diff --git a/.gitattributes b/.gitattributes index a6344aac8c09253b3b630fb776ae94478aa0275b..4f2ba7a7e346ba3dfcf3ee5d9596a548fb4452fc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,35 +1,2 @@ -*.7z filter=lfs diff=lfs merge=lfs -text -*.arrow filter=lfs diff=lfs merge=lfs -text -*.bin filter=lfs diff=lfs merge=lfs -text -*.bz2 filter=lfs diff=lfs merge=lfs -text -*.ckpt filter=lfs diff=lfs merge=lfs -text -*.ftz filter=lfs diff=lfs merge=lfs -text -*.gz filter=lfs diff=lfs merge=lfs -text -*.h5 filter=lfs diff=lfs merge=lfs -text -*.joblib filter=lfs diff=lfs merge=lfs -text -*.lfs.* filter=lfs diff=lfs merge=lfs -text -*.mlmodel filter=lfs diff=lfs merge=lfs -text -*.model filter=lfs diff=lfs merge=lfs -text -*.msgpack filter=lfs diff=lfs merge=lfs -text -*.npy filter=lfs diff=lfs merge=lfs -text -*.npz filter=lfs diff=lfs merge=lfs -text -*.onnx filter=lfs diff=lfs merge=lfs -text -*.ot filter=lfs diff=lfs merge=lfs -text -*.parquet filter=lfs diff=lfs merge=lfs -text -*.pb filter=lfs diff=lfs merge=lfs -text -*.pickle filter=lfs diff=lfs merge=lfs -text -*.pkl filter=lfs diff=lfs merge=lfs -text -*.pt filter=lfs diff=lfs merge=lfs -text -*.pth filter=lfs diff=lfs merge=lfs -text -*.rar filter=lfs diff=lfs merge=lfs -text -*.safetensors filter=lfs diff=lfs merge=lfs -text -saved_model/**/* filter=lfs diff=lfs merge=lfs -text -*.tar.* filter=lfs diff=lfs merge=lfs -text -*.tar filter=lfs diff=lfs merge=lfs -text -*.tflite filter=lfs diff=lfs merge=lfs -text -*.tgz filter=lfs diff=lfs merge=lfs -text -*.wasm filter=lfs diff=lfs merge=lfs -text -*.xz filter=lfs diff=lfs merge=lfs -text -*.zip filter=lfs diff=lfs merge=lfs -text -*.zst filter=lfs diff=lfs merge=lfs -text -*tfevents* filter=lfs diff=lfs merge=lfs -text +*.gif filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text \ No newline at end of file diff --git a/404.html b/404.html new file mode 100644 index 0000000000000000000000000000000000000000..cbd625ce2eefdc51a4f540fd365aa08d67976540 --- /dev/null +++ b/404.html @@ -0,0 +1 @@ +404: This page could not be found.MEDTRACE — Longitudinal Brain MRI

404

This page could not be found.

\ No newline at end of file diff --git a/404/index.html b/404/index.html new file mode 100644 index 0000000000000000000000000000000000000000..cbd625ce2eefdc51a4f540fd365aa08d67976540 --- /dev/null +++ b/404/index.html @@ -0,0 +1 @@ +404: This page could not be found.MEDTRACE — Longitudinal Brain MRI

404

This page could not be found.

\ No newline at end of file diff --git a/_next/static/3FTYk2NLW5nOk64NExprH/_buildManifest.js b/_next/static/3FTYk2NLW5nOk64NExprH/_buildManifest.js new file mode 100644 index 0000000000000000000000000000000000000000..963f6b2c975bbb76be3545e12099a4c3038fd2f0 --- /dev/null +++ b/_next/static/3FTYk2NLW5nOk64NExprH/_buildManifest.js @@ -0,0 +1 @@ +self.__BUILD_MANIFEST=function(e,r,t){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:2,errorRate:1e-4,numBits:39,numHashes:14,bitArray:[0,1,1,0,r,e,e,r,r,e,e,r,e,e,e,r,r,e,e,e,e,r,e,r,r,r,r,e,e,e,r,e,r,e,r,e,e,e,r]},__routerFilterDynamic:{numItems:r,errorRate:1e-4,numBits:r,numHashes:null,bitArray:[]},"/_error":["static/chunks/pages/_error-a8479a8c7bc399cf.js"],sortedPages:["/_app","/_error"]}}(1,0,1e-4),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/_next/static/3FTYk2NLW5nOk64NExprH/_ssgManifest.js b/_next/static/3FTYk2NLW5nOk64NExprH/_ssgManifest.js new file mode 100644 index 0000000000000000000000000000000000000000..5b3ff592fd46c8736892a12864fdf3fed8775202 --- /dev/null +++ b/_next/static/3FTYk2NLW5nOk64NExprH/_ssgManifest.js @@ -0,0 +1 @@ +self.__SSG_MANIFEST=new Set([]);self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB() \ No newline at end of file diff --git a/_next/static/DGlq7oEfmh1JjD6ikGNzk/_buildManifest.js b/_next/static/DGlq7oEfmh1JjD6ikGNzk/_buildManifest.js new file mode 100644 index 0000000000000000000000000000000000000000..963f6b2c975bbb76be3545e12099a4c3038fd2f0 --- /dev/null +++ b/_next/static/DGlq7oEfmh1JjD6ikGNzk/_buildManifest.js @@ -0,0 +1 @@ +self.__BUILD_MANIFEST=function(e,r,t){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:2,errorRate:1e-4,numBits:39,numHashes:14,bitArray:[0,1,1,0,r,e,e,r,r,e,e,r,e,e,e,r,r,e,e,e,e,r,e,r,r,r,r,e,e,e,r,e,r,e,r,e,e,e,r]},__routerFilterDynamic:{numItems:r,errorRate:1e-4,numBits:r,numHashes:null,bitArray:[]},"/_error":["static/chunks/pages/_error-a8479a8c7bc399cf.js"],sortedPages:["/_app","/_error"]}}(1,0,1e-4),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/_next/static/DGlq7oEfmh1JjD6ikGNzk/_ssgManifest.js b/_next/static/DGlq7oEfmh1JjD6ikGNzk/_ssgManifest.js new file mode 100644 index 0000000000000000000000000000000000000000..5b3ff592fd46c8736892a12864fdf3fed8775202 --- /dev/null +++ b/_next/static/DGlq7oEfmh1JjD6ikGNzk/_ssgManifest.js @@ -0,0 +1 @@ +self.__SSG_MANIFEST=new Set([]);self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB() \ No newline at end of file diff --git a/_next/static/chunks/139.8d54880d25bc452f.js b/_next/static/chunks/139.8d54880d25bc452f.js new file mode 100644 index 0000000000000000000000000000000000000000..fc5ac44246bc529f43fe58a6209f395c4cbc0b83 --- /dev/null +++ b/_next/static/chunks/139.8d54880d25bc452f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[139],{45139:(e,t,l)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return s}});let u=l(64252),n=l(37876),a=u._(l(14232)),o=l(1033);async function r(e){let{Component:t,ctx:l}=e;return{pageProps:await (0,o.loadGetInitialProps)(t,l)}}class s extends a.default.Component{render(){let{Component:e,pageProps:t}=this.props;return(0,n.jsx)(e,{...t})}}s.origGetInitialProps=r,s.getInitialProps=r,("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)}}]); \ No newline at end of file diff --git a/_next/static/chunks/141-d76cad12a8d5b9c5.js b/_next/static/chunks/141-d76cad12a8d5b9c5.js new file mode 100644 index 0000000000000000000000000000000000000000..ebcf65d3e3c9b32492e1208b3ab1d9c68c766128 --- /dev/null +++ b/_next/static/chunks/141-d76cad12a8d5b9c5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[141],{31668:(t,e,s)=>{s.d(e,{X:()=>o,k:()=>u});var i=s(34049),n=s(74268),r=s(93049),a=s(69781),o=class extends a.k{#t;#e;#s;#i;#n;#r;#a;constructor(t){super(),this.#a=!1,this.#r=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#i=t.client,this.#s=this.#i.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#t=h(this.options),this.state=t.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#n?.promise}setOptions(t){if(this.options={...this.#r,...t},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let t=h(this.options);void 0!==t.data&&(this.setData(t.data,{updatedAt:t.dataUpdatedAt,manual:!0}),this.#t=t)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#s.remove(this)}setData(t,e){let s=(0,i.pl)(this.state.data,t,this.options);return this.#o({data:s,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),s}setState(t,e){this.#o({type:"setState",state:t,setStateOptions:e})}cancel(t){let e=this.#n?.promise;return this.#n?.cancel(t),e?e.then(i.lQ).catch(i.lQ):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(t=>!1!==(0,i.Eh)(t.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===i.hT||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(t=>"static"===(0,i.d2)(t.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(t=0){return void 0===this.state.data||"static"!==t&&(!!this.state.isInvalidated||!(0,i.j3)(this.state.dataUpdatedAt,t))}onFocus(){let t=this.observers.find(t=>t.shouldFetchOnWindowFocus());t?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){let t=this.observers.find(t=>t.shouldFetchOnReconnect());t?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#n&&(this.#a?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#s.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(t,e){if("idle"!==this.state.fetchStatus&&this.#n?.status()!=="rejected"){if(void 0!==this.state.data&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(t&&this.setOptions(t),!this.options.queryFn){let t=this.observers.find(t=>t.options.queryFn);t&&this.setOptions(t.options)}let s=new AbortController,n=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(this.#a=!0,s.signal)})},a=()=>{let t=(0,i.ZM)(this.options,e),s=(()=>{let t={client:this.#i,queryKey:this.queryKey,meta:this.meta};return n(t),t})();return(this.#a=!1,this.options.persister)?this.options.persister(t,s,this):t(s)},o=(()=>{let t={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:a};return n(t),t})();this.options.behavior?.onFetch(o,this),this.#e=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#o({type:"fetch",meta:o.fetchOptions?.meta}),this.#n=(0,r.II)({initialPromise:e?.initialPromise,fn:o.fetchFn,onCancel:t=>{t instanceof r.cc&&t.revert&&this.setState({...this.#e,fetchStatus:"idle"}),s.abort()},onFail:(t,e)=>{this.#o({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{let t=await this.#n.start();if(void 0===t)throw Error(`${this.queryHash} data is undefined`);return this.setData(t),this.#s.config.onSuccess?.(t,this),this.#s.config.onSettled?.(t,this.state.error,this),t}catch(t){if(t instanceof r.cc){if(t.silent)return this.#n.promise;else if(t.revert){if(void 0===this.state.data)throw t;return this.state.data}}throw this.#o({type:"error",error:t}),this.#s.config.onError?.(t,this),this.#s.config.onSettled?.(this.state.data,t,this),t}finally{this.scheduleGc()}}#o(t){let e=e=>{switch(t.type){case"failed":return{...e,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...e,fetchStatus:"paused"};case"continue":return{...e,fetchStatus:"fetching"};case"fetch":return{...e,...u(e.data,this.options),fetchMeta:t.meta??null};case"success":let s={...e,data:t.data,dataUpdateCount:e.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#e=t.manual?s:void 0,s;case"error":let i=t.error;return{...e,error:i,errorUpdateCount:e.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:e.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...e,isInvalidated:!0};case"setState":return{...e,...t.state}}};this.state=e(this.state),n.jG.batch(()=>{this.observers.forEach(t=>{t.onQueryUpdate()}),this.#s.notify({query:this,type:"updated",action:t})})}};function u(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:(0,r.v_)(e.networkMode)?"fetching":"paused",...void 0===t&&{error:null,status:"pending"}}}function h(t){let e="function"==typeof t.initialData?t.initialData():t.initialData,s=void 0!==e,i=s?"function"==typeof t.initialDataUpdatedAt?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}},34049:(t,e,s)=>{s.d(e,{Cp:()=>y,EN:()=>f,Eh:()=>c,F$:()=>p,GU:()=>E,MK:()=>l,S$:()=>n,ZM:()=>j,ZZ:()=>F,Zw:()=>a,d2:()=>h,f8:()=>m,gn:()=>o,hT:()=>T,j3:()=>u,lQ:()=>r,nJ:()=>d,pl:()=>C,y9:()=>O,yy:()=>S});var i=s(37126),n="undefined"==typeof window||"Deno"in globalThis;function r(){}function a(t,e){return"function"==typeof t?t(e):t}function o(t){return"number"==typeof t&&t>=0&&t!==1/0}function u(t,e){return Math.max(t+(e||0)-Date.now(),0)}function h(t,e){return"function"==typeof t?t(e):t}function c(t,e){return"function"==typeof t?t(e):t}function l(t,e){let{type:s="all",exact:i,fetchStatus:n,predicate:r,queryKey:a,stale:o}=t;if(a){if(i){if(e.queryHash!==p(a,e.options))return!1}else if(!y(e.queryKey,a))return!1}if("all"!==s){let t=e.isActive();if("active"===s&&!t||"inactive"===s&&t)return!1}return("boolean"!=typeof o||e.isStale()===o)&&(!n||n===e.state.fetchStatus)&&(!r||!!r(e))}function d(t,e){let{exact:s,status:i,predicate:n,mutationKey:r}=t;if(r){if(!e.options.mutationKey)return!1;if(s){if(f(e.options.mutationKey)!==f(r))return!1}else if(!y(e.options.mutationKey,r))return!1}return(!i||e.state.status===i)&&(!n||!!n(e))}function p(t,e){return(e?.queryKeyHashFn||f)(t)}function f(t){return JSON.stringify(t,(t,e)=>g(e)?Object.keys(e).sort().reduce((t,s)=>(t[s]=e[s],t),{}):e)}function y(t,e){return t===e||typeof t==typeof e&&!!t&&!!e&&"object"==typeof t&&"object"==typeof e&&Object.keys(e).every(s=>y(t[s],e[s]))}var v=Object.prototype.hasOwnProperty;function m(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(let s in t)if(t[s]!==e[s])return!1;return!0}function b(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function g(t){if(!w(t))return!1;let e=t.constructor;if(void 0===e)return!0;let s=e.prototype;return!!w(s)&&!!s.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(t)===Object.prototype}function w(t){return"[object Object]"===Object.prototype.toString.call(t)}function S(t){return new Promise(e=>{i.zs.setTimeout(e,t)})}function C(t,e,s){return"function"==typeof s.structuralSharing?s.structuralSharing(t,e):!1!==s.structuralSharing?function t(e,s){if(e===s)return e;let i=b(e)&&b(s);if(!i&&!(g(e)&&g(s)))return s;let n=(i?e:Object.keys(e)).length,r=i?s:Object.keys(s),a=r.length,o=i?Array(a):{},u=0;for(let h=0;hs?i.slice(1):i}function F(t,e,s=0){let i=[e,...t];return s&&i.length>s?i.slice(0,-1):i}var T=Symbol();function j(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:t.queryFn&&t.queryFn!==T?t.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${t.queryHash}'`))}function E(t,e){return"function"==typeof t?t(...e):!!t}},37126:(t,e,s)=>{s.d(e,{Zq:()=>r,zs:()=>n});var i={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},n=new class{#u=i;#h=!1;setTimeoutProvider(t){this.#u=t}setTimeout(t,e){return this.#u.setTimeout(t,e)}clearTimeout(t){this.#u.clearTimeout(t)}setInterval(t,e){return this.#u.setInterval(t,e)}clearInterval(t){this.#u.clearInterval(t)}};function r(t){setTimeout(t,0)}},38445:(t,e,s)=>{s.d(e,{Q:()=>i});var i=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}},38559:(t,e,s)=>{s.d(e,{$:()=>o,s:()=>a});var i=s(74268),n=s(69781),r=s(93049),a=class extends n.k{#i;#c;#l;#n;constructor(t){super(),this.#i=t.client,this.mutationId=t.mutationId,this.#l=t.mutationCache,this.#c=[],this.state=t.state||o(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#c.includes(t)||(this.#c.push(t),this.clearGcTimeout(),this.#l.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#c=this.#c.filter(e=>e!==t),this.scheduleGc(),this.#l.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#c.length||("pending"===this.state.status?this.scheduleGc():this.#l.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(t){let e=()=>{this.#o({type:"continue"})},s={client:this.#i,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#n=(0,r.II)({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(Error("No mutationFn found")),onFail:(t,e)=>{this.#o({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#o({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#l.canRun(this)});let i="pending"===this.state.status,n=!this.#n.canStart();try{if(i)e();else{this.#o({type:"pending",variables:t,isPaused:n}),await this.#l.config.onMutate?.(t,this,s);let e=await this.options.onMutate?.(t,s);e!==this.state.context&&this.#o({type:"pending",context:e,variables:t,isPaused:n})}let r=await this.#n.start();return await this.#l.config.onSuccess?.(r,t,this.state.context,this,s),await this.options.onSuccess?.(r,t,this.state.context,s),await this.#l.config.onSettled?.(r,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(r,null,t,this.state.context,s),this.#o({type:"success",data:r}),r}catch(e){try{throw await this.#l.config.onError?.(e,t,this.state.context,this,s),await this.options.onError?.(e,t,this.state.context,s),await this.#l.config.onSettled?.(void 0,e,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(void 0,e,t,this.state.context,s),e}finally{this.#o({type:"error",error:e})}}finally{this.#l.runNext(this)}}#o(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),i.jG.batch(()=>{this.#c.forEach(e=>{e.onMutationUpdate(t)}),this.#l.notify({mutation:this,type:"updated",action:t})})}};function o(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},56195:(t,e,s)=>{s.d(e,{m:()=>r});var i=s(38445),n=s(34049),r=new class extends i.Q{#d;#p;#f;constructor(){super(),this.#f=t=>{if(!n.S$&&window.addEventListener){let e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#p||this.setEventListener(this.#f)}onUnsubscribe(){this.hasListeners()||(this.#p?.(),this.#p=void 0)}setEventListener(t){this.#f=t,this.#p?.(),this.#p=t(t=>{"boolean"==typeof t?this.setFocused(t):this.onFocus()})}setFocused(t){this.#d!==t&&(this.#d=t,this.onFocus())}onFocus(){let t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return"boolean"==typeof this.#d?this.#d:globalThis.document?.visibilityState!=="hidden"}}},63122:(t,e,s)=>{s.d(e,{t:()=>r});var i=s(38445),n=s(34049),r=new class extends i.Q{#y=!0;#p;#f;constructor(){super(),this.#f=t=>{if(!n.S$&&window.addEventListener){let e=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#p||this.setEventListener(this.#f)}onUnsubscribe(){this.hasListeners()||(this.#p?.(),this.#p=void 0)}setEventListener(t){this.#f=t,this.#p?.(),this.#p=t(this.setOnline.bind(this))}setOnline(t){this.#y!==t&&(this.#y=t,this.listeners.forEach(e=>{e(t)}))}isOnline(){return this.#y}}},69781:(t,e,s)=>{s.d(e,{k:()=>r});var i=s(37126),n=s(34049),r=class{#v;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),(0,n.gn)(this.gcTime)&&(this.#v=i.zs.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(n.S$?1/0:3e5))}clearGcTimeout(){this.#v&&(i.zs.clearTimeout(this.#v),this.#v=void 0)}}},74268:(t,e,s)=>{s.d(e,{jG:()=>n});var i=s(37126).Zq,n=function(){let t=[],e=0,s=t=>{t()},n=t=>{t()},r=i,a=i=>{e?t.push(i):r(()=>{s(i)})};return{batch:i=>{let a;e++;try{a=i()}finally{--e||(()=>{let e=t;t=[],e.length&&r(()=>{n(()=>{e.forEach(t=>{s(t)})})})})()}return a},batchCalls:t=>(...e)=>{a(()=>{t(...e)})},schedule:a,setNotifyFunction:t=>{s=t},setBatchNotifyFunction:t=>{n=t},setScheduler:t=>{r=t}}}()},83515:(t,e,s)=>{s.d(e,{T:()=>i});function i(){let t,e,s=new Promise((s,i)=>{t=s,e=i});function i(t){Object.assign(s,t),delete s.resolve,delete s.reject}return s.status="pending",s.catch(()=>{}),s.resolve=e=>{i({status:"fulfilled",value:e}),t(e)},s.reject=t=>{i({status:"rejected",reason:t}),e(t)},s}},93049:(t,e,s)=>{s.d(e,{II:()=>c,cc:()=>h,v_:()=>u});var i=s(56195),n=s(63122),r=s(83515),a=s(34049);function o(t){return Math.min(1e3*2**t,3e4)}function u(t){return(t??"online")!=="online"||n.t.isOnline()}var h=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function c(t){let e,s=!1,c=0,l=(0,r.T)(),d=()=>i.m.isFocused()&&("always"===t.networkMode||n.t.isOnline())&&t.canRun(),p=()=>u(t.networkMode)&&t.canRun(),f=t=>{"pending"===l.status&&(e?.(),l.resolve(t))},y=t=>{"pending"===l.status&&(e?.(),l.reject(t))},v=()=>new Promise(s=>{e=t=>{("pending"!==l.status||d())&&s(t)},t.onPause?.()}).then(()=>{e=void 0,"pending"===l.status&&t.onContinue?.()}),m=()=>{let e;if("pending"!==l.status)return;let i=0===c?t.initialPromise:void 0;try{e=i??t.fn()}catch(t){e=Promise.reject(t)}Promise.resolve(e).then(f).catch(e=>{if("pending"!==l.status)return;let i=t.retry??3*!a.S$,n=t.retryDelay??o,r="function"==typeof n?n(c,e):n,u=!0===i||"number"==typeof i&&cd()?void 0:v()).then(()=>{s?y(e):m()})})};return{promise:l,status:()=>l.status,cancel:e=>{if("pending"===l.status){let s=new h(e);y(s),t.onCancel?.(s)}},continue:()=>(e?.(),l),cancelRetry:()=>{s=!0},continueRetry:()=>{s=!1},canStart:p,start:()=>(p()?m():v().then(m),l)}}},99776:(t,e,s)=>{s.d(e,{Ht:()=>o,jE:()=>a});var i=s(12115),n=s(95155),r=i.createContext(void 0),a=t=>{let e=i.useContext(r);if(t)return t;if(!e)throw Error("No QueryClient set, use QueryClientProvider to set one");return e},o=t=>{let{client:e,children:s}=t;return i.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,n.jsx)(r.Provider,{value:e,children:s})}}}]); \ No newline at end of file diff --git a/_next/static/chunks/156-38979c8018e9e56b.js b/_next/static/chunks/156-38979c8018e9e56b.js new file mode 100644 index 0000000000000000000000000000000000000000..65cca5441a77abc519dfcdcd8f78a2cdacb134d1 --- /dev/null +++ b/_next/static/chunks/156-38979c8018e9e56b.js @@ -0,0 +1,157 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[156],{894:(e,t,n)=>{"use strict";n.d(t,{A:()=>D});var i,a=n(85839),r=n(70192),o=n(82006),s=n(11492),l=n(97442),d=n(59998),c=n(10353),h=n(34699),u=n(73904),g=n(17964),p=n(78378),m=n(34470),f=n(41918),v=n(77047),I=n(4101),_=n(60212),w=n(69340),b=n(29544),C=n(46704),A=n(83048),E=n(68764),M=n(17167);let{transformWorldToIndex:y,transformWorldToIndexContinuous:S}=r.BF;class T extends a.EC{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{storePointData:!1,shadow:!0,preventHandleOutsideImage:!1,calculateStats:!0,getTextLines:M.d6,statsCalculator:A.OA,targetsFilter:a.F6.allPixelData}}){super(e,t),this.addNewAnnotation=e=>{let{currentPoints:t,element:n}=e.detail,i=t.world,{viewport:a}=(0,r.kJ)(n);this.isDrawing=!0;let o=this.constructor.createAnnotationForViewport(a,{data:{handles:{points:[[...i],[...i],[...i],[...i]],textBox:{hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}}},cachedStats:{}}});(0,l.lC)(o,n);let s=(0,m.Q0)(n,this.getToolName());return this.editData={annotation:o,viewportIdsToRender:s,handleIndex:3,movingTextBox:!1,newAnnotation:!0,hasMoved:!1},this._activateDraw(n),(0,I.lY)(n),e.preventDefault(),(0,_.A)(s),o},this.isPointNearTool=(e,t,n,i)=>{let{viewport:a}=(0,r.kJ)(e),{data:o}=t,{points:s}=o.handles,l=a.worldToCanvas(s[0]),d=a.worldToCanvas(s[3]),c=this._getRectangleImageCoordinates([l,d]),h=[n[0],n[1]],{left:u,top:g,width:p,height:m}=c;return v.A([u,g,p,m],h)<=i},this.toolSelectedCallback=(e,t)=>{let{element:n}=e.detail;t.highlighted=!0;let i=(0,m.Q0)(n,this.getToolName());this.editData={annotation:t,viewportIdsToRender:i,movingTextBox:!1},this._activateModify(n),(0,I.lY)(n),(0,_.A)(i),e.preventDefault()},this.handleSelectedCallback=(e,t,n)=>{let i,{element:a}=e.detail,{data:r}=t;t.highlighted=!0;let o=!1;n.worldPosition?o=!0:i=r.handles.points.findIndex(e=>e===n);let s=(0,m.Q0)(a,this.getToolName());this.editData={annotation:t,viewportIdsToRender:s,handleIndex:i,movingTextBox:o},this._activateModify(a),(0,I.lY)(a),(0,_.A)(s),e.preventDefault()},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:i,newAnnotation:a,hasMoved:r}=this.editData,{data:o}=n;(!a||r)&&(o.handles.activeHandleIndex=null,this._deactivateModify(t),this._deactivateDraw(t),(0,I.Q_)(t),this.doneEditMemo(),this.editData=null,this.isDrawing=!1,this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,l.O8)(n.annotationUID),(0,_.A)(i),a&&(0,h.triggerAnnotationCompleted)(n))},this._dragCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{annotation:i,viewportIdsToRender:a,handleIndex:o,movingTextBox:s,newAnnotation:l}=this.editData;this.createMemo(n,i,{newAnnotation:l});let{data:d}=i;if(s){let{deltaPoints:e}=t,n=e.world,{textBox:i}=d.handles,{worldPosition:a}=i;a[0]+=n[0],a[1]+=n[1],a[2]+=n[2],i.hasMoved=!0}else if(void 0===o){let{deltaPoints:e}=t,n=e.world,{points:a}=d.handles;a.forEach(e=>{e[0]+=n[0],e[1]+=n[1],e[2]+=n[2]}),i.invalidated=!0}else{let e,a,s,l,c,h,u,g,{currentPoints:p}=t,{worldToCanvas:m,canvasToWorld:f}=(0,r.kJ)(n).viewport,v=p.world,{points:I}=d.handles;switch(I[o]=[...v],o){case 0:case 3:e=m(I[0]),a=[(l=m(I[3]))[0],e[1]],s=[e[0],l[1]],h=f(a),u=f(s),I[1]=h,I[2]=u;break;case 1:case 2:a=m(I[1]),e=[(s=m(I[2]))[0],a[1]],l=[a[0],s[1]],c=f(e),g=f(l),I[0]=c,I[3]=g}i.invalidated=!0}this.editData.hasMoved=!0,(0,r.kJ)(n),(0,_.A)(a),i.invalidated&&(0,h.triggerAnnotationModified)(i,n,p.wi.HandlesUpdated)},this.cancel=e=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateDraw(e),this._deactivateModify(e),(0,I.Q_)(e);let{annotation:t,viewportIdsToRender:n,newAnnotation:i}=this.editData,{data:a}=t;return t.highlighted=!1,a.handles.activeHandleIndex=null,(0,_.A)(n),i&&(0,h.triggerAnnotationCompleted)(t),this.editData=null,t.annotationUID}},this._activateDraw=e=>{g.wk.isInteractingWithTool=!0,e.addEventListener(p.sV.MOUSE_UP,this._endCallback),e.addEventListener(p.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(p.sV.MOUSE_MOVE,this._dragCallback),e.addEventListener(p.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(p.sV.TOUCH_END,this._endCallback),e.addEventListener(p.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(p.sV.TOUCH_TAP,this._endCallback)},this._deactivateDraw=e=>{g.wk.isInteractingWithTool=!1,e.removeEventListener(p.sV.MOUSE_UP,this._endCallback),e.removeEventListener(p.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(p.sV.MOUSE_MOVE,this._dragCallback),e.removeEventListener(p.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(p.sV.TOUCH_END,this._endCallback),e.removeEventListener(p.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(p.sV.TOUCH_TAP,this._endCallback)},this._activateModify=e=>{g.wk.isInteractingWithTool=!0,e.addEventListener(p.sV.MOUSE_UP,this._endCallback),e.addEventListener(p.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(p.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(p.sV.TOUCH_END,this._endCallback),e.addEventListener(p.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(p.sV.TOUCH_TAP,this._endCallback)},this._deactivateModify=e=>{g.wk.isInteractingWithTool=!1,e.removeEventListener(p.sV.MOUSE_UP,this._endCallback),e.removeEventListener(p.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(p.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(p.sV.TOUCH_END,this._endCallback),e.removeEventListener(p.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(p.sV.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(e,t)=>{let n=!1,{viewport:i}=e,{element:a}=i,o=(0,l.Rh)(this.getToolName(),a);if(!o?.length||(o=this.filterInteractableAnnotationsForElement(a,o),!o?.length))return n;let s=i.getRenderingEngine(),h={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let a=0;ai.worldToCanvas(e)),w=this.getMeasurementTargets(i,m);h.annotationUID=p;let{color:C,lineWidth:A,lineDash:M}=this.getAnnotationStyle({annotation:g,styleSpecifier:h}),{viewPlaneNormal:y,viewUp:S}=(0,f.A)(i);if(this.ensureCachedStatsTargets(m,w,e=>null==e.areaUnit))this._calculateCachedStats(g,y,S,e);else if(g.invalidated&&(this._throttledCalculateCachedStats(g,y,S,e),i instanceof r.PX)){let{referencedImageId:e}=g.metadata;for(let t in m.cachedStats)t.startsWith("imageId")&&s.getViewports().filter(b.hz).find(t=>{let n=r.BF.imageIdToURI(e),i=t.hasImageURI(n),a=r.BF.imageIdToURI(t.getCurrentImageId());return i&&a!==n})&&delete m.cachedStats[t]}if(!i.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}if(!(0,c.YY)(p))continue;(0,d.Gh)(p)||this.editData||null==I||(l=[_[I]]);let T=!!(0,E.h)("showHandlesAlways",{});(l||T)&&(0,u.qX)(t,p,"0",T?_:l,{color:C});let D=`${p}-rect`;(0,u.pJ)(t,p,"0",_,{color:C,lineDash:M,lineWidth:A},D),n=!0;let P=this.configuration.getTextLines(m,w);if(P?.length&&!this.renderLinkedTextBoxAnnotation({enabledElement:e,svgDrawingHelper:t,annotation:g,styleSpecifier:h,textLines:P,canvasCoordinates:_}))continue}return n},this._getRectangleImageCoordinates=e=>{let[t,n]=e;return{left:Math.min(t[0],n[0]),top:Math.min(t[1],n[1]),width:Math.abs(t[0]-n[0]),height:Math.abs(t[1]-n[1])}},this._calculateCachedStats=(e,t,n,a)=>{if(!this.configuration.calculateStats)return;let{data:r}=e,{viewport:s}=a,{element:l}=s,d=r.handles.points,{cachedStats:c}=r;if(e.invalidated){let e=this.getMeasurementTargets(s,r);for(let e of Object.keys(c))delete c[e];this.ensureCachedStatsTargets(r,e)}let u=Object.keys(c),g=!1;for(let t=0;tS(l,e)),f=y(l,d[0]),v=y(l,d[3]),I=!this._isInsideVolume(f,v,r);if(g||=I,I)c[n]={Modality:h.Modality};else{let t,r=Math.min(f[0],v[0]),d=Math.max(f[0],v[0]),u=Math.min(f[1],v[1]),g=Math.max(f[1],v[1]),I=[[r,d],[u,g],[Math.min(f[2],v[2]),Math.max(f[2],v[2])]],_=[f,v],b=(0,o.Op)(a,_),A=Math.abs(i.calculateLengthInIndex(b,[m[0],m[1]])*i.calculateLengthInIndex(b,[m[0],m[2]])),{areaUnit:E}=b,M={isPreScaled:(0,C.u)(s,n),isSuvScaled:this.isSuvScaled(s,n,e.metadata.referencedImageId)},y=(0,w.j)(h.Modality,e.metadata.referencedImageId,M);p&&(t=p.forEach(this.configuration.statsCalculator.statsCallback,{boundsIJK:I,imageData:l,returnPoints:this.configuration.storePointData}));let S=this.configuration.statsCalculator.getStatistics();c[n]={Modality:h.Modality,area:A,mean:S.mean?.value,stdDev:S.stdDev?.value,max:S.max?.value,min:S.min?.value,statsArray:S.array,pointsInShape:t,areaUnit:E,modalityUnit:y}}}this.isHandleOutsideImage=g;let m=e.invalidated;return e.invalidated=!1,m&&(0,h.triggerAnnotationModified)(e,l,p.wi.StatsUpdated),c},this._isInsideVolume=(e,t,n)=>r.BF.indexWithinDimensions(e,n)&&r.BF.indexWithinDimensions(t,n),this._throttledCalculateCachedStats=(0,s.A)(this._calculateCachedStats,100,{trailing:!0})}}i=T,T.toolName="RectangleROI",T.hydrate=(e,t,n)=>{let a=(0,r.yj)(e);if(!a)return;let{FrameOfReferenceUID:o,referencedImageId:s,viewPlaneNormal:d,instance:c,viewport:h}=i.hydrateBase(i,a,t,n),{toolInstance:u,...g}=n||{},p={annotationUID:n?.annotationUID||r.BF.uuidv4(),data:{handles:{points:t,activeHandleIndex:null},label:"",cachedStats:{}},highlighted:!1,autoGenerated:!1,invalidated:!1,isLocked:!1,isVisible:!0,metadata:{toolName:c.getToolName(),viewPlaneNormal:d,FrameOfReferenceUID:o,referencedImageId:s,...g}};(0,l.lC)(p,h.element),(0,_.A)([h.id])};let D=T},1150:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return l}});let i=n(95155),a=n(12115),r=n(24437);function o(e){return{default:e&&"default"in e?e.default:e}}n(36552);let s={loader:()=>Promise.resolve(o(()=>null)),loading:null,ssr:!0},l=function(e){let t={...s,...e},n=(0,a.lazy)(()=>t.loader().then(o)),l=t.loading;function d(e){let o=l?(0,i.jsx)(l,{isLoading:!0,pastDelay:!0,error:null}):null,s=!t.ssr||!!t.loading,d=s?a.Suspense:a.Fragment,c=t.ssr?(0,i.jsxs)(i.Fragment,{children:[null,(0,i.jsx)(n,{...e})]}):(0,i.jsx)(r.BailoutToCSR,{reason:"next/dynamic",children:(0,i.jsx)(n,{...e})});return(0,i.jsx)(d,{...s?{fallback:o}:{},children:c})}return d.displayName="LoadableComponent",d}},2468:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var i=n(21167);function a(e){let t=(0,i.A)(e);if(t?.length)return t.find(t=>t.getImageIds().some(t=>t===e.metadata.referencedImageId))??t[0]}},2821:(e,t,n)=>{"use strict";function i(){for(var e,t,n=0,i="",a=arguments.length;ni})},3533:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>c});var i=n(17042),a=n(58804),r=n(54914),o=n(66888),s=n(85250),l={mapper:null,forceOpaque:!1,forceTranslucent:!1};function d(e,t,n={}){Object.assign(t,l,n),r.Ay.extend(e,t,n),t.boundsMTime={},i.Ay.obj(t.boundsMTime),i.Ay.setGet(e,t,["mapper","forceOpaque","forceTranslucent"]),t.classHierarchy.push("vtkImageSlice"),e.getActors=()=>e,e.getImages=()=>e,e.getIsOpaque=()=>{if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.properties[0]||e.getProperty();let n=t.properties[0].getOpacity()>=1;return n&&(!t.mapper||t.mapper.getIsOpaque())},e.hasTranslucentPolygonalGeometry=()=>!1,e.makeProperty=o.Ay.newInstance,e.getBoundsForSlice=(n,i)=>{let r=t.mapper.getBoundsForSlice(n,i);if(!a.Ay.isValid(r))return r;e.computeMatrix();let o=new Float64Array(16);return s.transpose(o,t.matrix),a.Ay.transformBounds(r,o)},e.getMinXBound=()=>e.getBoundsByReference()[0],e.getMaxXBound=()=>e.getBoundsByReference()[1],e.getMinYBound=()=>e.getBoundsByReference()[2],e.getMaxYBound=()=>e.getBoundsByReference()[3],e.getMinZBound=()=>e.getBoundsByReference()[4],e.getMaxZBound=()=>e.getBoundsByReference()[5],e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),e=(n=t.mapper.getInput().getMTime())>e?n:e)}return t.properties.forEach(t=>{e=Math.max(e,t.getMTime());let n=t.getRGBTransferFunction();null!==n&&(e=Math.max(e,n.getMTime()))}),e},e.getSupportsSelection=()=>!!t.mapper&&t.mapper.getSupportsSelection()}var c={newInstance:i.Ay.newInstance(d,"vtkImageSlice"),extend:d}},4055:(e,t,n)=>{"use strict";n.d(t,{I:()=>r,h:()=>a});let i=new Map;function a(e,t){i.set(e,t)}function r(e){return i.get(e)}},4101:(e,t,n)=>{"use strict";n.d(t,{Q_:()=>s,lY:()=>l,pD:()=>r});var i=n(29010);let a=Symbol("ElementCursorsMap");function r(e,t){d(e)[0]=t,o(e,t)}function o(e,t){let n=d(e);n[1]=n[0],n[0]=t,e.style.cursor=(t instanceof i.A?t:i.A.getDefinedCursor("auto")).getStyleProperty()}function s(e){o(e,d(e)[1])}function l(e){o(e,i.A.getDefinedCursor("none"))}function d(e){let t=d[a];t instanceof WeakMap||Object.defineProperty(d,a,{value:t=new WeakMap});let n=t.get(e);return n||(n=[null,null],t.set(e,n)),n}},5068:(e,t,n)=>{"use strict";n.d(t,{B:()=>a});var i=n(43385);function a(e){let t=(0,i.T)(e);if(!t)return;let n=t.representationData?.Contour;if(!n)return;let{annotationUIDsMap:a}=n;if(a)return a}},5434:(e,t,n)=>{"use strict";n.d(t,{Bw:()=>u,C:()=>s,Cc:()=>f,Om:()=>m,Re:()=>c,S8:()=>p,WQ:()=>d,Z0:()=>v,aI:()=>_,fA:()=>o,hZ:()=>l,hs:()=>h,m3:()=>g,o8:()=>r,t2:()=>I,vt:()=>a});var i=n(97633);function a(){var e=new i.tb(4);return i.tb!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function r(e){var t=new i.tb(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function o(e,t,n,a){var r=new i.tb(4);return r[0]=e,r[1]=t,r[2]=n,r[3]=a,r}function s(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function l(e,t,n,i,a){return e[0]=t,e[1]=n,e[2]=i,e[3]=a,e}function d(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function c(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}function h(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function u(e){return Math.hypot(e[0],e[1],e[2],e[3])}function g(e){var t=e[0],n=e[1],i=e[2],a=e[3];return t*t+n*n+i*i+a*a}function p(e,t){var n=t[0],i=t[1],a=t[2],r=t[3],o=n*n+i*i+a*a+r*r;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=i*o,e[2]=a*o,e[3]=r*o,e}function m(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function f(e,t,n,i){var a=t[0],r=t[1],o=t[2],s=t[3];return e[0]=a+i*(n[0]-a),e[1]=r+i*(n[1]-r),e[2]=o+i*(n[2]-o),e[3]=s+i*(n[3]-s),e}function v(e,t,n){var i=t[0],a=t[1],r=t[2],o=t[3];return e[0]=n[0]*i+n[4]*a+n[8]*r+n[12]*o,e[1]=n[1]*i+n[5]*a+n[9]*r+n[13]*o,e[2]=n[2]*i+n[6]*a+n[10]*r+n[14]*o,e[3]=n[3]*i+n[7]*a+n[11]*r+n[15]*o,e}function I(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function _(e,t){var n=e[0],a=e[1],r=e[2],o=e[3],s=t[0],l=t[1],d=t[2],c=t[3];return Math.abs(n-s)<=i.p8*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(a-l)<=i.p8*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(r-d)<=i.p8*Math.max(1,Math.abs(r),Math.abs(d))&&Math.abs(o-c)<=i.p8*Math.max(1,Math.abs(o),Math.abs(c))}a()},5469:(e,t,n)=>{"use strict";n.d(t,{T8:()=>d,aF:()=>l,vl:()=>s});var i=n(32207),a=n(43385),r=n(46702),o=n(66442);function s(e,t){let n=l(e,t);if(!n?.length)return;if(1===n.length)return n[0];let i=(0,a.T)(t),s=(0,r.Q)(t),d=s?(0,o.r)(i,s):void 0;return d?.imageIds?.length?n.find(e=>d.imageIds.includes(e))??n[0]:n[0]}function l(e,t){return i._6.getCurrentLabelmapImageIdsForViewport(e,t)}function d(e,t){return i._6.getLabelmapImageIdsForImageId(e,t)}},5966:(e,t,n)=>{"use strict";n.d(t,{A:()=>M});var i,a=n(50923),r=n(91336),o=n(70192),s=n(82006),l=n(85839),d=n(11492),c=n(93022),h=n(59998),u=n(10353),g=n(34699),p=n(73904),m=n(17964),f=n(78378),v=n(34470),I=n(10458),_=n(16857),w=n(4101),b=n(60212),C=n(68764);class A extends l.EC{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{preventHandleOutsideImage:!1,getTextLines:E}}){super(e,t),this.isPointNearTool=(e,t,n,i)=>{let{viewport:a}=(0,o.kJ)(e),{data:r}=t,{points:s}=r.handles,l=a.worldToCanvas(s[0]),d=a.worldToCanvas(s[1]),c={start:{x:l[0],y:l[1]},end:{x:d[0],y:d[1]}},h=I.A([c.start.x,c.start.y],[c.end.x,c.end.y],[n[0],n[1]]);return h<=i||(l=a.worldToCanvas(s[2]),d=a.worldToCanvas(s[3]),c={start:{x:l[0],y:l[1]},end:{x:d[0],y:d[1]}},(h=I.A([c.start.x,c.start.y],[c.end.x,c.end.y],[n[0],n[1]]))<=i)},this.toolSelectedCallback=(e,t)=>{let{element:n}=e.detail;t.highlighted=!0;let i=(0,v.Q0)(n,this.getToolName());this.editData={annotation:t,viewportIdsToRender:i,movingTextBox:!1},this._activateModify(n);let{renderingEngine:a}=(0,o.kJ)(n);(0,b.A)(i),(0,w.lY)(n),e.preventDefault()},this.handleSelectedCallback=(e,t,n)=>{let i,{element:a}=e.detail,r=t.data;t.highlighted=!0;let s=!1;n.worldPosition?s=!0:i=r.handles.points.findIndex(e=>e===n);let l=(0,v.Q0)(a,this.getToolName());(0,w.lY)(a),this.editData={annotation:t,viewportIdsToRender:l,handleIndex:i,movingTextBox:s},this._activateModify(a);let{renderingEngine:d}=(0,o.kJ)(a);(0,b.A)(l),e.preventDefault()},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:i,newAnnotation:s,hasMoved:l}=this.editData,{data:d}=n;if(s&&!l)return;this.doneEditMemo(),d.handles.activeHandleIndex=null,this._deactivateModify(t),this._deactivateDraw(t),(0,w.Q_)(t);let{renderingEngine:h}=(0,o.kJ)(t);if(void 0!==this.editData.handleIndex){let{points:e}=d.handles,t=a.Io(e[0],e[1]);if(a.Io(e[2],e[3])>t){let t,n=[[...e[2]],[...e[3]]],i=[...e[0]],a=[...e[1]],o=r.vt();r.hZ(o,n[1][0]-n[0][0],n[1][1]-n[1][0]);let s=r.vt();r.hZ(s,-o[1],o[0]);let l=r.vt();r.hZ(l,a[0]-i[0],a[1]-i[0]),t=r.Om(l,s)>0?[i,a]:[a,i],d.handles.points=[n[0],n[1],t[0],t[1]]}}this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,c.removeAnnotation)(n.annotationUID),(0,b.A)(i),s&&(0,g.triggerAnnotationCompleted)(n),this.editData=null,this.isDrawing=!1},this._dragDrawCallback=e=>{this.isDrawing=!0;let{currentPoints:t,element:n}=e.detail,{viewport:i}=(0,o.kJ)(n),{worldToCanvas:a}=i,{annotation:s,viewportIdsToRender:l,handleIndex:d,newAnnotation:c}=this.editData;this.createMemo(n,s,{newAnnotation:c});let{data:h}=s,u=t.world;h.handles.points[d]=[...u];let p=h.handles.points.map(a),m={longLineSegment:{start:{x:p[0][0],y:p[0][1]},end:{x:p[1][0],y:p[1][1]}},shortLineSegment:{start:{x:p[2][0],y:p[2][1]},end:{x:p[3][0],y:p[3][1]}}},v=r.Io(p[0],p[1])/3,I=m.longLineSegment.start.x-m.longLineSegment.end.x,_=m.longLineSegment.start.y-m.longLineSegment.end.y,w=Math.sqrt(I*I+_*_),C=I/w,A=_/w,E=(m.longLineSegment.start.x+m.longLineSegment.end.x)/2,M=(m.longLineSegment.start.y+m.longLineSegment.end.y)/2;h.handles.points[2]=i.canvasToWorld([E+v*A,M-v*C]),h.handles.points[3]=i.canvasToWorld([E-v*A,M+v*C]),s.invalidated=!0,(0,b.A)(l),(0,g.triggerAnnotationModified)(s,n,f.wi.HandlesUpdated),this.editData.hasMoved=!0},this._dragModifyCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{annotation:i,viewportIdsToRender:a,handleIndex:r,movingTextBox:o,newAnnotation:s}=this.editData;this.createMemo(n,i,{newAnnotation:s});let{data:l}=i;if(o){let{deltaPoints:e}=t,n=e.world,{textBox:i}=l.handles,{worldPosition:a}=i;a[0]+=n[0],a[1]+=n[1],a[2]+=n[2],i.hasMoved=!0}else if(void 0===r){let{deltaPoints:e}=t,n=e.world;l.handles.points.forEach(e=>{e[0]+=n[0],e[1]+=n[1],e[2]+=n[2]}),i.invalidated=!0}else this._dragModifyHandle(e),i.invalidated=!0;(0,b.A)(a),i.invalidated&&(0,g.triggerAnnotationModified)(i,n,f.wi.HandlesUpdated)},this._dragModifyHandle=e=>{let{currentPoints:t,element:n}=e.detail,{viewport:i}=(0,o.kJ)(n),{annotation:a,handleIndex:s}=this.editData,{data:l}=a,d=t.world,c=[i.worldToCanvas(l.handles.points[0]),i.worldToCanvas(l.handles.points[1]),i.worldToCanvas(l.handles.points[2]),i.worldToCanvas(l.handles.points[3])],h={start:{x:c[0][0],y:c[0][1]},end:{x:c[1][0],y:c[1][1]}},u={start:{x:c[2][0],y:c[2][1]},end:{x:c[3][0],y:c[3][1]}},g=[...d],p=i.worldToCanvas(g);if(0===s||1===s){let e=c[+(0===s)],t=r.hZ(r.vt(),p[0]-e[0],p[1]-e[1]),n=r.hZ(r.vt(),c[s][0]-e[0],c[s][1]-e[1]);r.S8(t,t),r.S8(n,n);let a={start:{x:e[0],y:e[1]},end:{x:p[0],y:p[1]}};if(this._movingLongAxisWouldPutItThroughShortAxis(a,u))return;let o=this._getSignedAngle(n,t),d=c[2][0],h=c[2][1],m=c[3][0],f=c[3][1];d-=e[0],h-=e[1],m-=e[0],f-=e[1];let v=d*Math.cos(o)-h*Math.sin(o),I=d*Math.sin(o)+h*Math.cos(o),_=m*Math.cos(o)-f*Math.sin(o),w=m*Math.sin(o)+f*Math.cos(o);d=v+e[0],h=I+e[1],m=_+e[0],f=w+e[1];let b=i.canvasToWorld([d,h]),C=i.canvasToWorld([m,f]);l.handles.points[s]=g,l.handles.points[2]=b,l.handles.points[3]=C}else{let e=2===s?3:2,t={longLineSegment:{start:h.start,end:h.end},shortLineSegment:{start:u.start,end:u.end}},n=r.Re(r.vt(),[t.longLineSegment.end.x,t.longLineSegment.end.y],[t.longLineSegment.start.x,t.longLineSegment.start.y]),a=r.S8(r.vt(),n),o=r.Re(r.vt(),[p[0],p[1]],[c[s][0],c[s][1]]),d=r.Bw(o),m=Math.cos(this._getSignedAngle(a,o))*d,f=r.Ln(r.vt(),[c[e][0],c[e][1]],a,m);if(this._movingLongAxisWouldPutItThroughShortAxis({start:{x:p[0],y:p[1]},end:{x:f[0],y:f[1]}},{start:{x:t.longLineSegment.start.x,y:t.longLineSegment.start.y},end:{x:t.longLineSegment.end.x,y:t.longLineSegment.end.y}})||!_.A([p[0],p[1]],[f[0],f[1]],[h.start.x,h.start.y],[h.end.x,h.end.y]))return;l.handles.points[e]=i.canvasToWorld(f),l.handles.points[s]=g}},this.cancel=e=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateDraw(e),this._deactivateModify(e),(0,w.Q_)(e);let{annotation:t,viewportIdsToRender:n,newAnnotation:i}=this.editData,{data:a}=t;return t.highlighted=!1,a.handles.activeHandleIndex=null,(0,b.A)(n),i&&(0,g.triggerAnnotationCompleted)(t),this.editData=null,t.annotationUID}},this._activateDraw=e=>{m.wk.isInteractingWithTool=!0,e.addEventListener(f.sV.MOUSE_UP,this._endCallback),e.addEventListener(f.sV.MOUSE_DRAG,this._dragDrawCallback),e.addEventListener(f.sV.MOUSE_MOVE,this._dragDrawCallback),e.addEventListener(f.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(f.sV.TOUCH_TAP,this._endCallback),e.addEventListener(f.sV.TOUCH_END,this._endCallback),e.addEventListener(f.sV.TOUCH_DRAG,this._dragDrawCallback)},this._deactivateDraw=e=>{m.wk.isInteractingWithTool=!1,e.removeEventListener(f.sV.MOUSE_UP,this._endCallback),e.removeEventListener(f.sV.MOUSE_DRAG,this._dragDrawCallback),e.removeEventListener(f.sV.MOUSE_MOVE,this._dragDrawCallback),e.removeEventListener(f.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(f.sV.TOUCH_TAP,this._endCallback),e.removeEventListener(f.sV.TOUCH_END,this._endCallback),e.removeEventListener(f.sV.TOUCH_DRAG,this._dragDrawCallback)},this._activateModify=e=>{m.wk.isInteractingWithTool=!0,e.addEventListener(f.sV.MOUSE_UP,this._endCallback),e.addEventListener(f.sV.MOUSE_DRAG,this._dragModifyCallback),e.addEventListener(f.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(f.sV.TOUCH_END,this._endCallback),e.addEventListener(f.sV.TOUCH_DRAG,this._dragModifyCallback),e.addEventListener(f.sV.TOUCH_TAP,this._endCallback)},this._deactivateModify=e=>{m.wk.isInteractingWithTool=!1,e.removeEventListener(f.sV.MOUSE_UP,this._endCallback),e.removeEventListener(f.sV.MOUSE_DRAG,this._dragModifyCallback),e.removeEventListener(f.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(f.sV.TOUCH_END,this._endCallback),e.removeEventListener(f.sV.TOUCH_DRAG,this._dragModifyCallback),e.removeEventListener(f.sV.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(e,t)=>{let n=!0,{viewport:i}=e,{element:a}=i,r=(0,c.getAnnotations)(this.getToolName(),a);if(!r?.length||(r=this.filterInteractableAnnotationsForElement(a,r),!r?.length))return n;let o=this.getTargetId(i),s=i.getRenderingEngine(),l={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let a=0;ai.worldToCanvas(e));l.annotationUID=g;let{color:_,lineWidth:w,lineDash:b,shadow:A}=this.getAnnotationStyle({annotation:c,styleSpecifier:l});if(m.cachedStats[o]&&null!=m.cachedStats[o].unit?c.invalidated&&this._throttledCalculateCachedStats(c,s,e):(m.cachedStats[o]={length:null,width:null,unit:null},this._calculateCachedStats(c,s,e)),!i.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}if(!(0,u.YY)(g))continue;(0,h.Gh)(g)||this.editData||null===v||(d=[I[v]]);let E=!!(0,C.h)("showHandlesAlways",{});(d||E)&&(0,p.qX)(t,g,"0",E?I:d,{color:_});let M=`${g}-line-1`,y=`${g}-line-2`;(0,p.V6)(t,g,"0",I[0],I[1],{color:_,lineDash:b,lineWidth:w,shadow:A},M),(0,p.V6)(t,g,"1",I[2],I[3],{color:_,lineDash:b,lineWidth:w,shadow:A},y),n=!0;let S=this.configuration.getTextLines(m,o);if(S&&0!==S.length&&!this.renderLinkedTextBoxAnnotation({enabledElement:e,svgDrawingHelper:t,annotation:c,styleSpecifier:l,textLines:S,canvasCoordinates:I}))continue}return n},this._movingLongAxisWouldPutItThroughShortAxis=(e,t)=>{let n=r.vt();r.hZ(n,t.end.x-t.start.x,t.end.y-t.start.y),r.S8(n,n);let i={start:{x:t.start.x-10*n[0],y:t.start.y-10*n[1]},end:{x:t.end.x+10*n[0],y:t.end.y+10*n[1]}};return!_.A([i.start.x,i.start.y],[i.end.x,i.end.y],[e.start.x,e.start.y],[e.end.x,e.end.y])},this._calculateCachedStats=(e,t,n)=>{let{data:a}=e,{element:r}=n.viewport;a.handles.points[0],a.handles.points[1],a.handles.points[2],a.handles.points[3];let{cachedStats:o}=a,l=Object.keys(o);for(let e=0;er.worldToIndex(e)),h=c.slice(0,2),u=c.slice(2,4),g=(0,s.Op)(n,c),p=i.calculateLengthInIndex(g,h),m=i.calculateLengthInIndex(g,u),{unit:v}=g,I=p>m?p:m,_=p>m?m:p;this.isHandleOutsideImage=!i.isInsideVolume(d,c),o[t]={length:I,width:_,unit:v,widthUnit:v,statsArray:[{value:I,name:"height",unit:v,type:f.Jf.Linear},{value:_,name:"width",unit:v,type:f.Jf.Linear}]}}let d=e.invalidated;return e.invalidated=!1,d&&(0,g.triggerAnnotationModified)(e,r,f.wi.StatsUpdated),o},this._getSignedAngle=(e,t)=>Math.atan2(e[0]*t[1]-e[1]*t[0],e[0]*t[0]+e[1]*t[1]),this._throttledCalculateCachedStats=(0,d.A)(this._calculateCachedStats,100,{trailing:!0})}addNewAnnotation(e){let{currentPoints:t,element:n}=e.detail,i=t.world;this.isDrawing=!0;let a=this.createAnnotation(e,[[...i],[...i],[...i],[...i]]);(0,c.addAnnotation)(a,n);let r=(0,v.Q0)(n,this.getToolName());return this.editData={annotation:a,viewportIdsToRender:r,handleIndex:1,movingTextBox:!1,newAnnotation:!0,hasMoved:!1},this._activateDraw(n),(0,w.lY)(n),e.preventDefault(),(0,b.A)(r),a}}function E(e,t){let{cachedStats:n,label:i}=e,{length:a,width:r,unit:s}=n[t],l=[];return i&&l.push(i),void 0===a||l.push(`L: ${o.BF.roundNumber(a)} ${s||s}`,`W: ${o.BF.roundNumber(r)} ${s}`),l}i=A,A.toolName="Bidirectional",A.hydrate=(e,t,n)=>{let a=(0,o.yj)(e);if(!a)return;let{FrameOfReferenceUID:r,referencedImageId:s,viewPlaneNormal:l,instance:d,viewport:h}=i.hydrateBase(i,a,t[0],n),[u,g]=t,[p,m]=u,[f,v]=g,{toolInstance:I,..._}=n||{},w={annotationUID:n?.annotationUID||o.BF.uuidv4(),data:{handles:{points:[p,m,f,v],activeHandleIndex:null,textBox:{hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}}},cachedStats:{}},highlighted:!1,autoGenerated:!1,invalidated:!1,isLocked:!1,isVisible:!0,metadata:{toolName:d.getToolName(),viewPlaneNormal:l,FrameOfReferenceUID:r,referencedImageId:s,..._}};return(0,c.addAnnotation)(w,h.element),(0,b.A)([h.id]),w};let M=A},8270:(e,t,n)=>{"use strict";n.d(t,{A:()=>_});var i=n(70192),a=n(91336),r=n(50923),o=n(78378),s=n(45826),l=n(39157),d=n(11663),c=n(14036),h=n(4101),u=n(60212),g=n(88819),p=n(88129),m=n(62207),f=n(75246),v=n(41067);class I extends g.A{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{strategies:{FILL_INSIDE_CIRCLE:d.kr,ERASE_INSIDE_CIRCLE:c.r,FILL_INSIDE_SPHERE:s.Jq,ERASE_INSIDE_SPHERE:l._,THRESHOLD_INSIDE_CIRCLE:d.q,THRESHOLD_INSIDE_SPHERE:s.rd,THRESHOLD_INSIDE_SPHERE_WITH_ISLAND_REMOVAL:s.Sw},defaultStrategy:"FILL_INSIDE_CIRCLE",activeStrategy:"FILL_INSIDE_CIRCLE",brushSize:25,useCenterSegmentIndex:!1,preview:{enabled:!1,previewColors:{0:[255,255,255,128]},previewTimeMs:250,previewMoveDistance:8,dragMoveDistance:4,dragTimeMs:500},actions:{[o.Yh.AcceptPreview]:{method:o.Yh.AcceptPreview,bindings:[{key:"Enter"}]},[o.Yh.RejectPreview]:{method:o.Yh.RejectPreview,bindings:[{key:"Escape"}]},[o.Yh.Interpolate]:{method:o.Yh.Interpolate,bindings:[{key:"i"}],configuration:{useBallStructuringElement:!0,noUseDistanceTransform:!0,noUseExtrapolation:!0}},interpolateExtrapolation:{method:o.Yh.Interpolate,bindings:[{key:"e"}],configuration:{}}}}}){super(e,t),this._lastDragInfo=null,this._drawStartTimeStamp=0,this._lazyEdit=new m.A,this.onSetToolPassive=e=>{this.disableCursor()},this.onSetToolEnabled=()=>{this.disableCursor()},this.onSetToolDisabled=e=>{this.disableCursor()},this.preMouseDownCallback=e=>{let t=e.detail,{element:n,currentPoints:s}=t,l=(0,i.kJ)(n),{viewport:d}=l;if(!(0,v.T)(d.id)){let e=new CustomEvent(i.fX.sV.ERROR_EVENT,{detail:{type:"Segmentation",message:"No active segmentation detected, create a segmentation representation before using the brush tool"},cancelable:!0});return i.tX.dispatchEvent(e),!1}this._editData=this.createEditData(n),this._previewData.isDrag=!1,this._previewData.timerStart=Date.now(),this._drawStartTimeStamp=t.event?.timeStamp??0;let c=a.o8(s.canvas),g=d.canvasToWorld([c[0],c[1]]);if(this._lastDragInfo={canvas:c,world:r.o8(g)},this._hoverData=this.createHoverData(n,c),!this._hoverData)return this._editData=null,!1;this._calculateCursor(n,c),I.activeCursorTool=this,this._resetLazyEditState(),this._isLazyLabelmapEditingEnabled(this._hoverData.viewport)&&(this._lazyEdit.appendStrokePoint(g),this._captureLazyPreviewCircle()),(0,u.A)(this._hoverData.viewportIdsToRender);let p=this.getOperationData(n);return!!p&&(this._activateDraw(n),(0,h.lY)(n),e.preventDefault(),this.applyActiveStrategyCallback(l,p,o.Yh.OnInteractionStart),!0)},this.mouseMoveCallback=e=>{if(this.isPrimary&&this.mode===o.r$.Active){if(this.updateCursor(e),!this.configuration.preview.enabled)return;let{previewTimeMs:t,previewMoveDistance:n,dragMoveDistance:i}=this.configuration.preview,{currentPoints:r,element:o}=e.detail,{canvas:s}=r,{startPoint:l,timer:d,timerStart:c,isDrag:h}=this._previewData;if(h)return;let u=a.Io(s,l),g=Date.now()-c;if((u>n||g>t&&u>i)&&(d&&(window.clearTimeout(d),this._previewData.timer=null),h||this.rejectPreview(o)),!this._previewData.timer){let e=window.setTimeout(this.previewCallback,250);Object.assign(this._previewData,{timerStart:Date.now(),timer:e,startPoint:s,element:o})}}},this.previewCallback=()=>{if(this._previewData.isDrag){this._previewData.timer=null;return}this._previewData.timer=null;let e=this.getOperationData(this._previewData.element);if(!e)return;let t=(0,i.kJ)(this._previewData.element);if(!t)return;let{viewport:n}=t,a=this.configuration.activeStrategy,r=(0,p.S)({operationData:e,viewport:n,strategy:a});if(!e)return;let s=this.createMemo(e.segmentationId,r.segmentationVoxelManager);this._previewData.preview=this.applyActiveStrategyCallback((0,i.kJ)(this._previewData.element),{...e,...r,memo:s},o.Yh.Preview)},this._dragCallback=e=>{let t=e.detail,{element:n,currentPoints:o}=t,{currentPointsList:s}=t;if(s?.length>1)return void this._cancelTouchDraw(n);let l=(0,i.kJ)(n),{viewport:d}=l;if(this.updateCursor(e),!this._hoverData)return;let{viewportIdsToRender:c}=this._hoverData;(0,u.A)(c);let h=a.Io(o.canvas,this._previewData.startPoint),{dragTimeMs:g,dragMoveDistance:p}=this.configuration.preview;if(!this._previewData.isDrag&&Date.now()-this._previewData.timerStart{let t=e.detail,{element:n}=t;if(t.eventName===o.sV.TOUCH_TAP&&(t.event?.timeStamp??0)r.o8(e)),this.applyActiveStrategy(a,s)):this._previewData.preview||this._previewData.isDrag||this.applyActiveStrategy(a,s),this.doneEditMemo(),this._deactivateDraw(n),(0,h.Q_)(n),this._editData=null,this._lastDragInfo=null,l&&this._previewData.isDrag?(this._scheduleLazyPreviewCleanup(n,e.detail.currentPoints.canvas,a.viewport.id,s.segmentationId,this._isTouchInteraction(e)),(0,u.A)(this._hoverData.viewportIdsToRender)):(this._resetLazyEditState(),this._isTouchInteraction(e)?this._clearCursor(n):this.updateCursor(e)),this.applyActiveStrategyCallback(a,s,o.Yh.OnInteractionEnd),this._previewData.isDrag||this.acceptPreview(n)},this._activateDraw=e=>{e.addEventListener(o.sV.MOUSE_UP,this._endCallback),e.addEventListener(o.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(o.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(o.sV.TOUCH_END,this._endCallback),e.addEventListener(o.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(o.sV.TOUCH_TAP,this._endCallback)},this._deactivateDraw=e=>{e.removeEventListener(o.sV.MOUSE_UP,this._endCallback),e.removeEventListener(o.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(o.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(o.sV.TOUCH_END,this._endCallback),e.removeEventListener(o.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(o.sV.TOUCH_TAP,this._endCallback)}}disableCursor(){this._clearPendingLazyPreviewCleanup(),this._hoverData=void 0,this._resetLazyEditState(),this.rejectPreview()}_isLazyLabelmapEditingEnabled(e){return(0,f.v)(e??this._hoverData?.viewport)}_resetLazyEditState(){this._lazyEdit.reset()}_clearPendingLazyPreviewCleanup(){this._lazyEdit.clearPendingCleanup()}_refreshCursor(e,t){this._hoverData=this.createHoverData(e,t),this._hoverData&&(this._calculateCursor(e,t),I.activeCursorTool=this,(0,u.A)(this._hoverData.viewportIdsToRender))}_scheduleLazyPreviewCleanup(e,t,n,i,a=!1){this._lazyEdit.scheduleCleanup({element:e,centerCanvas:t,viewportId:n,segmentationId:i,refreshCursor:a?e=>this._clearCursor(e):this._refreshCursor.bind(this)})}_captureLazyPreviewCircle(){this._isLazyLabelmapEditingEnabled()&&this._hoverData&&this._lazyEdit.capturePreviewCircle(this._hoverData)}updateCursor(e){let t=e.detail,{element:n}=t,{currentPoints:i}=t,a=i.canvas;this._refreshCursor(n,a)}_clearCursor(e){let t=this._hoverData?.viewportIdsToRender;if(this._hoverData=void 0,t?.length)return void(0,u.A)(t);let n=(0,i.kJ)(e);n&&(0,u.A)([n.viewport.id])}_cancelTouchDraw(e){let{memo:t}=this;t?.commitMemo?.()&&t.restoreMemo(!0),this.memo=null,this._deactivateDraw(e),(0,h.Q_)(e),this._editData=null,this._lastDragInfo=null,this._previewData.preview=null,this._previewData.isDrag=!1,this._previewData.timer&&(window.clearTimeout(this._previewData.timer),this._previewData.timer=null),this._resetLazyEditState(),this._clearCursor(e)}_calculateCursor(e,t){let n=(0,i.kJ)(e),a=this.getOperationData(e);n&&a&&this.applyActiveStrategyCallback(n,a,o.Yh.CalculateCursorGeometry)}getStatistics(e,t){if(!e)return;let n=(0,i.kJ)(e),a=this.getOperationData(e);if(n&&a)return this.applyActiveStrategyCallback(n,a,o.Yh.GetStatistics,t)}rejectPreview(e=this._previewData.element){if(!e)return;this.doneEditMemo();let t=(0,i.kJ)(e);if(!t)return;let n=this.getOperationData(e);n&&(this.applyActiveStrategyCallback(t,n,o.Yh.RejectPreview),this._previewData.preview=null,this._previewData.isDrag=!1)}acceptPreview(e=this._previewData.element){e&&super.acceptPreview(e)}interpolate(e,t){if(!e)return;let n=(0,i.kJ)(e),a=this.getOperationData(e);n&&a&&(this._previewData.preview=this.applyActiveStrategyCallback(n,a,o.Yh.Interpolate,t.configuration),this._previewData.isDrag=!0)}invalidateBrushCursor(){if(void 0===this._hoverData)return;let{data:e}=this._hoverData.brushCursor,{viewport:t}=this._hoverData;e.invalidated=!0;let{segmentColor:n}=this.getActiveSegmentationData(t)||{};this._hoverData.brushCursor.metadata.segmentColor=n}renderAnnotation(e,t){if(!this._hoverData||I.activeCursorTool!==this)return;let{viewport:n}=e;if(this._hoverData.viewportIdsToRender.includes(n.id)){if(!0===this._hoverData.brushCursor.data.invalidated){let{centerCanvas:e}=this._hoverData,{element:t}=n;this._calculateCursor(t,e)}this.applyActiveStrategyCallback(e,this.getOperationData(n.element),o.Yh.RenderCursor,t)}}}I.toolName="Brush";let _=I},8567:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorage",{enumerable:!0,get:function(){return i.workAsyncStorageInstance}});let i=n(17828)},9538:(e,t,n)=>{},10883:(e,t,n)=>{"use strict";n.d(t,{j:()=>s,z:()=>o});var i=n(32207),a=n(49007),r=n(93287);function o(e){let t=i._6;t.getAllViewportSegmentationRepresentations().filter(({representations:t})=>t.some(t=>t.segmentationId===e)).map(({viewportId:e})=>e).forEach(t=>{(0,r.nc)(t,{segmentationId:e})}),t.removeSegmentation(e),(0,a.triggerSegmentationRemoved)(e)}function s(){let e=i._6;e.getState().segmentations.map(e=>e.segmentationId).forEach(e=>{o(e)}),e.resetState()}},11212:(e,t,n)=>{"use strict";n.d(t,{R:()=>d,l:()=>c});var i=n(70192),a=n(50923),r=n(17242),o=n(41918);let{transformWorldToIndex:s}=i.BF;function l(e,t,n){let[i,o]=e,l=a.fA((i[0]+o[0])/2,(i[1]+o[1])/2,(i[2]+o[2])/2),d=a.Io(i,o)/2,{boundsIJK:c,topLeftWorld:h,bottomRightWorld:u}=function(e,t,n,i,o){let l=e.getDimensions(),{row:d,column:c,normal:h}=t,u=a.vt(),g=a.vt();a.Ln(u,i,h,o),a.Ln(g,i,h,-o),a.Ln(u,u,c,-o),a.Ln(g,g,c,o),a.Ln(u,u,d,-o),a.Ln(g,g,d,o);let p=s(e,u),m=s(e,g),f=n.map(t=>s(e,t));return{boundsIJK:(0,r.gm)([p,m,...f],l),topLeftWorld:u,bottomRightWorld:g}}(t,n,e,l,d);return{boundsIJK:c,centerWorld:l,radiusWorld:d,topLeftWorld:h,bottomRightWorld:u}}function d(e,t){let n=t.getDirection(),i=a.fA(n[0],n[1],n[2]),r=a.fA(n[3],n[4],n[5]),o=a.fA(n[6],n[7],n[8]);return l(e,t,{row:i,column:r,normal:a.ze(a.vt(),o)})}function c(e,t,n){if(!n)throw Error("viewport is required in order to calculate the sphere bounds");let i=(0,o.A)(n);if(!i.viewUp||!i.viewPlaneNormal)throw Error("viewport view plane is required in order to calculate the sphere bounds");let r=a.fA(i.viewUp[0],i.viewUp[1],i.viewUp[2]),s=a.fA(i.viewPlaneNormal[0],i.viewPlaneNormal[1],i.viewPlaneNormal[2]),d=a.vt();return a.$A(d,r,s),l(e,t,{row:d,normal:s,column:a.ze(a.vt(),r)})}},11236:(e,t,n)=>{"use strict";n.d(t,{u:()=>s});var i=n(70192),a=n(32207),r=n(54310),o=n(74600);function s(e,t){let n=a._6,s=t??(0,r.u)(),l=[...e];if(i.BF.isEqual(l[0],[0,0,0,0])||(console.warn("addColorLUT: [0, 0, 0, 0] color is not provided for the background color (segmentIndex =0), automatically adding it"),l=[[0,0,0,0],...l]),(l=l.map(e=>3===e.length?[e[0],e[1],e[2],255]:e)).length<256){let e=o.A.slice(l.length);l=[...l,...e]}for(;l.length<256;){let e=(l.length-1)%(o.A.length-1)+1;l.push([...o.A[e]])}return n.addColorLUT(l,s),s}},11420:(e,t,n)=>{"use strict";n.d(t,{VQ:()=>m,pY:()=>p});var i=n(50923),a=n(70192),r=n(17242),o=n(41918),s=n(73971),l=n(78378),d=n(20552);let{transformWorldToIndex:c}=a.BF,h={[l.Yh.Initialize]:e=>{let{points:t,viewport:n,segmentationImageData:s}=e;if(!t)return;let l=i.fA(0,0,0);t.forEach(e=>{i.WQ(l,l,e)}),i.hs(l,l,1/t.length),e.centerWorld=l,e.centerIJK=c(s,l);let{boundsIJK:d,pointInShapeFn:h}=function(e,t,n){let s=t.map(e=>c(n,e));s=s.map(e=>e.map(e=>Math.round(e)));let l=(0,r.gm)(s,n.getDimensions()),[d,h,u,g]=t,p=i.vt(),m=i.vt();i.Re(p,h,d),i.Re(m,g,d);let f=i.Bw(p),v=i.Bw(m);i.S8(p,p),i.S8(m,m);let I=i.vt();i.$A(I,p,m),i.S8(I,I);let _=n.getDirection(),w=n.getSpacing(),{viewPlaneNormal:b}=(0,o.A)(e),C=a.BF.getSpacingInNormalDirection({direction:_,spacing:w},b);return{boundsIJK:l,pointInShapeFn:e=>{let t=i.vt();i.Re(t,e,d);let n=i.Om(t,p),a=i.Om(t,m),r=Math.abs(i.Om(t,I));return n>=-C&&n<=f+C&&a>=-C&&a<=v+C&&r<=C}}}(n,t,s);e.isInObject=h,e.isInObjectBoundsIJK=d}},u=new s.A("Rectangle",d.A.regionFill,d.A.setValue,h,d.A.determineSegmentIndex,d.A.preview,d.A.labelmapStatistics),g=new s.A("RectangleThreshold",d.A.regionFill,d.A.setValue,h,d.A.determineSegmentIndex,d.A.dynamicThreshold,d.A.threshold,d.A.preview,d.A.islandRemoval,d.A.labelmapStatistics),p=u.strategyFunction,m=g.strategyFunction},11663:(e,t,n)=>{"use strict";n.d(t,{C$:()=>p,N5:()=>b,kr:()=>_,mu:()=>f,pB:()=>v,q:()=>w});var i=n(50923),a=n(70192),r=n(17242),o=n(73971),s=n(78378),l=n(20552),d=n(33513);let{transformWorldToIndex:c,transformIndexToWorld:h,isEqual:u,getNormalizedAspectRatio:g}=a.BF;function p(e){let[t,n,i,a]=e,r=[i[0],n[1]],o=[a[0],t[1]];return[r,o,[i[0],t[1]],[a[0],n[1]]]}let m={[s.Yh.Initialize]:e=>{let{points:t,viewport:n,segmentationImageData:a,viewUp:o,viewPlaneNormal:s}=e;if(!t)return;let l=i.vt();t.length>=2?(i.WQ(l,t[0],t[1]),i.hs(l,l,.5)):i.C(l,t[0]),e.centerWorld=l,e.centerIJK=c(a,l);let d=g(n.getAspectRatio()),h=t.length>=2?i.Io(t[0],t[1])/2/d[1]:0,u=t.length>=2?i.Io(t[2],t[3])/2/d[0]:0,m=p(t.map(e=>n.worldToCanvas(e))).map(e=>n.canvasToWorld(e)),v=i.fA(o[0],o[1],o[2]);i.S8(v,v);let I=i.fA(s[0],s[1],s[2]);i.S8(I,I);let _=i.vt();i.$A(_,v,I),i.S8(_,_);let w=(e.strokePointsWorld&&e.strokePointsWorld.length>0?e.strokePointsWorld:[e.centerWorld]).map(e=>i.o8(e)),b=w.flatMap(e=>(function(e,t,n,a,r){let o=i.fA(e[0],e[1],e[2]),s=i.vt();i.Ln(s,o,t,a);let l=i.vt();i.Ln(l,o,t,-a);let d=i.vt();i.Ln(d,o,n,r);let c=i.vt();return i.Ln(c,o,n,-r),[l,s,c,d]})(e,v,_,h,u)).map(e=>c(a,e)),C=(0,r.gm)(b,a.getDimensions());e.strokePointsWorld=w,e.isInObject=f(m,{strokePointsWorld:w,segmentationImageData:a,xRadius:u,yRadius:h,aspectRatio:d}),e.isInObjectBoundsIJK=C}};function f(e=[],t={}){if(!e||4!==e.length)throw Error("createPointInEllipse: cornersInWorld must have 4 points");let[n,a,r,o]=e,s=t.aspectRatio||[1,1],l=i.vt();i.WQ(l,n,a),i.hs(l,l,.5);let c=i.vt();i.Re(c,o,n);let g=i.Bw(c)/2;i.S8(c,c);let p=i.vt();i.Re(p,r,n),i.S8(p,p);let m=g/s[0],v=g/s[1],I=t.xRadius??m,_=t.yRadius??v,w=function(e,t,n){if(!e.length||t<=0||n<=0)return null;let i=t*t,a=n*n,r=e.map(e=>[e[0],e[1],e[2]]),o=[];for(let e=1;e{if(!e)return!1;for(let t of r){let n=e[0]-t[0],r=e[1]-t[1],o=e[2]-t[2];if(n*n/i+r*r/a+o*o<=1)return!0}for(let{start:t,vector:n,lengthSquared:r}of o){if(0===r){let n=e[0]-t[0],r=e[1]-t[1],o=e[2]-t[2];if(n*n/i+r*r/a+o*o<=1)return!0;continue}let o=e[0]-t[0],s=e[1]-t[1],l=e[2]-t[2],d=Math.max(0,Math.min(1,(o*n[0]+s*n[1]+l*n[2])/r)),c=t[0]+n[0]*d,h=t[1]+n[1]*d,u=t[2]+n[2]*d,g=e[0]-c,p=e[1]-h,m=e[2]-u;if(g*g/i+p*p/a+m*m<=1)return!0}return!1}}(t.strokePointsWorld||[],I,_);if(u(m,v)){let e={center:l,radius:m,radius2:m*m};return(n,i)=>{let a=n;return!a&&i&&t.segmentationImageData&&(a=h(t.segmentationImageData,i)),!!a&&(!!w?.(a)||(0,d.A)(e,a))}}return(e,n)=>{let a=e;if(!a&&n&&t.segmentationImageData&&(a=h(t.segmentationImageData,n)),!a)return!1;if(w?.(a))return!0;let r=i.vt();i.Re(r,a,l);let o=i.Om(r,c),s=i.Om(r,p);return o*o/(m*m)+s*s/(v*v)<=1}}let v=new o.A("Circle",l.A.regionFill,l.A.setValue,m,l.A.determineSegmentIndex,l.A.preview,l.A.labelmapStatistics),I=new o.A("CircleThreshold",l.A.regionFill,l.A.setValue,m,l.A.determineSegmentIndex,l.A.dynamicThreshold,l.A.threshold,l.A.preview,l.A.islandRemoval,l.A.labelmapStatistics),_=v.strategyFunction,w=I.strategyFunction;function b(){throw Error("Not yet implemented")}},12487:(e,t,n)=>{"use strict";n.d(t,{RC:()=>s.R,WA:()=>d.W,k9:()=>r.A});var i=n(43806),a=n(17191),r=n(81480),o=n(13312),s=n(15009),l=n(84468),d=n(5490);i.A,a.A,o.A,r.A,s.R,l.Y,d.W,s.p},12722:(e,t,n)=>{"use strict";n.r(t),n.d(t,{addColorLUT:()=>l.u,addSegmentations:()=>r.d,destroy:()=>_,getColorLUT:()=>d.B,getCurrentLabelmapImageIdForViewport:()=>m.vl,getCurrentLabelmapImageIdsForViewport:()=>m.aF,getDefaultSegmentationStateManager:()=>w,getNextColorLUTIndex:()=>c.u,getSegmentation:()=>i.T,getSegmentationRepresentation:()=>I.Ut,getSegmentationRepresentations:()=>I.r$,getSegmentationRepresentationsBySegmentationId:()=>I.ny,getSegmentations:()=>a.K,getStackSegmentationImageIdsForViewport:()=>v,getViewportIdsWithSegmentation:()=>p.P,getViewportSegmentationRepresentations:()=>g.z,getViewportSegmentations:()=>g.a,removeAllSegmentationRepresentations:()=>s.us,removeAllSegmentations:()=>o.j,removeColorLUT:()=>u,removeContourRepresentation:()=>s.OE,removeLabelmapRepresentation:()=>s.kN,removeSegmentation:()=>o.z,removeSegmentationRepresentation:()=>s.E8,removeSurfaceRepresentation:()=>s.JC,updateLabelmapSegmentationImageReferences:()=>f.t});var i=n(43385),a=n(91006),r=n(35172),o=n(10883),s=n(93287),l=n(11236),d=n(65947),c=n(54310),h=n(32207);function u(e){h._6.removeColorLUT(e)}var g=n(95324),p=n(69435),m=n(5469),f=n(61689);function v(e,t){return h._6.getStackSegmentationImageIdsForViewport(e,t)}var I=n(51200);function _(){h._6.resetState()}function w(){return h._6}},16835:(e,t,n)=>{"use strict";n.r(t),n.d(t,{convertContourHoles:()=>w,decimateContours:()=>u,extractSegmentPolylines:()=>c,getAnnotationMapFromSegmentation:()=>o,getAnnotationsUIDMapFromSegmentation:()=>i.B,getViewportAssociatedToSegmentation:()=>a.IN,getViewportWithMatchingViewPlaneNormal:()=>a.W8,removeCompleteContourAnnotation:()=>g,removeContourHoles:()=>m,removeContourIslands:()=>v,smoothContours:()=>_});var i=n(5068),a=n(38031),r=n(93022);function o(e,t={}){let n=e.annotationUIDsMap,i=t.segmentIndices?.length?t.segmentIndices:Array.from(n.keys()),a=new Map;return i.forEach(e=>{let t=Array.from(n.get(e)),i=(t=t.filter(e=>!(0,r.getAnnotation)(e).parentAnnotationUID)).map(e=>{let t=(0,r.getAnnotation)(e),n=t.childAnnotationUIDs?.length,i=n&&t.childAnnotationUIDs.map(e=>{let t=(0,r.getAnnotation)(e);return{polyline:t.data.contour.polyline,isClosed:t.data.contour.closed}}),a=n&&i.map(e=>e.isClosed),o=n&&i.map(e=>e.polyline);return{polyline:t.data.contour.polyline,isClosed:t.data.contour.closed,annotationUID:t.annotationUID,referencedImageId:t.metadata.referencedImageId,holesPolyline:o,holesUIDs:t.childAnnotationUIDs,holesClosed:a}});a.set(e,i)}),{segmentIndices:i,annotationUIDsInSegmentMap:a}}var s=n(43385),l=n(98723);function d(e,t){if(!e||0===e.length)return[];if(!t)return[...e];let n=e[0],i=e[e.length-1];return n[0]===i[0]&&n[1]===i[1]&&n[2]===i[2]?[...e]:[...e,n]}function c(e,t){let n=(0,a.xT)(e),i=(0,s.T)(e);if(!i||!i.representationData.Contour)return;let c=i.representationData.Contour,{annotationUIDsMap:h}=c;if(!h||!h.get(t))return;let u=function(e,t){let{annotationUIDsInSegmentMap:n}=o(e);if(!n.has(t))return void console.warn(`No contour information found for segmentIndex ${t}`);let i=new Map;for(let e of n.get(t)){i.set(e.annotationUID,d(e.polyline,e.isClosed));for(let t=0;td.canvasToWorld(e)),(0,r.invalidateAnnotation)(t))}}function g(e){e&&(e.parentAnnotationUID&&(0,r.clearParentAnnotation)(e),(0,r.removeAnnotation)(e.annotationUID),(0,l.M)(e))}var p=n(60332);function m(e,t){let n=(0,s.T)(e);if(!n)return void console.warn(`Invalid segmentation given ${e}`);if(!n.representationData.Contour)return void console.warn(`No contour representation found for segmentation ${e}`);let i=c(e,t);if(!i)return void console.warn(`Error extracting contour data from segment ${t} in segmentation ${e}`);let a=Array.from(i?.keys()),o=a.map(e=>i.get(e)),l=(0,p.dz)(o);l?.length>0&&l.forEach(e=>{e.holeIndexes.forEach(e=>{g((0,r.getAnnotation)(a[e]))})})}var f=n(83603);function v(e,t,n={threshold:3}){let i=(0,s.T)(e);if(!i)return void console.warn(`Invalid segmentation given ${e}`);if(!i.representationData.Contour)return void console.warn(`No contour representation found for segmentation ${e}`);let a=c(e,t);if(!a)return void console.warn(`Error extracting contour data from segment ${t} in segmentation ${e}`);let o=Array.from(a?.keys()),l=o.map(e=>a.get(e)),d=(0,f.A)(l,n.threshold);d?.length>0&&d.forEach(e=>{g((0,r.getAnnotation)(o[e]))})}var I=n(4235);function _(e,t,n={knotsRatioPercentage:30}){let i=(0,s.T)(e);if(!i)return void console.warn(`Invalid segmentation given ${e}`);if(!i.representationData.Contour)return void console.warn(`No contour representation found for segmentation ${e}`);let{annotationUIDsMap:a}=i.representationData.Contour;return a?a.has(t)?void a.get(t).forEach(e=>{let t=(0,r.getAnnotation)(e);if(!t)return;let i=t.data.contour.polyline;if(!i||i.length<3)return;let a=(0,I.A)(i,0,i.length-1,n.knotsRatioPercentage);t.data.contour.polyline=a}):void console.warn(`Error extracting contour data from segment ${t} in segmentation ${e}`):void console.warn(`No contours found for segmentation ${e}`)}function w(e,t,n,i){let a,o=(0,s.T)(e);if(!o)return void console.warn(`Invalid segmentation given ${e}`);if(!o.representationData.Contour)return void console.warn(`No contour representation found for segmentation ${e}`);let{annotationUIDsMap:l}=o?.representationData.Contour||{};if(!l)return void console.warn(`No annotation map found for segmentation ${e}`);let d=l?.get(t);if(!d)return void console.warn(`Segmentation index ${t} has no annotations in segmentation ${e}`);if(n&&"number"==typeof i){let e=(0,s.T)(n);if(!e)return void console.warn(`Target segmentation ${n} does not exist.`);if(!e.representationData.Contour)return void console.warn(`No contour representation found for target segmentation ${n}`);(a=e.representationData.Contour.annotationUIDsMap.get(i))||(a=new Set,e.representationData.Contour.annotationUIDsMap.set(i,a))}let h=c(e,t);if(!h)return void console.warn(`Error extracting contour data from segment ${t} in segmentation ${e}`);let u=Array.from(h?.keys()),g=u.map(e=>h.get(e)),m=(0,p.dz)(g);m?.length>0&&m.forEach(e=>{e.holeIndexes.forEach(e=>{let t=(0,r.getAnnotation)(u[e]);(0,r.clearParentAnnotation)(t),n&&"number"==typeof i?a.add(t.annotationUID):d.add(t.annotationUID)})})}},17167:(e,t,n)=>{"use strict";n.d(t,{D6:()=>r,d6:()=>o});var i=n(70192);let{isEqual:a}=i.BF;function r(e){return function(t,n){let r=Array.isArray(n)?n:[n],o=r.map(e=>t.cachedStats[e]).filter(t=>e.some(({attribute:e})=>t?.[e]!==void 0&&t?.[e]!==null));if(!o.length)return;let s=[];for(let t of e){var l,d;l=s,(d=function(e,t,n,r,o){let s=[`${n}:`],l=null,d=null;for(let t of e){if(!i.BF.isNumber(t?.[r]))continue;let e=t[r],n=t[o];a(l,e)&&d===n||(s.push(`${i.BF.roundNumber(e)} ${n}`),l=e,d=n)}if(!(s.length<=1))return s.join(" ")}(o,0,t.name,t.attribute,t.unitAttribute))&&l.push(d)}return s}}let o=r([{name:"Area",attribute:"area",unitAttribute:"areaUnit"},{name:"Mean",attribute:"mean",unitAttribute:"modalityUnit"},{name:"Max",attribute:"max",unitAttribute:"modalityUnit"},{name:"Min",attribute:"min",unitAttribute:"modalityUnit"},{name:"Std Dev",attribute:"stdDev",unitAttribute:"modalityUnit"}])},17828:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorageInstance",{enumerable:!0,get:function(){return i}});let i=(0,n(64054).createAsyncLocalStorage)()},19307:(e,t,n)=>{"use strict";n.d(t,{Ii:()=>i.A,_x:()=>a.A});var i=n(29010);n(82243);var a=n(87086);n(4101),n(94952),[...n(23278).bp,...i.i]},19921:(e,t,n)=>{"use strict";n.r(t),n.d(t,{addColorLUT:()=>s,getSegmentIndexColor:()=>d,setColorLUT:()=>l,setSegmentIndexColor:()=>c});var i=n(11236),a=n(65947),r=n(51200),o=n(49007);function s(e,t){if(!e)throw Error("addColorLUT: colorLUT is required");return(0,i.u)(e,t)}function l(e,t,n){if(!(0,a.B)(n))throw Error(`setColorLUT: could not find colorLUT with index ${n}`);let i=(0,r.r$)(e,{segmentationId:t});if(!i)throw Error(`viewport specific state for viewport ${e} does not exist`);i.forEach(e=>{e.colorLUTIndex=n}),(0,o.triggerSegmentationRepresentationModified)(e,t)}function d(e,t,n){let i=(0,r.r$)(e,{segmentationId:t});if(!i||0===i.length)return null;let{colorLUTIndex:o}=i[0],s=(0,a.B)(o),l=s[n];if(!l){if("number"!=typeof n)return console.warn(`Can't create colour for LUT index ${n}`),null;l=s[n]=[0,0,0,0]}return l}function c(e,t,n,i){let a=d(e,t,n);for(let e=0;e{"use strict";let i,a;n.d(t,{fX:()=>S,LW:()=>ln,CH:()=>oO,ae:()=>o6,_K:()=>I,dU:()=>tT,Du:()=>o5,OQ:()=>sa,Gx:()=>T.Gx,Ts:()=>aW,b2:()=>E});var r,o,s,l,d,c,h,u,g,p,m,f,v,I={};n.r(I),n.d(I,{createSynchronizer:()=>iO,destroy:()=>iR,destroySynchronizer:()=>iF,getAllSynchronizers:()=>iU,getSynchronizer:()=>iN,getSynchronizersForViewport:()=>iT});var _={};n.r(_),n.d(_,{getActiveSegmentation:()=>aC,setActiveSegmentation:()=>aA});var w={};n.r(w),n.d(w,{getActiveSegmentIndex:()=>aE.Q,setActiveSegmentIndex:()=>r_});var b={};n.r(b),n.d(b,{getHiddenSegmentIndices:()=>oo,getSegmentIndexVisibility:()=>or,getSegmentationRepresentationVisibility:()=>oi,setSegmentIndexVisibility:()=>oa,setSegmentationRepresentationVisibility:()=>on});var C={};n.r(C),n.d(C,{getRenderInactiveSegmentations:()=>ou,getStyle:()=>od,hasCustomStyle:()=>op,resetToGlobalStyle:()=>og,setRenderInactiveSegmentations:()=>oh,setStyle:()=>oc});var A={};n.r(A),n.d(A,{color:()=>oe,style:()=>C,visibility:()=>b});var E={};n.r(E),n.d(E,{activeSegmentation:()=>_,addContourRepresentationToViewport:()=>rb,addContourRepresentationToViewportMap:()=>rC,addDefaultSegmentationListener:()=>tD.Np,addLabelmapRepresentationToViewport:()=>rA,addLabelmapRepresentationToViewportMap:()=>rE,addRepresentationData:()=>iq,addSegmentationListener:()=>tD.MC,addSegmentationRepresentations:()=>rw,addSegmentations:()=>r6.d,addSurfaceRepresentationToViewport:()=>rM,addSurfaceRepresentationToViewportMap:()=>ry,config:()=>A,defaultSegmentationStateManager:()=>iB._6,getActiveSegmentation:()=>ab.T,getCurrentLabelmapImageIdsForViewport:()=>t$.aF,getLabelmapImageIds:()=>ob,getLabelmapImageIdsForImageId:()=>t$.T8,helpers:()=>oE,removeAllSegmentationListeners:()=>tD.bm,removeAllSegmentationRepresentations:()=>r4.us,removeAllSegmentations:()=>oA.j,removeContourRepresentation:()=>r4.OE,removeLabelmapRepresentation:()=>r4.kN,removeSegment:()=>ow,removeSegmentation:()=>oA.z,removeSegmentationListener:()=>tD.L8,removeSegmentationRepresentation:()=>r4.E8,removeSegmentationRepresentations:()=>r4.nc,removeSurfaceRepresentation:()=>r4.JC,segmentIndex:()=>w,segmentLocking:()=>r7,segmentationStyle:()=>iQ.Y,state:()=>a8,strategies:()=>oC,triggerSegmentationEvents:()=>e9,updateSegmentations:()=>r9,utilities:()=>om});var M=n(70192),y=n(93022),S=n(78378),T=n(69548),D=n(31895);function P(e,t){var n,i;let a=t||e.currentTarget,{viewport:r}=(0,M.kJ)(a)||{};if(!r)return;let o=[(n=e).clientX,n.clientY],s=[(i=e).pageX,i.pageY],l=function(e,t){let n=e.getBoundingClientRect();return[t[0]-n.left-window.pageXOffset,t[1]-n.top-window.pageYOffset]}(a,s),d=function(e,t){try{return e.canvasToWorld(t)}catch(e){var n;if((n=e)instanceof Error&&n.message.includes("because no data is mounted"))return;throw e}}(r,l);if(d)return{page:s,client:o,canvas:l,world:d}}let k=function(e){let t=e.currentTarget,n=(0,M.kJ)(t);if(!n)return;let{viewportId:i,renderingEngineId:a}=n,r=P(e,t);if(!r)return;let o={event:e,eventName:D.A.MOUSE_DOUBLE_CLICK,viewportId:i,renderingEngineId:a,camera:{},element:t,startPoints:r,lastPoints:r,currentPoints:r,deltaPoints:{page:[0,0],client:[0,0],canvas:[0,0],world:[0,0,0]}};(0,M.Hl)(t,D.A.MOUSE_DOUBLE_CLICK,o)||(e.stopImmediatePropagation(),e.preventDefault())},x=D.A.MOUSE_MOVE,L=function(e){let t=e.currentTarget,n=(0,M.kJ)(t);if(!n)return;let{renderingEngineId:i,viewportId:a}=n,r=P(e);r&&((0,M.Hl)(t,x,{renderingEngineId:i,viewportId:a,camera:{},element:t,currentPoints:r,eventName:x,event:e})||(e.stopImmediatePropagation(),e.preventDefault()))},{MOUSE_DOWN:V,MOUSE_DOWN_ACTIVATE:O,MOUSE_CLICK:R,MOUSE_UP:N,MOUSE_DRAG:U}=D.A,F={mouseButton:void 0,element:null,renderingEngineId:void 0,viewportId:void 0,isClickEvent:!0,clickDelay:200,preventClickTimeout:null,startPoints:{page:[0,0],client:[0,0],canvas:[0,0],world:[0,0,0]},lastPoints:{page:[0,0],client:[0,0],canvas:[0,0],world:[0,0,0]}},B={mouseButton:void 0,renderingEngineId:void 0,viewportId:void 0,isClickEvent:!0,clickDelay:200,element:null,preventClickTimeout:null,startPoints:{page:[0,0],client:[0,0],canvas:[0,0],world:[0,0,0]},lastPoints:{page:[0,0],client:[0,0],canvas:[0,0],world:[0,0,0]}},G={doubleClickTimeout:null,mouseDownEvent:null,mouseUpEvent:null,ignoreDoubleClick:!1};function H(e){let t=(0,M.kJ)(B.element);if(!t?.viewport)return;let n=P(e,B.element);if(!n)return;let i=q(B.element,B.lastPoints),a=K(n,i);if(G.doubleClickTimeout)if(!z(a.canvas))return;else Y();let r={event:e,eventName:U,mouseButton:B.mouseButton,renderingEngineId:B.renderingEngineId,viewportId:B.viewportId,camera:{},element:B.element,startPoints:Q(B.startPoints),lastPoints:Q(i),currentPoints:n,deltaPoints:a};(0,M.Hl)(B.element,U,r)||(e.stopImmediatePropagation(),e.preventDefault()),B.lastPoints=Q(n)}function W(e){if(clearTimeout(B.preventClickTimeout),G.doubleClickTimeout)G.mouseUpEvent?J():(G.mouseUpEvent=e,B.element.addEventListener("mousemove",X));else{let t=B.isClickEvent?R:N,n=P(e,B.element);if(!n)return void J();let i=K(n,B.lastPoints),a={event:e,eventName:t,mouseButton:B.mouseButton,element:B.element,renderingEngineId:B.renderingEngineId,viewportId:B.viewportId,camera:{},startPoints:Q(B.startPoints),lastPoints:Q(B.lastPoints),currentPoints:n,deltaPoints:i};(0,M.Hl)(a.element,t,a),J()}document.removeEventListener("mousemove",H)}function X(e){let t=P(e,B.element);t&&z(K(t,q(B.element,B.lastPoints)).canvas)&&(Y(),L(e))}function z(e){return Math.abs(e[0])+Math.abs(e[1])>3}function $(){B.isClickEvent=!1}function Y(){G.ignoreDoubleClick=!0;let e=G.mouseDownEvent,t=G.mouseUpEvent;j();let n=K(B.startPoints,B.startPoints),i={event:e,eventName:V,element:B.element,mouseButton:B.mouseButton,renderingEngineId:B.renderingEngineId,viewportId:B.viewportId,camera:{},startPoints:B.startPoints,lastPoints:B.startPoints,currentPoints:B.startPoints,deltaPoints:n};B.lastPoints=Q(i.lastPoints),(0,M.Hl)(i.element,V,i)&&(0,M.Hl)(i.element,O,i),t&&W(t)}function j(){G.doubleClickTimeout&&(clearTimeout(G.doubleClickTimeout),G.doubleClickTimeout=null),G.mouseDownEvent=null,G.mouseUpEvent=null}function J(){document.removeEventListener("mouseup",W),B.element?.removeEventListener("mousemove",X),B.element?.addEventListener("mousemove",L),j(),B=M.BF.deepClone(F)}function Q(e){return M.BF.deepClone(e)}function q(e,t){let n,{viewport:i}=(0,M.kJ)(e)||{};if(!i)return t;try{n=i.canvasToWorld(t.canvas)}catch(e){var a;if((a=e)instanceof Error&&a.message.includes("because no data is mounted"))return t;throw e}return{page:t.page,client:t.client,canvas:t.canvas,world:n}}function K(e,t){var n,i;return e&&t?{page:Z(e.page,t.page),client:Z(e.client,t.client),canvas:Z(e.canvas,t.canvas),world:(n=e.world,i=t.world,[n[0]-i[0],n[1]-i[1],n[2]-i[2]])}:{page:[0,0],client:[0,0],canvas:[0,0],world:[0,0,0]}}function Z(e,t){return[e[0]-t[0],e[1]-t[1]]}function ee(e){G.ignoreDoubleClick?(G.ignoreDoubleClick=!1,e.stopImmediatePropagation(),e.preventDefault()):J()}let et=function(e){if(G.doubleClickTimeout){if(e.buttons===G.mouseDownEvent.buttons)return;G.mouseDownEvent=e,Y();return}G.doubleClickTimeout=setTimeout(Y,1===e.buttons?400:150),G.mouseDownEvent=e,G.ignoreDoubleClick=!1,B.element=e.currentTarget,B.mouseButton=e.buttons;let t=(0,M.kJ)(B.element);if(!t){B=M.BF.deepClone(F);return}let{renderingEngineId:n,viewportId:i}=t;B.renderingEngineId=n,B.viewportId=i,B.preventClickTimeout=setTimeout($,B.clickDelay);let a=P(e,B.element);if(!a){clearTimeout(B.preventClickTimeout),B=M.BF.deepClone(F);return}B.element.removeEventListener("mousemove",L),B.startPoints=Q(a),B.lastPoints=Q(a),document.addEventListener("mouseup",W),document.addEventListener("mousemove",H)};function en(e){e.removeEventListener("dblclick",k),e.removeEventListener("mousedown",et),e.removeEventListener("mousemove",L),e.removeEventListener("dblclick",ee,{capture:!0})}let ei={enable:function(e){en(e),e.addEventListener("dblclick",k),e.addEventListener("mousedown",et),e.addEventListener("mousemove",L),e.addEventListener("dblclick",ee,{capture:!0})},disable:en},ea={mouse:0,touch:1};function er(e,t){let n=Date.now();if(e!==i){if(n-a<=2e3)return t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),!1;i=e}a=n}let eo=er.bind(null,ea.mouse),es=er.bind(null,ea.touch);function el(e,t,n){let i=n?eo:es;t.forEach(function(t){e.addEventListener(t,i,{passive:!1})})}function ed(e,t,n){let i=n?eo:es;t.forEach(function(t){e.removeEventListener(t,i)})}let ec=["mousedown","mouseup","mousemove"],eh=["touchstart","touchend"];function eu(e){ed(e,ec,ea.mouse),ed(e,eh,ea.touch)}let eg={enable:function(e){eu(e),el(e,ec,ea.mouse),el(e,eh,ea.touch)},disable:eu};var ep=n(44489);function em(e,t){let n=t||e.currentTarget,{viewport:i}=(0,M.kJ)(n)||{};if(!i)return[];let a="touchend"===e.type?e.changedTouches:e.touches;return Object.keys(a).map(e=>{var t,r;let o=[(t=a[e]).clientX,t.clientY],s=[(r=a[e]).pageX,r.pageY],l=function(e,t){let n=e.getBoundingClientRect();return[t[0]-n.left-window.pageXOffset,t[1]-n.top-window.pageYOffset]}(n,s),d=function(e,t){try{return e.canvasToWorld(t)}catch(e){var n;if((n=e)instanceof Error&&n.message.includes("because no data is mounted"))return;throw e}}(i,l);if(d)return{page:s,client:o,canvas:l,world:d,touch:{identifier:e,radiusX:a[e].radiusX,radiusY:a[e].radiusY,force:a[e].force,rotationAngle:a[e].rotationAngle}}}).filter(Boolean)}function ef(e,t){var n,i;let a=eb(e),r=eb(t);return{page:eA(a.page,r.page),client:eA(a.client,r.client),canvas:eA(a.canvas,r.canvas),world:(n=a.world,i=r.world,[n[0]-i[0],n[1]-i[1],n[2]-i[2]])}}function ev(e,t){let n=eb(e),i=eb(t);return{page:eM(n.page,i.page),client:eM(n.client,i.client),canvas:eM(n.canvas,i.canvas),world:ey(n.world,i.world)}}function eI(e,t){let n=eE(e),i=eE(t);return{page:n.page-i.page,client:n.client-i.client,canvas:n.canvas-i.canvas,world:n.world-i.world}}function e_(e){return M.BF.deepClone(e)}function ew(e){return M.BF.deepClone(e)}function eb(e){return e.reduce((t,n)=>({page:[t.page[0]+n.page[0]/e.length,t.page[1]+n.page[1]/e.length],client:[t.client[0]+n.client[0]/e.length,t.client[1]+n.client[1]/e.length],canvas:[t.canvas[0]+n.canvas[0]/e.length,t.canvas[1]+n.canvas[1]/e.length],world:[t.world[0]+n.world[0]/e.length,t.world[1]+n.world[1]/e.length,t.world[2]+n.world[2]/e.length]}),{page:[0,0],client:[0,0],canvas:[0,0],world:[0,0,0]})}function eC(e){return e.reduce((t,n)=>({page:[t.page[0]+n.page[0]/e.length,t.page[1]+n.page[1]/e.length],client:[t.client[0]+n.client[0]/e.length,t.client[1]+n.client[1]/e.length],canvas:[t.canvas[0]+n.canvas[0]/e.length,t.canvas[1]+n.canvas[1]/e.length],world:[t.world[0]+n.world[0]/e.length,t.world[1]+n.world[1]/e.length,t.world[2]+n.world[2]/e.length],touch:{identifier:null,radiusX:t.touch.radiusX+n.touch.radiusX/e.length,radiusY:t.touch.radiusY+n.touch.radiusY/e.length,force:t.touch.force+n.touch.force/e.length,rotationAngle:t.touch.rotationAngle+n.touch.rotationAngle/e.length}}),{page:[0,0],client:[0,0],canvas:[0,0],world:[0,0,0],touch:{identifier:null,radiusX:0,radiusY:0,force:0,rotationAngle:0}})}function eA(e,t){return[e[0]-t[0],e[1]-t[1]]}function eE(e){let t=[];for(let n=0;n({page:e.page+n.page/t.length,client:e.client+n.client/t.length,canvas:e.canvas+n.canvas/t.length,world:e.world+n.world/t.length}),{page:0,client:0,canvas:0,world:0})}function eM(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))}function ey(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))}var eS=n(11185);M.wB.getRuntimeSettings();let{TOUCH_START:eT,TOUCH_START_ACTIVATE:eD,TOUCH_PRESS:eP,TOUCH_DRAG:ek,TOUCH_END:ex,TOUCH_TAP:eL,TOUCH_SWIPE:eV}=D.A,eO={page:[0,0],client:[0,0],canvas:[0,0],world:[0,0,0]},eR={page:0,client:0,canvas:0,world:0},eN={renderingEngineId:void 0,viewportId:void 0,element:null,startPointsList:[{...eO,touch:null}],lastPointsList:[{...eO,touch:null}],isTouchStart:!1,startTime:null,pressTimeout:null,pressDelay:700,pressMaxDistance:5,accumulatedDistance:eR,swipeDistanceThreshold:48,swiped:!1,swipeToleranceMs:300},eU={renderingEngineId:void 0,viewportId:void 0,element:null,startPointsList:[{...eO,touch:null}],taps:0,tapTimeout:null,tapMaxDistance:eS.gI,tapToleranceMs:eS.vU},eF=M.BF.deepClone(eN),eB=M.BF.deepClone(eU);function eG(e,t,n){return(0,M.Hl)(e,t,n)}function eH(e){let t=em(e,eF.element),n=eX(eF.element,eF.lastPointsList),i=t.length===n.length?ef(t,n):eO,a=t.length===n.length?eI(t,n):eR,r=t.length===n.length?ev(t,eF.lastPointsList):eR;eF.accumulatedDistance={page:eF.accumulatedDistance.page+r.page,client:eF.accumulatedDistance.client+r.client,canvas:eF.accumulatedDistance.canvas+r.canvas,world:eF.accumulatedDistance.world+r.world};let o={event:e,eventName:ek,renderingEngineId:eF.renderingEngineId,viewportId:eF.viewportId,camera:{},element:eF.element,startPoints:eC(eF.startPointsList),lastPoints:eC(n),currentPoints:eC(t),startPointsList:e_(eF.startPointsList),lastPointsList:e_(n),currentPointsList:t,deltaPoints:i,deltaDistance:a};eG(eF.element,ek,o),function(e,t){let n=new Date().getTime(),i=eF.startTime.getTime();if(eF.swiped||n-i>eF.swipeToleranceMs)return;let[a,r]=t.canvas,o={event:e,eventName:eV,renderingEngineId:eF.renderingEngineId,viewportId:eF.viewportId,camera:{},element:eF.element,swipe:null};Math.abs(a)>eF.swipeDistanceThreshold&&(o.swipe=a>0?ep.H.RIGHT:ep.H.LEFT,eG(o.element,eV,o),eF.swiped=!0),Math.abs(r)>eF.swipeDistanceThreshold&&(o.swipe=r>0?ep.H.DOWN:ep.H.UP,eG(o.element,eV,o),eF.swiped=!0)}(e,i),eF.lastPointsList=e_(t)}function eW(e){clearTimeout(eF.pressTimeout);let t=em(e,eF.element),n=eX(eF.element,eF.lastPointsList),i=t.length===n.length?ef(t,n):ef(t,t),a=t.length===n.length?eI(t,n):eI(t,t),r={event:e,eventName:ex,element:eF.element,renderingEngineId:eF.renderingEngineId,viewportId:eF.viewportId,camera:{},startPointsList:e_(eF.startPointsList),lastPointsList:e_(n),currentPointsList:t,startPoints:eC(eF.startPointsList),lastPoints:eC(n),currentPoints:eC(t),deltaPoints:i,deltaDistance:a};eG(r.element,ex,r),function(e){if(new Date().getTime()-eF.startTime.getTime()>eB.tapToleranceMs||(0===eB.taps&&(eB.element=eF.element,eB.renderingEngineId=eF.renderingEngineId,eB.viewportId=eF.viewportId,eB.startPointsList=eF.startPointsList),eB.taps>0&&(eB.element!=eF.element||eB.renderingEngineId!=eF.renderingEngineId||eB.viewportId!=eF.viewportId)))return;let t=em(e,eB.element);ev(t,eB.startPointsList).canvas>eB.tapMaxDistance||(clearTimeout(eB.tapTimeout),eB.taps+=1,eB.tapTimeout=setTimeout(()=>{if(eF.isTouchStart){eB=M.BF.deepClone(eU);return}let n={event:e,eventName:eL,element:eB.element,renderingEngineId:eB.renderingEngineId,viewportId:eB.viewportId,camera:{},currentPointsList:t,currentPoints:eC(t),taps:eB.taps};eG(n.element,eL,n),eB=M.BF.deepClone(eU)},eB.tapToleranceMs))}(e),eF=M.BF.deepClone(eN),document.removeEventListener("touchmove",eH),document.removeEventListener("touchend",eW)}function eX(e,t){let{viewport:n}=(0,M.kJ)(e)||{};return n?t.map(e=>{let t;try{t=n.canvasToWorld(e.canvas)}catch(e){var i;if((i=e)instanceof Error&&i.message.includes("because no data is mounted"))return;throw e}return{page:e.page,client:e.client,canvas:e.canvas,world:t,touch:e.touch}}).filter(Boolean):t}let ez=function(e){eF.element=e.currentTarget;let{renderingEngineId:t,viewportId:n}=(0,M.kJ)(eF.element);eF.renderingEngineId=t,eF.viewportId=n,eF.isTouchStart||(clearTimeout(eF.pressTimeout),eF.pressTimeout=setTimeout(()=>(function(e){if(eF.accumulatedDistance.canvas>eF.pressMaxDistance)return;let t={event:e,eventName:eP,renderingEngineId:eF.renderingEngineId,viewportId:eF.viewportId,camera:{},element:eF.element,startPointsList:e_(eF.startPointsList),lastPointsList:e_(eF.lastPointsList),startPoints:ew(eC(eF.startPointsList)),lastPoints:ew(eC(eF.lastPointsList))};eG(t.element,eP,t)})(e),eF.pressDelay),function(e){eF.isTouchStart=!0,eF.startTime=new Date;let t=em(e,eF.element),n=eC(t),i={event:e,eventName:eT,element:eF.element,renderingEngineId:eF.renderingEngineId,viewportId:eF.viewportId,camera:{},startPointsList:t,lastPointsList:t,currentPointsList:t,startPoints:n,lastPoints:n,currentPoints:n,deltaPoints:eO,deltaDistance:eR};eF.startPointsList=e_(i.startPointsList),eF.lastPointsList=e_(i.lastPointsList),eG(i.element,eT,i)&&eG(i.element,eD,i)}(e),document.addEventListener("touchmove",eH),document.addEventListener("touchend",eW))};function e$(e){eg.disable(e),e.removeEventListener("touchstart",ez)}let eY={enable:function(e){e$(e),eg.enable(e),e.addEventListener("touchstart",ez,{passive:!1})},disable:e$},ej=function(e){let t,n,i,a,r=e.currentTarget,{renderingEngineId:o,viewportId:s}=(0,M.kJ)(r);if(e.deltaY>-1&&e.deltaY<1)return;let l=P(e);if(!l)return;e.preventDefault();let{spinX:d,spinY:c,pixelX:h,pixelY:u}=(t=0,n=0,i=0,a=0,"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),i=10*t,a=10*n,"deltaY"in e&&(a=e.deltaY),"deltaX"in e&&(i=e.deltaX),(i||a)&&e.deltaMode&&(1===e.deltaMode?(i*=40,a*=40):(i*=800,a*=800)),i&&!t&&(t=i<1?-1:1),a&&!n&&(n=a<1?-1:1),{spinX:t,spinY:n,pixelX:i,pixelY:a}),g={event:e,eventName:D.A.MOUSE_WHEEL,renderingEngineId:o,viewportId:s,element:r,camera:{},detail:e,wheel:{spinX:d,spinY:c,pixelX:h,pixelY:u,direction:c<0?-1:1},points:l};(0,M.Hl)(r,D.A.MOUSE_WHEEL,g)};function eJ(e){e.removeEventListener("wheel",ej)}let eQ={enable:function(e){eJ(e),e.addEventListener("wheel",ej,{passive:!1})},disable:eJ},eq={renderingEngineId:void 0,viewportId:void 0,key:void 0,keyCode:void 0,element:null},eK={renderingEngineId:void 0,viewportId:void 0,key:void 0,keyCode:void 0,element:null};function eZ(e){eK.element=e.currentTarget;let{renderingEngineId:t,viewportId:n}=(0,M.kJ)(eK.element);eK.renderingEngineId=t,eK.viewportId=n,eK.key=e.key,eK.keyCode=e.keyCode,e.preventDefault();let i={renderingEngineId:eK.renderingEngineId,viewportId:eK.viewportId,element:eK.element,key:eK.key,keyCode:eK.keyCode};(0,M.Hl)(i.element,D.A.KEY_DOWN,i),document.addEventListener("keyup",e1),document.addEventListener("visibilitychange",e0),eK.element.removeEventListener("keydown",eZ)}function e0(){document.removeEventListener("visibilitychange",e0),"hidden"===document.visibilityState&&e2()}function e1(e){let t={renderingEngineId:eK.renderingEngineId,viewportId:eK.viewportId,element:eK.element,key:eK.key,keyCode:eK.keyCode};document.removeEventListener("keyup",e1),document.removeEventListener("visibilitychange",e0),eK.element.addEventListener("keydown",eZ),eK=M.BF.deepClone(eq),(0,M.Hl)(t.element,D.A.KEY_UP,t)}function e2(){eK.keyCode=void 0}function e5(e){e.removeEventListener("keydown",eZ)}let e3={enable:function(e){e5(e),e.addEventListener("keydown",eZ)},disable:e5,getModifierKey:function(){return eK.keyCode}};var e8=n(43385),e4=n(51200),e6=n(17964),e9=n(49007),e7=n(50923),te=n(82006),tt=n(33845),tn=n(12487),ti=n(11492),ta=n(34470),tr=n(60212),to=n(1571),ts=n(98040),tl=n(78985),td=n(62901),tc=n(25002),th=n(46883),tu=n(34699),tg=n(42067),tp=n(46704),tm=n(83048),tf=n(1760),tv=n(69340),tI=n(82147);let{pointCanProjectOnLine:t_}=tt.XL,{p8:tw}=M.Jj,tb=1-tw;class tC extends tf.A{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{storePointData:!1,shadow:!0,preventHandleOutsideImage:!1,contourHoleAdditionModifierKey:S.qv.Shift,alwaysRenderOpenContourHandles:{enabled:!1,radius:2},allowOpenContours:!0,closeContourProximity:10,checkCanvasEditFallbackProximity:6,makeClockWise:!0,subPixelResolution:4,smoothing:{smoothOnAdd:!1,smoothOnEdit:!1,knotsRatioPercentageOnAdd:40,knotsRatioPercentageOnEdit:40},interpolation:{enabled:!1,onInterpolationComplete:null},decimate:{enabled:!1,epsilon:.1},displayOnePointAsCrosshairs:!1,calculateStats:!0,getTextLines:tA,statsCalculator:tm.OA}}){super(e,t),this.isDrawing=!1,this.isEditingClosed=!1,this.isEditingOpen=!1,this.addNewAnnotation=e=>{let{element:t}=e.detail,n=this.createAnnotation(e);this.addAnnotation(n,t);let i=(0,ta.Q0)(t,this.getToolName());return this.activateDraw(e,n,i),e.preventDefault(),(0,tr.A)(i),n},this.handleSelectedCallback=(e,t,n)=>{let{element:i}=e.detail,a=(0,ta.Q0)(i,this.getToolName());this.activateOpenContourEndEdit(e,t,a,n)},this.toolSelectedCallback=(e,t)=>{let{element:n}=e.detail,i=(0,ta.Q0)(n,this.getToolName());t.data.contour.closed?this.activateClosedContourEdit(e,t,i):this.activateOpenContourEdit(e,t,i),e.preventDefault()},this.isPointNearTool=(e,t,n,i)=>{let{viewport:a}=(0,M.kJ)(e),{polyline:r}=t.data.contour,o=a.worldToCanvas(r[0]);for(let e=1;e{let t=this.isDrawing,n=this.isEditingOpen,i=this.isEditingClosed;t?this.cancelDrawing(e):n?this.cancelOpenContourEdit(e):i&&this.cancelClosedContourEdit(e)},this._calculateCachedStats=(e,t,n,i)=>{let{data:a}=e,{cachedStats:r}=a,{polyline:o,closed:s}=a.contour,l=Object.keys(r);for(let n=0;nt.worldToCanvas(e)),p={isPreScaled:(0,tp.u)(t,i),isSuvScaled:this.isSuvScaled(t,i,e.metadata.referencedImageId)},m=(0,tv.j)(h.Modality,e.metadata.referencedImageId,p),f=a.contour.polyline,v=f.length,I=Array(v);for(let e=0;e{let{data:a}=e,r=this.getTargetId(t,a),o={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:n.viewport.id,annotationUID:e.annotationUID},s=this.configuration.getTextLines(a,r);if(!s||0===s.length)return;let l=a.contour.polyline.map(e=>t.worldToCanvas(e));this.renderLinkedTextBoxAnnotation({enabledElement:n,svgDrawingHelper:i,annotation:e,styleSpecifier:o,textLines:s,canvasCoordinates:l})},(0,to.A)(this),(0,ts.A)(this),(0,tl.A)(this),(0,td.A)(this),(0,tc.A)(this),(0,th.A)(this),this._throttledCalculateCachedStats=(0,ti.A)(this._calculateCachedStats,100,{trailing:!0})}filterInteractableAnnotationsForElement(e,t){let n;if(!t?.length)return[];let i=super.filterInteractableAnnotationsForElement(e,t);if(!i?.length)return[];let{viewport:a}=(0,M.kJ)(e);if(a instanceof M.PX){let e=a.getCamera(),{spacingInNormalDirection:t}=M.BF.getTargetVolumeAndSpacingInNormalDir(a,e);n=this.filterAnnotationsWithinSlice(i,e,t)}else n=(0,tn.k9)(a,t);return n}filterAnnotationsWithinSlice(e,t,n){let{viewPlaneNormal:i}=t,a=e.filter(e=>{let n=e.metadata.viewPlaneNormal;if(!e.metadata.referencedImageId&&!n&&e.metadata.FrameOfReferenceUID){for(let n of e.data.contour.polyline){let e=e7.jb(e7.vt(),n,t.focalPoint),i=e7.Om(e,t.viewPlaneNormal);if(!M.BF.isEqual(i,0))return!1}return e.metadata.viewPlaneNormal=t.viewPlaneNormal,e.metadata.cameraFocalPoint=t.focalPoint,!0}if(!n){let{referencedImageId:t}=e.metadata,{imageOrientationPatient:i}=M.wx.get("imagePlaneModule",t),a=e7.fA(i[0],i[1],i[2]),r=e7.fA(i[3],i[4],i[5]);n=e7.vt(),e7.$A(n,a,r),e.metadata.viewPlaneNormal=n}let a=Math.abs(e7.Om(i,n))>tb;return n&&a});if(!a.length)return[];let r=n/2,{focalPoint:o}=t,s=[];for(let e of a){let t=e.data.contour.polyline[0];if(!e.isVisible)continue;let n=e7.vt();e7.jb(n,o,t),Math.abs(e7.Om(n,i)){e.data.handles.points.length=0}})}getAnnotationStyle(e){return super.getAnnotationStyle(e)}renderAnnotationInstance(e){let{enabledElement:t,targetId:n,svgDrawingHelper:i}=e,a=e.annotation,r=!1,{viewport:o,renderingEngine:s}=t,l=this.isDrawing,d=this.isEditingOpen,c=this.isEditingClosed;if(l||d||c){let e=this.commonData.annotation.annotationUID;if(a.annotationUID===e)if(l)this.renderContourBeingDrawn(t,i,a);else if(c)this.renderClosedContourBeingEdited(t,i,a);else if(d)this.renderOpenContourBeingEdited(t,i,a);else throw Error(`Unknown ${this.getToolName()} annotation rendering state`);else this.configuration.displayOnePointAsCrosshairs&&1===a.data.contour.polyline.length?this.renderPointContourWithMarker(t,i,a):this.renderContour(t,i,a);r=!0}else this.configuration.displayOnePointAsCrosshairs&&1===a.data.contour.polyline.length?this.renderPointContourWithMarker(t,i,a):this.renderContour(t,i,a);if(!this.configuration.calculateStats)return;let{data:h,invalidated:u}=a,g=h?.cachedStats;return(u||!g?.[n])&&this._calculateStatsIfActive(a,n,o,s,t),this._renderStats(a,o,t,i),r}_calculateStatsIfActive(e,t,n,i,a){let r=this.commonData?.annotation.annotationUID;if((e.annotationUID!==r||this.commonData?.movingTextBox)&&!this.commonData?.movingTextBox){let{data:r}=e;r.cachedStats[t]?.unit?e.invalidated&&this._throttledCalculateCachedStats(e,n,i,a):(r.cachedStats[t]={Modality:null,area:null,max:null,mean:null,stdDev:null,areaUnit:null,unit:null},this._calculateCachedStats(e,n,i,a))}}updateClosedCachedStats({viewport:e,points:t,imageData:n,metadata:i,voxelManager:a,cachedStats:r,targetId:o,modalityUnit:s,canvasCoordinates:l,calibratedScale:d,deltaInX:c,deltaInY:h}){let u,{areaUnit:g,unit:p}=d,m=t.map(e=>n.worldToIndex(e)),f=n.getDimensions(),v=Number.MAX_SAFE_INTEGER,I=Number.MIN_SAFE_INTEGER,_=Number.MAX_SAFE_INTEGER,w=Number.MIN_SAFE_INTEGER,b=Number.MAX_SAFE_INTEGER,C=Number.MIN_SAFE_INTEGER;for(let e=0;e{let i=!0,a=e.worldToCanvas(t);a[1]!=x&&(V=0,x=a[1],(L=(0,tg.getLineSegmentIntersectionsCoordinates)(l,a,[k[0],a[1]])).sort(function(e,t){return e[0]===t[0]?0:e[0]L[0][0]&&(L.shift(),V++),V%2==0&&(i=!1),i},boundsIJK:D,returnPoints:this.configuration.storePointData}));let O=this.configuration.statsCalculator.getStatistics(),R={name:"area",value:A,unit:g,type:S.Jf.Area},N={name:"perimeter",value:E,unit:p,type:S.Jf.Linear};r[o]={Modality:i.Modality,area:A,perimeter:E,mean:O.mean?.value,max:O.max?.value,min:O.min?.value,stdDev:O.stdDev?.value,statsArray:[R,N,...O.array],pointsInShape:u,areaUnit:g,modalityUnit:s,unit:p}}updateOpenCachedStats({targetId:e,metadata:t,cachedStats:n,modalityUnit:i,calibratedScale:a,imageData:r,points:o}){let{unit:s}=a,l=o.map(e=>r.worldToIndex(e)),d=tC.calculateLengthInIndex(a,l),c={name:"length",value:d,unit:s,type:S.Jf.Linear};n[e]={Modality:t.Modality,length:d,modalityUnit:i,unit:s,statArray:[c]}}}function tA(e,t){let{area:n,mean:i,stdDev:a,length:r,perimeter:o,max:s,min:l,isEmptyArea:d,unit:c,areaUnit:h,modalityUnit:u}=e.cachedStats[t]||{},g=[];if(M.BF.isNumber(n)){let e=d?"Area: Oblique not supported":`Area: ${M.BF.roundNumber(n)} ${h}`;g.push(e)}return M.BF.isNumber(i)&&g.push(`Mean: ${M.BF.roundNumber(i)} ${u}`),M.BF.isNumber(s)&&g.push(`Max: ${M.BF.roundNumber(s)} ${u}`),M.BF.isNumber(l)&&g.push(`Min: ${M.BF.roundNumber(l)} ${u}`),M.BF.isNumber(a)&&g.push(`Std Dev: ${M.BF.roundNumber(a)} ${u}`),M.BF.isNumber(o)&&g.push(`Perimeter: ${M.BF.roundNumber(o)} ${c}`),M.BF.isNumber(r)&&g.push(`${M.BF.roundNumber(r)} ${c}`),g}tC.toolName="PlanarFreehandROI";let tE=tC;var tM=n(20832);class ty extends tE{constructor(e){super(M.BF.deepMerge({configuration:{calculateStats:!1,allowOpenContours:!1}},e))}isContourSegmentationTool(){return!0}renderAnnotationInstance(e){let t=e.annotation,{invalidated:n}=t,i=super.renderAnnotationInstance(e);if(n){let{segmentationId:e}=t.data.segmentation;(0,e9.triggerSegmentationDataModified)(e)}return i}}ty.toolName="PlanarFreehandContourSegmentationTool",tM.A.register(ty);let tS=ty;var tT=n(42306),tD=n(87944),tP=n(4055);let tk=tS.toolName;class tx{constructor(){this._needsRender=new Set,this._pendingRenderQueue=[],this._animationFrameSet=!1,this._animationFrameHandle=null,this._getAllViewports=()=>(0,M.qO)().flatMap(e=>e.getViewports()),this._renderFlaggedSegmentations=()=>{if(this._throwIfDestroyed(),Array.from(this._needsRender).forEach(e=>{this._triggerRender(e)}),this._needsRender.clear(),this._animationFrameSet=!1,this._animationFrameHandle=null,this._pendingRenderQueue.length>0){let e=this._pendingRenderQueue.shift();e&&e.length>0&&this._setViewportsToBeRenderedNextFrame(e)}}}renderSegmentationsForViewport(e){let t=e?[e]:this._getViewportIdsForSegmentation();this._setViewportsToBeRenderedNextFrame(t)}renderSegmentation(e){let t=this._getViewportIdsForSegmentation(e);this._setViewportsToBeRenderedNextFrame(t)}_getViewportIdsForSegmentation(e){let t=this._getAllViewports(),n=[];for(let i of t){let t=i.id;if(e){let i=(0,e4.r$)(t,{segmentationId:e});i?.length>0&&n.push(t)}else{let e=(0,e4.r$)(t);e?.length>0&&n.push(t)}}return n}_throwIfDestroyed(){if(this.hasBeenDestroyed)throw Error("this.destroy() has been manually called to free up memory, can not longer use this instance. Instead make a new one.")}_setViewportsToBeRenderedNextFrame(e){if(this._animationFrameSet)return void this._pendingRenderQueue.push(e);e.forEach(e=>{this._needsRender.add(e)}),this._render()}_render(){this._needsRender.size>0&&!1===this._animationFrameSet&&(this._animationFrameHandle=window.requestAnimationFrame(this._renderFlaggedSegmentations),this._animationFrameSet=!0)}_triggerRender(e){let t=(0,e4.r$)(e);if(!t?.length)return;let{viewport:n}=(0,M.yj)(e)||{};n&&Promise.allSettled(t.map(e=>{e.type===S.D_.Contour&&this._addPlanarFreeHandToolIfAbsent(n);let t=(0,tP.I)(e.type),i=void 0!==(0,e8.T)(e.segmentationId).representationData[e.type];return t?t.render(n,e).then(()=>(i||(0,tD.Np)(n,e.segmentationId,e.type),{segmentationId:e.segmentationId,type:e.type})).catch(t=>(console.error(t),{segmentationId:e.segmentationId,type:e.type})):(console.warn(`No display registered for segmentation representation type ${e.type}.`),Promise.resolve({segmentationId:e.segmentationId,type:e.type}))})).then(e=>{let t=e.filter(e=>"fulfilled"===e.status).map(e=>e.value);n.element.addEventListener(M.fX.sV.IMAGE_RENDERED,function e(n){let{element:i,viewportId:a}=n.detail;i.removeEventListener(M.fX.sV.IMAGE_RENDERED,e),t.forEach(e=>{let t={viewportId:a,segmentationId:e.segmentationId,type:e.type};(0,M.Hl)(M.tX,S.sV.SEGMENTATION_RENDERED,{...t})})}),n.render()})}_addPlanarFreeHandToolIfAbsent(e){tk in e6.wk.tools||(0,T.Gx)(tS);let t=(0,tT.getToolGroupForViewport)(e.id);t.hasTool(tk)||(t.addTool(tk),t.setToolPassive(tk))}}function tL(e){tR.renderSegmentationsForViewport(e)}function tV(e){tR.renderSegmentation(e)}let tO=new Map,tR=new tx;var tN=n(66442),tU=n(91792),tF=n(87352),tB=n(54261),tG=n(10355),tH=n(69301);function tW(e){return e.referencedImageIds?.length?e.referencedImageIds:(e.imageIds??(e.volumeId?M.PP.getVolume(e.volumeId)?.imageIds:void 0)??[]).map(e=>M.PP.getImage(e)?.referencedImageId).filter(Boolean)}function tX(e,t,n){if(n!==S.D_.Labelmap||!e)return!0;let i=(0,e8.T)(t);if(!i)return!0;let a=(0,tH.m)(i);return"function"==typeof e.getAllVolumeIds?function(e,t){let n;try{n=e.getFrameOfReferenceUID?.()}catch(e){return!0}if(!n)return!0;let i=t.flatMap(e=>(function(e){let t=new Set;if(e.volumeId){let n=M.PP.getVolume(e.volumeId)?.metadata?.FrameOfReferenceUID;n&&t.add(n)}for(let n of tW(e)){let e=M.wx.get("imagePlaneModule",n)?.frameOfReferenceUID;e&&t.add(e)}return[...t]})(e));return!i.length||i.includes(n)}(e,a):function(e,t){let n,i=t.flatMap(e=>tW(e));if(!i.length)return!0;try{n=e.getImageIds?.()??[]}catch(e){return!0}if(!n.length)return!0;let a=new Set(i);return n.some(e=>a.has(e))}(e,a)}var tz=n(61689),t$=n(5469),tY=n(97132);function tj(e){return`${e}-${S.D_.Labelmap}`}function tJ({segmentationId:e,referencedId:t,sliceStateKey:n}){return[tj(e),t,n].filter(Boolean).join("-")}function tQ(e,t){return"string"==typeof e&&e.startsWith(tj(t))}let tq=function(e,t,n){let i=n.representationUID;return!!tQ(i,t)&&"function"==typeof e.removeData&&(M.BF.genericViewportDisplaySetMetadataProvider.remove(i),e.removeData(i),!0)};function tK(e,t){if("function"!=typeof e.getCurrentImageId)return;let n=e.getCurrentImageId();if(!n||!tX(e,t,S.D_.Labelmap))return;(0,tz.t)(e.id,t);let i=(0,t$.aF)(e.id,t)??[],a=new Set(i),r=((0,tY.ED)(e.id,t)??[]).filter(e=>!a.has(e.referencedId)),o=function(e){let t=e?.getProperty?.();if(t)return{cfun:t.getRGBTransferFunction?.(0),ofun:t.getScalarOpacity?.(0)}}(r[0]?.actor),s=!1,l=r.length>0;if(r.length){let n=[];r.forEach(i=>{tq(e,t,i)||n.push(i.uid)}),n.length&&e.removeActors(n),s=!0}let d=(0,tU.A)(e),c=e.getDefaultActor()?.actorMapper?.renderMode,h=M.PP.getImage(n)||{imageId:n},{origin:u}=e.getImageDataMetadata(h);i.forEach(n=>{let i=M.PP.getImage(n);if(!i)return void console.warn("No derived image found in the cache for segmentation representation",{segmentationId:t,derivedImageId:n});let a=(0,tY.ED)(e.id,t)?.find(e=>e.referencedId===n);if(!a){let a=tJ({segmentationId:t,referencedId:i.imageId});if("image"===d&&c===M.T7.CPU_IMAGE)e.addImages([{dataId:a,imageId:n,reference:{kind:"segmentation",segmentationId:t,representationUID:a,labelmapId:i.imageId},representationUID:a}]);else{let{dimensions:r,spacing:s,direction:l}=e.getImageDataMetadata(i),d=new(i.voxelManager.getConstructor())(i.voxelManager.getScalarData()),c=tF.Ay.newInstance({dataType:tF.Ay.getDataType(d),name:"Pixels",numberOfComponents:1,values:d}),h=tB.Ay.newInstance();h.setDimensions(r[0],r[1],1),h.setSpacing(s),h.setDirection(l),h.setOrigin(u),h.getPointData().setScalars(c),h.modified(),e.addImages([{dataId:a,imageId:n,reference:{kind:"segmentation",segmentationId:t,representationUID:a,labelmapId:i.imageId},representationUID:a,callback:({imageActor:e})=>{e.getMapper().setInputData(h),function(e,t){let n=e?.getProperty?.();if(n){if(t?.cfun&&n.setRGBTransferFunction&&n.setRGBTransferFunction(0,t.cfun),t?.ofun&&n.setScalarOpacity)n.setScalarOpacity(0,t.ofun);else if(n.setScalarOpacity){let e=tG.Ay.newInstance();e.addPoint(0,0),e.addPoint(1,1),e.setClamping(!1),n.setScalarOpacity(0,e)}n.setUseLookupTableScalarRange?.(!0),n.setInterpolationTypeToNearest?.(),e?.setForceTranslucent?.(!0),e?.setForceOpaque?.(!1)}}(e,o)}}])}s=!0,l=!0;return}let r=a.actorMapper,h=(r?.mapper?r.mapper:a.actor.getMapper()).getInputData();h.modified(),h.setDerivedImage?h.setDerivedImage(i):M.BF.updateVTKImageDataWithCornerstoneImage(h,i),l=!0}),s&&tL(e.id),l&&e.render()}var tZ=n(69435),t0=n(93084);let t1=function(e){let{segmentationId:t,modifiedSlicesToUse:n}=e.detail,{representationData:i}=(0,e8.T)(t),a=(0,tZ.P)(t),r=[],o=[],s=[];a.forEach(e=>{let n=(e=>{let t=(0,M.yj)(e);return t?.viewport??void 0})(e);if(!n)return;let i=(0,e4.r$)(e,{segmentationId:t,type:S.D_.Labelmap})[0],a=(0,t0.bY)((0,e8.T)(t),i?.config),l=(0,tU.A)(n,{useSliceRendering:a});if("volume"===l)return void r.push(e);"image"===l&&(a&&(0,t0.QO)(n)?s.push(e):o.push(e))});let l=r.length>0,d=o.length>0;l&&function({modifiedSlicesToUse:e,representationData:t,type:n}){(function(e){let t=[],n=new Set,i=e=>{!e?.volumeId||n.has(e.volumeId)||(n.add(e.volumeId),t.push(e))};return Object.values(e?.labelmaps??{}).forEach(e=>{i((0,tN.kL)(e))}),i(e?.volumeId&&M.PP.getVolume(e.volumeId)),t})(t[n]).forEach(t=>{let n,{imageData:i,vtkOpenGLTexture:a,voxelManager:r}=t;n=e?.length>0?e:[...Array(i.getDimensions()[2]).keys()],a?.setUpdatedFrame&&n.forEach(e=>{a.setUpdatedFrame(e)}),r?.invalidateCache?.(),i.modified();let o=t.imageIds?.length??i.getDimensions()[2]??0,s=t.metadata?.FrameOfReferenceUID??"";(0,M.Hl)(M.tX,M.fX.sV.IMAGE_VOLUME_MODIFIED,{volumeId:t.volumeId,FrameOfReferenceUID:s,numberOfFrames:o,framesProcessed:o})})}({modifiedSlicesToUse:l&&d?[]:n,representationData:i,type:S.D_.Labelmap}),d&&function({viewportIds:e,segmentationId:t}){e.forEach(e=>{let n=(0,e4.r$)(e,{segmentationId:t});(n=n.filter(e=>e.type===S.D_.Labelmap)).forEach(n=>{if(n.segmentationId!==t)return;let i=(0,M.yj)(e);if(!i)return;let{viewport:a}=i;"image"===(0,tU.A)(a)&&"function"==typeof a.getCurrentImageId&&tK(a,t)})})}({viewportIds:o,segmentationId:t}),s.forEach(e=>{tL(e)})},t2=function(e){let{segmentationId:t}=e.detail,{representationData:n}=(0,e8.T)(t);n.Labelmap&&t1(e),tR._getViewportIdsForSegmentation(t).forEach(e=>{let{viewport:t}=(0,M.yj)(e)||{};if(!t)return;if(!function(e){if(e.getBlendMode?.()===M.fX.gd.LABELMAP_EDGE_PROJECTION_BLEND)return!0;if("function"!=typeof e.getDisplaySetPresentation)return!1;let t=[],n=e.getSourceDataId?.();return n&&t.push(n),e.getActors?.().forEach(e=>{e.representationUID&&t.push(String(e.representationUID))}),t.some(t=>(e.getDisplaySetPresentation(t)?.slabThickness??0)>0)}(t))return void tR.renderSegmentationsForViewport(e);let n=tO.get(e);void 0!==n&&clearTimeout(n),tO.set(e,setTimeout(()=>{tO.delete(e),tR.renderSegmentationsForViewport(e)},240))})},t5=function(e){let{segmentationId:t}=e.detail;tV(t)},t3=new Map;function t8(e){let{viewportId:t,renderingEngineId:n}=e.detail,i=(0,M.b1)(t,n);if(!i)return;let{viewport:a}=i;M.ei;let r=(0,e4.r$)(t);if(!r?.length)return void t3.delete(t);let o=r.filter(e=>e.type===S.D_.Labelmap),s=o.some(e=>{let t=(0,e8.T)(e.segmentationId);return(0,t0.QO)(a)&&(0,t0.bY)(t,e.config)});if(e.type===M.fX.sV.CAMERA_MODIFIED){if(s){let e=(0,t0.o)(a);if(t3.get(t)===e.key)return;t3.set(t,e.key),tL(t);return}if(a.type!==M.fX.NV.PLANAR_NEXT)return void t3.delete(t)}"image"!==(0,tU.A)(a)||(0,t0.QO)(a)||"function"!=typeof a.getCurrentImageId||o.forEach(t=>{let{segmentationId:n}=t;tK(a,n),e.type===M.fX.sV.IMAGE_RENDERED&&a.element.removeEventListener(M.fX.sV.IMAGE_RENDERED,t8)})}let t4={enable:function(e){if(!e)return;let t=(0,M.kJ)(e);if(!t)return;let{viewport:n}=t,i=n instanceof M.ei,a=n.type===M.fX.NV.PLANAR_NEXT,r="function"==typeof n.getCurrentImageId;(i||a)&&e.addEventListener(M.fX.sV.CAMERA_MODIFIED,t8),!i&&r&&"image"===(0,tU.A)(n)&&(e.addEventListener(M.fX.sV.PRE_STACK_NEW_IMAGE,t8),e.addEventListener(M.fX.sV.IMAGE_RENDERED,t8))},disable:function(e){let t=(0,M.kJ)(e)?.viewport?.id;e.removeEventListener(M.fX.sV.PRE_STACK_NEW_IMAGE,t8),e.removeEventListener(M.fX.sV.IMAGE_RENDERED,t8),e.removeEventListener(M.fX.sV.CAMERA_MODIFIED,t8),t&&t3.delete(t)}};var t6=n(98723),t9=n(21167),t7=n(26410),ne=n(4546),nt=n(42018),nn=n(28402),ni=n(63306),na=n(36965),nr=n(76818);let no="PlanarFreehandContourSegmentationTool",{DefaultHistoryMemo:ns}=M.BF.HistoryMemo;function nl(e,t,n){if(!(0,T.l$)(no)){console.warn(`${no} is not registered. Cannot apply stroke.`),nd(t);return}let i=(0,ni.RZ)(t.data.contour.polyline,e);if(i.length<3)return void nd(t);let a=function(e,t){let n=t.annotationUID;return(0,y.getAllAnnotations)().filter(i=>!!i.annotationUID&&i.annotationUID!==n&&!!(0,t7.A)(i)&&!!function(e,t){let{segmentation:n}=e.data,{segmentation:i}=t.data;return n.segmentationId===i.segmentationId&&n.segmentIndex===i.segmentIndex}(i,t)&&!!e.isReferenceViewable(i.metadata)&&!i.parentAnnotationUID)}(e,t),r=a.map(t=>{let n=(0,ni.RZ)(t.data.contour.polyline,e),i=(0,ni.Yo)(e,t).map(e=>e.polyline);return{outer:n,holes:i.length?i:void 0}}),o=(0,nt.NE)(i);if(0===o.length)return void nd(t);let s=(0,nt.ZC)(r,o,n),l=n===nt.Gi.Union?(0,nn.v)(s):s,d=[];for(let t of a)for(let n of(d.push(t),(0,ni.Yo)(e,t)))d.push(n.annotation);let c=[t,...d];for(let e of c)nd(e);let h=a[0]??t,{element:u}=e,g=[];for(let t of l){if(t.outer.length<3)continue;let n=(0,ni.oN)(e,h,t.outer,ne.W.Clockwise);(0,y.addAnnotation)(n,u),(0,na.V)(n),g.push(n),t.holes?.forEach(t=>{if(t.length<3)return;let i=(0,ni.oN)(e,h,t,ne.W.CounterClockwise);(0,y.addAnnotation)(i,u),(0,y.addChildAnnotation)(n,i),g.push(i),(0,tu.triggerAnnotationModified)(i,u)}),(0,tu.triggerAnnotationModified)(n,u)}(function(e,t,n,i){let a={id:e.annotationUID,operationType:"annotation",restoreMemo:(e=!0)=>{let a=e?n:t,r=e?t:n;(function(e){for(let t=e.length-1;t>=0;t--){let n=e[t];(0,y.getAnnotation)(n.annotationUID)&&(0,y.removeAnnotation)(n.annotationUID),(0,nr.M)(n)}})(a),function(e,t){for(let n of e)(0,y.getAnnotation)(n.annotationUID)||((0,y.addAnnotation)(n,t),(0,na.V)(n))}(r,i.element),(0,ni.AL)(i,[...a,...r])}};ns.replaceCurrentMemo(a,t=>t.id===e.annotationUID&&"annotation"===t.operationType)})(t,d,g,e),(0,ni.AL)(e,c)}function nd(e){(0,y.removeAnnotation)(e.annotationUID),(0,nr.M)(e)}async function nc(e){let t=e.detail.annotation;if(!(0,t7.A)(t))return;let n=function(e){let t=(0,t9.A)(e);return t.find(e=>(function(e,t=!1){let n,i="PlanarFreehandContourSegmentationTool",a=(0,tT.getToolGroupForViewport)(e.id,e.renderingEngineId);return a?a.hasTool(i)?a.getToolOptions(i)||(n=`Tool ${i} must be in active/passive state in ${a.id} toolGroup`):n=`Tool ${i} not added to ${a.id} toolGroup`:n=`ToolGroup not found for viewport ${e.id}`,n&&!t&&console.warn(n),!n})(e,!0))??t[0]}(t),{contourHoleProcessingEnabled:i=!1}=e.detail;i?nl(n,t,nt.Gi.Difference):nl(n,t,nt.Gi.Union),(0,M.Hl)(M.tX,S.sV.ANNOTATION_CUT_MERGE_PROCESS_COMPLETED,{element:n.element,sourceAnnotation:t})}function nh(e){let t=e.detail.annotation;t6.Ys(t)&&nc(e)}let nu=function(e){e.detail.removed.length&&(0,M.qO)().forEach(e=>{let t=e.getViewports().map(e=>e.id);(0,tr.t)(t)})},ng=function(e){let{viewportId:t}=e.detail;(0,tr.A)([t])};function np(e){let t=e.detail.annotation;t6.Ys(t)&&function(e){let t=e.detail.annotation;(0,t6.M)(t)}(e)}var nm=n(83409);let nf=function(e){(0,nm.A)(e.detail.element)},nv={enable:function(e){e.addEventListener(M.fX.sV.IMAGE_RENDERED,nf)},disable:function(e){e.removeEventListener(M.fX.sV.IMAGE_RENDERED,nf)}};var nI=n(40812);let{Active:n_}=nI.A;function nw(e,t,n){let i;if(e6.wk.isInteractingWithTool)return!1;let{renderingEngineId:a,viewportId:r}=n.detail,o=(0,tT.getToolGroupForViewport)(r,a);if(!o)return!1;let s=Object.keys(o.toolOptions);for(let e=0;e{for(let o of i){if(o.isLocked||!o.isVisible)continue;let i=t.getHandleNearImagePoint(e,o,n,a);if(i){r.push({tool:t,annotation:o,handle:i});break}}}),r}function nS(e,t){let n=[];for(let i=0;i0&&n.push({tool:a,annotations:r}))}return n}function nT(e,t,n,i="mouse"){let a="touch"===i?eS.Y2:eS.QG,r=[];return t.forEach(({tool:t,annotations:o})=>{for(let s of o)if(!s.isLocked&&s.isVisible&&t.isPointNearTool(e,s,n,a,i)){r.push({tool:t,annotation:s});break}}),r}var nD=n(62196);let{Active:nP}=S.r$;function nk(e){let{renderingEngineId:t,viewportId:n,event:i}=e.detail,a=(0,nD.A)(i)||e3.getModifierKey(),r=(0,tT.getToolGroupForViewport)(n,t);if(!r)return null;let o=Object.keys(r.toolOptions),s=r.getDefaultMousePrimary(),l=e.detail.buttons??i?.buttons??s;for(let e=0;ee.mouseButton===l&&e.modifierKey===a);if(n.mode===nP&&i)return r.getToolInstance(t)}}function nx(e,t,n){let{renderingEngineId:i,viewportId:a}=e.detail,r=(0,tT.getToolGroupForViewport)(a,i);if(!r)return[];let o=[],s=Object.keys(r.toolOptions);for(let e=0;ee.mouseButton===n);if(t.includes(a.mode)&&(!n||l)){let e=r.getToolInstance(i);o.push(e)}}return o}let{Active:nL,Passive:nV}=S.r$,{Active:nO,Passive:nR}=S.r$;function nN(e){if(e6.wk.isInteractingWithTool)return;let t=nk(e);if(t&&"function"==typeof t.preMouseDownCallback&&t.preMouseDownCallback(e))return;let n=[...nx(e,[nO])||[],...nx(e,[nR])||[]];if(function(e){if(e6.wk.isInteractingWithTool)return!1;let t=e.detail,{element:n}=t,i=(0,M.kJ)(n),{canvas:a}=t.currentPoints;if(!i)return!1;let r=function(e,t){let n=new Map,{renderingEngineId:i,viewportId:a}=e.detail,r=(0,tT.getToolGroupForViewport)(a,i);if(!r)return n;let o=Object.keys(r.toolOptions),s=r.getDefaultMousePrimary(),l=e.detail.event,d=l?.buttons??s,c=(0,nD.A)(l)||e3.getModifierKey();for(let e=0;ee.bindings?.length&&e.bindings.some(e=>e.mouseButton===d&&e.modifierKey===c));l&&n.set(a,l)}return n}(e,[nL,nV]),o=nS(n,Array.from(r.keys())),s=nT(n,o,a);if(s.length>0){let{tool:t,annotation:n}=s[0],i=r.get(t);return("string"==typeof i.method?t[i.method]:i.method).call(t,e,n),!0}return!1}(e))return;let i=e.detail,{element:a}=i,r=nS(a,n),o=i.currentPoints.canvas,s=ny(a,r,o,"mouse"),l=!!e.detail.event.shiftKey;if(s.length>0){let{tool:t,annotation:n,handle:i}=nU(s);nF(n.annotationUID,l),t.handleSelectedCallback(e,n,i,"Mouse");return}let d=nT(a,r,o,"mouse");if(d.length>0){let{tool:t,annotation:n}=nU(d);nF(n.annotationUID,l),t.toolSelectedCallback(e,n,"Mouse",o);return}if(t&&"function"==typeof t.postMouseDownCallback&&t.postMouseDownCallback(e))return}function nU(e){if(e.length>1){let t=e.find(e=>{let t=!(0,nE.Gh)(e.annotation.annotationUID),n=(0,nM.YY)(e.annotation.annotationUID);return t&&n});if(t)return t}return e[0]}function nF(e,t=!1){t?(0,nA.zN)(e)?(0,nA.L6)(e,!1):(0,nA.L6)(e,!0,!0):(0,nA.L6)(e,!0,!1)}function nB(e){if(e6.wk.isInteractingWithTool)return;let t=nk(e);if(t&&!e6.wk.isMultiPartToolActive&&t.addNewAnnotation)try{let n=t.addNewAnnotation(e,"mouse");(0,nA.L6)(n.annotationUID)}catch(e){console.warn("Error adding new annotation, viewport not ready:",e)}}function nG(e){if(e6.wk.isInteractingWithTool)return;let t=nk(e);t&&"function"==typeof t.mouseDragCallback&&t.mouseDragCallback(e)}let{Active:nH,Passive:nW}=S.r$;function nX(e){if(e6.wk.isInteractingWithTool||e6.wk.isMultiPartToolActive)return;let t=nx(e,[nH,nW]),{element:n}=e.detail,i=nS(n,t),a=t.filter(e=>!i.some(t=>t.tool.getToolName()===e.getToolName())),r=!1;for(let{tool:t,annotations:n}of i)"function"==typeof t.mouseMoveCallback&&(r=t.mouseMoveCallback(e,n)||r);a.forEach(t=>{"function"==typeof t.mouseMoveCallback&&t.mouseMoveCallback(e)}),!0===r&&(0,nm.A)(n)}let nz=nw.bind(null,"Mouse","mouseUpCallback");var n$=n(94070);let nY=function(e){if(e6.wk.isInteractingWithTool)return;e.detail.buttons=n$.i.Wheel|(e.detail.event.buttons||0);let t=nk(e);if(t)return t.mouseWheelCallback(e)},nj={enable:function(e){e.addEventListener(D.A.MOUSE_CLICK,nb),e.addEventListener(D.A.MOUSE_DOWN,nN),e.addEventListener(D.A.MOUSE_DOWN_ACTIVATE,nB),e.addEventListener(D.A.MOUSE_DOUBLE_CLICK,nC),e.addEventListener(D.A.MOUSE_DRAG,nG),e.addEventListener(D.A.MOUSE_MOVE,nX),e.addEventListener(D.A.MOUSE_UP,nz),e.addEventListener(D.A.MOUSE_WHEEL,nY)},disable:function(e){e.removeEventListener(D.A.MOUSE_CLICK,nb),e.removeEventListener(D.A.MOUSE_DOWN,nN),e.removeEventListener(D.A.MOUSE_DOWN_ACTIVATE,nB),e.removeEventListener(D.A.MOUSE_DOUBLE_CLICK,nC),e.removeEventListener(D.A.MOUSE_DRAG,nG),e.removeEventListener(D.A.MOUSE_MOVE,nX),e.removeEventListener(D.A.MOUSE_UP,nz),e.removeEventListener(D.A.MOUSE_WHEEL,nY)}},{Active:nJ}=S.r$;function nQ(e){let{renderingEngineId:t,viewportId:n}=e.detail,i=B.mouseButton,a=e3.getModifierKey(),r=(0,tT.getToolGroupForViewport)(n,t);if(!r)return null;let o=Object.keys(r.toolOptions),s=r.getDefaultMousePrimary();for(let e=0;ee.mouseButton===(i??s)&&e.modifierKey===a))return r.getToolInstance(t)}}function nq(e){let t=nQ(e);if(t){let{renderingEngineId:n,viewportId:i}=e.detail,a=(0,tT.getToolGroupForViewport)(i,n),r=t.getToolName();Object.keys(a.toolOptions).includes(r)&&a.setViewportsCursorByToolName(r)}let n=function(e,t){let n=new Map,{renderingEngineId:i,viewportId:a}=e.detail,r=(0,tT.getToolGroupForViewport)(a,i);if(!r)return n;let o=Object.keys(r.toolOptions),s=e.detail.key;for(let e=0;ee.bindings?.some(e=>e.key===s));c&&n.set(a,c)}return n}(e,[nI.A.Active]);if(n?.size){let{element:t}=e.detail;for(let[i,a]of[...n.entries()])("function"==typeof a.method?a.method:i[a.method]).call(i,t,a,e)}}function nK(e){let t=nQ(e);if(!t)return;let{renderingEngineId:n,viewportId:i}=e.detail,a=(0,tT.getToolGroupForViewport)(i,n);e2();let r=t.getToolName();Object.keys(a.toolOptions).includes(r)&&a.setViewportsCursorByToolName(r)}let nZ={enable:function(e){e.addEventListener(D.A.KEY_DOWN,nq),e.addEventListener(D.A.KEY_UP,nK)},disable:function(e){e.removeEventListener(D.A.KEY_DOWN,nq),e.removeEventListener(D.A.KEY_UP,nK)}},{Active:n0,Passive:n1,Enabled:n2}=S.r$,n5=function(e){nx(e,[n0,n1,n2]).forEach(t=>{t.onCameraModified&&t.onCameraModified(e)})},n3={enable:function(e){e.addEventListener(M.fX.sV.CAMERA_MODIFIED,n5)},disable:function(e){e.removeEventListener(M.fX.sV.CAMERA_MODIFIED,n5)}},{Active:n8,Passive:n4,Enabled:n6}=S.r$,n9=function(e){nx(e,[n8,n4,n6]).forEach(t=>{t.onImageSpacingCalibrated&&t.onImageSpacingCalibrated(e)})},n7={enable:function(e){e.addEventListener(M.fX.sV.IMAGE_SPACING_CALIBRATED,n9)},disable:function(e){e.removeEventListener(M.fX.sV.IMAGE_SPACING_CALIBRATED,n9)}},{Active:ie}=S.r$;function it(e){let{renderingEngineId:t,viewportId:n}=e.detail,i=e.detail.event,a=(0,tT.getToolGroupForViewport)(n,t);if(!a)return null;let r=Object.keys(a.toolOptions),o=Object.keys(i.touches).length,s=(0,nD.A)(i)||e3.getModifierKey(),l=a.getDefaultMousePrimary();for(let e=0;e(e.numTouchPoints===o||1===o&&e.mouseButton===l)&&e.modifierKey===s);if(n.mode===ie&&i)return a.getToolInstance(t)}}function ii(e,t,n){return"function"==typeof e?.[t]?n=>e[t](n):e?.supportedInteractionTypes?.includes("Touch")&&"function"==typeof e[n]?t=>{var i;return i=t.detail,i.mouseButton??=S.iP.Primary,i.startPoints??=i.currentPoints,i.lastPoints??=i.currentPoints,i.deltaPoints??={page:[0,0],client:[0,0],canvas:[0,0],world:[0,0,0]},e[n](t)}:void 0}function ia(e,t,n){let{renderingEngineId:i,viewportId:a}=e.detail,r=(0,tT.getToolGroupForViewport)(a,i);if(!r)return[];let o=[],s=Object.keys(r.toolOptions);for(let e=0;ee.numTouchPoints===n);if(t.includes(a.mode)&&(!n||l)){let e=r.getToolInstance(i);o.push(e)}}return o}let{Active:ir,Passive:io}=S.r$;function is(e){if(e6.wk.isInteractingWithTool)return;let t=it(e),n=ii(t,"preTouchStartCallback","preMouseDownCallback");if(n&&n(e))return;let i=[...ia(e,[ir])||[],...ia(e,[io])||[]],a=e.detail,{element:r}=a,o=nS(r,i),s=a.currentPoints.canvas,l=ny(r,o,s,"touch");if(l.length>0){let{tool:t,annotation:n,handle:i}=il(l);id(n.annotationUID,!1),t.handleSelectedCallback(e,n,i,"Touch");return}let d=nT(r,o,s,"touch");if(d.length>0){let{tool:t,annotation:n}=il(d);id(n.annotationUID,!1),t.toolSelectedCallback(e,n,"Touch",s);return}let c=ii(t,"postTouchStartCallback","postMouseDownCallback");if(c&&c(e))return}function il(e){return e.length>1&&e.find(e=>!(0,nE.Gh)(e.annotation.annotationUID)&&(0,nM.YY)(e.annotation.annotationUID))||e[0]}function id(e,t=!1){t?(0,nA.zN)(e)?(0,nA.L6)(e,!1):(0,nA.L6)(e,!0,!0):(0,nA.L6)(e,!0,!1)}function ic(e){if(e6.wk.isInteractingWithTool)return;let t=it(e);if(t&&!e6.wk.isMultiPartToolActive&&t.addNewAnnotation)try{let n=t.addNewAnnotation(e,"touch");(0,nA.L6)(n.annotationUID)}catch(e){console.warn("Error adding new annotation, viewport not ready:",e)}}function ih(e){let t=function(e){if(!e6.wk.isInteractingWithTool||!(e.detail.currentPointsList?.length>1))return!1;let{renderingEngineId:t,viewportId:n,element:i}=e.detail,a=(0,tT.getToolGroupForViewport)(n,t);if(!a)return!1;let r=!1;for(let e of Object.keys(a.toolOptions)){let t=a.getToolInstance(e);if(t){if(t.handlesMultiTouchGestures){t.isDrawing&&(r=!0);continue}t.cancel?.(i)}}return r}(e);if(e6.wk.isInteractingWithTool&&!t)return;let n=ii(it(e),"touchDragCallback","mouseDragCallback");n&&n(e)}let iu=nw.bind(null,"Touch","touchEndCallback"),{Active:ig}=nI.A;function ip(e){if(e6.wk.isInteractingWithTool)return;let{renderingEngineId:t,viewportId:n}=e.detail,i=(0,tT.getToolGroupForViewport)(n,t);if(!i)return;let a=Object.keys(i.toolOptions);for(let t=0;t{t.onResetCamera&&t.onResetCamera(e)})},iE={enable:function(e){e.addEventListener(M.fX.sV.CAMERA_RESET,iA)},disable:function(e){e.removeEventListener(M.fX.sV.CAMERA_RESET,iA)}};var iM=n(99537);function iy(e){var t;let{element:n,viewportId:i}=e.detail,a=function(e){let t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg"),i=`svg-layer-${e}`;n.classList.add("svg-layer"),n.setAttribute("id",i),n.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.style.width="100%",n.style.height="100%",n.style.pointerEvents="none",n.style.position="absolute";let a=document.createElementNS(t,"defs"),r=document.createElementNS(t,"filter"),o=document.createElementNS(t,"feOffset"),s=document.createElementNS(t,"feColorMatrix"),l=document.createElementNS(t,"feBlend");return r.setAttribute("id",`shadow-${i}`),r.setAttribute("filterUnits","userSpaceOnUse"),o.setAttribute("result","offOut"),o.setAttribute("in","SourceGraphic"),o.setAttribute("dx","0.5"),o.setAttribute("dy","0.5"),s.setAttribute("result","matrixOut"),s.setAttribute("in","offOut"),s.setAttribute("in2","matrix"),s.setAttribute("values","0.2 0 0 0 0 0 0.2 0 0 0 0 0 0.2 0 0 0 0 0 1 0"),l.setAttribute("in","SourceGraphic"),l.setAttribute("in2","matrixOut"),l.setAttribute("mode","normal"),r.appendChild(o),r.appendChild(s),r.appendChild(l),a.appendChild(r),n.appendChild(a),n}(i);(function(e){let{viewportUid:t,renderingEngineUid:n}=e.dataset,i=`${t}:${n}`;e6.wk.svgNodeCache[i]={}})(n),t=a,n.querySelector("div.viewport-element").appendChild(t),iM.o.addViewportElement(i,n),ei.enable(n),eQ.enable(n),eY.enable(n),e3.enable(n),t4.enable(n),nv.enable(n),n3.enable(n),n7.enable(n),iE.enable(n),nj.enable(n),nZ.enable(n),iv.enable(n),e6.wk.enabledElements.push(n)}n(31860);var iS=n(97442);let iT=function(e,t){let n=[];if(!t&&!e)throw Error("At least one of renderingEngineId or viewportId should be given");for(let i=0;it===e);t>-1&&e6.wk.enabledElements.splice(t,1)},ik=function(e){let{element:t,viewportId:n}=e.detail;(function(e){let{viewportUid:t,renderingEngineUid:n}=e.dataset,i=`${t}:${n}`;delete e6.wk.svgNodeCache[i]})(t),function(e){let t=e.querySelector("div.viewport-element"),n=t.querySelector("svg");n&&t.removeChild(n)}(t),iM.o.removeViewportElement(n,t),ei.disable(t),eQ.disable(t),eY.disable(t),e3.disable(t),t4.disable(t),nv.disable(t),n3.disable(t),n7.disable(t),iE.disable(t),nj.disable(t),nZ.disable(t),iv.disable(t),(e=>{let t=(0,M.kJ)(e);t&&iT(t.viewportId,t.renderingEngineId).forEach(e=>{e.remove(t)})})(t),(e=>{let t=(0,M.kJ)(e);if(!t)return;let{renderingEngineId:n,viewportId:i}=t,a=(0,iD.A)(i,n);a&&a.removeViewports(n,i)})(t),iP(t)};class ix{constructor(e,t,n,i){this._viewportOptions={},this._onEvent=e=>{if(!0===this._ignoreFiredEvents||!this._targetViewports.length)return;let t="element"===this._eventSource?(0,M.kJ)(e.currentTarget):(0,M.yj)(e.detail?.viewportId);if(!t)return;let{renderingEngineId:n,viewportId:i}=t;this._sourceViewports.find(e=>e.viewportId===i)&&this.fireEvent({renderingEngineId:n,viewportId:i},e)},this._enabled=!0,this._eventName=t,this._eventHandler=n,this._eventListener=this._onEvent.bind(this),this._ignoreFiredEvents=!1,this._sourceViewports=[],this._targetViewports=[],this._options=i||{},this._eventSource=this._options.eventSource||"element",this._auxiliaryEvents=this._options.auxiliaryEvents||[],this.id=e}isDisabled(){return!this._enabled||!this._hasSourceElements()}setOptions(e,t={}){this._viewportOptions[e]=t}setEnabled(e){this._enabled=e}getOptions(e){return this._viewportOptions[e]}add(e){this.addTarget(e),this.addSource(e)}addSource(e){if(iV(this._sourceViewports,e))return;let{renderingEngineId:t,viewportId:n}=e,i=(0,M.lD)(t).getViewport(n);if(!i)return void console.warn(`Synchronizer.addSource: No viewport for ${t} ${n}`);("element"===this._eventSource?i.element:M.tX).addEventListener(this._eventName,this._eventListener),this._auxiliaryEvents.forEach(({name:e,source:t="element"})=>{("element"===t?i.element:M.tX).addEventListener(e,this._eventListener)}),this._updateDisableHandlers(),this._sourceViewports.push(e)}addTarget(e){iV(this._targetViewports,e)||(this._targetViewports.push(e),this._updateDisableHandlers())}getSourceViewports(){return this._sourceViewports}getTargetViewports(){return this._targetViewports}destroy(){this._sourceViewports.forEach(e=>this.removeSource(e)),this._targetViewports.forEach(e=>this.removeTarget(e))}remove(e){this.removeTarget(e),this.removeSource(e)}removeSource(e){let t=iL(this._sourceViewports,e);if(-1===t)return;let n="element"===this._eventSource?this.getViewportElement(e):M.tX;this._sourceViewports.splice(t,1),n.removeEventListener(this._eventName,this._eventListener),this._auxiliaryEvents.forEach(({name:t,source:n="element"})=>{("element"===n?this.getViewportElement(e):M.tX).removeEventListener(t,this._eventListener)}),this._updateDisableHandlers()}removeTarget(e){let t=iL(this._targetViewports,e);-1!==t&&(this._targetViewports.splice(t,1),this._updateDisableHandlers())}hasSourceViewport(e,t){return iV(this._sourceViewports,{renderingEngineId:e,viewportId:t})}hasTargetViewport(e,t){return iV(this._targetViewports,{renderingEngineId:e,viewportId:t})}fireEvent(e,t){if(this.isDisabled()||this._ignoreFiredEvents)return;this._ignoreFiredEvents=!0;let n=[];try{for(let i=0;i{this._ignoreFiredEvents=!1}):this._ignoreFiredEvents=!1}}_hasSourceElements(){return 0!==this._sourceViewports.length}_updateDisableHandlers(){let e=function(e,t){let n=[],i=e.concat(t);for(let e=0;et.renderingEngineId===e.renderingEngineId&&t.viewportId===e.viewportId)||n.push(t)}return n}(this._sourceViewports,this._targetViewports),t=this.remove.bind(this),n=e=>{t(e.detail.element)};e.forEach(e=>{let t=this.getEventSource(e);t&&(t.removeEventListener(M.fX.sV.ELEMENT_DISABLED,n),t.addEventListener(M.fX.sV.ELEMENT_DISABLED,n))})}getEventSource(e){return"element"===this._eventSource?this.getViewportElement(e):M.tX}getViewportElement(e){let{renderingEngineId:t,viewportId:n}=e,i=(0,M.lD)(t);if(!i)return null;let a=i.getViewport(n);return a?a.element:null}}function iL(e,t){return e.findIndex(e=>t.renderingEngineId===e.renderingEngineId&&t.viewportId===e.viewportId)}function iV(e,t){return e.some(e=>e.renderingEngineId===t.renderingEngineId&&e.viewportId===t.viewportId)}n(42279);let iO=function(e,t,n,i){if(e6.wk.synchronizers.some(t=>t.id===e))throw Error(`Synchronizer with id '${e}' already exists.`);let a=new ix(e,t,n,i);return e6.wk.synchronizers.push(a),a},iR=function(){for(;e6.wk.synchronizers.length>0;)e6.wk.synchronizers.pop().destroy()},iN=function(e){return e6.wk.synchronizers.find(t=>t.id===e)},iU=function(){return e6.wk.synchronizers},iF=function(e){let t=e6.wk.synchronizers.findIndex(t=>t.id===e);t>-1&&(e6.wk.synchronizers[t].destroy(),e6.wk.synchronizers.splice(t,1))};var iB=n(32207);let iG=function(e){let{viewportId:t}=e.detail;tL(t)};var iH=n(87195);let iW=function(e){let{segmentationId:t}=e.detail;(0,y.getAllAnnotations)().filter(e=>t===e?.data?.segmentation?.segmentationId).forEach(e=>{(0,y.removeAnnotation)(e.annotationUID)})},iX=function(e){let t=e.detail?.viewportId;if(!t)return;let n=(0,e4.r$)(t);n?.length&&tL(t)};var iz=n(90174),i$=n(41918),iY=n(73416),ij=n(30536),iJ=n(19047),iQ=n(79541);let iq=function({segmentationId:e,type:t,data:n}){let i=(0,e8.T)(e);if(!i)throw Error(`Segmentation ${e} not found`);switch(i.representationData[t]&&console.warn(`Representation data of type ${t} already exists for segmentation ${e}, overwriting it.`),t){case iz.A.Labelmap:case iz.A.Contour:case iz.A.Surface:n&&(i.representationData[t]=n);break;default:throw Error(`Invalid representation type ${t}`)}};async function iK(e,t,n,i){let a=await n();return iq({segmentationId:e,type:t,data:a}),i?.(),a}var iZ=n(38433);let i0=new Map,i1=new Map,i2={getUpdateFunction:function(e){return null},render:async function e(e,t){var n,i;let{segmentationId:a}=t,r=(0,e8.T)(a);if(!r)return;let o=r.representationData[iz.A.Contour],s=(0,iH.Qy)();if(!o&&(0,iH.Qy)()?.canComputeRequestedRepresentation(a,iz.A.Contour)&&!i0.get(e.id)){i0.set(e.id,!0);try{o=await iK(a,iz.A.Contour,()=>s.computeContourData(a,{viewport:e}))}catch(e){console.warn("Unable to compute contour data for segmentationId",a,e)}i0.set(e.id,!1)}else o||(0,iH.Qy)()||console.debug(`No contour data found for segmentationId ${a} and PolySeg add-on is not configured. Unable to convert from other representations to contour. Please register PolySeg using cornerstoneTools.init({ addons: { polySeg } }) to enable automatic conversion.`);if(!o||!o.geometryIds?.length)return;let l=!1,d=(0,i$.A)(e).viewPlaneNormal;o.annotationUIDsMap&&(l=!function(e,t){let n=Array.from(e.values()).flat().map(e=>Array.from(e)).flat();for(let e of M.BF.getRandomSampleFromArray(n,3)){let n=(0,y.getAnnotation)(e);if(n?.metadata){if(!n.metadata.viewPlaneNormal)continue;let e=n.metadata.viewPlaneNormal;if(Math.abs(Math.abs(t[0]*e[0]+t[1]*e[1]+t[2]*e[2])-1)>.01)return!1}}return!0}(o.annotationUIDsMap,d)),o.geometryIds.length>0&&(l=!function(e,t){let n=null,i=null;for(let t of e){let e=M.PP.getGeometry(t);if(!e)continue;let a=e.data;if(a.contours?.[0]?.points?.length>=3){n=e,i=a;break}}if(!n||!i)return!1;let{points:a}=i.contours[0],[r]=a,o=e7.vt(),{length:s}=a,l=Math.ceil(s/25);for(let e=1;e.1)return!1}return!0}(o.geometryIds,d));let c=i1.get(e.id)||new Set;if(l&&!i0.get(e.id)&&!c.has(a)&&e.viewportStatus===M.fX.Dt.RENDERED){i0.set(e.id,!0);let t=function(e){let t,n=(0,iZ.R1)(e);if(n)return n;let i=(0,e8.T)(e);if(!i)throw Error(`No segmentation found for segmentationId ${e}`);if(i.representationData.Labelmap)t=Object.keys(i.segments).map(Number).sort((e,t)=>e-t);else if(i.representationData.Contour)t=function(e){let{annotationUIDsMap:t,geometryIds:n}=e.representationData.Contour||{};if(!n)throw Error(`No geometryIds found for segmentationId ${e.segmentationId}`);let i=new Set([...t.keys()]);return n.forEach(e=>{let t=M.PP.getGeometry(e);i.add(t.data.segmentIndex)}),Array.from(i).sort((e,t)=>e-t)}(i);else if(i.representationData.Surface){var a;a=i,t=Array.from((a.representationData.Surface?.geometryIds??[]).keys()).map(Number).sort((e,t)=>e-t)}else throw Error(`Unsupported segmentation type: ${i.representationData}`);return(0,iZ.Dm)(e,t),t}(a),n=(await s.computeSurfaceData(a,{segmentIndices:t,viewport:e})).geometryIds,i=[];for(let e of n.values()){let t=M.PP.getGeometry(e).data;i.push({points:t.points,polys:t.polys,segmentIndex:t.segmentIndex,id:t.segmentIndex})}let r=await s.clipAndCacheSurfacesForViewport(i,e),l=s.extractContourData(r),d=s.createAndAddContourSegmentationsFromClippedSurfaces(l,e,a);o.annotationUIDsMap=new Map([...o.annotationUIDsMap,...d]),c.add(a),i1.set(e.id,c),i0.set(e.id,!1)}n=o.geometryIds,i=o.annotationUIDsMap,i.size?e.render():function(e,t,n){let{segmentationId:i}=n,a=new Map;t.forEach(t=>{let n=M.PP.getGeometry(t);if(!n)return void console.warn(`No geometry found for geometryId ${t}. Skipping render.`);let r=n.data.segmentIndex;var o=n;if(!o)throw Error(`No contours found for geometryId ${o.id}`);let s=o.id;if(o.type!==M.fX.dC.CONTOUR)throw Error(`Geometry type ${o.type} not supported for rendering.`);o.data||console.warn(`No contours found for geometryId ${s}. Skipping render.`);let l=iQ.Y.getStyle({viewportId:e.id,segmentationId:i,type:S.D_.Contour,segmentIndex:r}),d=n.data,c=(0,i$.A)(e).viewPlaneNormal;d.contours.forEach(t=>{let{points:n,color:a,id:o}=t,s=function(e,t,n){let i=e.getImageIds();if(!i||!i.length)return;let a=i.map(e=>{let{imagePositionPatient:i}=M.wx.get("imagePlaneModule",e);return{imageId:e,distance:function(e,t,n){let i=e7.vt();return e7.jb(i,e,t),Math.abs(e7.Om(i,n))}(t,i,n)}});return a.sort((e,t)=>e.distance-t.distance),a[0].imageId}(e,n[0],c),l={annotationUID:M.BF.uuidv4(),data:{contour:{closed:!0,polyline:n},segmentation:{segmentationId:i,segmentIndex:r,color:a,id:o},handles:{}},handles:{},highlighted:!1,autoGenerated:!1,invalidated:!1,isLocked:!0,isVisible:!0,metadata:{referencedImageId:s,toolName:"PlanarFreehandContourSegmentationTool",FrameOfReferenceUID:e.getFrameOfReferenceUID(),viewPlaneNormal:c}},d=e.element;(0,y.addAnnotation)(l,d),(0,t6.V0)(l)}),l&&a.set(r,l)}),e.render()}(e,n,t)},removeRepresentation:function(e,t,n=!1){let i=(0,M.yj)(e);if(!i)return;let{viewport:a}=i;n&&a.render()}};var i5=n(86216),i3=n(3533);function i8(e,t,n){if(n<=0)return void e.setPosition(0,0,0);let[i,a,r]=e7.S8(e7.vt(),t),o=1e-4*n;e.setPosition(i*o,a*o,r*o)}function i4(e,t){let n=-1,i=0;if(t.forEach((t,a)=>{let r=e7.Om(e,t);Math.abs(r)>Math.abs(i)&&(n=a,i=r)}),!(-1===n||Math.abs(i)=0?1:-1}}function i6(e){let t=i9(e.getResolvedView?.()?.toICamera?.());return t||i9(e.getCamera?.())}function i9(e){let t=i7(e?.focalPoint),n=i7(e?.viewPlaneNormal),i=i7(e?.viewUp);if(t&&n&&i)return{focalPoint:t,viewPlaneNormal:n,viewUp:i}}function i7(e){if(!e||"number"!=typeof e.length||e.length<3)return;let t=[Number(e[0]),Number(e[1]),Number(e[2])];return t.every(Number.isFinite)?t:void 0}function ae(e){let{direction:t}=e;return[[t[0],t[1],t[2]],[t[3],t[4],t[5]],[t[6],t[7],t[8]]]}function at(e,t){let n=i6(e);if(!n)return;let{viewPlaneNormal:i,viewUp:a,focalPoint:r}=n,o=e7.S8(e7.vt(),e7.$A(e7.vt(),i,a)),s=e7.S8(e7.vt(),a),l=ae(t),d=i4(o,l),c=i4(s,l),h=i4(i,l);if(!d||!c||!h||3!==new Set([d.axis,c.axis,h.axis]).size)return;let u=Math.floor(M.BF.transformWorldToIndexContinuous(t.imageData,r)[h.axis]+.5-1e-6);if(!(u<0)&&!(u>=t.dimensions[h.axis]))return{key:[h.axis,u,d.axis,d.sign,c.axis,c.sign].join(":"),xAxis:d.axis,xSign:d.sign,yAxis:c.axis,ySign:c.sign,sliceAxis:h.axis,sliceIndex:u}}function an(e,t){let n=at(t,e);if(!n)return;let i=ae(e),{dimensions:a,spacing:r,voxelManager:o}=e,s=a[n.xAxis],l=a[n.yAxis],d=new(o.getConstructor())(s*l),c=[0,0,0];c[n.sliceAxis]=n.sliceIndex;let h=n.xSign>0?0:s-1,u=n.xSign>0?1:-1,g=n.ySign>0?0:l-1,p=n.ySign>0?1:-1;for(let e=0,t=g;e0?0:s-1,m[n.yAxis]=n.ySign>0?0:l-1;let f=i[n.xAxis].map(e=>e*n.xSign),v=i[n.yAxis].map(e=>e*n.ySign),I=i6(t);if(!I)return;let _=e7.S8(e7.vt(),I.viewPlaneNormal),w=tF.Ay.getDataType(d),b=tF.Ay.newInstance({dataType:w,name:"Pixels",numberOfComponents:1,values:d}),C=tB.Ay.newInstance();return C.set({dataType:w,numberOfComponents:1},!0),C.setDimensions(s,l,1),C.setSpacing([r[n.xAxis],r[n.yAxis],1]),C.setDirection(new Float32Array([...f,...v,_[0],_[1],_[2]])),C.setOrigin(M.BF.transformIndexToWorld(e.imageData,m)),C.getPointData().setScalars(b),C.modified(),{imageData:C,state:n}}function ai(e){return e.type===M.fX.NV.PLANAR_NEXT&&"function"==typeof e.addImages&&"function"==typeof e.getCurrentImageId&&"function"==typeof e.render}function aa(e){return`${e}::labelmap-image-mapper-overlay`}async function ar(e){let{viewport:t,segmentation:n,segmentationId:i}=e;if((0,t0.QO)(t)){if(ai(t))return void await ao({viewport:t,segmentation:n,segmentationId:i});(0,tN.m)(n).forEach(e=>{let n=(0,tN.kL)(e);if(!n)return;let a=an(n,t);if(!a)return;let r=tJ({segmentationId:i,referencedId:e.labelmapId,sliceStateKey:a.state.key}),o=function(e){let t=i5.Ay.newInstance();t.setInputData(e.imageData);let n=i3.Ay.newInstance();return n.setMapper(t),{uid:e.representationUID,actor:n,actorMapper:{actor:n,mapper:t,renderMode:M.T7.VTK_IMAGE},referencedId:e.referencedId,representationUID:e.representationUID}}({imageData:a.imageData,referencedId:e.labelmapId,representationUID:r});t.addActor(o);let s=t.getRenderer(),l=function(e){let t=e.getRenderingEngine().getOffscreenMultiRenderWindow(e.id),n=aa(e.id),i=e.getRenderer(),a=i.getViewport(),r=t.getRenderer(n);if(!r){let e=t.getRenderWindow();2>e.getNumberOfLayers()&&e.setNumberOfLayers(2),t.addRenderer({viewport:a,id:n,background:[0,0,0]}),(r=t.getRenderer(n)).setLayer(1),r.setPreserveDepthBuffer(!1)}return r.setActiveCamera(i.getActiveCamera()),r.setViewport(a[0],a[1],a[2],a[3]),r}(t);s.removeActor(o.actor),l.addActor(o.actor)})}}async function ao(e){let{viewport:t,segmentation:n,segmentationId:i}=e;for(let[e,a]of(0,tN.m)(n).entries()){let n=(0,tN.kL)(a);if(!n)continue;let r=an(n,t);if(!r)continue;let o=t.getCurrentImageId()??n.imageIds[Math.min(Math.max(r.state.sliceIndex,0),Math.max(n.imageIds.length-1,0))];if(!o)continue;let s=tJ({segmentationId:i,referencedId:a.labelmapId});await t.addImages([{dataId:s,imageId:o,imageData:r.imageData,reference:{kind:"segmentation",segmentationId:i,representationUID:s,labelmapId:a.labelmapId},useWorldCoordinateImageData:!0,callback:({imageActor:n})=>{let i=n.getMapper(),a=i6(t);i.setInputData(r.imageData),i.modified(),a&&i8(n,a.viewPlaneNormal,e+1)}}])}t.render()}function as(e,t){!function(e,t){if(e.type!==M.fX.NV.ORTHOGRAPHIC||!(0,t0.QO)(e))return;let n=e.getRenderingEngine().getOffscreenMultiRenderWindow(e.id),i=n.getRenderer(aa(e.id));i&&(e.getActors().filter(e=>tQ(e.representationUID,t)).forEach(e=>{i.removeActor(e.actor)}),i.getActors().length||n.removeRenderer(aa(e.id)))}(e,t);let n=(0,tY.ED)(e.id,t)??[],i=[];n.forEach(n=>{tq(e,t,n)||i.push(n.uid)}),i.length&&e.removeActors(i)}function al({isVolumeImageMapper:e,kind:t,renderMode:n,segmentationId:i,unsupportedStateKey:a,updateAfterMount:r=!0,useSliceRendering:o,viewport:s,canRenderCurrentViewport:l=()=>"unsupported"!==t,getExpectedRepresentationUIDs:d=()=>[],isActorEntryCompatible:c=()=>!0,mount:h=async()=>void 0,update:u=()=>void 0}){let g=()=>as(s,i),p=e=>(function(e,t){let n=new Set((e??[]).map(e=>e.representationUID)),i=new Set(t);if(n.size!==i.size)return!0;for(let e of i)if(!n.has(e))return!0;return!1})(e,d())||(e??[]).some(e=>!c(e));return{kind:t,renderMode:n,useSliceRendering:o,isVolumeImageMapper:e,unsupportedStateKey:a,getExpectedRepresentationUIDs:d,mount:h,needsRemount:p,remove:g,update:u,reconcile:async({actorEntries:e,labelMapData:t})=>{if(!l())return e;let n=e;p(n)&&n?.length&&(g(),n=void 0);let a=!n?.length;return a&&await h({labelMapData:t}),n=(0,tY.ED)(s.id,i),n?.length&&(!a||r)&&u({actorEntries:n}),n}}}function ad(e){return e.actorMapper?.renderMode}let ac=new Map,ah=({cfun:e,ofun:t,actor:n})=>{n.getProperty().setRGBTransferFunction(1,e),n.getProperty().setScalarOpacity(1,t)};async function au({viewport:e,volumeInputs:t,segmentationId:n}){let i=e.getDefaultActor(),{actor:a}=i,{uid:r}=i,o=e.getVolumeId();if(ac.get(r)?.added)return{uid:r,actor:a};let s=M.PP.getVolume(t[0].volumeId);if(!s)throw Error(`imageVolume with id: ${s.volumeId} does not exist`);let{volumeId:l}=t[0],d=await M.UH.loadVolume(l);if(!d)throw Error(`segImageVolume with id: ${d.volumeId} does not exist`);let c=d.voxelManager.getCompleteScalarDataArray(),{imageData:h}=d,u=M.PP.getVolume(o);if(u.vtkOpenGLTexture.hasUpdatedFrames())return;let g=u.voxelManager.getCompleteScalarDataArray(),p=new Float32Array(2*u.voxelManager.getScalarDataLength()),m=h.getDimensions();for(let e=0;et)){let t=e*p,n=M.PP.getImage(o.imageIds?.[e]),i=n?.voxelManager?.getScalarData?.();if(i?.length===p)for(let e=0;ee.representationUID===s)}if(r.setViewReference(l),r.render?.(),t)return{uid:t.uid,actor:t.actor}}let{uuidv4:ap}=M.BF;async function am({config:e,labelMapData:t,segmentation:n,segmentationId:i,viewport:a}){var r;let{id:o}=a,s=(r=n,(0,tN.m)(r).map(e=>{if(e.volumeId)return e;let t=(0,tN.kL)(e);if(t?.volumeId)return{...e,volumeId:t.volumeId}}).filter(e=>!!e));if(!s.length){let e=function(e,t){let{volumeId:n}=e;return n||(n=ap(),t.representationData.Labelmap={...t.representationData.Labelmap,volumeId:n},e.volumeId=n,(0,e9.triggerSegmentationModified)(t.segmentationId)),n}(t,n);M.PP.getVolume(e)||await av(t),s.push({labelmapId:e,storageKind:"volume",volumeId:e,imageIds:M.PP.getVolume(e)?.imageIds})}let l=e?.blendMode??M.fX.gd.MAXIMUM_INTENSITY_BLEND,d=l===M.fX.gd.LABELMAP_EDGE_PROJECTION_BLEND;if(d){let e=a.getVolumeId?.(),t=s[0]?.volumeId,n=e?M.PP.getVolume(e):void 0,i=t?M.PP.getVolume(t):void 0;if(n&&i){let e=i.dimensions,t=n.dimensions;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2])&&(d=!1,l=M.fX.gd.MAXIMUM_INTENSITY_BLEND,console.debug("Dimensions mismatch - falling back to regular volume addition"))}else d=!1,l=M.fX.gd.MAXIMUM_INTENSITY_BLEND,console.debug("Independent components unavailable (missing reference or segmentation volume) - falling back to regular volume addition")}let c=s.map(e=>({volumeId:e.volumeId,visibility:!0,representationUID:tJ({segmentationId:i,referencedId:e.labelmapId}),useIndependentComponents:d,blendMode:l}));if(a.type===M.fX.NV.PLANAR_NEXT&&"function"==typeof a.getVolumeId&&"function"==typeof a.getViewReference&&"function"==typeof a.getViewState&&"function"==typeof a.addDisplaySet&&"function"==typeof a.setDisplaySetPresentation&&"function"==typeof a.setViewReference)return ag({blendMode:l,labelmapLayers:s,segmentationId:i,viewport:a,visibility:!0});if(!c[0].useIndependentComponents){await (0,M.x)(a.getRenderingEngine(),c,[o],!1,!0),(0,e9.triggerSegmentationDataModified)(i);return}return au({viewport:a,volumeInputs:c,segmentationId:i})}function af(e){return!!(e.volumeId||e.geometryVolumeId||e.imageIds?.length)}async function av(e){if(!(e.imageIds.length>0))throw Error("cannot create labelmap, no imageIds found for the volume labelmap");return await M.UH.createAndCacheVolumeFromImages(e.volumeId??ap(),e.imageIds)}async function aI(e,t){tK(e,t),(0,e9.triggerSegmentationDataModified)(t)}async function a_({viewport:e,segmentation:t,segmentationId:n}){await ar({viewport:e,segmentation:t,segmentationId:n}),(0,e9.triggerSegmentationDataModified)(n)}var aw=n(56109),ab=n(41067);function aC(e){return(0,ab.T)(e)}function aA(e,t){iB._6.setActiveSegmentation(e,t)}var aE=n(46702),aM=n(65947),ay=n(74840);let aS=new WeakMap,aT=new WeakMap;function aD(e,t,n){let i={...e,...n||{}};return{fillAlpha:t?i.fillAlpha:i.fillAlphaInactive,outlineWidth:t?i.outlineWidth:i.outlineWidthInactive,renderFill:t?i.renderFill:i.renderFillInactive,renderOutline:t?i.renderOutline:i.renderOutlineInactive,outlineOpacity:t?i.outlineOpacity:i.outlineOpacityInactive,activeSegmentOutlineWidthDelta:i.activeSegmentOutlineWidthDelta}}let aP=new Map,ak=!1;async function ax(e,t){let{segmentationId:n}=t,i=(0,e8.T)(n);if(!i)return void console.warn("No segmentation found for segmentationId: ",n);let a=i.representationData[iz.A.Labelmap],r=(0,tY.ED)(e.id,n);if(!a&&(0,iH.Qy)()?.canComputeRequestedRepresentation(n,iz.A.Labelmap)&&!ak){ak=!0;let t=(0,iH.Qy)();if(!(a=await iK(n,iz.A.Labelmap,()=>t.computeLabelmapData(n,{viewport:e}),()=>{iB._6.processLabelmapRepresentationAddition(e.id,n),setTimeout(()=>{(0,e9.triggerSegmentationDataModified)(n)},0)})))throw Error(`No labelmap data found for segmentationId ${n}.`);ak=!1}else a||(0,iH.Qy)()||console.debug(`No labelmap data found for segmentationId ${n} and PolySeg add-on is not configured. Unable to convert from other representations to labelmap. Please register PolySeg using cornerstoneTools.init({ addons: { polySeg } }) to enable automatic conversion.`);if(!a)return;let o=function({viewport:e,segmentation:t,representation:n}){let{segmentationId:i,config:a}=n,r=(0,t0.bY)(t,a),o=(0,tU.A)(e,{useSliceRendering:r}),s=r&&(0,t0.QO)(e);return"unsupported"===o?al({isVolumeImageMapper:s,kind:"unsupported",renderMode:o,segmentationId:i,unsupportedStateKey:r?(0,t0.o)(e).key:void 0,useSliceRendering:r,viewport:e}):s?function({isVolumeImageMapper:e,renderMode:t,segmentation:n,segmentationId:i,useSliceRendering:a,viewport:r}){return al({isVolumeImageMapper:e,kind:"volume-slice-image-mapper",renderMode:t,segmentationId:i,useSliceRendering:a,viewport:r,getExpectedRepresentationUIDs:()=>(function(e,t,n){if(!(0,t0.QO)(e))return[];let i=ai(e);return(0,tN.m)(n).map(n=>{let a=(0,tN.kL)(n);if(!a)return;let r=at(e,a);if(r)return tJ({segmentationId:t,referencedId:n.labelmapId,...i?{}:{sliceStateKey:r.key}})}).filter(e=>!!e)})(r,i,n),isActorEntryCompatible:e=>!function(e){let t=ad(e);return t===M.T7.VTK_VOLUME||t===M.T7.VTK_VOLUME_SLICE||t===M.T7.CPU_VOLUME}(e),mount:()=>a_({viewport:r,segmentation:n,segmentationId:i}),update:({actorEntries:e})=>(function(e){let{viewport:t,segmentation:n,segmentationId:i,actorEntries:a}=e;if(!(0,t0.QO)(t))return;if(ai(t))return void function(e){let{viewport:t,segmentation:n,segmentationId:i,actorEntries:a}=e,r=new Map((a??t.getActors()).filter(e=>tQ(e.representationUID,i)).map(e=>[e.referencedId,e]));(0,tN.m)(n).forEach((e,n)=>{let i=r.get(e.labelmapId);if(!i)return;let a=(0,tN.kL)(e);if(!a)return;let o=an(a,t);if(!o)return;let s=i.actor.getMapper();s.setInputData(o.imageData),s.modified();let l=i6(t);l&&i8(i.actor,l.viewPlaneNormal,n+1),i.actor.modified?.()})}({viewport:t,segmentation:n,segmentationId:i,actorEntries:a});let r=new Map((a??t.getActors()).filter(e=>tQ(e.representationUID,i)).map(e=>[e.referencedId,e]));(0,tN.m)(n).forEach(e=>{let n=r.get(e.labelmapId);if(!n)return;let i=(0,tN.kL)(e);if(!i)return;let a=an(i,t);if(!a)return;let o=n.actor.getMapper();o.setInputData(a.imageData),o.modified(),n.actor.modified?.()})})({viewport:r,segmentation:n,segmentationId:i,actorEntries:e})})}({isVolumeImageMapper:s,renderMode:o,segmentation:t,segmentationId:i,useSliceRendering:r,viewport:e}):"volume"===o?function({config:e,isVolumeImageMapper:t,renderMode:n,segmentation:i,segmentationId:a,useSliceRendering:r,viewport:o}){return al({isVolumeImageMapper:t,kind:"legacy-volume",renderMode:n,segmentationId:a,useSliceRendering:r,viewport:o,getExpectedRepresentationUIDs:()=>{var e,t;return e=i,t=a,(0,tN.m)(e).filter(af).map(e=>tJ({segmentationId:t,referencedId:e.labelmapId}))},isActorEntryCompatible:e=>!function(e){let t=ad(e);return t===M.T7.VTK_IMAGE||t===M.T7.CPU_IMAGE}(e),mount:({labelMapData:t})=>am({config:e,labelMapData:t,segmentation:i,segmentationId:a,viewport:o})})}({config:a,isVolumeImageMapper:s,renderMode:o,segmentation:t,segmentationId:i,useSliceRendering:r,viewport:e}):function({isVolumeImageMapper:e,renderMode:t,segmentationId:n,useSliceRendering:i,viewport:a}){return al({isVolumeImageMapper:e,kind:"legacy-stack-image",renderMode:t,segmentationId:n,updateAfterMount:!1,useSliceRendering:i,viewport:a,canRenderCurrentViewport:()=>{var e,t;return e=a,t=n,!!(0,t$.aF)(e.id,t)?.length},getExpectedRepresentationUIDs:()=>{var e,t;return e=a,t=n,(0,t$.aF)(e.id,t)?.map(e=>tJ({segmentationId:t,referencedId:e}))??[]},mount:()=>aI(a,n),update:()=>tK(a,n)})}({isVolumeImageMapper:s,renderMode:o,segmentationId:i,useSliceRendering:r,viewport:e})}({viewport:e,segmentation:i,representation:t});if("unsupported"===o.kind){r?.length&&o.remove(),o.unsupportedStateKey&&function(e,t,n){let i=`${e}:${t}`;aP.get(i)!==n&&(aP.set(i,n),M.tX.dispatchEvent(new CustomEvent(M.fX.sV.ERROR_EVENT,{detail:{type:"Segmentation",message:"Labelmap image-mapper rendering is only supported on legacy orthographic single-slice volume viewports."},cancelable:!0})))}(e.id,n,o.unsupportedStateKey);return}if(aL(e.id,n),r=await o.reconcile({actorEntries:r,labelMapData:a}),r?.length)for(let n of r)!function(e,t,n){let{segmentationId:i}=n,{colorLUTIndex:a}=n,r=aC(e),o=r?.segmentationId===i,s=iQ.Y.getStyle({viewportId:e,type:iz.A.Labelmap,segmentationId:i}),l=iQ.Y.getRenderInactiveSegmentations(e),d=(0,aM.B)(a),c=(0,e8.T)(i),h=function(e,t){if(t)return(0,tN.Hs)(e,t)??(0,tN.M4)(e,t)??(0,tN.BS)(e,t)??(0,tN.m)(e).find(e=>e.volumeId===t)}(c,t.referencedId),u=Math.max(1,...Object.keys(c.segments).map(Number).map(e=>({segmentIndex:e,binding:(0,tN.hM)(c,e)})).filter(e=>!h||e.binding?.labelmapId===h.labelmapId).map(e=>e.binding?.labelValue??e.segmentIndex)),g=Math.max(d.length,u+1),p=Array.from({length:g-1},(e,t)=>{let n=t+1,i=h?.labelToSegmentIndex?.[n]??n;return{labelValue:n,segmentIndex:i}}),{outlineWidth:m,renderOutline:f,outlineOpacity:v,activeSegmentOutlineWidthDelta:I}=aD(s,o),_=(0,ay.s)(e,{segmentationId:i,type:iz.A.Labelmap}),w=t.actor,b=[{x:0,r:0,g:0,b:0,midpoint:.5,sharpness:1}],C=[{x:0,y:0,midpoint:.5,sharpness:1}];p.forEach(({labelValue:t,segmentIndex:n})=>{let a=d[n];if(!a)return;let{fillAlpha:r,renderFill:l}=aD(s,o,iQ.Y.getStyle({viewportId:e,type:iz.A.Labelmap,segmentationId:i,segmentIndex:n}));if(b.push({x:t,r:a[0]/255,g:a[1]/255,b:a[2]/255,midpoint:.5,sharpness:1}),l){let e=_.has(n)?0:a[3]/255*r;C.push({x:t,y:e,midpoint:.5,sharpness:1})}else C.push({x:t,y:.01,midpoint:.5,sharpness:1})});let A=(0,aE.Q)(n.segmentationId),E=Array(g-1).fill(0);f&&p.forEach(({labelValue:e,segmentIndex:t})=>{_.has(t)||(E[e-1]=t===A?m+I:m)});let y=o||l,S=t.actorMapper?.renderMode===M.T7.VTK_IMAGE||t.actorMapper?.renderMode===M.T7.VTK_VOLUME_SLICE,{preLoad:T}=w.get?.("preLoad")||{preLoad:null},D=JSON.stringify({colorNodes:b,opacityNodes:C,renderOutline:f,outlineOpacity:v,outlineWidths:E,visible:y,useImageSliceProperties:S}),P=!T;if(P&&aT.get(w)===D)return;let{cfun:k,ofun:x}=function(e){let t=aS.get(e);if(t)return t;let n=aw.Ay.newInstance(),i=tG.Ay.newInstance();i.addPoint(0,0);let a={cfun:n,ofun:i};return aS.set(e,a),a}(w);k.removeAllPoints(),x.removeAllPoints(),k.setNodes(b),x.setNodes(C),x.setClamping(!1);let L=t.actorMapper,V=L?.mapper?L.mapper:w.getMapper();T?T({cfun:k,ofun:x,actor:w}):(w.getProperty().setRGBTransferFunction(0,k),w.getProperty().setScalarOpacity(0,x),w.getProperty().setInterpolationTypeToNearest()),S&&(w.setForceTranslucent(!0),w.setForceOpaque(!1),w.getProperty().setUseLookupTableScalarRange(!0)),f?(w.getProperty().setUseLabelOutline(f),w.getProperty().setLabelOutlineOpacity(v),w.getProperty().setLabelOutlineThickness(E),w.modified(),w.getProperty().modified(),V?.modified?.()):w.getProperty().setLabelOutlineThickness(E),w.setVisibility(y),w.modified(),w.getProperty().modified(),V?.modified?.(),P?aT.set(w,D):aT.delete(w)}(e.id,n,t)}function aL(e,t){aP.delete(`${e}:${t}`)}let aV={getUpdateFunction:function(e){},render:ax,removeRepresentation:function(e,t,n=!1){aL(e,t);let i=(0,M.yj)(e);if(!i)return;let{viewport:a}=i;as(a,t),n&&a.render()}},aO=function(e,t){let{viewport:n}=(0,M.kJ)(e),i=n.getActors().filter(e=>e.representationUID&&"string"==typeof e.representationUID&&e.representationUID.startsWith(t));n.removeActors(i.map(e=>e.uid))};var aR=n(12412),aN=n(89473);let aU=function(e,t,n){let i,a=(0,tY.Th)(e.id,n,t.segmentIndex),r=a?.actor,o=t.visible;if(r){if(r.setVisibility(o),!o)return;let n=r.getMapper(),i=n.getInputData(),a=t.points,s=t.polys,l=i.getPoints().getData(),d=i.getPolys().getData();if(a.length===l.length&&s.length===d.length)return;let c=iJ.Ay.newInstance();c.getPoints().setData(a,3);let h=iY.Ay.newInstance({values:Float32Array.from(s)});c.setPolys(h),n.setInputData(c),n.modified(),e.getRenderer().resetCameraClippingRange();return}let s=t.points,l=t.polys,d=t.color,c=iJ.Ay.newInstance();c.getPoints().setData(s,3);let h=iY.Ay.newInstance({values:Float32Array.from(l)});c.setPolys(h);let u=aR.Ay.newInstance({});u.setInputData(c);let g=aN.Ay.newInstance();g.setMapper(u),g.getProperty().setColor(d[0]/255,d[1]/255,d[2]/255),g.getProperty().setLineWidth(2);let p=(0,tY.DU)(n,t.segmentIndex);e.addActor({uid:M.BF.uuidv4(),actor:g,clippingFilter:i,representationUID:p}),e.resetCamera(),e.getRenderer().resetCameraClippingRange(),e.render()},aF={getUpdateFunction:function(e){let t=(0,iH.Qy)();return n=>t.updateSurfaceData(n,{viewport:e})},render:async function e(e,t){let{segmentationId:n,type:i}=t,a=(0,e8.T)(n);if(!a)return;let r=a.representationData[iz.A.Surface];if(!r&&(0,iH.Qy)()?.canComputeRequestedRepresentation(n,iz.A.Surface)){let t=(0,iH.Qy)();if(!(r=await iK(n,iz.A.Surface,()=>t.computeSurfaceData(n,{viewport:e}))))throw Error(`No Surface data found for segmentationId ${n} even we tried to compute it`)}else r||(0,iH.Qy)()||console.debug(`No surface data found for segmentationId ${n} and PolySeg add-on is not configured. Unable to convert from other representations to surface. Please register PolySeg using cornerstoneTools.init({ addons: { polySeg } }) to enable automatic conversion.`);if(!r)return void console.warn(`No Surface data found for segmentationId ${n}. Skipping render.`);let{geometryIds:o}=r;o?.size||console.warn(`No Surfaces found for segmentationId ${n}. Skipping render.`);let{colorLUTIndex:s}=t,l=(0,aM.B)(s),d=[];o.forEach(t=>{let a=M.PP.getGeometry(t);if(!a?.data)return void console.warn(`No Surfaces found for geometryId ${t}. Skipping render.`);let{segmentIndex:r}=a.data,o=(0,ay.s)(e.id,{segmentationId:n,type:i}).has(r),s=a.data;s.color=l[r].slice(0,3),s.visible=!o,d.push(s),aU(e,s,n)}),e.render()},removeRepresentation:function(e,t,n=!1){let i=(0,M.yj)(e);if(!i)return;let{viewport:a}=i;aO(a.element,t),n&&a.render()}},aB=!1;function aG(){aB||((0,tP.h)(iz.A.Labelmap,aV),(0,tP.h)(iz.A.Contour,i2),(0,tP.h)(iz.A.Surface,aF),aB=!0)}aG();let aH=!1;function aW(e={}){aH||(aG(),(0,iH.Nk)(e),function(){let e=M.fX.sV.ELEMENT_ENABLED,t=M.fX.sV.ELEMENT_DISABLED;M.tX.removeEventListener(e,iy),M.tX.removeEventListener(t,ik),M.tX.removeEventListener(M.fX.sV.RENDERING_PIPELINE_CHANGED,iX),i_.disable();let n=M.fX.sV.ELEMENT_ENABLED,i=M.fX.sV.ELEMENT_DISABLED;M.tX.addEventListener(n,iy),M.tX.addEventListener(i,ik),M.tX.addEventListener(M.fX.sV.RENDERING_PIPELINE_CHANGED,iX),i_.enable()}(),M.tX.removeEventListener(S.sV.ANNOTATION_COMPLETED,nh),M.tX.removeEventListener(S.sV.ANNOTATION_MODIFIED,ng),M.tX.removeEventListener(S.sV.ANNOTATION_SELECTION_CHANGE,nu),M.tX.removeEventListener(S.sV.ANNOTATION_SELECTION_CHANGE,nu),M.tX.removeEventListener(S.sV.ANNOTATION_REMOVED,np),M.tX.removeEventListener(S.sV.SEGMENTATION_MODIFIED,t5),M.tX.removeEventListener(S.sV.SEGMENTATION_DATA_MODIFIED,t2),M.tX.removeEventListener(S.sV.SEGMENTATION_REPRESENTATION_MODIFIED,iG),M.tX.removeEventListener(S.sV.SEGMENTATION_REPRESENTATION_ADDED,iG),M.tX.removeEventListener(S.sV.SEGMENTATION_REMOVED,iW),M.tX.addEventListener(S.sV.ANNOTATION_COMPLETED,nh),M.tX.addEventListener(S.sV.ANNOTATION_MODIFIED,ng),M.tX.addEventListener(S.sV.ANNOTATION_SELECTION_CHANGE,nu),M.tX.addEventListener(S.sV.ANNOTATION_SELECTION_CHANGE,nu),M.tX.addEventListener(S.sV.ANNOTATION_REMOVED,np),M.tX.addEventListener(S.sV.SEGMENTATION_MODIFIED,t5),M.tX.addEventListener(S.sV.SEGMENTATION_DATA_MODIFIED,t2),M.tX.addEventListener(S.sV.SEGMENTATION_REPRESENTATION_MODIFIED,iG),M.tX.addEventListener(S.sV.SEGMENTATION_REPRESENTATION_ADDED,iG),M.tX.addEventListener(S.sV.SEGMENTATION_REMOVED,iW),aH=!0)}function aX(e,t){let n=M.g6.getPresentation(e,{selector:t});return n||e.getViewPresentation?.(t)}function az(e,t){if(!t)return!1;let n=M.g6.withPresentation(e,t);return n&&"function"==typeof e.setViewState?(e.setViewState(n),!0):"function"==typeof e.setViewPresentation&&(e.setViewPresentation(t),!0)}let{CAMERA_MODIFIED:a$}=M.fX.sV,{CAMERA_MODIFIED:aY}=M.fX.sV,{CAMERA_MODIFIED:aj}=M.fX.sV,{STACK_NEW_IMAGE:aJ,VOLUME_NEW_IMAGE:aQ}=M.fX.sV,{CAMERA_MODIFIED:aq}=M.fX.sV;var aK=n(73904);let{calibratedPixelSpacingMetadataProvider:aZ}=M.BF;n(64029);var a0=n(11212);n(2468),n(60332),n(52210),n(80455),n(35558),n(65114);let a1=function(e,t,n={}){let i=n.onFlood,a=n.onBoundary,r=n.equals,o=n.filter,s=n.diagonals||!1,l=e(...t),d=(function(e){let t=[];for(let r=0;r0;)!function(t){var n;let s=t.currentArgs,m=t.previousArgs;p(s)||(function(e){let[t,n,i=0]=e;u.add(t+32768+65536*(n+32768+65536*(i+32768)))}(s),function(t){let n=e(...t);return r?r(n,l):n===l}(s)?(n=s,h.push(n),i&&i(...n),function(e){for(let t=0;t{this.calculators.set(e,new a2.C3({storePointData:t}))}):this.calculators.set(n,new a2.C3({storePointData:t}))}static statsCallback(e){let{segmentIndex:t,...n}=e;if(!t)throw Error("Segment index is required for stats calculation");let i="individual"===this.mode?this.calculators.get(t):this.calculators.get(this.indices);if(!i)throw Error(`No calculator found for segment ${t}`);i.statsCallback(n)}static getStatistics(e){if("individual"===this.mode){let t={};return this.calculators.forEach((n,i)=>{t[i]=n.getStatistics(e)}),t}return this.calculators.get(this.indices).getStatistics(e)}}a5.calculators=new Map,a5.indices=[],a5.mode="collective",n(68002),n(6972),n(12236);var a3=n(40155),a8=n(12722),a4=n(81480);function a6(e,t,n={}){let i=(0,a8.getSegmentation)(e),a=i.representationData,r=n?.representationType??Object.keys(a)[0];if(!r)throw Error(`Segmentation ${e} does not have any representations`);switch(r){case S.D_.Labelmap:return function(e,t,{viewport:n}){if("volume"===(n?(0,tU.A)(n):"unsupported")||n instanceof M.ei){for(let n of(0,tN.m)(e)){let i=(0,tN.kL)(n);if(!i)continue;let a=i.voxelManager,r=M.BF.transformWorldToIndex(i.imageData,t),o=a.getAtIJKPoint(r);if(o)return(0,tN.Mx)(e,n.labelmapId,o)}return}let i=(0,a8.getCurrentLabelmapImageIdsForViewport)(n.id,e.segmentationId);if(i?.length)for(let a of i){if(!M.PP.getImage(a))continue;let i=(0,tY.wV)(n.id,e.segmentationId,a),r=i?.actor.getMapper().getInputData(),o=M.BF.transformWorldToIndex(r,t),s=r.getDimensions(),l=(r.voxelManager||M.BF.VoxelManager.createScalarVolumeVoxelManager({dimensions:s,scalarData:r.getPointData().getScalars().getData()})).getAtIJKPoint(o);if(!l)continue;let d=(0,tN.m)(e).find(e=>e.imageIds?.includes(a));if(!d)return l;return(0,tN.Mx)(e,d.labelmapId,l)}}(i,t,n);case S.D_.Contour:return function(e,t,{viewport:n}){let i=e.representationData.Contour,a=new Map;for(let[e,t]of i.annotationUIDsMap)for(let n of t){let t=(0,iS.gw)(n);t&&a.set(t,Number(e))}for(let e of(0,a4.A)(n,Array.from(a.keys()))){let{polyline:n}=e.data.contour;if((0,tg.isPointInsidePolyline3D)(t,n))return a.get(e)}}(i,t,n);default:return}}var a9=n(5205);function a7(e,t,n=1){let i=Array.from({length:2*n+1},(e,t)=>t-n);for(let n of i)for(let a of i)for(let r of i){if(0===n&&0===a&&0===r)continue;let i=e(n,a,r);if(void 0!==i&&t!==i)return!0}return!1}let re=` +const MAX_STRENGTH = 65535f; + +// Workgroup size - X*Y*Z must be multiple of 32 for better performance +override workGroupSizeX = 1u; +override workGroupSizeY = 1u; +override workGroupSizeZ = 1u; + +// Compare the current voxel to neighbors using a 9x9x9 window +override windowSize = 9i; + +struct Params { + size: vec3u, + iteration: u32, +} + +// New structure to track bounds of modified voxels +struct Bounds { + minX: atomic, + minY: atomic, + minZ: atomic, + maxX: atomic, + maxY: atomic, + maxZ: atomic, +} + +@group(0) @binding(0) var params: Params; +@group(0) @binding(1) var volumePixelData: array; +@group(0) @binding(2) var labelmap: array; +@group(0) @binding(3) var strengthData: array; +@group(0) @binding(4) var prevLabelmap: array; +@group(0) @binding(5) var prevStrengthData: array; +@group(0) @binding(6) var updatedVoxelsCounter: array>; +@group(0) @binding(7) var modifiedBounds: Bounds; + +fn getPixelIndex(ijkPos: vec3u) -> u32 { + let numPixelsPerSlice = params.size.x * params.size.y; + return ijkPos.x + ijkPos.y * params.size.x + ijkPos.z * numPixelsPerSlice; +} + +fn updateBounds(position: vec3i) { + // Atomically update min bounds (use min operation) + let oldMinX = atomicMin(&modifiedBounds.minX, position.x); + let oldMinY = atomicMin(&modifiedBounds.minY, position.y); + let oldMinZ = atomicMin(&modifiedBounds.minZ, position.z); + + // Atomically update max bounds (use max operation) + let oldMaxX = atomicMax(&modifiedBounds.maxX, position.x); + let oldMaxY = atomicMax(&modifiedBounds.maxY, position.y); + let oldMaxZ = atomicMax(&modifiedBounds.maxZ, position.z); +} + +@compute @workgroup_size(workGroupSizeX, workGroupSizeY, workGroupSizeZ) +fn main( + @builtin(global_invocation_id) globalId: vec3u, +) { + // Make sure it will not get out of bounds for volume with sizes that + // are not multiple of workGroupSize + if ( + globalId.x >= params.size.x || + globalId.y >= params.size.y || + globalId.z >= params.size.z + ) { + return; + } + + // Initialize bounds for the first iteration + if (params.iteration == 0 && globalId.x == 0 && globalId.y == 0 && globalId.z == 0) { + // Initialize to opposite extremes to ensure any update will improve the bounds + atomicStore(&modifiedBounds.minX, i32(params.size.x)); + atomicStore(&modifiedBounds.minY, i32(params.size.y)); + atomicStore(&modifiedBounds.minZ, i32(params.size.z)); + atomicStore(&modifiedBounds.maxX, -1); + atomicStore(&modifiedBounds.maxY, -1); + atomicStore(&modifiedBounds.maxZ, -1); + } + + let currentCoord = vec3i(globalId); + let currentPixelIndex = getPixelIndex(globalId); + + let numPixels = arrayLength(&volumePixelData); + let currentPixelValue = volumePixelData[currentPixelIndex]; + + if (params.iteration == 0) { + // All non-zero initial labels are given maximum strength + strengthData[currentPixelIndex] = select(MAX_STRENGTH, 0., labelmap[currentPixelIndex] == 0); + + // Update bounds for non-zero initial labels + if (labelmap[currentPixelIndex] != 0) { + updateBounds(currentCoord); + } + return; + } + + // It should at least copy the values from previous state + var newLabel = prevLabelmap[currentPixelIndex]; + var newStrength = prevStrengthData[currentPixelIndex]; + + let window = i32(ceil(f32(windowSize - 1) * .5)); + let minWindow = -1i * window; + let maxWindow = 1i * window; + + for (var k = minWindow; k <= maxWindow; k++) { + for (var j = minWindow; j <= maxWindow; j++) { + for (var i = minWindow; i <= maxWindow; i++) { + // Skip current voxel + if (i == 0 && j == 0 && k == 0) { + continue; + } + + let neighborCoord = currentCoord + vec3i(i, j, k); + + // Boundary conditions. Do not grow outside of the volume + if ( + neighborCoord.x < 0i || neighborCoord.x >= i32(params.size.x) || + neighborCoord.y < 0i || neighborCoord.y >= i32(params.size.y) || + neighborCoord.z < 0i || neighborCoord.z >= i32(params.size.z) + ) { + continue; + } + + let neighborIndex = getPixelIndex(vec3u(neighborCoord)); + let neighborPixelValue = volumePixelData[neighborIndex]; + let prevNeighborStrength = prevStrengthData[neighborIndex]; + let strengthCost = abs(neighborPixelValue - currentPixelValue); + let takeoverStrength = prevNeighborStrength - strengthCost; + + if (takeoverStrength > newStrength) { + newLabel = prevLabelmap[neighborIndex]; + newStrength = takeoverStrength; + } + } + } + } + + if (labelmap[currentPixelIndex] != newLabel) { + atomicAdd(&updatedVoxelsCounter[params.iteration], 1u); + + // Update bounds for modified voxels + updateBounds(currentCoord); + } + + labelmap[currentPixelIndex] = newLabel; + strengthData[currentPixelIndex] = newStrength; +} +`,rt={windowSize:3,maxProcessingTime:3e4,inspection:{numCyclesInterval:5,numCyclesBelowThreshold:3,threshold:1e-4}};async function rn(e,t,n=rt){let{windowSize:i,maxProcessingTime:a}=Object.assign({},rt,n),r=Object.assign({},rt.inspection,n.inspection),o=M.PP.getVolume(e),s=M.PP.getVolume(t),[l,d,c]=o.dimensions;if(s.dimensions[0]!==l||s.dimensions[1]!==d||s.dimensions[2]!==c)throw Error("Volume and labelmap must have the same size");let h=Math.floor(Math.sqrt(d**2+l**2+c**2)/2);h=Math.min(h,500);let u=s.voxelManager.getCompleteScalarDataArray(),g=o.voxelManager.getCompleteScalarDataArray();g instanceof Float32Array||(g=new Float32Array(g));let p=await navigator.gpu?.requestAdapter(),m=await p.requestDevice({requiredLimits:{maxStorageBufferBindingSize:2136746229.76,maxBufferSize:2136746229.76}}),f=g.byteLength,v=h*Uint32Array.BYTES_PER_ELEMENT,I=6*Int32Array.BYTES_PER_ELEMENT,_=m.createShaderModule({code:re}),w=new Uint32Array([l,d,c,0]),b=m.createBuffer({size:w.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),C=m.createBuffer({size:f,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST});m.queue.writeBuffer(C,0,g);let A=[0,1].map(()=>m.createBuffer({size:f,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST}));m.queue.writeBuffer(A[0],0,new Uint32Array(u));let E=[0,1].map(()=>m.createBuffer({size:f,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST})),y=m.createBuffer({size:v,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST}),S=m.createBuffer({size:I,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST}),T=new Int32Array([l,d,c,-1,-1,-1]);m.queue.writeBuffer(S,0,T);let D=m.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:3,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:4,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}},{binding:5,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}},{binding:6,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:7,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}}]}),P=[0,1].map(e=>{let t=A[e],n=E[e],i=A[(e+1)%2],a=E[(e+1)%2];return m.createBindGroup({layout:D,entries:[{binding:0,resource:{buffer:b}},{binding:1,resource:{buffer:C}},{binding:2,resource:{buffer:t}},{binding:3,resource:{buffer:n}},{binding:4,resource:{buffer:i}},{binding:5,resource:{buffer:a}},{binding:6,resource:{buffer:y}},{binding:7,resource:{buffer:S}}]})}),k=m.createComputePipeline({layout:m.createPipelineLayout({bindGroupLayouts:[D]}),compute:{module:_,entryPoint:"main",constants:{workGroupSizeX:8,workGroupSizeY:8,workGroupSizeZ:4,windowSize:i}}}),x=[Math.ceil(l/8),Math.ceil(d/8),Math.ceil(c/4)],L=m.createBuffer({size:v,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),V=a?performance.now()+a:0,O=r.numCyclesInterval,R=0;for(let e=0;e0&&!(e%O)){await L.mapAsync(GPUMapMode.READ,0,v);let t=new Uint32Array(L.getMappedRange(0,v).slice(0))[e]/g.length;if(L.unmap(),e>=1&&tV){console.warn(`Exceeded processing time limit (${a})ms`);break}}let N=m.createCommandEncoder(),U=(h+1)%2,F=m.createBuffer({size:f,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),B=m.createBuffer({size:I,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST});N.copyBufferToBuffer(A[U],0,F,0,f),N.copyBufferToBuffer(S,0,B,0,I),m.queue.submit([N.finish()]),await F.mapAsync(GPUMapMode.READ,0,f);let G=new Uint32Array(F.getMappedRange(0,f));u.set(G),F.unmap(),await B.mapAsync(GPUMapMode.READ,0,I);let H=new Int32Array(B.getMappedRange(0,I).slice(0));B.unmap();let W=H[0],X=H[1],z=H[2],$=H[3],Y=H[4],j=H[5];s.voxelManager.setCompleteScalarDataArray(u),s.voxelManager.clearBounds(),s.voxelManager.setBounds([[W,$],[X,Y],[z,j]])}var ri=n(49963);let{transformWorldToIndex:ra}=M.BF;async function rr(e,t,n,i){let a=await M.UH.createAndCacheDerivedLabelmapVolume(e.volumeId);return!function(e,t,n,i){let a=e.voxelManager.getCompleteScalarDataArray(),r=n.center,[o,s,l]=e.dimensions,d=o*s,c=ra(e.imageData,r),h=a[c[2]*d+c[1]*o+c[0]],u=i.positiveSeedValue??254,g=Math.abs(h*(i.positiveSeedVariance??.1)),p=h-g,m=h+g,f=[[-1,0,0],[1,0,0],[0,-1,0],[0,1,0],[0,0,-1],[0,0,1]],v=c[2]*d+c[1]*o+c[0];t.voxelManager.setAtIndex(v,u);let I=[c];for(;I.length;){let[e,n,i]=I.shift();for(let r=0,c=f.length;r=o||g<0||g>=s||v<0||v>=l)continue;let _=v*d+g*o+h,w=a[_];t.voxelManager.getAtIndex(_)===u||wm||(t.voxelManager.setAtIndex(_,u),I.push([h,g,v]))}}}(e,a,t,i),!function(e,t,n,i,a){let r=e.voxelManager.getCompleteScalarDataArray(),[o,s,l]=t.dimensions,d=o*s,{worldVecRowDir:c,worldVecSliceDir:h}=M.BF.getVolumeDirectionVectors(t.imageData,(0,i$.A)(i)),u=ra(e.imageData,n.center),g=r[u[2]*o*s+u[1]*o+u[0]],p=a.negativeSeedVariance??.8,m=a?.negativeSeedValue??255,f=Math.abs(g*p),v=g-f,I=g+f,_=2*Math.PI/360,w=ri.x8(ri.vt(),h,_),b=e7.o8(c);for(let e=0;e<360;e++){let e=e7.Ln(e7.vt(),n.center,b,n.radius),[i,a,c]=ra(t.imageData,e);if(e7.gL(b,b,w),i<0||i>=o||a<0||a>=s||c<0||c>=l)continue;let h=i+a*o+c*d,u=r[h];(uI)&&t.voxelManager.setAtIndex(h,m)}}(e,a,t,n,i),a}async function ro(e,t,n,i){let a=function(e,t,n){let i=e.imageData,a=(0,i$.A)(n),{ijkVecRowDir:r,ijkVecColDir:o}=M.BF.getVolumeDirectionVectors(i,a);if([r,o].some(e=>!M.BF.isEqual(Math.abs(e[0]),1)&&!M.BF.isEqual(Math.abs(e[1]),1)&&!M.BF.isEqual(Math.abs(e[2]),1)))return void console.warn("Oblique view is not supported!");let{boundsIJK:s}=function(e,t){let n=e.imageData.getDirection(),i=e7.fA(n[3],n[4],n[5]),{center:a,radius:r}=t,o=e.imageData,s=e7.Ln(e7.vt(),a,i,-r),l=e7.Ln(e7.vt(),a,i,r),d=(0,a0.R)([l,s],o),{topLeftWorld:c,bottomRightWorld:h}=d,u=ra(e.imageData,c),g=ra(e.imageData,h);return{...d,topLeftIJK:u,bottomRightIJK:g}}(e,t),l={minX:s[0][0],maxX:s[0][1]+1,minY:s[1][0],maxY:s[1][1]+1,minZ:s[2][0],maxZ:s[2][1]+1};return M.BF.createSubVolume(e.volumeId,l,{targetBuffer:{type:"Float32Array"}})}(M.PP.getVolume(e),t,n),r=await rr(a,t,n,i);return await rn(a.volumeId,r.volumeId),r}let rs=[-1/0,-995],rl=[0,1900];async function rd(e,t){let n=M.UH.createAndCacheDerivedLabelmapVolume(e.volumeId);return!function(e,t,n){let{positiveSeedValue:i=254,positivePixelRange:a=rl}=n,r=e.voxelManager.getCompleteScalarDataArray();t.voxelManager.getCompleteScalarDataArray();let[o,s,l]=t.dimensions,d=Math.max(Math.floor(l/2)-3,0),c=Math.max(d+5,l),h=o*s;for(let e=d;e=a[0]&&l<=a[1]&&t.voxelManager.setAtIndex(o,i)}}}}(e,n,t),!function(e,t,n){let{negativeSeedValue:i=255,negativePixelRange:a=rs}=n,r=e.voxelManager.getCompleteScalarDataArray(),[o,s,l]=t.dimensions,d=Math.floor(l/2),c=Array(o*s).fill(!1),h=d*o*s,u=(e,n)=>{let l=[[e,n]];for(;l.length;){let[e,n]=l.shift(),d=n*o+e;if(e<0||e>=o||n<0||n>=s||c[d])continue;c[d]=!0;let u=h+d,g=r[u];ga[1]||(t.voxelManager.setAtIndex(u,i),l.push([e-1,n]),l.push([e+1,n]),l.push([e,n-1]),l.push([e,n+1]))}},g=(e,t,n,i)=>{for(let s=e;s!==t;s+=n){let e=i*o+s,t=r[h+e];if(ta[1])break;c[e]||u(s,i)}};for(let e=0;e=r||f[1]<0||f[1]>=o||f[2]<0||f[2]>=s)return console.warn("Click position is outside volume bounds."),null;let I=M.BF.calculateNeighborhoodStats(d,i,f,h);0===I.count&&(I.mean=d[v],I.stdDev=0);let _=I.mean-u*I.stdDev,w=I.mean+u*I.stdDev,b=[[-1,0,0],[1,0,0],[0,-1,0],[0,1,0],[0,0,-1],[0,0,1]],C=1/0,A=1/0,E=1/0,y=-1/0,S=-1/0,T=-1/0,D=new Set,P=[],k=d[v];if(!(k>=_)||!(k<=w))return console.warn("Clicked voxel intensity is outside the calculated positive range. No positive seeds generated."),{positiveSeedIndices:new Set,negativeSeedIndices:new Set};D.add(v),P.push(f),C=y=f[0],A=S=f[1],E=T=f[2];let x=0;for(;x=r||g<0||g>=o||p<0||p>=s)continue;let m=p*c+g*r+u;if(D.has(m))continue;let f=d[m];f>=_&&f<=w&&(D.add(m),D.size<1e5&&P.push([u,g,p]))}}if(D.size>=1e5&&console.debug("Reached maximum number of positive seeds (100000). Stopping BFS."),0===D.size)return console.warn("No positive seeds found after BFS."),{positiveSeedIndices:new Set,negativeSeedIndices:new Set};let L=0,V=0;D.forEach(e=>{let t=d[e];L+=t,V+=t*t});let O=D.size,R=L/O,N=g*Math.sqrt(Math.max(0,V/O-R*R)),U=Math.max(0,C-p),F=Math.max(0,A-p),B=Math.max(0,E-p),G=Math.min(r-1,y+p),H=Math.min(o-1,S+p),W=Math.min(s-1,T+p),X=new Set,z=0,$=0,Y=50*m;for(;$N){let i=!1;for(let a=-1;a<=1;a++){let s=t+a;if(!(s<0)&&!(s>=o))for(let t=-1;t<=1;t++){let a=e+t;if(a<0||a>=r)continue;let o=n*c+s*r+a;D.has(o)||X.has(o)||(X.add(o),i=!0)}}i&&$++}}return 0===X.size&&console.warn("Could not find any negative seeds. GrowCut might fail or produce poor results."),console.debug("positiveSeedIndices",D.size),console.debug("negativeSeedIndices",X.size),{positiveSeedIndices:D,negativeSeedIndices:X}}async function rg({referencedVolumeId:e,worldPosition:t,options:n}){let i=M.PP.getVolume(e),a=M.UH.createAndCacheDerivedLabelmapVolume(e);a.voxelManager.forEach(({index:e,value:t})=>{0!==t&&a.voxelManager.setAtIndex(e,0)});let r=n.seeds??ru(i,t,n),o=n?.positiveSeedValue??254,s=n?.negativeSeedValue??255;if(!r)return null;let{positiveSeedIndices:l,negativeSeedIndices:d}=r;return l.size<10||l.size>1e5||d.size<10?console.warn("Not enough seeds found. GrowCut might fail or produce poor results."):(l.forEach(e=>{a.voxelManager.setAtIndex(e,o)}),d.forEach(e=>{a.voxelManager.setAtIndex(e,s)}),await rn(e,a.volumeId,n)),a}var rp=n(6001),rm=n(67358),rf=n(5800);n(2911),n(81038),n(75405);var rv=n(74600),rI=n(11236);function r_(e,t){let n=(0,e8.T)(e);if("string"==typeof t&&(console.warn("segmentIndex is a string, converting to number"),t=Number(t)),Object.values(n.segments).forEach(e=>{e.active=!1}),!n.segments[t]&&(n.segments[t]={segmentIndex:t,label:"",locked:!1,cachedStats:{},active:!1},n.representationData?.Labelmap)){(0,tN.uk)(n);let e=(0,tN.m)(n)[0];e&&((0,tN.Zs)(n,t,{labelmapId:e.labelmapId,labelValue:t}),(0,tN.xS)(n))}if(n.representationData?.Labelmap&&!(0,tN.hM)(n,t)){(0,tN.uk)(n);let e=(0,tN.m)(n)[0];e&&((0,tN.Zs)(n,t,{labelmapId:e.labelmapId,labelValue:t}),(0,tN.xS)(n))}!0!==n.segments[t].active&&(n.segments[t].active=!0,(0,e9.triggerSegmentationModified)(e));let i=(0,tZ.P)(e);i.forEach(n=>{(0,e4.r$)(n,{segmentationId:e}).forEach(e=>{e.segments[t]||(e.segments[t]={visible:!0})})}),i.forEach(e=>{let t=(0,tT.getToolGroupForViewport)(e);t&&function(e){let t=(0,tT.getToolGroup)(e);if(void 0===t)return;(0,a3.n)(e).forEach(e=>{e.invalidateBrushCursor()});let n=t.getViewportsInfo();if(!Object.keys(n).map(e=>n[e]).length)return;let i=t.getViewportIds();(0,tr.A)(i)}(t.id)})}function rw(e,t){t.map(t=>(function(e,t){let{segmentationId:n,config:i}=t;if(!tX((0,M.yj)(e)?.viewport,n,t.type))return void console.warn(`Skipping ${t.type} representation of segmentation "${n}" on viewport "${e}": the viewport is not a compatible destination for it.`);let a={colorLUTIndex:function(e){let{colorLUTOrIndex:t}=e||{};return void 0===t?(0,rI.u)(M.BF.deepClone(rv.A)):"number"==typeof t?t:Array.isArray(t)&&t.every(e=>Array.isArray(e)&&4===e.length)?(0,rI.u)(t):(0,rI.u)(M.BF.deepClone(rv.A))}(i),...i};iB._6.addSegmentationRepresentation(e,n,t.type,a);let{viewport:r}=(0,M.yj)(e)||{};if(r&&(0,tD.Np)(r,n,t.type),!(0,aE.Q)(n)){let e=1,t=iB._6.getSegmentation(n);if(t){let i=Object.keys(t.segments);i.length>0&&(e=i.map(e=>Number(e)).sort()[0]),r_(n,e)}}t.type===S.D_.Contour&&(0,tr.t)([e]),t.type===S.D_.Surface&&(0,e9.triggerSegmentationDataModified)(n),(0,e9.triggerSegmentationModified)(n)})(e,t))}function rb(e,t){return rw(e,t.map(e=>({...e,type:S.D_.Contour})))}function rC(e){let t={};for(let[n,i]of Object.entries(e))t[n]=rb(n,i);return t}function rA(e,t){return rw(e,t.map(e=>({...e,type:S.D_.Labelmap})))}function rE(e){let t={};for(let[n,i]of Object.entries(e))t[n]=rA(n,i.map(e=>({...e,type:S.D_.Labelmap})))}function rM(e,t){return rw(e,t.map(e=>({...e,type:S.D_.Surface})))}function ry(e){let t={};for(let[n,i]of Object.entries(e))t[n]=rM(n,i);return t}async function rS({segmentationId:e,viewportId:t,imageIds:n,options:i}){let a=(0,e8.T)(e);if(i?.removeOriginal){let e=a.representationData.Labelmap;M.PP.getVolume(e.volumeId)&&M.PP.removeVolumeLoadObject(e.volumeId),a.representationData.Labelmap={imageIds:n}}else a.representationData.Labelmap={...a.representationData.Labelmap,imageIds:n};await rw(t,[{segmentationId:e,type:S.D_.Labelmap}]),M.tX.addEventListenerOnce(S.sV.SEGMENTATION_RENDERED,()=>(0,e9.triggerSegmentationDataModified)(e))}async function rT(e){return(0,iB.Zm)(e)}n(83143),n(51889),n(26361),n(96313);var rD=n(84305);function rP(e){return Array.isArray(e)&&3===e.length&&e.every(e=>Number.isFinite(e))}function rk(e){let t;if(!e)return null;try{t=(0,i$.A)(e)}catch{return null}let n=t?.viewPlaneNormal,i=t?.focalPoint;if(!rP(n)||!rP(i)||1e-10>e7.Bw(n))return null;let a=e7.S8(e7.vt(),n);return{normal:[a[0],a[1],a[2]],point:[i[0],i[1],i[2]]}}function rx(e,t){if(!e||!t)return null;let n=e7.S8(e7.vt(),e.normal),i=e7.S8(e7.vt(),t.normal),a=e7.$A(e7.vt(),n,i),r=e7.m3(a);if(r<1e-6*1e-6)return null;let o=e7.Om(n,e.point),s=e7.Om(i,t.point),l=e7.$A(e7.vt(),i,a),d=e7.$A(e7.vt(),a,n),c=e7.vt();return(e7.Ln(c,c,l,o),e7.Ln(c,c,d,s),e7.hs(c,c,1/r),e7.S8(a,a),[...c,...a].every(e=>Number.isFinite(e)))?{point:[c[0],c[1],c[2]],direction:[a[0],a[1],a[2]]}:null}function rL(e,t){let n=e7.S8(e7.vt(),t.normal),i=e7.Re(e7.vt(),e,t.point);return e7.Om(i,n)}function rV(e,t){let n=e7.S8(e7.vt(),t.normal),i=rL(e,t);return[e[0]-i*n[0],e[1]-i*n[1],e[2]-i*n[2]]}function rO(e,t,n){let[i,a]=n;if(1e-6>Math.abs(t))return e<0;let r=e/t;if(t>0){if(r>a)return 0;r>i&&(n[0]=r)}else{if(rMath.abs(d)&&1e-6>Math.abs(c)&&r>=n[0]&&r<=n[2]&&o>=n[1]&&o<=n[3])return 1;let h=[0,1];if(rO(n[0]-r,d,h)&&rO(r-n[2],-d,h)&&rO(n[1]-o,c,h)&&rO(o-n[3],-c,h)){let[e,t]=h;return t<1&&(a[0]=r+t*d,a[1]=o+t*c),e>0&&(i[0]+=e*d,i[1]+=e*c),1}return 0}function rN(e){if(M.BF.isGenericViewport(e)){let{element:t}=e;return{clientWidth:t?.clientWidth??0,clientHeight:t?.clientHeight??0}}let{clientWidth:t=0,clientHeight:n=0}=e.canvas??{};return{clientWidth:t,clientHeight:n}}function rU(e,t){if(!e||!t)return null;let{clientWidth:n,clientHeight:i}=rN(t);if(!n||!i)return null;let a=e7.S8(e7.vt(),e.direction);if(1e-10>e7.Bw(a))return null;let r=t.canvasToWorld([n/2,i/2]),o=e7.Re(e7.vt(),r,e.point),s=e7.Om(o,a),l=e7.Ln(e7.vt(),e.point,a,s),d=t.canvasToWorld([0,0]),c=Math.max(2*e7.Io(r,d),1),h=e7.Ln(e7.vt(),l,a,-c),u=e7.Ln(e7.vt(),l,a,c),g=t.worldToCanvas([h[0],h[1],h[2]]),p=t.worldToCanvas([u[0],u[1],u[2]]);if(![...g,...p].every(e=>Number.isFinite(e)))return null;let m=[g[0],g[1]],f=[p[0],p[1]];return 1!==rR(m,f,[0,0,n,i])||.001>Math.hypot(f[0]-m[0],f[1]-m[1])?null:[m,f]}let{Cf:rF}=M.Jj;function rB(e){return M.BF.isGenericViewport(e)?rF.MINIMUM_SLAB_THICKNESS:e.getSlabThickness()}function rG(e,t){M.BF.isGenericViewport(e)&&e.setViewReference({cameraFocalPoint:t})}function rH(e,t){if(!M.BF.isGenericViewport(e))return!1;if(e.getCurrentMode?.()==="stack"){if("function"!=typeof e.getImageIds||"function"!=typeof e.getCurrentImageIdIndex)return!1;let n=null;try{n=M.BF.getClosestStackImageIndexForPoint(t,e)}catch{return!1}return null!==n&&!(n<0)&&(e.setViewReference({sliceIndex:n}),!0)}return e.setViewReference({cameraFocalPoint:[t[0],t[1],t[2]]}),!0}function rW(e){if(!M.BF.viewportSupportsDisplaySetPresentation(e))return{properties:{}};let t=e.getSourceDataId(),n={...(t?e.getDisplaySetPresentation(t):{})??{}},i=n.VOILUTFunction??n.voiLUTFunction;void 0!==i&&(n.VOILUTFunction=i);let a=aX(e)??{};return{properties:n,rotation:a.rotation,flipHorizontal:a.flipHorizontal,flipVertical:a.flipVertical,currentImageId:e.getCurrentImageId()}}!function(e){e.CLIP_STOPPED="CORNERSTONE_CINE_TOOL_STOPPED",e.CLIP_STARTED="CORNERSTONE_CINE_TOOL_STARTED"}(r||(r={}));let{Dt:rX}=M.fX,{triggerEvent:rz}=M.BF;n(17242);var r$=n(85250);n(4235),n(57186);let{isEqual:rY}=M.BF;e7.fA(1,0,0),e7.fA(0,1,0),e7.fA(0,0,1);var rj=n(29544);M.fX.Yw.Prefetch;let{imageRetrieveMetadataProvider:rJ}=M.BF,{imageRetrieveMetadataProvider:rQ}=M.BF;function rq(e,t){let n=e.getScalarDataLength(),i=new Float32Array(n);for(let a of t){let t=e.getDimensionGroupScalarData(a);for(let e=0;e{n.updateSegmentation(e.segmentationId,e.payload),t||(0,e9.triggerSegmentationModified)(e.segmentationId)})}var r7=n(86779),oe=n(19921),ot=n(85840);function on(e,t,n){let i=(0,e4.r$)(e,t);i&&i.forEach(t=>{var i;i={segmentationId:t.segmentationId,type:t.type},iB._6.setSegmentationRepresentationVisibility(e,i,n)})}function oi(e,t){return(0,ot.I)(e,t)}function oa(e,t,n,i){let a=(0,e4.r$)(e,t);a&&(a.forEach(e=>{e.segments&&e.segments[n]&&(e.visible||=i,e.segments[n].visible=i)}),tV(t.segmentationId),(0,e9.triggerSegmentationRepresentationModified)(e,t.segmentationId))}function or(e,t,n){return!oo(e,t).has(n)}function oo(e,t){let n=(0,e4.Ut)(e,t);return n?Object.entries(n.segments).reduce((e,[t,n])=>(n.visible||e.add(Number(t)),e),new Set):new Set}var os=n(91006),ol=n(95324);function od(e){return iQ.Y.getStyle(e)}function oc(e,t,n){iQ.Y.setStyle(e,t,n),e.viewportId||e.segmentationId||(0,os.K)().forEach(e=>{tL(e.segmentationId)}),(0,e9.triggerSegmentationRepresentationModified)(e.viewportId,e.segmentationId,e.type)}function oh(e,t){iQ.Y.setRenderInactiveSegmentations(e,t),tL(e),(0,ol.a)(e).forEach(t=>{(0,e9.triggerSegmentationRepresentationModified)(e,t.segmentationId)})}function ou(e){return iQ.Y.getRenderInactiveSegmentations(e)}function og(){iQ.Y.resetToGlobalStyle(),tL()}function op(e){return iQ.Y.hasCustomStyle(e)}var om=n(16835);async function of(e){let t=(0,iB.cC)(e);return(0,e9.triggerSegmentationModified)(e.segmentationId),t}let{DefaultHistoryMemo:ov}=M.BF.HistoryMemo;function oI(e,t,n){let i=(0,e8.T)(e);if(i.representationData.Labelmap){let a=(0,tN.hM)(i,t),r=(0,tN.r)(i,t);a&&r&&((r.volumeId?[M.PP.getVolume(r.volumeId)]:(r.imageIds??[]).map(e=>M.PP.getImage(e))).forEach(t=>{if(!t)return;let{voxelManager:i}=t,r=n?.recordHistory?(0,rp.hH)(e,i):null,o=r?.voxelManager??i;i.forEach(({value:e,index:t})=>{e===a.labelValue&&o.setAtIndex(t,0)}),r?.commitMemo()&&ov.push(r)}),(0,tN.Pi)(i,t)),(0,e9.triggerSegmentationDataModified)(e)}else throw Error("Invalid segmentation type, only labelmap is supported right now")}var o_=n(53686);function ow(e,t,n={setNextSegmentAsActive:!0}){let i=(0,e8.T)(e);if(i?.representationData.Contour)!function(e,t,n){let i=(0,om.getAnnotationsUIDMapFromSegmentation)(e);if(!i)return;let a=i.get(t);if(!a)return;let r=Array.from(a),o=[];for(let e of r){let t=(0,y.getAnnotation)(e);(0,t6.Ys)(t)&&o.push(t)}if(0!==o.length)for(let e of o)e.parentAnnotationUID||(n?.recordHistory&&o_.A.createAnnotationMemo(null,e,{deleting:!0}),(0,om.removeCompleteContourAnnotation)(e))}(e,t,{recordHistory:n.recordHistory});else if(i?.representationData.Labelmap)oI(e,t,{recordHistory:n.recordHistory});else throw Error("Invalid segmentation type");let a=(0,aE.Q)(e)===t,{segments:r}=i;if(delete r[t],r9([{segmentationId:e,payload:{segments:{...r}}}]),a&&!1!==n.setNextSegmentAsActive){let n=Object.keys(r).map(Number).sort((e,t)=>e-t),i=n.indexOf(t),a=n[i+1],o=n[i-1];void 0!==a?r_(e,a):void 0!==o&&r_(e,o)}(0,tZ.P)(e).forEach(n=>{(0,e4.r$)(n,{segmentationId:e}).forEach(e=>{delete e.segments[t]})})}function ob(e){let t=iB._6,n=(0,e8.T)(e);return t.getLabelmapImageIds(n.representationData)}var oC=n(61034),oA=n(10883);let oE={clearSegmentValue:oI,convertStackToVolumeLabelmap:of,computeVolumeLabelmapFromStack:rT,convertVolumeToStackLabelmap:function({segmentationId:e,options:t}){let n=(0,e8.T)(e);if(!n)return;let{volumeId:i}=n.representationData.Labelmap,a=M.PP.getVolume(i);return rS({segmentationId:e,viewportId:t.viewportId,imageIds:a.imageIds,options:t})}};var oM=n(5434);class oy{constructor(e){this._controlPoints=[],this._invalidated=!1,this._length=0,this._controlPoints=[],this._resolution=e?.resolution??20,this._fixedResolution=e?.fixedResolution??!1,this._closed=e?.closed??!1,this._invalidated=!0}get controlPoints(){return this._controlPoints}get numControlPoints(){return this._controlPoints.length}get resolution(){return this._resolution}set resolution(e){this._fixedResolution||this._resolution===e||(this._resolution=e,this.invalidated=!0)}get fixedResolution(){return this._fixedResolution}get closed(){return this._closed}set closed(e){this._closed!==e&&(this._closed=e,this.invalidated=!0)}get aabb(){return this._update(),this._aabb}get length(){return this._update(),this._length}get invalidated(){return this._invalidated}set invalidated(e){this._invalidated=e}hasTangentPoints(){return!1}addControlPoint(e){this._controlPoints.push([e[0],e[1]]),this.invalidated=!0}addControlPoints(e){e.forEach(e=>this.addControlPoint(e))}addControlPointAtU(e){let{start:t,end:n}=this._getLineSegmentAt(e).points,i=Math.floor(e),a=this._curveSegments[i],r=e-Math.floor(i),o=[t[0]+r*(n[0]-t[0]),t[1]+r*(n[1]-t[1])],s=this._controlPoints.indexOf(a.controlPoints.p1)+1;return this._controlPoints.splice(s,0,o),this.invalidated=!0,{index:s,point:o}}deleteControlPointByIndex(e){let t=this._closed?3:1;return!!(e>=0&&et)&&(this._controlPoints.splice(e,1),this.invalidated=!0,!0)}clearControlPoints(){this._controlPoints=[],this.invalidated=!0}setControlPoints(e){this.clearControlPoints(),this.addControlPoints(e)}updateControlPoint(e,t){if(e<0||e>=this._controlPoints.length)throw Error("Index out of bounds");this._controlPoints[e]=[...t],this.invalidated=!0}getControlPoints(){return this._controlPoints.map(e=>[e[0],e[1]])}getClosestControlPoint(e){let t=this._controlPoints,n=1/0,i=-1;for(let a=0,r=t.length;ae.distanceSquared-t.distanceSquared);let r=-1,o=1/0;for(let s=0;so)continue;let{curveSegmentIndex:d,curveSegment:c}=l,{lineSegments:h}=c;for(let a=0;a=r.minY&&e[1]=a.minY&&e[1]=s.maxX?a:s.maxX,r=r>=s.maxY?r:s.maxY,t+=l}this._curveSegments=e,this._aabb={minX:n,minY:i,maxX:a,maxY:r},this._length=t,this._invalidated=!1}_convertCurveSegmentsToPolyline(e){this._update();let t=[];return e.forEach(({lineSegments:e},n)=>{e.forEach((e,i)=>{0===n&&0===i&&t.push([...e.points.start]),t.push([...e.points.end])})}),t}_getCurveSegmmentsDistanceSquaredInfo(e){this._update();let t=[],{_curveSegments:n}=this;for(let i=0;in)return[];let i=this._getCurveSegmmentsDistanceSquaredInfo(e),a=[];for(let e=0,t=i.length;e=t.previousLineSegmentsLength&&a<=n)return t}}_getClosingCurveSegmentWithStraightLineSegment(){if(this.closed)return;let e=this._controlPoints,t=e[0],n=e[e.length-1],i={points:{start:[...t],end:[...n]},aabb:{minX:Math.min(t[0],n[0]),minY:Math.min(t[1],n[1]),maxX:Math.max(t[0],n[0]),maxY:Math.max(t[1],n[1])}};return{aabb:{minX:i.aabb.minX,minY:i.aabb.minY,maxX:i.aabb.maxX,maxY:i.aabb.maxY},lineSegments:[i]}}}class oS extends oy{getPreviewCurveSegments(e,t){let n=this._getNumCurveSegments()+1,i=Math.max(0,n-2),a=t?n:n-1,r=this.getTransformMatrix(),o=[...this.controlPoints],s=[];t||o.push(e);for(let e=i;e<=a;e++){let n=this._getCurveSegment(e,r,o,t);s.push(n)}return s}getSplineCurves(){let e=this._getNumCurveSegments(),t=Array(e);if(e<=0)return[];let n=this.getTransformMatrix(),i=0;for(let a=0;a=a)if(!this.closed)return;else o=(a+o)%a;let{p0:l,p1:d,p2:c,p3:h}=this._getCurveSegmentPoints(o,n,i),u=s*s,g=oM.fA(1,s,u,u*s),p=oM.Z0(oM.vt(),g,t);return[oM.Om(p,oM.fA(l[0],d[0],c[0],h[0])),oM.Om(p,oM.fA(l[1],d[1],c[1],h[1]))]}_getCurveSegmentPoints(e,t=this.controlPoints,n=this.closed){let i,a,r=this._getNumCurveSegments(t,n),o=e-1,s=n?(e+1)%r:e+1,l=s+1,d=t[e],c=t[s];return i=o>=0?t[o]:n?t[t.length-1]:tt.zx.mirror(c,d),a=ll?l:h;let e=this._getPoint(h,t,n,i);if(!r){a=e;continue}let o=Math.sqrt((e[0]-a[0])**2+(e[1]-a[1])**2),s={minX:a[0]<=e[0]?a[0]:e[0],maxX:a[0]>=e[0]?a[0]:e[0],minY:a[1]<=e[1]?a[1]:e[1],maxY:a[1]>=e[1]?a[1]:e[1]};d.push({points:{start:a,end:e},aabb:s,length:o,previousLineSegmentsLength:c}),a=e,c+=o}return d}_getCurveSegment(e,t=this.getTransformMatrix(),n=this.controlPoints,i=this.closed){let{p0:a,p1:r,p2:o,p3:s}=this._getCurveSegmentPoints(e,n,i),l=this._getLineSegments(e,t,n,i),d=0,c=1/0,h=1/0,u=-1/0,g=-1/0;return l.forEach(({aabb:e,length:t})=>{c=Math.min(c,e.minX),h=Math.min(h,e.minY),u=Math.max(u,e.maxX),g=Math.max(g,e.maxY),d+=t}),{controlPoints:{p0:a,p1:r,p2:o,p3:s},aabb:{minX:c,minY:h,maxX:u,maxY:g},length:d,previousCurveSegmentsLength:0,lineSegments:l}}}let oT=r$.multiplyScalar(r$.create(),r$.fromValues(1,4,1,0,-3,0,3,0,3,-6,3,0,-1,3,-3,1),1/6);class oD extends oS{getTransformMatrix(){return oT}}class oP extends oS{constructor(e){super(e),this._scale=e?.scale??.5,this._fixedScale=e?.fixedScale??!1}get scale(){return this._scale}set scale(e){this._fixedScale||this._scale===e||(this._scale=e,this.invalidated=!0)}get fixedScale(){return this._fixedScale}getTransformMatrix(){let{scale:e}=this,t=2*e;return[0,1,0,0,-e,0,e,0,t,e-3,3-t,-e,-e,2-e,e-2,e]}}class ok extends oP{constructor(){super({scale:.5,fixedScale:!0})}}class ox extends oP{constructor(){super({resolution:0,fixedResolution:!0,scale:0,fixedScale:!0})}}var oL=n(85839);class oV extends oL.oS{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{limitToViewport:!1,ignoreX:!1,ignoreY:!1,ignoreZ:!1}}){super(e,t)}touchDragCallback(e){this._dragCallback(e)}mouseDragCallback(e){this._dragCallback(e)}_checkImageInViewport(e,t){let n,{canvas:i}=e,a=window.devicePixelRatio,r=i.width/a,o=i.height/a,s=e.getDefaultActor(),l=e.getRenderer();n=s&&M.BF.isImageActor(s)?s.actor.getMapper().getInputData().getBounds():l.computeVisiblePropBounds();let[d,c]=e.worldToCanvas([n[0],n[2],n[4]]),[h,u]=e.worldToCanvas([n[1],n[3],n[5]]);if(1>=e.getZoom()){if(d+t[0]<0&&t[0]<0||h+t[0]>r&&t[0]>0||c+t[1]<0&&t[1]<0||u+t[1]>o&&t[1]>0)return!1}else if(d+t[0]>0&&t[0]>0||h+t[0]0&&t[1]>0||u+t[1]0?[e[0]/t,e[1]/t,e[2]/t]:e}([t.position[0]-i[0],t.position[1]-i[1],t.position[2]-i[2]]));let o=()=>e.getResolvedView?.()?.toICamera?.()?.parallelScale,s=o(),l=e.getZoom?.();e.setViewReference({...n,cameraFocalPoint:i,viewPlaneNormal:r,viewUp:a}),e.invalidateResolvedView?.();let d=o();if(s&&d&&"number"==typeof l&&"function"==typeof e.setZoom){let t=d*l/s;Number.isFinite(t)&&t>0&&e.setZoom(t)}e.render();return}e.setViewState?.(t);return}e.setCamera?.(t)}function oU(e,t){if(M.BF.isGenericViewport(e))return void e.resetViewState?.(t);e.resetCamera?.(t)}class oF extends oL.oS{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{rotateIncrementDegrees:2,rotateSampleDistanceFactor:2}}){super(e,t),this._resizeObservers=new Map,this._hasResolutionChanged=!1,this.preMouseDownCallback=e=>{let{element:t}=e.detail,{viewport:n}=(0,M.kJ)(t),i=n.getDefaultActor().actor.getMapper();if(!("getSampleDistance"in i||"getCurrentSampleDistance"in i))return!0;let a=i.getSampleDistance();if(!this._hasResolutionChanged){let{rotateSampleDistanceFactor:e}=this.configuration;i.setSampleDistance(a*e),this._hasResolutionChanged=!0,null!==this.cleanUp&&(document.removeEventListener("mouseup",this.cleanUp),document.removeEventListener("touchend",this.cleanUp),document.removeEventListener("touchcancel",this.cleanUp)),this.cleanUp=()=>{document.removeEventListener("mouseup",this.cleanUp),document.removeEventListener("touchend",this.cleanUp),document.removeEventListener("touchcancel",this.cleanUp),i.setSampleDistance(a),n.render(),this._hasResolutionChanged=!1},document.addEventListener("mouseup",this.cleanUp,{once:!0}),document.addEventListener("touchend",this.cleanUp,{once:!0}),document.addEventListener("touchcancel",this.cleanUp,{once:!0})}return!0},this._getViewportsInfo=()=>(0,tT.getToolGroup)(this.toolGroupId).viewportsInfo,this.onSetToolActive=()=>{let e=()=>{this._getViewportsInfo().forEach(({viewportId:e,renderingEngineId:t})=>{if(!this._resizeObservers.has(e)){let{viewport:n}=(0,M.b1)(e,t)||{viewport:null};if(!n)return;let{element:i}=n,a=new ResizeObserver(()=>{let n=(0,M.b1)(e,t);if(!n)return;let{viewport:i}=n,a=aX(i);oU(i),az(i,a),i.render()});a.observe(i),this._resizeObservers.set(e,a)}})};e(),this._viewportAddedListener=t=>{t.detail.toolGroupId===this.toolGroupId&&e()},M.tX.addEventListener(S.sV.TOOLGROUP_VIEWPORT_ADDED,this._viewportAddedListener)},this.onSetToolDisabled=()=>{this._resizeObservers.forEach((e,t)=>{e.disconnect(),this._resizeObservers.delete(t)}),this._viewportAddedListener&&(M.tX.removeEventListener(S.sV.TOOLGROUP_VIEWPORT_ADDED,this._viewportAddedListener),this._viewportAddedListener=null)},this.rotateCamera=(e,t,n,i)=>{let a=e.getVtkActiveCamera(),r=a.getViewUp(),o=a.getFocalPoint(),s=a.getPosition(),l=[0,0,0],d=[0,0,0],c=[0,0,0],h=r$.identity(new Float32Array(16));r$.translate(h,h,t),r$.rotate(h,h,i,n),r$.translate(h,h,[-t[0],-t[1],-t[2]]),e7.Z0(l,s,h),e7.Z0(d,o,h),r$.identity(h),r$.rotate(h,h,i,n),e7.Z0(c,r,h),oN(e,{position:l,viewUp:c,focalPoint:d})},this.touchDragCallback=this._dragCallback.bind(this),this.mouseDragCallback=this._dragCallback.bind(this)}_dragCallback(e){let{element:t,currentPoints:n,lastPoints:i}=e.detail,a=n.canvas,r=i.canvas,{rotateIncrementDegrees:o}=this.configuration,{viewport:s}=(0,M.kJ)(t),l=(0,i$.A)(s),d=t.clientWidth,c=t.clientHeight,h=[a[0]/d,a[1]/c],u=[r[0]/d,r[1]/c],g=s.canvasToWorld([.5*d,.5*c]),p=(1+Math.abs(.5))**2,m=[u[0],0,0],f=[h[0],0,0],v=m[0]**2,I=f[0]**2,_=v>p?0:Math.sqrt(p-v),w=I>p?0:Math.sqrt(p-I),b=[m[0],0,_];oR.Ay.normalize(b);let C=[f[0],0,w];oR.Ay.normalize(C);let A=oR.Ay.dot(b,C);if(Math.abs(A)>1e-4){let e=-2*Math.acos(oR.Ay.clampValue(A,-1,1))*Math.sign(h[0]-u[0])*o,t=l.viewUp,n=l.viewPlaneNormal,i=[0,0,0],a=[0,0,0];oR.Ay.cross(t,n,i),oR.Ay.normalize(i),oR.Ay.cross(n,i,a),oR.Ay.normalize(a),oR.Ay.normalize(t),this.rotateCamera(s,g,a,e);let r=(u[1]-h[1])*o;this.rotateCamera(s,g,i,r),s.render()}}}oF.toolName="TrackballRotate";var oB=n(37843),oG=n(17042),oH={radius:.5,latLongTessellation:!1,thetaResolution:8,startTheta:0,endTheta:360,phiResolution:8,startPhi:0,endPhi:180,center:[0,0,0],pointType:"Float64Array"},oW={newInstance:oG.Ay.newInstance(function(e,t,n={}){Object.assign(t,oH,n),oG.Ay.obj(e,t),oG.Ay.setGet(e,t,["radius","latLongTessellation","thetaResolution","startTheta","endTheta","phiResolution","startPhi","endPhi"]),oG.Ay.setGetArray(e,t,["center"],3),oG.Ay.algo(e,t,0,1),t.classHierarchy.push("vtkSphereSource"),e.requestData=(e,n)=>{let i=n[0],a=i?i.getPoints().getDataType():t.pointType;i=i?.initialize()||iJ.Ay.newInstance();let r=0,{thetaResolution:o}=t,s=t.startThetat.startTheta?t.endTheta:t.startTheta;l*=Math.PI/180;let d=t.startPhit.startPhi?t.endPhi:t.startPhi;c*=Math.PI/180,Math.abs(s-l)<2*Math.PI&&++o;let h=(l-s)/t.thetaResolution,u=+(t.startPhi<=0),g=t.phiResolution+(t.endPhi>=180?-1:0),p=t.phiResolution*o+2,m=2*t.phiResolution*t.thetaResolution,f=0,v=oG.Ay.newTypedArray(a,3*p),I=new Float32Array(3*p),_=0,w=new Uint32Array(5*m);t.startPhi<=0&&(v[3*f+0]=t.center[0],v[3*f+1]=t.center[1],v[3*f+2]=t.center[2]+t.radius,I[3*f+0]=0,I[3*f+1]=0,I[3*f+2]=1,f++,r++),t.endPhi>=180&&(v[3*f+0]=t.center[0],v[3*f+1]=t.center[1],v[3*f+2]=t.center[2]-t.radius,I[3*f+0]=0,I[3*f+1]=0,I[3*f+2]=-1,f++,r++);let b=t.phiResolution-r,C=(c-d)/(t.phiResolution-1);for(let e=0;e=180){let e=b-1+r;for(let t=0;t({origin:[...e.origin],normal:[...e.normal]}))}function oj(e){if(!e)return null;for(let[t,n]of Object.entries({AXIAL:[0,0,1],CORONAL:[0,1,0],SAGITTAL:[1,0,0]}))if(M.BF.isEqualAbs(1,e7.Om(n,e),.01))return t;return null}let oJ=new Map;function oQ(e,t){oJ.get(e)===t&&oJ.delete(e)}class oq extends oL.oS{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{showCornerSpheres:!0,showHandles:!0,showClippingPlanes:!0,mobile:{enabled:!1,opacity:.8},initialCropFactor:.08,sphereColors:{SAGITTAL:[1,1,0],CORONAL:[0,1,0],AXIAL:[1,0,0],CORNERS:[0,0,1]},sphereRadius:8,grabSpherePixelDistance:20,rotateIncrementDegrees:2,rotateSampleDistanceFactor:2,rotateClippingPlanesIncrementDegrees:5}}){super(e,t),this._resizeObservers=new Map,this._hasResolutionChanged=!1,this.originalClippingPlanes=[],this.draggingSphereIndex=null,this.rotatePlanesOnDrag=!1,this.suppressPlaneRotationForCurrentDrag=!1,this.cornerDragOffset=null,this.faceDragOffset=null,this.volumeDirectionVectors=null,this.sphereStates=[],this.edgeLines={},this.onSetToolConfiguration=()=>{},this.onSetToolEnabled=()=>{},this.onCameraModified=e=>{let{element:t}=e.currentTarget?{element:e.currentTarget}:e.detail,n=(0,M.kJ)(t);this._updateClippingPlanes(n.viewport),n.viewport.render()},this.preMouseDownCallback=e=>{var t;let{element:n}=e.detail,{viewport:i}=(0,M.kJ)(n);this.suppressPlaneRotationForCurrentDrag=(t=i.id,"orientation-controller"===oJ.get(t));let a=this._getVolumeActor(i);if(!a)return!1;let r=a.getMapper(),o=[e.detail.currentPoints.canvas[0],e.detail.currentPoints.canvas[1]];this.draggingSphereIndex=null,this.cornerDragOffset=null,this.faceDragOffset=null;for(let e=0;e{if(document.removeEventListener("mouseup",this.cleanUp),document.removeEventListener("touchend",this.cleanUp),document.removeEventListener("touchcancel",this.cleanUp),r.setSampleDistance(s),e.target.style.cursor="",null!==this.draggingSphereIndex){let e=this.sphereStates[this.draggingSphereIndex],[t]=this._getViewportsInfo(),n=(0,M.lD)(t.renderingEngineId).getViewport(t.viewportId);e.isCorner&&(this._updateCornerSpheres(),this._updateFaceSpheresFromCorners(),this._updateClippingPlanesFromFaceSpheres(n))}this.draggingSphereIndex=null,this.cornerDragOffset=null,this.faceDragOffset=null,this.suppressPlaneRotationForCurrentDrag=!1,i.render(),this._hasResolutionChanged=!1},document.addEventListener("mouseup",this.cleanUp,{once:!0}),document.addEventListener("touchend",this.cleanUp,{once:!0}),document.addEventListener("touchcancel",this.cleanUp,{once:!0})}return!0},this._onMouseMoveSphere=e=>{if(null===this.draggingSphereIndex)return!1;let t=this.sphereStates[this.draggingSphereIndex];if(!t)return!1;let{viewport:n,world:i}=this._getViewportAndWorldCoords(e);if(!n||!i)return!1;if(t.isCorner){let e=this.cornerDragOffset?e7.WQ([0,0,0],i,this.cornerDragOffset):i,n=t.point,a=function(e){let t=e.replace("corner_","");return{isXMin:t.includes("XMIN"),isXMax:t.includes("XMAX"),isYMin:t.includes("YMIN"),isYMax:t.includes("YMAX"),isZMin:t.includes("ZMIN"),isZMax:t.includes("ZMAX")}}(t.uid),{xDir:r,yDir:o,zDir:s}=this._getDirectionVectors();if(!r||!o||!s)return!1;let l=[e[0]-n[0],e[1]-n[1],e[2]-n[2]],d=l[0]*r[0]+l[1]*r[1]+l[2]*r[2],c=l[0]*o[0]+l[1]*o[1]+l[2]*o[2],h=l[0]*s[0]+l[1]*s[1]+l[2]*s[2];if(a.isXMin){let e=this.sphereStates[o$.XMIN],t=[e.point[0]+d*r[0],e.point[1]+d*r[1],e.point[2]+d*r[2]];this._updateSpherePosition(o$.XMIN,t)}else if(a.isXMax){let e=this.sphereStates[o$.XMAX],t=[e.point[0]+d*r[0],e.point[1]+d*r[1],e.point[2]+d*r[2]];this._updateSpherePosition(o$.XMAX,t)}if(a.isYMin){let e=this.sphereStates[o$.YMIN],t=[e.point[0]+c*o[0],e.point[1]+c*o[1],e.point[2]+c*o[2]];this._updateSpherePosition(o$.YMIN,t)}else if(a.isYMax){let e=this.sphereStates[o$.YMAX],t=[e.point[0]+c*o[0],e.point[1]+c*o[1],e.point[2]+c*o[2]];this._updateSpherePosition(o$.YMAX,t)}if(a.isZMin){let e=this.sphereStates[o$.ZMIN],t=[e.point[0]+h*s[0],e.point[1]+h*s[1],e.point[2]+h*s[2]];this._updateSpherePosition(o$.ZMIN,t)}else if(a.isZMax){let e=this.sphereStates[o$.ZMAX],t=[e.point[0]+h*s[0],e.point[1]+h*s[1],e.point[2]+h*s[2]];this._updateSpherePosition(o$.ZMAX,t)}this._updateCornerSpheres(),this._updateFaceSpheresFromCorners()}else{let e=this._getDirectionVectorForAxis(t.axis),n=[i[0]-t.point[0],i[1]-t.point[1],i[2]-t.point[2]],a=n[0]*e[0]+n[1]*e[1]+n[2]*e[2],r=null!==this.faceDragOffset?a+this.faceDragOffset:a,o=[t.point[0]+r*e[0],t.point[1]+r*e[1],t.point[2]+r*e[2]];this._updateSpherePosition(this.draggingSphereIndex,o),this._updateCornerSpheresFromFaces(),this._updateFaceSpheresFromCorners(),this._updateCornerSpheres()}return this._updateClippingPlanesFromFaceSpheres(n),n.render(),this._notifyClippingPlanesChanged(),!0},this._onControlToolChange=e=>{let t=this._getViewport();if(e.detail.seriesInstanceUID===this.seriesInstanceUID)if(e.detail.clippingPlanes&&e.detail.clippingPlanes.length>=6){this.originalClippingPlanes=oY(e.detail.clippingPlanes),this._updateFaceSpheresFromClippingPlanes(),this._updateCornerSpheresFromFaces(),this._updateFaceSpheresFromCorners(),this._updateCornerSpheres();let n=this._getVolumeMapper(t);n&&this._applyClippingPlanesToMapper(n),t.render(),this._notifyClippingPlanesChanged(t)}else this._notifyClippingPlanesChanged(t)},this._getViewportsInfo=()=>{let e=(0,tT.getToolGroup)(this.toolGroupId);return e?.viewportsInfo||[]},this._initialize3DViewports=e=>{if(!e?.length||!e[0])return void console.warn("VolumeCroppingTool: No viewportsInfo available for initialization of volumecroppingtool.");let t=this._getViewport();if(!t)return;let n=this._getVolumeActor(t);if(!n)return void console.warn("VolumeCroppingTool: No volume actors found in the viewport.");let i=n.getMapper().getInputData();if(!i)return void console.warn("VolumeCroppingTool: No image data found for volume actor.");this.seriesInstanceUID=i.seriesInstanceUID||"unknown",this.volumeDirectionVectors=function(e){let t=e.getDirection();return{xDir:e7.S8([0,0,0],t.slice(0,3)),yDir:e7.S8([0,0,0],t.slice(3,6)),zDir:e7.S8([0,0,0],t.slice(6,9))}}(i);let{xDir:a,yDir:r,zDir:o}=this.volumeDirectionVectors,s=i.getDimensions(),l=this.configuration.initialCropFactor||.1,d=l*s[0],c=(1-l)*s[0],h=l*s[1],u=(1-l)*s[1],g=l*s[2],p=(1-l)*s[2],m=(d+c)/2,f=(h+u)/2,v=(g+p)/2,I=i.indexToWorld([d,f,v]),_=i.indexToWorld([c,f,v]),w=i.indexToWorld([m,h,v]),b=i.indexToWorld([m,u,v]),C=i.indexToWorld([m,f,g]),A=i.indexToWorld([m,f,p]),E=oX.Ay.newInstance({origin:I,normal:a}),y=oX.Ay.newInstance({origin:_,normal:[-a[0],-a[1],-a[2]]}),T=oX.Ay.newInstance({origin:w,normal:r}),D=oX.Ay.newInstance({origin:b,normal:[-r[0],-r[1],-r[2]]}),P=oX.Ay.newInstance({origin:C,normal:o}),k=oX.Ay.newInstance({origin:A,normal:[-o[0],-o[1],-o[2]]}),x=[E,y,T,D,P,k].map(e=>({origin:[...e.getOrigin()],normal:[...e.getNormal()]}));this.originalClippingPlanes=x;let L=i.indexToWorld([0,0,0]),V=i.indexToWorld([s[0],s[1],s[2]]),O=function(e,t){let n=t.sphereRadiusScale||.01;return Math.max(t.minSphereRadius||2,Math.min(t.maxSphereRadius||50,e*n))}(e7.Io(L,V),this.configuration);this._addSphere(t,I,"x","min",null,O),this._addSphere(t,_,"x","max",null,O),this._addSphere(t,w,"y","min",null,O),this._addSphere(t,b,"y","max",null,O),this._addSphere(t,C,"z","min",null,O),this._addSphere(t,A,"z","max",null,O);let R=[i.indexToWorld([d,h,g]),i.indexToWorld([d,h,p]),i.indexToWorld([d,u,g]),i.indexToWorld([d,u,p]),i.indexToWorld([c,h,g]),i.indexToWorld([c,h,p]),i.indexToWorld([c,u,g]),i.indexToWorld([c,u,p])],N=["XMIN_YMIN_ZMIN","XMIN_YMIN_ZMAX","XMIN_YMAX_ZMIN","XMIN_YMAX_ZMAX","XMAX_YMIN_ZMIN","XMAX_YMIN_ZMAX","XMAX_YMAX_ZMIN","XMAX_YMAX_ZMAX"];for(let e=0;e{let i=this.sphereStates.find(t=>t.uid===`corner_${e}`),a=this.sphereStates.find(e=>e.uid===`corner_${n}`);if(i&&a){let r=`edge_${e}_${n}`,{actor:o,source:s}=function(e,t,n,i=[.7,.7,.7],a="",r=!0){if(t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2])return{actor:null,source:null};let o=ij.Ay.newInstance();o.setNumberOfPoints(2),o.setPoint(0,t[0],t[1],t[2]),o.setPoint(1,n[0],n[1],n[2]);let s=iY.Ay.newInstance({values:[2,0,1]}),l=iJ.Ay.newInstance();l.setPoints(o),l.setLines(s);let d=aR.Ay.newInstance();d.setInputData(l);let c=aN.Ay.newInstance();return c.setMapper(d),c.getProperty().setColor(...i),c.getProperty().setLineWidth(.5),c.getProperty().setOpacity(1),c.getProperty().setInterpolationToFlat(),c.getProperty().setAmbient(1),c.getProperty().setDiffuse(0),c.getProperty().setSpecular(0),c.setVisibility(r),e.addActor({actor:c,uid:a}),{actor:c,source:l}}(t,i.point,a.point,[.7,.7,.7],r,this.configuration.showHandles);this.edgeLines[r]={actor:o,source:s,key1:e,key2:n}}});let U=n.getMapper();U.addClippingPlane(E),U.addClippingPlane(y),U.addClippingPlane(T),U.addClippingPlane(D),U.addClippingPlane(P),U.addClippingPlane(k),M.tX.addEventListener(S.sV.VOLUMECROPPINGCONTROL_TOOL_CHANGED,e=>{this._onControlToolChange(e)}),t.render()},this._getViewportAndWorldCoords=e=>{let t=this._getViewport(),n=e.detail.currentPoints.canvas[0],i=e.detail.currentPoints.canvas[1],a=t.canvasToWorld([n,i]);return{viewport:t,world:a}},this._getViewport=()=>{let e=this._getViewportsInfo();if(!e||0===e.length)return null;let[t]=e,n=(0,M.lD)(t.renderingEngineId);return n?.getViewport(t.viewportId)||null},this._onNewVolume=()=>{let e=this._getViewportsInfo();this.originalClippingPlanes=[],this.sphereStates=[],this.edgeLines={},this._initialize3DViewports(e)},this._rotateClippingPlanes=e=>{let{element:t,currentPoints:n,lastPoints:i}=e.detail,a=n.canvas,r=i.canvas,o=this.configuration.rotateClippingPlanesIncrementDegrees??this.configuration.rotateIncrementDegrees??5,{viewport:s}=(0,M.kJ)(t),l=(0,i$.A)(s),d=t.clientWidth,c=t.clientHeight,h=[a[0]/d,a[1]/c],u=[r[0]/d,r[1]/c],g=(1+Math.abs(.5))**2,p=[u[0],0,0],m=[h[0],0,0],f=p[0]**2,v=m[0]**2,I=f>g?0:Math.sqrt(g-f),_=v>g?0:Math.sqrt(g-v),w=[p[0],0,I];oR.Ay.normalize(w);let b=[m[0],0,_];oR.Ay.normalize(b);let C=oR.Ay.dot(w,b);if(Math.abs(C)>1e-4){let e,t=20*Math.acos(oR.Ay.clampValue(C,-1,1))*Math.sign(h[0]-u[0])*o,n=l.viewUp,i=l.viewPlaneNormal,a=[0,0,0],r=[0,0,0];oR.Ay.cross(n,i,a),oR.Ay.normalize(a),oR.Ay.cross(i,a,r),oR.Ay.normalize(r);let d=20*(h[1]-u[1])*o;if(this.sphereStates.length>=6){let t=[this.sphereStates[o$.XMIN],this.sphereStates[o$.XMAX],this.sphereStates[o$.YMIN],this.sphereStates[o$.YMAX],this.sphereStates[o$.ZMIN],this.sphereStates[o$.ZMAX]];e=[(t[0].point[0]+t[1].point[0]+t[2].point[0]+t[3].point[0]+t[4].point[0]+t[5].point[0])/6,(t[0].point[1]+t[1].point[1]+t[2].point[1]+t[3].point[1]+t[4].point[1]+t[5].point[1])/6,(t[0].point[2]+t[1].point[2]+t[2].point[2]+t[3].point[2]+t[4].point[2]+t[5].point[2])/6]}else e=[0,0,0];let c=r$.identity(new Float32Array(16));r$.translate(c,c,e),r$.rotate(c,c,t*Math.PI/180,r),r$.translate(c,c,[-e[0],-e[1],-e[2]]);let g=r$.identity(new Float32Array(16));r$.translate(g,g,e),r$.rotate(g,g,d*Math.PI/180,a),r$.translate(g,g,[-e[0],-e[1],-e[2]]);let p=r$.create();r$.multiply(p,g,c);let m=r$.identity(new Float32Array(16));r$.rotate(m,m,t*Math.PI/180,r);let f=oB.create();oB.fromMat4(f,m);let v=r$.identity(new Float32Array(16));r$.rotate(v,v,d*Math.PI/180,a);let I=oB.create();oB.fromMat4(I,v);let _=oB.create();oB.multiply(_,I,f);for(let e=0;e=6&&(this.sphereStates[o$.XMIN].point=[...this.originalClippingPlanes[oz.XMIN].origin],this.sphereStates[o$.XMAX].point=[...this.originalClippingPlanes[oz.XMAX].origin],this.sphereStates[o$.YMIN].point=[...this.originalClippingPlanes[oz.YMIN].origin],this.sphereStates[o$.YMAX].point=[...this.originalClippingPlanes[oz.YMAX].origin],this.sphereStates[o$.ZMIN].point=[...this.originalClippingPlanes[oz.ZMIN].origin],this.sphereStates[o$.ZMAX].point=[...this.originalClippingPlanes[oz.ZMAX].origin],[o$.XMIN,o$.XMAX,o$.YMIN,o$.YMAX,o$.ZMIN,o$.ZMAX].forEach(e=>{let t=this.sphereStates[e];t.sphereSource.setCenter(...t.point),t.sphereSource.modified()}),[o$.XMIN_YMIN_ZMIN,o$.XMIN_YMIN_ZMAX,o$.XMIN_YMAX_ZMIN,o$.XMIN_YMAX_ZMAX,o$.XMAX_YMIN_ZMIN,o$.XMAX_YMIN_ZMAX,o$.XMAX_YMAX_ZMIN,o$.XMAX_YMAX_ZMAX].forEach(e=>{let t=this.sphereStates[e];if(t){let e=e7.fA(t.point[0],t.point[1],t.point[2]);e7.Z0(e,e,p),t.point=[e[0],e[1],e[2]],t.sphereSource.setCenter(...t.point),t.sphereSource.modified()}}),Object.values(this.edgeLines).forEach(({source:e,key1:t,key2:n})=>{let i=this.sphereStates.find(e=>e.uid===`corner_${t}`),a=this.sphereStates.find(e=>e.uid===`corner_${n}`);if(i&&a){let t=e.getPoints();t.setPoint(0,i.point[0],i.point[1],i.point[2]),t.setPoint(1,a.point[0],a.point[1],a.point[2]),t.modified(),e.modified()}})),this._updateClippingPlanes(s),s.render(),(0,M.Hl)(M.tX,S.sV.VOLUMECROPPING_TOOL_CHANGED,{originalClippingPlanes:this.originalClippingPlanes,viewportId:s.id,renderingEngineId:s.renderingEngineId,seriesInstanceUID:this.seriesInstanceUID})}},this._rotateCamera=(e,t,n,i)=>{let a=e.getVtkActiveCamera(),r=a.getViewUp(),o=a.getFocalPoint(),s=a.getPosition(),l=[0,0,0],d=[0,0,0],c=[0,0,0],h=r$.identity(new Float32Array(16));r$.translate(h,h,t),r$.rotate(h,h,i,n),r$.translate(h,h,[-t[0],-t[1],-t[2]]),e7.Z0(l,s,h),e7.Z0(d,o,h),r$.identity(h),r$.rotate(h,h,i,n),e7.Z0(c,r,h),oN(e,{position:l,viewUp:c,focalPoint:d})},this.touchDragCallback=this._dragCallback.bind(this),this.mouseDragCallback=this._dragCallback.bind(this)}onSetToolActive(){let e=this._getViewportsInfo(),t=()=>{e.forEach(({viewportId:e,renderingEngineId:t})=>{if(!this._resizeObservers.has(e)){let{viewport:n}=(0,M.b1)(e,t)||{viewport:null};if(!n)return;let{element:i}=n,a=new ResizeObserver(()=>{let n=(0,M.b1)(e,t);if(!n)return;let{viewport:i}=n,a=aX(i);oU(i),az(i,a),i.render()});a.observe(i),this._resizeObservers.set(e,a)}})};t(),this._viewportAddedListener=e=>{e.detail.toolGroupId===this.toolGroupId&&t()},M.tX.addEventListener(S.sV.TOOLGROUP_VIEWPORT_ADDED,this._viewportAddedListener),this._unsubscribeToViewportNewVolumeSet(e),this._subscribeToViewportNewVolumeSet(e),this.sphereStates&&0===this.sphereStates.length&&(this.originalClippingPlanes=[],this._initialize3DViewports(e)),this.configuration.showClippingPlanes=!1,this.configuration.showHandles=!1;let n=this._getViewport();n&&this.originalClippingPlanes&&this.originalClippingPlanes.length>0&&(this._updateClippingPlanes(n),this.sphereStates&&this.sphereStates.length>0&&this._updateHandlesVisibility(),n.render())}onSetToolDisabled(){this._resizeObservers.forEach((e,t)=>{e.disconnect(),this._resizeObservers.delete(t)}),this._viewportAddedListener&&(M.tX.removeEventListener(S.sV.TOOLGROUP_VIEWPORT_ADDED,this._viewportAddedListener),this._viewportAddedListener=null);let e=this._getViewportsInfo();this._unsubscribeToViewportNewVolumeSet(e)}setHandlesVisible(e){this.configuration.showHandles=e,e&&(this._updateFaceSpheresFromClippingPlanes(),this._updateCornerSpheres()),this._updateHandlesVisibility();let[t]=this._getViewportsInfo();(0,M.lD)(t.renderingEngineId).getViewport(t.viewportId).render()}getHandlesVisible(){return this.configuration.showHandles}setHandleRadius(e){this.configuration.sphereRadius=e,this.sphereStates.forEach(t=>{t?.sphereSource?.setRadius&&(t.sphereSource.setRadius(e),t.sphereSource.modified())});let[t]=this._getViewportsInfo();if(!t)return;let n=(0,M.lD)(t.renderingEngineId),i=n?.getViewport(t.viewportId);i?.render()}getClippingPlanesVisible(){return this.configuration.showClippingPlanes}setClippingPlanesVisible(e){this.configuration.showClippingPlanes=e;let t=this._getViewport();this._updateClippingPlanes(t),this.sphereStates&&this.sphereStates.length>0&&(this.configuration.showHandles=e,this._updateHandlesVisibility()),e&&t&&this.originalClippingPlanes?.length>=6&&this._notifyClippingPlanesChanged(t),t.render()}getRotatePlanesOnDrag(){return this.rotatePlanesOnDrag}setRotatePlanesOnDrag(e){this.rotatePlanesOnDrag=e;let t=this._getViewport();t&&t.render()}_dragCallback(e){let{element:t,currentPoints:n,lastPoints:i}=e.detail;if(null!==this.draggingSphereIndex)this._onMouseMoveSphere(e);else{let a=e.detail.event?.shiftKey??!1;if((!0===this.rotatePlanesOnDrag||a)&&!this.suppressPlaneRotationForCurrentDrag)return void this._rotateClippingPlanes(e);let r=n.canvas,o=i.canvas,{rotateIncrementDegrees:s}=this.configuration,{viewport:l}=(0,M.kJ)(t),d=(0,i$.A)(l),c=t.clientWidth,h=t.clientHeight,u=[r[0]/c,r[1]/h],g=[o[0]/c,o[1]/h],p=l.canvasToWorld([.5*c,.5*h]),m=(1+Math.abs(.5))**2,f=[g[0],0,0],v=[u[0],0,0],I=f[0]**2,_=v[0]**2,w=I>m?0:Math.sqrt(m-I),b=_>m?0:Math.sqrt(m-_),C=[f[0],0,w];oR.Ay.normalize(C);let A=[v[0],0,b];oR.Ay.normalize(A);let E=oR.Ay.dot(C,A);if(Math.abs(E)>1e-4){let e=-2*Math.acos(oR.Ay.clampValue(E,-1,1))*Math.sign(u[0]-g[0])*s,t=d.viewUp,n=d.viewPlaneNormal,i=[0,0,0],a=[0,0,0];oR.Ay.cross(t,n,i),oR.Ay.normalize(i),oR.Ay.cross(n,i,a),oR.Ay.normalize(a),oR.Ay.normalize(t),this._rotateCamera(l,p,a,e);let r=(g[1]-u[1])*s;this._rotateCamera(l,p,i,r)}l.render()}}_updateClippingPlanes(e){let t=this._getVolumeActor(e),n=this._getVolumeMapper(e);if(!t||!n)return;let i=t.getMatrix();if(!this.configuration.showClippingPlanes)return void n.removeAllClippingPlanes();let a=oB.create();oB.fromMat4(a,i);let r=oB.create();oB.invert(r,a),oB.transpose(r,r);let o=this.originalClippingPlanes;if(!o||!o.length)return;n.removeAllClippingPlanes();let s=[],l=[];for(let e=0;e{e.sphereActor&&e.sphereActor.setVisibility(this.configuration.showHandles)}),Object.values(this.edgeLines).forEach(({actor:e})=>{e&&e.setVisibility(this.configuration.showHandles)})}_addSphere(e,t,n,i,a=null,r){let o=a?`corner_${a}`:`${n}_${i}`;if(this.sphereStates.find(e=>e.uid===o))return;let s=oW.newInstance();s.setCenter(t),s.setRadius(r);let l=aR.Ay.newInstance();l.setInputConnection(s.getOutputPort());let d=aN.Ay.newInstance();d.setMapper(l);let c=[0,1,0],h=this.configuration.sphereColors||{};a?c=h.CORNERS||[0,0,1]:"z"===n?c=h.AXIAL||[1,0,0]:"x"===n?c=h.SAGITTAL||[1,1,0]:"y"===n&&(c=h.CORONAL||[0,1,0]);let u=this.sphereStates.findIndex(e=>e.uid===o),g=[t[0],t[1],t[2]];-1===u?this.sphereStates.push({point:g,axis:n,uid:o,sphereSource:s,sphereActor:d,isCorner:!!a,color:c}):(this.sphereStates[u].point=g,this.sphereStates[u].sphereSource=s),d.getProperty().setColor(c),d.setVisibility(this.configuration.showHandles),e.addActor({actor:d,uid:o})}_getDirectionVectorForAxis(e){if(this.originalClippingPlanes&&this.originalClippingPlanes.length>=6)switch(e){case"x":return this.originalClippingPlanes[oz.XMIN].normal;case"y":return this.originalClippingPlanes[oz.YMIN].normal;case"z":return this.originalClippingPlanes[oz.ZMIN].normal;default:return[1,0,0]}if(!this.volumeDirectionVectors)return"x"===e?[1,0,0]:"y"===e?[0,1,0]:"z"===e?[0,0,1]:[1,0,0];switch(e){case"x":return this.volumeDirectionVectors.xDir;case"y":return this.volumeDirectionVectors.yDir;case"z":return this.volumeDirectionVectors.zDir;default:return[1,0,0]}}_getVolumeActor(e){let t=e||this._getViewport();return t?.getActors?.()?.find(e=>e.actor?.getClassName?.()==="vtkVolume")?.actor}_getVolumeMapper(e){let t=this._getVolumeActor(e);return t?.getMapper()}_applyClippingPlanesToMapper(e){e.removeAllClippingPlanes();for(let t=0;t<6;++t){let n=oX.Ay.newInstance({origin:this.originalClippingPlanes[t].origin,normal:this.originalClippingPlanes[t].normal});e.addClippingPlane(n)}}_updateClippingPlanesFromFaceSpheres(e){let t=this._getVolumeMapper(e);t&&(this.originalClippingPlanes[oz.XMIN].origin=[...this.sphereStates[o$.XMIN].point],this.originalClippingPlanes[oz.XMAX].origin=[...this.sphereStates[o$.XMAX].point],this.originalClippingPlanes[oz.YMIN].origin=[...this.sphereStates[o$.YMIN].point],this.originalClippingPlanes[oz.YMAX].origin=[...this.sphereStates[o$.YMAX].point],this.originalClippingPlanes[oz.ZMIN].origin=[...this.sphereStates[o$.ZMIN].point],this.originalClippingPlanes[oz.ZMAX].origin=[...this.sphereStates[o$.ZMAX].point],this._applyClippingPlanesToMapper(t))}_updateCornerSpheresFromFaces(){let{xDir:e,yDir:t,zDir:n}=this._getDirectionVectors();if(!e||!t||!n)return;let i=this.sphereStates[o$.XMIN].point,a=this.sphereStates[o$.XMAX].point,r=this.sphereStates[o$.YMIN].point,o=this.sphereStates[o$.YMAX].point,s=this.sphereStates[o$.ZMIN].point,l=this.sphereStates[o$.ZMAX].point;for(let d of[{key:"XMIN_YMIN_ZMIN",pos:this._calculateCornerFromFaces(i,r,s,e,t,n)},{key:"XMIN_YMIN_ZMAX",pos:this._calculateCornerFromFaces(i,r,l,e,t,n)},{key:"XMIN_YMAX_ZMIN",pos:this._calculateCornerFromFaces(i,o,s,e,t,n)},{key:"XMIN_YMAX_ZMAX",pos:this._calculateCornerFromFaces(i,o,l,e,t,n)},{key:"XMAX_YMIN_ZMIN",pos:this._calculateCornerFromFaces(a,r,s,e,t,n)},{key:"XMAX_YMIN_ZMAX",pos:this._calculateCornerFromFaces(a,r,l,e,t,n)},{key:"XMAX_YMAX_ZMIN",pos:this._calculateCornerFromFaces(a,o,s,e,t,n)},{key:"XMAX_YMAX_ZMAX",pos:this._calculateCornerFromFaces(a,o,l,e,t,n)}]){let e=this.sphereStates.findIndex(e=>e.uid===`corner_${d.key}`);-1!==e&&this._updateSpherePosition(e,d.pos)}}_updateFaceSpheresFromCorners(){if(!this.volumeDirectionVectors)return;let e=[this.sphereStates[o$.XMIN_YMIN_ZMIN].point,this.sphereStates[o$.XMIN_YMIN_ZMAX].point,this.sphereStates[o$.XMIN_YMAX_ZMIN].point,this.sphereStates[o$.XMIN_YMAX_ZMAX].point,this.sphereStates[o$.XMAX_YMIN_ZMIN].point,this.sphereStates[o$.XMAX_YMIN_ZMAX].point,this.sphereStates[o$.XMAX_YMAX_ZMIN].point,this.sphereStates[o$.XMAX_YMAX_ZMAX].point],t=this._averagePoints([e[0],e[1],e[2],e[3]]),n=this._averagePoints([e[4],e[5],e[6],e[7]]),i=this._averagePoints([e[0],e[1],e[4],e[5]]),a=this._averagePoints([e[2],e[3],e[6],e[7]]),r=this._averagePoints([e[0],e[2],e[4],e[6]]),o=this._averagePoints([e[1],e[3],e[5],e[7]]);this._updateSpherePosition(o$.XMIN,t),this._updateSpherePosition(o$.XMAX,n),this._updateSpherePosition(o$.YMIN,i),this._updateSpherePosition(o$.YMAX,a),this._updateSpherePosition(o$.ZMIN,r),this._updateSpherePosition(o$.ZMAX,o)}_updateCornerSpheres(){let{xDir:e,yDir:t,zDir:n}=this._getDirectionVectors();if(!e||!t||!n)return;let i=this.sphereStates[o$.XMIN].point,a=this.sphereStates[o$.XMAX].point,r=this.sphereStates[o$.YMIN].point,o=this.sphereStates[o$.YMAX].point,s=this.sphereStates[o$.ZMIN].point,l=this.sphereStates[o$.ZMAX].point;for(let d of[{key:"XMIN_YMIN_ZMIN",pos:this._calculateCornerFromProjection(i,r,s,e,t,n)},{key:"XMIN_YMIN_ZMAX",pos:this._calculateCornerFromProjection(i,r,l,e,t,n)},{key:"XMIN_YMAX_ZMIN",pos:this._calculateCornerFromProjection(i,o,s,e,t,n)},{key:"XMIN_YMAX_ZMAX",pos:this._calculateCornerFromProjection(i,o,l,e,t,n)},{key:"XMAX_YMIN_ZMIN",pos:this._calculateCornerFromProjection(a,r,s,e,t,n)},{key:"XMAX_YMIN_ZMAX",pos:this._calculateCornerFromProjection(a,r,l,e,t,n)},{key:"XMAX_YMAX_ZMIN",pos:this._calculateCornerFromProjection(a,o,s,e,t,n)},{key:"XMAX_YMAX_ZMAX",pos:this._calculateCornerFromProjection(a,o,l,e,t,n)}]){let e=this.sphereStates.findIndex(e=>e.uid===`corner_${d.key}`);-1!==e&&this._updateSpherePosition(e,d.pos)}this._updateEdgeLines()}_unsubscribeToViewportNewVolumeSet(e){e.forEach(({viewportId:e,renderingEngineId:t})=>{let{viewport:n}=(0,M.b1)(e,t),{element:i}=n;i.removeEventListener(M.fX.sV.VOLUME_VIEWPORT_NEW_VOLUME,this._onNewVolume)})}_subscribeToViewportNewVolumeSet(e){e.forEach(({viewportId:e,renderingEngineId:t})=>{let{viewport:n}=(0,M.b1)(e,t),{element:i}=n;i.addEventListener(M.fX.sV.VOLUME_VIEWPORT_NEW_VOLUME,this._onNewVolume)})}_getDirectionVectors(){let e=this.originalClippingPlanes?.length>=6;return{xDir:e?this.originalClippingPlanes[oz.XMIN].normal:this.volumeDirectionVectors?.xDir||[1,0,0],yDir:e?this.originalClippingPlanes[oz.YMIN].normal:this.volumeDirectionVectors?.yDir||[0,1,0],zDir:e?this.originalClippingPlanes[oz.ZMIN].normal:this.volumeDirectionVectors?.zDir||[0,0,1]}}_updateSpherePosition(e,t){let n=this.sphereStates[e];n&&(n.point=t,n.sphereSource.setCenter(...t),n.sphereSource.modified())}_updateFaceSpheresFromClippingPlanes(){[{sphereIdx:o$.XMIN,planeIdx:oz.XMIN},{sphereIdx:o$.XMAX,planeIdx:oz.XMAX},{sphereIdx:o$.YMIN,planeIdx:oz.YMIN},{sphereIdx:o$.YMAX,planeIdx:oz.YMAX},{sphereIdx:o$.ZMIN,planeIdx:oz.ZMIN},{sphereIdx:o$.ZMAX,planeIdx:oz.ZMAX}].forEach(({sphereIdx:e,planeIdx:t})=>{let n=[...this.originalClippingPlanes[t].origin];this._updateSpherePosition(e,n)})}_averagePoints(e){let t=e.reduce((e,t)=>[e[0]+t[0],e[1]+t[1],e[2]+t[2]],[0,0,0]);return[t[0]/e.length,t[1]/e.length,t[2]/e.length]}_notifyClippingPlanesChanged(e){let t={originalClippingPlanes:this.originalClippingPlanes,seriesInstanceUID:this.seriesInstanceUID};e&&(t.viewportId=e.id,t.renderingEngineId=e.renderingEngineId),(0,M.Hl)(M.tX,S.sV.VOLUMECROPPING_TOOL_CHANGED,t)}_calculateCornerFromFaces(e,t,n,i,a,r){let o=[t[0]-e[0],t[1]-e[1],t[2]-e[2]],s=o[0]*a[0]+o[1]*a[1]+o[2]*a[2],l=[n[0]-e[0],n[1]-e[1],n[2]-e[2]],d=l[0]*r[0]+l[1]*r[1]+l[2]*r[2];return[e[0]+s*a[0]+d*r[0],e[1]+s*a[1]+d*r[1],e[2]+s*a[2]+d*r[2]]}_calculateCornerFromProjection(e,t,n,i,a,r){let o=e[0]*i[0]+e[1]*i[1]+e[2]*i[2],s=t[0]*a[0]+t[1]*a[1]+t[2]*a[2],l=n[0]*r[0]+n[1]*r[1]+n[2]*r[2];return[o*i[0]+s*a[0]+l*r[0],o*i[1]+s*a[1]+l*r[1],o*i[2]+s*a[2]+l*r[2]]}_updateEdgeLines(){Object.values(this.edgeLines).forEach(({source:e,key1:t,key2:n})=>{let i=this.sphereStates.find(e=>e.uid===`corner_${t}`),a=this.sphereStates.find(e=>e.uid===`corner_${n}`);if(i&&a){let t=e.getPoints();t.setPoint(0,i.point[0],i.point[1],i.point[2]),t.setPoint(1,a.point[0],a.point[1],a.point[2]),t.modified(),e.modified()}})}}oq.toolName="VolumeCropping";var oK=n(4101),oZ=n(10458);let o0={DRAG:1};class o1 extends oL.EC{constructor(e={},t={supportedInteractionTypes:["Mouse"],configuration:{viewportIndicators:!1,viewportIndicatorsConfig:{radius:5,x:null,y:null},extendReferenceLines:!0,initialCropFactor:.2,mobile:{enabled:!1,opacity:.8},lineColors:{AXIAL:[1,0,0],CORONAL:[0,1,0],SAGITTAL:[1,1,0],UNKNOWN:[0,0,1]},lineWidth:1.5,lineWidthActive:2.5}}){super(e,t),this.clippingPlanes=[],this.initializeViewport=({renderingEngineId:e,viewportId:t})=>{if(!e||!t)return void console.warn("VolumeCroppingControlTool: Missing renderingEngineId or viewportId");let n=(0,M.b1)(t,e);if(!n)return;let{viewport:i}=n,a=i.getActors();if(a&&a.length>0){let e=a[0].actor.getMapper().getInputData();e&&(this.seriesInstanceUID=e.seriesInstanceUID||"unknown")}let{element:r}=i,{position:o,focalPoint:s}=(0,i$.A)(i),l=this._getAnnotations(n);l=this.filterInteractableAnnotationsForElement(r,l),l?.length&&(0,y.removeAnnotation)(l[0].annotationUID);let d=oj((0,i$.A)(i).viewPlaneNormal),c={highlighted:!1,metadata:{cameraPosition:[...o],cameraFocalPoint:[...s],toolName:this.getToolName()},data:{handles:{activeOperation:null,clippingPlanes:this.clippingPlanes.length>0?oY(this.clippingPlanes):[]},activeViewportIds:[],viewportId:t,referenceLines:[],orientation:d}};(0,y.addAnnotation)(c,r)},this._getViewportsInfo=()=>(0,tT.getToolGroup)(this.toolGroupId).viewportsInfo,this.resetCroppingSpheres=()=>{let e=this._getViewportsInfo();for(let t of e){let{viewportId:e,renderingEngineId:n}=t,i=(0,M.b1)(e,n),a=i.viewport;oU(a,{resetPan:!0,resetZoom:!0,resetToCenter:!0,resetRotation:!0,suppressEvents:!0}),a.resetSlabThickness();let{element:r}=a,o=this._getAnnotations(i);(o=this.filterInteractableAnnotationsForElement(r,o)).length&&(0,y.removeAnnotation)(o[0].annotationUID),a.render()}this._initializeViewports(e)},this._initializeViewports=e=>{if(!e?.length||!e[0])return void console.warn("VolumeCroppingControlTool: No valid viewportsInfo for initialization.");e.forEach(e=>{this.initializeViewport(e)}),(0,tr.A)(e.map(({viewportId:e})=>e))},this.cancel=()=>{},this.isPointNearTool=(e,t,n,i)=>!!this._pointNearTool(e,t,n,6),this.toolSelectedCallback=(e,t,n)=>{let{element:i}=e.detail;t.highlighted=!0,this._activateModify(i),(0,oK.lY)(i),e.preventDefault()},this.onResetCamera=e=>{this.resetCroppingSpheres()},this.mouseMoveCallback=(e,t)=>{if(!t)return;let{element:n,currentPoints:i}=e.detail,a=i.canvas,r=!1;for(let e=0;e{if(!t||!t.length)return[];let n=(0,M.kJ)(e),i=null;if(n.viewport){let{viewPlaneNormal:e}=(0,i$.A)(n.viewport);e&&(i=oj(e))}return t.filter(e=>!!e.data.orientation&&!!i&&e.data.orientation===i)},this.renderAnnotation=(e,t)=>{let n=this._getViewportsInfo();if(!n||0===n.length)return!1;let i=!1,{viewport:a,renderingEngine:r}=e,{element:o}=a,s=this._getAnnotations(e),l=(0,i$.A)(a),d=this.filterInteractableAnnotationsForElement(o,s)[0];if(!d||!d.data)return i;let c=d.annotationUID,{clientWidth:h,clientHeight:u}=a.canvas,g=Math.sqrt(h*h+u*u),p=d.data,m=d.data.handles.clippingPlanes;if(!m||m.length<6)if(!this.clippingPlanes||!(this.clippingPlanes.length>=6))return!1;else m=this.clippingPlanes,p.handles.clippingPlanes=oY(this.clippingPlanes);let{viewPlaneNormal:f,focalPoint:v}=l,I=[],_=["min","max","min","max","min","max"];for(let e=0;e<6;e++){let t=function(e,t,n){let i=e.normal,a=e.origin,r=e7.vt();e7.$A(r,i,t);let o=e7.m3(r);if(o<1e-10)return null;let s=oR.Ay.dot(i,a),l=oR.Ay.dot(t,n),d=e7.vt(),c=e7.vt();e7.$A(d,t,r),e7.hs(d,d,s),e7.$A(c,r,i),e7.hs(c,c,l);let h=e7.vt();if(e7.WQ(h,d,c),e7.hs(h,h,1/o),!Number.isFinite(h[0])||!Number.isFinite(h[1])||!Number.isFinite(h[2]))return null;let u=e7.vt();return e7.hs(u,r,1/Math.sqrt(o)),{direction:u,point:h}}(m[e],f,v);if(!t)continue;let n=function(e,t,n){let i=e7.Ln([0,0,0],e,t,-1e5),a=e7.Ln([0,0,0],e,t,1e5),r=n.worldToCanvas(i),o=n.worldToCanvas(a),{clientWidth:s,clientHeight:l}=n.canvas,d=[0,0,s,l],c=rK.o8(r),h=rK.o8(o),u=!isNaN(c[0])&&!isNaN(c[1]),g=!isNaN(h[0])&&!isNaN(h[1]);if(!u||!g||0===rR(c,h,d))return null;let p=!isNaN(c[0])&&!isNaN(c[1]),m=!isNaN(h[0])&&!isNaN(h[1]);if(!p||!m)return null;let[f,v,I,_]=d,w=c[0]>=f-1&&c[0]<=I+1&&c[1]>=v-1&&c[1]<=_+1,b=h[0]>=f-1&&h[0]<=I+1&&h[1]>=v-1&&h[1]<=_+1;if(!w||!b)return null;let C=h[0]-c[0],A=h[1]-c[1];return 1>Math.sqrt(C*C+A*A)?null:{start:c,end:h}}(t.point,t.direction,a);n&&I.push([{id:a.id,canvas:a.canvas},n.start,n.end,_[e],e])}p.referenceLines=I;let w=this._getReferenceLineColor(a.id),b=void 0!==w?w:"rgb(200, 200, 200)";if(I.forEach((e,n)=>{let[i,a,r,o,s]=e;if(void 0===s||s<0||s>=6)return;let l=[];for(let e=0;eMath.abs(l))return null;let d=(-r*(e[0]-n[0])+a*(e[1]-n[1]))/l,c=(o*(e[1]-n[1])-s*(e[0]-n[0]))/l;return d>=0&&d<=1&&c>=0&&c<=1?[e[0]+c*a,e[1]+c*r]:null}(a,r,t[1],t[2]);i&&l.push({with:t[3],point:i})}let d=function(e){return e===oz.XMIN||e===oz.XMAX?"SAGITTAL":e===oz.YMIN||e===oz.YMAX?"CORONAL":e===oz.ZMIN||e===oz.ZMAX?"AXIAL":null}(s),h=this.configuration.lineColors||{},u=d&&(h[d]||h.UNKNOWN)||[1,0,0],g=(0,M.J_)(u);this._getReferenceLineControllable(i.id);let m=p.activeViewportIds.find(e=>e===i.id),f=this.configuration.lineWidth??1.5;null!==p.handles.activeOperation&&p.handles.activeOperation===o0.DRAG&&m&&(f=this.configuration.activeLineWidth??2.5);let v=`plane_${s}`;if(2===l.length?(0,aK.V6)(t,c,v,l[0].point,l[1].point,{color:g,lineWidth:f}):(0,aK.V6)(t,c,v,a,r,{color:g,lineWidth:f}),this.configuration.extendReferenceLines&&2===l.length){let e=l.map(e=>({...e,distance:rK.Io(a,e.point)})).sort((e,t)=>e.distance-t.distance);(0,aK.V6)(t,c,v+"_dashed_before",a,e[0].point,{color:g,lineWidth:f,lineDash:[4,4]}),(0,aK.V6)(t,c,v+"_dashed_after",e[1].point,r,{color:g,lineWidth:f,lineDash:[4,4]})}}),i=!0,this.configuration.viewportIndicators){let{viewportIndicatorsConfig:e}=this.configuration,n=e?.xOffset||.95,i=e?.yOffset||.05,a=e?.circleRadius||.01*g;(0,aK.hp)(t,c,"0",[h*n,u*i],a,{color:b,fill:b})}return i},this._getAnnotations=e=>{let{viewport:t}=e,n=(0,y.getAnnotations)(this.getToolName(),t.element)||[],i=this._getViewportsInfo().map(({viewportId:e})=>e);return n.filter(e=>{let{data:t}=e;return i.includes(t.viewportId)})},this._onSphereMoved=e=>{if(e.detail.originalClippingPlanes)this._syncWithVolumeCroppingTool(e.detail.originalClippingPlanes);else{e.detail.seriesInstanceUID,this.seriesInstanceUID;return}},this._onNewVolume=()=>{let e=this._getViewportsInfo();if(e&&e.length>0){let{viewportId:t,renderingEngineId:n}=e[0],i=(0,M.lD)(n);if(!i)return;let a=i.getViewport(t);if(!a)return;let r=a.getActors();if(r.length>0){let e=r[0].actor.getMapper().getInputData();e&&(this.seriesInstanceUID=e.seriesInstanceUID)}}this._initializeViewports(e),(0,M.Hl)(M.tX,S.sV.VOLUMECROPPINGCONTROL_TOOL_CHANGED,{toolGroupId:this.toolGroupId,viewportsInfo:e,seriesInstanceUID:this.seriesInstanceUID})},this._activateModify=e=>{e6.wk.isInteractingWithTool=!this.configuration.mobile?.enabled,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._deactivateModify=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._endCallback=e=>{let{element:t}=e.detail;this.editData.annotation.data.handles.activeOperation=null,this.editData.annotation.data.activeViewportIds=[],this._deactivateModify(t),(0,oK.Q_)(t),this.editData=null;let n=(0,ta.Q0)(t,this.getToolName(),!1);(0,tr.A)(n)},this._dragCallback=e=>{let t=e.detail,n=t.deltaPoints.world;if(.001>Math.abs(n[0])&&.001>Math.abs(n[1])&&.001>Math.abs(n[2]))return;let{element:i}=t,a=(0,M.kJ)(i),{viewport:r}=a;if(r.type===M.fX.NV.VOLUME_3D)return;let o=this._getAnnotations(a),s=this.filterInteractableAnnotationsForElement(i,o)[0];if(!s)return;let{handles:l}=s.data,d=l.clippingPlanes;if(l.activeOperation===o0.DRAG&&d&&d.length>=6){if(void 0!==l.activePlaneIndex&&l.activePlaneIndex>=0&&l.activePlaneIndex<6){let e=d[l.activePlaneIndex],t=e.normal,i=oR.Ay.dot(n,t);e.origin[0]+=t[0]*i,e.origin[1]+=t[1]*i,e.origin[2]+=t[2]*i}else"min"===l.activeType?(d[0].origin[0]+=n[0],d[2].origin[1]+=n[1],d[4].origin[2]+=n[2]):"max"===l.activeType&&(d[1].origin[0]+=n[0],d[3].origin[1]+=n[1],d[5].origin[2]+=n[2]);this.clippingPlanes=oY(d);let e=this._getViewportsInfo();e.forEach(({viewportId:e,renderingEngineId:t})=>{let n=(0,M.b1)(e,t);n&&this._getAnnotations(n).forEach(e=>{e.data?.handles&&(e.data.handles.clippingPlanes=oY(this.clippingPlanes))})}),(0,tr.A)(e.map(({viewportId:e})=>e)),(0,M.Hl)(M.tX,S.sV.VOLUMECROPPINGCONTROL_TOOL_CHANGED,{toolGroupId:this.toolGroupId,clippingPlanes:this.clippingPlanes,handleType:l.activeType,seriesInstanceUID:this.seriesInstanceUID})}},this._getReferenceLineColor=e.configuration?.getReferenceLineColor||(()=>"rgb(0, 200, 0)"),this._getReferenceLineControllable=e.configuration?.getReferenceLineControllable||(()=>!0);let n=(0,tT.getToolGroup)(this.toolGroupId)?.viewportsInfo;if(M.tX.addEventListener(S.sV.VOLUMECROPPING_TOOL_CHANGED,this._onSphereMoved),n&&n.length>0){let{viewportId:e,renderingEngineId:t}=n[0],i=(0,M.lD)(t);if(!i)return;let a=i.getViewport(e);if(!a)return;let r=a.getActors();if(!r||!r.length)return void console.warn(`VolumeCroppingControlTool: No volume actors found in viewport ${e}.`);let o=r[0].actor.getMapper().getInputData();o&&(this.seriesInstanceUID=o.seriesInstanceUID||"unknown")}}onSetToolInactive(){}onSetToolActive(){let e=this._getViewportsInfo(),t=!1;for(let n of e){let e=(0,M.b1)(n.viewportId,n.renderingEngineId),i=this._getAnnotations(e);if(i&&i.length>0){t=!0;break}}if(t)for(let t of e){let e=(0,M.b1)(t.viewportId,t.renderingEngineId);if(!e)continue;let n=this._getAnnotations(e);n&&n.length>0&&n.forEach(e=>{(0,y.removeAnnotation)(e.annotationUID)}),e.viewport.render()}else this._unsubscribeToViewportNewVolumeSet(e),this._subscribeToViewportNewVolumeSet(e),this._initializeViewports(e),(0,M.Hl)(M.tX,S.sV.VOLUMECROPPINGCONTROL_TOOL_CHANGED,{toolGroupId:this.toolGroupId,viewportsInfo:e,seriesInstanceUID:this.seriesInstanceUID})}onSetToolEnabled(){M.tX.addEventListener(S.sV.VOLUMECROPPING_TOOL_CHANGED,this._onSphereMoved)}onSetToolDisabled(){let e=this._getViewportsInfo();this._unsubscribeToViewportNewVolumeSet(e),M.tX.removeEventListener(S.sV.VOLUMECROPPING_TOOL_CHANGED,this._onSphereMoved),e.forEach(({renderingEngineId:e,viewportId:t})=>{let n=(0,M.b1)(t,e);if(!n)return;let i=this._getAnnotations(n);i?.length&&i.forEach(e=>{(0,y.removeAnnotation)(e.annotationUID)})})}_syncWithVolumeCroppingTool(e){if(!e||e.length<6)return;this.clippingPlanes=oY(e);let t=this._getViewportsInfo();t.forEach(({viewportId:e,renderingEngineId:t})=>{let n=(0,M.b1)(e,t);n&&this._getAnnotations(n).forEach(e=>{e.data?.handles&&(e.data.handles.clippingPlanes=oY(this.clippingPlanes))})}),(0,tr.A)(t.map(({viewportId:e})=>e))}addNewAnnotation(e){let{element:t}=e.detail,n=(0,M.kJ)(t),{viewport:i}=n,a=this._getAnnotations(n),r=this.filterInteractableAnnotationsForElement(i.element,a);if(!r||0===r.length||!r[0])return null;let{data:o}=r[0],s=[],l=o.referenceLines||[];for(let e=0;e{let{viewport:n}=(0,M.b1)(e,t),{element:i}=n;i.removeEventListener(M.fX.sV.VOLUME_VIEWPORT_NEW_VOLUME,this._onNewVolume)})}_subscribeToViewportNewVolumeSet(e){e.forEach(({viewportId:e,renderingEngineId:t})=>{let{viewport:n}=(0,M.b1)(e,t),{element:i}=n;i.addEventListener(M.fX.sV.VOLUME_VIEWPORT_NEW_VOLUME,this._onNewVolume)})}_pointNearTool(e,t,n,i){let{data:a}=t,r=a.referenceLines,o=[];if(r)for(let e=0;e{let n,i,a=Math.floor(t[2]/2),r=t[0]*t[1];e instanceof Float32Array?(n=4,i=Float32Array):e instanceof Uint8Array?(n=1,i=Uint8Array):e instanceof Uint16Array?(n=2,i=Uint16Array):e instanceof Int16Array&&(n=2,i=Int16Array);let o=new i(e.buffer,a*r*n,r),{max:s,min:l}=this._getMinMax(o,r);return s-l}}touchDragCallback(e){this.mouseDragCallback(e)}mouseDragCallback(e){let t,n,i,a,r,o,{element:s,deltaPoints:l}=e.detail,{viewport:d}=(0,M.kJ)(s),c=!1,h=function(e){if("function"==typeof e.getProperties)return e.getProperties();let t=o3(e);if(!t)return;let n=t.viewport.getDisplaySetPresentation?.(t.dataId),i=t.viewport.getDefaultVOIRange?.(t.dataId);return{...n||{},voiRange:n?.voiRange??i}}(d);if(!h?.voiRange)throw Error("Viewport is not a valid type");if(d instanceof M.PX){if(t=d.getVolumeId(),o=M.BF.getViewportsWithVolumeId(t),{lower:n,upper:i}=h.voiRange,!M.PP.getVolume(t))throw Error("Volume not found "+t)}else if(h.voiRange)({lower:n,upper:i}=h.voiRange);else throw Error("Viewport is not a valid type");let u=M.BF.getScalingDescriptor(d,t);if(a=u?.modality,c=!!u?.isPreScaled,!((r="PT"===a&&c?this.getPTScaledNewRange({deltaPointsCanvas:l.canvas,lower:n,upper:i,clientHeight:s.clientHeight,isPreScaled:c,viewport:d,volumeId:t}):this.getNewRange({viewport:d,deltaPointsCanvas:l.canvas,volumeId:t,lower:n,upper:i,voiLutFunction:h.VOILUTFunction})).lower>=r.upper)&&(function(e,t){if("function"==typeof e.setProperties)return e.setProperties(t);let n=o3(e);n&&n.viewport.setDisplaySetPresentation?.(n.dataId,t)}(d,{voiRange:r}),d.render(),d instanceof M.PX))return void o.forEach(e=>{d!==e&&e.render()})}getPTScaledNewRange({deltaPointsCanvas:e,lower:t,upper:n,clientHeight:i,viewport:a,volumeId:r,isPreScaled:o}){let s=4;s=o?5/i:this._getMultiplierFromDynamicRange(a,r)||4;let l=e[1]*s;return n-=l,{lower:t,upper:n=o?Math.max(n,.1):n}}getNewRange({viewport:e,deltaPointsCanvas:t,volumeId:n,lower:i,upper:a,voiLutFunction:r}){let o=this._getMultiplierFromDynamicRange(e,n)||4,s=t[0]*o,l=t[1]*o,{windowWidth:d,windowCenter:c}=M.BF.windowLevel.toWindowLevel(i,a);return d+=s,c+=l,d=Math.max(d,1),M.BF.windowLevel.toLowHighRange(d,c,r)}_getMultiplierFromDynamicRange(e,t){let n;if(t){let i=M.PP.getVolume(t),{voxelManager:a}=e.getImageData(),r=a.getMiddleSliceData().reduce((e,t)=>[Math.min(e[0],t),Math.max(e[1],t)],[1/0,-1/0]),o=i?.metadata?.BitsStored,s=o?2**o:1/0,l=r[1]-r[0];n=Number.isFinite(l)?Math.min(l,s):s}else n=this._getImageDynamicRangeFromViewport(e);let i=n/1024;return Number.isFinite(i)?i>1?Math.round(i):i:1024}_getImageDynamicRangeFromViewport(e){let t,n,{imageData:i,voxelManager:a}=e.getImageData();if(a?.getRange){let e=a.getRange();return e[1]-e[0]}let r=i.getDimensions();if(i.getRange){let e=i.getRange();return e[1]-e[0]}if(t=i.getScalarData?i.getScalarData():i.getPointData().getScalars().getData(),1!==r[2])return this._getImageDynamicRangeFromMiddleSlice(t,r);if(t.getRange)n=t.getRange();else{let{min:e,max:i}=this._getMinMax(t,t.length);n=[e,i]}return n[1]-n[0]}_getMinMax(e,t){let n=1/0,i=-1/0;for(let a=0;ai&&(i=t)}return{max:i,min:n}}}o2.toolName="WindowLevel";let o5=o2;function o3(e){let t=e.getSourceDataId?.();if(t&&"function"==typeof e.getDisplaySetPresentation&&"function"==typeof e.setDisplaySetPresentation)return{viewport:e,dataId:t}}class o8 extends oL.EC{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{minWindowWidth:10}}){super(e,t),this.addNewAnnotation=e=>{let{currentPoints:t,element:n}=e.detail,i=t.world,{viewport:a}=(0,M.kJ)(n);this.isDrawing=!0;let{viewPlaneNormal:r,viewUp:o}=(0,i$.A)(a),s=this.getReferencedImageId(a,i,r,o),l=a.getFrameOfReferenceUID(),d={invalidated:!0,highlighted:!0,metadata:{toolName:this.getToolName(),viewPlaneNormal:[...r],viewUp:[...o],FrameOfReferenceUID:l,referencedImageId:s},data:{handles:{points:[[...i],[...i],[...i],[...i]]},cachedStats:{}}};(0,iS.lC)(d,n);let c=(0,ta.Q0)(n,this.getToolName());return this.editData={annotation:d,viewportIdsToRender:c},this._activateDraw(n),(0,oK.lY)(n),e.preventDefault(),(0,tr.A)(c),d},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:i}=this.editData;this._deactivateDraw(t),(0,oK.Q_)(t),this.editData=null,this.isDrawing=!1,(0,iS.O8)(n.annotationUID),(0,tr.A)(i),(0,tu.triggerAnnotationCompleted)(n),this.applyWindowLevelRegion(n,t)},this._dragCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{annotation:i,viewportIdsToRender:a}=this.editData,{data:r}=i,{currentPoints:o}=t,{worldToCanvas:s,canvasToWorld:l}=(0,M.kJ)(n).viewport,d=o.world,{points:c}=r.handles;c[3]=[...d];let h=s(c[0]),u=s(c[3]),g=[u[0],h[1]],p=[h[0],u[1]],m=l(g),f=l(p);c[1]=m,c[2]=f,i.invalidated=!0,(0,tr.A)(a)},this._activateDraw=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._deactivateDraw=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(e,t)=>{let n=!1,{viewport:i}=e,{element:a}=i,r=(0,iS.Rh)(this.getToolName(),a);if(!r?.length||(r=this.filterInteractableAnnotationsForElement(a,r),!r?.length))return n;let o={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let e=0;ei.worldToCanvas(e));o.annotationUID=s;let{color:h,lineWidth:u,lineDash:g}=this.getAnnotationStyle({annotation:a,styleSpecifier:o});if(!i.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}let p=`${s}-rect`;(0,aK.tk)(t,s,"0",c[0],c[3],{color:h,lineDash:g,lineWidth:u},p),n=!0}return n},this.applyWindowLevelRegion=(e,t)=>{let{viewport:n}=(0,M.kJ)(t),i=function(e){if(e instanceof M.PX){var t=e;let{scalarData:n,width:i,height:a}=M.BF.getCurrentVolumeViewportSlice(t),{min:r,max:o}=M.BF.getMinMax(n);return{scalarData:n,minPixelValue:r,maxPixelValue:o,width:i,height:a,rows:i,columns:a}}if(e instanceof M.hS)return function(e){let t=e.getImageData(),{scalarData:n}=t,{min:i,max:a}=M.BF.getMinMax(n),r=t.dimensions[0],o=t.dimensions[1],{rows:s,columns:l,color:d}=e.getCornerstoneImage();return{scalarData:n,width:r,height:o,minPixelValue:i,maxPixelValue:a,rows:s,columns:l,color:d}}(e);if(M.BF.isGenericViewport(e))return function(e){let t=e.getCurrentImageId();if(!t)return void console.warn("WindowLevelRegionTool: the current native viewport slice has no backing image (reformatted/oblique volume plane); skipping region window level.");let n=M.PP.getImage(t);if(!n)throw Error("Viewport not supported");let i=n.getPixelData(),{rows:a,columns:r,color:o}=n,{min:s,max:l}=M.BF.getMinMax(i);return{scalarData:i,width:r,height:a,minPixelValue:s,maxPixelValue:l,rows:a,columns:r,color:o}}(e);throw Error("Viewport not supported")}(n);if(!i)return;let{data:a}=e,{points:r}=a.handles,o=r.map(e=>n.worldToCanvas(e)),s=o[0],l=o[3],d=Math.min(s[0],l[0]),c=Math.min(s[1],l[1]),h=Math.abs(s[0]-l[0]),u=Math.abs(s[1]-l[1]);d=M.BF.clip(d,0,i.width),c=M.BF.clip(c,0,i.height),h=Math.floor(Math.min(h,Math.abs(i.width-d))),u=Math.floor(Math.min(u,Math.abs(i.height-c)));let g=function(e,t,n){let i=e.length,a=n,r=t,o=0;if(i<2)return{min:a,max:r,mean:(t+n)/2};for(let t=0;tnull,this.isPointNearTool=()=>null,this.toolSelectedCallback=()=>null,this.handleSelectedCallback=()=>null,this._activateModify=()=>null,this._deactivateModify=()=>null}}o8.toolName="WindowLevelRegion";class o4 extends oL.oS{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{invert:!1,debounceIfNotLoaded:!0,loop:!1}}){super(e,t),this.deltaY=1}mouseWheelCallback(e){this._scroll(e)}mouseDragCallback(e){this._dragCallback(e)}touchDragCallback(e){this._dragCallback(e)}_dragCallback(e){this._scrollDrag(e)}_scrollDrag(e){let t,{deltaPoints:n,viewportId:i,renderingEngineId:a}=e.detail,{viewport:r}=(0,M.b1)(i,a),{debounceIfNotLoaded:o,invert:s,loop:l}=this.configuration,d=n.canvas[1];r instanceof M.PX&&(t=r.getVolumeId());let c=this._getPixelPerImage(r),h=d+this.deltaY;if(c)if(Math.abs(h)>=c){let e=Math.round(h/c);M.BF.scroll(r,{delta:s?-e:e,volumeId:t,debounceLoading:o,loop:l}),this.deltaY=h%c}else this.deltaY=h}_scroll(e){let{wheel:t,element:n}=e.detail,{direction:i}=t,{invert:a}=this.configuration,{viewport:r}=(0,M.kJ)(n);M.BF.scroll(r,{delta:i*(a?-1:1),debounceLoading:this.configuration.debounceIfNotLoaded,loop:this.configuration.loop,volumeId:r instanceof M.ei?r.getVolumeId():void 0,scrollSlabs:this.configuration.scrollSlabs})}_getPixelPerImage(e){let{element:t}=e,n=e.getNumberOfSlices();return Math.max(2,t.offsetHeight/Math.max(n,8))}}o4.toolName="StackScroll";let o6=o4;function o9(e,t){return 3===e[0].length?function(e,t){let[n,i]=e,[a,r]=t,o=e7.jb(e7.vt(),i,n),s=e7.jb(e7.vt(),a,r),l=e7.Om(o,s),d=e7.Bw(o);return 180*Math.acos(l/(d*e7.Bw(s)))/Math.PI}(e,t):function(e,t){let[n,i]=e,[a,r]=t,o=rK.jb(rK.vt(),i,n),s=rK.jb(rK.vt(),a,r),l=rK.Om(o,s),d=rK.Bw(o);return 180/Math.PI*Math.acos(l/(d*rK.Bw(s)))}(e,t)}class o7 extends oL.oS{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"]}){super(e,t),this.mouseWheelCallback=e=>{let{element:t,wheel:n}=e.detail,{viewport:i}=(0,M.kJ)(t),{invert:a}=this.configuration,r=10*n.direction*(a?-1:1);this.setAngle(i,r)},this.touchDragCallback=this._dragCallback.bind(this),this.mouseDragCallback=this._dragCallback.bind(this)}_dragCallback(e){let{element:t,currentPoints:n,startPoints:i}=e.detail,a=n.world,r=i.world,{viewport:o}=(0,M.kJ)(t),s=(0,i$.A)(o),l=t.clientWidth,d=t.clientHeight,c=o.canvasToWorld([.5*l,.5*d]),h=o9([r,c],[c,a]),{viewPlaneNormal:u}=s;if(!u)return;let g=e7.jb(e7.vt(),c,r),p=e7.jb(e7.vt(),c,a),m=e7.$A(e7.vt(),g,p);e7.Om(u,m)>0&&(h=-h),Number.isNaN(h)||this.setAngle(o,h)}setAngle(e,t){let{viewPlaneNormal:n,viewUp:i}=(0,i$.A)(e);if(n&&i){if(e instanceof M.ei){let a=(t+360)%360*Math.PI/180,r=r$.identity(new Float32Array(16));r$.rotate(r,r,a,n);let o=e7.Z0(e7.vt(),i,r);e.setCamera({viewUp:o})}else{let n=aX(e);if(!n)return;let{rotation:i=0}=n;if(!az(e,{rotation:(i+t+360)%360}))return}e.render()}}}o7.toolName="PlanarRotate";class se extends oL.oS{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{zoomToCenter:!1,minZoomScale:.001,maxZoomScale:3e3,pinchToZoom:!0,pan:!0,invert:!1}}){super(e,t),this.preMouseDownCallback=e=>{let{element:t,currentPoints:n}=e.detail,i=n.world,a=st((0,M.kJ)(t).viewport);if(!sn(a))return!1;let{focalPoint:r}=a;this.initialMousePosWorld=i;let o=e7.fA(r[0]-i[0],r[1]-i[1],r[2]-i[2]);return o=e7.S8(e7.vt(),o),this.dirVec=o,!1},this.preTouchStartCallback=e=>{if(!this.configuration.pinchToZoom)return this.preMouseDownCallback(e)},this._dragParallelProjection=(e,t,n,i=!1)=>{let{element:a,deltaPoints:r}=e.detail,o=i?e.detail.deltaDistance.canvas:r.canvas[1],s=[a.clientWidth,a.clientHeight],{parallelScale:l,focalPoint:d,position:c}=n,h=o*(5/s[1])*(this.configuration.invert?-1:1),u=(1-h)*l,g=d,p=c;if(!this.configuration.zoomToCenter){let e=e7.Io(d,this.initialMousePosWorld);p=e7.Ln(e7.vt(),c,this.dirVec,-e*h),g=e7.Ln(e7.vt(),d,this.dirVec,-e*h)}let m=t.getImageData(),f=[1,1,1],v=u,I=!1;if(m){let e;f=m.spacing;let{dimensions:n}=m,i=n[0]*f[0],a=n[1]*f[1],r=s[0]/s[1],o=(0,M.D0)().rendering?.useLegacyCameraFOV?1.1:1,l=t.options?.displayArea,d=l?.imageArea?.[0]??o,c=l?.imageArea?.[1]??o,h=i*d,g=a*c;e=h/g>r?h/r*.5:.5*g;let{minZoomScale:p,maxZoomScale:_}=this.configuration,w=e/_,b=e/p;ub&&(v=b,I=!0)}t.setCamera({parallelScale:v,focalPoint:I?d:g,position:I?c:p})},this._dragPerspectiveProjection=(e,t,n,i=!1)=>{let{element:a,deltaPoints:r}=e.detail,o=i?e.detail.deltaDistance.canvas:r.canvas[1],s=[a.clientWidth,a.clientHeight],{position:l,focalPoint:d,viewPlaneNormal:c}=n,h=Math.sqrt(oR.Ay.distance2BetweenPoints(l,d))/s[1],u=[-c[0],-c[1],-c[2]],g=this.configuration.invert?o/h:o*h,p=g*u[0];l[0]+=p,d[0]+=p,p=g*u[1],l[1]+=p,d[1]+=p,p=g*u[2],l[2]+=p,d[2]+=p,t.setCamera({position:l,focalPoint:d})},this.initialMousePosWorld=[0,0,0],this.dirVec=[0,0,0],this.configuration.pinchToZoom?this.touchDragCallback=this._pinchCallback.bind(this):this.touchDragCallback=this._dragCallback.bind(this),this.mouseDragCallback=this._dragCallback.bind(this)}mouseWheelCallback(e){this._zoom(e)}_pinchCallback(e){if(e.detail.currentPointsList.length>1){var t;let{element:n,currentPoints:i}=e.detail,{viewport:a}=(0,M.kJ)(n),r=st(a),o=i.world;if(!sn(r)){(0,M.qV)(a)&&(this._dragViewportZoom(e,a),a.render()),this.configuration.pan&&this._panCallback(e);return}let{focalPoint:s}=r;this.initialMousePosWorld=o;let l=e7.fA(s[0]-o[0],s[1]-o[1],s[2]-o[2]);l=e7.S8(e7.vt(),l),this.dirVec=l,si(r)&&r.parallelProjection?this._dragParallelProjection(e,a,r,!0):sn(t=r)&&Array.isArray(t.viewPlaneNormal)&&this._dragPerspectiveProjection(e,a,r,!0),a.render()}this.configuration.pan&&this._panCallback(e)}_dragCallback(e){let{element:t}=e.detail,{viewport:n}=(0,M.kJ)(t),i=st(n);if(si(i))i.parallelProjection?this._dragParallelProjection(e,n,i):this._dragPerspectiveProjection(e,n,i);else{if(!(0,M.qV)(n))return;this._dragViewportZoom(e,n)}n.render()}_zoom(e){let{element:t,points:n}=e.detail,i=(0,M.kJ)(t),{viewport:a}=i,r=st(a),o=e.detail.wheel.direction;if(!si(r)){if(!(0,M.qV)(a))return;let e=this.configuration.zoomToCenter?void 0:n.canvas;this._applyViewportZoomDelta(a,t,-(5*o),e),a.render();return}let s={detail:{element:t,eventName:S.sV.MOUSE_WHEEL,renderingEngineId:i.renderingEngineId,viewportId:a.id,camera:{},deltaPoints:{page:n.page,client:n.client,world:n.world,canvas:[0,-(5*o)]},startPoints:n,lastPoints:n,currentPoints:n}};a.type===M.fX.NV.STACK&&this.preMouseDownCallback(s),this._dragCallback(s)}_panCallback(e){let{element:t,deltaPoints:n}=e.detail,i=(0,M.kJ)(t),a=n.world,r=i.viewport,o=st(r);if(!sn(o)){if(!(0,M.sv)(r))return;let e=r.getPan();r.setPan([e[0]+n.canvas[0],e[1]+n.canvas[1]]),r.render();return}let{focalPoint:s,position:l}=o,d=[l[0]-a[0],l[1]-a[1],l[2]-a[2]],c=[s[0]-a[0],s[1]-a[1],s[2]-a[2]];r.setCamera({focalPoint:c,position:d}),r.render()}_dragViewportZoom(e,t){let{element:n,deltaPoints:i,startPoints:a}=e.detail,r=this.configuration.zoomToCenter?void 0:a?.canvas;this._applyViewportZoomDelta(t,n,i.canvas[1],r)}_applyViewportZoomDelta(e,t,n,i){let a=e.getZoom(),r=Math.min(Math.max(a/Math.max(1-n*(5/Math.max(t.clientHeight,1))*(this.configuration.invert?-1:1),.01),this.configuration.minZoomScale),this.configuration.maxZoomScale);e.setZoom(r,i)}}function st(e){return"function"==typeof e.getCamera?e.getCamera():void 0}function sn(e){return!!(e&&Array.isArray(e.focalPoint)&&Array.isArray(e.position))}function si(e){return!!(sn(e)&&"boolean"==typeof e.parallelProjection&&"number"==typeof e.parallelScale&&Array.isArray(e.viewPlaneNormal))}se.toolName="Zoom";let sa=se;class sr extends oL.oS{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{targetViewportIds:[]}}){super(e,t)}mouseClickCallback(e){let{element:t,currentPoints:n}=e.detail,{viewport:i,renderingEngine:a}=(0,M.kJ)(t),r=i.getVolumeId();if(!r)throw Error("MIPJumpToClickTool: targetId is not a volumeId, you should only use MIPJumpToClickTool with a volumeId as the targetId");let o=-1/0,s=(0,tn.RC)(i,n.world,r,(e,t)=>{if(e>o)return o=e,t});if(!s||!s.length)return;let{targetViewportIds:l,toolGroupId:d}=this.configuration;a.getViewports().filter(e=>{if(l?.indexOf(e.id)>=0)return!0;let t=(0,tT.getToolGroupForViewport)(e.id,a.id);return!!d&&d===t?.id}).forEach(e=>{e instanceof M.PX?e.jumpToWorld(s):console.warn("Cannot jump to specified world coordinates for a viewport that is not a VolumeViewport")})}}sr.toolName="MIPJumpToClickTool";var so=n(48185);let{Cf:ss}=M.Jj;function sl(e){if(M.BF.isGenericViewport(e)){let{element:t}=e;return{clientWidth:t.clientWidth,clientHeight:t.clientHeight}}let{clientWidth:t,clientHeight:n}=e.canvas;return{clientWidth:t,clientHeight:n}}function sd(){return"rgb(0, 200, 0)"}function sc(){return!0}function sh(){return!0}function su(){return!0}let sg={DRAG:1,ROTATE:2,SLAB:3};class sp extends oL.EC{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{shadow:!0,viewportIndicators:!1,viewportIndicatorsConfig:{radius:5,x:null,y:null},autoPan:{enabled:!1,panSize:10},handleRadius:3,enableHDPIHandles:!1,referenceLinesCenterGapRadius:20,referenceLinesCenterGapRatio:null,minimal:{enabled:!1,lineLengthInPx:40},filterActorUIDsToSetSlabThickness:[],slabThicknessBlendMode:M.fX.gd.MAXIMUM_INTENSITY_BLEND,centerPoint:{enabled:!1,color:"rgba(255, 255, 0, 0.5)",size:2},mobile:{enabled:"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(any-pointer:coarse)").matches,opacity:.8,handleRadius:9,referenceLinesCenterGapRatio:.05}}}){super(e,t),this.toolCenter=[0,0,0],this._volumeViewportNewVolumeListeners=new Map,this._toolGroupViewportAddedListener=null,this._toolGroupViewportRemovedListener=null,this._ignoreFiredEvents=!1,this.initializeViewport=({renderingEngineId:e,viewportId:t})=>{let n=(0,M.b1)(t,e);if(!n)return;let{FrameOfReferenceUID:i,viewport:a}=n,{element:r}=a,{position:o,focalPoint:s,viewPlaneNormal:l}=(0,i$.A)(a),d=this._getAnnotations(n);d=this.filterInteractableAnnotationsForElement(r,d),d?.length&&(0,y.removeAnnotation)(d[0].annotationUID);let c={highlighted:!1,metadata:{cameraPosition:[...o],cameraFocalPoint:[...s],FrameOfReferenceUID:i,toolName:this.getToolName()},data:{handles:{rotationPoints:[],slabThicknessPoints:[],toolCenter:this.toolCenter},activeOperation:null,activeViewportIds:[],viewportId:t}};(0,y.addAnnotation)(c,r);let{clientWidth:h,clientHeight:u}=sl(a);return{normal:l,point:a.canvasToWorld([h/2,u/2])}},this._getViewportsInfo=()=>(0,tT.getToolGroup)(this.toolGroupId).viewportsInfo,this._reinitializeListenersAndCenter=()=>{this._unbindToolGroupViewportListeners(),this._clearAllVolumeListenersAndViewportState(),this._bindToolGroupViewportListeners(),this._syncVolumeListenersWithToolGroup(),this._computeToolCenter(this._getViewportsInfo())},this.resetCrosshairs=()=>{let e=this._getViewportsInfo();for(let t of e){let{viewportId:e,renderingEngineId:n}=t,i=(0,M.b1)(e,n);if(!i)continue;let a=i.viewport;M.BF.isGenericViewport(a)?a.resetViewState({resetPan:!0,resetZoom:!0,resetOrientation:!0,resetFlip:!0}):(a.resetCamera({resetPan:!0,resetZoom:!0,resetToCenter:!0,resetRotation:!0,suppressEvents:!0}),a.resetSlabThickness());let{element:r}=a,o=this._getAnnotations(i);(o=this.filterInteractableAnnotationsForElement(r,o)).length&&(0,y.removeAnnotation)(o[0].annotationUID),a.render()}this._computeToolCenter(e)},this.computeToolCenter=()=>{let e=this._getViewportsInfo();this._computeToolCenter(e)},this._computeToolCenter=e=>{if(!e.length||1===e.length)return void console.warn("For crosshairs to operate, at least two viewports must be given.");e.forEach(e=>{this.initializeViewport(e)}),this._recomputeToolCenterFromAbsoluteCameras({emitEvent:!0,updateViewportCameras:!0})},this.addNewAnnotation=e=>{let t=e.detail,{element:n}=t,{currentPoints:i}=t,a=i.world;this._syncVolumeListenersWithToolGroup(),this._recomputeToolCenterFromAbsoluteCameras({emitEvent:!1,updateViewportCameras:!1});let r=(0,M.kJ)(n),{viewport:o}=r;this._jump(r,a);let s=this._getAnnotations(r),l=this.filterInteractableAnnotationsForElement(o.element,s),{data:d}=l[0],{rotationPoints:c}=d.handles,h=[];for(let e=0;e{console.log("Not implemented yet")},this.handleSelectedCallback=(e,t)=>{let{element:n}=e.detail;t.highlighted=!0,this._activateModify(n,e),(0,oK.lY)(n),e.preventDefault()},this.isPointNearTool=(e,t,n,i)=>!!this._pointNearTool(e,t,n,i),this.toolSelectedCallback=(e,t,n)=>{let{element:i}=e.detail;t.highlighted=!0,this._activateModify(i,e),(0,oK.lY)(i),e.preventDefault()},this.onCameraModified=e=>{let{element:t}=e.detail,n=(0,M.kJ)(t);if(!n)return;let{renderingEngine:i}=n,a=n.viewport;if(this._syncVolumeListenersWithToolGroup(),this._ignoreFiredEvents||!this._getViewportsInfo().some(({viewportId:e,renderingEngineId:t})=>e===a.id&&t===i.id))return;let r=this._getAnnotations(n),o=this.filterInteractableAnnotationsForElement(t,r)[0],s=(0,i$.A)(a);o&&(o.metadata.cameraPosition=[...s.position],o.metadata.cameraFocalPoint=[...s.focalPoint]),this._recomputeToolCenterFromAbsoluteCameras({emitEvent:!0,updateViewportCameras:!1}),this.configuration.autoPan?.enabled&&(0,tT.getToolGroupForViewport)(a.id,i.id).getViewportIds().filter(e=>e!==a.id).forEach(e=>{this._autoPanViewportIfNecessary(e,i)});let l=(0,ta.Q0)(t,this.getToolName(),!1);(0,tr.A)(l)},this.onResetCamera=e=>{this.resetCrosshairs()},this.mouseMoveCallback=(e,t)=>{if(!t)return!1;let{element:n,currentPoints:i}=e.detail,a=i.canvas,r=!1;for(let e=0;e0?[...o.activeViewportIds]:[];o.activeViewportIds=[],o.handles.activeOperation=null;let c=this.getHandleNearImagePoint(n,i,a,6),h=!1,u=(h=!!c||this._pointNearTool(n,i,a,6))&&!s,g=!h&&s;u||g?(i.highlighted=!s,r=!0):o.handles.activeOperation===l&&this._areViewportIdArraysEqual(o.activeViewportIds,d)||(r=!0)}return r},this.filterInteractableAnnotationsForElement=(e,t)=>{if(!t||!t.length)return[];let{viewportId:n}=(0,M.kJ)(e);return t.filter(e=>e.data.viewportId===n)},this.renderAnnotation=(e,t)=>{let n=!1,{viewport:i,renderingEngine:a}=e,{element:r}=i,o=this._getAnnotations(e),s=(0,i$.A)(i),l=this.filterInteractableAnnotationsForElement(r,o)[0];if(!o?.length||!l?.data)return n;let d=l.annotationUID,{clientWidth:c,clientHeight:h}=sl(i),u=Math.sqrt(c*c+h*h),g=Math.min(c,h),p=l.data,m=i.worldToCanvas(this.toolCenter),f=this._filterAnnotationsByUniqueViewportOrientations(e,o),v=[],I=[0,0,c,h];f.forEach(e=>{let{data:t}=e;t.handles.toolCenter=this.toolCenter;let n=a.getViewport(t.viewportId),r=(0,i$.A)(n),o=this._getReferenceLineControllable(n.id),l=this._getReferenceLineDraggableRotatable(n.id),d=this._getReferenceLineSlabThicknessControlsOn(n.id),{clientWidth:c,clientHeight:h}=sl(n),p=Math.sqrt(c*c+h*h),_=n.canvasToWorld([.5*c,.5*h]),w=[0,0,0];oR.Ay.cross(s.viewPlaneNormal,r.viewPlaneNormal,w),oR.Ay.normalize(w),oR.Ay.multiplyScalar(w,p);let b=[0,0,0];oR.Ay.add(_,w,b);let C=[0,0,0];oR.Ay.subtract(_,w,C);let A=i.worldToCanvas(b),E=i.worldToCanvas(_),M=rK.vt();rK.Re(M,A,E),rK.S8(M,M);let y=rK.vt();rK.hs(y,M,100*u);let S=rK.vt();rK.hs(S,M,.2*g);let T=rK.vt(),D=this.configuration.mobile,{referenceLinesCenterGapRatio:P}=D?.enabled?D:this.configuration,k=sm(this.configuration),x=P>0?g*P:this.configuration.referenceLinesCenterGapRadius;rK.hs(T,M,2===f.length?x:0);let L=rK.vt(),V=rK.vt(),O=rK.vt(),R=rK.vt(),N=rK.o8(m);if(l&&o||(N=rK.o8(E)),rK.WQ(L,N,T),rK.WQ(V,N,y),rK.Re(O,N,T),rK.Re(R,N,y),rR(L,V,I),rR(O,R,I),k.enabled){let e=rK.vt();rK.hs(e,M,k.lineLengthInPx),rK.WQ(L,N,T),rK.WQ(V,L,e),rK.Re(O,N,T),rK.Re(R,O,e),rR(L,V,I),rR(O,R,I)}let U=sf(L,V),F=sf(O,R),B=rK.o8(m);!l&&d&&(B=rK.o8(E));let G=[...this.toolCenter];!l&&d&&(G=[..._]);let H=[0,0,0];oR.Ay.subtract(b,C,H),oR.Ay.normalize(H);let{viewPlaneNormal:W}=s,{matrix:X}=so.A.buildFromDegree().rotate(90,W),z=[0,0,0];e7.Z0(z,H,X);let $=rB(n),Y=[...z];oR.Ay.multiplyScalar(Y,$);let j=[0,0,0];oR.Ay.add(G,Y,j);let J=i.worldToCanvas(j),Q=rK.vt();rK.Re(Q,B,J);let q=rK.vt();rK.Re(q,B,y),rK.WQ(q,q,Q);let K=rK.vt();rK.WQ(K,B,y),rK.WQ(K,K,Q),rR(q,K,I);let Z=rK.vt();rK.WQ(Z,B,y),rK.Re(Z,Z,Q);let ee=rK.vt();rK.Re(ee,B,y),rK.Re(ee,ee,Q),rR(Z,ee,I);let et=rK.vt(),en=rK.vt(),ei=rK.vt(),ea=rK.vt();rK.Re(et,B,S),rK.WQ(et,et,Q),rK.WQ(en,B,S),rK.WQ(en,en,Q),rK.Re(ei,B,S),rK.Re(ei,ei,Q),rK.WQ(ea,B,S),rK.Re(ea,ea,Q),v.push([n,L,V,O,R,q,K,Z,ee,U,F,et,en,ei,ea])});let _=[],w=[],b=this._getReferenceLineColor(i.id),C=void 0!==b?b:"rgb(200, 200, 200)";if(v.forEach((e,n)=>{let a=e[0],r=sm(this.configuration),o=this._getReferenceLineColor(a.id),s=this._getReferenceLineControllable(a.id),l=!r.enabled&&(this._getReferenceLineDraggableRotatable(a.id)||this.configuration.mobile?.enabled),c=!r.enabled&&(this._getReferenceLineSlabThicknessControlsOn(a.id)||this.configuration.mobile?.enabled),h=p.activeViewportIds.find(e=>e===a.id),u=void 0!==o?o:"rgb(200, 200, 200)",g=1,m=null!==p.handles.activeOperation&&p.handles.activeOperation===sg.DRAG&&h;m&&(g=2.5);let f=`${n}`;if(s&&(l||r.enabled)?(f=`${n}One`,(0,aK.V6)(t,d,f,e[1],e[2],{color:u,lineWidth:g}),f=`${n}Two`,(0,aK.V6)(t,d,f,e[3],e[4],{color:u,lineWidth:g})):(0,aK.V6)(t,d,f,e[2],e[4],{color:u,lineWidth:g}),s){u=void 0!==o?o:"rgb(200, 200, 200)";let s=p.handles.activeOperation===sg.ROTATE,g=[e[9],e[10]],v=[i.canvasToWorld(e[9]),a,e[1],e[2]],I=[i.canvasToWorld(e[10]),a,e[3],e[4]];_.push(v,I);let b=p.handles.activeOperation===sg.SLAB,C=[e[11],e[12],e[13],e[14]];if(!r.enabled){let t=[i.canvasToWorld(e[11]),a,e[5],e[6]],n=[i.canvasToWorld(e[12]),a,e[5],e[6]],r=[i.canvasToWorld(e[13]),a,e[7],e[8]],o=[i.canvasToWorld(e[14]),a,e[7],e[8]];w.push(t,n,r,o)}let A=this.configuration.handleRadius*(this.configuration.enableHDPIHandles?window.devicePixelRatio:1),E=1;if(this.configuration.mobile?.enabled&&(A=this.configuration.mobile.handleRadius,E=this.configuration.mobile.opacity),(m||this.configuration.mobile?.enabled)&&!s&&!b&&l&&c){let e=`${n}One`;(0,aK.qX)(t,d,e,g,{color:u,handleRadius:A,opacity:E,type:"circle"}),e=`${n}Two`,(0,aK.qX)(t,d,e,C,{color:u,handleRadius:A,opacity:E,type:"rect"})}else if(m&&!s&&!b&&l){let e=`${n}`;(0,aK.qX)(t,d,e,g,{color:u,handleRadius:A,opacity:E,type:"circle"})}else if(h&&!s&&!b&&c){let e=`${n}`;(0,aK.qX)(t,d,e,C,{color:u,handleRadius:A,opacity:E,type:"rect"})}else if(s&&l){let e=`${n}`,i=this.configuration.handleRadius*(this.configuration.enableHDPIHandles?window.devicePixelRatio:1);(0,aK.qX)(t,d,e,g,{color:u,handleRadius:i,fill:u,type:"circle"})}else if(b&&h&&c){let e=this.configuration.handleRadius*(this.configuration.enableHDPIHandles?window.devicePixelRatio:1);(0,aK.qX)(t,d,f,C,{color:u,handleRadius:e,fill:u,type:"rect"})}rB(a)>.5&&c&&(f=`${n}STOne`,(0,aK.V6)(t,d,f,e[5],e[6],{color:u,width:1,lineDash:[2,3]}),f=`${n}STTwo`,(0,aK.V6)(t,d,f,e[7],e[8],{color:u,width:e,lineDash:[2,3]}))}}),n=!0,p.handles.rotationPoints=_,p.handles.slabThicknessPoints=w,this.configuration.viewportIndicators){let{viewportIndicatorsConfig:e}=this.configuration,n=e?.xOffset||.95,i=e?.yOffset||.05,a=e?.circleRadius||.01*u;(0,aK.hp)(t,d,"0",[c*n,h*i],a,{color:C,fill:C})}if(this.configuration.centerPoint?.enabled){let e=this.configuration.centerPoint.color||"rgba(255, 255, 0, 0.5)",n=Math.min(this.configuration.centerPoint.size||2,5);(0,aK.hp)(t,d,"centerPoint",m,n,{color:e,fill:e})}return n},this._getAnnotations=e=>{let{viewport:t}=e,n=(0,y.getAnnotations)(this.getToolName(),t.element)||[],i=this._getViewportsInfo().map(({viewportId:e})=>e);return n.filter(e=>{let{data:t}=e;return i.includes(t.viewportId)})},this._onNewVolume=e=>{this._syncVolumeListenersWithToolGroup(),this._recomputeToolCenterFromAbsoluteCameras({emitEvent:!0,updateViewportCameras:!1})},this._areViewportIdArraysEqual=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n{let{viewportId:n,renderingEngine:i,viewport:a}=e,r=t.filter(e=>e.data.viewportId!==n);if(!r||!r.length)return[];let{viewPlaneNormal:o,position:s}=(0,i$.A)(a);return r.filter(e=>{let{viewportId:t}=e.data,n=i.getViewport(t),a=(0,i$.A)(n);return!(M.BF.isEqual(a.viewPlaneNormal,o,.01)&&M.BF.isEqual(a.position,s,1))})},this._filterViewportWithSameOrientation=(e,t,n)=>{let{renderingEngine:i}=e,{data:a}=t,r=i.getViewport(a.viewportId),o=n.filter(e=>{let{data:t}=e,n=i.getViewport(t.viewportId);return!0===this._getReferenceLineControllable(n.id)});if(!o||!o.length)return[];let s=(0,i$.A)(r),l=s.viewPlaneNormal;return oR.Ay.normalize(l),o.filter(e=>{let{viewportId:t}=e.data,n=i.getViewport(t),a=(0,i$.A)(n),r=a.viewPlaneNormal;return oR.Ay.normalize(r),M.BF.isEqual(l,r,.01)&&M.BF.isEqual(s.viewUp,a.viewUp,.01)})},this._filterAnnotationsByUniqueViewportOrientations=(e,t)=>{let{renderingEngine:n,viewport:i}=e,a=(0,i$.A)(i).viewPlaneNormal;oR.Ay.normalize(a);let r=t.filter(e=>{let{data:t}=e,a=n.getViewport(t.viewportId),r=this._getReferenceLineControllable(a.id);return i!==a&&!0===r}),o=[];for(let e=0;e{let{data:t}=e,a=n.getViewport(t.viewportId),r=this._getReferenceLineControllable(a.id);return i!==a&&!0!==r});for(let e=0;ee===t))continue;let{viewportId:i}=t.data,r=n.getViewport(i),s=(0,i$.A)(r),d=s.viewPlaneNormal;if(oR.Ay.normalize(d),M.BF.isEqual(a,d,.01)||M.BF.isOpposite(a,d,.01))continue;let c=!1;for(let e=0;e{if(M.BF.isGenericViewport(e)||M.BF.isGenericViewport(t)){let n=e.getViewReference?.(),i=t.getViewReference?.(),a=n?.dataId??n?.FrameOfReferenceUID,r=i?.dataId??i?.FrameOfReferenceUID;return!!a&&a===r}let n=e.getAllVolumeIds(),i=t.getAllVolumeIds();return n.length===i.length&&n.every(e=>i.includes(e))},this._jump=(e,t)=>{e6.wk.isInteractingWithTool=!0;let{viewport:n,renderingEngine:i}=e,a=this._getAnnotations(e),r=[0,0,0];oR.Ay.subtract(t,this.toolCenter,r);let o=this._getAnnotationsForViewportsWithDifferentCameras(e,a).filter(e=>{let{data:t}=e,a=i.getViewport(t.viewportId),r=this._checkIfViewportsRenderingSameScene(n,a);return this._getReferenceLineControllable(a.id)&&this._getReferenceLineDraggableRotatable(a.id)&&r});return 0===o.length?(e6.wk.isInteractingWithTool=!1,!1):(this._applyDeltaShiftToSelectedViewportCameras(i,o,r),this._recomputeToolCenterFromAbsoluteCameras({emitEvent:!0,updateViewportCameras:!1}),n.render(),e6.wk.isInteractingWithTool=!1,!0)},this._activateModify=(e,t)=>{this._syncVolumeListenersWithToolGroup(),this._recomputeToolCenterFromAbsoluteCameras({emitEvent:!1,updateViewportCameras:!1}),e6.wk.isInteractingWithTool=!(this._isTouchInteraction(t)&&this.configuration.mobile?.enabled),e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._deactivateModify=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._endCallback=e=>{let{element:t}=e.detail;this.editData?.annotation?.data&&(this.editData.annotation.data.handles.activeOperation=null,this.editData.annotation.data.activeViewportIds=[]),this._deactivateModify(t),this._recomputeToolCenterFromAbsoluteCameras({emitEvent:!0,updateViewportCameras:!1}),(0,oK.Q_)(t),this.editData=null;let n=(0,ta.Q0)(t,this.getToolName(),!1);(0,tr.A)(n)},this._dragCallback=e=>{let t=e.detail,n=t.deltaPoints.world;if(.001>Math.abs(n[0])&&.001>Math.abs(n[1])&&.001>Math.abs(n[2]))return;let{element:i}=t,a=(0,M.kJ)(i),{renderingEngine:r,viewport:o}=a,s=this._getAnnotations(a),l=this.filterInteractableAnnotationsForElement(i,s)[0];if(!l)return;let{handles:d}=l.data,{currentPoints:c}=e.detail,h=c.canvas;if(d.activeOperation===sg.DRAG){let e=this._getAnnotationsForViewportsWithDifferentCameras(a,s).filter(e=>{let{data:t}=e,n=r.getViewport(t.viewportId),i=this._getReferenceLineControllable(n.id),a=this._getReferenceLineDraggableRotatable(n.id);return!0===i&&!0===a&&l.data.activeViewportIds.find(e=>e===n.id)});this._applyDeltaShiftToSelectedViewportCameras(r,e,n),this._recomputeToolCenterFromAbsoluteCameras({emitEvent:!0,updateViewportCameras:!1})}else if(d.activeOperation===sg.ROTATE){if(M.BF.isGenericViewport(a.viewport))return;let e=this._getAnnotationsForViewportsWithDifferentCameras(a,s).filter(e=>{let{data:t}=e,n=r.getViewport(t.viewportId),i=this._getReferenceLineControllable(n.id),a=this._getReferenceLineDraggableRotatable(n.id);return!0===i&&!0===a}),n=rK.vt(),i=rK.vt(),l=[this.toolCenter[0],this.toolCenter[1],this.toolCenter[2]],d=o.worldToCanvas(l),c=t.currentPoints.canvas,h=rK.vt();rK.jb(h,c,t.deltaPoints.canvas),rK.jb(n,h,d),rK.jb(i,c,d);let u=rK.g7(n,i);this._isClockWise(d,h,c)&&(u*=-1),u=Math.round(100*u)/100;let g=(0,i$.A)(o).viewPlaneNormal,{matrix:p}=so.A.buildFromRadian().translate(l[0],l[1],l[2]).rotate(u,g).translate(-l[0],-l[1],-l[2]),m=[],f=this._ignoreFiredEvents;this._ignoreFiredEvents=!0;try{e.forEach(e=>{let{data:t}=e;t.handles.toolCenter=l;let n=r.getViewport(t.viewportId),{viewUp:i,position:a,focalPoint:o}=(0,i$.A)(n);i[0]+=a[0],i[1]+=a[1],i[2]+=a[2],e7.Z0(o,o,p),e7.Z0(a,a,p),e7.Z0(i,i,p),i[0]-=a[0],i[1]-=a[1],i[2]-=a[2],n.setCamera({position:a,viewUp:i,focalPoint:o}),m.push(n.id)})}finally{this._ignoreFiredEvents=f}r.renderViewports(m),this._recomputeToolCenterFromAbsoluteCameras({emitEvent:!0,updateViewportCameras:!1})}else if(d.activeOperation===sg.SLAB){if(M.BF.isGenericViewport(a.viewport))return;let e=this._getAnnotationsForViewportsWithDifferentCameras(a,s).filter(e=>{let{data:t}=e,n=r.getViewport(t.viewportId),i=this._getReferenceLineControllable(n.id),a=this._getReferenceLineSlabThicknessControlsOn(n.id);return!0===i&&!0===a&&l.data.activeViewportIds.find(e=>e===n.id)});if(0===e.length)return;let i=this._filterViewportWithSameOrientation(a,e[0],s),d=[];d.push(o.id),i.forEach(e=>{let{data:i}=e,a=r.getViewport(i.viewportId),s=(0,i$.A)(a).viewPlaneNormal,c=oR.Ay.dot(n,s),u=[...s];if(oR.Ay.multiplyScalar(u,c),Math.abs(u[0])>.001||Math.abs(u[1])>.001||Math.abs(u[2])>.001){let e=Math.sqrt(u[0]*u[0]+u[1]*u[1]+u[2]*u[2]),n=t.lastPoints.world,i=[0,0,0],c=[this.toolCenter[0],this.toolCenter[1],this.toolCenter[2]];if(!this._getReferenceLineDraggableRotatable(a.id)){let{rotationPoints:e}=this.editData.annotation.data.handles,t=e.filter(e=>e[1].uid===a.id);if(2===t.length){let e=o.canvasToWorld(t[0][3]),n=o.canvasToWorld(t[1][3]);oR.Ay.add(e,n,c),oR.Ay.multiplyScalar(c,.5)}}oR.Ay.subtract(n,c,i);let g=oR.Ay.dot(i,s),p=[...s];oR.Ay.multiplyScalar(p,g);let m=[p[0],p[1],p[2]];e7.S8(m,m);let f=[u[0],u[1],u[2]];e7.S8(f,f);let v=rB(a);M.BF.isOpposite(m,f,.001)?v-=e:v+=e,v=Math.abs(v),v=Math.max(ss.MINIMUM_SLAB_THICKNESS,v),this._pointNearReferenceLine(l,h,6,a)&&(v=ss.MINIMUM_SLAB_THICKNESS),(0,tT.getToolGroupForViewport)(a.id,r.id).getToolInstance(this.getToolName()).setSlabThickness(a,v),d.push(a.id)}}),r.renderViewports(d),this._recomputeToolCenterFromAbsoluteCameras({emitEvent:!0,updateViewportCameras:!1})}let u=(0,ta.Q0)(i,this.getToolName(),!1);(0,tr.A)(u)},this._pointNearReferenceLine=(e,t,n,i)=>{let{data:a}=e,{rotationPoints:r}=a.handles;for(let e=0;e`${e}::${t}`,this._isFinitePoint3=e=>!!e&&3===e.length&&Number.isFinite(e[0])&&Number.isFinite(e[1])&&Number.isFinite(e[2]),this._bindToolGroupViewportListeners=()=>{this._toolGroupViewportAddedListener||(this._toolGroupViewportAddedListener=e=>{e.detail?.toolGroupId===this.toolGroupId&&(this._syncVolumeListenersWithToolGroup(),this._computeToolCenter(this._getViewportsInfo()))},M.tX.addEventListener(S.sV.TOOLGROUP_VIEWPORT_ADDED,this._toolGroupViewportAddedListener)),this._toolGroupViewportRemovedListener||(this._toolGroupViewportRemovedListener=e=>{e.detail?.toolGroupId===this.toolGroupId&&(this._syncVolumeListenersWithToolGroup(),this._recomputeToolCenterFromAbsoluteCameras({emitEvent:!0,updateViewportCameras:!1}))},M.tX.addEventListener(S.sV.TOOLGROUP_VIEWPORT_REMOVED,this._toolGroupViewportRemovedListener))},this._unbindToolGroupViewportListeners=()=>{this._toolGroupViewportAddedListener&&(M.tX.removeEventListener(S.sV.TOOLGROUP_VIEWPORT_ADDED,this._toolGroupViewportAddedListener),this._toolGroupViewportAddedListener=null),this._toolGroupViewportRemovedListener&&(M.tX.removeEventListener(S.sV.TOOLGROUP_VIEWPORT_REMOVED,this._toolGroupViewportRemovedListener),this._toolGroupViewportRemovedListener=null)},this._syncVolumeListenersWithToolGroup=()=>{let e=this._getViewportsInfo(),t=new Set;e.forEach(e=>{let{viewportId:n,renderingEngineId:i}=e,a=this._toViewportKey(i,n);t.add(a);let r=(0,M.b1)(n,i),o=this._volumeViewportNewVolumeListeners.get(a);if(!r){o&&(o.element.removeEventListener(M.fX.sV.VOLUME_VIEWPORT_NEW_VOLUME,o.handler),this._volumeViewportNewVolumeListeners.delete(a));return}let{viewport:s}=r,{element:l}=s;if(o&&o.element!==l&&(o.element.removeEventListener(M.fX.sV.VOLUME_VIEWPORT_NEW_VOLUME,o.handler),this._volumeViewportNewVolumeListeners.delete(a)),this._volumeViewportNewVolumeListeners.has(a))return;let d=e=>this._onNewVolume(e);l.addEventListener(M.fX.sV.VOLUME_VIEWPORT_NEW_VOLUME,d),this._volumeViewportNewVolumeListeners.set(a,{element:l,handler:d})}),Array.from(this._volumeViewportNewVolumeListeners.entries()).forEach(([e,n])=>{t.has(e)||(n.element.removeEventListener(M.fX.sV.VOLUME_VIEWPORT_NEW_VOLUME,n.handler),this._volumeViewportNewVolumeListeners.delete(e))})},this._clearAllVolumeListenersAndViewportState=()=>{this._volumeViewportNewVolumeListeners.forEach(e=>{e.element.removeEventListener(M.fX.sV.VOLUME_VIEWPORT_NEW_VOLUME,e.handler)}),this._volumeViewportNewVolumeListeners.clear()},this._calculateToolCenterFromAbsoluteCameras=()=>{let e,t=this._getViewportsInfo(),n=[];if(t.forEach(e=>{let t=(0,M.b1)(e.viewportId,e.renderingEngineId);if(!t)return;let i=(0,i$.A)(t.viewport),a=[...i.viewPlaneNormal],r=[...i.focalPoint];this._isFinitePoint3(a)&&this._isFinitePoint3(r)&&(e7.S8(a,a),n.some(e=>M.BF.isEqual(e.normal,a,.001)||M.BF.isOpposite(e.normal,a,.001))||n.push({normal:a,point:r}))}),n.length<2)return null;let i=M.BF.planar.planeEquation(n[0].normal,n[0].point),a=M.BF.planar.planeEquation(n[1].normal,n[1].point);if(n.length>=3)e=M.BF.planar.planeEquation(n[2].normal,n[2].point);else{let t=e7.vt();if(e7.$A(t,n[0].normal,n[1].normal),1e-6>e7.Bw(t))return null;e7.S8(t,t);let i=this._isFinitePoint3(this.toolCenter)?[...this.toolCenter]:[(n[0].point[0]+n[1].point[0])*.5,(n[0].point[1]+n[1].point[1])*.5,(n[0].point[2]+n[1].point[2])*.5];e=M.BF.planar.planeEquation(t,i)}let r=M.BF.planar.threePlaneIntersection(i,a,e);return this._isFinitePoint3(r)?r:null},this._recomputeToolCenterFromAbsoluteCameras=({emitEvent:e=!0,updateViewportCameras:t=!1}={})=>{let n=this._calculateToolCenterFromAbsoluteCameras();return n?(M.BF.isEqual(this.toolCenter,n,.001)||(t?this.setToolCenter(n,!e):(this.toolCenter=n,e&&(0,M.Hl)(M.tX,S.sV.CROSSHAIR_TOOL_CENTER_CHANGED,{toolGroupId:this.toolGroupId,toolCenter:this.toolCenter}))),n):null},this._getReferenceLineColor=e.configuration?.getReferenceLineColor||sd,this._getReferenceLineControllable=e.configuration?.getReferenceLineControllable||sc,this._getReferenceLineDraggableRotatable=e.configuration?.getReferenceLineDraggableRotatable||sh,this._getReferenceLineSlabThicknessControlsOn=e.configuration?.getReferenceLineSlabThicknessControlsOn||su}onSetToolActive(){this._reinitializeListenersAndCenter()}onSetToolPassive(){this._reinitializeListenersAndCenter()}onSetToolEnabled(){this._reinitializeListenersAndCenter()}onSetToolDisabled(){let e=this._getViewportsInfo();this._unbindToolGroupViewportListeners(),this._clearAllVolumeListenersAndViewportState(),this._ignoreFiredEvents=!1,this.editData=null,e6.wk.isInteractingWithTool=!1,e.forEach(({renderingEngineId:e,viewportId:t})=>{let n=(0,M.b1)(t,e);if(!n)return;let i=this._getAnnotations(n);i?.length&&i.forEach(e=>{(0,y.removeAnnotation)(e.annotationUID)})})}setToolCenter(e,t=!1){let n=this._getViewportsInfo(),i=this._ignoreFiredEvents;this._ignoreFiredEvents=!0;try{n.forEach(({renderingEngineId:t,viewportId:n})=>{let i=(0,M.lD)(t);if(!i)return;let a=i.getViewport(n);if(!a)return;let{focalPoint:r,position:o,viewPlaneNormal:s}=(0,i$.A)(a),l=[e[0]-r[0],e[1]-r[1],e[2]-r[2]],d=l[0]*s[0]+l[1]*s[1]+l[2]*s[2],c=[d*s[0],d*s[1],d*s[2]],h=[r[0]+c[0],r[1]+c[1],r[2]+c[2]],u=[o[0]+c[0],o[1]+c[1],o[2]+c[2]];M.BF.isGenericViewport(a)?rG(a,h):a.setCamera({focalPoint:h,position:u}),a.render()})}finally{this._ignoreFiredEvents=i}this.toolCenter=e,t||(0,M.Hl)(M.tX,S.sV.CROSSHAIR_TOOL_CENTER_CHANGED,{toolGroupId:this.toolGroupId,toolCenter:this.toolCenter})}getHandleNearImagePoint(e,t,n,i){let{viewport:a}=(0,M.kJ)(e),r=this._getRotationHandleNearImagePoint(a,t,n,i);if(null!==r||null!==(r=this._getSlabThicknessHandleNearImagePoint(a,t,n,i)))return r}_unsubscribeToViewportNewVolumeSet(e){this._syncVolumeListenersWithToolGroup()}_subscribeToViewportNewVolumeSet(e){this._syncVolumeListenersWithToolGroup()}_autoPanViewportIfNecessary(e,t){let n=t.getViewport(e);if(M.BF.isGenericViewport(n))return;let{clientWidth:i,clientHeight:a}=sl(n),r=n.worldToCanvas(this.toolCenter),o=this.configuration.autoPan.panSize,s=[r[0],r[1]];if(r[0]<0?s[0]=o:r[0]>i&&(s[0]=i-o),r[1]<0?s[1]=o:r[1]>a&&(s[1]=a-o),s[0]===r[0]&&s[1]===r[1])return;let l=n.canvasToWorld(s),d=[l[0]-this.toolCenter[0],l[1]-this.toolCenter[1],l[2]-this.toolCenter[2]],{focalPoint:c,position:h}=(0,i$.A)(n),u=[h[0]-d[0],h[1]-d[1],h[2]-d[2]],g=[c[0]-d[0],c[1]-d[1],c[2]-d[2]],p=this._ignoreFiredEvents;this._ignoreFiredEvents=!0;try{n.setCamera({focalPoint:g,position:u})}finally{this._ignoreFiredEvents=p}n.render()}setSlabThickness(e,t){let n;if(M.BF.isGenericViewport(e))return;let{filterActorUIDsToSetSlabThickness:i}=this.configuration;i&&i.length>0&&(n=i);let a=this.configuration.slabThicknessBlendMode;t===ss.MINIMUM_SLAB_THICKNESS&&(a=M.fX.gd.COMPOSITE),e.setBlendMode(a,n,!1),e.setSlabThickness(t,n)}_isClockWise(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0])>0}_applyDeltaShiftToSelectedViewportCameras(e,t,n){t.forEach(t=>{this._applyDeltaShiftToViewportCamera(e,t,n)})}_applyDeltaShiftToViewportCamera(e,t,n){let{data:i}=t,a=e.getViewport(i.viewportId),r=(0,i$.A)(a),o=r.viewPlaneNormal,s=oR.Ay.dot(n,o),l=[...o];if(oR.Ay.multiplyScalar(l,s),Math.abs(l[0])>.001||Math.abs(l[1])>.001||Math.abs(l[2])>.001){let e=[0,0,0],t=[0,0,0];oR.Ay.add(r.focalPoint,l,e),oR.Ay.add(r.position,l,t);let n=this._ignoreFiredEvents;this._ignoreFiredEvents=!0;try{M.BF.isGenericViewport(a)?rG(a,e):a.setCamera({focalPoint:e,position:t})}finally{this._ignoreFiredEvents=n}a.render()}}_getRotationHandleNearImagePoint(e,t,n,i){let a=sm(this.configuration),{data:r}=t,{rotationPoints:o}=r.handles;for(let s=0;se===t.id))continue;let r=this._getReferenceLineControllable(t.id),o=!a.enabled&&this._getReferenceLineSlabThicknessControlsOn(t.id);if(!r||!o)continue;let s=h[e][2],c=h[e][3],g=rK.vt();rK.WQ(g,s,c),rK.hs(g,g,.5);let p=rK.vt();rK.Re(p,s,g),rK.S8(p,p);let m=rK.vt();rK.hs(m,p,.05*l);let f=rK.vt(),v=rK.vt();rK.WQ(f,g,m),rK.Re(v,g,m);let I={start:{x:f[0],y:f[1]},end:{x:s[0],y:s[1]}},_=oZ.A([I.start.x,I.start.y],[I.end.x,I.end.y],[n[0],n[1]]),w={start:{x:v[0],y:v[1]},end:{x:c[0],y:c[1]}},b=oZ.A([w.start.x,w.start.y],[w.end.x,w.end.y],[n[0],n[1]]);(_<=i||b<=i)&&(u.push(t.id),d.handles.activeOperation=null),e++}return d.activeViewportIds=[...u],this.editData={annotation:t},d.handles.activeOperation===sg.DRAG}}function sm(e){let t=e?.minimal;return t?.enabled?{enabled:!0,lineLengthInPx:Math.max(0,"number"==typeof t.lineLengthInPx&&Number.isFinite(t.lineLengthInPx)?t.lineLengthInPx:40)}:{enabled:!1,lineLengthInPx:0}}function sf(e,t){let n=rK.vt();return rK.WQ(n,e,t),rK.hs(n,n,.5),n}sp.minimalModeExamples=new Map([["Default",{enabled:!1,lineLengthInPx:40}],["Minimal 40px",{enabled:!0,lineLengthInPx:40}],["Minimal 80px",{enabled:!0,lineLengthInPx:80}]]),sp.toolName="Crosshairs";let sv=new Map;function sI(e,t){return`${e.id}:${t}`}function s_(e,t,n){let[i,a,r]=t,o=ij.Ay.newInstance();o.setNumberOfPoints(6),o.setPoint(0,i-n,a,r),o.setPoint(1,i+n,a,r),o.setPoint(2,i,a-n,r),o.setPoint(3,i,a+n,r),o.setPoint(4,i,a,r-n),o.setPoint(5,i,a,r+n);let s=iY.Ay.newInstance({values:[2,0,1,2,2,3,2,4,5]});e.setPoints(o),e.setLines(s),e.modified()}function sw(e){return"function"==typeof e?.getRenderer?e.getRenderer():void 0}function sb(e,t){let n=sI(e,t),i=sv.get(n);if(sv.delete(n),!i)return;let a=sw(e);a&&(a.removeActor(i.actor),e.render())}let{NV:sC}=M.fX;function sA(e){return Array.isArray(e)&&3===e.length&&e.every(e=>Number.isFinite(e))}class sE extends oL.EC{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{pointColor:"rgb(255, 255, 0)",pointRadius:4,markerStyle:"crosshair",centerGapRadius:12,offSliceDisplay:"projectedWithDistance",offSliceToleranceMm:.5,autoInitializeOnEnable:!0,clickToSet:!1,snapToSlabIntensity:!0,jumpOnSet:!0,jumpMode:"sliceOnly",preservePanZoom:!0,liveUpdateOnShiftMouseMove:!0,liveJumpOnShiftMouseMove:!0,showIn2D:!0,showIn3D:!0,threeDViewportIds:[],threeDLineLengthMm:100,linkPolicy:"frameOfReferenceUID",explicitLinkedViewportIds:[]}}){super(e,t),this._state={worldPoint:null,visible:!0,locked:!1,cursorWorldPoint:null},this._annotation=null,this._isDragging=!1,this._autoInitialized=!1,this.addNewAnnotation=e=>{let t=e.detail,{element:n,currentPoints:i}=t,a=(0,M.kJ)(n);if(!a||this._state.locked)return this._getAnnotationOrDetached();let r=t.event;if(!this.configuration.clickToSet&&!r?.shiftKey)return this._getAnnotationOrDetached();let{viewport:o,renderingEngine:s,FrameOfReferenceUID:l}=a;return this._isPlanarViewport(o)&&(this.setWorldPoint(this._resolveInteractionWorldPoint(o,i.world),{sourceViewportId:o.id,sourceRenderingEngineId:s?.id,frameOfReferenceUID:l}),e.preventDefault(),(0,oK.lY)(n),this._startDrag(n)),this._getAnnotationOrDetached()},this.toolSelectedCallback=(e,t)=>{let{element:n}=e.detail;this._state.locked||(t.highlighted=!0,(0,oK.lY)(n),this._startDrag(n),e.preventDefault())},this.handleSelectedCallback=(e,t,n,i="Mouse")=>{this.toolSelectedCallback(e,t)},this.doubleClickCallback=e=>{let{element:t,currentPoints:n}=e.detail,i=(0,M.kJ)(t);if(!i||!this._state.worldPoint)return;let a=this._getMarkerCanvasPosition(i.viewport);a&&(Math.hypot(a[0]-n.canvas[0],a[1]-n.canvas[1])>this.configuration.pointRadius+6||(this.jumpLinkedViewportsToWorldPoint(),e.preventDefault()))},this.mouseMoveCallback=(e,t)=>{let{element:n,currentPoints:i}=e.detail,a=e.detail.event,r=!1;if(this.configuration.liveUpdateOnShiftMouseMove&&a?.shiftKey&&!this._state.locked){let e=(0,M.kJ)(n),t=e?.viewport;t&&this._isPlanarViewport(t)&&(this._state.cursorWorldPoint=[i.world[0],i.world[1],i.world[2]],this.setWorldPoint(this._resolveInteractionWorldPoint(t,i.world),{sourceViewportId:t.id,sourceRenderingEngineId:e.renderingEngine?.id,frameOfReferenceUID:e.FrameOfReferenceUID,jump:this.configuration.liveJumpOnShiftMouseMove}),r=!0)}if(t?.length)for(let e of t){let t=this.isPointNearTool(n,e,i.canvas,6,"mouse");!!e.highlighted!==t&&(e.highlighted=t,r=!0)}return r},this.isPointNearTool=(e,t,n,i,a)=>{let r=(0,M.kJ)(e);if(!r)return!1;let o=this._getMarkerCanvasPosition(r.viewport);return!!o&&Math.hypot(o[0]-n[0],o[1]-n[1])<=this.configuration.pointRadius+i},this.filterInteractableAnnotationsForElement=(e,t)=>{if(!t?.length||!this._state.worldPoint)return[];let n=(0,M.kJ)(e);return n&&this._getMarkerCanvasPosition(n.viewport)?t.filter(e=>e.metadata.toolName===this.getToolName()):[]},this.cancel=e=>{this._isDragging&&(this._isDragging=!1,this._deactivateModify(e),(0,oK.Q_)(e))},this._dragCallback=e=>{let{element:t,currentPoints:n}=e.detail,i=(0,M.kJ)(t);if(!i||this._state.locked)return;let{viewport:a,renderingEngine:r,FrameOfReferenceUID:o}=i;this._isPlanarViewport(a)&&(this._state.cursorWorldPoint=[n.world[0],n.world[1],n.world[2]],this.setWorldPoint(this._resolveInteractionWorldPoint(a,n.world),{sourceViewportId:a.id,sourceRenderingEngineId:r?.id,frameOfReferenceUID:o}))},this._endCallback=e=>{let{element:t}=e.detail;this._isDragging=!1,this._deactivateModify(t),(0,oK.Q_)(t),this._state.cursorWorldPoint=null,this._renderLinkedViewports()},this.renderAnnotation=(e,t)=>{this._maybeAutoInitialize(e);let{viewport:n}=e,{worldPoint:i,visible:a}=this._state,{showIn2D:r,pointColor:o,pointRadius:s,markerStyle:l,offSliceDisplay:d,offSliceToleranceMm:c}=this.configuration;if(!i||!a||!r||!this._isPlanarViewport(n)||!this._isViewportLinked(n))return!1;let h=rk(n);if(!h)return!1;let u=rL(i,h),g=rV(i,h),p=n.worldToCanvas(g);if(!p||!p.every(e=>Number.isFinite(e)))return!1;let m=Math.abs(u)<=this._getEffectiveOffSliceTolerance(n,h,c);if(!m&&"hide"===d)return!1;let f=this._annotation?.annotationUID??`WorldCrosshair-${this.toolGroupId}`,v={color:o,width:this._annotation?.highlighted?2:1,...m?{}:{lineDash:"3,3",strokeOpacity:.7}};if("point"===l)(0,aK.hp)(t,f,"marker",p,s,{...v,fill:m?o:"transparent"},`${f}-marker`);else{let{clientWidth:e,clientHeight:i}=rN(n),a=Math.max(this.configuration.centerGapRadius??0,0),[r,o]=p;[["marker-h1",[0,o],[r-a,o]],["marker-h2",[r+a,o],[e,o]],["marker-v1",[r,0],[r,o-a]],["marker-v2",[r,o+a],[r,i]]].forEach(([e,n,i])=>{let a=Math.hypot(i[0]-n[0],i[1]-n[1]),r=i[0]>=n[0]&&i[1]>=n[1];!(a<1)&&r&&(0,aK.V6)(t,f,e,n,i,v,`${f}-${e}`)})}if(!m&&"projectedWithDistance"===d){let e=`${u>=0?"+":"-"}${Math.abs(u).toFixed(1)} mm`;(0,aK.T$)(t,f,"marker-distance",[e],[p[0]+s+6,p[1]+s+6],{color:o})}return!0}}setWorldPoint(e,t={}){if(!sA(e))return;let n=[e[0],e[1],e[2]],i=this._state.worldPoint,a=!i||e7.Io(i,n)>1e-4;void 0!==t.sourceViewportId&&(this._state.sourceViewportId=t.sourceViewportId),void 0!==t.sourceRenderingEngineId&&(this._state.sourceRenderingEngineId=t.sourceRenderingEngineId);let r=void 0!==t.frameOfReferenceUID&&t.frameOfReferenceUID!==this._state.frameOfReferenceUID;void 0!==t.frameOfReferenceUID&&(this._state.frameOfReferenceUID=t.frameOfReferenceUID),a&&(this._state.worldPoint=n,this._autoInitialized=!0),(a||r)&&this._syncAnnotation(),a&&!t.suppressEvents&&(0,M.Hl)(M.tX,S.sV.WORLD_CROSSHAIR_POINT_CHANGED,this._getEventDetail()),(t.jump??this.configuration.jumpOnSet)&&this._jumpLinkedViewports({suppressEvents:!0}),a&&this._update3DLines(),this._renderLinkedViewports()}getWorldPoint(){let{worldPoint:e}=this._state;return e?[e[0],e[1],e[2]]:null}clearWorldPoint(e={}){this._state.worldPoint&&(this._state.worldPoint=null,this._state.cursorWorldPoint=null,this._syncAnnotation(),this._update3DLines(),e.suppressEvents||(0,M.Hl)(M.tX,S.sV.WORLD_CROSSHAIR_POINT_CLEARED,this._getEventDetail()),this._renderLinkedViewports())}clearWorldCrosshair(e={}){this.clearWorldPoint(e)}jumpLinkedViewportsToWorldPoint(e={}){this._jumpLinkedViewports({...e,suppressEvents:!1})}setVisibility(e){this._state.visible!==e&&(this._state.visible=e,this._update3DLines(),this._renderLinkedViewports())}setLocked(e){this._state.locked=e}getState(){return{toolGroupId:this.toolGroupId,...this._state,worldPoint:this.getWorldPoint(),cursorWorldPoint:this._state.cursorWorldPoint?[...this._state.cursorWorldPoint]:null}}onSetToolEnabled(){this._syncAnnotation(),this._maybeAutoInitialize(),this._update3DLines(),this._renderLinkedViewports()}onSetToolActive(){this.onSetToolEnabled()}onSetToolPassive(){this.onSetToolEnabled()}onSetToolDisabled(){this._isDragging=!1,this._autoInitialized=!1,e6.wk.isInteractingWithTool=!1,this._annotation?.annotationUID&&(0,y.removeAnnotation)(this._annotation.annotationUID),this._annotation=null,this._get3DViewports().forEach(e=>sb(e,this._getMarkerUIDPrefix())),this._renderLinkedViewports()}getHandleNearImagePoint(e,t,n,i){if(this.isPointNearTool(e,t,n,i,"mouse"))return this._state.worldPoint}_startDrag(e){this._isDragging=!0,this._activateModify(e)}_maybeAutoInitialize(e){let t;if(this._autoInitialized||this._state.worldPoint||!this.configuration.autoInitializeOnEnable)return;let n=e?.viewport,i=e?.renderingEngine?.id,a=e?.FrameOfReferenceUID;if(!n)for(let e of this._getViewportsInfo()){let t=(0,M.b1)(e.viewportId,e.renderingEngineId);if(t&&this._isPlanarViewport(t.viewport)){n=t.viewport,i=t.renderingEngine?.id,a=t.FrameOfReferenceUID;break}}if(n&&this._isPlanarViewport(n)){try{({focalPoint:t}=(0,i$.A)(n))}catch{return}sA(t)&&this.setWorldPoint(t,{sourceViewportId:n.id,sourceRenderingEngineId:i,frameOfReferenceUID:a??n.getFrameOfReferenceUID?.(),jump:!1})}}_jumpLinkedViewports(e={}){let{worldPoint:t}=this._state;if(!t)return;let n=e.jumpMode??this.configuration.jumpMode,i=e6.wk.isInteractingWithTool;e6.wk.isInteractingWithTool=!0;try{this._getLinkedViewports().forEach(e=>{this._jumpViewportToPoint(e,t,n)})}finally{e6.wk.isInteractingWithTool=i}e.suppressEvents||(0,M.Hl)(M.tX,S.sV.WORLD_CROSSHAIR_JUMPED_TO_POINT,this._getEventDetail())}_jumpViewportToPoint(e,t,n){let i;if(!this._isPlanarViewport(e))return;try{i=(0,i$.A)(e)}catch{return}let{focalPoint:a,viewPlaneNormal:r}=i;if(!a||!r)return;let o=e7.Re(e7.vt(),t,a),s=e7.Om(o,r);if("centered"===n){if(!rH(e,t))return;e.setViewState({anchorWorld:[t[0],t[1],t[2]],anchorCanvas:[.5,.5]}),e.render();return}if(1e-6>Math.abs(s))return;let l=e7.Ln(e7.vt(),a,r,s);rH(e,[l[0],l[1],l[2]])&&e.render()}_get3DViewports(){let{threeDViewportIds:e}=this.configuration;return e?.length?e.map(e=>(0,M.yj)(e)?.viewport).filter(e=>e&&e.type===sC.VOLUME_3D_NEXT&&M.BF.isGenericViewport(e)):[]}_update3DLines(){let{showIn3D:e,threeDLineLengthMm:t,pointColor:n}=this.configuration,{worldPoint:i,visible:a}=this._state,r=this._getMarkerUIDPrefix();this._get3DViewports().forEach(o=>{e&&a&&i?function(e,t,n){let i=sw(e);if(!i||!t)return;let{lineLengthMm:a,color:r,uidPrefix:o}=n,s=Math.max(a/2,1),l=sI(e,o),d=sv.get(l),c=d&&!!i.getActors?.().includes(d.actor);if(d&&c)s_(d.polyData,t,s);else{d&&i.removeActor(d.actor);let e=iJ.Ay.newInstance();s_(e,t,s);let n=aR.Ay.newInstance();n.setInputData(e);let a=aN.Ay.newInstance();a.setMapper(n),a.getProperty().setColor(...r),a.getProperty().setLineWidth(1.5),a.getProperty().setInterpolationToFlat(),a.getProperty().setAmbient(1),a.getProperty().setDiffuse(0),a.getProperty().setSpecular(0),i.addActor(a),i.resetCameraClippingRange?.(),d={actor:a,polyData:e},sv.set(l,d)}e.render()}(o,i,{lineLengthMm:t,color:function(e){if("string"==typeof e){let t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(t)return[Number(t[1])/255,Number(t[2])/255,Number(t[3])/255];let n=e.match(/^#([0-9a-f]{6})$/i);if(n){let e=parseInt(n[1],16);return[(e>>16&255)/255,(e>>8&255)/255,(255&e)/255]}}return[1,1,0]}(n),uidPrefix:r}):sb(o,r)})}_getMarkerUIDPrefix(){return`WorldCrosshair-${this.toolGroupId}`}_isPlanarViewport(e){return e?.type===sC.PLANAR_NEXT&&M.BF.isGenericViewport(e)}_getViewportsInfo(){return(0,tT.getToolGroup)(this.toolGroupId)?.viewportsInfo??[]}_getLinkedViewports(){let e=this._getViewportsInfo().map(({viewportId:e,renderingEngineId:t})=>(0,M.b1)(e,t)?.viewport).filter(e=>e&&this._isPlanarViewport(e)),{linkPolicy:t,explicitLinkedViewportIds:n}=this.configuration,{sourceViewportId:i,frameOfReferenceUID:a}=this._state;return"explicit"===t?e.filter(e=>e.id===i||n?.includes(e.id)):"frameOfReferenceUID"===t?a?e.filter(e=>e.id===i||e.getFrameOfReferenceUID?.()===a):e:e}_isViewportLinked(e){if(!this._isPlanarViewport(e)||!this._getViewportsInfo().some(({viewportId:t})=>t===e.id))return!1;let{linkPolicy:t,explicitLinkedViewportIds:n}=this.configuration,{sourceViewportId:i,frameOfReferenceUID:a}=this._state;return e.id===i||("explicit"===t?!!n?.includes(e.id):"frameOfReferenceUID"!==t||!a||e.getFrameOfReferenceUID?.()===a)}_renderLinkedViewports(){let e=this._getLinkedViewports().map(e=>e.id);e.length&&(0,tr.A)(e)}_getMarkerCanvasPosition(e){let{worldPoint:t,visible:n}=this._state,{showIn2D:i,offSliceDisplay:a,offSliceToleranceMm:r}=this.configuration;if(!t||!n||!i||!this._isPlanarViewport(e)||!this._isViewportLinked(e))return null;let o=rk(e);if(!o||Math.abs(rL(t,o))>this._getEffectiveOffSliceTolerance(e,o,r)&&"hide"===a)return null;let s=rV(t,o),l=e.worldToCanvas(s);return l&&l.every(e=>Number.isFinite(e))?l:null}_resolveInteractionWorldPoint(e,t){return this.configuration.snapToSlabIntensity?function(e,t){let n=function(e){let t;if(!M.BF.isGenericViewport(e))return null;try{if(e.getCurrentMode?.()!=="volume")return null}catch{return null}if(!M.BF.viewportSupportsDisplaySetPresentation(e))return null;let n=e.getSourceDataId();if(!n)return null;let{blendMode:i,slabThickness:a}=e.getDisplaySetPresentation(n)??{};if(i===M.fX.gd.MAXIMUM_INTENSITY_BLEND)t="max";else{if(i!==M.fX.gd.MINIMUM_INTENSITY_BLEND)return null;t="min"}return!Number.isFinite(a)||a<=r3.MINIMUM_SLAB_THICKNESS?null:{mode:t,slabThicknessMm:a}}(e);if(!n||!t)return null;let i=e.getVolumeId?.(),a=i?M.PP.getVolume(i):void 0;if(!a?.voxelManager||!a.dimensions||!a.spacing||!a.direction||!a.origin)return null;let r=rk(e);if(!r)return null;let o=r.normal,s=Math.abs(o[0])*a.spacing[0]+Math.abs(o[1])*a.spacing[1]+Math.abs(o[2])*a.spacing[2];if(!Number.isFinite(s)||s<=0)return null;let l=n.slabThicknessMm/2,d=.25*s,c=Math.min(Math.ceil(l/d),1e3);d=l/c;let h="max"===n.mode,u=NaN,g=0,p=e7.vt(),m=e=>{e7.Ln(p,t,o,e);let n=M.BF.VoxelManager.sampleAtWorld(a,[p[0],p[1],p[2]]);Number.isFinite(n)&&(Number.isNaN(u)||(h?n>u:n0?i:0}_getEffectiveOffSliceTolerance(e,t,n){let i,a=this._getSourceSlabThicknessMm(e),r=Math.max(n,a>0?a/2+.01:0);try{i=e.getImageData?.()?.spacing}catch{i=void 0}if(!i||3!==i.length)return r;let[o,s,l]=t.normal,d=Math.abs(o)*i[0]+Math.abs(s)*i[1]+Math.abs(l)*i[2];return!Number.isFinite(d)||d<=0?r:Math.max(r,d/2+.01)}_syncAnnotation(){let{worldPoint:e,frameOfReferenceUID:t}=this._state;if(!e){this._annotation?.annotationUID&&(0,y.removeAnnotation)(this._annotation.annotationUID),this._annotation=null;return}if(this._annotation&&t&&this._annotation.metadata.FrameOfReferenceUID!==t&&((0,y.removeAnnotation)(this._annotation.annotationUID),this._annotation=null),this._annotation){this._annotation.data.handles.points=[[e[0],e[1],e[2]]],this._annotation.invalidated=!0;return}if(!t)return;let n={highlighted:!1,invalidated:!0,metadata:{toolName:this.getToolName(),FrameOfReferenceUID:t},data:{handles:{points:[[e[0],e[1],e[2]]]}}};(0,y.addAnnotation)(n,t),this._annotation=n}_getAnnotationOrDetached(){return this._annotation?this._annotation:{annotationUID:M.BF.uuidv4(),highlighted:!1,invalidated:!1,metadata:{toolName:this.getToolName()},data:{handles:{points:[]}}}}_getEventDetail(){let{sourceViewportId:e,sourceRenderingEngineId:t,frameOfReferenceUID:n}=this._state;return{toolGroupId:this.toolGroupId,worldPoint:this.getWorldPoint(),sourceViewportId:e,sourceRenderingEngineId:t,frameOfReferenceUID:n}}}sE.toolLabel="Reference Point",sE.toolName="WorldCrosshair";let{NV:sM}=M.fX,{Cf:sy}=M.Jj;class sS extends oL.EC{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{showCurrentSliceLine:!0,showSlabThickness:!0,showBoundaryLines:!1,showIntermediateLines:!1,draggable:!0,rotatable:!0,slabThicknessControls:!0,lineWidth:1,activeLineWidth:2.5,handleRadius:3,alignGroupsOnEnable:!0,rotationPivotPolicy:"currentIntersection",familyColors:{axial:"rgb(200, 60, 60)",sagittal:"rgb(220, 200, 60)",coronal:"rgb(60, 200, 60)"},setWorldCrosshairOnIntersectionDoubleClick:!1,jumpToIntersectionOnDoubleClick:!1,slabThicknessBlendMode:M.fX.gd.MAXIMUM_INTENSITY_BLEND,perViewportLines:!1}}){super(e,t),this._activeOperation=null,this._renderedLines=new Map,this._pendingHandle=null,this._editData=null,this._mprFamilyByViewportId=new Map,this._passViewportsById=null,this._passPlaneGroups=null,this._passCacheClearScheduled=!1,this.onCameraModified=e=>{let t=e.detail?.viewportId;if(!t)return void this._renderToolViewports();let n=new Set;for(let[e,i]of this._renderedLines){if(e===t){i.length&&n.add(e);continue}i.some(e=>e.leaderViewportId===t)&&n.add(e)}n.size&&(0,tr.A)([...n])},this.renderAnnotation=(e,t)=>{let{viewport:n}=e,i=this._computeLinesForTarget(n);if(this._renderedLines.set(n.id,i),!i.length)return!1;let a=this._getOrCreateViewportAnnotation(n),r=a?.annotationUID??`SliceIntersection-${n.id}`,{lineWidth:o,activeLineWidth:s,handleRadius:l,showCurrentSliceLine:d}=this.configuration;return i.forEach(e=>{let{groupId:n,canvasPoints:i,color:a,isActive:c}=e;d&&(0,aK.V6)(t,r,`line-${n}`,i[0],i[1],{color:a,width:c?s:o},`${r}-line-${n}`),e.slabLineSegments.forEach((e,i)=>{(0,aK.V6)(t,r,`slab-${n}-${i}`,e[0],e[1],{color:a,width:1,lineDash:"4,4",strokeOpacity:.8})}),e.boundaryLineSegments.forEach((e,i)=>{(0,aK.V6)(t,r,`boundary-${n}-${i}`,e[0],e[1],{color:a,width:1,lineDash:"4,4",strokeOpacity:.8})}),e.rotateHandles.forEach((e,i)=>{(0,aK.hp)(t,r,`rotate-handle-${n}-${i}`,e,l,{color:a,fill:a})}),e.slabHandles.forEach((e,i)=>{(0,aK.hp)(t,r,`slab-handle-${n}-${i}`,e,l,{color:a,fill:"transparent"})})}),!0},this.addNewAnnotation=e=>{let{element:t}=e.detail,n=(0,M.kJ)(t);return n?this._getOrCreateViewportAnnotation(n.viewport)??this._createDetachedAnnotation():this._createDetachedAnnotation()},this.isPointNearTool=(e,t,n,i,a)=>{let r=(0,M.kJ)(e);return!!r&&!!this._findLineNear(r.viewport.id,n,6,!0)},this.toolSelectedCallback=(e,t)=>{let{element:n,currentPoints:i}=e.detail,a=(0,M.kJ)(n);if(!a)return;let r=this._findLineNear(a.viewport.id,i.canvas,6);r&&(this._selectLine(r),this.configuration.draggable&&this._startManipulation(n,r,"translate"),e.preventDefault())},this.handleSelectedCallback=(e,t,n,i="Mouse")=>{let{element:a}=e.detail,r=this._pendingHandle;if(this._pendingHandle=null,!r)return;let{operation:o,lineInfo:s}=r;("rotate"!==o||this.configuration.rotatable)&&("slabThickness"!==o||this.configuration.slabThicknessControls)&&(this._selectLine(s),this._startManipulation(a,s,o),e.preventDefault())},this.doubleClickCallback=e=>{let{setWorldCrosshairOnIntersectionDoubleClick:t,jumpToIntersectionOnDoubleClick:n}=this.configuration;if(!t&&!n)return;let{element:i,currentPoints:a}=e.detail,r=(0,M.kJ)(i);if(!r)return;let{viewport:o}=r,s=this._findLineNear(o.id,a.canvas,6);if(!s)return;let l=this._closestPointOnLine(s.line,a.world);if(n&&this._centerViewportOnPoint(o,l),t){let e=(0,tT.getToolGroup)(this.toolGroupId)?.getToolInstance?.("WorldCrosshair");e?.setWorldPoint?.(l,{sourceViewportId:o.id,sourceRenderingEngineId:r.renderingEngine?.id,frameOfReferenceUID:r.FrameOfReferenceUID})}e.preventDefault()},this.mouseMoveCallback=(e,t)=>{let{element:n,currentPoints:i}=e.detail,a=(0,M.kJ)(n);if(!a)return!1;let{viewport:r}=a;if(!this._isPlanarViewport(r))return!1;let o=this._findLineNear(r.id,i.canvas,6,!0),s=!1;return o?(this._activeGroupId!==o.groupId||this._activeTargetViewportId!==r.id)&&(this._activeGroupId=o.groupId,this._activeTargetViewportId=r.id,s=!0):this._activeTargetViewportId===r.id&&(this._activeTargetViewportId=void 0,s=!0),s},this.filterInteractableAnnotationsForElement=(e,t)=>{if(!t?.length)return[];let n=(0,M.kJ)(e);if(!n)return[];let{viewportId:i}=n;return t.filter(e=>e.data.viewportId===i)},this.cancel=e=>{this._editData&&this._endManipulation(e,{suppressEvents:!1})},this._endCallback=e=>{let{element:t}=e.detail;this._endManipulation(t)},this._dragCallback=e=>{let t=this._editData;if(!t)return;let n=t.memberViewportIds.map(e=>this._getViewportById(e)).filter(Boolean);if(n.length){switch(t.operation){case"translate":this._applyTranslate(n,e,t);break;case"rotate":this._applyRotate(n,e,t);break;case"slabThickness":this._applySlabThickness(n,e,t)}this._renderToolViewports()}}}getState(){return{toolGroupId:this.toolGroupId,activeGroupId:this._activeGroupId,activeTargetViewportId:this._activeTargetViewportId,activeOperation:this._activeOperation}}getPlaneGroups(){return this._getPlaneGroups().map(e=>({...e,viewportIds:[...e.viewportIds]}))}refreshPlaneFamilies(){this._mprFamilyByViewportId.clear(),this._clearPassCaches(),this._renderToolViewports()}onSetToolEnabled(){this.configuration.alignGroupsOnEnable&&this._alignPlaneGroups(),this._renderToolViewports()}onSetToolActive(){this.onSetToolEnabled()}onSetToolPassive(){this.onSetToolEnabled()}onSetToolDisabled(){this._editData=null,this._pendingHandle=null,this._activeOperation=null,this._activeGroupId=void 0,this._activeTargetViewportId=void 0,e6.wk.isInteractingWithTool=!1,this._renderedLines.clear(),this._mprFamilyByViewportId.clear(),this._clearPassCaches(),this._getViewportsInfo().forEach(({viewportId:e,renderingEngineId:t})=>{let n=(0,M.b1)(e,t);if(!n)return;let i=(0,y.getAnnotations)(this.getToolName(),n.viewport.element);i?.forEach(e=>{(0,y.removeAnnotation)(e.annotationUID)})})}_getMprFamily(e){let t=this._mprFamilyByViewportId.get(e.id);if(t)return t;let n=rk(e);if(!n)return null;let[i,a,r]=n.normal.map(Math.abs),o=r>=i&&r>=a?"axial":i>=a?"sagittal":"coronal";return this._mprFamilyByViewportId.set(e.id,o),o}_getPlaneGroups(){return this._passPlaneGroups||(this._passPlaneGroups=this._computePlaneGroups(),this._schedulePassCacheClear()),this._passPlaneGroups}_computePlaneGroups(){let e=this._getToolGroupViewports().filter(e=>this._isPlanarViewport(e));if(this.configuration.perViewportLines)return e.map(e=>{let t=this._getMprFamily(e),n=e.getFrameOfReferenceUID?.();return t&&n?{id:e.id,family:t,frameOfReferenceUID:n,viewportIds:[e.id],leaderViewportId:e.id}:null}).filter(Boolean);let t=new Map;return e.forEach(e=>{let n=this._getMprFamily(e),i=e.getFrameOfReferenceUID?.();if(!n||!i)return;let a=`${i}:${n}`,r=t.get(a);r||(r={id:a,family:n,frameOfReferenceUID:i,viewportIds:[],leaderViewportId:e.id},t.set(a,r)),r.viewportIds.push(e.id);let o=this._getViewportById(r.leaderViewportId);!this._isVolumeModeViewport(o)&&this._isVolumeModeViewport(e)&&(r.leaderViewportId=e.id)}),[...t.values()]}_alignPlaneGroups(){let e=e6.wk.isInteractingWithTool;e6.wk.isInteractingWithTool=!0;try{this._getPlaneGroups().forEach(e=>{if(e.viewportIds.length<2)return;let t=this._getViewportById(e.leaderViewportId),n=t&&rk(t);n&&e.viewportIds.forEach(t=>{if(t===e.leaderViewportId)return;let i=this._getViewportById(t);i&&this._isPlanarViewport(i)&&rH(i,n.point)&&i.render()})})}finally{e6.wk.isInteractingWithTool=e}}_computeLinesForTarget(e){if(!e||!this._isPlanarViewport(e))return[];let t=rk(e);if(!t)return[];let n=e.getFrameOfReferenceUID?.();if(!n)return[];let i=[];return this._getPlaneGroups().forEach(a=>{if(a.frameOfReferenceUID!==n||a.viewportIds.includes(e.id))return;let r=this._computeLineForGroup(e,t,a);r&&i.push(r)}),i}_computeLineForGroup(e,t,n){let i=this._getViewportById(n.leaderViewportId);if(!i)return null;let a=rk(i);if(!a)return null;let r=rx(t,a);if(!r)return null;let o=rU(r,e);if(!o)return null;let{familyColors:s,getLineColor:l}=this.configuration,d=l?.(n.family,n.id,e.id)??s?.[n.family]??"rgb(0, 200, 200)",c=this._activeGroupId===n.id&&this._activeTargetViewportId===e.id,h={groupId:n.id,family:n.family,leaderViewportId:n.leaderViewportId,memberViewportIds:[...n.viewportIds],targetViewportId:e.id,line:r,leaderPlane:a,canvasPoints:o,slabLineSegments:[],boundaryLineSegments:[],rotateHandles:[],slabHandles:[],color:d,isActive:c};return this._appendSlabGeometry(h,e,t,i,a),this._appendBoundaryGeometry(h,e,t,i,a),c&&this._appendHandles(h,e,i),h}_clipOffsetPlaneIntersection(e,t,n,i){let a=rx(t,{normal:n.normal,point:[n.point[0]+n.normal[0]*i,n.point[1]+n.normal[1]*i,n.point[2]+n.normal[2]*i]});return a?rU(a,e):null}_appendSlabGeometry(e,t,n,i,a){if(!this.configuration.showSlabThickness||!this._isVolumeModeViewport(i))return;let r=this._getSourceSlabThickness(i);r&&!(r<=sy.MINIMUM_SLAB_THICKNESS)&&[r/2,-r/2].forEach(i=>{let r=this._clipOffsetPlaneIntersection(t,n,a,i);r&&e.slabLineSegments.push(r)})}_appendBoundaryGeometry(e,t,n,i,a){let{showBoundaryLines:r,showIntermediateLines:o}=this.configuration;if(!r&&!o)return;let s=this._getSourceExtentAlongNormal(i,a);if(!s)return;let{minOffset:l,maxOffset:d,spacing:c}=s,h=[];if(r&&h.push(l,d),o&&c>0){let e=Math.max(c,(d-l)/50);for(let t=Math.ceil(l/e)*e;t1e-6&&h.push(t)}h.forEach(i=>{let r=this._clipOffsetPlaneIntersection(t,n,a,i);r&&e.boundaryLineSegments.push(r)})}_getSourceExtentAlongNormal(e,t){let n;try{n=e.getImageData?.()}catch{return null}let i=n?.imageData?.getBounds?.();if(!i||6!==i.length)return null;let[a,r,o,s,l,d]=i,c=1/0,h=-1/0;if([[a,o,l],[r,o,l],[a,s,l],[r,s,l],[a,o,d],[r,o,d],[a,s,d],[r,s,d]].forEach(e=>{let n=rL(e,t);c=Math.min(c,n),h=Math.max(h,n)}),!Number.isFinite(c)||!Number.isFinite(h))return null;let u=Math.min(...(n?.spacing??[]).filter(e=>Number.isFinite(e)&&e>0),1/0);return{minOffset:c,maxOffset:h,spacing:Number.isFinite(u)?u:0}}_appendHandles(e,t,n){let{rotatable:i,slabThicknessControls:a,showSlabThickness:r}=this.configuration,[o,s]=e.canvasPoints,l=this._isVolumeModeViewport(n);i&&l&&(e.rotateHandles=[.25,.75].map(e=>[o[0]+(s[0]-o[0])*e,o[1]+(s[1]-o[1])*e])),a&&r&&l&&(e.slabHandles=this._computeSlabHandles(e,t,n))}_computeSlabHandles(e,t,n){let[i,a]=e.canvasPoints,r=[i[0]+(a[0]-i[0])*.85,i[1]+(a[1]-i[1])*.85],o=this._getSourceSlabThickness(n),s=t.canvasToWorld(r),{normal:l}=e.leaderPlane,d=[s[0]+l[0]*(o/2),s[1]+l[1]*(o/2),s[2]+l[2]*(o/2)],c=t.worldToCanvas(d);if(Math.hypot(c[0]-r[0],c[1]-r[1])>=12){let e=[s[0]-l[0]*(o/2),s[1]-l[1]*(o/2),s[2]-l[2]*(o/2)];return[c,t.worldToCanvas(e)]}let h=rK.S8(rK.vt(),rK.Re(rK.vt(),a,i)),u=[-h[1],h[0]];return[[r[0]+12*u[0],r[1]+12*u[1]],[r[0]-12*u[0],r[1]-12*u[1]]]}getHandleNearImagePoint(e,t,n,i){this._pendingHandle=null;let a=(0,M.kJ)(e);if(a)for(let e of this._renderedLines.get(a.viewport.id)??[]){if(e.rotateHandles.some(e=>Math.hypot(e[0]-n[0],e[1]-n[1])<=this.configuration.handleRadius+i))return this._pendingHandle={operation:"rotate",lineInfo:e},e.line.point;if(e.slabHandles.some(e=>Math.hypot(e[0]-n[0],e[1]-n[1])<=this.configuration.handleRadius+i))return this._pendingHandle={operation:"slabThickness",lineInfo:e},e.line.point}}_startManipulation(e,t,n){let i=this._getViewportById(t.targetViewportId);if(this._editData={targetViewportId:t.targetViewportId,groupId:t.groupId,family:t.family,memberViewportIds:[...t.memberViewportIds],operation:n},"rotate"===n&&i){let e=rk(i);this._editData.rotationAxis=e?.normal,this._editData.pivotWorld=this._resolveRotationPivot(i,t)}this._activeOperation=n,(0,oK.lY)(e),this._activateModify(e),(0,M.Hl)(M.tX,S.sV.SLICE_INTERSECTION_MANIPULATION_STARTED,this._getManipulationDetail(n))}_endManipulation(e,{suppressEvents:t=!1}={}){let n=this._editData;this._deactivateModify(e),(0,oK.Q_)(e),this._editData=null,this._activeOperation=null,n&&!t&&(0,M.Hl)(M.tX,S.sV.SLICE_INTERSECTION_MANIPULATION_ENDED,this._getManipulationDetail(n.operation,n)),this._renderToolViewports()}_applyTranslate(e,t,n){let i=t.detail.startPoints?.world,a=t.detail.currentPoints?.world,r=t.detail.deltaPoints?.world,o=i&&a?e7.Re(e7.vt(),a,i):r;if(!o)return;let s=!!(i&&a),l=n?.memberStartPlanePoints??new Map;n&&(n.memberStartPlanePoints=l),e.forEach(e=>{let t=rk(e);if(!t)return;if(!s){(function(e,t){let n;if(!e||!Number.isFinite(t)||0===t)return!1;try{n=(0,i$.A)(e)}catch{return!1}let i=n?.viewPlaneNormal,a=n?.focalPoint,r=n?.position;if(!i||!a||!r)return!1;let o=e7.Ln(e7.vt(),a,i,t),s=e7.Ln(e7.vt(),r,i,t);return M.BF.isGenericViewport(e)?rH(e,[o[0],o[1],o[2]]):(e.setCamera({focalPoint:[o[0],o[1],o[2]],position:[s[0],s[1],s[2]]}),!0)})(e,e7.Om(o,t.normal))&&e.render();return}let n=l.get(e.id);n||(n=[...t.point],l.set(e.id,n));let i=e7.Om(o,t.normal);rH(e,[n[0]+t.normal[0]*i,n[1]+t.normal[1]*i,n[2]+t.normal[2]*i])&&e.render()})}_applyRotate(e,t,n){let{pivotWorld:i,rotationAxis:a,targetViewportId:r}=n;if(!i||!a)return;let o=this._getViewportById(r);if(!o)return;let s=t.detail,l=s.currentPoints?.canvas,d=s.deltaPoints?.canvas;if(!l||!d)return;let c=o.worldToCanvas(i),h=[l[0]-d[0],l[1]-d[1]],u=rK.Re(rK.vt(),h,c),g=rK.Re(rK.vt(),l,c);if(1e-6>rK.Bw(u)||1e-6>rK.Bw(g))return;let p=rK.g7(u,g);if(!Number.isFinite(p)||0===p||(u[0]*g[1]-u[1]*g[0]>0&&(p*=-1),0==(p=Math.round(100*p)/100)))return;let m=e7.S8(e7.vt(),a);if(1e-10>e7.Bw(m))return;let f=r$.fromRotation(r$.create(),p,m);f&&(n.memberStartScales??=new Map,e.forEach(e=>{if(!this._isVolumeModeViewport(e))return;let{viewPlaneNormal:t,viewUp:a}=(0,i$.A)(e);if(!t||!a)return;n.memberStartScales.has(e.id)||n.memberStartScales.set(e.id,e.getScale?.()??null);let r=e7.Z0(e7.vt(),t,f),o=e7.Z0(e7.vt(),a,f);e.setViewReference({viewPlaneNormal:[r[0],r[1],r[2]],viewUp:[o[0],o[1],o[2]],cameraFocalPoint:[i[0],i[1],i[2]]});let s=n.memberStartScales.get(e.id);s&&e.setScale?.(s),e.render()}))}_applySlabThickness(e,t,n){let i=t.detail.currentPoints?.world;if(!i)return;let a=e.find(e=>this._isVolumeModeViewport(e)),r=a&&rk(a);if(!r)return;let o=Math.max(sy.MINIMUM_SLAB_THICKNESS,2*Math.abs(rL(i,r))),s=!1;e.forEach(e=>{this._setViewportSlabThickness(e,o)&&(s=!0)}),s&&(0,M.Hl)(M.tX,S.sV.SLICE_INTERSECTION_SLAB_THICKNESS_CHANGED,this._getManipulationDetail("slabThickness",n))}_setViewportSlabThickness(e,t){if(!this._isVolumeModeViewport(e))return!1;let n=this._getSourceDataId(e);if(!n||1e-6>Math.abs(this._getSourceSlabThickness(e)-t))return!1;let i=this.configuration.slabThicknessBlendMode;return t<=sy.MINIMUM_SLAB_THICKNESS&&(i=M.fX.gd.COMPOSITE),e.setDisplaySetPresentation(n,{slabThickness:t,blendMode:i}),e.render(),!0}_isPlanarViewport(e){return e?.type===sM.PLANAR_NEXT&&M.BF.isGenericViewport(e)}_isVolumeModeViewport(e){if(!e||!this._isPlanarViewport(e))return!1;try{return e.getCurrentMode?.()==="volume"}catch{return!1}}_getSourceDataId(e){if(M.BF.viewportSupportsDisplaySetPresentation(e))return e.getSourceDataId()}_getSourceSlabThickness(e){let t=this._getSourceDataId(e);if(!t)return sy.MINIMUM_SLAB_THICKNESS;let n=e.getDisplaySetPresentation(t),i=n?.slabThickness;return Number.isFinite(i)&&i>0?i:sy.MINIMUM_SLAB_THICKNESS}_resolveRotationPivot(e,t){let{rotationPivotPolicy:n}=this.configuration;if("worldCrosshairPointIfAvailable"===n){let e=(0,tT.getToolGroup)(this.toolGroupId)?.getToolInstance?.("WorldCrosshair"),t=e?.getWorldPoint?.();if(t)return t}if("viewportCenter"===n){let{focalPoint:t}=(0,i$.A)(e);if(t)return t}let{focalPoint:i}=(0,i$.A)(e);return this._closestPointOnLine(t.line,i??t.line.point)}_closestPointOnLine(e,t){let n=e7.Re(e7.vt(),t,e.point),i=e7.Om(n,e.direction);return[e.point[0]+e.direction[0]*i,e.point[1]+e.direction[1]*i,e.point[2]+e.direction[2]*i]}_centerViewportOnPoint(e,t){this._isPlanarViewport(e)&&(e.setViewState({anchorWorld:[t[0],t[1],t[2]],anchorCanvas:[.5,.5]}),e.render())}_selectLine(e){this._activeGroupId=e.groupId,this._activeTargetViewportId=e.targetViewportId,(0,M.Hl)(M.tX,S.sV.SLICE_INTERSECTION_LINE_SELECTED,{toolGroupId:this.toolGroupId,groupId:e.groupId,targetViewportId:e.targetViewportId})}_findLineNear(e,t,n,i=!1){let a=this._renderedLines.get(e)??[],r=this.configuration.handleRadius+n;for(let e of a)if(oZ.A(e.canvasPoints[0],e.canvasPoints[1],t)<=n||i&&[...e.rotateHandles,...e.slabHandles].some(e=>Math.hypot(e[0]-t[0],e[1]-t[1])<=r))return e;return null}_getViewportsInfo(){return(0,tT.getToolGroup)(this.toolGroupId)?.viewportsInfo??[]}_getToolGroupViewports(){return this._getViewportsInfo().map(({viewportId:e,renderingEngineId:t})=>(0,M.b1)(e,t)?.viewport).filter(Boolean)}_getViewportById(e){if(e)return this._passViewportsById||(this._passViewportsById=new Map(this._getToolGroupViewports().map(e=>[e.id,e])),this._schedulePassCacheClear()),this._passViewportsById.get(e)}_clearPassCaches(){this._passViewportsById=null,this._passPlaneGroups=null}_schedulePassCacheClear(){this._passCacheClearScheduled||(this._passCacheClearScheduled=!0,queueMicrotask(()=>{this._passCacheClearScheduled=!1,this._clearPassCaches()}))}_renderToolViewports(){let e=this._getViewportsInfo().map(({viewportId:e})=>e);e.length&&(0,tr.A)(e)}_getOrCreateViewportAnnotation(e){let{element:t}=e;if(!t)return null;let n=(0,y.getAnnotations)(this.getToolName(),t),i=n?.find(t=>t.data.viewportId===e.id);if(i)return i;let a={highlighted:!1,invalidated:!1,metadata:{toolName:this.getToolName(),FrameOfReferenceUID:e.getFrameOfReferenceUID?.()},data:{viewportId:e.id,handles:{points:[]}}};return(0,y.addAnnotation)(a,t),a}_createDetachedAnnotation(){return{annotationUID:M.BF.uuidv4(),highlighted:!1,invalidated:!1,metadata:{toolName:this.getToolName()},data:{viewportId:"",handles:{points:[]}}}}_getManipulationDetail(e,t=this._editData){return{toolGroupId:this.toolGroupId,groupId:t?.groupId??this._activeGroupId??"",family:t?.family,viewportIds:t?.memberViewportIds??[],targetViewportId:t?.targetViewportId??this._activeTargetViewportId??"",operation:e}}}sS.toolLabel="Slice Intersections",sS.toolName="SliceIntersection";let sT="magnify-viewport";class sD extends oL.oS{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{magnifySize:10,magnifyWidth:250,magnifyHeight:250,touchOffset:40}}){super(e,t),this._hasBeenRemoved=!1,this.preMouseDownCallback=e=>{let{element:t,currentPoints:n}=e.detail,i=(0,M.kJ)(t),{viewport:a,renderingEngine:r}=i;if(!(a instanceof M.hS)&&!M.BF.isGenericViewport(a))throw Error("MagnifyTool only works on Stack or native planar viewports");let o=this._getReferencedImageId(a);if(!o)throw Error("MagnifyTool: No referenced image id found, reconstructed planes not supported yet");let s=(0,ta.Q0)(t,this.getToolName()),l=e.type===S.sV.TOUCH_START;return this.editData={referencedImageId:o,viewportIdsToRender:s,enabledElement:i,renderingEngine:r,currentPoints:n,isTouch:l},this._createMagnificationViewport(),this._activateDraw(t),(0,oK.lY)(t),e.preventDefault(),(0,tr.A)(s),!0},this.preTouchStartCallback=e=>{this.preMouseDownCallback(e)},this._positionMagnifyElement=(e,t,n)=>{let{magnifyWidth:i,magnifyHeight:a,touchOffset:r}=this.configuration,o=t[0]-i/2,s=t[1]-a/2;if(this.editData?.isTouch){s=t[1]-a-(r??0);let e=Math.max(n.clientWidth-i,0),l=Math.max(n.clientHeight-a,0);o=Math.min(Math.max(o,0),e),s=Math.min(Math.max(s,0),l)}e.style.top=`${s}px`,e.style.left=`${o}px`},this._createMagnificationViewport=()=>{let e,{enabledElement:t,referencedImageId:n,viewportIdsToRender:i,renderingEngine:a,currentPoints:r}=this.editData,{viewport:o}=t,{element:s}=o,l=M.BF.isGenericViewport(o)?rW(o):void 0,d=l?l.properties:o.getProperties(),{rotation:c,flipHorizontal:h,flipVertical:u}=l??o.getViewPresentation(),{canvas:g,world:p}=r;if(null===(e=s.querySelector(".magnifyTool"))){let t=document.createElement("div");t.classList.add("magnifyTool"),t.style.display="block",t.style.width=`${this.configuration.magnifyWidth}px`,t.style.height=`${this.configuration.magnifyHeight}px`,t.style.position="absolute",e=t,s.querySelector(".viewport-element").appendChild(t);let n={viewportId:sT,type:M.fX.NV.STACK,element:e};a.enableElement(n)}this._positionMagnifyElement(e,g,s);let m=a.getViewport(sT);m.setStack([n]).then(()=>{let e;if(this._hasBeenRemoved)return;m.setProperties(d),m.setViewPresentation({rotation:c,flipHorizontal:h,flipVertical:u});let{focalPoint:t,position:n,viewPlaneNormal:i}=m.getCamera();if(M.BF.isGenericViewport(o)){let t=o.element,n=o.canvasToWorld([0,0]),i=o.canvasToWorld([0,1]);e=e7.Io(n,i)*t.clientHeight/2}else({parallelScale:e}=o.getCamera());let a=Math.sqrt(Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2)+Math.pow(t[2]-n[2],2)),r=[p[0],p[1],p[2]],s=[r[0]+a*i[0],r[1]+a*i[1],r[2]+a*i[2]];m.setCamera({parallelScale:e*(1/this.configuration.magnifySize),focalPoint:r,position:s}),m.render()}),e.style.display="block",(0,tr.A)(i)},this._cancelCallback=e=>{e.preventDefault(),e.stopPropagation(),this._dragEndCallback(e)},this._dragCallback=e=>{let{deltaPoints:t,element:n,currentPoints:i}=e.detail,a=t.world,r=i.canvas,{renderingEngine:o}=(0,M.kJ)(n),s=o.getViewport(sT),l=n.querySelector(".magnifyTool");if(!l)return;this._positionMagnifyElement(l,r,n);let{focalPoint:d,position:c}=s.getCamera(),h=[c[0]+a[0],c[1]+a[1],c[2]+a[2]],u=[d[0]+a[0],d[1]+a[1],d[2]+a[2]];s.setCamera({focalPoint:u,position:h}),s.render()},this._dragEndCallback=e=>{let{element:t}=e.detail;if(void 0===t){let{enabledElement:e}=this.editData,{viewport:n}=e;t=n.element}let{renderingEngine:n}=(0,M.kJ)(t);n.disableElement(sT);let i=t.querySelector(".viewport-element"),a=i.querySelector(".magnifyTool");i.removeChild(a),this._deactivateDraw(t),(0,oK.Q_)(t),this._hasBeenRemoved=!0},this._activateDraw=e=>{e6.wk.isInteractingWithTool=!0,this._hasBeenRemoved=!1,e.addEventListener(S.sV.MOUSE_UP,this._dragEndCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._dragEndCallback),e.addEventListener("contextmenu",this._cancelCallback),e.addEventListener(S.sV.TOUCH_END,this._dragEndCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this._deactivateDraw=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._dragEndCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._dragEndCallback),e.removeEventListener("contextmenu",this._cancelCallback),e.removeEventListener(S.sV.TOUCH_END,this._dragEndCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback)}}_getReferencedImageId(e){let t,n=this.getTargetId(e);return e instanceof M.hS?t=n.split("imageId:")[1]:M.BF.isGenericViewport(e)&&(t=rW(e).currentImageId),t}}sD.toolName="Magnify";var sP=n(20644);function sk(e){let[t,n]=e;return(0,sP.A)(t,n)}var sx=n(87635);let{sV:sL}=M.fX,sV=e=>!!e.representationUID;(s||(s={})).ShowZoomFactorsList="showZoomFactorsList";let sO="AdvancedMagnify",sR=1-M.Jj.p8;class sN extends oL.EC{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{shadow:!0,magnifyingGlass:{radius:125,zoomFactor:3,zoomFactorList:[1.5,2,2.5,3,3.5,4,4.5,5],autoPan:{enabled:!0,padding:10}},actions:{showZoomFactorsList:{method:"showZoomFactorsList",bindings:[{mouseButton:S.iP.Secondary,modifierKey:S.qv.Shift}]}}}}){super(e,t),this.addNewAnnotation=e=>{let{currentPoints:t,element:n}=e.detail,i=(0,M.kJ)(n),{viewport:a,renderingEngine:r}=i,o=t.world,s=t.canvas,{magnifyingGlass:l}=this.configuration,{radius:d,zoomFactor:c,autoPan:h}=l,u=this._getWorldHandlePoints(a,s,d),g=M.BF.isGenericViewport(a),{viewPlaneNormal:p,viewUp:m}=g?(0,i$.A)(a):a.getCamera(),f=g?rW(a).currentImageId:this.getReferencedImageId(a,o,p,m),v=M.BF.uuidv4(),I=M.BF.uuidv4(),_=a.getFrameOfReferenceUID(),w={annotationUID:v,highlighted:!0,invalidated:!0,metadata:{toolName:this.getToolName(),viewPlaneNormal:[...p],viewUp:[...m],FrameOfReferenceUID:_,referencedImageId:f},data:{sourceViewportId:a.id,magnifyViewportId:I,zoomFactor:c,isCanvasAnnotation:!1,handles:{points:u,activeHandleIndex:null}}};this.magnifyViewportManager.createViewport(w,{magnifyViewportId:I,sourceEnabledElement:i,position:s,radius:d,zoomFactor:c,autoPan:{enabled:h.enabled,padding:h.padding,callback:e=>{let t=w.data.handles.points,{world:n}=e.delta;for(let e=0,i=t.length;e{this.magnifyViewportManager.dispose(),(0,y.getAllAnnotations)().forEach(e=>{e.metadata.toolName===this.getToolName()&&(0,y.removeAnnotation)(e.annotationUID)})},this.isPointNearTool=(e,t,n,i,a)=>{let{viewport:r}=(0,M.kJ)(e),{points:o}=t.data.handles,{radius:s,center:l}=this._getCanvasCircleData(r,o),d=sk([l,n]);return!!(Math.abs(d-s)<2*i)||"touch"===a&&!!(d{let{element:n}=e.detail;t.highlighted=!0;let i=(0,ta.Q0)(n,this.getToolName());this.editData={annotation:t,viewportIdsToRender:i},(0,oK.lY)(n),this._activateModify(n),(0,tr.A)(i),e.preventDefault()},this.handleSelectedCallback=(e,t,n)=>{let{element:i}=e.detail,{data:a}=t;t.highlighted=!0;let{points:r}=a.handles,o=r.findIndex(e=>e===n),s=(0,ta.Q0)(i,this.getToolName());this.editData={annotation:t,viewportIdsToRender:s,handleIndex:o},this._activateModify(i),(0,oK.lY)(i),(0,tr.A)(s),e.preventDefault()},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:i,newAnnotation:a}=this.editData,{data:r}=n;r.handles.activeHandleIndex=null,this._deactivateModify(t),(0,oK.Q_)(t),this.editData=null,this.isDrawing=!1,(0,tr.A)(i),a&&(0,tu.triggerAnnotationCompleted)(n)},this._dragDrawCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{viewport:i}=(0,M.kJ)(n),{deltaPoints:a}=t,r=a?.canvas??[0,0,0],{annotation:o,viewportIdsToRender:s}=this.editData,{points:l}=o.data.handles,d=this._getWorldDeltaFromCanvasDelta(i,l,r);this._applyWorldDelta(l,d),o.invalidated=!0,this.editData.hasMoved=!0,(0,tr.A)(s)},this._dragModifyCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{annotation:i,viewportIdsToRender:a,handleIndex:r}=this.editData,{data:o}=i;if(void 0===r){let{deltaPoints:e}=t,a=e.canvas??[0,0,0],r=o.handles.points,s=this._getWorldDeltaFromCanvasDelta((0,M.kJ)(n).viewport,r,a);this._applyWorldDelta(r,s),i.invalidated=!0}else this._dragHandle(e),i.invalidated=!0;(0,tr.A)(a)},this._pressModifyCallback=e=>{let{element:t,startPoints:n}=e.detail,i=this.editData.annotation,a=sN.TOUCH_PROXIMITY;this.isPointNearTool(t,i,n.canvas,a)&&(e.stopImmediatePropagation(),this._endCallback(e),this.showZoomFactorsList(e,i))},this._dragHandle=e=>{let t=e.detail,{element:n}=t,{viewport:i}=(0,M.kJ)(n),{annotation:a}=this.editData,{data:r}=a,{points:o}=r.handles,{center:s}=this._getCanvasCircleData(i,o),{currentPoints:l}=t,d=sk([s,l.canvas]),c=this._getCanvasHandlePoints(s,d).map(e=>i.canvasToWorld(e));o[0]=c[0],o[1]=c[1],o[2]=c[2],o[3]=c[3]},this.cancel=e=>{if(!this.isDrawing)return;this.isDrawing=!1,this._deactivateModify(e),(0,oK.Q_)(e);let{annotation:t,viewportIdsToRender:n,newAnnotation:i}=this.editData,{data:a}=t;return t.highlighted=!1,a.handles.activeHandleIndex=null,(0,tr.A)(n),i&&(0,tu.triggerAnnotationCompleted)(t),this.editData=null,t.annotationUID},this._activateModify=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragModifyCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragModifyCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback),e.addEventListener(S.sV.TOUCH_PRESS,this._pressModifyCallback)},this._deactivateModify=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragModifyCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragModifyCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback),e.removeEventListener(S.sV.TOUCH_PRESS,this._pressModifyCallback)},this.renderAnnotation=(e,t)=>{let n=!1,{viewport:i}=e,{element:a}=i,r=(0,y.getAnnotations)(this.getToolName(),a);if(!r?.length)return n;r=r?.filter(e=>e.data.sourceViewportId===i.id);let o=this.filterInteractableAnnotationsForElement(a,r);if(!o?.length)return n;let s={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let e=0;e{let{element:t,startPoints:n}=e.detail,i=(0,M.kJ)(t);if(!i)return;let{viewport:a}=i,r=n.canvas,o=sN.TOUCH_PROXIMITY,s=((0,y.getAnnotations)(this.getToolName(),t)??[]).filter(e=>e.data.sourceViewportId===a.id).find(e=>(0,nM.YY)(e.annotationUID)&&!(0,nE.Gh)(e.annotationUID)&&this.isPointNearTool(t,e,r,o));s&&this.showZoomFactorsList(e,s)},this._getWorldHandlePoints=(e,t,n)=>this._getCanvasHandlePoints(t,n).map(t=>e.canvasToWorld(t)),this._getCanvasCircleData=(e,t)=>{let n=t.map(t=>e.worldToCanvas(t)),i=n[0],a=n[2],r=n[3],o=.5*Math.abs(a[1]-i[1]);return{canvasPoints:n,center:[r[0]+o,i[1]+o],radius:o}},this._getCanvasHandlePoints=(e,t)=>[[e[0],e[1]-t,0],[e[0]+t,e[1],0],[e[0],e[1]+t,0],[e[0]-t,e[1],0]],this.magnifyViewportManager=sU.getInstance()}showZoomFactorsList(e,t){let{element:n}=e.detail,i="currentPoints"in e.detail?e.detail.currentPoints:e.detail.startPoints,{viewport:a}=(0,M.kJ)(n),{canvas:r}=i,o=n.querySelector(":scope .viewport-element"),s=t.data.zoomFactor,l=this._getZoomFactorsListDropdown(s,e=>{void 0!==e&&(t.data.zoomFactor=Number.parseFloat(e),t.invalidated=!0),l.remove(),a.render()});Object.assign(l.style,{left:`${r[0]}px`,top:`${r[1]}px`}),o.appendChild(l),l.focus()}_getZoomFactorsListDropdown(e,t){let{zoomFactorList:n}=this.configuration.magnifyingGlass,i=document.createElement("select");i.size=5,Object.assign(i.style,{width:"50px",position:"absolute"}),["mousedown","mouseup","mousemove","click","touchstart","touchend","touchmove"].forEach(e=>{i.addEventListener(e,e=>e.stopPropagation())});let a=!1,r=e=>{a||(a=!0,t(e))};return i.addEventListener("change",e=>{e.stopPropagation(),r(i.value)}),i.addEventListener("click",e=>{e.stopPropagation(),e.target?.tagName==="OPTION"&&r(i.value)}),i.addEventListener("blur",()=>r(i.value)),i.addEventListener("keydown",e=>{((e.keyCode??27===e.which)||e.key?.toLowerCase()==="escape")&&(e.stopPropagation(),r())}),n.forEach(t=>{let n=document.createElement("option");n.label=t,n.title=`Zoom factor ${t.toFixed(1)}`,n.value=t,n.defaultSelected=t===e,i.add(n)}),i}_getWorldDeltaFromCanvasDelta(e,t,n){if(!n)return[0,0,0];let i=t[0],a=e.worldToCanvas(i),r=e.canvasToWorld([a[0]+n[0],a[1]+n[1]]);return[r[0]-i[0],r[1]-i[1],r[2]-i[2]]}_applyWorldDelta(e,t){if(t)for(let n=0,i=e.length;n{let{magnifyViewportId:n,sourceEnabledElement:i,position:a,radius:r,zoomFactor:o,autoPan:s}=t,{viewport:l}=i,{element:d}=l,c=new sF({magnifyViewportId:n,sourceEnabledElement:i,radius:r,position:a,zoomFactor:o,autoPan:s,annotation:e});return this._addSourceElementEventListener(d),this._magnifyViewportsMap.set(c.viewportId,{annotation:e,magnifyViewport:c,magnifyViewportInfo:t}),c},this._annotationRemovedCallback=e=>{let{annotation:t}=e.detail;t.metadata.toolName===sO&&this.destroyViewport(t.data.magnifyViewportId)},this._newStackImageCallback=e=>{let{viewportId:t,imageId:n}=e.detail,i=this._getMagnifyViewportsMapEntriesBySourceViewportId(t),{viewport:a}=(0,M.yj)(t);a.stackActorReInitialized&&this._reset(t),i.forEach(({annotation:e})=>{e.metadata.referencedImageId=n,e.invalidated=!0})},this._newVolumeImageCallback=e=>{let{renderingEngineId:t,viewportId:n}=e.detail,i=(0,M.lD)(t).getViewport(n),{viewPlaneNormal:a}=M.BF.isGenericViewport(i)?(0,i$.A)(i):i.getCamera();this._getMagnifyViewportsMapEntriesBySourceViewportId(n).forEach(({annotation:e})=>{let{viewPlaneNormal:t}=e.metadata;if(!(Math.abs(e7.Om(t,a))>sR))return;let{handles:n}=e.data,r=i.canvasToWorld([0,0]),o=e7.jb(e7.vt(),r,n.points[0]),s=e7.Om(o,a),l=e7.hs(e7.vt(),a,s);for(let e=0,t=n.points.length;ethis.destroyViewport(e))}_getMagnifyViewportsMapEntriesBySourceViewportId(e){return Array.from(this._magnifyViewportsMap.values()).filter(({magnifyViewport:t})=>{let{viewport:n}=t.sourceEnabledElement;return n.id===e})}_reset(e){this._getMagnifyViewportsMapEntriesBySourceViewportId(e).forEach(({magnifyViewport:t,annotation:n,magnifyViewportInfo:i})=>{this.destroyViewport(t.viewportId);let a=(0,M.yj)(e);this.createViewport(n,{...i,sourceEnabledElement:{...a}})})}_addEventListeners(){M.tX.addEventListener(S.sV.ANNOTATION_REMOVED,this._annotationRemovedCallback)}_removeEventListeners(){M.tX.removeEventListener(S.sV.ANNOTATION_REMOVED,this._annotationRemovedCallback)}_addSourceElementEventListener(e){e.addEventListener(sL.STACK_NEW_IMAGE,this._newStackImageCallback);let t=e=>{let{viewportId:t}=e.detail;this._reset(t)};e.addEventListener(sL.VIEWPORT_NEW_IMAGE_SET,t);let n=e=>{let{viewportId:t}=e.detail;this._reset(t)};e.addEventListener(sL.VOLUME_VIEWPORT_NEW_VOLUME,n),e.addEventListener(sL.VOLUME_NEW_IMAGE,this._newVolumeImageCallback),e.newStackHandler=t,e.newVolumeHandler=n}_removeSourceElementEventListener(e){e.removeEventListener(sL.STACK_NEW_IMAGE,this._newStackImageCallback),e.removeEventListener(sL.VOLUME_NEW_IMAGE,this._newVolumeImageCallback),e.removeEventListener(sL.VIEWPORT_NEW_IMAGE_SET,e.newStackHandler),e.removeEventListener(sL.VOLUME_VIEWPORT_NEW_VOLUME,e.newVolumeHandler),delete e.newStackHandler,delete e.newVolumeHandler}_initialize(){this._addEventListeners()}}class sF{constructor({magnifyViewportId:e,sourceEnabledElement:t,radius:n=125,position:i=[0,0],zoomFactor:a,autoPan:r,annotation:o}){this._enabledElement=null,this._sourceToolGroup=null,this._magnifyToolGroup=null,this._isViewportReady=!1,this._radius=0,this._resized=!1,this._canAutoPan=!1,this._viewportId=e??M.BF.uuidv4(),this._sourceEnabledElement=t,this._autoPan=r,this._annotation=o,this.radius=n,this.position=i,this.zoomFactor=a,this.visible=!0,this._browserMouseDownCallback=this._browserMouseDownCallback.bind(this),this._browserMouseUpCallback=this._browserMouseUpCallback.bind(this),this._browserTouchStartCallback=this._browserTouchStartCallback.bind(this),this._browserTouchEndCallback=this._browserTouchEndCallback.bind(this),this._touchPressCallback=this._touchPressCallback.bind(this),this._handleToolModeChanged=this._handleToolModeChanged.bind(this),this._mouseDragCallback=this._mouseDragCallback.bind(this),this._resizeViewportAsync=(0,sx.A)(this._resizeViewport.bind(this),1),this._initialize()}get sourceEnabledElement(){return this._sourceEnabledElement}get viewportId(){return this._viewportId}get radius(){return this._radius}set radius(e){Math.abs(this._radius-e)>1e-5&&(this._radius=e,this._resized=!0)}update(){let{radius:e,position:t,visible:n}=this,{viewport:i}=this._enabledElement,{element:a}=i,r=2*e,[o,s]=t;this._resized&&(this._resizeViewportAsync(),this._resized=!1),Object.assign(a.style,{display:n?"block":"hidden",width:`${r}px`,height:`${r}px`,left:`${-e}px`,top:`${-e}px`,transform:`translate(${o}px, ${s}px)`}),this._isViewportReady&&(this._syncViewports(),i.render())}dispose(){let{viewport:e}=this._enabledElement,{element:t}=e,n=e.getRenderingEngine();this._removeEventListeners(t),n.disableElement(e.id),t.parentNode&&t.parentNode.removeChild(t)}_handleToolModeChanged(e){let{_magnifyToolGroup:t}=this,{toolGroupId:n,toolName:i,mode:a,toolBindingsOptions:r}=e.detail;if(this._sourceToolGroup?.id===n)switch(a){case S.r$.Active:t.setToolActive(i,r);break;case S.r$.Passive:t.setToolPassive(i);break;case S.r$.Enabled:t.setToolEnabled(i);break;case S.r$.Disabled:t.setToolDisabled(i);break;default:throw Error(`Unknow tool mode (${a})`)}}_inheritBorderRadius(e){let t=e.querySelector(".viewport-element"),n=e.querySelector(".cornerstone-canvas");t.style.borderRadius="inherit",n.style.borderRadius="inherit"}_createViewportNode(){let e=document.createElement("div"),{radius:t}=this,n=2*t;return e.classList.add("advancedMagnifyTool"),Object.assign(e.style,{display:"block",width:`${n}px`,height:`${n}px`,position:"absolute",overflow:"hidden",borderRadius:"50%",boxSizing:"border-box",left:`${-t}px`,top:`${-t}px`,transform:"translate(-1000px, -1000px)"}),e}_convertZoomFactorToParallelScale(e,t,n){if(M.BF.isGenericViewport(e)){let i=e.element,a=i.clientWidth,r=i.clientHeight,o=e.canvasToWorld([0,0]),s=e.canvasToWorld([0,1]);return 1/n*(e7.Io(o,s)*r/2)*(t.canvas.offsetWidth/a)}let{parallelScale:i}=e.getCamera();return 1/n*i*(t.canvas.offsetWidth/e.canvas.offsetWidth)}_isStackViewport(e){return"setStack"in e}_isVolumeViewport(e){return"addVolumes"in e}_cloneToolGroups(e,t){let n=e.getActors(),i=`${t.id}-toolGroup`,a=(0,tT.getToolGroupForViewport)(e.id,e.renderingEngineId),r=a.clone(i,e=>{let t=a.getToolInstance(e);return t instanceof oL.EC&&!(t instanceof sN)});return r.addViewport(t.id,t.renderingEngineId),n.filter(sV).forEach(e=>{rw(this.viewportId,[{segmentationId:e.referencedId,type:S.D_.Labelmap}])}),{sourceToolGroup:a,magnifyToolGroup:r}}_cloneStack(e,t){let n=e.getImageIds();t.setStack(n).then(()=>{this._isViewportReady=!0,this.update()})}_cloneVolumes(e,t){let n=e.getActors().filter(e=>!sV(e)).map(e=>({volumeId:e.referencedId}));return t.setVolumes(n).then(()=>{this._isViewportReady=!0,this.update()}),t}_cloneViewport(e,t){let{viewportId:n}=this,i=e.getRenderingEngine(),{options:a}=e,r=M.BF.isGenericViewport(e),o={element:t,viewportId:n,type:r?M.fX.NV.STACK:e.type,defaultOptions:r?{}:{...a}};i.enableElement(o);let s=i.getViewport(n);r||this._isStackViewport(e)?this._cloneStack(e,s):this._isVolumeViewport(e)&&this._cloneVolumes(e,s),this._inheritBorderRadius(t);let l=this._cloneToolGroups(e,s);this._sourceToolGroup=l.sourceToolGroup,this._magnifyToolGroup=l.magnifyToolGroup}_cancelMouseEventCallback(e){e.stopPropagation(),e.preventDefault()}_browserMouseUpCallback(e){let{element:t}=this._enabledElement.viewport;document.removeEventListener("mouseup",this._browserMouseUpCallback),t.addEventListener("mouseup",this._cancelMouseEventCallback),t.addEventListener("mousemove",this._cancelMouseEventCallback)}_browserMouseDownCallback(e){let{element:t}=this._enabledElement.viewport;this._canAutoPan=!!e.target?.closest(".advancedMagnifyTool"),document.addEventListener("mouseup",this._browserMouseUpCallback),t.removeEventListener("mouseup",this._cancelMouseEventCallback),t.removeEventListener("mousemove",this._cancelMouseEventCallback)}_browserTouchEndCallback(e){if(e.touches?.length>0)return;let{element:t}=this._enabledElement.viewport;document.removeEventListener("touchend",this._browserTouchEndCallback),document.removeEventListener("touchcancel",this._browserTouchEndCallback),t.addEventListener("touchend",this._cancelMouseEventCallback,{passive:!1}),t.addEventListener("touchmove",this._cancelMouseEventCallback,{passive:!1})}_browserTouchStartCallback(e){let{element:t}=this._enabledElement.viewport;e.touches?.length===1&&(this._canAutoPan=!!e.target?.closest(".advancedMagnifyTool")),document.addEventListener("touchend",this._browserTouchEndCallback),document.addEventListener("touchcancel",this._browserTouchEndCallback),t.removeEventListener("touchend",this._cancelMouseEventCallback),t.removeEventListener("touchmove",this._cancelMouseEventCallback)}_mouseDragCallback(e){if(!e6.wk.isInteractingWithTool)return;let{_autoPan:t}=this;if(!t.enabled||!this._canAutoPan)return;let{currentPoints:n}=e.detail,{viewport:i}=this._enabledElement,{canvasToWorld:a}=i,{canvas:r}=n,{radius:o}=this,s=[o,o],l=(0,sP.A)(s,r),d=o-t.padding;if(l<=d)return;let c=rK.jb(rK.vt(),r,s);rK.S8(c,c),rK.hs(c,c,l-d);let h=rK.WQ(rK.vt(),this.position,c),u=a(this.position),g=a(h),p=e7.jb(e7.vt(),g,u),m={points:{currentPosition:{canvas:this.position,world:u},newPosition:{canvas:h,world:g}},delta:{canvas:c,world:p}};t.callback(m)}_touchPressCallback(e){if(e6.wk.isInteractingWithTool)return;let t=this._sourceToolGroup?.getToolInstance(sO);if(!t||!this._annotation)return;let{viewport:n}=this._sourceEnabledElement,i=e.detail.startPoints.canvas,a=[i[0]+this.position[0]-this.radius,i[1]+this.position[1]-this.radius];t.showZoomFactorsList({detail:{element:n.element,startPoints:{canvas:a}}},this._annotation)}_addBrowserEventListeners(e){document.addEventListener("mousedown",this._browserMouseDownCallback,!0),e.addEventListener("mousedown",this._cancelMouseEventCallback),e.addEventListener("mouseup",this._cancelMouseEventCallback),e.addEventListener("mousemove",this._cancelMouseEventCallback),e.addEventListener("dblclick",this._cancelMouseEventCallback),document.addEventListener("touchstart",this._browserTouchStartCallback,!0),e.addEventListener("touchstart",this._cancelMouseEventCallback,{passive:!1}),e.addEventListener("touchend",this._cancelMouseEventCallback,{passive:!1}),e.addEventListener("touchmove",this._cancelMouseEventCallback,{passive:!1})}_removeBrowserEventListeners(e){document.removeEventListener("mousedown",this._browserMouseDownCallback,!0),document.removeEventListener("mouseup",this._browserMouseUpCallback),e.removeEventListener("mousedown",this._cancelMouseEventCallback),e.removeEventListener("mouseup",this._cancelMouseEventCallback),e.removeEventListener("mousemove",this._cancelMouseEventCallback),e.removeEventListener("dblclick",this._cancelMouseEventCallback),document.removeEventListener("touchstart",this._browserTouchStartCallback,!0),document.removeEventListener("touchend",this._browserTouchEndCallback),document.removeEventListener("touchcancel",this._browserTouchEndCallback),e.removeEventListener("touchstart",this._cancelMouseEventCallback),e.removeEventListener("touchend",this._cancelMouseEventCallback),e.removeEventListener("touchmove",this._cancelMouseEventCallback)}_addEventListeners(e){M.tX.addEventListener(S.sV.TOOL_MODE_CHANGED,this._handleToolModeChanged),e.addEventListener(S.sV.MOUSE_MOVE,this._mouseDragCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._mouseDragCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._mouseDragCallback),e.addEventListener(S.sV.TOUCH_PRESS,this._touchPressCallback),this._addBrowserEventListeners(e)}_removeEventListeners(e){M.tX.removeEventListener(S.sV.TOOL_MODE_CHANGED,this._handleToolModeChanged),e.addEventListener(S.sV.MOUSE_MOVE,this._mouseDragCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._mouseDragCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._mouseDragCallback),e.removeEventListener(S.sV.TOUCH_PRESS,this._touchPressCallback),this._removeBrowserEventListeners(e)}_initialize(){let{_sourceEnabledElement:e}=this,{viewport:t}=e,{canvas:n}=t,i=this._createViewportNode();n.parentNode.appendChild(i),this._addEventListeners(i),this._cloneViewport(t,i),this._enabledElement=(0,M.kJ)(i)}_syncViewportsCameras(e,t){let n=e.canvasToWorld(this.position),i=this._convertZoomFactorToParallelScale(e,t,this.zoomFactor),{flipHorizontal:a,flipVertical:r}=(M.BF.isGenericViewport(e)?rW(e):void 0)??e.getCamera(),{focalPoint:o,position:s,viewPlaneNormal:l}=t.getCamera(),d=Math.sqrt(Math.pow(o[0]-s[0],2)+Math.pow(o[1]-s[1],2)+Math.pow(o[2]-s[2],2)),c=[n[0],n[1],n[2]],h=[c[0]+d*l[0],c[1]+d*l[1],c[2]+d*l[2]];t.setCamera({parallelScale:i,focalPoint:c,position:h,flipHorizontal:a,flipVertical:r})}_syncStackViewports(e,t){t.setImageIdIndex(e.getCurrentImageIdIndex())}_syncViewports(){let{viewport:e}=this._sourceEnabledElement,{viewport:t}=this._enabledElement,n=M.BF.isGenericViewport(e),i=n?rW(e).properties:e.getProperties();t.getImageData()&&(t.setProperties(i),this._syncViewportsCameras(e,t),(n||this._isStackViewport(e))&&this._syncStackViewports(e,t),this._syncViewportsCameras(e,t),t.render())}_resizeViewport(){let{viewport:e}=this._enabledElement;e.getRenderingEngine().resize()}}sN.toolName="AdvancedMagnify";var sB=n(77680);let{p8:sG}=M.Jj;class sH extends sB.A{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{sourceViewportId:"",enforceSameFrameOfReference:!0,showFullDimension:!1}}){super(e,t),this.editData=null,this._init=()=>{let e=(0,M.qO)()[0];if(!e)return;let t=e.getViewports();t=(0,ta.Zi)(t,this.getToolName());let n=e.getViewport(this.configuration.sourceViewportId);if(!n?.getImageData?.())return;let{element:i}=n,{viewUp:a,viewPlaneNormal:r}=(0,i$.A)(n),o=M.BF.getViewportImageCornersInWorld(n),s=this.editData?.annotation,l=n.getFrameOfReferenceUID();if(s)this.editData.annotation.data.handles.points=o;else{let e={highlighted:!0,invalidated:!0,metadata:{toolName:this.getToolName(),viewPlaneNormal:[...r],viewUp:[...a],FrameOfReferenceUID:l,referencedImageId:null},data:{handles:{points:o}}};(0,y.addAnnotation)(e,i),s=e}this.editData={sourceViewportId:n.id,renderingEngine:e,annotation:s},(0,tr.A)(t.filter(e=>e.id!==n.id).map(e=>e.id))},this.onSetToolEnabled=()=>{this._init()},this.onSetToolConfiguration=()=>{this._init()},this.onCameraModified=e=>{this._init()},this.renderAnnotation=(e,t)=>{let{viewport:n}=e;if(!this.editData)return!1;let{annotation:i,sourceViewportId:a}=this.editData,r=!1,{viewport:o}=(0,M.yj)(a)||{};if(!o||o.id===n.id||!i||!i?.data?.handles?.points||this.configuration.enforceSameFrameOfReference&&o.getFrameOfReferenceUID()!==n.getFrameOfReferenceUID())return r;let s={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id},l=i.data.handles.points[0],d=i.data.handles.points[1],c=i.data.handles.points[2],h=i.data.handles.points[3],{focalPoint:u,viewPlaneNormal:g,viewUp:p}=(0,i$.A)(n),{viewPlaneNormal:m}=(0,i$.A)(o);if(this.isParallel(g,m))return r;let f=M.BF.planar.planeEquation(g,u),v=[l,c,d,h],I=v,_=e7.Re(e7.vt(),v[0],v[1]);_=e7.S8(e7.vt(),_);let w=e7.Re(e7.vt(),v[2],v[0]);w=e7.S8(e7.vt(),w);let b=e7.$A(e7.vt(),_,w);if(this.isParallel(b,g))return r;this.isPerpendicular(_,g)&&(I=[l,d,c,h]);let C=M.BF.planar.linePlaneIntersection(I[0],I[1],f),A=M.BF.planar.linePlaneIntersection(I[2],I[3],f),{annotationUID:E}=i;s.annotationUID=E;let y=this.getStyle("lineWidth",s,i),S=this.getStyle("lineDash",s,i),T=this.getStyle("color",s,i),D=this.getStyle("shadow",s,i),P=[C,A].map(e=>n.worldToCanvas(e));if(this.configuration.showFullDimension&&(P=this.handleFullDimension(n,C,g,p,A,P)),P.length<2)return r;let k=`${E}-line`;return(0,aK.V6)(t,E,"1",P[0],P[1],{color:T,width:y,lineDash:S,shadow:D},k),r=!0},this.isPerpendicular=(e,t)=>Math.abs(e7.Om(e,t))M.BF.worldToImageCoords(l,e)),[u,g]=[t,a].map(e=>M.BF.worldToImageCoords(l,e));r=[[o,d],[d,c],[h,c],[o,h]].map(([e,t])=>this.intersectInfiniteLines(e,t,u,g)).filter(e=>e&&this.isInBound(e,i)).map(t=>{let n=M.BF.imageToWorldCoords(l,t);return e.worldToCanvas(n)})}catch(e){console.log(e)}return r}intersectInfiniteLines(e,t,n,i){let[a,r]=e,[o,s]=t,[l,d]=n,[c,h]=i,u=s-r,g=a-o,p=o*r-a*s,m=h-d,f=l-c,v=c*d-l*h;if(!(Math.abs(u*f-m*g)1-sG}isInBound(e,t){return e[0]>=0&&e[0]<=t[0]&&e[1]>=0&&e[1]<=t[1]}}sH.toolName="ReferenceLines";let{p8:sW}=M.Jj;class sX extends sB.A{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{sourceImageIds:[]}}){super(e,t),this.onSetToolEnabled=()=>{this._init()},this.onSetToolActive=()=>{this._init()},this._init=()=>{let e=this.configuration.sourceImageIds;if(!e?.length)return void console.warn("OverlayGridTool: No sourceImageIds provided in configuration");let t=M.wx.get("imagePlaneModule",e[0]);if(!t)return void console.warn("OverlayGridTool: No imagePlaneModule found for sourceImageIds");let{frameOfReferenceUID:n}=t,i=(0,tT.getToolGroup)(this.toolGroupId).viewportsInfo;if(!i?.length)return void console.warn("OverlayGridTool: No viewports found");let a=(0,y.getAnnotations)(this.getToolName(),n);if(!a?.length){let t=e.map(e=>this.calculateImageIdPointSets(e)),i={highlighted:!0,invalidated:!0,metadata:{toolName:this.getToolName(),FrameOfReferenceUID:n,referencedImageId:null},data:{viewportData:new Map,pointSets:t}};(0,y.addAnnotation)(i,n)}(0,tr.A)(i.map(({viewportId:e})=>e))},this.calculateImageIdPointSets=e=>{let{imagePositionPatient:t,rows:n,columns:i,rowCosines:a,columnCosines:r,rowPixelSpacing:o,columnPixelSpacing:s}=M.wx.get("imagePlaneModule",e),l=[...t],d=[...t],c=[...t],h=[...t];return e7.Ln(d,t,r,i*s),e7.Ln(c,t,a,n*o),e7.Ln(h,c,r,i*s),{pointSet1:[l,c,d,h],pointSet2:[l,d,c,h]}},this.renderAnnotation=(e,t)=>{let n=this.configuration.sourceImageIds,i=!1;if(!n?.length)return i;let{viewport:a,FrameOfReferenceUID:r}=e;if(a.getImageIds().length<2)return i;let o=(0,y.getAnnotations)(this.getToolName(),r);if(!o?.length)return i;let s=o[0],{annotationUID:l}=s,{focalPoint:d,viewPlaneNormal:c}=(0,i$.A)(a),h={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id},u=this.getImageIdNormal(n[0]);if(this.isParallel(c,u))return i;let g=M.BF.planar.planeEquation(c,d),p=s.data.pointSets,m=s.data.viewportData;for(let e=0;ea.worldToCanvas(e)),w=`${l}-line`,b=`${e}`;(0,aK.V6)(t,l,b,_[0],_[1],{color:v,width:u,lineDash:f,shadow:I},w)}return!0},this.initializeViewportData=(e,t)=>(e.set(t,{pointSetsToUse:[],lineStartsWorld:[],lineEndsWorld:[]}),e.get(t)),this.isPerpendicular=(e,t)=>Math.abs(e7.Om(e,t))1-sW}getImageIdNormal(e){let{imageOrientationPatient:t}=M.wx.get("imagePlaneModule",e),n=e7.fA(t[0],t[1],t[2]),i=e7.fA(t[3],t[4],t[5]);return e7.$A(e7.vt(),n,i)}}sX.toolName="OverlayGrid";class sz extends sB.A{constructor(e={},t={configuration:{opacity:.5}}){super(e,t),this._init=()=>{let e=(0,tT.getToolGroup)(this.toolGroupId).viewportsInfo;if(!e?.length)return void console.warn(this.getToolName()+"Tool: No viewports found");let t=(0,M.lD)(e[0].renderingEngineId)?.getViewport(e[0].viewportId);if(!t)return;let n=t.getFrameOfReferenceUID(),i=(0,y.getAnnotations)(this.getToolName(),n);if(!i?.length){var a;let t=new Map;a=t,e.forEach(({viewportId:e,renderingEngineId:t})=>{s$(a,(0,M.lD)(t)?.getViewport(e))});let i={highlighted:!0,invalidated:!0,metadata:{toolName:this.getToolName(),FrameOfReferenceUID:n,referencedImageId:null},data:{actorsWorldPointsMap:t}};(0,y.addAnnotation)(i,n)}(0,tr.A)(e.map(({viewportId:e})=>e))},this.onSetToolEnabled=()=>{this._init()},this.onCameraModified=e=>{this._init()},this.renderAnnotation=(e,t)=>{let{viewport:n,FrameOfReferenceUID:i}=e,a=!1,r=(0,y.getAnnotations)(this.getToolName(),i);if(!r?.length)return a;let o=r[0],{annotationUID:s}=o,l=o.data.actorsWorldPointsMap;s$(l,n);let d=n.getActors(),c=sY(n);return d.forEach(e=>{if(!e?.clippingFilter)return;let i=l.get(e.uid);if(!i||!i.get(c))return;let a=1,{worldPointsSet:r,color:o}=i.get(c);for(let i=0;in.worldToCanvas(e)),d={color:o,fillColor:o,fillOpacity:this.configuration.opacity,closePath:!0,lineWidth:2},c=e.uid+"#"+a;(0,aK.kd)(t,s,c,l,d),a++}}),a=!0}}}function s$(e,t){let n=t.getActors(),i=sY(t);n.forEach(t=>{if(!t?.clippingFilter)return;let n=e.get(t.uid);if(n||(n=new Map,e.set(t.uid,n)),!n.get(i)){let e=function(e){let t=function(e){let t=e.getLines().getData(),n=0,i=new Map;for(;n{for(let[t,n]of e.entries())if(void 0!==n)return t;return -1},o=r(i);for(;-1!==o;){let e=[o];for(;i.has(o);){let t=i.get(o)[1];i.has(t)&&e.push(t),i.delete(o),o=t}a.push(e),o=r(i)}return a.length?a:void 0}(e);if(!t)return;let n=e.getPoints().getData();return t.map(e=>e.map(e=>(function(e,t){let n=3*t;if(n{let{detail:t}=e,{element:n,currentPoints:i}=t;this._currentCursorWorldPosition=i.world,this._currentCanvasPosition=i.canvas,this._elementWithCursor=n;let a=this.getActiveAnnotation(n);return null===a?this.createInitialAnnotation(i.world,n):this.updateAnnotationPosition(n,a),!1},this.createInitialAnnotation=(e,t)=>{let n=(0,M.kJ)(t);if(!n)throw Error("No enabled element found");let{viewport:i,renderingEngine:a}=n;this.isDrawing=!0;let{viewPlaneNormal:r,viewUp:o}=(0,i$.A)(i);if(!r||!o)throw Error("Camera not found");let s=this.getReferencedImageId(i,e,r,o),l=i.getFrameOfReferenceUID(),d={highlighted:!0,invalidated:!0,metadata:{toolName:this.getToolName(),viewPlaneNormal:[...r],viewUp:[...o],FrameOfReferenceUID:l,referencedImageId:s},data:{label:"",handles:{points:[[...e]],activeHandleIndex:null,textBox:{hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}}}}};if((0,y.getAnnotations)(this.getToolName(),t).length>0)return null;if(null===(0,y.addAnnotation)(d,t))return;let c=(0,ta.Q0)(t,this.getToolName(),!1);(0,tr.A)(c)},this.onCameraModified=e=>{let t=e.detail,{previousCamera:n,camera:i}=t,a=t.element||e.currentTarget||e.target;if(!a||!n)return;let r=(0,M.kJ)(a).viewport;if(a!==this._elementWithCursor)return;let o=n.focalPoint,s=i.viewPlaneNormal,l=i.focalPoint,d=[0,0,0];if(oR.Ay.subtract(l,o,d),0===d.reduce((e,t)=>e+t,0)||.01>Math.abs(oR.Ay.dot(d,s))||!this._currentCanvasPosition)return;let c=r.canvasToWorld(this._currentCanvasPosition);this._currentCursorWorldPosition=c,this.updateAnnotationPosition(a,this.getActiveAnnotation(a))},this.renderAnnotation=(e,t)=>{let n=!1,{viewport:i,FrameOfReferenceUID:a}=e,r=this._elementWithCursor===i.element;this.configuration.positionSync&&!r&&this.updateViewportImage(i);let{element:o}=i,s=(0,y.getAnnotations)(this.getToolName(),o);if(!s?.length||(s=this.filterInteractableAnnotationsForElement(o,s),!s?.length))return n;let l={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let e=0;eisNaN(e)))break;let f=h.map(e=>i.worldToCanvas(e));if(!i.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}if(!(0,nM.YY)(o))continue;let v={upper:"upper",right:"right",lower:"lower",left:"left"},[I,_]=f[0],w=r?20:7,b=r?5:7;(0,aK.V6)(t,o,v.upper,[I,_-(w/2+b)],[I,_-w/2],{color:m,lineDash:p,lineWidth:g}),(0,aK.V6)(t,o,v.lower,[I,_+(w/2+b)],[I,_+w/2],{color:m,lineDash:p,lineWidth:g}),(0,aK.V6)(t,o,v.right,[I+(w/2+b),_],[I+w/2,_],{color:m,lineDash:p,lineWidth:g}),(0,aK.V6)(t,o,v.left,[I-(w/2+b),_],[I-w/2,_],{color:m,lineDash:p,lineWidth:g}),n=!0}return n},this._disableCursorEnabled=this.configuration.disableCursor}onSetToolActive(){if(this._disableCursorEnabled=this.configuration.disableCursor,!this._disableCursorEnabled)return;let e=(0,tT.getToolGroup)(this.toolGroupId).viewportsInfo;e&&e.map(e=>(0,M.b1)(e.viewportId,e.renderingEngineId)).forEach(e=>{e&&(0,oK.lY)(e.viewport.element)})}onSetToolDisabled(){if(!this._disableCursorEnabled)return;let e=(0,tT.getToolGroup)(this.toolGroupId).viewportsInfo;e&&e.map(e=>(0,M.b1)(e.viewportId,e.renderingEngineId)).forEach(e=>{e&&(0,oK.Q_)(e.viewport.element)})}getActiveAnnotation(e){let t=(0,y.getAnnotations)(this.getToolName(),e);return t.length?t[0]:null}updateAnnotationPosition(e,t){let n=this._currentCursorWorldPosition;if(!n||!t.data?.handles?.points)return;t.data.handles.points=[[...n]],t.invalidated=!0;let i=(0,ta.Q0)(e,this.getToolName(),!1);(0,M.kJ)(e)&&(0,tr.A)(i)}filterInteractableAnnotationsForElement(e,t){if(!(t instanceof Array)||0===t.length)return[];let n=t[0],i=(0,M.kJ)(e)?.viewport;if(!i)return[];let{viewPlaneNormal:a,focalPoint:r}=(0,i$.A)(i);if(!a||!r)return[];let o=n.data?.handles?.points;if(!(o instanceof Array)||1!==o.length)return[];let s=o[0],l=M.BF.planar.planeEquation(a,r);return M.BF.planar.planeDistanceToPoint(l,s)isNaN(e)))){if(e instanceof M.hS){let n=M.BF.getClosestStackImageIndexForPoint(t,e);if(null===n)return;n!==e.getCurrentImageIdIndex()&&e.setImageIdIndex(n)}else if(e instanceof M.PX){let{focalPoint:n,viewPlaneNormal:i}=(0,i$.A)(e);if(!n||!i)return;let a=M.BF.planar.planeEquation(i,n),r=M.BF.planar.planeDistanceToPoint(a,t,!0);if(.5>Math.abs(r))return;let o=e7.S8(e7.vt(),e7.fA(...i)),s=e7.hs(e7.vt(),o,r),l=e7.WQ(e7.vt(),e7.fA(...n),s);{e.setCamera({focalPoint:l});let t=e.getRenderingEngine();t&&t.renderViewport(e.id)}}else if(M.BF.isGenericViewport(e)){let{focalPoint:n,viewPlaneNormal:i}=(0,i$.A)(e);if(!n||!i)return;let a=M.BF.planar.planeEquation(i,n),r=M.BF.planar.planeDistanceToPoint(a,t,!0);if(.5>Math.abs(r))return;let o=e7.S8(e7.vt(),e7.fA(...i)),s=e7.hs(e7.vt(),o,r);rG(e,e7.WQ(e7.vt(),e7.fA(...n),s));let l=e.getRenderingEngine();l&&l.renderViewport(e.id)}}}}sj.toolName="ReferenceCursors";let sJ=[];class sQ extends sB.A{constructor(e={},t={configuration:{viewportId:"",scaleLocation:"bottom"}}){super(e,t),this.editData=null,this._init=()=>{let e=(0,M.qO)()[0];if(!e)return;let t=(0,tT.getToolGroup)(this.toolGroupId).viewportsInfo;if(!t)return;let n=t.map(e=>(0,M.b1)(e.viewportId,e.renderingEngineId)),{viewport:i}=n[0],{FrameOfReferenceUID:a}=n[0];if(this.configuration.viewportId&&n.forEach(e=>{e.viewport.id==this.configuration.viewportId&&(i=e.viewport)}),!i)return;let{viewUp:r,viewPlaneNormal:o}=(0,i$.A)(i),s=M.BF.getViewportImageCornersInWorld(i),l=this.editData?.annotation,d=(0,y.getAnnotations)(this.getToolName(),i.element);d.length&&(l=d.filter(e=>e.data?.viewportId==i.id)[0]),n.forEach(e=>{let{viewport:t}=e;if(!sJ.includes(t.id)){let e={metadata:{toolName:this.getToolName(),viewPlaneNormal:[...o],viewUp:[...r],FrameOfReferenceUID:a,referencedImageId:null},data:{handles:{points:M.BF.getViewportImageCornersInWorld(t)},viewportId:t.id}};sJ.push(t.id),(0,y.addAnnotation)(e,t.element),l=e}}),this.editData?.annotation&&this.editData.annotation.data.viewportId==i.id&&(this.editData.annotation.data.handles.points=s,this.editData.annotation.data.viewportId=i.id),this.editData={viewport:i,renderingEngine:e,annotation:l}},this.onSetToolEnabled=()=>{this._init()},this.onCameraModified=e=>{this.configuration.viewportId=e.detail.viewportId,this._init()},this.computeScaleSize=(e,t,n)=>{let i=[16e3,8e3,4e3,2e3,1e3,500,250,100,50,25,10,5,2];return("top"==n||"bottom"==n?i.filter(t=>t<.6*e&&t>.2*e):i.filter(e=>e<.6*t&&e>.2*t))[0]},this.computeEndScaleTicks=(e,t)=>{let n={bottom:[[0,-10],[0,-10]],top:[[0,10],[0,10]],left:[[0,0],[10,0]],right:[[0,0],[-10,0]]};return{endTick1:[[e[1][0]+n[t][0][0],e[1][1]+n[t][0][0]],[e[1][0]+n[t][1][0],e[1][1]+n[t][1][1]]],endTick2:[[e[0][0]+n[t][0][0],e[0][1]+n[t][0][0]],[e[0][0]+n[t][1][0],e[0][1]+n[t][1][1]]]}},this.computeInnerScaleTicks=(e,t,n,i,a)=>{let r;"bottom"==t||"top"==t?r=a[0][0]-i[0][0]:("left"==t||"right"==t)&&(r=a[0][1]-i[0][1]);let o=[],s=[],l=[],d=e;e>=50&&(d=e/10);let c=r/d;for(let e=0;e{let i,a=e7.Re(e7.vt(),n[0],n[1]);a=e7.S8(e7.vt(),a);let r=e7.Re(e7.vt(),n[2],n[0]);r=e7.S8(e7.vt(),r);let o={bottom:[n[1],n[2]],top:[n[0],n[3]],right:[n[2],n[3]],left:[n[0],n[1]]},s=e7.WQ(e7.vt(),o[t][0],o[t][0]).map(e=>e/2),l=e/2/Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2));return"top"==t||"bottom"==t?i=[e7.Re(e7.vt(),s,r.map(e=>e*l)),e7.WQ(e7.vt(),s,r.map(e=>e*l))]:("left"==t||"right"==t)&&(i=[e7.WQ(e7.vt(),s,a.map(e=>e*l)),e7.Re(e7.vt(),s,a.map(e=>e*l))]),i},this.computeCanvasScaleCoordinates=(e,t,n,i,a)=>{let r;if("top"==a||"bottom"==a){let i=t[0][0]-t[1][0];r=[[e.width/2-i/2,n.height],[e.width/2+i/2,n.height]]}else if("left"==a||"right"==a){let n=t[0][1]-t[1][1];r=[[i.width,e.height/2-n/2],[i.width,e.height/2+n/2]]}return r},this.computeScaleBounds=(e,t,n,i)=>{let a=t*Math.min(1e3,e.width),r=n*Math.min(1e3,e.height),o={bottom:[-r,-a],top:[r,a],left:[r,a],right:[-r,-a]},s={bottom:[e.height,e.width],top:[0,e.width],left:[e.height,0],right:[e.height,e.width]};return{height:s[i][0]+o[i][0],width:s[i][1]+o[i][1]}}}renderAnnotation(e,t){if(!this.editData||!this.editData.viewport)return;let n=this.configuration.scaleLocation,{viewport:i}=e,a=(0,y.getAnnotations)(this.getToolName(),i.element).filter(e=>e.data?.viewportId==i.id)[0],r=e.viewport.canvas;if(!i||!a)return!1;let o={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id},s={width:r.width/window.devicePixelRatio||1,height:r.height/window.devicePixelRatio||1},l=a.data.handles.points[0],d=a.data.handles.points[1],c=a.data.handles.points[2],h=a.data.handles.points[3],u=[l,c,d,h],g=e7.Io(c,h),p=e7.Io(l,c),m=this.computeScaleBounds(s,.05,.05,n),f=this.computeScaleBounds(s,.05,.05,n),v=this.computeScaleSize(g,p,n),I=this.computeWorldScaleCoordinates(v,n,u).map(e=>i.worldToCanvas(e)),_=this.computeCanvasScaleCoordinates(s,I,f,m,n),w=this.computeEndScaleTicks(_,n),{annotationUID:b}=a;o.annotationUID=b;let C=this.getStyle("lineWidth",o,a),A=this.getStyle("lineDash",o,a),E=this.getStyle("color",o,a),M=this.getStyle("shadow",o,a),S=`${b}-scaleline`;(0,aK.V6)(t,b,"1",_[0],_[1],{color:E,width:C,lineDash:A,shadow:M},S);let T=`${b}-left`;(0,aK.V6)(t,b,"2",w.endTick1[0],w.endTick1[1],{color:E,width:C,lineDash:A,shadow:M},T);let D=`${b}-right`;(0,aK.V6)(t,b,"3",w.endTick2[0],w.endTick2[1],{color:E,width:C,lineDash:A,shadow:M},D);let P={bottom:[-10,-42],top:[-12,-35],left:[-40,-20],right:[-50,-20]},k=[_[0][0]+P[n][0],_[0][1]+P[n][1]],x=this._getTextLines(v),{tickIds:L,tickUIDs:V,tickCoordinates:O}=this.computeInnerScaleTicks(v,n,b,w.endTick1,w.endTick2);for(let e=0;e=50?(t=e/10,n=" cm"):(t=e,n=" mm"),[t.toString().concat(n)]}}sQ.toolName="ScaleOverlay";var sq=n(68764);let sK=(e,t,n)=>{if(!t?.data?.contour?.polyline?.length)return;let{polyline:i}=t.data.contour,{length:a}=i,r=1/0;for(let t=0;t0&&(i.toolSize=Math.min(i.maxToolSize,a),this.computeWorldRadius(t,!0))}getMaxSpacing(e){return Math.max(this.toolInfo.toolSize/4,e)}computeWorldRadius(e,t=!1){if(!this.toolInfo.radius||t){let t=e.canvasToWorld([0,0]),n=e.canvasToWorld([this.toolInfo.toolSize,0]);this.toolInfo.radius=e7.Bw(e7.jb(e7.vt(),t,n))}return this.toolInfo.radius}getEdge(e,t,n,i){let a=e7.WQ(e7.vt(),t,n||t);e7.hs(a,a,.5);let r=e.worldToCanvas(a),o=rK.jb(rK.vt(),r,i),s=Math.atan2(o[1],o[0]),l=this.interpolatePoint(e,s,i),d=e.worldToCanvas(l);return{point:l,angle:s,canvasPoint:d}}interpolatePoint(e,t,n){let[i,a]=n,r=this.toolInfo.toolSize,o=Math.cos(t)*r,s=Math.sin(t)*r;return e.canvasToWorld([i+o,a+s])}isInCursor(e,t){return e7.Io(e,t){let t=e.detail,{element:n}=t;if(this.configureToolSize(e),this.selectFreehandTool(t),null!==this.commonData.activeAnnotationUID)return this.isActive=!0,(0,oK.lY)(n),this.activateModify(n),!0},this.mouseMoveCallback=e=>{this.mode===S.r$.Active?(this.configureToolSize(e),this.updateCursor(e)):this.commonData.canvasLocation=void 0},this.endCallback=e=>{let{element:t}=e.detail;this.isActive=!1,this.deactivateModify(t),(0,oK.Q_)(t);let n=this.getToolInstance(t);n.doneEditMemo?.();let i=this.filterSculptableAnnotationsForElement(t).find(e=>e.annotationUID===this.commonData.activeAnnotationUID);n.configuration.calculateStats&&(i.invalidated=!0),(0,tu.triggerAnnotationModified)(i,t,S.wi.HandlesUpdated)},this.dragCallback=e=>{let t=e.detail,n=t.element;this.updateCursor(e);let i=this.filterSculptableAnnotationsForElement(n),a=i.find(e=>e.annotationUID===this.commonData.activeAnnotationUID);if(!i?.length||!this.isActive)return;let r=a.data.contour.polyline;this.sculpt(t,r)},this.registerShapes(sZ.shapeName,sZ),this.setToolShape(this.configuration.toolShape)}registerShapes(e,t){let n=new t;this.registeredShapes.set(e,n)}sculpt(e,t){let n=this.configuration,i=e.element,{viewport:a}=(0,M.kJ)(i),r=this.registeredShapes.get(this.selectedShape);this.sculptData={mousePoint:e.currentPoints.world,mouseCanvasPoint:e.currentPoints.canvas,points:t,maxSpacing:r.getMaxSpacing(n.minSpacing),element:i,contours:[{annotationUID:this.commonData.activeAnnotationUID,points:t}]};let o=this.intersect(a,r);if(!o.length)return;let s=this.getContourSelections(o,t.length),{closed:l}=this.commonData;for(let e of s){let n,i=[],r=e[e.length-1],o=l?r.relIndex:0;for(let r of e)r.isEnter?(s2(i,t,o,r.index),n=r):this.interpolatePoints(a,n,r,t,i),o=r.index;if(s.length>1&&0>(0,tg.getSignedArea)(i.map(a.worldToCanvas))){console.warn("Skipping internal area");continue}!l&&oh?u-2*Math.PI:u;(r&&!o&&Math.abs(p-h)e[0].index-t[0].index);for(let e=0;e1&&console.warn("************* More than 1 result",n),n}findMergeable(e,t,n){let i=t[t.length-1];for(let t=n+1;t=i.relIndex){let n=e[t];return e.splice(t,1),n}}}findNext(e,t,n=!0){let i,a;if(1===e.length){let[t]=e;return e.splice(0,1),t}for(let r=0;ri&&n.push(e)}updateCursor(e){let t=e.detail,n=t.element,{viewport:i}=(0,M.kJ)(n);this.commonData.viewportIdsToRender=[i.id];let a=this.filterSculptableAnnotationsForElement(n);if(!a?.length)return;let r=a.find(e=>e.annotationUID===this.commonData.activeAnnotationUID);if(this.commonData.canvasLocation=t.currentPoints.canvas,this.isActive)r.highlighted=!0;else{let e=this.registeredShapes.get(this.selectedShape),n=t.currentPoints.canvas;"dynamic"===this.configuration.updateCursorSize&&e.updateToolSize(n,i,r)}(0,tr.t)(this.commonData.viewportIdsToRender)}getToolInstance(e){let{renderingEngineId:t,viewportId:n}=(0,M.kJ)(e);return(0,tT.getToolGroupForViewport)(n,t).getToolInstance(this.configuration.referencedToolName)}filterSculptableAnnotationsForElement(e){let{configuration:t}=this,n=[],i=this.getToolInstance(e);return t.referencedToolNames.forEach(t=>{let i=(0,iS.Rh)(t,e);i&&n.push(...i)}),i.filterInteractableAnnotationsForElement(e,n)}configureToolSize(e){this.registeredShapes.get(this.selectedShape).configureToolSize(e)}selectFreehandTool(e){let t=this.getClosestFreehandToolOnElement(e);if(void 0===t)return;let n=(0,iS.gw)(t);if(this.commonData.activeAnnotationUID=t,this.commonData.closed=n.data.contour.closed,this.commonData.external=!0,this.commonData.closed){let{element:t}=e,{viewport:i}=(0,M.kJ)(t),a=n.data.contour.polyline.map(e=>i.worldToCanvas(e)),r=e.currentPoints.canvas;this.commonData.external=!(0,tg.containsPoint)(a,r,{closed:!0})}}getClosestFreehandToolOnElement(e){let{element:t}=e,{viewport:n}=(0,M.kJ)(t),i=this.configuration,a=this.filterSculptableAnnotationsForElement(t);if(!a?.length)return;let r=e.currentPoints.canvas,o={distance:1/0,toolIndex:void 0,annotationUID:void 0};for(let e=0;e(e+t)%t;s1.toolName="SculptorTool";let s3={Z:[0,0,1]};class s8 extends oL.oS{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{direction:s3.Z,rotateIncrementDegrees:30,rotateDragDegreesPerPixel:.5}}){super(e,t)}mouseWheelCallback(e){let{element:t,wheel:n}=e.detail,{rotateIncrementDegrees:i}=this.configuration,{direction:a}=n,r=i*Math.PI*a/180;this._rotate(t,r)}mouseDragCallback(e){this._dragCallback(e)}touchDragCallback(e){this._dragCallback(e)}_dragCallback(e){let{element:t,deltaPoints:n}=e.detail,{rotateDragDegreesPerPixel:i}=this.configuration,a=n.canvas[0];if(!a)return;let r=a*i*Math.PI/180;this._rotate(t,r)}_rotate(e,t){let{viewport:n}=(0,M.kJ)(e),{direction:i}=this.configuration,{viewUp:a,position:r,focalPoint:o}=(0,i$.A)(n),[s,l,d]=o,[c,h,u]=i,g=[0,0,0],p=[0,0,0],m=[0,0,0],f=r$.identity(new Float32Array(16));r$.translate(f,f,[s,l,d]),r$.rotate(f,f,t,[c,h,u]),r$.translate(f,f,[-s,-l,-d]),e7.Z0(g,r,f),e7.Z0(p,o,f),r$.identity(f),r$.rotate(f,f,t,[c,h,u]),e7.Z0(m,a,f),oN(n,{position:g,viewUp:m,focalPoint:p}),n.render()}}s8.toolName="VolumeRotateMouseWheel";var s4=n(5966);class s6 extends oL.EC{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{shadow:!0,getTextCallback:s9,changeTextCallback:s7,preventHandleOutsideImage:!1}}){super(e,t),this.isPointNearTool=(e,t,n,i)=>{let{viewport:a}=(0,M.kJ)(e),{annotationUID:r}=t,o=t.data.handles.points[0],s=a.worldToCanvas(o);if(rK.Io(n,s)=p&&n[0]<=p+c.width&&n[1]>=m&&n[1]<=m+c.height},this.addNewAnnotation=e=>{let{currentPoints:t,element:n}=e.detail,i=t.world;(0,oK.lY)(n),this.isDrawing=!0;let a=this.createAnnotation(e,[[...i],[...i]]);(0,y.addAnnotation)(a,n);let r=(0,ta.Q0)(n,this.getToolName());return this.editData={annotation:a,newAnnotation:!0,viewportIdsToRender:r,offset:[0,0,0]},e.preventDefault(),(0,tr.A)(r),this.configuration.getTextCallback(e=>{if(!e){(0,y.removeAnnotation)(a.annotationUID),(0,tr.A)(r),this.isDrawing=!1;return}(0,oK.Q_)(n),a.data.label=e,(0,tu.triggerAnnotationCompleted)(a),(0,tr.A)(r)}),this.createMemo(n,a,{newAnnotation:!0}),a},this.toolSelectedCallback=(e,t)=>{let{element:n,currentPoints:i}=e.detail;t.highlighted=!0;let a=(0,ta.Q0)(n,this.getToolName()),r=[0,0,0];if(i&&i.world){let e=i.world,n=t.data.handles.points[0];r=[n[0]-e[0],n[1]-e[1],n[2]-e[2]]}this.editData={annotation:t,viewportIdsToRender:a,offset:r},this._activateModify(n),(0,oK.lY)(n),(0,tr.A)(a),e.preventDefault()},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:i,newAnnotation:a}=this.editData;this._deactivateDraw(t),this._deactivateModify(t),(0,oK.Q_)(t),a&&this.createMemo(t,n,{newAnnotation:a}),this.editData=null,this.isDrawing=!1,this.doneEditMemo(),this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,y.removeAnnotation)(n.annotationUID),(0,tr.A)(i),a&&(0,tu.triggerAnnotationCompleted)(n)},this._dragCallback=e=>{let{currentPoints:t,element:n}=e.detail,i=t.world,{annotation:a,viewportIdsToRender:r,offset:o}=this.editData;o?a.data.handles.points[0]=[i[0]+o[0],i[1]+o[1],i[2]+o[2]]:a.data.handles.points[0]=[...i],a.invalidated=!0,(0,tr.A)(r),(0,tu.triggerAnnotationModified)(a,n,S.wi.LabelChange)},this.cancel=e=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateModify(e),(0,oK.Q_)(e);let{annotation:t,viewportIdsToRender:n,newAnnotation:i}=this.editData,{data:a}=t;return t.highlighted=!1,a.handles.activeHandleIndex=null,(0,tr.A)(n),i&&(0,tu.triggerAnnotationCompleted)(t),this.editData=null,t.annotationUID}},this._activateModify=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this._deactivateModify=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback)},this._activateDraw=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this._deactivateDraw=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this.renderAnnotation=(e,t)=>{let n=!1,{viewport:i}=e,{element:a}=i,r=(0,y.getAnnotations)(this.getToolName(),a);if(!r?.length)return n;r=this.filterInteractableAnnotationsForElement(a,r);let o={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let e=0;e{let a=(0,M.yj)(e);if(!a)return;let{viewport:r}=a,o=r.getFrameOfReferenceUID(),{viewPlaneNormal:s,viewUp:l}=(0,i$.A)(r),d=new s6,c=d.getReferencedImageId(r,t,s,l),h={annotationUID:i?.annotationUID||M.BF.uuidv4(),data:{label:n,handles:{points:[t]}},highlighted:!1,autoGenerated:!1,invalidated:!1,isLocked:!1,isVisible:!0,metadata:{toolName:d.getToolName(),viewPlaneNormal:s,FrameOfReferenceUID:o,referencedImageId:c,...i}};(0,y.addAnnotation)(h,r.element),(0,tr.A)([r.id])},s6.toolName="Label";class le extends oL.EC{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{preventHandleOutsideImage:!1,getTextLines:lt,actions:{undo:{method:"undo",bindings:[{key:"z"}]},redo:{method:"redo",bindings:[{key:"y"}]}}}}){super(e,t),this.addNewAnnotation=e=>{let{currentPoints:t,element:n}=e.detail,i=t.world;(0,oK.lY)(n),this.isDrawing=!0;let a=this.createAnnotation(e,[[...i],[...i]]);(0,y.addAnnotation)(a,n);let r=(0,ta.Q0)(n,this.getToolName());return this.editData={annotation:a,viewportIdsToRender:r,handleIndex:1,movingTextBox:!1,newAnnotation:!0,hasMoved:!1},this._activateDraw(n),e.preventDefault(),(0,tr.A)(r),a},this.isPointNearTool=(e,t,n,i)=>{let{viewport:a}=(0,M.kJ)(e),{data:r}=t,[o,s]=r.handles.points,l=a.worldToCanvas(o),d=a.worldToCanvas(s),c={start:{x:l[0],y:l[1]},end:{x:d[0],y:d[1]}};return oZ.A([c.start.x,c.start.y],[c.end.x,c.end.y],[n[0],n[1]])<=i},this.toolSelectedCallback=(e,t)=>{let{element:n}=e.detail;t.highlighted=!0;let i=(0,ta.Q0)(n,this.getToolName());this.editData={annotation:t,viewportIdsToRender:i,movingTextBox:!1},this._activateModify(n),(0,oK.lY)(n),(0,tr.A)(i),e.preventDefault()},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:i,newAnnotation:a,hasMoved:r}=this.editData,{data:o}=n;(!a||r)&&(o.handles.activeHandleIndex=null,this._deactivateModify(t),this._deactivateDraw(t),(0,oK.Q_)(t),this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,y.removeAnnotation)(n.annotationUID),(0,tr.A)(i),this.doneEditMemo(),a&&(0,tu.triggerAnnotationCompleted)(n),this.editData=null,this.isDrawing=!1)},this._dragCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{annotation:i,viewportIdsToRender:a,handleIndex:r,movingTextBox:o,newAnnotation:s}=this.editData,{data:l}=i;if(this.createMemo(n,i,{newAnnotation:s}),o){let{deltaPoints:e}=t,n=e.world,{textBox:i}=l.handles,{worldPosition:a}=i;a[0]+=n[0],a[1]+=n[1],a[2]+=n[2],i.hasMoved=!0}else if(void 0===r){let{deltaPoints:e}=t,n=e.world;l.handles.points.forEach(e=>{e[0]+=n[0],e[1]+=n[1],e[2]+=n[2]}),i.invalidated=!0}else{let{currentPoints:e}=t,n=e.world;l.handles.points[r]=[...n],i.invalidated=!0}this.editData.hasMoved=!0,(0,tr.A)(a),i.invalidated&&(0,tu.triggerAnnotationModified)(i,n,S.wi.HandlesUpdated)},this.cancel=e=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateDraw(e),this._deactivateModify(e),(0,oK.Q_)(e);let{annotation:t,viewportIdsToRender:n,newAnnotation:i}=this.editData,{data:a}=t;return t.highlighted=!1,a.handles.activeHandleIndex=null,(0,tr.A)(n),i&&(0,tu.triggerAnnotationCompleted)(t),this.editData=null,t.annotationUID}},this._activateModify=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._deactivateModify=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._activateDraw=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._deactivateDraw=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(e,t)=>{let n=!1,{viewport:i}=e,{element:a}=i,r=(0,y.getAnnotations)(this.getToolName(),a);if(!r?.length||(r=this.filterInteractableAnnotationsForElement(a,r),!r?.length))return n;let o=this.getTargetId(i),s=i.getRenderingEngine(),l={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let a=0;ai.worldToCanvas(e));if(u.cachedStats[o]&&null!=u.cachedStats[o].unit?c.invalidated&&this._throttledCalculateCachedStats(c,s,e):(u.cachedStats[o]={length:null,unit:null},this._calculateCachedStats(c,s,e)),!i.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}if(!(0,nM.YY)(h))continue;(0,nE.Gh)(h)||this.editData||null===p||(d=[_[p]]);let w=!!(0,sq.h)("showHandlesAlways",{});(d||w)&&(0,aK.qX)(t,h,"0",_,{color:m,lineDash:v,lineWidth:f});let b=`${h}-line`;if((0,aK.V6)(t,h,"1",_[0],_[1],{color:m,width:f,lineDash:v,shadow:I},b),n=!0,!i.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}let C=this.configuration.getTextLines(u,o);if(!this.renderLinkedTextBoxAnnotation({enabledElement:e,svgDrawingHelper:t,annotation:c,styleSpecifier:l,textLines:C??[],canvasCoordinates:_}))continue}return n},this._throttledCalculateCachedStats=(0,ti.A)(this._calculateCachedStats,100,{trailing:!0})}handleSelectedCallback(e,t,n){let i,{element:a}=e.detail,{data:r}=t;t.highlighted=!0;let o=!1;n.worldPosition?o=!0:i=r.handles.points.findIndex(e=>e===n);let s=(0,ta.Q0)(a,this.getToolName());this.editData={annotation:t,viewportIdsToRender:s,handleIndex:i,movingTextBox:o},this._activateModify(a),(0,oK.lY)(a),(0,tr.A)(s),e.preventDefault()}_calculateCachedStats(e,t,n){let i=e.data,{element:a}=n.viewport,{cachedStats:r}=i,o=Object.keys(r);for(let e=0;ea.worldToIndex(e)),c=(0,te.Op)(n,d),{unit:h}=c,u=l.calculateLengthInIndex(c,d);this.isHandleOutsideImage=!l.isInsideVolume(s,d);let g={name:"length",value:u,unit:h,type:S.Jf.Linear};r[t]={length:u,unit:h,statsArray:[g]}}let s=e.invalidated;return e.invalidated=!1,s&&(0,tu.triggerAnnotationModified)(e,a,S.wi.StatsUpdated),r}}function lt(e,t){let{length:n,unit:i}=e.cachedStats[t];if(!(null==n||isNaN(n)))return[`${M.BF.roundNumber(n)} ${i}`]}l=le,le.toolName="Length",le.hydrate=(e,t,n)=>{let i=(0,M.yj)(e);if(!i)return;let{FrameOfReferenceUID:a,referencedImageId:r,viewPlaneNormal:o,instance:s,viewport:d}=l.hydrateBase(l,i,t,n),{toolInstance:c,...h}=n||{},u={annotationUID:n?.annotationUID||M.BF.uuidv4(),data:{handles:{points:t}},highlighted:!1,autoGenerated:!1,invalidated:!1,isLocked:!1,isVisible:!0,metadata:{toolName:s.getToolName(),viewPlaneNormal:o,FrameOfReferenceUID:a,referencedImageId:r,...h}};(0,y.addAnnotation)(u,d.element),(0,tr.A)([d.id])};let ln=le,{transformWorldToIndex:li}=M.BF;class la extends oL.EC{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{preventHandleOutsideImage:!1,getTextLines:lr}}){super(e,t),this.addNewAnnotation=e=>{let{currentPoints:t,element:n}=e.detail,i=t.world;(0,oK.lY)(n),this.isDrawing=!0;let a=this.createAnnotation(e,[[...i],[...i]]);(0,y.addAnnotation)(a,n);let r=(0,ta.Q0)(n,this.getToolName());return this.editData={annotation:a,viewportIdsToRender:r,handleIndex:1,movingTextBox:!1,newAnnotation:!0,hasMoved:!1},this._activateDraw(n),e.preventDefault(),(0,tr.A)(r),a},this.isPointNearTool=(e,t,n,i)=>{let{viewport:a}=(0,M.kJ)(e),{data:r}=t,[o,s]=r.handles.points,l=a.worldToCanvas(o),d=a.worldToCanvas(s),c={start:{x:l[0],y:l[1]},end:{x:d[0],y:d[1]}};return oZ.A([c.start.x,c.start.y],[c.end.x,c.end.y],[n[0],n[1]])<=i},this.toolSelectedCallback=(e,t)=>{let{element:n}=e.detail;t.highlighted=!0;let i=(0,ta.Q0)(n,this.getToolName());this.editData={annotation:t,viewportIdsToRender:i,movingTextBox:!1},this._activateModify(n),(0,oK.lY)(n),(0,M.kJ)(n),(0,tr.A)(i),e.preventDefault()},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:i,newAnnotation:a,hasMoved:r}=this.editData,{data:o}=n;if(a&&!r)return;o.handles.activeHandleIndex=null,this._deactivateModify(t),this._deactivateDraw(t),(0,oK.Q_)(t);let{renderingEngine:s}=(0,M.kJ)(t);this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,y.removeAnnotation)(n.annotationUID),(0,tr.A)(i),this.doneEditMemo(),a&&(0,tu.triggerAnnotationCompleted)(n),this.editData=null,this.isDrawing=!1},this._dragCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{annotation:i,viewportIdsToRender:a,handleIndex:r,movingTextBox:o,newAnnotation:s}=this.editData,{data:l}=i;if(this.createMemo(n,i,{newAnnotation:s}),o){let{deltaPoints:e}=t,n=e.world,{textBox:i}=l.handles,{worldPosition:a}=i;a[0]+=n[0],a[1]+=n[1],a[2]+=n[2],i.hasMoved=!0}else if(void 0===r){let{deltaPoints:e}=t,n=e.world;l.handles.points.forEach(e=>{e[0]+=n[0],e[1]+=n[1],e[2]+=n[2]}),i.invalidated=!0}else{let{currentPoints:e}=t,n=e.world;l.handles.points[r]=[...n],i.invalidated=!0}this.editData.hasMoved=!0;let{renderingEngine:d}=(0,M.kJ)(n);(0,tr.A)(a)},this.cancel=e=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateDraw(e),this._deactivateModify(e),(0,oK.Q_)(e);let{annotation:t,viewportIdsToRender:n,newAnnotation:i}=this.editData,{data:a}=t;return t.highlighted=!1,a.handles.activeHandleIndex=null,(0,M.kJ)(e),(0,tr.A)(n),i&&(0,tu.triggerAnnotationCompleted)(t),this.editData=null,t.annotationUID}},this._activateModify=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._deactivateModify=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._activateDraw=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._deactivateDraw=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(e,t)=>{let n=!1,{viewport:i}=e,{element:a}=i,r=(0,y.getAnnotations)(this.getToolName(),a);if(!r?.length||(r=this.filterInteractableAnnotationsForElement(a,r),!r?.length))return n;let o=this.getTargetId(i),s=i.getRenderingEngine(),l={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let a=0;ai.worldToCanvas(e));if(u.cachedStats[o]&&null!=u.cachedStats[o].unit?c.invalidated&&this._throttledCalculateCachedStats(c,s,e):(u.cachedStats[o]={length:null,unit:null},this._calculateCachedStats(c,s,e)),!(0,nM.YY)(h))continue;(0,nE.Gh)(h)||this.editData||null===p||(d=[_[p]]);let w=!!(0,sq.h)("showHandlesAlways",{});if((d||w)&&(0,aK.qX)(t,h,"0",_,{color:m,lineDash:v,lineWidth:f}),(0,aK.YR)(t,h,"0",_[0],_[1],{color:m,width:f,lineDash:v}),n=!0,!i.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}let b=this.configuration.getTextLines(u,o);if(!this.renderLinkedTextBoxAnnotation({enabledElement:e,svgDrawingHelper:t,annotation:c,styleSpecifier:l,textLines:b??[],canvasCoordinates:_}))continue}return n},this._throttledCalculateCachedStats=(0,ti.A)(this._calculateCachedStats,100,{trailing:!0})}handleSelectedCallback(e,t,n){let i,{element:a}=e.detail,{data:r}=t;t.highlighted=!0;let o=!1;n.worldPosition?o=!0:i=r.handles.points.findIndex(e=>e===n);let s=(0,ta.Q0)(a,this.getToolName());this.editData={annotation:t,viewportIdsToRender:s,handleIndex:i,movingTextBox:o},this._activateModify(a),(0,oK.lY)(a);let{renderingEngine:l}=(0,M.kJ)(a);(0,tr.A)(s),e.preventDefault()}_calculateHeight(e,t){let n=t[0]-e[0],i=t[1]-e[1],a=t[2]-e[2];if(0==n)if(0!=i)return Math.abs(a);else return 0;return 0==i?Math.abs(a):0==a?Math.abs(i):void 0}_calculateCachedStats(e,t,n){let i=e.data,{element:a}=n.viewport,r=i.handles.points[0],o=i.handles.points[1],{cachedStats:s}=i,l=Object.keys(s);for(let e=0;e{let{currentPoints:n,element:i}=e.detail,{viewport:a}=(0,M.kJ)(i),r="touch"===t.toLowerCase(),o=this.getTouchAdjustedWorldPos(a,n,r);this.isDrawing=!0;let s=this.constructor.createAnnotationForViewport(a,{data:{handles:{points:[[...o]]}}});(0,y.addAnnotation)(s,i);let l=(0,ta.Q0)(i,this.getToolName());return this.editData={annotation:s,newAnnotation:!0,viewportIdsToRender:l},this._activateModify(i),(0,oK.lY)(i),e.preventDefault(),(0,tr.A)(l),s},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:i,newAnnotation:a}=this.editData,{viewportId:r,renderingEngine:o}=(0,M.kJ)(t);this.eventDispatchDetail={viewportId:r,renderingEngineId:o.id},this._deactivateModify(t),(0,oK.Q_)(t),a&&this.createMemo(t,n,{newAnnotation:a}),this.editData=null,this.isDrawing=!1,this.doneEditMemo(),this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,y.removeAnnotation)(n.annotationUID),(0,tr.A)(i),a&&(0,tu.triggerAnnotationCompleted)(n)},this._dragCallback=e=>{this.isDrawing=!0;let{currentPoints:t,element:n}=e.detail,{viewport:i}=(0,M.kJ)(n),a=e.type===S.sV.TOUCH_DRAG,r=this.getTouchAdjustedWorldPos(i,t,a),{annotation:o,viewportIdsToRender:s,newAnnotation:l}=this.editData,{data:d}=o;this.createMemo(n,o,{newAnnotation:l}),d.handles.points[0]=[...r],o.invalidated=!0,(0,tr.A)(s)},this.cancel=e=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateModify(e),(0,oK.Q_)(e);let{annotation:t,viewportIdsToRender:n,newAnnotation:i}=this.editData,{data:a}=t;return t.highlighted=!1,a.handles.activeHandleIndex=null,(0,tr.A)(n),i&&(0,tu.triggerAnnotationCompleted)(t),this.editData=null,t.annotationUID}},this._activateModify=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._deactivateModify=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(e,t)=>{let n=!1,{viewport:i}=e,{element:a}=i,r=(0,y.getAnnotations)(this.getToolName(),a);if(!r?.length||(r=this.filterInteractableAnnotationsForElement(a,r),!r?.length))return n;let o=i.getRenderingEngine(),s={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let l=0;l{let n=t.getCurrentImageId();if(!n)return!1;let i=M.BF.imageIdToURI(e),a=t.hasImageURI(i),r=M.BF.imageIdToURI(n);return a&&r!==i})&&delete h.cachedStats[t]}}else h.cachedStats[p]={Modality:null,index:null,value:null},this._calculateCachedStats(d,o,e,S.wi.StatsUpdated);if(!i.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}if(!(0,nM.YY)(c))continue;(0,aK.qX)(t,c,"0",[g],{color:m,lineWidth:f,handleRadius:this.configuration.handleRadius}),n=!0;let v=this.getLinkedTextBoxStyle(s,d);if(!v.visibility)continue;let I=this.configuration.getTextLines(h,p);if(I){let e=(0,rD.P)([g],a,I);(0,aK.T$)(t,c,"0",I,e,v)}}return n}}isPointNearTool(e,t,n,i){let{viewport:a}=(0,M.kJ)(e),{data:r}=t,o=r.handles.points[0],s=a.worldToCanvas(o);return rK.Io(n,s)null!==e);t=n?e.values:t,r=n?e.units:"raw"}else t=u?.getAtIJKPoint(p),r=(0,tv.j)(g,e.metadata.referencedImageId,i);d[n]={index:p,value:t,Modality:g,modalityUnit:r},e.invalidated=!0}else this.isHandleOutsideImage=!0,d[n]={index:p,Modality:g}}let h=e.invalidated;return e.invalidated=!1,h&&(0,tu.triggerAnnotationModified)(e,s,i),d}}d=ls,ls.toolName="Probe",ls.probeDefaults={supportedInteractionTypes:["Mouse","Touch"],configuration:{shadow:!0,preventHandleOutsideImage:!1,getTextLines:function(e,t){let{index:n,value:i,modalityUnit:a}=e.cachedStats[t];if(void 0===i||!n)return;let r=[];if(r.push(`(${n[0]}, ${n[1]}, ${n[2]})`),i instanceof Array&&a instanceof Array)for(let e=0;e{let i=(0,M.yj)(e);if(!i)return;let{FrameOfReferenceUID:a,referencedImageId:r,viewPlaneNormal:o,viewUp:s,instance:l,viewport:c}=d.hydrateBase(d,i,t,n),{toolInstance:h,...u}=n||{},g={annotationUID:n?.annotationUID||M.BF.uuidv4(),data:{handles:{points:t}},highlighted:!1,autoGenerated:!1,invalidated:!1,isLocked:!1,isVisible:!0,metadata:{toolName:l.getToolName(),viewPlaneNormal:o,FrameOfReferenceUID:a,referencedImageId:r,...u}};(0,y.addAnnotation)(g,c.element),(0,tr.A)([c.id])};let ll=ls;class ld extends ll{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{shadow:!0,preventHandleOutsideImage:!1,getTextLines:lc}}){super(e,t),this.postMouseDownCallback=e=>{let{currentPoints:t,element:n}=e.detail,{viewport:i}=(0,M.kJ)(n),a=e.type===S.sV.TOUCH_START,r=this.getTouchAdjustedWorldPos(i,t,a);this.isDrawing=!0;let{viewPlaneNormal:o,viewUp:s}=(0,i$.A)(i),l=this.getReferencedImageId(i,r,o,s),d={invalidated:!0,highlighted:!0,isVisible:!0,metadata:{toolName:this.getToolName(),viewPlaneNormal:[...o],viewUp:[...s],FrameOfReferenceUID:i.getFrameOfReferenceUID(),referencedImageId:l},data:{label:"",handles:{points:[[...r]]},cachedStats:{}}},c=(0,ta.Q0)(n,this.getToolName());return this.editData={annotation:d,newAnnotation:!0,viewportIdsToRender:c},this._activateModify(n),(0,oK.lY)(n),e.preventDefault(),(0,tr.A)(c),d},this.postTouchStartCallback=e=>this.postMouseDownCallback(e),this.renderAnnotation=(e,t)=>{let n=!1,{viewport:i}=e;if(!this.editData)return n;let a=this.filterInteractableAnnotationsForElement(i.element,[this.editData.annotation]);if(!a?.length)return n;let r=i.getRenderingEngine(),o={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id},s=this.editData.annotation,l=s.annotationUID,d=s.data,c=d.handles.points[0],h=i.worldToCanvas(c),u=this.getTargetId(i,d);o.annotationUID=l;let{color:g}=this.getAnnotationStyle({annotation:s,styleSpecifier:o});if(d.cachedStats[u]&&null!==d.cachedStats[u].value?s.invalidated&&this._calculateCachedStats(s,r,e):(d.cachedStats[u]={Modality:null,index:null,value:null},this._calculateCachedStats(s,r,e)),!i.getRenderingEngine())return console.warn("Rendering Engine has been destroyed"),n;(0,aK.qX)(t,l,"0",[h],{color:g}),n=!0;let p=this.configuration.getTextLines(d,u);if(p){let e=[h[0]+6,h[1]-6];(0,aK.T$)(t,l,"0",p,[e[0],e[1]],this.getLinkedTextBoxStyle(o,s))}return n}}}function lc(e,t){let{index:n,value:i,modalityUnit:a}=e.cachedStats[t];if(void 0===i)return;let r=[];return r.push(`(${n[0]}, ${n[1]}, ${n[2]})`),r.push(`${i.toFixed(2)} ${a}`),r}ld.toolName="DragProbe",n(894);var lh=n(13312);function lu(e){let[t,n,i,a]=e;return[[i[0],n[1]],[a[0],t[1]]]}function lg(e,t,n={}){return n.precalculated||lp(e,n),n.precalculated(t)}let lp=(e,t={})=>{let{xRadius:n,yRadius:i,zRadius:a}=e;(void 0===t.invXRadiusSq||void 0===t.invYRadiusSq||void 0===t.invZRadiusSq)&&(t.invXRadiusSq=0!==n?1/n**2:0,t.invYRadiusSq=0!==i?1/i**2:0,t.invZRadiusSq=0!==a?1/a**2:0);let{invXRadiusSq:r,invYRadiusSq:o,invZRadiusSq:s}=t,{center:l}=e,[d,c,h]=l;return t.precalculated=e=>{let t=e[0]-d,n=t*t*r;if(n>1)return!1;let i=e[1]-c;if((n+=i*i*o)>1)return!1;let a=e[2]-h;return(n+=a*a*s)<=1},t},{transformWorldToIndex:lm}=M.BF;class lf extends oL.EC{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{shadow:!0,preventHandleOutsideImage:!1,storePointData:!1,centerPointRadius:0,calculateStats:!0,getTextLines:lv,statsCalculator:tm.OA}}){super(e,t),this.isHandleOutsideImage=!1,this.addNewAnnotation=e=>{let{currentPoints:t,element:n}=e.detail,i=t.world;this.isDrawing=!0;let a=this.createAnnotation(e,[[...i],[...i],[...i],[...i]]);(0,y.addAnnotation)(a,n);let r=(0,ta.Q0)(n,this.getToolName());return this.editData={annotation:a,viewportIdsToRender:r,centerWorld:i,newAnnotation:!0,hasMoved:!1},this._activateDraw(n),(0,oK.lY)(n),e.preventDefault(),(0,tr.A)(r),a},this.isPointNearTool=(e,t,n,i)=>{let{viewport:a}=(0,M.kJ)(e),{data:r}=t,{points:o}=r.handles,[s,l,d,c]=o.map(e=>a.worldToCanvas(e)),h=Math.hypot(d[0]-c[0],d[1]-c[1]),u=Math.hypot(l[0]-s[0],l[1]-s[1]),g=Math.atan2(d[1]-c[1],d[0]-c[0]),p=[(d[0]+c[0])/2,(l[1]+s[1])/2],m=this._pointInEllipseCanvas({center:p,xRadius:(h-i)/2,yRadius:(u-i)/2,angle:g},n);return!!this._pointInEllipseCanvas({center:p,xRadius:(h+i)/2,yRadius:(u+i)/2,angle:g},n)&&!m},this.toolSelectedCallback=(e,t)=>{let{element:n}=e.detail;t.highlighted=!0;let i=(0,ta.Q0)(n,this.getToolName());this.editData={annotation:t,viewportIdsToRender:i,movingTextBox:!1},(0,oK.lY)(n),this._activateModify(n);let{renderingEngine:a}=(0,M.kJ)(n);(0,tr.A)(i),e.preventDefault()},this.handleSelectedCallback=(e,t,n)=>{let i,a,r,o,s,{element:l}=e.detail,{data:d}=t;t.highlighted=!0;let c=!1;if(n.worldPosition)c=!0;else{let{points:e}=d.handles,{viewport:t}=(0,M.kJ)(l),{worldToCanvas:c,canvasToWorld:h}=t;i=e.findIndex(e=>e===n);let u=e.map(c);s=u[i],r=Math.abs(u[2][0]-u[3][0]),o=Math.abs(u[0][1]-u[1][1]),a=h([(u[2][0]+u[3][0])/2,(u[0][1]+u[1][1])/2])}let h=(0,ta.Q0)(l,this.getToolName());this.editData={annotation:t,viewportIdsToRender:h,handleIndex:i,canvasWidth:r,canvasHeight:o,centerWorld:a,originalHandleCanvas:s,movingTextBox:c},this._activateModify(l),(0,oK.lY)(l),(0,tr.A)(h),e.preventDefault()},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:i,newAnnotation:a,hasMoved:r}=this.editData,{data:o}=n;(!a||r)&&(this.doneEditMemo(),n.highlighted=!1,o.handles.activeHandleIndex=null,this._deactivateModify(t),this._deactivateDraw(t),(0,oK.Q_)(t),this.editData=null,this.isDrawing=!1,this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,y.removeAnnotation)(n.annotationUID),(0,tr.A)(i),a&&(0,tu.triggerAnnotationCompleted)(n))},this._dragDrawCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{currentPoints:i}=t,a=i.canvas,{viewport:r}=(0,M.kJ)(n),{canvasToWorld:o}=r,{annotation:s,viewportIdsToRender:l,centerWorld:d,newAnnotation:c}=this.editData;this.createMemo(n,s,{newAnnotation:c});let h=r.worldToCanvas(d),{data:u}=s,g=Math.abs(a[0]-h[0]),p=Math.abs(a[1]-h[1]),m=[h[0],h[1]-p],f=[h[0],h[1]+p],v=[h[0]-g,h[1]],I=[h[0]+g,h[1]];u.handles.points=[o(m),o(f),o(v),o(I)],s.invalidated=!0,this.editData.hasMoved=!0,(0,tr.A)(l),(0,tu.triggerAnnotationModified)(s,n,S.wi.HandlesUpdated)},this._dragModifyCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{annotation:i,viewportIdsToRender:a,handleIndex:r,movingTextBox:o,newAnnotation:s}=this.editData;this.createMemo(n,i,{newAnnotation:s});let{data:l}=i;if(o){let{deltaPoints:e}=t,n=e.world,{textBox:i}=l.handles,{worldPosition:a}=i;a[0]+=n[0],a[1]+=n[1],a[2]+=n[2],i.hasMoved=!0}else if(void 0===r){let{deltaPoints:e}=t,n=e.world;l.handles.points.forEach(e=>{e[0]+=n[0],e[1]+=n[1],e[2]+=n[2]}),i.invalidated=!0}else this._dragHandle(e),i.invalidated=!0;let{renderingEngine:d}=(0,M.kJ)(n);(0,tr.A)(a),i.invalidated&&(0,tu.triggerAnnotationModified)(i,n,S.wi.HandlesUpdated)},this._dragHandle=e=>{let t=e.detail,{element:n}=t,{viewport:i}=(0,M.kJ)(n),{canvasToWorld:a,worldToCanvas:r}=i,{annotation:o,canvasWidth:s,canvasHeight:l,handleIndex:d,centerWorld:c,originalHandleCanvas:h}=this.editData,u=i.worldToCanvas(c),{data:g}=o,{points:p}=g.handles,{currentPoints:m}=t,f=m.canvas;if(0===d||1===d){let e=Math.abs(f[1]-u[1]),t=[u[0],u[1]-e],n=[u[0],u[1]+e];p[0]=a(t),p[1]=a(n);let i=s/2+(f[0]-h[0]),r=[u[0]-i,u[1]],o=[u[0]+i,u[1]];p[2]=a(r),p[3]=a(o)}else{let e=Math.abs(f[0]-u[0]),t=[u[0]-e,u[1]],n=[u[0]+e,u[1]];p[2]=a(t),p[3]=a(n);let i=l/2+(f[1]-h[1]),r=[u[0],u[1]-i],o=[u[0],u[1]+i];p[0]=a(r),p[1]=a(o)}},this.cancel=e=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateDraw(e),this._deactivateModify(e),(0,oK.Q_)(e);let{annotation:t,viewportIdsToRender:n,newAnnotation:i}=this.editData,{data:a}=t;return t.highlighted=!1,a.handles.activeHandleIndex=null,(0,tr.A)(n),i&&(0,tu.triggerAnnotationCompleted)(t),this.editData=null,t.annotationUID}},this._activateModify=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragModifyCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragModifyCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._deactivateModify=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragModifyCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragModifyCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._activateDraw=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragDrawCallback),e.addEventListener(S.sV.MOUSE_MOVE,this._dragDrawCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragDrawCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._deactivateDraw=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragDrawCallback),e.removeEventListener(S.sV.MOUSE_MOVE,this._dragDrawCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragDrawCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(e,t)=>{let n=!1,{viewport:i}=e,{element:a}=i,r=(0,y.getAnnotations)(this.getToolName(),a);if(!r?.length||(r=this.filterInteractableAnnotationsForElement(a,r),!r?.length))return n;let o=i.getRenderingEngine(),s={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let a=0;ai.worldToCanvas(e)),w=lu(_),{centerPointRadius:b}=this.configuration;if(h.cachedStats[m]&&null!=h.cachedStats[m].areaUnit){if(d.invalidated&&(this._throttledCalculateCachedStats(d,i,o,e),i instanceof M.PX)){let{referencedImageId:e}=d.metadata;for(let t in h.cachedStats)t.startsWith("imageId")&&o.getViewports().filter(rj.hz).find(t=>{let n=M.BF.imageIdToURI(e),i=t.hasImageURI(n),a=M.BF.imageIdToURI(t.getCurrentImageId());return i&&a!==n})&&delete h.cachedStats[t]}}else h.cachedStats[m]={Modality:null,area:null,max:null,mean:null,stdDev:null,areaUnit:null},this._calculateCachedStats(d,i,o);if(!i.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}if(!(0,nM.YY)(c))continue;(0,nE.Gh)(c)||this.editData||null===p||(l=[_[p]]);let C=!!(0,sq.h)("showHandlesAlways",{});(l||C)&&(0,aK.qX)(t,c,"0",C?_:l,{color:f});let A=`${c}-ellipse`;if((0,aK.Xr)(t,c,"0",_,{color:f,lineDash:I,lineWidth:v},A),b>0&&Math.min(Math.abs(w[0][0]-w[1][0])/2,Math.abs(w[0][1]-w[1][1])/2)>3*b){let e=this._getCanvasEllipseCenter(_);(0,aK.hp)(t,c,"0-center",e,b,{color:f,lineDash:I,lineWidth:v})}n=!0;let E=this.configuration.getTextLines(h,m);if(E&&0!==E.length&&!this.renderLinkedTextBoxAnnotation({enabledElement:e,svgDrawingHelper:t,annotation:d,styleSpecifier:s,textLines:E,canvasCoordinates:_,placementPoints:w}))continue}return n},this._calculateCachedStats=(e,t,n)=>{if(!this.configuration.calculateStats)return;let i=e.data,{element:a}=t,{points:r}=i.handles,o=r.map(e=>t.worldToCanvas(e)),{viewPlaneNormal:s,viewUp:l}=(0,i$.A)(t),[d,h]=lu(o),u=t.canvasToWorld(d),g=t.canvasToWorld(h),{cachedStats:p}=i,m=Object.keys(p);for(let n=0;nd.worldToIndex(e)),R=Math.abs(c.calculateLengthInIndex(x,O.slice(2,4))/2*Math.PI*(c.calculateLengthInIndex(x,O.slice(0,2))/V/2)),N={isPreScaled:(0,tp.u)(t,i),isSuvScaled:this.isSuvScaled(t,i,e.metadata.referencedImageId)},U=(0,tv.j)(h.Modality,e.metadata.referencedImageId,N);f&&(n=f.forEach(this.configuration.statsCalculator.statsCallback,{isInObject:e=>lg(S,e,{fast:!0}),boundsIJK:b,imageData:d,returnPoints:this.configuration.storePointData}));let F=this.configuration.statsCalculator.getStatistics();p[i]={Modality:h.Modality,area:R,mean:F.mean?.value,max:F.max?.value,min:F.min?.value,stdDev:F.stdDev?.value,statsArray:F.array,pointsInShape:n,isEmptyArea:P,areaUnit:L,modalityUnit:U}}else this.isHandleOutsideImage=!0,p[i]={Modality:h.Modality}}let f=e.invalidated;return e.invalidated=!1,f&&(0,tu.triggerAnnotationModified)(e,a,S.wi.StatsUpdated),p},this._isInsideVolume=(e,t,n)=>M.BF.indexWithinDimensions(e,n)&&M.BF.indexWithinDimensions(t,n),this._throttledCalculateCachedStats=(0,ti.A)(this._calculateCachedStats,100,{trailing:!0})}_pointInEllipseCanvas(e,t){let{xRadius:n,yRadius:i,center:a,angle:r}=e,o=rK.e$(rK.vt(),t,a,-r);if(n<=0||i<=0)return!1;let s=[o[0]-a[0],o[1]-a[1]];return s[0]*s[0]/(n*n)+s[1]*s[1]/(i*i)<=1}_getCanvasEllipseCenter(e){let[t,n,i,a]=e,r=[i[0],n[1]],o=[a[0],t[1]];return[(r[0]+o[0])/2,(r[1]+o[1])/2]}}function lv(e,t){let{area:n,mean:i,stdDev:a,max:r,isEmptyArea:o,areaUnit:s,modalityUnit:l,min:d}=e.cachedStats[t],c=[];if(M.BF.isNumber(n)){let e=o?"Area: Oblique not supported":`Area: ${M.BF.roundNumber(n)} ${s}`;c.push(e)}return M.BF.isNumber(i)&&c.push(`Mean: ${M.BF.roundNumber(i)} ${l}`),M.BF.isNumber(r)&&c.push(`Max: ${M.BF.roundNumber(r)} ${l}`),M.BF.isNumber(d)&&c.push(`Min: ${M.BF.roundNumber(d)} ${l}`),M.BF.isNumber(a)&&c.push(`Std Dev: ${M.BF.roundNumber(a)} ${l}`),c}function lI(e){let[t,n]=e,i=(0,sP.A)(t,n);return[[t[0]-i,t[1]-i],[t[0]+i,t[1]+i]]}function l_(e,t){let{viewUp:n,viewPlaneNormal:i}=(0,i$.A)(t),a=e7.vt();e7.$A(a,n,i);let[r,o]=e,s=e7.Io(r,o),l=e7.vt(),d=e7.vt(),c=e7.vt(),h=e7.vt();for(let e=0;e<=2;e++)l[e]=r[e]-n[e]*s,d[e]=r[e]+n[e]*s,c[e]=r[e]-a[e]*s,h[e]=r[e]+a[e]*s;return[l,d,c,h]}c=lf,lf.toolName="EllipticalROI",lf.hydrate=(e,t,n)=>{let i=(0,M.yj)(e);if(!i)return;let{FrameOfReferenceUID:a,referencedImageId:r,viewPlaneNormal:o,instance:s,viewport:l}=c.hydrateBase(c,i,t,n),{toolInstance:d,...h}=n||{},u={annotationUID:n?.annotationUID||M.BF.uuidv4(),data:{handles:{points:t,activeHandleIndex:null},label:"",cachedStats:{}},highlighted:!1,autoGenerated:!1,invalidated:!1,isLocked:!1,isVisible:!0,metadata:{toolName:s.getToolName(),viewPlaneNormal:o,FrameOfReferenceUID:a,referencedImageId:r,...h}};(0,y.addAnnotation)(u,l.element),(0,tr.A)([l.id])};let{transformWorldToIndex:lw}=M.BF;class lb extends oL.EC{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{shadow:!0,preventHandleOutsideImage:!1,storePointData:!1,centerPointRadius:0,calculateStats:!0,getTextLines:lC,statsCalculator:tm.OA,simplified:!0,targetsFilter:oL.F6.allPixelData}}){super(e,t),this.isHandleOutsideImage=!1,this.addNewAnnotation=e=>{let t,{currentPoints:n,element:i}=e.detail,a=n.world;this.isDrawing=!0,t=this.configuration.simplified?[[...a],[...a]]:[[...a],[...a],[...a],[...a],[...a]];let r=this.createAnnotation(e,t);(0,y.addAnnotation)(r,i);let o=(0,ta.Q0)(i,this.getToolName());return this.editData={annotation:r,viewportIdsToRender:o,newAnnotation:!0,hasMoved:!1},this._activateDraw(i),(0,oK.lY)(i),e.preventDefault(),(0,tr.A)(o),r},this.isPointNearTool=(e,t,n,i)=>{let{viewport:a}=(0,M.kJ)(e),{points:r}=t.data.handles,[o,s]=lu(l_(r.slice(0,2),a).map(e=>a.worldToCanvas(e))),l={left:Math.min(o[0],s[0])+i/2,top:Math.min(o[1],s[1])+i/2,width:Math.abs(o[0]-s[0])-i,height:Math.abs(o[1]-s[1])-i},d={left:Math.min(o[0],s[0])-i/2,top:Math.min(o[1],s[1])-i/2,width:Math.abs(o[0]-s[0])+i,height:Math.abs(o[1]-s[1])+i},c=this._pointInEllipseCanvas(l,n);return!!this._pointInEllipseCanvas(d,n)&&!c},this.toolSelectedCallback=(e,t)=>{let{element:n}=e.detail;t.highlighted=!0;let i=(0,ta.Q0)(n,this.getToolName());this.editData={annotation:t,viewportIdsToRender:i,movingTextBox:!1},(0,oK.lY)(n),this._activateModify(n),(0,tr.A)(i),e.preventDefault()},this.handleSelectedCallback=(e,t,n)=>{let i,{element:a}=e.detail,{data:r}=t;t.highlighted=!0;let o=!1;if(n.worldPosition)o=!0;else{let{points:e}=r.handles;i=e.findIndex(e=>e===n)}let s=(0,ta.Q0)(a,this.getToolName());this.editData={annotation:t,viewportIdsToRender:s,handleIndex:i,movingTextBox:o},this._activateModify(a),(0,oK.lY)(a),(0,tr.A)(s),e.preventDefault()},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:i,newAnnotation:a,hasMoved:r}=this.editData,{data:o}=n;(!a||r)&&(this.doneEditMemo(),n.highlighted=!1,o.handles.activeHandleIndex=null,this._deactivateModify(t),this._deactivateDraw(t),(0,oK.Q_)(t),this.editData=null,this.isDrawing=!1,this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,y.removeAnnotation)(n.annotationUID),(0,tr.A)(i),a&&(0,tu.triggerAnnotationCompleted)(n))},this._dragDrawCallback=e=>{this.isDrawing=!0;let{element:t,currentPoints:n}=e.detail,{world:i,canvas:a}=n,{viewport:r}=(0,M.kJ)(t),{canvasToWorld:o}=r,{annotation:s,viewportIdsToRender:l,newAnnotation:d}=this.editData;this.createMemo(t,s,{newAnnotation:d});let{data:c}=s,h=c.handles.points[0],u=r.worldToCanvas(h);if(this.configuration.simplified)c.handles.points[1]=i;else{let e=rK.Io(u,a);c.handles.points[0]=[...h],c.handles.points[1]=o([u[0],u[1]-e]),c.handles.points[2]=o([u[0],u[1]+e]),c.handles.points[3]=o([u[0]-e,u[1]]),c.handles.points[4]=o([u[0]+e,u[1]])}s.invalidated=!0,this.editData.hasMoved=!0,(0,tr.A)(l),(0,tu.triggerAnnotationModified)(s,t,S.wi.HandlesUpdated)},this._dragModifyCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{annotation:i,viewportIdsToRender:a,handleIndex:r,movingTextBox:o,newAnnotation:s}=this.editData;this.createMemo(n,i,{newAnnotation:s});let{data:l}=i;if(o){let{deltaPoints:e}=t,n=e.world,{textBox:i}=l.handles,{worldPosition:a}=i;a[0]+=n[0],a[1]+=n[1],a[2]+=n[2],i.hasMoved=!0}else if(void 0===r){let{deltaPoints:e}=t,n=e.world;l.handles.points.forEach(e=>{e[0]+=n[0],e[1]+=n[1],e[2]+=n[2]}),i.invalidated=!0}else this._dragHandle(e),i.invalidated=!0;(0,tr.A)(a),i.invalidated&&(0,tu.triggerAnnotationModified)(i,n,S.wi.HandlesUpdated)},this._dragHandle=e=>{let t=e.detail,{element:n}=t,{canvasToWorld:i,worldToCanvas:a}=(0,M.kJ)(n).viewport,{annotation:r,handleIndex:o}=this.editData,{data:s}=r,{points:l}=s.handles,{currentPoints:d,deltaPoints:c}=t;if(0===o){let e=c.world;l.forEach(t=>{e7.WQ(t,t,e)})}else{let e=a(l[0]),t=d.canvas,n=rK.Io(e,t);l[1]=i([e[0],e[1]-n]),l[2]=i([e[0],e[1]+n]),l[3]=i([e[0]-n,e[1]]),l[4]=i([e[0]+n,e[1]])}r.invalidated=!0},this.cancel=e=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateDraw(e),this._deactivateModify(e),(0,oK.Q_)(e);let{annotation:t,viewportIdsToRender:n,newAnnotation:i}=this.editData;return t.highlighted=!1,t.data.handles.activeHandleIndex=null,(0,tr.A)(n),i&&(0,tu.triggerAnnotationCompleted)(t),this.editData=null,t.annotationUID}},this._activateModify=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragModifyCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragModifyCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._deactivateModify=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragModifyCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragModifyCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._activateDraw=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragDrawCallback),e.addEventListener(S.sV.MOUSE_MOVE,this._dragDrawCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragDrawCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._deactivateDraw=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragDrawCallback),e.removeEventListener(S.sV.MOUSE_MOVE,this._dragDrawCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragDrawCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(e,t)=>{let n=!1,{viewport:i}=e,{element:a}=i,r=(0,y.getAnnotations)(this.getToolName(),a);if(!r?.length||(r=this.filterInteractableAnnotationsForElement(a,r),!r?.length))return n;let o=i.getRenderingEngine(),s={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let a=0;ai.worldToCanvas(e)),w=_[0],b=sk([w,_[1]]),C=lI([w,_[1]]),{centerPointRadius:A}=this.configuration;if(this.ensureCachedStatsTargets(h,m,e=>null==e.areaUnit))this._calculateCachedStats(d,i,o,e);else if(d.invalidated&&(this._throttledCalculateCachedStats(d,i,o,e),i instanceof M.PX)){let{referencedImageId:e}=d.metadata;for(let t in h.cachedStats)t.startsWith("imageId")&&o.getViewports().filter(rj.hz).find(t=>{let n=M.BF.imageIdToURI(e),i=t.hasImageURI(n),a=M.BF.imageIdToURI(t.getCurrentImageId());return i&&a!==n})&&delete h.cachedStats[t]}if(!i.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}if(!(0,nM.YY)(c))continue;(0,nE.Gh)(c)||this.editData||null===p||(l=this.configuration.simplified?[_[p]]:_);let E=!!(0,sq.h)("showHandlesAlways",{});(l||E)&&(0,aK.qX)(t,c,"0",E?_:l,{color:f});let y=`${c}-circle`,S=l_([g[0],g[1]],i).map(e=>i.worldToCanvas(e));if((0,aK.Xr)(t,c,"0",S,{color:f,lineDash:I,lineWidth:v},y),A>0&&b>3*A&&(0,aK.hp)(t,c,"0-center",w,A,{color:f,lineDash:I,lineWidth:v}),n=!0,this.configuration.calculateStats){let n=this.configuration.getTextLines(h,m);if(!n||0===n.length)continue;let i=[w,_[1]];if(!this.renderLinkedTextBoxAnnotation({enabledElement:e,svgDrawingHelper:t,annotation:d,styleSpecifier:s,textLines:n,canvasCoordinates:i,placementPoints:C}))continue}}return n},this._calculateCachedStats=(e,t,n,i)=>{if(!this.configuration.calculateStats)return;let{data:a}=e,{element:r}=t,o=e.invalidated,{points:s}=a.handles,l=s.map(e=>t.worldToCanvas(e)),[d,c]=lI([l[0],l[1]]),u=t.canvasToWorld(d),g=t.canvasToWorld(c),{cachedStats:p}=a;if(o){let e=this.getMeasurementTargets(t,a);for(let e of Object.keys(p))delete p[e];this.ensureCachedStatsTargets(a,e)}let m=Object.keys(p),f=!1;for(let n=0;no.worldToIndex(e)),v=(0,te.Op)(a,c),I=h.calculateLengthInIndex(v,c.slice(0,2)),_=Math.PI*I*I,w=2*Math.PI*I,b=0===I,{unit:C,areaUnit:A}=v,E={name:"area",value:_,unit:A,type:S.Jf.Area},y={name:"circumference",value:w,unit:C,type:S.Jf.Linear},T=[E,{name:"radius",value:I,unit:C,type:S.Jf.Linear},y];p[i]={Modality:l.Modality,area:_,isEmptyArea:b,areaUnit:A,radius:I,radiusUnit:C,perimeter:w,statsArray:T};let D=lw(o,u),P=lw(o,g),k=!oL.oS.isInsideVolume(r,[D,P]);if(f||=k,!k){let n,a=Math.min(D[0],P[0]),r=Math.max(D[0],P[0]),c=Math.min(D[1],P[1]),h=Math.max(D[1],P[1]),m=[[a,r],[c,h],[Math.min(D[2],P[2]),Math.max(D[2],P[2])]],f=s[0],v=Math.abs(u[0]-g[0])/2,I=Math.abs(u[1]-g[1])/2,_=Math.abs(u[2]-g[2])/2,w={center:f,xRadius:vlg(w,e,{fast:!0}),boundsIJK:m,imageData:o,returnPoints:this.configuration.storePointData}));let A=this.configuration.statsCalculator.getStatistics();p[i]={...p[i],Modality:l.Modality,mean:A.mean?.value,max:A.max?.value,min:A.min?.value,pointsInShape:n,stdDev:A.stdDev?.value,modalityUnit:C,statsArray:[...T,...A.array]}}}return this.isHandleOutsideImage=f,e.invalidated=!1,o&&(0,tu.triggerAnnotationModified)(e,r,S.wi.StatsUpdated),p},this._throttledCalculateCachedStats=(0,ti.A)(this._calculateCachedStats,100,{trailing:!0})}_pointInEllipseCanvas(e,t){let n=e.width/2,i=e.height/2;if(n<=0||i<=0)return!1;let a=[e.left+n,e.top+i],r=[t[0]-a[0],t[1]-a[1]];return r[0]*r[0]/(n*n)+r[1]*r[1]/(i*i)<=1}}function lC(e,t){let n=e.cachedStats[t[0]],i=[];if(!n)return i;let{radius:a,radiusUnit:r,area:o,isEmptyArea:s,areaUnit:l}=n;if(M.BF.isNumber(a)){let e=s?"Radius: Oblique not supported":`Radius: ${M.BF.roundNumber(a)} ${r}`;i.push(e)}if(M.BF.isNumber(o)){let e=s?"Area: Oblique not supported":`Area: ${M.BF.roundNumber(o)} ${l}`;i.push(e)}let d=lb.getTextLines(e,t);return d&&i.push(...d),i}h=lb,lb.toolName="CircleROI",lb.hydrate=(e,t,n)=>{let i=(0,M.yj)(e);if(!i)return;let{FrameOfReferenceUID:a,referencedImageId:r,viewPlaneNormal:o,instance:s,viewport:l}=h.hydrateBase(h,i,t,n),{toolInstance:d,...c}=n||{},u={annotationUID:n?.annotationUID||M.BF.uuidv4(),data:{handles:{points:t,textBox:{hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}},activeHandleIndex:null},label:"",cachedStats:{}},highlighted:!1,autoGenerated:!1,invalidated:!1,isLocked:!1,isVisible:!0,metadata:{toolName:s.getToolName(),viewPlaneNormal:o,FrameOfReferenceUID:a,referencedImageId:r,...c}};(0,y.addAnnotation)(u,l.element),(0,tr.A)([l.id])},lb.CIRCLE_ROI_METRICS=[{name:"Mean",attribute:"mean",unitAttribute:"modalityUnit"},{name:"Max",attribute:"max",unitAttribute:"modalityUnit"},{name:"Min",attribute:"min",unitAttribute:"modalityUnit"},{name:"Std Dev",attribute:"stdDev",unitAttribute:"modalityUnit"}],lb.getTextLines=(0,r8.D6)(h.CIRCLE_ROI_METRICS);let lA=lb;class lE extends oL.EC{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{shadow:!0,preventHandleOutsideImage:!1,degrees:[45,135,225,315],diameters:[10,30,60]}}){super(e,t),this.isHandleOutsideImage=!1,this.addNewAnnotation=e=>{let{currentPoints:t,element:n}=e.detail,i=t.world,{viewport:a,renderingEngine:r}=(0,M.kJ)(n);this.isDrawing=!0;let{viewPlaneNormal:o,viewUp:s}=(0,i$.A)(a),l=this.getReferencedImageId(a,i,o,s),d=a.getFrameOfReferenceUID(),c={highlighted:!0,invalidated:!0,metadata:{toolName:this.getToolName(),viewPlaneNormal:[...o],viewUp:[...s],FrameOfReferenceUID:d,referencedImageId:l,...a.getViewReference({points:[i]})},data:{label:"",handles:{points:[[...i]]}}};(0,y.addAnnotation)(c,n);let h=(0,ta.Q0)(n,this.getToolName());return this.editData={annotation:c,viewportIdsToRender:h,newAnnotation:!0},this._activateDraw(n),(0,oK.lY)(n),e.preventDefault(),(0,tr.A)(h),c},this.isPointNearTool=(e,t,n,i)=>{let{viewport:a}=(0,M.kJ)(e),{data:r}=t,{points:o}=r.handles;return Math.abs(sk([a.worldToCanvas(o[0]),n])){let{element:n}=e.detail;t.highlighted=!0;let i=(0,ta.Q0)(n,this.getToolName());this.editData={annotation:t,viewportIdsToRender:i},(0,oK.lY)(n),this._activateModify(n);let{renderingEngine:a}=(0,M.kJ)(n);(0,tr.A)(i),e.preventDefault()},this.handleSelectedCallback=(e,t)=>{let{element:n}=e.detail;t.highlighted=!0;let i=(0,ta.Q0)(n,this.getToolName());this.editData={annotation:t,viewportIdsToRender:i},this._activateModify(n),(0,oK.lY)(n);let{renderingEngine:a}=(0,M.kJ)(n);(0,tr.A)(i),e.preventDefault()},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:i,newAnnotation:a,hasMoved:r}=this.editData,{data:o}=n;if(a&&!r)return;n.highlighted=!1,o.handles.activeHandleIndex=null,this._deactivateModify(t),this._deactivateDraw(t),(0,oK.Q_)(t);let{renderingEngine:s}=(0,M.kJ)(t);this.editData=null,this.isDrawing=!1,this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,y.removeAnnotation)(n.annotationUID),(0,tr.A)(i),a&&(0,tu.triggerAnnotationCompleted)(n)},this._dragDrawCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{currentPoints:i}=t,a=i.canvas,{renderingEngine:r,viewport:o}=(0,M.kJ)(n),{canvasToWorld:s}=o,{annotation:l,viewportIdsToRender:d}=this.editData,{data:c}=l;c.handles.points=[s(a),s(a)],l.invalidated=!0,this.editData.hasMoved=!0,(0,tr.A)(d)},this._dragModifyCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{annotation:i,viewportIdsToRender:a}=this.editData,{data:r}=i,{deltaPoints:o}=t,s=o.world;r.handles.points.forEach(e=>{e[0]+=s[0],e[1]+=s[1],e[2]+=s[2]}),i.invalidated=!0;let{renderingEngine:l}=(0,M.kJ)(n);(0,tr.A)(a)},this._dragHandle=e=>{let t=e.detail,{element:n}=t,{canvasToWorld:i,worldToCanvas:a}=(0,M.kJ)(n).viewport,{annotation:r}=this.editData,{data:o}=r,{points:s}=o.handles,l=s.map(e=>a(e)),{currentPoints:d}=t,c=d.canvas,h=c[0]-l[0][0],u=c[1]-l[0][1],g=[l[1][0]+h,l[1][1]+u];s[0]=i(c),s[1]=i(g)},this.cancel=e=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateDraw(e),this._deactivateModify(e),(0,oK.Q_)(e);let{annotation:t,viewportIdsToRender:n,newAnnotation:i}=this.editData,{data:a}=t;t.highlighted=!1,a.handles.activeHandleIndex=null;let{renderingEngine:r}=(0,M.kJ)(e);return(0,tr.A)(n),i&&(0,tu.triggerAnnotationCompleted)(t),this.editData=null,t.annotationUID}},this._activateModify=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragModifyCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragModifyCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._deactivateModify=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragModifyCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragModifyCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._activateDraw=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragDrawCallback),e.addEventListener(S.sV.MOUSE_MOVE,this._dragDrawCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragDrawCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._deactivateDraw=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragDrawCallback),e.removeEventListener(S.sV.MOUSE_MOVE,this._dragDrawCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragDrawCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(e,t)=>{let n=!1,{viewport:i}=e,{element:a}=i,r=(0,y.getAnnotations)(this.getToolName(),a);if(!r?.length||(r=this.filterInteractableAnnotationsForElement(a,r),!r?.length))return n;let o={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let e=0;ei.worldToCanvas(e))[0];if(!i.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}if(!(0,nM.YY)(s))continue;let m=`${s}-crosshair-vertical`,f=[p[0],p[1]+5],v=[p[0],p[1]-5];(0,aK.V6)(t,s,m,f,v,{color:h,lineDash:g,lineWidth:u}),m=`${s}-crosshair-horizontal`,f=[p[0]+5,p[1]],v=[p[0]-5,p[1]],(0,aK.V6)(t,s,m,f,v,{color:h,lineDash:g,lineWidth:u});let I=this.configuration.diameters.map(e=>this.worldMeasureToCanvas(e,i));for(let e=0;ee*Math.PI/180,w=this.configuration.degrees.map(e=>_(e));for(let e=0;e{let{instance:a}=t.data.spline;return!!a&&a.isPointNearCurve(n,i)},this.toolSelectedCallback=(e,t)=>{let{element:n}=e.detail;t.highlighted=!0;let i=(0,ta.Q0)(n,this.getToolName());this.editData={annotation:t,viewportIdsToRender:i,movingTextBox:!1},this._activateModify(n),(0,tr.A)(i),e.preventDefault()},this.handleSelectedCallback=(e,t,n)=>{let i,{element:a}=e.detail,{data:r}=t;t.highlighted=!0;let o=!1;if(n.worldPosition)o=!0;else{let{points:e}=r.handles;i=e.findIndex(e=>e===n)}let s=(0,ta.Q0)(a,this.getToolName());this.editData={annotation:t,viewportIdsToRender:s,handleIndex:i,movingTextBox:o},this._activateModify(a),(0,tr.A)(s),e.preventDefault()},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:i,newAnnotation:a,contourHoleProcessingEnabled:r}=this.editData,{data:o}=n;n.autoGenerated=!1,o.handles.activeHandleIndex=null,this._deactivateModify(t),this._deactivateDraw(t);let s=(0,M.kJ)(t),{imageData:l,dimensions:d}=this.getTargetImageData(this.getTargetId(s.viewport));this.isHandleOutsideImage=o.handles.points.map(e=>M.BF.transformWorldToIndex(l,e)).some(e=>!M.BF.indexWithinDimensions(e,d)),this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,y.removeAnnotation)(n.annotationUID);let c=a?S.wi.Completed:S.wi.HandlesUpdated;this.fireChangeOnUpdate?(this.fireChangeOnUpdate.annotationUID=n.annotationUID,this.fireChangeOnUpdate.changeType=c):this.fireChangeOnUpdate={annotationUID:n.annotationUID,changeType:c,contourHoleProcessingEnabled:r},(0,tr.A)(i),this.doneEditMemo(),this.editData=null,this.isDrawing=!1},this._keyDownCallback=e=>{let t=e.detail,{element:n}=t,i=t.key??"",{lastControlPointDeletionKeys:a}=this.configuration.spline;if(!a.includes(i))return;let{annotation:r}=this.editData,{data:o}=r;if(3===o.handles.points.length)return void this.cancel(n);{let e=o.handles.points.length-1;this._deleteControlPointByIndex(n,r,e)}e.preventDefault()},this._mouseMoveCallback=e=>{let{drawPreviewEnabled:t}=this.configuration.spline;if(!t)return;let{element:n}=e.detail,{renderingEngine:i}=(0,M.kJ)(n),a=(0,ta.Q0)(n,this.getToolName());this.editData.lastCanvasPoint=e.detail.currentPoints.canvas,this.editData.closeCurveDistance=e.type===S.sV.TOUCH_DRAG?this.configuration.spline.touchCloseCurveDistance:10,(0,tr.A)(a),e.preventDefault()},this._mouseDownCallback=e=>{let t=e.type===S.sV.TOUCH_TAP||e.type===S.sV.TOUCH_END,n=e.type===S.sV.TOUCH_TAP&&e.detail.taps>=2,i=e.type===S.sV.MOUSE_DOUBLE_CLICK||n;if(n&&this.isTouchTapEchoOfLiftCommit(e.detail.currentPoints.canvas))return;let{annotation:a,viewportIdsToRender:r}=this.editData,{data:o}=a;if(o.contour.closed)return;this.doneEditMemo();let{currentPoints:s,element:l}=e.detail,{canvas:d,world:c}=s,h=o.handles.points.length>=2&&i&&!this.configuration.allowOpenSplines,u=!0;if(o.handles.points.length&&this.createMemo(l,a,{newAnnotation:1===o.handles.points.length}),o.handles.points.length>=3){this.createMemo(l,a);let{instance:e}=o.spline,n=t?this.configuration.spline.touchCloseCurveDistance:10,i=e.getClosestControlPointWithinDistance(d,n);i?.index===0&&(u=!1,h=!this.configuration.allowOpenSplines)}u&&o.handles.points.push(c),o.contour.closed=o.contour.closed||h,a.invalidated=!0,(0,tr.A)(r);let g=i&&this.configuration.allowOpenSplines&&o.handles.points.length>=3;(o.contour.closed||g)&&this._endCallback(e),e.preventDefault()},this._touchDragDuringDrawCallback=e=>{e.detail.currentPointsList.length>1||this._mouseMoveCallback(e)},this._touchEndDuringDrawCallback=e=>{let{startPointsList:t,currentPointsList:n,startPoints:i,currentPoints:a}=e.detail;t.length>1||n.length>1||tt.zx.distanceToPoint(i.canvas,a.canvas)<=u.TOUCH_TAP_MAX_CANVAS_DISTANCE||(this.recordTouchLiftCommit(a.canvas),this._mouseDownCallback(e))},this._dragCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{annotation:i,viewportIdsToRender:a,handleIndex:r,movingTextBox:o,newAnnotation:s}=this.editData,{data:l}=i;if(this.createMemo(n,i,{newAnnotation:s}),o){let{deltaPoints:e}=t,n=e.world,{textBox:i}=l.handles,{worldPosition:a}=i;a[0]+=n[0],a[1]+=n[1],a[2]+=n[2],i.hasMoved=!0}else if(void 0===r){let{deltaPoints:e}=t,n=e.world;this.moveAnnotation(i,n)}else{let{currentPoints:e}=t,n=e.world;l.handles.points[r]=[...n],i.invalidated=!0}this.editData.hasMoved=!0;let{renderingEngine:d}=(0,M.kJ)(n);(0,tr.A)(a)},this.triggerAnnotationCompleted=(e,t)=>{let n=S.sV.ANNOTATION_COMPLETED,i={annotation:e,changeType:S.wi.Completed,contourHoleProcessingEnabled:t};(0,M.Hl)(M.tX,n,i)},this.triggerAnnotationModified=(e,t,n=S.wi.StatsUpdated)=>{let{viewportId:i,renderingEngineId:a}=t,r=S.sV.ANNOTATION_MODIFIED;(0,M.Hl)(M.tX,r,{annotation:e,viewportId:i,renderingEngineId:a,changeType:n})},this.triggerChangeEvent=(e,t,n=S.wi.StatsUpdated,i)=>{n===S.wi.Completed?this.triggerAnnotationCompleted(e,i):this.triggerAnnotationModified(e,t,n)},this._activateDraw=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.KEY_DOWN,this._keyDownCallback),e.addEventListener(S.sV.MOUSE_MOVE,this._mouseMoveCallback),e.addEventListener(S.sV.MOUSE_DOWN,this._mouseDownCallback),e.addEventListener(S.sV.MOUSE_DOUBLE_CLICK,this._mouseDownCallback),e.addEventListener(S.sV.TOUCH_TAP,this._mouseDownCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._touchDragDuringDrawCallback),e.addEventListener(S.sV.TOUCH_END,this._touchEndDuringDrawCallback)},this._deactivateDraw=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.KEY_DOWN,this._keyDownCallback),e.removeEventListener(S.sV.MOUSE_MOVE,this._mouseMoveCallback),e.removeEventListener(S.sV.MOUSE_DOWN,this._mouseDownCallback),e.removeEventListener(S.sV.MOUSE_DOUBLE_CLICK,this._mouseDownCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._mouseDownCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._touchDragDuringDrawCallback),e.removeEventListener(S.sV.TOUCH_END,this._touchEndDuringDrawCallback)},this._renderStats=(e,t,n)=>{let i=e.data,{viewport:a}=t,r=this.getTargetId(a);if(!i.spline.instance.closed)return;let o={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:t.viewport.id,annotationUID:e.annotationUID},s=this.configuration.getTextLines(i,r);if(!s||0===s.length)return;let l=i.handles.points.map(e=>a.worldToCanvas(e));this.renderLinkedTextBoxAnnotation({enabledElement:t,svgDrawingHelper:n,annotation:e,styleSpecifier:o,textLines:s,canvasCoordinates:l,textBoxUID:"textBox"})},this.addControlPointCallback=(e,t)=>{let{data:n}=t,i=n.spline.type,a=this._getSplineConfig(i),r=a.controlPointAdditionDistance;if(!1===a.controlPointAdditionEnabled)return;let{element:o}=e.detail,{renderingEngine:s,viewport:l}=(0,M.kJ)(o),{canvasToWorld:d}=l,{instance:c}=n.spline,h=e.detail.currentPoints.canvas,u=c.getClosestPoint(h);if(u.distance>r)return;let{index:g,point:p}=c.addControlPointAtU(u.uValue);n.handles.points.splice(g,0,d(p)),t.invalidated=!0;let m=(0,ta.Q0)(o,this.getToolName());(0,tr.A)(m)},this.deleteControlPointCallback=(e,t)=>{let n=t.data.spline.type,i=this._getSplineConfig(n),a=i.controlPointDeletionDistance;if(!1===i.controlPointDeletionEnabled)return;let{element:r,currentPoints:o}=e.detail,{canvas:s}=o,{instance:l}=t.data.spline,d=l.getClosestControlPointWithinDistance(s,a);d&&this._deleteControlPointByIndex(r,t,d.index)},this._calculateCachedStats=(e,t)=>{if(!this.configuration.calculateStats)return;let n=e.data;if(!n.contour.closed)return;let i=(0,M.kJ)(t);if(!i)return;let{viewport:a}=i,{cachedStats:r}=n,{polyline:o}=n.contour,s=Object.keys(r);for(let e=0;ea.worldToCanvas(e)),d=l[0],c=a.canvasToWorld(d),h=a.canvasToWorld([d[0]+1,d[1]]),u=a.canvasToWorld([d[0],d[1]+1]),g=e7.Io(c,h),p=e7.Io(c,u),{imageData:m}=n,{areaUnit:f}=(0,te.Op)(n,()=>{let{maxX:e,maxY:t,minX:n,minY:i}=tt.XL.getAABB(l),r=a.canvasToWorld([n,i]),o=M.BF.transformWorldToIndex(m,r),s=a.canvasToWorld([e,t]);return[o,M.BF.transformWorldToIndex(m,s)]}),v=tt.XL.getArea(l)*g*p;r[t]={Modality:i.Modality,area:v,areaUnit:f}}let l=e.invalidated;return e.invalidated=!1,l&&this.triggerAnnotationModified(e,i,S.wi.StatsUpdated),r},this._throttledCalculateCachedStats=(0,ti.A)(this._calculateCachedStats,100,{trailing:!0}),this.annotationCompletedBinded=this.annotationCompleted.bind(this)}annotationCompleted(e){let{sourceAnnotation:t}=e.detail;this.splineToolNames.includes(t?.metadata?.toolName)&&this.configuration.simplifiedSpline&&this.isContourSegmentationTool()&&(0,t6.v1)(t)}initializeListeners(){M.tX.addEventListener(S.sV.ANNOTATION_COMPLETED,this.annotationCompletedBinded)}removeListeners(){M.tX.removeEventListener(S.sV.ANNOTATION_COMPLETED,this.annotationCompletedBinded)}onSetToolEnabled(){this.initializeListeners()}onSetToolActive(){this.initializeListeners()}onSetToolDisabled(){this.removeListeners()}addNewAnnotation(e){let{currentPoints:t,element:n}=e.detail,{canvas:i}=t,a=(0,nD.A)(e.detail.event)===this.configuration.contourHoleAdditionModifierKey,r=this.createAnnotation(e);this.isDrawing=!0,this.addAnnotation(r,n);let o=(0,ta.Q0)(n,this.getToolName());return this.editData={annotation:r,viewportIdsToRender:o,movingTextBox:!1,newAnnotation:!0,hasMoved:!1,lastCanvasPoint:i,contourHoleProcessingEnabled:a},this._activateDraw(n),e.preventDefault(),(0,tr.A)(o),r}cancel(e){if(!this.isDrawing)return;this.isDrawing=!1,this._deactivateDraw(e),this._deactivateModify(e);let{annotation:t,viewportIdsToRender:n,newAnnotation:i}=this.editData;i&&(0,y.removeAnnotation)(t.annotationUID),super.cancelAnnotation(t);let{renderingEngine:a}=(0,M.kJ)(e);return(0,tr.A)(n),this.editData=null,t.annotationUID}isContourSegmentationTool(){return!1}renderAnnotationInstance(e){let t,{enabledElement:n,targetId:i,svgDrawingHelper:a,annotationStyle:r}=e,{viewport:o}=n,{worldToCanvas:s}=o,{element:l}=o,d=e.annotation,{annotationUID:c,data:h,highlighted:u}=d,{handles:g}=h,{points:p,activeHandleIndex:m}=g,f=this.editData?.newAnnotation,{lineWidth:v,lineDash:I,color:_,locked:w}=r,b=p.map(e=>s(e)),{drawPreviewEnabled:C}=this.configuration.spline;d.data.spline&&!d.data.spline.instance&&(d.data.spline.instance=new(this._getSplineConfig(d.data.spline.type)).Class);let A=d.data.spline.type,E=this._getSplineConfig(A),M=d.data.spline.instance,S=(0,y.getChildAnnotations)(d);if(-1!==S.findIndex(e=>!e))throw Error(`Can't find annotation for child ${d.childAnnotationUIDs.join()}`);if([d,...S].filter(e=>this._isSplineROIAnnotation(e)).forEach(e=>{let t=this._updateSplineInstance(l,e).getPolylinePoints();this.updateContourPolyline(e,{points:t,closed:h.contour.closed,targetWindingDirection:ne.W.Clockwise},o,{updateWindingDirection:h.contour.closed})}),super.renderAnnotationInstance(e),h.cachedStats[i]&&null!=h.cachedStats[i].areaUnit?d.invalidated&&this._throttledCalculateCachedStats(d,l):(h.cachedStats[i]={Modality:null,area:null,areaUnit:null},this._calculateCachedStats(d,l)),w||this.editData||null===m||(t=[b[m]]),(t||f||u)&&(0,aK.qX)(a,c,"0",b,{color:_,lineWidth:v,handleRadius:"3"}),C&&M.numControlPoints>=1&&this.editData?.lastCanvasPoint&&!M.closed){let{lastCanvasPoint:e}=this.editData,{enableTwoPointPreview:t}=this.configuration.spline;if(1===M.numControlPoints&&t){let t=[b[0],e];(0,aK.VV)(a,c,"previewSplineChange",t,{color:"#9EA0CA",lineDash:I,lineWidth:1})}else if(M.numControlPoints>1){let t=M.getPreviewPolylinePoints(e,this.editData?.closeCurveDistance??10);(0,aK.VV)(a,c,"previewSplineChange",t,{color:"#9EA0CA",lineDash:I,lineWidth:1})}}if(E.showControlPointsConnectors){let e=[...b];M.closed&&e.push(b[0]),(0,aK.VV)(a,c,"controlPointsConnectors",e,{color:"rgba(255, 255, 255, 0.5)",lineWidth:1})}return this._renderStats(d,n,a),this.fireChangeOnUpdate?.annotationUID===c&&(this.triggerChangeEvent(d,n,this.fireChangeOnUpdate.changeType,this.fireChangeOnUpdate.contourHoleProcessingEnabled),this.fireChangeOnUpdate=null),d.invalidated=!1,!0}createInterpolatedSplineControl(e){if(e.data.handles.points?.length)return;let{polyline:t}=e.data.contour;if(!t||!t.length)return;e.data.handles.points=[];let{points:n}=e.data.handles,i=Math.max(10,Math.floor(t.length/20));for(let e=0;e({type:r.type,instance:o,resolution:r.resolution});return this.configuration.interpolation?.enabled&&(t=e=>{e.data.spline||=s(),this.createInterpolatedSplineControl(e)}),M.BF.deepMerge(n,{data:{handles:{points:[[...i]]},spline:s(),cachedStats:{}},onInterpolationComplete:t})}_deleteControlPointByIndex(e,t,n){let i=(0,M.kJ)(e),{points:a}=t.data.handles;3===a.length?(0,y.removeAnnotation)(t.annotationUID):a.splice(n,1);let{renderingEngine:r}=i,o=(0,ta.Q0)(e,this.getToolName());t.invalidated=!0,(0,tr.A)(o)}_isSplineROIAnnotation(e){return!!e.data?.spline}_getSplineConfig(e){let{configuration:t}=this;return Object.assign({type:e},lM,t.spline.configuration[e])}_updateSplineInstance(e,t){let{viewport:n}=(0,M.kJ)(e),{worldToCanvas:i}=n,{data:a}=t,{type:r,instance:o}=t.data.spline,s=this._getSplineConfig(r),l=a.handles.points.map(i),d=void 0!==s.resolution?parseInt(s.resolution):void 0,c=void 0!==s.scale?parseFloat(s.scale):void 0;return o.setControlPoints(l),o.closed=!!a.contour.closed,o.fixedResolution||void 0===d||o.resolution===d||(o.resolution=d,t.invalidated=!0),o instanceof oP&&!o.fixedScale&&void 0!==c&&o.scale!==c&&(o.scale=c,t.invalidated=!0),o}}function lT(e,t){let{area:n,isEmptyArea:i,areaUnit:a}=e.cachedStats[t],r=[];if(n){let e=i?"Area: Oblique not supported":`Area: ${M.BF.roundNumber(n)} ${a}`;r.push(e)}return r}u=lS,lS.toolName="SplineROI",lS.SplineTypes=g,lS.Actions=p,lS.hydrate=(e,t,n)=>{let i=(0,M.yj)(e);if(!i)return;if(t.length<3)return void console.warn("Spline requires at least 3 control points");let{FrameOfReferenceUID:a,referencedImageId:r,viewPlaneNormal:o,viewUp:s,instance:l,viewport:d}=u.hydrateBase(u,i,t,n),c=n?.splineType||g.CatmullRom,h=new(l._getSplineConfig(c)).Class,{toolInstance:p,...m}=n||{},f={annotationUID:n?.annotationUID||M.BF.uuidv4(),data:{handles:{points:t},label:"",cachedStats:{},spline:{type:c,instance:h},contour:{closed:!0}},highlighted:!1,autoGenerated:!1,invalidated:!0,isLocked:!1,isVisible:!0,metadata:{toolName:l.getToolName(),viewPlaneNormal:o,FrameOfReferenceUID:a,referencedImageId:r,...m}};(0,y.addAnnotation)(f,d.element),(0,tr.A)([d.id])};let lD=lS;class lP extends lD{constructor(e){super(M.BF.deepMerge({configuration:{calculateStats:!1}},e)),this.annotationCutMergeCompletedBinded=this.annotationCutMergeCompleted.bind(this)}isContourSegmentationTool(){return!0}initializeListeners(){M.tX.addEventListener(S.sV.ANNOTATION_CUT_MERGE_PROCESS_COMPLETED,this.annotationCutMergeCompletedBinded)}removeListeners(){M.tX.removeEventListener(S.sV.ANNOTATION_CUT_MERGE_PROCESS_COMPLETED,this.annotationCutMergeCompletedBinded)}annotationCutMergeCompleted(e){let{sourceAnnotation:t}=e.detail;this.toolName===t?.metadata?.toolName&&this.splineToolNames.includes(t?.metadata?.toolName)&&this.configuration.simplifiedSpline&&t?.annotationUID&&(0,y.getAnnotation)(t.annotationUID)&&(0,t6.v1)(t)}}lP.toolName="SplineContourSegmentationTool";var lk=n(66703);class lx{constructor({numBits:e,getPriority:t,areEqual:n}){this._bucketCount=1<e,this._areEqual="function"==typeof n?n:(e,t)=>e===t}push(e){let t=this._getBucketIndex(e),n=this._buckets[t];this._buckets[t]={value:e,next:n},this._size++}pop(){if(0===this._size)throw Error("Cannot pop because the queue is empty.");for(;null===this._buckets[this._currentBucketIndex];)this._currentBucketIndex=(this._currentBucketIndex+1)%this._bucketCount;let e=this._buckets[this._currentBucketIndex];return this._buckets[this._currentBucketIndex]=e.next,this._size--,e.value}remove(e){let t;if(!e)return!1;let n=this._getBucketIndex(e),i=this._buckets[n],a=i;for(;null!==a&&!this._areEqual(e,a.value);)t=a,a=a.next;return null!==a&&(a===i?this._buckets[n]=a.next:t.next=a.next,this._size--,!0)}isEmpty(){return 0===this._size}_getBucketIndex(e){return this._getPriority(e)&this._mask}_buildArray(e){let t=Array(e);return t.fill(null),t}}let{isEqual:lL}=M.BF,lV=2/(3*Math.PI);class lO{constructor(e,t,n){this._getPointIndex=(e,t)=>{let{width:n}=this;return e*n+t},this._getPointCoordinate=e=>[e%this.width,Math.floor(e/this.width)],this._getPointCost=e=>Math.round(this.searchGranularity*this.costs[e]);let i=e.length;this.searchGranularityBits=8,this.searchGranularity=1<.33?0:1;i[n(a,e-2)]=1,i[n(a,e-1)]=1}return i.fill(1,n(t-2,0)),i}_computeGradientX(){let{width:e,height:t}=this,n=new Float32Array(e*t),i=0;for(let a=0;a=i||l<0||l>=a)return 1;if(r<0||o<0||r>=i||o>=a)return 0;let d=n(l,s),c=this.gradMagnitude[d];return(r===s||o===l)&&(c*=Math.SQRT1_2),.43*c+.43*this.laplace[d]+.11*this._getGradientDirection(r,o,s,l)}_getNeighborPoints(e){let{width:t,height:n}=this,i=[],a=Math.max(e[0]-1,0),r=Math.max(e[1]-1,0),o=Math.min(e[0]+1,t-1),s=Math.min(e[1]+1,n-1);for(let t=r;t<=s;t++)for(let n=a;n<=o;n++)(n!==e[0]||t!==e[1])&&i.push([n,t]);return i}static createInstanceFromRawPixelData(e,t,n,i){let a=new Float32Array(e.length),{lower:r,upper:o}=i,s=o-r;for(let t=0,n=e.length;tthis.pointArray[e])}getNumControlPoints(){return this._controlPointIndexes.length}removeLastControlPoint(){this._controlPointIndexes.length&&this._controlPointIndexes.pop()}getLastControlPoint(){if(this._controlPointIndexes.length)return this.pointArray[this._controlPointIndexes[this._controlPointIndexes.length-1]]}removeLastPoints(e){this.pointArray.splice(this.pointArray.length-e,e)}addPoints(e){this.pointArray=this.pointArray.concat(e)}prependPath(e){let t=e.pointArray.length,n=[];this.pointArray=e.pointArray.concat(this.pointArray);for(let e=0;ethis._controlPointIndexes.push(e))}}class lN extends tf.A{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{getTextLines:lF,calculateStats:!0,preventHandleOutsideImage:!1,contourHoleAdditionModifierKey:S.qv.Shift,snapHandleNearby:2,touchCloseCurveDistance:36,interpolation:{enabled:!1,nearestEdge:2,showInterpolationPolyline:!1},decimate:{enabled:!1,epsilon:.1},actions:{cancelInProgress:{method:"cancelInProgress",bindings:[{key:"Escape"}]}}}}){super(e,t),this.handlesMultiTouchGestures=!0,this.isHandleOutsideImage=!1,this.isPointNearTool=(e,t,n,i)=>{let{viewport:a}=(0,M.kJ)(e),r=i*i,o=t.data.contour.polyline.map(e=>a.worldToCanvas(e)),s=o[o.length-1];for(let e=0;e{let{element:n}=e.detail;t.highlighted=!0;let i=(0,ta.Q0)(n,this.getToolName());this.editData={annotation:t,viewportIdsToRender:i,movingTextBox:!1},this._activateModify(n),(0,tr.A)(i),e.preventDefault()},this.handleSelectedCallback=(e,t,n)=>{let i,{element:a}=e.detail,{data:r}=t;t.highlighted=!0;let o=!1;if(n.worldPosition)o=!0;else{let{points:e}=r.handles;i=e.findIndex(e=>e===n)}let s=(0,ta.Q0)(a,this.getToolName());this.editData={annotation:t,viewportIdsToRender:s,handleIndex:i,movingTextBox:o},this._activateModify(a),(0,tr.A)(s),e.preventDefault()},this._endCallback=(e,t=!1)=>{let{element:n}=e.detail,{annotation:i,viewportIdsToRender:a,newAnnotation:r,contourHoleProcessingEnabled:o}=this.editData,{data:s}=i;this.doneEditMemo(),s.handles.activeHandleIndex=null,this._deactivateModify(n),this._deactivateDraw(n);let l=(0,M.kJ)(n);if(this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage||t){(0,y.removeAnnotation)(i.annotationUID),this.clearEditData(),(0,tr.A)(a);return}(0,tr.A)(a);let d=r?S.wi.Completed:S.wi.HandlesUpdated;this.triggerChangeEvent(i,l,d,o),this.clearEditData()},this.triggerChangeEvent=(e,t,n=S.wi.StatsUpdated,i=!1)=>{n===S.wi.Completed?(0,tu.triggerContourAnnotationCompleted)(e,i):(0,tu.triggerAnnotationModified)(e,t.viewport.element,n)},this._mouseDownCallback=e=>{let t=e.type===S.sV.TOUCH_TAP||e.type===S.sV.TOUCH_END,n=e.type===S.sV.TOUCH_TAP&&e.detail.taps>=2,i=e.type===S.sV.MOUSE_DOUBLE_CLICK||n;if(n&&this.isTouchTapEchoOfLiftCommit(e.detail.currentPoints.canvas))return;let{annotation:a,viewportIdsToRender:r,worldToSlice:o,sliceToWorld:s,newAnnotation:l}=this.editData;if(this.editData.closed)return;let d=e.detail,{element:c}=d,{currentPoints:h}=d,{canvas:u,world:g}=h,p=g,{viewport:m}=(0,M.kJ)(c),f=this.editData.currentPath.getControlPoints(),v=f.length>=2&&i;if(this.doneEditMemo(),this.createMemo(c,a,{newAnnotation:l&&1===f.length}),f.length>=2){let e={index:-1,distSquared:1/0},n=t?this.configuration.touchCloseCurveDistance**2:100;for(let t=0,i=f.length;t{let{element:t,currentPoints:n}=e.detail,{world:i,canvas:a}=n,r=(0,ta.Q0)(t,this.getToolName());this.editData.lastCanvasPoint=a;let{width:o,height:s}=this.scissors,{worldToSlice:l}=this.editData,d=l(i);if(d[0]<0||d[1]<0||d[0]>=o||d[1]>=s)return;let c=this.scissors.findPathToPoint(d),h=new lR;h.addPoints(c),h.prependPath(this.editData.confirmedPath),this.editData.currentPath=h,(0,tr.A)(r),e.preventDefault()},this._touchDragDuringDrawCallback=e=>{e.detail.currentPointsList.length>1||this._mouseMoveCallback(e)},this._touchEndDuringDrawCallback=e=>{let{startPointsList:t,currentPointsList:n,startPoints:i,currentPoints:a}=e.detail;t.length>1||n.length>1||tt.zx.distanceToPoint(i.canvas,a.canvas)<=lN.TOUCH_TAP_MAX_CANVAS_DISTANCE||(this.recordTouchLiftCommit(a.canvas),this._mouseDownCallback(e))},this._dragCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{annotation:i,viewportIdsToRender:a,movingTextBox:r,handleIndex:o,newAnnotation:s}=this.editData;this.createMemo(n,i,{newAnnotation:s});let{data:l}=i;if(r){let{deltaPoints:e}=t,n=e.world,{textBox:i}=l.handles,{worldPosition:a}=i;a[0]+=n[0],a[1]+=n[1],a[2]+=n[2],i.hasMoved=!0}else if(void 0===o)console.warn("Drag annotation not implemented");else{let{currentPoints:e}=t,a=e.world;this.editHandle(a,n,i,o)}this.editData.hasMoved=!0,(0,tr.A)(a)},this.cancel=e=>{if(!this.isDrawing)return;this.isDrawing=!1,this._deactivateDraw(e),this._deactivateModify(e);let{annotation:t,viewportIdsToRender:n,newAnnotation:i}=this.editData;return i&&(0,y.removeAnnotation)(t.annotationUID),(0,tr.A)(n),this.doneEditMemo(),this.scissors=null,t.annotationUID},this._activateDraw=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_MOVE,this._mouseMoveCallback),e.addEventListener(S.sV.MOUSE_DOWN,this._mouseDownCallback),e.addEventListener(S.sV.MOUSE_DOUBLE_CLICK,this._mouseDownCallback),e.addEventListener(S.sV.TOUCH_TAP,this._mouseDownCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._touchDragDuringDrawCallback),e.addEventListener(S.sV.TOUCH_END,this._touchEndDuringDrawCallback)},this._deactivateDraw=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_MOVE,this._mouseMoveCallback),e.removeEventListener(S.sV.MOUSE_DOWN,this._mouseDownCallback),e.removeEventListener(S.sV.MOUSE_DOUBLE_CLICK,this._mouseDownCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._mouseDownCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._touchDragDuringDrawCallback),e.removeEventListener(S.sV.TOUCH_END,this._touchEndDuringDrawCallback)},this._calculateCachedStats=(e,t)=>{if(!this.configuration.calculateStats)return;let n=e.data;if(!n.contour.closed)return;let i=(0,M.kJ)(t),{viewport:a}=i,{cachedStats:r}=n,{polyline:o}=n.contour,s=Object.keys(r);for(let e=0;ea.worldToCanvas(e)),d=l[0],c=a.canvasToWorld(d),h=a.canvasToWorld([d[0]+1,d[1]]),u=a.canvasToWorld([d[0],d[1]+1]),g=e7.Io(c,h),p=e7.Io(c,u),{imageData:m}=n,{areaUnit:f}=(0,te.Op)(n,()=>{let{maxX:e,maxY:t,minX:n,minY:i}=tt.XL.getAABB(l),r=a.canvasToWorld([n,i]),o=M.BF.transformWorldToIndex(m,r),s=a.canvasToWorld([e,t]);return[o,M.BF.transformWorldToIndex(m,s)]}),v=tt.XL.getArea(l)*g*p;r[t]={Modality:i.Modality,area:v,areaUnit:f}}let l=e.invalidated;return e.invalidated=!1,l&&this.triggerAnnotationModified(e,i,S.wi.StatsUpdated),r},this._renderStats=(e,t,n)=>{let i=e.data,{viewport:a}=t,r=this.getTargetId(a);if(!i.contour.closed)return;let o={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:t.viewport.id,annotationUID:e.annotationUID},s=this.configuration.getTextLines(i,r);if(!s||0===s.length)return;let l=i.handles.points.map(e=>a.worldToCanvas(e));this.renderLinkedTextBoxAnnotation({enabledElement:t,svgDrawingHelper:n,annotation:e,styleSpecifier:o,textLines:s,canvasCoordinates:l,textBoxUID:"textBox"})},this.triggerAnnotationModified=(e,t,n=S.wi.StatsUpdated)=>{let{viewportId:i,renderingEngineId:a}=t,r=S.sV.ANNOTATION_MODIFIED;(0,M.Hl)(M.tX,r,{annotation:e,viewportId:i,renderingEngineId:a,changeType:n})},this._throttledCalculateCachedStats=(0,ti.A)(this._calculateCachedStats,100,{trailing:!0})}setupBaseEditData(e,t,n,i,a){let r,o,s,l,d,c,{viewport:h}=(0,M.kJ)(t);this.isDrawing=!0;let u=h.getImageData(),{imageData:g}=u;if(h instanceof M.PX)if(h instanceof M.PX){let e=M.BF.getCurrentVolumeViewportSlice(h),{sliceToIndexMatrix:t,indexToSliceMatrix:n}=e;r=e=>{let t=M.BF.transformWorldToIndex(g,e),i=e7.Z0([0,0,0],t,n);return[i[0],i[1]]},o=e=>{let n=e7.Z0([0,0,0],[e[0],e[1],0],t);return M.BF.transformIndexToWorld(g,n)},d=e.scalarData,s=e.width,l=e.height}else throw Error("Viewport not supported");else s=u.dimensions[0],l=u.dimensions[1],r=e=>{let t=M.BF.transformWorldToIndex(g,e);return[t[0],t[1]]},o=e=>M.BF.transformIndexToWorld(g,[e[0],e[1],0]),d=u.scalarData;if(d=M.BF.convertToGrayscale(d,s,l),M.BF.viewportSupportsDisplaySetPresentation(h)){let e=h.getSourceDataId();c=(e?h.getDisplaySetPresentation(e)?.voiRange:void 0)??h.getDefaultVOIRange(e)??void 0}else({voiRange:c}=h.getProperties());let p=r(e);this.scissors=lO.createInstanceFromRawPixelData(d,s,l,c),i&&(this.scissorsNext=lO.createInstanceFromRawPixelData(d,s,l,c),this.scissorsNext.startSearch(r(i))),this.scissors.startSearch(p);let m=!i,f=new lR,v=new lR,I=m?void 0:new lR;f.addPoint(p),f.addControlPoint(p);let _=(0,ta.Q0)(t,this.getToolName()),w=h.worldToCanvas(e);this.editData={annotation:n,viewportIdsToRender:_,newAnnotation:m,hasMoved:!1,lastCanvasPoint:w,confirmedPath:f,currentPath:v,confirmedPathNext:I,closed:!1,handleIndex:this.editData?.handleIndex??n.handles?.activeHandleIndex,worldToSlice:r,sliceToWorld:o,contourHoleProcessingEnabled:a}}addNewAnnotation(e){let{currentPoints:t,element:n}=e.detail,{world:i}=t,a=this.createAnnotation(e),r=(0,nD.A)(e.detail.event)===this.configuration.contourHoleAdditionModifierKey;return this.setupBaseEditData(i,n,a,void 0,r),this.addAnnotation(a,n),this._activateDraw(n),e.preventDefault(),(0,tr.A)(this.editData.viewportIdsToRender),a}clearEditData(){this.editData=null,this.scissors=null,this.scissorsNext=null,this.isDrawing=!1}editHandle(e,t,n,i){let{data:a}=n,{points:r}=a.handles,{length:o}=r,s=r[(i-1+o)%o],l=r[(i+1)%o];if(!this.editData?.confirmedPathNext){this.setupBaseEditData(s,t,n,l);let{polyline:e}=a.contour,r=new lR,o=new lR,{worldToSlice:d}=this.editData,c=(0,lk.A)(n,i-1),h=(0,lk.A)(n,i+1);if(-1===h||-1===c)throw Error(`Can't find handle index ${-1===h&&l} ${-1===c&&s}`);0===i?o.addPoints(e.slice(h+1,c).map(d)):(r.addPoints(e.slice(0,c+1).map(d)),o.addPoints(e.slice(h,e.length).map(d))),this.editData.confirmedPath=r,this.editData.confirmedPathNext=o}let{editData:d,scissors:c}=this,{worldToSlice:h,sliceToWorld:u}=d,{activeHandleIndex:g}=a.handles;if(null==g)a.handles.activeHandleIndex=i;else if(g!==i)throw Error(`Trying to edit a different handle than the one currently being edited ${i}!==${a.handles.activeHandleIndex}`);let p=h(e);if(p[0]<0||p[0]>=c.width||p[1]<0||p[1]>=c.height)return;r[i]=u(p);let m=c.findPathToPoint(p),f=this.scissorsNext.findPathToPoint(p),v=new lR;v.prependPath(d.confirmedPath),0!==i&&v.addPoints(m),v.addPoints(f.reverse()),v.appendPath(d.confirmedPathNext),0===i&&v.addPoints(m),d.currentPath=v,n.invalidated=!0,d.hasMoved=!0,d.closed=!0}renderAnnotation(e,t){return this.updateAnnotation(this.editData?.currentPath),super.renderAnnotation(e,t)}isContourSegmentationTool(){return!1}createAnnotation(e){let t=super.createAnnotation(e),{world:n}=e.detail.currentPoints;return M.BF.deepMerge(t,{data:{handles:{points:[[...n]]}}})}cancelInProgress(e,t,n){if(!this.editData)return void this.undo();this._endCallback(n,!0)}renderAnnotationInstance(e){let{annotation:t,enabledElement:n,svgDrawingHelper:i,annotationStyle:a,targetId:r}=e,{viewport:o}=n,{element:s}=o,{worldToCanvas:l}=o,{annotationUID:d,data:c,highlighted:h}=t,{handles:u}=c,g=this.editData?.newAnnotation,{lineWidth:p,lineDash:m,color:f}=a;if(h||g&&t.annotationUID===this.editData?.annotation?.annotationUID){let e=u.points.map(l);(0,aK.qX)(i,d,"0",e,{color:f,lineDash:m,lineWidth:p})}return super.renderAnnotationInstance(e),c.cachedStats[r]&&c.cachedStats[r]?.areaUnit!==null?t.invalidated&&this._throttledCalculateCachedStats(t,s):(c.cachedStats[r]={Modality:null,area:null,areaUnit:null},this._calculateCachedStats(t,s)),this._renderStats(t,n,i),!0}updateAnnotation(e){if(!this.editData||!e)return;let{annotation:t,sliceToWorld:n,worldToSlice:i,closed:a,newAnnotation:r}=this.editData,{pointArray:o}=e;o.length>1&&(o=[...o,o[0]]);let s=r&&a?ne.W.Clockwise:void 0;this.updateContourPolyline(t,{points:o,closed:a,targetWindingDirection:s},{canvasToWorld:n,worldToCanvas:i})}}lN.toolName="LivewireContour";let lU=lN;function lF(e,t){let{area:n,areaUnit:i}=e.cachedStats[t],a=[];if(n){let e=`Area: ${M.BF.roundNumber(n)} ${i}`;a.push(e)}return a}class lB extends lU{updateInterpolatedAnnotation(e,t){!this.editData&&e.invalidated&&e.data.handles.interpolationSources&&(e.data.contour.originalPolyline=e.data.contour.polyline,queueMicrotask(()=>{if(!e.data.handles.interpolationSources)return;let{points:n}=e.data.handles,{element:i}=t.viewport;this.setupBaseEditData(n[0],i,e);let{length:a}=n,{scissors:r}=this,{nearestEdge:o,repeatInterpolation:s}=this.configuration.interpolation;e.data.handles.originalPoints=n;let{worldToSlice:l,sliceToWorld:d}=this.editData,c=[];if(o){let e=l(n[n.length-1]);n.forEach((t,i)=>{let a=l(t);e=a,c.push(a),r.startSearch(e),r.findPathToPoint(a),r.findPathToPoint(l(n[(i+3)%n.length]));let s=r.findMinNearby(a,o);M.BF.isEqual(a,s)||(c[i]=s,e=s,n[i]=d(s))})}let h=new lR;for(let e=0;e{this.startGroupRecording();let{currentPoints:t,element:n}=e.detail,i=t.world;(0,oK.lY)(n),this.isDrawing=!0;let{arrowFirst:a}=this.configuration,r=this.createAnnotation(e,[[...i],[...i]],{data:{handles:{arrowFirst:a}}});(0,y.addAnnotation)(r,n);let o=(0,ta.Q0)(n,this.getToolName());return this.editData={annotation:r,viewportIdsToRender:o,handleIndex:1,movingTextBox:!1,newAnnotation:!0,hasMoved:!1},this._activateDraw(n),e.preventDefault(),(0,tr.A)(o),r},this.isPointNearTool=(e,t,n,i)=>{let{viewport:a}=(0,M.kJ)(e),{data:r}=t,[o,s]=r.handles.points,l=a.worldToCanvas(o),d=a.worldToCanvas(s),c={start:{x:l[0],y:l[1]},end:{x:d[0],y:d[1]}};return oZ.A([c.start.x,c.start.y],[c.end.x,c.end.y],[n[0],n[1]])<=i},this.toolSelectedCallback=(e,t)=>{let{element:n}=e.detail;t.highlighted=!0;let i=(0,ta.Q0)(n,this.getToolName());this.editData={annotation:t,viewportIdsToRender:i,movingTextBox:!1},this._activateModify(n),(0,oK.lY)(n);let{renderingEngine:a}=(0,M.kJ)(n);(0,tr.A)(i),e.preventDefault()},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:i,newAnnotation:a,hasMoved:r,movingTextBox:o}=this.editData,{data:s}=n;(!a||r)&&(s.handles.activeHandleIndex=null,this._deactivateModify(t),this._deactivateDraw(t),(0,oK.Q_)(t),this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,y.removeAnnotation)(n.annotationUID),a?this.configuration.getTextCallback(e=>{if(!e){(0,y.removeAnnotation)(n.annotationUID),(0,tr.A)(i),this.editData=null,this.isDrawing=!1;return}n.data.label=e,(0,tu.triggerAnnotationModified)(n,t,S.wi.HandlesUpdated),(0,tu.triggerAnnotationCompleted)(n),this.createMemo(t,n,{newAnnotation:!!this.memo}),function(e,t,n){e.data.label=n,(0,tu.triggerAnnotationModified)(e,t,S.wi.LabelChange)}(n,t,e),this.endGroupRecording(),this.doneEditMemo(),(0,tr.A)(i)}):o||(0,tu.triggerAnnotationModified)(n,t,S.wi.HandlesUpdated),this.doneEditMemo(),this.editData=null,this.isDrawing=!1)},this._dragCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{annotation:i,viewportIdsToRender:a,handleIndex:r,movingTextBox:o,newAnnotation:s}=this.editData;this.createMemo(n,i,{newAnnotation:s});let{data:l}=i;if(o){let{deltaPoints:e}=t,n=e.world,{textBox:i}=l.handles,{worldPosition:a}=i;a[0]+=n[0],a[1]+=n[1],a[2]+=n[2],i.hasMoved=!0}else if(void 0===r){let{deltaPoints:e}=t,n=e.world;l.handles.points.forEach(e=>{e[0]+=n[0],e[1]+=n[1],e[2]+=n[2]}),i.invalidated=!0}else{let{currentPoints:e}=t,n=e.world;l.handles.points[r]=[...n],i.invalidated=!0}this.editData.hasMoved=!0,(0,tr.A)(a),i.invalidated&&(0,tu.triggerAnnotationModified)(i,n,S.wi.HandlesUpdated)},this.touchTapCallback=e=>{2==e.detail.taps&&this.doubleClickCallback(e,m.TOUCH_PROXIMITY)},this.doubleClickCallback=(e,t=m.MOUSE_PROXIMITY)=>{let n=e.detail,{element:i}=n,a=(0,y.getAnnotations)(this.getToolName(),i);if(a=this.filterInteractableAnnotationsForElement(i,a),!a?.length)return;let r=a.find(e=>this.isPointNearTool(i,e,n.currentPoints.canvas,t));r&&(this.configuration.changeTextCallback(r,e.detail,this._doneChangingTextCallback.bind(this,i,r)),this.editData=null,this.isDrawing=!1,e.stopImmediatePropagation(),e.preventDefault())},this.cancel=e=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateDraw(e),this._deactivateModify(e),(0,oK.Q_)(e);let{annotation:t,viewportIdsToRender:n,newAnnotation:i}=this.editData,{data:a}=t;return t.highlighted=!1,a.handles.activeHandleIndex=null,(0,tr.A)(n),i&&(0,tu.triggerAnnotationCompleted)(t),this.editData=null,t.annotationUID}},this._activateModify=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this._deactivateModify=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback)},this._activateDraw=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this._deactivateDraw=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this.renderAnnotation=(e,t)=>{let n=!1,{viewport:i}=e,{element:a}=i,r=(0,y.getAnnotations)(this.getToolName(),a);if(!r?.length||(r=this.filterInteractableAnnotationsForElement(a,r),!r?.length))return n;let o={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let a=0;ai.worldToCanvas(e));if((0,nE.Gh)(d)||this.editData||null===p||(s=[_[p]]),!i.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}if(!(0,nM.YY)(d))continue;let w=!!(0,sq.h)("showHandlesAlways",{});if((s||w)&&(0,aK.qX)(t,d,"0",_,{color:m,lineWidth:f}),this.configuration.arrowFirst?(0,aK.CI)(t,d,"1",_[1],_[0],{color:m,width:f,lineDash:v,viaMarker:"legacy"!==this.configuration.arrowHeadStyle,markerSize:I}):(0,aK.CI)(t,d,"1",_[0],_[1],{color:m,width:f,lineDash:v,viaMarker:"legacy"!==this.configuration.arrowHeadStyle,markerSize:I}),n=!0,u&&!this.renderLinkedTextBoxAnnotation({enabledElement:e,svgDrawingHelper:t,annotation:l,styleSpecifier:o,textLines:[u],canvasCoordinates:_}))continue}return n}}handleSelectedCallback(e,t,n){let i,{element:a}=e.detail,{data:r}=t;t.highlighted=!0;let o=!1;n.worldPosition?o=!0:i=r.handles.points.findIndex(e=>e===n);let s=(0,ta.Q0)(a,this.getToolName());this.editData={annotation:t,viewportIdsToRender:s,handleIndex:i,movingTextBox:o},this._activateModify(a),(0,oK.lY)(a);let{renderingEngine:l}=(0,M.kJ)(a);(0,tr.A)(s),e.preventDefault()}_doneChangingTextCallback(e,t,n){t.data.label=n;let i=(0,ta.Q0)(e,this.getToolName());(0,tr.A)(i),(0,tu.triggerAnnotationModified)(t,e)}_isInsideVolume(e,t,n){return M.BF.indexWithinDimensions(e,n)&&M.BF.indexWithinDimensions(t,n)}}function lH(e){return e(prompt("Enter your annotation:"))}function lW(e,t,n){return n(prompt("Enter your annotation:"))}m=lG,lG.toolName="ArrowAnnotate",lG.hydrate=(e,t,n,i)=>{let a=(0,M.yj)(e);if(!a)return;let{FrameOfReferenceUID:r,referencedImageId:o,viewPlaneNormal:s,instance:l,viewport:d}=m.hydrateBase(m,a,t,i),{toolInstance:c,...h}=i||{},u=m.createAnnotation({annotationUID:i?.annotationUID||M.BF.uuidv4(),data:{label:n||"",handles:{points:t}},autoGenerated:!1,metadata:{toolName:l.getToolName(),viewPlaneNormal:s,FrameOfReferenceUID:r,referencedImageId:o,...h}});(0,y.addAnnotation)(u,d.element),(0,tr.A)([d.id])};class lX extends oL.EC{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{shadow:!0,showAngleArc:!1,arcOffset:5,preventHandleOutsideImage:!1,getTextLines:lz}}){super(e,t),this.addNewAnnotation=e=>{if(this.angleStartedNotYetCompleted)return;this.angleStartedNotYetCompleted=!0;let{currentPoints:t,element:n}=e.detail,i=t.world;(0,oK.lY)(n),this.isDrawing=!0;let a=this.createAnnotation(e,[[...i],[...i]]);(0,y.addAnnotation)(a,n);let r=(0,ta.Q0)(n,this.getToolName());return this.editData={annotation:a,viewportIdsToRender:r,handleIndex:1,movingTextBox:!1,newAnnotation:!0,hasMoved:!1},this._activateDraw(n),e.preventDefault(),(0,tr.A)(r),a},this.isPointNearTool=(e,t,n,i)=>{let{viewport:a}=(0,M.kJ)(e),{data:r}=t,[o,s,l]=r.handles.points,d=a.worldToCanvas(o),c=a.worldToCanvas(s),h={start:{x:d[0],y:d[1]},end:{x:c[0],y:c[1]}};if(oZ.A([h.start.x,h.start.y],[h.end.x,h.end.y],[n[0],n[1]])<=i)return!0;if(!l)return!1;let u=a.worldToCanvas(l),g={start:{x:c[0],y:c[1]},end:{x:u[0],y:u[1]}};return oZ.A([g.start.x,g.start.y],[g.end.x,g.end.y],[n[0],n[1]])<=i},this.toolSelectedCallback=(e,t)=>{let{element:n}=e.detail;t.highlighted=!0;let i=(0,ta.Q0)(n,this.getToolName());this.editData={annotation:t,viewportIdsToRender:i,movingTextBox:!1},this._activateModify(n),(0,oK.lY)(n);let{renderingEngine:a}=(0,M.kJ)(n);(0,tr.A)(i),e.preventDefault()},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:i,newAnnotation:a,hasMoved:r}=this.editData,{data:o}=n;if(a&&!r)return;if(this.angleStartedNotYetCompleted&&2===o.handles.points.length){this.editData.handleIndex=2;return}this.angleStartedNotYetCompleted=!1,o.handles.activeHandleIndex=null,this._deactivateModify(t),this._deactivateDraw(t),(0,oK.Q_)(t);let{renderingEngine:s}=(0,M.kJ)(t);this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,y.removeAnnotation)(n.annotationUID),(0,tr.A)(i),this.doneEditMemo(),a&&(0,tu.triggerAnnotationCompleted)(n),this.editData=null,this.isDrawing=!1},this._dragCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{annotation:i,viewportIdsToRender:a,handleIndex:r,movingTextBox:o,newAnnotation:s}=this.editData,{data:l}=i;if(this.createMemo(n,i,{newAnnotation:s}),o){let{deltaPoints:e}=t,n=e.world,{textBox:i}=l.handles,{worldPosition:a}=i;a[0]+=n[0],a[1]+=n[1],a[2]+=n[2],i.hasMoved=!0}else if(void 0===r){let{deltaPoints:e}=t,n=e.world;l.handles.points.forEach(e=>{e[0]+=n[0],e[1]+=n[1],e[2]+=n[2]}),i.invalidated=!0}else{let{currentPoints:e}=t,n=e.world;l.handles.points[r]=[...n],i.invalidated=!0}this.editData.hasMoved=!0;let{renderingEngine:d}=(0,M.kJ)(n);(0,tr.A)(a),i.invalidated&&(0,tu.triggerAnnotationModified)(i,n,S.wi.HandlesUpdated)},this.cancel=e=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateDraw(e),this._deactivateModify(e),(0,oK.Q_)(e);let{annotation:t,viewportIdsToRender:n,newAnnotation:i}=this.editData,{data:a}=t;return t.highlighted=!1,a.handles.activeHandleIndex=null,(0,tr.A)(n),i&&(0,tu.triggerAnnotationCompleted)(t),this.editData=null,this.angleStartedNotYetCompleted=!1,t.annotationUID}},this._activateModify=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this._deactivateModify=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this._activateDraw=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this._deactivateDraw=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this.renderAnnotation=(e,t)=>{let n=!1,{viewport:i}=e,{element:a}=i,r=(0,y.getAnnotations)(this.getToolName(),a);if(!r?.length||(r=this.filterInteractableAnnotationsForElement(a,r),!r?.length))return n;let o=this.getTargetId(i),s=i.getRenderingEngine(),l={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let a=0;ai.worldToCanvas(e));if(u.cachedStats[o]&&null!=u.cachedStats[o].angle?c.invalidated&&this._throttledCalculateCachedStats(c,s,e):(u.cachedStats[o]={angle:null},this._calculateCachedStats(c,s,e)),(0,nE.Gh)(c.annotationUID)||this.editData||null===p||(d=[_[p]]),!i.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}if(!(0,nM.YY)(h))continue;let w=!!(0,sq.h)("showHandlesAlways",{});(d||w)&&(0,aK.qX)(t,h,"0",_,{color:m,lineDash:v,lineWidth:f});let b="1";if((0,aK.V6)(t,h,b,_[0],_[1],{color:m,width:f,lineDash:v}),n=!0,3!==_.length)break;if(b="2",(0,aK.V6)(t,h,b,_[1],_[2],{color:m,width:f,lineDash:v}),this.configuration.showAngleArc){let e=_[1],n=this.configuration.arcOffset,i=Math.min(oZ.A([e[0],e[1]],[_[0][0],_[0][1]],[_[2][0],_[2][1]]),oZ.A([e[0],e[1]],[_[2][0],_[2][1]],[_[0][0],_[0][1]]))/n,a=[],r=Math.atan2(_[0][1]-e[1],_[0][0]-e[0]),o=Math.atan2(_[2][1]-e[1],_[2][0]-e[0]);if(oMath.PI){let e=r;r=o,o=e+2*Math.PI}for(let t=0;t<=32;t++){let n=r+t/32*(o-r);a.push([e[0]+i*Math.cos(n),e[1]+i*Math.sin(n)])}(0,aK.kd)(t,h,"3",a,{color:m,width:f,lineDash:I})}if(!u.cachedStats[o]?.angle)continue;let C=this.configuration.getTextLines(u,o),A=[_[1],_[1]];if(!this.renderLinkedTextBoxAnnotation({enabledElement:e,svgDrawingHelper:t,annotation:c,styleSpecifier:l,textLines:C,canvasCoordinates:_,placementPoints:A}))continue}return n},this._throttledCalculateCachedStats=(0,ti.A)(this._calculateCachedStats,100,{trailing:!0})}handleSelectedCallback(e,t,n){let i,{element:a}=e.detail,{data:r}=t;t.highlighted=!0;let o=!1;n.worldPosition?o=!0:i=r.handles.points.findIndex(e=>e===n);let s=(0,ta.Q0)(a,this.getToolName());this.editData={annotation:t,viewportIdsToRender:s,handleIndex:i,movingTextBox:o},this._activateModify(a),(0,oK.lY)(a);let{renderingEngine:l}=(0,M.kJ)(a);(0,tr.A)(s),e.preventDefault()}_calculateCachedStats(e,t,n){let i=e.data,{element:a}=n.viewport;if(3!==i.handles.points.length)return;let r=i.handles.points[0],o=i.handles.points[1],s=i.handles.points[2],{cachedStats:l}=i,d=Object.keys(l);for(let e=0;eM.BF.transformWorldToIndex(c,e)).some(e=>!M.BF.indexWithinDimensions(e,a)),l[t]={angle:isNaN(n)?"Incomplete Angle":n}}let c=e.invalidated;return e.invalidated=!1,c&&(0,tu.triggerAnnotationModified)(e,a,S.wi.StatsUpdated),l}}function lz(e,t){let{angle:n}=e.cachedStats[t];return void 0===n?void 0:isNaN(n)?[`${n}`]:[`${M.BF.roundNumber(n)} ${String.fromCharCode(176)}`]}lX.toolName="Angle",lX.hydrate=(e,t,n)=>{let i=(0,M.yj)(e);if(!i)return;let{FrameOfReferenceUID:a,referencedImageId:r,viewPlaneNormal:o,instance:s,viewport:l}=lX.hydrateBase(lX,i,t,n),{toolInstance:d,...c}=n||{},h={annotationUID:n?.annotationUID||M.BF.uuidv4(),data:{handles:{points:t}},highlighted:!1,autoGenerated:!1,invalidated:!1,isLocked:!1,isVisible:!0,metadata:{toolName:s.getToolName(),viewPlaneNormal:o,FrameOfReferenceUID:a,referencedImageId:r,...c}};(0,y.addAnnotation)(h,l.element),(0,tr.A)([l.id])};let l$=(...e)=>{let t=2===e[0].length?[0,0]:[0,0,0],n=e.length;for(let i of e)t[0]+=i[0]/n,t[1]+=i[1]/n,3===t.length&&(t[2]+=i[2]/n);return t};class lY extends oL.EC{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{shadow:!0,preventHandleOutsideImage:!1,getTextLines:lj,showArcLines:!1}}){super(e,t),this.addNewAnnotation=e=>{if(this.angleStartedNotYetCompleted)return;this.angleStartedNotYetCompleted=!0;let{currentPoints:t,element:n}=e.detail,i=t.world;(0,oK.lY)(n),this.isDrawing=!0;let a=this.createAnnotation(e,[[...i],[...i]]);(0,y.addAnnotation)(a,n);let r=(0,ta.Q0)(n,this.getToolName());return this.editData={annotation:a,viewportIdsToRender:r,handleIndex:1,movingTextBox:!1,newAnnotation:!0,hasMoved:!1},this._activateDraw(n),e.preventDefault(),(0,tr.A)(r),a},this.isPointNearTool=(e,t,n,i)=>{let{viewport:a}=(0,M.kJ)(e),{data:r}=t,{distanceToPoint:o,distanceToPoint2:s}=this.distanceToLines({viewport:a,points:r.handles.points,canvasCoords:n,proximity:i});return!!(o<=i)||!!(s<=i)},this.toolSelectedCallback=(e,t,n,i,a=6)=>{let{element:r}=e.detail;t.highlighted=!0;let o=(0,ta.Q0)(r,this.getToolName()),{renderingEngine:s,viewport:l}=(0,M.kJ)(r),{isNearFirstLine:d,isNearSecondLine:c}=this.distanceToLines({viewport:l,points:t.data.handles.points,canvasCoords:i,proximity:a});this.editData={annotation:t,viewportIdsToRender:o,movingTextBox:!1,isNearFirstLine:d,isNearSecondLine:c},this._activateModify(r),(0,oK.lY)(r),(0,tr.A)(o),e.preventDefault()},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:i,newAnnotation:a,hasMoved:r}=this.editData,{data:o}=n;if(a&&!r)return;if(this.doneEditMemo(),this.angleStartedNotYetCompleted&&o.handles.points.length<4){(0,oK.Q_)(t),this.editData.handleIndex=o.handles.points.length;return}this.angleStartedNotYetCompleted=!1,o.handles.activeHandleIndex=null,this._deactivateModify(t),this._deactivateDraw(t),(0,oK.Q_)(t);let{renderingEngine:s}=(0,M.kJ)(t);this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,y.removeAnnotation)(n.annotationUID),(0,tr.A)(i),a&&(0,tu.triggerAnnotationCompleted)(n),this.editData=null,this.isDrawing=!1},this._mouseDownCallback=e=>{let{annotation:t,handleIndex:n}=this.editData,{element:i,currentPoints:a}=e.detail,r=a.world,{data:o}=t;if(1===n){o.handles.points[1]=r,this.editData.hasMoved=o.handles.points[1][0]!==o.handles.points[0][0]||o.handles.points[1][1]!==o.handles.points[0][0];return}if(3===n){o.handles.points[3]=r,this.editData.hasMoved=o.handles.points[3][0]!==o.handles.points[2][0]||o.handles.points[3][1]!==o.handles.points[2][0],this.angleStartedNotYetCompleted=!1;return}this.editData.hasMoved=!1,(0,oK.lY)(i),o.handles.points[2]=o.handles.points[3]=r,this.editData.handleIndex=o.handles.points.length-1},this._dragCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{annotation:i,viewportIdsToRender:a,handleIndex:r,movingTextBox:o,isNearFirstLine:s,isNearSecondLine:l,newAnnotation:d}=this.editData;this.createMemo(n,i,{newAnnotation:d});let{data:c}=i;if(o){let{deltaPoints:e}=t,n=e.world,{textBox:i}=c.handles,{worldPosition:a}=i;a[0]+=n[0],a[1]+=n[1],a[2]+=n[2],i.hasMoved=!0}else if(void 0===r&&(s||l)){let{deltaPoints:e}=t,n=e.world,a=c.handles.points;s?[a[0],a[1]].forEach(e=>{e[0]+=n[0],e[1]+=n[1],e[2]+=n[2]}):l&&[a[2],a[3]].forEach(e=>{e[0]+=n[0],e[1]+=n[1],e[2]+=n[2]}),i.invalidated=!0}else{let{currentPoints:e}=t,n=e.world;c.handles.points[r]=[...n],i.invalidated=!0}this.editData.hasMoved=!0;let{renderingEngine:h}=(0,M.kJ)(n);(0,tr.A)(a),i.invalidated&&(0,tu.triggerAnnotationModified)(i,n,S.wi.HandlesUpdated)},this.cancel=e=>{if(!this.isDrawing)return;this.isDrawing=!1,this._deactivateDraw(e),this._deactivateModify(e),(0,oK.Q_)(e);let{annotation:t,viewportIdsToRender:n,newAnnotation:i}=this.editData,{data:a}=t;a.handles.points.length<4&&(0,y.removeAnnotation)(t.annotationUID),t.highlighted=!1,a.handles.activeHandleIndex=null;let{renderingEngine:r}=(0,M.kJ)(e);return(0,tr.A)(n),i&&(0,tu.triggerAnnotationCompleted)(t),this.editData=null,this.angleStartedNotYetCompleted=!1,t.annotationUID},this._activateModify=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(S.sV.TOUCH_START,this._mouseDownCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._deactivateModify=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(S.sV.TOUCH_START,this._mouseDownCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._activateDraw=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.MOUSE_DOWN,this._mouseDownCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(S.sV.TOUCH_START,this._mouseDownCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._deactivateDraw=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.MOUSE_DOWN,this._mouseDownCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(S.sV.TOUCH_START,this._mouseDownCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(e,t)=>{let n=!1,{viewport:i}=e,{element:a}=i,r=(0,y.getAnnotations)(this.getToolName(),a);if(!r?.length||(r=this.filterInteractableAnnotationsForElement(a,r),!r?.length))return n;let o=i.getRenderingEngine(),s={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let a=0;ai.worldToCanvas(e));if(h.cachedStats[p]&&null!=h.cachedStats[p].angle?d.invalidated&&this._throttledCalculateCachedStats(d,o,e):(h.cachedStats[p]={angle:null,arc1Angle:null,arc2Angle:null,points:{world:{arc1Start:null,arc1End:null,arc2Start:null,arc2End:null,arc1Angle:null,arc2Angle:null},canvas:{arc1Start:null,arc1End:null,arc2Start:null,arc2End:null,arc1Angle:null,arc2Angle:null}}},this._calculateCachedStats(d,o,e)),(0,nE.Gh)(c)||this.editData||null===g||(l=[I[g]]),!i.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}if(!(0,nM.YY)(c))continue;let _=!!(0,sq.h)("showHandlesAlways",{});(l||_)&&(0,aK.qX)(t,c,"0",I,{color:m,lineDash:v,lineWidth:f});let w=[I[0],I[1]],b=[I[2],I[3]],C="line1";if((0,aK.V6)(t,c,C,w[0],w[1],{color:m,width:f,lineDash:v}),n=!0,I.length<4)break;C="line2",(0,aK.V6)(t,c,C,b[0],b[1],{color:m,width:f,lineDash:v}),C="linkLine";let A=l$(w[0],w[1]),E=l$(b[0],b[1]);(0,aK.V6)(t,c,C,A,E,{color:m,lineWidth:"1",lineDash:"1,4"});let{arc1Start:M,arc1End:y,arc2End:S,arc2Start:T}=h.cachedStats[p].points.canvas,{arc1Angle:D,arc2Angle:P}=h.cachedStats[p];if(this.configuration.showArcLines&&(C="arc1",(0,aK.V6)(t,c,C,M,y,{color:m,lineWidth:"1"}),C="arc2",(0,aK.V6)(t,c,C,T,S,{color:m,lineWidth:"1"})),!h.cachedStats[p]?.angle)continue;let k=this.configuration.getTextLines(h,p);if(this.renderLinkedTextBoxAnnotation({enabledElement:e,svgDrawingHelper:t,annotation:d,styleSpecifier:s,textLines:k??[],canvasCoordinates:I,textBoxUID:"cobbAngleText"})&&this.configuration.showArcLines){let e=this.getLinkedTextBoxStyle(s,d),n=[`${D.toFixed(2)} ${String.fromCharCode(176)}`],i=l$(M,y);(0,aK.T$)(t,c,"arcAngle1",n,i,{...e,padding:3});let a=[`${P.toFixed(2)} ${String.fromCharCode(176)}`],r=l$(T,S);(0,aK.T$)(t,c,"arcAngle2",a,r,{...e,padding:3})}}return n},this.distanceToLines=({viewport:e,points:t,canvasCoords:n,proximity:i})=>{let[a,r,o,s]=t,l=e.worldToCanvas(a),d=e.worldToCanvas(r),c=e.worldToCanvas(o),h=e.worldToCanvas(s),u={start:{x:l[0],y:l[1]},end:{x:d[0],y:d[1]}},g={start:{x:c[0],y:c[1]},end:{x:h[0],y:h[1]}},p=oZ.A([u.start.x,u.start.y],[u.end.x,u.end.y],[n[0],n[1]]),m=oZ.A([g.start.x,g.start.y],[g.end.x,g.end.y],[n[0],n[1]]),f=!1,v=!1;return p<=i?f=!0:m<=i&&(v=!0),{distanceToPoint:p,distanceToPoint2:m,isNearFirstLine:f,isNearSecondLine:v}},this.getArcsStartEndPoints=({firstLine:e,secondLine:t,mid1:n,mid2:i})=>{let a=[n,i],r=o9(e,a),o=o9(t,a),s=+(r>90),l=o>90?0:1,d=l$(a[0],a[1]),c=Math.sqrt((a[1][0]-a[0][0])**2+(a[1][1]-a[0][1])**2),h=l$(e[0],e[1]),u=l$(t[0],t[1]),g=[e[s][0]-h[0],e[s][1]-h[1]],p=Math.sqrt(g[0]**2+g[1]**2),m=[g[0]/p,g[1]/p],f=[h[0]+m[0]*c*.1,h[1]+m[1]*c*.1],v=[d[0]-n[0],d[1]-n[1]],I=Math.sqrt(v[0]**2+v[1]**2),_=[v[0]/I,v[1]/I],w=[n[0]+_[0]*c*.1,n[1]+_[1]*c*.1],b=[t[l][0]-u[0],t[l][1]-u[1]],C=Math.sqrt(b[0]**2+b[1]**2),A=[b[0]/C,b[1]/C],E=[u[0]+A[0]*c*.1,u[1]+A[1]*c*.1],M=[d[0]-i[0],d[1]-i[1]],y=Math.sqrt(M[0]**2+M[1]**2),S=[M[0]/y,M[1]/y];return{arc1Start:f,arc1End:w,arc2Start:E,arc2End:[i[0]+S[0]*c*.1,i[1]+S[1]*c*.1],arc1Angle:r>90?180-r:r,arc2Angle:o>90?180-o:o}},this._throttledCalculateCachedStats=(0,ti.A)(this._calculateCachedStats,25,{trailing:!0})}handleSelectedCallback(e,t,n,i="mouse"){let a,{element:r}=e.detail,{data:o}=t;t.highlighted=!0;let s=!1;n.worldPosition?s=!0:a=o.handles.points.findIndex(e=>e===n);let l=(0,ta.Q0)(r,this.getToolName());this.editData={annotation:t,viewportIdsToRender:l,handleIndex:a,movingTextBox:s},this._activateModify(r),(0,oK.lY)(r),(0,tr.A)(l),e.preventDefault()}_calculateCachedStats(e,t,n){let i=e.data;if(4!==i.handles.points.length)return;let a=[null,null],r=[null,null],o=Number.MAX_VALUE;for(let e=0;e<2;e+=1)for(let t=2;t<4;t+=1){let n=e7.Io(i.handles.points[e],i.handles.points[t]);ns.worldToCanvas(e)),c=[d[0],d[1]],h=[d[2],d[3]],u=l$(c[0],c[1]),g=l$(h[0],h[1]),{arc1Start:p,arc1End:m,arc2End:f,arc2Start:v,arc1Angle:I,arc2Angle:_}=this.getArcsStartEndPoints({firstLine:c,secondLine:h,mid1:u,mid2:g}),{cachedStats:w}=i,b=Object.keys(w);for(let e=0;e{if(this.startedDrawing)return;this.startedDrawing=!0;let{currentPoints:t,element:n}=e.detail,i=t.world,{viewport:a}=(0,M.kJ)(n);if(!(a instanceof M.hS)&&!(a instanceof M.Sm))throw Error("UltrasoundDirectionalTool can only be used on a StackViewport or ECGViewport");(0,oK.lY)(n),this.isDrawing=!0;let r=this.createAnnotation(e,[[...i],[...i]]);(0,y.addAnnotation)(r,n);let o=(0,ta.Q0)(n,this.getToolName());return this.editData={annotation:r,viewportIdsToRender:o,handleIndex:1,movingTextBox:!1,newAnnotation:!0,hasMoved:!1},this._activateDraw(n),e.preventDefault(),(0,tr.A)(o),r},this.isPointNearTool=(e,t,n,i)=>{let{viewport:a}=(0,M.kJ)(e),{data:r}=t,[o,s]=r.handles.points,l=a.worldToCanvas(o),d=a.worldToCanvas(s),c={start:{x:l[0],y:l[1]},end:{x:d[0],y:d[1]}};return tt.wd.distanceToPoint([c.start.x,c.start.y],[c.end.x,c.end.y],[n[0],n[1]])<=i},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:i,newAnnotation:a,hasMoved:r}=this.editData,{data:o}=n;if(a&&!r)return;if(this.startedDrawing&&1===o.handles.points.length){this.editData.handleIndex=1;return}this.startedDrawing=!1,o.handles.activeHandleIndex=null,this._deactivateModify(t),this._deactivateDraw(t),(0,oK.Q_)(t);let{renderingEngine:s}=(0,M.kJ)(t);this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,y.removeAnnotation)(n.annotationUID),(0,tr.A)(i),a&&(0,tu.triggerAnnotationCompleted)(n),this.editData=null,this.isDrawing=!1},this._dragCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{annotation:i,viewportIdsToRender:a,handleIndex:r,movingTextBox:o}=this.editData,{data:s}=i;if(o){let{deltaPoints:e}=t,n=e.world,{textBox:i}=s.handles,{worldPosition:a}=i;a[0]+=n[0],a[1]+=n[1],a[2]+=n[2],i.hasMoved=!0}else if(void 0===r){let{deltaPoints:e}=t,n=e.world;s.handles.points.forEach(e=>{e[0]+=n[0],e[1]+=n[1],e[2]+=n[2]}),i.invalidated=!0}else{let{currentPoints:e}=t,n=e.world;s.handles.points[r]=[...n],i.invalidated=!0}this.editData.hasMoved=!0;let{renderingEngine:l}=(0,M.kJ)(n);(0,tr.A)(a)},this.cancel=e=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateDraw(e),this._deactivateModify(e),(0,oK.Q_)(e);let{annotation:t,viewportIdsToRender:n,newAnnotation:i}=this.editData,{data:a}=t;return t.highlighted=!1,a.handles.activeHandleIndex=null,(0,tr.A)(n),i&&(0,tu.triggerAnnotationCompleted)(t),this.editData=null,this.startedDrawing=!1,t.annotationUID}},this._activateModify=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this._deactivateModify=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this._activateDraw=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this._deactivateDraw=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this.renderAnnotation=(e,t)=>{let n=!1,{viewport:i}=e,{element:a}=i,r=(0,y.getAnnotations)(this.getToolName(),a);if(!r?.length||(r=this.filterInteractableAnnotationsForElement(a,r),!r?.length))return n;let o=this.getTargetId(i),s=i.getRenderingEngine(),l={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let a=0;ai.worldToCanvas(e));if(h.cachedStats[o]&&null!=h.cachedStats[o].xValues?d.invalidated&&this._throttledCalculateCachedStats(d,s,e):(h.cachedStats[o]={xValues:[0,0],yValues:[0,0],isHorizontal:!1,units:[""],isUnitless:!1},this._calculateCachedStats(d,s,e)),!i.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}let m="0";if((0,aK.$V)(t,c,m,p[0],{color:g},0),n=!0,2!==p.length)break;if(m="1",(0,aK.$V)(t,c,m,p[1],{color:g},1),h.cachedStats[o].isUnitless){let e=`${c}-line-1`;(0,aK.V6)(t,c,"1",p[0],p[1],{color:g,width:1,shadow:this.configuration.shadow},e)}else{let e=p[0],n=p[1],i=n[1]-e[1],a=n[0]-e[0],r=h.cachedStats[o].isHorizontal,s=[0,0];s=r?[e[0]+a,e[1]]:[e[0],e[1]+i];let l=`${c}-line-1`,d="1";(0,aK.V6)(t,c,d,p[0],s,{color:g,width:1,shadow:this.configuration.shadow},l),l=`${c}-line-2`,d="2",(0,aK.V6)(t,c,d,p[1],s,{color:g,width:1,lineDash:[1,1],shadow:this.configuration.shadow},l)}let f=this.configuration.getTextLines(h,o,this.configuration),v=[p[1],p[1]];if(!this.renderLinkedTextBoxAnnotation({enabledElement:e,svgDrawingHelper:t,annotation:d,styleSpecifier:l,textLines:f,canvasCoordinates:p,placementPoints:v}))continue}return n},this._throttledCalculateCachedStats=(0,ti.A)(this._calculateCachedStats,100,{trailing:!0})}toolSelectedCallback(e,t,n,i){}handleSelectedCallback(e,t,n){let i,{element:a}=e.detail,{data:r}=t;t.highlighted=!0;let o=(0,ta.Q0)(a,this.getToolName());n.worldPosition||(i=r.handles.points.findIndex(e=>e===n)),this.editData={handleIndex:i,annotation:t,viewportIdsToRender:o},this._activateModify(a),(0,oK.lY)(a);let{renderingEngine:s}=(0,M.kJ)(a);(0,tr.A)(o),e.preventDefault()}_calculateCachedStats(e,t,n){let i=e.data,{element:a}=n.viewport;if(2!==i.handles.points.length)return;let{cachedStats:r}=i,o=Object.keys(r);for(let e=0;eMath.abs(r),t=[f[0],I[0]],a=[f[1],I[1]],s=[v[0],v[1]]}r[d]={xValues:t,yValues:a,isHorizontal:l,units:s,isUnitless:w}}let s=e.invalidated;return e.invalidated=!1,s&&(0,tu.triggerAnnotationModified)(e,a,S.wi.StatsUpdated),r}}function lq(e,t,n){let{xValues:i,yValues:a,units:r,isUnitless:o,isHorizontal:s}=e.cachedStats[t];if(o)return[`${M.BF.roundNumber(i[0])} px`];if(n.displayBothAxesDistances){let e=Math.abs(i[1]-i[0]),t=Math.abs(a[1]-a[0]);return[`${M.BF.roundNumber(e)} ${r[0]}`,`${M.BF.roundNumber(t)} ${r[1]}`]}if(s){let e=Math.abs(i[1]-i[0]);return[`${M.BF.roundNumber(e)} ${r[0]}`]}{let e=Math.abs(a[1]-a[0]);return[`${M.BF.roundNumber(e)} ${r[1]}`]}}function lK(e,t){let n=t[0]-e[0];return(180/Math.PI*Math.atan2(t[1]-e[1],n)%360+360)%360}function lZ(e,t){let n=lK(e,t[0]),i=lK(e,t[1]);return ne[0]-t[0]);let t=[e[0].slice()];for(let n=1;n[Math.max(e,n),Math.min(t,i)]).filter(([e,t])=>t>e);if(0===a.length)return[[n,i]];a.sort((e,t)=>e[0]-t[0]);let r=[],[o,s]=a[0];for(let e=1;ed&&l.push([d,e]),d=Math.max(d,t);return d{let{currentPoints:t,element:n}=e.detail,i=t.world,{viewport:a}=(0,M.kJ)(n);(0,oK.lY)(n),this.isDrawing=!0;let{viewPlaneNormal:r,viewUp:o,position:s}=(0,i$.A)(a),l=this.getReferencedImageId(a,i,r,o),d={highlighted:!0,invalidated:!0,metadata:{...a.getViewReference({points:[i]}),toolName:this.getToolName(),referencedImageId:l,viewUp:o,cameraPosition:s},data:{handles:{points:[[...i],[...i]],activeHandleIndex:null},annotationType:this.getActiveAnnotationType(),label:""}};(0,y.addAnnotation)(d,n);let c=(0,ta.Q0)(n,this.getToolName());return this.editData={annotation:d,viewportIdsToRender:c,handleIndex:1,movingTextBox:!1,newAnnotation:!0,hasMoved:!1},this._activateDraw(n),e.preventDefault(),(0,tr.A)(c),d},this.isPointNearTool=(e,t,n,i)=>{let{viewport:a}=(0,M.kJ)(e),{data:r}=t,[o,s]=r.handles.points,l=a.worldToCanvas(o),d=a.worldToCanvas(s),c={start:{x:l[0],y:l[1]},end:{x:d[0],y:d[1]}};return oZ.A([c.start.x,c.start.y],[c.end.x,c.end.y],[n[0],n[1]])<=i},this.toolSelectedCallback=(e,t)=>{let{element:n}=e.detail;t.highlighted=!0;let i=(0,ta.Q0)(n,this.getToolName());this.editData={annotation:t,viewportIdsToRender:i,movingTextBox:!1},this._activateModify(n),(0,oK.lY)(n),(0,tr.A)(i),e.preventDefault()},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:i,newAnnotation:a,hasMoved:r}=this.editData,{data:o}=n;(!a||r)&&(o.handles.activeHandleIndex=null,this._deactivateModify(t),this._deactivateDraw(t),(0,oK.Q_)(t),this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,y.removeAnnotation)(n.annotationUID),(0,tr.A)(i),this.doneEditMemo(),a&&(0,tu.triggerAnnotationCompleted)(n),this.editData=null,this.isDrawing=!1)},this._dragCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{viewport:i}=(0,M.kJ)(n)||{};if(!i)return;let{annotation:a,viewportIdsToRender:r,handleIndex:o,movingTextBox:s,newAnnotation:l}=this.editData,{data:d}=a;if(this.createMemo(n,a,{newAnnotation:l}),s){let{deltaPoints:e}=t,n=e.world,{textBox:i}=d.handles,{worldPosition:a}=i;a[0]+=n[0],a[1]+=n[1],a[2]+=n[2],i.hasMoved=!0}else if(void 0===o){let{deltaPoints:e}=t,n=e.world,r=d.handles.points;r.every(e=>{let t=[e[0]+n[0],e[1]+n[1],e[2]+n[2]];return this.isInsideFanShape(i,t)})&&(r.forEach(e=>{e[0]+=n[0],e[1]+=n[1],e[2]+=n[2]}),a.invalidated=!0)}else{let{currentPoints:e}=t,n=e.world;this.isInsideFanShape(i,n)&&(d.handles.points[o]=[...n],a.invalidated=!0)}this.editData.hasMoved=!0,(0,tr.A)(r),a.invalidated&&(0,tu.triggerAnnotationModified)(a,n,S.wi.HandlesUpdated)},this.cancel=e=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateDraw(e),this._deactivateModify(e),(0,oK.Q_)(e);let{annotation:t,viewportIdsToRender:n,newAnnotation:i}=this.editData,{data:a}=t;return t.highlighted=!1,a.handles.activeHandleIndex=null,(0,tr.A)(n),i&&(0,tu.triggerAnnotationCompleted)(t),this.editData=null,t.annotationUID}},this._activateModify=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._deactivateModify=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._activateDraw=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._deactivateDraw=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(e,t)=>{let n=!1,{viewport:i}=e,{element:a}=i;if(!this.getFanShapeGeometryParameters(i))return;let{imageData:r}=i.getImageData()||{};if(!r)return n;this.configuration.drawDepthGuide&&this.drawDepthGuide(t,i);let o=(0,y.getAnnotations)(this.getToolName(),a);if(!o?.length||(o=this.filterInteractableAnnotationsForElement(a,o),!o?.length))return n;this.getTargetId(i),i.getRenderingEngine();let s={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id},l=i.worldToCanvas(l5(r,this.configuration.center)),d=this.getIndexToCanvasRatio(i),c=this.configuration.innerRadius*d,h=this.configuration.outerRadius*d,u=i.getCurrentImageId(),g=l0(o.filter(e=>e.data.annotationType===f.USPleuraBLineAnnotationType.PLEURA&&e.metadata.referencedImageId===u).map(e=>lZ(l,e.data.handles.points.map(e=>i.worldToCanvas(e))))),p=[],m=[],v=e=>{let a,{annotationUID:r,data:o}=e,{points:d,activeHandleIndex:u}=o.handles;s.annotationUID=r;let{color:v,lineWidth:I,lineDash:_,shadow:w}=this.getAnnotationStyle({annotation:e,styleSpecifier:s}),b=d.map(e=>i.worldToCanvas(e));if(!i.getRenderingEngine())return console.warn("Rendering Engine has been destroyed"),n;if(!(0,nM.YY)(r))return;(0,nE.Gh)(r)||this.editData||null===u||(a=[b[u]]),a&&(0,aK.qX)(t,r,"0",b,{color:this.getColorForLineType(e),fill:this.getColorForLineType(e),lineDash:_,lineWidth:I});let C=`${r}-line`;if((0,aK.V6)(t,r,"1",b[0],b[1],{color:this.getColorForLineType(e),width:I,lineDash:_,shadow:w},C),this.configuration.showFanAnnotations){let n=lZ(l,b),i=0;e.data.annotationType===f.USPleuraBLineAnnotationType.BLINE?l1(m,n).forEach(n=>{l2(n,g).forEach(n=>{let a=++i,o=`${r}-fan-${a}`,s=`2-${a}`;(0,aK.Sm)(t,r,s,l,c,h,n[0],n[1],{color:"transparent",fill:this.getColorForLineType(e),fillOpacity:this.configuration.fanOpacity,width:I,lineDash:_,shadow:w},o,10),m.push(n)})}):e.data.annotationType===f.USPleuraBLineAnnotationType.PLEURA&&l1(p,n).forEach((n,a)=>{let o=++i,s=`${r}-fan-${o}`,d=`2-${o}`;(0,aK.Sm)(t,r,d,l,c,h,n[0],n[1],{color:"transparent",fill:this.getColorForLineType(e),fillOpacity:this.configuration.fanOpacity,width:I,lineDash:_,shadow:w},s,5),p.push(n)})}};return o.filter(e=>e.data.annotationType===f.USPleuraBLineAnnotationType.PLEURA&&e.metadata.referencedImageId===u).forEach(e=>{if(!i.getRenderingEngine())return console.warn("Rendering Engine has been destroyed"),n;v(e)}),o.filter(e=>e.data.annotationType===f.USPleuraBLineAnnotationType.BLINE&&e.metadata.referencedImageId===u).forEach(e=>{if(!i.getRenderingEngine())return console.warn("Rendering Engine has been destroyed"),n;v(e)}),n=!0,this.configuration.updatePercentageCallback&&i&&this.configuration.updatePercentageCallback(this.calculateBLinePleuraPercentage(i)),n},this.activeAnnotationType=f.USPleuraBLineAnnotationType.BLINE}static filterAnnotations(e,t=()=>!0){let n=(0,y.getAnnotations)(f.toolName,e);return n?.length?n.filter(e=>t(e.metadata.referencedImageId)):[]}static countAnnotations(e,t=()=>!0){let n=(0,y.getAnnotations)(f.toolName,e),{viewport:i}=(0,M.kJ)(e),a=i.getImageIds();if(!n?.length)return;let r=new Map;return n.forEach(e=>{let n,i=e.metadata.referencedImageId;if(!t(i))return;let{annotationType:o}=e.data;n=r.has(i)?r.get(i):{frame:(e=>{let t=a.findIndex(t=>t===e);return -1===t?0:t})(i),bLine:0,pleura:0},o===f.USPleuraBLineAnnotationType.PLEURA?n.pleura++:o===f.USPleuraBLineAnnotationType.BLINE&&n.bLine++,r.set(i,n)}),r}static deleteAnnotations(e,t=()=>!1){let n=(0,y.getAnnotations)(f.toolName,e);n?.length&&n.forEach(e=>{t(e.metadata.referencedImageId)&&(0,y.removeAnnotation)(e.annotationUID)})}setActiveAnnotationType(e){this.activeAnnotationType=e}getActiveAnnotationType(){return this.activeAnnotationType}deleteLastAnnotationType(e,t){let n,i=(0,y.getAnnotations)(f.toolName,e);if(t===f.USPleuraBLineAnnotationType.PLEURA?n=i.filter(e=>e.data.annotationType===f.USPleuraBLineAnnotationType.PLEURA):t===f.USPleuraBLineAnnotationType.BLINE&&(n=i.filter(e=>e.data.annotationType===f.USPleuraBLineAnnotationType.BLINE)),n?.length>0){let e=n.pop();(0,y.removeAnnotation)(e.annotationUID)}}handleSelectedCallback(e,t,n){let i,{element:a}=e.detail,{data:r}=t;t.highlighted=!0;let o=!1;n.worldPosition?o=!0:i=r.handles.points.findIndex(e=>e===n);let s=(0,ta.Q0)(a,this.getToolName());this.editData={annotation:t,viewportIdsToRender:s,handleIndex:i,movingTextBox:o},this._activateModify(a),(0,oK.lY)(a),(0,tr.A)(s),e.preventDefault()}isInsideFanShape(e,t){if(!this.getFanShapeGeometryParameters(e))return!1;let{imageData:n}=e.getImageData()||{};if(n){let i=lK(e.worldToCanvas(n.indexToWorld(this.configuration.center)),e.worldToCanvas(t));return i>=this.configuration.startAngle&&i<=this.configuration.endAngle}}updateFanGeometryConfiguration(e){e&&(this.isFanShapeGeometryParametersValid(e)&&(this.configuration.center=[e.center[0],e.center[1],0]),this.configuration.innerRadius=e.innerRadius,this.configuration.outerRadius=e.outerRadius,this.configuration.startAngle=e.startAngle,this.configuration.endAngle=e.endAngle)}deriveFanGeometryFromViewport(e){let{fanGeometry:t}=function(e){let{pixelData:t,width:n,height:i}=function(e){let t=M.PP.getImage(e);if(!t)return;let n=t.width,i=t.height;return{pixelData:t.getPixelData(),width:n,height:i}}(e)||{};if(!t)return;let a=function(e,t,n){let i=t*n,a=e.length/i;if(![1,3,4].includes(a))throw Error("Buffer must be 1, 3, or 4 channels per pixel");let r=Array.from({length:n},()=>Array(t).fill(!1));for(let i=0;i0){s=!0;break}r[i][n]=s}let o=Array.from({length:n},()=>Array(t).fill(0)),s=0,l={};for(let e=0;e!(e<0)&&!(e>=t)&&!(i<0)&&!(i>=n)&&r[i][e]&&0===o[i][e],[i,e],{onFlood:(e,t)=>{o[t][e]=s,a++},diagonals:!1}),l[s]=a}if(0===s)return[];let d=Object.keys(l).reduce((e,t)=>l[e]>l[t]?e:t);function c(e,i){if(o[i][e]!==+d)return!1;for(let[a,r]of[[1,0],[-1,0],[0,1],[0,-1]]){let s=e+a,l=i+r;if(s<0||s>=t||l<0||l>=n||o[l][s]!==+d)return!0}return!1}let h=null;e:for(let e=0;et[0]===e&&t[1]===i);a<0&&(a=0);let r=null;for(let e=1;e<=8;e++){let[i,o]=u[(a+e)%8],s=p[0]+i,l=p[1]+o;if(s>=0&&s=0&&lu||op)continue;let a=Math.round(i),s=Math.round(o);if(a<0||a>=t||s<0||s>=n)continue;let l=(a-m[0])*r,f=(s-m[0])*d;e[s*t+a]>c&&(l>0||f>0)&&(m=[i,o])}return m}return{P1:l(i.P1,{dx:-1,dy:-1}),P2:l(i.P2,{dx:-1,dy:1}),P3:l(i.P3,{dx:1,dy:1}),P4:l(i.P4,{dx:1,dy:-1})}}(t,n,i,function(e,t=7){if(!e.length)throw Error("Convex hull is empty");let n=e.length,i=e=>(e+1)%n,a=(e,t)=>{let n=[];for(let a=e;n.push(a),a!==t;a=i(a));return n},r=0,o=0;for(let t=1;te[o][0]&&(o=t);let s=e[r],l=e[o],d=a(r,o),c=a(o,r),h=Math.min(...e.map(e=>e[1])),u=d.some(t=>e[t][1]===h)?d:c,g=Math.min(...u.map(t=>e[t][1])),p=u.map(t=>e[t]).filter(e=>Math.abs(e[1]-g)<=t);return p.length<2&&(p=u.map(t=>e[t]).sort((e,t)=>e[1]-t[1]).slice(0,2)),{P1:p.reduce((e,t)=>t[0]t[0]>e[0]?t:e,p[0])}}(o),r,{maxDist:20,step:.5}),l=function(e){let{P1:t,P2:n,P3:i,P4:a}=e,r=(0,r2.A)(t,n,a,i,!0);if(!r)throw Error("Fan edges appear parallel — no apex found");let o=r5(r,t)*(180/Math.PI),s=r5(r,a)*(180/Math.PI);if(s<=o){let e=o;o=s,s=e}let l=Math.hypot(t[0]-r[0],t[1]-r[1]),d=Math.hypot(a[0]-r[0],a[1]-r[1]),c=Math.hypot(n[0]-r[0],n[1]-r[1]),h=Math.hypot(i[0]-r[0],i[1]-r[1]);return{center:r,startAngle:o,endAngle:s,innerRadius:Math.min(l,d),outerRadius:Math.max(c,h)}}({P1:s.P1,P2:s.P2,P3:s.P3,P4:s.P4});return{contour:a,simplified:r,hull:o,refined:s,fanGeometry:l}}(e.getCurrentImageId())||{};t&&this.updateFanGeometryConfiguration(t)}isFanShapeGeometryParametersValid(e){return e||(e=this.configuration),e?.center&&e?.innerRadius>0&&e?.outerRadius&&e?.startAngle>0&&e?.startAngle<360&&e?.endAngle>0&&e?.endAngle<360}getFanShapeGeometryParameters(e){if(this.isFanShapeGeometryParametersValid())return!0;if(!this.isFanShapeGeometryParametersValid()){let t=e.getCurrentImageId(),n=M.wx.get("ultrasoundFanShapeGeometry",t);this.updateFanGeometryConfiguration(n)}return this.isFanShapeGeometryParametersValid()||this.deriveFanGeometryFromViewport(e),this.isFanShapeGeometryParametersValid()}calculateBLinePleuraPercentage(e){if(!this.getFanShapeGeometryParameters(e))return;let{imageData:t}=e.getImageData()||{};if(!t)return;let{element:n}=e,i=e.worldToCanvas(t.indexToWorld(this.configuration.center)),a=e.getCurrentImageId(),r=(0,y.getAnnotations)(this.getToolName(),n)||[];return function(e,t,n){let i=l0(t.map(t=>lZ(e,t))),a=i.reduce((e,[t,n])=>e+(n-t),0);if(0===a)return 0;let r=[];for(let t of n){let n=l2(lZ(e,t),i);r.push(...n)}return Math.min(100,Math.max(0,l0(r).reduce((e,[t,n])=>e+(n-t),0)/a*100))}(i,r.filter(e=>e.data.annotationType===f.USPleuraBLineAnnotationType.PLEURA&&e.metadata.referencedImageId===a).map(t=>t.data.handles.points.map(t=>e.worldToCanvas(t))),r.filter(e=>e.data.annotationType===f.USPleuraBLineAnnotationType.BLINE&&e.metadata.referencedImageId===a).map(t=>t.data.handles.points.map(t=>e.worldToCanvas(t))))}getColorForLineType(e){let{annotationType:t}=e.data,{bLineColor:n,pleuraColor:i}=this.configuration;return t===f.USPleuraBLineAnnotationType.BLINE?n:t===f.USPleuraBLineAnnotationType.PLEURA?i:n}getIndexToCanvasRatio(e){let{imageData:t}=e.getImageData()||{},n=e.worldToCanvas(t.indexToWorld([1,0,0])),i=e.worldToCanvas(t.indexToWorld([2,0,0])),a=[i[0]-n[0],i[1]-n[1]];return Math.sqrt(a[0]*a[0]+a[1]*a[1])}drawDepthGuide(e,t){if(!this.getFanShapeGeometryParameters(t))return;let{imageData:n}=t.getImageData()||{};if(!n)return;let i=e=>180*e/Math.PI,a=e=>e*Math.PI/180,r=e=>t.worldToCanvas(l5(n,e)),o=this.configuration.innerRadius+this.configuration.depth_ratio*(this.configuration.outerRadius-this.configuration.innerRadius),s=this.configuration.startAngle,l=this.configuration.endAngle-s,d=Math.round(a(l)*o/(this.configuration.depthGuideDashLength+this.configuration.depthGuideDashGap));d<=0&&(d=Math.max(15,Math.round(l/5)));let c=l/d;for(let n=0;n{let i=(0,M.yj)(e);if(!i)return;let{FrameOfReferenceUID:a,referencedImageId:r,viewPlaneNormal:o,instance:s,viewport:l}=f.hydrateBase(f,i,t,n),{toolInstance:d,...c}=n||{},h={annotationUID:n?.annotationUID||M.BF.uuidv4(),data:{handles:{points:t}},highlighted:!1,autoGenerated:!1,invalidated:!1,isLocked:!1,isVisible:!0,metadata:{toolName:s.getToolName(),viewPlaneNormal:o,FrameOfReferenceUID:a,referencedImageId:r,...c}};(0,y.addAnnotation)(h,l.element),(0,tr.A)([l.id])};class l4 extends oL.EC{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{getTextCallback:l6,changeTextCallback:l9,canvasPosition:[10,10],canvasSize:10,handleRadius:"6",seriesLevel:!1,isPoint:!1}}){super(e,t),this.addNewAnnotation=e=>{let{element:t,currentPoints:n}=e.detail,{viewport:i}=(0,M.kJ)(t),a=n.world,r=this.constructor.createAnnotationForViewport(i,{data:{handles:{points:[[...a]]},seriesLevel:this.configuration.seriesLevel,isPoint:this.configuration.isPoint}});(0,y.addAnnotation)(r,t);let o=(0,ta.Q0)(t,this.getToolName());return e.preventDefault(),(0,tr.A)(o),this.configuration.getTextCallback(e=>{if(!e){(0,y.removeAnnotation)(r.annotationUID),(0,tr.A)(o),this.isDrawing=!1;return}r.data.label=e,(0,tu.triggerAnnotationCompleted)(r),(0,tr.A)(o)}),this.createMemo(t,r,{newAnnotation:!0}),r},this.isPointNearTool=(e,t,n,i)=>{let{viewport:a}=(0,M.kJ)(e),{data:r}=t;if(!r?.isPoint)return!1;let{canvasPosition:o,canvasSize:s}=this.configuration;return!!o?.length&&!!(Math.abs(n[0]-o[0]+s/2)<=s/2&&Math.abs(n[1]-o[1]+s/2)<=s/2)},this.toolSelectedCallback=(e,t)=>{t.highlighted=!0,e.preventDefault()},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:i,newAnnotation:a}=this.editData,{viewportId:r,renderingEngine:o}=(0,M.kJ)(t);this.eventDispatchDetail={viewportId:r,renderingEngineId:o.id},this._deactivateModify(t),(0,oK.Q_)(t),a&&this.createMemo(t,n,{newAnnotation:a}),this.editData=null,this.isDrawing=!1,this.doneEditMemo(),this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,y.removeAnnotation)(n.annotationUID),(0,tr.A)(i),a&&(0,tu.triggerAnnotationCompleted)(n)},this.doubleClickCallback=e=>{let t=e.detail,{element:n}=t,i=(0,y.getAnnotations)(this.getToolName(),n);if(i=this.filterInteractableAnnotationsForElement(n,i),!i?.length)return;let a=i.find(e=>this.isPointNearTool(n,e,t.currentPoints.canvas,6));a&&(this.createMemo(n,a),this.configuration.changeTextCallback(a,e.detail,this._doneChangingTextCallback.bind(this,n,a)),this.isDrawing=!1,this.doneEditMemo(),e.stopImmediatePropagation(),e.preventDefault())},this._dragCallback=e=>{this.isDrawing=!0;let{currentPoints:t,element:n}=e.detail,i=t.world,{annotation:a,viewportIdsToRender:r,newAnnotation:o}=this.editData,{data:s}=a;this.createMemo(n,a,{newAnnotation:o}),s.handles.points[0]=[...i],a.invalidated=!0,(0,tr.A)(r)},this._activateModify=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._deactivateModify=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(e,t)=>{let n=!1,{viewport:i}=e,{element:a}=i,r=(0,y.getAnnotations)(this.getToolName(),a);if(!r?.length||(r=this.filterInteractableAnnotationsForElement(a,r),!r?.length))return n;let o={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let e=0;ee+u),h,{color:d,width:1});if(n=!0,!i.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}}return n}}handleSelectedCallback(e,t){let{element:n}=e.detail;t.highlighted=!0;let i=(0,ta.Q0)(n,this.getToolName());this.editData={annotation:t,viewportIdsToRender:i},this._activateModify(n),(0,oK.lY)(n),(0,tr.A)(i),e.preventDefault()}static setPoint(e,t=!e.data.isPoint,n){e.data.isPoint=t,(0,tu.triggerAnnotationModified)(e,n)}_doneChangingTextCallback(e,t,n){t.data.label=n;let i=(0,ta.Q0)(e,this.getToolName());(0,tr.A)(i),(0,tu.triggerAnnotationModified)(t,e)}cancel(e){if(this.isDrawing){this.isDrawing=!1,this._deactivateModify(e),(0,oK.Q_)(e);let{annotation:t,viewportIdsToRender:n,newAnnotation:i}=this.editData,{data:a}=t;return t.highlighted=!1,a.handles.activeHandleIndex=null,(0,tr.A)(n),i&&(0,tu.triggerAnnotationCompleted)(t),this.editData=null,t.annotationUID}}_isInsideVolume(e,t,n){return M.BF.indexWithinDimensions(e,n)&&M.BF.indexWithinDimensions(t,n)}}function l6(e){return e(prompt("Enter your annotation:"))}function l9(e,t,n){return n(prompt("Enter your annotation:"))}l4.toolName="KeyImage",l4.dataSeries={data:{seriesLevel:!0}},l4.dataPoint={data:{isPoint:!0}};class l7 extends oL.oS{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"]}){super(e,t),this.preMouseDownCallback=e=>this._deleteNearbyAnnotations(e,"mouse"),this.preTouchStartCallback=e=>this._deleteNearbyAnnotations(e,"touch")}_deleteNearbyAnnotations(e,t){let{renderingEngineId:n,viewportId:i,element:a,currentPoints:r}=e.detail,o=(0,tT.getToolGroupForViewport)(i,n);if(!o)return!1;let s=o._toolInstances,l=[];for(let e in s){let n=s[e];if("function"!=typeof n.isPointNearTool||"function"!=typeof n.filterInteractableAnnotationsForElement)continue;let i=(0,y.getAnnotations)(e,a),o=n.filterInteractableAnnotationsForElement(a,i);if(o)for(let e of o)n.isPointNearTool(a,e,r.canvas,10,t)&&l.push(e.annotationUID)}for(let e of l){(0,nA.L6)(e);let t=(0,y.getAnnotation)(e);oL.EC.createAnnotationMemo(a,t,{deleting:!0}),(0,y.removeAnnotation)(e)}return e.preventDefault(),!0}}l7.toolName="Eraser";var de=n(88710);let{transformWorldToIndex:dt,transformIndexToWorld:dn}=M.BF;class di extends oL.oS{constructor(e,t){super(e,M.BF.deepMerge({configuration:{positiveStdDevMultiplier:1.8,shrinkExpandIncrement:.1,islandRemoval:{enabled:!1}}},t))}async preMouseDownCallback(e){let{element:t,currentPoints:n}=e.detail,{world:i}=n,{viewport:a,renderingEngine:r}=(0,M.kJ)(t),{viewUp:o}=(0,i$.A)(a),{segmentationId:s,segmentIndex:l,labelmapVolumeId:d,referencedVolumeId:c}=await this.getLabelmapSegmentationData(a);if(!this._isOrthogonalView(a,c))throw Error("Oblique view is not supported yet");return this.growCutData={metadata:{...a.getViewReference({points:[i]}),viewUp:o},segmentation:{segmentationId:s,segmentIndex:l,labelmapVolumeId:d,referencedVolumeId:c},viewportId:a.id,renderingEngineId:r.id},e.preventDefault(),!0}shrink(){this._runLastCommand({shrinkExpandAmount:-this.configuration.shrinkExpandIncrement})}expand(){this._runLastCommand({shrinkExpandAmount:this.configuration.shrinkExpandIncrement})}refresh(){this._runLastCommand()}async getGrowCutLabelmap(e){throw Error("Not implemented")}async runGrowCut(){let{growCutData:e,configuration:t}=this,{segmentation:{segmentationId:n,segmentIndex:i,labelmapVolumeId:a}}=e,r=M.PP.getVolume(a),o=0,s=async({shrinkExpandAmount:a=0}={})=>{0!==a&&(this.seeds=null),o+=a;let s=Math.max(.1,t.positiveStdDevMultiplier+o),l=a<0?Math.max(1,30-3*Math.abs(o)):30+3*o,d={...e,options:{...e.options||{},positiveSeedValue:i,negativeSeedValue:255,positiveStdDevMultiplier:s,negativeSeedMargin:l}},c=await this.getGrowCutLabelmap(d),{isPartialVolume:h}=t;(h?this.applyPartialGrowCutLabelmap:this.applyGrowCutLabelmap)(n,i,r,c),this._removeIslands(d)};await s(),di.lastGrowCutCommand=s,this.growCutData=null}applyPartialGrowCutLabelmap(e,t,n,i){let a=i.voxelManager.getCompleteScalarDataArray(),r=n.voxelManager,[o,s,l]=i.dimensions,[d,c]=n.dimensions,h=o*s,u=d*c;for(let e=0;e{e===t&&a.setAtIndex(n,e)}),(0,e9.triggerSegmentationDataModified)(e)}_runLastCommand({shrinkExpandAmount:e=0}={}){let t=di.lastGrowCutCommand;t&&t({shrinkExpandAmount:e})}async getLabelmapSegmentationData(e){let t=aC(e.id);if(!t)throw Error("No active segmentation found");let{segmentationId:n}=t,i=aE.Q(n),{representationData:a}=a8.getSegmentation(n),r=a[S.D_.Labelmap],{volumeId:o,referencedVolumeId:s}=r;if(!o){let t=e.getImageIds();if(M.BF.isValidVolume(t))o=(0,rf.A)(n).volumeId;else{let t=e.getCurrentImageId(),i=M.PP.getImage(t),a=M.R2.createAndCacheDerivedImage(t);s=this._createFakeVolume([i.imageId,a.imageId]).volumeId;let r=(0,t$.vl)(e.id,n),l=M.R2.createAndCacheDerivedImage(r);o=this._createFakeVolume([r,l.imageId]).volumeId}}if(!s){let{imageIds:e}=r,t=e.map(e=>M.PP.getImage(e).referencedImageId),n=M.PP.generateVolumeId(t),i=M.PP.getVolume(n);s=i?i.volumeId:(await M.UH.createAndCacheVolumeFromImagesSync(n,t)).volumeId}return{segmentationId:n,segmentIndex:i,labelmapVolumeId:o,referencedVolumeId:s}}_createFakeVolume(e){let t=M.PP.generateVolumeId(e),n=M.PP.getVolume(t);if(n)return n;let i=M.BF.generateVolumePropsFromImageIds(e,t),a=i.spacing;0===a[2]&&(a[2]=1);let r=new M.QV({volumeId:t,dataType:i.dataType,metadata:M.BF.deepClone(i.metadata),dimensions:i.dimensions,spacing:i.spacing,origin:i.origin,direction:i.direction,referencedVolumeId:i.referencedVolumeId,imageIds:i.imageIds,referencedImageIds:i.referencedImageIds});return M.PP.putVolumeSync(t,r),r}_isOrthogonalView(e,t){let n=M.PP.getVolume(t).imageData,i=(0,i$.A)(e),{ijkVecColDir:a,ijkVecSliceDir:r}=M.BF.getVolumeDirectionVectors(n,i);return[a,r].every(e=>M.BF.isEqual(Math.abs(e[0]),1)||M.BF.isEqual(Math.abs(e[1]),1)||M.BF.isEqual(Math.abs(e[2]),1))}getRemoveIslandData(e){}_removeIslands(e){let{islandRemoval:t}=this.configuration;if(!t.enabled)return;let{segmentation:{segmentIndex:n,labelmapVolumeId:i},renderingEngineId:a,viewportId:r}=e,o=M.PP.getVolume(i),s=this.getRemoveIslandData(e);if(!s)return;let[l,d]=o.dimensions,c=l*d,{worldIslandPoints:h=[],islandPointIndexes:u=[]}=s,g=[...s?.ijkIslandPoints??[]],p=(0,M.lD)(a).getViewport(r),{voxelManager:m}=o,f=new rm.A;g=(g=g.concat(h.map(e=>dt(o.imageData,e)))).concat(u.map(e=>{let t=Math.floor(e/l)%d,n=Math.floor(e/c);return[e%l,t,n]})),f.initialize(p,m,{points:g,previewSegmentIndex:n,segmentIndex:n}),f.floodFillSegmentIsland(),f.removeExternalIslands(),f.removeInternalIslands()}getSegmentStyle({segmentationId:e,viewportId:t,segmentIndex:n}){return(0,de.u)({segmentationId:e,segmentIndex:n,viewportId:t})}}di.lastGrowCutCommand=null,di.toolName="GrowCutBaseTool";let da=di;class dr extends da{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{isPartialVolume:!0,positiveSeedVariance:.5,negativeSeedVariance:.9}}){super(e,t),this._dragCallback=e=>{let{element:t,currentPoints:n}=e.detail,{world:i}=n,{viewport:a}=(0,M.kJ)(t);this.growCutData.circleBorderPoint=i,(0,tr.A)([a.id])},this._endCallback=async e=>{let{element:t}=e.detail,{viewport:n}=(0,M.kJ)(t);this.runGrowCut(),this._deactivateDraw(t),this.growCutData=null,(0,oK.Q_)(t),(0,tr.A)([n.id])},this._deactivateDraw=e=>{e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)}}async preMouseDownCallback(e){let{element:t,currentPoints:n}=e.detail,{world:i}=n,{viewport:a,renderingEngine:r}=(0,M.kJ)(t);return await super.preMouseDownCallback(e),Object.assign(this.growCutData,{circleCenterPoint:i,circleBorderPoint:i}),this._activateDraw(t),(0,oK.lY)(t),(0,tr.A)([a.id]),!0}async getGrowCutLabelmap(e){let{segmentation:{referencedVolumeId:t},renderingEngineId:n,viewportId:i,circleCenterPoint:a,circleBorderPoint:r,options:o}=e,{positiveSeedVariance:s,negativeSeedVariance:l,positiveStdDevMultiplier:d}=this.configuration,c=d??1,h=(o?.positiveStdDevMultiplier?Math.max(o.positiveStdDevMultiplier,.01):c)/c,u={...o,positiveSeedVariance:Math.max(.01,(s??1)*h),negativeSeedVariance:Math.max(.01,(l??1)*h)},g=(0,M.lD)(n).getViewport(i),p=e7.Il(e7.jb(e7.vt(),a,r));return ro(t,{center:a,radius:p},g,u)}_activateDraw(e){e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)}renderAnnotation(e,t){if(!this.growCutData)return;let{viewport:n}=e,{segmentation:i,circleCenterPoint:a,circleBorderPoint:r}=this.growCutData,o=n.worldToCanvas(a),s=n.worldToCanvas(r),l=rK.jb(rK.vt(),s,o),d=rK.Il(l);if(M.BF.isEqual(d,0))return;let{color:c}=this.getSegmentStyle({segmentationId:i.segmentationId,segmentIndex:i.segmentIndex,viewportId:n.id});(0,aK.hp)(t,"growcut","0",o,d,{color:c})}}dr.toolName="RegionSegment";class ds extends da{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{isPartialVolume:!1,positiveSeedVariance:.4,negativeSeedVariance:.9,subVolumePaddingPercentage:.1,islandRemoval:{enabled:!1}}}){super(e,t),this.mouseTimer=null,this.allowedToProceed=!1}mouseMoveCallback(e){if(this.mode!==S.r$.Active)return;let{currentPoints:t,element:n}=e.detail,{world:i}=t;n.style.cursor="default",null!==this.mouseTimer&&(window.clearTimeout(this.mouseTimer),this.mouseTimer=null),this.mouseTimer=window.setTimeout(()=>{this.onMouseStable(e,i,n)},this.configuration.mouseStabilityDelay||500)}async onMouseStable(e,t,n){let i;await super.preMouseDownCallback(e);let a=ru(M.PP.getVolume(this.growCutData.segmentation.referencedVolumeId),t,{})||{positiveSeedIndices:new Set,negativeSeedIndices:new Set},{positiveSeedIndices:r,negativeSeedIndices:o}=a;r.size/o.size>20||o.size<30?(i="not-allowed",this.allowedToProceed=!1):(i="copy",this.allowedToProceed=!0);let s=(0,M.kJ)(n);n&&(n.style.cursor=i,requestAnimationFrame(()=>{n.style.cursor!==i&&(n.style.cursor=i)})),this.allowedToProceed&&(this.seeds=a),s&&s.viewport&&s.viewport.render()}async preMouseDownCallback(e){if(!this.allowedToProceed)return!1;let{currentPoints:t,element:n}=e.detail;(0,M.kJ)(n)&&(n.style.cursor="wait",requestAnimationFrame(()=>{"wait"!==n.style.cursor&&(n.style.cursor="wait")}));let{world:i}=t;return await super.preMouseDownCallback(e),this.growCutData=M.BF.deepMerge(this.growCutData,{worldPoint:i,islandRemoval:{worldIslandPoints:[i]}}),this.growCutData.worldPoint=i,this.growCutData.islandRemoval={worldIslandPoints:[i]},await this.runGrowCut(),n&&(n.style.cursor="default"),!0}getRemoveIslandData(e){let{worldPoint:t}=e;return{worldIslandPoints:[t]}}async getGrowCutLabelmap(e){let{segmentation:{referencedVolumeId:t},worldPoint:n,options:i}=e,{subVolumePaddingPercentage:a}=this.configuration;return rg({referencedVolumeId:t,worldPosition:n,options:{...i,subVolumePaddingPercentage:a,seeds:this.seeds}})}}ds.toolName="RegionSegmentPlus";let{logger:dl}=M.BF,{growCutLog:dd}=dl;class dc extends rm.A{constructor(e){super(e),this.verboseLogging=!1,this.usingPreviewLayer=!1,this.internalFilledPoints=[],this.verboseLogging=e?.verboseLogging??this.verboseLogging}initialize(e,t,n){this.usingPreviewLayer=!!t.sourceVoxelManager;let i=super.initialize(e,t,n);if(i&&this.verboseLogging){let{segmentSet:e}=this;dd.info("islandRemoval: initialize",{segmentIndex:this.segmentIndex,previewSegmentIndex:this.previewSegmentIndex,segmentSetDimensions:{width:e.width,height:e.height,depth:e.depth},boundsIJKPrime:e.normalizer.boundsIJKPrime,clickedPoints:this.selectedPoints,segmentVoxelsInPlaneGrid:dc.countRleValueVolume(e,rm.a.SEGMENT)})}return i}static countRleValueVolume(e,t){let n=0;return e.forEach((e,i)=>{i.value===t&&(n+=i.end-i.start)}),n}floodFillSegmentIsland(){if(this.verboseLogging){let{selectedPoints:e,segmentSet:t}=this,{fromIJK:n}=t.normalizer;for(let i of e){let e=n(i),a=t.get(t.toIndex(e));a!==rm.a.SEGMENT&&dd.info("islandRemoval: floodFillSegmentIsland click skipped (not SEGMENT)",{clickedPointVolumeIJK:i,ijkPrime:e,segmentSetAtIndex:a})}}let e=super.floodFillSegmentIsland();return this.verboseLogging&&dd.info("islandRemoval: floodFillSegmentIsland done",{totalIslandVoxels:e,islandVoxelsAfterFlood:dc.countRleValueVolume(this.segmentSet,rm.a.ISLAND)}),e}removeExternalIslands(){let{previewVoxelManager:e,segmentSet:t}=this,{toIJK:n}=t.normalizer,i=e.sourceVoxelManager??e;if(!this.usingPreviewLayer)return dd.warn("islandRemoval: removeExternalIslands has no preview layer; external island cleanup of accepted voxels is skipped. Run island removal through a preview layer to clear external islands."),0;let a=0,r=(r,o)=>{let[,s,l]=t.toIJK(r);if(o.value!==rm.a.ISLAND)for(let t=o.start;t=i||v<0||v>=a||I<0||I>=r)return{sliceMasks:new Map,voxelCount:0,truncated:!1,bbox:null};s&&await s(I);let _=e(f,v,I);if(!o(_,_))return{sliceMasks:new Map,voxelCount:0,truncated:!1,bbox:null};let w=i*a,b=new Map;function C(e,t,n){let a;(!(a=b.get(e))&&(a=new Uint8Array(w),b.set(e,a)),a)[n*i+t]|=1}let A=d?[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0]]:[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],E=[],M=0;E.push(I*w+v*i+f),C(I,f,v);let y=f,S=f,T=v,D=v,P=I,k=I,x=()=>({min:[y,T,P],max:[S,D,k]}),L=0,V=!1,O=m;for(;Mg||p&&E.length>=O&&(O+=m,!p({voxelCount:E.length,bbox:x()}))){V=!0;break}L++,l>0&&L%l==0&&await new Promise(e=>setTimeout(e,0));let[t,n,R]=function(e){let t=Math.floor(e/i),n=Math.floor(t/a);return[e%i,t%a,n]}(E[M++]);for(let l=0;l=i||p<0||p>=a||m<0||m>=r||c>=0&&Math.abs(m-I)>c||h>=0&&(Math.abs(g-f)>h||Math.abs(p-v)>h)||d&&m!==I||function(e,t,n){let a=b.get(e);return!!a&&(1&a[n*i+t])!=0}(m,g,p))){if(s&&(await s(m),u?.()))break;o(e(g,p,m),_)&&(C(m,g,p),E.push(m*w+p*i+g),gS&&(S=g),pD&&(D=p),mk&&(k=m))}}}let R=E.length;return{sliceMasks:b,voxelCount:R,truncated:V,bbox:R>0?x():null}}let{VoxelManager:du}=M.BF;function dg(e,t,n,i,a){let[r,o,s]=t,l=0,d=0,c=0,[h,u,g]=n.map(Math.round);for(let t=g-i;t<=g+i;t++)if(!(t<0)&&!(t>=s)){for(let n=u-i;n<=u+i;n++)if(!(n<0)&&!(n>=o))for(let o=h-i;o<=h+i;o++){if(o<0||o>=r)continue;let i=Number(e.getAtIJK(o,n,t)),s=a?a(i):i;l+=s,d+=s*s,c++}}if(0===c){if(h>=0&&h=0&&u=0&&g{},dw=e=>{},db="cornerstone.tools: floodFill: prep",dC="cornerstone.tools: floodFill: prep: ref_volume_meta",dA="cornerstone.tools: floodFill: intensityRange",dE="cornerstone.tools: floodFill: fillAndIslandRemoval",dM="cornerstone.tools: floodFill: islandRemoval:external",dy="cornerstone.tools: floodFill: islandRemoval:internal";function dS(e,t,n){return n?.voiMapping?function(e,t,n,i){let{dimensions:a,imageData:r}=e,[o,s,l]=a,d=e.voxelManager,c=i?.initialNeighborhoodRadius??1,h=i?.positiveStdDevMultiplier??1.8,u=dm(r,t).map(Math.round);if(u[0]<0||u[0]>=o||u[1]<0||u[1]>=s||u[2]<0||u[2]>=l)return dI.info("intensity range (VOI-mapped): click outside volume",{ijkStart:u,dimensions:[o,s,l]}),null;let g=e=>df(e,n),p=dg(d,a,u,c,g);0===p.count&&(p.mean=g(Number(d.getAtIJKPoint(u))),p.stdDev=0);let m=p.mean-h*p.stdDev,f=p.mean+h*p.stdDev;if((m=Math.max(0,Math.min(1,m)))>(f=Math.max(0,Math.min(1,f)))){let e=m;m=f,f=e}let{rawMin:v,rawMax:I}=dv(m,f,n),_=Number(d.getAtIJKPoint(u));return{min:Math.min(Math.min(v,I),_),max:Math.max(Math.max(v,I),_),ijkStart:u,diagnostics:{neighborhoodMean:p.mean,neighborhoodStdDev:p.stdDev,clickedVoxelValue:_,positiveStdDevMultiplier:h,neighborhoodRadius:c,strategy:"meanStdVoiMapped",mappedBand:{min:m,max:f}}}}(e,t,n.voiMapping,n):function(e,t,n){let{dimensions:i,imageData:a}=e,[r,o,s]=i,l=e.voxelManager,d=n?.initialNeighborhoodRadius??1,c=n?.positiveStdDevMultiplier??1.8,h=dm(a,t).map(Math.round);if(h[0]<0||h[0]>=r||h[1]<0||h[1]>=o||h[2]<0||h[2]>=s)return dI.warn("intensity range: click outside volume",{ijkStart:h,dimensions:[r,o,s]}),null;let u=dg(l,i,h,d);0===u.count&&(u.mean=Number(l.getAtIJKPoint(h)),u.stdDev=0);let g=u.mean-c*u.stdDev,p=u.mean+c*u.stdDev,m=l.getAtIJKPoint(h);return mp?(dI.warn("intensity range: clicked voxel intensity is outside the calculated positive range"),null):{min:g,max:p,ijkStart:h,diagnostics:{neighborhoodMean:u.mean,neighborhoodStdDev:u.stdDev,clickedVoxelValue:m,positiveStdDevMultiplier:c,neighborhoodRadius:d,strategy:"meanStdRaw"}}}(e,t,n)}function dT(e,t,n,i,a,r,o){for(let s=0;s.2){let e=Number(o.voxelManager.getAtIJKPoint(E)),a=Math.max(0,Math.min(1,df(e,_))),r=Math.max(0,a-.1),s=Math.min(1,a+.1),{rawMin:l,rawMax:d}=dv(r,s,_);S=Math.min(l,d,e),T=Math.max(l,d,e),dI.info("flood fill: clipped wide WL band around seed",{maxWlBandFraction:.2,originalMappedBand:{min:t,max:n,width:i},clippedMappedBand:{min:r,max:s,width:s-r}})}}dI.info("intensity tolerance band",{toleranceMin:S,toleranceMax:T,width:T-S,...y}),d_(dE);try{let e,{dimensions:t}=o,[r,s,l]=t,d=o.voxelManager,c=r*s,h=i.voxelManager,u=a.historyVoxelManager??i.voxelManager,f=S,v=T,I=Number(d.getAtIJKPoint(E));Number.isFinite(I)&&(Iv&&(dI.info("flood fill: expanded tolerance max to include seed voxel",{seedScalar:I,previousMax:v}),v=I));let _=a.ensureSliceLoaded??function(e){let t=e.dimensions[2],n=e.imageIds;if(!n?.length)return async()=>void 0;let i=new Set,a=new Map;return async function(e){if(!Number.isFinite(e)||e<0||e>=t||i.has(e))return;let r=a.get(e);if(r)return r;let o=n[e];if(!o)return;let s=M.R2.loadImage(o).then(()=>{i.add(e)}).finally(()=>{a.delete(e)});return a.set(e,s),s}}(o),w=!0===a.planar;w&&dI.info("flood fill: planar mode (fixed slice index k)",{ijkStart:E});let{sliceMasks:b,voxelCount:C,truncated:A,bbox:y}=await dh((e,t,n)=>{if(e<0||e>=r||t<0||t>=s||n<0||n>=l)return;let i=n*c+t*r+e;return d.getAtIndex(i)},E,{width:r,height:s,depth:l,equals:(e,t)=>void 0!==e&&"number"==typeof e&&e>=f&&e<=v,ensureSliceLoaded:_,yieldEvery:a.yieldEvery??500,planar:w,maxDeltaK:a.maxDeltaK,maxDeltaIJ:a.maxDeltaIJ,isCancelled:a.isCancelled,maxVoxels:a.maxVoxels,shouldContinue:a.shouldContinueRegion}),D=!A&&y&&a.shouldContinueRegion&&!a.shouldContinueRegion({voxelCount:C,bbox:y});if(A||D)return dI.warn("flood fill: rejected — region stopped by budget or shape gate; nothing committed",{maxVoxels:a.maxVoxels,voxelCountAtStop:C,bbox:y,ijkStart:E}),a.onRejected?.({voxelCount:C,bbox:y}),null;if(0===C)return dI.info("flood fill: zero voxels (range may be too tight or seed isolated)",{ijkStart:E,toleranceMin:f,toleranceMax:v}),i;if(a.isCancelled?.()===!0)return dI.info("flood fill: cancellation requested; nothing committed",{ijkStart:E,voxelCountAtCancel:C}),null;let{floodedPoints:P,voxelCount:k}=function({labelmapVolume:e,sliceMasks:t,width:n,height:i,paintIndex:a,historyVoxelManager:r}){let o=[],s=0,l=e.voxelManager,[d,c,h]=e.dimensions;if(d!==n||c!==i)throw Error(`commitSliceMasksToLabelmapVolume: labelmap in-plane dimensions ${d}x${c} do not match mask dimensions ${n}x${i}`);let u=n*i,g=u*h,p=Array.from(t.keys()).sort((e,t)=>e-t);for(let d=0;d=h)continue;let m=t.get(c);if(!m||m.length!==u)continue;let f=!1,v=1/0,I=1/0,_=-1/0,w=-1/0,b=(e,t,n)=>{for(let i=t;i=g&&"function"==typeof l.scalarData.fill){let e=c*u,t=l.scalarData;for(let r=0;r=u&&"function"==typeof h.scalarData.fill){let e=h.scalarData;for(let t=0;t0?P.concat(B):P,m&&dT(h,u,p,g,x,c,r),a.onCommitted?.(x),i}finally{dw(dE)}}let{transformWorldToIndex:dP,mapScalarToViewportVoiIntensity:dk,mapViewportVoiIntensityToScalar:dx,getVolumeDirectionVectors:dL}=M.BF,{growCutLog:dV}=M.BF.logger;function dO(e){if(!e.length)return 0;let t=e.slice().sort((e,t)=>e-t);return t[Math.floor(t.length/2)]}function dR(e,t){let n,i,{seedByte:a,polarity:r,voiMapping:o,rawWindow:s,seedScalar:l}=e,d=e=>o?dx(e/255,o):s.min+e/255*s.span,c=d(Math.max(0,Math.min(255,r>0?a-t:a+t)));return d(255*(r>0))>=c?(n=c,i=1/0):(n=-1/0,i=c),Number.isFinite(l)&&(n=Math.min(n,l),i=Math.max(i,l)),{min:n,max:i}}function dN(e,t,n){let{dimensions:i,imageData:a,spacing:r}=e,o=e.voxelManager,[s,l]=i,d=s*l,c=dP(a,t).map(Math.round),h=n?.voiMapping??(n?.viewport&&n?.referencedVolumeId?dp(n.viewport,n.referencedVolumeId):null),u=n?.positiveStdDevMultiplier?n.positiveStdDevMultiplier/1.8:1,g=function(e,t){if(!t)return[0,1];try{let n=t.getCamera(),{ijkVecSliceDir:i}=dL(e.imageData,n),a=i.map(Math.abs),r=0;a[1]>=a[0]&&a[1]>=a[2]?r=1:a[2]>=a[0]&&a[2]>=a[1]&&(r=2);let o=[0,1,2].filter(e=>e!==r);return[o[0],o[1]]}catch{return[0,1]}}(e,n?.viewport),p=[r?.[g[0]]??1,r?.[g[1]]??1],m=function(e){let{dimensions:t,getScalar:n,ijkClick:i,voiMapping:a}=e,r=e.inPlaneAxes??[0,1],o=e.inPlaneSpacing??[1,1];for(let e=0;e<3;e++)if(i[e]<0||i[e]>=t[e])return{viable:!1,reason:"outside-volume",range:null};let[s,l]=r,d=Math.max(0,i[s]-96),c=Math.min(t[s]-1,i[s]+96),h=Math.max(0,i[l]-96),u=Math.min(t[l]-1,i[l]+96),g=c-d+1,p=u-h+1,m=g*p,f=(Number.isFinite(o[0])&&o[0]>0?o[0]:1)*(Number.isFinite(o[1])&&o[1]>0?o[1]:1),v=Math.max(6,Math.ceil(8/f)),I=Math.max(v+1,Math.floor(.6*m)),_=(e,t)=>{let a=[...i];return a[s]=d+e,a[l]=h+t,Number(n(a[0],a[1],a[2]))},w=new Float64Array(m),b=1/0,C=-1/0;for(let e=0;eC&&(C=n))}if(!Number.isFinite(b))return{viable:!1,reason:"outside-volume",range:null};let A=C-b||1,E=new Int16Array(m);for(let e=0;e=0&&M.push(E[e]);let t=(p-1)*g+e;p>1&&E[t]>=0&&M.push(E[t])}for(let e=1;e=0&&M.push(E[t]),g>1&&E[n]>=0&&M.push(E[n])}let y=dO(M),S=i[s]-d,T=i[l]-h,D=S,P=T,k=-1,x=1/0;for(let e=-4;e<=4;e++)for(let t=-4;t<=4;t++){if(t*t+e*e>16)continue;let n=S+t,i=T+e;if(n<0||n>=g||i<0||i>=p)continue;let a=E[i*g+n];if(a<0)continue;let r=Math.abs(a-y),o=t*t+e*e;(r>k||r===k&&o=y?1:-1,O=e=>V>0?e:255-e,R=[];for(let e=-1;e<=1;e++)for(let t=-1;t<=1;t++){let n=D+t,i=P+e;if(n<0||n>=g||i<0||i>=p)continue;let a=E[i*g+n];a>=0&&Math.abs(a-L)<=Math.abs(a-y)&&R.push(a)}let N=R.length?dO(R):L,U=O(N),F=e=>{let t=E[e];return t<0?-1:Math.max(0,U-O(t))},B=Array(256),G=(e,t)=>{let n=B[e];n||(n=[],B[e]=n),n.push(t)},H=new Uint8Array(m),W=P*g+D,X=F(W);if(X<0)return{viable:!1,reason:"flat-region",range:null};G(X,W),H[W]=1;let z=[],$=T*g+S,Y=-1,j=[],J=new Map;[[-1,0],[1,0],[0,-1],[0,1]].forEach(([e,t],n)=>{let i=S+e,a=T+t;if(i<0||i>=g||a<0||a>=p)return void j.push(null);j.push(-1),J.set(a*g+i,n)});let Q=0,q=-1,K=-1;e:for(let e=0;e<256;e++){let t=B[e];if(t?.length){for(let n=0;nI){K=e;break e}let s=[i-1,i+1,i-g,i+g],l=[r>0,r0,o(z.length?z[z.length-1].size:0)&&z.push({level:e,size:Q})}let Z=K>=0?K-1:255,ee=[];{let e=-1,t=0,n=0,i=(t,n)=>{e>=0&&t>=e&&ee.push({startLevel:e,endLevel:t,width:t-e,size:n}),e=-1};for(let a=0;a<=Z;a++){let r=t,o=0;n0&&o<=s?e<0&&(e=a):i(a-1,r)}i(Z,t)}let et=null;for(let e of ee){let t=q>=0?Math.min(e.endLevel,q-1):e.endLevel;if(tI||(!et||n.width>et.width)&&(et=n)}let en=()=>({growthCurve:z.map(e=>[e.level,e.size]),quietRuns:ee.map(e=>[e.startLevel,e.endLevel,e.size]),seedByte:N,backgroundByte:y,polarity:V,borderTouchLevel:q,explosionLevel:K,clickJoinLevel:Y,minRegionPx:v,maxRegionPx:I,pxAreaMm2:f});if(!et||et.width<4){let e=ee.find(e=>e.size=4&&(q<0||e.startLevel0?e.toleranceScale:1;ei=Math.max(1,Math.min(255,Math.round(ei*ea)));let er=et;if(Y<0||Y>ei)return{viable:!1,reason:"off-target",range:null,regionSizePx:er.size,regionAreaMm2:er.size*f,debug:en()};let eo=[...i];eo[s]=d+D,eo[l]=h+P;let es=w[W],el=w[T*g+S],ed={seedByte:N,polarity:V,voiMapping:a??null,rawWindow:{min:b,span:A},seedIjk:eo,seedScalar:Number.isFinite(es)?es:0,growthCurve:z.map(e=>[e.level,e.size]),chosenToleranceBytes:ei,growthEndLevel:Z,pxAreaMm2:f},{min:ec,max:eh}=dR(ed,ei);return{viable:!0,reason:"ok",regionSizePx:er.size,regionAreaMm2:er.size*f,toleranceBytes:ei,clickNeighborJoinLevels:j,expandContext:ed,range:{min:ec,max:eh,ijkStart:eo,diagnostics:{neighborhoodMean:Number.isFinite(es)?es:0,neighborhoodStdDev:0,clickedVoxelValue:Number.isFinite(el)?el:0,positiveStdDevMultiplier:ea,neighborhoodRadius:4,strategy:"adaptiveRegion",adaptive:{toleranceBytes:ei,regionSizePx:er.size,regionAreaMm2:er.size*f,backgroundByte:y,seedByte:N,polarity:V,seedSnapped:D!==S||P!==T,windowSize:[g,p],growthCurve:z.map(e=>[e.level,e.size]),explosionLevel:K,borderTouchLevel:q}}}}}({dimensions:i,getScalar:(e,t,n)=>Number(o.getAtIndex(n*d+t*s+e)),ijkClick:c,inPlaneAxes:g,inPlaneSpacing:p,voiMapping:h,toleranceScale:u});return dV.debug("adaptiveRegion probe",{ijkClick:c,viable:m.viable,reason:m.reason,regionSizePx:m.regionSizePx,regionAreaMm2:m.regionAreaMm2,toleranceBytes:m.toleranceBytes,band:m.range?{min:m.range.min,max:m.range.max}:null}),m}let dU="url(\"data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%3E%3Ccircle%20cx='12'%20cy='12'%20r='9'%20fill='none'%20stroke='%2300dc82'%20stroke-width='2'/%3E%3Cpath%20d='M12%208v8M8%2012h8'%20stroke='%2300dc82'%20stroke-width='2'%20stroke-linecap='round'/%3E%3C/svg%3E\") 12 12, copy",dF="url(\"data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%3E%3Ccircle%20cx='12'%20cy='12'%20r='9'%20fill='none'%20stroke='%23ff5a5a'%20stroke-width='2'/%3E%3Cpath%20d='M5.7%205.7L18.3%2018.3'%20stroke='%23ff5a5a'%20stroke-width='2'%20stroke-linecap='round'/%3E%3C/svg%3E\") 12 12, not-allowed",dB="url(\"data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%3E%3Ccircle%20cx='12'%20cy='12'%20r='9'%20fill='none'%20stroke='%23a0a6ad'%20stroke-width='2'%20stroke-dasharray='4%203'/%3E%3C/svg%3E\") 12 12, progress",{growCutLog:dG}=M.BF.logger,dH="The region here does not form a self-contained, lesion-like shape; nothing was segmented.";class dW extends da{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{maxDeltaK:25,maxDeltaIJ:512,actions:{cancelInProgress:{method:"cancelInProgress",bindings:[{key:"Escape"}]}}}}){super(e,t),this.segmentationInProgress=!1,this.hoverThrottleTimer=null,this.pendingHoverEvent=null,this.lastHoverElement=null,this.lastProbe=null,this.lastClick=null,this.clickAbortController=null,this.dryRunToken=null,this.confirmedRegion=null,this.rejectedRegions=[],this.preTouchStartCallback=async e=>this.mode===S.r$.Active&&!this.segmentationInProgress&&((await this.runHoverProbe(e),this.lastProbe&&!this.lastProbe.ok)?(dG.info("tap ignored: probe reported no proper region",{canvasPoint:this.lastProbe.canvas}),this.notifySegmentationError("No meaningful region at the tapped location; nothing was segmented."),!0):this.preMouseDownCallback(e))}notifySegmentationError(e){let t=new CustomEvent(M.fX.sV.ERROR_EVENT,{detail:{type:"Segmentation",message:e},cancelable:!0});M.tX.dispatchEvent(t)}cancelInProgress(){return this.cancelActiveOperation()}cancelActiveOperation(){return!!this.clickAbortController&&!this.clickAbortController.signal.aborted&&(this.clickAbortController.abort(),!0)}clearHoverState(){null!==this.hoverThrottleTimer&&(window.clearTimeout(this.hoverThrottleTimer),this.hoverThrottleTimer=null),this.pendingHoverEvent=null,this.lastProbe=null,this.confirmedRegion=null,this.rejectedRegions=[],this.dryRunToken&&(this.dryRunToken.cancelled=!0,this.dryRunToken=null),this.lastHoverElement&&(this.lastHoverElement.style.cursor="",this.lastHoverElement=null)}pointerOnConfirmedRegion(e,t,n){let i=this.confirmedRegion;if(!i||i.viewportId!==t.id||Date.now()>i.expiresAt)return!1;let a=M.BF.transformWorldToIndex(e.imageData,n).map(Math.round);for(let e=0;e<3;e++)if(a[e]i.bbox.max[e])return!1;let[r,o]=e.dimensions,s=Number(e.voxelManager.getAtIndex(a[2]*r*o+a[1]*r+a[0]));return!!Number.isFinite(s)&&!(si.bandMax)&&(i.expiresAt=Date.now()+2500,!0)}static bandsAreSimilar(e,t,n,i){let a=(e,t)=>{if(!Number.isFinite(e)||!Number.isFinite(t))return e===t;let n=Math.max(Math.abs(e),Math.abs(t),1e-6);return Math.abs(e-t)<=.25*n};return a(e,n)&&a(t,i)}matchesRejectedRegion(e,t){let n=Date.now();this.rejectedRegions=this.rejectedRegions.filter(e=>e.expiresAt>n);let i=t.ijkStart,a=this.rejectedRegions.find(n=>{if(n.viewportId!==e)return!1;for(let e=0;e<3;e++)if(i[e]n.bbox.max[e])return!1;return dW.bandsAreSimilar(t.min,t.max,n.bandMin,n.bandMax)});return!!a&&(a.expiresAt=n+2500,!0)}rememberRejectedRegion(e,t,n,i){t&&(this.rejectedRegions.push({viewportId:e,bbox:{min:[...t.min],max:[...t.max]},bandMin:n,bandMax:i,expiresAt:Date.now()+2500}),this.rejectedRegions.length>8&&this.rejectedRegions.splice(0,this.rejectedRegions.length-8))}safeSpacing(e){let t=e.spacing??[1,1,1];return[0,1,2].map(e=>Number.isFinite(t[e])&&t[e]>0?t[e]:1)}computeVoxelBudget(e){let[t,n,i]=this.safeSpacing(e);return Math.max(1e3,Math.ceil(2e6/(t*n*i)))}makeRegionShapeGate(e){let t=this.safeSpacing(e),n=t[0]*t[1]*t[2],i=this.configuration.maxDeltaK;return({voxelCount:e,bbox:a})=>{if("number"==typeof i&&i>=0&&a.max[2]-a.min[2]+1>=2*i+1)return!1;let r=e*n;if(r<2e3)return!0;let o=1;for(let e=0;e<3;e++)o*=(a.max[e]-a.min[e]+1)*t[e];return r/o>=.08}}onSetToolPassive(){this.clearHoverState()}onSetToolDisabled(){this.clearHoverState()}buildProbeOptions(e,t,n){return{viewport:e,element:t,referencedVolumeId:n,voiMapping:dp(e,n)??void 0}}mouseMoveCallback(e){if(this.mode!==S.r$.Active)return;let{element:t}=e.detail;if(this.lastHoverElement=t,this.segmentationInProgress){t.style.cursor="wait";return}this.queueHoverProbe(e)}queueHoverProbe(e){this.pendingHoverEvent=e,null===this.hoverThrottleTimer&&this.flushHoverProbe()}flushHoverProbe(){let e=this.pendingHoverEvent;this.pendingHoverEvent=null,e&&(this.runHoverProbe(e),this.hoverThrottleTimer=window.setTimeout(()=>{this.hoverThrottleTimer=null,this.pendingHoverEvent&&this.flushHoverProbe()},100))}getViewportSliceIndex(e){let t=e.getSliceIndex;if("function"!=typeof t)return null;try{let n=t.call(e);return Number.isFinite(n)?n:null}catch{return null}}async runHoverProbe(e){if(this.mode!==S.r$.Active||this.segmentationInProgress)return;let{element:t,currentPoints:n}=e.detail,i=(0,M.kJ)(t),a=i?.viewport;if(!a)return;this.dryRunToken&&(this.dryRunToken.cancelled=!0,this.dryRunToken=null);let r="unknown",o=null;try{if(aC(a.id)){let e=await this.getLabelmapSegmentationData(a);if(e){let{referencedVolumeId:i}=e;if(this._isOrthogonalView(a,i)){let e=M.PP.getVolume(i);if(e)if(this.pointerOnConfirmedRegion(e,a,n.world))r="plus";else{let s=this.buildProbeOptions(a,t,i),l=dN(e,n.world,s);l.viable&&l.range?this.matchesRejectedRegion(a.id,l.range)?r="blocked":this.neighborsAgree(l)?(r="pending",o={refVolume:e,range:l.range}):r="blocked":r="blocked"}}else r="blocked"}}}catch(e){dG.debug("hover probe: could not evaluate",{message:e instanceof Error?e.message:String(e)}),r="unknown"}let s="unknown"===r?null:{viewportId:a.id,canvas:[...n.canvas],sliceIndex:this.getViewportSliceIndex(a),ok:"blocked"!==r,at:Date.now()};if(this.lastProbe=s,t.style.cursor="plus"===r?dU:"blocked"===r?dF:dB,"pending"===r&&o&&s){let e={cancelled:!1};this.dryRunToken=e,this.runConfinementDryRun(o.refVolume,o.range,e,s,t)}}neighborsAgree(e){let t=e.clickNeighborJoinLevels,n=e.toleranceBytes;if(!t||"number"!=typeof n)return!0;let i=0,a=0;for(let e of t)null!==e&&(a++,e>=0&&e<=n&&i++);return a<2?i===a:i>=2}async runConfinementDryRun(e,t,n,i,a){let{dimensions:r}=e,[o,s,l]=r,d=o*s,c=e.voxelManager,{min:h,max:u}=t,g=this.makeRegionShapeGate(e);try{let{truncated:r,voxelCount:p,bbox:m}=await dh((e,t,n)=>Number(c.getAtIndex(n*d+t*o+e)),[...t.ijkStart],{width:o,height:s,depth:l,equals:e=>"number"==typeof e&&Number.isFinite(e)&&e>=h&&e<=u,yieldEvery:1e4,maxDeltaK:this.configuration.maxDeltaK,maxDeltaIJ:this.configuration.maxDeltaIJ,isCancelled:()=>n.cancelled,maxVoxels:this.computeVoxelBudget(e),shouldContinue:g});if(n.cancelled)return;!r&&m&&g({voxelCount:p,bbox:m})?(this.confirmedRegion={viewportId:i.viewportId,bbox:m,bandMin:h,bandMax:u,expiresAt:Date.now()+2500},this.lastProbe===i&&(i.ok=!0,a.style.cursor=dU)):(this.rememberRejectedRegion(i.viewportId,m,h,u),this.lastProbe===i&&(i.ok=!1,a.style.cursor=dF))}catch(e){dG.debug("hover dry-run: could not evaluate",{message:e instanceof Error?e.message:String(e)})}finally{this.dryRunToken===n&&(this.dryRunToken=null)}}probeAppliesToClick(e,t){let n=this.lastProbe;if(!n||n.viewportId!==e.id||Date.now()-n.at>1500||n.sliceIndex!==this.getViewportSliceIndex(e))return!1;let i=t[0]-n.canvas[0],a=t[1]-n.canvas[1];return 6>=Math.sqrt(i*i+a*a)}async preMouseDownCallback(e){if(this.segmentationInProgress)return!1;let{currentPoints:t,element:n}=e.detail,{world:i,canvas:a}=t,r=n?(0,M.kJ)(n):void 0;if(r?.viewport&&this.probeAppliesToClick(r.viewport,a)&&this.lastProbe?.ok===!1)return dG.info("click ignored: hover probe reported no proper region",{canvasPoint:a}),!1;let o=!1;try{o=await super.preMouseDownCallback(e)}catch(t){let e=t instanceof Error?t.message:"Click segmentation failed.";return dG.info("ClickSegment: click setup rejected",{message:e}),this.notifySegmentationError(e),!1}if(!o||!this.growCutData)return!1;let s=this.growCutData;return this.growCutData=null,this.runClick(s,i,n).catch(e=>{let t=e instanceof Error?e.message:"Click segmentation failed.";this.notifySegmentationError(t),dG.error("ClickSegment: segmentation failed",{message:t})}),!0}async runClick(e,t,n){let i,{segmentation:a,viewportId:r,renderingEngineId:o}=e,{referencedVolumeId:s,labelmapVolumeId:l,segmentIndex:d}=a,c=(0,M.lD)(o),h=c?.getViewport(r);if(!h)throw Error("ClickSegment: viewport not found for click.");let u=M.PP.getVolume(s),g=M.PP.getVolume(l);if(!u||!g)throw Error("ClickSegment: referenced or labelmap volume not in cache.");let p=dN(u,t,this.buildProbeOptions(h,h.element,s));if(!p.viable||!p.range||!p.expandContext){dG.info("ClickSegment: click found no meaningful region",{reason:p.reason,regionAreaMm2:p.regionAreaMm2}),this.notifySegmentationError("No meaningful region at the clicked location. Move the pointer until the plus cursor appears.");return}dG.info("ClickSegment: click",{worldPoint:t,toleranceBytes:p.toleranceBytes,regionAreaMm2:p.regionAreaMm2,band:{min:p.range.min,max:p.range.max}});let m=this.beginLabelmapMemo(a,g);try{i=await this.fillWithRange(p.range,{segmentation:a,viewportId:r,renderingEngineId:o},h,g,n,m)}finally{this.doneEditMemo()}this.lastClick={expandContext:p.expandContext,toleranceBytes:p.expandContext.chosenToleranceBytes,worldPoint:[...t],filledPoints:i,segmentation:a,viewportId:r,renderingEngineId:o},dG.info("ClickSegment: click complete",{filledVoxels:i.length,segmentIndex:d})}async fillWithRange(e,t,n,i,a,r){let{segmentation:o}=t,{referencedVolumeId:s,segmentIndex:l,segmentationId:d}=o;this.segmentationInProgress=!0,a&&(a.style.cursor="wait");let c=new AbortController;this.clickAbortController=c;let h=[],u=!1;try{let t=M.PP.getVolume(s);if(!t)throw Error("ClickSegment: referenced volume is no longer cached; cannot fill.");if(!await dD({referencedVolumeId:s,worldPosition:this.indexToWorld(t,e.ijkStart),viewport:n,labelmapVolume:i,options:{segmentIndex:l,getIntensityRange:()=>e,element:n.element,applyExternalIslandRemoval:!0,applyInternalIslandRemoval:!0,maxDeltaK:this.configuration.maxDeltaK,maxDeltaIJ:this.configuration.maxDeltaIJ,isCancelled:()=>c.signal.aborted,maxVoxels:this.computeVoxelBudget(t),shouldContinueRegion:this.makeRegionShapeGate(t),historyVoxelManager:r?.voxelManager,onRejected:({voxelCount:e,bbox:t})=>{u=!0,dG.info("ClickSegment: fill rejected by shape gate",{voxelCount:e,bbox:t})},onCommitted:e=>{h=e}}})){if(c.signal.aborted)throw Error("ClickSegment: fill cancelled.");throw Error(u?dH:"ClickSegment: fill produced no result (band rejected).")}return(0,e9.triggerSegmentationDataModified)(d),h}finally{this.clickAbortController===c&&(this.clickAbortController=null),this.segmentationInProgress=!1,a&&(a.style.cursor=dB)}}indexToWorld(e,t){return M.BF.transformIndexToWorld(e.imageData,t)}beginLabelmapMemo(e,t){let n=rp.hH(e.segmentationId,t.voxelManager);return this.memo=n,n}curveSizeAt(e,t){let n=0;for(let[i,a]of e.growthCurve){if(i>t)break;n=a}return n}pickNextTolerance(e){let t=this.lastClick;if(!t)return null;let{expandContext:n,toleranceBytes:i}=t,a=this.curveSizeAt(n,i);if(e>0){for(let[e,t]of n.growthCurve)if(!(e<=i)&&t>=Math.max(a+1,1.15*a))return e;return null}for(let e=n.growthCurve.length-1;e>=0;e--){let[t,r]=n.growthCurve[e];if(!(t>=i)&&r<=Math.min(a-1,.85*a))return t}return null}expand(){this.stepTolerance(1)}shrink(){this.stepTolerance(-1)}refresh(){let e=this.lastClick;e&&!this.segmentationInProgress&&this.refillAtTolerance(e.toleranceBytes).catch(e=>{dG.error("ClickSegment: refresh failed",{message:e instanceof Error?e.message:String(e)})})}stepTolerance(e){if(this.segmentationInProgress)return;let t=this.lastClick;if(!t)return void dG.info("ClickSegment: no click to expand/shrink yet");let n=this.pickNextTolerance(e);if(null===n)return void dG.info("ClickSegment: no further step available",{direction:e>0?"expand":"shrink",toleranceBytes:t.toleranceBytes});dG.info("ClickSegment: stepping tolerance",{direction:e>0?"expand":"shrink",fromToleranceBytes:t.toleranceBytes,toToleranceBytes:n,predictedRegionPx:this.curveSizeAt(t.expandContext,n)});let i=t.toleranceBytes;this.refillAtTolerance(n).catch(t=>{let n=t instanceof Error?t.message:String(t);if(n===dH&&e>0){dG.info("ClickSegment: expand blocked by the lesion shape gate; previous result kept",{previousTolerance:i}),this.notifySegmentationError("Expanding further would leak beyond a lesion-like shape; kept the previous result.");return}dG.error("ClickSegment: expand/shrink failed",{message:n})})}async refillAtTolerance(e){let t=this.lastClick;if(!t)return;let{segmentation:n,viewportId:i,renderingEngineId:a}=t,r=M.PP.getVolume(n.labelmapVolumeId),o=(0,M.lD)(a),s=o?.getViewport(i);if(!r||!s)return void dG.warn("ClickSegment: labelmap or viewport gone; cannot expand/shrink");let l=this.beginLabelmapMemo(n,r);try{let{voxelManager:o}=r,d=l.voxelManager,[c,h]=r.dimensions,u=c*h,{segmentIndex:g}=n,p=[];for(let[e,n,i]of t.filledPoints){let t=i*u+n*c+e;o.getAtIndex(t)===g&&(d.setAtIndex(t,0),p.push(t))}let m=function(e,t){let n=Math.max(0,Math.min(255,Math.round(t))),{min:i,max:a}=dR(e,n);return{min:i,max:a,ijkStart:[...e.seedIjk],diagnostics:{neighborhoodMean:Number.isFinite(e.seedScalar)?e.seedScalar:0,neighborhoodStdDev:0,clickedVoxelValue:Number.isFinite(e.seedScalar)?e.seedScalar:0,positiveStdDevMultiplier:1,neighborhoodRadius:4,strategy:"adaptiveRegion:atTolerance",adaptive:{toleranceBytes:n,regionSizePx:-1,backgroundByte:-1,seedByte:e.seedByte,seedSnapped:!1,windowSize:[0,0],polarity:e.polarity}}}}(t.expandContext,e);try{let o=await this.fillWithRange(m,{segmentation:n,viewportId:i,renderingEngineId:a},s,r,this.lastHoverElement??void 0,l);t.toleranceBytes=e,t.filledPoints=o,dG.info("ClickSegment: refill complete",{toleranceBytes:e,filledVoxels:o.length})}catch(e){for(let e of p)d.setAtIndex(e,g);throw(0,e9.triggerSegmentationDataModified)(n.segmentationId),e}}finally{this.doneEditMemo()}}}dW.toolName="ClickSegment";let dX=[-1/0,-995],dz=[0,1900],d$=[1e3,1900],{transformWorldToIndex:dY,transformIndexToWorld:dj}=M.BF;class dJ extends da{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{isPartialVolume:!0,positivePixelRange:dz,negativePixelRange:dX,islandRemoval:{enabled:!0,islandPixelRange:d$}}}){super(e,t),this._dragCallback=e=>{let{element:t,currentPoints:n}=e.detail,{world:i}=n,a=(0,M.kJ)(t),{viewport:r}=a,o=this._getHorizontalLineWorldPoints(a,i);this.growCutData.horizontalLines[1]=o,(0,tr.A)([r.id])},this._endCallback=async e=>{let{element:t}=e.detail,{viewport:n}=(0,M.kJ)(t);this._deactivateDraw(t),await this.runGrowCut(),this.growCutData=null,(0,oK.Q_)(t),(0,tr.A)([n.id])},this._deactivateDraw=e=>{e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)}}async preMouseDownCallback(e){let{element:t,currentPoints:n}=e.detail,{world:i}=n,a=(0,M.kJ)(t),{viewport:r,renderingEngine:o}=a,s=this._getHorizontalLineWorldPoints(a,i);return await super.preMouseDownCallback(e),this.growCutData.horizontalLines=[s,s],this._activateDraw(t),(0,oK.lY)(t),(0,tr.A)([r.id]),!0}renderAnnotation(e,t){if(!this.growCutData)return;let{segmentation:n,horizontalLines:i}=this.growCutData;if(2!==i.length)return;let{viewport:a}=e,{segmentationId:r,segmentIndex:o}=n,[s,l]=i,[d,c]=s,[h,u]=l,g=[d,c,u,h].map(e=>a.worldToCanvas(e)),{color:p,fillColor:m,lineWidth:f,fillOpacity:v,lineDash:I}=this.getSegmentStyle({segmentationId:r,segmentIndex:o,viewportId:a.id});(0,aK.VV)(t,"growCutRect","0",g,{color:p,fillColor:m,fillOpacity:v,lineWidth:f,lineDash:I,closePath:!0})}async getGrowCutLabelmap(e){let{segmentation:{segmentIndex:t,referencedVolumeId:n},renderingEngineId:i,viewportId:a,horizontalLines:r}=e,o=(0,M.lD)(i).getViewport(a),[s,l]=r,d=[s[0],s[1],l[1],l[0]],c=M.PP.getVolume(n),{topLeft:h,bottomRight:u}=this._getWorldBoundingBoxFromProjectedSquare(o,d),g=dY(c.imageData,h),p=dY(c.imageData,u),m=this.configuration;return rc(n,{boundingBox:{ijkTopLeft:g,ijkBottomRight:p}},{positiveSeedValue:t,negativeSeedValue:255,negativePixelRange:m.negativePixelRange,positivePixelRange:m.positivePixelRange})}getRemoveIslandData(){let{segmentation:{segmentIndex:e,referencedVolumeId:t,labelmapVolumeId:n}}=this.growCutData,i=M.PP.getVolume(t),a=M.PP.getVolume(n),r=i.voxelManager.getCompleteScalarDataArray(),o=a.voxelManager.getCompleteScalarDataArray(),{islandPixelRange:s}=this.configuration.islandRemoval,l=[];for(let t=0,n=o.length;t=s[0]&&n<=s[1]&&l.push(t)}return{islandPointIndexes:l}}_activateDraw(e){e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)}_projectWorldPointAcrossSlices(e,t,n){let i=this._getViewportVolume(e),{dimensions:a}=i,r=dY(i.imageData,t),o=n.findIndex(e=>M.BF.isEqual(Math.abs(e),1));if(-1===o)throw Error("Non-orthogonal direction vector");let s=[...r],l=[...r];return s[o]=0,l[o]=a[o]-1,[s,l]}_getCuboidIJKEdgePointsFromProjectedWorldPoint(e,t){let{viewPlaneNormal:n}=(0,i$.A)(e);return this._projectWorldPointAcrossSlices(e,t,n)}_getWorldCuboidCornerPoints(e,t){let n=[],i=this._getViewportVolume(e);return t.forEach(t=>{let a=this._getCuboidIJKEdgePointsFromProjectedWorldPoint(e,t).map(e=>dj(i.imageData,e));n.push(...a)}),n}_getWorldBoundingBoxFromProjectedSquare(e,t){let n=this._getWorldCuboidCornerPoints(e,t),i=[...n[0]],a=[...n[0]];return n.forEach(e=>{e7.jk(i,i,e),e7.T9(a,a,e)}),{topLeft:i,bottomRight:a}}_getViewportVolume(e){if(!(e instanceof M.ei))throw Error("Viewport is not a BaseVolumeViewport");let t=e.getAllVolumeIds()[0];return M.PP.getVolume(t)}_getHorizontalLineIJKPoints(e,t){let{viewport:n}=e,i=this._getViewportVolume(n),{dimensions:a}=i,r=dY(i.imageData,t),{viewUp:o,viewPlaneNormal:s}=(0,i$.A)(n),l=e7.$A(e7.vt(),o,s).findIndex(e=>M.BF.isEqual(Math.abs(e),1)),d=[...r],c=[...r];return d[l]=0,c[l]=a[l]-1,[d,c]}_getHorizontalLineWorldPoints(e,t){let{viewport:n}=e,i=this._getViewportVolume(n),[a,r]=this._getHorizontalLineIJKPoints(e,t);return[dj(i.imageData,a),dj(i.imageData,r)]}}dJ.toolName="WholeBodySegment";var dQ=n(88819),dq=n(11420);function dK(e,t){!function(e,t,n=!0){let i=Object.assign({},t,{segmentIndex:0});(0,dq.pY)(e,i)}(e,t,!0)}class dZ extends dQ.A{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{strategies:{FILL_INSIDE:dq.pY,ERASE_INSIDE:dK},defaultStrategy:"FILL_INSIDE",activeStrategy:"FILL_INSIDE"}}){super(e,t),this.preMouseDownCallback=e=>{if(!0===this.isDrawing)return;let{currentPoints:t,element:n}=e.detail,i=t.world,{viewport:a}=(0,M.kJ)(n);this.isDrawing=!0;let{viewPlaneNormal:r,viewUp:o}=(0,i$.A)(a),s=aC(a.id);if(!s)throw Error("No active segmentation detected, create one before using scissors tool");let{segmentationId:l}=s,d=aE.Q(l),c=r7.getLockedSegmentIndices(l),h=oe.getSegmentIndexColor(a.id,l,d),{representationData:u}=(0,a8.getSegmentation)(l);u[S.D_.Labelmap];let g={highlighted:!0,invalidated:!0,metadata:{viewPlaneNormal:[...r],viewUp:[...o],FrameOfReferenceUID:a.getFrameOfReferenceUID(),referencedImageId:"",toolName:this.getToolName(),segmentColor:h},data:{handles:{points:[[...i],[...i],[...i],[...i]],activeHandleIndex:null}}},p=(0,ta.Q0)(n,this.getToolName());if(this.editData={annotation:g,segmentIndex:d,segmentationId:l,segmentsLocked:c,segmentColor:h,viewportIdsToRender:p,handleIndex:3,movingTextBox:!1,newAnnotation:!0,hasMoved:!1,volumeId:null,referencedVolumeId:null,imageId:null},"volume"===(0,tU.A)(a)||a instanceof M.ei){let e=(0,tN.Nf)((0,a8.getSegmentation)(l),d),t=e?(0,tN.kL)(e):void 0;if(!t)return;this.editData={...this.editData,volumeId:t.volumeId,referencedVolumeId:e?.referencedVolumeId??t.referencedVolumeId}}else{let e=(0,a8.getCurrentLabelmapImageIdForViewport)(a.id,l);this.editData={...this.editData,imageId:e}}return this._activateDraw(n),(0,oK.lY)(n),e.preventDefault(),(0,tr.A)(p),!0},this._dragCallback=e=>{let t,n,i,a,r,o,s,l,d=e.detail,{element:c}=d,{currentPointsList:h}=d;if(h?.length>1)return void this._cancelTouchDraw(c);this.isDrawing=!0;let{annotation:u,viewportIdsToRender:g,handleIndex:p}=this.editData,{data:m}=u,{currentPoints:f}=d,{worldToCanvas:v,canvasToWorld:I}=(0,M.kJ)(c).viewport,_=f.world,{points:w}=m.handles;switch(w[p]=[..._],p){case 0:case 3:t=v(w[0]),n=[(a=v(w[3]))[0],t[1]],i=[t[0],a[1]],o=I(n),s=I(i),w[1]=o,w[2]=s;break;case 1:case 2:n=v(w[1]),t=[(i=v(w[2]))[0],n[1]],a=[n[0],i[1]],r=I(t),l=I(a),w[0]=r,w[3]=l}u.invalidated=!0,this.editData.hasMoved=!0,(0,tr.A)(g)},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,newAnnotation:i,hasMoved:a}=this.editData,{data:r}=n;if(i&&!a)return;r.handles.activeHandleIndex=null,this._deactivateDraw(t),(0,oK.Q_)(t);let o=(0,M.kJ)(t),s={...this.editData,points:r.handles.points,createMemo:this.createMemo.bind(this)};this.editData=null,this.isDrawing=!1,this.applyActiveStrategy(o,s),this.doneEditMemo()},this._activateDraw=e=>{e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback)},this._deactivateDraw=e=>{e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this.renderAnnotation=(e,t)=>{let n=!1;if(!this.editData)return n;let{viewport:i}=e,{annotation:a}=this.editData,r=a.metadata,o=a.annotationUID,{points:s}=a.data.handles,l=s.map(e=>i.worldToCanvas(e)),d=`rgb(${r.segmentColor.slice(0,3)})`;return i.getRenderingEngine()?((0,aK.tk)(t,o,"0",l[0],l[3],{color:d}),n=!0):(console.warn("Rendering Engine has been destroyed"),n)}}}dZ.toolName="RectangleScissor";var d0=n(11663),d1=n(14036);function d2(e,t){let[n,i,a,r]=e.map(e=>t.worldToCanvas(e)),o=[(n[0]+i[0])/2,(n[1]+i[1])/2],s=e7.Io(e[0],e[1]),l=e7.Io(e[2],e[3]),d=rK.Io(n,i),c=rK.Io(a,r)/l,h=d/s;return{center:o,radius:Math.round(Math.abs(c-h)>1e-4?s/2*Math.min(c,h):d/2)}}class d5 extends dQ.A{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{strategies:{FILL_INSIDE:d0.kr,ERASE_INSIDE:d1.r},defaultStrategy:"FILL_INSIDE",activeStrategy:"FILL_INSIDE"}}){super(e,t),this.preMouseDownCallback=e=>{if(!0===this.isDrawing)return;let{currentPoints:t,element:n}=e.detail,i=t.world,a=t.canvas,{viewport:r}=(0,M.kJ)(n);this.isDrawing=!0;let{viewPlaneNormal:o,viewUp:s}=(0,i$.A)(r),l=aC(r.id);if(!l)throw Error("No active segmentation detected, create one before using scissors tool");let{segmentationId:d}=l,c=aE.Q(d),h=r7.getLockedSegmentIndices(d),u=oe.getSegmentIndexColor(r.id,d,c),{representationData:g}=(0,a8.getSegmentation)(d);if(!g.Labelmap)throw Error("No labelmap data found for the active segmentation, create one before using scissors tool");let p={invalidated:!0,highlighted:!0,metadata:{viewPlaneNormal:[...o],viewUp:[...s],FrameOfReferenceUID:r.getFrameOfReferenceUID(),referencedImageId:"",toolName:this.getToolName(),segmentColor:u},data:{handles:{points:[[...i],[...i],[...i],[...i]],activeHandleIndex:null},isDrawing:!0,cachedStats:{}}},m=[r.id];if(this.editData={annotation:p,centerCanvas:a,segmentIndex:c,segmentationId:d,segmentsLocked:h,segmentColor:u,viewportIdsToRender:m,handleIndex:3,movingTextBox:!1,newAnnotation:!0,hasMoved:!1,volumeId:null,referencedVolumeId:null,imageId:null},"volume"===(0,tU.A)(r)||r instanceof M.ei){let e=(0,tN.Nf)((0,a8.getSegmentation)(d),c),t=e?(0,tN.kL)(e):void 0;if(!t)return;this.editData={...this.editData,volumeId:t.volumeId,referencedVolumeId:e?.referencedVolumeId??t.referencedVolumeId}}else{let e=(0,a8.getCurrentLabelmapImageIdForViewport)(r.id,d);this.editData={...this.editData,imageId:e}}return this._activateDraw(n),(0,oK.lY)(n),e.preventDefault(),(0,tr.A)(m),!0},this._dragCallback=e=>{let t=e.detail,{element:n}=t,{currentPointsList:i}=t;if(i?.length>1)return void this._cancelTouchDraw(n);this.isDrawing=!0;let{currentPoints:a}=t,r=a.canvas,{renderingEngine:o,viewport:s}=(0,M.kJ)(n),{canvasToWorld:l}=s,{annotation:d,viewportIdsToRender:c,centerCanvas:h}=this.editData,{data:u}=d,g=l(h),p=l(r);u.handles.points=l_([g,p],s),d.invalidated=!0,this.editData.hasMoved=!0,(0,tr.A)(c)},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,newAnnotation:i,hasMoved:a}=this.editData,{data:r}=n,{viewPlaneNormal:o,viewUp:s}=n.metadata;if(i&&!a)return;r.handles.activeHandleIndex=null,this._deactivateDraw(t),(0,oK.Q_)(t);let l=(0,M.kJ)(t),d={...this.editData,points:r.handles.points,viewPlaneNormal:o,viewUp:s,createMemo:this.createMemo.bind(this)};this.editData=null,this.isDrawing=!1,this.applyActiveStrategy(l,d),this.doneEditMemo()},this._activateDraw=e=>{e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback)},this._deactivateDraw=e=>{e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(e,t)=>{let n=!1;if(!this.editData)return n;let{viewport:i}=e,{viewportIdsToRender:a}=this.editData;if(!a.includes(i.id))return n;let{annotation:r}=this.editData,o=r.metadata,s=r.annotationUID,{points:l}=r.data.handles,{center:d,radius:c}=d2(l,i),h=`rgb(${o.segmentColor.slice(0,3)})`;return i.getRenderingEngine()?((0,aK.hp)(t,s,"0",d,c,{color:h}),n=!0):(console.warn("Rendering Engine has been destroyed"),n)}}}d5.toolName="CircleScissor";var d3=n(45826),d8=n(39157);class d4 extends dQ.A{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{strategies:{FILL_INSIDE:d3.Jq,ERASE_INSIDE:d8._},defaultStrategy:"FILL_INSIDE",activeStrategy:"FILL_INSIDE"}}){super(e,t),this.preMouseDownCallback=e=>{if(!0===this.isDrawing)return;this.doneEditMemo();let{currentPoints:t,element:n}=e.detail,i=t.world,a=t.canvas,{viewport:r}=(0,M.kJ)(n);this.isDrawing=!0;let{viewPlaneNormal:o,viewUp:s}=(0,i$.A)(r);if(!o||!s)throw Error("Unable to resolve viewport view plane for scissors tool");let l=aC(r.id);if(!l)throw Error("No active segmentation detected, create one before using scissors tool");let{segmentationId:d}=l,c=aE.Q(d),h=r7.getLockedSegmentIndices(d),u=oe.getSegmentIndexColor(r.id,d,c);this.isDrawing=!0;let g={metadata:{viewPlaneNormal:[...o],viewUp:[...s],FrameOfReferenceUID:r.getFrameOfReferenceUID(),referencedImageId:"",toolName:this.getToolName(),segmentColor:u},data:{invalidated:!0,handles:{points:[[...i],[...i],[...i],[...i]],activeHandleIndex:null},cachedStats:{},highlighted:!0}},p=[r.id];this.editData={annotation:g,centerCanvas:a,segmentIndex:c,segmentationId:d,segmentsLocked:h,segmentColor:u,toolGroupId:this.toolGroupId,viewportIdsToRender:p,handleIndex:3,movingTextBox:!1,newAnnotation:!0,hasMoved:!1,volumeId:null,referencedVolumeId:null,imageId:null};let{representationData:m}=(0,a8.getSegmentation)(d),f=this.getEditData({viewport:r,representationData:m,segmentsLocked:h,segmentationId:d});return this.editData={...this.editData,...f},this._activateDraw(n),(0,oK.lY)(n),e.preventDefault(),(0,tr.A)(p),!0},this._dragCallback=e=>{let t=e.detail,{element:n}=t,{currentPointsList:i}=t;if(i?.length>1)return void this._cancelTouchDraw(n);this.isDrawing=!0;let{currentPoints:a}=t,r=a.canvas,{renderingEngine:o,viewport:s}=(0,M.kJ)(n),{canvasToWorld:l}=s,{annotation:d,viewportIdsToRender:c,centerCanvas:h}=this.editData,{data:u}=d,g=l(h),p=l(r);u.handles.points=l_([g,p],s),d.invalidated=!0,this.editData.hasMoved=!0,(0,tr.A)(c)},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,newAnnotation:i,hasMoved:a,segmentIndex:r,segmentsLocked:o}=this.editData,{data:s}=n,{viewPlaneNormal:l,viewUp:d}=n.metadata;if(i&&!a)return;n.highlighted=!1,s.handles.activeHandleIndex=null,this._deactivateDraw(t),(0,oK.Q_)(t);let c=(0,M.kJ)(t),h={...this.editData,points:s.handles.points,segmentIndex:r,segmentsLocked:o,viewPlaneNormal:l,viewUp:d,createMemo:this.createMemo.bind(this)};this.editData=null,this.isDrawing=!1,this.applyActiveStrategy(c,h),this.doneEditMemo()},this._activateDraw=e=>{e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_TAP,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this._deactivateDraw=e=>{e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(S.sV.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(e,t)=>{let n=!1;if(!this.editData)return n;let{viewport:i}=e,{viewportIdsToRender:a}=this.editData;if(!a.includes(i.id))return n;let{annotation:r}=this.editData,o=r.metadata,s=r.annotationUID,{points:l}=r.data.handles,{center:d,radius:c}=d2(l,i),h=`rgb(${o.segmentColor.slice(0,3)})`;return i.getRenderingEngine()?((0,aK.hp)(t,s,"0",d,c,{color:h}),n=!0):(console.warn("Rendering Engine has been destroyed"),n)}}}d4.toolName="SphereScissor",n(10598),n(42905);let{transformWorldToIndex:d6}=M.BF;class d9 extends lA{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{simplified:!0,storePointData:!1,numSlicesToPropagate:10,calculatePointsInsideVolume:!0,getTextLines:d7,statsCalculator:tm.OA,showTextBox:!1,throttleTimeout:100}}){super(e,t),this.isHandleOutsideImage=!1,this.addNewAnnotation=e=>{let t,n,i,a,{currentPoints:r,element:o}=e.detail,s=r.world,l=(0,M.kJ)(o),{viewport:d}=l;this.isDrawing=!0;let{viewPlaneNormal:c,viewUp:h}=d.getCamera();if(d instanceof M.hS)throw Error("Stack Viewport Not implemented");{let e=this.getTargetId(d);i=M.BF.getVolumeId(e),n=M.PP.getVolume(i),t=M.BF.getClosestImageId(n,s,c)}let u=M.BF.getSpacingInNormalDirection(n,c),g=this._getStartCoordinate(s,u,c),p=this._getEndCoordinate(s,u,c),m=d.getFrameOfReferenceUID();a=this.configuration.simplified?[[...s],[...s]]:[[...s],[...s],[...s],[...s],[...s]];let f={highlighted:!0,invalidated:!0,metadata:{toolName:this.getToolName(),viewPlaneNormal:[...c],viewUp:[...h],FrameOfReferenceUID:m,referencedImageId:t,volumeId:i,spacingInNormal:u,enabledElement:l},data:{label:"",startCoordinate:g,endCoordinate:p,handles:{textBox:{hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}},points:a,activeHandleIndex:null},cachedStats:{pointsInVolume:[],projectionPoints:[],statistics:[]}}};this._computeProjectionPoints(f,n),(0,y.addAnnotation)(f,o);let v=(0,ta.Q0)(o,this.getToolName());return this.editData={annotation:f,viewportIdsToRender:v,newAnnotation:!0,hasMoved:!1},this._activateDraw(o),(0,oK.lY)(o),e.preventDefault(),(0,tr.A)(v),f},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:i,newAnnotation:a,hasMoved:r}=this.editData,{data:o}=n;if(a&&!r)return;n.highlighted=!1,o.handles.activeHandleIndex=null,this._deactivateModify(t),this._deactivateDraw(t),(0,oK.Q_)(t);let{metadata:s}=n,{enabledElement:l}=s;this.editData=null,this.isDrawing=!1,this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,y.removeAnnotation)(n.annotationUID);let d=this.getTargetId(l.viewport),c=M.PP.getVolume(d.split(/volumeId:|\?/)[1]);this._computePointsInsideVolume(n,c,d,l),(0,tr.A)(i),a?(0,tu.triggerAnnotationCompleted)(n):(0,tu.triggerAnnotationModified)(n,t)},this.renderAnnotation=(e,t)=>{let n=!1,{viewport:i}=e,a=(0,y.getAnnotations)(this.getToolName(),i.element);if(!a?.length)return n;a=(0,tn.WA)(a,i.getCamera());let r={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let o=0;oi.worldToCanvas(e)),b=w[0],C=sk([w[0],w[1]]),{centerPointRadius:A}=this.configuration,E=lI([w[0],w[1]]),y=i.getCamera().focalPoint,S=i.getCamera().viewPlaneNormal,T=u,D=g;Array.isArray(u)&&(c.startCoordinate=T=this._getCoordinateForViewplaneNormal(T,S)),Array.isArray(g)&&(c.endCoordinate=D=this._getCoordinateForViewplaneNormal(D,S));let P=M.BF.roundToPrecision(c.startCoordinate),k=M.BF.roundToPrecision(c.endCoordinate),x=this._getCoordinateForViewplaneNormal(y,S),L=M.BF.roundToPrecision(x);if(LMath.max(P,k))continue;let V=M.BF.roundToPrecision((c.startCoordinate+c.endCoordinate)/2),O=!1;for(let e of(L===V&&(O=!0),c.handles.points[0][this._getIndexOfCoordinatesForViewplaneNormal(S)]=V,f.viewport?.volumeIds.values()))l.invalidated&&l.metadata.volumeId===e&&this._throttledCalculateCachedStats(l,f);if(!i.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}if(!(0,nM.YY)(d))continue;(0,nE.Gh)(d)||this.editData||null===m||!O||(s=this.configuration.simplified?[w[m]]:w),s&&(0,aK.qX)(t,d,"0",s,{color:_});let R=v,N=I;if(O?(R=v,N=[]):N=[5,5],(0,aK.hp)(t,d,"0",b,C,{color:_,lineDash:N,lineWidth:R}),A>0&&C>3*A&&(0,aK.hp)(t,d,"0-center",b,A,{color:_,lineDash:I,lineWidth:v}),n=!0,this.configuration.showTextBox){let n=this.configuration.getTextLines(c,{metadata:h});if(!n||0===n.length)continue;let i=[w[0],w[1]];if(!this.renderLinkedTextBoxAnnotation({enabledElement:e,svgDrawingHelper:t,annotation:l,styleSpecifier:r,textLines:n,canvasCoordinates:i,placementPoints:E}))continue}}return n},this.configuration.calculatePointsInsideVolume?this._throttledCalculateCachedStats=(0,ti.A)(this._calculateCachedStatsTool,this.configuration.throttleTimeout,{trailing:!0}):this._throttledCalculateCachedStats=(0,sx.A)(this._calculateCachedStatsTool,this.configuration.throttleTimeout)}_computeProjectionPoints(e,t){let{data:n,metadata:i}=e,{viewPlaneNormal:a,spacingInNormal:r}=i,{startCoordinate:o,endCoordinate:s}=n,{points:l}=n.handles,d=this._getIndexOfCoordinatesForViewplaneNormal(a),c=e7.o8(l[0]);c[d]=o;let h=e7.o8(l[0]);h[d]=s;let u=e7.vt();e7.Re(u,h,c);let g=e7.Bw(u);if(0===g){let e=l.map(e=>{let t=e7.o8(e);return t[d]=o,Array.from(t)});n.cachedStats.projectionPoints=[e];return}e7.S8(u,u);let p=M.BF.deepClone(l);p[0][d]=o,p[1][d]=o;let m=[];for(let e=0;e<=g+1e-6;e+=r)m.push(p.map(t=>{let n=e7.vt();return e7.Ln(n,t,u,e),Array.from(n)}));n.cachedStats.projectionPoints=m}_computePointsInsideVolume(e,t,n,i){let{data:a,metadata:r}=e,{viewPlaneNormal:o,viewUp:s}=r,{viewport:l}=i,d=a.cachedStats.projectionPoints,c=[[]],h=this.getTargetImageData(n),u=a.handles.points.map(e=>l.worldToCanvas(e)),g=lI([u[0],u[1]])[0],p=lI([u[0],u[1]])[1],m=l.canvasToWorld(g),f=l.canvasToWorld(p),{worldWidth:v,worldHeight:I}=(0,lh.A)(o,s,m,f),_=(0,te.Op)(h,a.handles.points),w=(0,te.CQ)(h),b=Math.abs(Math.PI*(v/_.scale/2)*(I/w/_.scale/2)),C={isPreScaled:(0,tp.u)(l,n),isSuvScaled:this.isSuvScaled(l,n,e.metadata.referencedImageId)},A=(0,tv.j)(r.Modality,e.metadata.referencedImageId,C);for(let e=0;el.worldToCanvas(e)),[a,r]=lI([i[0],i[1]]),s=l.canvasToWorld(a),h=l.canvasToWorld(r),{dimensions:u,imageData:g,voxelManager:p}=t,m=d6(g,s),f=d6(g,n),v=this._getIndexOfCoordinatesForViewplaneNormal(o);m[0]=Math.floor(m[0]),m[1]=Math.floor(m[1]),m[2]=Math.floor(m[2]),m[v]=f[v];let I=d6(g,h);if(I[0]=Math.floor(I[0]),I[1]=Math.floor(I[1]),I[2]=Math.floor(I[2]),I[v]=f[v],lA.isInsideVolume(u,[m,I])){let e=Math.min(m[0],I[0]),t=Math.max(m[0],I[0]),i=Math.min(m[1],I[1]),a=Math.max(m[1],I[1]),r=[[e,t],[i,a],[Math.min(m[2],I[2]),Math.max(m[2],I[2])]],o={center:n,xRadius:Math.abs(s[0]-h[0])/2,yRadius:Math.abs(s[1]-h[1])/2,zRadius:Math.abs(s[2]-h[2])/2},l=p.forEach(this.configuration.statsCalculator.statsCallback,{isInObject:e=>lg(o,e),boundsIJK:r,imageData:g,returnPoints:this.configuration.storePointData});c.push(l)}}let E=this.configuration.statsCalculator.getStatistics();a.cachedStats.pointsInVolume=c,a.cachedStats.statistics={Modality:r.Modality,area:b,mean:E.mean?.value,stdDev:E.stdDev?.value,max:E.max?.value,statsArray:E.array,areaUnit:_.areaUnit,modalityUnit:A}}_calculateCachedStatsTool(e,t){let n=e.data,{viewport:i}=t,{cachedStats:a}=n,r=this.getTargetId(i),o=M.PP.getVolume(r.split(/volumeId:|\?/)[1]);return this._computeProjectionPoints(e,o),this._computePointsInsideVolume(e,o,r,t),e.invalidated=!1,(0,tu.triggerAnnotationModified)(e,i.element),a}_getStartCoordinate(e,t,n){let i=Math.round(this.configuration.numSlicesToPropagate/2),a=e7.vt();return e7.Ln(a,e,n,-(i*t)),this._getCoordinateForViewplaneNormal(a,n)}_getEndCoordinate(e,t,n){let i=this.configuration.numSlicesToPropagate,a=i-Math.round(i/2),r=e7.vt();return e7.Ln(r,e,n,a*t),this._getCoordinateForViewplaneNormal(r,n)}_getIndexOfCoordinatesForViewplaneNormal(e){let t=[Math.abs(e[0]),Math.abs(e[1]),Math.abs(e[2])];return t.indexOf(Math.max(...t))}_getCoordinateForViewplaneNormal(e,t){return e[this._getIndexOfCoordinatesForViewplaneNormal(t)]}}function d7(e,t={}){let{area:n,mean:i,max:a,stdDev:r,areaUnit:o,modalityUnit:s}=e.cachedStats.statistics;if(void 0===i)return;let l=[];return l.push(`Area: ${M.BF.roundNumber(n)} ${o}`),l.push(`Mean: ${M.BF.roundNumber(i)} ${s}`),l.push(`Max: ${M.BF.roundNumber(a)} ${s}`),l.push(`Std Dev: ${M.BF.roundNumber(r)} ${s}`),l}d9.toolName="CircleROIStartEndThreshold";var ce=n(8270);let{transformWorldToIndex:ct,isEqual:cn}=M.BF;class ci extends oL.oS{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"]}){super(e,t),this.preMouseDownCallback=e=>{let t,n,i,a,{currentPoints:r,element:o}=e.detail,s=r.world,{viewport:l}=(0,M.kJ)(o),{viewPlaneNormal:d}=l.getCamera(),c=aC(l.id);if(!c)throw Error("No active segmentation detected, create one before using scissors tool");let{segmentationId:h}=c,u=aE.Q(h),g=r7.getLockedSegmentIndices(h),{representationData:p}=(0,a8.getSegmentation)(h);if(this.doneEditMemo(),"volume"===(0,tU.A)(l)||l instanceof M.ei){let e=(0,tN.Nf)((0,a8.getSegmentation)(h),u),r=e?(0,tN.kL)(e):void 0;if(!r)return;({dimensions:t,direction:n}=r),a=r.voxelManager,i=ct(r.imageData,s)}else{let e=(0,a8.getCurrentLabelmapImageIdForViewport)(l.id,h);if(!e)throw Error("No active segmentation imageId detected, create one before using scissors tool");let{imageData:r}=l.getImageData();t=r.getDimensions(),n=r.getDirection(),a=M.PP.getImage(e).voxelManager,i=ct(r,s)}let m=this.getFixedDimension(d,n);if(void 0===m)return void console.warn("Oblique paint fill not yet supported");let{floodFillGetter:f,getLabelValue:v,getScalarDataPositionFromPlane:I,inPlaneSeedPoint:_,fixedDimensionValue:w}=this.generateHelpers(a,t,i,m);if(i[0]<0||i[0]>=t[0]||i[1]<0||i[1]>=t[1]||i[2]<0||i[2]>=t[2])return;let b=v(i[0],i[1],i[2]);if(g.includes(b))return;let C=a1(f,_),{flooded:A}=C;A.forEach(e=>{let t=I(e[0],e[1]);a.setAtIndex(t,u)});let E=this.getFramesModified(m,w,C);return(0,e9.triggerSegmentationDataModified)(h,E),!0},this.getFramesModified=(e,t,n)=>{let{flooded:i}=n;if(2===e)return[t];let a=1/0,r=-1/0;for(let e=0;er&&(r=t)}let o=[];for(let e=a;e<=r;e++)o.push(e);return o},this.generateHelpers=(e,t,n,i=2)=>{let a,r;switch(i){case 0:a=n[0],r=[n[1],n[2]];break;case 1:a=n[1],r=[n[0],n[2]];break;case 2:a=n[2],r=[n[0],n[1]];break;default:throw Error(`Invalid fixedDimension: ${i}`)}let o=(t,n,i)=>e.getAtIJK(t,n,i),s=this.generateFloodFillGetter(t,i,a,o);return{getScalarDataPositionFromPlane:this.generateGetScalarDataPositionFromPlane((t,n,i)=>e.toIndex([t,n,i]),i,a),getLabelValue:o,floodFillGetter:s,inPlaneSeedPoint:r,fixedDimensionValue:a}},this.generateFloodFillGetter=(e,t,n,i)=>{let a;switch(t){case 0:a=(t,a)=>{if(!(t>=e[1])&&!(t<0)&&!(a>=e[2])&&!(a<0))return i(n,t,a)};break;case 1:a=(t,a)=>{if(!(t>=e[0])&&!(t<0)&&!(a>=e[2])&&!(a<0))return i(t,n,a)};break;case 2:a=(t,a)=>{if(!(t>=e[0])&&!(t<0)&&!(a>=e[1])&&!(a<0))return i(t,a,n)};break;default:throw Error(`Invalid fixedDimension: ${t}`)}return a},this.generateGetScalarDataPositionFromPlane=(e,t,n)=>{let i;switch(t){case 0:i=(t,i)=>e(n,t,i);break;case 1:i=(t,i)=>e(t,n,i);break;case 2:i=(t,i)=>e(t,i,n);break;default:throw Error(`Invalid fixedDimension: ${t}`)}return i}}getFixedDimension(e,t){let n=t.slice(0,3),i=t.slice(3,6),a=t.slice(6,9),r=[Math.abs(e[0]),Math.abs(e[1]),Math.abs(e[2])];return cn(r,[Math.abs(n[0]),Math.abs(n[1]),Math.abs(n[2])])?0:cn(r,[Math.abs(i[0]),Math.abs(i[1]),Math.abs(i[2])])?1:cn(r,[Math.abs(a[0]),Math.abs(a[1]),Math.abs(a[2])])?2:void 0}}ci.toolName="PaintFill";var ca=n(1943),cr={Corners:{TOP_LEFT:"TOP_LEFT",TOP_RIGHT:"TOP_RIGHT",BOTTOM_LEFT:"BOTTOM_LEFT",BOTTOM_RIGHT:"BOTTOM_RIGHT"}},{vtkErrorMacro:co}=oG.Ay,{Corners:cs}=cr,cl={viewportCorner:cr.Corners.BOTTOM_LEFT,viewportSize:.2,minPixelSize:50,maxPixelSize:200,parentRenderer:null,interactiveRenderer:!1};function cd(e,t,n={}){Object.assign(t,cl,n),oG.Ay.obj(e,t),oG.Ay.get(e,t,["enabled","viewportCorner","viewportSize","interactiveRenderer"]),oG.Ay.setGet(e,t,["_interactor","minPixelSize","maxPixelSize","parentRenderer"]),oG.Ay.get(e,t,["actor"]),oG.Ay.moveToProtected(e,t,["interactor"]),function(e,t){t.classHierarchy.push("vtkOrientationMarkerWidget");let n={...e},i=[],a=ca.Ay.newInstance(),r=new ResizeObserver(t=>{e.updateViewport()}),o=null,s=null,l=null,d=null,c=null;function h(){t._interactor.isAnimating()||e.updateMarkerOrientation()}t._onParentRendererChanged=()=>e.updateViewport(),e.computeViewport=()=>{let e=t.parentRenderer||t._interactor.getCurrentRenderer(),[n,i,a,r]=e.getViewport(),o=t._interactor.getView(),s=o.getSize(),[l,d]=o.getViewportSize(e),c=Math.min(l,d),h=t.viewportSize*c,u=(h=Math.max(Math.min(t.minPixelSize,c),Math.min(t.maxPixelSize,h)))/s[0],g=h/s[1];switch(t.viewportCorner){case cs.TOP_LEFT:return[n,r-g,n+u,r];case cs.TOP_RIGHT:return[a-u,r-g,a,r];case cs.BOTTOM_LEFT:return[n,i,n+u,i+g];case cs.BOTTOM_RIGHT:return[a-u,i,a,i+g];default:return co("Invalid widget corner"),null}},e.updateViewport=()=>{t.enabled&&(a.setViewport(...e.computeViewport()),t._interactor.render())},e.updateMarkerOrientation=()=>{let e=(t.parentRenderer||t._interactor.getCurrentRenderer()).getActiveCamera();if(!e)return;let n=e.getReferenceByName("position"),r=e.getReferenceByName("focalPoint"),o=e.getReferenceByName("viewUp");if(i[0]!==n[0]||i[1]!==n[1]||i[2]!==n[2]||i[3]!==r[0]||i[4]!==r[1]||i[5]!==r[2]||i[6]!==o[0]||i[7]!==o[1]||i[8]!==o[2]){i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=r[0],i[4]=r[1],i[5]=r[2],i[6]=o[0],i[7]=o[1],i[8]=o[2];let e=a.getActiveCamera();e.setPosition(n[0],n[1],n[2]),e.setFocalPoint(r[0],r[1],r[2]),e.setViewUp(o[0],o[1],o[2]),a.resetCamera()}},e.setEnabled=n=>{if(n){if(t.enabled)return;if(!t.actor)return void co("Must set actor before enabling orientation marker.");if(!t._interactor)return void co("Must set interactor before enabling orientation marker.");let n=t.parentRenderer||t._interactor.getCurrentRenderer(),i=n.getRenderWindow();i.addRenderer(a),2>i.getNumberOfLayers()&&i.setNumberOfLayers(2),a.setLayer(i.getNumberOfLayers()-1),a.setInteractive(t.interactiveRenderer),a.addViewProp(t.actor),t.actor.setVisibility(!0),o=n.onEvent(e=>{"ActiveCameraEvent"===e.type&&(s&&s.unsubscribe(),s=e.camera.onModified(h))}),s=n.getActiveCamera().onModified(h),l=t._interactor.onAnimation(e.updateMarkerOrientation),d=t._interactor.onEndAnimation(e.updateMarkerOrientation),r.observe(t._interactor.getView().getCanvas()),e.updateViewport(),e.updateMarkerOrientation(),t.enabled=!0}else{if(!t.enabled)return;t.enabled=!1,r.disconnect(),o.unsubscribe(),o=null,s.unsubscribe(),s=null,l.unsubscribe(),l=null,d.unsubscribe(),d=null,t.actor.setVisibility(!1),a.removeViewProp(t.actor);let e=t._interactor?.findPokedRenderer()?.getRenderWindow();e&&e.removeRenderer(a)}e.modified()},e.setViewportCorner=n=>{n!==t.viewportCorner&&(t.viewportCorner=n,e.updateViewport())},e.setViewportSize=n=>{let i=Math.min(1,Math.max(0,n));i!==t.viewportSize&&(t.viewportSize=i,e.updateViewport())},e.setActor=n=>{let i=t.enabled;e.setEnabled(!1),t.actor=n,e.setEnabled(i)},e.getRenderer=()=>a,e.delete=()=>{n.delete(),c&&(c.unsubscribe(),c=null),o&&(o.unsubscribe(),o=null),s&&(s.unsubscribe(),s=null),l&&(l.unsubscribe(),l=null),d&&(d.unsubscribe(),d=null),r.disconnect()},c=e.onModified(e.updateViewport)}(e,t)}var cc={newInstance:oG.Ay.newInstance(cd,"vtkOrientationMarkerWidget"),extend:cd,...cr},ch={canvasToImageData:function(e,t=[0,0,0,0]){let[n,i,a,r]=t,o=e.getContext("2d").getImageData(n,i,a||e.width,r||e.height),s=tB.Ay.newInstance({type:"vtkImageData"});s.setOrigin(0,0,0),s.setSpacing(1,1,1),s.setExtent(0,(a||e.width)-1,0,(r||e.height)-1,0,0);let l=tF.Ay.newInstance({numberOfComponents:4,values:new Uint8Array(o.data.buffer)});return l.setName("scalars"),s.getPointData().setScalars(l),s}},cu=n(83734),cg=n(78543),cp={xPlus:0,xMinus:1,yPlus:2,yMinus:3,zPlus:4,zMinus:5},cm={defaultStyle:{text:"",faceColor:"white",faceRotation:0,fontFamily:"Arial",fontColor:"black",fontStyle:"normal",fontSizeScale:e=>e/1.8,edgeThickness:.1,edgeColor:"black",resolution:200}},cf={newInstance:oG.Ay.newInstance(function(e,t,n={}){Object.assign(t,cm,n),aN.Ay.extend(e,t,n),oG.Ay.get(e,t,["defaultStyle","xPlusFaceProperty","xMinusFaceProperty","yPlusFaceProperty","yMinusFaceProperty","zPlusFaceProperty","zMinusFaceProperty"]),function(e,t){t.classHierarchy.push("vtkAnnotatedCubeActor"),t.xPlusFaceProperty={...t.xPlusFaceProperty},t.xMinusFaceProperty={...t.xMinusFaceProperty},t.yPlusFaceProperty={...t.yPlusFaceProperty},t.yMinusFaceProperty={...t.yMinusFaceProperty},t.zPlusFaceProperty={...t.zPlusFaceProperty},t.zMinusFaceProperty={...t.zMinusFaceProperty};let n=null,i=document.createElement("canvas"),a=aR.Ay.newInstance(),r=cg.Ay.newInstance();function o(n,a=null){a&&Object.assign(t[`${n}FaceProperty`],a);let s={...t.defaultStyle,...t[`${n}FaceProperty`]};i.width=s.resolution,i.height=s.resolution;let l=i.getContext("2d");l.fillStyle=s.faceColor,l.fillRect(0,0,i.width,i.height),s.edgeThickness>0&&(l.strokeStyle=s.edgeColor,l.lineWidth=s.edgeThickness*i.width,l.strokeRect(0,0,i.width,i.height)),l.save(),l.translate(0,i.height),l.scale(1,-1),l.translate(i.width/2,i.height/2),l.rotate(-Math.PI*(s.faceRotation/180));let d=s.fontSizeScale(s.resolution);l.fillStyle=s.fontColor,l.textAlign="center",l.textBaseline="middle",l.font=`${s.fontStyle} ${d}px "${s.fontFamily}"`,l.fillText(s.text,0,0),l.restore();let c=ch.canvasToImageData(i);r.setInputData(c,cp[n]),e.modified()}function s(){n=cu.Ay.newInstance({generate3DTextureCoordinates:!0}),a.setInputConnection(n.getOutputPort()),o("xPlus"),o("xMinus"),o("yPlus"),o("yMinus"),o("zPlus"),o("zMinus")}r.setInterpolate(!0),e.setDefaultStyle=e=>{t.defaultStyle={...t.defaultStyle,...e},s()},e.setXPlusFaceProperty=e=>o("xPlus",e),e.setXMinusFaceProperty=e=>o("xMinus",e),e.setYPlusFaceProperty=e=>o("yPlus",e),e.setYMinusFaceProperty=e=>o("yMinus",e),e.setZPlusFaceProperty=e=>o("zPlus",e),e.setZMinusFaceProperty=e=>o("zMinus",e),s(),a.setInputConnection(n.getOutputPort()),e.setMapper(a),e.addTexture(r)}(e,t)},"vtkAnnotatedCubeActor")},cv=n(99298),cI=n(76826),{vtkErrorMacro:c_}=oG.Ay;function cw(e,t,n,i){let a;e.set((a=0,t.map((e,t)=>t===a?(a+=e+1,e):e+n)),i)}var cb={outputPointsPrecision:cI.kP.DEFAULT},cC={newInstance:oG.Ay.newInstance(function(e,t,n={}){Object.assign(t,cb,n),oG.Ay.setGet(e,t,["outputPointsPrecision"]),oG.Ay.obj(e,t),oG.Ay.algo(e,t,1,1),t.classHierarchy.push("vtkAppendPolyData"),e.requestData=(n,i)=>{let a=e.getNumberOfInputPorts();if(!a)return void c_("No input specified.");if(1===a){i[0]=n[0];return}let r=i[0]&&n[0]!==i[0]?i[0].initialize():iJ.Ay.newInstance(),o=0,s=0,l=1,d=1,c=0,h=0,u=0,g=0,p=!0,m=!0,f=!0;for(let e=0;e(l=t.getPoints().getDataType())?s:l);let a=t.getPointData();a?(p=p&&null!==a.getNormals(),m=m&&null!==a.getTCoords(),f=f&&null!==a.getScalars()):(p=!1,m=!1,f=!1)}t.outputPointsPrecision===cI.kP.SINGLE?s=cv.JA.FLOAT:t.outputPointsPrecision===cI.kP.DOUBLE&&(s=cv.JA.DOUBLE);let v=ij.Ay.newInstance({dataType:s});v.setNumberOfPoints(o);let I=v.getData(),_=new Uint32Array(c),w=new Uint32Array(h),b=new Uint32Array(u),C=new Uint32Array(g),A=null,E=null,M=null,y=n[a-1];if(p){let e=y.getPointData().getNormals();A=tF.Ay.newInstance({numberOfComponents:3,numberOfTuples:o,size:3*o,dataType:e.getDataType(),name:e.getName()})}if(m){let e=y.getPointData().getTCoords();E=tF.Ay.newInstance({numberOfComponents:2,numberOfTuples:o,size:2*o,dataType:e.getDataType(),name:e.getName()})}if(f){let e=y.getPointData().getScalars();M=tF.Ay.newInstance({numberOfComponents:e.getNumberOfComponents(),numberOfTuples:o,size:o*e.getNumberOfComponents(),dataType:e.getDataType(),name:e.getName()})}o=0,c=0,h=0,u=0,g=0;for(let e=0;e{let i=2*Math.PI/t.resolution,a=-t.height/2,r=t.resolution+1,o=4*t.resolution+1+t.resolution,s=0,l=oG.Ay.newTypedArray(t.pointType,3*r),d=0,c=new Uint32Array(o);l[0]=t.height/2,l[1]=0,l[2]=0,t.capping&&(c[d++]=t.resolution);for(let e=0;et.resolution?1:e+2;so.A.buildFromRadian().translate(...t.center).rotateFromDirections([1,0,0],t.direction).apply(l);let h=n[0]?.initialize()||iJ.Ay.newInstance();h.getPoints().setData(l,3),h.getPolys().setData(c,1),n[0]=h}},"vtkConeSource")},cM={height:1,initAngle:0,radius:1,resolution:6,center:[0,0,0],direction:[0,1,0],capping:!0,pointType:"Float64Array"},cy={newInstance:oG.Ay.newInstance(function(e,t,n={}){Object.assign(t,cM,n),oG.Ay.obj(e,t),oG.Ay.setGet(e,t,["height","initAngle","otherRadius","radius","resolution","capping"]),oG.Ay.setGetArray(e,t,["center","direction"],3),oG.Ay.algo(e,t,0,1),t.classHierarchy.push("vtkCylinderSource"),e.requestData=(e,n)=>{let i=2*Math.PI/t.resolution,a=2*t.resolution,r=5*t.resolution;t.capping&&(a=4*t.resolution,r=7*t.resolution+2);let o=oG.Ay.newTypedArray(t.pointType,3*a),s=0,l=new Uint32Array(r),d=new Float32Array(3*a),c=tF.Ay.newInstance({numberOfComponents:3,values:d,name:"Normals"}),h=new Float32Array(2*a),u=tF.Ay.newInstance({numberOfComponents:2,values:h,name:"TCoords"}),g=[0,0,0],p=[0,0,0],m=[0,0,0],f=[0,0,0],v=[0,0],I=[0,0],_=null==t.otherRadius?t.radius:t.otherRadius;for(let e=0;e-1*e)).apply(o),so.A.buildFromRadian().rotateFromDirections([0,1,0],t.direction).apply(d);let w=n[0]?.initialize()||iJ.Ay.newInstance();w.getPoints().setData(o,3),w.getPolys().setData(l,1),w.getPointData().setNormals(c),w.getPointData().setTCoords(u),n[0]=w}},"vtkCylinderSource")},cS={tipResolution:6,tipRadius:.1,tipLength:.35,shaftResolution:6,shaftRadius:.03,invert:!1,direction:[1,0,0],pointType:"Float64Array"},cT={newInstance:oG.Ay.newInstance(function(e,t,n={}){Object.assign(t,cS,n),oG.Ay.obj(e,t),oG.Ay.setGet(e,t,["tipResolution","tipRadius","tipLength","shaftResolution","shaftRadius","invert"]),oG.Ay.setGetArray(e,t,["direction"],3),oG.Ay.algo(e,t,0,1),t.classHierarchy.push("vtkArrowSource"),e.requestData=(e,n)=>{let i=cy.newInstance({capping:!0});i.setResolution(t.shaftResolution),i.setRadius(t.shaftRadius),i.setHeight(1-t.tipLength),i.setCenter(0,(1-t.tipLength)*.5,0);let a=i.getOutputData(),r=a.getPoints().getData(),o=a.getPointData().getNormals().getData();so.A.buildFromDegree().rotateZ(-90).apply(r).apply(o);let s=cE.newInstance();s.setResolution(t.tipResolution),s.setHeight(t.tipLength),s.setRadius(t.tipRadius);let l=s.getOutputData(),d=l.getPoints().getData();so.A.buildFromRadian().translate(1-.5*t.tipLength,0,0).apply(d);let c=cC.newInstance();c.setInputData(a),c.addInputData(l);let h=c.getOutputData(),u=h.getPoints().getData();so.A.buildFromRadian().translate(-.5+.5*t.tipLength,0,0).apply(u),t.invert?(so.A.buildFromRadian().rotateFromDirections([1,0,0],t.direction).scale(-1,-1,-1).apply(u),n[0]=h):(so.A.buildFromRadian().rotateFromDirections([1,0,0],t.direction).scale(1,1,1).apply(u),n[0]=c.getOutputData())}},"vtkArrowSource")};function cD(e){let t=e.getPoints().getBounds(),n=[-(.5*(t[0]+t[1])),-(.5*(t[2]+t[3])),-(.5*(t[4]+t[5]))];so.A.buildFromDegree().translate(...n).apply(e.getPoints().getData())}function cP(e,t,n=!1){let i=e.getPoints().getBounds(),a=[0,0,0];n?a[t]=-i[2*t+1]:a[t]=-i[2*t],so.A.buildFromDegree().translate(...a).apply(e.getPoints().getData())}function ck(e,t,n,i){let a=e.getPoints().getData().length,r=new Uint8ClampedArray(a),o=0;for(;o{let e={...t.config,...t.xConfig},n=cT.newInstance({direction:[1,0,0],...e}).getOutputData();t.config.recenter?cD(n):cP(n,0,e.invert),ck(n,...e.color),e={...t.config,...t.yConfig};let a=cT.newInstance({direction:[0,1,0],...e}).getOutputData();t.config.recenter?cD(a):cP(a,1,e.invert),ck(a,...e.color),e={...t.config,...t.zConfig};let r=cT.newInstance({direction:[0,0,1],...e}).getOutputData();t.config.recenter?cD(r):cP(r,2,e.invert),ck(r,...e.color);let o=cC.newInstance();o.setInputData(n),o.addInputData(a),o.addInputData(r),i.setInputConnection(o.getOutputPort())},e.update();let a=oG.Ay.debounce(e.update,0);e.setXAxisColor=t=>e.setXConfig({...e.getXConfig(),color:t}),e.setYAxisColor=t=>e.setYConfig({...e.getYConfig(),color:t}),e.setZAxisColor=t=>e.setZConfig({...e.getZConfig(),color:t}),e.getXAxisColor=()=>t.getXConfig().color,e.getYAxisColor=()=>t.getYConfig().color,e.getZAxisColor=()=>t.getZConfig().color,t._onConfigChanged=a,t._onXConfigChanged=a,t._onYConfigChanged=a,t._onZConfigChanged=a},"vtkAxesActor")},cL=n(35656);!function(e){e[e.ANNOTATED_CUBE=1]="ANNOTATED_CUBE",e[e.AXES=2]="AXES",e[e.CUSTOM=3]="CUSTOM"}(v||(v={}));class cV extends oL.oS{constructor(e={},t={configuration:{orientationWidget:{enabled:!0,viewportCorner:cc.Corners.BOTTOM_RIGHT,viewportSize:.15,minPixelSize:100,maxPixelSize:300},overlayMarkerType:cV.OVERLAY_MARKER_TYPES.ANNOTATED_CUBE,overlayConfiguration:{[cV.OVERLAY_MARKER_TYPES.ANNOTATED_CUBE]:{faceProperties:{xPlus:{text:"L",faceColor:"#ffff00",faceRotation:90},xMinus:{text:"R",faceColor:"#ffff00",faceRotation:270},yPlus:{text:"P",faceColor:"#00ffff",fontColor:"white",faceRotation:180},yMinus:{text:"A",faceColor:"#00ffff",fontColor:"white"},zPlus:{text:"S"},zMinus:{text:"I"}},defaultStyle:{fontStyle:"bold",fontFamily:"Arial",fontColor:"black",fontSizeScale:e=>e/2,faceColor:"#0000ff",edgeThickness:.1,edgeColor:"black",resolution:400}},[cV.OVERLAY_MARKER_TYPES.AXES]:{},[cV.OVERLAY_MARKER_TYPES.CUSTOM]:{polyDataURL:"https://raw.githubusercontent.com/Slicer/Slicer/80ad0a04dacf134754459557bf2638c63f3d1d1b/Base/Logic/Resources/OrientationMarkers/Human.vtp"}}}}){super(e,t),this._resizeObservers=new Map,this.onSetToolEnabled=()=>{this.initViewports(),this._subscribeToViewportEvents()},this.onSetToolActive=()=>{this.initViewports(),this._subscribeToViewportEvents()},this.onSetToolDisabled=()=>{this.cleanUpData(),this._unsubscribeToViewportNewVolumeSet()},this._getViewportsInfo=()=>(0,tT.getToolGroup)(this.toolGroupId).viewportsInfo,this.resize=e=>{let t=this.orientationMarkers[e];if(!t)return;let{orientationWidget:n}=t;n.updateViewport()},this.orientationMarkers={},this.updatingOrientationMarker={}}_unsubscribeToViewportNewVolumeSet(){let e=()=>{this._getViewportsInfo().forEach(({viewportId:e,renderingEngineId:t})=>{let{viewport:n}=(0,M.b1)(e,t),{element:i}=n;i.removeEventListener(M.fX.sV.VOLUME_VIEWPORT_NEW_VOLUME,this.initViewports.bind(this)),this._resizeObservers.get(e).unobserve(i)})};M.tX.removeEventListener(S.sV.TOOLGROUP_VIEWPORT_ADDED,t=>{t.detail.toolGroupId===this.toolGroupId&&(e(),this.initViewports())})}_subscribeToViewportEvents(){let e=()=>{this._getViewportsInfo().forEach(({viewportId:e,renderingEngineId:t})=>{let{viewport:n}=(0,M.b1)(e,t),{element:i}=n;this.initViewports(),i.addEventListener(M.fX.sV.VOLUME_VIEWPORT_NEW_VOLUME,this.initViewports.bind(this));let a=new ResizeObserver(()=>{setTimeout(()=>{let n=(0,M.b1)(e,t);if(!n)return;let{viewport:i}=n;this.resize(e),i.render()},100)});a.observe(i),this._resizeObservers.set(e,a)})};e(),M.tX.addEventListener(S.sV.TOOLGROUP_VIEWPORT_ADDED,t=>{t.detail.toolGroupId===this.toolGroupId&&(e(),this.initViewports())})}cleanUpData(){(0,M.qO)()[0].getViewports().forEach(e=>{let t=this.orientationMarkers[e.id];if(!t)return;let{actor:n,orientationWidget:i}=t;i?.setEnabled(!1),i?.delete(),n?.delete(),e.getRenderingEngine().getOffscreenMultiRenderWindow(e.id).getRenderWindow().render(),e.getRenderingEngine().render(),delete this.orientationMarkers[e.id]})}initViewports(){let e=(0,M.qO)()[0];if(!e)return;let t=e.getViewports();(t=(0,ta.Zi)(t,this.getToolName())).forEach(e=>{if("function"!=typeof e.getWidget)return;let t=e.getWidget(this.getToolName());(!t||t.isDeleted())&&this.addAxisActorInViewport(e)})}async addAxisActorInViewport(e){let t=e.id;if(!this.updatingOrientationMarker[t]){let n;this.updatingOrientationMarker[t]=!0;let i=this.configuration.overlayMarkerType,a=this.configuration.overlayConfiguration[i];if(this.orientationMarkers[t]){let{actor:n,orientationWidget:i}=this.orientationMarkers[t];e.getRenderer().removeActor(n),i.setEnabled(!1)}1===i?n=this.createAnnotationCube(a):2===i?n=cx.newInstance():3===i&&(n=await this.createCustomActor());let r=e.getRenderer(),o=e.getRenderingEngine().getOffscreenMultiRenderWindow(t).getRenderWindow(),{enabled:s,viewportCorner:l,viewportSize:d,minPixelSize:c,maxPixelSize:h}=this.configuration.orientationWidget,u=cc.newInstance({actor:n,interactor:o.getInteractor(),parentRenderer:r});u.setEnabled(s),u.setViewportCorner(l),u.setViewportSize(d),u.setMinPixelSize(c),u.setMaxPixelSize(h),u.updateMarkerOrientation(),this.orientationMarkers[t]={orientationWidget:u,actor:n},e.addWidget(this.getToolName(),u),o.render(),e.getRenderingEngine().render(),this.updatingOrientationMarker[t]=!1}}async createCustomActor(){let e=this.configuration.overlayConfiguration[v.CUSTOM].polyDataURL,t=await fetch(e),n=await t.arrayBuffer(),i=cL.Ay.newInstance();i.parseAsArrayBuffer(n),i.update();let a=iJ.Ay.newInstance();a.shallowCopy(i.getOutputData()),a.getPointData().setActiveScalars("Color");let r=aR.Ay.newInstance();r.setInputData(a),r.setColorModeToDirectScalars();let o=aN.Ay.newInstance();return o.setMapper(r),o.rotateZ(180),o}createAnnotationCube(e){let t=cf.newInstance();return t.setDefaultStyle({...e.defaultStyle}),t.setXPlusFaceProperty({...e.faceProperties.xPlus}),t.setXMinusFaceProperty({...e.faceProperties.xMinus}),t.setYPlusFaceProperty({...e.faceProperties.yPlus}),t.setYMinusFaceProperty({...e.faceProperties.yMinus}),t.setZPlusFaceProperty({...e.faceProperties.zPlus}),t.setZMinusFaceProperty({...e.faceProperties.zMinus}),t}async createAnnotatedCubeActor(){let e=cf.newInstance(),{faceProperties:t,defaultStyle:n}=this.configuration.annotatedCube;return e.setDefaultStyle(n),Object.keys(t).forEach(n=>{e[`set${n.charAt(0).toUpperCase()+n.slice(1)}FaceProperty`](t[n])}),e}}cV.CUBE=1,cV.AXIS=2,cV.VTPFILE=3,cV.OVERLAY_MARKER_TYPES=v,cV.toolName="OrientationMarker";var cO=n(53188),cR=n(58804);function cN(e,t,n){let i=-1,a=-1,r=0,o=1;for(let s=0;s<3;s++)for(let l=0;l<2;l++){let d=2*s+l,c=(e[d]-t[s])*(1-2*l),h=(e[d]-n[s])*(1-2*l);if(c>0&&h>0)return;if(c>0||h>0){let e=0;if(0!==c&&(e=c/(c-h)),c>0?e>=r&&(r=e,i=d):e<=o&&(o=e,a=d),r>o&&(i<0||a<0))return}}function s(i,a){let r=[0,0,0];for(let o=0;o<2;o++)for(let o=0;o<3;o++)i===2*o||i===2*o+1?r[o]=e[i]:(r[o]=t[o]*(1-a)+n[o]*a,r[o]e[2*o+1]&&(r[o]=e[2*o+1]));return r}let l=s(i,r),d=s(a,o);return{t1:r,t2:o,x1:l,x2:d}}var cU={bbox:[...cR.Ay.INIT_BOUNDS]};function cF(e,t,n={}){Object.assign(t,cU,n),cO.Ay.extend(e,t,n),t.classHierarchy.push("vtkBox"),e.setBounds=(...e)=>{let n=[];if(Array.isArray(e[0]))n=e[0];else for(let t=0;t[...t.bbox],e.evaluateFunction=(e,n,i)=>{let a,r,o,s=Array.isArray(e)?e:[e,n,i],l=-Number.MAX_VALUE,d=0,c=cR.Ay.getMinPoint(t.bbox),h=cR.Ay.getMaxPoint(t.bbox),u=1;for(let e=0;e<3;e++)0!==(a=cR.Ay.getLength(t.bbox,e))?(o=(s[e]-c[e])/a)<0?(u=0,r=c[e]-s[e]):o>1?(u=0,r=s[e]-h[e]):(r=o<=.5?c[e]-s[e]:s[e]-h[e])>l&&(l=r):(r=Math.abs(s[e]-c[e]))>0&&(u=0),r>0&&(d+=r*r);return(d=Math.sqrt(d),u)?l:d},e.addBounds=(...n)=>{let i=[];if(Array.isArray(n[0]))i=n[0];else for(let e=0;ee.addBounds(t.getBounds()),e.intersectWithLine=(e,n)=>cN(t.bbox,e,n)}var cB={newInstance:oG.Ay.newInstance(cF,"vtkBox"),extend:cF,intersectWithLine:cN,...{}},cG=n(82382),cH=n(57956),cW=n(95917),cX=n(39535),cz=n(66831),c$=n(87600),cY={renderer:null,selectionPoint:[0,0,0],pickPosition:[0,0,0],pickFromList:!1,pickList:[]};function cj(e,t,n={}){Object.assign(t,cY,n),oG.Ay.obj(e,t),oG.Ay.get(e,t,["renderer"]),oG.Ay.getArray(e,t,["selectionPoint","pickPosition"]),oG.Ay.setGet(e,t,["pickFromList","pickList"]),t.classHierarchy.push("vtkAbstractPicker"),e.initialize=()=>{t.renderer=null,t.selectionPoint[0]=0,t.selectionPoint[1]=0,t.selectionPoint[2]=0,t.pickPosition[0]=0,t.pickPosition[1]=0,t.pickPosition[2]=0},e.initializePickList=()=>{t.pickList=[]},e.addPickList=e=>{t.pickList.push(e)},e.deletePickList=e=>{let n=t.pickList.indexOf(e);-1!==n&&t.pickList.splice(n,1)}}oG.Ay.newInstance(cj,"vtkAbstractPicker");var cJ={extend:cj},{vtkErrorMacro:cQ}=oG.Ay,{vtkWarningMacro:cq}=oG.Ay,cK={tolerance:.025,mapperPosition:[0,0,0],mapper:null,dataSet:null,actors:[],pickedPositions:[],transformMatrix:null,globalTMin:Number.MAX_VALUE};function cZ(e,t,n={}){Object.assign(t,cK,n),cJ.extend(e,t,n),oG.Ay.setGet(e,t,["tolerance"]),oG.Ay.setGetArray(e,t,["mapperPosition"],3),oG.Ay.get(e,t,["mapper","dataSet","actors","pickedPositions"]),oG.Ay.event(e,t,"pickChange");t.classHierarchy.push("vtkPicker");let i={...e};function a(){i.initialize(),t.actors=[],t.pickedPositions=[],t.mapperPosition[0]=0,t.mapperPosition[1]=0,t.mapperPosition[2]=0,t.mapper=null,t.dataSet=null,t.globalTMin=Number.MAX_VALUE}function r(e,t,n){let i=0,a=n.getRenderWindow().getViews()[0],r=n.getViewport(),o=a.getSize(),s=o[0]*r[0],l=o[1]*r[1],d=a.displayToNormalizedDisplay(s,l,e),c=n.normalizedDisplayToWorld(d[0],d[1],d[2],t);s=o[0]*r[2],l=o[1]*r[3];let h=a.displayToNormalizedDisplay(s,l,e),u=n.normalizedDisplayToWorld(h[0],h[1],h[2],t);for(let e=0;e<3;e++)i+=(u[e]-c[e])*(u[e]-c[e]);return Math.sqrt(i)}function o(e,n,i,a){let r=new Float64Array(4),o=new Float64Array(4),s=[],l=[],d=t.pickFromList?t.pickList:e.getActors(),c=new Float64Array(3),h=new Float64Array(3);d.forEach(e=>{let d=e.getMapper(),u=e.getProperty?.().getOpacity?.()===0;if(!(e.getNestedPickable()&&e.getNestedVisibility()&&!u))return;t.transformMatrix=e.getMatrix().slice(0),r$.transpose(t.transformMatrix,t.transformMatrix),r$.invert(t.transformMatrix,t.transformMatrix),oM.Z0(r,i,t.transformMatrix),oM.Z0(o,a,t.transformMatrix),e7.hs(r,r,1/r[3]),e7.hs(o,o,1/o[3]),(0,oR.Re)(o,r,s);let g=d?cR.Ay.inflate(d.getBounds(),n):[...cR.Ay.INIT_BOUNDS];if(cR.Ay.intersectBox(g,r,s,l,[])){r$.getScaling(c,t.transformMatrix);let s=t.intersectWithLine(r,o,.333*n*(c[0]+c[1]+c[2]),e,d);if(s{let n=e.distance2,i=t.distance2;return ni)}),t.pickedPositions=[],t.actors=[],u.forEach(e=>{t.pickedPositions.push(e.pickedPosition),t.actors.push(e.actor)})}t.intersectWithLine=(e,t,n,i,a)=>{if(!a)return Number.MAX_VALUE;let r=a.getCenter(),o=e7.Re(new Float64Array(3),t,e),s=(0,oR.Om)(o,o);return 0===s?2:(o[0]*(r[0]-e[0])+o[1]*(r[1]-e[1])+o[2]*(r[2]-e[2]))/s},e.pick=(e,n)=>{let i,s;if(3!==e.length&&cq("vtkPicker.pick - selection needs three components"),!n)throw cQ("vtkPicker.pick - renderer cannot be null"),Error("renderer cannot be null");a();let l=e[0],d=e[1],c=e[2];t.renderer=n,t.selectionPoint[0]=l,t.selectionPoint[1]=d,t.selectionPoint[2]=c;let h=new Float64Array(4),u=new Float64Array(4),g=n.getActiveCamera(),p=g.getPosition(),m=g.getFocalPoint(),f=n.getRenderWindow().getViews()[0],v=f.getViewportSize(n);if(0===v[1])return void cq("vtkPicker.pick - viewport area is 0");let I=v[0]/v[1],_=[];_=n.worldToNormalizedDisplay(m[0],m[1],m[2],I),c=(_=f.normalizedDisplayToDisplay(_[0],_[1],_[2]))[2];let w=f.displayToNormalizedDisplay(l,d,c),b=n.normalizedDisplayToWorld(w[0],w[1],w[2],I);for(let e=0;e<3;e++)t.pickPosition[e]=b[e];let C=[];for(let e=0;e<3;e++)C[e]=t.pickPosition[e]-p[e];let A=[];for(let e=0;e<3;e++)A[e]=m[e]-p[e];(0,oR.S8)(A);let E=(0,oR.Om)(A,C);if(0===E)return void cq("Picker::Pick Cannot process points");let M=g.getClippingRange();if(g.getParallelProjection()){i=M[0]-E,s=M[1]-E;for(let e=0;e<3;e++)h[e]=t.pickPosition[e]+i*A[e],u[e]=t.pickPosition[e]+s*A[e]}else{i=M[0]/E,s=M[1]/E;for(let e=0;e<3;e++)h[e]=p[e]+i*C[e],u[e]=p[e]+s*C[e]}h[3]=1,u[3]=1;let y=r(c,I,n)*t.tolerance;o(t.renderer,y,h,u)},e.pick3DPoint=(e,n,i)=>{if(!i)throw Error("renderer cannot be null");a(),t.renderer=i,e7.C(t.selectionPoint,e);let s=i.getRenderWindow().getViews()[0].getViewportSize(i);if(0===s[1])return void cq("vtkPicker.pick3DPoint - viewport area is 0");let l=s[0]/s[1];o(i,r(t.selectionPoint[2],l,i)*t.tolerance,e,n)}}oG.Ay.newInstance(cZ,"vtkPicker");var c0={extend:cZ};function c1(){return{[cG.vZ.VTK_LINE]:cW.Ay.newInstance(),[cG.vZ.VTK_POLY_LINE]:cX.Ay.newInstance(),[cG.vZ.VTK_TRIANGLE]:cz.Ay.newInstance(),[cG.vZ.VTK_QUAD]:c$.Ay.newInstance()}}function c2(e,t,n,i){let a={planeId:-1,t1:0,t2:1,intersect:0},r=e.getNumberOfClippingPlanes(),o=[];for(let s=0;s=a.t1&&(a.t1=e,a.planeId=s):e<=a.t2&&(a.t2=e),a.t1>a.t2)return a.intersect=0,a}}return a.intersect=1,a}var c5={cellId:-1,pCoords:[],cellIJK:[],pickNormal:[],mapperNormal:[],opacityThreshold:.2};function c3(e,t,n={}){Object.assign(t,c5,n),c0.extend(e,t,n),oG.Ay.getArray(e,t,["pickNormal","mapperNormal","pCoords","cellIJK"]),oG.Ay.setGet(e,t,["opacityThreshold"]),oG.Ay.get(e,t,["cellId"]);t.classHierarchy.push("vtkCellPicker");let i={...e};function a(){t.dataSet=null,t.mapper=null,t.cellId=-1,t.pCoords[0]=0,t.pCoords[1]=0,t.pCoords[2]=0,t.cellIJK[0]=0,t.cellIJK[1]=0,t.cellIJK[2]=0,t.mapperNormal[0]=0,t.mapperNormal[1]=0,t.mapperNormal[2]=1,t.pickNormal[0]=0,t.pickNormal[1]=0,t.pickNormal[2]=1}e.initialize=()=>{a(),i.initialize()},e.computeSurfaceNormal=(e,t,n,i)=>{let a=e.getPointData().getNormals();if(a){i[0]=0,i[1]=0,i[2]=0;let e=[];for(let r=0;r<3;r++)a.getTuple(t.getPointsIds()[r],e),i[0]+=e[0]*n[r],i[1]+=e[1]*n[r],i[2]+=e[2]*n[r];(0,oR.S8)(i)}else if(1)return 0;return 1},e.pick=(n,a)=>{e.initialize();let r=i.pick(n,a);if(r){let e=a.getActiveCamera(),n=[];if(e.getPosition(n),e.getParallelProjection()){let i=[];e.getFocalPoint(i),t.pickNormal[0]=n[0]-i[0],t.pickNormal[1]=n[1]-i[1],t.pickNormal[2]=n[2]-i[2]}else t.pickNormal[0]=n[0]-t.pickPosition[0],t.pickNormal[1]=n[1]-t.pickPosition[1],t.pickNormal[2]=n[2]-t.pickPosition[2];(0,oR.S8)(t.pickNormal)}return r},t.intersectWithLine=(e,n,i,a,r)=>{let o=Number.MAX_VALUE,s=0,l=1,d=c2(r,t.transformMatrix,e,n,s,l);if(r&&!d.intersect)return Number.MAX_VALUE;if(r.isA("vtkImageMapper")||r.isA("vtkImageArrayMapper")){let i=r.intersectWithLineForCellPicking(e,n);i&&(o=i.t,t.cellIJK=i.ijk,t.pCoords=i.pCoords)}else if(r.isA("vtkVolumeMapper")){let c=cB.intersectWithLine(r.getBounds(),e,n);s=c?.t1>d.t1?c.t1:d.t1,l=c?.t2Math.abs(o-s)&&d.clippingPlaneId>=0){t.mapperPosition[0]=e[0]*(1-s)+n[0]*s,t.mapperPosition[1]=e[1]*(1-s)+n[1]*s,t.mapperPosition[2]=e[2]*(1-s)+n[2]*s;let i=[];r.getClippingPlaneInDataCoords(t.transformMatrix,d.clippingPlaneId,i),(0,oR.S8)(i),t.mapperNormal[0]=-i[0],t.mapperNormal[1]=-i[1],t.mapperNormal[2]=-i[2]}e7.Z0(t.pickPosition,t.mapperPosition,t.transformMatrix);let i=t.transformMatrix;t.mapperNormal[0]=i[0]*t.pickNormal[0]+i[4]*t.pickNormal[1]+i[8]*t.pickNormal[2],t.mapperNormal[1]=i[1]*t.pickNormal[0]+i[5]*t.pickNormal[1]+i[9]*t.pickNormal[2],t.mapperNormal[2]=i[2]*t.pickNormal[0]+i[6]*t.pickNormal[1]+i[10]*t.pickNormal[2]}return o},t.intersectVolumeWithLine=(e,n,i,a,r,o)=>{let s,l,d,c=Number.MAX_VALUE,h=o.getMapper(),u=h.getInputData(),g=u.getDimensions(),p=u.getPointData().getScalars().getData(),m=u.getExtent(),f=u.getWorldToIndex(),v=h.getOpacityTextureWidth();v<=0&&(v=1024);let I=new Float32Array(v),_=new Float32Array(v),w=o.getMapper().getSampleDistance();for(let e=0;e<1;++e){l=(s=o.getProperty().getScalarOpacity(e)).getRange(),s.getTable(l[0],l[1],v,I,1);let t=w/o.getProperty().getScalarOpacityUnitDistance(e);for(let e=0;em[2*e+1]&&(y[e]=m[2*e+1],d=!1),S[e]=Math.round(y[e]);if(d){let n=p[S[2]*T+S[1]*D+S[0]];if(nl[1]&&(n=l[1]),I[n=Math.floor((n-l[0])*b)]>t.opacityThreshold){c=i*(1-e)+a*e;break}}}return c},t.intersectActorWithLine=(n,i,r,o,s,l)=>{let d=Number.MAX_VALUE,c=[0,0,0],h=Number.MAX_VALUE,u=[0,0,0],g=null,p=null,m=null,f=null,v=[],I=l.getInputData(),_=[0,0,0],w=[0,0,0];if(_[0]=n[0],_[1]=n[1],_[2]=n[2],w[0]=i[0],w[1]=i[1],w[2]=i[2],0!==r||1!==o)for(let e=0;e<3;e++)_[e]=n[e]*(1-r)+i[e]*r,w[e]=n[e]*(1-o)+i[e]*o;if(I.getCells){I.getCells()||I.buildLinks();let e=c1(),a=c1(),l=I.getNumberOfCells();for(let _=0;_=r&&l.t<=o)){let e=b.getParametricDistance(w);if(e=0&&dl&&(d=e,l=o[e]);-1!==d&&(t.pointId=p.getPointsIds()[d]),t.mapperPosition[0]=c[0],t.mapperPosition[1]=c[1],t.mapperPosition[2]=c[2],e.computeSurfaceNormal(I,p,o,t.mapperNormal)||(t.mapperNormal[0]=n[0]-i[0],t.mapperNormal[1]=n[1]-i[1],t.mapperNormal[2]=n[2]-i[2],(0,oR.S8)(t.mapperNormal))}return d}}var c8={newInstance:oG.Ay.newInstance(c3,"vtkCellPicker"),extend:c3,...{clipLineWithPlane:c2}};let c4=[4,0,1,2,3,4,4,5,6,7,4,8,9,10,11,4,12,13,14,15,4,16,17,18,19,4,20,21,22,23],c6=[3,0,16,8,3,1,9,20,3,2,23,13,3,3,12,19,3,4,17,11,3,5,10,21,3,6,14,22,3,7,18,15],c9=[4,0,1,9,8,4,1,2,23,20,4,2,3,12,13,4,3,0,16,19,4,4,5,10,11,4,5,6,22,21,4,6,7,15,14,4,7,4,17,18,4,8,11,17,16,4,9,20,21,10,4,13,23,22,14,4,12,19,18,15],c7={scale:1,generate3DTextureCoordinates:!1,generateMainFaces:!0,generateEdgeFaces:!0,generateCornerFaces:!0},he={newInstance:oG.Ay.newInstance(function(e,t,n={}){Object.assign(t,c7,n),oG.Ay.obj(e,t),oG.Ay.setGet(e,t,["scale","generate3DTextureCoordinates","generateMainFaces","generateEdgeFaces","generateCornerFaces"]),oG.Ay.algo(e,t,0,1),t.classHierarchy.push("vtkRhombicuboctahedronSource"),e.requestData=(e,n)=>{let i=n[0]?.initialize()||iJ.Ay.newInstance();n[0]=i;let a=1;void 0!==t.scale&&null!==t.scale&&(Array.isArray(t.scale)?a=t.scale[0]||1:"number"==typeof t.scale&&(a=t.scale));let r=[];r.push(-.792,-.792,-1.4),r.push(.792,-.792,-1.4),r.push(.792,.792,-1.4),r.push(-.792,.792,-1.4),r.push(-.792,-.792,1.4),r.push(.792,-.792,1.4),r.push(.792,.792,1.4),r.push(-.792,.792,1.4),r.push(-.792,-1.4,-.792),r.push(.792,-1.4,-.792),r.push(.792,-1.4,.792),r.push(-.792,-1.4,.792),r.push(-.792,1.4,-.792),r.push(.792,1.4,-.792),r.push(.792,1.4,.792),r.push(-.792,1.4,.792),r.push(-1.4,-.792,-.792),r.push(-1.4,-.792,.792),r.push(-1.4,.792,.792),r.push(-1.4,.792,-.792),r.push(1.4,-.792,-.792),r.push(1.4,-.792,.792),r.push(1.4,.792,.792),r.push(1.4,.792,-.792);let o=null;if(t.generate3DTextureCoordinates){o=new Float64Array(72);for(let e=0;e<24;e++){let t=r[3*e],n=r[3*e+1],i=r[3*e+2],a=Math.sqrt(t*t+n*n+i*i)||1;o[3*e]=t/a,o[3*e+1]=n/a,o[3*e+2]=i/a}}for(let e=0;e0){let e=iY.Ay.newInstance({values:Uint16Array.from(c)});i.getPolys().deepCopy(e)}else i.getPolys().initialize();i.modified()}},"vtkRhombicuboctahedronSource")},ht={defaultStyle:{text:"",faceColor:"white",faceRotation:0,fontFamily:"Arial",fontColor:"black",fontStyle:"normal",fontSizeScale:e=>e/1.8,edgeThickness:.1,edgeColor:"black",resolution:200},xPlusFaceProperty:{},xMinusFaceProperty:{},yPlusFaceProperty:{},yMinusFaceProperty:{},zPlusFaceProperty:{},zMinusFaceProperty:{},showMainFaces:!0,showEdgeFaces:!0,showCornerFaces:!0,scale:1},hn={newInstance:oG.Ay.newInstance(function(e,t,n={}){Object.assign(t,ht,n),aN.Ay.extend(e,t,n),t.xPlusFaceProperty={...t.xPlusFaceProperty},t.xMinusFaceProperty={...t.xMinusFaceProperty},t.yPlusFaceProperty={...t.yPlusFaceProperty},t.yMinusFaceProperty={...t.yMinusFaceProperty},t.zPlusFaceProperty={...t.zPlusFaceProperty},t.zMinusFaceProperty={...t.zMinusFaceProperty},oG.Ay.get(e,t,["defaultStyle","xPlusFaceProperty","xMinusFaceProperty","yPlusFaceProperty","yMinusFaceProperty","zPlusFaceProperty","zMinusFaceProperty","showMainFaces","showEdgeFaces","showCornerFaces","scale"]);t.classHierarchy.push("vtkAnnotatedRhombicuboctahedronActor"),e.setDefaultStyle=e=>{t.defaultStyle={...t.defaultStyle,...e}},e.setXPlusFaceProperty=n=>{Object.assign(t.xPlusFaceProperty,n),e.modified()},e.setXMinusFaceProperty=n=>{Object.assign(t.xMinusFaceProperty,n),e.modified()},e.setYPlusFaceProperty=n=>{Object.assign(t.yPlusFaceProperty,n),e.modified()},e.setYMinusFaceProperty=n=>{Object.assign(t.yMinusFaceProperty,n),e.modified()},e.setZPlusFaceProperty=n=>{Object.assign(t.zPlusFaceProperty,n),e.modified()},e.setZMinusFaceProperty=n=>{Object.assign(t.zMinusFaceProperty,n),e.modified()},e.setShowMainFaces=e=>{t.showMainFaces!==e&&(t.showMainFaces=e)},e.setShowEdgeFaces=e=>{t.showEdgeFaces!==e&&(t.showEdgeFaces=e)},e.setShowCornerFaces=e=>{t.showCornerFaces!==e&&(t.showCornerFaces=e)},e.setRhombScale=e=>{t.scale!==e&&(t.scale=e)},e.getActors=()=>(function(){let e=1;void 0!==t.scale&&null!==t.scale&&(Array.isArray(t.scale)?e=t.scale[0]||1:"number"==typeof t.scale&&(e=t.scale));let n=[],i=e=>{let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?t.slice(1,4).map(e=>parseInt(e,16)):[255,255,255]},a=e=>{if(!e)return[0,0,0];let t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t)return[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10)];if(e.startsWith("#"))return i(e);let n={black:[0,0,0],white:[255,255,255],red:[255,0,0],green:[0,255,0],blue:[0,0,255]};return n[e.toLowerCase()]?n[e.toLowerCase()]:[0,0,0]},r={zMinus:i(t.zMinusFaceProperty.faceColor||t.defaultStyle.faceColor),zPlus:i(t.zPlusFaceProperty.faceColor||t.defaultStyle.faceColor),yMinus:i(t.yMinusFaceProperty.faceColor||t.defaultStyle.faceColor),yPlus:i(t.yPlusFaceProperty.faceColor||t.defaultStyle.faceColor),xMinus:i(t.xMinusFaceProperty.faceColor||t.defaultStyle.faceColor),xPlus:i(t.xPlusFaceProperty.faceColor||t.defaultStyle.faceColor)};if(!1!==t.showMainFaces){let i=function(e){let t=document.createElement("canvas");t.width=768,t.height=512;let n=t.getContext("2d");return e.forEach((e,t)=>{let i=Math.floor(t/3),a=t%3*256,r=256*i;n.fillStyle=`rgb(${e.faceColor[0]}, ${e.faceColor[1]}, ${e.faceColor[2]})`,n.fillRect(a,r,256,256),e.text&&(n.save(),n.translate(a+128,r+128),e.flipVertical&&n.scale(1,-1),e.flipHorizontal&&n.scale(-1,1),n.rotate((e.rotation||0)*Math.PI/180),n.fillStyle=`rgb(${e.textColor[0]}, ${e.textColor[1]}, ${e.textColor[2]})`,n.font="bold 180px Arial",n.textAlign="center",n.textBaseline="middle",n.fillText(e.text,0,0),n.restore())}),ch.canvasToImageData(t)}([{faceColor:r.zMinus,text:t.zMinusFaceProperty.text||"I",textColor:a(t.zMinusFaceProperty.fontColor||t.defaultStyle.fontColor),rotation:0},{faceColor:r.zPlus,text:t.zPlusFaceProperty.text||"S",textColor:a(t.zPlusFaceProperty.fontColor||t.defaultStyle.fontColor),rotation:0,flipVertical:!0},{faceColor:r.yMinus,text:t.yMinusFaceProperty.text||"A",textColor:a(t.yMinusFaceProperty.fontColor||t.defaultStyle.fontColor),rotation:180},{faceColor:r.yPlus,text:t.yPlusFaceProperty.text||"P",textColor:a(t.yPlusFaceProperty.fontColor||t.defaultStyle.fontColor),rotation:180},{faceColor:r.xMinus,text:t.xMinusFaceProperty.text||"L",textColor:a(t.xMinusFaceProperty.fontColor||t.defaultStyle.fontColor),rotation:90,flipVertical:!0},{faceColor:r.xPlus,text:t.xPlusFaceProperty.text||"R",textColor:a(t.xPlusFaceProperty.fontColor||t.defaultStyle.fontColor),rotation:90}]),o=function(e,t,n){let i=he.newInstance({generate3DTextureCoordinates:!1,generateMainFaces:!0,generateEdgeFaces:!1,generateCornerFaces:!1,scale:e});i.update();let a=i.getOutputData();if(a){let e=[];for(let t=0;t<6;t++){let n=t%3,i=Math.floor(t/3),a=n/3,r=(n+1)/3,o=i/2,s=(i+1)/2;e.push(a,o),e.push(r,o),e.push(r,s),e.push(a,s)}let t=tF.Ay.newInstance({name:"TextureCoordinates",values:new Float32Array(e),numberOfComponents:2});a.getPointData().setTCoords(t),a.modified()}return a}(e,0,0);if(o){let e=aN.Ay.newInstance(),t=aR.Ay.newInstance();t.setInputData(o),e.setMapper(t);let a=cg.Ay.newInstance();a.setInputData(i),a.setInterpolate(!0),e.addTexture(a);let r=e.getProperty();r.setBackfaceCulling(!1),r.setFrontfaceCulling(!1),r.setLighting(!1),r.setAmbient(1),r.setDiffuse(0),r.setSpecular(0),n.push(e)}}if(!1!==t.showEdgeFaces){let i=function(e,t){let n=he.newInstance({generate3DTextureCoordinates:!1,generateMainFaces:!1,generateEdgeFaces:!0,generateCornerFaces:!1,scale:e});n.update();let i=n.getOutputData();if(i){let e=[],n=i.getNumberOfCells();for(let i=0;i`#${e.map(e=>{let t=Math.round(e).toString(16);return 1===t.length?"0"+t:t}).join("")}`,n=e=>`rgb(${e[0]}, ${e[1]}, ${e[2]})`,i=hn.newInstance({edgeColor:e.edgeColor??[200,200,200],cornerColor:e.cornerColor??[150,150,150]}),a={fontStyle:"bold",fontFamily:"Arial",fontColor:"black",fontSizeScale:e=>e/2,faceColor:t(e.faceColors.topBottom),edgeThickness:.1,edgeColor:"black",resolution:400};i.setDefaultStyle(a),i.setXPlusFaceProperty({text:"L",faceColor:t(e.faceColors.leftRight),fontColor:n(e.letterColors.xPlus),faceRotation:0}),i.setXMinusFaceProperty({text:"R",faceColor:t(e.faceColors.leftRight),fontColor:n(e.letterColors.xMinus),faceRotation:0}),i.setYPlusFaceProperty({text:"P",faceColor:t(e.faceColors.frontBack),fontColor:n(e.letterColors.yPlus),faceRotation:180}),i.setYMinusFaceProperty({text:"A",faceColor:t(e.faceColors.frontBack),fontColor:n(e.letterColors.yMinus),faceRotation:0}),i.setZPlusFaceProperty({text:"S",faceColor:t(e.faceColors.topBottom),fontColor:n(e.letterColors.zPlus)}),i.setZMinusFaceProperty({text:"I",faceColor:t(e.faceColors.topBottom),fontColor:n(e.letterColors.zMinus)}),i.setShowMainFaces(!0),i.setShowEdgeFaces(e.showEdgeFaces),i.setShowCornerFaces(e.showCornerFaces);let r=i.getActors();return this._highlightColor=e.highlightColor??[255,255,255],this._restingAmbient=e.restingAmbient??1,this._hoverAmbient=e.hoverAmbient??1,r.forEach(t=>{let n=t.getProperty();n.setOpacity(e.opacity),n.setAmbient(this._restingAmbient),t.setVisibility(!0)}),r}addActorsToViewport(e,t,n){this.actors.get(e)&&this.removeActorsFromViewport(e,t);let i=t.getRenderingEngine().getOffscreenMultiRenderWindow(t.id).getRenderWindow(),a=t.getRenderingEngine()?.getRenderer(e)??t.getRenderer(),r=ca.Ay.newInstance();r.setLayer(1),r.setInteractive(!1),r.setPreserveColorBuffer(!0),r.setActiveCamera(a.getActiveCamera());let o=a.getViewport();r.setViewport(...o),2>i.getNumberOfLayers()&&i.setNumberOfLayers(2),i.addRenderer(r),n.forEach(e=>{r.addActor(e)}),this.actors.set(e,n),this.overlayRenderers.set(e,r),this.renderWindows.set(e,i)}removeActorsFromViewport(e,t){let n=this.actors.get(e),i=this.overlayRenderers.get(e),a=this.renderWindows.get(e);n&&i&&(n.forEach(e=>{i.removeActor(e)}),a&&a.removeRenderer(i),i.delete()),this.actors.delete(e),this.overlayRenderers.delete(e),this.renderWindows.delete(e)}setupPicker(e,t){let n=c8.newInstance({opacityThreshold:1e-4});return n.setPickFromList(!0),n.setTolerance(.001),n.initializePickList(),t.forEach(e=>{n.addPickList(e)}),this.pickers.set(e,n),n}pickAtPosition(e,t,n,i,a){let r=this.pickers.get(t);if(!r)return null;let o=this.overlayRenderers.get(t)??n.getRenderingEngine()?.getRenderer(t)??n.getRenderer();if(!o)return null;let s=i.getBoundingClientRect(),l=e.clientX-s.left,d=e.clientY-s.top,c=window.devicePixelRatio||1,h=[l*c,d*c],{width:u,height:g}=n.canvas,[p,m,f,v]=o.getViewport(),I=v-m,_=h[0]/u*(f-p)*u,w=h[1]/g*I*g,b=[_,I*g-w],C=[b[0],b[1],0];r.pick(C,o);let A=r.getActors();if(0===A.length)return null;let E=A[0],M=r.getCellId();if(a.includes(E)&&-1!==M){let e=a.indexOf(E);return{pickedActor:E,cellId:M,actorIndex:e}}return null}calculateMarkerPosition(e,t,n){let i,a,r=e.canvas;if(!r)return null;let o=window.devicePixelRatio||1,s=r.clientWidth||r.width/o,l=r.clientHeight||r.height/o,d=e.type===M.fX.NV.VOLUME_3D?1.3:1.1,c=.5*n,h=Math.max(0,(s-n)/2),u=Math.max(0,(l-n)/2),g=Math.min(d*n,h,u);switch(t){case"top-left":i=g+c,a=g+c;break;case"top-right":i=s-g-c,a=g+c;break;case"bottom-left":i=g+c,a=l-g-c;break;default:i=s-g-c,a=l-g-c}let p=[i,a],m=e.canvasToWorld(p);return[m[0],m[1],m[2]]}positionActors(e,t,n){let i=e.canvas;if(!i)return console.warn("OrientationControllerWidget: No canvas available"),!1;let a=e.getRenderingEngine()?.getRenderer(e.id)??e.getRenderer(),r=a?.getActiveCamera();if(!r)return!1;let o=r.getParallelScale(),s=window.devicePixelRatio||1,l=i.clientHeight||i.height/s,d=Math.min(i.clientWidth||i.width/s,l)*n.size,c=2*o/l*d;return t.forEach(t=>{t.setScale(c,c,c);let i=this.calculateMarkerPosition(e,n.position,d);if(!i)return void console.warn("OrientationControllerWidget: Could not get world position");t.setPosition(i[0],i[1],i[2]),t.setOrientation(0,0,0)}),!0}highlightFace(e,t,n,i=!1){if(this.highlightedFace&&this.highlightedFace.actor===e&&this.highlightedFace.cellId===t&&this.highlightedFace.isMainFace===i)return;if(this.clearHighlight(),i){let i=e.getTextures?.(),a=Array.isArray(i)?i[0]:i?.getItem?.(0),r=a?.getInputData?.(),o=r?.getPointData().getScalars(),s=o?.getData(),l=r?.getDimensions();if(!r||!o||!s||!l||t<0||t>5){let i=e.getMapper().getInputData();if(!i?.getCellPoints)return;let{cellPointIds:a}=i.getCellPoints(t);if(!a||a.length<3)return;let r=i.getPoints().getData(),o=[];Array.from(a).forEach(e=>{let t=3*e;o.push(r[t],r[t+1],r[t+2])});let s=ij.Ay.newInstance();s.setData(new Float32Array(o),3);let l=iY.Ay.newInstance({values:new Uint32Array([a.length,...Array.from(a,(e,t)=>t)])}),d=iJ.Ay.newInstance();d.setPoints(s),d.setPolys(l);let c=aR.Ay.newInstance();c.setInputData(d);let h=aN.Ay.newInstance();h.setMapper(c);let[u,g,p]=e.getScale(),[m,f,v]=e.getPosition(),[I,_,w]=e.getOrientation();h.setScale(u,g,p),h.setPosition(m,f,v),h.setOrientation(I,_,w),h.setPickable(!1);let b=h.getProperty();b.setLighting(!1),b.setAmbient(1),b.setDiffuse(0),b.setColor(1,1,1),b.setOpacity(.58),this.overlayRenderers.get(n.id)?.addActor(h),this.highlightedFace={actor:e,cellId:t,originalColor:[0,0,0,0],viewport:n,isMainFace:!0,mainFaceHighlightActor:h},n.render();return}let[d,c]=l,h=Math.floor(d/3),u=Math.floor(c/2),g=t%3*h,p=Math.floor(t/3)*u,m=new Uint8Array(h*u*4),f=0;for(let e=0;e{I[0]+=s[e],I[1]+=s[e+1],I[2]+=s[e+2]}),I[0]/=v.length,I[1]/=v.length,I[2]/=v.length;let _=(e,t)=>{if(e<0||e>=h||t<0||t>=u)return!1;let n=((p+t)*d+(g+e))*4,i=s[n]-I[0],a=s[n+1]-I[1],r=s[n+2]-I[2];return Math.sqrt(i*i+a*a+r*r)>=42},w=Math.max(4,Math.floor(.035*h));for(let e=0;e=h-w||e=u-w||_(t,e))continue;let n=((p+e)*d+(g+t))*4;s[n]=Math.min(255,s[n]+72),s[n+1]=Math.min(255,s[n+1]+72),s[n+2]=Math.min(255,s[n+2]+72)}for(let e=0;e=h-w||e=u-w))continue;let n=((p+e)*d+(g+t))*4;s[n]=0,s[n+1]=0,s[n+2]=0}o.modified(),r.modified(),a.modified?.(),e.modified?.(),this.highlightedFace={actor:e,cellId:t,originalColor:[0,0,0,0],viewport:n,isMainFace:!0,mainFaceTextureData:m,mainFaceTile:{x0:g,y0:p,width:h,height:u,imageWidth:d}},n.render();return}let a=e.getMapper().getInputData();if(!a)return;let r=a.getCellData().getScalars();if(!r)return;let o=r.getData(),s=4*t,l=[o[s],o[s+1],o[s+2],o[s+3]];this.highlightedFace={actor:e,cellId:t,originalColor:l,viewport:n,isMainFace:!1};let d=this._highlightColor;o[s]=d[0],o[s+1]=d[1],o[s+2]=d[2],o[s+3]=255,r.modified(),a.modified(),n.render()}clearHighlight(){if(!this.highlightedFace)return;let{actor:e,cellId:t,originalColor:n,viewport:i,isMainFace:a}=this.highlightedFace;if(a){let t=this.highlightedFace.mainFaceTextureData,n=this.highlightedFace.mainFaceTile,a=e.getTextures?.(),r=a?.[0],o=r?.getInputData?.(),s=o?.getPointData().getScalars(),l=s?.getData();if(t&&n&&s&&o&&l){let i=0;for(let e=0;e{i.forEach(t=>{t.getProperty().setAmbient(e?this._hoverAmbient:this._restingAmbient)}),n.render()},l=!1,d=null,c=null,h=d=>{if(r){if(c){let e=d.clientX-c.x,t=d.clientY-c.y;e*e+t*t>9&&(l=!0)}return}let h=this.pickAtPosition(d,e,n,t,i);if(h){o||(o=!0,s(!0));let{pickedActor:e,cellId:t,actorIndex:i}=h;this.highlightFace(e,t,n,0===i),a.onFaceHover&&a.onFaceHover(h)}else o&&(o=!1,s(!1)),this.clearHighlight(),a.onFaceHover&&a.onFaceHover(null)},u=a=>{if(0!==a.button)return;let o=this.pickAtPosition(a,e,n,t,i);o&&(r=!0,l=!1,d=o,c={x:a.clientX,y:a.clientY},oJ.has(e)||oJ.set(e,"orientation-controller"))},g=t=>{if(r&&!l&&d){let e=d.cellId;1===d.actorIndex?e=d.cellId+6:2===d.actorIndex&&(e=d.cellId+18),a.onFacePicked({...d,cellId:e}),t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation()}r=!1,o&&(o=!1,s(!1)),l=!1,d=null,c=null,oQ(e,"orientation-controller"),this.clearHighlight()},p=a=>{this.pickAtPosition(a,e,n,t,i)&&(a.preventDefault(),a.stopImmediatePropagation())};t.addEventListener("mousemove",h,!0),t.addEventListener("mousedown",u,!0),t.addEventListener("mouseup",g),t.addEventListener("mouseleave",g),t.addEventListener("dblclick",p,!0);let m=()=>{t.removeEventListener("mousemove",h,!0),t.removeEventListener("mousedown",u,!0),t.removeEventListener("mouseup",g),t.removeEventListener("mouseleave",g),t.removeEventListener("dblclick",p,!0),oQ(e,"orientation-controller")};return this.mouseHandlers.set(e,{cleanup:m}),{cleanup:m}}getActors(e){return this.actors.get(e)}syncOverlayViewport(e,t){let n=this.overlayRenderers.get(e);if(!n)return;let i=t.getRenderingEngine()?.getRenderer(e)??t.getRenderer();if(!i)return;let a=i.getViewport();n.setViewport(...a)}getOrientationForFace(e){let t=new Map;t.set(0,{viewPlaneNormal:[0,0,-1],viewUp:[0,-1,0]}),t.set(1,{viewPlaneNormal:[0,0,1],viewUp:[0,1,0]}),t.set(2,{viewPlaneNormal:[0,-1,0],viewUp:[0,0,1]}),t.set(3,{viewPlaneNormal:[0,1,0],viewUp:[0,0,1]}),t.set(4,{viewPlaneNormal:[-1,0,0],viewUp:[0,0,1]}),t.set(5,{viewPlaneNormal:[1,0,0],viewUp:[0,0,1]});let n=1/Math.sqrt(2);t.set(6,{viewPlaneNormal:[0,-n,-n],viewUp:[0,-n,n]}),t.set(7,{viewPlaneNormal:[n,0,-n],viewUp:[0,0,1]}),t.set(8,{viewPlaneNormal:[0,n,-n],viewUp:[0,-n,-n]}),t.set(9,{viewPlaneNormal:[-n,0,-n],viewUp:[0,0,1]}),t.set(10,{viewPlaneNormal:[0,-n,n],viewUp:[0,n,n]}),t.set(11,{viewPlaneNormal:[n,0,n],viewUp:[0,0,1]}),t.set(12,{viewPlaneNormal:[0,n,n],viewUp:[0,n,-n]}),t.set(13,{viewPlaneNormal:[-n,0,n],viewUp:[0,0,1]}),t.set(14,{viewPlaneNormal:[-n,-n,0],viewUp:[0,0,1]}),t.set(15,{viewPlaneNormal:[n,-n,0],viewUp:[0,0,1]}),t.set(16,{viewPlaneNormal:[n,n,0],viewUp:[0,0,1]}),t.set(17,{viewPlaneNormal:[-n,n,0],viewUp:[0,0,1]});let i=1/Math.sqrt(3);return t.set(18,{viewPlaneNormal:[-i,-i,-i],viewUp:[0,0,1]}),t.set(19,{viewPlaneNormal:[i,-i,-i],viewUp:[0,0,1]}),t.set(20,{viewPlaneNormal:[i,i,-i],viewUp:[0,0,1]}),t.set(21,{viewPlaneNormal:[-i,i,-i],viewUp:[0,0,1]}),t.set(22,{viewPlaneNormal:[-i,-i,i],viewUp:[0,0,1]}),t.set(23,{viewPlaneNormal:[i,-i,i],viewUp:[0,0,1]}),t.set(24,{viewPlaneNormal:[i,i,i],viewUp:[0,0,1]}),t.set(25,{viewPlaneNormal:[-i,i,i],viewUp:[0,0,1]}),t.get(e)||null}cleanup(e){if(e){let t=this.mouseHandlers.get(e);t&&(t.cleanup(),this.mouseHandlers.delete(e));let n=this.overlayRenderers.get(e),i=this.renderWindows.get(e);n&&(i&&i.removeRenderer(n),n.delete()),this.actors.delete(e),this.pickers.delete(e),this.overlayRenderers.delete(e),this.renderWindows.delete(e)}else this.mouseHandlers.forEach(e=>e.cleanup()),this.mouseHandlers.clear(),this.overlayRenderers.forEach((e,t)=>{let n=this.renderWindows.get(t);n&&n.removeRenderer(e),e.delete()}),this.overlayRenderers.clear(),this.renderWindows.clear(),this.actors.clear(),this.pickers.clear();this.clearHighlight()}}let ha={marker:{topBottom:[0,0,255],frontBack:[0,255,255],leftRight:[255,255,0]},gray:{topBottom:[180,180,180],frontBack:[180,180,180],leftRight:[180,180,180]},rgy:{topBottom:[255,0,0],frontBack:[0,255,0],leftRight:[255,255,0]}},hr={mixed:{zMinus:[255,255,255],zPlus:[255,255,255],yMinus:[255,255,255],yPlus:[255,255,255],xMinus:[0,0,0],xPlus:[0,0,0]},rgy:{zMinus:[255,255,255],zPlus:[255,255,255],yMinus:[255,255,255],yPlus:[255,255,255],xMinus:[0,0,0],xPlus:[0,0,0]},white:{zMinus:[255,255,255],zPlus:[255,255,255],yMinus:[255,255,255],yPlus:[255,255,255],xMinus:[255,255,255],xPlus:[255,255,255]},black:{zMinus:[0,0,0],zPlus:[0,0,0],yMinus:[0,0,0],yPlus:[0,0,0],xMinus:[0,0,0],xPlus:[0,0,0]}},ho={resetZoom:!1,resetPan:!0,resetToCenter:!0};class hs extends oL.oS{constructor(e={},t={supportedInteractionTypes:["Mouse"],configuration:{enabled:!0,opacity:1,size:.04,position:"bottom-right",colorScheme:"rgy",letterColorScheme:"mixed",showEdgeFaces:!0,showCornerFaces:!0,keepOrientationUp:!0,highlightColor:[255,255,255],edgeColor:[200,200,200],cornerColor:[150,150,150],restingAmbient:1,hoverAmbient:1}}){super(e,t),this.widget=new hi,this.resizeObservers=new Map,this.cameraHandlers=new Map,this.animationFrameHandles=new Map,this.animationTokens=new Map,this._getViewportsInfo=()=>(0,tT.getToolGroup)(this.toolGroupId)?.viewportsInfo||[],this.onSetToolConfiguration=()=>{this._getViewportsInfo().some(({viewportId:e})=>null!==this.widget.getActors(e))&&(this.removeMarkers(),this.addMarkers())},this.onViewportAdded=e=>{let{viewportId:t,renderingEngineId:n,toolGroupId:i}=e.detail;i===this.toolGroupId&&(this.widget.getActors(t)||setTimeout(()=>{this.addMarkerToViewport(t,n)},500))},this.onViewportRemoved=e=>{let{viewportId:t,renderingEngineId:n,toolGroupId:i}=e.detail;if(i!==this.toolGroupId)return;let a=(0,M.b1)(t,n);if(a){let{viewport:e}=a;e.isOrientationChangeable()&&this.widget.removeActorsFromViewport(t,e);let n=this.cameraHandlers.get(t);n&&(e.element.removeEventListener(M.fX.sV.CAMERA_MODIFIED,n),this.cameraHandlers.delete(t))}this.widget.cleanup(t);let r=this.resizeObservers.get(t);r&&(r.disconnect(),this.resizeObservers.delete(t))},this.addMarkers=()=>{this._getViewportsInfo().forEach(({viewportId:e,renderingEngineId:t})=>{let n=(0,M.b1)(e,t);if(!n)return;let{viewport:i}=n;i.isOrientationChangeable()&&(this.widget.getActors(e)||setTimeout(()=>{this.addMarkerToViewport(e,t)},500))})},this.onCameraModified=e=>{let{viewportId:t}=e.detail;if(!t)return;let n=this.widget.getActors(t);if(!n)return;let i=this._getViewportsInfo().find(e=>e.viewportId===t);if(!i)return;let a=(0,M.b1)(t,i.renderingEngineId);if(!a)return;let{viewport:r}=a;r.isOrientationChangeable()&&(this.widget.positionActors(r,n,this.getPositionConfig()),this.widget.syncOverlayViewport(t,r),r.render())}}getPositionConfig(){return{position:this.configuration.position||"bottom-right",size:this.configuration.size||.04}}getFaceColors(){let e=this.configuration.colorScheme||"rgy";if(this.configuration.faceColors){let e=this.configuration.faceColors;if(e.topBottom&&e.frontBack&&e.leftRight)return{topBottom:e.topBottom,frontBack:e.frontBack,leftRight:e.leftRight}}return ha[e]??ha.rgy}getLetterColors(){return hr[this.configuration.letterColorScheme||"mixed"]??hr.mixed}onSetToolEnabled(){this.removeMarkers(),this.addMarkers(),M.tX.addEventListener(S.sV.TOOLGROUP_VIEWPORT_ADDED,this.onViewportAdded),M.tX.addEventListener(S.sV.TOOLGROUP_VIEWPORT_REMOVED,this.onViewportRemoved)}onSetToolDisabled(){this.removeMarkers(),M.tX.removeEventListener(S.sV.TOOLGROUP_VIEWPORT_ADDED,this.onViewportAdded),M.tX.removeEventListener(S.sV.TOOLGROUP_VIEWPORT_REMOVED,this.onViewportRemoved)}removeMarkers(){this._getViewportsInfo().forEach(({viewportId:e,renderingEngineId:t})=>{let n=(0,M.b1)(e,t);if(n){let{viewport:t}=n;t.isOrientationChangeable()&&this.widget.removeActorsFromViewport(e,t);let i=this.cameraHandlers.get(e);i&&(t.element.removeEventListener(M.fX.sV.CAMERA_MODIFIED,i),this.cameraHandlers.delete(e))}let i=this.resizeObservers.get(e);i&&(i.disconnect(),this.resizeObservers.delete(e))}),this.widget.cleanup(),this.resizeObservers.forEach(e=>e.disconnect()),this.resizeObservers.clear(),this.cameraHandlers.clear(),this.animationFrameHandles.forEach(e=>cancelAnimationFrame(e)),this.animationFrameHandles.clear(),this.animationTokens.clear()}createAnnotatedRhombActor(){let e=this.getFaceColors(),t=this.getLetterColors();return this.widget.createActors({faceColors:e,letterColors:t,opacity:this.configuration.opacity??1,showEdgeFaces:!1!==this.configuration.showEdgeFaces,showCornerFaces:!1!==this.configuration.showCornerFaces,highlightColor:this.configuration.highlightColor??[255,255,255],edgeColor:this.configuration.edgeColor??[200,200,200],cornerColor:this.configuration.cornerColor??[150,150,150],restingAmbient:this.configuration.restingAmbient??1,hoverAmbient:this.configuration.hoverAmbient??1})}addMarkerToViewport(e,t){if(this.widget.getActors(e))return;let n=(0,M.b1)(e,t);if(!n)return void console.warn("OrientationControllerTool: No enabled element found");let{viewport:i}=n;if(!i.isOrientationChangeable())return void console.warn("OrientationControllerTool: Viewport does not support orientation changes");let a=i.element,r=this.createAnnotatedRhombActor();this.widget.addActorsToViewport(e,i,r),this.widget.positionActors(i,r,this.getPositionConfig())?i.render():(console.warn("OrientationControllerTool: Initial positioning failed, retrying..."),setTimeout(()=>{this.widget.positionActors(i,r,this.getPositionConfig())?i.render():console.error("OrientationControllerTool: Retry positioning also failed")},1e3)),this.widget.syncOverlayViewport(e,i),this.widget.setupPicker(e,r),this.widget.setupMouseHandlers(e,a,i,r,{onFacePicked:e=>{let t=this.widget.getOrientationForFace(e.cellId);t&&this.animateCameraToOrientation(i,t.viewPlaneNormal,t.viewUp)},onFaceHover:e=>{e?this.widget.highlightFace(e.pickedActor,e.cellId,i,0===e.actorIndex):this.widget.clearHighlight()}});let o=new ResizeObserver(()=>{this.updateMarkerPosition(e,t)});o.observe(a),this.resizeObservers.set(e,o);let s=t=>{t.detail.viewportId===e&&this.onCameraModified(t)};a.addEventListener(M.fX.sV.CAMERA_MODIFIED,s),this.cameraHandlers.set(e,s)}updateMarkerPosition(e,t){let n=(0,M.b1)(e,t);if(!n)return;let i=this.widget.getActors(e);if(!i)return;let{viewport:a}=n;a.isOrientationChangeable()&&(this.widget.positionActors(a,i,this.getPositionConfig()),this.widget.syncOverlayViewport(e,a),a.render())}animateCameraToOrientation(e,t,n){let i,a=e.id,r=this.animationFrameHandles.get(a);void 0!==r&&(cancelAnimationFrame(r),this.animationFrameHandles.delete(a));let o=(this.animationTokens.get(a)??0)+1;this.animationTokens.set(a,o);let s=!1!==this.configuration.keepOrientationUp,l=e.getRenderer().getActiveCamera(),d=l.getDirectionOfProjection(),c=l.getViewUp(),h=e7.fA(-d[0],-d[1],-d[2]),u=e7.fA(c[0],c[1],c[2]),g=e7.vt();e7.$A(g,u,h),e7.S8(g,g);let p=r$.fromValues(g[0],g[1],g[2],0,u[0],u[1],u[2],0,h[0],h[1],h[2],0,0,0,0,1),m=e7.S8(e7.vt(),t);if(s)i=e7.fA(n[0],n[1],n[2]);else{let e=e7.S8(e7.vt(),h),t=ri.vt();ri.Yc(t,e,m),i=e7.vt(),e7.gL(i,u,t),e7.S8(i,i)}let f=e7.Om(i,m);if(e7.Ln(i,i,m,-f),1e-4>e7.Bw(i)){i=e7.o8(u);let e=e7.Om(i,m);e7.Ln(i,i,m,-e)}e7.S8(i,i);let v=e7.vt();e7.$A(v,i,m),e7.S8(v,v),e7.$A(i,m,v),e7.S8(i,i);let I=r$.fromValues(v[0],v[1],v[2],0,i[0],i[1],i[2],0,m[0],m[1],m[2],0,0,0,0,1),_=r$.getRotation(ri.vt(),p),w=r$.getRotation(ri.vt(),I),b=ri.Om(_,w);if(b<0&&(ri.hs(w,w,-1),b=-b),b>.99996)return;let C=performance.now(),A=[m[0],m[1],m[2]],E=[i[0],i[1],i[2]],M=t=>{if(this.animationTokens.get(a)!==o)return;let n=Math.min(1,(t-C)/150),i=n>=1,r=n<.5?2*n*n:1-Math.pow(-2*n+2,2)/2,s=ri.vt();ri.nu(s,_,w,r);let l=r$.create();r$.fromQuat(l,s);let d=l.slice(8,11),c=l.slice(4,7);if(oN(e,{viewPlaneNormal:i?A:d,viewUp:i?E:c}),oU(e,ho),e.render(),i)this.animationFrameHandles.delete(a);else{let e=requestAnimationFrame(M);this.animationFrameHandles.set(a,e)}},y=requestAnimationFrame(M);this.animationFrameHandles.set(a,y)}}hs.toolName="OrientationControllerTool";class hl extends oL.oS{constructor(e={},t={supportedInteractionTypes:["Mouse"],configuration:{hoverTimeout:100,mode:hl.SelectMode.Border,searchRadius:6}}){super(e,t),this.mouseMoveCallback=e=>{if(this.mode===S.r$.Active)return this.hoverTimer&&clearTimeout(this.hoverTimer),this.hoverTimer=setTimeout(()=>{this._setActiveSegment(e),this.hoverTimer=null},this.configuration.hoverTimeout),!0},this.onSetToolEnabled=()=>{this.onSetToolActive()},this.onSetToolActive=()=>{this.hoverTimer=null},this.onSetToolDisabled=()=>{this.hoverTimer=null},this.hoverTimer=null}_setActiveSegment(e={}){if(e6.wk.isInteractingWithTool)return;let{element:t,currentPoints:n}=e.detail,i=n.world,a=(0,M.kJ)(t);if(!a)return;let{viewport:r}=a,o=aC(r.id);o&&this._setActiveSegmentForType(o,i,r)}_setActiveSegmentForType(e,t,n){let i;if(!n.getImageData())return;let{segmentationId:a,representationData:r}=e;if(this.configuration.mode===hl.SelectMode.Inside?i=a6(a,t,{viewport:n}):r.Labelmap?i=function(e,t,{viewport:n,searchRadius:i}){var a,r;let o=(0,a8.getSegmentation)(e);if("volume"===(n?(0,tU.A)(n):"unsupported")||n instanceof M.ei){for(let e of(0,tN.m)(o)){let a=(0,tN.kL)(e);if(!a)continue;let r=a.voxelManager,s=a.imageData,l=M.BF.transformWorldToIndex(s,t),d=r.getAtIJK(l[0],l[1],l[2]);if(function(e,t,n,i,a){return a7((t,a)=>{let r=[e[0]+t,e[1]+a],o=n.canvasToWorld(r),s=i.get("voxelManager").voxelManager,l=M.BF.transformWorldToIndex(i,o);return s.getAtIJK(l[0],l[1],l[2])},t,a)}(n.worldToCanvas(t),d,n,s,i)&&d)return(0,tN.Mx)(o,e.labelmapId,d)}return}let s=(0,a8.getCurrentLabelmapImageIdForViewport)(n.id,e);if(!s||!M.PP.getImage(s))return;let l=(0,a9.wV)(n.id,e,s),d=l?.actor.getMapper().getInputData(),c=M.BF.transformWorldToIndex(d,t),h=d.getDimensions(),u=d.voxelManager||M.BF.VoxelManager.createScalarVolumeVoxelManager({dimensions:h,scalarData:d.getPointData().getScalars().getData()}),g=u.getAtIJKPoint(c);if(a=c,r=u,!a7((e,t,n)=>{let i=[a[0]+e,a[1]+t,a[2]+n];return r.getAtIJK(i[0],i[1],i[2])},g,void 0)||!g)return;let p=(0,tN.m)(o).find(e=>e.imageIds?.includes(s));return p?(0,tN.Mx)(o,p.labelmapId,g):g}(a,t,{viewport:n,searchRadius:this.configuration.searchRadius}):r.Contour?i=function(e){let{annotationUIDsMap:t}=(0,a8.getSegmentation)(e).representationData.Contour;for(let[e,n]of t.entries())if(Array.from(n).find(e=>(0,iS.gw)(e).highlighted))return e}(a):r.Surface,!i||0===i)return;r_(a,i);let o=n.getRenderingEngine().getViewports().map(e=>e.id);(0,e9.triggerSegmentationModified)(a),(0,tr.A)(o)}}hl.SelectMode={Inside:"Inside",Border:"Border"},hl.toolName="SegmentSelectTool";class hd extends s4.A{constructor(e={}){super(e),this.renderAnnotation=(e,t)=>{let n=!0,{viewport:i}=e,{element:a}=i,r=i.id,o=(0,y.getAnnotations)(this.getToolName(),a);if(!o?.length||(o=this.filterInteractableAnnotationsForElement(a,o),!o?.length))return n;let s=this.getTargetId(i),l=i.getRenderingEngine(),d={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let a=0;ai.worldToCanvas(e));d.annotationUID=u;let{segmentIndex:v,segmentationId:I}=h.metadata,{lineWidth:_,lineDash:w,shadow:b}=this.getAnnotationStyle({annotation:h,styleSpecifier:d}),C=(0,oe.getSegmentIndexColor)(r,I,v),A=`rgb(${C.slice(0,3).join(",")})`;if(g.cachedStats[s]&&null!=g.cachedStats[s].unit?h.invalidated&&this._throttledCalculateCachedStats(h,l,e):(g.cachedStats[s]={length:null,width:null,unit:null},this._calculateCachedStats(h,l,e)),!i.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}if(!(0,nM.YY)(u))continue;(0,nE.Gh)(u)||this.editData||null===m||(c=[f[m]]),c&&(0,aK.qX)(t,u,"0",c,{color:A});let E=`${u}-line-1`,M=`${u}-line-2`;(0,aK.V6)(t,u,"0",f[0],f[1],{color:A,lineWidth:_,lineDash:w,shadow:b},E),(0,aK.V6)(t,u,"1",f[2],f[3],{color:A,lineWidth:_,lineDash:w,shadow:b},M),n=!0;let y=this.configuration.getTextLines(g,s);if(y&&0!==y.length&&!this.renderLinkedTextBoxAnnotation({enabledElement:e,svgDrawingHelper:t,annotation:h,styleSpecifier:d,textLines:y,canvasCoordinates:f}))continue}return n}}addNewAnnotation(e){let{currentPoints:t,element:n}=e.detail,i=t.world,{viewport:a}=(0,M.kJ)(n);this.isDrawing=!0;let{viewPlaneNormal:r,viewUp:o}=(0,i$.A)(a),s=this.getReferencedImageId(a,i,r,o),l=a.getFrameOfReferenceUID(),d={highlighted:!0,invalidated:!0,metadata:{toolName:this.getToolName(),viewPlaneNormal:[...r],viewUp:[...o],FrameOfReferenceUID:l,referencedImageId:s,...a.getViewReference({points:[i]})},data:{handles:{points:[[...i],[...i],[...i],[...i]],textBox:{hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}},activeHandleIndex:null},label:"",cachedStats:{}}};(0,y.addAnnotation)(d,n);let c=(0,ta.Q0)(n,this.getToolName());return this.editData={annotation:d,viewportIdsToRender:c,handleIndex:1,movingTextBox:!1,newAnnotation:!0,hasMoved:!1},this._activateDraw(n),(0,oK.lY)(n),e.preventDefault(),(0,tr.A)(c),d}}hd.toolName="SegmentBidirectional",hd.hydrate=(e,t,n)=>{let i=(0,M.yj)(e);if(!i)return;let{viewport:a}=i,r=(0,y.getAllAnnotations)().filter(e=>"SegmentBidirectional"===e.metadata.toolName).find(e=>{let{metadata:t}=e;return t.segmentIndex===n?.segmentIndex&&t.segmentationId===n?.segmentationId});r&&(0,y.removeAnnotation)(r.annotationUID);let{FrameOfReferenceUID:o,referencedImageId:s,viewPlaneNormal:l,instance:d}=hd.hydrateBase(hd,i,t[0],n),[c,h]=t,[u,g]=c,[p,m]=h,{toolInstance:f,...v}=n||{},I={annotationUID:n?.annotationUID||M.BF.uuidv4(),data:{handles:{points:[u,g,p,m],activeHandleIndex:null,textBox:{hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}}},cachedStats:{}},highlighted:!1,autoGenerated:!1,invalidated:!1,isLocked:!1,isVisible:!0,metadata:{segmentIndex:n?.segmentIndex,segmentationId:n?.segmentationId,toolName:d.getToolName(),viewPlaneNormal:l,FrameOfReferenceUID:o,referencedImageId:s,...v}};return(0,y.addAnnotation)(I,a.element),(0,tr.A)([a.id]),I};class hc extends oL.oS{constructor(e={data:{handles:{textBox:{worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}}}}},t={supportedInteractionTypes:["Mouse"],configuration:{hoverTimeout:100,searchRadius:6,color:null,background:null}}){super(e,t),this.mouseMoveCallback=e=>(this.hoverTimer&&clearTimeout(this.hoverTimer),this.hoverTimer=setTimeout(()=>{this._setHoveredSegment(e),this.hoverTimer=null},this.configuration.hoverTimeout),!0),this.onSetToolEnabled=()=>{this.onSetToolActive()},this.onSetToolActive=()=>{this.hoverTimer=null},this.onSetToolDisabled=()=>{this.hoverTimer=null},this.data=e.data??{handles:{textBox:{worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}}}},this.hoverTimer=null}_setHoveredSegment(e={}){if(e6.wk.isInteractingWithTool)return;let{element:t,currentPoints:n}=e.detail,i=n.world,a=(0,M.kJ)(t);if(!a)return;let{viewport:r}=a,o=aC(r.id);o&&this._setHoveredSegmentForType(o,i,r)}_setHoveredSegmentForType(e,t,n){if(!n.getImageData())return;let{segmentationId:i}=e,a=a6(i,t,{viewport:n}),r=e.segments[a],o=this.configuration.color??oe.getSegmentIndexColor(n.id,i,a),s=r?.label,l=n.worldToCanvas(t);if(this._editData={hoveredSegmentIndex:a,hoveredSegmentLabel:s,canvasCoordinates:l,color:o},!a||0===a)return;let d=n.getRenderingEngine().getViewports().map(e=>e.id);(0,e9.triggerSegmentationModified)(i),(0,tr.A)(d)}renderAnnotation(e,t){if(!this._editData)return;let{viewport:n}=e,{hoveredSegmentIndex:i,hoveredSegmentLabel:a,canvasCoordinates:r,color:o}=this._editData;if(!i)return;let s=[r[0]+-15,r[1]+-15],l=(0,aK.T$)(t,"segmentSelectLabelAnnotation","segmentSelectLabelTextBox",[a??"(unnamed segment)"],s,{color:`rgba(${o[0]}, ${o[1]}, ${o[2]}, ${o[3]})`,background:this.configuration.background??void 0}),d=r[0],c=r[1],{width:h,height:u}=l;this.data.handles.textBox.worldBoundingBox={topLeft:n.canvasToWorld([d,c]),topRight:n.canvasToWorld([d+h,c]),bottomLeft:n.canvasToWorld([d,c+u]),bottomRight:n.canvasToWorld([d+h,c+u])}}}hc.toolName="SegmentLabelTool";class hh extends tS{constructor(e={}){super(M.BF.deepMerge({configuration:{calculateStats:!1,allowOpenContours:!1}},e)),this.onViewportAddedToToolGroupBinded=this.onViewportAddedToToolGroup.bind(this),this.onSegmentationModifiedBinded=this.onSegmentationModified.bind(this)}initializeListeners(){hh.annotationsToViewportMap.clear(),hh.viewportIdsChecked=[],M.tX.addEventListener(S.sV.ANNOTATION_MODIFIED,this.annotationModified),M.tX.addEventListener(S.sV.ANNOTATION_COMPLETED,this.annotationCompleted),M.tX.addEventListener(S.sV.TOOLGROUP_VIEWPORT_ADDED,this.onViewportAddedToToolGroupBinded),M.tX.addEventListener(S.sV.SEGMENTATION_MODIFIED,this.onSegmentationModifiedBinded),M.tX.addEventListener(S.sV.SEGMENTATION_REPRESENTATION_MODIFIED,this.onSegmentationModifiedBinded)}cleanUpListeners(){hh.annotationsToViewportMap.clear(),hh.viewportIdsChecked=[],M.tX.removeEventListener(S.sV.ANNOTATION_MODIFIED,this.annotationModified),M.tX.removeEventListener(S.sV.ANNOTATION_COMPLETED,this.annotationCompleted),M.tX.removeEventListener(S.sV.TOOLGROUP_VIEWPORT_ADDED,this.onViewportAddedToToolGroup.bind(this)),M.tX.removeEventListener(S.sV.SEGMENTATION_MODIFIED,this.onSegmentationModified.bind(this)),M.tX.removeEventListener(S.sV.SEGMENTATION_REPRESENTATION_MODIFIED,this.onSegmentationModified.bind(this))}async checkContourSegmentation(e){if(hh.viewportIdsChecked.includes(e))return;let t=ab.T(e);if(!t)return console.log("No active segmentation detected"),!1;let n=t.segmentationId;return t.representationData.Contour?hh.viewportIdsChecked.push(e):(hh.viewportIdsChecked.push(e),await rb(e,[{segmentationId:n,type:S.D_.Contour}]),iq({segmentationId:n,type:S.D_.Contour,data:{}})),!0}onViewportAddedToToolGroup(e){let{toolGroupId:t,viewportId:n}=e.detail;t===this.toolGroupId&&this.checkContourSegmentation(n)}onSegmentationModified(e){let{segmentationId:t}=e.detail||{};if(!t)return;let n=(0,e4.ny)(t);n&&n.forEach(async({viewportId:e})=>await this.checkContourSegmentation(e))}onSetToolEnabled(){this.initializeListeners()}onSetToolActive(){this.initializeListeners()}onSetToolDisabled(){this.cleanUpListeners()}annotationModified(e){let{annotation:t,renderingEngineId:n,viewportId:i}=e.detail,a=(0,M.lD)(n)?.getViewport(i);a&&hh.annotationsToViewportMap.set(t.annotationUID,a)}annotationCompleted(e){let{annotation:t}=e.detail,{polyline:n}=t.data?.contour||{};if(t?.metadata?.toolName===hh.toolName&&n&&hh.annotationsToViewportMap.has(t.annotationUID)){let e=hh.annotationsToViewportMap.get(t.annotationUID);n.length>3&&ce.A.viewportContoursToLabelmap(e)}}}hh.toolName="LabelMapEditWithContour",hh.annotationsToViewportMap=new Map,hh.viewportIdsChecked=[];var hu=n(77047);class hg extends oL.EC{constructor(e={}){super(e,{supportedInteractionTypes:["Mouse","Touch"],configuration:{shadow:!0,preventHandleOutsideImage:!1}}),this.addNewAnnotation=e=>{let{currentPoints:t,element:n}=e.detail,i=t.world,{viewport:a}=(0,M.kJ)(n);this.isDrawing=!0;let r=this.constructor.createAnnotationForViewport(a,{data:{handles:{points:[[...i],[...i],[...i],[...i]]}}});(0,iS.lC)(r,n);let o=(0,ta.Q0)(n,this.getToolName(),!1);return this.editData={annotation:r,viewportUIDsToRender:o,handleIndex:3,newAnnotation:!0,hasMoved:!1},this._activateDraw(n),(0,oK.lY)(n),e.preventDefault(),(0,tr.A)(o),r},this.getHandleNearImagePoint=(e,t,n,i)=>{let{viewport:a}=(0,M.kJ)(e),{data:r}=t,{points:o}=r.handles;for(let e=0;e{let{viewport:a}=(0,M.kJ)(e),{data:r}=t,{points:o}=r.handles,s=a.worldToCanvas(o[0]),l=a.worldToCanvas(o[3]),d=this._getRectangleImageCoordinates([s,l]),c=[n[0],n[1]],{left:h,top:u,width:g,height:p}=d;if(hu.A([h,u,g,p],c)<=i)return!0},this.toolSelectedCallback=(e,t,n="mouse")=>{let{element:i}=e.detail,{data:a}=t;a.active=!0;let r=(0,ta.Q0)(i,this.getToolName(),!1);this.editData={annotation:t,viewportUIDsToRender:r},this._activateModify(i),(0,oK.lY)(i),(0,tr.A)(r),e.preventDefault()},this.handleSelectedCallback=(e,t,n,i="mouse")=>{let a,{element:r}=e.detail,{data:o}=t;o.active=!0,n.worldPosition||(a=o.handles.points.findIndex(e=>e===n));let s=(0,ta.Q0)(r,this.getToolName(),!1);this.editData={annotation:t,viewportUIDsToRender:s,handleIndex:a},this._activateModify(r),(0,oK.lY)(r),(0,tr.A)(s),e.preventDefault()},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportUIDsToRender:i,newAnnotation:a,hasMoved:r}=this.editData,{data:o}=n;(!a||r)&&(this.doneEditMemo(),o.active=!1,o.handles.activeHandleIndex=null,this._deactivateModify(t),this._deactivateDraw(t),(0,oK.Q_)(t),this.editData=null,this.isDrawing=!1,this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,iS.O8)(n.annotationUID),(0,tr.A)(i))},this._dragCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{annotation:i,viewportUIDsToRender:a,handleIndex:r,newAnnotation:o}=this.editData;this.createMemo(n,i,{newAnnotation:o});let{data:s}=i;if(void 0===r){let{deltaPoints:e}=t,n=e.world,{points:i}=s.handles;i.forEach(e=>{e[0]+=n[0],e[1]+=n[1],e[2]+=n[2]}),s.invalidated=!0}else{let e,i,a,o,l,d,c,h,{currentPoints:u}=t,{worldToCanvas:g,canvasToWorld:p}=(0,M.kJ)(n).viewport,m=u.world,{points:f}=s.handles;switch(f[r]=[...m],r){case 0:case 3:e=g(f[0]),i=[(o=g(f[3]))[0],e[1]],a=[e[0],o[1]],d=p(i),c=p(a),f[1]=d,f[2]=c;break;case 1:case 2:i=g(f[1]),e=[(a=g(f[2]))[0],i[1]],o=[i[0],a[1]],l=p(e),h=p(o),f[0]=l,f[3]=h}s.invalidated=!0}this.editData.hasMoved=!0,(0,M.kJ)(n),(0,tr.A)(a)},this._activateDraw=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this._deactivateDraw=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_MOVE,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this._activateModify=e=>{e6.wk.isInteractingWithTool=!0,e.addEventListener(S.sV.MOUSE_UP,this._endCallback),e.addEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(S.sV.TOUCH_END,this._endCallback),e.addEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this._deactivateModify=e=>{e6.wk.isInteractingWithTool=!1,e.removeEventListener(S.sV.MOUSE_UP,this._endCallback),e.removeEventListener(S.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(S.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(S.sV.TOUCH_END,this._endCallback),e.removeEventListener(S.sV.TOUCH_DRAG,this._dragCallback)},this.renderAnnotation=(e,t)=>{let{viewport:n}=e,{element:i}=n,a=(0,iS.Rh)(this.getToolName(),i);if(!a?.length||(a=this.filterInteractableAnnotationsForElement(i,a),!a?.length))return!1;let r={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let e=0;en.worldToCanvas(e)),h=this.getStyle("lineWidth",r,o),u=this.getStyle("lineDash",r,o),g=this.getStyle("color",r,o);if(!n.getRenderingEngine())return void console.warn("Rendering Engine has been destroyed");this.editData||null===d||(i=[c[d]]),i&&(0,aK.qX)(t,s,"0",i,{color:g}),(0,aK.Kj)(t,s,"0",c[0],c[3],{color:"black",lineDash:u,lineWidth:h})}},this._getRectangleImageCoordinates=e=>{let[t,n]=e;return{left:Math.min(t[0],n[0]),top:Math.min(t[1],n[1]),width:Math.abs(t[0]-n[0]),height:Math.abs(t[1]-n[1])}},this._calculateCachedStats=(e,t,n,i,a)=>{let{data:r}=e,{viewportUID:o,renderingEngineUID:s,sceneUID:l}=a,d=r.handles.points[0],c=r.handles.points[3],{cachedStats:h}=r,u=Object.keys(h);for(let e=0;eM.BF.indexWithinDimensions(e,n)&&M.BF.indexWithinDimensions(t,n),this._getTargetVolumeUID=e=>{if(this.configuration.volumeUID)return this.configuration.volumeUID;let t=e.getVolumeActors();if(t||t.length)return t[0].uid},this._throttledCalculateCachedStats=(0,ti.A)(this._calculateCachedStats,100,{trailing:!0})}cancel(e){if(!this.isDrawing)return;this.isDrawing=!1,this._deactivateDraw(e),this._deactivateModify(e),(0,oK.Q_)(e);let{annotation:t,viewportUIDsToRender:n}=this.editData,{data:i}=t;return i.active=!1,i.handles.activeHandleIndex=null,(0,tr.A)(n),this.editData=null,t.annotationUID}_getImageVolumeFromTargetUID(e,t){let n,i;if(e.startsWith("stackTarget")){let i=e.indexOf(":"),a=e.substring(i+1);n=t.getViewport(a).getImageData()}else n=M.PP.getVolume(e);return{imageVolume:n,viewport:i}}_getTargetStackUID(e){return`stackTarget:${e.uid}`}}hg.toolName="VideoRedaction"},22454:(e,t,n)=>{"use strict";n.d(t,{I:()=>w});var i=n(56195),a=n(74268),r=n(31668),o=n(38445),s=n(83515),l=n(34049),d=n(37126),c=class extends o.Q{constructor(e,t){super(),this.options=t,this.#e=e,this.#t=null,this.#n=(0,s.T)(),this.bindMethods(),this.setOptions(t)}#e;#i=void 0;#a=void 0;#r=void 0;#o;#s;#n;#t;#l;#d;#c;#h;#u;#g;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#i.addObserver(this),h(this.#i,this.options)?this.#m():this.updateResult(),this.#f())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return u(this.#i,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return u(this.#i,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#v(),this.#I(),this.#i.removeObserver(this)}setOptions(e){let t=this.options,n=this.#i;if(this.options=this.#e.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,l.Eh)(this.options.enabled,this.#i))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#_(),this.#i.setOptions(this.options),t._defaulted&&!(0,l.f8)(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#i,observer:this});let i=this.hasListeners();i&&g(this.#i,n,this.options,t)&&this.#m(),this.updateResult(),i&&(this.#i!==n||(0,l.Eh)(this.options.enabled,this.#i)!==(0,l.Eh)(t.enabled,this.#i)||(0,l.d2)(this.options.staleTime,this.#i)!==(0,l.d2)(t.staleTime,this.#i))&&this.#w();let a=this.#b();i&&(this.#i!==n||(0,l.Eh)(this.options.enabled,this.#i)!==(0,l.Eh)(t.enabled,this.#i)||a!==this.#g)&&this.#C(a)}getOptimisticResult(e){var t,n;let i=this.#e.getQueryCache().build(this.#e,e),a=this.createResult(i,e);return t=this,n=a,(0,l.f8)(t.getCurrentResult(),n)||(this.#r=a,this.#s=this.options,this.#o=this.#i.state),a}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),"promise"!==n||this.options.experimental_prefetchInRender||"pending"!==this.#n.status||this.#n.reject(Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#i}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#_();let t=this.#i.fetch(this.options,e);return e?.throwOnError||(t=t.catch(l.lQ)),t}#w(){this.#v();let e=(0,l.d2)(this.options.staleTime,this.#i);if(l.S$||this.#r.isStale||!(0,l.gn)(e))return;let t=(0,l.j3)(this.#r.dataUpdatedAt,e);this.#h=d.zs.setTimeout(()=>{this.#r.isStale||this.updateResult()},t+1)}#b(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#i):this.options.refetchInterval)??!1}#C(e){this.#I(),this.#g=e,!l.S$&&!1!==(0,l.Eh)(this.options.enabled,this.#i)&&(0,l.gn)(this.#g)&&0!==this.#g&&(this.#u=d.zs.setInterval(()=>{(this.options.refetchIntervalInBackground||i.m.isFocused())&&this.#m()},this.#g))}#f(){this.#w(),this.#C(this.#b())}#v(){this.#h&&(d.zs.clearTimeout(this.#h),this.#h=void 0)}#I(){this.#u&&(d.zs.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){let n,i=this.#i,a=this.options,o=this.#r,d=this.#o,c=this.#s,u=e!==i?e.state:this.#a,{state:m}=e,f={...m},v=!1;if(t._optimisticResults){let n=this.hasListeners(),o=!n&&h(e,t),s=n&&g(e,i,t,a);(o||s)&&(f={...f,...(0,r.k)(m.data,e.options)}),"isRestoring"===t._optimisticResults&&(f.fetchStatus="idle")}let{error:I,errorUpdatedAt:_,status:w}=f;n=f.data;let b=!1;if(void 0!==t.placeholderData&&void 0===n&&"pending"===w){let e;o?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=o.data,b=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#c?.state.data,this.#c):t.placeholderData,void 0!==e&&(w="success",n=(0,l.pl)(o?.data,e,t),v=!0)}if(t.select&&void 0!==n&&!b)if(o&&n===d?.data&&t.select===this.#l)n=this.#d;else try{this.#l=t.select,n=t.select(n),n=(0,l.pl)(o?.data,n,t),this.#d=n,this.#t=null}catch(e){this.#t=e}this.#t&&(I=this.#t,n=this.#d,_=Date.now(),w="error");let C="fetching"===f.fetchStatus,A="pending"===w,E="error"===w,M=A&&C,y=void 0!==n,S={status:w,fetchStatus:f.fetchStatus,isPending:A,isSuccess:"success"===w,isError:E,isInitialLoading:M,isLoading:M,data:n,dataUpdatedAt:f.dataUpdatedAt,error:I,errorUpdatedAt:_,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:C,isRefetching:C&&!A,isLoadingError:E&&!y,isPaused:"paused"===f.fetchStatus,isPlaceholderData:v,isRefetchError:E&&y,isStale:p(e,t),refetch:this.refetch,promise:this.#n,isEnabled:!1!==(0,l.Eh)(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=e=>{"error"===S.status?e.reject(S.error):void 0!==S.data&&e.resolve(S.data)},n=()=>{t(this.#n=S.promise=(0,s.T)())},a=this.#n;switch(a.status){case"pending":e.queryHash===i.queryHash&&t(a);break;case"fulfilled":("error"===S.status||S.data!==a.value)&&n();break;case"rejected":("error"!==S.status||S.error!==a.reason)&&n()}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#i,this.options);if(this.#o=this.#i.state,this.#s=this.options,void 0!==this.#o.data&&(this.#c=this.#i),(0,l.f8)(t,e))return;this.#r=t;let n=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n="function"==typeof t?t():t;if("all"===n||!n&&!this.#p.size)return!0;let i=new Set(n??this.#p);return this.options.throwOnError&&i.add("error"),Object.keys(this.#r).some(t=>this.#r[t]!==e[t]&&i.has(t))};this.#A({listeners:n()})}#_(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#i)return;let t=this.#i;this.#i=e,this.#a=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#f()}#A(e){a.jG.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#i,type:"observerResultsUpdated"})})}};function h(e,t){return!1!==(0,l.Eh)(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&u(e,t,t.refetchOnMount)}function u(e,t,n){if(!1!==(0,l.Eh)(t.enabled,e)&&"static"!==(0,l.d2)(t.staleTime,e)){let i="function"==typeof n?n(e):n;return"always"===i||!1!==i&&p(e,t)}return!1}function g(e,t,n,i){return(e!==t||!1===(0,l.Eh)(i.enabled,e))&&(!n.suspense||"error"!==e.state.status)&&p(e,n)}function p(e,t){return!1!==(0,l.Eh)(t.enabled,e)&&e.isStaleByTime((0,l.d2)(t.staleTime,e))}var m=n(12115),f=n(99776);n(95155);var v=m.createContext(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),I=m.createContext(!1);I.Provider;var _=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function w(e,t){return function(e,t,n){var i,r,o,s,d;let c=m.useContext(I),h=m.useContext(v),u=(0,f.jE)(n),g=u.defaultQueryOptions(e);if(null==(r=u.getDefaultOptions().queries)||null==(i=r._experimental_beforeQuery)||i.call(r,g),g._optimisticResults=c?"isRestoring":"optimistic",g.suspense){let e=e=>"static"===e?e:Math.max(e??1e3,1e3),t=g.staleTime;g.staleTime="function"==typeof t?(...n)=>e(t(...n)):e(t),"number"==typeof g.gcTime&&(g.gcTime=Math.max(g.gcTime,1e3))}(g.suspense||g.throwOnError||g.experimental_prefetchInRender)&&!h.isReset()&&(g.retryOnMount=!1),m.useEffect(()=>{h.clearReset()},[h]);let p=!u.getQueryCache().get(g.queryHash),[w]=m.useState(()=>new t(u,g)),b=w.getOptimisticResult(g),C=!c&&!1!==e.subscribed;if(m.useSyncExternalStore(m.useCallback(e=>{let t=C?w.subscribe(a.jG.batchCalls(e)):l.lQ;return w.updateResult(),t},[w,C]),()=>w.getCurrentResult(),()=>w.getCurrentResult()),m.useEffect(()=>{w.setOptions(g)},[g,w]),g?.suspense&&b.isPending)throw _(g,w,h);if((e=>{let{result:t,errorResetBoundary:n,throwOnError:i,query:a,suspense:r}=e;return t.isError&&!n.isReset()&&!t.isFetching&&a&&(r&&void 0===t.data||(0,l.GU)(i,[t.error,a]))})({result:b,errorResetBoundary:h,throwOnError:g.throwOnError,query:u.getQueryCache().get(g.queryHash),suspense:g.suspense}))throw b.error;if(null==(s=u.getDefaultOptions().queries)||null==(o=s._experimental_afterQuery)||o.call(s,g,b),g.experimental_prefetchInRender&&!l.S$&&b.isLoading&&b.isFetching&&!c){let e=p?_(g,w,h):null==(d=u.getQueryCache().get(g.queryHash))?void 0:d.promise;null==e||e.catch(l.lQ).finally(()=>{w.updateResult()})}return g.notifyOnChangeProps?b:w.trackResult(b)}(e,c,t)}},24437:(e,t,n)=>{"use strict";function i(e){let{reason:t,children:n}=e;return n}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return i}}),n(24553)},25881:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>r,pF:()=>i,pd:()=>a});var i={Unknown:0,LeftController:1,RightController:2},a={Unknown:0,Trigger:1,TrackPad:2,Grip:3,Thumbstick:4,A:5,B:6,ApplicationMenu:7},r={Device:i,Input:a,Axis:{Unknown:0,TouchpadX:1,TouchpadY:2,ThumbstickX:3,ThumbstickY:4},MouseButton:{LeftButton:1,MiddleButton:2,RightButton:3}}},25959:(e,t,n)=>{"use strict";n.d(t,{v:()=>o});var i=n(12115);let a=e=>{let t,n=new Set,i=(e,i)=>{let a="function"==typeof e?e(t):e;if(!Object.is(a,t)){let e=t;t=(null!=i?i:"object"!=typeof a||null===a)?a:Object.assign({},t,a),n.forEach(n=>n(t,e))}},a=()=>t,r={setState:i,getState:a,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(i,a,r);return r},r=e=>{let t=(e=>e?a(e):a)(e),n=e=>(function(e,t=e=>e){let n=i.useSyncExternalStore(e.subscribe,i.useCallback(()=>t(e.getState()),[e,t]),i.useCallback(()=>t(e.getInitialState()),[e,t]));return i.useDebugValue(n),n})(t,e);return Object.assign(n,t),n},o=e=>e?r(e):r},26410:(e,t,n)=>{"use strict";function i(e){return!!e.data?.segmentation}n.d(t,{A:()=>i})},28402:(e,t,n)=>{"use strict";n.d(t,{f:()=>l,v:()=>s});var i=n(33845),a=n(42018);function r(e,t){let n=e[0]-t[0],i=e[1]-t[1];return n*n+i*i}function o(e,t){let n=i.XL.getWindingDirection(t)!==i.XL.getWindingDirection(e)?[...t].reverse():t,a=1/0,o=0,s=0;for(let t=0;tt),a=e=>{let t=e;for(;n[t]!==t;)t=n[t];for(;n[e]!==t;){let i=n[e];n[e]=t,e=i}return t},o=(e,t)=>{n[a(e)]=a(t)},s=e.map(e=>i.XL.getAABB(e));for(let n=0;n=r(e[n],t[i]))return!0;return!1}(e[n],e[i])&&o(n,i)}let c=new Map;for(let e=0;ee.outer));return t.length===e.length?e:t.map(t=>{if(1===t.length)return e[t[0]];let n=e[t[0]].outer;for(let i=1;ie[t].holes??[]);return i.length?{outer:n,holes:i}:{outer:n}})}function l(e){let t=(0,a.NE)(e);if(0===t.length||1===t.length&&!t[0].holes?.length)return e;let n=s(t).reduce((e,t)=>i.XL.getArea(t.outer)>i.XL.getArea(e.outer)?t:e),r=n.outer;for(let e of n.holes??[])r=o(r,e);return r}},31608:(e,t,n)=>{"use strict";n.d(t,{A7:()=>a.A,oI:()=>i.oI,x:()=>r.A}),n(52219),n(44151);var i=n(72661),a=n(31665),r=n(89602);n(25102)},31860:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var i=n(70192),a=n(42306);function r(e,t){let{renderingEngineId:n,viewportId:r}=(0,i.kJ)(e),o=(0,a.getToolGroupForViewport)(r,n);if(!o)return[];let s=[],l=Object.keys(o.toolOptions);for(let e=0;e{"use strict";n.d(t,{Zm:()=>p,_6:()=>v,cC:()=>m});var i=n(70192),a=n(78378),r=n(56109),o=n(10355),s=n(91792),l=n(49007),d=n(79541),c=n(5965),h=n(69301);let u={colorLUT:[],segmentations:[],viewportSegRepresentations:{}};class g{constructor(e){e||=i.BF.uuidv4(),this.state=Object.freeze(i.BF.deepClone(u)),this.uid=e,this.labelmapImageReferenceResolver=new h.Lp(this.getSegmentation.bind(this))}getState(){return this.state}updateState(e){let t=i.BF.deepClone(this.state);e(t),this.state=Object.freeze(t)}getColorLUT(e){return this.state.colorLUT[e]}getNextColorLUTIndex(){return this.state.colorLUT.length}resetState(){this.labelmapImageReferenceResolver.reset(),this.state=Object.freeze(i.BF.deepClone(u))}getSegmentation(e){return this.state.segmentations.find(t=>t.segmentationId===e)}updateSegmentation(e,t){this.updateState(n=>{let i=n.segmentations.find(t=>t.segmentationId===e);if(!i)return void console.warn(`Segmentation with id ${e} not found. Update aborted.`);Object.assign(i,t),i.representationData?.Labelmap&&((0,h.uk)(i),(0,h.xS)(i))}),(0,l.triggerSegmentationModified)(e)}addSegmentation(e){if(this.getSegmentation(e.segmentationId))throw Error(`Segmentation with id ${e.segmentationId} already exists`);this.updateState(t=>{let n=i.BF.deepClone(e);n.representationData?.Labelmap&&((0,h.uk)(n),(0,h.xS)(n));let a=n.representationData.Labelmap;if(a?.volumeId&&!("imageIds"in a)){let e=this.getLabelmapImageIds(n.representationData);n.representationData.Labelmap.imageIds=e}t.segmentations.push(n)}),(0,c.R)(e.segmentationId)}removeSegmentation(e){this.labelmapImageReferenceResolver.removeSegmentation(e),this.updateState(t=>{let n=t.segmentations.filter(t=>t.segmentationId!==e);t.segmentations.splice(0,t.segmentations.length,...n)}),(0,l.triggerSegmentationRemoved)(e)}addSegmentationRepresentation(e,t,n,r){if((0,i.yj)(e)){if(this.getSegmentationRepresentations(e,{type:n,segmentationId:t}).length>0){console.debug("A segmentation representation of type",n,"already exists in viewport",e,"for segmentation",t),(0,l.triggerSegmentationRepresentationModified)(e,t,n);return}this.updateState(i=>{i.viewportSegRepresentations[e]||(i.viewportSegRepresentations[e]=[],d.Y.setRenderInactiveSegmentations(e,!0)),n!==a.D_.Labelmap?this.addDefaultSegmentationRepresentation(i,e,t,n,r):this.addLabelmapRepresentation(i,e,t,r)}),(0,l.triggerSegmentationRepresentationModified)(e,t,n)}}addDefaultSegmentationRepresentation(e,t,n,i,a){let r=e.segmentations.find(e=>e.segmentationId===n);if(!r)return;let o={};Object.keys(r.segments).forEach(e=>{o[Number(e)]={visible:!0}}),e.viewportSegRepresentations[t].push({segmentationId:n,type:i,active:!0,visible:!0,colorLUTIndex:a?.colorLUTIndex||0,segments:o,config:{...f(i),...a}}),this._setActiveSegmentation(e,t,n)}addLabelmapRepresentation(e,t,n,r=f(a.D_.Labelmap)){if(!(0,i.yj)(t))return;let o=this.getSegmentation(n);if(!o)return;let{representationData:s}=o;if(!s.Labelmap)return this.addDefaultSegmentationRepresentation(e,t,n,a.D_.Labelmap,r);this.processLabelmapRepresentationAddition(t,n),this.addDefaultSegmentationRepresentation(e,t,n,a.D_.Labelmap,r)}async processLabelmapRepresentationAddition(e,t){let n=(0,i.yj)(e);if(!n)return;let a=this.getSegmentation(t);if(!a)return;let r="volume"===(0,s.A)(n.viewport),{representationData:o}=a,l=!!o.Labelmap.volumeId;r||l||this.updateLabelmapSegmentationImageReferences(e,a.segmentationId)}updateLabelmapSegmentationImageReferences(e,t){return this.labelmapImageReferenceResolver.updateLabelmapSegmentationImageReferences(e,t)}getLabelmapImageIds(e){return this.labelmapImageReferenceResolver.getLabelmapImageIds(e)}getLabelmapImageIdsForImageId(e,t){return this.labelmapImageReferenceResolver.getLabelmapImageIdsForImageId(e,t)}getCurrentLabelmapImageIdsForViewport(e,t){return this.labelmapImageReferenceResolver.getCurrentLabelmapImageIdsForViewport(e,t)}getCurrentLabelmapImageIdForViewport(e,t){return this.labelmapImageReferenceResolver.getCurrentLabelmapImageIdForViewport(e,t)}getStackSegmentationImageIdsForViewport(e,t){return this.labelmapImageReferenceResolver.getStackSegmentationImageIdsForViewport(e,t)}removeSegmentationRepresentationsInternal(e,t){let n=[];return this.updateState(i=>{if(!i.viewportSegRepresentations[e])return;let a=i.viewportSegRepresentations[e],r=!1;if(!t||Object.values(t).every(e=>void 0===e))n.push(...a),delete i.viewportSegRepresentations[e];else{let{segmentationId:o,type:s}=t;i.viewportSegRepresentations[e]=a.filter(e=>{let t=o&&s&&e.segmentationId===o&&e.type===s||o&&!s&&e.segmentationId===o||!o&&s&&e.type===s;return t&&(n.push(e),e.active&&(r=!0)),!t}),0===i.viewportSegRepresentations[e].length?delete i.viewportSegRepresentations[e]:r&&(i.viewportSegRepresentations[e][0].active=!0)}}),n}removeSegmentationRepresentations(e,t){let n=this.removeSegmentationRepresentationsInternal(e,t);n.forEach(t=>{(0,l.triggerSegmentationRepresentationRemoved)(e,t.segmentationId,t.type)});let i=this.getSegmentationRepresentations(e);return i.length>0&&i[0].active&&(0,l.triggerSegmentationRepresentationModified)(e,i[0].segmentationId,i[0].type),n}removeSegmentationRepresentation(e,t,n){let i=this.removeSegmentationRepresentationsInternal(e,t);return n||i.forEach(({segmentationId:t,type:n})=>{(0,l.triggerSegmentationRepresentationRemoved)(e,t,n)}),i}_setActiveSegmentation(e,t,n){let i=e.viewportSegRepresentations[t];i&&i.forEach(e=>{e.active=e.segmentationId===n})}setActiveSegmentation(e,t){this.updateState(n=>{let i=n.viewportSegRepresentations[e];i&&i.forEach(e=>{e.active=e.segmentationId===t})}),(0,l.triggerSegmentationRepresentationModified)(e,t)}getActiveSegmentation(e){if(!this.state.viewportSegRepresentations[e])return;let t=this.state.viewportSegRepresentations[e].find(e=>e.active);if(t)return this.getSegmentation(t.segmentationId)}getSegmentationRepresentations(e,t={}){let n=this.state.viewportSegRepresentations[e];return n?t.type||t.segmentationId?n.filter(e=>{let n=!t.type||e.type===t.type,i=!t.segmentationId||e.segmentationId===t.segmentationId;return n&&i}):n:[]}getSegmentationRepresentation(e,t){return this.getSegmentationRepresentations(e,t)[0]}getSegmentationRepresentationVisibility(e,t){let n=this.getSegmentationRepresentation(e,t);return n?.visible}setSegmentationRepresentationVisibility(e,t,n){this.updateState(i=>{let a=i.viewportSegRepresentations[e]?.filter(e=>e.segmentationId===t.segmentationId&&e.type===t.type);a&&a.forEach(e=>{e.visible=n,Object.values(e.segments).forEach(e=>{e.visible=n})})}),(0,l.triggerSegmentationRepresentationModified)(e,t.segmentationId,t.type)}addColorLUT(e,t){this.updateState(n=>{n.colorLUT[t]&&console.warn("Color LUT table already exists, overwriting"),n.colorLUT[t]=i.BF.deepClone(e)})}removeColorLUT(e){this.updateState(t=>{delete t.colorLUT[e]})}_getStackIdForImageIds(e){return e.map(e=>e.slice(-Math.round(.15*e.length))).join("_")}getAllViewportSegmentationRepresentations(){return Object.entries(this.state.viewportSegRepresentations).map(([e,t])=>({viewportId:e,representations:t}))}getSegmentationRepresentationsBySegmentationId(e){let t=[];return Object.entries(this.state.viewportSegRepresentations).forEach(([n,i])=>{let a=i.filter(t=>t.segmentationId===e);a.length>0&&t.push({viewportId:n,representations:a})}),t}}async function p({imageIds:e,options:t}){let n=t?.volumeId||i.BF.uuidv4();return await i.UH.createAndCacheVolumeFromImages(n,e),{volumeId:n}}async function m({segmentationId:e,options:t}){let n=v.getSegmentation(e),i=n.representationData.Labelmap,{volumeId:a}=await p({imageIds:i.imageIds,options:t});n.representationData.Labelmap.volumeId=a}function f(e){let t=r.Ay.newInstance(),n=o.Ay.newInstance();return(n.addPoint(0,0),e===a.D_.Labelmap)?{cfun:t,ofun:n}:{}}let v=new g("DEFAULT")},33174:(e,t,n)=>{"use strict";n.r(t),n.d(t,{ECGUtilities:()=>eS,FrameRange:()=>eR.A,HistoryMemo:()=>L,PointsManager:()=>K.A,ProgressiveIterator:()=>el.A,RLEVoxelMap:()=>eI.A,VideoUtilities:()=>eT,VoxelManager:()=>ev.A,WSIUtilities:()=>eD,actorIsA:()=>W.N,applyPreset:()=>q.A,asArray:()=>e7._,autoLoad:()=>ez.A,buildMetadata:()=>eF.KP,calculateNeighborhoodStats:()=>e3.c,calculateRadiographicPixelSpacing:()=>e4.VD,calculateSpacingBetweenImageIds:()=>e2.A,calculateViewportsSpatialRegistration:()=>Y.A,calibratedPixelSpacingMetadataProvider:()=>_.A,clamp:()=>w.A,clip:()=>eq.Ay,clonePoint3:()=>p.A,color:()=>eV,colormap:()=>ex,convertColorArrayToRgbString:()=>eb.J,convertStackToVolumeViewport:()=>em.h,convertToGrayscale:()=>ew.A,convertVolumeToStackViewport:()=>ef.n,createLinearRGBTransferFunction:()=>d.A,createSigmoidRGBTransferFunction:()=>s.A,createSubVolume:()=>eK.A,decimate:()=>ed.A,deepClone:()=>ej.G,deepEqual:()=>eO.b,deepMerge:()=>Z.A,eventListener:()=>i,fnv1aHash:()=>eN.A,generateFrameImageId:()=>eY.Hf,generateVolumePropsFromImageIds:()=>ep.D,genericMetadataProvider:()=>er.A,genericViewportDisplaySetMetadataProvider:()=>eh.A,getAcquisitionPlaneOrientation:()=>eZ.A,getBufferConfiguration:()=>eg.h,getClosestImageId:()=>C.A,getClosestStackImageIndexForPoint:()=>z.A,getCubeSizeInView:()=>e6.H,getCurrentVolumeViewportSlice:()=>$.A,getDynamicVolumeInfo:()=>eX.A,getERMF:()=>e4.lJ,getImageDataMetadata:()=>eU.T,getImageLegacy:()=>en.A,getImageSliceDataForVolumeViewport:()=>H.A,getMinMax:()=>g.A,getNormalizedAspectRatio:()=>tt.x,getPixelSpacingInformation:()=>e4.Cc,getRandomSampleFromArray:()=>eA.p,getRuntimeId:()=>f.A,getScalingDescriptor:()=>tr,getScalingParameters:()=>ee.A,getSliceRange:()=>B.A,getSpacingInNormalDirection:()=>A.A,getTargetVolumeAndSpacingInNormalDir:()=>E.A,getVOIRangeFromWindowLevel:()=>v.A,getViewportContentMode:()=>te.nH,getViewportImageCornersInWorld:()=>J.A,getViewportImageIds:()=>eC.A,getViewportModality:()=>ta,getViewportsWithImageURI:()=>X.A,getViewportsWithVolumeId:()=>D.A,getVoiFromSigmoidRGBTransferFunction:()=>l.A,getVolumeActorCorners:()=>M.A,getVolumeDirectionVectors:()=>e0.A,getVolumeId:()=>eE.A,getVolumeSliceRangeInfo:()=>U.A,getVolumeViewReferenceId:()=>e1.A,getVolumeViewportScrollInfo:()=>F.A,getVolumeViewportsContainingSameVolumes:()=>T.A,handleMultiframe4D:()=>eY.FM,hasFloatScalingParameters:()=>eM.a,hasNaNValues:()=>Q.A,hasOwn:()=>m.A,imageIdToURI:()=>I.A,imageRetrieveMetadataProvider:()=>ec.A,imageToWorldCoords:()=>N.A,indexAlmostWithinDimensions:()=>S.A,indexWithinDimensions:()=>y.A,invertRgbTransferFunction:()=>o.A,isEqual:()=>ti.n4,isEqualAbs:()=>ti.Ph,isEqualNegative:()=>ti.WC,isGenericViewport:()=>te.oX,isImageActor:()=>W.e,isNumber:()=>ti.Et,isOpposite:()=>b.A,isPTPrescaledWithSUV:()=>et.A,isValidVolume:()=>eo.p,isVideoTransferSyntax:()=>eu.A,jumpToSlice:()=>eJ.e,loadImageToCanvas:()=>x.A,logger:()=>e5,makeVolumeMetadata:()=>ea.A,mapMappedBandToRawRange:()=>e8.j_,mapScalarToViewportVoiIntensity:()=>e8.fT,mapViewportVoiIntensityToScalar:()=>e8.l2,planar:()=>eP,pointInShapeCallback:()=>ey.ii,renderToCanvasCPU:()=>V.A,renderToCanvasGPU:()=>O.A,resolveGenericViewportVolumeId:()=>eH.d,rotateToViewCoordinates:()=>e9.P,roundNumber:()=>e_.A,roundToPrecision:()=>e_.C,scaleArray:()=>e$.A,scaleRgbTransferFunction:()=>c.A,scroll:()=>eQ.A,snapFocalPointToSlice:()=>G.A,sortImageIdsAndGetSpacing:()=>ei.A,spatialRegistrationMetadataProvider:()=>j.A,splitImageIdsBy4DTags:()=>eY.Ay,transferFunctionUtils:()=>eL,transformIndexToWorld:()=>k.A,transformWorldToIndex:()=>P.A,transformWorldToIndexContinuous:()=>P.p,triggerEvent:()=>h.A,updatePlaneRestriction:()=>tn.O,updateVTKImageDataWithCornerstoneImage:()=>es.J,uuidv4:()=>u.A,viewportIsInStackMode:()=>te.NL,viewportIsInVolumeMode:()=>te.zb,viewportSupportsDisplaySetPresentation:()=>te.Tf,viewportSupportsImageSlices:()=>te.hz,viewportSupportsStackCalibration:()=>te.Xu,viewportSupportsStackCompatibility:()=>te.T,viewportSupportsVolumeActors:()=>te.$O,viewportSupportsVolumeCompatibility:()=>te.rw,viewportSupportsVolumeId:()=>te.Uv,viewportSupportsVolumeURI:()=>te.vP,windowLevel:()=>ek,worldToImageCoords:()=>R.A});var i={};n.r(i),n.d(i,{MultiTargetEventListenerManager:()=>r.I,TargetEventListeners:()=>a.f});var a=n(59845),r=n(30600),o=n(48320),s=n(97748),l=n(28478),d=n(62455),c=n(13898),h=n(69228),u=n(3793),g=n(37190),p=n(32166),m=n(30888),f=n(27109),v=n(23703),I=n(62553),_=n(14958),w=n(85759),b=n(77849),C=n(47241),A=n(74798),E=n(85156),M=n(37579),y=n(74842),S=n(90140),T=n(84454),D=n(32488),P=n(22911),k=n(24887),x=n(42028),L=n(5357),V=n(50869),O=n(6913),R=n(26980),N=n(31226),U=n(94237),F=n(92449),B=n(5663),G=n(92154),H=n(47776),W=n(50987),X=n(18110),z=n(94633),$=n(1049),Y=n(97140),j=n(15005),J=n(73588),Q=n(18695),q=n(91711),K=n(96446),Z=n(5454),ee=n(15057),et=n(55291),en=n(56478),ei=n(6927),ea=n(6529),er=n(85461),eo=n(38744),es=n(42422),el=n(77757),ed=n(80486),ec=n(16841),eh=n(18025),eu=n(17935),eg=n(6560),ep=n(32876),em=n(94320),ef=n(35954),ev=n(36039),eI=n(30075),e_=n(89937),ew=n(50121),eb=n(41652),eC=n(82039),eA=n(32854),eE=n(79923),eM=n(64375),ey=n(39262),eS=n(39935),eT=n(98197),eD=n(24433),eP=n(23668),ek=n(65110),ex=n(60251),eL=n(74092),eV=n(92051),eO=n(24106),eR=n(850),eN=n(28712),eU=n(35972),eF=n(96945),eB=n(11601),eG=n(19204),eH=n(12732),eW=n(54268),eX=n(50699),ez=n(50695),e$=n(3075),eY=n(92049),ej=n(21483),eJ=n(60609),eQ=n(11877),eq=n(622),eK=n(19012),eZ=n(52971),e0=n(80777),e1=n(92557),e2=n(35290),e5=n(82332),e3=n(1827),e8=n(7373),e4=n(56381),e6=n(37995),e9=n(11806),e7=n(31913),te=n(66384),tt=n(66368),tn=n(73265),ti=n(88824);let ta=(e,t)=>(0,eB.p)(e,t,eW.Ay.getVolume),tr=(e,t)=>(0,eG.c)(e,t,eW.Ay.getVolume)},33845:(e,t,n)=>{"use strict";n.d(t,{VH:()=>i,XL:()=>o,wd:()=>a,zx:()=>r});var i=n(92570);n(83048);var a=n(51302),r=n(55146),o=n(42067)},34470:(e,t,n)=>{"use strict";n.d(t,{Q0:()=>a.A,Zi:()=>i.A});var i=n(36898),a=n(48975);n(65488)},35172:(e,t,n)=>{"use strict";n.d(t,{d:()=>d});var i=n(32207),a=n(49007),r=n(78378),o=n(70192),s=n(66442);let l=function(e){var t;let{segmentationId:n,representation:i,config:a}=e,{type:l,data:d}=i,c=d?{...d}:{};if(!c)throw Error("Segmentation representation data may not be undefined");l===r.D_.Contour&&((t=c).geometryIds=t.geometryIds??[],t.annotationUIDsMap=t.annotationUIDsMap??new Map);let h=function(e,t,n){let i={};return e?Object.entries(e).forEach(([e,t])=>{let{label:n,locked:a,cachedStats:r,active:o,...s}=t,l={segmentIndex:Number(e),label:n??`Segment ${e}`,locked:a??!1,cachedStats:r??{},active:o??!1,...s};i[e]=l}):t===r.D_.Contour?function(e,t){let{geometryIds:n}=t;n?.forEach(t=>{let n=o.PP.getGeometry(t);if(n?.data){let{segmentIndex:t}=n.data;e[t]={segmentIndex:t}}})}(i,n):t===r.D_.Surface?function(e,t){let{geometryIds:n}=t;n?.forEach(t=>{let n=o.PP.getGeometry(t);if(n?.data){let{segmentIndex:t}=n.data;e[t]={segmentIndex:t}}})}(i,n):i[1]={segmentIndex:1,label:"Segment 1",locked:!1,cachedStats:{},active:!0},i}(a?.segments,l,c);delete a?.segments;let u={segmentationId:n,label:a?.label??null,fallbackLabel:a?.fallbackLabel??null,cachedStats:a?.cachedStats??{},segments:h,segmentOrder:a?.segmentOrder??Object.keys(h).map(Number).sort((e,t)=>e-t),representationData:{[l]:{...c}}};return l===r.D_.Labelmap&&((0,s.uk)(u),(0,s.xS)(u)),u};function d(e,t){let n=i._6;e.forEach(e=>{let i=l(e);n.addSegmentation(i),t||(0,a.triggerSegmentationModified)(i.segmentationId)})}},36552:(e,t,n)=>{"use strict";function i(e){let{moduleIds:t}=e;return null}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return i}}),n(95155),n(47650),n(8567),n(77278)},36814:(e,t,n)=>{"use strict";n.d(t,{Q:()=>o});var i=n(70192),a=n(78378),r=n(38433);function o(e,t,n){(0,r.HM)(e),(0,i.Hl)(i.tX,a.sV.SEGMENTATION_DATA_MODIFIED,{segmentationId:e,modifiedSlicesToUse:t,segmentIndex:n})}},37429:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var i=n(27321),a=n(68759),r=n(65704);let o=function(e,t,n,o,s,l,d,c,h={},u="",g){let{color:p,fill:m,width:f,lineWidth:v,lineDash:I,fillOpacity:_,strokeOpacity:w}=Object.assign({color:"rgb(0, 255, 0)",fill:"transparent",width:"2",lineDash:void 0,lineWidth:void 0,strokeOpacity:1,fillOpacity:1},h),b=(0,i.A)(t,"fan",n),C=e.getSvgNode(b),A=d*Math.PI/180,E=c*Math.PI/180,M=o[0],y=o[1],S=M+l*Math.cos(A),T=y+l*Math.sin(A),D=M+l*Math.cos(E),P=y+l*Math.sin(E),k=M+s*Math.cos(A),x=y+s*Math.sin(A),L=M+s*Math.cos(E),V=y+s*Math.sin(E),O=c-d<=180?0:1,R=`M ${S} ${T}`,N={d:R+=` A ${l} ${l} 0 ${O} 1 ${D} ${P} L ${L} ${V} A ${s} ${s} 0 ${O} 0 ${k} ${x} Z`,stroke:p,fill:m,"stroke-width":v||f,"stroke-dasharray":I,"fill-opacity":_,"stroke-opacity":w,"mix-blend-mode":"normal"};if(C)(0,a.A)(N,C),e.setNodeTouched(b);else{let t=document.createElementNS("http://www.w3.org/2000/svg","path");""!==u&&t.setAttribute("data-id",u),void 0!==g&&(t.style.zIndex=g.toString()),(0,r.A)(N,t),e.appendNode(t,b)}}},38031:(e,t,n)=>{"use strict";n.d(t,{IN:()=>l,W8:()=>d,xT:()=>s});var i=n(50923),a=n(70192),r=n(41918),o=n(69435);function s(e){let t=(0,o.P)(e);if(t?.length===0)return[];let n=[];for(let e of t){let{viewport:t}=(0,a.yj)(e)||{};t&&n.push(t)}return n}function l(e){let t=s(e);return t.length>0?t[0]:void 0}function d(e,t,n=.99){let a=t.metadata?.viewPlaneNormal;if(!a||!Array.isArray(a))return;let o=i.vt();for(let t of(i.S8(o,a),e)){let e=(0,r.A)(t);if(!e?.viewPlaneNormal)continue;let a=i.vt();if(i.S8(a,e.viewPlaneNormal),Math.abs(i.Om(o,a))>=n)return t}}},38433:(e,t,n)=>{"use strict";n.d(t,{Dm:()=>o,HM:()=>a,R1:()=>r}),n(70192),n(56099);let i=new Map,a=e=>{let t=i.get(e);t&&(t.isDirty=!0)},r=e=>{let t=i.get(e);return t&&!t.isDirty?t.indices:null},o=(e,t)=>{i.set(e,{indices:t,isDirty:!1})}},40155:(e,t,n)=>{"use strict";n.d(t,{n:()=>r});var i=n(42306),a=n(8270);function r(e,t){let n=(0,i.getToolGroup)(e);if(void 0===n)return[];let r=n._toolInstances;return Object.keys(r).length?t&&r[t]?[r[t]]:Object.values(r).filter(e=>e instanceof a.A):[]}},40454:(e,t,n)=>{"use strict";n.d(t,{I3:()=>l,Mx:()=>d,Nf:()=>h,Pi:()=>u,Zs:()=>s,hM:()=>o,r:()=>c});var i=n(18236),a=n(65509),r=n(76399);function o(e,t){return(0,i.uk)(e)?.segmentBindings?.[t]}function s(e,t,n){let a=(0,i.uk)(e);if(!a)return;let r=a.segmentBindings[t];if(r){let e=a.labelmaps[r.labelmapId];e?.labelToSegmentIndex&&delete e.labelToSegmentIndex[r.labelValue]}a.segmentBindings[t]=n;let o=a.labelmaps[n.labelmapId];o&&(o.labelToSegmentIndex||={},o.labelToSegmentIndex[n.labelValue]=t)}function l(e,t){let n=(0,i.uk)(e);return n?Object.entries(n.segmentBindings).filter(([,e])=>e.labelmapId===t).map(([e])=>Number(e)).sort((e,t)=>e-t):[]}function d(e,t,n){let i=(0,a.Hs)(e,t);if(i&&null!=n)return i.labelToSegmentIndex?.[n]??n}function c(e,t){let n=o(e,t);if(n)return(0,a.Hs)(e,n.labelmapId)}function h(e,t){return c(e,t)??(0,a.m)(e)[0]}function u(e,t){let n=(0,i.uk)(e),o=n?.segmentBindings?.[t];if(!n||!o)return;let s=n.labelmaps[o.labelmapId];s?.labelToSegmentIndex&&delete s.labelToSegmentIndex[o.labelValue],delete n.segmentBindings[t],0===l(e,o.labelmapId).length&&(0,a.$n)(e,o.labelmapId),(0,r.x)(e)}},42018:(e,t,n)=>{"use strict";n.d(t,{Gi:()=>i,NE:()=>u,ZC:()=>h});var i,a=n(94648);!function(e){e[e.Union=0]="Union",e[e.Difference=1]="Difference",e[e.Intersection=2]="Intersection",e[e.Xor=3]="Xor"}(i||(i={}));let r={[i.Union]:a.nQ.Union,[i.Difference]:a.nQ.Difference,[i.Intersection]:a.nQ.Intersection,[i.Xor]:a.nQ.Xor};function o(e){let t=e.length,n=Array(t);for(let i=0;i=3&&t.push(o(n.outer)),n.holes)for(let e of n.holes)e.length>=3&&t.push(o(e));return t}function d(e){let t=[];return function e(t,n){for(let i=0;i=3&&l.push(s(t)),e(i,n)}}l.length>0&&(o.holes=l),n.push(o)}}(e,t),t}function c(e){return e.map(e=>({outer:e.outer.map(e=>[e[0],e[1]]),holes:e.holes?.map(e=>e.map(e=>[e[0],e[1]]))}))}function h(e,t,n){if(0===e.length)return n===i.Union||n===i.Xor?c(t):[];if(0===t.length)return n===i.Intersection?[]:c(e);let o=l(e),s=l(t);if(0===o.length)return n===i.Union||n===i.Xor?c(t):[];if(0===s.length)return n===i.Intersection?[]:c(e);let h=new a.nF;return a.Qw.booleanOpDWithPolyTree(r[n],o,s,h,a.gY.EvenOdd,4),d(h)}function u(e){if(e.length<3)return[];let t=new a.nF;return a.Qw.booleanOpDWithPolyTree(a.nQ.Union,[o(e)],null,t,a.gY.EvenOdd,4),d(t)}},42067:(e,t,n)=>{"use strict";n.r(t),n.d(t,{addCanvasPointsToArray:()=>A.A,arePolylinesIdentical:()=>T.A,containsPoint:()=>a.A,containsPoints:()=>r.A,convexHull:()=>S.A,decimate:()=>f.A,getAABB:()=>o.A,getArea:()=>s.A,getClosestLineSegmentIntersection:()=>w.A,getFirstLineSegmentIntersectionIndexes:()=>v.A,getLineSegmentIntersectionsCoordinates:()=>_.A,getLineSegmentIntersectionsIndexes:()=>I.A,getNormal2:()=>h.A,getNormal3:()=>c.A,getSignedArea:()=>l.A,getSubPixelSpacingAndXYDirections:()=>b.A,getWindingDirection:()=>d.A,intersectPolyline:()=>m.A,intersectPolylines:()=>g.A,isClosed:()=>i.A,isPointInsidePolyline3D:()=>y,mergePolylines:()=>p.S,pointCanProjectOnLine:()=>E.A,pointsAreWithinCloseContourProximity:()=>C.A,projectTo2D:()=>M.p,subtractPolylines:()=>u.A});var i=n(37972),a=n(59061),r=n(96674),o=n(22958),s=n(32897),l=n(31677),d=n(45079),c=n(53772),h=n(31167),u=n(17673),g=n(61190),p=n(61101),m=n(41105),f=n(54562),v=n(27520),I=n(63701),_=n(12138),w=n(11239),b=n(99717),C=n(59351),A=n(10830),E=n(96158),M=n(23838);function y(e,t,n={}){let{sharedDimensionIndex:i,projectedPolyline:r}=(0,M.p)(t),{holes:o}=n,s=[];if(o)for(let e=0;e{"use strict";n.d(t,{D0:()=>C,Dh:()=>b,G_:()=>A,LH:()=>_,Ts:()=>p,a:()=>E,cz:()=>v,lk:()=>I,up:()=>m,xu:()=>w}),n(16376);var i=n(5454),a=n(41532),r=n(99376);n(69228),n(3922);var o=n(77280),s=n(10115);let l=!1,d={isMobile:!1,rendering:{useCPURendering:!1,preferSizeOverAccuracy:!1,useLegacyCameraFOV:!1,strictZSpacingForVolumeViewport:!0,renderingEngineMode:o.FJ.ContextPool,webGlContextCount:7,planar:{renderBackend:o.YB.Auto,cpuVolume:{useViewportSamplingForLinear:!0,volumeModifiedThrottleMs:5e3}},volumeRendering:{sampleDistanceMultiplier:1}},debug:{statsOverlay:!1},peerImport:e=>null},c={...d,rendering:{...d.rendering}},h=null;function u(){let e=(0,r.BV)();return e.norm16&&e.norm16Linear}function g(){return!!/iPad|iPhone|iPod/.test(navigator.platform)||navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&navigator.platform.includes("MacIntel")}function p(e=c){if(l)return l;(c=(0,i.A)(d,e)).isMobile&&(c.rendering.webGlContextCount=1),g()&&(e.rendering?.preferSizeOverAccuracy?c.rendering.preferSizeOverAccuracy=!0:u()||console.log("norm16 texture not supported, you can turn on the preferSizeOverAccuracy flag to use native data type, but be aware of the inaccuracy of the rendering in high bits"));let t=(0,r.BV)();return t.webgl?(console.log("CornerstoneRender: using GPU rendering"),t.softwareRasterizer&&console.log(`CornerstoneRender: software rasterizer detected (${t.renderer}), GPU rendering may be slow`)):(console.log("CornerstoneRender: GPU not detected, using CPU rendering"),c.rendering.useCPURendering=!0),l=!0,h||(h=new a.A),l}function m(){return u()}let f=new Set;function v(e){let t=e??c.rendering.planar?.renderBackend??o.YB.Auto;if(t!==o.YB.Auto){if((0,s.FF)(t))return t;f.has(t)||(f.add(t),console.warn(`[getEffectiveRenderBackend] Unregistered render backend "${t}"; falling back to 'auto'. Register custom backends with registerRenderBackend().`))}return c.rendering.useCPURendering?o.YB.CPU:o.YB.GPU}function I(){let e=(0,r.BV)();return e.webgl2?e.floatLinear:!g()}function _(){return c.rendering.useCPURendering}function w(){return!0===c.rendering.useGenericViewport}function b(){return l}function C(){return c}function A(){return h||(h=new a.A),h}async function E(e){return c.peerImport(e)}},42279:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});let i={}},42306:(e,t,n)=>{"use strict";n.r(t),n.d(t,{createToolGroup:()=>v,destroy:()=>_,destroyToolGroup:()=>I,getAllToolGroups:()=>b,getToolGroup:()=>d,getToolGroupForViewport:()=>w.A,getToolGroupsWithToolName:()=>A});var i=n(17964),a=n(78378),r=n(78928),o=n(70192),s=n(19307),l=n(4101);let d=function(e){return i.wk.toolGroups.find(t=>t.id===e)},{Active:c,Passive:h,Enabled:u,Disabled:g}=a.r$,p=[{mouseButton:a.iP.Primary}];class m{constructor(e){this.viewportsInfo=[],this.toolOptions={},this.currentActivePrimaryToolName=null,this.prevActivePrimaryToolName=null,this.restoreToolOptions={},this._toolInstances={},this.id=e}getViewportIds(){return this.viewportsInfo.map(({viewportId:e})=>e)}getViewportsInfo(){return this.viewportsInfo.slice()}getToolInstance(e){let t=this._toolInstances[e];return t||void console.warn(`'${e}' is not registered with this toolGroup (${this.id}).`)}getToolInstances(){return this._toolInstances}hasTool(e){return!!this._toolInstances[e]}addTool(e,t={}){let n=i.wk.tools[e],a=void 0!==e&&""!==e,r=this.toolOptions[e];if(!a)return void console.warn("Tool with configuration did not produce a toolName: ",t);if(!n)return void console.warn(`'${e}' is not registered with the library. You need to use cornerstoneTools.addTool to register it.`);if(r)return void console.warn(`'${e}' is already registered for ToolGroup ${this.id}.`);let{toolClass:o}=n,s=new o({name:e,toolGroupId:this.id,configuration:t});this._toolInstances[e]=s}addToolInstance(e,t,n={}){let a=i.wk.tools[e]?.toolClass;if(!a){let n=i.wk.tools[t].toolClass;class r extends n{}r.toolName=e,a=r,i.wk.tools[e]={toolClass:r}}this.addTool(a.toolName,n)}addViewport(e,t){if("string"!=typeof e)throw Error("viewportId must be defined and be a string");let n=this._findRenderingEngine(e,t);this.viewportsInfo.some(({viewportId:t})=>t===e)||this.viewportsInfo.push({viewportId:e,renderingEngineId:n});let i=this.getActivePrimaryMouseButtonTool();this.setViewportsCursorByToolName(i);let r={toolGroupId:this.id,viewportId:e,renderingEngineId:n};(0,o.Hl)(o.tX,a.sV.TOOLGROUP_VIEWPORT_ADDED,r)}removeViewports(e,t){let n=[];if(this.viewportsInfo.forEach((i,a)=>{let r=!1;i.renderingEngineId===e&&(r=!0,t&&i.viewportId!==t&&(r=!1)),r&&n.push(a)}),n.length)for(let e=n.length-1;e>=0;e--)this.viewportsInfo.splice(n[e],1);let i={toolGroupId:this.id,viewportId:t,renderingEngineId:e};(0,o.Hl)(o.tX,a.sV.TOOLGROUP_VIEWPORT_REMOVED,i)}setActiveStrategy(e,t){let n=this._toolInstances[e];if(void 0===n)return void console.warn(`Tool ${e} not added to toolGroup, can't set tool configuration.`);n.setActiveStrategy(t)}setToolMode(e,t,n={}){return e?t===a.r$.Active?void this.setToolActive(e,n||this.restoreToolOptions[e]):t===a.r$.Passive?void this.setToolPassive(e):t===a.r$.Enabled?void this.setToolEnabled(e):t===a.r$.Disabled?void this.setToolDisabled(e):void console.warn("setToolMode: mode must be defined"):void console.warn("setToolMode: toolName must be defined")}setToolActive(e,t={}){let n=this._toolInstances[e];if(void 0===n)return void console.warn(`Tool ${e} not added to toolGroup, can't set tool mode.`);if(!n)return void console.warn(`'${e}' instance ${n} is not registered with this toolGroup, can't set tool mode.`);let i=[...this.toolOptions[e]?this.toolOptions[e].bindings:[],...t.bindings?t.bindings:[]].reduce((e,t)=>{let n=void 0!==t.numTouchPoints,i=void 0!==t.mouseButton;return!e.some(e=>f(e,t))&&(n||i)&&e.push(t),e},[]);if(this.toolOptions[e]={bindings:i,mode:c},this._toolInstances[e].mode=c,this._hasMousePrimaryButtonBinding(t))this.setViewportsCursorByToolName(e),n.isPrimary=!0;else{if(!this.getActivePrimaryMouseButtonTool()){let e=s.Ii.getDefinedCursor("default");this._setCursorForViewports(e)}n.isPrimary=!1}this._hasMousePrimaryButtonBinding(t)&&(null===this.prevActivePrimaryToolName?this.prevActivePrimaryToolName=e:this.prevActivePrimaryToolName=this.currentActivePrimaryToolName,this.currentActivePrimaryToolName=e),"function"==typeof n.onSetToolActive&&n.onSetToolActive(),this._renderViewports();let r={toolGroupId:this.id,toolName:e,toolBindingsOptions:t};(0,o.Hl)(o.tX,a.sV.TOOL_ACTIVATED,r),this._triggerToolModeChangedEvent(e,c,t)}setToolPassive(e,t){let n=this._toolInstances[e];if(void 0===n)return void console.warn(`Tool ${e} not added to toolGroup, can't set tool mode.`);let i=this.getToolOptions(e),a=Object.assign({bindings:i?i.bindings:[]},i,{mode:h}),r=Array.isArray(t?.removeAllBindings)?t.removeAllBindings:this.getDefaultPrimaryBindings();a.bindings=a.bindings.filter(e=>t?.removeAllBindings!==!0&&!r.some(t=>f(e,t)));let o=h;0!==a.bindings.length&&(a.mode=o=c),this.toolOptions[e]=a,n.mode=o,n.isPrimary=!1,"function"==typeof n.onSetToolPassive&&n.onSetToolPassive(),this._renderViewports(),this._triggerToolModeChangedEvent(e,h)}setToolEnabled(e){let t=this._toolInstances[e];if(void 0===t)return void console.warn(`Tool ${e} not added to toolGroup, can't set tool mode.`);this.toolOptions[e]={bindings:[],mode:u},t.mode=u,"function"==typeof t.onSetToolEnabled&&t.onSetToolEnabled(),this._renderViewports(),this._triggerToolModeChangedEvent(e,u)}setToolDisabled(e){let t=this._toolInstances[e];if(void 0===t)return void console.warn(`Tool ${e} not added to toolGroup, can't set tool mode.`);this.restoreToolOptions[e]=this.toolOptions[e],this.toolOptions[e]={bindings:[],mode:g},t.mode=g,"function"==typeof t.onSetToolDisabled&&t.onSetToolDisabled(),this._renderViewports(),this._triggerToolModeChangedEvent(e,g)}getToolOptions(e){let t=this.toolOptions[e];if(void 0!==t)return t}getActivePrimaryMouseButtonTool(){return Object.keys(this.toolOptions).find(e=>{let t=this.toolOptions[e];return t.mode===c&&this._hasMousePrimaryButtonBinding(t)})}setViewportsCursorByToolName(e,t){let n=this._getCursor(e,t);this._setCursorForViewports(n)}_getCursor(e,t){let n,i;return t&&(n=`${e}.${t}`,i=s._x.getDefinedCursor(n,!0))?i:(n=`${e}`,(i=s._x.getDefinedCursor(n,!0))||(n=e,i=s._x.getDefinedCursor(n,!0)))?i:s.Ii.getDefinedCursor("default")}_setCursorForViewports(e){o.wB.getRuntimeSettings().get("useCursors")&&this.viewportsInfo.forEach(({renderingEngineId:t,viewportId:n})=>{let i=(0,o.b1)(n,t);if(!i)return;let{viewport:a}=i;(0,l.pD)(a.element,e)})}setToolConfiguration(e,t,n){let i,a=this._toolInstances[e];return void 0===a?(console.warn(`Tool ${e} not present, can't set tool configuration.`),!1):(i=n?t:Object.assign(a.configuration,t),a.configuration=i,"function"==typeof a.onSetToolConfiguration&&a.onSetToolConfiguration(),this._renderViewports(),!0)}getDefaultMousePrimary(){return a.iP.Primary}getDefaultPrimaryBindings(){return p}getToolConfiguration(e,t){if(void 0===this._toolInstances[e])return void console.warn(`Tool ${e} not present, can't set tool configuration.`);let n=r(this._toolInstances[e].configuration,t)||this._toolInstances[e].configuration;return o.BF.deepClone(n)}getPrevActivePrimaryToolName(){return this.prevActivePrimaryToolName}setActivePrimaryTool(e){let t=this.getCurrentActivePrimaryToolName();this.setToolDisabled(t),this.setToolActive(e,{bindings:[{mouseButton:a.iP.Primary}]})}getCurrentActivePrimaryToolName(){return this.currentActivePrimaryToolName}clone(e,t=null){let n=d(e);return n?console.debug(`ToolGroup ${e} already exists`):(n=new m(e),i.wk.toolGroups.push(n),t=t??(()=>!0),Object.keys(this._toolInstances).filter(t).forEach(e=>{let t=this._toolInstances[e],i=this.toolOptions[e],a=t.mode;n.addTool(e),n.setToolMode(e,a,{bindings:i?.bindings??[]})})),n}_hasMousePrimaryButtonBinding(e){let t=this.getDefaultPrimaryBindings();return e?.bindings?.some(e=>t.some(t=>f(e,t)))}_renderViewports(){this.viewportsInfo.forEach(({renderingEngineId:e,viewportId:t})=>{(0,o.lD)(e).renderViewport(t)})}_triggerToolModeChangedEvent(e,t,n){let i={toolGroupId:this.id,toolName:e,mode:t,toolBindingsOptions:n};(0,o.Hl)(o.tX,a.sV.TOOL_MODE_CHANGED,i)}_findRenderingEngine(e,t){let n=(0,o.qO)();if(n?.length===0)throw Error("No rendering engines found.");if(t)return t;let i=n.filter(t=>t.getViewport(e));if(0===i.length){if(1===n.length)return n[0].id;throw Error("No rendering engines found that contain the viewport with the same viewportId, you must specify a renderingEngineId.")}if(i.length>1)throw Error("Multiple rendering engines found that contain the viewport with the same viewportId, you must specify a renderingEngineId.");return i[0].id}}function f(e,t){return e.mouseButton===t.mouseButton&&e.numTouchPoints===t.numTouchPoints&&e.modifierKey===t.modifierKey}let v=function(e){if(i.wk.toolGroups.some(t=>t.id===e))return void console.warn(`'${e}' already exists.`);let t=new m(e);return i.wk.toolGroups.push(t),t},I=function(e){let t=i.wk.toolGroups.findIndex(t=>t.id===e);t>-1&&i.wk.toolGroups.splice(t,1)},_=function(){for(let e of[...i.wk.toolGroups])I(e.id);i.wk.toolGroups=[]};var w=n(73526);let b=function(){return i.wk.toolGroups},C=[a.r$.Active,a.r$.Passive,a.r$.Enabled],A=function(e){return i.wk.toolGroups.filter(({toolOptions:t})=>{let n=Object.keys(t);for(let i=0;i{"use strict";n.d(t,{A:()=>l});var i=n(50923),a=n(70192);let{isEqual:r}=a.BF,{p8:o}=a.Jj,s=1-o;function l(e,t,n){let{viewPlaneNormal:l}=t,d=e.filter(e=>{let{planeRestriction:n,referencedImageId:o}=e.metadata,{viewPlaneNormal:d}=e.metadata;if(n){let{inPlaneVector1:e,inPlaneVector2:t}=n;return(!e||!!r(0,i.Om(l,e)))&&(!t||!!r(0,i.Om(l,t)))}if(!e.metadata.referencedImageId&&!d&&e.metadata.FrameOfReferenceUID){for(let n of e.data.handles.points){let e=i.jb(i.vt(),n,t.focalPoint);if(!r(i.Om(e,l),0))return!1}return e.metadata.viewPlaneNormal=l,e.metadata.cameraFocalPoint=t.focalPoint,!0}if(!d&&o){let{imageOrientationPatient:t}=a.wx.get("imagePlaneModule",o),n=i.fA(t[0],t[1],t[2]),r=i.fA(t[3],t[4],t[5]);d=i.vt(),i.$A(d,n,r),e.metadata.viewPlaneNormal=d}let c=Math.abs(i.Om(l,d))>s;return d&&c});if(!d.length)return[];let c=n/2+o,{focalPoint:h}=t,u=[];for(let e of d){let{data:t,metadata:n,isVisible:a}=e;if(!a)continue;let r=n.planeRestriction?.point||t.handles?.points?.[0]||t.contour?.polyline[0];if(!r){u.push(e);continue}let o=i.jb(i.vt(),h,r);Math.abs(i.Om(o,l)){"use strict";n.d(t,{A:()=>s,h:()=>l});var i=n(36195),a=n(42215),r=n(54731),o=n(87352);function s(e,t){let n=i.wu.newInstance();n.setInputData(e);let r=e.getSpacing(),o=((0,a.D0)().rendering?.volumeRendering?.sampleDistanceMultiplier||1)*(r[0]+r[1]+r[2])/6;return n.setMaximumSamplesPerRay(4e3),n.setSampleDistance(o),n.setScalarTexture(t),n}function l(e){let t=r.Ay.newInstance();t.setBlendMode(e.getBlendMode());let n=e.getInputData(),{voxelManager:i}=n.get("voxelManager"),a=i.getCompleteScalarDataArray(),s=o.Ay.newInstance({name:"Pixels",values:a});return n.getPointData().setScalars(s),t.setInputData(n),t.setMaximumSamplesPerRay(e.getMaximumSamplesPerRay()),t.setSampleDistance(e.getSampleDistance()),t}},44489:(e,t,n)=>{"use strict";var i;n.d(t,{H:()=>i}),function(e){e.UP="UP",e.DOWN="DOWN",e.LEFT="LEFT",e.RIGHT="RIGHT"}(i||(i={}))},46704:(e,t,n)=>{"use strict";n.d(t,{u:()=>a});var i=n(70192);function a(e,t){return!!i.BF.getScalingDescriptor(e,t)?.isPreScaled}},49007:(e,t,n)=>{"use strict";n.r(t),n.d(t,{triggerSegmentationDataModified:()=>i.Q,triggerSegmentationModified:()=>o,triggerSegmentationRemoved:()=>s,triggerSegmentationRepresentationModified:()=>l,triggerSegmentationRepresentationRemoved:()=>d});var i=n(36814),a=n(70192),r=n(78378);function o(e){(0,a.Hl)(a.tX,r.sV.SEGMENTATION_MODIFIED,{segmentationId:e})}function s(e){(0,a.Hl)(a.tX,r.sV.SEGMENTATION_REMOVED,{segmentationId:e})}function l(e,t,n){(0,a.Hl)(a.tX,r.sV.SEGMENTATION_REPRESENTATION_MODIFIED,{segmentationId:t,type:n,viewportId:e})}function d(e,t,n){(0,a.Hl)(a.tX,r.sV.SEGMENTATION_REPRESENTATION_REMOVED,{viewportId:e,segmentationId:t,type:n})}},49963:(e,t,n)=>{"use strict";n.d(t,{Om:()=>m,Xd:()=>d,Xr:()=>u,Yc:()=>v,fA:()=>g,hs:()=>p,lw:()=>c,nu:()=>h,vt:()=>s,x8:()=>l});var i=n(97633),a=n(37843),r=n(50923),o=n(5434);function s(){var e=new i.tb(4);return i.tb!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function l(e,t,n){var i=Math.sin(n*=.5);return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=Math.cos(n),e}function d(e,t){var n=2*Math.acos(t[3]),a=Math.sin(n/2);return a>i.p8?(e[0]=t[0]/a,e[1]=t[1]/a,e[2]=t[2]/a):(e[0]=1,e[1]=0,e[2]=0),n}function c(e,t,n){var i=t[0],a=t[1],r=t[2],o=t[3],s=n[0],l=n[1],d=n[2],c=n[3];return e[0]=i*c+o*s+a*d-r*l,e[1]=a*c+o*l+r*s-i*d,e[2]=r*c+o*d+i*l-a*s,e[3]=o*c-i*s-a*l-r*d,e}function h(e,t,n,a){var r,o,s,l,d,c=t[0],h=t[1],u=t[2],g=t[3],p=n[0],m=n[1],f=n[2],v=n[3];return(o=c*p+h*m+u*f+g*v)<0&&(o=-o,p=-p,m=-m,f=-f,v=-v),1-o>i.p8?(s=Math.sin(r=Math.acos(o)),l=Math.sin((1-a)*r)/s,d=Math.sin(a*r)/s):(l=1-a,d=a),e[0]=l*c+d*p,e[1]=l*h+d*m,e[2]=l*u+d*f,e[3]=l*g+d*v,e}function u(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}o.o8;var g=o.fA;o.C,o.hZ,o.WQ;var p=o.hs,m=o.Om;o.Cc,o.Bw,o.m3;var f=o.S8;o.t2,o.aI;var v=function(){var e=r.vt(),t=r.fA(1,0,0),n=r.fA(0,1,0);return function(i,a,o){var s=r.Om(a,o);return s<-.999999?(r.$A(e,t,a),1e-6>r.Il(e)&&r.$A(e,n,a),r.S8(e,e),l(i,e,Math.PI),i):s>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(r.$A(e,a,o),i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=1+s,f(i,i))}}();s(),s(),a.create()},50923:(e,t,n)=>{"use strict";n.d(t,{$A:()=>M,Bw:()=>o,C:()=>l,DI:()=>C,Il:()=>R,Io:()=>I,LI:()=>m,Ln:()=>v,Om:()=>E,Re:()=>h,S8:()=>A,T9:()=>p,WQ:()=>c,Z0:()=>y,aI:()=>x,ei:()=>S,fA:()=>s,g7:()=>D,gL:()=>T,hG:()=>_,hZ:()=>d,hs:()=>f,jb:()=>L,jk:()=>g,lo:()=>O,lw:()=>u,m3:()=>w,o8:()=>r,t2:()=>k,v_:()=>P,vt:()=>a,xg:()=>V,ze:()=>b});var i=n(97633);function a(){var e=new i.tb(3);return i.tb!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function r(e){var t=new i.tb(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function o(e){return Math.hypot(e[0],e[1],e[2])}function s(e,t,n){var a=new i.tb(3);return a[0]=e,a[1]=t,a[2]=n,a}function l(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function d(e,t,n,i){return e[0]=t,e[1]=n,e[2]=i,e}function c(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function h(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function u(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}function g(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e}function p(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e}function m(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e}function f(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function v(e,t,n,i){return e[0]=t[0]+n[0]*i,e[1]=t[1]+n[1]*i,e[2]=t[2]+n[2]*i,e}function I(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2])}function _(e,t){var n=t[0]-e[0],i=t[1]-e[1],a=t[2]-e[2];return n*n+i*i+a*a}function w(e){var t=e[0],n=e[1],i=e[2];return t*t+n*n+i*i}function b(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function C(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function A(e,t){var n=t[0],i=t[1],a=t[2],r=n*n+i*i+a*a;return r>0&&(r=1/Math.sqrt(r)),e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function E(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function M(e,t,n){var i=t[0],a=t[1],r=t[2],o=n[0],s=n[1],l=n[2];return e[0]=a*l-r*s,e[1]=r*o-i*l,e[2]=i*s-a*o,e}function y(e,t,n){var i=t[0],a=t[1],r=t[2],o=n[3]*i+n[7]*a+n[11]*r+n[15];return o=o||1,e[0]=(n[0]*i+n[4]*a+n[8]*r+n[12])/o,e[1]=(n[1]*i+n[5]*a+n[9]*r+n[13])/o,e[2]=(n[2]*i+n[6]*a+n[10]*r+n[14])/o,e}function S(e,t,n){var i=t[0],a=t[1],r=t[2];return e[0]=i*n[0]+a*n[3]+r*n[6],e[1]=i*n[1]+a*n[4]+r*n[7],e[2]=i*n[2]+a*n[5]+r*n[8],e}function T(e,t,n){var i=n[0],a=n[1],r=n[2],o=n[3],s=t[0],l=t[1],d=t[2],c=a*d-r*l,h=r*s-i*d,u=i*l-a*s,g=a*u-r*h,p=r*c-i*u,m=i*h-a*c,f=2*o;return c*=f,h*=f,u*=f,g*=2,p*=2,m*=2,e[0]=s+c+g,e[1]=l+h+p,e[2]=d+u+m,e}function D(e,t){var n=e[0],i=e[1],a=e[2],r=t[0],o=t[1],s=t[2],l=Math.sqrt(n*n+i*i+a*a)*Math.sqrt(r*r+o*o+s*s);return Math.acos(Math.min(Math.max(l&&E(e,t)/l,-1),1))}function P(e){return e[0]=0,e[1]=0,e[2]=0,e}function k(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function x(e,t){var n=e[0],a=e[1],r=e[2],o=t[0],s=t[1],l=t[2];return Math.abs(n-o)<=i.p8*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(a-s)<=i.p8*Math.max(1,Math.abs(a),Math.abs(s))&&Math.abs(r-l)<=i.p8*Math.max(1,Math.abs(r),Math.abs(l))}var L=h,V=I,O=_,R=o;a()},51200:(e,t,n)=>{"use strict";n.d(t,{Ut:()=>r,ny:()=>o,r$:()=>a});var i=n(32207);function a(e,t={}){return i._6.getSegmentationRepresentations(e,t)}function r(e,t){let n=i._6;if(!t.segmentationId||!t.type)throw Error("getSegmentationRepresentation: No segmentationId or type provided, you need to provide at least one of them");let a=n.getSegmentationRepresentations(e,t);return a?.[0]}function o(e){return i._6.getSegmentationRepresentationsBySegmentationId(e)}},51302:(e,t,n)=>{"use strict";n.r(t),n.d(t,{distanceToPoint:()=>i.A,distanceToPointSquared:()=>a.A,distanceToPointSquaredInfo:()=>r.A,intersectLine:()=>o.A,isPointOnLineSegment:()=>s.A});var i=n(10458),a=n(19431),r=n(30983),o=n(16857),s=n(66644)},54310:(e,t,n)=>{"use strict";n.d(t,{u:()=>a});var i=n(32207);function a(){return i._6.getNextColorLUTIndex()}},54715:(e,t,n)=>{"use strict";n.d(t,{W:()=>function e(t){return null==t||"object"!=typeof t?t:Array.isArray(t)?t.map(t=>e(t)):function t(n){let i={};for(let[r,o]of Object.entries(n)){if(a.has(r)){let e=a.get(r);e&&(i[r]=e(r,o));continue}null==o||"object"!=typeof o?i[r]=o:Array.isArray(o)?i[r]=o.map(t=>e(t)):i[r]=t(o)}return i}(t)}});let{PointsManager:i}=n(70192).BF,a=new Map([["pointsInVolume",null],["projectionPoints",null],["contour",function(e,t){return null!=t&&"object"==typeof t&&"polyline"in t?{...t,polyline:null,pointsManager:i.create3(t.polyline.length,t.polyline)}:t}],["spline",null]])},55623:(e,t,n)=>{"use strict";n(89819)},57407:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var i=n(76722);function a(e,t,n,r,o,s={}){if(isNaN(r[0])||isNaN(r[1])||isNaN(o[0])||isNaN(o[1]))return;let{color:l,width:d,lineWidth:c,lineDash:h}=Object.assign({color:"rgb(0, 255, 0)",width:"2",lineWidth:void 0,lineDash:void 0},s),u=o[0]+(r[0]-o[0])/2,g=[u,r[1]],p=[u,o[1]];(0,i.A)(e,t,"1",r,g,{color:l,width:d,lineWidth:c,lineDash:h}),(0,i.A)(e,t,"2",g,p,{color:l,width:d,lineWidth:c,lineDash:h}),(0,i.A)(e,t,"3",p,o,{color:l,width:d,lineWidth:c,lineDash:h})}},60212:(e,t,n)=>{"use strict";n.d(t,{A:()=>o,t:()=>r});var i=n(70192),a=n(83409);function r(e){e.length&&e.forEach(e=>{let t=(0,i.yj)(e);if(!t)return void console.warn(`Viewport not available for ${e}`);let{viewport:n}=t;if(!n)return void console.warn(`Viewport not available for ${e}`);let r=n.element;(0,a.A)(r)})}let o=r},60332:(e,t,n)=>{"use strict";n.d(t,{dz:()=>i.A}),n(9538),n(94194),n(38094);var i=n(90734);n(55158),n(20832),n(71283),n(83101),n(74065),n(13026),n(66703),n(83603)},61034:(e,t,n)=>{"use strict";n.r(t),n.d(t,{fillInsideCircle:()=>a.kr,fillInsideRectangle:()=>i.pY,fillOutsideCircle:()=>a.N5,thresholdInsideRectangle:()=>i.VQ});var i=n(11420),a=n(11663)},61689:(e,t,n)=>{"use strict";n.d(t,{t:()=>a});var i=n(32207);function a(e,t){return i._6.updateLabelmapSegmentationImageReferences(e,t)}},63306:(e,t,n)=>{"use strict";n.d(t,{AL:()=>f,RZ:()=>u,Yo:()=>g,oN:()=>m,rK:()=>p});var i=n(70192),a=n(4546);n(33845);var r=n(74065),o=n(93022);n(36965);var s=n(76818);n(34699);var l=n(60212),d=n(34470),c=n(69548);n(42018);let h="PlanarFreehandContourSegmentationTool";function u(e,t){let n=e.length,i=Array(n);for(let a=0;a{let n=u(t.data.contour.polyline,e);return{annotation:t,polyline:n}})}function p(e,t,n){(0,o.addChildAnnotation)(t,n),(0,s.M)(n);let{contour:i}=n.data,l=u(i.polyline,e);(0,r.A)(n,{points:l,closed:i.closed,targetWindingDirection:t.data.contour.windingDirection===a.W.Clockwise?a.W.CounterClockwise:a.W.Clockwise},e);let{element:d}=e;f(e,[t,n])}function m(e,t,n,o=a.W.Clockwise){let s=e.canvasToWorld(n[0]),l=e.canvasToWorld(n[n.length-1]),d={metadata:{...t.metadata,toolName:h,originalToolName:t.metadata.originalToolName||t.metadata.toolName},data:{cachedStats:{},handles:{points:[s,l],textBox:t.data.handles.textBox?{...t.data.handles.textBox}:void 0},contour:{polyline:[],closed:!0},spline:t.data.spline,segmentation:{...t.data.segmentation}},annotationUID:i.BF.uuidv4(),highlighted:!0,invalidated:!0,isLocked:!1,isVisible:void 0,interpolationUID:t.interpolationUID,interpolationCompleted:t.interpolationCompleted};return(0,r.A)(d,{points:n,closed:!0,targetWindingDirection:o},e),d}function f(e,t){let{element:n}=e,i=new Set([h]);for(let e of(t.forEach(e=>{i.add(e.metadata.toolName)}),i.values()))if((0,c.l$)(e)){let t=(0,d.Q0)(n,e);(0,l.A)(t)}}},64029:(e,t,n)=>{"use strict";n.d(t,{_:()=>o});var i=n(70192),a=n(83409),r=n(42306);function o(e){e.forEach(e=>{let t=(0,r.getToolGroup)(e);if(!t)return void console.warn(`ToolGroup not available for ${e}`);t.getViewportsInfo().forEach(e=>{let{renderingEngineId:t,viewportId:n}=e,r=(0,i.lD)(t);if(!r)return void console.warn(`RenderingEngine not available for ${t}`);let o=r.getViewport(n);(0,a.A)(o.element)})})}},64054:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{bindSnapshot:function(){return o},createAsyncLocalStorage:function(){return r},createSnapshot:function(){return s}});let n=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class i{disable(){throw n}getStore(){}run(){throw n}exit(){throw n}enterWith(){throw n}static bind(e){return e}}let a="undefined"!=typeof globalThis&&globalThis.AsyncLocalStorage;function r(){return a?new a:new i}function o(e){return a?a.bind(e):i.bind(e)}function s(){return a?a.snapshot():function(e,...t){return e(...t)}}},65509:(e,t,n)=>{"use strict";n.d(t,{$n:()=>d,AD:()=>l,BS:()=>u,Hs:()=>o,M4:()=>h,kL:()=>c,m:()=>s});var i=n(70192),a=n(18236),r=n(4849);function o(e,t){return(0,a.uk)(e)?.labelmaps?.[t]}function s(e){let t=(0,a.uk)(e);return t?Object.values(t.labelmaps):[]}function l(e,t){let n=(0,a.uk)(e);n&&(n.labelmaps[t.labelmapId]=t)}function d(e,t){let n=(0,a.uk)(e);if(!n)return;let r=n.labelmaps[t];r?.geometryVolumeId&&i.PP.getVolume(r.geometryVolumeId)&&i.PP.removeVolumeLoadObject(r.geometryVolumeId),delete n.labelmaps[t]}function c(e){let t=function(e){var t;if(e.volumeId||(t=e,!(0,r.dm)(t)))return;let n=e.geometryVolumeId??`${e.labelmapId}-geometry`,a=i.PP.getVolume(n);if(a)return a;let o=new Map;(0,r.Zd)(e,(e,t)=>{let n=o.get(e)??[];n.push(t),o.set(e,n)});let s=Array.from(o.keys());if(!s.length)return;let l=0,d=i.R2.createAndCacheDerivedImages(s,{getDerivedImageId:()=>`${n}-image-${l++}`,targetBuffer:{type:"Uint8Array"}});return d.forEach(e=>{let t=o.get(e.referencedImageId);if(!t?.length)return;let n=e.voxelManager,a=n.getScalarDataLength();t.forEach(e=>{let t=i.PP.getImage(e),r=t?.voxelManager;if(!r)return;let o=Math.min(a,r.getScalarDataLength());for(let e=0;ee.imageId))}(e);if(t)return t;let n=e.volumeId??e.geometryVolumeId;if(n){let e=i.PP.getVolume(n);if(e)return e}let a=e.imageIds??[];if(!a.length)return;let o=e.volumeId??e.geometryVolumeId??`${e.labelmapId}-geometry`;e.volumeId||(e.geometryVolumeId=o);let s=i.PP.getVolume(o);return s||i.UH.createAndCacheVolumeFromImagesSync(o,a)}function h(e,t){return s(e).find(e=>e.imageIds?.includes(t))}function u(e,t){return s(e).find(e=>e.volumeId===t||e.geometryVolumeId===t)}},65947:(e,t,n)=>{"use strict";n.d(t,{B:()=>a});var i=n(32207);function a(e){return i._6.getColorLUT(e)}},66442:(e,t,n)=>{"use strict";n.d(t,{BS:()=>i.BS,Hs:()=>i.Hs,M4:()=>i.M4,Mx:()=>i.Mx,Nf:()=>i.Nf,Pi:()=>i.Pi,Qk:()=>i.Qk,Ry:()=>i.Ry,VQ:()=>i.VQ,Zs:()=>i.Zs,hM:()=>i.hM,kL:()=>i.kL,m:()=>i.m,r:()=>i.r,uk:()=>i.uk,xS:()=>i.xS});var i=n(69301)},66703:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var i=n(70192),a=n(50923);let{isEqual:r}=i.BF;function o(e,t){let{polyline:n}=e.data.contour,{points:i}=e.data.handles,{length:o}=i;if(t===o)return n.length;if(t<0&&(t=(t+o)%o),0===t)return 0;let s=i[t],l=n.findIndex(e=>r(s,e));if(-1!==l)return l;let d=1/0;return n.reduce((e,t,n)=>{let i=a.hG(t,s);return i{"use strict";n.d(t,{QV:()=>i.A}),n(54268);var i=n(94302);n(74885),n(59408),n(31377)},67358:(e,t,n)=>{"use strict";n.d(t,{A:()=>l,a:()=>i});var i,a=n(70192),r=n(49185);let{RLEVoxelMap:o,VoxelManager:s}=a.BF;!function(e){e[e.SEGMENT=-1]="SEGMENT",e[e.ISLAND=-2]="ISLAND",e[e.INTERIOR=-3]="INTERIOR",e[e.EXTERIOR=-4]="EXTERIOR",e[e.INTERIOR_SMALL=-5]="INTERIOR_SMALL",e[e.INTERIOR_TEST=-6]="INTERIOR_TEST"}(i||(i={}));class l{constructor(e){this.fillInternalEdge=!1,this.maxInternalRemove=128,this.maxInternalRemove=e?.maxInternalRemove??this.maxInternalRemove,this.fillInternalEdge=e?.fillInternalEdge??this.fillInternalEdge}initialize(e,t,n){let a=!!t.sourceVoxelManager,l=a?t.sourceVoxelManager:t,d=a?t:s.createRLEHistoryVoxelManager(l),{segmentIndex:c=1,previewSegmentIndex:h=1}=n,u=n.points||l.getPoints();if(!u?.length)return;let g=l.getBoundsIJK().map((e,t)=>[Math.min(e[0],...u.map(e=>e[t])),Math.max(e[1],...u.map(e=>e[t]))]);if(g.find(e=>e[0]<0||e[1]>65535))return;let{toIJK:p,fromIJK:m,boundsIJKPrime:f,error:v}=(0,r.A)(e,g);if(v)return void console.warn("Not performing island removal for planes not orthogonal to acquisition plane",v);let[I,_,w]=m(l.dimensions),b=new o(I,_,w);return b.fillFrom((e,t,n)=>{let a=l.toIndex(p([e,t,n])),r=l.getAtIndex(a);if(r===h||r===c)return i.SEGMENT},f),b.normalizer={toIJK:p,fromIJK:m,boundsIJKPrime:f},this.segmentSet=b,this.previewVoxelManager=d,this.segmentIndex=c,this.previewSegmentIndex=h??c,this.selectedPoints=u,!0}floodFillSegmentIsland(){let{selectedPoints:e,segmentSet:t}=this,n=0,{fromIJK:a}=t.normalizer;return e.forEach(e=>{let r=a(e),o=t.toIndex(r),[s,l,d]=r;t.get(o)===i.SEGMENT&&(n+=t.floodFill(s,l,d,i.ISLAND))}),n}removeExternalIslands(){let{previewVoxelManager:e,segmentSet:t}=this,{toIJK:n}=t.normalizer;t.forEach((a,r)=>{let[,o,s]=t.toIJK(a);if(r.value!==i.ISLAND)for(let t=r.start;t{let a;for(let r of[...n])if(r.value===i.ISLAND){if(!a){if(this.fillInternalEdge&&r.start>0)for(let n=0;n{if(n.value!==i.INTERIOR)return;let[,r,o]=e.toIJK(t),s=r>0?e.getRun(r-1,o):null,d=r+12)||u&&g||e.floodFill(n.start,r,o,i.EXTERIOR,{singlePlane:!0})}),e.forEach((t,n)=>{if(n.value!==i.INTERIOR)return;let[,a,r]=e.toIJK(t),o=e.floodFill(n.start,a,r,i.INTERIOR_TEST)>this.maxInternalRemove?i.EXTERIOR:i.INTERIOR_SMALL;e.floodFill(n.start,a,r,o)}),e.forEach((a,r)=>{if(r.value===i.INTERIOR_SMALL)for(let i=r.start;i=e.start&&n=i)return!0;return!1}}},67368:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>M});var i=n(17042),a=n(99298),r=n(628),o=n(56929),s=n(68916),l=n(34839),d=n(64125),c=n(1537),h=n(71836),u=n(72288),g=n(39536),{vtkDebugMacro:p,vtkErrorMacro:m}=i.Ay,f={position:"absolute",top:0,left:0,width:"100%",height:"100%"},v=["activateTexture","deactivateTexture","disableCullFace","enableCullFace","setCullFaceMode","get3DContext","getActiveFramebuffer","getContext","getDefaultTextureByteSize","getDefaultTextureInternalFormat","getDefaultToWebgl2","getGLInformations","getGraphicsMemoryInfo","getGraphicsResourceForObject","getHardwareMaximumLineWidth","getPixelData","getShaderCache","getTextureUnitForTexture","getTextureUnitManager","getWebgl2","makeCurrent","releaseGraphicsResources","registerGraphicsResourceUser","unregisterGraphicsResourceUser","restoreContext","setActiveFramebuffer","setContext","setDefaultToWebgl2","setGraphicsResourceForObject"];function I(e,t,n){let i=e.createFramebuffer(),a=e.createTexture();e.bindTexture(e.TEXTURE_2D,a),e.texImage2D(e.TEXTURE_2D,0,t,2,2,0,t,n,null),e.bindFramebuffer(e.FRAMEBUFFER,i),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,a,0);let r=e.checkFramebufferStatus(e.FRAMEBUFFER);return e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null),r===e.FRAMEBUFFER_COMPLETE}var _=0,w=[];function b(e){e.preventDefault()}var C={cullFaceEnabled:!1,cullFaceMode:null,shaderCache:null,initialized:!1,context:null,context2D:null,canvas:null,cursorVisibility:!0,cursor:"pointer",textureUnitManager:null,textureResourceIds:null,containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,webgl2:!1,defaultToWebgl2:!0,activeFramebuffer:null,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1};function A(e,t,n={}){Object.assign(t,C,n),u.Ay.extend(e,t,n),t.canvas||(t.canvas=document.createElement("canvas"),t.canvas.style.width="100%"),t.selector||(t.selector=d.Ay.newInstance(),t.selector.setOpenGLRenderWindow(e)),t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",t._textureResourceIds=new Map,t._graphicsResources=new Map,t._glInformation=null,t.myFactory=o.Ay.newInstance(),t.shaderCache=c.Ay.newInstance(),t.shaderCache.setOpenGLRenderWindow(e),t.renderPasses[0]=l.Ay.newInstance(),i.Ay.get(e,t,["shaderCache","textureUnitManager","webgl2","useBackgroundImage","activeFramebuffer","rootOpenGLRenderWindow"]),i.Ay.setGet(e,t,["initialized","context","context2D","canvas","renderPasses","notifyStartCaptureImage","defaultToWebgl2","cursor","useOffScreen"]),i.Ay.setGetArray(e,t,["size"],2),i.Ay.event(e,t,"imageReady"),i.Ay.event(e,t,"windowResizeEvent"),function(e,t){let n,r;t.classHierarchy.push("vtkOpenGLRenderWindow"),e.getViewNodeFactory=()=>t.myFactory,t.canvas.addEventListener("webglcontextlost",b,!1),t.canvas.addEventListener("webglcontextrestored",e.restoreContext,!1);let o=[0,0];e.onModified(function(){t.renderable&&(t.size[0]!==o[0]||t.size[1]!==o[1])&&(o[0]=t.size[0],o[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1])),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null}),e.buildPass=n=>{n&&t.renderable&&(e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.addMissingNodes(t.renderable.getChildRenderWindowsByReference()),e.removeUnusedNodes(),e.initialize(),t.children.forEach(t=>{t.setOpenGLRenderWindow?.(e)}))},e.initialize=()=>{if(!t.initialized){if(t.rootOpenGLRenderWindow=e.getLastAncestorOfType("vtkOpenGLRenderWindow"),t.rootOpenGLRenderWindow)t.context2D=e.get2DContext();else{t.context=e.get3DContext(),e.resizeFromChildRenderWindows(),t.context&&(_++,w.forEach(e=>e(_))),t.textureUnitManager=h.Ay.newInstance(),t.textureUnitManager.setContext(t.context),t.shaderCache.setContext(t.context);let n=t.context;n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),n.depthFunc(n.LEQUAL),n.enable(n.BLEND)}t.initialized=!0}},e.makeCurrent=()=>{t.context.makeCurrent()},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&m("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){let{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.activeFramebuffer?.getSize()||t.size,e.getPixelData=(e,n,i,a)=>{let r=new Uint8Array((i-e+1)*(a-n+1)*4);return t.context.readPixels(e,n,i-e+1,a-n+1,t.context.RGBA,t.context.UNSIGNED_BYTE,r),r},e.get3DContext=(e={preserveDrawingBuffer:!1,depth:!0,alpha:!0,powerPreference:"high-performance"})=>{let i=null,a="undefined"!=typeof WebGL2RenderingContext;return t.webgl2=!1,t.defaultToWebgl2&&a&&(i=t.canvas.getContext("webgl2",e))&&(t.webgl2=!0,p("using webgl2")),i||(p("using webgl1"),i=t.canvas.getContext("webgl",e)||t.canvas.getContext("experimental-webgl",e)),i||m("no webgl context"),new Proxy(i,(!n&&(n=(0,g.gJ)()),n))},e.get2DContext=(e={})=>t.canvas.getContext("2d",e),e.restoreContext=()=>{let t=s.Ay.newInstance();t.setCurrentOperation("Release"),t.traverse(e,null)},e.activateTexture=n=>{let i=t._textureResourceIds.get(n);if(void 0!==i)return void t.context.activeTexture(t.context.TEXTURE0+i);let a=e.getTextureUnitManager().allocate();if(a<0)return void m("Hardware does not support the number of textures defined.");t._textureResourceIds.set(n,a),t.context.activeTexture(t.context.TEXTURE0+a)},e.deactivateTexture=n=>{let i=t._textureResourceIds.get(n);void 0!==i&&(e.getTextureUnitManager().free(i),t._textureResourceIds.delete(n))},e.getTextureUnitForTexture=e=>{let n=t._textureResourceIds.get(e);return void 0!==n?n:-1},e.getDefaultTextureByteSize=(e,n=null,i=!1)=>{if(t.webgl2)switch(e){case a.JA.CHAR:case a.JA.SIGNED_CHAR:case a.JA.UNSIGNED_CHAR:break;case n:case i:case a.JA.UNSIGNED_SHORT:case a.JA.SHORT:case a.JA.VOID:return 2;default:return 4}return 1},e.getDefaultTextureInternalFormat=(e,n,i=null,r=!1)=>{if(t.webgl2)switch(e){case a.JA.UNSIGNED_CHAR:switch(n){case 1:return t.context.R8;case 2:return t.context.RG8;case 3:return t.context.RGB8;default:return t.context.RGBA8}case i&&!r&&a.JA.UNSIGNED_SHORT:switch(n){case 1:return i.R16_EXT;case 2:return i.RG16_EXT;case 3:return i.RGB16_EXT;default:return i.RGBA16_EXT}case i&&!r&&a.JA.SHORT:switch(n){case 1:return i.R16_SNORM_EXT;case 2:return i.RG16_SNORM_EXT;case 3:return i.RGB16_SNORM_EXT;default:return i.RGBA16_SNORM_EXT}case a.JA.UNSIGNED_SHORT:case a.JA.SHORT:case a.JA.FLOAT:default:switch(n){case 1:return r?t.context.R16F:t.context.R32F;case 2:return r?t.context.RG16F:t.context.RG32F;case 3:return r?t.context.RGB16F:t.context.RGB32F;default:return r?t.context.RGBA16F:t.context.RGBA32F}}switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:return t.context.RGB;default:return t.context.RGBA}},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=(n="image/png",{resetCamera:i=!1,size:a=null,scale:r=1}={})=>{if(t.deleted)return null;t.imageFormat=n;let o=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:a||1!==r?a||t.size.map(e=>e*r):null},new Promise((n,a)=>{let r=e.onImageReady(a=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=o,r.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach(({restoreParamsFn:e,arg:t})=>e(t)),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(a);else{let n=document.createElement("img");if(n.style=f,n.src=a,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t.rootOpenGLRenderWindow?.resizeFromChildRenderWindows(),t._screenshot.size=null,e.modified(),i){let e=!0!==i;t._screenshot.cameras=t.renderable.getRenderers().map(t=>{let n=t.getActiveCamera(),a=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?i:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(a))}}),t._screenshot.cameras.forEach(({resetCameraFn:e,resetCameraArgs:t})=>e(t))}e.traverseAllPasses()}})})},e.getHardwareMaximumLineWidth=()=>{if(null!=r)return r;let t=e.get3DContext(),n=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE);return r=n[1],n[1]},e.getGLInformations=()=>{if(t._glInformation)return t._glInformation;let n=e.get3DContext(),i=n.getExtension("OES_texture_float"),a=n.getExtension("OES_texture_half_float"),r=n.getExtension("WEBGL_debug_renderer_info"),o=n.getExtension("WEBGL_draw_buffers"),s=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),l=[["Max Vertex Attributes","MAX_VERTEX_ATTRIBS",n.getParameter(n.MAX_VERTEX_ATTRIBS)],["Max Varying Vectors","MAX_VARYING_VECTORS",n.getParameter(n.MAX_VARYING_VECTORS)],["Max Vertex Uniform Vectors","MAX_VERTEX_UNIFORM_VECTORS",n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS)],["Max Fragment Uniform Vectors","MAX_FRAGMENT_UNIFORM_VECTORS",n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS)],["Max Fragment Texture Image Units","MAX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)],["Max Vertex Texture Image Units","MAX_VERTEX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)],["Max Combined Texture Image Units","MAX_COMBINED_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS)],["Max 2D Texture Size","MAX_TEXTURE_SIZE",n.getParameter(n.MAX_TEXTURE_SIZE)],["Max Cube Texture Size","MAX_CUBE_MAP_TEXTURE_SIZE",n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE)],["Max Texture Anisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT",s&&n.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT)],["Point Size Range","ALIASED_POINT_SIZE_RANGE",n.getParameter(n.ALIASED_POINT_SIZE_RANGE).join(" - ")],["Line Width Range","ALIASED_LINE_WIDTH_RANGE",n.getParameter(n.ALIASED_LINE_WIDTH_RANGE).join(" - ")],["Max Viewport Dimensions","MAX_VIEWPORT_DIMS",n.getParameter(n.MAX_VIEWPORT_DIMS).join(" - ")],["Max Renderbuffer Size","MAX_RENDERBUFFER_SIZE",n.getParameter(n.MAX_RENDERBUFFER_SIZE)],["Framebuffer Red Bits","RED_BITS",n.getParameter(n.RED_BITS)],["Framebuffer Green Bits","GREEN_BITS",n.getParameter(n.GREEN_BITS)],["Framebuffer Blue Bits","BLUE_BITS",n.getParameter(n.BLUE_BITS)],["Framebuffer Alpha Bits","ALPHA_BITS",n.getParameter(n.ALPHA_BITS)],["Framebuffer Depth Bits","DEPTH_BITS",n.getParameter(n.DEPTH_BITS)],["Framebuffer Stencil Bits","STENCIL_BITS",n.getParameter(n.STENCIL_BITS)],["Framebuffer Subpixel Bits","SUBPIXEL_BITS",n.getParameter(n.SUBPIXEL_BITS)],["MSAA Samples","SAMPLES",n.getParameter(n.SAMPLES)],["MSAA Sample Buffers","SAMPLE_BUFFERS",n.getParameter(n.SAMPLE_BUFFERS)],["Supported Formats for UByte Render Targets ","UNSIGNED_BYTE RENDER TARGET FORMATS",[i&&I(n,n.RGBA,n.UNSIGNED_BYTE)?"RGBA":"",i&&I(n,n.RGB,n.UNSIGNED_BYTE)?"RGB":"",i&&I(n,n.LUMINANCE,n.UNSIGNED_BYTE)?"LUMINANCE":"",i&&I(n,n.ALPHA,n.UNSIGNED_BYTE)?"ALPHA":"",i&&I(n,n.LUMINANCE_ALPHA,n.UNSIGNED_BYTE)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Half Float Render Targets","HALF FLOAT RENDER TARGET FORMATS",[a&&I(n,n.RGBA,a.HALF_FLOAT_OES)?"RGBA":"",a&&I(n,n.RGB,a.HALF_FLOAT_OES)?"RGB":"",a&&I(n,n.LUMINANCE,a.HALF_FLOAT_OES)?"LUMINANCE":"",a&&I(n,n.ALPHA,a.HALF_FLOAT_OES)?"ALPHA":"",a&&I(n,n.LUMINANCE_ALPHA,a.HALF_FLOAT_OES)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Full Float Render Targets","FLOAT RENDER TARGET FORMATS",[i&&I(n,n.RGBA,n.FLOAT)?"RGBA":"",i&&I(n,n.RGB,n.FLOAT)?"RGB":"",i&&I(n,n.LUMINANCE,n.FLOAT)?"LUMINANCE":"",i&&I(n,n.ALPHA,n.FLOAT)?"ALPHA":"",i&&I(n,n.LUMINANCE_ALPHA,n.FLOAT)?"LUMINANCE_ALPHA":""].join(" ")],["Max Multiple Render Targets Buffers","MAX_DRAW_BUFFERS_WEBGL",o?n.getParameter(o.MAX_DRAW_BUFFERS_WEBGL):0],["High Float Precision in Vertex Shader","HIGH_FLOAT VERTEX_SHADER",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision+" (-2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMax+")"],["Medium Float Precision in Vertex Shader","MEDIUM_FLOAT VERTEX_SHADER",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision+" (-2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMax+")"],["Low Float Precision in Vertex Shader","LOW_FLOAT VERTEX_SHADER",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).precision+" (-2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMax+")"],["High Float Precision in Fragment Shader","HIGH_FLOAT FRAGMENT_SHADER",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision+" (-2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMax+")"],["Medium Float Precision in Fragment Shader","MEDIUM_FLOAT FRAGMENT_SHADER",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision+" (-2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMax+")"],["Low Float Precision in Fragment Shader","LOW_FLOAT FRAGMENT_SHADER",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).precision+" (-2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMax+")"],["High Int Precision in Vertex Shader","HIGH_INT VERTEX_SHADER",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).precision+" (-2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMax+")"],["Medium Int Precision in Vertex Shader","MEDIUM_INT VERTEX_SHADER",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).precision+" (-2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMax+")"],["Low Int Precision in Vertex Shader","LOW_INT VERTEX_SHADER",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).precision+" (-2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMax+")"],["High Int Precision in Fragment Shader","HIGH_INT FRAGMENT_SHADER",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).precision+" (-2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMax+")"],["Medium Int Precision in Fragment Shader","MEDIUM_INT FRAGMENT_SHADER",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).precision+" (-2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMax+")"],["Low Int Precision in Fragment Shader","LOW_INT FRAGMENT_SHADER",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).precision+" (-2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMax+")"],["Supported Extensions","EXTENSIONS",n.getSupportedExtensions().join("
")],["WebGL Renderer","RENDERER",n.getParameter(n.RENDERER)],["WebGL Vendor","VENDOR",n.getParameter(n.VENDOR)],["WebGL Version","VERSION",n.getParameter(n.VERSION)],["Shading Language Version","SHADING_LANGUAGE_VERSION",n.getParameter(n.SHADING_LANGUAGE_VERSION)],["Unmasked Renderer","UNMASKED_RENDERER",r&&n.getParameter(r.UNMASKED_RENDERER_WEBGL)],["Unmasked Vendor","UNMASKED_VENDOR",r&&n.getParameter(r.UNMASKED_VENDOR_WEBGL)],["WebGL Version","WEBGL_VERSION",t.webgl2?2:1]],d={};for(;l.length;){let[e,t,n]=l.pop();t&&(d[t]={label:e,value:n})}return t._glInformation=d,d},e.traverseAllPasses=()=>{if(t.renderPasses)for(let n=0;n{e.getViewProps().forEach(e=>{if(e.getContainer){let t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{let e=t.rootOpenGLRenderWindow;if(!e||!t.context2D||t.children.some(e=>!!e.getSelector?.()))return;let n=e.getCanvas(),i=t.canvas;t.context2D.drawImage(n,0,n.height-i.height,i.width,i.height,0,0,i.width,i.height)},e.resizeFromChildRenderWindows=()=>{let n=t.renderable.getChildRenderWindowsByReference();if(n.length>0){let t=[0,0];for(let i=0;it[0]?a[0]:t[0],t[1]=a[1]>t[1]?a[1]:t[1])}e.setSize(...t)}},e.disableCullFace=()=>{t.cullFaceEnabled&&(t.context.disable(t.context.CULL_FACE),t.cullFaceEnabled=!1)},e.enableCullFace=()=>{t.cullFaceEnabled||(t.context.enable(t.context.CULL_FACE),t.cullFaceEnabled=!0)},e.setCullFaceMode=e=>{t.cullFaceMode!==e&&(t.context.cullFace(e),t.cullFaceMode=e)},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady(t=>e.setBackgroundImage(t.image)),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.createSelector=()=>{let t=d.Ay.newInstance();return t.setOpenGLRenderWindow(e),t},e.delete=i.Ay.chain(()=>{t.context&&(_--,w.forEach(e=>e(_))),e.setContainer(),e.setViewStream()},function(){t.canvas.removeEventListener("webglcontextlost",b),t.canvas.removeEventListener("webglcontextrestored",e.restoreContext)},e.delete),e.setActiveFramebuffer=e=>{t.activeFramebuffer=e};let l=e.setSize;e.setSize=(t,n)=>{let i=l(t,n);return i&&e.invokeWindowResizeEvent({width:t,height:n}),i},e.registerGraphicsResourceUser=(n,i)=>{t._graphicsResources.has(n)||e.setGraphicsResourceForObject(n,null,null),t._graphicsResources.get(n)?.users.add(i)},e.unregisterGraphicsResourceUser=(n,i)=>{let a=t._graphicsResources.get(n);a&&(a.users.delete(i),a.users.size||(a.oglObject?.releaseGraphicsResources(e),t._graphicsResources.delete(n)))},e.getGraphicsResourceForObject=e=>t._graphicsResources.get(e),e.setGraphicsResourceForObject=(n,i,a)=>{if(!n)return;let r=t._graphicsResources.get(n);r?.oglObject?.releaseGraphicsResources(e),t._graphicsResources.set(n,{coreObject:n,oglObject:i,hash:a,users:r?.users??new Set})},e.getGraphicsMemoryInfo=()=>{let e=0;return t._graphicsResources.forEach(({oglObject:t})=>{e+=t.getAllocatedGPUMemoryInBytes()}),e},e.releaseGraphicsResources=()=>{null!==t.shaderCache&&t.shaderCache.releaseGraphicsResources(e),t._graphicsResources.forEach(({oglObject:t})=>{t.releaseGraphicsResources(e)}),t._graphicsResources.clear(),null!==t.textureUnitManager&&t.textureUnitManager.freeAll(),t.renderable.getRenderersByReference().forEach(t=>{e.getViewNodeFor(t)?.releaseGraphicsResources()})};let c={...e};v.forEach(n=>{e[n]=(...e)=>t.rootOpenGLRenderWindow?t.rootOpenGLRenderWindow[n](...e):c[n](...e)})}(e,t)}var E=i.Ay.newInstance(A,"vtkOpenGLRenderWindow");(0,r.p$)("WebGL",E);var M={newInstance:E,extend:A,pushMonitorGLContextCount:function(e){w.push(e)},popMonitorGLContextCount:function(e){return w.pop()}};(0,o.c9)("vtkRenderWindow",E)},67909:(e,t,n)=>{"use strict";n.d(t,{default:()=>a.a});var i=n(86278),a=n.n(i)},69301:(e,t,n)=>{"use strict";n.d(t,{BS:()=>a.BS,Hs:()=>a.Hs,Lp:()=>l.A,M4:()=>a.M4,Mx:()=>o.Mx,Nf:()=>o.Nf,Pi:()=>o.Pi,Qk:()=>s.Qk,Ry:()=>s.Ry,VQ:()=>s.VQ,Zs:()=>o.Zs,hM:()=>o.hM,kL:()=>a.kL,m:()=>a.m,r:()=>o.r,uk:()=>i.uk,xS:()=>r.x});var i=n(18236),a=n(65509),r=n(76399),o=n(40454);n(37406);var s=n(26221),l=n(82875)},70192:(e,t,n)=>{"use strict";n.d(t,{T7:()=>J.T,ei:()=>x.A,Jj:()=>a,Sm:()=>L.A,p8:()=>p.p8,fX:()=>i,QV:()=>V.QV,vR:()=>P,wB:()=>W,hS:()=>C.A,PX:()=>b.A,x:()=>D.x,PP:()=>O.Ay,J_:()=>q.J,hA:()=>k.h,tX:()=>c.A,D0:()=>r.D0,kJ:()=>N.Ay,b1:()=>N.b1,yj:()=>N.yj,zb:()=>N.zb,lD:()=>w.lD,qO:()=>w.qO,LH:()=>r.LH,G_:()=>r.G_,lR:()=>R.A,R2:()=>j,Ts:()=>r.Ts,wx:()=>U,Hl:()=>h.A,BF:()=>Q,sv:()=>A.sv,qV:()=>A.qV,g6:()=>A.g6,UH:()=>Y});var i=n(77280),a=n(79267),r=n(42215),o=n(32916),s=n(13032),l=n(41092),d=n(76879),c=n(3922),h=n(69228),u=n(56872),g=n(35881),p=n(72661),m=n(8605),f=n(42684),v=n(66384);class I extends s.A{constructor(e){super(e),this._renderFlaggedViewports=()=>{this._throwIfDestroyed();let e=this._getViewportsAsArray().filter(e=>this._needsRender.has(e.id));if(0===e.length){this._animationFrameSet=!1,this._animationFrameHandle=null;return}let t=e.map(e=>{let t=this.renderViewportUsingCustomOrVtkPipeline(e);return e.setRendered(),this._needsRender.delete(e.id),t});this._animationFrameSet=!1,this._animationFrameHandle=null,t.forEach(e=>{e?.element&&(0,h.A)(e.element,d.A.IMAGE_RENDERED,e)})},this.useCPURendering||this.ensureContextPool()}ensureContextPool(){if(!this.contextPool){let{rendering:e}=(0,r.D0)(),{webGlContextCount:t}=e;this.contextPool=new l.A(t,this.id)}return this.contextPool}enableVTKjsDrivenViewport(e){let t=this._getViewportsAsArray().filter(e=>!1===(0,g.A)(e.type)).map(e=>e.canvas),n=(0,p.Ay)(e.element);(0,p.zV)(n),t.push(n);let i={...e,canvas:n};this.addVtkjsDrivenViewport(i)}addVtkjsDrivenViewport(e){let t=this.ensureContextPool(),{element:n,canvas:i,viewportId:a,type:r,defaultOptions:o}=e;n.tabIndex=-1,(0,m.u)(n);let s=0;if(r===u.A.STACK){let e=t.getAllContexts();s=this._viewports.size%e.length}t.assignViewportToContext(a,s),t.updateViewportSize(a,i.width,i.height);let{context:l,container:g}=t.getContextByIndex(s),p=t.getMaxSizeForContext(s);g.width=p.width,g.height=p.height,l.resize(),l.addRenderer({viewport:[0,0,1,1],id:a,background:o.background?o.background:[0,0,0]});let v={id:a,element:n,renderingEngineId:this.id,type:r,canvas:i,sx:0,sy:0,sWidth:i.width,sHeight:i.height,defaultOptions:o||{}},I=(0,f.aZ)(e);if(!I)throw Error(`Viewport Type ${r} is not supported`);let _=new I(v);_.requestedType=e.requestedType??r,this._viewports.set(a,_);let w={element:n,viewportId:a,renderingEngineId:this.id};_.suppressEvents||(0,h.A)(c.A,d.A.ELEMENT_ENABLED,w)}setVtkjsDrivenViewports(e){if(e.length){let t=e.map(e=>(0,p.Ay)(e.element));t.forEach(e=>(0,p.zV)(e));for(let n=0;n{if(e.resize?.(),(0,v.oX)(e))return;let n=e.getCamera(),i=e.getRotation?.()??0,{flipHorizontal:a}=n;e.resetViewStateForResize?e.resetViewStateForResize():e.resetCameraForResize?.();let r=e.getDisplayArea();t&&(r?(a&&e.setCamera({flipHorizontal:a}),i&&e.setViewPresentation({rotation:i})):e.setCamera(n))}),n&&this.render())}}renderViewportUsingCustomOrVtkPipeline(e){if((0,g.q)(e))return e.customRenderViewportToCanvas();if(!this.contextPool)throw Error("GPU not available, and using a viewport with no custom render pipeline.");let t=this.contextPool.getContextIndexForViewport(e.id),{context:n,container:i}=this.contextPool.getContextByIndex(t);return this._renderViewportWithContext(e,n,i)}_renderViewportWithContext(e,t,n){if(0===e.canvas.clientWidth||0===e.canvas.clientHeight)return;if(e.sWidth{let i=n.split("::")[0];t.setDraw(i===e.id)});let v=this.getWidgetRenderers();v.forEach((t,n)=>{n.setDraw(t===e.id)}),i.render(),f.forEach(({renderer:e})=>e.setDraw(!1)),v.forEach((e,t)=>{t.setDraw(!1)}),r&&a.setRenderPasses(r);let I=t.getOpenGLRenderWindow().get3DContext().canvas;return this._copyToOnscreenCanvas(e,I)}_renderViewportFromVtkCanvasToOnscreenCanvas(e,t){return this._copyToOnscreenCanvas(e,t)}_resizeOffScreenCanvasForViewport(e,t,n){let i=this.contextPool.getContextIndexForViewport(e.id);if(void 0===i||!this.contextPool.updateViewportSize(e.id,e.sWidth,e.sHeight))return;let a=this.contextPool.getMaxSizeForContext(i);(t.width!==a.width||t.height!==a.height)&&(t.width=a.width,t.height=a.height,n.resize())}_copyToOnscreenCanvas(e,t){let{element:n,canvas:i,id:a,renderingEngineId:r,suppressEvents:o}=e,s=e.sWidth,l=e.sHeight;(0,p.zV)(i,{width:s,height:l});let d=i.getContext("2d"),c=this.contextPool.getContextIndexForViewport(a),h=this.contextPool.getMaxSizeForContext(c).height-l;return d.drawImage(t,0,h,s,l,0,0,s,l),{element:n,suppressEvents:o,viewportId:a,renderingEngineId:r,viewportStatus:e.viewportStatus}}_resize(e){let t=new Set;for(let n of e){n.sx=0,n.sy=0;let e=this.contextPool.getContextIndexForViewport(n.id);this.contextPool.updateViewportSize(n.id,n.sWidth,n.sHeight)&&t.add(e);let{context:i}=this.contextPool.getContextByIndex(e),a=i.getRenderer(n.id),r=this.contextPool.getMaxSizeForContext(e),o=Math.min(1,n.sWidth/r.width),s=Math.min(1,n.sHeight/r.height);a.setViewport(0,0,o,s)}t.forEach(e=>{let t=this.contextPool.getContextByIndex(e);if(t){let{context:n,container:i}=t,a=this.contextPool.getMaxSizeForContext(e);i.width=a.width,i.height=a.height,n.resize()}})}getWidgetRenderers(){let e=this._getViewportsAsArray(),t=new Map;return e.forEach(e=>{(e.getWidgets?e.getWidgets():[]).forEach(n=>{let i=n.getRenderer?n.getRenderer():null;i&&t.set(i,e.id)})}),t}getViewportRenderPasses(e){let t=this.getViewport(e);return t?.getRenderPasses?t.getRenderPasses():null}getRenderer(e){let t=this.contextPool?.getContextIndexForViewport(e);if(void 0===t||!this.contextPool)return;let n=this.contextPool.getContextByIndex(t);if(!n)return;let{context:i}=n;return i.getRenderer(e)}disableElement(e){let t=this.getViewport(e);if(t&&(super.disableElement(e),!(0,g.A)(t.type)&&this.contextPool)){let t=this.contextPool.getContextIndexForViewport(e);if(void 0!==t){let n=this.contextPool.getContextByIndex(t);if(n){let{context:t}=n;t.removeRenderer(e)}}this.contextPool.removeViewport(e)}}destroy(){super.destroy(),this.contextPool&&this.contextPool.destroy()}getOffscreenMultiRenderWindow(e){if(!this.contextPool)throw Error("Offscreen multi render window is not available.");let t=this.contextPool.getContextIndexForViewport(e);if(void 0===t)throw Error(`Offscreen multi render window is not available for viewport ${e}.`);let n=this.contextPool.getContextByIndex(t);if(!n)throw Error(`Offscreen multi render window is not available for viewport ${e}.`);return n.context}}class _{constructor(e){let t=(0,r.D0)(),n=t?.rendering?.renderingEngineMode;switch(n){case i.FJ.Tiled:this._implementation=new o.A(e);break;case i.FJ.ContextPool:this._implementation=new I(e);break;default:console.warn(`RenderingEngine: Unknown rendering engine mode "${n}". Defaulting to Next rendering engine.`),this._implementation=new I(e)}}get id(){return this._implementation.id}disableViewport(e){return this._implementation.disableElement(e)}enableElement(e){return this._implementation.enableElement(e)}disableElement(e){return this._implementation.disableElement(e)}setViewports(e){return this._implementation.setViewports(e)}resize(e=!0,t=!0){return this._implementation.resize(e,t)}getViewport(e){return this._implementation.getViewport(e)}getViewports(){return this._implementation.getViewports()}getRenderer(e){return this._implementation.getRenderer(e)}fillCanvasWithBackgroundColor(e,t){return this._implementation.fillCanvasWithBackgroundColor(e,t)}render(){return this._implementation.render()}renderViewports(e){return this._implementation.renderViewports(e)}renderViewport(e){return this._implementation.renderViewport(e)}destroy(){return this._implementation.destroy()}getOffscreenMultiRenderWindow(e){return this._implementation.getOffscreenMultiRenderWindow(e)}}var w=n(16376),b=n(62685),C=n(2523);n(68337);var A=n(25294),E=n(62004),M=n(80405),y=n(39113),S=n(27112),T=n(48196),D=n(31608);A.g1,A.rE,A.N9,A.Pf,A.g6,E.Ay,E.JG,E.Xy,E.cs,E.L0,M.Ay,M.jY,M.hW,M.QJ,M.vL,y.Ay,y.ep,y.Iz,y.xn,y.Sy,S.Ay,S.Dl,S.zp,S.er,S.fB,T.Ay,T.v9,T.Jj,T.qn,T.LG;let P=_;n(52219);var k=n(44151),x=n(21601);n(58851),n(39997);var L=n(7842);n(55580);var V=n(67058),O=n(54268);n(54223);var R=n(92391),N=n(35088),U=n(39216);n(99376);let F=Symbol("DefaultSettings"),B=Symbol("RuntimeSettings"),G=Symbol("ObjectSettingsMap"),H=Symbol("Dictionary");class W{constructor(e){let t=Object.create(e instanceof W&&H in e?e[H]:null);Object.seal(Object.defineProperty(this,H,{value:t}))}set(e,t){return z(this[H],e,t,null)}get(e){var t;return t=this[H],t[e]}unset(e){return function(e,t){if(t.endsWith(".")){let n=0,i=t.slice(0,-1),a=0===i.length;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a||r.startsWith(t)||r===i)&&(delete e[r],++n);return n>0}return delete e[t]}(this[H],e+"")}forEach(e){X(this[H],e)}extend(){return new W(this)}import(e){$(e)&&Object.keys(e).forEach(t=>{z(this[H],t,e[t],null)})}dump(){let e={};return X(this[H],(t,n)=>{void 0!==n&&function e(t,n,i){let a=n.indexOf(".");if(a>=0){let r=n.slice(0,a),o=t[r];if("object"!=typeof o||null===o){let e=o;o={},void 0!==e&&(o[""]=e),t[r]=o}e(o,n.slice(a+1,n.length),i)}else t[n]=i}(e,t,n)}),e}static assert(e){return e instanceof W?e:W.getRuntimeSettings()}static getDefaultSettings(e=null){let t=W[F];if(t instanceof W||(t=new W,W[F]=t),e){let n={};return t.forEach(i=>{i.startsWith(e)&&(n[i.split(`${e}.`)[1]]=t.get(i))}),n}return t}static getRuntimeSettings(){let e=W[B];return e instanceof W||(e=new W(W.getDefaultSettings()),W[B]=e),e}static getObjectSettings(e,t){let n=null;if(e instanceof W)n=e;else if("object"==typeof e&&null!==e){let i=W[G];i instanceof WeakMap||(i=new WeakMap,W[G]=i),(n=i.get(e))instanceof W||(n=new W(W.assert(W.getObjectSettings(t))),i.set(e,n))}return n}static extendRuntimeSettings(){return W.getRuntimeSettings().extend()}}function X(e,t){for(let n in e)t(n,e[n])}function z(e,t,n,i){if(function(e){let t,n,i;if("string"!=typeof e||(t=e.length-1)<0)return!1;for(i=-1;(n=e.indexOf(".",i+1))>=0;){if(n-i<2||n===t)return!1;i=n}return!0}(t)){if($(n)){let r;var a=i instanceof WeakSet?i:new WeakSet;if(a.has(n))return z(e,t,null,a);for(let i in a.add(n),r=0,n)Object.prototype.hasOwnProperty.call(n,i)&&!z(e,0===i.length?t:`${t}.${i}`,n[i],a)&&++r;return a.delete(n),0===r}return e[t]=n,!0}return!1}function $(e){if("object"==typeof e&&null!==e){let t=Object.getPrototypeOf(e);if(t===Object.prototype||null===t)return!0}return!1}W.getDefaultSettings().set("useCursors",!0);var Y=n(20549),j=n(97938);n(14098),n(44191),n(98497);var J=n(1705),Q=n(33174),q=n(41652);n(13402),n(15721),n(26444),n(10115),A.g1,A.rE,A.N9,E.Ay,E.JG,E.Xy,E.cs,E.L0,M.Ay,M.jY,M.hW,M.QJ,M.vL,y.Ay,y.ep,y.Iz,y.xn,y.Sy,S.Ay,S.Dl,S.zp,S.er,S.fB,T.Ay,T.v9,T.Jj,T.qn,T.LG},73416:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>c});var i=n(17042),a=n(99298),r=n(87352),{isVtkObject:o}=i.Ay;function s(e){let t=[];for(let n=0;n((void 0===t.numberOfCells||n)&&(t.cellSizes?t.numberOfCells=t.cellSizes.length:t.numberOfCells=l(e.getData())),t.numberOfCells),e.getCellSizes=n=>((void 0===t.cellSizes||n)&&(t.cellSizes=s(e.getData())),t.cellSizes),e.resize=n=>{let a=e.getNumberOfTuples();i.resize(n);let r=e.getNumberOfTuples();r{i.setData(e,1),t.numberOfCells=void 0,t.cellSizes=void 0},e.getCell=e=>{let n=e,i=t.values[n++];return t.values.subarray(n,n+i)},e.insertNextCell=n=>{let i;i=o(n)?n.getPointsIds():n;let a=e.getNumberOfCells();return e.insertNextTuples([i.length,...i]),++t.numberOfCells,null!=t.cellSizes&&t.cellSizes.push(i.length),a},e.getMaxCellSize=()=>e.getCellSizes().reduce((e,t)=>Math.max(e,t),0)}var c={newInstance:i.Ay.newInstance(d,"vtkCellArray"),extend:d,...{extractCellSizes:s,getNumberOfCells:l}}},73526:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var i=n(70192),a=n(17964);let r=function(e,t){t||(t=(0,i.qO)().find(t=>t.getViewports().find(t=>t.id===e))?.id);let n=a.wk.toolGroups.filter(n=>n.viewportsInfo.some(n=>n.renderingEngineId===t&&(!n.viewportId||n.viewportId===e)));if(n.length){if(n.length>1)throw Error(`Multiple tool groups found for renderingEngineId: ${t} and viewportId: ${e}. You should only + have one tool group per viewport in a renderingEngine.`);return n[0]}}},73904:(e,t,n)=>{"use strict";n.d(t,{$2:()=>h,CI:()=>M.A,hp:()=>u.A,Xr:()=>g.A,Sm:()=>w.A,$V:()=>m.A,qX:()=>p.A,YR:()=>v.A,V6:()=>f.A,a5:()=>b.A,kd:()=>_.A,VV:()=>I.A,tk:()=>C.A,pJ:()=>A.A,Kj:()=>y.A,T$:()=>E.A});var i=n(17964),a=n(70192);function r(e,t){if(i.wk.svgNodeCache[e]&&i.wk.svgNodeCache[e][t])return i.wk.svgNodeCache[e][t].domRef}function o(e,t,n,a){if(!i.wk.svgNodeCache[t])return null;i.wk.svgNodeCache[t][a]={touched:!0,domRef:n},e.appendChild(n)}function s(e,t){i.wk.svgNodeCache[e]&&i.wk.svgNodeCache[e][t]&&(i.wk.svgNodeCache[e][t].touched=!0)}function l(e,t){i.wk.svgNodeCache[t]&&Object.keys(i.wk.svgNodeCache[t]).forEach(n=>{let a=i.wk.svgNodeCache[t][n];!a.touched&&a.domRef&&(e.removeChild(a.domRef),delete i.wk.svgNodeCache[t][n])})}let d=function(e){let{viewportId:t,renderingEngineId:n}=(0,a.kJ)(e),d=`${t}:${n}`,c=function(e){let t=e.querySelector(".viewport-element");return t?.querySelector(":scope > .svg-layer")}(e);return Object.keys(i.wk.svgNodeCache[d]).forEach(e=>{i.wk.svgNodeCache[d][e].touched=!1}),{svgLayerElement:c,svgNodeCacheForCanvas:i.wk.svgNodeCache,getSvgNode:r.bind(this,d),appendNode:o.bind(this,c,d),setNodeTouched:s.bind(this,d),clearUntouched:l.bind(this,c,d)}};var c=n(10999);let h=function(e,t){let n=d(e);n.svgLayerElement&&(0,c.F4)(n.svgLayerElement),t(n),n.clearUntouched()};var u=n(6600),g=n(92066),p=n(59187),m=n(29470),f=n(76722),v=n(57407),I=n(39172),_=n(49151),w=n(37429),b=n(47315),C=n(85050),A=n(94066),E=n(99572),M=n(89681),y=n(88451)},74600:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});let i=[[0,0,0,0],[221,84,84,255],[77,228,121,255],[166,70,235,255],[189,180,116,255],[109,182,196,255],[204,101,157,255],[123,211,94,255],[93,87,218,255],[225,128,80,255],[73,232,172,255],[181,119,186,255],[176,193,112,255],[105,153,200,255],[208,97,120,255],[90,215,101,255],[135,83,222,255],[229,178,76,255],[122,183,181,255],[190,115,171,255],[149,197,108,255],[100,118,205,255],[212,108,93,255],[86,219,141,255],[183,79,226,255],[233,233,72,255],[118,167,187,255],[194,111,146,255],[116,201,104,255],[115,96,209,255],[216,147,89,255],[82,223,188,255],[230,75,224,255],[163,184,121,255],[114,143,191,255],[198,107,114,255],[99,206,122,255],[153,92,213,255],[220,192,85,255],[78,215,227,255],[234,71,173,255],[141,188,117,255],[110,113,195,255],[202,128,103,255],[95,210,157,255],[195,88,217,255],[206,224,81,255],[74,166,231,255],[185,120,139,255],[113,192,113,255],[133,106,199,255],[207,162,98,255],[91,214,198,255],[221,84,198,255],[159,228,77,255],[70,111,235,255],[189,119,116,255],[109,196,138,255],[165,101,204,255],[211,201,94,255],[87,191,218,255],[225,80,153,255],[106,232,73,255],[124,119,186,255],[193,142,112,255],[105,200,168,255],[203,97,208,255],[184,215,90,255],[83,147,222,255],[229,76,101,255],[122,183,130,255],[146,115,190,255],[197,171,108,255],[100,205,205,255],[212,93,177,255],[141,219,86,255],[79,97,226,255],[233,99,72,255],[118,187,150,255],[173,111,194,255],[197,201,104,255],[96,171,209,255],[216,89,137,255],[94,223,82,255],[107,75,230,255],[184,153,121,255],[114,191,175,255],[198,107,191,255],[166,206,99,255],[92,132,213,255],[220,85,91,255],[78,227,115,255],[159,71,234,255],[188,176,117,255],[110,185,195,255],[202,103,161,255],[129,210,95,255],[88,88,217,255],[224,123,81,255],[74,231,166,255],[177,120,185,255],[179,192,113,255],[106,156,199,255],[207,98,125,255],[91,214,96,255],[130,84,221,255],[228,171,77,255],[70,235,221,255],[189,116,174,255],[153,196,109,255],[101,123,204,255],[211,104,94,255],[87,218,136,255],[177,80,225,255],[232,225,73,255],[119,169,186,255],[193,112,149,255],[121,200,105,255],[111,97,208,255],[215,142,90,255],[83,222,181,255],[229,76,229,255],[165,183,122,255],[115,146,190,255],[197,108,119,255],[100,205,118,255],[148,93,212,255],[219,186,86,255],[79,220,226,255],[233,72,179,255],[144,187,118,255],[111,118,194,255],[201,124,104,255],[96,209,153,255],[189,89,216,255],[211,223,82,255],[75,172,230,255],[184,121,142,255],[117,191,114,255],[130,107,198,255],[206,157,99,255],[92,213,193,255],[220,85,203,255],[165,227,78,255],[71,118,234,255],[188,117,117,255],[110,195,135,255],[161,103,202,255],[210,195,95,255],[88,195,217,255],[224,81,158,255],[113,231,74,255],[123,120,185,255],[192,139,113,255],[106,199,164,255],[198,98,207,255],[188,214,91,255],[84,153,221,255],[228,77,108,255],[70,235,84,255],[143,116,189,255],[196,167,109,255],[101,204,199,255],[211,94,182,255],[147,218,87,255],[80,104,225,255],[232,93,73,255],[119,186,147,255],[170,112,193,255],[200,200,105,255],[97,175,208,255],[215,90,142,255],[100,222,83,255],[101,76,229,255],[183,150,122,255],[115,190,171,255],[197,108,194,255],[170,205,100,255],[93,138,212,255],[219,86,97,255],[79,226,110,255],[153,72,233,255],[187,173,118,255],[111,187,194,255],[201,104,165,255],[134,209,96,255],[89,95,216,255],[223,117,82,255],[75,230,159,255],[174,121,184,255],[182,191,114,255],[107,160,198,255],[206,99,130,255],[92,213,92,255],[124,85,220,255],[227,165,78,255],[71,234,214,255],[188,117,176,255],[156,195,110,255],[103,128,202,255],[210,100,95,255],[88,217,131,255],[170,81,224,255],[231,218,74,255],[120,172,185,255],[192,113,153,255],[125,199,106,255],[107,98,207,255],[214,137,91,255],[84,221,175,255],[222,77,228,255],[194,235,70,255],[116,149,189,255],[196,109,123,255],[101,204,114,255],[143,94,211,255],[218,180,87,255],[80,225,225,255],[232,73,186,255],[147,186,119,255],[112,122,193,255],[200,121,105,255],[97,208,148,255],[184,90,215,255],[216,222,83,255],[76,178,229,255],[183,122,145,255],[121,190,115,255],[126,108,197,255],[205,153,100,255],[93,212,187,255],[219,86,208,255],[171,226,79,255],[72,126,233,255],[187,118,121,255],[111,194,132,255],[157,104,201,255],[209,190,96,255],[89,200,216,255],[223,82,164,255],[120,230,75,255],[121,121,184,255],[191,136,114,255],[107,198,160,255],[192,99,206,255],[193,213,92,255],[85,158,220,255],[227,78,115,255],[71,234,78,255],[141,117,188,255],[195,163,110,255],[103,202,194,255],[210,95,186,255],[153,217,88,255],[81,111,224,255]]},74978:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>d,c9:()=>o});var i=n(17042),a=n(81522),r=Object.create(null);function o(e,t){r[e]=t}var s={};function l(e,t,n={}){Object.assign(t,s,n),t.overrides=r,a.Ay.extend(e,t,n),t.classHierarchy.push("vtkWebGPUViewNodeFactory")}var d={newInstance:i.Ay.newInstance(l,"vtkWebGPUViewNodeFactory"),extend:l}},75889:(e,t,n)=>{"use strict";n.d(t,{QP:()=>ee});let i=(e,t)=>{if(0===e.length)return t.classGroupId;let n=e[0],a=t.nextPart.get(n),r=a?i(e.slice(1),a):void 0;if(r)return r;if(0===t.validators.length)return;let o=e.join("-");return t.validators.find(({validator:e})=>e(o))?.classGroupId},a=/^\[(.+)\]$/,r=(e,t,n,i)=>{e.forEach(e=>{if("string"==typeof e){(""===e?t:o(t,e)).classGroupId=n;return}if("function"==typeof e)return s(e)?void r(e(i),t,n,i):void t.validators.push({validator:e,classGroupId:n});Object.entries(e).forEach(([e,a])=>{r(a,o(t,e),n,i)})})},o=(e,t)=>{let n=e;return t.split("-").forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},s=e=>e.isThemeGetter,l=/\s+/;function d(){let e,t,n=0,i="";for(;n{let t;if("string"==typeof e)return e;let n="";for(let i=0;i{let t=t=>t[e]||[];return t.isThemeGetter=!0,t},u=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,g=/^\((?:(\w[\w-]*):)?(.+)\)$/i,p=/^\d+\/\d+$/,m=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,f=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,v=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,I=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,w=e=>p.test(e),b=e=>!!e&&!Number.isNaN(Number(e)),C=e=>!!e&&Number.isInteger(Number(e)),A=e=>e.endsWith("%")&&b(e.slice(0,-1)),E=e=>m.test(e),M=()=>!0,y=e=>f.test(e)&&!v.test(e),S=()=>!1,T=e=>I.test(e),D=e=>_.test(e),P=e=>!x(e)&&!U(e),k=e=>z(e,J,S),x=e=>u.test(e),L=e=>z(e,Q,y),V=e=>z(e,q,b),O=e=>z(e,Y,S),R=e=>z(e,j,D),N=e=>z(e,Z,T),U=e=>g.test(e),F=e=>$(e,Q),B=e=>$(e,K),G=e=>$(e,Y),H=e=>$(e,J),W=e=>$(e,j),X=e=>$(e,Z,!0),z=(e,t,n)=>{let i=u.exec(e);return!!i&&(i[1]?t(i[1]):n(i[2]))},$=(e,t,n=!1)=>{let i=g.exec(e);return!!i&&(i[1]?t(i[1]):n)},Y=e=>"position"===e||"percentage"===e,j=e=>"image"===e||"url"===e,J=e=>"length"===e||"size"===e||"bg-size"===e,Q=e=>"length"===e,q=e=>"number"===e,K=e=>"family-name"===e,Z=e=>"shadow"===e;Symbol.toStringTag;let ee=function(e,...t){let n,o,s,c=function(l){let d;return o=(n={cache:(e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=new Map,i=new Map,a=(a,r)=>{n.set(a,r),++t>e&&(t=0,i=n,n=new Map)};return{get(e){let t=n.get(e);return void 0!==t?t:void 0!==(t=i.get(e))?(a(e,t),t):void 0},set(e,t){n.has(e)?n.set(e,t):a(e,t)}}})((d=t.reduce((e,t)=>t(e),e())).cacheSize),parseClassName:(e=>{let{prefix:t,experimentalParseClassName:n}=e,i=e=>{let t,n,i=[],a=0,r=0,o=0;for(let n=0;no?t-o:void 0}};if(t){let e=t+":",n=i;i=t=>t.startsWith(e)?n(t.substring(e.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:t,maybePostfixModifierPosition:void 0}}if(n){let e=i;i=t=>n({className:t,parseClassName:e})}return i})(d),sortModifiers:(e=>{let t=Object.fromEntries(e.orderSensitiveModifiers.map(e=>[e,!0]));return e=>{if(e.length<=1)return e;let n=[],i=[];return e.forEach(e=>{"["===e[0]||t[e]?(n.push(...i.sort(),e),i=[]):i.push(e)}),n.push(...i.sort()),n}})(d),...(e=>{let t=(e=>{let{theme:t,classGroups:n}=e,i={nextPart:new Map,validators:[]};for(let e in n)r(n[e],i,e,t);return i})(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:e=>{let n=e.split("-");return""===n[0]&&1!==n.length&&n.shift(),i(n,t)||(e=>{if(a.test(e)){let t=a.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}})(e)},getConflictingClassGroupIds:(e,t)=>{let i=n[e]||[];return t&&o[e]?[...i,...o[e]]:i}}})(d)}).cache.get,s=n.cache.set,c=h,h(l)};function h(e){let t=o(e);if(t)return t;let i=((e,t)=>{let{parseClassName:n,getClassGroupId:i,getConflictingClassGroupIds:a,sortModifiers:r}=t,o=[],s=e.trim().split(l),d="";for(let e=s.length-1;e>=0;e-=1){let t=s[e],{isExternal:l,modifiers:c,hasImportantModifier:h,baseClassName:u,maybePostfixModifierPosition:g}=n(t);if(l){d=t+(d.length>0?" "+d:d);continue}let p=!!g,m=i(p?u.substring(0,g):u);if(!m){if(!p||!(m=i(u))){d=t+(d.length>0?" "+d:d);continue}p=!1}let f=r(c).join(":"),v=h?f+"!":f,I=v+m;if(o.includes(I))continue;o.push(I);let _=a(m,p);for(let e=0;e<_.length;++e){let t=_[e];o.push(v+t)}d=t+(d.length>0?" "+d:d)}return d})(e,n);return s(e,i),i}return function(){return c(d.apply(null,arguments))}}(()=>{let e=h("color"),t=h("font"),n=h("text"),i=h("font-weight"),a=h("tracking"),r=h("leading"),o=h("breakpoint"),s=h("container"),l=h("spacing"),d=h("radius"),c=h("shadow"),u=h("inset-shadow"),g=h("text-shadow"),p=h("drop-shadow"),m=h("blur"),f=h("perspective"),v=h("aspect"),I=h("ease"),_=h("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[...S(),U,x],D=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],$=()=>[U,x,l],Y=()=>[w,"full","auto",...$()],j=()=>[C,"none","subgrid",U,x],J=()=>["auto",{span:["full",C,U,x]},C,U,x],Q=()=>[C,"auto",U,x],q=()=>["auto","min","max","fr",U,x],K=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Z=()=>["start","end","center","stretch","center-safe","end-safe"],ee=()=>["auto",...$()],et=()=>[w,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...$()],en=()=>[e,U,x],ei=()=>[...S(),G,O,{position:[U,x]}],ea=()=>["no-repeat",{repeat:["","x","y","space","round"]}],er=()=>["auto","cover","contain",H,k,{size:[U,x]}],eo=()=>[A,F,L],es=()=>["","none","full",d,U,x],el=()=>["",b,F,L],ed=()=>["solid","dashed","dotted","double"],ec=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],eh=()=>[b,A,G,O],eu=()=>["","none",m,U,x],eg=()=>["none",b,U,x],ep=()=>["none",b,U,x],em=()=>[b,U,x],ef=()=>[w,"full",...$()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[E],breakpoint:[E],color:[M],container:[E],"drop-shadow":[E],ease:["in","out","in-out"],font:[P],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[E],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[E],shadow:[E],spacing:["px",b],text:[E],"text-shadow":[E],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",w,x,U,v]}],container:["container"],columns:[{columns:[b,x,U,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:T()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Y()}],"inset-x":[{"inset-x":Y()}],"inset-y":[{"inset-y":Y()}],start:[{start:Y()}],end:[{end:Y()}],top:[{top:Y()}],right:[{right:Y()}],bottom:[{bottom:Y()}],left:[{left:Y()}],visibility:["visible","invisible","collapse"],z:[{z:[C,"auto",U,x]}],basis:[{basis:[w,"full","auto",s,...$()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[b,w,"auto","initial","none",x]}],grow:[{grow:["",b,U,x]}],shrink:[{shrink:["",b,U,x]}],order:[{order:[C,"first","last","none",U,x]}],"grid-cols":[{"grid-cols":j()}],"col-start-end":[{col:J()}],"col-start":[{"col-start":Q()}],"col-end":[{"col-end":Q()}],"grid-rows":[{"grid-rows":j()}],"row-start-end":[{row:J()}],"row-start":[{"row-start":Q()}],"row-end":[{"row-end":Q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":q()}],"auto-rows":[{"auto-rows":q()}],gap:[{gap:$()}],"gap-x":[{"gap-x":$()}],"gap-y":[{"gap-y":$()}],"justify-content":[{justify:[...K(),"normal"]}],"justify-items":[{"justify-items":[...Z(),"normal"]}],"justify-self":[{"justify-self":["auto",...Z()]}],"align-content":[{content:["normal",...K()]}],"align-items":[{items:[...Z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Z(),{baseline:["","last"]}]}],"place-content":[{"place-content":K()}],"place-items":[{"place-items":[...Z(),"baseline"]}],"place-self":[{"place-self":["auto",...Z()]}],p:[{p:$()}],px:[{px:$()}],py:[{py:$()}],ps:[{ps:$()}],pe:[{pe:$()}],pt:[{pt:$()}],pr:[{pr:$()}],pb:[{pb:$()}],pl:[{pl:$()}],m:[{m:ee()}],mx:[{mx:ee()}],my:[{my:ee()}],ms:[{ms:ee()}],me:[{me:ee()}],mt:[{mt:ee()}],mr:[{mr:ee()}],mb:[{mb:ee()}],ml:[{ml:ee()}],"space-x":[{"space-x":$()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":$()}],"space-y-reverse":["space-y-reverse"],size:[{size:et()}],w:[{w:[s,"screen",...et()]}],"min-w":[{"min-w":[s,"screen","none",...et()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[o]},...et()]}],h:[{h:["screen","lh",...et()]}],"min-h":[{"min-h":["screen","lh","none",...et()]}],"max-h":[{"max-h":["screen","lh",...et()]}],"font-size":[{text:["base",n,F,L]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,U,V]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",A,x]}],"font-family":[{font:[B,x,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,U,x]}],"line-clamp":[{"line-clamp":[b,"none",U,V]}],leading:[{leading:[r,...$()]}],"list-image":[{"list-image":["none",U,x]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",U,x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:en()}],"text-color":[{text:en()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ed(),"wavy"]}],"text-decoration-thickness":[{decoration:[b,"from-font","auto",U,L]}],"text-decoration-color":[{decoration:en()}],"underline-offset":[{"underline-offset":[b,"auto",U,x]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:$()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",U,x]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",U,x]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ei()}],"bg-repeat":[{bg:ea()}],"bg-size":[{bg:er()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},C,U,x],radial:["",U,x],conic:[C,U,x]},W,R]}],"bg-color":[{bg:en()}],"gradient-from-pos":[{from:eo()}],"gradient-via-pos":[{via:eo()}],"gradient-to-pos":[{to:eo()}],"gradient-from":[{from:en()}],"gradient-via":[{via:en()}],"gradient-to":[{to:en()}],rounded:[{rounded:es()}],"rounded-s":[{"rounded-s":es()}],"rounded-e":[{"rounded-e":es()}],"rounded-t":[{"rounded-t":es()}],"rounded-r":[{"rounded-r":es()}],"rounded-b":[{"rounded-b":es()}],"rounded-l":[{"rounded-l":es()}],"rounded-ss":[{"rounded-ss":es()}],"rounded-se":[{"rounded-se":es()}],"rounded-ee":[{"rounded-ee":es()}],"rounded-es":[{"rounded-es":es()}],"rounded-tl":[{"rounded-tl":es()}],"rounded-tr":[{"rounded-tr":es()}],"rounded-br":[{"rounded-br":es()}],"rounded-bl":[{"rounded-bl":es()}],"border-w":[{border:el()}],"border-w-x":[{"border-x":el()}],"border-w-y":[{"border-y":el()}],"border-w-s":[{"border-s":el()}],"border-w-e":[{"border-e":el()}],"border-w-t":[{"border-t":el()}],"border-w-r":[{"border-r":el()}],"border-w-b":[{"border-b":el()}],"border-w-l":[{"border-l":el()}],"divide-x":[{"divide-x":el()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":el()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ed(),"hidden","none"]}],"divide-style":[{divide:[...ed(),"hidden","none"]}],"border-color":[{border:en()}],"border-color-x":[{"border-x":en()}],"border-color-y":[{"border-y":en()}],"border-color-s":[{"border-s":en()}],"border-color-e":[{"border-e":en()}],"border-color-t":[{"border-t":en()}],"border-color-r":[{"border-r":en()}],"border-color-b":[{"border-b":en()}],"border-color-l":[{"border-l":en()}],"divide-color":[{divide:en()}],"outline-style":[{outline:[...ed(),"none","hidden"]}],"outline-offset":[{"outline-offset":[b,U,x]}],"outline-w":[{outline:["",b,F,L]}],"outline-color":[{outline:en()}],shadow:[{shadow:["","none",c,X,N]}],"shadow-color":[{shadow:en()}],"inset-shadow":[{"inset-shadow":["none",u,X,N]}],"inset-shadow-color":[{"inset-shadow":en()}],"ring-w":[{ring:el()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:en()}],"ring-offset-w":[{"ring-offset":[b,L]}],"ring-offset-color":[{"ring-offset":en()}],"inset-ring-w":[{"inset-ring":el()}],"inset-ring-color":[{"inset-ring":en()}],"text-shadow":[{"text-shadow":["none",g,X,N]}],"text-shadow-color":[{"text-shadow":en()}],opacity:[{opacity:[b,U,x]}],"mix-blend":[{"mix-blend":[...ec(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ec()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[b]}],"mask-image-linear-from-pos":[{"mask-linear-from":eh()}],"mask-image-linear-to-pos":[{"mask-linear-to":eh()}],"mask-image-linear-from-color":[{"mask-linear-from":en()}],"mask-image-linear-to-color":[{"mask-linear-to":en()}],"mask-image-t-from-pos":[{"mask-t-from":eh()}],"mask-image-t-to-pos":[{"mask-t-to":eh()}],"mask-image-t-from-color":[{"mask-t-from":en()}],"mask-image-t-to-color":[{"mask-t-to":en()}],"mask-image-r-from-pos":[{"mask-r-from":eh()}],"mask-image-r-to-pos":[{"mask-r-to":eh()}],"mask-image-r-from-color":[{"mask-r-from":en()}],"mask-image-r-to-color":[{"mask-r-to":en()}],"mask-image-b-from-pos":[{"mask-b-from":eh()}],"mask-image-b-to-pos":[{"mask-b-to":eh()}],"mask-image-b-from-color":[{"mask-b-from":en()}],"mask-image-b-to-color":[{"mask-b-to":en()}],"mask-image-l-from-pos":[{"mask-l-from":eh()}],"mask-image-l-to-pos":[{"mask-l-to":eh()}],"mask-image-l-from-color":[{"mask-l-from":en()}],"mask-image-l-to-color":[{"mask-l-to":en()}],"mask-image-x-from-pos":[{"mask-x-from":eh()}],"mask-image-x-to-pos":[{"mask-x-to":eh()}],"mask-image-x-from-color":[{"mask-x-from":en()}],"mask-image-x-to-color":[{"mask-x-to":en()}],"mask-image-y-from-pos":[{"mask-y-from":eh()}],"mask-image-y-to-pos":[{"mask-y-to":eh()}],"mask-image-y-from-color":[{"mask-y-from":en()}],"mask-image-y-to-color":[{"mask-y-to":en()}],"mask-image-radial":[{"mask-radial":[U,x]}],"mask-image-radial-from-pos":[{"mask-radial-from":eh()}],"mask-image-radial-to-pos":[{"mask-radial-to":eh()}],"mask-image-radial-from-color":[{"mask-radial-from":en()}],"mask-image-radial-to-color":[{"mask-radial-to":en()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[b]}],"mask-image-conic-from-pos":[{"mask-conic-from":eh()}],"mask-image-conic-to-pos":[{"mask-conic-to":eh()}],"mask-image-conic-from-color":[{"mask-conic-from":en()}],"mask-image-conic-to-color":[{"mask-conic-to":en()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ei()}],"mask-repeat":[{mask:ea()}],"mask-size":[{mask:er()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",U,x]}],filter:[{filter:["","none",U,x]}],blur:[{blur:eu()}],brightness:[{brightness:[b,U,x]}],contrast:[{contrast:[b,U,x]}],"drop-shadow":[{"drop-shadow":["","none",p,X,N]}],"drop-shadow-color":[{"drop-shadow":en()}],grayscale:[{grayscale:["",b,U,x]}],"hue-rotate":[{"hue-rotate":[b,U,x]}],invert:[{invert:["",b,U,x]}],saturate:[{saturate:[b,U,x]}],sepia:[{sepia:["",b,U,x]}],"backdrop-filter":[{"backdrop-filter":["","none",U,x]}],"backdrop-blur":[{"backdrop-blur":eu()}],"backdrop-brightness":[{"backdrop-brightness":[b,U,x]}],"backdrop-contrast":[{"backdrop-contrast":[b,U,x]}],"backdrop-grayscale":[{"backdrop-grayscale":["",b,U,x]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[b,U,x]}],"backdrop-invert":[{"backdrop-invert":["",b,U,x]}],"backdrop-opacity":[{"backdrop-opacity":[b,U,x]}],"backdrop-saturate":[{"backdrop-saturate":[b,U,x]}],"backdrop-sepia":[{"backdrop-sepia":["",b,U,x]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":$()}],"border-spacing-x":[{"border-spacing-x":$()}],"border-spacing-y":[{"border-spacing-y":$()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",U,x]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[b,"initial",U,x]}],ease:[{ease:["linear","initial",I,U,x]}],delay:[{delay:[b,U,x]}],animate:[{animate:["none",_,U,x]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,U,x]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:eg()}],"rotate-x":[{"rotate-x":eg()}],"rotate-y":[{"rotate-y":eg()}],"rotate-z":[{"rotate-z":eg()}],scale:[{scale:ep()}],"scale-x":[{"scale-x":ep()}],"scale-y":[{"scale-y":ep()}],"scale-z":[{"scale-z":ep()}],"scale-3d":["scale-3d"],skew:[{skew:em()}],"skew-x":[{"skew-x":em()}],"skew-y":[{"skew-y":em()}],transform:[{transform:[U,x,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ef()}],"translate-x":[{"translate-x":ef()}],"translate-y":[{"translate-y":ef()}],"translate-z":[{"translate-z":ef()}],"translate-none":["translate-none"],accent:[{accent:en()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:en()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",U,x]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":$()}],"scroll-mx":[{"scroll-mx":$()}],"scroll-my":[{"scroll-my":$()}],"scroll-ms":[{"scroll-ms":$()}],"scroll-me":[{"scroll-me":$()}],"scroll-mt":[{"scroll-mt":$()}],"scroll-mr":[{"scroll-mr":$()}],"scroll-mb":[{"scroll-mb":$()}],"scroll-ml":[{"scroll-ml":$()}],"scroll-p":[{"scroll-p":$()}],"scroll-px":[{"scroll-px":$()}],"scroll-py":[{"scroll-py":$()}],"scroll-ps":[{"scroll-ps":$()}],"scroll-pe":[{"scroll-pe":$()}],"scroll-pt":[{"scroll-pt":$()}],"scroll-pr":[{"scroll-pr":$()}],"scroll-pb":[{"scroll-pb":$()}],"scroll-pl":[{"scroll-pl":$()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",U,x]}],fill:[{fill:["none",...en()]}],"stroke-w":[{stroke:[b,F,L,V]}],stroke:[{stroke:["none",...en()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}})},76826:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>a,kP:()=>i});var i={DEFAULT:0,SINGLE:1,DOUBLE:2},a={AttributeCopyOperations:{COPYTUPLE:0,INTERPOLATE:1,PASSDATA:2,ALLCOPY:3},AttributeLimitTypes:{MAX:0,EXACT:1,NOLIMIT:2},AttributeTypes:{SCALARS:0,VECTORS:1,NORMALS:2,TCOORDS:3,TENSORS:4,GLOBALIDS:5,PEDIGREEIDS:6,EDGEFLAG:7,NUM_ATTRIBUTES:8},CellGhostTypes:{DUPLICATECELL:1,HIGHCONNECTIVITYCELL:2,LOWCONNECTIVITYCELL:4,REFINEDCELL:8,EXTERIORCELL:16,HIDDENCELL:32},DesiredOutputPrecision:i,PointGhostTypes:{DUPLICATEPOINT:1,HIDDENPOINT:2},ghostArrayName:"vtkGhostType"}},77280:(e,t,n)=>{"use strict";n.d(t,{gd:()=>d.A,ov:()=>p.A,sV:()=>r.A,$0:()=>a,dC:()=>h.A,FU:()=>f.A,VO:()=>l.A,WA:()=>u.A,nb:()=>I.A,KY:()=>c,YB:()=>w.A,FJ:()=>_.A,Yw:()=>o.A,yX:()=>g.A,QO:()=>v,Dt:()=>m.A,NV:()=>s.A});var i,a,r=n(76879),o=n(41831),s=n(56872);n(42357);var l=n(66692),d=n(33011);!function(e){e.AXIAL="axial",e.CORONAL="coronal",e.SAGITTAL="sagittal",e.ACQUISITION="acquisition",e.AXIAL_REFORMAT="axial_reformat",e.CORONAL_REFORMAT="coronal_reformat",e.SAGITTAL_REFORMAT="sagittal_reformat",e.REFORMAT="reformat"}(i||(i={}));let c=i;var h=n(29234);n(31620);var u=n(40523),g=n(5541);n(42151);var p=n(21339),m=n(17774),f=n(82866),v=n(65693),I=n(35752);!function(e){e.SUM="SUM",e.SUBTRACT="SUBTRACT",e.AVERAGE="AVERAGE"}(a||(a={})),n(42776);var _=n(89566),w=n(70639)},78928:(e,t,n)=>{var i="__lodash_hash_undefined__",a=1/0,r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,o=/^\w*$/,s=/^\./,l=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,d=/\\(\\)?/g,c=/^\[object .+?Constructor\]$/,h="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,u="object"==typeof self&&self&&self.Object===Object&&self,g=h||u||Function("return this")(),p=Array.prototype,m=Function.prototype,f=Object.prototype,v=g["__core-js_shared__"],I=function(){var e=/[^.]+$/.exec(v&&v.keys&&v.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),_=m.toString,w=f.hasOwnProperty,b=f.toString,C=RegExp("^"+_.call(w).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),A=g.Symbol,E=p.splice,M=V(g,"Map"),y=V(Object,"create"),S=A?A.prototype:void 0,T=S?S.toString:void 0;function D(e){var t=-1,n=e?e.length:0;for(this.clear();++t-1},P.prototype.set=function(e,t){var n=this.__data__,i=x(n,e);return i<0?n.push([e,t]):n[i][1]=t,this},k.prototype.clear=function(){this.__data__={hash:new D,map:new(M||P),string:new D}},k.prototype.delete=function(e){return L(this,e).delete(e)},k.prototype.get=function(e){return L(this,e).get(e)},k.prototype.has=function(e){return L(this,e).has(e)},k.prototype.set=function(e,t){return L(this,e).set(e,t),this};var O=R(function(e){e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(F(e))return T?T.call(e):"";var t=e+"";return"0"==t&&1/e==-a?"-0":t}(t);var t,n=[];return s.test(e)&&n.push(""),e.replace(l,function(e,t,i,a){n.push(i?a.replace(d,"$1"):t||e)}),n});function R(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw TypeError("Expected a function");var n=function(){var i=arguments,a=t?t.apply(this,i):i[0],r=n.cache;if(r.has(a))return r.get(a);var o=e.apply(this,i);return n.cache=r.set(a,o),o};return n.cache=new(R.Cache||k),n}R.Cache=k;var N=Array.isArray;function U(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function F(e){return"symbol"==typeof e||!!e&&"object"==typeof e&&"[object Symbol]"==b.call(e)}e.exports=function(e,t,n){var i=null==e?void 0:function(e,t){var n;t=!function(e,t){if(N(e))return!1;var n=typeof e;return!!("number"==n||"symbol"==n||"boolean"==n||null==e||F(e))||o.test(e)||!r.test(e)||null!=t&&e in Object(t)}(t,e)?N(n=t)?n:O(n):[t];for(var i=0,s=t.length;null!=e&&i{"use strict";n.d(t,{n:()=>c});var i=n(12115),a=n(38559),r=n(74268),o=n(38445),s=n(34049),l=class extends o.Q{#e;#r=void 0;#E;#M;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#y()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,s.f8)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#E,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,s.EN)(t.mutationKey)!==(0,s.EN)(this.options.mutationKey)?this.reset():this.#E?.state.status==="pending"&&this.#E.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#E?.removeObserver(this)}onMutationUpdate(e){this.#y(),this.#A(e)}getCurrentResult(){return this.#r}reset(){this.#E?.removeObserver(this),this.#E=void 0,this.#y(),this.#A()}mutate(e,t){return this.#M=t,this.#E?.removeObserver(this),this.#E=this.#e.getMutationCache().build(this.#e,this.options),this.#E.addObserver(this),this.#E.execute(e)}#y(){let e=this.#E?.state??(0,a.$)();this.#r={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#A(e){r.jG.batch(()=>{if(this.#M&&this.hasListeners()){let t=this.#r.variables,n=this.#r.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};e?.type==="success"?(this.#M.onSuccess?.(e.data,t,n,i),this.#M.onSettled?.(e.data,null,t,n,i)):e?.type==="error"&&(this.#M.onError?.(e.error,t,n,i),this.#M.onSettled?.(void 0,e.error,t,n,i))}this.listeners.forEach(e=>{e(this.#r)})})}},d=n(99776);function c(e,t){let n=(0,d.jE)(t),[a]=i.useState(()=>new l(n,e));i.useEffect(()=>{a.setOptions(e)},[a,e]);let o=i.useSyncExternalStore(i.useCallback(e=>a.subscribe(r.jG.batchCalls(e)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),c=i.useCallback((e,t)=>{a.mutate(e,t).catch(s.lQ)},[a]);if(o.error&&(0,s.GU)(a.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:c,mutateAsync:o.mutate}}},81863:(e,t,n)=>{"use strict";n.d(t,{A2:()=>r,BX:()=>I,LV:()=>h});let i=Symbol("Comlink.proxy"),a=Symbol("Comlink.endpoint"),r=Symbol("Comlink.releaseProxy"),o=Symbol("Comlink.finalizer"),s=Symbol("Comlink.thrown"),l=e=>"object"==typeof e&&null!==e||"function"==typeof e,d=new Map([["proxy",{canHandle:e=>l(e)&&e[i],serialize(e){let{port1:t,port2:n}=new MessageChannel;return function e(t,n=globalThis,i=["*"]){n.addEventListener("message",function a(r){let l;if(!r||!r.data)return;if(!function(e,t){for(let n of e)if(t===n||"*"===n||n instanceof RegExp&&n.test(t))return!0;return!1}(i,r.origin))return void console.warn(`Invalid origin '${r.origin}' for comlink proxy`);let{id:d,type:h,path:u}=Object.assign({path:[]},r.data),g=(r.data.argumentList||[]).map(w);try{let n=u.slice(0,-1).reduce((e,t)=>e[t],t),i=u.reduce((e,t)=>e[t],t);switch(h){case"GET":l=i;break;case"SET":n[u.slice(-1)[0]]=w(r.data.value),l=!0;break;case"APPLY":l=i.apply(n,g);break;case"CONSTRUCT":{let e=new i(...g);l=I(e)}break;case"ENDPOINT":{var p,m;let{port1:n,port2:i}=new MessageChannel;e(t,i),p=n,m=[n],v.set(p,m),l=p}break;case"RELEASE":l=void 0;break;default:return}}catch(e){l={value:e,[s]:0}}Promise.resolve(l).catch(e=>({value:e,[s]:0})).then(e=>{let[i,r]=_(e);n.postMessage(Object.assign(Object.assign({},i),{id:d}),r),"RELEASE"===h&&(n.removeEventListener("message",a),c(n),o in t&&"function"==typeof t[o]&&t[o]())}).catch(e=>{let[t,i]=_({value:TypeError("Unserializable return value"),[s]:0});n.postMessage(Object.assign(Object.assign({},t),{id:d}),i)})}),n.start&&n.start()}(e,t),[n,[n]]},deserialize:e=>(e.start(),h(e))}],["throw",{canHandle:e=>l(e)&&s in e,serialize:({value:e})=>[e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[]],deserialize(e){if(e.isError)throw Object.assign(Error(e.value.message),e.value);throw e.value}}]]);function c(e){"MessagePort"===e.constructor.name&&e.close()}function h(e,t){let n=new Map;return e.addEventListener("message",function(e){let{data:t}=e;if(!t||!t.id)return;let i=n.get(t.id);if(i)try{i(t)}finally{n.delete(t.id)}}),function e(t,n,i=[],o=function(){}){let s=!1,l=new Proxy(o,{get(a,o){if(u(s),o===r)return()=>{m&&m.unregister(l),g(t),n.clear(),s=!0};if("then"===o){if(0===i.length)return{then:()=>l};let e=b(t,n,{type:"GET",path:i.map(e=>e.toString())}).then(w);return e.then.bind(e)}return e(t,n,[...i,o])},set(e,a,r){u(s);let[o,l]=_(r);return b(t,n,{type:"SET",path:[...i,a].map(e=>e.toString()),value:o},l).then(w)},apply(r,o,l){u(s);let d=i[i.length-1];if(d===a)return b(t,n,{type:"ENDPOINT"}).then(w);if("bind"===d)return e(t,n,i.slice(0,-1));let[c,h]=f(l);return b(t,n,{type:"APPLY",path:i.map(e=>e.toString()),argumentList:c},h).then(w)},construct(e,a){u(s);let[r,o]=f(a);return b(t,n,{type:"CONSTRUCT",path:i.map(e=>e.toString()),argumentList:r},o).then(w)}}),d=(p.get(t)||0)+1;return p.set(t,d),m&&m.register(l,t,l),l}(e,n,[],t)}function u(e){if(e)throw Error("Proxy has been released and is not useable")}function g(e){return b(e,new Map,{type:"RELEASE"}).then(()=>{c(e)})}let p=new WeakMap,m="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{let t=(p.get(e)||0)-1;p.set(e,t),0===t&&g(e)});function f(e){var t;let n=e.map(_);return[n.map(e=>e[0]),(t=n.map(e=>e[1]),Array.prototype.concat.apply([],t))]}let v=new WeakMap;function I(e){return Object.assign(e,{[i]:!0})}function _(e){for(let[t,n]of d)if(n.canHandle(e)){let[i,a]=n.serialize(e);return[{type:"HANDLER",name:t,value:i},a]}return[{type:"RAW",value:e},v.get(e)||[]]}function w(e){switch(e.type){case"HANDLER":return d.get(e.name).deserialize(e.value);case"RAW":return e.value}}function b(e,t,n,i){return new Promise(a=>{let r=[,,,,].fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");t.set(r,a),e.start&&e.start(),e.postMessage(Object.assign({id:r},n),i)})}},82006:(e,t,n)=>{"use strict";n.d(t,{CQ:()=>h,Op:()=>d,Xw:()=>c});let{ov:i}=n(70192).fX,a="voxels",r=[1,2,3,4],o=["4,3","4,7","4,-1"],s={0:"px",1:"percent",2:"dB",3:"cm",4:"seconds",5:"hertz",6:"dB/seconds",7:"cm/sec",8:"cm\xb2",9:"cm\xb2/s",12:"degrees",[-1]:"mV"},l=[i.ERMF,i.USER,i.ERROR,i.PROJECTION,i.CALIBRATED,i.UNKNOWN],d=(e,t)=>{let{calibration:n,hasPixelSpacing:d,spacing:c=[1,1,1]}=e,h=d?"mm":"px",u=d?"mm\xb3":a,g=h+"\xb2",p=n?.scale||1,m=p/(n?.columnPixelSpacing||c[0]),f=p/(n?.rowPixelSpacing||c[1]),v=p/c[2],I="";if(!n||!n.type&&!n.sequenceOfUltrasoundRegions)return{unit:h,areaUnit:g,scale:m,scaleY:f,scaleZ:v,volumeUnit:u};if(l.includes(n?.type)&&(I=n.type),n.type===i.UNCALIBRATED)return{unit:"px",areaUnit:"px\xb2",scale:m,scaleY:f,scaleZ:v,volumeUnit:a};if(n.sequenceOfUltrasoundRegions){let e=n.sequenceOfUltrasoundRegions.find(e=>t.every(t=>t[0]>=e.regionLocationMinX0&&t[0]<=e.regionLocationMaxX1&&t[1]>=e.regionLocationMinY0&&t[1]<=e.regionLocationMaxY1)&&(r.includes(e.regionDataType)||o.includes(`${e.physicalUnitsXDirection},${e.physicalUnitsYDirection}`)));if(e&&e.physicalUnitsXDirection===e.physicalUnitsYDirection){let t=Math.abs(e.physicalDeltaX),n=Math.abs(e.physicalDeltaY);m=1/t,f=1/n,I="US Region",g=(h=s[e.physicalUnitsXDirection]||"unknown")+"\xb2"}else if(e&&-1===e.physicalUnitsYDirection){let t=Math.abs(e.physicalDeltaX),n=Math.abs(e.physicalDeltaY);m=1/t,f=1/n,I="ECG Region",h=s[e.physicalUnitsXDirection]||s[e.physicalUnitsYDirection]||"unknown",g=(s[e.physicalUnitsYDirection]||"px")+"\xb2"}}else n.scale&&(m=n.scale);return{unit:h+(I?` ${I}`:""),areaUnit:g+(I?` ${I}`:""),volumeUnit:u+(I?` ${I}`:""),scale:m,scaleY:f,scaleZ:v}},c=(e,t)=>{let[n]=t,{calibration:i}=e,a=["raw"],l=[null],d="";if(!i||!i.type&&!i.sequenceOfUltrasoundRegions)return{units:a,values:l};if(i.sequenceOfUltrasoundRegions){let e=i.sequenceOfUltrasoundRegions.filter(e=>(r.includes(e.regionDataType)||o.includes(`${e.physicalUnitsXDirection},${e.physicalUnitsYDirection}`))&&o.includes(`${e.physicalUnitsXDirection},${e.physicalUnitsYDirection}`));if(!e?.length)return{units:a,values:l};let t=e.find(e=>n[0]>=e.regionLocationMinX0&&n[0]<=e.regionLocationMaxX1&&n[1]>=e.regionLocationMinY0&&n[1]<=e.regionLocationMaxY1);if(!t)return{units:a,values:l};let{referencePixelX0:c=0,referencePixelY0:h=0}=t,{physicalDeltaX:u,physicalDeltaY:g}=t,p=(n[1]-t.regionLocationMinY0-h)*g,m=(n[0]-t.regionLocationMinX0-c)*u;d=-1===t.physicalUnitsYDirection?"ECG Region":"US Region",l=[m,p],a=[s[t.physicalUnitsXDirection]??"unknown",s[t.physicalUnitsYDirection]??"unknown"]}return{units:a,values:l,calibrationType:d}},h=e=>e.calibration?.aspect||1},82332:(e,t,n)=>{"use strict";n.r(t),n.d(t,{aiLog:()=>c,coreLog:()=>s,cs3dLog:()=>r,dicomConsistencyLog:()=>u,examplesLog:()=>h,getLogger:()=>a,getRootLogger:()=>i,growCutLog:()=>p,imageConsistencyLog:()=>g,loaderLog:()=>d,toolsLog:()=>l,workerLog:()=>o});let{pp:i,tZ:a,gE:r,bM:o,uu:s,UA:l,_E:d,RZ:c,UX:h,HL:u,U5:g}=n(82280).m9,p=l.getLogger("growCut")},83603:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var i=n(37972),a=n(42067);function r(e,t){if(!e||0===e.length||t<=0)return[];let n=[];for(let r=0;r{"use strict";n.d(t,{P:()=>r});var i=n(10999),a=n(64777);function r(e,t,n=[]){if(!e?.length||!e[0])return[0,0];let a=function(e){let t=e.filter(Boolean),n=t[0];if(!n||t.length<2)return{left:n,right:n,top:n,bottom:n};let i=n,a=n,r=n,o=n;for(let e=1;ea[0]&&(a=n),n[1]o[1]&&(o=n)}return{left:i,top:r,bottom:o,right:a}}(e),l=(a.top[1]+a.bottom[1])/2,d=[a.right[0],l];if(!t)return d;let{width:c,height:h}=function(e){let t=e.reduce((e,t)=>Math.max(e,t?.length??0),0);return{width:8*t+50,height:17*Math.max(e.length,1)+50}}(n),u=t.clientWidth-4,g=t.clientHeight-4,p=a.right[0],m=l-h/2;p+c>u&&(p=a.left[0]-c),p=Math.max(4,Math.min(p,u-c)),m=Math.max(4,Math.min(m,g-h));let f=function(e){let t=e.querySelector(".viewport-element");return t?.querySelector(":scope > .svg-layer")||null}(t);if(f){let e=(0,i.Pd)(f);if(e.length>0){let t=function(e,t,n,i,a,r,l,d){if(!o(e,t,n,i,a))return[e,t];let c=t;for(let t=0;t<30;t++){let t=s(e,c,n,i,a);if(!t)break;if((c=t.y+t.height+6)+i>d){c=1/0;break}}if(c!==1/0&&!o(e,c,n,i,a))return[e,Math.max(4,Math.min(c,d-i))];c=t;for(let t=0;t<30;t++){let t=s(e,c,n,i,a);if(!t)break;if((c=t.y-i-6)(0,a.A)(o,l(e,3)))}function s(e,t,n,i,r){let o=l({x:e,y:t,width:n,height:i});return r.find(e=>(0,a.A)(o,l(e,3)))}function l(e,t=0){return{minX:e.x-t,minY:e.y-t,maxX:e.x+e.width+t,maxY:e.y+e.height+t}}},85250:(e,t,n)=>{"use strict";n.r(t),n.d(t,{add:()=>Y,adjoint:()=>u,clone:()=>r,copy:()=>o,create:()=>a,determinant:()=>g,equals:()=>K,exactEquals:()=>q,frob:()=>$,fromQuat:()=>V,fromQuat2:()=>T,fromRotation:()=>A,fromRotationTranslation:()=>S,fromRotationTranslationScale:()=>x,fromRotationTranslationScaleOrigin:()=>L,fromScaling:()=>C,fromTranslation:()=>b,fromValues:()=>s,fromXRotation:()=>E,fromYRotation:()=>M,fromZRotation:()=>y,frustum:()=>O,getRotation:()=>k,getScaling:()=>P,getTranslation:()=>D,identity:()=>d,invert:()=>h,lookAt:()=>W,mul:()=>Z,multiply:()=>p,multiplyScalar:()=>J,multiplyScalarAndAdd:()=>Q,ortho:()=>G,orthoNO:()=>B,orthoZO:()=>H,perspective:()=>N,perspectiveFromFieldOfView:()=>F,perspectiveNO:()=>R,perspectiveZO:()=>U,rotate:()=>v,rotateX:()=>I,rotateY:()=>_,rotateZ:()=>w,scale:()=>f,set:()=>l,str:()=>z,sub:()=>ee,subtract:()=>j,targetTo:()=>X,translate:()=>m,transpose:()=>c});var i=n(97633);function a(){var e=new i.tb(16);return i.tb!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function r(e){var t=new i.tb(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function o(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function s(e,t,n,a,r,o,s,l,d,c,h,u,g,p,m,f){var v=new i.tb(16);return v[0]=e,v[1]=t,v[2]=n,v[3]=a,v[4]=r,v[5]=o,v[6]=s,v[7]=l,v[8]=d,v[9]=c,v[10]=h,v[11]=u,v[12]=g,v[13]=p,v[14]=m,v[15]=f,v}function l(e,t,n,i,a,r,o,s,l,d,c,h,u,g,p,m,f){return e[0]=t,e[1]=n,e[2]=i,e[3]=a,e[4]=r,e[5]=o,e[6]=s,e[7]=l,e[8]=d,e[9]=c,e[10]=h,e[11]=u,e[12]=g,e[13]=p,e[14]=m,e[15]=f,e}function d(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function c(e,t){if(e===t){var n=t[1],i=t[2],a=t[3],r=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=i,e[9]=r,e[11]=t[14],e[12]=a,e[13]=o,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function h(e,t){var n=t[0],i=t[1],a=t[2],r=t[3],o=t[4],s=t[5],l=t[6],d=t[7],c=t[8],h=t[9],u=t[10],g=t[11],p=t[12],m=t[13],f=t[14],v=t[15],I=n*s-i*o,_=n*l-a*o,w=n*d-r*o,b=i*l-a*s,C=i*d-r*s,A=a*d-r*l,E=c*m-h*p,M=c*f-u*p,y=c*v-g*p,S=h*f-u*m,T=h*v-g*m,D=u*v-g*f,P=I*D-_*T+w*S+b*y-C*M+A*E;return P?(P=1/P,e[0]=(s*D-l*T+d*S)*P,e[1]=(a*T-i*D-r*S)*P,e[2]=(m*A-f*C+v*b)*P,e[3]=(u*C-h*A-g*b)*P,e[4]=(l*y-o*D-d*M)*P,e[5]=(n*D-a*y+r*M)*P,e[6]=(f*w-p*A-v*_)*P,e[7]=(c*A-u*w+g*_)*P,e[8]=(o*T-s*y+d*E)*P,e[9]=(i*y-n*T-r*E)*P,e[10]=(p*C-m*w+v*I)*P,e[11]=(h*w-c*C-g*I)*P,e[12]=(s*M-o*S-l*E)*P,e[13]=(n*S-i*M+a*E)*P,e[14]=(m*_-p*b-f*I)*P,e[15]=(c*b-h*_+u*I)*P,e):null}function u(e,t){var n=t[0],i=t[1],a=t[2],r=t[3],o=t[4],s=t[5],l=t[6],d=t[7],c=t[8],h=t[9],u=t[10],g=t[11],p=t[12],m=t[13],f=t[14],v=t[15];return e[0]=s*(u*v-g*f)-h*(l*v-d*f)+m*(l*g-d*u),e[1]=-(i*(u*v-g*f)-h*(a*v-r*f)+m*(a*g-r*u)),e[2]=i*(l*v-d*f)-s*(a*v-r*f)+m*(a*d-r*l),e[3]=-(i*(l*g-d*u)-s*(a*g-r*u)+h*(a*d-r*l)),e[4]=-(o*(u*v-g*f)-c*(l*v-d*f)+p*(l*g-d*u)),e[5]=n*(u*v-g*f)-c*(a*v-r*f)+p*(a*g-r*u),e[6]=-(n*(l*v-d*f)-o*(a*v-r*f)+p*(a*d-r*l)),e[7]=n*(l*g-d*u)-o*(a*g-r*u)+c*(a*d-r*l),e[8]=o*(h*v-g*m)-c*(s*v-d*m)+p*(s*g-d*h),e[9]=-(n*(h*v-g*m)-c*(i*v-r*m)+p*(i*g-r*h)),e[10]=n*(s*v-d*m)-o*(i*v-r*m)+p*(i*d-r*s),e[11]=-(n*(s*g-d*h)-o*(i*g-r*h)+c*(i*d-r*s)),e[12]=-(o*(h*f-u*m)-c*(s*f-l*m)+p*(s*u-l*h)),e[13]=n*(h*f-u*m)-c*(i*f-a*m)+p*(i*u-a*h),e[14]=-(n*(s*f-l*m)-o*(i*f-a*m)+p*(i*l-a*s)),e[15]=n*(s*u-l*h)-o*(i*u-a*h)+c*(i*l-a*s),e}function g(e){var t=e[0],n=e[1],i=e[2],a=e[3],r=e[4],o=e[5],s=e[6],l=e[7],d=e[8],c=e[9],h=e[10],u=e[11],g=e[12],p=e[13],m=e[14],f=e[15];return(t*o-n*r)*(h*f-u*m)-(t*s-i*r)*(c*f-u*p)+(t*l-a*r)*(c*m-h*p)+(n*s-i*o)*(d*f-u*g)-(n*l-a*o)*(d*m-h*g)+(i*l-a*s)*(d*p-c*g)}function p(e,t,n){var i=t[0],a=t[1],r=t[2],o=t[3],s=t[4],l=t[5],d=t[6],c=t[7],h=t[8],u=t[9],g=t[10],p=t[11],m=t[12],f=t[13],v=t[14],I=t[15],_=n[0],w=n[1],b=n[2],C=n[3];return e[0]=_*i+w*s+b*h+C*m,e[1]=_*a+w*l+b*u+C*f,e[2]=_*r+w*d+b*g+C*v,e[3]=_*o+w*c+b*p+C*I,_=n[4],w=n[5],b=n[6],C=n[7],e[4]=_*i+w*s+b*h+C*m,e[5]=_*a+w*l+b*u+C*f,e[6]=_*r+w*d+b*g+C*v,e[7]=_*o+w*c+b*p+C*I,_=n[8],w=n[9],b=n[10],C=n[11],e[8]=_*i+w*s+b*h+C*m,e[9]=_*a+w*l+b*u+C*f,e[10]=_*r+w*d+b*g+C*v,e[11]=_*o+w*c+b*p+C*I,_=n[12],w=n[13],b=n[14],C=n[15],e[12]=_*i+w*s+b*h+C*m,e[13]=_*a+w*l+b*u+C*f,e[14]=_*r+w*d+b*g+C*v,e[15]=_*o+w*c+b*p+C*I,e}function m(e,t,n){var i,a,r,o,s,l,d,c,h,u,g,p,m=n[0],f=n[1],v=n[2];return t===e?(e[12]=t[0]*m+t[4]*f+t[8]*v+t[12],e[13]=t[1]*m+t[5]*f+t[9]*v+t[13],e[14]=t[2]*m+t[6]*f+t[10]*v+t[14],e[15]=t[3]*m+t[7]*f+t[11]*v+t[15]):(i=t[0],a=t[1],r=t[2],o=t[3],s=t[4],l=t[5],d=t[6],c=t[7],h=t[8],u=t[9],g=t[10],p=t[11],e[0]=i,e[1]=a,e[2]=r,e[3]=o,e[4]=s,e[5]=l,e[6]=d,e[7]=c,e[8]=h,e[9]=u,e[10]=g,e[11]=p,e[12]=i*m+s*f+h*v+t[12],e[13]=a*m+l*f+u*v+t[13],e[14]=r*m+d*f+g*v+t[14],e[15]=o*m+c*f+p*v+t[15]),e}function f(e,t,n){var i=n[0],a=n[1],r=n[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*a,e[5]=t[5]*a,e[6]=t[6]*a,e[7]=t[7]*a,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function v(e,t,n,a){var r,o,s,l,d,c,h,u,g,p,m,f,v,I,_,w,b,C,A,E,M,y,S,T,D=a[0],P=a[1],k=a[2],x=Math.hypot(D,P,k);return x0?(n[0]=(l*s+h*a+d*o-c*r)*2/u,n[1]=(d*s+h*r+c*a-l*o)*2/u,n[2]=(c*s+h*o+l*r-d*a)*2/u):(n[0]=(l*s+h*a+d*o-c*r)*2,n[1]=(d*s+h*r+c*a-l*o)*2,n[2]=(c*s+h*o+l*r-d*a)*2),S(e,t,n),e}function D(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function P(e,t){var n=t[0],i=t[1],a=t[2],r=t[4],o=t[5],s=t[6],l=t[8],d=t[9],c=t[10];return e[0]=Math.hypot(n,i,a),e[1]=Math.hypot(r,o,s),e[2]=Math.hypot(l,d,c),e}function k(e,t){var n=new i.tb(3);P(n,t);var a=1/n[0],r=1/n[1],o=1/n[2],s=t[0]*a,l=t[1]*r,d=t[2]*o,c=t[4]*a,h=t[5]*r,u=t[6]*o,g=t[8]*a,p=t[9]*r,m=t[10]*o,f=s+h+m,v=0;return f>0?(v=2*Math.sqrt(f+1),e[3]=.25*v,e[0]=(u-p)/v,e[1]=(g-d)/v,e[2]=(l-c)/v):s>h&&s>m?(v=2*Math.sqrt(1+s-h-m),e[3]=(u-p)/v,e[0]=.25*v,e[1]=(l+c)/v,e[2]=(g+d)/v):h>m?(v=2*Math.sqrt(1+h-s-m),e[3]=(g-d)/v,e[0]=(l+c)/v,e[1]=.25*v,e[2]=(u+p)/v):(v=2*Math.sqrt(1+m-s-h),e[3]=(l-c)/v,e[0]=(g+d)/v,e[1]=(u+p)/v,e[2]=.25*v),e}function x(e,t,n,i){var a=t[0],r=t[1],o=t[2],s=t[3],l=a+a,d=r+r,c=o+o,h=a*l,u=a*d,g=a*c,p=r*d,m=r*c,f=o*c,v=s*l,I=s*d,_=s*c,w=i[0],b=i[1],C=i[2];return e[0]=(1-(p+f))*w,e[1]=(u+_)*w,e[2]=(g-I)*w,e[3]=0,e[4]=(u-_)*b,e[5]=(1-(h+f))*b,e[6]=(m+v)*b,e[7]=0,e[8]=(g+I)*C,e[9]=(m-v)*C,e[10]=(1-(h+p))*C,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function L(e,t,n,i,a){var r=t[0],o=t[1],s=t[2],l=t[3],d=r+r,c=o+o,h=s+s,u=r*d,g=r*c,p=r*h,m=o*c,f=o*h,v=s*h,I=l*d,_=l*c,w=l*h,b=i[0],C=i[1],A=i[2],E=a[0],M=a[1],y=a[2],S=(1-(m+v))*b,T=(g+w)*b,D=(p-_)*b,P=(g-w)*C,k=(1-(u+v))*C,x=(f+I)*C,L=(p+_)*A,V=(f-I)*A,O=(1-(u+m))*A;return e[0]=S,e[1]=T,e[2]=D,e[3]=0,e[4]=P,e[5]=k,e[6]=x,e[7]=0,e[8]=L,e[9]=V,e[10]=O,e[11]=0,e[12]=n[0]+E-(S*E+P*M+L*y),e[13]=n[1]+M-(T*E+k*M+V*y),e[14]=n[2]+y-(D*E+x*M+O*y),e[15]=1,e}function V(e,t){var n=t[0],i=t[1],a=t[2],r=t[3],o=n+n,s=i+i,l=a+a,d=n*o,c=i*o,h=i*s,u=a*o,g=a*s,p=a*l,m=r*o,f=r*s,v=r*l;return e[0]=1-h-p,e[1]=c+v,e[2]=u-f,e[3]=0,e[4]=c-v,e[5]=1-d-p,e[6]=g+m,e[7]=0,e[8]=u+f,e[9]=g-m,e[10]=1-d-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function O(e,t,n,i,a,r,o){var s=1/(n-t),l=1/(a-i),d=1/(r-o);return e[0]=2*r*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*r*l,e[6]=0,e[7]=0,e[8]=(n+t)*s,e[9]=(a+i)*l,e[10]=(o+r)*d,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*r*2*d,e[15]=0,e}function R(e,t,n,i,a){var r,o=1/Math.tan(t/2);return e[0]=o/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=a&&a!==1/0?(r=1/(i-a),e[10]=(a+i)*r,e[14]=2*a*i*r):(e[10]=-1,e[14]=-2*i),e}var N=R;function U(e,t,n,i,a){var r,o=1/Math.tan(t/2);return e[0]=o/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=a&&a!==1/0?(r=1/(i-a),e[10]=a*r,e[14]=a*i*r):(e[10]=-1,e[14]=-i),e}function F(e,t,n,i){var a=Math.tan(t.upDegrees*Math.PI/180),r=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(o+s),d=2/(a+r);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=d,e[6]=0,e[7]=0,e[8]=-((o-s)*l*.5),e[9]=(a-r)*d*.5,e[10]=i/(n-i),e[11]=-1,e[12]=0,e[13]=0,e[14]=i*n/(n-i),e[15]=0,e}function B(e,t,n,i,a,r,o){var s=1/(t-n),l=1/(i-a),d=1/(r-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*d,e[11]=0,e[12]=(t+n)*s,e[13]=(a+i)*l,e[14]=(o+r)*d,e[15]=1,e}var G=B;function H(e,t,n,i,a,r,o){var s=1/(t-n),l=1/(i-a),d=1/(r-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=d,e[11]=0,e[12]=(t+n)*s,e[13]=(a+i)*l,e[14]=r*d,e[15]=1,e}function W(e,t,n,a){var r,o,s,l,c,h,u,g,p,m,f=t[0],v=t[1],I=t[2],_=a[0],w=a[1],b=a[2],C=n[0],A=n[1],E=n[2];return Math.abs(f-C)0&&(c*=g=1/Math.sqrt(g),h*=g,u*=g);var p=l*u-d*h,m=d*c-s*u,f=s*h-l*c;return(g=p*p+m*m+f*f)>0&&(p*=g=1/Math.sqrt(g),m*=g,f*=g),e[0]=p,e[1]=m,e[2]=f,e[3]=0,e[4]=h*f-u*m,e[5]=u*p-c*f,e[6]=c*m-h*p,e[7]=0,e[8]=c,e[9]=h,e[10]=u,e[11]=0,e[12]=a,e[13]=r,e[14]=o,e[15]=1,e}function z(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function $(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function Y(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function j(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function J(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function Q(e,t,n,i){return e[0]=t[0]+n[0]*i,e[1]=t[1]+n[1]*i,e[2]=t[2]+n[2]*i,e[3]=t[3]+n[3]*i,e[4]=t[4]+n[4]*i,e[5]=t[5]+n[5]*i,e[6]=t[6]+n[6]*i,e[7]=t[7]+n[7]*i,e[8]=t[8]+n[8]*i,e[9]=t[9]+n[9]*i,e[10]=t[10]+n[10]*i,e[11]=t[11]+n[11]*i,e[12]=t[12]+n[12]*i,e[13]=t[13]+n[13]*i,e[14]=t[14]+n[14]*i,e[15]=t[15]+n[15]*i,e}function q(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function K(e,t){var n=e[0],a=e[1],r=e[2],o=e[3],s=e[4],l=e[5],d=e[6],c=e[7],h=e[8],u=e[9],g=e[10],p=e[11],m=e[12],f=e[13],v=e[14],I=e[15],_=t[0],w=t[1],b=t[2],C=t[3],A=t[4],E=t[5],M=t[6],y=t[7],S=t[8],T=t[9],D=t[10],P=t[11],k=t[12],x=t[13],L=t[14],V=t[15];return Math.abs(n-_)<=i.p8*Math.max(1,Math.abs(n),Math.abs(_))&&Math.abs(a-w)<=i.p8*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(r-b)<=i.p8*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(o-C)<=i.p8*Math.max(1,Math.abs(o),Math.abs(C))&&Math.abs(s-A)<=i.p8*Math.max(1,Math.abs(s),Math.abs(A))&&Math.abs(l-E)<=i.p8*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(d-M)<=i.p8*Math.max(1,Math.abs(d),Math.abs(M))&&Math.abs(c-y)<=i.p8*Math.max(1,Math.abs(c),Math.abs(y))&&Math.abs(h-S)<=i.p8*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(u-T)<=i.p8*Math.max(1,Math.abs(u),Math.abs(T))&&Math.abs(g-D)<=i.p8*Math.max(1,Math.abs(g),Math.abs(D))&&Math.abs(p-P)<=i.p8*Math.max(1,Math.abs(p),Math.abs(P))&&Math.abs(m-k)<=i.p8*Math.max(1,Math.abs(m),Math.abs(k))&&Math.abs(f-x)<=i.p8*Math.max(1,Math.abs(f),Math.abs(x))&&Math.abs(v-L)<=i.p8*Math.max(1,Math.abs(v),Math.abs(L))&&Math.abs(I-V)<=i.p8*Math.max(1,Math.abs(I),Math.abs(V))}var Z=p,ee=j},85839:(e,t,n)=>{"use strict";n.d(t,{EC:()=>a.A,F6:()=>r.Ay,oS:()=>i.A});var i=n(16410),a=n(53686);n(77680);var r=n(3721)},86216:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>m});var i=n(17042),a=n(11701),r=n(58804),o=n(10463),s=n(3570),l=n(88838),d=n(53695),{staticOffsetAPI:c,otherStaticMethods:h}=o.Ay,{SlicingMode:u}=s.A,g={slicingMode:u.NONE,closestIJKAxis:{ijkMode:u.NONE,flip:!1},renderToRectangle:!1,sliceAtFocalPoint:!1,preferSizeOverAccuracy:!1};function p(e,t,n={}){Object.assign(t,g,n),l.A.extend(e,t,n),i.Ay.get(e,t,["slicingMode"]),i.Ay.setGet(e,t,["closestIJKAxis","renderToRectangle","sliceAtFocalPoint","preferSizeOverAccuracy"]),o.Ay.implementCoincidentTopologyMethods(e,t);var s=t;function c(){let t;switch(s.slicingMode){case u.X:t=0;break;case u.Y:t=1;break;case u.Z:t=2;break;default:s.closestIJKAxis={ijkMode:s.slicingMode,flip:!1};return}let n=(0,a.xk)(e.getCurrentImage().getDirection()),i=0;for(;i<3&&0===n[t+3*i];++i);let r=n[t+3*i]<0;s.closestIJKAxis={ijkMode:i,flip:r}}s.classHierarchy.push("vtkImageMapper"),e.getSliceAtPosition=t=>{let n,i=e.getCurrentImage();if(3===t.length)n=t;else if(Number.isFinite(t)){let e=i.getBounds();switch(s.slicingMode){case u.X:n=[t,(e[3]+e[2])/2,(e[5]+e[4])/2];break;case u.Y:n=[(e[1]+e[0])/2,t,(e[5]+e[4])/2];break;case u.Z:n=[(e[1]+e[0])/2,(e[3]+e[2])/2,t]}}let r=[0,0,0];i.worldToIndex(n,r);let o=i.getExtent(),{ijkMode:l}=e.getClosestIJKAxis(),d=0;switch(l){case u.I:d=(0,a.L3)(r[0],o[0],o[1]);break;case u.J:d=(0,a.L3)(r[1],o[2],o[3]);break;case u.K:d=(0,a.L3)(r[2],o[4],o[5]);break;default:return 0}return d},e.setSliceFromCamera=t=>{let n=t.getFocalPoint();switch(s.slicingMode){case u.I:case u.J:case u.K:{let t=e.getSliceAtPosition(n);e.setSlice(t)}break;case u.X:e.setSlice(n[0]);break;case u.Y:e.setSlice(n[1]);break;case u.Z:e.setSlice(n[2])}},e.setXSlice=t=>{e.setSlicingMode(u.X),e.setSlice(t)},e.setYSlice=t=>{e.setSlicingMode(u.Y),e.setSlice(t)},e.setZSlice=t=>{e.setSlicingMode(u.Z),e.setSlice(t)},e.setISlice=t=>{e.setSlicingMode(u.I),e.setSlice(t)},e.setJSlice=t=>{e.setSlicingMode(u.J),e.setSlice(t)},e.setKSlice=t=>{e.setSlicingMode(u.K),e.setSlice(t)},e.getSlicingModeNormal=()=>{let t=[0,0,0],n=e.getCurrentImage().getDirection();switch(s.slicingMode){case u.X:t[0]=1;break;case u.Y:t[1]=1;break;case u.Z:t[2]=1;break;case u.I:(0,a.n_)(n,[1,0,0],t);break;case u.J:(0,a.n_)(n,[0,1,0],t);break;case u.K:(0,a.n_)(n,[0,0,1],t)}return t},e.setSlicingMode=t=>{s.slicingMode!==t&&(s.slicingMode=t,e.getCurrentImage()&&c(),e.modified())},e.getClosestIJKAxis=()=>((void 0===s.closestIJKAxis||s.closestIJKAxis.ijkMode===u.NONE)&&e.getCurrentImage()&&c(),s.closestIJKAxis),e.computeBounds=()=>{let t=e.getCurrentImage();if(!t)return void r.Ay.reset(s.bounds);if(!s.useCustomExtents)return void r.Ay.setBounds(s.bounds,t.getBounds());let n=s.customDisplayExtent.slice(),{ijkMode:i}=e.getClosestIJKAxis(),a=s.slice;switch(i!==s.slicingMode&&(a=e.getSliceAtPosition(s.slice)),i){case u.I:n[0]=a,n[1]=a;break;case u.J:n[2]=a,n[3]=a;break;case u.K:n[4]=a,n[5]=a}r.Ay.setBounds(s.bounds,t.extentToBounds(n))},e.getBoundsForSlice=(t=s.slice,n=0)=>{let i=e.getCurrentImage();if(!i)return(0,a.Z6)();let r=i.getSpatialExtent(),{ijkMode:o}=e.getClosestIJKAxis(),l=t;switch(o!==s.slicingMode&&(l=e.getSliceAtPosition(t)),o){case u.I:r[0]=l-n,r[1]=l+n;break;case u.J:r[2]=l-n,r[3]=l+n;break;case u.K:r[4]=l-n,r[5]=l+n}return i.extentToBounds(r)},e.intersectWithLineForPointPicking=(t,n)=>(0,d.I)(t,n,e),e.intersectWithLineForCellPicking=(t,n)=>(0,d.Y)(t,n,e),e.getCurrentImage=()=>e.getInputData()}var m={newInstance:i.Ay.newInstance(p,"vtkImageMapper"),extend:p,...c,...h,...s.A}},86278:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a}});let i=n(28140)._(n(1150));function a(e,t){var n;let a={};"function"==typeof e&&(a.loader=e);let r={...a,...t};return(0,i.default)({...r,modules:null==(n=r.loadableGenerated)?void 0:n.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},86779:(e,t,n)=>{"use strict";n.r(t),n.d(t,{getLockedSegmentIndices:()=>d,isSegmentIndexLocked:()=>s,setSegmentIndexLocked:()=>l});var i=n(43385),a=n(59998),r=n(49007),o=n(16835);function s(e,t){let n=(0,i.T)(e);if(!n)throw Error(`No segmentation state found for ${e}`);let{segments:a}=n;return a[t].locked}function l(e,t,n=!0){let s=(0,i.T)(e);if(!s)throw Error(`No segmentation state found for ${e}`);let{segments:d}=s;d[t].locked=n,s?.representationData?.Contour&&function(e,t,n){let i=(0,o.getAnnotationsUIDMapFromSegmentation)(e.segmentationId);if(!i)return;let r=i.get(t);r&&r.forEach(e=>{(0,a.Un)(e,n)})}(s,t,n),(0,r.triggerSegmentationModified)(e)}function d(e){let t=(0,i.T)(e);if(!t)throw Error(`No segmentation state found for ${e}`);let{segments:n}=t;return Object.keys(n).filter(e=>n[e].locked).map(e=>parseInt(e))}},87086:(e,t,n)=>{"use strict";n.d(t,{A:()=>d});var i=n(78378),a=n(82243),r=n(23278),o=n(68764);let s=i.dt.Highlighted,l=i.r$.Active;class d extends a.A{constructor(e,t,n,i,a){super(e,t,n,i,a)}static getDefinedCursor(e,t=!1,n){var i,a,h;n||(n=(0,o.h)("color",{},s,l));let u=(i=e,a=t,h=n,`${a?"pointer":"cursor"}:${i}/${h}`),g=super.getDefinedCursor(u),p=Number((0,o.h)("pointerStrokeWidth",{}));if(!g){let i=(0,r.ft)(e);i&&(g=function(e,t,n,i,a,r){let{x:o,y:s}=e.mousePoint;return new d(function(e,t,n){let i=new Blob([(t?function(e,t){let{iconContent:n,iconSize:i,viewBox:a,mousePointerGroupString:r}=e,o=i/Math.max(a.x,a.y,1),s=16+i,l=t.pointerStrokeWidth||1;return c(` + + ${r} + ${n} + `,t)}:function(e,t){let{iconContent:n,iconSize:i,viewBox:a}=e;return c(` + + ${n} + `,t)})(e,n)],{type:"image/svg+xml"}),a=URL.createObjectURL(i);return`${a}#${e.name||"unknown"}-${t?"pointer":"cursor"}`}(e,n,{color:i,pointerStrokeWidth:a}),o,s,t,r)}(i,u,t,n,p,super.getDefinedCursor("default")),super.setDefinedCursor(u,g))}return g}}function c(e,t){let n=Object(t),i=Object.prototype.hasOwnProperty.bind(n);return(e+"").replace(/\{\{(\w+)\}\}/g,(e,t)=>i(t)?n[t]+"":"")}},87195:(e,t,n)=>{"use strict";n.d(t,{Nk:()=>r,Qy:()=>s,zj:()=>a}),n(70192),n(31895);let i={};function a(){return i}function r(e){i=e}let o=!1;function s(){if(!i.addons?.polySeg)return console.warn("PolySeg add-on not configured. This will prevent automatic conversion between segmentation representations (labelmap, contour, surface). To enable these features, install @cornerstonejs/polymorphic-segmentation and register it during initialization: cornerstoneTools.init({ addons: { polySeg } })."),null;let e=i.addons.polySeg;return o||(e.init(),o=!0),e}},87944:(e,t,n)=>{"use strict";n.d(t,{L8:()=>u,MC:()=>h,Np:()=>c,bm:()=>g});var i=n(70192),a=n(78378),r=n(49007),o=n(87635),s=n(43385),l=n(4055);let d=new Map;function c(e,t,n){let i=(0,l.I)(n)?.getUpdateFunction(e);i&&h(t,n,i)}function h(e,t,n){d.has(e)||d.set(e,new Map);let l=d.get(e);l.has(t)&&u(e,t);let c=function(e,t,n){let i=(0,o.A)(i=>{let a=i.detail?.segmentationId,o=(0,s.T)(a);a===e&&o?.representationData?.[t]&&(n(e),(0,r.triggerSegmentationModified)(e))},300);return e=>{i(e)}}(e,t,n);i.tX.addEventListener(a.sV.SEGMENTATION_DATA_MODIFIED,c),l.set(t,c)}function u(e,t){let n=d.get(e);if(!n)return;let r=n.get(t);r&&(i.tX.removeEventListener(a.sV.SEGMENTATION_DATA_MODIFIED,r),n.delete(t))}function g(e){let t=d.get(e);if(t){for(let e of t.values())i.tX.removeEventListener(a.sV.SEGMENTATION_DATA_MODIFIED,e);d.delete(e)}}},88451:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var i=n(27321),a=n(68759),r=n(65704);function o(e,t,n,s,l,d={}){let{color:c,width:h,lineWidth:u,lineDash:g}=Object.assign({color:"rgb(0, 255, 0)",width:"2",lineWidth:void 0,lineDash:void 0},d),p=(0,i.A)(t,"rect",n),m=e.getSvgNode(p),f=[Math.min(s[0],l[0]),Math.min(s[1],l[1])],v=Math.abs(s[0]-l[0]),I=Math.abs(s[1]-l[1]),_={x:`${f[0]}`,y:`${f[1]}`,width:`${v}`,height:`${I}`,stroke:c,fill:"black","stroke-width":u||h,"stroke-dasharray":g};if(m)(0,a.A)(_,m),e.setNodeTouched(p);else{let t=document.createElementNS("http://www.w3.org/2000/svg","rect");(0,r.A)(_,t),e.appendNode(t,p)}}},88819:(e,t,n)=>{"use strict";n.d(t,{A:()=>E});var i=n(70192),a=n(85839);n(90174);var r=n(41067),o=n(86779),s=n(43385),l=n(5469),d=n(19921),c=n(46702),h=n(78378),u=n(6001),g=n(93022),p=n(12487),m=n(42067),f=n(49007),v=n(61034),I=n(91792),_=n(66442),w=n(41918),b=n(60212),C=n(4101);class A extends a.oS{constructor(e,t){super(e,t),this.memoMap=new Map,this.acceptedMemoIds=new Map,this.centerSegmentIndexInfo={segmentIndex:null,hasSegmentIndex:!1,hasPreviewIndex:!1,changedIndices:[]}}_cancelTouchDraw(e){if(!this.isDrawing)return;let t=this.editData?.viewportIdsToRender;this._deactivateDraw(e),(0,C.Q_)(e),this.editData=null,this.isDrawing=!1,t&&(0,b.A)(t)}_historyRedoHandler(e){let{id:t,operationType:n}=e.detail;if("labelmap"===n){if(this.acceptedMemoIds.has(t)){this._hoverData=null;let e=this.acceptedMemoIds.get(t),n=e?.element,a=this.getOperationData(n);if(!a)return;a.segmentIndex=e?.segmentIndex,n&&this.applyActiveStrategyCallback((0,i.kJ)(n),a,h.Yh.AcceptPreview)}this._previewData.isDrag=!0}}get _previewData(){return A.previewData}hasPreviewData(){return!!this._previewData.preview}shouldResolvePreviewRequests(){return("Active"===this.mode||"Enabled"===this.mode)&&this.hasPreviewData()}createMemo(e,t){let n=t.id;if(this.memo&&this.memo.segmentationVoxelManager===t)return this.memo;let i=this.memoMap.get(n);return i?i.redoVoxelManager&&(i=u.hH(e,t),this.memoMap.set(n,i)):(i=u.hH(e,t),this.memoMap.set(n,i)),this.memo=i,i}createEditData(e){let{viewport:t}=(0,i.kJ)(e),n=(0,r.T)(t.id);if(!n)return null;let{segmentationId:a}=n,l=(0,o.getLockedSegmentIndices)(a),{representationData:d}=(0,s.T)(a);return this.getEditData({viewport:t,representationData:d,segmentsLocked:l,segmentationId:a})}getEditData({viewport:e,representationData:t,segmentsLocked:n,segmentationId:a}){let r=(0,I.A)(e),o=(0,c.Q)(a),d=(0,s.T)(a),h=o?(0,_.Nf)(d,o):void 0;if("volume"===r||e instanceof i.ei){let t=h?(0,_.kL)(h):void 0,a=h?.volumeId??t?.volumeId;if(!t||!a)return;let r=e.getActors().filter(e=>e.referencedId).map(e=>i.PP.getVolume(e.referencedId)).filter(e=>!!e),o=r.find(e=>i.BF.isEqual(e.dimensions,t.dimensions))?.volumeId||r[0]?.volumeId;return{volumeId:a,referencedVolumeId:this.configuration.threshold?.volumeId??h?.referencedVolumeId??t.referencedVolumeId??o,segmentsLocked:n}}if("image"===r){let t=(0,l.vl)(e.id,a);if(!t)return;return{imageId:t,segmentsLocked:n}}let u=new CustomEvent(i.fX.sV.ERROR_EVENT,{detail:{type:"Segmentation",message:"Cannot perform brush operation on the selected viewport"},cancelable:!0});return i.tX.dispatchEvent(u),null}createHoverData(e,t){let{viewport:n}=(0,i.kJ)(e),{viewPlaneNormal:a,viewUp:r}=(0,w.A)(n);if(!a||!r)return;let o=[n.id],s=this.getActiveSegmentationData(n);if(!s)return;let{segmentIndex:l,segmentationId:d,segmentColor:c}=s;return{brushCursor:{metadata:{viewPlaneNormal:[...a],viewUp:[...r],FrameOfReferenceUID:n.getFrameOfReferenceUID(),referencedImageId:"",toolName:this.getToolName(),segmentColor:c},data:{}},centerCanvas:t,segmentIndex:l,viewport:n,segmentationId:d,segmentColor:c,viewportIdsToRender:o}}getActiveSegmentationData(e){let t=e.id,n=(0,r.T)(t);if(!n)return;let{segmentationId:i}=n,a=(0,c.Q)(i);if(!a)return;let o=(0,d.getSegmentIndexColor)(t,i,a);return{segmentIndex:a,segmentationId:i,segmentColor:o}}getOperationData(e){let t=this._editData||this.createEditData(e),n=this._hoverData||this.createHoverData(e);if(!t||!n)return;let{segmentIndex:a,segmentationId:r,brushCursor:o}=n,{data:s,metadata:l={}}=o||{},{viewPlaneNormal:c,viewUp:h}=l,u=s?.editPoints||s?.handles?.points,g=this.configuration.preview?.previewColors?.[a],{viewport:p}=(0,i.kJ)(e)||{};if(!p||!a||!r)return;let m=(0,d.getSegmentIndexColor)(p.id,r,a);if(!g&&!m)return;let f=null,v=null;return this.configuration.preview?.enabled&&(f=g||function(e,t,n,i,a=.4){return[Math.round(e+(255-e)*a),Math.round(t+(255-t)*a),Math.round(n+(255-n)*a),i]}(...m),v=255),{...t,points:u,segmentIndex:a,viewPlaneNormal:c,previewOnHover:!this._previewData.isDrag,toolGroupId:this.toolGroupId,segmentationId:r,viewUp:h,centerSegmentIndexInfo:this.centerSegmentIndexInfo,activeStrategy:this.configuration.activeStrategy,configuration:this.configuration,previewColor:f,previewSegmentIndex:v,createMemo:this.createMemo.bind(this),hoverData:this._hoverData}}addPreview(e=this._previewData.element,t){let{_previewData:n}=this,a=t?.acceptReject;!0===a?this.acceptPreview(e):!1===a&&this.rejectPreview(e);let r=(0,i.kJ)(e),o=this.getOperationData(e);if(!r||!o)return;let s=this.applyActiveStrategyCallback(r,o,h.Yh.AddPreview);return n.isDrag=!0,s?.modified&&(n.preview=s,n.element=e),s}rejectPreview(e=this._previewData.element){if(!e)return;this.doneEditMemo();let t=(0,i.kJ)(e),n=this.getOperationData(e);t&&n&&(this.applyActiveStrategyCallback(t,n,h.Yh.RejectPreview),this._previewData.preview=null,this._previewData.isDrag=!1)}acceptPreview(e=this._previewData.element){if(!e)return;let t=this.getOperationData(e);if(!t)return;this.memo&&this.memo.id&&this.acceptedMemoIds.set(this.memo.id,{element:e,segmentIndex:t.segmentIndex});let n=(0,i.kJ)(e);this.applyActiveStrategyCallback(n,t,h.Yh.AcceptPreview),this.doneEditMemo(),this._previewData.preview=null,this._previewData.isDrag=!1}static viewportContoursToLabelmap(e,t){let n=t?.removeContours??!0,i=(0,g.getAllAnnotations)(),a=(0,p.k9)(e,i);if(!a?.length)return;let r=a.filter(e=>e.data.contour?.polyline?.length);if(!r.length)return;let{memo:o,segmentationId:s}=new A({},{configuration:{strategies:{FILL_INSIDE_CIRCLE:v.fillInsideCircle},activeStrategy:"FILL_INSIDE_CIRCLE"}}).addPreview(e.element),l=o?.voxelManager,d=l.sourceVoxelManager||l,{dimensions:h}=l,u=e.getDefaultActor().actor.getMapper().getInputData();for(let e of r){let t=[[1/0,-1/0],[1/0,-1/0],[1/0,-1/0]],{polyline:i}=e.data.contour;for(let e of i)u.worldToIndex(e).forEach((e,n)=>{t[n][0]=Math.min(t[n][0],e),t[n][1]=Math.max(t[n][1],e)});t.forEach((e,t)=>{e[0]=Math.round(Math.max(0,e[0])),e[1]=Math.round(Math.min(h[t]-1,e[1]))});let a=(0,c.Q)(s),r=e.data.handles?.[0]||i[0],o=u.worldToIndex(r).map(Math.round),p=d.getAtIJKPoint(o)||0,f=!1,v=!1;for(let e of i){let t=u.worldToIndex(e).map(Math.round),n=d.getAtIJKPoint(t);n===p?f=!0:n>=0&&(v=!0)}let I=f&&v?p:0===p?a:0;for(let e=t[0][0];e<=t[0][1];e++)for(let n=t[1][0];n<=t[1][1];n++)for(let a=t[2][0];a<=t[2][1];a++){let t=u.indexToWorld([e,n,a]);(0,m.isPointInsidePolyline3D)(t,i)&&l.setAtIJK(e,n,a,I)}n&&(0,g.removeAnnotation)(e.annotationUID)}let I=l.getArrayOfModifiedSlices();(0,f.triggerSegmentationDataModified)(s,I)}}A.previewData={preview:null,element:null,timerStart:0,timer:null,startPoint:[NaN,NaN],isDrag:!1};let E=A},89602:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var i=n(23230);let a=async function(e,t,n,a=!1,r=!1){let o=[];for(let t of n){let n=e.getViewport(t);if(!n)throw Error(`Viewport with Id ${t} does not exist`);if(!(0,i.A)(n))return void console.warn(`Viewport with Id ${t} does not implement addVolumes. Cannot add volume to this viewport.`);o.push(n)}await Promise.all(o.map(e=>e.addVolumes(t,a,r)))}},89681:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var i=n(76722);let a="http://www.w3.org/2000/svg";function r(e,t,n,o,s,l={}){if(isNaN(o[0])||isNaN(o[1])||isNaN(s[0])||isNaN(s[1]))return;let{viaMarker:d=!1,color:c="rgb(0, 255, 0)",markerSize:h=10}=l;if(!d)return void function(e,t,n,a,r,o={}){let{color:s="rgb(0, 255, 0)",width:l=2,lineWidth:d,lineDash:c}=o,h=Math.atan2(r[1]-a[1],r[0]-a[0]),u={start:[r[0]-10*Math.cos(h-Math.PI/7),r[1]-10*Math.sin(h-Math.PI/7)],end:r},g={start:[r[0]-10*Math.cos(h+Math.PI/7),r[1]-10*Math.sin(h+Math.PI/7)],end:r};(0,i.A)(e,t,n,a,r,{color:s,width:l,lineWidth:d,lineDash:c}),(0,i.A)(e,t,"2",u.start,u.end,{color:s,width:l,lineWidth:d,lineDash:c}),(0,i.A)(e,t,"3",g.start,g.end,{color:s,width:l,lineWidth:d,lineDash:c})}(e,t,n,o,s,l);let u=e.svgLayerElement.id,g=`arrow-${t}`,p=`${g}-${u}`,m=e.svgLayerElement.querySelector("defs"),f=m.querySelector(`#${p}`);if(f){f.setAttribute("markerWidth",`${h}`),f.setAttribute("markerHeight",`${h}`);let e=f.querySelector("path");e&&e.setAttribute("fill",c)}else{(f=document.createElementNS(a,"marker")).setAttribute("id",p),f.setAttribute("viewBox","0 0 10 10"),f.setAttribute("refX","8"),f.setAttribute("refY","5"),f.setAttribute("markerWidth",`${h}`),f.setAttribute("markerHeight",`${h}`),f.setAttribute("orient","auto");let e=document.createElementNS(a,"path");e.setAttribute("d","M 0 0 L 10 5 L 0 10 z"),e.setAttribute("fill",c),f.appendChild(e),m.appendChild(f)}l.markerEndId=p,(0,i.A)(e,t,n,o,s,l)}},89819:(e,t,n)=>{"use strict";n(70192)},90734:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var i=n(31677),a=n(96674),r=n(37972);function o(e){let t=[],n=[];e.forEach((e,t)=>{(0,r.A)(e)&&n.push({polyline:e,originalIndex:t})});for(let e=0;e0&&t.push({contourIndex:r.originalIndex,holeIndexes:d.sort((e,t)=>e-t)})}return t.sort((e,t)=>e.contourIndex-t.contourIndex)}},91006:(e,t,n)=>{"use strict";n.d(t,{K:()=>a});var i=n(32207);function a(){return i._6.getState().segmentations}},91336:(e,t,n)=>{"use strict";n.d(t,{Bw:()=>p,Il:()=>_,Io:()=>u,Ln:()=>h,Om:()=>f,Re:()=>d,S8:()=>m,WQ:()=>l,e$:()=>v,fA:()=>o,g7:()=>I,hG:()=>g,hZ:()=>s,hs:()=>c,jb:()=>w,o8:()=>r,vt:()=>a,xg:()=>b});var i=n(97633);function a(){var e=new i.tb(2);return i.tb!=Float32Array&&(e[0]=0,e[1]=0),e}function r(e){var t=new i.tb(2);return t[0]=e[0],t[1]=e[1],t}function o(e,t){var n=new i.tb(2);return n[0]=e,n[1]=t,n}function s(e,t,n){return e[0]=t,e[1]=n,e}function l(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}function d(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function c(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}function h(e,t,n,i){return e[0]=t[0]+n[0]*i,e[1]=t[1]+n[1]*i,e}function u(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1])}function g(e,t){var n=t[0]-e[0],i=t[1]-e[1];return n*n+i*i}function p(e){return Math.hypot(e[0],e[1])}function m(e,t){var n=t[0],i=t[1],a=n*n+i*i;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e}function f(e,t){return e[0]*t[0]+e[1]*t[1]}function v(e,t,n,i){var a=t[0]-n[0],r=t[1]-n[1],o=Math.sin(i),s=Math.cos(i);return e[0]=a*s-r*o+n[0],e[1]=a*o+r*s+n[1],e}function I(e,t){var n=e[0],i=e[1],a=t[0],r=t[1],o=Math.sqrt(n*n+i*i)*Math.sqrt(a*a+r*r);return Math.acos(Math.min(Math.max(o&&(n*a+i*r)/o,-1),1))}var _=p,w=d,b=u;a()},92066:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var i=n(27321),a=n(68759),r=n(65704);let o=function(e,t,n,o,s={},l=""){let{color:d,width:c,lineWidth:h,lineDash:u}=Object.assign({color:"rgb(0, 255, 0)",width:"2",lineWidth:void 0,lineDash:void 0},s),g=(0,i.A)(t,"ellipse",n),p=e.getSvgNode(g),[m,f,v,I]=o,_=Math.hypot(v[0]-I[0],v[1]-I[1]),w=Math.hypot(f[0]-m[0],f[1]-m[1]),b=180*Math.atan2(v[1]-I[1],v[0]-I[0])/Math.PI,C=[(v[0]+I[0])/2,(f[1]+m[1])/2],A={cx:`${C[0]}`,cy:`${C[1]}`,rx:`${_/2}`,ry:`${w/2}`,stroke:d,fill:"transparent",transform:`rotate(${b} ${C[0]} ${C[1]})`,"stroke-width":h||c,"stroke-dasharray":u};if(p)(0,a.A)(A,p),e.setNodeTouched(g);else{let t=document.createElementNS("http://www.w3.org/2000/svg","ellipse");""!==l&&t.setAttribute("data-id",l),(0,r.A)(A,t),e.appendNode(t,g)}}},92570:(e,t,n)=>{"use strict";n.r(t),n.d(t,{distanceToPoint:()=>r,distanceToPointSquared:()=>a,intersectAABB:()=>i.A});var i=n(64777);function a(e,t){let n=e.maxX-e.minX,i=e.maxY-e.minY,a=[n,i],r=[e.minX+n/2,e.minY+i/2],o=[Math.abs(t[0]-r[0]),Math.abs(t[1]-r[1])],s=o[0]-.5*a[0],l=o[1]-.5*a[1];if(s>0&&l>0)return s*s+l*l;let d=Math.max(s,0)+Math.max(l,0);return d*d}function r(e,t){return Math.sqrt(a(e,t))}},93022:(e,t,n)=>{"use strict";let i;n.r(t),n.d(t,{addAnnotation:()=>m,addChildAnnotation:()=>u,clearParentAnnotation:()=>h,getAllAnnotations:()=>c,getAnnotation:()=>d,getAnnotationManager:()=>o,getAnnotations:()=>l,getChildAnnotations:()=>p,getNumberOfAnnotations:()=>f,getParentAnnotation:()=>g,invalidateAnnotation:()=>_,removeAllAnnotations:()=>v,removeAnnotation:()=>function e(t){if(!t)return;let n=i,a=n.getAnnotation(t);a&&(a.childAnnotationUIDs?.forEach(t=>e(t)),n.removeAnnotation(t),(0,r.triggerAnnotationRemoved)({annotation:a,annotationManagerUID:n.uid}))},removeAnnotations:()=>I,setAnnotationManager:()=>s});var a=n(70192),r=n(34699);function o(){return i}function s(e){i=e}function l(e,t){let n=i,a=n.getGroupKey(t);return n.getAnnotations(a,e)}function d(e){return i.getAnnotation(e)}function c(){return i.getAllAnnotations()}function h(e){let{annotationUID:t,parentAnnotationUID:n}=e;if(!n)return;let i=d(n),a=i.childAnnotationUIDs.indexOf(t);i.childAnnotationUIDs.splice(a,1),e.parentAnnotationUID=void 0}function u(e,t){let{annotationUID:n}=e,{annotationUID:i}=t;h(t),e.childAnnotationUIDs||(e.childAnnotationUIDs=[]),e.childAnnotationUIDs.includes(i)||(e.childAnnotationUIDs.push(i),t.parentAnnotationUID=n)}function g(e){return e.parentAnnotationUID?d(e.parentAnnotationUID):void 0}function p(e){return e.childAnnotationUIDs?.map(e=>d(e))??[]}function m(e,t){e.annotationUID||(e.annotationUID=a.BF.uuidv4());let n=i;if(t instanceof HTMLDivElement&&(0,a.kJ)(t)){let i=n.getGroupKey(t);n.addAnnotation(e,i),(0,r.triggerAnnotationAddedForElement)(e,t)}else n.addAnnotation(e,void 0),(0,r.triggerAnnotationAddedForFOR)(e);return e.annotationUID}function f(e,t){let n=i,a=n.getGroupKey(t);return n.getNumberOfAnnotations(a,e)}function v(){let e=i;for(let t of e.removeAllAnnotations())(0,r.triggerAnnotationRemoved)({annotation:t,annotationManagerUID:e.uid})}function I(e,t){let n=i,a=n.getGroupKey(t);for(let t of n.removeAnnotations(a,e))(0,r.triggerAnnotationRemoved)({annotation:t,annotationManagerUID:n.uid})}function _(e){let t=e;for(;t;)t.invalidated=!0,t=t.parentAnnotationUID?d(t.parentAnnotationUID):void 0}},93084:(e,t,n)=>{"use strict";n.d(t,{KM:()=>o,QO:()=>_,bY:()=>I,o:()=>w,yc:()=>v});var i=n(70192),a=n(50923),r=n(65509);let o=.999,s="labelmapImageMapper";function l(e){return e===i.fX.gd.COMPOSITE||e===i.fX.gd.AVERAGE_INTENSITY_BLEND}function d(e){return e.type===i.fX.NV.PLANAR_NEXT&&c(e)===i.T7.VTK_VOLUME_SLICE}function c(e){let t=h(e);if(t){let n=e.getDisplaySetRenderMode?.(t);if(n)return n}return e.getDefaultActor?.()?.actorMapper?.renderMode}function h(e){let t=e.getSourceDataId?.();if(t)return t;let n=e._debug?.renderModes;if(n)return Object.entries(n).find(([t,n])=>e.getDisplaySetRole?.(t)==="source"&&n===i.T7.VTK_VOLUME_SLICE)?.[0]??Object.entries(n).find(([,e])=>e===i.T7.VTK_VOLUME_SLICE)?.[0]}function u(e){return!!(e&&g(e.viewPlaneNormal)&&g(e.viewUp))}function g(e){return!!(e&&"number"==typeof e.length&&e.length>=3&&Number.isFinite(Number(e[0]))&&Number.isFinite(Number(e[1]))&&Number.isFinite(Number(e[2])))}function p(e){if(!e.getDisplaySetPresentation)return;let t=h(e);return t?e.getDisplaySetPresentation(t):void 0}function m(e){if(e instanceof i.PX)return e.getBlendMode?.();if(!d(e))return;let t=p(e)?.blendMode;return void 0!==t?t:i.fX.gd.AVERAGE_INTENSITY_BLEND}function f(e){if(e instanceof i.PX)return e.getSlabThickness?.()??.1;if(!d(e))return .1;let t=(function(e){let t=e.getDefaultActor?.();return t?.actorMapper?.mapper??t?.actorMapper?.actor?.getMapper?.()})(e)?.getSlabThickness?.();return"number"==typeof t?t:p(e)?.slabThickness??.1}function v(e){if(e?.useSliceRendering)return!0;if("undefined"==typeof window)return!1;let t=new URLSearchParams(window.location.search);if(!t.has(s))return!1;let n=t.get(s);if(null===n||""===n)return!0;let i=n.trim().toLowerCase();return"0"!==i&&"false"!==i&&"off"!==i}function I(e,t){if(v(t))return!0;if(!e?.representationData?.Labelmap)return!1;let n=(0,r.m)(e);return n.length>1&&n.some(e=>"stack"===e.storageKind)}function _(e){let t=e instanceof i.PX,n=d(e);if(!t&&!n)return!1;let a=m(e);if(t&&!l(a)||f(e)>.101)return!1;if(t)try{e.getSliceViewInfo()}catch{return!1}return!0}function w(e){let t,n=e instanceof i.PX,r=d(e);if(!n&&!r)return{key:"unsupported:viewport",sliceIndex:NaN,supported:!1};let o=function(e){let t=e.getResolvedView?.()?.toICamera?.();if(u(t))return t;let n=e.getCamera?.();return u(n)?n:void 0}(e);if(!o)return{key:"unsupported:camera",sliceIndex:NaN,supported:!1};let{viewPlaneNormal:s,viewUp:h}=o,g=a.S8(a.vt(),s),p=a.S8(a.vt(),h);if(n)try{t=e.getSliceViewInfo().sliceIndex}catch{t=void 0}else t=e.getCurrentImageIdIndex?.();let v=m(e),I=f(e),_=[g.map(e=>e.toFixed(3)).join(","),p.map(e=>e.toFixed(3)).join(",")].join("|");if(n&&!l(v))return{key:`unsupported:blend:${v}:${_}`,sliceIndex:t??NaN,supported:!1};if(I>.101)return{key:`unsupported:slab:${I.toFixed(3)}:${_}`,sliceIndex:t??NaN,supported:!1};if(n)try{e.getSliceViewInfo()}catch{return{key:`unsupported:oblique:${_}`,sliceIndex:t??NaN,supported:!1}}return r&&c(e)!==i.T7.VTK_VOLUME_SLICE?{key:`unsupported:renderMode:${_}`,sliceIndex:t??NaN,supported:!1}:{key:`supported:${_}:${t??0}`,sliceIndex:t??NaN,supported:!0}}},93287:(e,t,n)=>{"use strict";n.d(t,{E8:()=>d,JC:()=>m,OE:()=>p,kN:()=>g,nc:()=>c,us:()=>u});var i=n(90174),a=n(51200),r=n(70192),o=n(32207),s=n(87944),l=n(4055);function d(e,t,n){return h(e,t,n)}function c(e,t,n){return h(e,t,n)}function h(e,t,n){let{segmentationId:i,type:d}=t;return function(e,t,n,i){(0,a.r$)(e,{segmentationId:t,type:n}).forEach(t=>{let n=(0,l.I)(t.type);n?n.removeRepresentation(e,t.segmentationId,i):console.warn(`No display registered for segmentation representation type ${t.type}.`),(0,s.L8)(t.segmentationId,t.type)});let{viewport:o}=(0,r.yj)(e)||{};o&&o.render()}(e,i,d,n),o._6.removeSegmentationRepresentations(e,{segmentationId:i,type:d})}function u(){o._6.getAllViewportSegmentationRepresentations().forEach(({viewportId:e,representations:t})=>{t.forEach(({segmentationId:t,type:n})=>{h(e,{segmentationId:t,type:n},void 0)})}),o._6.resetState()}function g(e,t,n){h(e,{segmentationId:t,type:i.A.Labelmap},n)}function p(e,t,n){h(e,{segmentationId:t,type:i.A.Contour},n)}function m(e,t,n){h(e,{segmentationId:t,type:i.A.Surface},n)}},94070:(e,t,n)=>{"use strict";var i,a;n.d(t,{i:()=>i,q:()=>a}),function(e){e[e.Primary=1]="Primary",e[e.Secondary=2]="Secondary",e[e.Primary_And_Secondary=3]="Primary_And_Secondary",e[e.Auxiliary=4]="Auxiliary",e[e.Primary_And_Auxiliary=5]="Primary_And_Auxiliary",e[e.Secondary_And_Auxiliary=6]="Secondary_And_Auxiliary",e[e.Primary_And_Secondary_And_Auxiliary=7]="Primary_And_Secondary_And_Auxiliary",e[e.Fourth_Button=8]="Fourth_Button",e[e.Fifth_Button=16]="Fifth_Button",e[e.Wheel=524288]="Wheel",e[e.Wheel_Primary=524289]="Wheel_Primary"}(i||(i={})),function(e){e[e.Shift=16]="Shift",e[e.Ctrl=17]="Ctrl",e[e.Alt=18]="Alt",e[e.Meta=91]="Meta",e[e.ShiftCtrl=1617]="ShiftCtrl",e[e.ShiftAlt=1618]="ShiftAlt",e[e.ShiftMeta=1691]="ShiftMeta",e[e.CtrlAlt=1718]="CtrlAlt",e[e.CtrlMeta=1791]="CtrlMeta",e[e.AltMeta=1891]="AltMeta"}(a||(a={}))},94194:(e,t,n)=>{},95324:(e,t,n)=>{"use strict";n.d(t,{a:()=>r,z:()=>o});var i=n(43385),a=n(32207);function r(e,t){return o(e).map(e=>(t&&e.type,(0,i.T)(e.segmentationId))).filter(e=>void 0!==e)}function o(e){return a._6.getState().viewportSegRepresentations[e]}},97132:(e,t,n)=>{"use strict";n.d(t,{DU:()=>d,ED:()=>o,Th:()=>l,wV:()=>s});var i=n(70192),a=n(78378);function r(e,t,n){let a=(0,i.yj)(e);if(!a)return;let{renderingEngine:r,viewport:o}=a;if(!r||!o)return;let s=o.getActors().filter(n);return s.length>0?s[0]:void 0}function o(e,t){return function(e,t){let n=(0,i.yj)(e);if(!n)return;let{renderingEngine:a,viewport:r}=n;if(!a||!r)return;let o=r.getActors().filter(t);return o.length>0?o:void 0}(e,e=>e.representationUID?.startsWith(`${t}-${a.D_.Labelmap}`))}function s(e,t,n){return r(e,t,e=>e.representationUID?.startsWith(`${t}-${a.D_.Labelmap}`)&&(!n||e.referencedId===n))}function l(e,t,n){return r(e,t,e=>e.representationUID===d(t,n))}function d(e,t){return`${e}-${a.D_.Surface}-${t}`}},97442:(e,t,n)=>{"use strict";n.d(t,{O8:()=>i.removeAnnotation,Rh:()=>i.getAnnotations,gw:()=>i.getAnnotation,lC:()=>i.addAnnotation}),n(36427),n(59998),n(12577);var i=n(93022);n(60721)},98723:(e,t,n)=>{"use strict";n.d(t,{V0:()=>o.V,RZ:()=>c.RZ,v1:()=>l,rK:()=>c.rK,Ys:()=>d.A,M:()=>r.M});var i=n(70192),a=n(97442),r=n(76818),o=n(36965),s=n(34699);function l(e){let{polyline:t}=e.data?.contour||{};if(!t||t.length<3)return void console.warn("Skipping creation of new annotation due to invalid polyline:",t);(0,a.O8)(e.annotationUID),(0,r.M)(e);let n=t[0],l=t[t.length-1],d={metadata:{...e.metadata,toolName:"PlanarFreehandContourSegmentationTool",originalToolName:e.metadata.originalToolName||e.metadata.toolName},data:{cachedStats:{},handles:{points:[n,l],textBox:e.data.handles.textBox?{...e.data.handles.textBox}:void 0},contour:{...e.data.contour},spline:e.data.spline,segmentation:{...e.data.segmentation}},annotationUID:i.BF.uuidv4(),highlighted:!0,invalidated:!0,isLocked:!1,isVisible:void 0,interpolationUID:e.interpolationUID,interpolationCompleted:e.interpolationCompleted};return(0,a.lC)(d,e.metadata.FrameOfReferenceUID),(0,o.V)(d),(0,s.triggerAnnotationModified)(d),d}n(5801),n(51740);var d=n(26410);n(51718),n(34355),n(6088);var c=n(63306);n(44120),n(2997),n(96310),n(68566)}}]); \ No newline at end of file diff --git a/_next/static/chunks/178.c399c7425cacc4ec.js b/_next/static/chunks/178.c399c7425cacc4ec.js new file mode 100644 index 0000000000000000000000000000000000000000..183e364a22b782be708cfb861dae58841766795b --- /dev/null +++ b/_next/static/chunks/178.c399c7425cacc4ec.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[178],{36178:(e,t,n)=>{n.d(t,{A5:()=>h,BX:()=>C,CB:()=>V,Oh:()=>S,Pf:()=>z,Q4:()=>v,S2:()=>o,cJ:()=>s,lD:()=>w,ow:()=>p,rr:()=>I,wn:()=>E,xI:()=>f});var l=n(70192),r=n(54987),i=n(20205);let a=null;function u(){return null!=a||(a=(async()=>{await (0,l.Ts)(),await (0,i.Ts)(),(0,r.Ts)(),l.R2.registerImageLoader("nifti",r.nL),(0,i.Gx)(i.Du),(0,i.Gx)(i.CH),(0,i.Gx)(i.OQ),(0,i.Gx)(i.ae),(0,i.Gx)(i.LW),l.PP.setMaxCacheSize(5e8),window.cornerstone={cache:l.PP,cacheStats:E}})()),a}let c=new Map;async function o(e){await u();let t=c.get(e);if(t)return t;let n=(0,r.AZ)({url:e}).catch(t=>{throw c.delete(e),t});return c.set(e,n),n}function f(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:99,l=[],r=Math.max(1,Math.floor(e.length/2e5));for(let t=0;t0&&l.push(n)}if(l.length<100)return null;l.sort((e,t)=>e-t);let i=e=>l[Math.min(l.length-1,Math.floor(e/100*l.length))],a=i(t),u=i(n);return u>a?{lower:a,upper:u}:null}function h(e){var t,n;let l=e.voxelManager;if(!l)return null;try{let e=null==(t=l.getMiddleSliceData)?void 0:t.call(l);if(null==e?void 0:e.length)return e}catch(e){}try{let e=null==(n=l.getScalarData)?void 0:n.call(l);if(null==e?void 0:e.length)return e}catch(e){}let r=e.dimensions;if(!l.getAtIndex||!r||r.length<3)return null;let i=r[0]*r[1]*r[2];if(!i)return null;let a=Math.max(1,Math.floor(i/1e5)),u=[];for(let e=0;enull==e?void 0:e.volumeId).filter(Boolean),n=l.PP.getCacheSize()>=.6*l.PP.getMaxCacheSize(),r=t.length>6;if(!n&&!r)return;let i=[...t.filter(t=>!g.includes(t)&&!e.has(t)),...g.filter(n=>t.includes(n)&&!e.has(n))],a=t.length;for(let e of i){if(!(l.PP.getCacheSize()>=.6*l.PP.getMaxCacheSize())&&a<=6)break;try{l.PP.removeVolumeLoadObject(e);let t=g.indexOf(e);for(let[n]of(-1!==t&&g.splice(t,1),c))e.endsWith(n)&&c.delete(n);a-=1}catch(e){}}}()}let g=[],m="medtrace",P=null;async function w(){return await u(),P&&P.hasBeenDestroyed&&(P=null),null!=P||(P=new l.vR(m)),P}let v=m,x=!0,y=l.fX.sV.CAMERA_MODIFIED,M=new Map;function p(e,t){let n=function(e){var t;let n=M.get(e);if(n)return n;let l="medtrace-slice-".concat(e);return n=null!=(t=i._K.getSynchronizer(l))?t:i._K.createSynchronizer(l,y,(e,t,n)=>{if(t.viewportId===n.viewportId)return;let l=P;if(!l)return;let r=l.getViewport(t.viewportId),i=l.getViewport(n.viewportId);if(!r||!i)return;let a=function(e){try{let t=e.getNumberOfSlices();if(!t||t<2)return null;let n=e.getSliceIndex();if(!Number.isFinite(n))return null;return Math.min(1,Math.max(0,n/(t-1)))}catch(e){return null}}(r);if(null!==a)try{let e=i.getNumberOfSlices();if(!e||e<2)return;let t=Math.round(a*(e-1));if(i.getSliceIndex()===t)return;let n=i.getVolumeId();if(!n)return;i.setViewReference({volumeId:n,viewPlaneNormal:i.getCamera().viewPlaneNormal,sliceIndex:t}),i.render()}catch(e){}}),M.set(e,n),n}(e);try{n.add({renderingEngineId:m,viewportId:t}),n.setEnabled(x)}catch(e){}}function S(e,t){try{var n;null==(n=M.get(e))||n.remove({renderingEngineId:m,viewportId:t})}catch(e){}}function I(e){for(let t of(x=e,M.values()))try{t.setEnabled(e)}catch(e){}}function C(){return x}let b=new Set;function z(e){return b.add(e),()=>b.delete(e)}function V(){try{null==P||P.destroy()}catch(e){}for(let[e,t]of(P=null,M)){try{t.destroy()}catch(e){}M.delete(e)}try{l.PP.purgeVolumeCache()}catch(e){}for(let e of(c.clear(),g.length=0,d.clear(),b))e()}function E(){return{bytes:l.PP.getCacheSize(),max:l.PP.getMaxCacheSize(),volumes:l.PP.getVolumes().length}}}}]); \ No newline at end of file diff --git a/_next/static/chunks/199.9b66732a108fbca1.js b/_next/static/chunks/199.9b66732a108fbca1.js new file mode 100644 index 0000000000000000000000000000000000000000..e93b63ea93b82e491cf4ceb60128f1a41875dd96 --- /dev/null +++ b/_next/static/chunks/199.9b66732a108fbca1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[199],{22199:(e,t,n)=>{n.r(t),n.d(t,{NiftiViewport:()=>m,ORIENTATIONS:()=>f});var r=n(95155),l=n(70192),o=n(20205),i=n(12115),a=n(85330),c=n(36178);let{NV:u,KY:s}=l.fX,{iP:d}=o.fX,f=["axial","coronal","sagittal"],v={axial:s.AXIAL,coronal:s.CORONAL,sagittal:s.SAGITTAL};function m(e){var t,n;let{pane:s,fileUrl:m,orientation:p,mask:w,onStatusChange:g,onRenderedChange:x}=e,y=(0,i.useRef)({axial:null,coronal:null,sagittal:null}),h=(0,i.useRef)(null),b=(0,i.useRef)(null),[E,A]=(0,i.useState)(!1),[N,O]=(0,i.useState)({state:"idle"}),[V,k]=(0,i.useState)(0),[I,C]=(0,i.useState)(null),[S,T]=(0,i.useState)(null),[R,j]=(0,i.useState)(null),[D,L]=(0,i.useState)(null),G=(0,i.useRef)(Promise.resolve()),P=(0,i.useRef)(0),z=(0,i.useRef)(0),_=(0,i.useRef)(null),B="tools-".concat(s),F=void 0!==m&&null!==I&&I.url===m&&I.orientation===p;return(0,i.useEffect)(()=>{null==g||g(N)},[N,g]),(0,i.useEffect)(()=>{null==x||x(F?m:null)},[F,m,x]),(0,i.useEffect)(()=>{let e=f.map(e=>y.current[e]);if(e.some(e=>!e))return;let t=!1;return(async function(){let n=await (0,c.lD)();if(t)return;for(let[t,r]of(b.current=n,f.entries()))n.enableElement({viewportId:"viewport-".concat(s,"-").concat(r),type:u.ORTHOGRAPHIC,element:e[t],defaultOptions:{orientation:v[r],background:[0,0,0]}});o.dU.getToolGroup(B)&&o.dU.destroyToolGroup(B);let r=o.dU.createToolGroup(B);if(r){for(let e of f)r.addViewport("viewport-".concat(s,"-").concat(e),c.Q4);for(let e of[o.Du,o.CH,o.OQ,o.ae])r.addTool(e.toolName);r.setToolActive(o.Du.toolName,{bindings:[{mouseButton:d.Primary}]}),r.setToolActive(o.CH.toolName,{bindings:[{mouseButton:d.Auxiliary}]}),r.setToolActive(o.OQ.toolName,{bindings:[{mouseButton:d.Secondary}]}),r.setToolActive(o.ae.toolName,{bindings:[{mouseButton:d.Wheel}]})}for(let e of f)(0,c.ow)(e,"viewport-".concat(s,"-").concat(e));A(!0)})().catch(e=>{t||O({state:"error",message:e instanceof Error?e.message:"Viewer failed to initialise"})}),()=>{t=!0,A(!1),C(null);try{o.dU.destroyToolGroup(B)}catch(e){}for(let t of f){(0,c.Oh)(t,"viewport-".concat(s,"-").concat(t));try{var e;null==(e=b.current)||e.disableElement("viewport-".concat(s,"-").concat(t))}catch(e){}}b.current=null,(0,c.cJ)(s,null)}},[s,B,V]),(0,i.useEffect)(()=>{function e(e){e.preventDefault(),C(null),O({state:"error",message:"Graphics context lost. Recovering…"}),setTimeout(()=>(0,c.CB)(),250)}return window.addEventListener("webglcontextlost",e,!0),document.addEventListener("webglcontextlost",e,!0),()=>{window.removeEventListener("webglcontextlost",e,!0),document.removeEventListener("webglcontextlost",e,!0)}},[]),(0,i.useEffect)(()=>(0,c.Pf)(()=>{A(!1),C(null),b.current=null,k(e=>e+1)}),[]),(0,i.useEffect)(()=>{if(!E)return;let e=b.current;if(!e)return;P.current+=1;let t=P.current;if(C(null),_.current&&((0,a.dp)(_.current.viewportId,_.current.segmentationId),_.current=null,z.current+=1,T(null),L(null)),!m){for(let t of f){let n=e.getViewport("viewport-".concat(s,"-").concat(t));try{null==n||n.removeAllActors(),null==n||n.render()}catch(e){}}O({state:"idle"}),(0,c.cJ)(s,null);return}let n="viewport-".concat(s,"-").concat(p),r="nifti:".concat(m);async function o(){if(P.current===t){O({state:"loading"});try{var o,i,a;let u=await (0,c.S2)(m);if(P.current!==t)return;if(0===u.length)throw Error("Volume contained no slices");let s=await l.UH.createAndCacheVolumeFromImages(r,u);if(P.current!==t)return;let d=e.getViewport(n);if(!d)throw Error("Viewport is not available");if(await d.setVolumes([{volumeId:r}],!1),P.current!==t||(await (null==(o=s.load)?void 0:o.call(s)),P.current!==t))return;let f=(0,c.A5)(s),v=f?(0,c.xI)(f):null;if(v&&d.setProperties({voiRange:v}),d.resetCamera(),d.render(),P.current!==t)return;let w=null!=(i=s.dimensions)?i:[];O({state:"ready",slices:null!=(a=w[2])?a:u.length}),C({url:m,orientation:p})}catch(e){if(P.current!==t)return;C(null),O({state:"error",message:e instanceof Error?e.message:"Could not render volume"})}}}(0,c.cJ)(s,r),G.current=G.current.then(o,o)},[E,m,p,s]),(0,i.useEffect)(()=>{if(!E||!F)return;let e="viewport-".concat(s,"-").concat(p),t="nifti:".concat(m),n=null==w?void 0:w.url,r=null==w?void 0:w.key;if(!n||!r||!(null==w?void 0:w.visible)){var l;_.current&&((0,a.dp)(_.current.viewportId,_.current.segmentationId),_.current=null),z.current+=1,T(null),L(null),null==(l=b.current)||l.renderViewports([e]);return}let o=(0,a.bh)(r),i="labelmap:".concat(r);z.current+=1;let c=z.current,u=()=>z.current!==c;async function d(){if(!u())try{var r,l;let c=await (0,a.zE)(n,t,i);if(u())return;(0,a.dp)(e,o),(0,a.o)(o,i),(0,a.Cn)(e,o,{outlineOnly:w.outlineOnly,opacity:w.opacity}),(0,a.ml)(e,o),_.current={viewportId:e,segmentationId:o},null==(r=b.current)||r.renderViewports([e]);let s=null==(l=b.current)?void 0:l.getViewport(e),d={outlineOnly:w.outlineOnly,opacity:w.opacity};(async()=>{let t=await (0,a.kl)(s,i,3e4);if(!u()&&(L(t),t))for(let t of[0,250,750,1500]){var n;if(t&&await new Promise(e=>setTimeout(e,t)),u())return;(0,a.Iy)(e,o,d),null==(n=b.current)||n.renderViewports([e])}})(),T(c)}catch(e){if(u())return;T(null),j(e instanceof Error?e.message:"Could not draw the tumour mask")}}return j(null),G.current=G.current.then(d,d),()=>{z.current+=1}},[E,F,s,p,m,null==w?void 0:w.url,null==w?void 0:w.key,null==w?void 0:w.visible]),(0,i.useEffect)(()=>{var e;(null==w?void 0:w.key)&&w.visible&&((0,a.AV)((0,a.bh)(w.key),{outlineOnly:w.outlineOnly,opacity:w.opacity}),null==(e=b.current)||e.renderViewports(["viewport-".concat(s,"-").concat(p)]))},[null==w?void 0:w.key,null==w?void 0:w.visible,null==w?void 0:w.outlineOnly,null==w?void 0:w.opacity,s,p]),(0,i.useEffect)(()=>{if(!E)return;let e=y.current[p],t=h.current;if(e&&t)return n(),e.addEventListener(l.fX.sV.CAMERA_MODIFIED,n),()=>e.removeEventListener(l.fX.sV.CAMERA_MODIFIED,n);function n(){var e;let n=null==(e=b.current)?void 0:e.getViewport("viewport-".concat(s,"-").concat(p));if(n)try{let e=n.getNumberOfSlices();if(!e)return;t.dataset.sliceIndex=String(n.getSliceIndex()),t.dataset.sliceCount=String(e)}catch(e){}}},[E,p,s,F]),(0,i.useEffect)(()=>{if(!E||!F)return;let e=b.current;if(!e)return;let t=requestAnimationFrame(()=>{try{e.renderViewports(["viewport-".concat(s,"-").concat(p)])}catch(e){}});return()=>cancelAnimationFrame(t)},[E,F,p,s]),(0,r.jsxs)("div",{ref:h,className:"relative size-full","data-rendered-url":F?m:"","data-mask-voxels":null!=(t=null==S?void 0:S.voxels)?t:"","data-mask-labels":null!=(n=null==S?void 0:S.labels.join(","))?n:"","data-mask-attached":null===D?"":String(D),"data-testid":"pane-".concat(s),children:[f.map(e=>(0,r.jsx)("div",{ref:t=>{y.current[e]=t},className:e===p?"absolute inset-0 z-10 bg-black":"pointer-events-none invisible absolute inset-0 z-0 bg-black",onContextMenu:e=>e.preventDefault(),"data-testid":e===p?"viewport-".concat(s):"viewport-".concat(s,"-").concat(e,"-hidden")},e)),F&&R&&(0,r.jsx)("p",{className:"absolute bottom-2 right-2 z-20 max-w-[60%] text-right text-[9px] leading-tight text-signal-uncertain",children:R}),!F&&(0,r.jsxs)("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-clinical-900",children:["loading"===N.state&&(0,r.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-clinical-dim",children:"loading volume"}),"error"===N.state&&(0,r.jsx)("p",{className:"max-w-[80%] text-center text-[10px] leading-tight text-signal-concern",children:N.message}),"idle"===N.state&&(0,r.jsx)("p",{className:"text-[10px] text-clinical-dim",children:"No volume"}),"ready"===N.state&&(0,r.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-clinical-dim",children:"loading volume"})]})]})}}}]); \ No newline at end of file diff --git a/_next/static/chunks/255-91b6ab0b096141ad.js b/_next/static/chunks/255-91b6ab0b096141ad.js new file mode 100644 index 0000000000000000000000000000000000000000..c46843bc55a362b1822412813f309361699f1005 --- /dev/null +++ b/_next/static/chunks/255-91b6ab0b096141ad.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[255],{307:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createRenderParamsFromClient",{enumerable:!0,get:function(){return n}});let n=r(77370).createRenderParamsFromClient;("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},1281:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"clearCacheNodeDataForSegmentPath",{enumerable:!0,get:function(){return function e(t,r,o){let l=o.length<=2,[a,i]=o,c=(0,u.createRouterCacheKey)(i),s=r.parallelRoutes.get(a),f=t.parallelRoutes.get(a);f&&f!==s||(f=new Map(s),t.parallelRoutes.set(a,f));let d=null==s?void 0:s.get(c),p=f.get(c);if(l){p&&p.lazyData&&p!==d||f.set(c,{lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,loading:null,navigatedAt:-1});return}if(!p||!d){p||f.set(c,{lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,loading:null,navigatedAt:-1});return}return p===d&&(p={lazyData:p.lazyData,rsc:p.rsc,prefetchRsc:p.prefetchRsc,head:p.head,prefetchHead:p.prefetchHead,parallelRoutes:new Map(p.parallelRoutes),loading:p.loading},f.set(c,p)),e(p,d,(0,n.getNextFlightSegmentPath)(o))}}});let n=r(16378),u=r(69190);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},1666:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(28110);let n=r(53663),u=r(71923);(0,n.appBootstrap)(()=>{let{hydrate:e}=r(49781);r(17297),r(9766),e(u)}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},2018:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"pathHasPrefix",{enumerable:!0,get:function(){return u}});let n=r(5240);function u(e,t){if("string"!=typeof e)return!1;let{pathname:r}=(0,n.parsePath)(e);return r===t||r.startsWith(t+"/")}},3201:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{getAppBuildId:function(){return u},setAppBuildId:function(){return n}});let r="";function n(e){r=e}function u(){return r}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},3463:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"reportGlobalError",{enumerable:!0,get:function(){return r}});let r="function"==typeof reportError?reportError:e=>{globalThis.console.error(e)};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},3789:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{isRecoverableError:function(){return i},onRecoverableError:function(){return c}});let n=r(28140),u=r(24553),o=n._(r(42444)),l=r(3463),a=new WeakSet;function i(e){return a.has(e)}let c=e=>{let t=(0,o.default)(e)&&"cause"in e?e.cause:e;(0,u.isBailoutToCSRError)(t)||(0,l.reportGlobalError)(t)};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},3860:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"unstable_rethrow",{enumerable:!0,get:function(){return n}});let n=r(67858).unstable_rethrow;("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},3865:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{PathParamsContext:function(){return l},PathnameContext:function(){return o},SearchParamsContext:function(){return u}});let n=r(12115),u=(0,n.createContext)(null),o=(0,n.createContext)(null),l=(0,n.createContext)(null)},5240:(e,t)=>{"use strict";function r(e){let t=e.indexOf("#"),r=e.indexOf("?"),n=r>-1&&(t<0||r-1?{pathname:e.substring(0,n?r:t),query:n?e.substring(r,t>-1?t:void 0):"",hash:t>-1?e.slice(t):""}:{pathname:e,query:"",hash:""}}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"parsePath",{enumerable:!0,get:function(){return r}})},5829:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isNextRouterError",{enumerable:!0,get:function(){return o}});let n=r(37099),u=r(86437);function o(e){return(0,u.isRedirectError)(e)||(0,n.isHTTPAccessFallbackError)(e)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},6640:(e,t,r)=>{"use strict";function n(){throw Object.defineProperty(Error("`unauthorized()` is experimental and only allowed to be used when `experimental.authInterrupts` is enabled."),"__NEXT_ERROR_CODE",{value:"E411",enumerable:!1,configurable:!0})}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"unauthorized",{enumerable:!0,get:function(){return n}}),r(37099).HTTP_ERROR_FALLBACK_ERROR_CODE,("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},7460:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"matchSegment",{enumerable:!0,get:function(){return r}});let r=(e,t)=>"string"==typeof e?"string"==typeof t&&e===t:"string"!=typeof t&&e[0]===t[0]&&e[1]===t[1];("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},9766:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return M}});let n=r(28140),u=r(49417),o=r(95155),l=r(86871),a=u._(r(12115)),i=n._(r(47650)),c=r(46752),s=r(32753),f=r(48359),d=r(88785),p=r(7460),h=r(84170),_=r(10531),y=r(63886),b=r(69190),v=r(48915),g=r(76248),m=r(39684);r(74061);let R=i.default.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,E=["bottom","height","left","right","top","width","x","y"];function O(e,t){let r=e.getBoundingClientRect();return r.top>=0&&r.top<=t}class P extends a.default.Component{componentDidMount(){this.handlePotentialScroll()}componentDidUpdate(){this.props.focusAndScrollRef.apply&&this.handlePotentialScroll()}render(){return this.props.children}constructor(...e){super(...e),this.handlePotentialScroll=()=>{let{focusAndScrollRef:e,segmentPath:t}=this.props;if(e.apply){if(0!==e.segmentPaths.length&&!e.segmentPaths.some(e=>t.every((t,r)=>(0,p.matchSegment)(t,e[r]))))return;let r=null,n=e.hashFragment;if(n&&(r=function(e){var t;return"top"===e?document.body:null!=(t=document.getElementById(e))?t:document.getElementsByName(e)[0]}(n)),r||(r=(0,R.findDOMNode)(this)),!(r instanceof Element))return;for(;!(r instanceof HTMLElement)||function(e){if(["sticky","fixed"].includes(getComputedStyle(e).position))return!0;let t=e.getBoundingClientRect();return E.every(e=>0===t[e])}(r);){if(null===r.nextElementSibling)return;r=r.nextElementSibling}e.apply=!1,e.hashFragment=null,e.segmentPaths=[],(0,h.disableSmoothScrollDuringRouteTransition)(()=>{if(n)return void r.scrollIntoView();let e=document.documentElement,t=e.clientHeight;!O(r,t)&&(e.scrollTop=0,O(r,t)||r.scrollIntoView())},{dontForceLayout:!0,onlyHashChange:e.onlyHashChange}),e.onlyHashChange=!1,r.focus()}}}}function j(e){let{segmentPath:t,children:r}=e,n=(0,a.useContext)(c.GlobalLayoutRouterContext);if(!n)throw Object.defineProperty(Error("invariant global layout router not mounted"),"__NEXT_ERROR_CODE",{value:"E473",enumerable:!1,configurable:!0});return(0,o.jsx)(P,{segmentPath:t,focusAndScrollRef:n.focusAndScrollRef,children:r})}function T(e){let{tree:t,segmentPath:r,cacheNode:n,url:u}=e,i=(0,a.useContext)(c.GlobalLayoutRouterContext);if(!i)throw Object.defineProperty(Error("invariant global layout router not mounted"),"__NEXT_ERROR_CODE",{value:"E473",enumerable:!1,configurable:!0});let{tree:d}=i,h=null!==n.prefetchRsc?n.prefetchRsc:n.rsc,_=(0,a.useDeferredValue)(n.rsc,h),y="object"==typeof _&&null!==_&&"function"==typeof _.then?(0,a.use)(_):_;if(!y){let e=n.lazyData;if(null===e){let t=function e(t,r){if(t){let[n,u]=t,o=2===t.length;if((0,p.matchSegment)(r[0],n)&&r[1].hasOwnProperty(u)){if(o){let t=e(void 0,r[1][u]);return[r[0],{...r[1],[u]:[t[0],t[1],t[2],"refetch"]}]}return[r[0],{...r[1],[u]:e(t.slice(2),r[1][u])}]}}return r}(["",...r],d),o=(0,v.hasInterceptionRouteInCurrentTree)(d),c=Date.now();n.lazyData=e=(0,s.fetchServerResponse)(new URL(u,location.origin),{flightRouterState:t,nextUrl:o?i.nextUrl:null}).then(e=>((0,a.startTransition)(()=>{(0,g.dispatchAppRouterAction)({type:l.ACTION_SERVER_PATCH,previousTree:d,serverResponse:e,navigatedAt:c})}),e)),(0,a.use)(e)}(0,a.use)(f.unresolvedThenable)}return(0,o.jsx)(c.LayoutRouterContext.Provider,{value:{parentTree:t,parentCacheNode:n,parentSegmentPath:r,url:u},children:y})}function S(e){let t,{loading:r,children:n}=e;if(t="object"==typeof r&&null!==r&&"function"==typeof r.then?(0,a.use)(r):r){let e=t[0],r=t[1],u=t[2];return(0,o.jsx)(a.Suspense,{fallback:(0,o.jsxs)(o.Fragment,{children:[r,u,e]}),children:n})}return(0,o.jsx)(o.Fragment,{children:n})}function M(e){let{parallelRouterKey:t,error:r,errorStyles:n,errorScripts:u,templateStyles:l,templateScripts:i,template:s,notFound:f,forbidden:p,unauthorized:h,segmentViewBoundaries:v}=e,g=(0,a.useContext)(c.LayoutRouterContext);if(!g)throw Object.defineProperty(Error("invariant expected layout router to be mounted"),"__NEXT_ERROR_CODE",{value:"E56",enumerable:!1,configurable:!0});let{parentTree:R,parentCacheNode:E,parentSegmentPath:O,url:P}=g,M=E.parallelRoutes,w=M.get(t);w||(w=new Map,M.set(t,w));let A=R[0],x=null===O?[t]:O.concat([A,t]),C=R[1][t],N=C[0],U=(0,b.createRouterCacheKey)(N,!0),D=(0,m.useRouterBFCache)(C,U),L=[];do{let e=D.tree,t=D.stateKey,a=e[0],v=(0,b.createRouterCacheKey)(a),g=w.get(v);if(void 0===g){let e={lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,loading:null,navigatedAt:-1};g=e,w.set(v,e)}let m=E.loading,R=(0,o.jsxs)(c.TemplateContext.Provider,{value:(0,o.jsxs)(j,{segmentPath:x,children:[(0,o.jsx)(d.ErrorBoundary,{errorComponent:r,errorStyles:n,errorScripts:u,children:(0,o.jsx)(S,{loading:m,children:(0,o.jsx)(y.HTTPAccessFallbackBoundary,{notFound:f,forbidden:p,unauthorized:h,children:(0,o.jsxs)(_.RedirectBoundary,{children:[(0,o.jsx)(T,{url:P,tree:e,cacheNode:g,segmentPath:x}),null]})})})}),null]}),children:[l,i,s]},t);L.push(R),D=D.next}while(null!==D);return L}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},10531:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{RedirectBoundary:function(){return f},RedirectErrorBoundary:function(){return s}});let n=r(49417),u=r(95155),o=n._(r(12115)),l=r(47260),a=r(86542),i=r(86437);function c(e){let{redirect:t,reset:r,redirectType:n}=e,u=(0,l.useRouter)();return(0,o.useEffect)(()=>{o.default.startTransition(()=>{n===i.RedirectType.push?u.push(t,{}):u.replace(t,{}),r()})},[t,n,r,u]),null}class s extends o.default.Component{static getDerivedStateFromError(e){if((0,i.isRedirectError)(e))return{redirect:(0,a.getURLFromRedirectError)(e),redirectType:(0,a.getRedirectTypeFromError)(e)};throw e}render(){let{redirect:e,redirectType:t}=this.state;return null!==e&&null!==t?(0,u.jsx)(c,{redirect:e,redirectType:t,reset:()=>this.setState({redirect:null})}):this.props.children}constructor(e){super(e),this.state={redirect:null,redirectType:null}}}function f(e){let{children:t}=e,r=(0,l.useRouter)();return(0,u.jsx)(s,{router:r,children:t})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},10836:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"findHeadInCache",{enumerable:!0,get:function(){return o}});let n=r(65360),u=r(69190);function o(e,t){return function e(t,r,o,l){if(0===Object.keys(r).length)return[t,o,l];let a=Object.keys(r).filter(e=>"children"!==e);for(let l of("children"in r&&a.unshift("children"),a)){let[a,i]=r[l];if(a===n.DEFAULT_SEGMENT_KEY)continue;let c=t.parallelRoutes.get(l);if(!c)continue;let s=(0,u.createRouterCacheKey)(a),f=(0,u.createRouterCacheKey)(a,!0),d=c.get(s);if(!d)continue;let p=e(d,i,o+"/"+s,o+"/"+f);if(p)return p}return null}(e,t,"","")}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},11126:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"handleMutable",{enumerable:!0,get:function(){return o}});let n=r(86343);function u(e){return void 0!==e}function o(e,t){var r,o;let l=null==(r=t.shouldScroll)||r,a=e.nextUrl;if(u(t.patchedTree)){let r=(0,n.computeChangedPath)(e.tree,t.patchedTree);r?a=r:a||(a=e.canonicalUrl)}return{canonicalUrl:u(t.canonicalUrl)?t.canonicalUrl===e.canonicalUrl?e.canonicalUrl:t.canonicalUrl:e.canonicalUrl,pushRef:{pendingPush:u(t.pendingPush)?t.pendingPush:e.pushRef.pendingPush,mpaNavigation:u(t.mpaNavigation)?t.mpaNavigation:e.pushRef.mpaNavigation,preserveCustomHistoryState:u(t.preserveCustomHistoryState)?t.preserveCustomHistoryState:e.pushRef.preserveCustomHistoryState},focusAndScrollRef:{apply:!!l&&(!!u(null==t?void 0:t.scrollableSegments)||e.focusAndScrollRef.apply),onlyHashChange:t.onlyHashChange||!1,hashFragment:l?t.hashFragment&&""!==t.hashFragment?decodeURIComponent(t.hashFragment.slice(1)):e.focusAndScrollRef.hashFragment:null,segmentPaths:l?null!=(o=null==t?void 0:t.scrollableSegments)?o:e.focusAndScrollRef.segmentPaths:[]},cache:t.cache?t.cache:e.cache,prefetchCache:t.prefetchCache?t.prefetchCache:e.prefetchCache,tree:u(t.patchedTree)?t.patchedTree:e.tree,nextUrl:a}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},11807:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{createMutableActionQueue:function(){return _},dispatchNavigateAction:function(){return v},dispatchTraverseAction:function(){return g},getCurrentAppRouterState:function(){return y},publicAppRouterInstance:function(){return m}});let n=r(86871),u=r(68451),o=r(12115),l=r(54089);r(66048);let a=r(76248),i=r(96058),c=r(17297),s=r(43933),f=r(63499);function d(e,t){null!==e.pending&&(e.pending=e.pending.next,null!==e.pending?p({actionQueue:e,action:e.pending,setState:t}):e.needsRefresh&&(e.needsRefresh=!1,e.dispatch({type:n.ACTION_REFRESH,origin:window.location.origin},t)))}async function p(e){let{actionQueue:t,action:r,setState:n}=e,u=t.state;t.pending=r;let o=r.payload,a=t.action(u,o);function i(e){r.discarded||(t.state=e,d(t,n),r.resolve(e))}(0,l.isThenable)(a)?a.then(i,e=>{d(t,n),r.reject(e)}):i(a)}let h=null;function _(e,t){let r={state:e,dispatch:(e,t)=>(function(e,t,r){let u={resolve:r,reject:()=>{}};if(t.type!==n.ACTION_RESTORE){let e=new Promise((e,t)=>{u={resolve:e,reject:t}});(0,o.startTransition)(()=>{r(e)})}let l={payload:t,next:null,resolve:u.resolve,reject:u.reject};null===e.pending?(e.last=l,p({actionQueue:e,action:l,setState:r})):t.type===n.ACTION_NAVIGATE||t.type===n.ACTION_RESTORE?(e.pending.discarded=!0,l.next=e.pending.next,e.pending.payload.type===n.ACTION_SERVER_ACTION&&(e.needsRefresh=!0),p({actionQueue:e,action:l,setState:r})):(null!==e.last&&(e.last.next=l),e.last=l)})(r,e,t),action:async(e,t)=>(0,u.reducer)(e,t),pending:null,last:null,onRouterTransitionStart:null!==t&&"function"==typeof t.onRouterTransitionStart?t.onRouterTransitionStart:null};if(null!==h)throw Object.defineProperty(Error("Internal Next.js Error: createMutableActionQueue was called more than once"),"__NEXT_ERROR_CODE",{value:"E624",enumerable:!1,configurable:!0});return h=r,r}function y(){return null!==h?h.state:null}function b(){return null!==h?h.onRouterTransitionStart:null}function v(e,t,r,u){let o=new URL((0,i.addBasePath)(e),location.href);(0,f.setLinkForCurrentNavigation)(u);let l=b();null!==l&&l(e,t),(0,a.dispatchAppRouterAction)({type:n.ACTION_NAVIGATE,url:o,isExternalUrl:(0,c.isExternalURL)(o),locationSearch:location.search,shouldScroll:r,navigateType:t,allowAliasing:!0})}function g(e,t){let r=b();null!==r&&r(e,"traverse"),(0,a.dispatchAppRouterAction)({type:n.ACTION_RESTORE,url:new URL(e),tree:t})}let m={back:()=>window.history.back(),forward:()=>window.history.forward(),prefetch:(e,t)=>{let r=function(){if(null===h)throw Object.defineProperty(Error("Internal Next.js error: Router action dispatched before initialization."),"__NEXT_ERROR_CODE",{value:"E668",enumerable:!1,configurable:!0});return h}(),u=(0,c.createPrefetchURL)(e);if(null!==u){var o;(0,s.prefetchReducer)(r.state,{type:n.ACTION_PREFETCH,url:u,kind:null!=(o=null==t?void 0:t.kind)?o:n.PrefetchKind.FULL})}},replace:(e,t)=>{(0,o.startTransition)(()=>{var r;v(e,"replace",null==(r=null==t?void 0:t.scroll)||r,null)})},push:(e,t)=>{(0,o.startTransition)(()=>{var r;v(e,"push",null==(r=null==t?void 0:t.scroll)||r,null)})},refresh:()=>{(0,o.startTransition)(()=>{(0,a.dispatchAppRouterAction)({type:n.ACTION_REFRESH,origin:window.location.origin})})},hmrRefresh:()=>{throw Object.defineProperty(Error("hmrRefresh can only be used in development mode. Please use refresh instead."),"__NEXT_ERROR_CODE",{value:"E485",enumerable:!1,configurable:!0})}};window.next&&(window.next.router=m),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},12115:(e,t,r)=>{"use strict";e.exports=r(61426)},12669:(e,t,r)=>{"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),e.exports=r(59248)},12845:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{UnrecognizedActionError:function(){return r},unstable_isUnrecognizedActionError:function(){return n}});class r extends Error{constructor(...e){super(...e),this.name="UnrecognizedActionError"}}function n(e){return!!(e&&"object"==typeof e&&e instanceof r)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},13485:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"computeCacheBustingSearchParam",{enumerable:!0,get:function(){return u}});let n=r(60075);function u(e,t,r,u){return(void 0===e||"0"===e)&&void 0===t&&void 0===r&&void 0===u?"":(0,n.hexHash)([e||"0",t||"0",r||"0",u||"0"].join(","))}},14029:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"HTML_LIMITED_BOT_UA_RE",{enumerable:!0,get:function(){return r}});let r=/[\w-]+-Google|Google-[\w-]+|Chrome-Lighthouse|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Yeti|googleweblight/i},15278:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"AsyncMetadataOutlet",{enumerable:!0,get:function(){return l}});let n=r(95155),u=r(12115);function o(e){let{promise:t}=e,{error:r,digest:n}=(0,u.use)(t);if(r)throw n&&(r.digest=n),r;return null}function l(e){let{promise:t}=e;return(0,n.jsx)(u.Suspense,{fallback:null,children:(0,n.jsx)(o,{promise:t})})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},15860:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"HandleISRError",{enumerable:!0,get:function(){return n}});let r=void 0;function n(e){let{error:t}=e;if(r){let e=r.getStore();if((null==e?void 0:e.isRevalidate)||(null==e?void 0:e.isStaticGeneration))throw console.error(t),t}return null}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},15903:(e,t,r)=>{"use strict";function n(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}r.r(t),r.d(t,{_:()=>n})},16378:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{getFlightDataPartsFromPath:function(){return u},getNextFlightSegmentPath:function(){return o},normalizeFlightData:function(){return l},prepareFlightRouterStateForRequest:function(){return a}});let n=r(65360);function u(e){var t;let[r,n,u,o]=e.slice(-4),l=e.slice(0,-4);return{pathToSegment:l.slice(0,-1),segmentPath:l,segment:null!=(t=l[l.length-1])?t:"",tree:r,seedData:n,head:u,isHeadPartial:o,isRootRender:4===e.length}}function o(e){return e.slice(2)}function l(e){return"string"==typeof e?e:e.map(e=>u(e))}function a(e,t){return t?encodeURIComponent(JSON.stringify(e)):encodeURIComponent(JSON.stringify(function e(t){var r,u;let[o,l,a,i,c,s]=t,f="string"==typeof(r=o)&&r.startsWith(n.PAGE_SEGMENT_KEY+"?")?n.PAGE_SEGMENT_KEY:r,d={};for(let[t,r]of Object.entries(l))d[t]=e(r);let p=[f,d,null,(u=i)&&"refresh"!==u?i:null];return void 0!==c&&(p[4]=c),void 0!==s&&(p[5]=s),p}(e)))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},16486:(e,t)=>{"use strict";function r(e){return Object.prototype.toString.call(e)}function n(e){if("[object Object]"!==r(e))return!1;let t=Object.getPrototypeOf(e);return null===t||t.hasOwnProperty("isPrototypeOf")}Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{getObjectClassLabel:function(){return r},isPlainObject:function(){return n}})},17297:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{createEmptyCacheNode:function(){return C},createPrefetchURL:function(){return A},default:function(){return L},isExternalURL:function(){return w}});let n=r(28140),u=r(49417),o=r(95155),l=u._(r(12115)),a=r(46752),i=r(86871),c=r(29658),s=r(3865),f=r(76248),d=r(93913),p=r(96058),h=r(43443),_=r(10531),y=r(10836),b=r(48359),v=r(51755),g=r(92929),m=r(86343),R=r(61489),E=r(11807),O=r(86542),P=r(86437);r(63499);let j=n._(r(28890)),T=n._(r(57150)),S=r(24431),M={};function w(e){return e.origin!==window.location.origin}function A(e){let t;if((0,d.isBot)(window.navigator.userAgent))return null;try{t=new URL((0,p.addBasePath)(e),window.location.href)}catch(t){throw Object.defineProperty(Error("Cannot prefetch '"+e+"' because it cannot be converted to a URL."),"__NEXT_ERROR_CODE",{value:"E234",enumerable:!1,configurable:!0})}return w(t)?null:t}function x(e){let{appRouterState:t}=e;return(0,l.useInsertionEffect)(()=>{let{tree:e,pushRef:r,canonicalUrl:n}=t,u={...r.preserveCustomHistoryState?window.history.state:{},__NA:!0,__PRIVATE_NEXTJS_INTERNALS_TREE:e};r.pendingPush&&(0,c.createHrefFromUrl)(new URL(window.location.href))!==n?(r.pendingPush=!1,window.history.pushState(u,"",n)):window.history.replaceState(u,"",n)},[t]),(0,l.useEffect)(()=>{},[t.nextUrl,t.tree]),null}function C(){return{lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,loading:null,navigatedAt:-1}}function N(e){null==e&&(e={});let t=window.history.state,r=null==t?void 0:t.__NA;r&&(e.__NA=r);let n=null==t?void 0:t.__PRIVATE_NEXTJS_INTERNALS_TREE;return n&&(e.__PRIVATE_NEXTJS_INTERNALS_TREE=n),e}function U(e){let{headCacheNode:t}=e,r=null!==t?t.head:null,n=null!==t?t.prefetchHead:null,u=null!==n?n:r;return(0,l.useDeferredValue)(r,u)}function D(e){let t,{actionQueue:r,assetPrefix:n,globalError:u}=e,c=(0,f.useActionQueue)(r),{canonicalUrl:d}=c,{searchParams:p,pathname:R}=(0,l.useMemo)(()=>{let e=new URL(d,window.location.href);return{searchParams:e.searchParams,pathname:(0,g.hasBasePath)(e.pathname)?(0,v.removeBasePath)(e.pathname):e.pathname}},[d]);(0,l.useEffect)(()=>{function e(e){var t;e.persisted&&(null==(t=window.history.state)?void 0:t.__PRIVATE_NEXTJS_INTERNALS_TREE)&&(M.pendingMpaPath=void 0,(0,f.dispatchAppRouterAction)({type:i.ACTION_RESTORE,url:new URL(window.location.href),tree:window.history.state.__PRIVATE_NEXTJS_INTERNALS_TREE}))}return window.addEventListener("pageshow",e),()=>{window.removeEventListener("pageshow",e)}},[]),(0,l.useEffect)(()=>{function e(e){let t="reason"in e?e.reason:e.error;if((0,P.isRedirectError)(t)){e.preventDefault();let r=(0,O.getURLFromRedirectError)(t);(0,O.getRedirectTypeFromError)(t)===P.RedirectType.push?E.publicAppRouterInstance.push(r,{}):E.publicAppRouterInstance.replace(r,{})}}return window.addEventListener("error",e),window.addEventListener("unhandledrejection",e),()=>{window.removeEventListener("error",e),window.removeEventListener("unhandledrejection",e)}},[]);let{pushRef:T}=c;if(T.mpaNavigation){if(M.pendingMpaPath!==d){let e=window.location;T.pendingPush?e.assign(d):e.replace(d),M.pendingMpaPath=d}throw b.unresolvedThenable}(0,l.useEffect)(()=>{let e=window.history.pushState.bind(window.history),t=window.history.replaceState.bind(window.history),r=e=>{var t;let r=window.location.href,n=null==(t=window.history.state)?void 0:t.__PRIVATE_NEXTJS_INTERNALS_TREE;(0,l.startTransition)(()=>{(0,f.dispatchAppRouterAction)({type:i.ACTION_RESTORE,url:new URL(null!=e?e:r,r),tree:n})})};window.history.pushState=function(t,n,u){return(null==t?void 0:t.__NA)||(null==t?void 0:t._N)||(t=N(t),u&&r(u)),e(t,n,u)},window.history.replaceState=function(e,n,u){return(null==e?void 0:e.__NA)||(null==e?void 0:e._N)||(e=N(e),u&&r(u)),t(e,n,u)};let n=e=>{if(e.state){if(!e.state.__NA)return void window.location.reload();(0,l.startTransition)(()=>{(0,E.dispatchTraverseAction)(window.location.href,e.state.__PRIVATE_NEXTJS_INTERNALS_TREE)})}};return window.addEventListener("popstate",n),()=>{window.history.pushState=e,window.history.replaceState=t,window.removeEventListener("popstate",n)}},[]);let{cache:w,tree:A,nextUrl:C,focusAndScrollRef:D}=c,L=(0,l.useMemo)(()=>(0,y.findHeadInCache)(w,A[1]),[w,A]),I=(0,l.useMemo)(()=>(0,m.getSelectedParams)(A),[A]),k=(0,l.useMemo)(()=>({parentTree:A,parentCacheNode:w,parentSegmentPath:null,url:d}),[A,w,d]),H=(0,l.useMemo)(()=>({tree:A,focusAndScrollRef:D,nextUrl:C}),[A,D,C]);if(null!==L){let[e,r,n]=L;t=(0,o.jsx)(U,{headCacheNode:e},r)}else t=null;let B=(0,o.jsxs)(_.RedirectBoundary,{children:[t,(0,o.jsx)(S.RootLayoutBoundary,{children:w.rsc}),(0,o.jsx)(h.AppRouterAnnouncer,{tree:A})]});return B=(0,o.jsx)(j.default,{errorComponent:u[0],errorStyles:u[1],children:B}),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(x,{appRouterState:c}),(0,o.jsx)(F,{}),(0,o.jsx)(s.PathParamsContext.Provider,{value:I,children:(0,o.jsx)(s.PathnameContext.Provider,{value:R,children:(0,o.jsx)(s.SearchParamsContext.Provider,{value:p,children:(0,o.jsx)(a.GlobalLayoutRouterContext.Provider,{value:H,children:(0,o.jsx)(a.AppRouterContext.Provider,{value:E.publicAppRouterInstance,children:(0,o.jsx)(a.LayoutRouterContext.Provider,{value:k,children:B})})})})})})]})}function L(e){let{actionQueue:t,globalErrorState:r,assetPrefix:n}=e;(0,R.useNavFailureHandler)();let u=(0,o.jsx)(D,{actionQueue:t,assetPrefix:n,globalError:r});return(0,o.jsx)(j.default,{errorComponent:T.default,children:u})}let I=new Set,k=new Set;function F(){let[,e]=l.default.useState(0),t=I.size;return(0,l.useEffect)(()=>{let r=()=>e(e=>e+1);return k.add(r),t!==I.size&&r(),()=>{k.delete(r)}},[t,e]),[...I].map((e,t)=>(0,o.jsx)("link",{rel:"stylesheet",href:""+e,precedence:"next"},t))}globalThis._N_E_STYLE_LOAD=function(e){let t=I.size;return I.add(e),I.size!==t&&k.forEach(e=>e()),Promise.resolve()},("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},17797:(e,t,r)=>{"use strict";r.r(t),r.d(t,{_:()=>u});var n=0;function u(e){return"__private_"+n+++"_"+e}},17989:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ClientSegmentRoot",{enumerable:!0,get:function(){return u}});let n=r(95155);function u(e){let{Component:t,slots:u,params:o,promise:l}=e;{let{createRenderParamsFromClient:e}=r(307),l=e(o);return(0,n.jsx)(t,{...u,params:l})}}r(48302),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},20396:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{setCacheBustingSearchParam:function(){return o},setCacheBustingSearchParamWithHash:function(){return l}});let n=r(13485),u=r(52486),o=(e,t)=>{l(e,(0,n.computeCacheBustingSearchParam)(t[u.NEXT_ROUTER_PREFETCH_HEADER],t[u.NEXT_ROUTER_SEGMENT_PREFETCH_HEADER],t[u.NEXT_ROUTER_STATE_TREE_HEADER],t[u.NEXT_URL]))},l=(e,t)=>{let r=e.search,n=(r.startsWith("?")?r.slice(1):r).split("&").filter(e=>e&&!e.startsWith(""+u.NEXT_RSC_UNION_QUERY+"="));t.length>0?n.push(u.NEXT_RSC_UNION_QUERY+"="+t):n.push(""+u.NEXT_RSC_UNION_QUERY),e.search=n.length?"?"+n.join("&"):""};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},21854:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{addSearchParamsToPageSegments:function(){return d},handleAliasedPrefetchEntry:function(){return f}});let n=r(65360),u=r(17297),o=r(60895),l=r(29658),a=r(69190),i=r(60543),c=r(11126),s=r(35737);function f(e,t,r,f,p){let h,_=t.tree,y=t.cache,b=(0,l.createHrefFromUrl)(f),v=[];if("string"==typeof r)return!1;for(let t of r){if(!function e(t){if(!t)return!1;let r=t[2];if(t[3])return!0;for(let t in r)if(e(r[t]))return!0;return!1}(t.seedData))continue;let r=t.tree;r=d(r,Object.fromEntries(f.searchParams));let{seedData:l,isRootRender:c,pathToSegment:p}=t,g=["",...p];r=d(r,Object.fromEntries(f.searchParams));let m=(0,o.applyRouterStatePatchToTree)(g,_,r,b),R=(0,u.createEmptyCacheNode)();if(c&&l){let t=l[1];R.loading=l[3],R.rsc=t,function e(t,r,u,o,l){if(0!==Object.keys(o[1]).length)for(let i in o[1]){let c,s=o[1][i],f=s[0],d=(0,a.createRouterCacheKey)(f),p=null!==l&&void 0!==l[2][i]?l[2][i]:null;if(null!==p){let e=p[1],r=p[3];c={lazyData:null,rsc:f.includes(n.PAGE_SEGMENT_KEY)?null:e,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,loading:r,navigatedAt:t}}else c={lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,loading:null,navigatedAt:-1};let h=r.parallelRoutes.get(i);h?h.set(d,c):r.parallelRoutes.set(i,new Map([[d,c]])),e(t,c,u,s,p)}}(e,R,y,r,l)}else R.rsc=y.rsc,R.prefetchRsc=y.prefetchRsc,R.loading=y.loading,R.parallelRoutes=new Map(y.parallelRoutes),(0,i.fillCacheWithNewSubTreeDataButOnlyLoading)(e,R,y,t);for(let e of(m&&(_=m,y=R,h=!0),(0,s.generateSegmentsFromPatch)(r))){let r=[...t.pathToSegment,...e];r[r.length-1]!==n.DEFAULT_SEGMENT_KEY&&v.push(r)}}return!!h&&(p.patchedTree=_,p.cache=y,p.canonicalUrl=b,p.hashFragment=f.hash,p.scrollableSegments=v,(0,c.handleMutable)(t,p))}function d(e,t){let[r,u,...o]=e;if(r.includes(n.PAGE_SEGMENT_KEY))return[(0,n.addSearchParamsIfPageSegment)(r,t),u,...o];let l={};for(let[e,r]of Object.entries(u))l[e]=d(r,t);return[r,l,...o]}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},23597:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{addRefreshMarkerToActiveParallelSegments:function(){return function e(t,r){let[n,u,,l]=t;for(let a in n.includes(o.PAGE_SEGMENT_KEY)&&"refresh"!==l&&(t[2]=r,t[3]="refresh"),u)e(u[a],r)}},refreshInactiveParallelSegments:function(){return l}});let n=r(77609),u=r(32753),o=r(65360);async function l(e){let t=new Set;await a({...e,rootTree:e.updatedTree,fetchedSegments:t})}async function a(e){let{navigatedAt:t,state:r,updatedTree:o,updatedCache:l,includeNextUrl:i,fetchedSegments:c,rootTree:s=o,canonicalUrl:f}=e,[,d,p,h]=o,_=[];if(p&&p!==f&&"refresh"===h&&!c.has(p)){c.add(p);let e=(0,u.fetchServerResponse)(new URL(p,location.origin),{flightRouterState:[s[0],s[1],s[2],"refetch"],nextUrl:i?r.nextUrl:null}).then(e=>{let{flightData:r}=e;if("string"!=typeof r)for(let e of r)(0,n.applyFlightData)(t,l,l,e)});_.push(e)}for(let e in d){let n=a({navigatedAt:t,state:r,updatedTree:d[e],updatedCache:l,includeNextUrl:i,fetchedSegments:c,rootTree:s,canonicalUrl:f});_.push(n)}await Promise.all(_)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},23982:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{describeHasCheckingStringProperty:function(){return u},describeStringPropertyAccess:function(){return n},wellKnownProperties:function(){return o}});let r=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function n(e,t){return r.test(t)?"`"+e+"."+t+"`":"`"+e+"["+JSON.stringify(t)+"]`"}function u(e,t){let r=JSON.stringify(t);return"`Reflect.has("+e+", "+r+")`, `"+r+" in "+e+"`, or similar"}let o=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toString","valueOf","toLocaleString","then","catch","finally","status","displayName","_debugInfo","toJSON","$$typeof","__esModule"])},24431:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{MetadataBoundary:function(){return o},OutletBoundary:function(){return a},RootLayoutBoundary:function(){return i},ViewportBoundary:function(){return l}});let n=r(68440),u={[n.METADATA_BOUNDARY_NAME]:function(e){let{children:t}=e;return t},[n.VIEWPORT_BOUNDARY_NAME]:function(e){let{children:t}=e;return t},[n.OUTLET_BOUNDARY_NAME]:function(e){let{children:t}=e;return t},[n.ROOT_LAYOUT_BOUNDARY_NAME]:function(e){let{children:t}=e;return t}},o=u[n.METADATA_BOUNDARY_NAME.slice(0)],l=u[n.VIEWPORT_BOUNDARY_NAME.slice(0)],a=u[n.OUTLET_BOUNDARY_NAME.slice(0)],i=u[n.ROOT_LAYOUT_BOUNDARY_NAME.slice(0)]},24553:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{BailoutToCSRError:function(){return n},isBailoutToCSRError:function(){return u}});let r="BAILOUT_TO_CLIENT_SIDE_RENDERING";class n extends Error{constructor(e){super("Bail out to client-side rendering: "+e),this.reason=e,this.digest=r}}function u(e){return"object"==typeof e&&null!==e&&"digest"in e&&e.digest===r}},26381:(e,t)=>{"use strict";function r(e){return Array.isArray(e)?e[1]:e}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getSegmentValue",{enumerable:!0,get:function(){return r}}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},28110:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(98301);let n=r(77278);{let e=r.u;r.u=function(){for(var t=arguments.length,r=Array(t),u=0;u{"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.r(t),r.d(t,{_:()=>n})},28890:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return i}});let n=r(28140),u=r(95155);r(12115);let o=n._(r(77759)),l=r(88785),a=(0,r(93913).isBot)(window.navigator.userAgent);function i(e){let{children:t,errorComponent:r,errorStyles:n,errorScripts:i}=e;return a?(0,u.jsx)(o.default,{children:t}):(0,u.jsx)(l.ErrorBoundary,{errorComponent:r,errorStyles:n,errorScripts:i,children:t})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},29658:(e,t)=>{"use strict";function r(e,t){return void 0===t&&(t=!0),e.pathname+e.search+(t?e.hash:"")}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createHrefFromUrl",{enumerable:!0,get:function(){return r}}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},30637:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"fillLazyItemsTillLeafWithHead",{enumerable:!0,get:function(){return function e(t,r,o,l,a,i,c){if(0===Object.keys(l[1]).length){r.head=i;return}for(let s in l[1]){let f,d=l[1][s],p=d[0],h=(0,n.createRouterCacheKey)(p),_=null!==a&&void 0!==a[2][s]?a[2][s]:null;if(o){let n=o.parallelRoutes.get(s);if(n){let o,l=(null==c?void 0:c.kind)==="auto"&&c.status===u.PrefetchCacheEntryStatus.reusable,a=new Map(n),f=a.get(h);o=null!==_?{lazyData:null,rsc:_[1],prefetchRsc:null,head:null,prefetchHead:null,loading:_[3],parallelRoutes:new Map(null==f?void 0:f.parallelRoutes),navigatedAt:t}:l&&f?{lazyData:f.lazyData,rsc:f.rsc,prefetchRsc:f.prefetchRsc,head:f.head,prefetchHead:f.prefetchHead,parallelRoutes:new Map(f.parallelRoutes),loading:f.loading}:{lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map(null==f?void 0:f.parallelRoutes),loading:null,navigatedAt:t},a.set(h,o),e(t,o,f,d,_||null,i,c),r.parallelRoutes.set(s,a);continue}}if(null!==_){let e=_[1],r=_[3];f={lazyData:null,rsc:e,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,loading:r,navigatedAt:t}}else f={lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,loading:null,navigatedAt:t};let y=r.parallelRoutes.get(s);y?y.set(h,f):r.parallelRoutes.set(s,new Map([[h,f]])),e(t,f,void 0,d,_,i,c)}}}});let n=r(69190),u=r(86871);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},32753:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{createFetch:function(){return y},createFromNextReadableStream:function(){return b},fetchServerResponse:function(){return _}});let n=r(77197),u=r(52486),o=r(41209),l=r(85153),a=r(86871),i=r(16378),c=r(3201),s=r(20396),f=r(93223),d=n.createFromReadableStream;function p(e){return{flightData:(0,f.urlToUrlWithoutFlightMarker)(new URL(e,location.origin)).toString(),canonicalUrl:void 0,couldBeIntercepted:!1,prerendered:!1,postponed:!1,staleTime:-1}}let h=new AbortController;async function _(e,t){let{flightRouterState:r,nextUrl:n,prefetchKind:o}=t,l={[u.RSC_HEADER]:"1",[u.NEXT_ROUTER_STATE_TREE_HEADER]:(0,i.prepareFlightRouterStateForRequest)(r,t.isHmrRefresh)};o===a.PrefetchKind.AUTO&&(l[u.NEXT_ROUTER_PREFETCH_HEADER]="1"),n&&(l[u.NEXT_URL]=n);try{var s;let t=o?o===a.PrefetchKind.TEMPORARY?"high":"low":"auto";(e=new URL(e)).pathname.endsWith("/")?e.pathname+="index.txt":e.pathname+=".txt";let r=await y(e,l,t,h.signal),n=(0,f.urlToUrlWithoutFlightMarker)(new URL(r.url)),d=r.redirected?n:void 0,_=r.headers.get("content-type")||"",v=!!(null==(s=r.headers.get("vary"))?void 0:s.includes(u.NEXT_URL)),g=!!r.headers.get(u.NEXT_DID_POSTPONE_HEADER),m=r.headers.get(u.NEXT_ROUTER_STALE_TIME_HEADER),R=null!==m?1e3*parseInt(m,10):-1,E=_.startsWith(u.RSC_CONTENT_TYPE_HEADER);if(E||(E=_.startsWith("text/plain")),!E||!r.ok||!r.body)return e.hash&&(n.hash=e.hash),p(n.toString());let O=g?function(e){let t=e.getReader();return new ReadableStream({async pull(e){for(;;){let{done:r,value:n}=await t.read();if(!r){e.enqueue(n);continue}return}}})}(r.body):r.body,P=await b(O);if((0,c.getAppBuildId)()!==P.b)return p(r.url);return{flightData:(0,i.normalizeFlightData)(P.f),canonicalUrl:d,couldBeIntercepted:v,prerendered:P.S,postponed:g,staleTime:R}}catch(t){return h.signal.aborted||console.error("Failed to fetch RSC payload for "+e+". Falling back to browser navigation.",t),{flightData:e.toString(),canonicalUrl:void 0,couldBeIntercepted:!1,prerendered:!1,postponed:!1,staleTime:-1}}}async function y(e,t,r,n){let o=new URL(e);(0,s.setCacheBustingSearchParam)(o,t);let l=await fetch(o,{credentials:"same-origin",headers:t,priority:r||void 0,signal:n}),a=l.redirected,i=new URL(l.url,o);return i.searchParams.delete(u.NEXT_RSC_UNION_QUERY),{url:i.href,redirected:a,ok:l.ok,headers:l.headers,body:l.body,status:l.status}}function b(e){return d(e,{callServer:o.callServer,findSourceMapURL:l.findSourceMapURL})}window.addEventListener("pagehide",()=>{h.abort()}),window.addEventListener("pageshow",()=>{h=new AbortController}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},35439:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{ReadonlyURLSearchParams:function(){return s},RedirectType:function(){return u.RedirectType},forbidden:function(){return l.forbidden},notFound:function(){return o.notFound},permanentRedirect:function(){return n.permanentRedirect},redirect:function(){return n.redirect},unauthorized:function(){return a.unauthorized},unstable_isUnrecognizedActionError:function(){return f},unstable_rethrow:function(){return i.unstable_rethrow}});let n=r(86542),u=r(86437),o=r(42542),l=r(71099),a=r(6640),i=r(3860);class c extends Error{constructor(){super("Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams")}}class s extends URLSearchParams{append(){throw new c}delete(){throw new c}set(){throw new c}sort(){throw new c}}function f(){throw Object.defineProperty(Error("`unstable_isUnrecognizedActionError` can only be used on the client."),"__NEXT_ERROR_CODE",{value:"E776",enumerable:!1,configurable:!0})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},35737:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{generateSegmentsFromPatch:function(){return m},handleExternalUrl:function(){return g},navigateReducer:function(){return function e(t,r){let{url:R,isExternalUrl:E,navigateType:O,shouldScroll:P,allowAliasing:j}=r,T={},{hash:S}=R,M=(0,u.createHrefFromUrl)(R),w="push"===O;if((0,y.prunePrefetchCache)(t.prefetchCache),T.preserveCustomHistoryState=!1,T.pendingPush=w,E)return g(t,T,R.toString(),w);if(document.getElementById("__next-page-redirect"))return g(t,T,M,w);let A=(0,y.getOrCreatePrefetchCacheEntry)({url:R,nextUrl:t.nextUrl,tree:t.tree,prefetchCache:t.prefetchCache,allowAliasing:j}),{treeAtTimeOfPrefetch:x,data:C}=A;return d.prefetchQueue.bump(C),C.then(d=>{let{flightData:y,canonicalUrl:E,postponed:O}=d,j=Date.now(),C=!1;if(A.lastUsedTime||(A.lastUsedTime=j,C=!0),A.aliased){let n=new URL(R.href);E&&(n.pathname=E.pathname);let u=(0,v.handleAliasedPrefetchEntry)(j,t,y,n,T);return!1===u?e(t,{...r,allowAliasing:!1}):u}if("string"==typeof y)return g(t,T,y,w);let N=E?(0,u.createHrefFromUrl)(E):M;if(S&&t.canonicalUrl.split("#",1)[0]===N.split("#",1)[0])return T.onlyHashChange=!0,T.canonicalUrl=N,T.shouldScroll=P,T.hashFragment=S,T.scrollableSegments=[],(0,s.handleMutable)(t,T);let U=t.tree,D=t.cache,L=[];for(let e of y){let{pathToSegment:r,seedData:u,head:s,isHeadPartial:d,isRootRender:y}=e,v=e.tree,E=["",...r],P=(0,l.applyRouterStatePatchToTree)(E,U,v,M);if(null===P&&(P=(0,l.applyRouterStatePatchToTree)(E,x,v,M)),null!==P){if(u&&y&&O){let e=(0,_.startPPRNavigation)(j,D,U,v,u,s,d,!1,L);if(null!==e){if(null===e.route)return g(t,T,M,w);P=e.route;let r=e.node;null!==r&&(T.cache=r);let u=e.dynamicRequestTree;if(null!==u){let r=(0,n.fetchServerResponse)(new URL(N,R.origin),{flightRouterState:u,nextUrl:t.nextUrl});(0,_.listenForDynamicRequest)(e,r)}}else P=v}else{if((0,i.isNavigatingToNewRootLayout)(U,P))return g(t,T,M,w);let n=(0,p.createEmptyCacheNode)(),u=!1;for(let t of(A.status!==c.PrefetchCacheEntryStatus.stale||C?u=(0,f.applyFlightData)(j,D,n,e,A):(u=function(e,t,r,n){let u=!1;for(let o of(e.rsc=t.rsc,e.prefetchRsc=t.prefetchRsc,e.loading=t.loading,e.parallelRoutes=new Map(t.parallelRoutes),m(n).map(e=>[...r,...e])))(0,b.clearCacheNodeDataForSegmentPath)(e,t,o),u=!0;return u}(n,D,r,v),A.lastUsedTime=j),(0,a.shouldHardNavigate)(E,U)?(n.rsc=D.rsc,n.prefetchRsc=D.prefetchRsc,(0,o.invalidateCacheBelowFlightSegmentPath)(n,D,r),T.cache=n):u&&(T.cache=n,D=n),m(v))){let e=[...r,...t];e[e.length-1]!==h.DEFAULT_SEGMENT_KEY&&L.push(e)}}U=P}}return T.patchedTree=U,T.canonicalUrl=N,T.scrollableSegments=L,T.hashFragment=S,T.shouldScroll=P,(0,s.handleMutable)(t,T)},()=>t)}}});let n=r(32753),u=r(29658),o=r(75597),l=r(60895),a=r(58130),i=r(44707),c=r(86871),s=r(11126),f=r(77609),d=r(43933),p=r(17297),h=r(65360),_=r(87317),y=r(83571),b=r(1281),v=r(21854);function g(e,t,r,n){return t.mpaNavigation=!0,t.canonicalUrl=r,t.pendingPush=n,t.scrollableSegments=void 0,(0,s.handleMutable)(e,t)}function m(e){let t=[],[r,n]=e;if(0===Object.keys(n).length)return[[r]];for(let[e,u]of Object.entries(n))for(let n of m(u))""===r?t.push([e,...n]):t.push([r,e,...n]);return t}r(66048),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},35878:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createRenderSearchParamsFromClient",{enumerable:!0,get:function(){return n}});let n=r(64869).createRenderSearchParamsFromClient;("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},36798:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"serverPatchReducer",{enumerable:!0,get:function(){return s}});let n=r(29658),u=r(60895),o=r(44707),l=r(35737),a=r(77609),i=r(11126),c=r(17297);function s(e,t){let{serverResponse:{flightData:r,canonicalUrl:s},navigatedAt:f}=t,d={};if(d.preserveCustomHistoryState=!1,"string"==typeof r)return(0,l.handleExternalUrl)(e,d,r,e.pushRef.pendingPush);let p=e.tree,h=e.cache;for(let t of r){let{segmentPath:r,tree:i}=t,_=(0,u.applyRouterStatePatchToTree)(["",...r],p,i,e.canonicalUrl);if(null===_)return e;if((0,o.isNavigatingToNewRootLayout)(p,_))return(0,l.handleExternalUrl)(e,d,e.canonicalUrl,e.pushRef.pendingPush);let y=s?(0,n.createHrefFromUrl)(s):void 0;y&&(d.canonicalUrl=y);let b=(0,c.createEmptyCacheNode)();(0,a.applyFlightData)(f,h,b,t),d.patchedTree=_,d.cache=b,h=b,p=_}return(0,i.handleMutable)(e,d)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},37099:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{HTTPAccessErrorStatus:function(){return r},HTTP_ERROR_FALLBACK_ERROR_CODE:function(){return u},getAccessFallbackErrorTypeByStatus:function(){return a},getAccessFallbackHTTPStatus:function(){return l},isHTTPAccessFallbackError:function(){return o}});let r={NOT_FOUND:404,FORBIDDEN:403,UNAUTHORIZED:401},n=new Set(Object.values(r)),u="NEXT_HTTP_ERROR_FALLBACK";function o(e){if("object"!=typeof e||null===e||!("digest"in e)||"string"!=typeof e.digest)return!1;let[t,r]=e.digest.split(";");return t===u&&n.has(Number(r))}function l(e){return Number(e.digest.split(";")[1])}function a(e){switch(e){case 401:return"unauthorized";case 403:return"forbidden";case 404:return"not-found";default:return}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},37854:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"restoreReducer",{enumerable:!0,get:function(){return o}});let n=r(29658),u=r(86343);function o(e,t){var r;let{url:o,tree:l}=t,a=(0,n.createHrefFromUrl)(o),i=l||e.tree,c=e.cache;return{canonicalUrl:a,pushRef:{pendingPush:!1,mpaNavigation:!1,preserveCustomHistoryState:!0},focusAndScrollRef:e.focusAndScrollRef,cache:c,prefetchCache:e.prefetchCache,tree:i,nextUrl:null!=(r=(0,u.extractPathFromFlightRouterState)(i))?r:o.pathname}}r(87317),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},38719:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"refreshReducer",{enumerable:!0,get:function(){return h}});let n=r(32753),u=r(29658),o=r(60895),l=r(44707),a=r(35737),i=r(11126),c=r(30637),s=r(17297),f=r(97332),d=r(48915),p=r(23597);function h(e,t){let{origin:r}=t,h={},_=e.canonicalUrl,y=e.tree;h.preserveCustomHistoryState=!1;let b=(0,s.createEmptyCacheNode)(),v=(0,d.hasInterceptionRouteInCurrentTree)(e.tree);b.lazyData=(0,n.fetchServerResponse)(new URL(_,r),{flightRouterState:[y[0],y[1],y[2],"refetch"],nextUrl:v?e.nextUrl:null});let g=Date.now();return b.lazyData.then(async r=>{let{flightData:n,canonicalUrl:s}=r;if("string"==typeof n)return(0,a.handleExternalUrl)(e,h,n,e.pushRef.pendingPush);for(let r of(b.lazyData=null,n)){let{tree:n,seedData:i,head:d,isRootRender:m}=r;if(!m)return console.log("REFRESH FAILED"),e;let R=(0,o.applyRouterStatePatchToTree)([""],y,n,e.canonicalUrl);if(null===R)return(0,f.handleSegmentMismatch)(e,t,n);if((0,l.isNavigatingToNewRootLayout)(y,R))return(0,a.handleExternalUrl)(e,h,_,e.pushRef.pendingPush);let E=s?(0,u.createHrefFromUrl)(s):void 0;if(s&&(h.canonicalUrl=E),null!==i){let e=i[1],t=i[3];b.rsc=e,b.prefetchRsc=null,b.loading=t,(0,c.fillLazyItemsTillLeafWithHead)(g,b,void 0,n,i,d,void 0),h.prefetchCache=new Map}await (0,p.refreshInactiveParallelSegments)({navigatedAt:g,state:e,updatedTree:R,updatedCache:b,includeNextUrl:v,canonicalUrl:h.canonicalUrl||e.canonicalUrl}),h.cache=b,h.patchedTree=R,y=R}return(0,i.handleMutable)(e,h)},()=>e)}r(66048),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},39684:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"useRouterBFCache",{enumerable:!0,get:function(){return u}});let n=r(12115);function u(e,t){let[r,u]=(0,n.useState)(()=>({tree:e,stateKey:t,next:null}));if(r.tree===e)return r;let o={tree:e,stateKey:t,next:null},l=1,a=r,i=o;for(;null!==a&&l<1;){if(a.stateKey===t){i.next=a.next;break}{l++;let e={tree:a.tree,stateKey:a.stateKey,next:null};i.next=e,i=e}a=a.next}return u(o),o}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},41209:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"callServer",{enumerable:!0,get:function(){return l}});let n=r(12115),u=r(86871),o=r(76248);async function l(e,t){return new Promise((r,l)=>{(0,n.startTransition)(()=>{(0,o.dispatchAppRouterAction)({type:u.ACTION_SERVER_ACTION,actionId:e,actionArgs:t,resolve:r,reject:l})})})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},42444:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{default:function(){return u},getProperError:function(){return o}});let n=r(16486);function u(e){return"object"==typeof e&&null!==e&&"name"in e&&"message"in e}function o(e){return u(e)?e:Object.defineProperty(Error((0,n.isPlainObject)(e)?function(e){let t=new WeakSet;return JSON.stringify(e,(e,r)=>{if("object"==typeof r&&null!==r){if(t.has(r))return"[Circular]";t.add(r)}return r})}(e):e+""),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0})}},42542:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"notFound",{enumerable:!0,get:function(){return u}});let n=""+r(37099).HTTP_ERROR_FALLBACK_ERROR_CODE+";404";function u(){let e=Object.defineProperty(Error(n),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});throw e.digest=n,e}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},43443:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"AppRouterAnnouncer",{enumerable:!0,get:function(){return l}});let n=r(12115),u=r(47650),o="next-route-announcer";function l(e){let{tree:t}=e,[r,l]=(0,n.useState)(null);(0,n.useEffect)(()=>(l(function(){var e;let t=document.getElementsByName(o)[0];if(null==t||null==(e=t.shadowRoot)?void 0:e.childNodes[0])return t.shadowRoot.childNodes[0];{let e=document.createElement(o);e.style.cssText="position:absolute";let t=document.createElement("div");return t.ariaLive="assertive",t.id="__next-route-announcer__",t.role="alert",t.style.cssText="position:absolute;border:0;height:1px;margin:-1px;padding:0;width:1px;clip:rect(0 0 0 0);overflow:hidden;white-space:nowrap;word-wrap:normal",e.attachShadow({mode:"open"}).appendChild(t),document.body.appendChild(e),t}}()),()=>{let e=document.getElementsByTagName(o)[0];(null==e?void 0:e.isConnected)&&document.body.removeChild(e)}),[]);let[a,i]=(0,n.useState)(""),c=(0,n.useRef)(void 0);return(0,n.useEffect)(()=>{let e="";if(document.title)e=document.title;else{let t=document.querySelector("h1");t&&(e=t.innerText||t.textContent||"")}void 0!==c.current&&c.current!==e&&i(e),c.current=e},[t]),r?(0,u.createPortal)(a,r):null}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},43933:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{prefetchQueue:function(){return o},prefetchReducer:function(){return l}});let n=r(79889),u=r(83571),o=new n.PromiseQueue(5),l=function(e,t){(0,u.prunePrefetchCache)(e.prefetchCache);let{url:r}=t;return(0,u.getOrCreatePrefetchCacheEntry)({url:r,nextUrl:e.nextUrl,prefetchCache:e.prefetchCache,kind:t.kind,tree:e.tree,allowAliasing:!0}),e};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},44707:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isNavigatingToNewRootLayout",{enumerable:!0,get:function(){return function e(t,r){let n=t[0],u=r[0];if(Array.isArray(n)&&Array.isArray(u)){if(n[0]!==u[0]||n[2]!==u[2])return!0}else if(n!==u)return!0;if(t[4])return!r[4];if(r[4])return!0;let o=Object.values(t[1])[0],l=Object.values(r[1])[0];return!o||!l||e(o,l)}}}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},45009:(e,t,r)=>{"use strict";e.exports=r(47362)},46752:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{AppRouterContext:function(){return u},GlobalLayoutRouterContext:function(){return l},LayoutRouterContext:function(){return o},MissingSlotContext:function(){return i},TemplateContext:function(){return a}});let n=r(28140)._(r(12115)),u=n.default.createContext(null),o=n.default.createContext(null),l=n.default.createContext(null),a=n.default.createContext(null),i=n.default.createContext(new Set)},47260:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{ReadonlyURLSearchParams:function(){return i.ReadonlyURLSearchParams},RedirectType:function(){return i.RedirectType},ServerInsertedHTMLContext:function(){return c.ServerInsertedHTMLContext},forbidden:function(){return i.forbidden},notFound:function(){return i.notFound},permanentRedirect:function(){return i.permanentRedirect},redirect:function(){return i.redirect},unauthorized:function(){return i.unauthorized},unstable_isUnrecognizedActionError:function(){return s.unstable_isUnrecognizedActionError},unstable_rethrow:function(){return i.unstable_rethrow},useParams:function(){return _},usePathname:function(){return p},useRouter:function(){return h},useSearchParams:function(){return d},useSelectedLayoutSegment:function(){return b},useSelectedLayoutSegments:function(){return y},useServerInsertedHTML:function(){return c.useServerInsertedHTML}});let n=r(12115),u=r(46752),o=r(3865),l=r(26381),a=r(65360),i=r(35439),c=r(72103),s=r(12845),f=void 0;function d(){let e=(0,n.useContext)(o.SearchParamsContext);return(0,n.useMemo)(()=>e?new i.ReadonlyURLSearchParams(e):null,[e])}function p(){return null==f||f("usePathname()"),(0,n.useContext)(o.PathnameContext)}function h(){let e=(0,n.useContext)(u.AppRouterContext);if(null===e)throw Object.defineProperty(Error("invariant expected app router to be mounted"),"__NEXT_ERROR_CODE",{value:"E238",enumerable:!1,configurable:!0});return e}function _(){return null==f||f("useParams()"),(0,n.useContext)(o.PathParamsContext)}function y(e){void 0===e&&(e="children"),null==f||f("useSelectedLayoutSegments()");let t=(0,n.useContext)(u.LayoutRouterContext);return t?function e(t,r,n,u){let o;if(void 0===n&&(n=!0),void 0===u&&(u=[]),n)o=t[1][r];else{var i;let e=t[1];o=null!=(i=e.children)?i:Object.values(e)[0]}if(!o)return u;let c=o[0],s=(0,l.getSegmentValue)(c);return!s||s.startsWith(a.PAGE_SEGMENT_KEY)?u:(u.push(s),e(o,r,!1,u))}(t.parentTree,e):null}function b(e){void 0===e&&(e="children"),null==f||f("useSelectedLayoutSegment()");let t=y(e);if(!t||0===t.length)return null;let r="children"===e?t[0]:t[t.length-1];return r===a.DEFAULT_SEGMENT_KEY?null:r}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},47362:(e,t)=>{"use strict";function r(e,t){var r=e.length;for(e.push(t);0>>1,u=e[n];if(0>>1;no(i,r))co(s,i)?(e[n]=s,e[c]=r,n=c):(e[n]=i,e[a]=r,n=a);else if(co(s,r))e[n]=s,e[c]=r,n=c;else break}}return t}function o(e,t){var r=e.sortIndex-t.sortIndex;return 0!==r?r:e.id-t.id}if(t.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var l,a=performance;t.unstable_now=function(){return a.now()}}else{var i=Date,c=i.now();t.unstable_now=function(){return i.now()-c}}var s=[],f=[],d=1,p=null,h=3,_=!1,y=!1,b=!1,v=!1,g="function"==typeof setTimeout?setTimeout:null,m="function"==typeof clearTimeout?clearTimeout:null,R="undefined"!=typeof setImmediate?setImmediate:null;function E(e){for(var t=n(f);null!==t;){if(null===t.callback)u(f);else if(t.startTime<=e)u(f),t.sortIndex=t.expirationTime,r(s,t);else break;t=n(f)}}function O(e){if(b=!1,E(e),!y)if(null!==n(s))y=!0,P||(P=!0,l());else{var t=n(f);null!==t&&C(O,t.startTime-e)}}var P=!1,j=-1,T=5,S=-1;function M(){return!!v||!(t.unstable_now()-Se&&M());){var a=p.callback;if("function"==typeof a){p.callback=null,h=p.priorityLevel;var i=a(p.expirationTime<=e);if(e=t.unstable_now(),"function"==typeof i){p.callback=i,E(e),r=!0;break t}p===n(s)&&u(s),E(e)}else u(s);p=n(s)}if(null!==p)r=!0;else{var c=n(f);null!==c&&C(O,c.startTime-e),r=!1}}break e}finally{p=null,h=o,_=!1}}}finally{r?l():P=!1}}}if("function"==typeof R)l=function(){R(w)};else if("undefined"!=typeof MessageChannel){var A=new MessageChannel,x=A.port2;A.port1.onmessage=w,l=function(){x.postMessage(null)}}else l=function(){g(w,0)};function C(e,r){j=g(function(){e(t.unstable_now())},r)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_forceFrameRate=function(e){0>e||125a?(e.sortIndex=o,r(f,e),null===n(s)&&e===n(f)&&(b?(m(j),j=-1):b=!0,C(O,o-a))):(e.sortIndex=i,r(s,e),y||_||(y=!0,P||(P=!0,l()))),e},t.unstable_shouldYield=M,t.unstable_wrapCallback=function(e){var t=h;return function(){var r=h;h=t;try{return e.apply(this,arguments)}finally{h=r}}}},47650:(e,t,r)=>{"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),e.exports=r(58730)},48302:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"InvariantError",{enumerable:!0,get:function(){return r}});class r extends Error{constructor(e,t){super("Invariant: "+(e.endsWith(".")?e:e+".")+" This is a bug in Next.js.",t),this.name="InvariantError"}}},48359:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"unresolvedThenable",{enumerable:!0,get:function(){return r}});let r={then:()=>{}};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},48915:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"hasInterceptionRouteInCurrentTree",{enumerable:!0,get:function(){return function e(t){let[r,u]=t;if(Array.isArray(r)&&("di"===r[2]||"ci"===r[2])||"string"==typeof r&&(0,n.isInterceptionRouteAppPath)(r))return!0;if(u){for(let t in u)if(e(u[t]))return!0}return!1}}});let n=r(57630);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},49417:(e,t,r)=>{"use strict";function n(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(n=function(e){return e?r:t})(e)}function u(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=n(t);if(r&&r.has(e))return r.get(e);var u={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if("default"!==l&&Object.prototype.hasOwnProperty.call(e,l)){var a=o?Object.getOwnPropertyDescriptor(e,l):null;a&&(a.get||a.set)?Object.defineProperty(u,l,a):u[l]=e[l]}return u.default=e,r&&r.set(e,u),u}r.r(t),r.d(t,{_:()=>u})},49781:(e,t,r)=>{"use strict";let n,u;Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"hydrate",{enumerable:!0,get:function(){return U}});let o=r(28140),l=r(49417),a=r(95155);r(66001);let i=o._(r(12669)),c=l._(r(12115)),s=r(77197),f=r(82073),d=r(3789),p=r(65444),h=r(41209),_=r(85153),y=r(11807),b=o._(r(17297)),v=r(62592);r(46752);let g=r(3201),m=s.createFromReadableStream,R=document,E=new TextEncoder,O=!1,P=!1,j=null;function T(e){if(0===e[0])n=[];else if(1===e[0]){if(!n)throw Object.defineProperty(Error("Unexpected server data: missing bootstrap script."),"__NEXT_ERROR_CODE",{value:"E18",enumerable:!1,configurable:!0});u?u.enqueue(E.encode(e[1])):n.push(e[1])}else if(2===e[0])j=e[1];else if(3===e[0]){if(!n)throw Object.defineProperty(Error("Unexpected server data: missing bootstrap script."),"__NEXT_ERROR_CODE",{value:"E18",enumerable:!1,configurable:!0});let r=atob(e[1]),o=new Uint8Array(r.length);for(var t=0;t{e.enqueue("string"==typeof t?E.encode(t):t)}),O&&!P)&&(null===e.desiredSize||e.desiredSize<0?e.error(Object.defineProperty(Error("The connection to the page was unexpectedly closed, possibly due to the stop button being clicked, loss of Wi-Fi, or an unstable internet connection."),"__NEXT_ERROR_CODE",{value:"E117",enumerable:!1,configurable:!0})):e.close(),P=!0,n=void 0),u=e}}),{callServer:h.callServer,findSourceMapURL:_.findSourceMapURL});function A(e){let{pendingActionQueue:t}=e,r=(0,c.use)(w),n=(0,c.use)(t);return(0,a.jsx)(b.default,{actionQueue:n,globalErrorState:r.G,assetPrefix:r.p})}let x=c.default.StrictMode;function C(e){let{children:t}=e;return t}let N={onDefaultTransitionIndicator:function(){return()=>{}},onRecoverableError:d.onRecoverableError,onCaughtError:p.onCaughtError,onUncaughtError:p.onUncaughtError};function U(e){let t=new Promise((t,r)=>{w.then(r=>{(0,g.setAppBuildId)(r.b);let n=Date.now();t((0,y.createMutableActionQueue)((0,v.createInitialRouterState)({navigatedAt:n,initialFlightData:r.f,initialCanonicalUrlParts:r.c,initialParallelRoutes:new Map,location:window.location,couldBeIntercepted:r.i,postponed:r.s,prerendered:r.S}),e))},e=>r(e))}),r=(0,a.jsx)(x,{children:(0,a.jsx)(f.HeadManagerContext.Provider,{value:{appDir:!0},children:(0,a.jsx)(C,{children:(0,a.jsx)(A,{pendingActionQueue:t})})})});"__next_error__"===document.documentElement.id?i.default.createRoot(R,N).render(r):c.default.startTransition(()=>{i.default.hydrateRoot(R,r,{...N,formState:j})})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},51486:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"useUntrackedPathname",{enumerable:!0,get:function(){return o}});let n=r(12115),u=r(3865);function o(){return(0,n.useContext)(u.PathnameContext)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},51755:(e,t,r)=>{"use strict";function n(e){return e}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"removeBasePath",{enumerable:!0,get:function(){return n}}),r(92929),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},52486:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{ACTION_HEADER:function(){return n},FLIGHT_HEADERS:function(){return f},NEXT_ACTION_NOT_FOUND_HEADER:function(){return v},NEXT_DID_POSTPONE_HEADER:function(){return h},NEXT_HMR_REFRESH_HASH_COOKIE:function(){return i},NEXT_HMR_REFRESH_HEADER:function(){return a},NEXT_IS_PRERENDER_HEADER:function(){return b},NEXT_REWRITTEN_PATH_HEADER:function(){return _},NEXT_REWRITTEN_QUERY_HEADER:function(){return y},NEXT_ROUTER_PREFETCH_HEADER:function(){return o},NEXT_ROUTER_SEGMENT_PREFETCH_HEADER:function(){return l},NEXT_ROUTER_STALE_TIME_HEADER:function(){return p},NEXT_ROUTER_STATE_TREE_HEADER:function(){return u},NEXT_RSC_UNION_QUERY:function(){return d},NEXT_URL:function(){return c},RSC_CONTENT_TYPE_HEADER:function(){return s},RSC_HEADER:function(){return r}});let r="rsc",n="next-action",u="next-router-state-tree",o="next-router-prefetch",l="next-router-segment-prefetch",a="next-hmr-refresh",i="__next_hmr_refresh_hash__",c="next-url",s="text/x-component",f=[r,u,o,a,l],d="_rsc",p="x-nextjs-stale-time",h="x-nextjs-postponed",_="x-nextjs-rewritten-path",y="x-nextjs-rewritten-query",b="x-nextjs-prerender",v="x-nextjs-action-not-found";("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},53663:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"appBootstrap",{enumerable:!0,get:function(){return u}});let n=r(94681);function u(e){var t,r;t=self.__next_s,r=()=>{e()},t&&t.length?t.reduce((e,t)=>{let[r,u]=t;return e.then(()=>new Promise((e,t)=>{let o=document.createElement("script");u&&(0,n.setAttributesFromProps)(o,u),r?(o.src=r,o.onload=()=>e(),o.onerror=t):u&&(o.innerHTML=u.children,setTimeout(e)),document.head.appendChild(o)}))},Promise.resolve()).catch(e=>{console.error(e)}).then(()=>{r()}):r()}window.next={version:"15.5.4",appDir:!0},("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},53965:e=>{!function(){var t={229:function(e){var t,r,n,u=e.exports={};function o(){throw Error("setTimeout has not been defined")}function l(){throw Error("clearTimeout has not been defined")}try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{r="function"==typeof clearTimeout?clearTimeout:l}catch(e){r=l}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}var i=[],c=!1,s=-1;function f(){c&&n&&(c=!1,n.length?i=n.concat(i):s=-1,i.length&&d())}function d(){if(!c){var e=a(f);c=!0;for(var t=i.length;t;){for(n=i,i=[];++s1)for(var r=1;r{"use strict";function r(e){return null!==e&&"object"==typeof e&&"then"in e&&"function"==typeof e.then}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isThenable",{enumerable:!0,get:function(){return r}})},57150:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return l}});let n=r(95155),u=r(15860),o={error:{fontFamily:'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',height:"100vh",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},text:{fontSize:"14px",fontWeight:400,lineHeight:"28px",margin:"0 8px"}},l=function(e){let{error:t}=e,r=null==t?void 0:t.digest;return(0,n.jsxs)("html",{id:"__next_error__",children:[(0,n.jsx)("head",{}),(0,n.jsxs)("body",{children:[(0,n.jsx)(u.HandleISRError,{error:t}),(0,n.jsx)("div",{style:o.error,children:(0,n.jsxs)("div",{children:[(0,n.jsxs)("h2",{style:o.text,children:["Application error: a ",r?"server":"client","-side exception has occurred while loading ",window.location.hostname," (see the"," ",r?"server logs":"browser console"," for more information)."]}),r?(0,n.jsx)("p",{style:o.text,children:"Digest: "+r}):null]})})]})]})};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},57630:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{INTERCEPTION_ROUTE_MARKERS:function(){return u},extractInterceptionRouteInformation:function(){return l},isInterceptionRouteAppPath:function(){return o}});let n=r(74061),u=["(..)(..)","(.)","(..)","(...)"];function o(e){return void 0!==e.split("/").find(e=>u.find(t=>e.startsWith(t)))}function l(e){let t,r,o;for(let n of e.split("/"))if(r=u.find(e=>n.startsWith(e))){[t,o]=e.split(r,2);break}if(!t||!r||!o)throw Object.defineProperty(Error("Invalid interception route: "+e+". Must be in the format //(..|...|..)(..)/"),"__NEXT_ERROR_CODE",{value:"E269",enumerable:!1,configurable:!0});switch(t=(0,n.normalizeAppPath)(t),r){case"(.)":o="/"===t?"/"+o:t+"/"+o;break;case"(..)":if("/"===t)throw Object.defineProperty(Error("Invalid interception route: "+e+". Cannot use (..) marker at the root level, use (.) instead."),"__NEXT_ERROR_CODE",{value:"E207",enumerable:!1,configurable:!0});o=t.split("/").slice(0,-1).concat(o).join("/");break;case"(...)":o="/"+o;break;case"(..)(..)":let l=t.split("/");if(l.length<=2)throw Object.defineProperty(Error("Invalid interception route: "+e+". Cannot use (..)(..) marker at the root level or one level up."),"__NEXT_ERROR_CODE",{value:"E486",enumerable:!1,configurable:!0});o=l.slice(0,-2).concat(o).join("/");break;default:throw Object.defineProperty(Error("Invariant: unexpected marker"),"__NEXT_ERROR_CODE",{value:"E112",enumerable:!1,configurable:!0})}return{interceptingRoute:t,interceptedRoute:o}}},58130:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"shouldHardNavigate",{enumerable:!0,get:function(){return function e(t,r){let[o,l]=r,[a,i]=t;return(0,u.matchSegment)(a,o)?!(t.length<=2)&&e((0,n.getNextFlightSegmentPath)(t),l[i]):!!Array.isArray(a)}}});let n=r(16378),u=r(7460);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},58730:(e,t,r)=>{"use strict";var n=r(12115);function u(e){var t="https://react.dev/errors/"+e;if(1{"use strict";function r(e){let t=5381;for(let r=0;r>>0}function n(e){return r(e).toString(36).slice(0,5)}Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{djb2Hash:function(){return r},hexHash:function(){return n}})},60543:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{fillCacheWithNewSubTreeData:function(){return i},fillCacheWithNewSubTreeDataButOnlyLoading:function(){return c}});let n=r(94201),u=r(30637),o=r(69190),l=r(65360);function a(e,t,r,a,i,c){let{segmentPath:s,seedData:f,tree:d,head:p}=a,h=t,_=r;for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"applyRouterStatePatchToTree",{enumerable:!0,get:function(){return function e(t,r,n,i){let c,[s,f,d,p,h]=r;if(1===t.length){let e=a(r,n);return(0,l.addRefreshMarkerToActiveParallelSegments)(e,i),e}let[_,y]=t;if(!(0,o.matchSegment)(_,s))return null;if(2===t.length)c=a(f[y],n);else if(null===(c=e((0,u.getNextFlightSegmentPath)(t),f[y],n,i)))return null;let b=[t[0],{...f,[y]:c},d,p];return h&&(b[4]=!0),(0,l.addRefreshMarkerToActiveParallelSegments)(b,i),b}}});let n=r(65360),u=r(16378),o=r(7460),l=r(23597);function a(e,t){let[r,u]=e,[l,i]=t;if(l===n.DEFAULT_SEGMENT_KEY&&r!==n.DEFAULT_SEGMENT_KEY)return e;if((0,o.matchSegment)(r,l)){let t={};for(let e in u)void 0!==i[e]?t[e]=a(u[e],i[e]):t[e]=u[e];for(let e in i)t[e]||(t[e]=i[e]);let n=[r,t];return e[2]&&(n[2]=e[2]),e[3]&&(n[3]=e[3]),e[4]&&(n[4]=e[4]),n}return t}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},61426:(e,t,r)=>{"use strict";var n=r(95704),u=Symbol.for("react.transitional.element"),o=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),s=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),_=Symbol.iterator,y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,v={};function g(e,t,r){this.props=e,this.context=t,this.refs=v,this.updater=r||y}function m(){}function R(e,t,r){this.props=e,this.context=t,this.refs=v,this.updater=r||y}g.prototype.isReactComponent={},g.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("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")},g.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},m.prototype=g.prototype;var E=R.prototype=new m;E.constructor=R,b(E,g.prototype),E.isPureReactComponent=!0;var O=Array.isArray;function P(){}var j={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function S(e,t,r){var n=r.ref;return{$$typeof:u,type:e,key:t,ref:void 0!==n?n:null,props:r}}function M(e){return"object"==typeof e&&null!==e&&e.$$typeof===u}var w=/\/+/g;function A(e,t){var r,n;return"object"==typeof e&&null!==e&&null!=e.key?(r=""+e.key,n={"=":"=0",":":"=2"},"$"+r.replace(/[=:]/g,function(e){return n[e]})):t.toString(36)}function x(e,t,r){if(null==e)return e;var n=[],l=0;return!function e(t,r,n,l,a){var i,c,s,f=typeof t;("undefined"===f||"boolean"===f)&&(t=null);var d=!1;if(null===t)d=!0;else switch(f){case"bigint":case"string":case"number":d=!0;break;case"object":switch(t.$$typeof){case u:case o:d=!0;break;case h:return e((d=t._init)(t._payload),r,n,l,a)}}if(d)return a=a(t),d=""===l?"."+A(t,0):l,O(a)?(n="",null!=d&&(n=d.replace(w,"$&/")+"/"),e(a,r,n,"",function(e){return e})):null!=a&&(M(a)&&(i=a,c=n+(null==a.key||t&&t.key===a.key?"":(""+a.key).replace(w,"$&/")+"/")+d,a=S(i.type,c,i.props)),r.push(a)),1;d=0;var p=""===l?".":l+":";if(O(t))for(var y=0;y{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{handleHardNavError:function(){return u},useNavFailureHandler:function(){return o}}),r(12115);let n=r(29658);function u(e){return!!e&&!!window.next.__pendingUrl&&(0,n.createHrefFromUrl)(new URL(window.location.href))!==(0,n.createHrefFromUrl)(window.next.__pendingUrl)&&(console.error("Error occurred during navigation, falling back to hard navigation",e),window.location.href=window.next.__pendingUrl.toString(),!0)}function o(){}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},62244:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"serverActionReducer",{enumerable:!0,get:function(){return A}});let n=r(41209),u=r(85153),o=r(52486),l=r(12845),a=r(77197),i=r(86871),c=r(66640),s=r(29658),f=r(35737),d=r(60895),p=r(44707),h=r(11126),_=r(30637),y=r(17297),b=r(48915),v=r(97332),g=r(23597),m=r(16378),R=r(86542),E=r(86437),O=r(83571),P=r(51755),j=r(92929),T=r(77519);r(66048);let S=a.createFromFetch;async function M(e,t,r){let i,s,f,d,{actionId:p,actionArgs:h}=r,_=(0,a.createTemporaryReferenceSet)(),y=(0,T.extractInfoFromServerReferenceId)(p),b="use-cache"===y.type?(0,T.omitUnusedArgs)(h,y):h,v=await (0,a.encodeReply)(b,{temporaryReferences:_}),g=await fetch(e.canonicalUrl,{method:"POST",headers:{Accept:o.RSC_CONTENT_TYPE_HEADER,[o.ACTION_HEADER]:p,[o.NEXT_ROUTER_STATE_TREE_HEADER]:(0,m.prepareFlightRouterStateForRequest)(e.tree),...{},...t?{[o.NEXT_URL]:t}:{}},body:v});if("1"===g.headers.get(o.NEXT_ACTION_NOT_FOUND_HEADER))throw Object.defineProperty(new l.UnrecognizedActionError('Server Action "'+p+'" was not found on the server. \nRead more: https://nextjs.org/docs/messages/failed-to-find-server-action'),"__NEXT_ERROR_CODE",{value:"E715",enumerable:!1,configurable:!0});let R=g.headers.get("x-action-redirect"),[O,P]=(null==R?void 0:R.split(";"))||[];switch(P){case"push":i=E.RedirectType.push;break;case"replace":i=E.RedirectType.replace;break;default:i=void 0}let j=!!g.headers.get(o.NEXT_IS_PRERENDER_HEADER);try{let e=JSON.parse(g.headers.get("x-action-revalidated")||"[[],0,0]");s={paths:e[0]||[],tag:!!e[1],cookie:e[2]}}catch(e){s=w}let M=O?(0,c.assignLocation)(O,new URL(e.canonicalUrl,window.location.href)):void 0,A=g.headers.get("content-type"),x=!!(A&&A.startsWith(o.RSC_CONTENT_TYPE_HEADER));if(!x&&!M)throw Object.defineProperty(Error(g.status>=400&&"text/plain"===A?await g.text():"An unexpected response was received from the server."),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});if(x){let e=await S(Promise.resolve(g),{callServer:n.callServer,findSourceMapURL:u.findSourceMapURL,temporaryReferences:_});f=M?void 0:e.a,d=(0,m.normalizeFlightData)(e.f)}else f=void 0,d=void 0;return{actionResult:f,actionFlightData:d,redirectLocation:M,redirectType:i,revalidatedParts:s,isPrerender:j}}let w={paths:[],tag:!1,cookie:!1};function A(e,t){let{resolve:r,reject:n}=t,u={},o=e.tree;u.preserveCustomHistoryState=!1;let l=e.nextUrl&&(0,b.hasInterceptionRouteInCurrentTree)(e.tree)?e.nextUrl:null,a=Date.now();return M(e,l,t).then(async c=>{let b,{actionResult:m,actionFlightData:T,redirectLocation:S,redirectType:M,isPrerender:w,revalidatedParts:A}=c;if(S&&(M===E.RedirectType.replace?(e.pushRef.pendingPush=!1,u.pendingPush=!1):(e.pushRef.pendingPush=!0,u.pendingPush=!0),u.canonicalUrl=b=(0,s.createHrefFromUrl)(S,!1)),!T)return(r(m),S)?(0,f.handleExternalUrl)(e,u,S.href,e.pushRef.pendingPush):e;if("string"==typeof T)return r(m),(0,f.handleExternalUrl)(e,u,T,e.pushRef.pendingPush);let x=A.paths.length>0||A.tag||A.cookie;for(let n of T){let{tree:i,seedData:c,head:s,isRootRender:h}=n;if(!h)return console.log("SERVER ACTION APPLY FAILED"),r(m),e;let R=(0,d.applyRouterStatePatchToTree)([""],o,i,b||e.canonicalUrl);if(null===R)return r(m),(0,v.handleSegmentMismatch)(e,t,i);if((0,p.isNavigatingToNewRootLayout)(o,R))return r(m),(0,f.handleExternalUrl)(e,u,b||e.canonicalUrl,e.pushRef.pendingPush);if(null!==c){let t=c[1],r=(0,y.createEmptyCacheNode)();r.rsc=t,r.prefetchRsc=null,r.loading=c[3],(0,_.fillLazyItemsTillLeafWithHead)(a,r,void 0,i,c,s,void 0),u.cache=r,u.prefetchCache=new Map,x&&await (0,g.refreshInactiveParallelSegments)({navigatedAt:a,state:e,updatedTree:R,updatedCache:r,includeNextUrl:!!l,canonicalUrl:u.canonicalUrl||e.canonicalUrl})}u.patchedTree=R,o=R}return S&&b?(x||((0,O.createSeededPrefetchCacheEntry)({url:S,data:{flightData:T,canonicalUrl:void 0,couldBeIntercepted:!1,prerendered:!1,postponed:!1,staleTime:-1},tree:e.tree,prefetchCache:e.prefetchCache,nextUrl:e.nextUrl,kind:w?i.PrefetchKind.FULL:i.PrefetchKind.AUTO}),u.prefetchCache=e.prefetchCache),n((0,R.getRedirectError)((0,j.hasBasePath)(b)?(0,P.removeBasePath)(b):b,M||E.RedirectType.push))):r(m),(0,h.handleMutable)(e,u)},t=>(n(t),e))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},62592:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createInitialRouterState",{enumerable:!0,get:function(){return s}});let n=r(29658),u=r(30637),o=r(86343),l=r(83571),a=r(86871),i=r(23597),c=r(16378);function s(e){var t,r;let{navigatedAt:s,initialFlightData:f,initialCanonicalUrlParts:d,initialParallelRoutes:p,location:h,couldBeIntercepted:_,postponed:y,prerendered:b}=e,v=d.join("/"),g=(0,c.getFlightDataPartsFromPath)(f[0]),{tree:m,seedData:R,head:E}=g,O={lazyData:null,rsc:null==R?void 0:R[1],prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:p,loading:null!=(t=null==R?void 0:R[3])?t:null,navigatedAt:s},P=h?(0,n.createHrefFromUrl)(h):v;(0,i.addRefreshMarkerToActiveParallelSegments)(m,P);let j=new Map;(null===p||0===p.size)&&(0,u.fillLazyItemsTillLeafWithHead)(s,O,void 0,m,R,E,void 0);let T={tree:m,cache:O,prefetchCache:j,pushRef:{pendingPush:!1,mpaNavigation:!1,preserveCustomHistoryState:!0},focusAndScrollRef:{apply:!1,onlyHashChange:!1,hashFragment:null,segmentPaths:[]},canonicalUrl:P,nextUrl:null!=(r=(0,o.extractPathFromFlightRouterState)(m)||(null==h?void 0:h.pathname))?r:null};if(h){let e=new URL(""+h.pathname+h.search,h.origin);(0,l.createSeededPrefetchCacheEntry)({url:e,data:{flightData:[g],canonicalUrl:void 0,couldBeIntercepted:!!_,prerendered:b,postponed:y,staleTime:b&&1?l.STATIC_STALETIME_MS:-1},tree:T.tree,prefetchCache:T.prefetchCache,nextUrl:T.nextUrl,kind:b?a.PrefetchKind.FULL:a.PrefetchKind.AUTO})}return T}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},63499:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{IDLE_LINK_STATUS:function(){return s},PENDING_LINK_STATUS:function(){return c},mountFormInstance:function(){return g},mountLinkInstance:function(){return v},onLinkVisibilityChanged:function(){return R},onNavigationIntent:function(){return E},pingVisibleLinks:function(){return P},setLinkForCurrentNavigation:function(){return f},unmountLinkForCurrentNavigation:function(){return d},unmountPrefetchableInstance:function(){return m}}),r(11807);let n=r(17297),u=r(66048),o=r(12115),l=r(86871),a=r(48302),i=null,c={pending:!0},s={pending:!1};function f(e){(0,o.startTransition)(()=>{null==i||i.setOptimisticLinkStatus(s),null==e||e.setOptimisticLinkStatus(c),i=e})}function d(e){i===e&&(i=null)}let p="function"==typeof WeakMap?new WeakMap:new Map,h=new Set,_="function"==typeof IntersectionObserver?new IntersectionObserver(function(e){for(let t of e){let e=t.intersectionRatio>0;R(t.target,e)}},{rootMargin:"200px"}):null;function y(e,t){void 0!==p.get(e)&&m(e),p.set(e,t),null!==_&&_.observe(e)}function b(e){try{return(0,n.createPrefetchURL)(e)}catch(t){return("function"==typeof reportError?reportError:console.error)("Cannot prefetch '"+e+"' because it cannot be converted to a URL."),null}}function v(e,t,r,n,u,o){if(u){let u=b(t);if(null!==u){let t={router:r,fetchStrategy:n,isVisible:!1,prefetchTask:null,prefetchHref:u.href,setOptimisticLinkStatus:o};return y(e,t),t}}return{router:r,fetchStrategy:n,isVisible:!1,prefetchTask:null,prefetchHref:null,setOptimisticLinkStatus:o}}function g(e,t,r,n){let u=b(t);null!==u&&y(e,{router:r,fetchStrategy:n,isVisible:!1,prefetchTask:null,prefetchHref:u.href,setOptimisticLinkStatus:null})}function m(e){let t=p.get(e);if(void 0!==t){p.delete(e),h.delete(t);let r=t.prefetchTask;null!==r&&(0,u.cancelPrefetchTask)(r)}null!==_&&_.unobserve(e)}function R(e,t){let r=p.get(e);void 0!==r&&(r.isVisible=t,t?h.add(r):h.delete(r),O(r,u.PrefetchPriority.Default))}function E(e,t){let r=p.get(e);void 0!==r&&void 0!==r&&O(r,u.PrefetchPriority.Intent)}function O(e,t){var r;let n=e.prefetchTask;if(!e.isVisible){null!==n&&(0,u.cancelPrefetchTask)(n);return}r=e,(async()=>{let e;switch(r.fetchStrategy){case u.FetchStrategy.PPR:e=l.PrefetchKind.AUTO;break;case u.FetchStrategy.Full:e=l.PrefetchKind.FULL;break;case u.FetchStrategy.PPRRuntime:throw Object.defineProperty(new a.InvariantError("FetchStrategy.PPRRuntime should never be used when `experimental.clientSegmentCache` is disabled"),"__NEXT_ERROR_CODE",{value:"E772",enumerable:!1,configurable:!0});default:r.fetchStrategy,e=void 0}return r.router.prefetch(r.prefetchHref,{kind:e})})().catch(e=>{})}function P(e,t){for(let r of h){let n=r.prefetchTask;if(null!==n&&!(0,u.isPrefetchTaskDirty)(n,e,t))continue;null!==n&&(0,u.cancelPrefetchTask)(n);let o=(0,u.createCacheKey)(r.prefetchHref,e);r.prefetchTask=(0,u.schedulePrefetchTask)(o,t,r.fetchStrategy,u.PrefetchPriority.Default,null)}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},63886:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"HTTPAccessFallbackBoundary",{enumerable:!0,get:function(){return s}});let n=r(49417),u=r(95155),o=n._(r(12115)),l=r(51486),a=r(37099);r(94781);let i=r(46752);class c extends o.default.Component{componentDidCatch(){}static getDerivedStateFromError(e){if((0,a.isHTTPAccessFallbackError)(e))return{triggeredStatus:(0,a.getAccessFallbackHTTPStatus)(e)};throw e}static getDerivedStateFromProps(e,t){return e.pathname!==t.previousPathname&&t.triggeredStatus?{triggeredStatus:void 0,previousPathname:e.pathname}:{triggeredStatus:t.triggeredStatus,previousPathname:e.pathname}}render(){let{notFound:e,forbidden:t,unauthorized:r,children:n}=this.props,{triggeredStatus:o}=this.state,l={[a.HTTPAccessErrorStatus.NOT_FOUND]:e,[a.HTTPAccessErrorStatus.FORBIDDEN]:t,[a.HTTPAccessErrorStatus.UNAUTHORIZED]:r};if(o){let i=o===a.HTTPAccessErrorStatus.NOT_FOUND&&e,c=o===a.HTTPAccessErrorStatus.FORBIDDEN&&t,s=o===a.HTTPAccessErrorStatus.UNAUTHORIZED&&r;return i||c||s?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("meta",{name:"robots",content:"noindex"}),!1,l[o]]}):n}return n}constructor(e){super(e),this.state={triggeredStatus:void 0,previousPathname:e.pathname}}}function s(e){let{notFound:t,forbidden:r,unauthorized:n,children:a}=e,s=(0,l.useUntrackedPathname)(),f=(0,o.useContext)(i.MissingSlotContext);return t||r||n?(0,u.jsx)(c,{pathname:s,notFound:t,forbidden:r,unauthorized:n,missingSlots:f,children:a}):(0,u.jsx)(u.Fragment,{children:a})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},64425:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{ROOT_SEGMENT_CACHE_KEY:function(){return o},ROOT_SEGMENT_REQUEST_KEY:function(){return u},appendSegmentCacheKeyPart:function(){return c},appendSegmentRequestKeyPart:function(){return a},convertSegmentPathToStaticExportFilename:function(){return d},createSegmentCacheKeyPart:function(){return i},createSegmentRequestKeyPart:function(){return l}});let n=r(65360),u="",o="";function l(e){if("string"==typeof e)return e.startsWith(n.PAGE_SEGMENT_KEY)?n.PAGE_SEGMENT_KEY:"/_not-found"===e?"_not-found":f(e);let t=e[0],r=e[2];return"$"+r+"$"+f(t)}function a(e,t,r){return e+"/"+("children"===t?r:"@"+f(t)+"/"+r)}function i(e,t){return"string"==typeof t?e:e+"$"+f(t[1])}function c(e,t,r){return e+"/"+("children"===t?r:"@"+f(t)+"/"+r)}let s=/^[a-zA-Z0-9\-_@]+$/;function f(e){return s.test(e)?e:"!"+btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function d(e){return"__next"+e.replace(/\//g,".")+".txt"}},64869:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createRenderSearchParamsFromClient",{enumerable:!0,get:function(){return o}});let n=r(23982),u=new WeakMap;function o(e){let t=u.get(e);if(t)return t;let r=Promise.resolve(e);return u.set(e,r),Object.keys(e).forEach(t=>{n.wellKnownProperties.has(t)||(r[t]=e[t])}),r}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},65345:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"hmrRefreshReducer",{enumerable:!0,get:function(){return n}}),r(32753),r(29658),r(60895),r(44707),r(35737),r(11126),r(77609),r(17297),r(97332),r(48915);let n=function(e,t){return e};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},65360:(e,t)=>{"use strict";function r(e){return"("===e[0]&&e.endsWith(")")}function n(e){return e.startsWith("@")&&"@children"!==e}function u(e,t){if(e.includes(o)){let e=JSON.stringify(t);return"{}"!==e?o+"?"+e:o}return e}Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{DEFAULT_SEGMENT_KEY:function(){return l},PAGE_SEGMENT_KEY:function(){return o},addSearchParamsIfPageSegment:function(){return u},isGroupSegment:function(){return r},isParallelRouteSegment:function(){return n}});let o="__PAGE__",l="__DEFAULT__"},65444:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{onCaughtError:function(){return s},onUncaughtError:function(){return f}});let n=r(28140),u=r(5829),o=r(24553),l=r(3463),a=r(88785),i=n._(r(57150)),c={decorateDevError:e=>e,handleClientError:()=>{},originConsoleError:console.error.bind(console)};function s(e,t){var r;let n,l=null==(r=t.errorBoundary)?void 0:r.constructor;if(n=n||l===a.ErrorBoundaryHandler&&t.errorBoundary.props.errorComponent===i.default)return f(e);(0,o.isBailoutToCSRError)(e)||(0,u.isNextRouterError)(e)||c.originConsoleError(e)}function f(e){(0,o.isBailoutToCSRError)(e)||(0,u.isNextRouterError)(e)||(0,l.reportGlobalError)(e)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},66001:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(90535),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},66048:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{FetchStrategy:function(){return h},NavigationResultTag:function(){return d},PrefetchPriority:function(){return p},cancelPrefetchTask:function(){return i},createCacheKey:function(){return f},getCurrentCacheVersion:function(){return l},isPrefetchTaskDirty:function(){return s},navigate:function(){return u},prefetch:function(){return n},reschedulePrefetchTask:function(){return c},revalidateEntireCache:function(){return o},schedulePrefetchTask:function(){return a}});let r=()=>{throw Object.defineProperty(Error("Segment Cache experiment is not enabled. This is a bug in Next.js."),"__NEXT_ERROR_CODE",{value:"E654",enumerable:!1,configurable:!0})},n=r,u=r,o=r,l=r,a=r,i=r,c=r,s=r,f=r;var d=function(e){return e[e.MPA=0]="MPA",e[e.Success=1]="Success",e[e.NoOp=2]="NoOp",e[e.Async=3]="Async",e}({}),p=function(e){return e[e.Intent=2]="Intent",e[e.Default=1]="Default",e[e.Background=0]="Background",e}({}),h=function(e){return e[e.LoadingBoundary=0]="LoadingBoundary",e[e.PPR=1]="PPR",e[e.PPRRuntime=2]="PPRRuntime",e[e.Full=3]="Full",e}({});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},66640:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"assignLocation",{enumerable:!0,get:function(){return u}});let n=r(96058);function u(e,t){if(e.startsWith(".")){let r=t.origin+t.pathname;return new URL((r.endsWith("/")?r:r+"/")+e)}return new URL((0,n.addBasePath)(e),t.href)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},67858:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"unstable_rethrow",{enumerable:!0,get:function(){return function e(t){if((0,u.isNextRouterError)(t)||(0,n.isBailoutToCSRError)(t))throw t;t instanceof Error&&"cause"in t&&e(t.cause)}}});let n=r(24553),u=r(5829);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},68440:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{METADATA_BOUNDARY_NAME:function(){return r},OUTLET_BOUNDARY_NAME:function(){return u},ROOT_LAYOUT_BOUNDARY_NAME:function(){return o},VIEWPORT_BOUNDARY_NAME:function(){return n}});let r="__next_metadata_boundary__",n="__next_viewport_boundary__",u="__next_outlet_boundary__",o="__next_root_layout_boundary__"},68451:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"reducer",{enumerable:!0,get:function(){return f}});let n=r(86871),u=r(35737),o=r(36798),l=r(37854),a=r(38719),i=r(43933),c=r(65345),s=r(62244),f=function(e,t){switch(t.type){case n.ACTION_NAVIGATE:return(0,u.navigateReducer)(e,t);case n.ACTION_SERVER_PATCH:return(0,o.serverPatchReducer)(e,t);case n.ACTION_RESTORE:return(0,l.restoreReducer)(e,t);case n.ACTION_REFRESH:return(0,a.refreshReducer)(e,t);case n.ACTION_HMR_REFRESH:return(0,c.hmrRefreshReducer)(e,t);case n.ACTION_PREFETCH:return(0,i.prefetchReducer)(e,t);case n.ACTION_SERVER_ACTION:return(0,s.serverActionReducer)(e,t);default:throw Object.defineProperty(Error("Unknown action"),"__NEXT_ERROR_CODE",{value:"E295",enumerable:!1,configurable:!0})}};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},69190:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createRouterCacheKey",{enumerable:!0,get:function(){return u}});let n=r(65360);function u(e,t){return(void 0===t&&(t=!1),Array.isArray(e))?e[0]+"|"+e[1]+"|"+e[2]:t&&e.startsWith(n.PAGE_SEGMENT_KEY)?n.PAGE_SEGMENT_KEY:e}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},71099:(e,t,r)=>{"use strict";function n(){throw Object.defineProperty(Error("`forbidden()` is experimental and only allowed to be enabled when `experimental.authInterrupts` is enabled."),"__NEXT_ERROR_CODE",{value:"E488",enumerable:!1,configurable:!0})}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"forbidden",{enumerable:!0,get:function(){return n}}),r(37099).HTTP_ERROR_FALLBACK_ERROR_CODE,("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},71239:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"normalizePathTrailingSlash",{enumerable:!0,get:function(){return o}});let n=r(77700),u=r(5240),o=e=>{if(!e.startsWith("/"))return e;let{pathname:t,query:r,hash:o}=(0,u.parsePath)(e);return/\.[^/]+\/?$/.test(t)?""+(0,n.removeTrailingSlash)(t)+r+o:t.endsWith("/")?""+t+r+o:t+"/"+r+o};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},71923:(e,t,r)=>{"use strict";e.exports=r(19393)},72103:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{ServerInsertedHTMLContext:function(){return u},useServerInsertedHTML:function(){return o}});let n=r(49417)._(r(12115)),u=n.default.createContext(null);function o(e){let t=(0,n.useContext)(u);t&&t(e)}},73879:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"addPathPrefix",{enumerable:!0,get:function(){return u}});let n=r(5240);function u(e,t){if(!e.startsWith("/")||!t)return e;let{pathname:r,query:u,hash:o}=(0,n.parsePath)(e);return""+t+r+u+o}},74061:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{normalizeAppPath:function(){return o},normalizeRscURL:function(){return l}});let n=r(76196),u=r(65360);function o(e){return(0,n.ensureLeadingSlash)(e.split("/").reduce((e,t,r,n)=>!t||(0,u.isGroupSegment)(t)||"@"===t[0]||("page"===t||"route"===t)&&r===n.length-1?e:e+"/"+t,""))}function l(e){return e.replace(/\.rsc($|\?)/,"$1")}},75597:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"invalidateCacheBelowFlightSegmentPath",{enumerable:!0,get:function(){return function e(t,r,o){let l=o.length<=2,[a,i]=o,c=(0,n.createRouterCacheKey)(i),s=r.parallelRoutes.get(a);if(!s)return;let f=t.parallelRoutes.get(a);if(f&&f!==s||(f=new Map(s),t.parallelRoutes.set(a,f)),l)return void f.delete(c);let d=s.get(c),p=f.get(c);p&&d&&(p===d&&(p={lazyData:p.lazyData,rsc:p.rsc,prefetchRsc:p.prefetchRsc,head:p.head,prefetchHead:p.prefetchHead,parallelRoutes:new Map(p.parallelRoutes)},f.set(c,p)),e(p,d,(0,u.getNextFlightSegmentPath)(o)))}}});let n=r(69190),u=r(16378);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},76196:(e,t)=>{"use strict";function r(e){return e.startsWith("/")?e:"/"+e}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ensureLeadingSlash",{enumerable:!0,get:function(){return r}})},76248:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{dispatchAppRouterAction:function(){return l},useActionQueue:function(){return a}});let n=r(49417)._(r(12115)),u=r(54089),o=null;function l(e){if(null===o)throw Object.defineProperty(Error("Internal Next.js error: Router action dispatched before initialization."),"__NEXT_ERROR_CODE",{value:"E668",enumerable:!1,configurable:!0});o(e)}function a(e){let[t,r]=n.default.useState(e.state);return o=t=>e.dispatch(t,r),(0,u.isThenable)(t)?(0,n.use)(t):t}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},77197:(e,t,r)=>{"use strict";e.exports=r(99062)},77278:(e,t)=>{"use strict";function r(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"encodeURIPath",{enumerable:!0,get:function(){return r}})},77370:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createRenderParamsFromClient",{enumerable:!0,get:function(){return o}});let n=r(23982),u=new WeakMap;function o(e){let t=u.get(e);if(t)return t;let r=Promise.resolve(e);return u.set(e,r),Object.keys(e).forEach(t=>{n.wellKnownProperties.has(t)||(r[t]=e[t])}),r}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},77519:(e,t)=>{"use strict";function r(e){let t=parseInt(e.slice(0,2),16),r=t>>1&63,n=Array(6);for(let e=0;e<6;e++){let t=r>>5-e&1;n[e]=1===t}return{type:1==(t>>7&1)?"use-cache":"server-action",usedArgs:n,hasRestArgs:1==(1&t)}}function n(e,t){let r=Array(e.length);for(let n=0;n=6&&t.hasRestArgs)&&(r[n]=e[n]);return r}Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{extractInfoFromServerReferenceId:function(){return r},omitUnusedArgs:function(){return n}})},77609:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"applyFlightData",{enumerable:!0,get:function(){return o}});let n=r(30637),u=r(60543);function o(e,t,r,o,l){let{tree:a,seedData:i,head:c,isRootRender:s}=o;if(null===i)return!1;if(s){let u=i[1];r.loading=i[3],r.rsc=u,r.prefetchRsc=null,(0,n.fillLazyItemsTillLeafWithHead)(e,r,t,a,i,c,l)}else r.rsc=t.rsc,r.prefetchRsc=t.prefetchRsc,r.parallelRoutes=new Map(t.parallelRoutes),r.loading=t.loading,(0,u.fillCacheWithNewSubTreeData)(e,r,t,o,l);return!0}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},77700:(e,t)=>{"use strict";function r(e){return e.replace(/\/$/,"")||"/"}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"removeTrailingSlash",{enumerable:!0,get:function(){return r}})},77759:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{GracefulDegradeBoundary:function(){return o},default:function(){return l}});let n=r(95155),u=r(12115);class o extends u.Component{static getDerivedStateFromError(e){return{hasError:!0}}componentDidMount(){let e=this.htmlRef.current;this.state.hasError&&e&&Object.entries(this.htmlAttributes).forEach(t=>{let[r,n]=t;e.setAttribute(r,n)})}render(){let{hasError:e}=this.state;return(this.rootHtml||(this.rootHtml=document.documentElement.innerHTML,this.htmlAttributes=function(e){let t={};for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PromiseQueue",{enumerable:!0,get:function(){return c}});let n=r(15903),u=r(17797);var o=u._("_maxConcurrency"),l=u._("_runningCount"),a=u._("_queue"),i=u._("_processNext");class c{enqueue(e){let t,r,u=new Promise((e,n)=>{t=e,r=n}),o=async()=>{try{n._(this,l)[l]++;let r=await e();t(r)}catch(e){r(e)}finally{n._(this,l)[l]--,n._(this,i)[i]()}};return n._(this,a)[a].push({promiseFn:u,task:o}),n._(this,i)[i](),u}bump(e){let t=n._(this,a)[a].findIndex(t=>t.promiseFn===e);if(t>-1){let e=n._(this,a)[a].splice(t,1)[0];n._(this,a)[a].unshift(e),n._(this,i)[i](!0)}}constructor(e=5){Object.defineProperty(this,i,{value:s}),Object.defineProperty(this,o,{writable:!0,value:void 0}),Object.defineProperty(this,l,{writable:!0,value:void 0}),Object.defineProperty(this,a,{writable:!0,value:void 0}),n._(this,o)[o]=e,n._(this,l)[l]=0,n._(this,a)[a]=[]}}function s(e){if(void 0===e&&(e=!1),(n._(this,l)[l]0){var t;null==(t=n._(this,a)[a].shift())||t.task()}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},80622:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"IconMark",{enumerable:!0,get:function(){return n}}),r(95155);let n=()=>null},81099:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"RedirectStatusCode",{enumerable:!0,get:function(){return r}});var r=function(e){return e[e.SeeOther=303]="SeeOther",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e}({});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},81959:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ClientPageRoot",{enumerable:!0,get:function(){return u}});let n=r(95155);function u(e){let{Component:t,searchParams:u,params:o,promises:l}=e;{let{createRenderSearchParamsFromClient:e}=r(35878),l=e(u),{createRenderParamsFromClient:a}=r(307),i=a(o);return(0,n.jsx)(t,{params:i,searchParams:l})}}r(48302),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},82073:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"HeadManagerContext",{enumerable:!0,get:function(){return n}});let n=r(28140)._(r(12115)).default.createContext({})},83571:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{DYNAMIC_STALETIME_MS:function(){return d},STATIC_STALETIME_MS:function(){return p},createSeededPrefetchCacheEntry:function(){return c},getOrCreatePrefetchCacheEntry:function(){return i},prunePrefetchCache:function(){return f}});let n=r(32753),u=r(86871),o=r(43933);function l(e,t,r){let n=e.pathname;return(t&&(n+=e.search),r)?""+r+"%"+n:n}function a(e,t,r){return l(e,t===u.PrefetchKind.FULL,r)}function i(e){let{url:t,nextUrl:r,tree:n,prefetchCache:o,kind:a,allowAliasing:i=!0}=e,c=function(e,t,r,n,o){for(let a of(void 0===t&&(t=u.PrefetchKind.TEMPORARY),[r,null])){let r=l(e,!0,a),i=l(e,!1,a),c=e.search?r:i,s=n.get(c);if(s&&o){if(s.url.pathname===e.pathname&&s.url.search!==e.search)return{...s,aliased:!0};return s}let f=n.get(i);if(o&&e.search&&t!==u.PrefetchKind.FULL&&f&&!f.key.includes("%"))return{...f,aliased:!0}}if(t!==u.PrefetchKind.FULL&&o){for(let t of n.values())if(t.url.pathname===e.pathname&&!t.key.includes("%"))return{...t,aliased:!0}}}(t,a,r,o,i);return c?(c.status=h(c),c.kind!==u.PrefetchKind.FULL&&a===u.PrefetchKind.FULL&&c.data.then(e=>{if(!(Array.isArray(e.flightData)&&e.flightData.some(e=>e.isRootRender&&null!==e.seedData)))return s({tree:n,url:t,nextUrl:r,prefetchCache:o,kind:null!=a?a:u.PrefetchKind.TEMPORARY})}),a&&c.kind===u.PrefetchKind.TEMPORARY&&(c.kind=a),c):s({tree:n,url:t,nextUrl:r,prefetchCache:o,kind:a||u.PrefetchKind.TEMPORARY})}function c(e){let{nextUrl:t,tree:r,prefetchCache:n,url:o,data:l,kind:i}=e,c=l.couldBeIntercepted?a(o,i,t):a(o,i),s={treeAtTimeOfPrefetch:r,data:Promise.resolve(l),kind:i,prefetchTime:Date.now(),lastUsedTime:Date.now(),staleTime:l.staleTime,key:c,status:u.PrefetchCacheEntryStatus.fresh,url:o};return n.set(c,s),s}function s(e){let{url:t,kind:r,tree:l,nextUrl:i,prefetchCache:c}=e,s=a(t,r),f=o.prefetchQueue.enqueue(()=>(0,n.fetchServerResponse)(t,{flightRouterState:l,nextUrl:i,prefetchKind:r}).then(e=>{let r;if(e.couldBeIntercepted&&(r=function(e){let{url:t,nextUrl:r,prefetchCache:n,existingCacheKey:u}=e,o=n.get(u);if(!o)return;let l=a(t,o.kind,r);return n.set(l,{...o,key:l}),n.delete(u),l}({url:t,existingCacheKey:s,nextUrl:i,prefetchCache:c})),e.prerendered){let t=c.get(null!=r?r:s);t&&(t.kind=u.PrefetchKind.FULL,-1!==e.staleTime&&(t.staleTime=e.staleTime))}return e})),d={treeAtTimeOfPrefetch:l,data:f,kind:r,prefetchTime:Date.now(),lastUsedTime:null,staleTime:-1,key:s,status:u.PrefetchCacheEntryStatus.fresh,url:t};return c.set(s,d),d}function f(e){for(let[t,r]of e)h(r)===u.PrefetchCacheEntryStatus.expired&&e.delete(t)}let d=1e3*Number("0"),p=1e3*Number("300");function h(e){let{kind:t,prefetchTime:r,lastUsedTime:n}=e;return Date.now()<(null!=n?n:r)+d?n?u.PrefetchCacheEntryStatus.reusable:u.PrefetchCacheEntryStatus.fresh:t===u.PrefetchKind.AUTO&&Date.now(){"use strict";function n(e,t){if(void 0===t&&(t={}),t.onlyHashChange)return void e();let r=document.documentElement;r.dataset.scrollBehavior;let n=r.style.scrollBehavior;r.style.scrollBehavior="auto",t.dontForceLayout||r.getClientRects(),e(),r.style.scrollBehavior=n}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"disableSmoothScrollDuringRouteTransition",{enumerable:!0,get:function(){return n}}),r(94781)},85153:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"findSourceMapURL",{enumerable:!0,get:function(){return r}});let r=void 0;("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},86343:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{computeChangedPath:function(){return c},extractPathFromFlightRouterState:function(){return i},getSelectedParams:function(){return function e(t,r){for(let n of(void 0===r&&(r={}),Object.values(t[1]))){let t=n[0],o=Array.isArray(t),l=o?t[1]:t;!l||l.startsWith(u.PAGE_SEGMENT_KEY)||(o&&("c"===t[2]||"oc"===t[2])?r[t[0]]=t[1].split("/"):o&&(r[t[0]]=t[1]),r=e(n,r))}return r}}});let n=r(57630),u=r(65360),o=r(7460),l=e=>"string"==typeof e?"children"===e?"":e:e[1];function a(e){return e.reduce((e,t)=>{let r;return""===(t="/"===(r=t)[0]?r.slice(1):r)||(0,u.isGroupSegment)(t)?e:e+"/"+t},"")||"/"}function i(e){var t;let r=Array.isArray(e[0])?e[0][1]:e[0];if(r===u.DEFAULT_SEGMENT_KEY||n.INTERCEPTION_ROUTE_MARKERS.some(e=>r.startsWith(e)))return;if(r.startsWith(u.PAGE_SEGMENT_KEY))return"";let o=[l(r)],c=null!=(t=e[1])?t:{},s=c.children?i(c.children):void 0;if(void 0!==s)o.push(s);else for(let[e,t]of Object.entries(c)){if("children"===e)continue;let r=i(t);void 0!==r&&o.push(r)}return a(o)}function c(e,t){let r=function e(t,r){let[u,a]=t,[c,s]=r,f=l(u),d=l(c);if(n.INTERCEPTION_ROUTE_MARKERS.some(e=>f.startsWith(e)||d.startsWith(e)))return"";if(!(0,o.matchSegment)(u,c)){var p;return null!=(p=i(r))?p:""}for(let t in a)if(s[t]){let r=e(a[t],s[t]);if(null!==r)return l(c)+"/"+r}return null}(e,t);return null==r||"/"===r?r:a(r.split("/"))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},86437:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{REDIRECT_ERROR_CODE:function(){return u},RedirectType:function(){return o},isRedirectError:function(){return l}});let n=r(81099),u="NEXT_REDIRECT";var o=function(e){return e.push="push",e.replace="replace",e}({});function l(e){if("object"!=typeof e||null===e||!("digest"in e)||"string"!=typeof e.digest)return!1;let t=e.digest.split(";"),[r,o]=t,l=t.slice(2,-2).join(";"),a=Number(t.at(-2));return r===u&&("replace"===o||"push"===o)&&"string"==typeof l&&!isNaN(a)&&a in n.RedirectStatusCode}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},86542:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{getRedirectError:function(){return l},getRedirectStatusCodeFromError:function(){return f},getRedirectTypeFromError:function(){return s},getURLFromRedirectError:function(){return c},permanentRedirect:function(){return i},redirect:function(){return a}});let n=r(81099),u=r(86437),o=void 0;function l(e,t,r){void 0===r&&(r=n.RedirectStatusCode.TemporaryRedirect);let o=Object.defineProperty(Error(u.REDIRECT_ERROR_CODE),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return o.digest=u.REDIRECT_ERROR_CODE+";"+t+";"+e+";"+r+";",o}function a(e,t){var r;throw null!=t||(t=(null==o||null==(r=o.getStore())?void 0:r.isAction)?u.RedirectType.push:u.RedirectType.replace),l(e,t,n.RedirectStatusCode.TemporaryRedirect)}function i(e,t){throw void 0===t&&(t=u.RedirectType.replace),l(e,t,n.RedirectStatusCode.PermanentRedirect)}function c(e){return(0,u.isRedirectError)(e)?e.digest.split(";").slice(2,-2).join(";"):null}function s(e){if(!(0,u.isRedirectError)(e))throw Object.defineProperty(Error("Not a redirect error"),"__NEXT_ERROR_CODE",{value:"E260",enumerable:!1,configurable:!0});return e.digest.split(";",2)[1]}function f(e){if(!(0,u.isRedirectError)(e))throw Object.defineProperty(Error("Not a redirect error"),"__NEXT_ERROR_CODE",{value:"E260",enumerable:!1,configurable:!0});return Number(e.digest.split(";").at(-2))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},86871:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{ACTION_HMR_REFRESH:function(){return a},ACTION_NAVIGATE:function(){return n},ACTION_PREFETCH:function(){return l},ACTION_REFRESH:function(){return r},ACTION_RESTORE:function(){return u},ACTION_SERVER_ACTION:function(){return i},ACTION_SERVER_PATCH:function(){return o},PrefetchCacheEntryStatus:function(){return s},PrefetchKind:function(){return c}});let r="refresh",n="navigate",u="restore",o="server-patch",l="prefetch",a="hmr-refresh",i="server-action";var c=function(e){return e.AUTO="auto",e.FULL="full",e.TEMPORARY="temporary",e}({}),s=function(e){return e.fresh="fresh",e.reusable="reusable",e.expired="expired",e.stale="stale",e}({});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},86897:(e,t)=>{"use strict";var r=Symbol.for("react.transitional.element");function n(e,t,n){var u=null;if(void 0!==n&&(u=""+n),void 0!==t.key&&(u=""+t.key),"key"in t)for(var o in n={},t)"key"!==o&&(n[o]=t[o]);else n=t;return{$$typeof:r,type:e,key:u,ref:void 0!==(t=n.ref)?t:null,props:n}}t.Fragment=Symbol.for("react.fragment"),t.jsx=n,t.jsxs=n},87317:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{abortTask:function(){return h},listenForDynamicRequest:function(){return p},startPPRNavigation:function(){return c},updateCacheNodeOnPopstateRestoration:function(){return function e(t,r){let n=r[1],u=t.parallelRoutes,l=new Map(u);for(let t in n){let r=n[t],a=r[0],i=(0,o.createRouterCacheKey)(a),c=u.get(t);if(void 0!==c){let n=c.get(i);if(void 0!==n){let u=e(n,r),o=new Map(c);o.set(i,u),l.set(t,o)}}}let a=t.rsc,i=b(a)&&"pending"===a.status;return{lazyData:null,rsc:a,head:t.head,prefetchHead:i?t.prefetchHead:[null,null],prefetchRsc:i?t.prefetchRsc:null,loading:t.loading,parallelRoutes:l,navigatedAt:t.navigatedAt}}}});let n=r(65360),u=r(7460),o=r(69190),l=r(44707),a=r(83571),i={route:null,node:null,dynamicRequestTree:null,children:null};function c(e,t,r,l,a,c,d,p,h){return function e(t,r,l,a,c,d,p,h,_,y,b){let v=l[1],g=a[1],m=null!==d?d[2]:null;c||!0===a[4]&&(c=!0);let R=r.parallelRoutes,E=new Map(R),O={},P=null,j=!1,T={};for(let r in g){let l,a=g[r],f=v[r],d=R.get(r),S=null!==m?m[r]:null,M=a[0],w=y.concat([r,M]),A=(0,o.createRouterCacheKey)(M),x=void 0!==f?f[0]:void 0,C=void 0!==d?d.get(A):void 0;if(null!==(l=M===n.DEFAULT_SEGMENT_KEY?void 0!==f?{route:f,node:null,dynamicRequestTree:null,children:null}:s(t,f,a,C,c,void 0!==S?S:null,p,h,w,b):_&&0===Object.keys(a[1]).length?s(t,f,a,C,c,void 0!==S?S:null,p,h,w,b):void 0!==f&&void 0!==x&&(0,u.matchSegment)(M,x)&&void 0!==C&&void 0!==f?e(t,C,f,a,c,S,p,h,_,w,b):s(t,f,a,C,c,void 0!==S?S:null,p,h,w,b))){if(null===l.route)return i;null===P&&(P=new Map),P.set(r,l);let e=l.node;if(null!==e){let t=new Map(d);t.set(A,e),E.set(r,t)}let t=l.route;O[r]=t;let n=l.dynamicRequestTree;null!==n?(j=!0,T[r]=n):T[r]=t}else O[r]=a,T[r]=a}if(null===P)return null;let S={lazyData:null,rsc:r.rsc,prefetchRsc:r.prefetchRsc,head:r.head,prefetchHead:r.prefetchHead,loading:r.loading,parallelRoutes:E,navigatedAt:t};return{route:f(a,O),node:S,dynamicRequestTree:j?f(a,T):null,children:P}}(e,t,r,l,!1,a,c,d,p,[],h)}function s(e,t,r,n,u,c,s,p,h,_){return!u&&(void 0===t||(0,l.isNavigatingToNewRootLayout)(t,r))?i:function e(t,r,n,u,l,i,c,s){let p,h,_,y,b=r[1],v=0===Object.keys(b).length;if(void 0!==n&&n.navigatedAt+a.DYNAMIC_STALETIME_MS>t)p=n.rsc,h=n.loading,_=n.head,y=n.navigatedAt;else if(null===u)return d(t,r,null,l,i,c,s);else if(p=u[1],h=u[3],_=v?l:null,y=t,u[4]||i&&v)return d(t,r,u,l,i,c,s);let g=null!==u?u[2]:null,m=new Map,R=void 0!==n?n.parallelRoutes:null,E=new Map(R),O={},P=!1;if(v)s.push(c);else for(let r in b){let n=b[r],u=null!==g?g[r]:null,a=null!==R?R.get(r):void 0,f=n[0],d=c.concat([r,f]),p=(0,o.createRouterCacheKey)(f),h=e(t,n,void 0!==a?a.get(p):void 0,u,l,i,d,s);m.set(r,h);let _=h.dynamicRequestTree;null!==_?(P=!0,O[r]=_):O[r]=n;let y=h.node;if(null!==y){let e=new Map;e.set(p,y),E.set(r,e)}}return{route:r,node:{lazyData:null,rsc:p,prefetchRsc:null,head:_,prefetchHead:null,loading:h,parallelRoutes:E,navigatedAt:y},dynamicRequestTree:P?f(r,O):null,children:m}}(e,r,n,c,s,p,h,_)}function f(e,t){let r=[e[0],t];return 2 in e&&(r[2]=e[2]),3 in e&&(r[3]=e[3]),4 in e&&(r[4]=e[4]),r}function d(e,t,r,n,u,l,a){let i=f(t,t[1]);return i[3]="refetch",{route:t,node:function e(t,r,n,u,l,a,i){let c=r[1],s=null!==n?n[2]:null,f=new Map;for(let r in c){let n=c[r],d=null!==s?s[r]:null,p=n[0],h=a.concat([r,p]),_=(0,o.createRouterCacheKey)(p),y=e(t,n,void 0===d?null:d,u,l,h,i),b=new Map;b.set(_,y),f.set(r,b)}let d=0===f.size;d&&i.push(a);let p=null!==n?n[1]:null,h=null!==n?n[3]:null;return{lazyData:null,parallelRoutes:f,prefetchRsc:void 0!==p?p:null,prefetchHead:d?u:[null,null],loading:void 0!==h?h:null,rsc:v(),head:d?v():null,navigatedAt:t}}(e,t,r,n,u,l,a),dynamicRequestTree:i,children:null}}function p(e,t){t.then(t=>{let{flightData:r}=t;if("string"!=typeof r){for(let t of r){let{segmentPath:r,tree:n,seedData:l,head:a}=t;l&&function(e,t,r,n,l){let a=e;for(let e=0;e{h(e,t)})}function h(e,t){let r=e.node;if(null===r)return;let n=e.children;if(null===n)_(e.route,r,t);else for(let e of n.values())h(e,t);e.dynamicRequestTree=null}function _(e,t,r){let n=e[1],u=t.parallelRoutes;for(let e in n){let t=n[e],l=u.get(e);if(void 0===l)continue;let a=t[0],i=(0,o.createRouterCacheKey)(a),c=l.get(i);void 0!==c&&_(t,c,r)}let l=t.rsc;b(l)&&(null===r?l.resolve(null):l.reject(r));let a=t.head;b(a)&&a.resolve(null)}let y=Symbol();function b(e){return e&&e.tag===y}function v(){let e,t,r=new Promise((r,n)=>{e=r,t=n});return r.status="pending",r.resolve=t=>{"pending"===r.status&&(r.status="fulfilled",r.value=t,e(t))},r.reject=e=>{"pending"===r.status&&(r.status="rejected",r.reason=e,t(e))},r.tag=y,r}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},88785:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{ErrorBoundary:function(){return f},ErrorBoundaryHandler:function(){return s}});let n=r(28140),u=r(95155),o=n._(r(12115)),l=r(51486),a=r(5829);r(61489);let i=r(15860),c=(0,r(93913).isBot)(window.navigator.userAgent);class s extends o.default.Component{static getDerivedStateFromError(e){if((0,a.isNextRouterError)(e))throw e;return{error:e}}static getDerivedStateFromProps(e,t){let{error:r}=t;return e.pathname!==t.previousPathname&&t.error?{error:null,previousPathname:e.pathname}:{error:t.error,previousPathname:e.pathname}}render(){return this.state.error&&!c?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(i.HandleISRError,{error:this.state.error}),this.props.errorStyles,this.props.errorScripts,(0,u.jsx)(this.props.errorComponent,{error:this.state.error,reset:this.reset})]}):this.props.children}constructor(e){super(e),this.reset=()=>{this.setState({error:null})},this.state={error:null,previousPathname:this.props.pathname}}}function f(e){let{errorComponent:t,errorStyles:r,errorScripts:n,children:o}=e,a=(0,l.useUntrackedPathname)();return t?(0,u.jsx)(s,{pathname:a,errorComponent:t,errorStyles:r,errorScripts:n,children:o}):(0,u.jsx)(u.Fragment,{children:o})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},90535:()=>{"trimStart"in String.prototype||(String.prototype.trimStart=String.prototype.trimLeft),"trimEnd"in String.prototype||(String.prototype.trimEnd=String.prototype.trimRight),"description"in Symbol.prototype||Object.defineProperty(Symbol.prototype,"description",{configurable:!0,get:function(){var e=/\((.*)\)/.exec(this.toString());return e?e[1]:void 0}}),Array.prototype.flat||(Array.prototype.flat=function(e,t){return t=this.concat.apply([],this),e>1&&t.some(Array.isArray)?t.flat(e-1):t},Array.prototype.flatMap=function(e,t){return this.map(e,t).flat()}),Promise.prototype.finally||(Promise.prototype.finally=function(e){if("function"!=typeof e)return this.then(e,e);var t=this.constructor||Promise;return this.then(function(r){return t.resolve(e()).then(function(){return r})},function(r){return t.resolve(e()).then(function(){throw r})})}),Object.fromEntries||(Object.fromEntries=function(e){return Array.from(e).reduce(function(e,t){return e[t[0]]=t[1],e},{})}),Array.prototype.at||(Array.prototype.at=function(e){var t=Math.trunc(e)||0;if(t<0&&(t+=this.length),!(t<0||t>=this.length))return this[t]}),Object.hasOwn||(Object.hasOwn=function(e,t){if(null==e)throw TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(e),t)}),"canParse"in URL||(URL.canParse=function(e,t){try{return new URL(e,t),!0}catch(e){return!1}})},92929:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"hasBasePath",{enumerable:!0,get:function(){return u}});let n=r(2018);function u(e){return(0,n.pathHasPrefix)(e,"")}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},93223:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{doesStaticSegmentAppearInURL:function(){return c},getCacheKeyForDynamicParam:function(){return s},getParamValueFromCacheKey:function(){return d},getRenderedPathname:function(){return a},getRenderedSearch:function(){return l},parseDynamicParamFromURLPart:function(){return i},urlToUrlWithoutFlightMarker:function(){return f}});let n=r(65360),u=r(64425),o=r(52486);function l(e){let t=e.headers.get(o.NEXT_REWRITTEN_QUERY_HEADER);return null!==t?""===t?"":"?"+t:f(new URL(e.url)).search}function a(e){let t=e.headers.get(o.NEXT_REWRITTEN_PATH_HEADER);return null!=t?t:f(new URL(e.url)).pathname}function i(e,t,r){switch(e){case"c":case"ci":return rencodeURIComponent(e)):[];case"oc":return rencodeURIComponent(e)):null;case"d":case"di":if(r>=t.length)return"";return encodeURIComponent(t[r]);default:return""}}function c(e){return!(e===u.ROOT_SEGMENT_REQUEST_KEY||e.startsWith(n.PAGE_SEGMENT_KEY)||"("===e[0]&&e.endsWith(")"))&&e!==n.DEFAULT_SEGMENT_KEY&&"/_not-found"!==e}function s(e,t){return"string"==typeof e?(0,n.addSearchParamsIfPageSegment)(e,Object.fromEntries(new URLSearchParams(t))):null===e?"":e.join("/")}function f(e){let t=new URL(e);if(t.searchParams.delete(o.NEXT_RSC_UNION_QUERY),t.pathname.endsWith(".txt")){let{pathname:e}=t,r=e.endsWith("/index.txt")?10:4;t.pathname=e.slice(0,-r)}return t}function d(e,t){return"c"===t||"oc"===t?e.split("/"):e}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},93913:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{HTML_LIMITED_BOT_UA_RE:function(){return n.HTML_LIMITED_BOT_UA_RE},HTML_LIMITED_BOT_UA_RE_STRING:function(){return o},getBotType:function(){return i},isBot:function(){return a}});let n=r(14029),u=/Googlebot(?!-)|Googlebot$/i,o=n.HTML_LIMITED_BOT_UA_RE.source;function l(e){return n.HTML_LIMITED_BOT_UA_RE.test(e)}function a(e){return u.test(e)||l(e)}function i(e){return u.test(e)?"dom":l(e)?"html":void 0}},94201:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"invalidateCacheByRouterState",{enumerable:!0,get:function(){return u}});let n=r(69190);function u(e,t,r){for(let u in r[1]){let o=r[1][u][0],l=(0,n.createRouterCacheKey)(o),a=t.parallelRoutes.get(u);if(a){let t=new Map(a);t.delete(l),e.parallelRoutes.set(u,t)}}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},94681:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"setAttributesFromProps",{enumerable:!0,get:function(){return o}});let r={acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv",noModule:"noModule"},n=["onLoad","onReady","dangerouslySetInnerHTML","children","onError","strategy","stylesheets"];function u(e){return["async","defer","noModule"].includes(e)}function o(e,t){for(let[o,l]of Object.entries(t)){if(!t.hasOwnProperty(o)||n.includes(o)||void 0===l)continue;let a=r[o]||o.toLowerCase();"SCRIPT"===e.tagName&&u(a)?e[a]=!!l:e.setAttribute(a,String(l)),(!1===l||"SCRIPT"===e.tagName&&u(a)&&(!l||"false"===l))&&(e.setAttribute(a,""),e.removeAttribute(a))}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},94781:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"warnOnce",{enumerable:!0,get:function(){return r}});let r=e=>{}},95155:(e,t,r)=>{"use strict";e.exports=r(86897)},95704:(e,t,r)=>{"use strict";var n,u;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(u=r.g.process)?void 0:u.env)?r.g.process:r(53965)},96058:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"addBasePath",{enumerable:!0,get:function(){return o}});let n=r(73879),u=r(71239);function o(e,t){return(0,u.normalizePathTrailingSlash)((0,n.addPathPrefix)(e,""))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},97332:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"handleSegmentMismatch",{enumerable:!0,get:function(){return u}});let n=r(35737);function u(e,t,r){return(0,n.handleExternalUrl)(e,{},e.canonicalUrl,!0)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},98301:(e,t)=>{"use strict";function r(){return""}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getDeploymentIdQueryOrEmptyString",{enumerable:!0,get:function(){return r}})},98924:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a}});let n=r(49417),u=r(95155),o=n._(r(12115)),l=r(46752);function a(){let e=(0,o.useContext)(l.TemplateContext);return(0,u.jsx)(u.Fragment,{children:e})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},99062:(e,t,r)=>{"use strict";var n=r(47650),u={stream:!0},o=new Map;function l(e){var t=r(e);return"function"!=typeof t.then||"fulfilled"===t.status?null:(t.then(function(e){t.status="fulfilled",t.value=e},function(e){t.status="rejected",t.reason=e}),t)}function a(){}function i(e){for(var t=e[1],n=[],u=0;uf||35===f||114===f||120===f?(p=f,f=3,s++):(p=0,f=3);continue;case 2:44===(b=c[s++])?f=4:h=h<<4|(96c.length&&(b=-1)}var v=c.byteOffset+s;if(-1{n.r(t),n.d(t,{EvolutionViewport:()=>N});var a=n(95155);n(69955),n(10054);var s=n(89473),r=n(56109),i=n(54261),l=n(10355),o=n(18533),c=n(54731),u=n(73416),d=n(87352),m=n(36481),p=n(38376),g=n(12412),h=n(30536),x=n(19047),f=n(12115),y=n(67161),w=n(6547);let v={newInstance:n(17042).Ay.newInstance(function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,n),w.Ay.extend(e,t,n),t.classHierarchy.push("vtkFollowPointerStyle"),e.handleMouseRotate=(e,n)=>{let a=t.previousPosition;if(a){var s,r,i;s=e.getActiveCamera(),r=n.x-a.x,i=n.y-a.y,Number.isFinite(r)&&Number.isFinite(i)&&(s.azimuth(-(.18*r)),s.elevation(function(e,t){let n=e.getViewPlaneNormal(),a=e.getViewUp(),s=180*Math.acos(Math.max(-1,Math.min(1,-(n[0]*a[0]+n[1]*a[1]+n[2]*a[2]))))/Math.PI;return Math.max(12-s,Math.min(168-s,t))}(s,-(.18*i))),s.orthogonalizeViewUp()),!1!==t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange(),t._interactor.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()}}},"vtkFollowPointerStyle")};var b=n(35623);function C(e){return null===e.relativeChange||e.correspondenceDoubtful?[.62,.64,.68]:e.relativeChange>.25?[.86,.31,.31]:e.relativeChange<-.25?[.32,.62,.86]:[.55,.72,.55]}let I=[[0,0],[1,0],[40,.02],[110,.06],[180,.14],[255,.22]],j=[[0,.05,.05,.06],[60,.35,.31,.29],[130,.62,.57,.53],[200,.85,.81,.77],[255,.97,.95,.92]];function N(e){let{current:t,prior:n,selectedLesionId:w,onSelectLesion:N,showPrior:R,brainSegmentationId:S}=e,[k,L]=(0,f.useState)(!0),O=(0,f.useRef)(null),M=(0,f.useRef)(null),[z,F]=(0,f.useState)({state:"idle"}),T=(0,f.useRef)(null),D=(0,f.useRef)(!1),[V,E]=(0,f.useState)(0),G=(0,f.useRef)(0),[U,_]=(0,f.useState)(0);(0,f.useEffect)(()=>{let e=O.current;if(!e)return;let t=m.Ay.newInstance({background:[.043,.055,.071]});t.setContainer(e),t.resize(),t.getInteractor().setInteractorStyle(v.newInstance()),(n=t.getRenderer().getActiveCamera()).setFocalPoint(0,0,0),n.setPosition(0,-1,0),n.setViewUp(0,0,1);var n,a=t.getRenderer();a.setTwoSidedLighting(!0),a.setAutomaticLightCreation(!1);let s=p.Ay.newInstance();s.setLightTypeToCameraLight(),s.setPosition(.35,.45,1),s.setFocalPoint(0,0,0),s.setIntensity(.85),a.addLight(s);let r=p.Ay.newInstance();r.setLightTypeToCameraLight(),r.setPosition(-.7,-.35,.4),r.setFocalPoint(0,0,0),r.setIntensity(.45),a.addLight(r),M.current={window:t,actors:new Map,volume:null};let i=()=>t.resize();return globalThis.addEventListener("resize",i),()=>{var e,n;for(let{actor:t,mapper:a,polyData:s}of(globalThis.removeEventListener("resize",i),M.current&&A(M.current),null!=(n=null==(e=M.current)?void 0:e.actors.values())?n:[]))t.delete(),a.delete(),s.delete();M.current=null,t.delete(),T.current=null,D.current=!1}},[]),(0,f.useEffect)(()=>{let e=M.current;if(!e)return;let a=!1;return async function(){let m,p=null;if(k&&S)try{p=await (0,y.V$)(S)}catch(e){p=null}if(a)return;let f=[...t.map(e=>({surface:e,isPrior:!1})),...R?n.map(e=>({surface:e,isPrior:!0})):[]];if(0===f.length){P(e),A(e),e.window.getRenderWindow().render(),_(0),F({state:"idle"});return}F({state:"loading"});try{m=await Promise.all(f.map(async e=>{let{surface:t,isPrior:n}=e;return{key:"".concat(n?"prior":"current",":").concat(t.observationId),mesh:await (0,y.s4)(t.observationId),surface:t,isPrior:n}}))}catch(e){if(a)return;F({state:"error",message:e instanceof Error?e.message:"Could not load surfaces"});return}if(a)return;if(new Set(m.map(e=>{let{mesh:t}=e;return t.spacing.join(",")})).size>1){F({state:"error",message:"These timepoints are not in a common space, so their surfaces cannot be overlaid. Registration is required."}),P(e),e.window.getRenderWindow().render();return}P(e);let v=e.window.getRenderer();if(A(e),p){let t=function(e){let t=i.Ay.newInstance();return t.setDimensions(e.dimensions),t.setSpacing(e.spacing),t.setOrigin([0,0,0]),t.getPointData().setScalars(d.Ay.newInstance({name:"intensity",numberOfComponents:1,values:e.voxels})),t}(p),n=c.Ay.newInstance();n.setInputData(t),n.setSampleDistance(1);let a=o.Ay.newInstance();a.setMapper(n);let s=r.Ay.newInstance();for(let[e,t,n,a]of j)s.addRGBPoint(e,t,n,a);let u=l.Ay.newInstance();for(let[e,t]of I)u.addPoint(e,t);let m=a.getProperty();m.setRGBTransferFunction(0,s),m.setScalarOpacity(0,u),m.setScalarOpacityUnitDistance(0,2.5),m.setInterpolationTypeToLinear(),m.setShade(!0),m.setAmbient(.3),m.setDiffuse(.75),m.setSpecular(.2),m.setSpecularPower(12),m.setUseGradientOpacity(0,!0),m.setGradientOpacityMinimumValue(0,2),m.setGradientOpacityMinimumOpacity(0,0),m.setGradientOpacityMaximumValue(0,20),m.setGradientOpacityMaximumOpacity(0,1),v.addVolume(a),e.volume={volume:a,mapper:n,imageData:t}}for(let{key:t,mesh:n,surface:a,isPrior:r}of m){let i=function(e){let t=x.Ay.newInstance(),n=h.Ay.newInstance();n.setData(e.points,3),t.setPoints(n),e.normals&&t.getPointData().setNormals(d.Ay.newInstance({name:"Normals",numberOfComponents:3,values:e.normals}));let a=new Uint32Array(4*e.triangleCount);for(let t=0;t{let{mesh:t}=e;return t.bounds})),L=V>0&&V!==G.current,O=p?function(e){let[t,n,a]=e.dimensions,[s,r,i]=e.spacing;return[0,0,0,(t-1)*s,(n-1)*r,(a-1)*i]}(p):null,M=O&&!L?(0,b.z)([O,...m.map(e=>{let{mesh:t}=e;return t.bounds})]):N;if(M){var z,E,U;let e=T.current;if(null===e||L||(z=e,!((E=M)[0]>=z[0])||!(E[1]>=z[1])||!(E[2]>=z[2])||!(E[3]<=z[3])||!(E[4]<=z[4])||!(E[5]<=z[5]))){let t=null===e||L?M:(0,b.z)([e,M]);T.current=t,G.current=V;let n=[(U=t)[0],U[3],U[1],U[4],U[2],U[5]];v.resetCamera(n),D.current||(v.getActiveCamera().elevation(-20),v.resetCamera(n),D.current=!0),v.resetCameraClippingRange()}}e.window.getRenderWindow().render(),_(p?p.voxels.length:0),F({state:"ready",triangles:m.reduce((e,t)=>{let{mesh:n}=t;return e+n.triangleCount},0)})}(),()=>{a=!0}},[t,n,R,w,V,k,S]);let W=t.reduce((e,t)=>e+t.volumeCm3,0);return(0,a.jsxs)("div",{className:"relative min-h-0 flex-1",children:[(0,a.jsx)("div",{ref:O,className:"absolute inset-0","data-testid":"evolution-canvas","data-surface-count":t.length,"data-triangle-count":"ready"===z.state?z.triangles:0,"data-brain-voxels":U}),(0,a.jsxs)("dl",{className:"pointer-events-none absolute left-2 top-2 space-y-1 text-[9px]",children:[[["#dc4f4f","growing (>25%)"],["#8cb88c","stable"],["#529edc","shrinking (>25%)"],["#9ea3ad","baseline or uncertain match"]].map(e=>{let[t,n]=e;return(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"size-2 rounded-sm",style:{backgroundColor:t},"aria-hidden":!0}),(0,a.jsx)("dt",{className:"text-clinical-dim",children:n})]},n)}),R&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 pt-0.5",children:[(0,a.jsx)("span",{className:"size-2 rounded-sm border border-clinical-500","aria-hidden":!0}),(0,a.jsx)("dt",{className:"text-clinical-dim",children:"outline: prior timepoint"})]})]}),S&&(0,a.jsx)("button",{type:"button",onClick:()=>L(e=>!e),title:"Show the brain surface, so the lesion can be located within the head",className:"absolute left-2 top-28 rounded px-2 py-0.5 text-[9px] uppercase tracking-wider transition-colors ".concat(k?"bg-signal-info/20 text-signal-info":"text-clinical-dim hover:text-clinical-muted"),children:"brain outline"}),t.length>0&&(0,a.jsx)("ul",{className:"absolute right-2 top-2 max-h-[70%] w-40 space-y-0.5 overflow-y-auto",children:t.map(e=>{let t=e.lesionId===w;return(0,a.jsx)("li",{children:(0,a.jsxs)("button",{type:"button",onClick:()=>N(t?null:e.lesionId),className:"flex w-full items-center justify-between gap-1 rounded px-1.5 py-0.5 text-left text-[10px] transition-colors ".concat(t?"bg-clinical-700 text-clinical-text":"text-clinical-muted hover:bg-clinical-800"),children:[(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"size-2 shrink-0 rounded-sm",style:{backgroundColor:"rgb(".concat(C(e).map(e=>Math.round(255*e)).join(","),")")},"aria-hidden":!0}),e.lesionLabel]}),(0,a.jsx)("span",{className:"measurement text-clinical-dim",children:e.volumeCm3.toFixed(2)})]})},e.observationId)})}),(0,a.jsxs)("p",{className:"measurement pointer-events-none absolute bottom-2 left-2 text-[9px] text-clinical-dim",children:[t.length," surface",1===t.length?"":"s"," \xb7"," ",W.toFixed(2)," cm\xb3 total","ready"===z.state&&" \xb7 ".concat(z.triangles.toLocaleString()," triangles")]}),"ready"!==z.state&&(0,a.jsxs)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-clinical-900/80",children:["loading"===z.state&&(0,a.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-clinical-dim",children:"loading surfaces"}),"error"===z.state&&(0,a.jsx)("p",{className:"max-w-[70%] text-center text-[10px] leading-relaxed text-signal-concern",children:z.message}),"idle"===z.state&&(0,a.jsxs)("p",{className:"max-w-[70%] text-center text-[11px] leading-relaxed text-clinical-dim",children:["No measurable surface at this timepoint.",(0,a.jsx)("br",{}),(0,a.jsx)("span",{className:"text-[10px]",children:"Lesions below a few voxels have no closed surface."})]})]}),(0,a.jsxs)("div",{className:"pointer-events-none absolute bottom-2 right-2 flex items-center gap-2",children:[(0,a.jsx)("button",{type:"button",onClick:()=>{T.current=null,E(e=>e+1)},className:"pointer-events-auto rounded px-2 py-0.5 text-[9px] uppercase tracking-wider text-clinical-dim transition-colors hover:bg-clinical-800 hover:text-clinical-muted",title:"Frame the camera on the surfaces currently shown",children:"fit view"}),(0,a.jsx)("span",{className:"text-[9px] text-clinical-dim",children:"drag: rotate \xb7 wheel: zoom \xb7 shift-drag: pan"})]})]})}function A(e){if(!e.volume)return;let{volume:t,mapper:n,imageData:a}=e.volume;e.window.getRenderer().removeVolume(t),t.delete(),n.delete(),a.delete(),e.volume=null}function P(e){let t=e.window.getRenderer();for(let{actor:n,mapper:a,polyData:s}of e.actors.values())t.removeActor(n),n.delete(),a.delete(),s.delete();e.actors.clear()}}}]); \ No newline at end of file diff --git a/_next/static/chunks/467ef8ee-6369ff81ae928fb4.js b/_next/static/chunks/467ef8ee-6369ff81ae928fb4.js new file mode 100644 index 0000000000000000000000000000000000000000..7d642652d40c964cf7591850263af9589d390ded --- /dev/null +++ b/_next/static/chunks/467ef8ee-6369ff81ae928fb4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[977],{66122:(A,e,n)=>{let t,i,r,a,o;n.d(e,{AA:()=>nq,Ay:()=>oU,Rm:()=>v});var s,c,u,l,E,S,g,I,d,B,m,C,D,f,h,p,M,w=n(15376).Buffer,R="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function Q(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var P={exports:{}},T=P.exports,y=function(){var A;return s?P.exports:(s=1,A=function(){var A=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),t=["trace","debug","info","warn","error"],i={},r=null;function a(A,e){var n=A[e];if("function"==typeof n.bind)return n.bind(A);try{return Function.prototype.bind.call(n,A)}catch(e){return function(){return Function.prototype.apply.apply(n,[A,arguments])}}}function o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function s(){for(var n=this.getLevel(),i=0;i=0&&e<=l.levels.SILENT)return e;throw TypeError("log.setLevel() called with invalid level: "+A)}"string"==typeof A?E+=":"+A:"symbol"==typeof A&&(E=void 0),l.name=A,l.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},l.methodFactory=n||u,l.getLevel=function(){return null!=c?c:null!=o?o:a},l.setLevel=function(A,n){return c=g(A),!1!==n&&function(A){var n=(t[A]||"silent").toUpperCase();if(typeof window!==e&&E){try{window.localStorage[E]=n;return}catch(A){}try{window.document.cookie=encodeURIComponent(E)+"="+n+";"}catch(A){}}}(c),s.call(l)},l.setDefaultLevel=function(A){o=g(A),S()||l.setLevel(A,!1)},l.resetLevel=function(){if(c=null,typeof window!==e&&E){try{window.localStorage.removeItem(E)}catch(A){}try{window.document.cookie=encodeURIComponent(E)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(A){}}s.call(l)},l.enableAll=function(A){l.setLevel(l.levels.TRACE,A)},l.disableAll=function(A){l.setLevel(l.levels.SILENT,A)},l.rebuild=function(){if(r!==l&&(a=g(r.getLevel())),s.call(l),r===l)for(var A in i)i[A].rebuild()},a=g(r?r.getLevel():"WARN");var I=S();null!=I&&(c=g(I)),s.call(l)}(r=new l).getLogger=function(A){if("symbol"!=typeof A&&"string"!=typeof A||""===A)throw TypeError("You must supply a name when creating a logger.");var e=i[A];return e||(e=i[A]=new l(A,r.methodFactory)),e};var E=typeof window!==e?window.log:void 0;return r.noConflict=function(){return typeof window!==e&&window.log===r&&(window.log=E),r},r.getLoggers=function(){return i},r.default=r,r},P.exports?P.exports=A():T.log=A(),P.exports)}(),v=Q(y);v.setLevel("warn");var O=v.getLogger("validation.dcmjs"),N={getBytesForBinaryFrame:G,pack:function(A){var e=A.length;v.debug("numPixels: "+e);for(var n=new Uint8Array(G(e)),t=0,i=0;i>i)}return n}};function G(A){var e=Math.floor(A/8);return A%8>0&&e++,e}function F(A){function e(A){if(Object(A)!==A)return Promise.reject(TypeError(A+" is not an object."));var e=A.done;return Promise.resolve(A.value).then(function(A){return{value:A,done:e}})}return(F=function(A){this.s=A,this.n=A.next}).prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(A){var n=this.s.return;return void 0===n?Promise.resolve({value:A,done:!0}):e(n.apply(this.s,arguments))},throw:function(A){var n=this.s.return;return void 0===n?Promise.reject(A):e(n.apply(this.s,arguments))}},new F(A)}function U(A,e,n){return e=z(e),function(A,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");if(void 0===A)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return A}(A,b()?Reflect.construct(e,n||[],z(A).constructor):e.apply(A,n))}function _(A,e,n){if(b())return Reflect.construct.apply(null,arguments);var t=[null];t.push.apply(t,e);var i=new(A.bind.apply(A,t));return n&&Z(i,n.prototype),i}function b(){try{var A=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(A){}return(b=function(){return!!A})()}function k(A,e){var n=Object.keys(A);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(A);e&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(A,e).enumerable})),n.push.apply(n,t)}return n}function L(A){for(var e=1;e=0;--r){var a=this.tryEntries[r],o=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=t.call(a,"catchLoc"),c=t.call(a,"finallyLoc");if(s&&c){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&t.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===A)return this.complete(n.completion,n.afterLoc),R(n),I}},catch:function(A){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===A){var t=n.completion;if("throw"===t.type){var i=t.arg;R(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,t){return this.delegate={iterator:P(e),resultName:n,nextLoc:t},"next"===this.method&&(this.arg=A),I}},e}function V(A){var e=function(A,e){if("object"!=typeof A||!A)return A;var n=A[Symbol.toPrimitive];if(void 0!==n){var t=n.call(A,e);if("object"!=typeof t)return t;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(A)}(A,"string");return"symbol"==typeof e?e:String(e)}function x(A){return(x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(A){return typeof A}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A})(A)}function H(A,e,n,t,i,r,a){try{var o=A[r](a),s=o.value}catch(A){n(A);return}o.done?e(s):Promise.resolve(s).then(t,i)}function Y(A){return function(){var e=this,n=arguments;return new Promise(function(t,i){var r=A.apply(e,n);function a(A){H(r,t,i,a,o,"next",A)}function o(A){H(r,t,i,a,o,"throw",A)}a(void 0)})}}function J(A,e){if(!(A instanceof e))throw TypeError("Cannot call a class as a function")}function W(A,e){for(var n=0;nA.length)&&(e=A.length);for(var n=0,t=Array(e);n=A.length?{done:!0}:{done:!1,value:A[t++]}},e:function(A){throw A},f:i}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,o=!1;return{s:function(){n=n.call(A)},n:function(){var A=n.next();return a=A.done,A},e:function(A){o=!0,r=A},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw r}}}}function Aa(A){let e=A.length;for(;--e>=0;)A[e]=0}let Ao=573,As=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Ac=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Au=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Al=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),AE=Array(576);Aa(AE);let AS=Array(60);Aa(AS);let Ag=Array(512);Aa(Ag);let AI=Array(256);Aa(AI);let Ad=Array(29);Aa(Ad);let AB=Array(30);function Am(A,e,n,t,i){this.static_tree=A,this.extra_bits=e,this.extra_base=n,this.elems=t,this.max_length=i,this.has_stree=A&&A.length}function AC(A,e){this.dyn_tree=A,this.max_code=0,this.stat_desc=e}Aa(AB);let AD=A=>A<256?Ag[A]:Ag[256+(A>>>7)],Af=(A,e)=>{A.pending_buf[A.pending++]=255&e,A.pending_buf[A.pending++]=e>>>8&255},Ah=(A,e,n)=>{A.bi_valid>16-n?(A.bi_buf|=e<>16-A.bi_valid,A.bi_valid+=n-16):(A.bi_buf|=e<{Ah(A,n[2*e],n[2*e+1])},AM=(A,e)=>{let n=0;do n|=1&A,A>>>=1,n<<=1;while(--e>0);return n>>>1},Aw=(A,e,n)=>{let t,i,r=Array(16),a=0;for(t=1;t<=15;t++)a=a+n[t-1]<<1,r[t]=a;for(i=0;i<=e;i++){let e=A[2*i+1];0!==e&&(A[2*i]=AM(r[e]++,e))}},AR=A=>{let e;for(e=0;e<286;e++)A.dyn_ltree[2*e]=0;for(e=0;e<30;e++)A.dyn_dtree[2*e]=0;for(e=0;e<19;e++)A.bl_tree[2*e]=0;A.dyn_ltree[512]=1,A.opt_len=A.static_len=0,A.sym_next=A.matches=0},AQ=A=>{A.bi_valid>8?Af(A,A.bi_buf):A.bi_valid>0&&(A.pending_buf[A.pending++]=A.bi_buf),A.bi_buf=0,A.bi_valid=0},AP=(A,e,n,t)=>{let i=2*e,r=2*n;return A[i]{let t=A.heap[n],i=n<<1;for(;i<=A.heap_len&&(i{let t,i,r,a,o=0;if(0!==A.sym_next)do t=(255&A.pending_buf[A.sym_buf+o++])+((255&A.pending_buf[A.sym_buf+o++])<<8),i=A.pending_buf[A.sym_buf+o++],0===t?Ap(A,i,e):(Ap(A,(r=AI[i])+256+1,e),0!==(a=As[r])&&Ah(A,i-=Ad[r],a),Ap(A,r=AD(--t),n),0!==(a=Ac[r])&&Ah(A,t-=AB[r],a));while(o{let n,t,i,r=e.dyn_tree,a=e.stat_desc.static_tree,o=e.stat_desc.has_stree,s=e.stat_desc.elems,c=-1;for(n=0,A.heap_len=0,A.heap_max=Ao;n>1;n>=1;n--)AT(A,r,n);i=s;do n=A.heap[1],A.heap[1]=A.heap[A.heap_len--],AT(A,r,1),t=A.heap[1],A.heap[--A.heap_max]=n,A.heap[--A.heap_max]=t,r[2*i]=r[2*n]+r[2*t],A.depth[i]=(A.depth[n]>=A.depth[t]?A.depth[n]:A.depth[t])+1,r[2*n+1]=r[2*t+1]=i,A.heap[1]=i++,AT(A,r,1);while(A.heap_len>=2);A.heap[--A.heap_max]=A.heap[1],((A,e)=>{let n,t,i,r,a,o,s=e.dyn_tree,c=e.max_code,u=e.stat_desc.static_tree,l=e.stat_desc.has_stree,E=e.stat_desc.extra_bits,S=e.stat_desc.extra_base,g=e.stat_desc.max_length,I=0;for(r=0;r<=15;r++)A.bl_count[r]=0;for(s[2*A.heap[A.heap_max]+1]=0,n=A.heap_max+1;ng&&(r=g,I++),s[2*t+1]=r,!(t>c)&&(A.bl_count[r]++,a=0,t>=S&&(a=E[t-S]),o=s[2*t],A.opt_len+=o*(r+a),l&&(A.static_len+=o*(u[2*t+1]+a)));if(0!==I){do{for(r=g-1;0===A.bl_count[r];)r--;A.bl_count[r]--,A.bl_count[r+1]+=2,A.bl_count[g]--,I-=2}while(I>0);for(r=g;0!==r;r--)for(t=A.bl_count[r];0!==t;)!((i=A.heap[--n])>c)&&(s[2*i+1]!==r&&(A.opt_len+=(r-s[2*i+1])*s[2*i],s[2*i+1]=r),t--)}})(A,e),Aw(r,c,A.bl_count)},AO=(A,e,n)=>{let t,i,r=-1,a=e[1],o=0,s=7,c=4;for(0===a&&(s=138,c=3),e[(n+1)*2+1]=65535,t=0;t<=n;t++)i=a,a=e[(t+1)*2+1],++o{let t,i,r=-1,a=e[1],o=0,s=7,c=4;for(0===a&&(s=138,c=3),t=0;t<=n;t++)if(i=a,a=e[(t+1)*2+1],!(++o{Ah(A,0+ +!!t,3),AQ(A),Af(A,n),Af(A,~n),n&&A.pending_buf.set(A.window.subarray(e,e+n),A.pending),A.pending+=n};var AU={_tr_init:A=>{AG||((()=>{let A,e,n,a,o,s=Array(16);for(a=0,n=0;a<28;a++)for(A=0,Ad[a]=n;A<1<>=7;a<30;a++)for(A=0,AB[a]=o<<7;A<1<{let i,r,a=0;A.level>0?(2===A.strm.data_type&&(A.strm.data_type=(A=>{let e,n=0xf3ffc07f;for(e=0;e<=31;e++,n>>>=1)if(1&n&&0!==A.dyn_ltree[2*e])return 0;if(0!==A.dyn_ltree[18]||0!==A.dyn_ltree[20]||0!==A.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==A.dyn_ltree[2*e])return 1;return 0})(A)),Av(A,A.l_desc),Av(A,A.d_desc),a=(A=>{let e;for(AO(A,A.dyn_ltree,A.l_desc.max_code),AO(A,A.dyn_dtree,A.d_desc.max_code),Av(A,A.bl_desc),e=18;e>=3&&0===A.bl_tree[2*Al[e]+1];e--);return A.opt_len+=3*(e+1)+5+5+4,e})(A),i=A.opt_len+3+7>>>3,(r=A.static_len+3+7>>>3)<=i&&(i=r)):i=r=n+5,n+4<=i&&-1!==e?AF(A,e,n,t):4===A.strategy||r===i?(Ah(A,2+ +!!t,3),Ay(A,AE,AS)):(Ah(A,4+ +!!t,3),((A,e,n,t)=>{let i;for(Ah(A,e-257,5),Ah(A,n-1,5),Ah(A,t-4,4),i=0;i(A.pending_buf[A.sym_buf+A.sym_next++]=e,A.pending_buf[A.sym_buf+A.sym_next++]=e>>8,A.pending_buf[A.sym_buf+A.sym_next++]=n,0===e?A.dyn_ltree[2*n]++:(A.matches++,e--,A.dyn_ltree[(AI[n]+256+1)*2]++,A.dyn_dtree[2*AD(e)]++),A.sym_next===A.sym_end),_tr_align:A=>{Ah(A,2,3),Ap(A,256,AE),(A=>{16===A.bi_valid?(Af(A,A.bi_buf),A.bi_buf=0,A.bi_valid=0):A.bi_valid>=8&&(A.pending_buf[A.pending++]=255&A.bi_buf,A.bi_buf>>=8,A.bi_valid-=8)})(A)}},A_=(A,e,n,t)=>{let i=65535&A,r=A>>>16&65535,a=0;for(;0!==n;){a=n>2e3?2e3:n,n-=a;do r=r+(i=i+e[t++]|0)|0;while(--a);i%=65521,r%=65521}return i|r<<16};let Ab=new Uint32Array((()=>{let A,e=[];for(var n=0;n<256;n++){A=n;for(var t=0;t<8;t++)A=1&A?0xedb88320^A>>>1:A>>>1;e[n]=A}return e})());var Ak=(A,e,n,t)=>{let i=t+n;A^=-1;for(let n=t;n>>8^Ab[(A^e[n])&255];return -1^A},AL={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Aq={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};let{_tr_init:AV,_tr_stored_block:Ax,_tr_flush_block:AH,_tr_tally:AY,_tr_align:AJ}=AU,{Z_NO_FLUSH:AW,Z_PARTIAL_FLUSH:AK,Z_FULL_FLUSH:AX,Z_FINISH:Aj,Z_BLOCK:Az,Z_OK:AZ,Z_STREAM_END:A$,Z_STREAM_ERROR:A0,Z_DATA_ERROR:A1,Z_BUF_ERROR:A2,Z_DEFAULT_COMPRESSION:A9,Z_FILTERED:A4,Z_HUFFMAN_ONLY:A8,Z_RLE:A3,Z_FIXED:A5,Z_DEFAULT_STRATEGY:A6,Z_UNKNOWN:A7,Z_DEFLATED:eA}=Aq,ee=573,en=(A,e)=>(A.msg=AL[e],e),et=A=>2*A-9*(A>4),ei=A=>{let e=A.length;for(;--e>=0;)A[e]=0},er=A=>{let e,n,t,i=A.w_size;t=e=A.hash_size;do n=A.head[--t],A.head[t]=n>=i?n-i:0;while(--e);t=e=i;do n=A.prev[--t],A.prev[t]=n>=i?n-i:0;while(--e)},ea=(A,e,n)=>(e<{let e=A.state,n=e.pending;n>A.avail_out&&(n=A.avail_out),0!==n&&(A.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+n),A.next_out),A.next_out+=n,e.pending_out+=n,A.total_out+=n,A.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))},es=(A,e)=>{AH(A,A.block_start>=0?A.block_start:-1,A.strstart-A.block_start,e),A.block_start=A.strstart,eo(A.strm)},ec=(A,e)=>{A.pending_buf[A.pending++]=e},eu=(A,e)=>{A.pending_buf[A.pending++]=e>>>8&255,A.pending_buf[A.pending++]=255&e},el=(A,e,n,t)=>{let i=A.avail_in;return(i>t&&(i=t),0===i)?0:(A.avail_in-=i,e.set(A.input.subarray(A.next_in,A.next_in+i),n),1===A.state.wrap?A.adler=A_(A.adler,e,i,n):2===A.state.wrap&&(A.adler=Ak(A.adler,e,i,n)),A.next_in+=i,A.total_in+=i,i)},eE=(A,e)=>{let n,t,i=A.max_chain_length,r=A.strstart,a=A.prev_length,o=A.nice_match,s=A.strstart>A.w_size-262?A.strstart-(A.w_size-262):0,c=A.window,u=A.w_mask,l=A.prev,E=A.strstart+258,S=c[r+a-1],g=c[r+a];A.prev_length>=A.good_match&&(i>>=2),o>A.lookahead&&(o=A.lookahead);do{if(c[(n=e)+a]!==g||c[n+a-1]!==S||c[n]!==c[r]||c[++n]!==c[r+1])continue;r+=2,n++;do;while(c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&ra){if(A.match_start=e,a=t,t>=o)break;S=c[r+a-1],g=c[r+a]}}while((e=l[e&u])>s&&0!=--i);return a<=A.lookahead?a:A.lookahead},eS=A=>{let e,n,t,i=A.w_size;do{if(n=A.window_size-A.lookahead-A.strstart,A.strstart>=i+(i-262)&&(A.window.set(A.window.subarray(i,i+i-n),0),A.match_start-=i,A.strstart-=i,A.block_start-=i,A.insert>A.strstart&&(A.insert=A.strstart),er(A),n+=i),0===A.strm.avail_in)break;if(e=el(A.strm,A.window,A.strstart+A.lookahead,n),A.lookahead+=e,A.lookahead+A.insert>=3)for(t=A.strstart-A.insert,A.ins_h=A.window[t],A.ins_h=ea(A,A.ins_h,A.window[t+1]);A.insert&&(A.ins_h=ea(A,A.ins_h,A.window[t+3-1]),A.prev[t&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=t,t++,A.insert--,!(A.lookahead+A.insert<3)););}while(A.lookahead<262&&0!==A.strm.avail_in)},eg=(A,e)=>{let n=A.pending_buf_size-5>A.w_size?A.w_size:A.pending_buf_size-5,t,i,r,a=0,o=A.strm.avail_in;do{if(t=65535,r=A.bi_valid+42>>3,A.strm.avail_out(i=A.strstart-A.block_start)+A.strm.avail_in&&(t=i+A.strm.avail_in),t>r&&(t=r),t>8,A.pending_buf[A.pending-2]=~t,A.pending_buf[A.pending-1]=~t>>8,eo(A.strm),i&&(i>t&&(i=t),A.strm.output.set(A.window.subarray(A.block_start,A.block_start+i),A.strm.next_out),A.strm.next_out+=i,A.strm.avail_out-=i,A.strm.total_out+=i,A.block_start+=i,t-=i),t&&(el(A.strm,A.strm.output,A.strm.next_out,t),A.strm.next_out+=t,A.strm.avail_out-=t,A.strm.total_out+=t)}while(0===a);return((o-=A.strm.avail_in)&&(o>=A.w_size?(A.matches=2,A.window.set(A.strm.input.subarray(A.strm.next_in-A.w_size,A.strm.next_in),0),A.strstart=A.w_size,A.insert=A.strstart):(A.window_size-A.strstart<=o&&(A.strstart-=A.w_size,A.window.set(A.window.subarray(A.w_size,A.w_size+A.strstart),0),A.matches<2&&A.matches++,A.insert>A.strstart&&(A.insert=A.strstart)),A.window.set(A.strm.input.subarray(A.strm.next_in-o,A.strm.next_in),A.strstart),A.strstart+=o,A.insert+=o>A.w_size-A.insert?A.w_size-A.insert:o),A.block_start=A.strstart),A.high_waterr&&A.block_start>=A.w_size&&(A.block_start-=A.w_size,A.strstart-=A.w_size,A.window.set(A.window.subarray(A.w_size,A.w_size+A.strstart),0),A.matches<2&&A.matches++,r+=A.w_size,A.insert>A.strstart&&(A.insert=A.strstart)),r>A.strm.avail_in&&(r=A.strm.avail_in),r&&(el(A.strm,A.window,A.strstart,r),A.strstart+=r,A.insert+=r>A.w_size-A.insert?A.w_size-A.insert:r),A.high_water>3,n=(r=A.pending_buf_size-r>65535?65535:A.pending_buf_size-r)>A.w_size?A.w_size:r,((i=A.strstart-A.block_start)>=n||(i||e===Aj)&&e!==AW&&0===A.strm.avail_in&&i<=r)&&(t=i>r?r:i,a=+(e===Aj&&0===A.strm.avail_in&&t===i),Ax(A,A.block_start,t,a),A.block_start+=t,eo(A.strm)),a?3:1)},eI=(A,e)=>{let n,t;for(;;){if(A.lookahead<262){if(eS(A),A.lookahead<262&&e===AW)return 1;if(0===A.lookahead)break}if(n=0,A.lookahead>=3&&(A.ins_h=ea(A,A.ins_h,A.window[A.strstart+3-1]),n=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),0!==n&&A.strstart-n<=A.w_size-262&&(A.match_length=eE(A,n)),A.match_length>=3)if(t=AY(A,A.strstart-A.match_start,A.match_length-3),A.lookahead-=A.match_length,A.match_length<=A.max_lazy_match&&A.lookahead>=3){A.match_length--;do A.strstart++,A.ins_h=ea(A,A.ins_h,A.window[A.strstart+3-1]),n=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart;while(0!=--A.match_length);A.strstart++}else A.strstart+=A.match_length,A.match_length=0,A.ins_h=A.window[A.strstart],A.ins_h=ea(A,A.ins_h,A.window[A.strstart+1]);else t=AY(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++;if(t&&(es(A,!1),0===A.strm.avail_out))return 1}return(A.insert=A.strstart<2?A.strstart:2,e===Aj)?(es(A,!0),0===A.strm.avail_out)?3:4:A.sym_next&&(es(A,!1),0===A.strm.avail_out)?1:2},ed=(A,e)=>{let n,t,i;for(;;){if(A.lookahead<262){if(eS(A),A.lookahead<262&&e===AW)return 1;if(0===A.lookahead)break}if(n=0,A.lookahead>=3&&(A.ins_h=ea(A,A.ins_h,A.window[A.strstart+3-1]),n=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),A.prev_length=A.match_length,A.prev_match=A.match_start,A.match_length=2,0!==n&&A.prev_length4096)&&(A.match_length=2)),A.prev_length>=3&&A.match_length<=A.prev_length){i=A.strstart+A.lookahead-3,t=AY(A,A.strstart-1-A.prev_match,A.prev_length-3),A.lookahead-=A.prev_length-1,A.prev_length-=2;do++A.strstart<=i&&(A.ins_h=ea(A,A.ins_h,A.window[A.strstart+3-1]),n=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart);while(0!=--A.prev_length);if(A.match_available=0,A.match_length=2,A.strstart++,t&&(es(A,!1),0===A.strm.avail_out))return 1}else if(A.match_available){if((t=AY(A,0,A.window[A.strstart-1]))&&es(A,!1),A.strstart++,A.lookahead--,0===A.strm.avail_out)return 1}else A.match_available=1,A.strstart++,A.lookahead--}return(A.match_available&&(t=AY(A,0,A.window[A.strstart-1]),A.match_available=0),A.insert=A.strstart<2?A.strstart:2,e===Aj)?(es(A,!0),0===A.strm.avail_out)?3:4:A.sym_next&&(es(A,!1),0===A.strm.avail_out)?1:2};function eB(A,e,n,t,i){this.good_length=A,this.max_lazy=e,this.nice_length=n,this.max_chain=t,this.func=i}let em=[new eB(0,0,0,0,eg),new eB(4,4,8,4,eI),new eB(4,5,16,8,eI),new eB(4,6,32,32,eI),new eB(4,4,16,16,ed),new eB(8,16,32,32,ed),new eB(8,16,128,128,ed),new eB(8,32,128,256,ed),new eB(32,128,258,1024,ed),new eB(32,258,258,4096,ed)];function eC(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=eA,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(2*ee),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),ei(this.dyn_ltree),ei(this.dyn_dtree),ei(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),ei(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),ei(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}let eD=A=>{if(!A)return 1;let e=A.state;return e&&e.strm===A&&(42===e.status||57===e.status||69===e.status||73===e.status||91===e.status||103===e.status||113===e.status||666===e.status)?0:1};var ef={deflateInit2:(A,e,n,t,i,r)=>{if(!A)return A0;let a=1;if(e===A9&&(e=6),t<0?(a=0,t=-t):t>15&&(a=2,t-=16),i<1||i>9||n!==eA||t<8||t>15||e<0||e>9||r<0||r>A5||8===t&&1!==a)return en(A,A0);8===t&&(t=9);let o=new eC;return A.state=o,o.strm=A,o.status=42,o.wrap=a,o.gzhead=null,o.w_bits=t,o.w_size=1<{let e=(A=>{if(eD(A))return en(A,A0);A.total_in=A.total_out=0,A.data_type=A7;let e=A.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?42:113,A.adler=+(2!==e.wrap),e.last_flush=-2,AV(e),AZ})(A);return e===AZ&&(A=>{A.window_size=2*A.w_size,ei(A.head),A.max_lazy_match=em[A.level].max_lazy,A.good_match=em[A.level].good_length,A.nice_match=em[A.level].nice_length,A.max_chain_length=em[A.level].max_chain,A.strstart=0,A.block_start=0,A.lookahead=0,A.insert=0,A.match_length=A.prev_length=2,A.match_available=0,A.ins_h=0})(A.state),e})(A)},deflateSetHeader:(A,e)=>eD(A)||2!==A.state.wrap?A0:(A.state.gzhead=e,AZ),deflate:(A,e)=>{if(eD(A)||e>Az||e<0)return A?en(A,A0):A0;let n=A.state;if(!A.output||0!==A.avail_in&&!A.input||666===n.status&&e!==Aj)return en(A,0===A.avail_out?A2:A0);let t=n.last_flush;if(n.last_flush=e,0!==n.pending){if(eo(A),0===A.avail_out)return n.last_flush=-1,AZ}else if(0===A.avail_in&&et(e)<=et(t)&&e!==Aj)return en(A,A2);if(666===n.status&&0!==A.avail_in)return en(A,A2);if(42===n.status&&0===n.wrap&&(n.status=113),42===n.status){let e=eA+(n.w_bits-8<<4)<<8;if(e|=(n.strategy>=A8||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(e|=32),eu(n,e+=31-e%31),0!==n.strstart&&(eu(n,A.adler>>>16),eu(n,65535&A.adler)),A.adler=1,n.status=113,eo(A),0!==n.pending)return n.last_flush=-1,AZ}if(57===n.status){if(A.adler=0,ec(n,31),ec(n,139),ec(n,8),n.gzhead)ec(n,+!!n.gzhead.text+2*!!n.gzhead.hcrc+4*!!n.gzhead.extra+8*!!n.gzhead.name+16*!!n.gzhead.comment),ec(n,255&n.gzhead.time),ec(n,n.gzhead.time>>8&255),ec(n,n.gzhead.time>>16&255),ec(n,n.gzhead.time>>24&255),ec(n,9===n.level?2:4*(n.strategy>=A8||n.level<2)),ec(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(ec(n,255&n.gzhead.extra.length),ec(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(A.adler=Ak(A.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(ec(n,0),ec(n,0),ec(n,0),ec(n,0),ec(n,0),ec(n,9===n.level?2:4*(n.strategy>=A8||n.level<2)),ec(n,3),n.status=113,eo(A),0!==n.pending)return n.last_flush=-1,AZ}if(69===n.status){if(n.gzhead.extra){let e=n.pending,t=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+t>n.pending_buf_size;){let i=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>e&&(A.adler=Ak(A.adler,n.pending_buf,n.pending-e,e)),n.gzindex+=i,eo(A),0!==n.pending)return n.last_flush=-1,AZ;e=0,t-=i}let i=new Uint8Array(n.gzhead.extra);n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+t),n.pending),n.pending+=t,n.gzhead.hcrc&&n.pending>e&&(A.adler=Ak(A.adler,n.pending_buf,n.pending-e,e)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let e,t=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(A.adler=Ak(A.adler,n.pending_buf,n.pending-t,t)),eo(A),0!==n.pending)return n.last_flush=-1,AZ;t=0}e=n.gzindext&&(A.adler=Ak(A.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let e,t=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(A.adler=Ak(A.adler,n.pending_buf,n.pending-t,t)),eo(A),0!==n.pending)return n.last_flush=-1,AZ;t=0}e=n.gzindext&&(A.adler=Ak(A.adler,n.pending_buf,n.pending-t,t))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(eo(A),0!==n.pending))return n.last_flush=-1,AZ;ec(n,255&A.adler),ec(n,A.adler>>8&255),A.adler=0}if(n.status=113,eo(A),0!==n.pending)return n.last_flush=-1,AZ}if(0!==A.avail_in||0!==n.lookahead||e!==AW&&666!==n.status){let t=0===n.level?eg(n,e):n.strategy===A8?((A,e)=>{let n;for(;;){if(0===A.lookahead&&(eS(A),0===A.lookahead)){if(e===AW)return 1;break}if(A.match_length=0,n=AY(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++,n&&(es(A,!1),0===A.strm.avail_out))return 1}return(A.insert=0,e===Aj)?(es(A,!0),0===A.strm.avail_out)?3:4:A.sym_next&&(es(A,!1),0===A.strm.avail_out)?1:2})(n,e):n.strategy===A3?((A,e)=>{let n,t,i,r,a=A.window;for(;;){if(A.lookahead<=258){if(eS(A),A.lookahead<=258&&e===AW)return 1;if(0===A.lookahead)break}if(A.match_length=0,A.lookahead>=3&&A.strstart>0&&(t=a[i=A.strstart-1])===a[++i]&&t===a[++i]&&t===a[++i]){r=A.strstart+258;do;while(t===a[++i]&&t===a[++i]&&t===a[++i]&&t===a[++i]&&t===a[++i]&&t===a[++i]&&t===a[++i]&&t===a[++i]&&iA.lookahead&&(A.match_length=A.lookahead)}if(A.match_length>=3?(n=AY(A,1,A.match_length-3),A.lookahead-=A.match_length,A.strstart+=A.match_length,A.match_length=0):(n=AY(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++),n&&(es(A,!1),0===A.strm.avail_out))return 1}return(A.insert=0,e===Aj)?(es(A,!0),0===A.strm.avail_out)?3:4:A.sym_next&&(es(A,!1),0===A.strm.avail_out)?1:2})(n,e):em[n.level].func(n,e);if((3===t||4===t)&&(n.status=666),1===t||3===t)return 0===A.avail_out&&(n.last_flush=-1),AZ;if(2===t&&(e===AK?AJ(n):e!==Az&&(Ax(n,0,0,!1),e===AX&&(ei(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),eo(A),0===A.avail_out))return n.last_flush=-1,AZ}return e!==Aj?AZ:n.wrap<=0?A$:(2===n.wrap?(ec(n,255&A.adler),ec(n,A.adler>>8&255),ec(n,A.adler>>16&255),ec(n,A.adler>>24&255),ec(n,255&A.total_in),ec(n,A.total_in>>8&255),ec(n,A.total_in>>16&255),ec(n,A.total_in>>24&255)):(eu(n,A.adler>>>16),eu(n,65535&A.adler)),eo(A),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?AZ:A$)},deflateEnd:A=>{if(eD(A))return A0;let e=A.state.status;return A.state=null,113===e?en(A,A1):AZ},deflateSetDictionary:(A,e)=>{let n=e.length;if(eD(A))return A0;let t=A.state,i=t.wrap;if(2===i||1===i&&42!==t.status||t.lookahead)return A0;if(1===i&&(A.adler=A_(A.adler,e,n,0)),t.wrap=0,n>=t.w_size){0===i&&(ei(t.head),t.strstart=0,t.block_start=0,t.insert=0);let A=new Uint8Array(t.w_size);A.set(e.subarray(n-t.w_size,n),0),e=A,n=t.w_size}let r=A.avail_in,a=A.next_in,o=A.input;for(A.avail_in=n,A.next_in=0,A.input=e,eS(t);t.lookahead>=3;){let A=t.strstart,e=t.lookahead-2;do t.ins_h=ea(t,t.ins_h,t.window[A+3-1]),t.prev[A&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=A,A++;while(--e);t.strstart=A,t.lookahead=2,eS(t)}return t.strstart+=t.lookahead,t.block_start=t.strstart,t.insert=t.lookahead,t.lookahead=0,t.match_length=t.prev_length=2,t.match_available=0,A.next_in=a,A.input=o,A.avail_in=r,t.wrap=i,AZ}};let eh=(A,e)=>Object.prototype.hasOwnProperty.call(A,e);var ep={assign:function(A){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let n=e.shift();if(n){if("object"!=typeof n)throw TypeError(n+"must be non-object");for(let e in n)eh(n,e)&&(A[e]=n[e])}}return A},flattenChunks:A=>{let e=0;for(let n=0,t=A.length;n=252?6:A>=248?5:A>=240?4:A>=224?3:A>=192?2:1;ew[254]=ew[254]=1;var eR={string2buf:A=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return new TextEncoder().encode(A);let e,n,t,i,r,a=A.length,o=0;for(i=0;i>>6:(n<65536?e[r++]=224|n>>>12:(e[r++]=240|n>>>18,e[r++]=128|n>>>12&63),e[r++]=128|n>>>6&63),e[r++]=128|63&n);return e},buf2string:(A,e)=>{let n,t,i=e||A.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return new TextDecoder().decode(A.subarray(0,e));let r=Array(2*i);for(t=0,n=0;n4){r[t++]=65533,n+=a-1;continue}for(e&=2===a?31:3===a?15:7;a>1&&n1){r[t++]=65533;continue}e<65536?r[t++]=e:(e-=65536,r[t++]=55296|e>>10&1023,r[t++]=56320|1023&e)}return((A,e)=>{if(e<65534&&A.subarray&&eM)return String.fromCharCode.apply(null,A.length===e?A:A.subarray(0,e));let n="";for(let t=0;t{(e=e||A.length)>A.length&&(e=A.length);let n=e-1;for(;n>=0&&(192&A[n])==128;)n--;return n<0||0===n?e:n+ew[A[n]]>e?n:e}},eQ=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};let eP=Object.prototype.toString,{Z_NO_FLUSH:eT,Z_SYNC_FLUSH:ey,Z_FULL_FLUSH:ev,Z_FINISH:eO,Z_OK:eN,Z_STREAM_END:eG,Z_DEFAULT_COMPRESSION:eF,Z_DEFAULT_STRATEGY:eU,Z_DEFLATED:e_}=Aq;function eb(A){this.options=ep.assign({level:eF,method:e_,chunkSize:16384,windowBits:15,memLevel:8,strategy:eU},A||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new eQ,this.strm.avail_out=0;let n=ef.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==eN)throw Error(AL[n]);if(e.header&&ef.deflateSetHeader(this.strm,e.header),e.dictionary){let A;if(A="string"==typeof e.dictionary?eR.string2buf(e.dictionary):"[object ArrayBuffer]"===eP.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,(n=ef.deflateSetDictionary(this.strm,A))!==eN)throw Error(AL[n]);this._dict_set=!0}}function ek(A,e){let n=new eb(e);if(n.push(A,!0),n.err)throw n.msg||AL[n.err];return n.result}eb.prototype.push=function(A,e){let n,t,i=this.strm,r=this.options.chunkSize;if(this.ended)return!1;for(t=e===~~e?e:!0===e?eO:eT,"string"==typeof A?i.input=eR.string2buf(A):"[object ArrayBuffer]"===eP.call(A)?i.input=new Uint8Array(A):i.input=A,i.next_in=0,i.avail_in=i.input.length;;){if(0===i.avail_out&&(i.output=new Uint8Array(r),i.next_out=0,i.avail_out=r),(t===ey||t===ev)&&i.avail_out<=6){this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;continue}if((n=ef.deflate(i,t))===eG)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),n=ef.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===eN;if(0===i.avail_out){this.onData(i.output);continue}if(t>0&&i.next_out>0){this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;continue}if(0===i.avail_in)break}return!0},eb.prototype.onData=function(A){this.chunks.push(A)},eb.prototype.onEnd=function(A){A===eN&&(this.result=ep.flattenChunks(this.chunks)),this.chunks=[],this.err=A,this.msg=this.strm.msg};var eL=function(A,e){let n,t,i,r,a,o,s,c,u,l,E,S,g,I,d,B,m,C,D,f,h,p,M,w,R=A.state;n=A.next_in,M=A.input,t=n+(A.avail_in-5),i=A.next_out,w=A.output,r=i-(e-A.avail_out),a=i+(A.avail_out-257),o=R.dmax,s=R.wsize,c=R.whave,u=R.wnext,l=R.window,E=R.hold,S=R.bits,g=R.lencode,I=R.distcode,d=(1<>>=C=m>>>24,S-=C,0==(C=m>>>16&255))w[i++]=65535&m;else if(16&C)for(D=65535&m,(C&=15)&&(S>>=C,S-=C),S<15&&(E+=M[n++]<>>=C=m>>>24,S-=C,16&(C=m>>>16&255)){if(f=65535&m,S<(C&=15)&&(E+=M[n++]<o){A.msg="invalid distance too far back",R.mode=16209;break A}if(E>>>=C,S-=C,f>(C=i-r)){if((C=f-C)>c&&R.sane){A.msg="invalid distance too far back",R.mode=16209;break A}if(h=0,p=l,0===u){if(h+=s-C,C2;)w[i++]=p[h++],w[i++]=p[h++],w[i++]=p[h++],D-=3;D&&(w[i++]=p[h++],D>1&&(w[i++]=p[h++]))}else{h=i-f;do w[i++]=w[h++],w[i++]=w[h++],w[i++]=w[h++],D-=3;while(D>2);D&&(w[i++]=w[h++],D>1&&(w[i++]=w[h++]))}}else if((64&C)==0){m=I[(65535&m)+(E&(1<>3,S-=D<<3,E&=(1<{let s,c,u,l,E,S,g,I,d,B=o.bits,m=0,C=0,D=0,f=0,h=0,p=0,M=0,w=0,R=0,Q=0,P=null,T=new Uint16Array(16),y=new Uint16Array(16),v=null;for(m=0;m<=15;m++)T[m]=0;for(C=0;C=1&&0===T[f];f--);if(h>f&&(h=f),0===f)return i[r++]=0x1400000,i[r++]=0x1400000,o.bits=1,0;for(D=1;D0&&(0===A||1!==f))return -1;for(m=1,y[1]=0;m<15;m++)y[m+1]=y[m]+T[m];for(C=0;C852||2===A&&R>592)return 1;for(;;){g=m-M,a[C]+1=S?(I=v[a[C]-S],d=P[a[C]-S]):(I=96,d=0),s=1<>M)+(c-=s)]=g<<24|I<<16|d;while(0!==c);for(s=1<>=1;if(0!==s?(Q&=s-1,Q+=s):Q=0,C++,0==--T[m]){if(m===f)break;m=e[n+a[C]]}if(m>h&&(Q&l)!==u){for(0===M&&(M=h),E+=D,w=1<<(p=m-M);p+M852||2===A&&R>592)return 1;i[u=Q&l]=h<<24|p<<16|E-r}}return 0!==Q&&(i[E+Q]=m-M<<24|4194304),o.bits=h,0};let{Z_FINISH:eJ,Z_BLOCK:eW,Z_TREES:eK,Z_OK:eX,Z_STREAM_END:ej,Z_NEED_DICT:ez,Z_STREAM_ERROR:eZ,Z_DATA_ERROR:e$,Z_MEM_ERROR:e0,Z_BUF_ERROR:e1,Z_DEFLATED:e2}=Aq,e9=A=>(A>>>24&255)+(A>>>8&65280)+((65280&A)<<8)+((255&A)<<24);function e4(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}let e8=A=>{if(!A)return 1;let e=A.state;return+(!e||e.strm!==A||e.mode<16180||e.mode>16211)},e3=A=>{if(e8(A))return eZ;let e=A.state;return e.wsize=0,e.whave=0,e.wnext=0,(A=>{if(e8(A))return eZ;let e=A.state;return A.total_in=A.total_out=e.total=0,A.msg="",e.wrap&&(A.adler=1&e.wrap),e.mode=16180,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,eX})(A)},e5=!0,e6=A=>{if(e5){a=new Int32Array(512),o=new Int32Array(32);let e=0;for(;e<144;)A.lens[e++]=8;for(;e<256;)A.lens[e++]=9;for(;e<280;)A.lens[e++]=7;for(;e<288;)A.lens[e++]=8;for(eY(1,A.lens,0,288,a,0,A.work,{bits:9}),e=0;e<32;)A.lens[e++]=5;eY(2,A.lens,0,32,o,0,A.work,{bits:5}),e5=!1}A.lencode=a,A.lenbits=9,A.distcode=o,A.distbits=5},e7=(A,e,n,t)=>{let i,r=A.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(n-r.wsize,n),0),r.wnext=0,r.whave=r.wsize):((i=r.wsize-r.wnext)>t&&(i=t),r.window.set(e.subarray(n-t,n-t+i),r.wnext),(t-=i)?(r.window.set(e.subarray(n-t,n),0),r.wnext=t,r.whave=r.wsize):(r.wnext+=i,r.wnext===r.wsize&&(r.wnext=0),r.whave{if(!A)return eZ;let n=new e4;A.state=n,n.strm=A,n.window=null,n.mode=16180;let t=((A,e)=>{let n;if(e8(A))return eZ;let t=A.state;return(e<0?(n=0,e=-e):(n=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15))?eZ:(null!==t.window&&t.wbits!==e&&(t.window=null),t.wrap=n,t.wbits=e,e3(A))})(A,e);return t!==eX&&(A.state=null),t},inflate:(A,e)=>{let n,t,i,r,a,o,s,c,u,l,E,S,g,I,d,B,m,C,D,f,h,p,M,w,R=0,Q=new Uint8Array(4),P=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(e8(A)||!A.output||!A.input&&0!==A.avail_in)return eZ;16191===(n=A.state).mode&&(n.mode=16192),a=A.next_out,i=A.output,s=A.avail_out,r=A.next_in,t=A.input,o=A.avail_in,c=n.hold,u=n.bits,l=o,E=s,p=eX;e:for(;;)switch(n.mode){case 16180:if(0===n.wrap){n.mode=16192;break}for(;u<16;){if(0===o)break e;o--,c+=t[r++]<>>8&255,n.check=Ak(n.check,Q,2,0),c=0,u=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&c)<<8)+(c>>8))%31){A.msg="incorrect header check",n.mode=16209;break}if((15&c)!==e2){A.msg="unknown compression method",n.mode=16209;break}if(c>>>=4,u-=4,h=(15&c)+8,0===n.wbits&&(n.wbits=h),h>15||h>n.wbits){A.msg="invalid window size",n.mode=16209;break}n.dmax=1<>8&1),512&n.flags&&4&n.wrap&&(Q[0]=255&c,Q[1]=c>>>8&255,n.check=Ak(n.check,Q,2,0)),c=0,u=0,n.mode=16182;case 16182:for(;u<32;){if(0===o)break e;o--,c+=t[r++]<>>8&255,Q[2]=c>>>16&255,Q[3]=c>>>24&255,n.check=Ak(n.check,Q,4,0)),c=0,u=0,n.mode=16183;case 16183:for(;u<16;){if(0===o)break e;o--,c+=t[r++]<>8),512&n.flags&&4&n.wrap&&(Q[0]=255&c,Q[1]=c>>>8&255,n.check=Ak(n.check,Q,2,0)),c=0,u=0,n.mode=16184;case 16184:if(1024&n.flags){for(;u<16;){if(0===o)break e;o--,c+=t[r++]<>>8&255,n.check=Ak(n.check,Q,2,0)),c=0,u=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&((S=n.length)>o&&(S=o),S&&(n.head&&(h=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(t.subarray(r,r+S),h)),512&n.flags&&4&n.wrap&&(n.check=Ak(n.check,t,S,r)),o-=S,r+=S,n.length-=S),n.length))break e;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===o)break e;S=0;do h=t[r+S++],n.head&&h&&n.length<65536&&(n.head.name+=String.fromCharCode(h));while(h&&S>9&1,n.head.done=!0),A.adler=n.check=0,n.mode=16191;break;case 16189:for(;u<32;){if(0===o)break e;o--,c+=t[r++]<>>=7&u,u-=7&u,n.mode=16206;break}for(;u<3;){if(0===o)break e;o--,c+=t[r++]<>>=1)){case 0:n.mode=16193;break;case 1:if(e6(n),n.mode=16199,e===eK){c>>>=2,u-=2;break e}break;case 2:n.mode=16196;break;case 3:A.msg="invalid block type",n.mode=16209}c>>>=2,u-=2;break;case 16193:for(c>>>=7&u,u-=7&u;u<32;){if(0===o)break e;o--,c+=t[r++]<>>16^65535)){A.msg="invalid stored block lengths",n.mode=16209;break}if(n.length=65535&c,c=0,u=0,n.mode=16194,e===eK)break e;case 16194:n.mode=16195;case 16195:if(S=n.length){if(S>o&&(S=o),S>s&&(S=s),0===S)break e;i.set(t.subarray(r,r+S),a),o-=S,r+=S,s-=S,a+=S,n.length-=S;break}n.mode=16191;break;case 16196:for(;u<14;){if(0===o)break e;o--,c+=t[r++]<>>=5))+1,u-=5,n.ncode=(15&(c>>>=5))+4,c>>>=4,u-=4,n.nlen>286||n.ndist>30){A.msg="too many length or distance symbols",n.mode=16209;break}n.have=0,n.mode=16197;case 16197:for(;n.have>>=3,u-=3}for(;n.have<19;)n.lens[P[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,M={bits:n.lenbits},p=eY(0,n.lens,0,19,n.lencode,0,n.work,M),n.lenbits=M.bits,p){A.msg="invalid code lengths set",n.mode=16209;break}n.have=0,n.mode=16198;case 16198:for(;n.have>>24,B=R>>>16&255,m=65535&R,!(d<=u);){if(0===o)break e;o--,c+=t[r++]<>>=d,u-=d,n.lens[n.have++]=m;else{if(16===m){for(w=d+2;u>>=d,u-=d,0===n.have){A.msg="invalid bit length repeat",n.mode=16209;break}h=n.lens[n.have-1],S=3+(3&c),c>>>=2,u-=2}else if(17===m){for(w=d+3;u>>=d,u-=d,h=0,S=3+(7&c),c>>>=3,u-=3}else{for(w=d+7;u>>=d,u-=d,h=0,S=11+(127&c),c>>>=7,u-=7}if(n.have+S>n.nlen+n.ndist){A.msg="invalid bit length repeat",n.mode=16209;break}for(;S--;)n.lens[n.have++]=h}}if(16209===n.mode)break;if(0===n.lens[256]){A.msg="invalid code -- missing end-of-block",n.mode=16209;break}if(n.lenbits=9,M={bits:n.lenbits},p=eY(1,n.lens,0,n.nlen,n.lencode,0,n.work,M),n.lenbits=M.bits,p){A.msg="invalid literal/lengths set",n.mode=16209;break}if(n.distbits=6,n.distcode=n.distdyn,M={bits:n.distbits},p=eY(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,M),n.distbits=M.bits,p){A.msg="invalid distances set",n.mode=16209;break}if(n.mode=16199,e===eK)break e;case 16199:n.mode=16200;case 16200:if(o>=6&&s>=258){A.next_out=a,A.avail_out=s,A.next_in=r,A.avail_in=o,n.hold=c,n.bits=u,eL(A,E),a=A.next_out,i=A.output,s=A.avail_out,r=A.next_in,t=A.input,o=A.avail_in,c=n.hold,u=n.bits,16191===n.mode&&(n.back=-1);break}for(n.back=0;d=(R=n.lencode[c&(1<>>24,B=R>>>16&255,m=65535&R,!(d<=u);){if(0===o)break e;o--,c+=t[r++]<>C)])>>>24,B=R>>>16&255,m=65535&R,!(C+d<=u);){if(0===o)break e;o--,c+=t[r++]<>>=C,u-=C,n.back+=C}if(c>>>=d,u-=d,n.back+=d,n.length=m,0===B){n.mode=16205;break}if(32&B){n.back=-1,n.mode=16191;break}if(64&B){A.msg="invalid literal/length code",n.mode=16209;break}n.extra=15&B,n.mode=16201;case 16201:if(n.extra){for(w=n.extra;u>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;d=(R=n.distcode[c&(1<>>24,B=R>>>16&255,m=65535&R,!(d<=u);){if(0===o)break e;o--,c+=t[r++]<>C)])>>>24,B=R>>>16&255,m=65535&R,!(C+d<=u);){if(0===o)break e;o--,c+=t[r++]<>>=C,u-=C,n.back+=C}if(c>>>=d,u-=d,n.back+=d,64&B){A.msg="invalid distance code",n.mode=16209;break}n.offset=m,n.extra=15&B,n.mode=16203;case 16203:if(n.extra){for(w=n.extra;u>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){A.msg="invalid distance too far back",n.mode=16209;break}n.mode=16204;case 16204:if(0===s)break e;if(S=E-s,n.offset>S){if((S=n.offset-S)>n.whave&&n.sane){A.msg="invalid distance too far back",n.mode=16209;break}S>n.wnext?(S-=n.wnext,g=n.wsize-S):g=n.wnext-S,S>n.length&&(S=n.length),I=n.window}else I=i,g=a-n.offset,S=n.length;S>s&&(S=s),s-=S,n.length-=S;do i[a++]=I[g++];while(--S);0===n.length&&(n.mode=16200);break;case 16205:if(0===s)break e;i[a++]=n.length,s--,n.mode=16200;break;case 16206:if(n.wrap){for(;u<32;){if(0===o)break e;o--,c|=t[r++]<{if(e8(A))return eZ;let e=A.state;return e.window&&(e.window=null),A.state=null,eX},inflateGetHeader:(A,e)=>{if(e8(A))return eZ;let n=A.state;return(2&n.wrap)==0?eZ:(n.head=e,e.done=!1,eX)},inflateSetDictionary:(A,e)=>{let n,t=e.length;return e8(A)||0!==(n=A.state).wrap&&16190!==n.mode?eZ:16190===n.mode&&A_(1,e,t,0)!==n.check?e$:e7(A,e,t,t)?(n.mode=16210,e0):(n.havedict=1,eX)}},ne=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};let nn=Object.prototype.toString,{Z_NO_FLUSH:nt,Z_FINISH:ni,Z_OK:nr,Z_STREAM_END:na,Z_NEED_DICT:no,Z_STREAM_ERROR:ns,Z_DATA_ERROR:nc,Z_MEM_ERROR:nu}=Aq;function nl(A){this.options=ep.assign({chunkSize:65536,windowBits:15,to:""},A||{});let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(A&&A.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(15&e.windowBits)==0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new eQ,this.strm.avail_out=0;let n=nA.inflateInit2(this.strm,e.windowBits);if(n!==nr||(this.header=new ne,nA.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=eR.string2buf(e.dictionary):"[object ArrayBuffer]"===nn.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw)&&(n=nA.inflateSetDictionary(this.strm,e.dictionary))!==nr))throw Error(AL[n])}function nE(A,e){let n=new nl(e);if(n.push(A),n.err)throw n.msg||AL[n.err];return n.result}nl.prototype.push=function(A,e){let n,t,i,r=this.strm,a=this.options.chunkSize,o=this.options.dictionary;if(this.ended)return!1;for(t=e===~~e?e:!0===e?ni:nt,"[object ArrayBuffer]"===nn.call(A)?r.input=new Uint8Array(A):r.input=A,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(a),r.next_out=0,r.avail_out=a),(n=nA.inflate(r,t))===no&&o&&((n=nA.inflateSetDictionary(r,o))===nr?n=nA.inflate(r,t):n===nc&&(n=no));r.avail_in>0&&n===na&&r.state.wrap>0&&0!==A[r.next_in];)nA.inflateReset(r),n=nA.inflate(r,t);switch(n){case ns:case nc:case no:case nu:return this.onEnd(n),this.ended=!0,!1}if(i=r.avail_out,r.next_out&&(0===r.avail_out||n===na))if("string"===this.options.to){let A=eR.utf8border(r.output,r.next_out),e=r.next_out-A,n=eR.buf2string(r.output,A);r.next_out=e,r.avail_out=a-e,e&&r.output.set(r.output.subarray(A,A+e),0),this.onData(n)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(n!==nr||0!==i){if(n===na)return n=nA.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},nl.prototype.onData=function(A){this.chunks.push(A)},nl.prototype.onEnd=function(A){A===nr&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=ep.flattenChunks(this.chunks)),this.chunks=[],this.err=A,this.msg=this.strm.msg};let{Deflate:nS,deflate:ng,deflateRaw:nI,gzip:nd}={Deflate:eb,deflate:ek,deflateRaw:function(A,e){return(e=e||{}).raw=!0,ek(A,e)},gzip:function(A,e){return(e=e||{}).gzip=!0,ek(A,e)}},{Inflate:nB,inflate:nm,inflateRaw:nC,ungzip:nD}={Inflate:nl,inflate:nE,inflateRaw:function(A,e){return(e=e||{}).raw=!0,nE(A,e)},ungzip:nE};var nf={inflateRaw:nC},nh=K(function A(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{defaultSize:262144};J(this,A),X(this,"buffers",[]),X(this,"views",[]),X(this,"offsets",[]),X(this,"lengths",[]),X(this,"size",0),X(this,"byteLength",0),X(this,"defaultSize",262144),X(this,"consumed",[]),X(this,"consumeOffset",-1),this.defaultSize=e.defaultSize||this.defaultSize},[{key:"consume",value:function(A){if(this.consumeOffset=Math.max(A,this.consumeOffset),this.consumed&&this.offsets.length)for(;;){var e,n=this.offsets[this.consumed.length],t=this.lengths[this.consumed.length];if(void 0===n||void 0===t)return;var i=n+t;if(this.consumeOffsetthis.size||e>this.size)return!1;for(var n=0;nt&&!this.buffers[n+1])return!1}return!0}},{key:"checkSize",value:function(A){for(;A>this.byteLength;){var e=new ArrayBuffer(this.defaultSize);this.buffers.push(e),this.views.push(new DataView(e)),this.offsets.push(this.byteLength),this.lengths.push(e.byteLength),this.byteLength+=e.byteLength}}},{key:"addBuffer",value:function(A){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;A=A.buffer||A;var t=(null==n?void 0:n.start)||0,i=(null==n?void 0:n.end)||A.byteLength,r=null!=(e=null==n?void 0:n.transfer)?e:0===t&&i===A.byteLength;if(t!==i){var a=r?A:A.slice(t,i),o=this.offsets.length?this.offsets[this.offsets.length-1]:0,s=this.lengths.length?this.lengths[this.lengths.length-1]:0;this.buffers.push(a),this.views.push(new DataView(a)),this.offsets.push(o+s),this.lengths.push(a.byteLength),this.size+=a.byteLength,this.byteLength+=a.byteLength}}},{key:"from",value:function(A,e){var n,t,i,r;this.size=A.size,this.byteLength=A.byteLength,(n=this.offsets).push.apply(n,An(A.offsets)),(t=this.lengths).push.apply(t,An(A.lengths)),(i=this.buffers).push.apply(i,An(A.buffers)),(r=this.views).push.apply(r,An(A.views))}},{key:"slice",value:function(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size;if(A===e)return new Uint8Array(0).buffer;var n=this.findStart(A);if(void 0===n)throw Error("Start ".concat(A," out of range of 0...").concat(this.byteLength));var t=this.buffers[n];if(!t)return void console.error("Buffer should be defined here");var i=this.offsets[n],r=t.byteLength;if(e<=i+r)return t.slice(A-i,e-i);for(var a=new Uint8Array(e-A),o=0;A+o0&&void 0!==arguments[0]?arguments[0]:0,e=0;e=this.offsets[e]&&A1&&void 0!==arguments[1]?arguments[1]:1,n=this.findStart(A),t=this.offsets[n],i=this.lengths[n];if(void 0===t)throw Error("Finding view is past end of input for start=".concat(A," where offsets=").concat(this.offsets," and lengths are ").concat(this.lengths));return A+e-t<=i?{view:this.views[n],viewOffset:t,index:n}:{view:new DataView(this.slice(A,A+e)),viewOffset:A,writeCommit:!0}}},{key:"writeCommit",value:function(A,e){this.writeBuffer(A.buffer,e)}},{key:"writeBuffer",value:function(A,e){for(var n=this.findStart(e),t=0;t0&&void 0!==arguments[0]?arguments[0]:null;J(this,A),X(this,"offset",0),X(this,"startOffset",0),X(this,"isLittleEndian",!1),X(this,"size",0),X(this,"view",new nh),X(this,"availableListeners",[]),X(this,"isComplete",!1),X(this,"clearBuffers",!1),X(this,"encoder",new TextEncoder("utf-8")),this.isLittleEndian=(null==n?void 0:n.littleEndian)||this.isLittleEndian,this.view.defaultSize=null!=(e=null==n?void 0:n.defaultSize)?e:this.view.defaultSize,this.clearBuffers=n.clearBuffers||!1},[{key:"setComplete",value:function(){var A=!(arguments.length>0)||void 0===arguments[0]||arguments[0];this.isComplete=A,this.notifyAvailableListeners()}},{key:"isAvailable",value:function(A){var e=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return this.offset+A<=this.endOffset||e&&this.isComplete}},{key:"ensureAvailable",value:function(){var A=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1024;return!!this.isAvailable(e)||new Promise(function(n){var t=function(){if(A.isAvailable(e))return void n(!0);A.availableListeners.push(t)};t()})}},{key:"setEndian",value:function(A){this.isLittleEndian=A}},{key:"slice",value:function(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.startOffset,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.endOffset;return this.view.slice(A,e)}},{key:"getBuffer",value:function(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size;return this.noCopy?new Uint8Array(this.slice(A,e)):this.slice(A,e)}},{key:"buffer",get:function(){return this.getBuffer()}},{key:"available",get:function(){return this.endOffset-this.offset}},{key:"writeUint8",value:function(A){return this.checkSize(1),this.view.setUint8(this.offset,nM(A)),this.increment(1)}},{key:"writeUint8Repeat",value:function(A,e){var n=nM(A);this.checkSize(e);for(var t=0;t>16),this.isLittleEndian),this.view.setUint16(this.offset+2,nM(65535&A),this.isLittleEndian),this.increment(4)}},{key:"writeInt16",value:function(A){return this.checkSize(2),this.view.setInt16(this.offset,nM(A),this.isLittleEndian),this.increment(2)}},{key:"writeUint32",value:function(A){return this.checkSize(4),this.view.setUint32(this.offset,nM(A),this.isLittleEndian),this.increment(4)}},{key:"writeInt32",value:function(A){return this.checkSize(4),this.view.setInt32(this.offset,nM(A),this.isLittleEndian),this.increment(4)}},{key:"writeBigUint64",value:function(A){return this.checkSize(8),this.view.setBigUint64(this.offset,A,this.isLittleEndian),this.increment(8)}},{key:"writeFloat",value:function(A){return this.checkSize(4),this.view.setFloat32(this.offset,np(A),this.isLittleEndian),this.increment(4)}},{key:"writeDouble",value:function(A){return this.checkSize(8),this.view.setFloat64(this.offset,np(A),this.isLittleEndian),this.increment(8)}},{key:"writeUTF8String",value:function(A){var e=this.encoder.encode(A);return this.checkSize(e.byteLength),this.view.writeBuffer(e,this.offset),this.increment(e.byteLength)}},{key:"writeAsciiString",value:function(A){var e=(A=A||"").length;this.checkSize(e);for(var n=this.offset,t=0;tthis.endOffset)throw Error("Stream has insufficient data: requested ".concat(A," bytes at offset ").concat(this.offset,", but only ").concat(this.endOffset-this.offset," bytes available (endOffset ").concat(this.endOffset,")"));var e=new Uint8Array(this.view.slice(this.offset,this.offset+A));return this.increment(A),e}},{key:"readArrayBuffer",value:function(A){return this.readUint8Array(A).buffer}},{key:"readUint16Array",value:function(A){for(var e=A/2,n=new Uint16Array(e),t=0;t++=this.view.byteLength&&(t=this.view.byteLength);for(var i=n;i=this.view.byteLength&&(A=this.view.byteLength-this.offset);var e=new DataView(this.slice(this.offset,this.offset+A)),n=this.decoder.decode(e);return this.increment(A),n}},{key:"readHex",value:function(A){for(var e="",n=0;nthis.size&&(this.size=this.offset),A}},{key:"fromAsyncStream",value:(A=Y(q().mark(function A(e){var n,t,i,r,a,o,s,c;return q().wrap(function(A){for(;;)switch(A.prev=A.next){case 0:n=!1,t=!1,A.prev=1,r=function(A){var e,n,t,i=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,t=Symbol.iterator);i--;){if(n&&null!=(e=A[n]))return e.call(A);if(t&&null!=(e=A[t]))return new F(e.call(A));n="@@asyncIterator",t="@@iterator"}throw TypeError("Object is not async iterable")}(e);case 2:return A.next=3,r.next();case 3:if(!(n=!(a=A.sent).done)){A.next=5;break}s=(o=a.value).buffer.slice(o.byteOffset,o.byteOffset+o.byteLength),this.addBuffer(s);case 4:n=!1,A.next=2;break;case 5:A.next=7;break;case 6:A.prev=6,c=A.catch(1),t=!0,i=c;case 7:if(A.prev=7,A.prev=8,!(n&&null!=r.return)){A.next=9;break}return A.next=9,r.return();case 9:if(A.prev=9,!t){A.next=10;break}throw i;case 10:return A.finish(9);case 11:return A.finish(7);case 12:this.setComplete();case 13:case"end":return A.stop()}},A,this,[[1,6,7,12],[8,,9,11]])})),function(e){return A.apply(this,arguments)})},{key:"addBuffer",value:function(A){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(A)return this.view.addBuffer(A,e),this.size=this.view.size,this.endOffset=this.size,this.notifyAvailableListeners(),this.size}},{key:"notifyAvailableListeners",value:function(){var A=An(this.availableListeners);this.availableListeners.splice(0,this.availableListeners.length),A.forEach(function(A){return A()})}},{key:"consume",value:function(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.offset;this.clearBuffers&&this.view.consume(A)}},{key:"hasData",value:function(A){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:A+1;return this.view.hasData(A,e)}},{key:"more",value:function(A){if(this.offset+A>this.endOffset)throw Error("Request more than currently allocated buffer");var e=new nR(this.slice(this.offset,this.offset+A));return this.increment(A),e.setComplete(),e}},{key:"reset",value:function(){return this.offset=0,this}},{key:"end",value:function(){return this.isComplete&&this.offset>=this.end}},{key:"toEnd",value:function(){this.offset=this.view.byteLength}},{key:"getBufferMemoryInfo",value:function(){return this.view.getBufferMemoryInfo(this.offset)}}])}(),nR=function(A){function e(A,n){var t,i,r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{start:null,stop:null,noCopy:!1};return J(this,e),(r=U(this,e,[L(L({},a),{},{littleEndian:n})])).noCopy=a.noCopy,r.decoder=new TextDecoder("latin1"),A instanceof nw?(r.view.from(A.view,a),r.isComplete=!0):A&&(r.view.addBuffer(A),r.isComplete=!0),r.offset=null!=(t=null!=(i=a.start)?i:null==A?void 0:A.offset)?t:0,r.size=a.stop||(null==A?void 0:A.size)||(null==A?void 0:A.byteLength)||0,r.startOffset=r.offset,r.endOffset=r.size,r}return j(e,A),K(e,[{key:"setDecoder",value:function(A){this.decoder=A}},{key:"reset",value:function(){return this.offset=this.startOffset,this}},{key:"end",value:function(){return this.isComplete&&this.offset>=this.endOffset}},{key:"toEnd",value:function(){this.offset=this.endOffset}},{key:"writeUint8",value:function(A){throw Error(A,"writeUint8 not implemented")}},{key:"writeUint8Repeat",value:function(A,e){throw Error("writeUint8Repeat not implemented (value: ".concat(A,", count: ").concat(e,")"))}},{key:"writeInt8",value:function(A){throw Error(A,"writeInt8 not implemented")}},{key:"writeUint16",value:function(A){throw Error(A,"writeUint16 not implemented")}},{key:"writeTwoUint16s",value:function(A){throw Error(A,"writeTwoUint16s not implemented")}},{key:"writeInt16",value:function(A){throw Error(A,"writeInt16 not implemented")}},{key:"writeUint32",value:function(A){throw Error(A,"writeUint32 not implemented")}},{key:"writeInt32",value:function(A){throw Error(A,"writeInt32 not implemented")}},{key:"writeFloat",value:function(A){throw Error(A,"writeFloat not implemented")}},{key:"writeDouble",value:function(A){throw Error(A,"writeDouble not implemented")}},{key:"writeAsciiString",value:function(A){throw Error(A,"writeAsciiString not implemented")}},{key:"writeUTF8String",value:function(A){throw Error(A,"writeUTF8String not implemented")}},{key:"checkSize",value:function(A){throw Error(A,"checkSize not implemented")}},{key:"concat",value:function(A){throw Error(A,"concat not implemented")}}])}(nw),nQ=function(A){function e(A,n){return J(this,e),U(this,e,[nf.inflateRaw(A.getBuffer(A.offset,A.size)).buffer,A.littleEndian,n])}return j(e,A),K(e)}(nR),nP=function(A){function e(A,n){var t;return J(this,e),(t=U(this,e,[{defaultSize:A,littleEndian:n}])).size=0,t}return j(e,A),K(e)}(nw),nT="1.2.840.10008.1.2",ny="1.2.840.10008.1.2.1",nv="1.2.840.10008.1.2.1.99",nO="1.2.840.10008.1.2.2",nN=X(X(X(X({},nT,!0),nO,!0),nv,!0),ny,!0),nG=new Set(["1.2.840.10008.1.2.4.100","1.2.840.10008.1.2.4.100.1","1.2.840.10008.1.2.4.101","1.2.840.10008.1.2.4.101.1","1.2.840.10008.1.2.4.102","1.2.840.10008.1.2.4.102.1","1.2.840.10008.1.2.4.103","1.2.840.10008.1.2.4.103.1","1.2.840.10008.1.2.4.104","1.2.840.10008.1.2.4.104.1","1.2.840.10008.1.2.4.105","1.2.840.10008.1.2.4.105.1","1.2.840.10008.1.2.4.106","1.2.840.10008.1.2.4.106.1","1.2.840.10008.1.2.4.107","1.2.840.10008.1.2.4.108"]);function nF(A){return A&&nG.has(A)}var nU={Item:"FFFEE000",ItemDelimitationEnd:"FFFEE00D",SequenceDelimitationEnd:"FFFEE0DD",PixelData:"7FE00010",FileMetaInformationGroupLength:"00020000",TransferSyntaxUID:"00020010",Rows:"00280010",Columns:"00280011",SamplesPerPixel:"00280002",BitsAllocated:"00280100",NumberOfFrames:"00280008",SpecificCharacterSet:"00080005",PixelRepresentation:"00280103",DataSetTrailingPadding:"FFFCFFFC",StudyInstanceUID:"0020000D",SeriesInstanceUID:"0020000E",SOPInstanceUID:"00080018",TimezoneOffsetFromUTC:"00080201",AvailableTransferSyntaxUID:"00083002",MediaStorageSOPInstanceUID:"00020003"},n_={"":"iso-8859-1","iso-ir-6":"iso-8859-1","iso-ir-13":"shift-jis","iso-ir-100":"latin1","iso-ir-101":"iso-8859-2","iso-ir-109":"iso-8859-3","iso-ir-110":"iso-8859-4","iso-ir-126":"iso-ir-126","iso-ir-127":"iso-ir-127","iso-ir-138":"iso-ir-138","iso-ir-144":"iso-ir-144","iso-ir-148":"iso-ir-148","iso-ir-166":"tis-620","iso-2022-ir-6":"iso-8859-1","iso-2022-ir-13":"shift-jis","iso-2022-ir-87":"iso-2022-jp","iso-2022-ir-100":"latin1","iso-2022-ir-101":"iso-8859-2","iso-2022-ir-109":"iso-8859-3","iso-2022-ir-110":"iso-8859-4","iso-2022-ir-126":"iso-ir-126","iso-2022-ir-127":"iso-ir-127","iso-2022-ir-138":"iso-ir-138","iso-2022-ir-144":"iso-ir-144","iso-2022-ir-148":"iso-ir-148","iso-2022-ir-149":"euc-kr","iso-2022-ir-159":"iso-2022-jp","iso-2022-ir-166":"tis-620","iso-2022-ir-58":"iso-ir-58","iso-ir-192":"utf-8",gb18030:"gb18030","iso-2022-gbk":"gbk","iso-2022-58":"gb2312",gbk:"gbk"},nb={"0020000D":"studyInstanceUid","0020000E":"seriesInstanceUid","00080018":"sopInstanceUid","00020010":"transferSyntaxUid","00083002":"availableTransferSyntaxUid","00080201":"timezoneOffsetFromUtc","00080005":"specificCharacterSet","00280008":"numberOfFrames","00280010":"rows","00280011":"columns","00280002":"samplesPerPixel","00280100":"bitsAllocated","00280103":"pixelRepresentation"},nk=new Set(["0020000D","0020000E","00080018","00020010","00083002","00080201","00080005","00280008","00280010","00280011","00280002","00280100","00280103"]),nL=new Set(["AE","AS","AT","CS","DA","DS","DT","FL","FD","IS","LO","LT","OB","OD","OF","OL","OV","OW","PN","SH","SL","SQ","SS","ST","SV","TM","UC","UI","UL","UN","UR","US","UT","UV"]),nq=Object.freeze({__proto__:null,BULKDATA_VRS:new Set(["DS","FL","FD","IS","LT","OB","OD","OF","OL","OV","OW","SL","SS","ST","SV","UC","UL","UN","US","UT","UV"]),DEFAULT_INFORMATION_TAGS:nk,DEFLATED_EXPLICIT_LITTLE_ENDIAN:nv,EXPLICIT_BIG_ENDIAN:nO,EXPLICIT_LITTLE_ENDIAN:ny,IMPLICIT_LITTLE_ENDIAN:nT,ITEM_DELIMITATION_LENGTH:0,PADDING_NULL:0,PADDING_SPACE:32,PN_COMPONENT_DELIMITER:61,SEQUENCE_DELIMITATION_VALUE:0,SEQUENCE_DELIMITER_TAG:0xfffee0dd,SEQUENCE_ITEM_TAG:0xfffee000,TAG_NAME_MAP:nb,TagHex:nU,UNDEFINED_LENGTH:0xffffffff,UNDEFINED_LENGTH_FIX:-1,VALID_VRS:nL,VM_DELIMITER:92,encodingMapping:n_,isVideoTransferSyntax:nF,unencapsulatedTransferSyntaxes:nN,videoTransferSyntaxUIDs:nG});function nV(A){var e=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(void 0==A)return e?[]:void 0;if("string"==typeof A||A instanceof String){var n=A.split("\\").filter(Boolean).map(function(A){var e=A.split("=");return L(L(L({},e[0]?{Alphabetic:e[0]}:{}),e[1]?{Ideographic:e[1]}:{}),e[2]?{Phonetic:e[2]}:{})});return e?n:n[0]}return!Array.isArray(A)&&e?[Object.assign({},A)]:A}function nx(A){return"string"==typeof A||A instanceof String?A:(Array.isArray(A)||(A=[A]),A.filter(Boolean).map(function(A){var e,n,t;return void 0===A||"string"==typeof A||A instanceof String?A:[null!=(e=A.Alphabetic)?e:"",null!=(n=A.Ideographic)?n:"",null!=(t=A.Phonetic)?t:""].join("=").replace(new RegExp("".concat("=","*$")),"")}).join("\\"))}var nH={pnObjectToString:nx,pnConvertToJsonObject:nV,pnAddValueAccessors:function(A){return A.__hasValueAccessors||(Object.defineProperty(A,"__hasValueAccessors",{value:!0}),Object.defineProperty(A,"toJSON",{value:function(){return Array.isArray(this)?this.filter(Boolean).map(function(A){return nV(A,!1)}):nV(this)}}),Object.defineProperty(A,"toString",{value:function(){return nx(A)}})),A}},nY={set:function(A,e,n){var t;if(["values","Value"].includes(e)&&A.vr&&nj.hasValueAccessors(A.vr))t=nj.createByTypeString(A.vr);else{if(!(e in l.nameMap&&nj.hasValueAccessors(l.nameMap[e].vr)))return A[e]=n,!0;t=nj.createByTypeString(l.nameMap[e].vr)}return A[e]=t.addValueAccessors(n),!0}};function nJ(A){return A.replace(/\s*$/g,"")}var nW=["FL","FD","SL","SS","UL","US","AT","UV"],nK=["OB","OW","OF","SQ","UC","UR","UT","UN","OD","UV"],nX=["SQ","OF","OW","OB","UN"],nj=function(){function A(e){J(this,A),this.type=e,this.multi=!1,this._isBinary=-1!=nW.indexOf(this.type),this._allowMultiple=!this._isBinary&&-1==nX.indexOf(this.type),this._isLength32=-1!=nK.indexOf(this.type),this._storeRaw=!0}return K(A,[{key:"isBinary",value:function(){return this._isBinary}},{key:"allowMultiple",value:function(){return this._allowMultiple}},{key:"isExplicit",value:function(){return this._isLength32}},{key:"isLength32",value:function(){return this._isLength32}},{key:"storeRaw",value:function(){return this._storeRaw}},{key:"addValueAccessors",value:function(A){return A}},{key:"dropPadByte",value:function(A){var e,n=null!=(e=this.maxLength)?e:this.maxCharLength;if(!Array.isArray(A)||!n||!this.padByte)return A;if(A.length>1){var t=String.fromCharCode(this.padByte),i=A.length-1,r=A[i];r.length%2!=0&&r.endsWith(t)&&(A[i]=r.substring(0,r.length-1))}return A}},{key:"read",value:function(A,e,n){var t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{forceStoreRaw:!1};if(this.fixed&&this.maxLength){if(!e)return{rawValue:this.defaultValue,value:this.defaultValue};this.maxLength!=e&&v.error("Invalid length for fixed length tag, vr "+this.type+", length "+this.maxLength+" != "+e)}var i=this.readBytes(A,e,n),r=this.applyFormatting(i);return this.storeRaw()||t.forceStoreRaw||(i=void 0),{rawValue:i,value:r}}},{key:"applyFormatting",value:function(A){return A}},{key:"readBytes",value:function(A,e){return A.readAsciiString(e)}},{key:"readPaddedAsciiString",value:function(A,e){if(!e)return"";if(A.peekUint8(e-1)!==this.padByte)return A.readAsciiString(e);var n=A.readAsciiString(e-1);return A.increment(1),n}},{key:"readPaddedEncodedString",value:function(A,e){if(!e)return"";var n=A.readEncodedString(e);return n.length&&n[n.length-1]!==String.fromCharCode(this.padByte)?n:n.slice(0,-1)}},{key:"write",value:function(A,e){var n=Array.from(arguments);if(null===n[2]||""===n[2]||void 0===n[2])return[A.writeAsciiString("")];var t=[],i=n.slice(2),r=A["write"+e];if(Array.isArray(i[0]))if(i[0].length<1)t.push(0);else{var a=this;i[0].forEach(function(e,n){a.allowMultiple()&&n>0&&A.writeUint8(92);var o=[e].concat(i.slice(1)),s=r.apply(A,o);t.push(s)})}else t.push(r.apply(A,i));return t}},{key:"writeBytes",value:function(A,e,n){for(var t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{allowInvalidVRLength:!1},i=t.allowInvalidVRLength,r=!0,a=Array.isArray(e)?e:[e],o=0,s=0;s4&&void 0!==arguments[4]?arguments[4]:{},s=o.fragmentMultiframe,c=void 0===s||s;if(n=null==n?[]:n,i){var u=n.length,l=[],E=0;for(r=0;r0){o=a/4;for(var c=0;c++0)(s=s.map(function(e){return e+A.offset})).push(A.size),i=Array.from({length:(r=s).length-1},function(A,e){return r.slice(e,e+2)}).map(function(e){for(var n=[],t=Ae(e,2),i=t[0],r=t[1],a=new nR(A.buffer,A.isLittleEndian,{start:i,stop:r,noCopy:A.noCopy}),o=0;!a.end();){var s=l(a);if(null===s)break;n.push(s),o+=s.byteLength}if(A.offset=a.offset,1===n.length)return n[0];if(a.noCopy)return n;var c=new ArrayBuffer(o),u=new Uint8Array(c);return n.reduce(function(A,e){return u.set(new Uint8Array(e),A),A+e.byteLength},0),c});else for(;!A.end();){var E=l(A);if(null===E)break;i.push(E)}}else throw Error("Item tag not found after undefined binary length");return i}}])}(nj),n0=function(A){function e(){var A;return J(this,e),(A=U(this,e,["AE"])).maxLength=16,A.padByte=32,A}return j(e,A),K(e,[{key:"readBytes",value:function(A,e){return A.readAsciiString(e)}},{key:"applyFormatting",value:function(A){return A.trim()}}])}(nz),n1=function(A){function e(){var A;return J(this,e),(A=U(this,e,["CS"])).maxLength=16,A.padByte=32,A}return j(e,A),K(e,[{key:"readBytes",value:function(A,e){return this.dropPadByte(A.readAsciiString(e).split("\\"))}},{key:"applyFormatting",value:function(A){var e=function(A){return A.trim()};return Array.isArray(A)?A.map(function(A){return e(A)}):e(A)}}])}(nz),n2=function(A){function e(){var A;return J(this,e),(A=U(this,e,["AS"])).maxLength=4,A.padByte=32,A.fixed=!0,A.defaultValue="",A}return j(e,A),K(e)}(nz),n9=function(A){function e(){var A;return J(this,e),(A=U(this,e,["AT"])).maxLength=4,A.valueLength=4,A.padByte=0,A.fixed=!0,A}return j(e,A),K(e,[{key:"readBytes",value:function(A){return u.readTag(A).value}},{key:"writeBytes",value:function(A,n,t){return AA(z(e.prototype),"writeBytes",this).call(this,A,n,AA(z(e.prototype),"write",this).call(this,A,"TwoUint16s",n),t)}}])}(nj),n4=function(A){function e(A){var n;return J(this,e),(n=U(this,e,["DA",A])).maxLength=8,n.rangeMatchingMaxLength=18,n.padByte=32,n.defaultValue="",n}return j(e,A),K(e,[{key:"checkLength",value:function(A){if("string"==typeof A||A instanceof String){var e=A.includes("-");return A.length<=(e?this.rangeMatchingMaxLength:this.maxLength)}return!0}}])}(nz),n8=function(A){function e(){return J(this,e),U(this,e,arguments)}return j(e,A),K(e,[{key:"readBytes",value:function(A,e){var n=A.readAsciiString(e);return this.dropPadByte(n.split("\\"))}}])}(nz);function n3(A){var e=Number(A);return Number.isFinite(e)?e:null}var n5=function(A){function e(){var A;return J(this,e),(A=U(this,e,["DS"])).maxLength=16,A.padByte=32,A}return j(e,A),K(e,[{key:"applyFormatting",value:function(A){var e=function(A){if(null==A)return null;var e=String(A).trim().replace(/[^0-9.\\\-+e]/gi,"");return""===e?null:n3(e)};return Array.isArray(A)?A.map(e):e(A)}},{key:"convertToString",value:function(A){if(null===A)return"";if("string"==typeof A)return A;var e=String(A);if(e.length>this.maxLength){var n=+(A<0),t=Math.log10(Math.abs(A));if(t<-4||t>=14-n){var i=A.toExponential(16-n);return i.length<=16?i:A.toExponential(16-(i.length-16)-n)}var r=A.toFixed(16-n);return r.length<=16?r:A.toFixed(16-n-(r.length-16))}return e}},{key:"writeBytes",value:function(A,n,t){var i=this,r=Array.isArray(n)?n.map(function(A){return i.convertToString(A)}):[this.convertToString(n)];return AA(z(e.prototype),"writeBytes",this).call(this,A,r,t)}}])}(n8),n6=function(A){function e(){var A;return J(this,e),(A=U(this,e,["DT"])).maxLength=26,A.rangeMatchingMaxLength=54,A.padByte=32,A}return j(e,A),K(e,[{key:"checkLength",value:function(A){if("string"==typeof A||A instanceof String){var e=A.includes("-");return A.length<=(e?this.rangeMatchingMaxLength:this.maxLength)}return!0}}])}(nz),n7=function(A){function e(){var A;return J(this,e),(A=U(this,e,["FL"])).maxLength=4,A.padByte=0,A.fixed=!0,A.defaultValue=0,A}return j(e,A),K(e,[{key:"readBytes",value:function(A){return A.readFloat()}},{key:"applyFormatting",value:function(A){return Number(A)}},{key:"writeBytes",value:function(A,n,t){return AA(z(e.prototype),"writeBytes",this).call(this,A,n,AA(z(e.prototype),"write",this).call(this,A,"Float",n),t)}}])}(nj),tA=function(A){function e(){var A;return J(this,e),(A=U(this,e,["FD"])).maxLength=8,A.padByte=0,A.fixed=!0,A.defaultValue=0,A}return j(e,A),K(e,[{key:"readBytes",value:function(A){return A.readDouble()}},{key:"applyFormatting",value:function(A){return Number(A)}},{key:"writeBytes",value:function(A,n,t){return AA(z(e.prototype),"writeBytes",this).call(this,A,n,AA(z(e.prototype),"write",this).call(this,A,"Double",n),t)}}])}(nj),te=function(A){function e(){var A;return J(this,e),(A=U(this,e,["IS"])).maxLength=12,A.padByte=32,A}return j(e,A),K(e,[{key:"applyFormatting",value:function(A){var e=function(A){if(null==A)return null;var e=String(A).trim();return""!==e&&/^[+-]?\d+$/.test(e)?n3(e):null};return Array.isArray(A)?A.map(e):e(A)}},{key:"convertToString",value:function(A){return"string"==typeof A?A:null===A?"":String(A)}},{key:"writeBytes",value:function(A,n,t){var i=this,r=Array.isArray(n)?n.map(function(A){return i.convertToString(A)}):[this.convertToString(n)];return AA(z(e.prototype),"writeBytes",this).call(this,A,r,t)}}])}(n8),tn=function(A){function e(){var A;return J(this,e),(A=U(this,e,["LO"])).maxCharLength=64,A.padByte=32,A}return j(e,A),K(e,[{key:"readBytes",value:function(A,e){return A.readEncodedString(e)}},{key:"applyFormatting",value:function(A){return A.trim()}}])}(nZ),tt=function(A){function e(){var A;return J(this,e),(A=U(this,e,["LT"])).maxCharLength=10240,A.padByte=32,A}return j(e,A),K(e,[{key:"readBytes",value:function(A,e){return A.readEncodedString(e)}},{key:"applyFormatting",value:function(A){return nJ(A)}}])}(nZ),ti=function(A){function e(){var A;return J(this,e),(A=U(this,e,["PN"])).maxLength=null,A.padByte=32,A}return j(e,A),K(e,[{key:"addValueAccessors",value:function(A){if("string"==typeof A&&(A=new String(A)),void 0!=A)if("object"===x(A))return nH.pnAddValueAccessors(A);else throw Error("Cannot add accessors to non-string primitives");return A}},{key:"checkLength",value:function(A){if(Array.isArray(A)){var n,t=Ar(A);try{for(t.s();!(n=t.n()).done;){var i=n.value,r=Object.keys(i).forEach(function(e){return A[e]});if(!e.checkComponentLengths(r))return!1}}catch(A){t.e(A)}finally{t.f()}}else if("string"==typeof A||A instanceof String){var a,o=Ar(A.split("\\"));try{for(o.s();!(a=o.n()).done;){var s=a.value.split("=");if(!e.checkComponentLengths(s))return!1}}catch(A){o.e(A)}finally{o.f()}}return!0}},{key:"readBytes",value:function(A,e){return this.readPaddedEncodedString(A,e)}},{key:"applyFormatting",value:function(A){var e=function(A){return nH.pnConvertToJsonObject(A)};return Array.isArray(A)?A.map(function(A){return e(A)}):e(A)}},{key:"writeBytes",value:function(A,n,t){return AA(z(e.prototype),"writeBytes",this).call(this,A,nH.pnObjectToString(n),t)}}],[{key:"checkComponentLengths",value:function(A){for(var e in A)if(A[e].length>64)return!1;return!0}}])}(nZ),tr=function(A){function e(){var A;return J(this,e),(A=U(this,e,["SH"])).maxCharLength=16,A.padByte=32,A}return j(e,A),K(e,[{key:"readBytes",value:function(A,e){return A.readEncodedString(e)}},{key:"applyFormatting",value:function(A){return A.trim()}}])}(nZ),ta=function(A){function e(){var A;return J(this,e),(A=U(this,e,["SL"])).maxLength=4,A.padByte=0,A.fixed=!0,A.defaultValue=0,A}return j(e,A),K(e,[{key:"readBytes",value:function(A){return A.readInt32()}},{key:"writeBytes",value:function(A,n,t){return AA(z(e.prototype),"writeBytes",this).call(this,A,n,AA(z(e.prototype),"write",this).call(this,A,"Int32",n),t)}}])}(nj),to=function(A){function e(){var A;return J(this,e),(A=U(this,e,["SQ"])).maxLength=null,A.padByte=0,A.noMultiple=!0,A._storeRaw=!1,A}return j(e,A),K(e,[{key:"readBytes",value:function(A,e,n){if(0==e)return[];for(var t=0xffffffff==e,i=[],r=0;;){var a=u.readTag(A),o=null;if(r+=4,a.is(0xfffee0dd)){A.readUint32();break}if(t||r!=e){if(a.is(0xfffee000)){o=A.readUint32(),r+=4;var s=null,l=0,E=0xffffffff==o;if(E)for(var S=0;;)if(65534==A.readUint16()){var g=A.readUint16(),I=A.readUint32();if(A.increment(-4),57357==g)if(0===I){if(--S<0){A.increment(4),r+=8;break}l+=4}else l+=2;else 57344==g?(l+=4,0xffffffff==I&&S++):(l+=2,A.increment(-2))}else l+=2;else l=o;if(l){A.increment(E?-l-8:0),s=A.more(l),r+=l,E&&A.increment(8);var d=c._read(s,n);i.push(d)}if(!t&&r==e)break}}else break}return i}},{key:"writeBytes",value:function(A,n,t,i){var r=0;if(n)for(var a=0;ar.maxLength)||r.noMultiple)return r.read(i,e,n,t);for(var a=[],o=[],s=e/r.maxLength,c=0;c++0&&void 0!==arguments[0]?arguments[0]:{allowInvalidVRLength:!1},e=new nP(4096,!0);e.writeUint8Repeat(0,128),e.writeAsciiString("DICM");var n=new nP(1024);this.meta[nU.TransferSyntaxUID]||(this.meta[nU.TransferSyntaxUID]={vr:"UI",Value:[tw]}),E.write(this.meta,n,tw,A),E.writeTagObject(e,nU.FileMetaInformationGroupLength,"UL",n.size,tw,A),e.concat(n);var t=this.meta[nU.TransferSyntaxUID].Value[0];return E.write(this.dict,e,t,A),e.getBuffer()}}],[{key:"setDicomMessageClass",value:function(A){E=A}}]),tQ=["UL","UI","SH","US","AE","AT","LO","LT","CS","IS","OB","up","SQ","DA","TM","DT","ST","PN","UR","UC","UT","UV","FD","DS","FL","AS","ox","OF","SL","SS","xs","lt","OW","OD","OL","UN","OV","SV","na"],tP=["1","1-n","1-8","2-n","1-3","1-2","3-3n","2","4","3","2-4","2-2n","6","16","9","1-32","1-99","3-n","6-n"],tT="CommandGroupLengthRETIRED_CommandLengthToEndAffectedSOPClassUIDRequestedSOPClassUIDRETIRED_CommandRecognitionCodeCommandFieldMessageIDMessageIDBeingRespondedToRETIRED_InitiatorRETIRED_ReceiverRETIRED_FindLocationMoveDestinationPriorityCommandDataSetTypeRETIRED_NumberOfMatchesRETIRED_ResponseSequenceNumberStatusOffendingElementErrorCommentErrorIDAffectedSOPInstanceUIDRequestedSOPInstanceUIDEventTypeIDAttributeIdentifierListActionTypeIDNumberOfRemainingSuboperationsNumberOfCompletedSuboperationsNumberOfFailedSuboperationsNumberOfWarningSuboperationsMoveOriginatorApplicationEntityTitleMoveOriginatorMessageIDRETIRED_DialogReceiverRETIRED_TerminalTypeRETIRED_MessageSetIDRETIRED_EndMessageIDRETIRED_DisplayFormatRETIRED_PagePositionIDRETIRED_TextFormatIDRETIRED_NormalReverseRETIRED_AddGrayScaleRETIRED_BordersRETIRED_CopiesRETIRED_CommandMagnificationTypeRETIRED_EraseRETIRED_PrintRETIRED_OverlaysFileMetaInformationGroupLengthFileMetaInformationVersionMediaStorageSOPClassUIDMediaStorageSOPInstanceUIDTransferSyntaxUIDImplementationClassUIDImplementationVersionNameSourceApplicationEntityTitleSendingApplicationEntityTitleReceivingApplicationEntityTitlePrivateInformationCreatorUIDPrivateInformationFileSetIDFileSetDescriptorFileIDSpecificCharacterSetOfFileSetDescriptorFileOffsetOfTheFirstDirectoryRecordOfTheRootDirectoryEntityOffsetOfTheLastDirectoryRecordOfTheRootDirectoryEntityFileSetConsistencyFlagDirectoryRecordSequenceOffsetOfTheNextDirectoryRecordRecordInUseFlagOffsetOfReferencedLowerLevelDirectoryEntityDirectoryRecordTypePrivateRecordUIDReferencedFileIDRETIRED_MRDRDirectoryRecordOffsetReferencedSOPClassUIDInFileReferencedSOPInstanceUIDInFileReferencedTransferSyntaxUIDInFileReferencedRelatedGeneralSOPClassUIDInFileRETIRED_NumberOfReferencesRETIRED_LengthToEndSpecificCharacterSetLanguageCodeSequenceImageTypeRETIRED_RecognitionCodeInstanceCreationDateInstanceCreationTimeInstanceCreatorUIDInstanceCoercionDateTimeSOPClassUIDAcquisitionUIDSOPInstanceUIDPyramidUIDRelatedGeneralSOPClassUIDOriginalSpecializedSOPClassUIDSyntheticDataStudyDateSeriesDateAcquisitionDateContentDateRETIRED_OverlayDateRETIRED_CurveDateAcquisitionDateTimeStudyTimeSeriesTimeAcquisitionTimeContentTimeRETIRED_OverlayTimeRETIRED_CurveTimeRETIRED_DataSetTypeRETIRED_DataSetSubtypeRETIRED_NuclearMedicineSeriesTypeAccessionNumberIssuerOfAccessionNumberSequenceQueryRetrieveLevelQueryRetrieveViewRetrieveAETitleStationAETitleInstanceAvailabilityFailedSOPInstanceUIDListModalityModalitiesInStudySOPClassesInStudyAnatomicRegionsInStudyCodeSequenceConversionTypePresentationIntentTypeManufacturerInstitutionNameInstitutionAddressInstitutionCodeSequenceReferringPhysicianNameReferringPhysicianAddressReferringPhysicianTelephoneNumbersReferringPhysicianIdentificationSequenceConsultingPhysicianNameConsultingPhysicianIdentificationSequenceCodeValueExtendedCodeValueCodingSchemeDesignatorCodingSchemeVersionCodeMeaningMappingResourceContextGroupVersionContextGroupLocalVersionExtendedCodeMeaningCodingSchemeResourcesSequenceCodingSchemeURLTypeContextGroupExtensionFlagCodingSchemeUIDContextGroupExtensionCreatorUIDCodingSchemeURLContextIdentifierCodingSchemeIdentificationSequenceCodingSchemeRegistryCodingSchemeExternalIDCodingSchemeNameCodingSchemeResponsibleOrganizationContextUIDMappingResourceUIDLongCodeValueURNCodeValueEquivalentCodeSequenceMappingResourceNameContextGroupIdentificationSequenceMappingResourceIdentificationSequenceTimezoneOffsetFromUTCResponsibleGroupCodeSequenceEquipmentModalityManufacturerRelatedModelGroupPrivateDataElementCharacteristicsSequencePrivateGroupReferencePrivateCreatorReferenceBlockIdentifyingInformationStatusNonidentifyingPrivateElementsDeidentificationActionSequenceIdentifyingPrivateElementsDeidentificationActionPrivateDataElementPrivateDataElementValueMultiplicityPrivateDataElementValueRepresentationPrivateDataElementNumberOfItemsPrivateDataElementNamePrivateDataElementKeywordPrivateDataElementDescriptionPrivateDataElementEncodingPrivateDataElementDefinitionSequenceScopeOfInventorySequenceInventoryPurposeInventoryInstanceDescriptionInventoryLevelItemInventoryDateTimeRemovedFromOperationalUseReasonForRemovalCodeSequenceStoredInstanceBaseURIFolderAccessURIFileAccessURIContainerFileTypeFilenameInContainerFileOffsetInContainerFileLengthInContainerStoredInstanceTransferSyntaxUIDExtendedMatchingMechanismsRangeMatchingSequenceListOfUIDMatchingSequenceEmptyValueMatchingSequenceGeneralMatchingSequenceRequestedStatusIntervalRetainInstancesExpirationDateTimeTransactionStatusTransactionStatusCommentFileSetAccessSequenceFileAccessSequenceRecordKeyPriorRecordKeyMetadataSequenceUpdatedMetadataSequenceStudyUpdateDateTimeInventoryAccessEndPointsSequenceStudyAccessEndPointsSequenceIncorporatedInventoryInstanceSequenceInventoriedStudiesSequenceInventoriedSeriesSequenceInventoriedInstancesSequenceInventoryCompletionStatusNumberOfStudyRecordsInInstanceTotalNumberOfStudyRecordsMaximumNumberOfRecordsRETIRED_NetworkIDStationNameStudyDescriptionProcedureCodeSequenceSeriesDescriptionSeriesDescriptionCodeSequenceInstitutionalDepartmentNameInstitutionalDepartmentTypeCodeSequencePhysiciansOfRecordPhysiciansOfRecordIdentificationSequencePerformingPhysicianNamePerformingPhysicianIdentificationSequenceNameOfPhysiciansReadingStudyPhysiciansReadingStudyIdentificationSequenceOperatorsNameOperatorIdentificationSequenceAdmittingDiagnosesDescriptionAdmittingDiagnosesCodeSequencePyramidDescriptionManufacturerModelNameRETIRED_ReferencedResultsSequenceReferencedStudySequenceReferencedPerformedProcedureStepSequenceReferencedInstancesBySOPClassSequenceReferencedSeriesSequenceReferencedPatientSequenceReferencedVisitSequenceRETIRED_ReferencedOverlaySequenceReferencedStereometricInstanceSequenceReferencedWaveformSequenceReferencedImageSequenceRETIRED_ReferencedCurveSequenceReferencedInstanceSequenceReferencedRealWorldValueMappingInstanceSequenceReferencedSOPClassUIDReferencedSOPInstanceUIDDefinitionSourceSequenceSOPClassesSupportedReferencedFrameNumberSimpleFrameListCalculatedFrameListTimeRangeFrameExtractionSequenceMultiFrameSourceSOPInstanceUIDRetrieveURLTransactionUIDWarningReasonFailureReasonFailedSOPSequenceReferencedSOPSequenceOtherFailuresSequenceFailedStudySequenceStudiesContainingOtherReferencedInstancesSequenceRelatedSeriesSequenceRETIRED_LossyImageCompressionRetiredDerivationDescriptionSourceImageSequenceStageNameStageNumberNumberOfStagesViewNameViewNumberNumberOfEventTimersNumberOfViewsInStageEventElapsedTimesEventTimerNamesEventTimerSequenceEventTimeOffsetEventCodeSequenceStartTrimStopTrimRecommendedDisplayFrameRateRETIRED_TransducerPositionRETIRED_TransducerOrientationRETIRED_AnatomicStructureAnatomicRegionSequenceAnatomicRegionModifierSequencePrimaryAnatomicStructureSequenceAnatomicStructureSpaceOrRegionSequencePrimaryAnatomicStructureModifierSequenceRETIRED_TransducerPositionSequenceRETIRED_TransducerPositionModifierSequenceRETIRED_TransducerOrientationSequenceRETIRED_TransducerOrientationModifierSequenceRETIRED_AnatomicStructureSpaceOrRegionCodeSequenceTrialRETIRED_AnatomicPortalOfEntranceCodeSequenceTrialRETIRED_AnatomicApproachDirectionCodeSequenceTrialRETIRED_AnatomicPerspectiveDescriptionTrialRETIRED_AnatomicPerspectiveCodeSequenceTrialRETIRED_AnatomicLocationOfExaminingInstrumentDescriptionTrialRETIRED_AnatomicLocationOfExaminingInstrumentCodeSequenceTrialRETIRED_AnatomicStructureSpaceOrRegionModifierCodeSequenceTrialRETIRED_OnAxisBackgroundAnatomicStructureCodeSequenceTrialAlternateRepresentationSequenceAvailableTransferSyntaxUIDIrradiationEventUIDSourceIrradiationEventSequenceRadiopharmaceuticalAdministrationEventUIDRETIRED_IdentifyingCommentsFrameTypeReferencedImageEvidenceSequenceReferencedRawDataSequenceCreatorVersionUIDDerivationImageSequenceSourceImageEvidenceSequencePixelPresentationVolumetricPropertiesVolumeBasedCalculationTechniqueComplexImageComponentAcquisitionContrastDerivationCodeSequenceReferencedPresentationStateSequenceReferencedOtherPlaneSequenceFrameDisplaySequenceRecommendedDisplayFrameRateInFloatSkipFrameRangeFlagPatientNamePatientIDIssuerOfPatientIDTypeOfPatientIDIssuerOfPatientIDQualifiersSequenceSourcePatientGroupIdentificationSequenceGroupOfPatientsIdentificationSequenceSubjectRelativePositionInImagePatientBirthDatePatientBirthTimePatientBirthDateInAlternativeCalendarPatientDeathDateInAlternativeCalendarPatientAlternativeCalendarPatientSexPatientInsurancePlanCodeSequencePatientPrimaryLanguageCodeSequencePatientPrimaryLanguageModifierCodeSequenceQualityControlSubjectQualityControlSubjectTypeCodeSequenceStrainDescriptionStrainNomenclatureStrainStockNumberStrainSourceRegistryCodeSequenceStrainStockSequenceStrainSourceStrainAdditionalInformationStrainCodeSequenceGeneticModificationsSequenceGeneticModificationsDescriptionGeneticModificationsNomenclatureGeneticModificationsCodeSequenceOtherPatientIDsOtherPatientNamesOtherPatientIDsSequencePatientBirthNamePatientAgePatientSizePatientSizeCodeSequencePatientBodyMassIndexMeasuredAPDimensionMeasuredLateralDimensionPatientWeightPatientAddressRETIRED_InsurancePlanIdentificationPatientMotherBirthNameMilitaryRankBranchOfServiceMedicalRecordLocatorReferencedPatientPhotoSequenceMedicalAlertsAllergiesCountryOfResidenceRegionOfResidencePatientTelephoneNumbersPatientTelecomInformationEthnicGroupEthnicGroupCodeSequenceOccupationSmokingStatusAdditionalPatientHistoryPregnancyStatusLastMenstrualDatePatientReligiousPreferencePatientSpeciesDescriptionPatientSpeciesCodeSequencePatientSexNeuteredAnatomicalOrientationTypePatientBreedDescriptionPatientBreedCodeSequenceBreedRegistrationSequenceBreedRegistrationNumberBreedRegistryCodeSequenceResponsiblePersonResponsiblePersonRoleResponsibleOrganizationPatientCommentsExaminedBodyThicknessClinicalTrialSponsorNameClinicalTrialProtocolIDClinicalTrialProtocolNameIssuerOfClinicalTrialProtocolIDOtherClinicalTrialProtocolIDsSequenceClinicalTrialSiteIDClinicalTrialSiteNameIssuerOfClinicalTrialSiteIDClinicalTrialSubjectIDIssuerOfClinicalTrialSubjectIDClinicalTrialSubjectReadingIDIssuerOfClinicalTrialSubjectReadingIDClinicalTrialTimePointIDClinicalTrialTimePointDescriptionLongitudinalTemporalOffsetFromEventLongitudinalTemporalEventTypeClinicalTrialTimePointTypeCodeSequenceIssuerOfClinicalTrialTimePointIDClinicalTrialCoordinatingCenterNamePatientIdentityRemovedDeidentificationMethodDeidentificationMethodCodeSequenceClinicalTrialSeriesIDClinicalTrialSeriesDescriptionIssuerOfClinicalTrialSeriesIDClinicalTrialProtocolEthicsCommitteeNameClinicalTrialProtocolEthicsCommitteeApprovalNumberConsentForClinicalTrialUseSequenceDistributionTypeConsentForDistributionFlagEthicsCommitteeApprovalEffectivenessStartDateEthicsCommitteeApprovalEffectivenessEndDateRETIRED_CADFileFormatRETIRED_ComponentReferenceSystemComponentManufacturingProcedureComponentManufacturerMaterialThicknessMaterialPipeDiameterMaterialIsolationDiameterMaterialGradeMaterialPropertiesDescriptionRETIRED_MaterialPropertiesFileFormatRetiredMaterialNotesComponentShapeCurvatureTypeOuterDiameterInnerDiameterComponentWelderIDsSecondaryApprovalStatusSecondaryReviewDateSecondaryReviewTimeSecondaryReviewerNameRepairIDMultipleComponentApprovalSequenceOtherApprovalStatusOtherSecondaryApprovalStatusDataElementLabelSequenceDataElementLabelItemSequenceDataElementDataElementNameDataElementDescriptionDataElementConditionalityDataElementMinimumCharactersDataElementMaximumCharactersActualEnvironmentalConditionsExpiryDateEnvironmentalConditionsEvaluatorSequenceEvaluatorNumberEvaluatorNameEvaluationAttemptIndicationSequenceIndicationNumberIndicationLabelIndicationDescriptionIndicationTypeIndicationDispositionIndicationROISequenceIndicationPhysicalPropertySequencePropertyLabelCoordinateSystemNumberOfAxesCoordinateSystemAxesSequenceCoordinateSystemAxisDescriptionCoordinateSystemDataSetMappingCoordinateSystemAxisNumberCoordinateSystemAxisTypeCoordinateSystemAxisUnitsCoordinateSystemAxisValuesCoordinateSystemTransformSequenceTransformDescriptionTransformNumberOfAxesTransformOrderOfAxesTransformedAxisUnitsCoordinateSystemTransformRotationAndScaleMatrixCoordinateSystemTransformTranslationMatrixInternalDetectorFrameTimeNumberOfFramesIntegratedDetectorTemperatureSequenceSensorNameHorizontalOffsetOfSensorVerticalOffsetOfSensorSensorTemperatureDarkCurrentSequenceDarkCurrentCountsGainCorrectionReferenceSequenceAirCountsKVUsedInGainCalibrationMAUsedInGainCalibrationNumberOfFramesUsedForIntegrationFilterMaterialUsedInGainCalibrationFilterThicknessUsedInGainCalibrationDateOfGainCalibrationTimeOfGainCalibrationBadPixelImageCalibrationNotesLinearityCorrectionTechniqueBeamHardeningCorrectionTechniquePulserEquipmentSequencePulserTypePulserNotesReceiverEquipmentSequenceAmplifierTypeReceiverNotesPreAmplifierEquipmentSequencePreAmplifierNotesTransmitTransducerSequenceReceiveTransducerSequenceNumberOfElementsElementShapeElementDimensionAElementDimensionBElementPitchAMeasuredBeamDimensionAMeasuredBeamDimensionBLocationOfMeasuredBeamDiameterNominalFrequencyMeasuredCenterFrequencyMeasuredBandwidthElementPitchBPulserSettingsSequencePulseWidthExcitationFrequencyModulationTypeDampingReceiverSettingsSequenceAcquiredSoundpathLengthAcquisitionCompressionTypeAcquisitionSampleSizeRectifierSmoothingDACSequenceDACTypeDACGainPointsDACTimePointsDACAmplitudePreAmplifierSettingsSequenceTransmitTransducerSettingsSequenceReceiveTransducerSettingsSequenceIncidentAngleCouplingTechniqueCouplingMediumCouplingVelocityProbeCenterLocationXProbeCenterLocationZSoundPathLengthDelayLawIdentifierGateSettingsSequenceGateThresholdVelocityOfSoundCalibrationSettingsSequenceCalibrationProcedureProcedureVersionProcedureCreationDateProcedureExpirationDateProcedureLastModifiedDateCalibrationTimeCalibrationDateProbeDriveEquipmentSequenceDriveTypeProbeDriveNotesDriveProbeSequenceProbeInductanceProbeResistanceReceiveProbeSequenceProbeDriveSettingsSequenceBridgeResistorsProbeOrientationAngleUserSelectedGainYUserSelectedPhaseUserSelectedOffsetXUserSelectedOffsetYChannelSettingsSequenceChannelThresholdScannerSettingsSequenceScanProcedureTranslationRateXTranslationRateYChannelOverlapImageQualityIndicatorTypeImageQualityIndicatorMaterialImageQualityIndicatorSizeLINACEnergyLINACOutputActiveApertureTotalApertureApertureElevationMainLobeAngleMainRoofAngleConnectorTypeWedgeModelNumberWedgeAngleFloatWedgeRoofAngleWedgeElement1PositionWedgeMaterialVelocityWedgeMaterialWedgeOffsetZWedgeOriginOffsetXWedgeTimeDelayWedgeNameWedgeManufacturerNameWedgeDescriptionNominalBeamAngleWedgeOffsetXWedgeOffsetYWedgeTotalLengthWedgeInContactLengthWedgeFrontGapWedgeTotalHeightWedgeFrontHeightWedgeRearHeightWedgeTotalWidthWedgeInContactWidthWedgeChamferHeightWedgeCurveRadiusAlongWedgeWhitePointPrimaryChromaticitiesBatteryLevelExposureTimeInSecondsFNumberOECFRowsOECFColumnsOECFColumnNamesOECFValuesSpatialFrequencyResponseRowsSpatialFrequencyResponseColumnsSpatialFrequencyResponseColumnNamesSpatialFrequencyResponseValuesColorFilterArrayPatternRowsColorFilterArrayPatternColumnsColorFilterArrayPatternValuesFlashFiringStatusFlashReturnStatusFlashModeFlashFunctionPresentFlashRedEyeModeExposureProgramSpectralSensitivityPhotographicSensitivitySelfTimerModeSensitivityTypeStandardOutputSensitivityRecommendedExposureIndexISOSpeedISOSpeedLatitudeyyyISOSpeedLatitudezzzEXIFVersionShutterSpeedValueApertureValueBrightnessValueExposureBiasValueMaxApertureValueSubjectDistanceMeteringModeLightSourceFocalLengthSubjectAreaMakerNoteTemperatureHumidityPressureWaterDepthAccelerationCameraElevationAngleFlashEnergySubjectLocationPhotographicExposureIndexSensingMethodFileSourceSceneTypeCustomRenderedExposureModeWhiteBalanceDigitalZoomRatioFocalLengthIn35mmFilmSceneCaptureTypeGainControlContrastSaturationSharpnessDeviceSettingDescriptionSubjectDistanceRangeCameraOwnerNameLensSpecificationLensMakeLensModelLensSerialNumberInteroperabilityIndexInteroperabilityVersionGPSVersionIDGPSLatitudeRefGPSLatitudeGPSLongitudeRefGPSLongitudeGPSAltitudeRefGPSAltitudeGPSTimeStampGPSSatellitesGPSStatusGPSMeasureModeGPSDOPGPSSpeedRefGPSSpeedGPSTrackRefGPSTrackGPSImgDirectionRefGPSImgDirectionGPSMapDatumGPSDestLatitudeRefGPSDestLatitudeGPSDestLongitudeRefGPSDestLongitudeGPSDestBearingRefGPSDestBearingGPSDestDistanceRefGPSDestDistanceGPSProcessingMethodGPSAreaInformationGPSDateStampGPSDifferentialLightSourcePolarizationEmitterColorTemperatureContactMethodImmersionMediaOpticalMagnificationFactorContrastBolusAgentContrastBolusAgentSequenceContrastBolusT1RelaxivityContrastBolusAdministrationRouteSequenceBodyPartExaminedScanningSequenceSequenceVariantScanOptionsMRAcquisitionTypeSequenceNameAngioFlagInterventionDrugInformationSequenceInterventionDrugStopTimeInterventionDrugDoseInterventionDrugCodeSequenceAdditionalDrugSequenceRETIRED_RadionuclideRadiopharmaceuticalRETIRED_EnergyWindowCenterlineRETIRED_EnergyWindowTotalWidthInterventionDrugNameInterventionDrugStartTimeInterventionSequenceRETIRED_TherapyTypeInterventionStatusRETIRED_TherapyDescriptionInterventionDescriptionCineRateInitialCineRunStateSliceThicknessKVPRETIRED_undefinedCountsAccumulatedAcquisitionTerminationConditionEffectiveDurationAcquisitionStartConditionAcquisitionStartConditionDataAcquisitionTerminationConditionDataRepetitionTimeEchoTimeInversionTimeNumberOfAveragesImagingFrequencyImagedNucleusEchoNumbersMagneticFieldStrengthSpacingBetweenSlicesNumberOfPhaseEncodingStepsDataCollectionDiameterEchoTrainLengthPercentSamplingPercentPhaseFieldOfViewPixelBandwidthDeviceSerialNumberDeviceUIDDeviceIDPlateIDGeneratorIDGridIDCassetteIDGantryIDUniqueDeviceIdentifierUDISequenceManufacturerDeviceClassUIDSecondaryCaptureDeviceIDRETIRED_HardcopyCreationDeviceIDDateOfSecondaryCaptureTimeOfSecondaryCaptureSecondaryCaptureDeviceManufacturerRETIRED_HardcopyDeviceManufacturerSecondaryCaptureDeviceManufacturerModelNameSecondaryCaptureDeviceSoftwareVersionsRETIRED_HardcopyDeviceSoftwareVersionRETIRED_HardcopyDeviceManufacturerModelNameSoftwareVersionsVideoImageFormatAcquiredDigitalImageFormatAcquiredProtocolNameContrastBolusRouteContrastBolusVolumeContrastBolusStartTimeContrastBolusStopTimeContrastBolusTotalDoseSyringeCountsContrastFlowRateContrastFlowDurationContrastBolusIngredientContrastBolusIngredientConcentrationSpatialResolutionTriggerTimeTriggerSourceOrTypeNominalIntervalFrameTimeCardiacFramingTypeFrameTimeVectorFrameDelayImageTriggerDelayMultiplexGroupTimeOffsetTriggerTimeOffsetSynchronizationTriggerSynchronizationChannelTriggerSamplePositionRadiopharmaceuticalRouteRadiopharmaceuticalVolumeRadiopharmaceuticalStartTimeRadiopharmaceuticalStopTimeRadionuclideTotalDoseRadionuclideHalfLifeRadionuclidePositronFractionRadiopharmaceuticalSpecificActivityRadiopharmaceuticalStartDateTimeRadiopharmaceuticalStopDateTimeBeatRejectionFlagLowRRValueHighRRValueIntervalsAcquiredIntervalsRejectedPVCRejectionSkipBeatsHeartRateCardiacNumberOfImagesTriggerWindowReconstructionDiameterDistanceSourceToDetectorDistanceSourceToPatientEstimatedRadiographicMagnificationFactorGantryDetectorTiltGantryDetectorSlewTableHeightTableTraverseTableMotionTableVerticalIncrementTableLateralIncrementTableLongitudinalIncrementTableAngleTableTypeRotationDirectionRETIRED_AngularPositionRadialPositionScanArcAngularStepCenterOfRotationOffsetRETIRED_RotationOffsetFieldOfViewShapeFieldOfViewDimensionsExposureTimeXRayTubeCurrentExposureExposureInuAsAveragePulseWidthRadiationSettingRectificationTypeRadiationModeImageAndFluoroscopyAreaDoseProductFilterTypeTypeOfFiltersIntensifierSizeImagerPixelSpacingGridGeneratorPowerCollimatorGridNameCollimatorTypeFocalDistanceXFocusCenterYFocusCenterFocalSpotsAnodeTargetMaterialBodyPartThicknessCompressionForceCompressionPressurePaddleDescriptionCompressionContactAreaAcquisitionModeDoseModeNameAcquiredSubtractionMaskFlagFluoroscopyPersistenceFlagFluoroscopyLastImageHoldPersistenceFlagUpperLimitNumberOfPersistentFluoroscopyFramesContrastBolusAutoInjectionTriggerFlagContrastBolusInjectionDelayXAAcquisitionPhaseDetailsSequenceXAAcquisitionFrameRateXAPlaneDetailsSequenceAcquisitionFieldOfViewLabelXRayFilterDetailsSequenceXAAcquisitionDurationReconstructionPipelineTypeImageFilterDetailsSequenceAppliedMaskSubtractionFlagRequestedSeriesDescriptionCodeSequenceDateOfLastCalibrationTimeOfLastCalibrationDateTimeOfLastCalibrationCalibrationDateTimeDateOfManufactureDateOfInstallationConvolutionKernelRETIRED_UpperLowerPixelValuesActualFrameDurationCountRatePreferredPlaybackSequencingReceiveCoilNameTransmitCoilNamePlateTypePhosphorTypeWaterEquivalentDiameterWaterEquivalentDiameterCalculationMethodCodeSequenceScanVelocityWholeBodyTechniqueScanLengthAcquisitionMatrixInPlanePhaseEncodingDirectionFlipAngleVariableFlipAngleFlagSARdBdtB1rmsAcquisitionDeviceProcessingDescriptionAcquisitionDeviceProcessingCodeCassetteOrientationCassetteSizeExposuresOnPlateRelativeXRayExposureExposureIndexTargetExposureIndexDeviationIndexColumnAngulationTomoLayerHeightTomoAngleTomoTimeTomoTypeTomoClassNumberOfTomosynthesisSourceImagesPositionerMotionPositionerTypePositionerPrimaryAnglePositionerSecondaryAnglePositionerPrimaryAngleIncrementPositionerSecondaryAngleIncrementDetectorPrimaryAngleDetectorSecondaryAngleShutterShapeShutterLeftVerticalEdgeShutterRightVerticalEdgeShutterUpperHorizontalEdgeShutterLowerHorizontalEdgeCenterOfCircularShutterRadiusOfCircularShutterVerticesOfThePolygonalShutterShutterPresentationValueShutterOverlayGroupShutterPresentationColorCIELabValueOutlineShapeTypeOutlineLeftVerticalEdgeOutlineRightVerticalEdgeOutlineUpperHorizontalEdgeOutlineLowerHorizontalEdgeCenterOfCircularOutlineDiameterOfCircularOutlineNumberOfPolygonalVerticesVerticesOfThePolygonalOutlineCollimatorShapeCollimatorLeftVerticalEdgeCollimatorRightVerticalEdgeCollimatorUpperHorizontalEdgeCollimatorLowerHorizontalEdgeCenterOfCircularCollimatorRadiusOfCircularCollimatorVerticesOfThePolygonalCollimatorAcquisitionTimeSynchronizedTimeSourceTimeDistributionProtocolNTPSourceAddressPageNumberVectorFrameLabelVectorFramePrimaryAngleVectorFrameSecondaryAngleVectorSliceLocationVectorDisplayWindowLabelVectorNominalScannedPixelSpacingDigitizingDeviceTransportDirectionRotationOfScannedFilmBiopsyTargetSequenceTargetUIDLocalizingCursorPositionCalculatedTargetPositionTargetLabelDisplayedZValueIVUSAcquisitionIVUSPullbackRateIVUSGatedRateIVUSPullbackStartFrameNumberIVUSPullbackStopFrameNumberLesionNumberRETIRED_AcquisitionCommentsOutputPowerTransducerDataTransducerIdentificationSequenceFocusDepthProcessingFunctionRETIRED_PostprocessingFunctionMechanicalIndexBoneThermalIndexCranialThermalIndexSoftTissueThermalIndexSoftTissueFocusThermalIndexSoftTissueSurfaceThermalIndexRETIRED_DynamicRangeRETIRED_TotalGainDepthOfScanFieldPatientPositionViewPositionProjectionEponymousNameCodeSequenceRETIRED_ImageTransformationMatrixRETIRED_ImageTranslationVectorSensitivitySequenceOfUltrasoundRegionsRegionSpatialFormatRegionDataTypeRegionFlagsRegionLocationMinX0RegionLocationMinY0RegionLocationMaxX1RegionLocationMaxY1ReferencePixelX0ReferencePixelY0PhysicalUnitsXDirectionPhysicalUnitsYDirectionReferencePixelPhysicalValueXReferencePixelPhysicalValueYPhysicalDeltaXPhysicalDeltaYTransducerFrequencyTransducerTypePulseRepetitionFrequencyDopplerCorrectionAngleSteeringAngleRETIRED_DopplerSampleVolumeXPositionRetiredDopplerSampleVolumeXPositionRETIRED_DopplerSampleVolumeYPositionRetiredDopplerSampleVolumeYPositionRETIRED_TMLinePositionX0RetiredTMLinePositionX0RETIRED_TMLinePositionY0RetiredTMLinePositionY0RETIRED_TMLinePositionX1RetiredTMLinePositionX1RETIRED_TMLinePositionY1RetiredTMLinePositionY1PixelComponentOrganizationPixelComponentMaskPixelComponentRangeStartPixelComponentRangeStopPixelComponentPhysicalUnitsPixelComponentDataTypeNumberOfTableBreakPointsTableOfXBreakPointsTableOfYBreakPointsNumberOfTableEntriesTableOfPixelValuesTableOfParameterValuesRWaveTimeVectorActiveImageAreaOverlayGroupDetectorConditionsNominalFlagDetectorTemperatureDetectorTypeDetectorConfigurationDetectorDescriptionDetectorModeDetectorIDDateOfLastDetectorCalibrationTimeOfLastDetectorCalibrationExposuresOnDetectorSinceLastCalibrationExposuresOnDetectorSinceManufacturedDetectorTimeSinceLastExposureDetectorActiveTimeDetectorActivationOffsetFromExposureDetectorBinningDetectorElementPhysicalSizeDetectorElementSpacingDetectorActiveShapeDetectorActiveDimensionsDetectorActiveOriginDetectorManufacturerNameDetectorManufacturerModelNameFieldOfViewOriginFieldOfViewRotationFieldOfViewHorizontalFlipPixelDataAreaOriginRelativeToFOVPixelDataAreaRotationAngleRelativeToFOVGridAbsorbingMaterialGridSpacingMaterialGridThicknessGridPitchGridAspectRatioGridPeriodGridFocalDistanceFilterMaterialFilterThicknessMinimumFilterThicknessMaximumFilterBeamPathLengthMinimumFilterBeamPathLengthMaximumExposureControlModeExposureControlModeDescriptionExposureStatusPhototimerSettingExposureTimeInuSXRayTubeCurrentInuAContentQualificationPulseSequenceNameMRImagingModifierSequenceEchoPulseSequenceInversionRecoveryFlowCompensationMultipleSpinEchoMultiPlanarExcitationPhaseContrastTimeOfFlightContrastSpoilingSteadyStatePulseSequenceEchoPlanarPulseSequenceTagAngleFirstAxisMagnetizationTransferT2PreparationBloodSignalNullingSaturationRecoverySpectrallySelectedSuppressionSpectrallySelectedExcitationSpatialPresaturationTaggingOversamplingPhaseTagSpacingFirstDimensionGeometryOfKSpaceTraversalSegmentedKSpaceTraversalRectilinearPhaseEncodeReorderingTagThicknessPartialFourierDirectionCardiacSynchronizationTechniqueReceiveCoilManufacturerNameMRReceiveCoilSequenceReceiveCoilTypeQuadratureReceiveCoilMultiCoilDefinitionSequenceMultiCoilConfigurationMultiCoilElementNameMultiCoilElementUsedMRTransmitCoilSequenceTransmitCoilManufacturerNameTransmitCoilTypeSpectralWidthChemicalShiftReferenceVolumeLocalizationTechniqueMRAcquisitionFrequencyEncodingStepsDecouplingDecoupledNucleusDecouplingFrequencyDecouplingMethodDecouplingChemicalShiftReferenceKSpaceFilteringTimeDomainFilteringNumberOfZeroFillsBaselineCorrectionParallelReductionFactorInPlaneCardiacRRIntervalSpecifiedAcquisitionDurationFrameAcquisitionDateTimeDiffusionDirectionalityDiffusionGradientDirectionSequenceParallelAcquisitionParallelAcquisitionTechniqueInversionTimesMetaboliteMapDescriptionPartialFourierEffectiveEchoTimeMetaboliteMapCodeSequenceChemicalShiftSequenceCardiacSignalSourceDiffusionBValueDiffusionGradientOrientationVelocityEncodingDirectionVelocityEncodingMinimumValueVelocityEncodingAcquisitionSequenceNumberOfKSpaceTrajectoriesCoverageOfKSpaceSpectroscopyAcquisitionPhaseRowsRETIRED_ParallelReductionFactorInPlaneRetiredTransmitterFrequencyResonantNucleusFrequencyCorrectionMRSpectroscopyFOVGeometrySequenceSlabThicknessSlabOrientationMidSlabPositionMRSpatialSaturationSequenceMRTimingAndRelatedParametersSequenceMREchoSequenceMRModifierSequenceMRDiffusionSequenceCardiacSynchronizationSequenceMRAveragesSequenceMRFOVGeometrySequenceVolumeLocalizationSequenceSpectroscopyAcquisitionDataColumnsDiffusionAnisotropyTypeFrameReferenceDateTimeMRMetaboliteMapSequenceParallelReductionFactorOutOfPlaneSpectroscopyAcquisitionOutOfPlanePhaseStepsRETIRED_BulkMotionStatusParallelReductionFactorSecondInPlaneCardiacBeatRejectionTechniqueRespiratoryMotionCompensationTechniqueRespiratorySignalSourceBulkMotionCompensationTechniqueBulkMotionSignalSourceApplicableSafetyStandardAgencyApplicableSafetyStandardDescriptionOperatingModeSequenceOperatingModeTypeOperatingModeSpecificAbsorptionRateDefinitionGradientOutputTypeSpecificAbsorptionRateValueGradientOutputFlowCompensationDirectionTaggingDelayRespiratoryMotionCompensationTechniqueDescriptionRespiratorySignalSourceIDRETIRED_ChemicalShiftMinimumIntegrationLimitInHzRETIRED_ChemicalShiftMaximumIntegrationLimitInHzMRVelocityEncodingSequenceFirstOrderPhaseCorrectionWaterReferencedPhaseCorrectionMRSpectroscopyAcquisitionTypeRespiratoryCyclePositionVelocityEncodingMaximumValueTagSpacingSecondDimensionTagAngleSecondAxisFrameAcquisitionDurationMRImageFrameTypeSequenceMRSpectroscopyFrameTypeSequenceMRAcquisitionPhaseEncodingStepsInPlaneMRAcquisitionPhaseEncodingStepsOutOfPlaneSpectroscopyAcquisitionPhaseColumnsCardiacCyclePositionSpecificAbsorptionRateSequenceRFEchoTrainLengthGradientEchoTrainLengthArterialSpinLabelingContrastMRArterialSpinLabelingSequenceASLTechniqueDescriptionASLSlabNumberASLSlabThicknessASLSlabOrientationASLMidSlabPositionASLContextASLPulseTrainDurationASLCrusherFlagASLCrusherFlowLimitASLCrusherDescriptionASLBolusCutoffFlagASLBolusCutoffTimingSequenceASLBolusCutoffTechniqueASLBolusCutoffDelayTimeASLSlabSequenceChemicalShiftMinimumIntegrationLimitInppmChemicalShiftMaximumIntegrationLimitInppmWaterReferenceAcquisitionEchoPeakPositionCTAcquisitionTypeSequenceAcquisitionTypeTubeAngleCTAcquisitionDetailsSequenceRevolutionTimeSingleCollimationWidthTotalCollimationWidthCTTableDynamicsSequenceTableSpeedTableFeedPerRotationSpiralPitchFactorCTGeometrySequenceDataCollectionCenterPatientCTReconstructionSequenceReconstructionAlgorithmConvolutionKernelGroupReconstructionFieldOfViewReconstructionTargetCenterPatientReconstructionAngleImageFilterCTExposureSequenceReconstructionPixelSpacingExposureModulationTypeEstimatedDoseSavingCTXRayDetailsSequenceCTPositionSequenceTablePositionExposureTimeInmsCTImageFrameTypeSequenceXRayTubeCurrentInmAExposureInmAsConstantVolumeFlagFluoroscopyFlagDistanceSourceToDataCollectionCenterContrastBolusAgentNumberContrastBolusIngredientCodeSequenceContrastAdministrationProfileSequenceContrastBolusUsageSequenceContrastBolusAgentAdministeredContrastBolusAgentDetectedContrastBolusAgentPhaseCTDIvolCTDIPhantomTypeCodeSequenceCalciumScoringMassFactorPatientCalciumScoringMassFactorDeviceEnergyWeightingFactorCTAdditionalXRaySourceSequenceMultienergyCTAcquisitionMultienergyCTAcquisitionSequenceMultienergyCTProcessingSequenceMultienergyCTCharacteristicsSequenceMultienergyCTXRaySourceSequenceXRaySourceIndexXRaySourceIDMultienergySourceTechniqueSourceStartDateTimeSourceEndDateTimeSwitchingPhaseNumberSwitchingPhaseNominalDurationSwitchingPhaseTransitionDurationEffectiveBinEnergyMultienergyCTXRayDetectorSequenceXRayDetectorIndexXRayDetectorIDMultienergyDetectorTypeXRayDetectorLabelNominalMaxEnergyNominalMinEnergyReferencedXRayDetectorIndexReferencedXRaySourceIndexReferencedPathIndexMultienergyCTPathSequenceMultienergyCTPathIndexMultienergyAcquisitionDescriptionMonoenergeticEnergyEquivalentMaterialCodeSequenceDecompositionMethodDecompositionDescriptionDecompositionAlgorithmIdentificationSequenceDecompositionMaterialSequenceMaterialAttenuationSequencePhotonEnergyXRayMassAttenuationCoefficientProjectionPixelCalibrationSequenceDistanceSourceToIsocenterDistanceObjectToTableTopObjectPixelSpacingInCenterOfBeamPositionerPositionSequenceTablePositionSequenceCollimatorShapeSequencePlanesInAcquisitionXAXRFFrameCharacteristicsSequenceFrameAcquisitionSequenceXRayReceptorTypeAcquisitionProtocolNameAcquisitionProtocolDescriptionContrastBolusIngredientOpaqueDistanceReceptorPlaneToDetectorHousingIntensifierActiveShapeIntensifierActiveDimensionsPhysicalDetectorSizePositionOfIsocenterProjectionFieldOfViewSequenceFieldOfViewDescriptionExposureControlSensingRegionsSequenceExposureControlSensingRegionShapeExposureControlSensingRegionLeftVerticalEdgeExposureControlSensingRegionRightVerticalEdgeExposureControlSensingRegionUpperHorizontalEdgeExposureControlSensingRegionLowerHorizontalEdgeCenterOfCircularExposureControlSensingRegionRadiusOfCircularExposureControlSensingRegionVerticesOfThePolygonalExposureControlSensingRegionColumnAngulationPatientBeamAngleFrameDetectorParametersSequenceCalculatedAnatomyThicknessCalibrationSequenceObjectThicknessSequencePlaneIdentificationFieldOfViewDimensionsInFloatIsocenterReferenceSystemSequencePositionerIsocenterPrimaryAnglePositionerIsocenterSecondaryAnglePositionerIsocenterDetectorRotationAngleTableXPositionToIsocenterTableYPositionToIsocenterTableZPositionToIsocenterTableHorizontalRotationAngleTableHeadTiltAngleTableCradleTiltAngleFrameDisplayShutterSequenceAcquiredImageAreaDoseProductCArmPositionerTabletopRelationshipXRayGeometrySequenceIrradiationEventIdentificationSequenceXRay3DFrameTypeSequenceContributingSourcesSequenceXRay3DAcquisitionSequencePrimaryPositionerScanArcSecondaryPositionerScanArcPrimaryPositionerScanStartAngleSecondaryPositionerScanStartAnglePrimaryPositionerIncrementSecondaryPositionerIncrementStartAcquisitionDateTimeEndAcquisitionDateTimePrimaryPositionerIncrementSignSecondaryPositionerIncrementSignApplicationNameApplicationVersionApplicationManufacturerAlgorithmTypeAlgorithmDescriptionXRay3DReconstructionSequenceReconstructionDescriptionPerProjectionAcquisitionSequenceDetectorPositionSequenceXRayAcquisitionDoseSequenceXRaySourceIsocenterPrimaryAngleXRaySourceIsocenterSecondaryAngleBreastSupportIsocenterPrimaryAngleBreastSupportIsocenterSecondaryAngleBreastSupportXPositionToIsocenterBreastSupportYPositionToIsocenterBreastSupportZPositionToIsocenterDetectorIsocenterPrimaryAngleDetectorIsocenterSecondaryAngleDetectorXPositionToIsocenterDetectorYPositionToIsocenterDetectorZPositionToIsocenterXRayGridSequenceXRayFilterSequenceDetectorActiveAreaTLHCPositionDetectorActiveAreaOrientationPositionerPrimaryAngleDirectionDiffusionBMatrixSequenceDiffusionBValueXXDiffusionBValueXYDiffusionBValueXZDiffusionBValueYYDiffusionBValueYZDiffusionBValueZZFunctionalMRSequenceFunctionalSettlingPhaseFramesPresentFunctionalSyncPulseSettlingPhaseFrameDecayCorrectionDateTimeStartDensityThresholdStartRelativeDensityDifferenceThresholdStartCardiacTriggerCountThresholdStartRespiratoryTriggerCountThresholdTerminationCountsThresholdTerminationDensityThresholdTerminationRelativeDensityThresholdTerminationTimeThresholdTerminationCardiacTriggerCountThresholdTerminationRespiratoryTriggerCountThresholdDetectorGeometryTransverseDetectorSeparationAxialDetectorDimensionRadiopharmaceuticalAgentNumberPETFrameAcquisitionSequencePETDetectorMotionDetailsSequencePETTableDynamicsSequencePETPositionSequencePETFrameCorrectionFactorsSequenceRadiopharmaceuticalUsageSequenceAttenuationCorrectionSourceNumberOfIterationsNumberOfSubsetsPETReconstructionSequencePETFrameTypeSequenceTimeOfFlightInformationUsedReconstructionTypeDecayCorrectedAttenuationCorrectedScatterCorrectedDeadTimeCorrectedGantryMotionCorrectedPatientMotionCorrectedCountLossNormalizationCorrectedRandomsCorrectedNonUniformRadialSamplingCorrectedSensitivityCalibratedDetectorNormalizationCorrectionIterativeReconstructionMethodAttenuationCorrectionTemporalRelationshipPatientPhysiologicalStateSequencePatientPhysiologicalStateCodeSequenceDepthsOfFocusExcludedIntervalsSequenceExclusionStartDateTimeExclusionDurationUSImageDescriptionSequenceImageDataTypeSequenceDataTypeTransducerScanPatternCodeSequenceAliasedDataTypePositionMeasuringDeviceUsedTransducerGeometryCodeSequenceTransducerBeamSteeringCodeSequenceTransducerApplicationCodeSequenceZeroVelocityPixelValuePhotoacousticExcitationCharacteristicsSequenceExcitationSpectralWidthExcitationEnergyExcitationPulseDurationExcitationWavelengthSequenceExcitationWavelengthIlluminationTranslationFlagAcousticCouplingMediumFlagAcousticCouplingMediumCodeSequenceAcousticCouplingMediumTemperatureTransducerResponseSequenceCenterFrequencyFractionalBandwidthLowerCutoffFrequencyUpperCutoffFrequencyTransducerTechnologySequenceSoundSpeedCorrectionMechanismCodeSequenceObjectSoundSpeedAcousticCouplingMediumSoundSpeedPhotoacousticImageFrameTypeSequenceImageDataTypeCodeSequenceReferenceLocationLabelReferenceLocationDescriptionReferenceBasisCodeSequenceReferenceGeometryCodeSequenceOffsetDistanceOffsetDirectionPotentialScheduledProtocolCodeSequencePotentialRequestedProcedureCodeSequencePotentialReasonsForProcedurePotentialReasonsForProcedureCodeSequencePotentialDiagnosticTasksContraindicationsCodeSequenceReferencedDefinedProtocolSequenceReferencedPerformedProtocolSequencePredecessorProtocolSequenceProtocolPlanningInformationProtocolDesignRationalePatientSpecificationSequenceModelSpecificationSequenceParametersSpecificationSequenceInstructionSequenceInstructionIndexInstructionTextInstructionDescriptionInstructionPerformedFlagInstructionPerformedDateTimeInstructionPerformanceCommentPatientPositioningInstructionSequencePositioningMethodCodeSequencePositioningLandmarkSequenceTargetFrameOfReferenceUIDAcquisitionProtocolElementSpecificationSequenceAcquisitionProtocolElementSequenceProtocolElementNumberProtocolElementNameProtocolElementCharacteristicsSummaryProtocolElementPurposeAcquisitionMotionAcquisitionStartLocationSequenceAcquisitionEndLocationSequenceReconstructionProtocolElementSpecificationSequenceReconstructionProtocolElementSequenceStorageProtocolElementSpecificationSequenceStorageProtocolElementSequenceRequestedSeriesDescriptionSourceAcquisitionProtocolElementNumberSourceAcquisitionBeamNumberSourceReconstructionProtocolElementNumberReconstructionStartLocationSequenceReconstructionEndLocationSequenceReconstructionAlgorithmSequenceReconstructionTargetCenterLocationSequenceImageFilterDescriptionCTDIvolNotificationTriggerDLPNotificationTriggerAutoKVPSelectionTypeAutoKVPUpperBoundAutoKVPLowerBoundProtocolDefinedPatientPositionContributingEquipmentSequenceContributionDateTimeContributionDescriptionStudyInstanceUIDSeriesInstanceUIDStudyIDSeriesNumberAcquisitionNumberInstanceNumberRETIRED_IsotopeNumberRETIRED_PhaseNumberRETIRED_IntervalNumberRETIRED_TimeSlotNumberRETIRED_AngleNumberItemNumberPatientOrientationRETIRED_OverlayNumberRETIRED_CurveNumberRETIRED_LUTNumberPyramidLabelRETIRED_ImagePositionImagePositionPatientRETIRED_ImageOrientationImageOrientationPatientRETIRED_LocationFrameOfReferenceUIDLateralityImageLateralityRETIRED_ImageGeometryTypeRETIRED_MaskingImageRETIRED_ReportNumberTemporalPositionIdentifierNumberOfTemporalPositionsTemporalResolutionSynchronizationFrameOfReferenceUIDSOPInstanceUIDOfConcatenationSourceRETIRED_SeriesInStudyRETIRED_AcquisitionsInSeriesImagesInAcquisitionRETIRED_ImagesInSeriesRETIRED_AcquisitionsInStudyRETIRED_ImagesInStudyRETIRED_ReferenceTargetPositionReferenceIndicatorPositionReferenceIndicatorSliceLocationRETIRED_OtherStudyNumbersNumberOfPatientRelatedStudiesNumberOfPatientRelatedSeriesNumberOfPatientRelatedInstancesNumberOfStudyRelatedSeriesNumberOfStudyRelatedInstancesNumberOfSeriesRelatedInstancesRETIRED_ModifyingDeviceIDRETIRED_ModifiedImageIDRETIRED_ModifiedImageDateRETIRED_ModifyingDeviceManufacturerRETIRED_ModifiedImageTimeRETIRED_ModifiedImageDescriptionImageCommentsRETIRED_OriginalImageIdentificationRETIRED_OriginalImageIdentificationNomenclatureStackIDInStackPositionNumberFrameAnatomySequenceFrameLateralityFrameContentSequencePlanePositionSequencePlaneOrientationSequenceTemporalPositionIndexNominalCardiacTriggerDelayTimeNominalCardiacTriggerTimePriorToRPeakActualCardiacTriggerTimePriorToRPeakFrameAcquisitionNumberDimensionIndexValuesFrameCommentsConcatenationUIDInConcatenationNumberInConcatenationTotalNumberDimensionOrganizationUIDDimensionIndexPointerFunctionalGroupPointerUnassignedSharedConvertedAttributesSequenceUnassignedPerFrameConvertedAttributesSequenceConversionSourceAttributesSequenceDimensionIndexPrivateCreatorDimensionOrganizationSequenceDimensionIndexSequenceConcatenationFrameOffsetNumberFunctionalGroupPrivateCreatorNominalPercentageOfCardiacPhaseNominalPercentageOfRespiratoryPhaseStartingRespiratoryAmplitudeStartingRespiratoryPhaseEndingRespiratoryAmplitudeEndingRespiratoryPhaseRespiratoryTriggerTypeRRIntervalTimeNominalActualCardiacTriggerDelayTimeRespiratorySynchronizationSequenceRespiratoryIntervalTimeNominalRespiratoryTriggerDelayTimeRespiratoryTriggerDelayThresholdActualRespiratoryTriggerDelayTimeImagePositionVolumeImageOrientationVolumeUltrasoundAcquisitionGeometryApexPositionVolumeToTransducerMappingMatrixVolumeToTableMappingMatrixVolumeToTransducerRelationshipPatientFrameOfReferenceSourceTemporalPositionTimeOffsetPlanePositionVolumeSequencePlaneOrientationVolumeSequenceTemporalPositionSequenceDimensionOrganizationTypeVolumeFrameOfReferenceUIDTableFrameOfReferenceUIDDimensionDescriptionLabelPatientOrientationInFrameSequenceFrameLabelAcquisitionIndexContributingSOPInstancesReferenceSequenceReconstructionIndexLightPathFilterPassThroughWavelengthLightPathFilterPassBandImagePathFilterPassThroughWavelengthImagePathFilterPassBandPatientEyeMovementCommandedPatientEyeMovementCommandCodeSequenceSphericalLensPowerCylinderLensPowerCylinderAxisEmmetropicMagnificationIntraOcularPressureHorizontalFieldOfViewPupilDilatedDegreeOfDilationVertexDistanceStereoBaselineAngleStereoBaselineDisplacementStereoHorizontalPixelOffsetStereoVerticalPixelOffsetStereoRotationAcquisitionDeviceTypeCodeSequenceIlluminationTypeCodeSequenceLightPathFilterTypeStackCodeSequenceImagePathFilterTypeStackCodeSequenceLensesCodeSequenceChannelDescriptionCodeSequenceRefractiveStateSequenceMydriaticAgentCodeSequenceRelativeImagePositionCodeSequenceCameraAngleOfViewStereoPairsSequenceLeftImageSequenceRightImageSequenceStereoPairsPresentAxialLengthOfTheEyeOphthalmicFrameLocationSequenceReferenceCoordinatesDepthSpatialResolutionMaximumDepthDistortionAlongScanSpatialResolutionMaximumAlongScanDistortionOphthalmicImageOrientationDepthOfTransverseImageMydriaticAgentConcentrationUnitsSequenceAcrossScanSpatialResolutionMaximumAcrossScanDistortionMydriaticAgentConcentrationIlluminationWaveLengthIlluminationPowerIlluminationBandwidthMydriaticAgentSequenceOphthalmicAxialMeasurementsRightEyeSequenceOphthalmicAxialMeasurementsLeftEyeSequenceOphthalmicAxialMeasurementsDeviceTypeOphthalmicAxialLengthMeasurementsTypeOphthalmicAxialLengthSequenceOphthalmicAxialLengthLensStatusCodeSequenceVitreousStatusCodeSequenceIOLFormulaCodeSequenceIOLFormulaDetailKeratometerIndexSourceOfOphthalmicAxialLengthCodeSequenceSourceOfCornealSizeDataCodeSequenceTargetRefractionRefractiveProcedureOccurredRefractiveSurgeryTypeCodeSequenceOphthalmicUltrasoundMethodCodeSequenceSurgicallyInducedAstigmatismSequenceTypeOfOpticalCorrectionToricIOLPowerSequencePredictedToricErrorSequencePreSelectedForImplantationToricIOLPowerForExactEmmetropiaSequenceToricIOLPowerForExactTargetRefractionSequenceOphthalmicAxialLengthMeasurementsSequenceIOLPowerPredictedRefractiveErrorOphthalmicAxialLengthVelocityLensStatusDescriptionVitreousStatusDescriptionIOLPowerSequenceLensConstantSequenceIOLManufacturerRETIRED_LensConstantDescriptionImplantNameKeratometryMeasurementTypeCodeSequenceImplantPartNumberReferencedOphthalmicAxialMeasurementsSequenceOphthalmicAxialLengthMeasurementsSegmentNameCodeSequenceRefractiveErrorBeforeRefractiveSurgeryCodeSequenceIOLPowerForExactEmmetropiaIOLPowerForExactTargetRefractionAnteriorChamberDepthDefinitionCodeSequenceLensThicknessSequenceAnteriorChamberDepthSequenceCalculationCommentSequenceCalculationCommentTypeCalculationCommentLensThicknessAnteriorChamberDepthSourceOfLensThicknessDataCodeSequenceSourceOfAnteriorChamberDepthDataCodeSequenceSourceOfRefractiveMeasurementsSequenceSourceOfRefractiveMeasurementsCodeSequenceOphthalmicAxialLengthMeasurementModifiedOphthalmicAxialLengthDataSourceCodeSequenceRETIRED_OphthalmicAxialLengthAcquisitionMethodCodeSequenceSignalToNoiseRatioOphthalmicAxialLengthDataSourceDescriptionOphthalmicAxialLengthMeasurementsTotalLengthSequenceOphthalmicAxialLengthMeasurementsSegmentalLengthSequenceOphthalmicAxialLengthMeasurementsLengthSummationSequenceUltrasoundOphthalmicAxialLengthMeasurementsSequenceOpticalOphthalmicAxialLengthMeasurementsSequenceUltrasoundSelectedOphthalmicAxialLengthSequenceOphthalmicAxialLengthSelectionMethodCodeSequenceOpticalSelectedOphthalmicAxialLengthSequenceSelectedSegmentalOphthalmicAxialLengthSequenceSelectedTotalOphthalmicAxialLengthSequenceOphthalmicAxialLengthQualityMetricSequenceRETIRED_OphthalmicAxialLengthQualityMetricTypeCodeSequenceRETIRED_OphthalmicAxialLengthQualityMetricTypeDescriptionIntraocularLensCalculationsRightEyeSequenceIntraocularLensCalculationsLeftEyeSequenceReferencedOphthalmicAxialLengthMeasurementQCImageSequenceOphthalmicMappingDeviceTypeAcquisitionMethodCodeSequenceAcquisitionMethodAlgorithmSequenceOphthalmicThicknessMapTypeCodeSequenceOphthalmicThicknessMappingNormalsSequenceRetinalThicknessDefinitionCodeSequencePixelValueMappingToCodedConceptSequenceMappedPixelValuePixelValueMappingExplanationOphthalmicThicknessMapQualityThresholdSequenceOphthalmicThicknessMapThresholdQualityRatingAnatomicStructureReferencePointRegistrationToLocalizerSequenceRegisteredLocalizerUnitsRegisteredLocalizerTopLeftHandCornerRegisteredLocalizerBottomRightHandCornerOphthalmicThicknessMapQualityRatingSequenceRelevantOPTAttributesSequenceTransformationMethodCodeSequenceTransformationAlgorithmSequenceOphthalmicAxialLengthMethodOphthalmicFOVTwoDimensionalToThreeDimensionalMapSequenceWideFieldOphthalmicPhotographyQualityRatingSequenceWideFieldOphthalmicPhotographyQualityThresholdSequenceWideFieldOphthalmicPhotographyThresholdQualityRatingXCoordinatesCenterPixelViewAngleYCoordinatesCenterPixelViewAngleNumberOfMapPointsTwoDimensionalToThreeDimensionalMapDataDerivationAlgorithmSequenceOphthalmicImageTypeCodeSequenceOphthalmicImageTypeDescriptionScanPatternTypeCodeSequenceReferencedSurfaceMeshIdentificationSequenceOphthalmicVolumetricPropertiesFlagOphthalmicAnatomicReferencePointXCoordinateOphthalmicAnatomicReferencePointYCoordinateOphthalmicEnFaceImageQualityRatingSequenceQualityThresholdOCTBscanAnalysisAcquisitionParametersSequenceNumberofBscansPerFrameBscanSlabThicknessDistanceBetweenBscanSlabsBscanCycleTimeBscanCycleTimeVectorAscanRateBscanRateSurfaceMeshZPixelOffsetVisualFieldHorizontalExtentVisualFieldVerticalExtentVisualFieldShapeScreeningTestModeCodeSequenceMaximumStimulusLuminanceBackgroundLuminanceStimulusColorCodeSequenceBackgroundIlluminationColorCodeSequenceStimulusAreaStimulusPresentationTimeFixationSequenceFixationMonitoringCodeSequenceVisualFieldCatchTrialSequenceFixationCheckedQuantityPatientNotProperlyFixatedQuantityPresentedVisualStimuliDataFlagNumberOfVisualStimuliExcessiveFixationLossesDataFlagExcessiveFixationLossesStimuliRetestingQuantityCommentsOnPatientPerformanceOfVisualFieldFalseNegativesEstimateFlagFalseNegativesEstimateNegativeCatchTrialsQuantityFalseNegativesQuantityExcessiveFalseNegativesDataFlagExcessiveFalseNegativesFalsePositivesEstimateFlagFalsePositivesEstimateCatchTrialsDataFlagPositiveCatchTrialsQuantityTestPointNormalsDataFlagTestPointNormalsSequenceGlobalDeviationProbabilityNormalsFlagFalsePositivesQuantityExcessiveFalsePositivesDataFlagExcessiveFalsePositivesVisualFieldTestNormalsFlagResultsNormalsSequenceAgeCorrectedSensitivityDeviationAlgorithmSequenceGlobalDeviationFromNormalGeneralizedDefectSensitivityDeviationAlgorithmSequenceLocalizedDeviationFromNormalPatientReliabilityIndicatorVisualFieldMeanSensitivityGlobalDeviationProbabilityLocalDeviationProbabilityNormalsFlagLocalizedDeviationProbabilityShortTermFluctuationCalculatedShortTermFluctuationShortTermFluctuationProbabilityCalculatedShortTermFluctuationProbabilityCorrectedLocalizedDeviationFromNormalCalculatedCorrectedLocalizedDeviationFromNormalCorrectedLocalizedDeviationFromNormalProbabilityCalculatedCorrectedLocalizedDeviationFromNormalProbabilityGlobalDeviationProbabilitySequenceLocalizedDeviationProbabilitySequenceFovealSensitivityMeasuredFovealSensitivityVisualFieldTestDurationVisualFieldTestPointSequenceVisualFieldTestPointXCoordinateVisualFieldTestPointYCoordinateAgeCorrectedSensitivityDeviationValueStimulusResultsSensitivityValueRetestStimulusSeenRetestSensitivityValueVisualFieldTestPointNormalsSequenceQuantifiedDefectAgeCorrectedSensitivityDeviationProbabilityValueGeneralizedDefectCorrectedSensitivityDeviationFlagGeneralizedDefectCorrectedSensitivityDeviationValueGeneralizedDefectCorrectedSensitivityDeviationProbabilityValueMinimumSensitivityValueBlindSpotLocalizedBlindSpotXCoordinateBlindSpotYCoordinateVisualAcuityMeasurementSequenceRefractiveParametersUsedOnPatientSequenceMeasurementLateralityOphthalmicPatientClinicalInformationLeftEyeSequenceOphthalmicPatientClinicalInformationRightEyeSequenceFovealPointNormativeDataFlagFovealPointProbabilityValueScreeningBaselineMeasuredScreeningBaselineMeasuredSequenceScreeningBaselineTypeScreeningBaselineValueAlgorithmSourceDataSetNameDataSetVersionDataSetSourceDataSetDescriptionVisualFieldTestReliabilityGlobalIndexSequenceVisualFieldGlobalResultsIndexSequenceDataObservationSequenceIndexNormalsFlagIndexProbabilityIndexProbabilitySequenceSamplesPerPixelSamplesPerPixelUsedPhotometricInterpretationRETIRED_ImageDimensionsPlanarConfigurationNumberOfFramesFrameIncrementPointerFrameDimensionPointerRowsColumnsRETIRED_PlanesUltrasoundColorDataPresentPixelSpacingZoomFactorZoomCenterPixelAspectRatioRETIRED_ImageFormatRETIRED_ManipulatedImageCorrectedImageRETIRED_CompressionRecognitionCodeRETIRED_CompressionCodeRETIRED_CompressionOriginatorRETIRED_CompressionLabelRETIRED_CompressionDescriptionRETIRED_CompressionSequenceRETIRED_CompressionStepPointersRETIRED_RepeatIntervalRETIRED_BitsGroupedRETIRED_PerimeterTableRETIRED_PerimeterValueRETIRED_PredictorRowsRETIRED_PredictorColumnsRETIRED_PredictorConstantsRETIRED_BlockedPixelsRETIRED_BlockRowsRETIRED_BlockColumnsRETIRED_RowOverlapRETIRED_ColumnOverlapBitsAllocatedBitsStoredHighBitPixelRepresentationRETIRED_SmallestValidPixelValueRETIRED_LargestValidPixelValueSmallestImagePixelValueLargestImagePixelValueSmallestPixelValueInSeriesLargestPixelValueInSeriesRETIRED_SmallestImagePixelValueInPlaneRETIRED_LargestImagePixelValueInPlanePixelPaddingValuePixelPaddingRangeLimitFloatPixelPaddingValueDoubleFloatPixelPaddingValueFloatPixelPaddingRangeLimitDoubleFloatPixelPaddingRangeLimitRETIRED_ImageLocationQualityControlImageBurnedInAnnotationRecognizableVisualFeaturesLongitudinalTemporalInformationModifiedReferencedColorPaletteInstanceUIDRETIRED_TransformLabelRETIRED_TransformVersionNumberRETIRED_NumberOfTransformStepsRETIRED_SequenceOfCompressedDataRETIRED_DetailsOfCoefficientsRETIRED_RowsForNthOrderCoefficientsRETIRED_ColumnsForNthOrderCoefficientsRETIRED_CoefficientCodingRETIRED_CoefficientCodingPointersRETIRED_DCTLabelRETIRED_DataBlockDescriptionRETIRED_DataBlockRETIRED_NormalizationFactorFormatRETIRED_ZonalMapNumberFormatRETIRED_ZonalMapLocationRETIRED_ZonalMapFormatRETIRED_AdaptiveMapFormatRETIRED_CodeNumberFormatRETIRED_CodeLabelRETIRED_NumberOfTablesRETIRED_CodeTableLocationRETIRED_BitsForCodeWordRETIRED_ImageDataLocationPixelSpacingCalibrationTypePixelSpacingCalibrationDescriptionPixelIntensityRelationshipPixelIntensityRelationshipSignWindowCenterWindowWidthRescaleInterceptRescaleSlopeRescaleTypeWindowCenterWidthExplanationVOILUTFunctionRETIRED_GrayScaleRecommendedViewingModeRETIRED_GrayLookupTableDescriptorRedPaletteColorLookupTableDescriptorGreenPaletteColorLookupTableDescriptorBluePaletteColorLookupTableDescriptorAlphaPaletteColorLookupTableDescriptorRETIRED_LargeRedPaletteColorLookupTableDescriptorRETIRED_LargeGreenPaletteColorLookupTableDescriptorRETIRED_LargeBluePaletteColorLookupTableDescriptorPaletteColorLookupTableUIDRETIRED_GrayLookupTableDataRedPaletteColorLookupTableDataGreenPaletteColorLookupTableDataBluePaletteColorLookupTableDataAlphaPaletteColorLookupTableDataRETIRED_LargeRedPaletteColorLookupTableDataRETIRED_LargeGreenPaletteColorLookupTableDataRETIRED_LargeBluePaletteColorLookupTableDataRETIRED_LargePaletteColorLookupTableUIDSegmentedRedPaletteColorLookupTableDataSegmentedGreenPaletteColorLookupTableDataSegmentedBluePaletteColorLookupTableDataSegmentedAlphaPaletteColorLookupTableDataStoredValueColorRangeSequenceMinimumStoredValueMappedMaximumStoredValueMappedBreastImplantPresentPartialViewPartialViewDescriptionPartialViewCodeSequenceSpatialLocationsPreservedDataFrameAssignmentSequenceDataPathAssignmentBitsMappedToColorLookupTableBlendingLUT1SequenceBlendingLUT1TransferFunctionBlendingWeightConstantBlendingLookupTableDescriptorBlendingLookupTableDataEnhancedPaletteColorLookupTableSequenceBlendingLUT2SequenceBlendingLUT2TransferFunctionDataPathIDRGBLUTTransferFunctionAlphaLUTTransferFunctionICCProfileColorSpaceLossyImageCompressionLossyImageCompressionRatioLossyImageCompressionMethodModalityLUTSequenceVariableModalityLUTSequenceLUTDescriptorLUTExplanationModalityLUTTypeLUTDataVOILUTSequenceSoftcopyVOILUTSequenceRETIRED_ImagePresentationCommentsRETIRED_BiPlaneAcquisitionSequenceRepresentativeFrameNumberFrameNumbersOfInterestFrameOfInterestDescriptionFrameOfInterestTypeRETIRED_MaskPointersRWavePointerMaskSubtractionSequenceMaskOperationApplicableFrameRangeMaskFrameNumbersContrastFrameAveragingMaskSubPixelShiftTIDOffsetMaskOperationExplanationEquipmentAdministratorSequenceNumberOfDisplaySubsystemsCurrentConfigurationIDDisplaySubsystemIDDisplaySubsystemNameDisplaySubsystemDescriptionSystemStatusSystemStatusCommentTargetLuminanceCharacteristicsSequenceLuminanceCharacteristicsIDDisplaySubsystemConfigurationSequenceConfigurationIDConfigurationNameConfigurationDescriptionReferencedTargetLuminanceCharacteristicsIDQAResultsSequenceDisplaySubsystemQAResultsSequenceConfigurationQAResultsSequenceMeasurementEquipmentSequenceMeasurementFunctionsMeasurementEquipmentTypeVisualEvaluationResultSequenceDisplayCalibrationResultSequenceDDLValueCIExyWhitePointDisplayFunctionTypeGammaValueNumberOfLuminancePointsLuminanceResponseSequenceTargetMinimumLuminanceTargetMaximumLuminanceLuminanceValueLuminanceResponseDescriptionWhitePointFlagDisplayDeviceTypeCodeSequenceDisplaySubsystemSequenceLuminanceResultSequenceAmbientLightValueSourceMeasuredCharacteristicsLuminanceUniformityResultSequenceVisualEvaluationTestSequenceTestResultTestResultCommentTestImageValidationTestPatternCodeSequenceMeasurementPatternCodeSequenceVisualEvaluationMethodCodeSequencePixelDataProviderURLDataPointRowsDataPointColumnsSignalDomainColumnsRETIRED_LargestMonochromePixelValueDataRepresentationPixelMeasuresSequenceFrameVOILUTSequencePixelValueTransformationSequenceSignalDomainRowsDisplayFilterPercentageFramePixelShiftSequenceSubtractionItemIDPixelIntensityRelationshipLUTSequenceFramePixelDataPropertiesSequenceGeometricalPropertiesGeometricMaximumDistortionImageProcessingAppliedMaskSelectionModeLUTFunctionMaskVisibilityPercentagePixelShiftSequenceRegionPixelShiftSequenceVerticesOfTheRegionMultiFramePresentationSequencePixelShiftFrameRangeLUTFrameRangeImageToEquipmentMappingMatrixEquipmentCoordinateSystemIdentificationRETIRED_StudyStatusIDRETIRED_StudyPriorityIDRETIRED_StudyIDIssuerRETIRED_StudyVerifiedDateRETIRED_StudyVerifiedTimeRETIRED_StudyReadDateRETIRED_StudyReadTimeRETIRED_ScheduledStudyStartDateRETIRED_ScheduledStudyStartTimeRETIRED_ScheduledStudyStopDateRETIRED_ScheduledStudyStopTimeRETIRED_ScheduledStudyLocationRETIRED_ScheduledStudyLocationAETitleRETIRED_ReasonForStudyRequestingPhysicianIdentificationSequenceRequestingPhysicianRequestingServiceRequestingServiceCodeSequenceRETIRED_StudyArrivalDateRETIRED_StudyArrivalTimeRETIRED_StudyCompletionDateRETIRED_StudyCompletionTimeRETIRED_StudyComponentStatusIDRequestedProcedureDescriptionRequestedProcedureCodeSequenceRequestedLateralityCodeSequenceReasonForVisitReasonForVisitCodeSequenceRequestedContrastAgentRETIRED_StudyCommentsFlowIdentifierSequenceFlowIdentifierFlowTransferSyntaxUIDFlowRTPSamplingRateSourceIdentifierFrameOriginTimestampIncludesImagingSubjectFrameUsefulnessGroupSequenceRealTimeBulkDataFlowSequenceCameraPositionGroupSequenceIncludesInformationTimeOfFrameGroupSequenceReferencedPatientAliasSequenceVisitStatusIDAdmissionIDRETIRED_IssuerOfAdmissionIDIssuerOfAdmissionIDSequenceRouteOfAdmissionsRETIRED_ScheduledAdmissionDateRETIRED_ScheduledAdmissionTimeRETIRED_ScheduledDischargeDateRETIRED_ScheduledDischargeTimeRETIRED_ScheduledPatientInstitutionResidenceAdmittingDateAdmittingTimeRETIRED_DischargeDateRETIRED_DischargeTimeRETIRED_DischargeDiagnosisDescriptionRETIRED_DischargeDiagnosisCodeSequenceSpecialNeedsServiceEpisodeIDRETIRED_IssuerOfServiceEpisodeIDServiceEpisodeDescriptionIssuerOfServiceEpisodeIDSequencePertinentDocumentsSequencePertinentResourcesSequenceResourceDescriptionCurrentPatientLocationPatientInstitutionResidencePatientStatePatientClinicalTrialParticipationSequenceVisitCommentsWaveformOriginalityNumberOfWaveformChannelsNumberOfWaveformSamplesSamplingFrequencyMultiplexGroupLabelChannelDefinitionSequenceWaveformChannelNumberChannelLabelChannelStatusChannelSourceSequenceChannelSourceModifiersSequenceSourceWaveformSequenceChannelDerivationDescriptionChannelSensitivityChannelSensitivityUnitsSequenceChannelSensitivityCorrectionFactorChannelBaselineChannelTimeSkewChannelSampleSkewChannelOffsetWaveformBitsStoredFilterLowFrequencyFilterHighFrequencyNotchFilterFrequencyNotchFilterBandwidthWaveformDataDisplayScaleWaveformDisplayBackgroundCIELabValueWaveformPresentationGroupSequencePresentationGroupNumberChannelDisplaySequenceChannelRecommendedDisplayCIELabValueChannelPositionDisplayShadingFlagFractionalChannelDisplayScaleAbsoluteChannelDisplayScaleMultiplexedAudioChannelsDescriptionCodeSequenceChannelIdentificationCodeChannelModeMultiplexGroupUIDPowerlineFrequencyChannelImpedanceSequenceImpedanceValueImpedanceMeasurementDateTimeImpedanceMeasurementFrequencyImpedanceMeasurementCurrentTypeWaveformAmplifierTypeFilterLowFrequencyCharacteristicsSequenceFilterHighFrequencyCharacteristicsSequenceSummarizedFilterLookupTableNotchFilterCharacteristicsSequenceWaveformFilterTypeAnalogFilterCharacteristicsSequenceAnalogFilterRollOffAnalogFilterTypeDigitalFilterCharacteristicsSequenceDigitalFilterOrderDigitalFilterTypeCodeSequenceWaveformFilterDescriptionFilterLookupTableSequenceFilterLookupTableDescriptionFrequencyEncodingCodeSequenceMagnitudeEncodingCodeSequenceFilterLookupTableDataScheduledStationAETitleScheduledProcedureStepStartDateScheduledProcedureStepStartTimeScheduledProcedureStepEndDateScheduledProcedureStepEndTimeScheduledPerformingPhysicianNameScheduledProcedureStepDescriptionScheduledProtocolCodeSequenceScheduledProcedureStepIDStageCodeSequenceScheduledPerformingPhysicianIdentificationSequenceScheduledStationNameScheduledProcedureStepLocationPreMedicationScheduledProcedureStepStatusOrderPlacerIdentifierSequenceOrderFillerIdentifierSequenceLocalNamespaceEntityIDUniversalEntityIDUniversalEntityIDTypeIdentifierTypeCodeAssigningFacilitySequenceAssigningJurisdictionCodeSequenceAssigningAgencyOrDepartmentCodeSequenceScheduledProcedureStepSequenceReferencedNonImageCompositeSOPInstanceSequencePerformedStationAETitlePerformedStationNamePerformedLocationPerformedProcedureStepStartDatePerformedProcedureStepStartTimePerformedProcedureStepEndDatePerformedProcedureStepEndTimePerformedProcedureStepStatusPerformedProcedureStepIDPerformedProcedureStepDescriptionPerformedProcedureTypeDescriptionPerformedProtocolCodeSequencePerformedProtocolTypeScheduledStepAttributesSequenceRequestAttributesSequenceCommentsOnThePerformedProcedureStepPerformedProcedureStepDiscontinuationReasonCodeSequenceQuantitySequenceQuantityMeasuringUnitsSequenceBillingItemSequenceTotalTimeOfFluoroscopyTotalNumberOfExposuresEntranceDoseExposedAreaDistanceSourceToEntranceRETIRED_DistanceSourceToSupportExposureDoseSequenceCommentsOnRadiationDoseXRayOutputHalfValueLayerOrganDoseOrganExposedBillingProcedureStepSequenceFilmConsumptionSequenceBillingSuppliesAndDevicesSequenceRETIRED_ReferencedProcedureStepSequencePerformedSeriesSequenceCommentsOnTheScheduledProcedureStepProtocolContextSequenceContentItemModifierSequenceScheduledSpecimenSequenceRETIRED_SpecimenAccessionNumberContainerIdentifierIssuerOfTheContainerIdentifierSequenceAlternateContainerIdentifierSequenceContainerTypeCodeSequenceContainerDescriptionContainerComponentSequenceRETIRED_SpecimenSequenceSpecimenIdentifierRETIRED_SpecimenDescriptionSequenceTrialRETIRED_SpecimenDescriptionTrialSpecimenUIDAcquisitionContextSequenceAcquisitionContextDescriptionSpecimenDescriptionSequenceIssuerOfTheSpecimenIdentifierSequenceSpecimenTypeCodeSequenceSpecimenShortDescriptionSpecimenDetailedDescriptionSpecimenPreparationSequenceSpecimenPreparationStepContentItemSequenceSpecimenLocalizationContentItemSequenceRETIRED_SlideIdentifierWholeSlideMicroscopyImageFrameTypeSequenceImageCenterPointCoordinatesSequenceXOffsetInSlideCoordinateSystemYOffsetInSlideCoordinateSystemZOffsetInSlideCoordinateSystemRETIRED_PixelSpacingSequenceRETIRED_CoordinateSystemAxisCodeSequenceMeasurementUnitsCodeSequenceRETIRED_VitalStainCodeSequenceTrialRequestedProcedureIDReasonForTheRequestedProcedureRequestedProcedurePriorityPatientTransportArrangementsRequestedProcedureLocationRETIRED_PlacerOrderNumberProcedureRETIRED_FillerOrderNumberProcedureConfidentialityCodeReportingPriorityReasonForRequestedProcedureCodeSequenceNamesOfIntendedRecipientsOfResultsIntendedRecipientsOfResultsIdentificationSequenceReasonForPerformedProcedureCodeSequenceRETIRED_RequestedProcedureDescriptionTrialPersonIdentificationCodeSequencePersonAddressPersonTelephoneNumbersPersonTelecomInformationRequestedProcedureCommentsRETIRED_ReasonForTheImagingServiceRequestIssueDateOfImagingServiceRequestIssueTimeOfImagingServiceRequestRETIRED_PlacerOrderNumberImagingServiceRequestRetiredRETIRED_FillerOrderNumberImagingServiceRequestRetiredOrderEnteredByOrderEntererLocationOrderCallbackPhoneNumberOrderCallbackTelecomInformationPlacerOrderNumberImagingServiceRequestFillerOrderNumberImagingServiceRequestImagingServiceRequestCommentsConfidentialityConstraintOnPatientDataDescriptionRETIRED_GeneralPurposeScheduledProcedureStepStatusRETIRED_GeneralPurposePerformedProcedureStepStatusRETIRED_GeneralPurposeScheduledProcedureStepPriorityRETIRED_ScheduledProcessingApplicationsCodeSequenceScheduledProcedureStepStartDateTimeRETIRED_MultipleCopiesFlagPerformedProcessingApplicationsCodeSequenceScheduledProcedureStepExpirationDateTimeHumanPerformerCodeSequenceScheduledProcedureStepModificationDateTimeExpectedCompletionDateTimeRETIRED_ResultingGeneralPurposePerformedProcedureStepsSequenceRETIRED_ReferencedGeneralPurposeScheduledProcedureStepSequenceScheduledWorkitemCodeSequencePerformedWorkitemCodeSequenceInputAvailabilityFlagInputInformationSequenceRETIRED_RelevantInformationSequenceRETIRED_ReferencedGeneralPurposeScheduledProcedureStepTransactionUIDScheduledStationNameCodeSequenceScheduledStationClassCodeSequenceScheduledStationGeographicLocationCodeSequencePerformedStationNameCodeSequencePerformedStationClassCodeSequencePerformedStationGeographicLocationCodeSequenceRETIRED_RequestedSubsequentWorkitemCodeSequenceRETIRED_NonDICOMOutputCodeSequenceOutputInformationSequenceScheduledHumanPerformersSequenceActualHumanPerformersSequenceHumanPerformerOrganizationHumanPerformerNameRawDataHandlingInputReadinessStatePerformedProcedureStepStartDateTimePerformedProcedureStepEndDateTimeProcedureStepCancellationDateTimeOutputDestinationSequenceDICOMStorageSequenceSTOWRSStorageSequenceStorageURLXDSStorageSequenceEntranceDoseInmGyEntranceDoseDerivationParametricMapFrameTypeSequenceReferencedImageRealWorldValueMappingSequenceRealWorldValueMappingSequencePixelValueMappingCodeSequenceLUTLabelRealWorldValueLastValueMappedRealWorldValueLUTDataDoubleFloatRealWorldValueLastValueMappedDoubleFloatRealWorldValueFirstValueMappedRealWorldValueFirstValueMappedQuantityDefinitionSequenceRealWorldValueInterceptRealWorldValueSlopeRETIRED_FindingsFlagTrialRelationshipTypeRETIRED_FindingsSequenceTrialRETIRED_FindingsGroupUIDTrialRETIRED_ReferencedFindingsGroupUIDTrialRETIRED_FindingsGroupRecordingDateTrialRETIRED_FindingsGroupRecordingTimeTrialRETIRED_FindingsSourceCategoryCodeSequenceTrialVerifyingOrganizationRETIRED_DocumentingOrganizationIdentifierCodeSequenceTrialVerificationDateTimeObservationDateTimeObservationStartDateTimeValueTypeConceptNameCodeSequenceRETIRED_MeasurementPrecisionDescriptionTrialContinuityOfContentRETIRED_UrgencyOrPriorityAlertsTrialRETIRED_SequencingIndicatorTrialRETIRED_DocumentIdentifierCodeSequenceTrialRETIRED_DocumentAuthorTrialRETIRED_DocumentAuthorIdentifierCodeSequenceTrialRETIRED_IdentifierCodeSequenceTrialVerifyingObserverSequenceRETIRED_ObjectBinaryIdentifierTrialVerifyingObserverNameRETIRED_DocumentingObserverIdentifierCodeSequenceTrialAuthorObserverSequenceParticipantSequenceCustodialOrganizationSequenceParticipationTypeParticipationDateTimeObserverTypeRETIRED_ProcedureIdentifierCodeSequenceTrialVerifyingObserverIdentificationCodeSequenceRETIRED_ObjectDirectoryBinaryIdentifierTrialRETIRED_EquivalentCDADocumentSequenceReferencedWaveformChannelsRETIRED_DateOfDocumentOrVerbalTransactionTrialRETIRED_TimeOfDocumentCreationOrVerbalTransactionTrialDateTimeDateTimePersonNameUIDRETIRED_ReportStatusIDTrialTemporalRangeTypeReferencedSamplePositionsReferencedFrameNumbersReferencedTimeOffsetsReferencedDateTimeTextValueFloatingPointValueRationalNumeratorValueRationalDenominatorValueRETIRED_ObservationCategoryCodeSequenceTrialConceptCodeSequenceRETIRED_BibliographicCitationTrialPurposeOfReferenceCodeSequenceObservationUIDRETIRED_ReferencedObservationUIDTrialRETIRED_ReferencedObservationClassTrialRETIRED_ReferencedObjectObservationClassTrialAnnotationGroupNumberRETIRED_ObservationDateTrialRETIRED_ObservationTimeTrialRETIRED_MeasurementAutomationTrialModifierCodeSequenceRETIRED_IdentificationDescriptionTrialRETIRED_CoordinatesSetGeometricTypeTrialRETIRED_AlgorithmCodeSequenceTrialRETIRED_AlgorithmDescriptionTrialRETIRED_PixelCoordinatesSetTrialMeasuredValueSequenceNumericValueQualifierCodeSequenceRETIRED_CurrentObserverTrialNumericValueRETIRED_ReferencedAccessionSequenceTrialRETIRED_ReportStatusCommentTrialRETIRED_ProcedureContextSequenceTrialRETIRED_VerbalSourceTrialRETIRED_AddressTrialRETIRED_TelephoneNumberTrialRETIRED_VerbalSourceIdentifierCodeSequenceTrialPredecessorDocumentsSequenceReferencedRequestSequencePerformedProcedureCodeSequenceCurrentRequestedProcedureEvidenceSequenceRETIRED_ReportDetailSequenceTrialPertinentOtherEvidenceSequenceHL7StructuredDocumentReferenceSequenceRETIRED_ObservationSubjectUIDTrialRETIRED_ObservationSubjectClassTrialRETIRED_ObservationSubjectTypeCodeSequenceTrialCompletionFlagCompletionFlagDescriptionVerificationFlagArchiveRequestedPreliminaryFlagContentTemplateSequenceIdenticalDocumentsSequenceRETIRED_ObservationSubjectContextFlagTrialRETIRED_ObserverContextFlagTrialRETIRED_ProcedureContextFlagTrialContentSequenceRETIRED_RelationshipSequenceTrialRETIRED_RelationshipTypeCodeSequenceTrialRETIRED_LanguageCodeSequenceTrialTabulatedValuesSequenceNumberOfTableRowsNumbeOfTableColumnsTableRowNumberTableColumnNumberTableRowDefinitionSequenceTableColumnDefinitionSequenceCellValuesSequenceRETIRED_UniformResourceLocatorTrialWaveformAnnotationSequenceTemplateIdentifierRETIRED_TemplateVersionRETIRED_TemplateLocalVersionRETIRED_TemplateExtensionFlagRETIRED_TemplateExtensionOrganizationUIDRETIRED_TemplateExtensionCreatorUIDReferencedContentItemIdentifierHL7InstanceIdentifierHL7DocumentEffectiveTimeHL7DocumentTypeCodeSequenceDocumentClassCodeSequenceRetrieveURIRetrieveLocationUIDTypeOfInstancesDICOMRetrievalSequenceDICOMMediaRetrievalSequenceWADORetrievalSequenceXDSRetrievalSequenceWADORSRetrievalSequenceRepositoryUniqueIDHomeCommunityIDDocumentTitleEncapsulatedDocumentMIMETypeOfEncapsulatedDocumentSourceInstanceSequenceListOfMIMETypesEncapsulatedDocumentLengthProductPackageIdentifierSubstanceAdministrationApprovalApprovalStatusFurtherDescriptionApprovalStatusDateTimeProductTypeCodeSequenceProductNameProductDescriptionProductLotIdentifierProductExpirationDateTimeSubstanceAdministrationDateTimeSubstanceAdministrationNotesSubstanceAdministrationDeviceIDProductParameterSequenceSubstanceAdministrationParameterSequenceApprovalSequenceAssertionCodeSequenceAssertionUIDAsserterIdentificationSequenceAssertionDateTimeAssertionExpirationDateTimeAssertionCommentsRelatedAssertionSequenceReferencedAssertionUIDApprovalSubjectSequenceOrganizationalRoleCodeSequenceLensDescriptionRightLensSequenceLeftLensSequenceUnspecifiedLateralityLensSequenceCylinderSequencePrismSequenceHorizontalPrismPowerHorizontalPrismBaseVerticalPrismPowerVerticalPrismBaseLensSegmentTypeOpticalTransmittanceChannelWidthPupilSizeCornealSizeCornealSizeSequenceAutorefractionRightEyeSequenceAutorefractionLeftEyeSequenceDistancePupillaryDistanceNearPupillaryDistanceIntermediatePupillaryDistanceOtherPupillaryDistanceKeratometryRightEyeSequenceKeratometryLeftEyeSequenceSteepKeratometricAxisSequenceRadiusOfCurvatureKeratometricPowerKeratometricAxisFlatKeratometricAxisSequenceBackgroundColorOptotypeOptotypePresentationSubjectiveRefractionRightEyeSequenceSubjectiveRefractionLeftEyeSequenceAddNearSequenceAddIntermediateSequenceAddOtherSequenceAddPowerViewingDistanceCorneaMeasurementsSequenceSourceOfCorneaMeasurementDataCodeSequenceSteepCornealAxisSequenceFlatCornealAxisSequenceCornealPowerCornealAxisCorneaMeasurementMethodCodeSequenceRefractiveIndexOfCorneaRefractiveIndexOfAqueousHumorVisualAcuityTypeCodeSequenceVisualAcuityRightEyeSequenceVisualAcuityLeftEyeSequenceVisualAcuityBothEyesOpenSequenceViewingDistanceTypeVisualAcuityModifiersDecimalVisualAcuityOptotypeDetailedDefinitionReferencedRefractiveMeasurementsSequenceSpherePowerCylinderPowerCornealTopographySurfaceCornealVertexLocationPupilCentroidXCoordinatePupilCentroidYCoordinateEquivalentPupilRadiusCornealTopographyMapTypeCodeSequenceVerticesOfTheOutlineOfPupilCornealTopographyMappingNormalsSequenceMaximumCornealCurvatureSequenceMaximumCornealCurvatureMaximumCornealCurvatureLocationMinimumKeratometricSequenceSimulatedKeratometricCylinderSequenceAverageCornealPowerCornealISValueAnalyzedAreaSurfaceRegularityIndexSurfaceAsymmetryIndexCornealEccentricityIndexKeratoconusPredictionIndexDecimalPotentialVisualAcuityCornealTopographyMapQualityEvaluationSourceImageCornealProcessedDataSequenceCornealPointLocationCornealPointEstimatedAxialPowerTangentialPowerRefractivePowerRelativeElevationCornealWavefrontImagedVolumeWidthImagedVolumeHeightImagedVolumeDepthTotalPixelMatrixColumnsTotalPixelMatrixRowsTotalPixelMatrixOriginSequenceSpecimenLabelInImageFocusMethodExtendedDepthOfFieldNumberOfFocalPlanesDistanceBetweenFocalPlanesRecommendedAbsentPixelCIELabValueIlluminatorTypeCodeSequenceImageOrientationSlideOpticalPathSequenceOpticalPathIdentifierOpticalPathDescriptionIlluminationColorCodeSequenceSpecimenReferenceSequenceCondenserLensPowerObjectiveLensPowerObjectiveLensNumericalApertureConfocalModeTissueLocationConfocalMicroscopyImageFrameTypeSequenceImageAcquisitionDepthPaletteColorLookupTableSequenceReferencedImageNavigationSequenceTopLeftHandCornerOfLocalizerAreaBottomRightHandCornerOfLocalizerAreaOpticalPathIdentificationSequencePlanePositionSlideSequenceColumnPositionInTotalImagePixelMatrixRowPositionInTotalImagePixelMatrixPixelOriginInterpretationNumberOfOpticalPathsTotalPixelMatrixFocalPlanesCalibrationImageDeviceSequenceContainerComponentTypeCodeSequenceContainerComponentThicknessDeviceLengthContainerComponentWidthDeviceDiameterDeviceDiameterUnitsDeviceVolumeInterMarkerDistanceContainerComponentMaterialContainerComponentIDContainerComponentLengthContainerComponentDiameterContainerComponentDescriptionDeviceDescriptionLongDeviceDescriptionContrastBolusIngredientPercentByVolumeOCTFocalDistanceBeamSpotSizeEffectiveRefractiveIndexOCTAcquisitionDomainOCTOpticalCenterWavelengthAxialResolutionRangingDepthALineRateALinesPerFrameCatheterRotationalRateALinePixelSpacingModeOfPercutaneousAccessSequenceIntravascularOCTFrameTypeSequenceOCTZOffsetAppliedIntravascularFrameContentSequenceIntravascularLongitudinalDistanceIntravascularOCTFrameContentSequenceOCTZOffsetCorrectionCatheterDirectionOfRotationSeamLineLocationFirstALineLocationSeamLineIndexNumberOfPaddedALinesInterpolationTypeRefractiveIndexAppliedEnergyWindowVectorNumberOfEnergyWindowsEnergyWindowInformationSequenceEnergyWindowRangeSequenceEnergyWindowLowerLimitEnergyWindowUpperLimitRadiopharmaceuticalInformationSequenceResidualSyringeCountsEnergyWindowNameDetectorVectorNumberOfDetectorsDetectorInformationSequencePhaseVectorNumberOfPhasesPhaseInformationSequenceNumberOfFramesInPhasePhaseDelayPauseBetweenFramesPhaseDescriptionRotationVectorNumberOfRotationsRotationInformationSequenceNumberOfFramesInRotationRRIntervalVectorNumberOfRRIntervalsGatedInformationSequenceDataInformationSequenceTimeSlotVectorNumberOfTimeSlotsTimeSlotInformationSequenceTimeSlotTimeSliceVectorNumberOfSlicesAngularViewVectorTimeSliceVectorNumberOfTimeSlicesStartAngleTypeOfDetectorMotionTriggerVectorNumberOfTriggersInPhaseViewCodeSequenceViewModifierCodeSequenceRadionuclideCodeSequenceAdministrationRouteCodeSequenceRadiopharmaceuticalCodeSequenceCalibrationDataSequenceEnergyWindowNumberImageIDPatientOrientationCodeSequencePatientOrientationModifierCodeSequencePatientGantryRelationshipCodeSequenceSliceProgressionDirectionScanProgressionDirectionSeriesTypeUnitsCountsSourceReprojectionMethodSUVTypeRandomsCorrectionMethodAttenuationCorrectionMethodDecayCorrectionReconstructionMethodDetectorLinesOfResponseUsedScatterCorrectionMethodAxialAcceptanceAxialMashTransverseMashDetectorElementSizeCoincidenceWindowWidthSecondaryCountsTypeFrameReferenceTimePrimaryPromptsCountsAccumulatedSecondaryCountsAccumulatedSliceSensitivityFactorDecayFactorDoseCalibrationFactorScatterFractionFactorDeadTimeFactorImageIndexRETIRED_CountsIncludedRETIRED_DeadTimeCorrectionFlagHistogramSequenceHistogramNumberOfBinsHistogramFirstBinValueHistogramLastBinValueHistogramBinWidthHistogramExplanationHistogramDataSegmentationTypeSegmentSequenceSegmentedPropertyCategoryCodeSequenceSegmentNumberSegmentLabelSegmentDescriptionSegmentationAlgorithmIdentificationSequenceSegmentAlgorithmTypeSegmentAlgorithmNameSegmentIdentificationSequenceReferencedSegmentNumberRecommendedDisplayGrayscaleValueRecommendedDisplayCIELabValueMaximumFractionalValueSegmentedPropertyTypeCodeSequenceSegmentationFractionalTypeSegmentedPropertyTypeModifierCodeSequenceUsedSegmentsSequenceSegmentsOverlapTrackingIDTrackingUIDDeformableRegistrationSequenceSourceFrameOfReferenceUIDDeformableRegistrationGridSequenceGridDimensionsGridResolutionVectorGridDataPreDeformationMatrixRegistrationSequencePostDeformationMatrixRegistrationSequenceNumberOfSurfacesSurfaceSequenceSurfaceNumberSurfaceCommentsSurfaceProcessingSurfaceProcessingRatioSurfaceProcessingDescriptionRecommendedPresentationOpacityRecommendedPresentationTypeFiniteVolumeManifoldSurfacePointsSequenceSurfacePointsNormalsSequenceSurfaceMeshPrimitivesSequenceNumberOfSurfacePointsPointCoordinatesDataPointPositionAccuracyMeanPointDistanceMaximumPointDistancePointsBoundingBoxCoordinatesAxisOfRotationCenterOfRotationNumberOfVectorsVectorDimensionalityVectorAccuracyVectorCoordinateDataDoublePointCoordinatesDataTrianglePointIndexListEdgePointIndexListVertexPointIndexListTriangleStripSequenceTriangleFanSequenceLineSequencePrimitivePointIndexListSurfaceCountReferencedSurfaceSequenceReferencedSurfaceNumberSegmentSurfaceGenerationAlgorithmIdentificationSequenceSegmentSurfaceSourceInstanceSequenceAlgorithmFamilyCodeSequenceAlgorithmNameCodeSequenceAlgorithmVersionAlgorithmParametersFacetSequenceSurfaceProcessingAlgorithmIdentificationSequenceAlgorithmNameRecommendedPointRadiusRecommendedLineThicknessLongPrimitivePointIndexListLongTrianglePointIndexListLongEdgePointIndexListLongVertexPointIndexListTrackSetSequenceTrackSequenceRecommendedDisplayCIELabValueListTrackingAlgorithmIdentificationSequenceTrackSetNumberTrackSetLabelTrackSetDescriptionTrackSetAnatomicalTypeCodeSequenceMeasurementsSequenceTrackSetStatisticsSequenceFloatingPointValuesTrackPointIndexListTrackStatisticsSequenceMeasurementValuesSequenceDiffusionAcquisitionCodeSequenceDiffusionModelCodeSequenceImplantSizeImplantTemplateVersionReplacedImplantTemplateSequenceImplantTypeDerivationImplantTemplateSequenceOriginalImplantTemplateSequenceEffectiveDateTimeImplantTargetAnatomySequenceInformationFromManufacturerSequenceNotificationFromManufacturerSequenceInformationIssueDateTimeInformationSummaryImplantRegulatoryDisapprovalCodeSequenceOverallTemplateSpatialToleranceHPGLDocumentSequenceHPGLDocumentIDHPGLDocumentLabelViewOrientationCodeSequenceViewOrientationModifierHPGLDocumentScalingHPGLDocumentHPGLContourPenNumberHPGLPenSequenceHPGLPenNumberHPGLPenLabelHPGLPenDescriptionRecommendedRotationPointBoundingRectangleImplantTemplate3DModelSurfaceNumberSurfaceModelDescriptionSequenceSurfaceModelLabelSurfaceModelScalingFactorMaterialsCodeSequenceCoatingMaterialsCodeSequenceImplantTypeCodeSequenceFixationMethodCodeSequenceMatingFeatureSetsSequenceMatingFeatureSetIDMatingFeatureSetLabelMatingFeatureSequenceMatingFeatureIDMatingFeatureDegreeOfFreedomSequenceDegreeOfFreedomIDDegreeOfFreedomTypeTwoDMatingFeatureCoordinatesSequenceReferencedHPGLDocumentIDTwoDMatingPointTwoDMatingAxesTwoDDegreeOfFreedomSequenceThreeDDegreeOfFreedomAxisRangeOfFreedomThreeDMatingPointThreeDMatingAxesTwoDDegreeOfFreedomAxisPlanningLandmarkPointSequencePlanningLandmarkLineSequencePlanningLandmarkPlaneSequencePlanningLandmarkIDPlanningLandmarkDescriptionPlanningLandmarkIdentificationCodeSequenceTwoDPointCoordinatesSequenceTwoDPointCoordinatesThreeDPointCoordinatesTwoDLineCoordinatesSequenceTwoDLineCoordinatesThreeDLineCoordinatesTwoDPlaneCoordinatesSequenceTwoDPlaneIntersectionThreeDPlaneOriginThreeDPlaneNormalModelModificationModelMirroringModelUsageCodeSequenceModelGroupUIDRelativeURIReferenceWithinEncapsulatedDocumentAnnotationCoordinateTypeAnnotationGroupSequenceAnnotationGroupUIDAnnotationGroupLabelAnnotationGroupDescriptionAnnotationGroupGenerationTypeAnnotationGroupAlgorithmIdentificationSequenceAnnotationPropertyCategoryCodeSequenceAnnotationPropertyTypeCodeSequenceAnnotationPropertyTypeModifierCodeSequenceNumberOfAnnotationsAnnotationAppliesToAllOpticalPathsReferencedOpticalPathIdentifierAnnotationAppliesToAllZPlanesCommonZCoordinateValueAnnotationIndexListGraphicAnnotationSequenceGraphicLayerBoundingBoxAnnotationUnitsAnchorPointAnnotationUnitsGraphicAnnotationUnitsUnformattedTextValueTextObjectSequenceGraphicObjectSequenceBoundingBoxTopLeftHandCornerBoundingBoxBottomRightHandCornerBoundingBoxTextHorizontalJustificationAnchorPointAnchorPointVisibilityGraphicDimensionsNumberOfGraphicPointsGraphicDataGraphicTypeGraphicFilledRETIRED_ImageRotationRetiredImageHorizontalFlipImageRotationRETIRED_DisplayedAreaTopLeftHandCornerTrialRETIRED_DisplayedAreaBottomRightHandCornerTrialDisplayedAreaTopLeftHandCornerDisplayedAreaBottomRightHandCornerDisplayedAreaSelectionSequenceGraphicLayerSequenceGraphicLayerOrderGraphicLayerRecommendedDisplayGrayscaleValueRETIRED_GraphicLayerRecommendedDisplayRGBValueGraphicLayerDescriptionContentLabelContentDescriptionPresentationCreationDatePresentationCreationTimeContentCreatorNameContentCreatorIdentificationCodeSequenceAlternateContentDescriptionSequencePresentationSizeModePresentationPixelSpacingPresentationPixelAspectRatioPresentationPixelMagnificationRatioGraphicGroupLabelGraphicGroupDescriptionCompoundGraphicSequenceCompoundGraphicInstanceIDFontNameFontNameTypeCSSFontNameRotationAngleTextStyleSequenceLineStyleSequenceFillStyleSequenceGraphicGroupSequenceTextColorCIELabValueHorizontalAlignmentVerticalAlignmentShadowStyleShadowOffsetXShadowOffsetYShadowColorCIELabValueUnderlinedBoldItalicPatternOnColorCIELabValuePatternOffColorCIELabValueLineThicknessLineDashingStyleLinePatternFillPatternFillModeShadowOpacityGapLengthDiameterOfVisibilityRotationPointTickAlignmentShowTickLabelTickLabelAlignmentCompoundGraphicUnitsPatternOnOpacityPatternOffOpacityMajorTicksSequenceTickPositionTickLabelCompoundGraphicTypeGraphicGroupIDShapeTypeRegistrationSequenceMatrixRegistrationSequenceMatrixSequenceFrameOfReferenceToDisplayedCoordinateSystemTransformationMatrixFrameOfReferenceTransformationMatrixTypeRegistrationTypeCodeSequenceFiducialDescriptionFiducialIdentifierFiducialIdentifierCodeSequenceContourUncertaintyRadiusUsedFiducialsSequenceUsedRTStructureSetROISequenceGraphicCoordinatesDataSequenceFiducialUIDReferencedFiducialUIDFiducialSetSequenceFiducialSequenceFiducialsPropertyCategoryCodeSequenceGraphicLayerRecommendedDisplayCIELabValueBlendingSequenceRelativeOpacityReferencedSpatialRegistrationSequenceBlendingPositionPresentationDisplayCollectionUIDPresentationSequenceCollectionUIDPresentationSequencePositionIndexRenderedImageReferenceSequenceVolumetricPresentationStateInputSequencePresentationInputTypeInputSequencePositionIndexCropCroppingSpecificationIndexCompositingMethodVolumetricPresentationInputNumberImageVolumeGeometryVolumetricPresentationInputSetUIDVolumetricPresentationInputSetSequenceGlobalCropGlobalCroppingSpecificationIndexRenderingMethodVolumeCroppingSequenceVolumeCroppingMethodBoundingBoxCropObliqueCroppingPlaneSequenceObliqueCroppingPlaneObliqueCroppingPlaneNormalCroppingSpecificationNumberMultiPlanarReconstructionStyleMPRThicknessTypeMPRSlabThicknessMPRTopLeftHandCornerMPRViewWidthDirectionMPRViewWidthNumberOfVolumetricCurvePointsVolumetricCurvePointsMPRViewHeightDirectionMPRViewHeightRenderProjectionViewpointPositionViewpointLookAtPointViewpointUpDirectionRenderFieldOfViewSamplingStepSizeShadingStyleAmbientReflectionIntensityLightDirectionDiffuseReflectionIntensitySpecularReflectionIntensityShininessPresentationStateClassificationComponentSequenceComponentTypeComponentInputSequenceVolumetricPresentationInputIndexPresentationStateCompositorComponentSequenceWeightingTransferFunctionSequenceWeightingLookupTableDescriptorWeightingLookupTableDataVolumetricAnnotationSequenceReferencedStructuredContextSequenceReferencedContentItemVolumetricPresentationInputAnnotationSequenceAnnotationClippingPresentationAnimationStyleRecommendedAnimationRateAnimationCurveSequenceAnimationStepSizeSwivelRangeVolumetricCurveUpDirectionsVolumeStreamSequenceRGBATransferFunctionDescriptionAdvancedBlendingSequenceBlendingInputNumberBlendingDisplayInputSequenceBlendingDisplaySequenceBlendingModeTimeSeriesBlendingGeometryForDisplayThresholdSequenceThresholdValueSequenceThresholdTypeThresholdValueHangingProtocolNameHangingProtocolDescriptionHangingProtocolLevelHangingProtocolCreatorHangingProtocolCreationDateTimeHangingProtocolDefinitionSequenceHangingProtocolUserIdentificationCodeSequenceHangingProtocolUserGroupNameSourceHangingProtocolSequenceNumberOfPriorsReferencedImageSetsSequenceImageSetSelectorSequenceImageSetSelectorUsageFlagSelectorAttributeSelectorValueNumberTimeBasedImageSetsSequenceImageSetNumberImageSetSelectorCategoryRelativeTimeRelativeTimeUnitsAbstractPriorValueAbstractPriorCodeSequenceImageSetLabelSelectorAttributeVRSelectorSequencePointerSelectorSequencePointerPrivateCreatorSelectorAttributePrivateCreatorSelectorAEValueSelectorASValueSelectorATValueSelectorDAValueSelectorCSValueSelectorDTValueSelectorISValueSelectorOBValueSelectorLOValueSelectorOFValueSelectorLTValueSelectorOWValueSelectorPNValueSelectorTMValueSelectorSHValueSelectorUNValueSelectorSTValueSelectorUCValueSelectorUTValueSelectorURValueSelectorDSValueSelectorODValueSelectorFDValueSelectorOLValueSelectorFLValueSelectorULValueSelectorUSValueSelectorSLValueSelectorSSValueSelectorUIValueSelectorCodeSequenceValueSelectorOVValueSelectorSVValueSelectorUVValueNumberOfScreensNominalScreenDefinitionSequenceNumberOfVerticalPixelsNumberOfHorizontalPixelsDisplayEnvironmentSpatialPositionScreenMinimumGrayscaleBitDepthScreenMinimumColorBitDepthApplicationMaximumRepaintTimeDisplaySetsSequenceDisplaySetNumberDisplaySetLabelDisplaySetPresentationGroupDisplaySetPresentationGroupDescriptionPartialDataDisplayHandlingSynchronizedScrollingSequenceDisplaySetScrollingGroupNavigationIndicatorSequenceNavigationDisplaySetReferenceDisplaySetsImageBoxesSequenceImageBoxNumberImageBoxLayoutTypeImageBoxTileHorizontalDimensionImageBoxTileVerticalDimensionImageBoxScrollDirectionImageBoxSmallScrollTypeImageBoxSmallScrollAmountImageBoxLargeScrollTypeImageBoxLargeScrollAmountImageBoxOverlapPriorityCineRelativeToRealTimeFilterOperationsSequenceFilterByCategoryFilterByAttributePresenceFilterByOperatorStructuredDisplayBackgroundCIELabValueEmptyImageBoxCIELabValueStructuredDisplayImageBoxSequenceStructuredDisplayTextBoxSequenceReferencedFirstFrameSequenceImageBoxSynchronizationSequenceSynchronizedImageBoxListTypeOfSynchronizationBlendingOperationTypeReformattingOperationTypeReformattingThicknessReformattingIntervalReformattingOperationInitialViewDirectionThreeDRenderingTypeSortingOperationsSequenceSortByCategorySortingDirectionDisplaySetPatientOrientationVOITypePseudoColorTypePseudoColorPaletteInstanceReferenceSequenceShowGrayscaleInvertedShowImageTrueSizeFlagShowGraphicAnnotationFlagShowPatientDemographicsFlagShowAcquisitionTechniquesFlagDisplaySetHorizontalJustificationDisplaySetVerticalJustificationContinuationStartMetersetContinuationEndMetersetProcedureStepStateProcedureStepProgressInformationSequenceProcedureStepProgressProcedureStepProgressDescriptionProcedureStepProgressParametersSequenceProcedureStepCommunicationsURISequenceContactURIContactDisplayNameProcedureStepDiscontinuationReasonCodeSequenceBeamTaskSequenceBeamTaskTypeRETIRED_BeamOrderIndexTrialAutosequenceFlagTableTopVerticalAdjustedPositionTableTopLongitudinalAdjustedPositionTableTopLateralAdjustedPositionPatientSupportAdjustedAngleTableTopEccentricAdjustedAngleTableTopPitchAdjustedAngleTableTopRollAdjustedAngleDeliveryVerificationImageSequenceVerificationImageTimingDoubleExposureFlagDoubleExposureOrderingRETIRED_DoubleExposureMetersetTrialRETIRED_DoubleExposureFieldDeltaTrialRelatedReferenceRTImageSequenceGeneralMachineVerificationSequenceConventionalMachineVerificationSequenceIonMachineVerificationSequenceFailedAttributesSequenceOverriddenAttributesSequenceConventionalControlPointVerificationSequenceIonControlPointVerificationSequenceAttributeOccurrenceSequenceAttributeOccurrencePointerAttributeItemSelectorAttributeOccurrencePrivateCreatorSelectorSequencePointerItemsScheduledProcedureStepPriorityWorklistLabelProcedureStepLabelScheduledProcessingParametersSequencePerformedProcessingParametersSequenceUnifiedProcedureStepPerformedProcedureSequenceRETIRED_RelatedProcedureStepSequenceRETIRED_ProcedureStepRelationshipTypeReplacedProcedureStepSequenceDeletionLockReceivingAERequestingAEReasonForCancellationSCPStatusSubscriptionListStatusUnifiedProcedureStepListStatusBeamOrderIndexDoubleExposureMetersetDoubleExposureFieldDeltaBrachyTaskSequenceContinuationStartTotalReferenceAirKermaContinuationEndTotalReferenceAirKermaContinuationPulseNumberChannelDeliveryOrderSequenceReferencedChannelNumberStartCumulativeTimeWeightEndCumulativeTimeWeightOmittedChannelSequenceReasonForChannelOmissionReasonForChannelOmissionDescriptionChannelDeliveryOrderIndexChannelDeliveryContinuationSequenceOmittedApplicationSetupSequenceImplantAssemblyTemplateNameImplantAssemblyTemplateIssuerImplantAssemblyTemplateVersionReplacedImplantAssemblyTemplateSequenceImplantAssemblyTemplateTypeOriginalImplantAssemblyTemplateSequenceDerivationImplantAssemblyTemplateSequenceImplantAssemblyTemplateTargetAnatomySequenceProcedureTypeCodeSequenceSurgicalTechniqueComponentTypesSequenceComponentTypeCodeSequenceExclusiveComponentTypeMandatoryComponentTypeComponentSequenceComponentIDComponentAssemblySequenceComponent1ReferencedIDComponent1ReferencedMatingFeatureSetIDComponent1ReferencedMatingFeatureIDComponent2ReferencedIDComponent2ReferencedMatingFeatureSetIDComponent2ReferencedMatingFeatureIDImplantTemplateGroupNameImplantTemplateGroupDescriptionImplantTemplateGroupIssuerImplantTemplateGroupVersionReplacedImplantTemplateGroupSequenceImplantTemplateGroupTargetAnatomySequenceImplantTemplateGroupMembersSequenceImplantTemplateGroupMemberIDThreeDImplantTemplateGroupMemberMatchingPointThreeDImplantTemplateGroupMemberMatchingAxesImplantTemplateGroupMemberMatching2DCoordinatesSequenceTwoDImplantTemplateGroupMemberMatchingPointTwoDImplantTemplateGroupMemberMatchingAxesImplantTemplateGroupVariationDimensionSequenceImplantTemplateGroupVariationDimensionNameImplantTemplateGroupVariationDimensionRankSequenceReferencedImplantTemplateGroupMemberIDImplantTemplateGroupVariationDimensionRankSurfaceScanAcquisitionTypeCodeSequenceSurfaceScanModeCodeSequenceRegistrationMethodCodeSequenceShotDurationTimeShotOffsetTimeSurfacePointPresentationValueDataSurfacePointColorCIELabValueDataUVMappingSequenceTextureLabelUValueDataVValueDataReferencedTextureSequenceReferencedSurfaceDataSequenceAssessmentSummaryAssessmentSummaryDescriptionAssessedSOPInstanceSequenceReferencedComparisonSOPInstanceSequenceNumberOfAssessmentObservationsAssessmentObservationsSequenceObservationSignificanceObservationDescriptionStructuredConstraintObservationSequenceAssessedAttributeValueSequenceAssessmentSetIDAssessmentRequesterSequenceSelectorAttributeNameSelectorAttributeKeywordAssessmentTypeCodeSequenceObservationBasisCodeSequenceAssessmentLabelConstraintTypeSpecificationSelectionGuidanceConstraintValueSequenceRecommendedDefaultValueSequenceConstraintViolationSignificanceConstraintViolationConditionModifiableConstraintFlagStorageMediaFileSetIDStorageMediaFileSetUIDIconImageSequenceRETIRED_TopicTitleRETIRED_TopicSubjectRETIRED_TopicAuthorRETIRED_TopicKeywordsSOPInstanceStatusSOPAuthorizationDateTimeSOPAuthorizationCommentAuthorizationEquipmentCertificationNumberMACIDNumberMACCalculationTransferSyntaxUIDMACAlgorithmDataElementsSignedDigitalSignatureUIDDigitalSignatureDateTimeCertificateTypeCertificateOfSignerSignatureCertifiedTimestampTypeCertifiedTimestampRETIRED_undefinedDigitalSignaturePurposeCodeSequenceReferencedDigitalSignatureSequenceReferencedSOPInstanceMACSequenceMACEncryptedAttributesSequenceEncryptedContentTransferSyntaxUIDEncryptedContentModifiedAttributesSequenceNonconformingModifiedAttributesSequenceNonconformingDataElementValueOriginalAttributesSequenceAttributeModificationDateTimeModifyingSystemSourceOfPreviousValuesReasonForTheAttributeModificationInstanceOriginStatusRETIRED_EscapeTripletRETIRED_RunLengthTripletRETIRED_HuffmanTableSizeRETIRED_HuffmanTableTripletRETIRED_ShiftTableSizeRETIRED_ShiftTableTripletRETIRED_ZonalMapNumberOfCopiesPrinterConfigurationSequencePrintPriorityMediumTypeFilmDestinationFilmSessionLabelMemoryAllocationMaximumMemoryAllocationRETIRED_ColorImagePrintingFlagRETIRED_CollationFlagRETIRED_AnnotationFlagRETIRED_ImageOverlayFlagRETIRED_PresentationLUTFlagRETIRED_ImageBoxPresentationLUTFlagMemoryBitDepthPrintingBitDepthMediaInstalledSequenceOtherMediaAvailableSequenceSupportedImageDisplayFormatsSequenceReferencedFilmBoxSequenceRETIRED_ReferencedStoredPrintSequenceImageDisplayFormatAnnotationDisplayFormatIDFilmOrientationFilmSizeIDPrinterResolutionIDDefaultPrinterResolutionIDMagnificationTypeSmoothingTypeDefaultMagnificationTypeOtherMagnificationTypesAvailableDefaultSmoothingTypeOtherSmoothingTypesAvailableBorderDensityEmptyImageDensityMinDensityMaxDensityTrimConfigurationInformationConfigurationInformationDescriptionMaximumCollatedFilmsIlluminationReflectedAmbientLightPrinterPixelSpacingReferencedFilmSessionSequenceReferencedImageBoxSequenceReferencedBasicAnnotationBoxSequenceImageBoxPositionPolarityRequestedImageSizeRequestedDecimateCropBehaviorRequestedResolutionIDRequestedImageSizeFlagDecimateCropResultBasicGrayscaleImageSequenceBasicColorImageSequenceRETIRED_ReferencedImageOverlayBoxSequenceRETIRED_ReferencedVOILUTBoxSequenceAnnotationPositionTextStringRETIRED_ReferencedOverlayPlaneSequenceRETIRED_ReferencedOverlayPlaneGroupsRETIRED_OverlayPixelDataSequenceRETIRED_OverlayMagnificationTypeRETIRED_OverlaySmoothingTypeRETIRED_OverlayOrImageMagnificationRETIRED_MagnifyToNumberOfColumnsRETIRED_OverlayForegroundDensityRETIRED_OverlayBackgroundDensityRETIRED_OverlayModeRETIRED_ThresholdDensityRETIRED_ReferencedImageBoxSequenceRetiredPresentationLUTSequencePresentationLUTShapeReferencedPresentationLUTSequenceRETIRED_PrintJobIDExecutionStatusExecutionStatusInfoCreationDateCreationTimeOriginatorRETIRED_DestinationAEOwnerIDNumberOfFilmsRETIRED_ReferencedPrintJobSequencePullStoredPrintPrinterStatusPrinterStatusInfoPrinterNameRETIRED_PrintQueueIDRETIRED_QueueStatusRETIRED_PrintJobDescriptionSequenceRETIRED_ReferencedPrintJobSequenceRETIRED_PrintManagementCapabilitiesSequenceRETIRED_PrinterCharacteristicsSequenceRETIRED_FilmBoxContentSequenceRETIRED_ImageBoxContentSequenceRETIRED_AnnotationContentSequenceRETIRED_ImageOverlayBoxContentSequenceRETIRED_PresentationLUTContentSequenceRETIRED_ProposedStudySequenceRETIRED_OriginalImageSequenceLabelUsingInformationExtractedFromInstancesLabelTextLabelStyleSelectionMediaDispositionBarcodeValueBarcodeSymbologyAllowMediaSplittingIncludeNonDICOMObjectsIncludeDisplayApplicationPreserveCompositeInstancesAfterMediaCreationTotalNumberOfPiecesOfMediaCreatedRequestedMediaApplicationProfileReferencedStorageMediaSequenceFailureAttributesAllowLossyCompressionRequestPriorityRTImageLabelRTImageNameRTImageDescriptionReportedValuesOriginRTImagePlaneXRayImageReceptorTranslationXRayImageReceptorAngleRTImageOrientationImagePlanePixelSpacingRTImagePositionRadiationMachineNameRadiationMachineSADRadiationMachineSSDRTImageSIDSourceToReferenceObjectDistanceFractionNumberExposureSequenceMetersetExposureDiaphragmPositionFluenceMapSequenceFluenceDataSourceFluenceDataScalePrimaryFluenceModeSequenceFluenceModeFluenceModeIDSelectedFrameNumberSelectedFrameFunctionalGroupsSequenceRTImageFrameGeneralContentSequenceRTImageFrameContextSequenceRTImageScopeSequenceBeamModifierCoordinatesPresenceFlagStartCumulativeMetersetStopCumulativeMetersetRTAcquisitionPatientPositionSequenceRTImageFrameImagingDevicePositionSequenceRTImageFramekVRadiationAcquisitionSequenceRTImageFrameMVRadiationAcquisitionSequenceRTImageFrameRadiationAcquisitionSequenceImagingSourcePositionSequenceImageReceptorPositionSequenceDevicePositionToEquipmentMappingMatrixDevicePositionParameterSequenceImagingSourceLocationSpecificationTypeImagingDeviceLocationMatrixSequenceImagingDeviceLocationParameterSequenceImagingApertureSequenceImagingApertureSpecificationTypeNumberOfAcquisitionDevicesAcquisitionDeviceSequenceAcquisitionTaskSequenceAcquisitionTaskWorkitemCodeSequenceAcquisitionSubtaskSequenceSubtaskWorkitemCodeSequenceAcquisitionTaskIndexAcquisitionSubtaskIndexReferencedBaselineParametersRTRadiationInstanceSequencePositionAcquisitionTemplateIdentificationSequencePositionAcquisitionTemplateIDPositionAcquisitionTemplateNamePositionAcquisitionTemplateCodeSequencePositionAcquisitionTemplateDescriptionAcquisitionTaskApplicabilitySequenceProjectionImagingAcquisitionParameterSequenceCTImagingAcquisitionParameterSequenceKVImagingGenerationParametersSequenceMVImagingGenerationParametersSequenceAcquisitionSignalTypeAcquisitionMethodScanStartPositionSequenceScanStopPositionSequenceImagingSourceToBeamModifierDefinitionPlaneDistanceScanArcTypeDetectorPositioningTypeAdditionalRTAccessoryDeviceSequenceDeviceSpecificAcquisitionParameterSequenceReferencedPositionReferenceInstanceSequenceEnergyDerivationCodeSequenceMaximumCumulativeMetersetExposureAcquisitionInitiationSequenceDVHTypeDoseUnitsDoseTypeSpatialTransformOfDoseDoseCommentNormalizationPointDoseSummationTypeGridFrameOffsetVectorDoseGridScalingRTDoseROISequenceDoseValueTissueHeterogeneityCorrectionDVHNormalizationPointDVHNormalizationDoseValueDVHSequenceDVHDoseScalingDVHVolumeUnitsDVHNumberOfBinsDVHDataDVHReferencedROISequenceDVHROIContributionTypeDVHMinimumDoseDVHMaximumDoseDVHMeanDoseStructureSetLabelStructureSetNameStructureSetDescriptionStructureSetDateStructureSetTimeReferencedFrameOfReferenceSequenceRTReferencedStudySequenceRTReferencedSeriesSequenceContourImageSequencePredecessorStructureSetSequenceStructureSetROISequenceROINumberReferencedFrameOfReferenceUIDROINameROIDescriptionROIDisplayColorROIVolumeROIDateTimeROIObservationDateTimeRTRelatedROISequenceRTROIRelationshipROIGenerationAlgorithmROIDerivationAlgorithmIdentificationSequenceROIGenerationDescriptionROIContourSequenceContourSequenceContourGeometricTypeContourSlabThicknessContourOffsetVectorNumberOfContourPointsContourNumberAttachedContoursSourcePixelPlanesCharacteristicsSequenceSourceSeriesSequenceSourceSeriesInformationSequenceROICreatorSequenceROIInterpreterSequenceROIObservationContextCodeSequenceContourDataRTROIObservationsSequenceObservationNumberReferencedROINumberROIObservationLabelRTROIIdentificationCodeSequenceROIObservationDescriptionRelatedRTROIObservationsSequenceRTROIInterpretedTypeROIInterpreterROIPhysicalPropertiesSequenceROIPhysicalPropertyROIPhysicalPropertyValueROIElementalCompositionSequenceROIElementalCompositionAtomicNumberROIElementalCompositionAtomicMassFractionAdditionalRTROIIdentificationCodeSequenceRETIRED_FrameOfReferenceRelationshipSequenceRETIRED_RelatedFrameOfReferenceUIDRETIRED_FrameOfReferenceTransformationTypeFrameOfReferenceTransformationMatrixFrameOfReferenceTransformationCommentPatientLocationCoordinatesSequencePatientLocationCoordinatesCodeSequencePatientSupportPositionSequenceMeasuredDoseReferenceSequenceMeasuredDoseDescriptionMeasuredDoseTypeMeasuredDoseValueTreatmentSessionBeamSequenceTreatmentSessionIonBeamSequenceCurrentFractionNumberTreatmentControlPointDateTreatmentControlPointTimeTreatmentTerminationStatusTreatmentTerminationCodeTreatmentVerificationStatusReferencedTreatmentRecordSequenceSpecifiedPrimaryMetersetSpecifiedSecondaryMetersetDeliveredPrimaryMetersetDeliveredSecondaryMetersetSpecifiedTreatmentTimeDeliveredTreatmentTimeControlPointDeliverySequenceIonControlPointDeliverySequenceSpecifiedMetersetDeliveredMetersetMetersetRateSetMetersetRateDeliveredScanSpotMetersetsDeliveredDoseRateDeliveredTreatmentSummaryCalculatedDoseReferenceSequenceCumulativeDoseToDoseReferenceFirstTreatmentDateMostRecentTreatmentDateNumberOfFractionsDeliveredOverrideSequenceParameterSequencePointerOverrideParameterPointerParameterItemIndexMeasuredDoseReferenceNumberParameterPointerOverrideReasonParameterValueNumberCorrectedParameterSequenceCorrectionValueCalculatedDoseReferenceSequenceCalculatedDoseReferenceNumberCalculatedDoseReferenceDescriptionCalculatedDoseReferenceDoseValueStartMetersetEndMetersetReferencedMeasuredDoseReferenceSequenceReferencedMeasuredDoseReferenceNumberReferencedCalculatedDoseReferenceSequenceReferencedCalculatedDoseReferenceNumberBeamLimitingDeviceLeafPairsSequenceEnhancedRTBeamLimitingDeviceSequenceEnhancedRTBeamLimitingOpeningSequenceEnhancedRTBeamLimitingDeviceDefinitionFlagParallelRTBeamDelimiterOpeningExtentsRecordedWedgeSequenceRecordedCompensatorSequenceRecordedBlockSequenceRecordedBlockSlabSequenceTreatmentSummaryMeasuredDoseReferenceSequenceRecordedSnoutSequenceRecordedRangeShifterSequenceRecordedLateralSpreadingDeviceSequenceRecordedRangeModulatorSequenceRecordedSourceSequenceSourceSerialNumberTreatmentSessionApplicationSetupSequenceApplicationSetupCheckRecordedBrachyAccessoryDeviceSequenceReferencedBrachyAccessoryDeviceNumberRecordedChannelSequenceSpecifiedChannelTotalTimeDeliveredChannelTotalTimeSpecifiedNumberOfPulsesDeliveredNumberOfPulsesSpecifiedPulseRepetitionIntervalDeliveredPulseRepetitionIntervalRecordedSourceApplicatorSequenceReferencedSourceApplicatorNumberRecordedChannelShieldSequenceReferencedChannelShieldNumberBrachyControlPointDeliveredSequenceSafePositionExitDateSafePositionExitTimeSafePositionReturnDateSafePositionReturnTimePulseSpecificBrachyControlPointDeliveredSequencePulseNumberBrachyPulseControlPointDeliveredSequenceCurrentTreatmentStatusTreatmentStatusCommentFractionGroupSummarySequenceReferencedFractionNumberFractionGroupTypeBeamStopperPositionFractionStatusSummarySequenceTreatmentDateTreatmentTimeRTPlanLabelRTPlanNameRTPlanDescriptionRTPlanDateRTPlanTimeTreatmentProtocolsPlanIntentTreatmentSitesRTPlanGeometryPrescriptionDescriptionDoseReferenceSequenceDoseReferenceNumberDoseReferenceUIDDoseReferenceStructureTypeNominalBeamEnergyUnitDoseReferenceDescriptionDoseReferencePointCoordinatesNominalPriorDoseDoseReferenceTypeConstraintWeightDeliveryWarningDoseDeliveryMaximumDoseTargetMinimumDoseTargetPrescriptionDoseTargetMaximumDoseTargetUnderdoseVolumeFractionOrganAtRiskFullVolumeDoseOrganAtRiskLimitDoseOrganAtRiskMaximumDoseOrganAtRiskOverdoseVolumeFractionToleranceTableSequenceToleranceTableNumberToleranceTableLabelGantryAngleToleranceBeamLimitingDeviceAngleToleranceBeamLimitingDeviceToleranceSequenceBeamLimitingDevicePositionToleranceSnoutPositionTolerancePatientSupportAngleToleranceTableTopEccentricAngleToleranceTableTopPitchAngleToleranceTableTopRollAngleToleranceTableTopVerticalPositionToleranceTableTopLongitudinalPositionToleranceTableTopLateralPositionToleranceTableTopPositionAlignmentUIDRTPlanRelationshipFractionGroupSequenceFractionGroupNumberFractionGroupDescriptionNumberOfFractionsPlannedNumberOfFractionPatternDigitsPerDayRepeatFractionCycleLengthFractionPatternNumberOfBeamsBeamDoseSpecificationPointReferencedDoseReferenceUIDBeamDoseBeamMetersetRETIRED_BeamDosePointDepthRETIRED_BeamDosePointEquivalentDepthRETIRED_BeamDosePointSSDBeamDoseMeaningBeamDoseVerificationControlPointSequenceAverageBeamDosePointDepthAverageBeamDosePointEquivalentDepthAverageBeamDosePointSSDBeamDoseTypeAlternateBeamDoseAlternateBeamDoseTypeDepthValueAveragingFlagBeamDosePointSourceToExternalContourDistanceNumberOfBrachyApplicationSetupsBrachyApplicationSetupDoseSpecificationPointBrachyApplicationSetupDoseBeamSequenceTreatmentMachineNamePrimaryDosimeterUnitSourceAxisDistanceBeamLimitingDeviceSequenceRTBeamLimitingDeviceTypeSourceToBeamLimitingDeviceDistanceIsocenterToBeamLimitingDeviceDistanceNumberOfLeafJawPairsLeafPositionBoundariesBeamNumberBeamNameBeamDescriptionBeamTypeBeamDeliveryDurationLimitRadiationTypeHighDoseTechniqueTypeReferenceImageNumberPlannedVerificationImageSequenceImagingDeviceSpecificAcquisitionParametersTreatmentDeliveryTypeNumberOfWedgesWedgeSequenceWedgeNumberWedgeTypeWedgeIDWedgeAngleWedgeFactorTotalWedgeTrayWaterEquivalentThicknessWedgeOrientationIsocenterToWedgeTrayDistanceSourceToWedgeTrayDistanceWedgeThinEdgePositionBolusIDBolusDescriptionEffectiveWedgeAngleNumberOfCompensatorsMaterialIDTotalCompensatorTrayFactorCompensatorSequenceCompensatorNumberCompensatorIDSourceToCompensatorTrayDistanceCompensatorRowsCompensatorColumnsCompensatorPixelSpacingCompensatorPositionCompensatorTransmissionDataCompensatorThicknessDataNumberOfBoliCompensatorTypeCompensatorTrayIDNumberOfBlocksTotalBlockTrayFactorTotalBlockTrayWaterEquivalentThicknessBlockSequenceBlockTrayIDSourceToBlockTrayDistanceIsocenterToBlockTrayDistanceBlockTypeAccessoryCodeBlockDivergenceBlockMountingPositionBlockNumberBlockNameBlockThicknessBlockTransmissionBlockNumberOfPointsBlockDataApplicatorSequenceApplicatorIDApplicatorTypeApplicatorDescriptionCumulativeDoseReferenceCoefficientFinalCumulativeMetersetWeightNumberOfControlPointsControlPointSequenceControlPointIndexNominalBeamEnergyDoseRateSetWedgePositionSequenceWedgePositionBeamLimitingDevicePositionSequenceLeafJawPositionsGantryAngleGantryRotationDirectionBeamLimitingDeviceAngleBeamLimitingDeviceRotationDirectionPatientSupportAnglePatientSupportRotationDirectionTableTopEccentricAxisDistanceTableTopEccentricAngleTableTopEccentricRotationDirectionTableTopVerticalPositionTableTopLongitudinalPositionTableTopLateralPositionIsocenterPositionSurfaceEntryPointSourceToSurfaceDistanceAverageBeamDosePointSourceToExternalContourSurfaceDistanceSourceToExternalContourDistanceExternalContourEntryPointCumulativeMetersetWeightTableTopPitchAngleTableTopPitchRotationDirectionTableTopRollAngleTableTopRollRotationDirectionHeadFixationAngleGantryPitchAngleGantryPitchRotationDirectionGantryPitchAngleToleranceFixationEyeChairHeadFramePositionHeadFixationAngleToleranceChairHeadFramePositionToleranceFixationLightAzimuthalAngleToleranceFixationLightPolarAngleTolerancePatientSetupSequencePatientSetupNumberPatientSetupLabelPatientAdditionalPositionFixationDeviceSequenceFixationDeviceTypeFixationDeviceLabelFixationDeviceDescriptionFixationDevicePositionFixationDevicePitchAngleFixationDeviceRollAngleShieldingDeviceSequenceShieldingDeviceTypeShieldingDeviceLabelShieldingDeviceDescriptionShieldingDevicePositionSetupTechniqueSetupTechniqueDescriptionSetupDeviceSequenceSetupDeviceTypeSetupDeviceLabelSetupDeviceDescriptionSetupDeviceParameterSetupReferenceDescriptionTableTopVerticalSetupDisplacementTableTopLongitudinalSetupDisplacementTableTopLateralSetupDisplacementBrachyTreatmentTechniqueBrachyTreatmentTypeTreatmentMachineSequenceSourceSequenceSourceNumberSourceTypeSourceManufacturerActiveSourceDiameterActiveSourceLengthSourceModelIDSourceDescriptionSourceEncapsulationNominalThicknessSourceEncapsulationNominalTransmissionSourceIsotopeNameSourceIsotopeHalfLifeSourceStrengthUnitsReferenceAirKermaRateSourceStrengthSourceStrengthReferenceDateSourceStrengthReferenceTimeApplicationSetupSequenceApplicationSetupTypeApplicationSetupNumberApplicationSetupNameApplicationSetupManufacturerTemplateNumberTemplateTypeTemplateNameTotalReferenceAirKermaBrachyAccessoryDeviceSequenceBrachyAccessoryDeviceNumberBrachyAccessoryDeviceIDBrachyAccessoryDeviceTypeBrachyAccessoryDeviceNameBrachyAccessoryDeviceNominalThicknessBrachyAccessoryDeviceNominalTransmissionChannelEffectiveLengthChannelInnerLengthAfterloaderChannelIDSourceApplicatorTipLengthChannelSequenceChannelNumberChannelLengthChannelTotalTimeSourceMovementTypeNumberOfPulsesPulseRepetitionIntervalSourceApplicatorNumberSourceApplicatorIDSourceApplicatorTypeSourceApplicatorNameSourceApplicatorLengthSourceApplicatorManufacturerSourceApplicatorWallNominalThicknessSourceApplicatorWallNominalTransmissionSourceApplicatorStepSizeApplicatorShapeReferencedROINumberTransferTubeNumberTransferTubeLengthChannelShieldSequenceChannelShieldNumberChannelShieldIDChannelShieldNameChannelShieldNominalThicknessChannelShieldNominalTransmissionFinalCumulativeTimeWeightBrachyControlPointSequenceControlPointRelativePositionControlPoint3DPositionCumulativeTimeWeightCompensatorDivergenceCompensatorMountingPositionSourceToCompensatorDistanceTotalCompensatorTrayWaterEquivalentThicknessIsocenterToCompensatorTrayDistanceCompensatorColumnOffsetIsocenterToCompensatorDistancesCompensatorRelativeStoppingPowerRatioCompensatorMillingToolDiameterIonRangeCompensatorSequenceCompensatorDescriptionRadiationMassNumberRadiationAtomicNumberRadiationChargeStateScanModeModulatedScanModeTypeVirtualSourceAxisDistancesSnoutSequenceSnoutPositionSnoutIDNumberOfRangeShiftersRangeShifterSequenceRangeShifterNumberRangeShifterIDRangeShifterTypeRangeShifterDescriptionNumberOfLateralSpreadingDevicesLateralSpreadingDeviceSequenceLateralSpreadingDeviceNumberLateralSpreadingDeviceIDLateralSpreadingDeviceTypeLateralSpreadingDeviceDescriptionLateralSpreadingDeviceWaterEquivalentThicknessNumberOfRangeModulatorsRangeModulatorSequenceRangeModulatorNumberRangeModulatorIDRangeModulatorTypeRangeModulatorDescriptionBeamCurrentModulationIDPatientSupportTypePatientSupportIDPatientSupportAccessoryCodeTrayAccessoryCodeFixationLightAzimuthalAngleFixationLightPolarAngleMetersetRateRangeShifterSettingsSequenceRangeShifterSettingIsocenterToRangeShifterDistanceRangeShifterWaterEquivalentThicknessLateralSpreadingDeviceSettingsSequenceLateralSpreadingDeviceSettingIsocenterToLateralSpreadingDeviceDistanceRangeModulatorSettingsSequenceRangeModulatorGatingStartValueRangeModulatorGatingStopValueRangeModulatorGatingStartWaterEquivalentThicknessRangeModulatorGatingStopWaterEquivalentThicknessIsocenterToRangeModulatorDistanceScanSpotTimeOffsetScanSpotTuneIDScanSpotPrescribedIndicesNumberOfScanSpotPositionsScanSpotReorderedScanSpotPositionMapScanSpotReorderingAllowedScanSpotMetersetWeightsScanningSpotSizeScanSpotSizesDeliveredNumberOfPaintingsIonToleranceTableSequenceIonBeamSequenceIonBeamLimitingDeviceSequenceIonBlockSequenceIonControlPointSequenceIonWedgeSequenceIonWedgePositionSequenceReferencedSetupImageSequenceSetupImageCommentMotionSynchronizationSequenceControlPointOrientationGeneralAccessorySequenceGeneralAccessoryIDGeneralAccessoryDescriptionGeneralAccessoryTypeGeneralAccessoryNumberSourceToGeneralAccessoryDistanceIsocenterToGeneralAccessoryDistanceApplicatorGeometrySequenceApplicatorApertureShapeApplicatorOpeningApplicatorOpeningXApplicatorOpeningYSourceToApplicatorMountingPositionDistanceNumberOfBlockSlabItemsBlockSlabSequenceBlockSlabThicknessBlockSlabNumberDeviceMotionControlSequenceDeviceMotionExecutionModeDeviceMotionObservationModeDeviceMotionParameterCodeSequenceDistalDepthFractionDistalDepthNominalRangeModulationFractionsNominalRangeModulatedRegionDepthsDepthDoseParametersSequenceDeliveredDepthDoseParametersSequenceDeliveredDistalDepthFractionDeliveredDistalDepthDeliveredNominalRangeModulationFractionsDeliveredNominalRangeModulatedRegionDepthsDeliveredReferenceDoseDefinitionReferenceDoseDefinitionRTControlPointIndexRadiationGenerationModeIndexReferencedDefinedDeviceIndexRadiationDoseIdentificationIndexNumberOfRTControlPointsReferencedRadiationGenerationModeIndexTreatmentPositionIndexReferencedDeviceIndexTreatmentPositionGroupLabelTreatmentPositionGroupUIDTreatmentPositionGroupSequenceReferencedTreatmentPositionIndexReferencedRadiationDoseIdentificationIndexRTAccessoryHolderWaterEquivalentThicknessReferencedRTAccessoryHolderDeviceIndexRTAccessoryHolderSlotExistenceFlagRTAccessoryHolderSlotSequenceRTAccessoryHolderSlotIDRTAccessoryHolderSlotDistanceRTAccessorySlotDistanceRTAccessoryHolderDefinitionSequenceRTAccessoryDeviceSlotIDRTRadiationSequenceRadiationDoseSequenceRadiationDoseIdentificationSequenceRadiationDoseIdentificationLabelReferenceDoseTypePrimaryDoseValueIndicatorDoseValuesSequenceDoseValuePurposeReferenceDosePointCoordinatesRadiationDoseValuesParametersSequenceMetersetToDoseMappingSequenceExpectedInVivoMeasurementValuesSequenceExpectedInVivoMeasurementValueIndexRadiationDoseInVivoMeasurementLabelRadiationDoseCentralAxisDisplacementRadiationDoseValueRadiationDoseSourceToSkinDistanceRadiationDoseMeasurementPointCoordinatesRadiationDoseSourceToExternalContourDistanceRTToleranceSetSequenceRTToleranceSetLabelAttributeToleranceValuesSequenceToleranceValuePatientSupportPositionToleranceSequenceTreatmentTimeLimitCArmPhotonElectronControlPointSequenceReferencedRTRadiationSequenceReferencedRTInstanceSequenceReferencedRTPatientSetupSequenceSourceToPatientSurfaceDistanceTreatmentMachineSpecialModeCodeSequenceIntendedNumberOfFractionsRTRadiationSetIntentRTRadiationPhysicalAndGeometricContentDetailFlagRTRecordFlagTreatmentDeviceIdentificationSequenceReferencedRTPhysicianIntentSequenceCumulativeMetersetDeliveryRateDeliveryRateUnitSequenceTreatmentPositionSequenceRadiationSourceAxisDistanceNumberOfRTBeamLimitingDevicesRTBeamLimitingDeviceProximalDistanceRTBeamLimitingDeviceDistalDistanceParallelRTBeamDelimiterDeviceOrientationLabelCodeSequenceBeamModifierOrientationAngleFixedRTBeamDelimiterDeviceSequenceParallelRTBeamDelimiterDeviceSequenceNumberOfParallelRTBeamDelimitersParallelRTBeamDelimiterBoundariesParallelRTBeamDelimiterPositionsRTBeamLimitingDeviceOffsetRTBeamDelimiterGeometrySequenceRTBeamLimitingDeviceDefinitionSequenceParallelRTBeamDelimiterOpeningModeParallelRTBeamDelimiterLeafMountingSidePatientSetupUIDWedgeDefinitionSequenceRadiationBeamWedgeAngleRadiationBeamWedgeThinEdgeDistanceRadiationBeamEffectiveWedgeAngleNumberOfWedgePositionsRTBeamLimitingDeviceOpeningSequenceNumberOfRTBeamLimitingDeviceOpeningsRadiationDosimeterUnitSequenceRTDeviceDistanceReferenceLocationCodeSequenceRadiationDeviceConfigurationAndCommissioningKeySequencePatientSupportPositionParameterSequencePatientSupportPositionSpecificationMethodPatientSupportPositionDeviceParameterSequenceDeviceOrderIndexPatientSupportPositionParameterOrderIndexPatientSupportPositionDeviceToleranceSequencePatientSupportPositionToleranceOrderIndexCompensatorDefinitionSequenceCompensatorMapOrientationCompensatorProximalThicknessMapCompensatorDistalThicknessMapCompensatorBasePlaneOffsetCompensatorShapeFabricationCodeSequenceCompensatorShapeSequenceRadiationBeamCompensatorMillingToolDiameterBlockDefinitionSequenceBlockEdgeDataBlockOrientationRadiationBeamBlockThicknessRadiationBeamBlockSlabThicknessBlockEdgeDataSequenceNumberOfRTAccessoryHoldersGeneralAccessoryDefinitionSequenceNumberOfGeneralAccessoriesBolusDefinitionSequenceNumberOfBolusesEquipmentFrameOfReferenceUIDEquipmentFrameOfReferenceDescriptionEquipmentReferencePointCoordinatesSequenceEquipmentReferencePointCodeSequenceRTBeamLimitingDeviceAngleSourceRollAngleRadiationGenerationModeSequenceRadiationGenerationModeLabelRadiationGenerationModeDescriptionRadiationGenerationModeMachineCodeSequenceRadiationTypeCodeSequenceNominalEnergyMinimumNominalEnergyMaximumNominalEnergyRadiationFluenceModifierCodeSequenceEnergyUnitCodeSequenceNumberOfRadiationGenerationModesPatientSupportDevicesSequenceNumberOfPatientSupportDevicesRTBeamModifierDefinitionDistanceBeamAreaLimitSequenceReferencedRTPrescriptionSequenceDoseValueInterpretationTreatmentSessionUIDRTRadiationUsageReferencedRTRadiationSetSequenceReferencedRTRadiationRecordSequenceRTRadiationSetDeliveryNumberClinicalFractionNumberRTTreatmentFractionCompletionStatusRTRadiationSetUsageTreatmentDeliveryContinuationFlagTreatmentRecordContentOriginRTTreatmentTerminationStatusRTTreatmentTerminationReasonCodeSequenceMachineSpecificTreatmentTerminationCodeSequenceRTRadiationSalvageRecordControlPointSequenceStartingMetersetValueKnownFlagTreatmentTerminationDescriptionTreatmentToleranceViolationSequenceTreatmentToleranceViolationCategoryTreatmentToleranceViolationAttributeSequenceTreatmentToleranceViolationDescriptionTreatmentToleranceViolationIdentificationTreatmentToleranceViolationDateTimeRecordedRTControlPointDateTimeReferencedRadiationRTControlPointIndexAlternateValueSequenceConfirmationSequenceInterlockSequenceInterlockDateTimeInterlockDescriptionInterlockOriginatingDeviceSequenceInterlockCodeSequenceInterlockResolutionCodeSequenceInterlockResolutionUserSequenceOverrideDateTimeTreatmentToleranceViolationTypeCodeSequenceTreatmentToleranceViolationCauseCodeSequenceMeasuredMetersetToDoseMappingSequenceReferencedExpectedInVivoMeasurementValueIndexDoseMeasurementDeviceCodeSequenceAdditionalParameterRecordingInstanceSequenceRETIRED_undefinedInterlockOriginDescriptionRTPatientPositionScopeSequenceReferencedTreatmentPositionGroupUIDRadiationOrderIndexOmittedRadiationSequenceReasonForOmissionCodeSequenceRTDeliveryStartPatientPositionSequenceRTTreatmentPreparationPatientPositionSequenceReferencedRTTreatmentPreparationSequenceReferencedPatientSetupPhotoSequencePatientTreatmentPreparationMethodCodeSequencePatientTreatmentPreparationProcedureParameterDescriptionPatientTreatmentPreparationDeviceSequencePatientTreatmentPreparationProcedureSequencePatientTreatmentPreparationProcedureCodeSequencePatientTreatmentPreparationMethodDescriptionPatientTreatmentPreparationProcedureParameterSequencePatientSetupPhotoDescriptionPatientTreatmentPreparationProcedureIndexReferencedPatientSetupProcedureIndexRTRadiationTaskSequenceRTPatientPositionDisplacementSequenceRTPatientPositionSequenceDisplacementReferenceLabelDisplacementMatrixPatientSupportDisplacementSequenceDisplacementReferenceLocationCodeSequenceRTRadiationSetDeliveryUsagePatientTreatmentPreparationSequencePatientToEquipmentRelationshipSequenceImagingEquipmentToTreatmentDeliveryDeviceRelationshipSequenceReferencedRTPlanSequenceReferencedBeamSequenceReferencedBeamNumberReferencedReferenceImageNumberStartCumulativeMetersetWeightEndCumulativeMetersetWeightReferencedBrachyApplicationSetupSequenceReferencedBrachyApplicationSetupNumberReferencedSourceNumberReferencedFractionGroupSequenceReferencedFractionGroupNumberReferencedVerificationImageSequenceReferencedReferenceImageSequenceReferencedDoseReferenceSequenceReferencedDoseReferenceNumberBrachyReferencedDoseReferenceSequenceReferencedStructureSetSequenceReferencedPatientSetupNumberReferencedDoseSequenceReferencedToleranceTableNumberReferencedBolusSequenceReferencedWedgeNumberReferencedCompensatorNumberReferencedBlockNumberReferencedControlPointIndexReferencedControlPointSequenceReferencedStartControlPointIndexReferencedStopControlPointIndexReferencedRangeShifterNumberReferencedLateralSpreadingDeviceNumberReferencedRangeModulatorNumberOmittedBeamTaskSequenceReasonForOmissionReasonForOmissionDescriptionPrescriptionOverviewSequenceTotalPrescriptionDosePlanOverviewSequencePlanOverviewIndexReferencedPlanOverviewIndexNumberOfFractionsIncludedDoseCalibrationConditionsSequenceAbsorbedDoseToMetersetRatioDelineatedRadiationFieldSizeDoseCalibrationConditionsVerifiedFlagCalibrationReferencePointDepthGatingBeamHoldTransitionSequenceBeamHoldTransitionBeamHoldTransitionDateTimeBeamHoldOriginatingDeviceSequenceBeamHoldTransitionTriggerSourceApprovalStatusReviewDateReviewTimeReviewerNameRadiobiologicalDoseEffectSequenceRadiobiologicalDoseEffectFlagEffectiveDoseCalculationMethodCategoryCodeSequenceEffectiveDoseCalculationMethodCodeSequenceEffectiveDoseCalculationMethodDescriptionConceptualVolumeUIDOriginatingSOPInstanceReferenceSequenceConceptualVolumeConstituentSequenceEquivalentConceptualVolumeInstanceReferenceSequenceEquivalentConceptualVolumesSequenceReferencedConceptualVolumeUIDConceptualVolumeCombinationExpressionConceptualVolumeConstituentIndexConceptualVolumeCombinationFlagConceptualVolumeCombinationDescriptionConceptualVolumeSegmentationDefinedFlagConceptualVolumeSegmentationReferenceSequenceConceptualVolumeConstituentSegmentationReferenceSequenceConstituentConceptualVolumeUIDDerivationConceptualVolumeSequenceSourceConceptualVolumeUIDConceptualVolumeDerivationAlgorithmSequenceConceptualVolumeDescriptionSourceConceptualVolumeSequenceAuthorIdentificationSequenceManufacturerModelVersionDeviceAlternateIdentifierDeviceAlternateIdentifierTypeDeviceAlternateIdentifierFormatSegmentationCreationTemplateLabelSegmentationTemplateUIDReferencedSegmentReferenceIndexSegmentReferenceSequenceSegmentReferenceIndexDirectSegmentReferenceSequenceCombinationSegmentReferenceSequenceConceptualVolumeSequenceSegmentedRTAccessoryDeviceSequenceSegmentCharacteristicsSequenceRelatedSegmentCharacteristicsSequenceSegmentCharacteristicsPrecedenceRTSegmentAnnotationSequenceSegmentAnnotationCategoryCodeSequenceSegmentAnnotationTypeCodeSequenceDeviceLabelDeviceTypeCodeSequenceSegmentAnnotationTypeModifierCodeSequencePatientEquipmentRelationshipCodeSequenceReferencedFiducialsUIDPatientTreatmentOrientationSequenceUserContentLabelUserContentLongLabelEntityLabelEntityNameEntityDescriptionEntityLongLabelDeviceIndexRTTreatmentPhaseIndexRTTreatmentPhaseUIDRTPrescriptionIndexRTSegmentAnnotationIndexBasisRTTreatmentPhaseIndexRelatedRTTreatmentPhaseIndexReferencedRTTreatmentPhaseIndexReferencedRTPrescriptionIndexReferencedParentRTPrescriptionIndexManufacturerDeviceIdentifierInstanceLevelReferencedPerformedProcedureStepSequenceRTTreatmentPhaseIntentPresenceFlagRadiotherapyTreatmentTypeTeletherapyRadiationTypeBrachytherapySourceTypeReferencedRTTreatmentPhaseSequenceReferencedDirectSegmentInstanceSequenceIntendedRTTreatmentPhaseSequenceIntendedPhaseStartDateIntendedPhaseEndDateRTTreatmentPhaseIntervalSequenceTemporalRelationshipIntervalAnchorMinimumNumberOfIntervalDaysMaximumNumberOfIntervalDaysPertinentSOPClassesInStudyPertinentSOPClassesInSeriesRTPrescriptionLabelRTPhysicianIntentPredecessorSequenceRTTreatmentApproachLabelRTPhysicianIntentSequenceRTPhysicianIntentIndexRTTreatmentIntentTypeRTPhysicianIntentNarrativeRTProtocolCodeSequenceReasonForSupersedingRTDiagnosisCodeSequenceReferencedRTPhysicianIntentIndexRTPhysicianIntentInputInstanceSequenceRTAnatomicPrescriptionSequencePriorTreatmentDoseDescriptionPriorTreatmentReferenceSequenceDosimetricObjectiveEvaluationScopeTherapeuticRoleCategoryCodeSequenceTherapeuticRoleTypeCodeSequenceConceptualVolumeOptimizationPrecedenceConceptualVolumeCategoryCodeSequenceConceptualVolumeBlockingConstraintConceptualVolumeTypeCodeSequenceConceptualVolumeTypeModifierCodeSequenceRTPrescriptionSequenceDosimetricObjectiveSequenceDosimetricObjectiveTypeCodeSequenceDosimetricObjectiveUIDReferencedDosimetricObjectiveUIDDosimetricObjectiveParameterSequenceReferencedDosimetricObjectivesSequenceAbsoluteDosimetricObjectiveFlagDosimetricObjectiveWeightDosimetricObjectivePurposePlanningInputInformationSequenceTreatmentSiteTreatmentSiteCodeSequenceFractionPatternSequenceTreatmentTechniqueNotesPrescriptionNotesNumberOfIntervalFractionsNumberOfFractionsIntendedDeliveryDurationFractionationNotesRTTreatmentTechniqueCodeSequencePrescriptionNotesSequenceFractionBasedRelationshipSequenceFractionBasedRelationshipIntervalAnchorMinimumHoursBetweenFractionsIntendedFractionStartTimeIntendedStartDayOfWeekWeekdayFractionPatternSequenceDeliveryTimeStructureCodeSequenceTreatmentSiteModifierCodeSequenceRoboticBaseLocationIndicatorRoboticPathNodeSetCodeSequenceRoboticNodeIdentifierRTTreatmentSourceCoordinatesRadiationSourceCoordinateSystemYawAngleRadiationSourceCoordinateSystemRollAngleRadiationSourceCoordinateSystemPitchAngleRoboticPathControlPointSequenceTomotherapeuticControlPointSequenceTomotherapeuticLeafOpenDurationsTomotherapeuticLeafInitialClosedDurationsConceptualVolumeIdentificationSequenceRETIRED_ArbitraryRETIRED_TextCommentsRETIRED_ResultsIDRETIRED_ResultsIDIssuerRETIRED_ReferencedInterpretationSequenceRETIRED_ReportProductionStatusTrialRETIRED_InterpretationRecordedDateRETIRED_InterpretationRecordedTimeRETIRED_InterpretationRecorderRETIRED_ReferenceToRecordedSoundRETIRED_InterpretationTranscriptionDateRETIRED_InterpretationTranscriptionTimeRETIRED_InterpretationTranscriberRETIRED_InterpretationTextRETIRED_InterpretationAuthorRETIRED_InterpretationApproverSequenceRETIRED_InterpretationApprovalDateRETIRED_InterpretationApprovalTimeRETIRED_PhysicianApprovingInterpretationRETIRED_InterpretationDiagnosisDescriptionRETIRED_InterpretationDiagnosisCodeSequenceRETIRED_ResultsDistributionListSequenceRETIRED_DistributionNameRETIRED_DistributionAddressRETIRED_InterpretationIDRETIRED_InterpretationIDIssuerRETIRED_InterpretationTypeIDRETIRED_InterpretationStatusIDRETIRED_ImpressionsRETIRED_ResultsCommentsLowEnergyDetectorsHighEnergyDetectorsDetectorGeometrySequenceThreatROIVoxelSequenceThreatROIBaseThreatROIExtentsThreatROIBitmapRouteSegmentIDGantryTypeOOIOwnerTypeRouteSegmentSequencePotentialThreatObjectIDThreatSequenceThreatCategoryThreatCategoryDescriptionATDAbilityAssessmentATDAssessmentFlagATDAssessmentProbabilityMassDensityZEffectiveBoardingPassIDCenterOfMassCenterOfPTOBoundingPolygonRouteSegmentStartLocationIDRouteSegmentEndLocationIDRouteSegmentLocationIDTypeAbortReasonVolumeOfPTOAbortFlagRouteSegmentStartTimeRouteSegmentEndTimeTDRTypeInternationalRouteSegmentThreatDetectionAlgorithmandVersionAssignedLocationAlarmDecisionTimeAlarmDecisionNumberOfTotalObjectsNumberOfAlarmObjectsPTORepresentationSequenceATDAssessmentSequenceTIPTypeDICOSVersionOOIOwnerCreationTimeOOITypeOOISizeAcquisitionStatusBasisMaterialsCodeSequencePhantomTypeOOIOwnerSequenceScanTypeItineraryIDItineraryIDTypeItineraryIDAssigningAuthorityRouteIDRouteIDAssigningAuthorityInboundArrivalTypeCarrierIDCarrierIDAssigningAuthoritySourceOrientationSourcePositionBeltHeightAlgorithmRoutingCodeSequenceTransportClassificationOOITypeDescriptorTotalProcessingTimeDetectorCalibrationDataAdditionalScreeningPerformedAdditionalInspectionSelectionCriteriaAdditionalInspectionMethodSequenceAITDeviceTypeQRMeasurementsSequenceTargetMaterialSequenceSNRThresholdImageScaleRepresentationReferencedPTOSequenceReferencedTDRInstanceSequencePTOLocationDescriptionAnomalyLocatorIndicatorSequenceAnomalyLocatorIndicatorPTORegionSequenceInspectionSelectionCriteriaSecondaryInspectionMethodSequencePRCSToRCSOrientationMACParametersSequenceSharedFunctionalGroupsSequencePerFrameFunctionalGroupsSequenceWaveformSequenceChannelMinimumValueChannelMaximumValueWaveformBitsAllocatedWaveformSampleInterpretationWaveformPaddingValueWaveformDataFirstOrderPhaseCorrectionAngleSpectroscopyDataExtendedOffsetTableExtendedOffsetTableLengthsEncapsulatedPixelDataValueTotalLengthFloatPixelDataDoubleFloatPixelDataPixelDataRETIRED_CoefficientsSDVNRETIRED_CoefficientsSDHNRETIRED_CoefficientsSDDNDigitalSignaturesSequenceDataSetTrailingPaddingItemItemDelimitationItemSequenceDelimitationItem",ty={groups_b64:"AAACAAQACAAQABIAFAAWABgAIAAiACQAKAAyADQAOAA6AEAAQgBEAEYASABQAFIAVABgAGIAZABmAGgAagBwAHIAdAB2AHgAgACCAIgAAAEABAAQEBAAIBAgICAwIEAgUCAAIRAhICEwIQAiAjAEMAYwCDAKMAwwDjAQMABACEAQQP5PAFIAVABW4H/6//z//v8=",groupStart_b64:"AAAAAC4AAAA6AAAATQAAAFUBAACiAQAAwgEAAIwCAAD6AgAAegYAAPQGAACjBwAACAgAAP8IAAAdCQAAKQkAAEcJAACGCQAAzgoAANQKAADtCgAARgsAAGsLAAB8CwAAlgsAAOcLAADuCwAAAwwAAAsMAABPDAAAmgwAAKoMAABmDQAA4g0AACwOAABDDgAAVQ4AAGIOAAB6DgAAgQ4AAIUOAAChDgAApw4AAKgOAAC9DgAA1w4AAOIOAADkDgAA8A4AAPMOAAD9DgAAAQ8AAAQPAAANDwAAHQ8AAGwPAACEDwAAww8AACcQAACOEgAAwBIAAMQSAABYEwAAWhMAAHYTAADMEwAAzRMAAM8TAADWEwAA2BMAAOETAADiEwAA4xMAAA==",elems_b64:"AAABAAIAAwAQAAABEAEgAQACAAMABAAGAAcACFAIYAgACQEJAgkDCQAQARACEAUQCBAgECEQIhAjEDAQMRAAQBBAEFAgUBBRIFEwUUBRUFFgUXBRgFGQUaBRsFEAAAEAAgADABAAEgATABYAFwAYAAABAgEwEUERQhEAEgISEhIgEgAUEBQgFDAUMhQAFQQVEBURFRIVGhUAFgEABQAGAAgAEAASABMAFAAVABYAFwAYABkAGgAbABwAIAAhACIAIwAkACUAKgAwADEAMgAzADQANQBAAEEAQgBQAFEAUgBTAFQAVQBWAFgAYABhAGIAYwBkAGgAcACAAIEAggCQAJIAlACWAJwAnQAAAQEBAgEDAQQBBQEGAQcBCAEJAQoBCwEMAQ0BDgEPARABEgEUARUBFgEXARgBGQEgASEBIgEjASQBAQIgAiECIgIAAwEDAgMDAwQDBQMGAwcDCAMJAwoDCwMMAw0DDgMPAxADAAQBBAIEAwQEBAUEBgQHBAgECQQKBAsEDAQNBA4EDwQQBBEEEgQTBBQEFQQWBBcEGAQZBBoEGwQcBB0EHgQfBCAEIQQiBCMEJAQlBCYEJwQoBCkEABAQEDAQMhA+ED8QQBBBEEgQSRBQEFIQYBBiEHAQchCAEIQQiBCQEAAREBERERIRFREgESURMBE0EToRQBFFEUoRSxFQEVURVhFaEWARYRFiEWMRZBFnEZARlRGWEZcRmBGZEZoRmxEAElASECERIRIhICEiISQhJyEoISkhKiEwITIhMyE0ITUhQiFDIUQhACIEIggiGCIgIigiKSIwIkAiQiJEIkYiUSJTIlUiViJXIlgiWSJaIlwiATACMBAwETASMABAB5CSkCGRI5EkkVSRBZIGkgeSCJIJkhWSN5IQlFiUWZRglBAAIAAhACIAJAAmACcAKAAwADIAMwA0ADUAQABQAAEBAgEAAgECEgITAhQCFQIWAhcCGAIZAiECIgIjAikCABABEAIQBRAQECAQIRAiECMQJBAwEEAQUBBgEIAQgRCQEAARACAQIVAhUiFUIVUhYCFhIYAhoCGwIcAh0CHwIQEiAiIDIhAikiKTIpQilSKWIpcimCKZIgBAMZQQACAAIQAiACMAMAAxADIAQABBAEIAQwBQAFEAUgBTAFQAVQBgAGIAYwBkAHEAcgBzAIEAggCDAIQAhQCGAIcAIwAkACUAKAAwADIANABCAEQARQBGAFAAUgBUAFYAAAEBAQIBAwEEAQUBBgEHAQgBAAIBAgICAwIEAgUCBgIHAhAQIBBAEAIgBCAGIAggEiAUIBYgGCAaIBwgHiAwIDIgAiIEIgYiCCIKIgwiDiIQIiAiIiIkIiYiKCIqIiwiETASMCAwIjAkMCYwKDBAMFAwYDBwMHEwcjBzMHQwdTB2MHcwgDCZMAAxATECQARABkAIQApADEAOQA9AEEARQBJAE0AUQBVAFkAXQBhAGUAaQBtAHEAdQCBAIkAkQCZAKEAwQDFAMkAzQDRANUA2QDhAOkA8QEBAUEBRQFJAVEBWQFdAWEBZQFpAXEBgQGJAZEBwQHJAdEB2QHhAekB8QH5AgECBQIJAg0CEQIVAhkCHQIhAiUCLQIxAjUCOQJFAkkCaQJtAnECdQJ9AoEChQKJAAlAEUABRAVECUQNRBFEFUQZRB1EIUQlRClELUQxRDVEOUQ9REFERURJRE1EUURVRFlEXURhRGVEaURtRHFEdUR5RH1EBAAIAAwAEAAUABgAHAAgACQAKAAsADAANAA4ADwAQABEAEgATABQAFQAWABcAGAAZABoAGwAcAB0AHgAfACAAIQAiACMAJAAlACYAJwAoACkAKgArADAAMQAyADMANAA1ADYANwA4ADkAOgA7AEEAQgBDAEQARQBGAEcASABJAEoASwBMAE0ATgBPAFAAUQBhAGIAcABxAHIAcwB0AHUAdgB3AHgAeQB6AHsAfAB9AH4AfwCAAIEAggCDAIQAhQCGAIcAiACJAIoAiwCMAI0AjgABEAIQAxAEEAUQEAASABMAFAAVACAAIQAiACMAJAAlACYAJwAoACkAKgAwADEAMgAzADQANQA2ADcAOAA5ADoAQABCAFAAYABhAHAAcQByAHMAdAB1AIAAgQCCAIMAhACFAIYAhwCIAIkAkACRAJMAlACVAAAQAhADEAQQBRAGEAcQCBAJEAoQCxAQEBEQEhAUEBYQFxAYEBkQGhAbECAQIhAjEDAQQBBBEEIQQxBEEEUQRhBHEEgQSRBQEGAQYRBiEGMQZBBlEGYQZxBoEGkQahBsEG4QcBBxEHIQcxB0EHUQdhB3EHgQeRCAEIEQghCDEIQQhRCGEIgQkBCUEAAREBERERQRIBEhETARMRE0ETURNhE3ETgROhFAEUERQhFDEUQRRRFGEUcRSRFQEVERUhFTEVQRVRFWEVoRXhFgEWERYhFkEWYRcBGAEYERghGDEYQRkBGREaARohGjEaQRpRGwEbERshGzEbQRtRG2EbcRuBG5EboRuxG8Eb0RvhG/EcARwREAEgESAhIDEgQSBRIQEkASQhJDEkQSUBJREmASYRJxEnISABMBEwITEBMSExQTFRMWExgTIBMAFAEUAhQDFAQUBRQRFBIUExRQFGAUcBSAFJAUkRSVFAAVCBUQFREVIBUhFTAVMRUAFgIWBBYGFggWEBYSFiAWIhYjFiQWMBYxFjIWMxY0FjUWNhY3FjgWABcCFwQXBhcIFxAXEhcgFwAYARgCGAMYASACIAMgBCAFIAYgECAgIDAgQSBCIEMgRCBFIEYgADEBMQIxAzEEMQUxAEAAUBBQEVASUCBQIVAiUCRQJlAnUChQKVAwUEBQUFAAUQFRBFEQUhJSAGARYBJgFGAWYBhgGmAcYB5gIGAiYCRgJmAoYCpgLGAuYDBgMWAyYDRgNmA4YDlgOmA7YDxgPWA+YD9gQGBBYEJgQ2BEYEZgSGBKYExgTmBQYFJgVGBWYFhgWmBgYHBgAHABcARwBXAGcAhwCnAMcA5wEHARcBJwFHAWcBpwIHAicCRwJnAocCpwK3AwcDJwNHA2cDhwQHBBcEJwRHBGcEhwTHBQcFJwVHBWcFhwYHBicGRwZXBQgVGBBJAFkAaQCJAJkBCQEZASkBSQFZAWkBeQGJAZkCCQIZAikCSQJZAmkCeQKJApkDCQMpAzkDSQNZA2kDeQQZBCkEOQRJBFkEaQR5BIkEmQUJBRkFKQU5BUkFiQWZBgkGGQYpBjkGSQZZBmkGeQaZBwkHOQdJB1kHaQd5B4kHmQgJCBkIKQg5CEkIWQh5CJkJCQkZCSkJOQlJCVkJaQmJAAkQGRA5EEkQWRBpEHkRKRFJEVkReRGJEZkSWRJpEnkUeRUZFSkVWRWZFmkWiRaZFwkXGRcpFzkXSRdZF2kXeReJF5kYCRgZGCkYORhJGFkYaRlZGWkZeRmJGZkQCSFJIXkhiSGZIgkiaSJ5IxkjKSNJI2kjmSQJJBklCSUZJSklOSVJJVklaSV5JYklmSWpJbklySXZJekl+SYJKVkpaSl5KYkgGTApMDkwSTBZMGkweTCJMJkxCTEZMSkxOTFJMVkxaTF5MYkxmTIJMhkyKTI5MkkyWTJpMnkyiTKZMwkzKTM5M0kzWTN5M4k0CTQZNCk0OTRJNFk0aTUZNSk1OTYJNhk2KTY5Nkk2WTZpNnk2iTaZNqk2uTbJNtk26Tb5Nwk3GTcpNzk3STdZN2k3eTeJN5k3qTe5N8k32TfpN/k4CTgZOCk4OThJMBlAKUA5QElAWUBpQHlBCUEpQXlCCUI5QklCWUJpQnlCiUKZQwlDKUM5Q0lDWUNpQ3lDiUOZRAlEGUQpRHlEmUUZRSlFWUVpRXlGGUYpRjlGSUZZRmlGeUaJRplHCUcZRylHOUdJR2lHeUBJUGlQeVCJUJlRCVEZUUlRWVFpUXlRiVGZUklSWVJpUnlSiVMJUxlTiVQZVClUOVRJVFlUaVR5VIlUmVUJVRlVKVU5VUlVWVVpVXlViVWZUBlgKWA5YElgWWBpYHliGWIpYjliSWAZcVlxaXF5cYlxmXIJchlyKXI5cklyWXJpcnlymXMpczlzSXNZc2lzeXOJc5l0CXSZdRl1WXVpdYl1mXYJdhl2KXY5dkl2WXZpdnl2iXaZdwl3GXcpcBmAOYBJgFmAaYB5gImAmYC5gMmA2YDpgPmBCYIZgimCOYJJglmCaYKJgpmCqYK5gsmC2YLpgvmDCYMZgymDOYNJg1mDaYAJkBmQKZA5kEmQWZBpkHmQiZCZkKmQuZDJkNmQ6ZD5kQmRGZEpkTmRSZFZkWmReZGJkZmRqZG5kcmR2ZHpkfmSCZIZkimSOZJJkwmTGZMpkzmTSZNZk2mTeZOJk5mTqZO5k8mT2ZPplBmUKZQ5lEmUWZRplHmQGgAqADoA0ADgAQABEAEgATABQAFQAWABcAGAAZACAAIgAkACYAJwAwADIANQA3AFAAUgBgAGIAcACAAKoAAAEFARABAAJCAgAQARACEAMQBBAFECAQPxBAEEEQcBAAEgISBBIGEggSCRIBNAI0AzQENAU0BjQAQABQAlBWkFeQcZBykBGRE5EWkSiRU5FUkVWRVpFXkViRYZFikWORZJFlkWeRcJFxkXKRE5IhkiKSKJI4kkGSRZJGkkeSSJJJklCSUZJSklOSVJJVklaSV5IBkwKTB5MIkwmTCpMLkwyTDZMOkw+TEJMRkxKTE5MhlFCUU5QYlSmVNpUBAAIAAwAEAAUABgAHAAgACQAKAAsADAANAA4ADwAQABEAEgATABQAFQAWABcAGAAZABoAGwAcAB0AHgAgACEAIgAoADAAMQAyADUANgA3ADgAOQBBAEIASABJAE4AVQBWAFcAWAAHEAgQCRAQEBIQGRAkECUQKBApEDMQNRA2EDcQORBAEEQQRRBGEEcQSBBJEEoQSxBQEFMQVBBZEGUQZhCQEJIQkxCUEJUQlhCXEAARAREDESERIhElEScRKBEqESsRLBEwETERMhEzETQRNRFAEVARUxFVEVkREBIREhISIBIlEjASUBJVElcSYBJiEmUScxIAExATMBMVFCAUIxQ2FEMURRRQFFIUVBRYFGAUYxRlFGYUZxRoFHAUchQSFRMVFRUXFRgVJRUmFScVKBUpFTAVMRUSFhUWFhYYFiAWIhYkFiYWKBYwFkAWQhZDFkQWRRZGFkkWUBZYFhAAEQASABYAGAAgACEAJAAlACgAMgAzADQANQA2ADcAOAA5AEAAQgBEAEUARgBIAFAAUQBSAFMAVABVAFYAVwBYAFkAYABhAGIAYwBkAGUAZgBnAGgAaQBwAHEAcgBzAHQAdQB2AHcAeAB5AIAAgQCDAIUAhgCHAIgAiQCQAJEAkgCTAJQAlQCWAJcAmAAAAQIBAwEEAQUBBgEHAQgBEAESARMBFAEVARcBGAEgASIBJAEmAQICBgMHAwgDCQMXAyADJQM4A0EDRAMCAAMABAAFAAYACAAJAAoAEAARABIAFAAwADEAMgA0AEAAUABRAF8AYABhAGIAYwBlAGYAaABpAHAAcQCAAIEAggCQAJEAkgCTAJQAAAEBAQIBAwEEAQUBBgEHAQgBCQEQAREBIAEhASIBIwEkASUBAAIAAwEDAgMDAwQDAAQBBAIEAwQEBBAEEQQSBBMEAAcBBwIHEAcgByEHIgcwB0AHAAgCCAMIBAgICAIKBApAEEEQUBBREFIQUxBUEFUQVhCAEJAQABEBEQIRAxEEEREREhETEZkRABIBEgISAxIEEhESEhITEhQSIRIiEiMSJBIwEjESMhIAE1ATURNSE1oTARQCFAMUBBQFFAYUBxQIFAsUDBQNFA4UDxQQFAAgAiAQIRIhFCEAMAEwAjADMAQwBjAQMBAxAEAAUBBgIGAiYCNgMGBAYABhAWECYRBhEmEUYSBhkGEAcAFwAnADcARwBXAGcAdwCHAJcApwC3AMcA1wDnAPcBBwEXAScBNwFHAVcBZwF3AYcBlwGnAbcBxwHXAecB9wIHAhcCJwI3AkcCVwJnAncChwKXAqcCtwLHAtcC5w4H8BkAKQA5CZkAiREJEykUWRNZIRlBWUFpQilEOURJRFlEaUVJR0lHiUAZUClQOVBZUGlQeVIJU3lQoADAASADIAMwA0ADUAABABEBAQERAgECEQMBAxEDIQMxA0EEAQQRBQEFEQVRBgEGQQZRBmEGcQcBAAQAEAAgADAAQABQAHAAgACQAKAAsADAANAAQACAAQABEAFAAWABoAGwAcAB0AHgAgACEAMAAyAEAARABQAGAAYQBiAGQAAAEBAQIBAAMABAAFAgUAQAQABQAQABoAIAAAAgICAwIFAggCCQIKAgwCEAIRAhICEwIUAhUCGAIaAiACIQIiAiMCMAIxAkACQQJCAkQCRQJGAkcCSAIAAwEDAgMQAxEDEgMTAxQDFQMWAxcDGAMZAyADIQMiAyMDJAMlAyYDJwMoAykDKgMrAywDLQMuAwEAAgADAAQABQAGAAcACAAJAAoACwAQABEAEgAgACYAJwAxADIAMwA1ADYAOQA6AAABIAJBAkICQwJEAkUCUAJRAlICUwJUAlUCYAJhAnACdQKAAoECkwKUApUClgIAAwEDAgMDAwYDBwMOAxADEgMUAxYDGAMgAyEDJAMwA0ADAARABEEEAAUKBRIFEwUVBRgFGgUgBVAFUQVSBVMFVAVVBVYFYAViBZoFAAYCBhAGEgYgBvoGEAcaByoHOgdKB9gI2gjqCPgJARACEAMQBBAFEAYQBxAIEAkQChAQEBEQEhBgEAERAhEDEQQRABQBIAQgBSAGIAcgCCAJIBAgESAWIBcgACQBMAFAAkADQARABUAGQAdACEAJQBBAEUAVQBZAGEAZQCBAIUAiQCNAJUAmQCdAKEApQDBAMUAyQDNANEA1QDZAN0BAQEFAUEBRQFJAcEBxQHJAc0B0QAKDA4OSkJSQlpCYkBCSEZISkhOSFJIWkiCSJJIlkgegEKAgoCGgIqAjoCSgJqAnoCigMKAyoDOgQKBDoEegUKBXoGCgZqBnoGigcKBzoHSgdaB2oHigeqB8oICggqCEoIWgiKCJoJCgsKAQoRKhIKEhoSKhI6EkoSWhMKEyoTahOKE6oWChYaFioWOhZ6FooWqhcKFxoXKhc6F0oYChkqGToZShlaEkopCilqKXopqiAKMBowejCqMTozqjQKNSo1OjVKNYo2CjcKNyo3WjgKOFo5CjAqQDpASkkaSSpJOklKSWpASlJaUApgGmA6YwpzGnMqdEpwGoAqgDqASoBagGqAeoCKiSqSCwANsG2wfbC9sM2w3bc9sB4ATgBuAI4BDgEeAg4CHgIuAj4CTgJeAw4DHgEAARABIAEwAUABUAAQACAAMABAAHAAgACQAKAAsAEAARABIAEwAZAAABAQECAQMBBAEFAQYBBwEIAQkBCgESABQAFQAWABgAKAAwADIANAA2ADgAQABCAEQARgBHAFAAUgBgAGIAYwBkAHAAcQB0AHUAdgB3AIAAkgCUAJUAlwCYAAABAQECAQQBBgEQAREBEgETARQBFQEWARcBGAEhASIBIwEkASUBNQE3ATkBRQFGAUcBAQICAgMCBAIFAgcCCAIQAhECEgITAhUCGAIgAiQCJwIwAjICNAI2AjgCQgJEAkcCSAJJAlACUQJSAlMCAQACAAMABgAHAAgAEAARABIAEwAUABUAAAECAQUBBgEHAQgBEAERARIBEwEUARUBFgEXASABAAIBAgICBwIaAh4CHwIBAwIDAwMEABAAEgATABQAFQAWABcAGAAZABoAGwAcAB0AHgAgACEAAQACAAMABAAGAAcACAAJABEAEgATABQAFgAlACYAJwAoACkAMAAxADMANAA2ADgAOQA6ABAAEQASABMAFAAVABYAFwAYACAAIQAiADAAMQAyADMANgA4ADkAUABRAFIAUwBgAGEAYgBjAHAAcQByAHMAgACBAJAAAAEBAQACAgIQAhECIAIiAgADAgMEAwYDCAMABBAEEgQUBAAFAQUAEAEQAhAEEAYQABEBEQIRAxEEEQURABIBEgISAxIQEiASABMQExETIBMhEyITIxMkEzATABQBFAAwAjAEMAYwCDAQMCAwAQACAAMABAAFAAYABwAIAAkACgALAAwADQAOAA8AEAARABIAEwAgACEAAgADAAUABwAIAAkADwAQAAEAAgADAAQACQAKAAsADAANAA4AEAARABIAEwAVABYAFwAYABkAGgAbABwAHgAfACAAIQAiACMAJAAlACYAJwAoACkAKgArACwALQAuAC8AMAAxADIANAA1ADYANwA4AEAAQQBCAEMAAQECAQMBBAEFAQYBBwEIASEBJAElASkBMAEyATMBNAEQYiFiImIjYiRiJWImYjBiYGJlYnBigGKgYqViwGLQYtVi4GLwYvJiAGMQYyBjMGNAY0VjRmNHY1BjYGOAY5BjoGOkY6hjrGOwY8Bj0GPgY/BjAGQQZCBkMGRAZFBkYGRwZJBkoGTAZNBk8GQAZRBlIGUwZUBlRWVQZWBlkGWgZbBl0GXgZfBlEGYgZgFwAnADcARwBXABAAIAAwAFAAYABwAIAAkACgALAAwADQAOAA8AEAARAAEAAgADAAQABQAGAAgACQAQABEAEgAUABUAIAAhACIAIwAkAEAAQQBCAFAAUQBSAFMAWgBgAGIAZgBnAGgAgACBAIIAgwCEAIYAhwAAAQEBAgEDAQcCCAIJAiYCJwIoAikCMAIxAjICMwI0AkECQgJDAkQCRQJGAkcCSAJJAlACUQJSAlMCVAJVAlYCVwJYAmECYgJzAnQCeAJ5AoIChAKFAocCiAKJApQClQIGAwgDCQMKAwsDDAMNAw8DEAMRAxIDFAMVAxgDGgMbAxwDHgMfAwEEAgQDBAQEBQQBEQIRAxEEEQESAhIDEgQSBRIGEgcSCBIJEgoSCxIMEg0SARMCEwMTBBMFEwYTCRMBFQIVAxUFFQcVCBUMFQ0VERUSFQIWAxYEFgUWBhYHFgEXAhcDFwQXBRcGFwEYAhgDGAQYBRgGGAcYCBgBGQMZBBkFGQcZARoDGgQaBRoGGgcaCBoJGgEbAhsDGwQbBhsHGwgbERsSGxMbFBsCAAQABgAIAAoADAAOABAAEgAUACAAIgAkACYAKAAwADIANAA4ADoAPAA+AEAAUABSAFQAVgBeAF8AYABhAGIAYwBkAGUAZgBnAGgAaQBqAGsAbABtAG4AbwBwAHEAcgBzAHQAdQB2AHgAegB8AH4AfwCAAIEAggCDAAABAgEEAQYBCAEKAQwBDgEAAgICAwIEAgYCCAIQAhICFAIWAhgCAAMCAwQDBgMIAxADEgMUAxYDGAMgAzADAAQCBAQEBgQgBCEEIgQkBCcEMAQyBDQEAAUQBRIFFAUWBSAFAAYCBgQGAAcCBwQHBQcGBxAHEgcUBxYHFwcYByABIQEAEAIQBBAGEAcQCBAKEAwQDhAgECIQJBAlECYQJxAoECoQKxAsEC0QMBAyEDQQNhA4EDoQQBBCEEQQRhBIEEoQTBBOEFAQUhBUEFYQVxAAEgISBBIQEhISFhIgEiISJBIwEjQSNhI4EkISRBJGEiQTOBM6EwEUAhQDFAQUBRQGFAcUCBQJFAoUCxQMFA0UDhQBAAMABgAIAAoADAAOABAAIAAwADIANAA2ADgAQABVAGAAcACAAJAAoACwAMAAAQAQACAAJAAmACgAKgAuAFAAYABwAJAAoACwALIAtAC2ALgAAQACAAMABAAFAAYABwAIAAkAEAARABIAEwABAAMABAAFAAYABwAIAAoADAAQABYAFwAYABkAIQAiACMAMgAzADQANQA2ADcAOAAwAUABAAIECQYJEAkSCRAEIAQkBCYEBQAQABUAIAAAAQUBEAEVASABBQMQAxUDAQQCBAMEBAQABRAFIAVQBVEFUgVhBWIFYwVkBWUFAAYQABEAEgATABQAFQAEABAAHgAgADAAQABQAGAAYQBiAGMAZQBnAGkAagCgAKEAogCkAKgAAAUQBRAAMABAAFAAUgBUAGAAgACmAKcAqACpAAABEAEgATABQAFQAVIBVAFeAWABdgMABRAFIAUQACAAMABAAFAAoACiABABEQEwAUABEAAgABAAEQAgAGAAcAByAHQAgACCAJAAAAEABRAAIAAABRAAIAAwAEAAUABwAEABYAFwAQAFEAAgADAAmQAQAFAAcAAQABUAMABAAFAAYACAAKAAwAABAAIAAwAEAAUABgAHAAgACQAKAAsADAANAA4ADwAgAAIAAwAEAAoADAANAA4AEAARABIAIAAiACQAJgAoACkAMAAyADQAQABBAEIAUABRAFIAAAEBAQIBAwEEAQUBBgEHAQgBCQEKAQsBDAENAQ4BDwEQAREBEgETARQBFQEWARcBGAEZARoBGwEcAR0BHgEfASABIQEiASMBJAElASYBJwEoASkBKgErASwBLQEuAS8BMAExATIBMwE0ATUBAQACAAQABQAGAAgACgAMAA4AEAASABQAQABCAFAAUgBUAFYAWABgAGIAcAByAHQAAgAEAAYACAAJABAAEgAUABYAGAAgACIAJAAmACgAKgAsAC0ALgAwADMANgA3ADgAOQBAAEIARABFAEYASABJAEoASwBMAE0ATgBPAFAAgACCAIQAhQCGAIgAoACkAKYAsACyALQAtgC3ALgAuQDAAMIAxADGAMgAyQDKAMsAEAASABQAFgAgACEAIgAkACUAKgArACwAMAAyADMANgA3ADoAOwBAAEEAQgBEAEUARgBHAEgAUABSAFQAVgBaAGAAYQBiAGMAZABlAGYAZwBoAGoAcAByAHQAdgB4AHoAgACCAJAAkgCgAKEAogCjAKQAsADAANAA0QDgAPAA8gD0APYAAAEFARABFgEgASIBMAEyATQBNgE4AToBPAFAAUIBUAFSAWABYgFkAWYBaAFxAXIBcwEAAgICIAIjAiQCMAJAAlACUQICAAMABAAGAAcACQAKAAsADAAOABAAEgATABQAFQAWABgAGgAgACEAIgAjACUAJgAnACgAKgArACwALQBAAEIAQwBEAEYASABKAEsATABOAE8AUABRAFIAUwBUAFUAcABxAHIAeAB5AHoAewCAAIIAgwCEAIYAiACJAIoAiwCMAI0AjgCPAJAAkQCSAJMAlACgAKIApACwALIAswC0ALYAuAC6ALsAvAC+AMAAwgDDAMQAxQDGAMcAyADKAMwAzgDQANEA0gDTANQA1QDWANcA2ADZANoA2wDcAN0A3gDgAOEA4gDjAOQA5QDmAOcA6ADpAOoA6wDsAO0A7gDvAPAA8gDzAPQA9QD2APcA+AD5APoA+wD8AP4AAAECAQQBBgEHAQgBCQEKAQwBDgEQAREBEgEUARUBFgEYARoBHAEeAR8BIAEhASIBIwEkASUBJgEoASkBKgEsAS4BMAExATIBMwE0AUABQgFEAUYBSAFKAUwBTgFQAVEBUgFTAVQBVQGAAYIBgwGEAZABkgGUAZYBmAGZAZoBoAGiAaQBpgGoAbABsgG0AbYBuAG6AbwB0AHSAdQB1gEAAgICBgIQAhICFAIWAhgCGgIbAhwCIgIkAiYCKAIpAioCKwIsAi4CMAIyAjQCNgI4AkACQgJEAlACYAJiAmMCZAJmAmoCbAJxAnICcwJ0AoACggKEAoYCiAKKAowCkAKRApIClAKWApgCnAKeAqACoQKiAqQCsAKyArMCtAK4AroCyALQAtIC1ALWAuAC4QLiAuMC5ALlAuYC5wLoAuoC6wICAwQDBgMIAwkDCgMMAw0DDwMSAxQDFgMYAyADIgMwAzIDNAM2AzgDOgM8A0ADQgNEA0YDSANKA0wDUANSA1QDVQNWA1gDWgNgA2IDZANmA3ADcgN0A4ADggOEA4YDiAOKA48DkAORA5IDkwOUA5UDlgOYA5kDmgOgA6IDpAOmA6gDqgOsAwEEAgQQBBIEIAQhBCIEIwQkBCUEJgQxBDIEMwQ0BDUENgRABEEEQgRDBFAEUQRSBFMEAQUCBQMFBAUFBQYFBwUIBQkFEAURBRIFAAYBBgIGAwYEBgUGBgYHBggGCQYKBgsGDAYNBg4GDwYQBhEGEgYTBhQGFQYWBhcGGAYZBhoGGwYcBh0GHgYfBiAGIQYiBiMGJAYlBiYGJwYoBikGKgYrBiwGLQYuBi8GMAYxBjIGNAY1BjYGNwY4BjkGOgY7BjwGPQY+Bj8GQAZBBkIGQwZEBkUGRgZHBkgGSQZKBksGTAZNBk4GTwZQBlEGUgZTBlQGVQZWBlcGWAZZBloGWwZcBl0GXgZfBmAGYQZiBmMGZAZlBmYGZwZoBmkGagZrBmwGbQZuBm8GcAZxBnIGcwZ0BnUGdgZ3BngGeQZ6BnsGfAZ9Bn4GfwaABoEGggaDBoQGhQaGBocGiAaJBooGiwYABwEHAgcDBwQHBQcGBwcHCAcJBxQHFQcWByIHIwcwBzEHMgczBzQHNQc2BzoHOwc+Bz8HQAdBB0IHQwdEB0UHRgdgB2EHYgdyB3MHdAeAB4IHgweEB4UHhgeHB4gHiQeKB4sHjAeNB44HjweQB5EHkgeTB5QHlQeWB5cHmAeZB5oHmwecB50HngefB6AHoQcCAAQABgAHAAgACQAKAAwADgAgACIAQABCAFAAUQBVAGAAagCAAKAAsADAANAA4ADwAPIA9AD2AAABAgEEAREBEgETARQBFQEWARcBGAEZASABIQEiASMBJAElASYBJwEoASkBAgAEAAUACAABAAIAAwAEAAUABgAHAAgACQAKAAsADAANAA4ADwAQABEAEgATABQAFQAWABcAGAAZABoAGwAcAB0AHgAfACAAIQAiACMAJAAlACYAJwAoACkAKgArACwALQAuAC8AMAAxADIAMwA0ADUANgA3ADgAOQA6ADsAPAA9AD4APwBAAEEAQgBDAEQARQBGAEcASABJAEoASwBMAE0ATgBPAFAAUQBSAFMAVABVAFYAVwBYAFkAWgBbAFwAXQBeAF8AYABhAGIAYwBkAGUAZgBnAGgAaQBqAGsAbABtAG4AbwBwAHEAcwB0AHUAdgB3AHgAeQB6AHsAfAB9AH4AfwCAAIEAggCDAIQAhQCGAIcAiACJAJAAkQCSAJMAlACVAJYAlwCYAJkAmgCgABAAAEBAAEIAUAD/AAABAQECAQMBCAEJAQoBCwEMAREBEgETARQBFQEXARgBGQEaAQACAgIQAhICAAMAQAEAAgAEAAEQBBAFEAYQBxAIEAkQChAQEBEQEhATEBQQFRAWEBcQGBAZEBoQGxAcEB0QHhAfECAQIRAjECQQJRAmECcQKBApECoQKxAxEDMQNBA3EDgQORA6EEEQQhBDEEQQRRBGEEcQSBBREFIQUxBUEFUQVhBYEFkQYBBhEGIQZBBnEGgQaRBsEG0QbhBvEHAQcRByEHMQdRB2EHcQeBB5EHoQexB8EH0QfhABACmSMJIAARABEgEEEAYQChAQEBAAIAABAAIAAwAIAAkAEAAgADAAQAD6//z/AOAN4N3g",vrCode_b64:"AAABAQIDAwMEBAQEAwMDAwMFBgMBAQMFAwMDAwMEAwcHAgIHBwgICAgJCAgIAwAKAQEBAQIEBAQBCggICAsLAwwLAwsIAQgLAQEBAQAACAwIAg0OAQ8BAQEBAQEIDQ0NDQ0NDw4ODg4ODgMGCAIMCAgEBAgBCAgBDAgIBgYQDBEQAgwRDAIGAgIGCA8PBwwICAEBEggMBhAQEAEBExIMBgwMAgwIBgwDBggDDAMIAwAIABMTFBQMDAcHCA8IDBISEggSFRUBCAwMDAwDCA8IBwwMCgoMDA8MDAwMDAwIABUVBAIGDAYMBgwRDBEMEQwRDAYMBgYMDAwMDAwMDAwMDAwMDAEBDAEJAAAWDAESAQMDDAwMDAwMCBAMAgkJAgkJCRcGDBYMCQkJCAgIDAwMDAwMDAwMDAwMEAwQDAwMDAEBDAEHCAwMAQwMCAgICAgMDAwMGAgRBgYIDAwMAw0OBgYICAwMDAgMEwYGDAwGFAwMEwYMBhEMERkXDBcXFxcGBhEGBgYMBgYGBgIHAgwCCAcDDQYGDAgIBgwMBgwRCAYHGAYGBgYMBgYGBgYGBgYQFggMBgYIBgwGBgYGBgwICA0NEBAQEBcXFxAQEAcICBcXBggNDhEQDAgIDAwFBgYICQkQDRAMCREJDAkCEAgIDAwCCQwQCAkICAoMEAkJCBcXFxcMEBcXFwwaDBoXFxcGFw0OCgcHBwwIBwwIBwwHDAwDCBcXFxcXFxcXFxcMFxcIFwwXCAkXDAgXFxcMDAwXEBAXFxcXEAwXFwwQAg0NDQ4NDAgHDBcXDAwXFxcXFxcMFwwQFxcXBgYGCQkDFxcXFwgCFxcIFwIXFxcCAgYXFxcXFxcXFxcXFxcIFxcXFBcXCQkTFwkJExcJCRcDAwMDAwMUCQkDCQkJCQkUFxcXFxcXAwMXCQoXFxcXFxcXCRcDAwMDAwMXCQMDAwMDCgMUFxQUFAgKCggXCBcDFw8UCAgXCBcIFwgXFAgXCBcIFwgXCgoPCQgXCAgXBgwYDAgICAgIAggMDhcMDAYGFxcGDgwICAgQCQgXFxcJCBcICQkXFxcXFwIJFxcJFwkXFxcGAQYGBgYGBhQMAQYGDQ4GBgYGBgYGAgYGBhcODhcJFxcIFxcXBgkXBhcXFxcXCAMABhcODhcXFxcPDwgJCQkJBgkJCQkXFxcXFxcXFwgXFxcXCAgXFxcXFxcICQkJCQkXCAgIFwIGFxcICQIICRcXFwgXFxcGFwYGCAgICQgWDBYMBgwWCAwIDA0ODw8NDQIJCQkDAgICBhYMFwgJAwgXCBcXGAYGCAgDCRcXFxcXFxcICAkICBcXFxcXFwgJCQkJCQkJAwMDCBYWFhYWFgAbCAkJCQkJCQkIAggGCQIXFxcCFwgXDAEYGAIYCBcXCQkJBwIGDBcGBhcXFxcXFxcXCQgIDBcXFwwDAwAAAAAAHBwDAxYWFhYACAAWFgAcABwAHAAcABwAHAMAAAADAwAAFgAAGBgDCBcICAcHAg0OCQkXFxcXFxcIFxcGBhcXCBgYBwcXFwkXFwgXFxgYCAcIFxcXCAIMCAgICAgICAgICBYICAgICAgICAgWCAgIFggIBgwICAwGAggMBggWFggDCAgWCBYICAMIFhYWDwgMCAgWEAgWDAwIFhYWFgwDCAAWFggIDBYWFgwMDAwMDAwMDAAIDwwWAAgWCAgICAgIBgwICAgIFhYIFhACFhYMCAgICBYWHRYMDAMDAAgMAwMIDAYDFhYWCAAIFgYIDAYADBYWCAkMCBYMFhYWDBYWFgwWDAgIFhYWAgwWCBYMDBYWDBYWCAgWAwwMDAgICBYMGBgYDAgMDAwMAxMIDw8DFxcXDAMTCBAXFwMDAwwDFBYMCBQMDAwXFwwYGBgMDAwIDAwIBgcIGAgYGBgMBgwIHR0dHR0DHRgYDBgMDAgYDBgYGBgYGBgYGAwYCAwMDAwMGBgYGBgYDw8dHQYGBggGDAYMDAwWFhYWFhYWFhYWFhYMDBYWCAwWFhYWFhYMCA8IDxYWFhYWFhYWFhYIFhYDDAwMDAwMCAMDDAwICAgICAgICAgICAgICAgMDBYMDxYMDAgMCAgMDAweDBYWFgwWCAgMFgwWFhYWDAwWFgwMBhQMDBcIDAwTDBMMDAwMFBQMDAwMAwYUCA8UDAwMAQwMAwYUFAgMDAwMDAwGAwMDDAwMDBQWFggWFggMDxABAQIJCQkJCQkJCQkICQkJBhcXFxcXAQgIBggJCQkXAQEJCQkJCQkGBgYXCQkJCQkJCQgIDQYOBgcFBgIADAgMDAwAFhgYAwAHAQMDAQUFDAwMBgwMAAYYGBgIGAgIFhYMFhYWFhYWCBYWFggIFgwMDAgBAQYMBgMMAwMDAwMIDBgYGBgYGAgYFhgYGBgYDAwMDAwMDAwMGAwMDAgYDBgYGBgYCBgMGBgXGBgYDAwMCAgMGAwMDAYYDAwYCAwMDAgMDAgMDAwYGBgGBgwMBgYGDAYMDAwYGAwMDAwIBxgYDAwMDAgMDBgGDAwMDAwMDAwMDAwMBgwMDAgMDAwMDAweBgwYGAwIGBgMDAwMCBgMDAwYGBgAGwwMBgwMCBgYDBcMABgYGBgYGAAYGAgMGBgMDBgYDAwMAwMIAwgIAwcIGAMDCAgIGAgDCAwIAwgICAwMGAwYBhgYCBgIGAgYCBgIGAwMCBgYDBgYGAgYCBgMGBgIGBgYCBgYDAwIDAwIGAgMCBgGBgYGBgwMDAgYDAMDCAMDCQUFAwMDAxcXFwkIBggGCAIGAggFAwMDHgMDAwgDAwMDAwMDAx4eHh4eHh4eHh4YFhgWAwgICAgBBgYDBgUDAwYFBggFAwMFAwMDCAMFAwUIBggdFxcXFwYGCAgIHh4eHgMeHh4BHyAgICAgICABICAgIAwWFggIEAwIDAgDDAgWAyAMDAgICAgKCAgXCAwMHgYGHwwMBwwDAwYIAwMMCAMDAxgdEAwDAwMCBggGDAMMAwIGAwwMDAwICAwMAxgIGAMMGBgYBggMDAwICAwMCAYIDAwMEgAACAMIDAwMCBgMAwwMCBgICAgYDAwdDAMDFwgICAYNDg0ODQ4NDgYEBgwRBgwNDg0OCAYMDBQMBgcMCgEACgoIDAwMCAwMCAYGDAYNDg0OBg0ODQ4GDAYGBgYMDAwGBgYGDAcIAwAXAgwJAggMDAwGFwwXFxcXFwMXFxcXGAMMAwwDGAgYGAwJCAEXDBcPFwgIDAwMDAgMFwwMCQwQDBAMDCEEDQ4NDhEGDAIMDAICBggMDBQUCAgMDAwMDAQCAg0ODQ4IAgYGDAgMDBAMDBcMDAMDAwMXFwwQFxcXCAwMDAwMBwwMDAYGDAwMBgwMBgwQAQwQDAwMBhQMDAwGDAwXFxcMDAwMAgYCBgYCAgYCDBEMDAYMEAYHBwYNDgICEQICBwYGBwYICAgMDwgMDwwPDwwMDAwIDAwBDAwMDAwMDAwMDAwGEQgIDw8PDAwMEgwXCAwMDAwCHhYWFh4MFhYICAwBAQ0ODAYMDw8PCAwGCAgGDBEMDAwKEQwMDAwIDwgMDAoMAw0ODw0OEQEICAADFw8UFhwADAwQDAEBCAgDDQ4IDBAIDBAcDAwRFwwQDBEQBgwMDAwMDAwMAQgMCAYICAgMDAgICAwMDAwMAAAAAAwMDBAMCA8PCAEBABAPDAwSAQgMDAwMDAEBEAoGDAYAEAgHDwwGBwYPDwYGDAwMDAEMDw8UDAEMDAYMDAwMDBYIFggIFhYWFgwMDBYWFhYMDAwWFhYMCAgIDAwMDAwWFgwMDAwWFgwYGAwMDAwIHRYGDBYWCBgYGBgMCQwMGBgMDBgYGBgYGBgYCAwYCBgYGBgYGBgYAAAMCAgIAxgDDBcMAhAMDBcXFwgIDBYMDAMDDAwcHAgAAAgMDBYXFhcIFxcIBhYWBgYQGBYWFggWFhYWAxYWDAwIDBYMHQgWFgMDCAgDAwwMFxcMCQIDAwwDAwwDCQkIAwMMAwMDDAwDAwwXAwMDAwMXCAkDDAwMDAwMAwIMDAwICAgICAgICAYIBgYGFwkJFxcIFwkJFxcXFxcDCAgMAx4eAwYACAwMAwYQDAgGDAMDAwMMCAwMCBQBDAEMABYbDAwADAAHCBgGGAgICAwMDAAbGBgYGBgYAAMYGyEgICAMDAwgAAwADAwMDAYHDAwGGBgAAAAADAwgDAAGFAwMDBsiDAwMDAYGDAgMDA8MDAwPEAwWDAMGDBYWCgMMAwYQFhYDDAYWDAwMDAwDBgwDDAMIDAMWFgwWFhYWFgwMDAMGDAwWFgwWFgwWFhYICAwBEggMAQYUCAwMDAwACAIIFiIMCAgICBAMDBgYCBgIAwMYCAgJCAMDAxwcDAwJAwMGCAYNDhEMDAgXCRgGEAwABggGFgwMDAwDCAgIGBgDCAgIAwMYCAAKCBgYGBgICAgIGBgMGAIIAAgMDAwWCAwQAgwWDAwMAQEMDAwDDBgMCAEBAwwMCAMIAwgDCAEMCAMIDAgWDBYWAwgIFhYWFhghFhYIFhYWFhYIFhYWFhYMCAwDDAwDCgwMAQwICBYMFhYhDAYMAwwMCAgIDAwIFgIGCAYPDAwGDAMMDAgFAwwDCAMIHQwGCAUGBgQZBQ0IDwkKBhsHIBEOAiMQExQSFyEWIhgAAxwdAQwkJRUDDAMDFgMDAwwDBgMGCAwDDAMDDAMIAwMICAMIAwMWDAgICAMDDAwMDAMICAgWFggIDAgICAgIDAgICAgICAgWFggMFxAMDBIGDAwICQgWFhYWFhYWDAgICBcXDAwMDAwMDAwMBQAGCQgGBgwMDAwGDAYEBAcICAgAFhYMFxcJDAkXFwwIBgkMDAYGBgwIDAwMDAYMCAgIDAMMAwMDAwMDBhAGBgwMDAMWFgwWFgwGDAMDDAwMFhYDAwwCGxsMDAgUDAwADAgUDAwGDAYGDAwGCBQMDAgUCAIBDAYQBgYIDwcGAwEIBQEPCAoKCAoYDAwMCgwBCgwMCgwPBgYICAMDAwMDAwMJDAgICAYJCQgICAgICAMDDAwMDAwQCAgICAgICAgICAgICAMDCBAHCQMDFwwMDAMIFwgICAgMDAwMAwYMAwwICAgDCAgICAwMCAwCCAgNDgQEAgkMCAgGAggMDAwMDAwMDAwMDAgUCAcHCAgICAgDBgwFCAgCBhAICBcXFxcXAhcXFxcJDBcXDAgXDAgCCQwMDAwIFhYMDAwMDAwMFgwIDAwMCAMMDAwMDAMDDAwQBgwHDAwMDAwICAwMFggIDAwMDBYMCAgICAYXCBcXDBcIFxcMFwgJFwwIFxcXAgYQDQ4MDAwMDAwJAQYQCRcPDwwICAwGDAwIFxcJCQkMDAwMDAwXDAkJAgwQDAgRDAgXDAMYDAwBCBcGDAwMDBAIFwwMCQ0OCAIIDBcXFxcXFwwMFxcYGBgXDBcNDQkMBQUJCQUQAwwYDAkQFxcXDAkMCQwMDAgWDAwMDAwMDAwMDAYMCAwJDBcXCQkXFwwJDAkMDQ4NDgwDDAgQDAkICAwNDgIGEA0OBggGCBAMCQEICAYXFwgXFxcXFxcXFxcXFwwJAhcXDBcYFxcYGBcXFwEIDAkGCQkJBwkXARcXGBgYCAwYGBgIFwgIFwkXFwwCCBcMCBcYCRcJBhAIFggICQwGCAkMCQgCCRcYFxgXGAIQFwkCFwwJAhcJCRcXFxcJCAIJFxgMAhcYCAYICAkGFxcJFwwCCAYXFwkMCRcXDAgMFxcIFwgXCBcXCBcXFxcXFxgYGBcYCBgIGBgIGAgXFxcXFwwJBgYMCAIQAhgYDAgCEAIIEAwIAhAXEBcXFwgIDAwJCAYXFwIGFxcGFwgXFw0ODAgJBgYJAgYXDAkCCAYXFxcXAhcMCRcXCAkXCQIIBhcGFxcXCQkXDAkCBhcXFwwXFxcICBcYGBgYGBgMBwkJHQgIGAwYAgkMCQIIBgkMCQIIBhgJDAkCCAYCCAIGBhgYGAwGGBgMBhgMGBgYGBgYAgkJCBgIGBgYCQwMDAwMDAwMEAwYDAIQCAkYFwwIGBgYGAkMFwMMCAgMGBgYGAwMGBgYGAgIAwMDAwMDAwMGAQwDAxYDCAwGFhYMBgwMDAYICAwIFgwMDAMGFhYWFhYMBgwWDBYMDAwMFgwDCAgIDAwWFgwMFgMWFgwWDAwDFhYWDAwICAEMFhYWAwwDDAwMDAgMAwMMAwwIGxsWDAwWDBsIFhYMAwwDDAMBEAwMFhYMAhAMDBcXFwwMAwwDFgwMCAEIDAwDAwgICAgIDAwMCBAMCAwQEA8PAwwMDA8QDAwMDA8MDAwDDAwDEAwBAwwMDAwMDAwHDAwMBwwHAwMMDAwGFgwMCAwMDAwMCQkXFwwJCQwJDAwMCQwMCQwJDAkJCQkMCQkJCQkMCAYMGAwDAwMMFhYIFgwIDwwICA0OEQwIDAwGAQwMDAwBFAMIEAgMDAEMAQwQDAwGEwgHBgEDDAMMDAwMDAwDDAwMBgwMDAEMAgYCBhAGAwMBAwMDAwMDAxAMCAgICAwMDA0NDAgWFgEBBgwGDAMIFAwQDAMMDBQMCAwMAwwIDAwMDAwBAQwMCBYIDAYMDBQUCQMDFAwMDAgWDgcMDAwIDAAWFhYWDAwWFgwHBwIGDAgNDhEGDQ4REBEMDQ4RBwwMEQYCBggIEBAICAwMGBgKAggIDAMMCAcICBgYGBgCGBgYAgIICBgIDw8ICAYCDwgDAwwMCAgPCBgIDAgMCAYCBgICCAIIGBgYDAgHGAoICAwIDAwWFwwMEAwYDAgMFwwMDAwaGgMIGhobGyQkFRshGiAgIAwKJiYm",vmCode_b64:"AAAAAAAAAAAAAAAAAAAAAAABAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAIAAAAAAQAAAQADAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAABAAEBAAAAAAAAAAAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAAQABQAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQYHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAQAAAAAAAQEAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQEBAQEBAQEBAQAAAAAAAQAAAAAAAAEBAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAABAQAAAQEAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAAAAAAFBwAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAJAAkAAAAAAAAAAAAAAAAAAAAJAAkAAAAAAAAAAAAAAAEAAAAAAAABAQEAAAAAAAAAAAEAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAQABAAAAAAAAAAAAAQEAAAAAAAAAAAEAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQEAAAAAAQAAAAEABQAAAAAAAAAAAAABAAcBAAAABQUFAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAAAAAAEBAAAAAAAAAAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAAAQAAAAABwALAAAJAAAAAAAHAAAABAAAAAAHAAsAAAAAAQEBAQEBBwAAAAAHCQAAAAAAAAABAAEBAAAAAAAAAAAAAAAAAAAAAAwJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQABAQEAAAAAAAAAAAAAAAAAAAAHBwcABQcAAAcAAAcAAAAAAAcAAAEBAQEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBQAAAAUFAAUABQUAAAAAAAAAAAABAAAAAAAAAAkJAAAAAAAABQUAAAAJCQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJAAAABwkAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAAFBwcAAAAAAAAAAAcAAwAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAkJDAwAAAAAAAEAAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAABAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkMAAkNDQAAAAAAAAAAAAAAAAEAAAAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAABwcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAAAAAAcHBwcAAQEAAAAAAAEBAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAAAEBAAEBAAABAAAAAQABAAEAAAAAAQEAAAABAAAACQkJCQkICAgAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAAAAAAAAAABAQAACQAAAQAAAAAAAQEBAQEAAAsBAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAcAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAALAAsLDQAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAkAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAHAAEBAQEAAQEBAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAcAAAAACwAAAAcAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAJAAwAAAAAAAAAAAAAAAAAAAcHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAABAAABAAAAAAAAAQAAAAEAAAABAAAAAQABAQAAAAEAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAcABwABAAABAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAEACQAAAAAAAAAAAAAACQkAAAAAAAAAAAAAAAAAAAAAAAAACQAADAkJAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBgsBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAABwgBAAAAAAAAAAAAAAAAAAAAAAAHCAAJBwkOCQAAAAAAAAAHCQAIDAAICQkAAAAAAAAAAAAAAAAAAAAAAAEAAQAAAAAAAAAAAAcHAAcAAAADAAAAAAAHBwcHAAAAAAkAAAAAAAAAAAAHBwAAAAAAAAAAAAAAAAAJAAAAAAAJAAAACQkAAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAQAAAAAAAAEAAAAMAAgJAAAAAAkJAAAACQAACQkJDAAAAAkAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAEBAAEBAQEBAQEAAQAAAAEBAQAAAQAAAQABAAEBAQEBAQAAAQEAAAAACAAAAAAAAAAAAAADAAABAAAAAAAAAAAAAAAAAAAAAAkJAAAAAAMAAAAAAAABAAAABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJDgAHCAAAAAAAAAAAAAABBgAAAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkJAAkACQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAAAAAAAAAAAABwAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAkADAcHAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJAAMAAAAECQAAAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAAAAAAAAAAAAAkAAAEAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAABEAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcHAQEAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAkJAAAACQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAEAAAABAAAAAAAAAAAABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAAEAAQcLAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBwAAAAAHBwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABCQAAAAAABwAACQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwMHAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQAAAAAAAAAAAAEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAJAAAAAAABAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQkAAAAAAAAAAAAAAAAAAAAACQkSAAAAAQAAAAAAAAEAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAAACQkAAAAAAAAAAAAAAAAAAAAAAAAJAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",nameOff_b64:"AAAAABIAAAAsAAAAPwAAAFMAAABxAAAAfQAAAIYAAACfAAAAsAAAAMAAAADUAAAA4wAAAOsAAAD9AAAAFAEAADIBAAA4AQAASAEAAFQBAABbAQAAcQEAAIgBAACTAQAAqgEAALYBAADUAQAA8gEAAA0CAAApAgAATQIAAGQCAAB6AgAAjgIAAKICAAC2AgAAywIAAOECAAD1AgAACgMAAB4DAAAtAwAAOwMAAFsDAABoAwAAdQMAAIUDAACjAwAAvQMAANQDAADuAwAA/wMAABUEAAAuBAAASgQAAGcEAACGBAAAogQAALQEAAC9BAAA1AQAAP8EAAA2BQAAbAUAAIIFAACZBQAAtwUAAMYFAADxBQAABAYAABQGAAAkBgAARQYAAGAGAAB+BgAAnwYAAMgGAADiBgAA9QYAAAkHAAAdBwAAJgcAAD0HAABRBwAAZQcAAHcHAACPBwAAmgcAAKgHAAC2BwAAwAcAANkHAAD3BwAABAgAAA0IAAAXCAAAJggAADEIAABECAAAVQgAAGgIAABxCAAAewgAAIoIAACVCAAAqAgAALkIAADMCAAA4ggAAAMJAAASCQAAMQkAAEMJAABUCQAAYwkAAHEJAACFCQAAnQkAAKUJAAC2CQAAxwkAAOkJAAD3CQAADQoAABkKAAAoCgAAOgoAAFEKAABnCgAAgAoAAKIKAADKCgAA4QoAAAoLAAATCwAAJAsAADoLAABNCwAAWAsAAGcLAAB6CwAAkgsAAKULAADCCwAA1QsAAO4LAAD9CwAAHAwAACsMAAA8DAAAXgwAAHIMAACIDAAAmAwAALsMAADFDAAA1wwAAOQMAADwDAAABg0AABkNAAA7DQAAYA0AAHUNAACRDQAAog0AAL8NAADoDQAA/Q0AABQOAAA1DgAAUg4AAHAOAACKDgAAoA4AALIOAADVDgAA+g4AABkPAAAvDwAASA8AAGUPAAB/DwAAow8AALsPAADLDwAA5w8AAPUPAAAKEAAAIxAAAD8QAABUEAAAYxAAAHAQAACBEAAAlBAAAKkQAAC+EAAA3RAAAPcQAAAMEQAAJREAAD8RAABWEQAAbREAAHwRAACOEQAAnxEAALcRAADMEQAA3hEAAOcRAAD1EQAABRIAABwSAAAvEgAATxIAAGsSAACQEgAAqhIAAMMSAADfEgAA+BIAABYTAAAvEwAARRMAAFYTAABhEwAAcRMAAIYTAACXEwAAtBMAAM8TAAD2EwAACBQAADAUAABHFAAAcBQAAIwUAAC4FAAAxRQAAOMUAAAAFQAAHhUAADAVAABFFQAAZhUAAH0VAAClFQAAyhUAAOIVAAD7FQAAEhYAADMWAABZFgAAcxYAAIoWAACpFgAAwxYAAPIWAAAHFwAAHxcAADcXAABKFwAAXxcAAG4XAACBFwAAihcAAKEXAAC/FwAAyhcAANgXAADlFwAA8hcAAAMYAAAYGAAALRgAAEAYAABxGAAAhhgAAKoYAAC/GAAA0hgAANsYAADmGAAA9BgAAPwYAAAGGQAAGRkAAC0ZAAA+GQAATRkAAF8ZAABuGQAAfxkAAIgZAACQGQAAqxkAAMUZAADiGQAA+xkAABEaAAAvGgAATxoAAHUaAACdGgAAvxoAAOkaAAAOGwAAOxsAAHIbAACjGwAA1RsAAAAcAAAsHAAAaRwAAKccAADmHAAAIB0AAD8dAABZHQAAbB0AAIodAACzHQAAzh0AANcdAAD2HQAADx4AACAeAAA3HgAAUh4AAGMeAAB3HgAAlh4AAKseAAC+HgAA1B4AAPceAAATHwAAJx8AAEkfAABbHwAAZh8AAG8fAACAHwAAjx8AALIfAADaHwAA/x8AAB0gAAAtIAAAPSAAAGIgAACHIAAAoSAAAKsgAADLIAAA7SAAABchAAAsIQAAUSEAAGIhAAB0IQAAhSEAAKUhAAC4IQAAxCEAAN8hAADxIQAADSIAACwiAABMIgAAbCIAAHsiAACMIgAAoyIAALMiAAC9IgAAyCIAAN8iAADzIgAABiMAAB4jAAArIwAAOSMAAFwjAAByIwAAfiMAAI0jAAChIwAAvyMAAMwjAADVIwAA5yMAAPgjAAAPJAAAKCQAADMkAABKJAAAVCQAAGEkAAB5JAAAiCQAAJkkAACzJAAAzCQAAOYkAAD4JAAAESUAACglAABAJQAAWSUAAHAlAACJJQAAmiUAAK8lAADGJQAA1SUAAOolAAACJgAAGSYAADImAABRJgAAdiYAAIkmAACeJgAAuSYAAM8mAADtJgAACicAAC8nAABHJwAAaCcAAIsnAACoJwAAzicAAO4nAAARKAAAJygAAD0oAABfKAAAdCgAAJIoAACvKAAA1ygAAAkpAAArKQAAOykAAFUpAACCKQAArSkAAMIpAADiKQAAASoAABYqAAAnKgAAOyoAAFQqAABhKgAAfioAAKkqAAC2KgAAxCoAANEqAADeKgAA6yoAAP0qAAAUKwAAJysAADorAABPKwAAVysAAHgrAACLKwAApysAAL8rAADbKwAA5isAAPUrAAALLAAAJCwAAEAsAABcLAAAeSwAAIMsAACaLAAAqywAALosAADHLAAA2CwAAOosAAD6LAAACS0AAB4tAAAsLQAAQS0AAFYtAAB4LQAAhS0AAKEtAAC9LQAA3C0AAPotAAAULgAALC4AAEUuAABfLgAAgC4AAJQuAACpLgAAvS4AANEuAAAALwAAKi8AAEMvAABbLwAAdi8AAIAvAACYLwAAri8AAL8vAADSLwAA4y8AAAIwAAALMAAAIjAAADkwAABZMAAAfDAAAKAwAAC1MAAAyjAAANcwAADnMAAAAzEAACMxAAA6MQAARDEAAE8xAABoMQAAdTEAAIIxAACfMQAAsDEAAMoxAADjMQAA8zEAAP8xAAAQMgAAITIAAC4yAABEMgAAWjIAAHgyAACIMgAAnzIAALAyAAC9MgAA0zIAAN0yAADwMgAA/jIAAAUzAAAdMwAANDMAAE4zAABjMwAAdTMAAIAzAACHMwAAlDMAAKEzAACtMwAAyTMAAOszAAAMNAAAGTQAACo0AAA4NAAASDQAAFw0AABwNAAAfzQAAJE0AAClNAAAsjQAAME0AADcNAAA8DQAAAA1AAAVNQAALDUAAEU1AABUNQAAYzUAAH41AACHNQAAljUAAKg1AAC3NQAAxjUAANo1AAD0NQAAAzYAABg2AAApNgAAOjYAAE02AABgNgAAdzYAAIc2AACeNgAAqzYAALs2AADLNgAA2TYAAPI2AAAPNwAAKDcAADM3AAA+NwAATDcAAFk3AABqNwAAdzcAAIQ3AACRNwAAoTcAALA3AAC+NwAA0zcAAOg3AAD1NwAAATgAABM4AAAhOAAAKjgAAD84AABPOAAAXzgAAGs4AAB3OAAAhzgAAJs4AACoOAAAuDgAAMg4AADXOAAA5jgAAPk4AAALOQAAFTkAACU5AAAvOQAARDkAAFA5AABlOQAAbDkAAHQ5AAB/OQAAjjkAAJg5AAC0OQAA0zkAAPY5AAAUOgAALzoAAE06AABqOgAAezoAAIw6AACVOgAAqToAALg6AADHOgAA2joAAPE6AAD+OgAADTsAACY7AAA+OwAARjsAAFk7AABsOwAAdzsAAIg7AACVOwAApDsAALU7AADFOwAA1DsAAOA7AADrOwAA9jsAAAE8AAAKPAAAFTwAAB08AAAlPAAALzwAADs8AABPPAAAWjwAAGk8AACCPAAAjzwAAJk8AACiPAAAsDwAALw8AADIPAAA2DwAAO08AAD9PAAACD0AABA9AAAaPQAAIz0AADs9AABPPQAAXj0AAG89AAB3PQAAgD0AAJA9AAClPQAAvD0AAMg9AADWPQAA4T0AAPA9AAD8PQAACj4AABU+AAAhPgAALj4AADc+AABFPgAASz4AAFY+AABePgAAaT4AAHE+AACDPgAAkj4AAJ0+AACvPgAAvj4AANE+AADhPgAA8j4AAAA/AAASPwAAIT8AADQ/AABGPwAAUj8AAGE/AAB4PwAAjz8AAJw/AACqPwAAxD8AANY/AADwPwAACUAAADFAAABBQAAAUUAAAGBAAABrQAAAfEAAAIhAAACRQAAAtEAAAMxAAADgQAAA/EAAABJBAAAmQQAAOUEAAFdBAAB1QQAAiUEAAKJBAAC2QQAAyUEAANtBAAD1QQAADEIAABRCAAAnQgAANUIAADhCAABJQgAAWkIAAHlCAACKQgAAo0IAAMBCAADjQgAA8UIAAPlCAAAGQwAAFkMAACZDAAAzQwAAPkMAAFNDAABnQwAAgUMAAJdDAACmQwAAtUMAAMxDAADaQwAA7EMAAPVDAAD9QwAABEQAAA9EAAAVRAAAH0QAACdEAAA9RAAASEQAAGJEAAB6RAAAmkQAALBEAADGRAAA6EQAAApFAAA1RQAAW0UAAIBFAACrRQAAu0UAANNFAADtRQAA+UUAAAtGAAAeRgAANEYAAElGAABfRgAAbEYAAHxGAACQRgAAp0YAAMtGAADcRgAA50YAAPpGAAAJRwAAEkcAACRHAAAzRwAAPUcAAE5HAABmRwAAd0cAAI1HAACjRwAAuEcAANBHAADpRwAABUgAACBIAAA1SAAASUgAAGVIAACISAAAqEgAAMdIAADYSAAA4kgAAO1IAAD+SAAAD0kAABtJAAAkSQAALUkAAEJJAABPSQAAZUkAAH1JAACUSQAAvEkAAM5JAADgSQAA60kAAPhJAAADSgAAGUoAAC5KAABISgAAUkoAAFtKAABsSgAAg0oAAJFKAACYSgAAo0oAALlKAADPSgAA30oAAPRKAAAASwAAD0sAABdLAAAkSwAANUsAAEVLAABWSwAAY0sAAIVLAACPSwAAnEsAAKtLAAC9SwAAwUsAAM9LAADhSwAA70sAAPxLAAAITAAAFEwAAB5MAAAxTAAAQkwAAFJMAABlTAAAdkwAAIxMAACbTAAAp0wAAMJMAADcTAAAA00AADBNAABVTQAAcE0AAJFNAACnTQAAvU0AANhNAADxTQAABk4AACBOAAA6TgAAVE4AAHpOAACPTgAApE4AAL1OAADQTgAA4U4AAPNOAAAETwAAIU8AADRPAAA9TwAAWE8AAGdPAAB3TwAAgE8AAIxPAACjTwAA108AAONPAAD1TwAA/08AABBQAAAtUAAANlAAAEtQAABOUAAAUlAAAFdQAAB9UAAAnFAAAK9QAAC7UAAAy1AAAN9QAADsUAAA/1AAAA1RAAAdUQAALFEAADVRAAA9UQAARVEAAE5RAABvUQAAf1EAAI1RAACjUQAAu1EAANpRAAD7UQAAD1IAACVSAAAxUgAASFIAAGBSAAB6UgAAlFIAAKtSAADCUgAA31IAAPdSAAAKUwAALVMAAD1TAABUUwAAbFMAAIZTAACgUwAAt1MAANBTAADpUwAABlQAABVUAAAvVAAASlQAAGdUAACEVAAAnlQAALhUAADYVAAA81QAAP1UAAAVVQAAJVUAADVVAABFVQAAXFUAAHVVAACIVQAAoFUAALpVAADcVQAA8VUAAAVWAAAOVgAAJlYAAD5WAABJVgAAWFYAAGdWAAB3VgAAhFYAAKBWAAC7VgAAx1YAAOJWAADtVgAA+1YAABtXAAAlVwAAN1cAAFVXAABkVwAAdFcAAIdXAACdVwAAuFcAANVXAADpVwAA+lcAAApYAAAZWAAAJVgAAEhYAABpWAAAh1gAAJJYAACtWAAAwFgAAM5YAADZWAAA7FgAAP9YAAASWQAAJVkAADVZAABFWQAAXFkAAHNZAACPWQAAq1kAALlZAADHWQAA2lkAAOhZAAAAWgAAFloAACNaAABOWgAAaloAAJVaAACxWgAA0FoAAOBaAAD/WgAAD1sAAC5bAAA+WwAAXVsAAG1bAACHWwAAmVsAALFbAADIWwAA41sAAPlbAAARXAAAJFwAADdcAABLXAAAXVwAAHNcAACCXAAAnVwAALpcAADNXAAA2VwAAO5cAAABXQAADV0AABddAAA0XQAAUV0AAHhdAACcXQAAuV0AAMtdAADvXQAA/l0AABleAAAvXgAAQl4AAFpeAABuXgAAhl4AAKNeAAC0XgAAx14AAOBeAAAAXwAAJ18AADxfAABPXwAAXF8AAGVfAAB0XwAAfl8AAI9fAACdXwAAs18AAMlfAADkXwAA/18AABJgAAAwYAAAPmAAAE9gAABfYAAAcmAAAIZgAACXYAAAsGAAAMFgAADSYAAA4mAAAPJgAAAHYQAAFGEAAChhAAAwYQAASGEAAF9hAABwYQAAhWEAAJJhAACkYQAAtmEAANNhAADvYQAAA2IAAApiAAAbYgAAM2IAAExiAABkYgAAhGIAAJBiAACnYgAAxmIAAOFiAAD2YgAABWMAABpjAAA1YwAAS2MAAF9jAABzYwAAiWMAAKVjAAC1YwAAwmMAANhjAADzYwAAFmQAACBkAAAwZAAAQ2QAAFNkAABzZAAAgmQAAJVkAACmZAAAuGQAANZkAADwZAAAA2UAABtlAAAyZQAAVGUAAGdlAACDZQAAkWUAAKllAAC3ZQAAyGUAAOFlAAD2ZQAACWYAABhmAAA0ZgAATWYAAGlmAACMZgAApmYAALZmAADWZgAAA2cAABdnAAAmZwAAOWcAAFpnAABnZwAAdmcAAIVnAACgZwAAxGcAANJnAADkZwAA92cAABVoAAAnaAAAPGgAAFZoAAB4aAAAj2gAAKVoAAC8aAAA3WgAAAhpAAAgaQAARGkAAGFpAACHaQAAnmkAAL1pAADTaQAA8WkAABRqAAApagAAOmoAAEdqAABnagAAeWoAAJRqAACiagAAu2oAAMdqAAD4agAAEWsAAEFrAABxawAAi2sAAKRrAADCawAA32sAAPdrAAATbAAALGwAAD5sAABWbAAAbmwAAI1sAACzbAAA3GwAAP9sAAATbQAAMW0AAEJtAABZbQAAdW0AAJNtAACqbQAAt20AAMdtAADZbQAA620AAPVtAAAKbgAAGG4AACtuAABAbgAAUm4AAG5uAACFbgAAnG4AAKtuAADUbgAA/W4AABZvAAAmbwAAP28AAE5vAABXbwAAc28AAIFvAACXbwAArG8AAMNvAADNbwAA4W8AAPJvAAAEcAAAH3AAADdwAABOcAAAZHAAAH1wAACecAAAsXAAALxwAADOcAAA6HAAAP5wAAARcQAAJnEAADhxAABFcQAAVXEAAG1xAACAcQAAjXEAAJ9xAACucQAA0nEAAOpxAAANcgAAMnIAAExyAABqcgAAhHIAAJtyAACicgAAvXIAANxyAAD6cgAAD3MAAC1zAABFcwAAZXMAAIRzAACocwAAx3MAANZzAADicwAA/HMAAA90AAAgdAAANHQAAFF0AABxdAAAg3QAAKR0AAC1dAAAw3QAANp0AADrdAAA+3QAAAt1AAAmdQAAP3UAAFJ1AABrdQAAgXUAAKJ1AAC/dQAA03UAAOZ1AAD+dQAAKnYAAEd2AABidgAAbnYAAIx2AACudgAAx3YAAN92AAD/dgAAGXcAAC53AABFdwAAWHcAAHl3AACRdwAAoXcAALh3AADWdwAA83cAABl4AAAveAAASngAAF54AAB7eAAAjngAAKR4AADJeAAA6ngAABZ5AABDeQAAcnkAAKF5AADNeQAA+XkAACt6AABCegAAS3oAAGp6AACEegAAl3oAAK56AADBegAA3XoAAP16AAAcewAAPXsAAGV7AAB+ewAAl3sAALB7AADMewAA3nsAAPJ7AAANfAAAKXwAAEt8AABffAAAhXwAAJx8AAC3fAAA0HwAAOh8AAACfQAAIX0AAEJ9AABcfQAAeH0AAJB9AACmfQAAxH0AAOR9AADzfQAABX4AABx+AAApfgAAPX4AAFl+AAByfgAAkn4AAKp+AADFfgAA5H4AAAV/AAAnfwAAS38AAGx/AACNfwAArn8AAMt/AADqfwAABoAAACKAAAA+gAAAToAAAGCAAAB+gAAAm4AAALqAAADSgAAA44AAAPSAAAAFgQAAFoEAACeBAAA4gQAATIEAAHCBAACDgQAAlYEAAKyBAADBgQAA6IEAAAmCAAAuggAASIIAAGOCAACGggAAnoIAAMWCAADwggAAAIMAAByDAAAygwAAUIMAAGuDAACLgwAAo4MAALaDAADXgwAA94MAABKEAAAkhAAAM4QAAEyEAABghAAAe4QAAI2EAACbhAAAr4QAAL+EAADQhAAA5YQAAPuEAAAahQAAKoUAAEuFAABghQAAf4UAAJyFAADFhQAA5oUAAAuGAAAYhgAAMYYAAEeGAABYhgAAcoYAAIeGAACPhgAAsIYAAL+GAADahgAA+IYAABqHAAA7hwAAUYcAAH+HAACWhwAApocAAL2HAADZhwAA7YcAAAiIAAAiiAAARIgAAGWIAAB/iAAAjogAAKGIAAC1iAAAyYgAAOWIAAAOiQAAHokAAD6JAABhiQAAeokAAJCJAACsiQAAxokAAOOJAADxiQAAAIoAACaKAABNigAAaYoAAJGKAACpigAAxooAAOeKAAAKiwAAJYsAAECLAABXiwAAc4sAAI2LAACsiwAAv4sAAM+LAADeiwAA9IsAAAyMAAAojAAARYwAAGqMAACHjAAAoowAALuMAADqjAAADI0AACGNAAA0jQAAWY0AAG+NAACAjQAAoI0AAL6NAADwjQAAFY4AAECOAABejgAAeI4AAJ6OAAC5jgAA4o4AAAWPAAAmjwAARY8AAG+PAACFjwAAn48AALWPAADJjwAA2o8AAOuPAAAJkAAAJpAAADqQAABRkAAAYZAAAHKQAAB5kAAAhZAAAJaQAACkkAAAuZAAAMyQAADikAAA+JAAAAuRAAAVkQAAJ5EAADyRAABPkQAAYJEAAGyRAACBkQAAlZEAAK2RAADEkQAA1JEAAOeRAADxkQAAAJIAABmSAAAtkgAAQZIAAFuSAAB0kgAAhpIAAKiSAADLkgAA4JIAAPySAAAPkwAAJZMAAECTAABVkwAAZpMAAIaTAACgkwAArZMAAMaTAADjkwAA/5MAAB6UAAA4lAAAVZQAAHOUAACMlAAAo5QAALyUAADflAAA+JQAABiVAAAllQAASJUAAHeVAAB+lQAAk5UAAKeVAAC2lQAAypUAAN+VAAD3lQAADJYAACqWAABPlgAAc5YAAImWAACdlgAAqpYAALqWAADPlgAA6ZYAAAGXAAAWlwAALJcAAFeXAACElwAAppcAAMKXAADflwAA9ZcAABOYAAAwmAAAT5gAAHKYAACOmAAAppgAAMCYAADWmAAA7JgAAAGZAAAemQAAQJkAAFeZAAB5mQAAmZkAALqZAADNmQAA45kAAACaAAAMmgAAK5oAAEWaAABjmgAAgJoAAJqaAAC1mgAA05oAAOuaAAAEmwAAHZsAADWbAABOmwAAb5sAAHmbAACJmwAAspsAAMWbAADpmwAAAJwAACScAAA7nAAAVpwAAHucAACNnAAAnpwAAKqcAADBnAAA1JwAAOmcAAD1nAAABZ0AABOdAAAmnQAAQJ0AAFudAAB0nQAAgp0AAKOdAAC/nQAA450AAAeeAAAZngAAN54AAE6eAABongAAiZ4AAJqeAACtngAAvp4AANCeAADingAA9Z4AABSfAAAonwAAPp8AAFSfAABunwAAiJ8AAKKfAAC4nwAA4J8AAPufAAAWoAAAMaAAAEegAABYoAAAbaAAAIOgAACuoAAA2KAAAP2gAAAioQAAP6EAAFShAABqoQAAhKEAAJqhAACqoQAAuqEAAOOhAAAGogAAFqIAADGiAABSogAAeKIAAJyiAACzogAAyKIAAOOiAAD9ogAAJKMAAFGjAAB6owAAgqMAAJqjAAC3owAAzKMAAOWjAAD1owAACaQAABikAAA3pAAAQqQAAGikAAB5pAAApqQAAN6kAAAQpQAAKqUAAEqlAAB0pQAAiaUAAKWlAAC/pQAA1aUAAOelAAD0pQAACKYAAC2mAABZpgAAf6YAAKmmAADRpgAA/KYAADanAABIpwAAcqcAAKanAADepwAAFqgAAEmoAAB5qAAAqKgAANioAAAEqQAAMqkAAFypAACGqQAAwKkAAPmpAAAkqgAATqoAAIeqAACiqgAAv6oAAOGqAAAHqwAAMKsAAFarAAB9qwAAjasAAKmrAADXqwAAA6wAACKsAABBrAAAWawAAH2sAAClrAAA0KwAAO2sAAANrQAALK0AAEetAABUrQAAf60AALKtAADorQAAHK4AADyuAABcrgAAba4AAJSuAACvrgAAzq4AAOyuAAAHrwAAMq8AAFSvAAB/rwAAqq8AANSvAADkrwAAEbAAACewAAA5sAAAUrAAAGCwAAB0sAAAfbAAAIawAACdsAAAuLAAANGwAADhsAAA/rAAABaxAAApsQAAQrEAAGmxAAB1sQAAjbEAAJ2xAAC7sQAA2LEAAO+xAAAQsgAALrIAAEOyAABisgAAebIAAJGyAAC6sgAA1LIAAOqyAAAFswAAG7MAADqzAABRswAAa7MAAIGzAACUswAAr7MAAMezAADfswAABLQAABq0AAA5tAAAULQAAGq0AACAtAAAsbQAAMq0AAAAtQAAHLUAADe1AABRtQAAa7UAAI+1AACstQAAyrUAAN61AAAHtgAAJrYAAFW2AAB6tgAAtLYAAOS2AAAGtwAAK7cAAES3AABVtwAAbLcAAIi3AACntwAAxrcAAOu3AAD6twAACrgAABy4AAAyuAAAVbgAAGW4AACVuAAAx7gAAPq4AAA4uQAAT7kAAGG5AAB1uQAAibkAAKi5AADRuQAA5rkAABm6AABNugAAaboAAIS6AACdugAAvroAANO6AADpugAA+LoAAAO7AAARuwAAHrsAADC7AABduwAAgrsAAJm7AACpuwAAubsAANG7AADguwAA87sAAAy8AAAjvAAANrwAAES8AABZvAAAbrwAAHK8AAB5vAAAh7wAAKG8AACtvAAAt7wAAMG8AADRvAAA5LwAAPy8AAAKvQAALL0AAEO9AABgvQAAeL0AAJa9AACxvQAA0L0AAOa9AAD5vQAAD74AACW+AAA6vgAAUr4AAGy+AACBvgAAkr4AAKa+AAC4vgAAzb4AANq+AADkvgAA674AAP6+AAAdvwAAO78AAFK/AABovwAAgr8AAJu/AADBvwAA5r8AAPe/AAANwAAAI8AAAD/AAABawAAAe8AAAJDAAACjwAAAtcAAAM/AAAD2wAAAF8EAAC3BAABLwQAAacEAAInBAACmwQAAycEAAO/BAAAIwgAAKcIAADnCAABVwgAAZsIAAIfCAACjwgAAu8IAANHCAADqwgAAAsMAABPDAAApwwAAQsMAAFnDAABywwAAjcMAAK/DAADJwwAA58MAAPPDAAD+wwAADsQAABrEAAAlxAAAQcQAAE/EAABgxAAAdsQAAJfEAAC7xAAA4cQAAAbFAAAsxQAAXcUAAJDFAADCxQAA3MUAAPfFAAAVxgAANcYAAFTGAAB0xgAAn8YAAMzGAAD4xgAAH8cAAEbHAABvxwAAl8cAAMDHAADdxwAA9ccAAA3IAAAhyAAALMgAAELIAABZyAAAcsgAAI3IAACfyAAAu8gAAM/IAADryAAAAckAAB7JAAA1yQAAXMkAAHDJAACMyQAAlskAAKzJAADEyQAAzskAANjJAADtyQAAB8oAACLKAAA1ygAAUMoAAF3KAABrygAAesoAAIHKAACPygAApcoAAMbKAADoygAAAcsAABfLAAAxywAARMsAAFjLAABkywAAe8sAAIjLAACcywAArMsAAMLLAADTywAA3MsAAPTLAAASzAAAK8wAAEHMAABTzAAAZ8wAAILMAACOzAAAocwAAMfMAADhzAAABs0AABXNAAAmzQAAPs0AAGjNAAB5zQAAms0AALjNAADUzQAA6M0AAADOAAAezgAAPs4AAEbOAABVzgAAaM4AAHLOAACJzgAAos4AALjOAADOzgAA3M4AAPjOAAAGzwAAI88AADvPAABSzwAAac8AAIDPAAChzwAAvc8AAMfPAADYzwAA688AAALQAAAg0AAAQtAAAFbQAABj0AAAc9AAAIbQAACp0AAAu9AAANDQAADj0AAAA9EAABPRAAAq0QAAQdEAAFLRAAB30QAAl9EAAKzRAADG0QAA3NEAAO3RAAD40QAAENIAACLSAAA60gAATdIAAGvSAAB/0gAAjNIAAKnSAADQ0gAA5dIAAPzSAAAR0wAAKtMAAEPTAABY0wAAbdMAAIzTAACr0wAAydMAAOfTAAAF1AAAKtQAAEDUAABp1AAAfNQAAI3UAACq1AAAwtQAANrUAAD11AAAENUAAC7VAABL1QAAadUAAIjVAACW1QAAsNUAAMbVAADb1QAA8dUAAP/VAAAU1gAAJ9YAADfWAABL1gAAYdYAAH3WAACZ1gAAtNYAAMfWAADf1gAA/dYAAArXAAAV1wAAMNcAAEvXAABc1wAAetcAAJjXAAC21wAA1NcAAADYAAAN2AAAGtgAAC/YAABE2AAAadgAAI/YAACb2AAAq9gAAMvYAADk2AAABNkAAB7ZAAA42QAAS9kAAGHZAAB82QAAiNkAALHZAAC+2QAA0dkAAOnZAAAA2gAAEdoAACTaAAA92gAAUtoAAF7aAABr2gAAgNoAAJ7aAAC02gAA0NoAAOLaAAAB2wAAI9sAADLbAABB2wAAUtsAAF/bAABx2wAAg9sAAJbbAACq2wAAvtsAANbbAAD62wAAG9wAADLcAABI3AAAbNwAAHvcAACN3AAAqtwAAMXcAAD03AAADd0AABjdAAAp3QAAO90AAFPdAABh3QAAfd0AAJrdAAC53QAAzt0AAPfdAAAh3gAAPN4AAF7eAABw3gAAk94AAKbeAAC23gAA2t4AAOzeAAAJ3wAAIt8AADvfAABX3wAAdN8AAJHfAACm3wAAvd8AANzfAAD73wAAGOAAADXgAABV4AAAduAAAJPgAACr4AAAvOAAAO7gAAAC4QAAIOEAAC3hAABJ4QAAZuEAAIPhAACZ4QAAquEAAL/hAADR4QAA6uEAAAviAAAy4gAAUOIAAH7iAACV4gAAqeIAALriAADZ4gAA+OIAABXjAAAy4wAATuMAAGbjAACH4wAAqOMAAMXjAADa4wAA+eMAABLkAAA15AAAbOQAAHzkAACE5AAAmuQAAK3kAADD5AAA2eQAAOXkAADw5AAACOUAACflAAA75QAAUuUAAFzlAABq5QAAc+UAAH/lAACb5QAAsuUAANPlAAD65QAAEeYAADTmAABL5gAAZuYAAH/mAACe5gAAseYAANfmAAD75gAAFOcAACjnAABC5wAAWucAAGznAACU5wAAtOcAAL/nAADZ5wAA9ucAABHoAAA26AAATugAAGboAACB6AAAnOgAAMboAADt6AAABOkAAC7pAABR6QAAb+kAAI3pAACr6QAAx+kAAO/pAAAL6gAALuoAAELqAABg6gAAeuoAAJbqAACw6gAA0uoAAPTqAAAH6wAAGOsAAD/rAABh6wAAkusAALnrAADj6wAAA+wAABDsAAAm7AAAPuwAAFjsAACB7AAAoewAAMHsAAD27AAAK+0AADntAABN7QAAZe0AAITtAACq7QAA0O0AAO3tAAAe7gAAUO4AAILuAAC27gAA6e4AAAzvAAAm7wAAUe8AAHnvAACT7wAAve8AANfvAAAV8AAAU/AAAHDwAACN8AAAovAAALrwAADd8AAAIfEAAEHxAABi8QAAkPEAALDxAADR8QAA//EAAC7yAABQ8gAAafIAAInyAACm8gAAwPIAANLyAADh8gAA9PIAABfzAAA48wAAWfMAAHLzAACG8wAAm/MAAKXzAAC38wAAyPMAAN7zAAD88wAAKPQAAEX0AABi9AAAavQAAIf0AACc9AAAxPQAAO30AAAL9QAAJfUAADz1AABP9QAAaPUAAHj1AACV9QAAsvUAANn1AAAA9gAAJ/YAAFb2AABr9gAApfYAALn2AADM9gAA5PYAAO32AAAE9wAAMPcAAEP3AABn9wAAh/cAALL3AADN9wAA/vcAACH4AAA6+AAAXfgAAHL4AACo+AAAvvgAANH4AADu+AAA//gAABT5AAAg+QAATPkAAHf5AACj+QAAyPkAAOL5AAAQ+gAARvoAAE76AABS+gAAVvoAAGD6AABj+gAAfvoAAI/6AACo+gAAvvoAANP6AADl+gAA7voAAAD7AAAW+wAALvsAAFr7AABt+wAAj/sAAK37AAC7+wAA4PsAAAf8AAA0/AAASfwAAGX8AACB/AAAo/wAALf8AADd/AAABf0AACf9AABI/QAAaP0AAH39AACe/QAAuv0AAMb9AADu/QAADv4AADP+AABM/gAAYP4AAHz+AACr/gAAx/4AAOD+AAD+/gAAJ/8AAEj/AABm/wAAjP8AAK7/AADS/wAAAQABAA8AAQAoAAEAOAABAEgAAQBXAAEAbgABAIgAAQCyAAEA0gABAPMAAQACAQEAIwEBAEwBAQBtAQEAhAEBAJUBAQCoAQEAtgEBAMcBAQDhAQEA/gEBABACAQAzAgEATQIBAF8CAQB2AgEAkgIBAK8CAQDXAgEA+gIBABkDAQAuAwEARgMBAGEDAQB6AwEAhQMBAJgDAQCnAwEAvQMBANgDAQDtAwEAAQQBABgEAQAqBAEAOQQBAEYEAQBaBAEAeAQBAI4EAQCdBAEAtwQBAM8EAQDuBAEADgUBACQFAQA7BQEARgUBAFgFAQBsBQEAhQUBAKQFAQDABQEA3wUBAPcFAQAfBgEALwYBAEQGAQBQBgEAbgYBAH8GAQCaBgEAqwYBAMMGAQDZBgEA8AYBAA4HAQAdBwEALgcBAD4HAQBfBwEAbwcBAHwHAQCQBwEAowcBALUHAQDGBwEA1QcBAOkHAQD1BwEA/gcBAAkIAQAcCAEAOggBAFcIAQBwCAEAhQgBAKIIAQC4CAEA0wgBAO0IAQAKCQEAGwkBACwJAQA8CQEAWAkBAGcJAQBvCQEAgwkBAKcJAQDKCQEA2QkBAPAJAQAACgEACAoBABcKAQAxCgEAWgoBAHIKAQCJCgEAlQoBAKAKAQDDCgEA2goBAPcKAQATCwEALwsBAEoLAQBqCwEAfQsBAJILAQClCwEAvwsBAOcLAQDyCwEA/wsBABcMAQAsDAEARAwBAFwMAQBxDAEAlQwBALAMAQDXDAEA9gwBAA0NAQAsDQEARw0BAGwNAQB/DQEAjQ0BAJkNAQCvDQEAxA0BANwNAQD2DQEAEg4BADcOAQBeDgEAcg4BAIcOAQCRDgEAoA4BAK8OAQDADgEA0A4BAOEOAQDzDgEABA8BABsPAQAvDwEATQ8BAGEPAQBsDwEAgA8BAJMPAQCtDwEAzg8BAOkPAQD+DwEAERABACYQAQA8EAEAWRABAHIQAQCEEAEAlhABALQQAQDAEAEAzhABAPYQAQALEQEAKhEBAEsRAQBrEQEAjxEBALARAQDKEQEA7xEBABESAQAqEgEAPhIBAFkSAQBpEgEAdxIBAJkSAQC0EgEAwBIBANcSAQDlEgEA+BIBAAQTAQAXEwEAMRMBAEUTAQBdEwEAdxMBAJQTAQClEwEAuhMBAOATAQDwEwEA/BMBABQUAQAoFAEAQhQBAFEUAQBdFAEAZhQBAHQUAQCKFAEAmxQBALsUAQDcFAEA7RQBAA4VAQAvFQEAUxUBAGcVAQCCFQEAkhUBAKQVAQCxFQEAxRUBANYVAQDsFQEA/hUBABMWAQAyFgEASxYBAGEWAQB3FgEAnRYBALIWAQDCFgEA0BYBAOEWAQD8FgEABxcBABUXAQAtFwEAQhcBAEwXAQBeFwEAbhcBAHwXAQCNFwEAqBcBAMAXAQDQFwEA4xcBAPsXAQASGAEAIBgBADEYAQBMGAEAWBgBAGMYAQBxGAEAghgBAJEYAQCjGAEArRgBAMEYAQDOGAEA5RgBAPUYAQANGQEAJRkBAEQZAQBjGQEAehkBAIwZAQCTGQEAsRkBANcZAQD8GQEAFRoBAC0aAQA3GgEAPBoBAEgaAQBaGgEAYRoBAHgaAQCTGgEAohoBALYaAQDRGgEA6BoBAPcaAQAAGwEADhsBACEbAQA3GwEAShsBAFwbAQB7GwEAlRsBAKsbAQC2GwEAyxsBAOAbAQDuGwEA+BsBAA4cAQAsHAEAPRwBAFIcAQBoHAEAfRwBAI4cAQCiHAEArxwBAL8cAQDOHAEA8xwBAAAdAQAMHQEAHh0BAEkdAQBdHQEAcR0BAI4dAQClHQEAxR0BAOIdAQD4HQEAGR4BADMeAQBcHgEAcB4BAH8eAQCJHgEAlB4BALIeAQDLHgEA7R4BAPseAQAJHwEAFx8BAD8fAQBoHwEAeB8BAIcfAQCUHwEAox8BALQfAQDKHwEA5h8BAAQgAQAfIAEAKyABADMgAQBIIAEAZCABAIEgAQCWIAEAqiABAL8gAQDQIAEA5CABAAAhAQAOIQEAHiEBAC0hAQBBIQEATyEBAGMhAQB9IQEAkyEBAKUhAQC5IQEAziEBAOEhAQDtIQEABCIBABAiAQApIgEAQCIBAHciAQCbIgEAtiIBAM8iAQDfIgEA8iIBAP8iAQAvIwEAPCMBAFIjAQBqIwEAhSMBAJ8jAQC1IwEAzSMBAN0jAQDqIwEACyQBADIkAQBAJAEATSQBAGAkAQCCJAEAliQBALAkAQDDJAEA1iQBAO0kAQAGJQEAJiUBAEAlAQBLJQEAYSUBAIAlAQCLJQEArCUBAMslAQDcJQEA+CUBABsmAQA/JgEAVyYBAGkmAQCRJgEAsCYBAMQmAQDSJgEA4yYBAP4mAQAVJwEAKCcBADQnAQBIJwEAVycBAGQnAQBwJwEAgicBAJonAQCrJwEAzicBAO0nAQD+JwEAFygBACwoAQBIKAEAXygBAHkoAQCSKAEApCgBALkoAQDOKAEA3SgBAAEpAQASKQEAJSkBAEkpAQBhKQEAcCkBAH4pAQCZKQEAsikBAMApAQDRKQEA4SkBAPgpAQAVKgEAMSoBAE4qAQBgKgEAeyoBAKUqAQDBKgEA1SoBAOsqAQAGKwEAGSsBAC4rAQBKKwEAXysBAHArAQCBKwEAkisBAKArAQC2KwEAwysBAPErAQAJLAEAICwBADIsAQBGLAEAYCwBAH0sAQCrLAEA0SwBAPMsAQAdLQEAMC0BAFItAQBxLQEAji0BAKQtAQC3LQEA0C0BANwtAQD2LQEAEC4BACYuAQA6LgEATC4BAGEuAQB9LgEAnS4BAMMuAQDOLgEA4y4BAPQuAQAJLwEAFC8BAB8vAQAsLwEASC8BAFsvAQBoLwEAky8BAMIvAQDgLwEAAjABACAwAQA0MAEARTABAHEwAQCfMAEAtjABAMIwAQDUMAEA7DABAAQxAQAWMQEAPjEBAGExAQB1MQEAjTEBAKkxAQDMMQEA3TEBAPQxAQALMgEAJDIBACwyAQA4MgEAQzIBAFAyAQBhMgEAcjIBAIMyAQCXMgEAqzIBAL4yAQDPMgEA2jIBAOcyAQD0MgEACjMBABQzAQAYMwEAHjMBADczAQBRMwEAXjMBAG4zAQB5MwEAhDMBAIwzAQCZMwEAojMBALYzAQDDMwEA0DMBAN0zAQDvMwEAAzQBABM0AQAkNAEANjQBAEI0AQBLNAEAXjQBAGw0AQB1NAEAiTQBAKM0AQCxNAEA8DQBABg1AQA0NQEARzUBAFk1AQB3NQEAjzUBAKQ1AQDBNQEA3zUBAOo1AQD/NQEAEjYBACI2AQBHNgEAcDYBAIA2AQCPNgEAtDYBAMQ2AQDkNgEABTcBACY3AQBENwEAbDcBAIE3AQCbNwEAnzcBALk3AQDKNwEA6zcBAP43AQAfOAEARTgBAE84AQBvOAEAfjgBAJQ4AQCoOAEAtzgBANM4AQDnOAEAATkBABw5AQA6OQEASjkBAFo5AQBuOQEAgzkBAI85AQCsOQEAwTkBANc5AQDkOQEA9DkBAAU6AQAZOgEALToBAD46AQBOOgEAWjoBAHQ6AQCCOgEAnDoBALc6AQDAOgEA8DoBAP06AQATOwEAMzsBAF87AQCAOwEAnjsBALY7AQDSOwEA9TsBAAo8AQA3PAEASTwBAGM8AQB7PAEAkTwBAKI8AQCtPAEAyDwBANw8AQD7PAEAEz0BACY9AQBCPQEAWT0BAGU9AQB3PQEAiT0BAJo9AQCwPQEAvT0BAMs9AQDePQEA+D0BAAw+AQAiPgEAQT4BAGI+AQCPPgEAqz4BAMg+AQDgPgEA8T4BAAk/AQAiPwEAMz8BAEY/AQBgPwEAbj8BAIY/AQCSPwEAoz8BALU/AQDOPwEA2z8BAO4/AQAFQAEAKkABAElAAQBYQAEAZ0ABAHZAAQCFQAEAlEABAKNAAQCyQAEAwUABANBAAQDfQAEA7kABAP1AAQAMQQEAG0EBACpBAQA5QQEASEEBAFdBAQBmQQEAdUEBAIRBAQCTQQEAokEBALFBAQDAQQEAz0EBAN5BAQDtQQEA/EEBAAtCAQAkQgEAM0IBAEJCAQBRQgEAYEIBAH9CAQCVQgEArUIBAM5CAQDsQgEABkMBACNDAQA2QwEARkMBAFVDAQBwQwEAlkMBALBDAQDNQwEA5UMBAABEAQAURAEAKEQBADpEAQBIRAEAWkQBAHlEAQCWRAEArUQBAMREAQDdRAEA9EQBAA1FAQAkRQEAOkUBAFJFAQBiRQEAe0UBAItFAQCxRQEAyUUBAOpFAQAKRgEAJkYBAEVGAQBdRgEAckYBAIdGAQCgRgEAtUYBAMlGAQDyRgEABUcBAB5HAQAsRwEAPEcBAFhHAQBfRwEAbkcBAJlHAQCuRwEAw0cBANxHAQD3RwEAFEgBADVIAQBUSAEAbUgBAIRIAQCWSAEAvkgBANNIAQDzSAEAGkkBAEBJAQBKSQEAXEkBAIpJAQCaSQEApkkBAMFJAQDRSQEA8UkBABVKAQA0SgEAT0oBAG1KAQCHSgEAoEoBAMFKAQDYSgEA6koBAABLAQAjSwEASEsBAGdLAQCJSwEAsEsBAM5LAQDmSwEAAkwBAC5MAQBRTAEAbEwBAIZMAQCbTAEAvEwBANhMAQD2TAEAA00BABVNAQA6TQEAX00BAI1NAQCxTQEA1k0BAPNNAQD/TQEACk4BABZOAQArTgEANE4BAEpOAQBoTgEAdk4BAIxOAQCkTgEAtk4BAN1OAQACTwEAGU8BADVPAQBMTwEAZU8BAHxPAQCSTwEAqk8BAM1PAQDmTwEACVABAChQAQBDUAEAYFABAH5QAQClUAEAwFABAOdQAQAQUQEAPFEBAFVRAQBmUQEAfFEBAJVRAQCrUQEAwVEBANJRAQDdUQEA9lEBAAxSAQAyUgEAVVIBAGtSAQCRUgEAtFIBAMxSAQDrUgEABVMBACBTAQBEUwEAbVMBAJBTAQCsUwEA2VMBAAVUAQA8VAEAZ1QBAJFUAQC/VAEA6VQBABtVAQBBVQEAa1UBAJFVAQCsVQEAylUBANpVAQDoVQEACVYBAClWAQA6VgEARlYBAFBWAQBaVgEAc1YBAJBWAQChVgEAvVYBANhWAQD/VgEAHVcBADtXAQBSVwEAaFcBAI9XAQCtVwEAvFcBANdXAQDsVwEABFgBAB5YAQA6WAEASVgBAFdYAQB1WAEAjFgBAKtYAQDKWAEA5lgBAP5YAQATWQEAKVkBADpZAQBMWQEAYFkBAHNZAQCIWQEAmVkBALFZAQDIWQEA8VkBAPxZAQAbWgEAJ1oBADlaAQBMWgEAZFoBAHNaAQCGWgEAj1oBAKVaAQC3WgEAyFoBAOtaAQANWwEALVsBADBbAQBLWwEAbFsBAHxbAQCWWwEAvVsBANpbAQD0WwEAEVwBACBcAQA2XAEAV1wBAGtcAQCAXAEAmFwBALBcAQDLXAEA4VwBAPpcAQAKXQEAGF0BADRdAQBBXQEAS10BAFpdAQBqXQEAel0BAJFdAQCvXQEAxF0BANpdAQDyXQEADV4BADBeAQA+XgEATl4BAGReAQB/XgEAo14BALxeAQDhXgEA814BAAxfAQAbXwEAJV8BADhfAQBSXwEAY18BAHBfAQCIXwEAqF8BALxfAQDYXwEA5V8BAPZfAQAAYAEACmABAA5gAQAmYAEASWABAF1gAQBpYAEAfmABAJFgAQCuYAEAyGABAOxgAQD8YAEABGEBABZhAQAzYQEASGEBAF5hAQBwYQEAi2EBAKJhAQDLYQEA7mEBAABiAQAKYgEAMGIBAFRiAQB0YgEAlGIBALBiAQDTYgEA82IBABNjAQAzYwEARmMBAF5jAQCHYwEAnmMBALJjAQDTYwEA5WMBAPRjAQAHZAEAE2QBAB9kAQApZAEAPmQBAEVkAQBSZAEAg2QBAJBkAQChZAEArGQBAMBkAQDTZAEA9mQBABhlAQBDZQEAaWUBAIdlAQCmZQEAx2UBAO1lAQATZgEAMGYBAE1mAQB4ZgEAgWYBAJRmAQCkZgEAsGYBAMBmAQDTZgEA6WYBAAJnAQAuZwEAT2cBAG9nAQCNZwEAnmcBALNnAQDCZwEAzmcBANlnAQDrZwEA/2cBAAtoAQAnaAEAPWgBAE9oAQBlaAEAdGgBAIhoAQCbaAEArmgBALhoAQDXaAEA5WgBAPVoAQAFaQEAFmkBAChpAQA5aQEASWkBAGNpAQBuaQEAe2kBAI5pAQCzaQEA1WkBAPBpAQAEagEAJ2oBAD5qAQBUagEAeGoBAKFqAQDLagEA9WoBAB1rAQA6awEAV2sBAH1rAQCcawEAwmsBAOVrAQALbAEAImwBAEJsAQBcbAEAdWwBAIxsAQCvbAEAyWwBAORsAQD4bAEAD20BAEZtAQB3bQEAlG0BALNtAQDabQEAAG4BACRuAQBRbgEAdm4BAJtuAQDAbgEA1W4BAOZuAQD/bgEAF28BAElvAQBUbwEAa28BAI5vAQC4bwEA428BAP9vAQAgcAEAPXABAERwAQBNcAEAVXABAGtwAQB2cAEAiHABAJlwAQCucAEAvXABAM5wAQDXcAEA9HABAAlxAQAicQEALXEBADtxAQBJcQEAWHEBAF9xAQB3cQEAjXEBAJtxAQCpcQEAtHEBAMVxAQDVcQEA7HEBAPxxAQAMcgEALnIBAEdyAQBhcgEAdXIBAJRyAQCrcgEAtHIBANFyAQDYcgEA5nIBAPVyAQD+cgEACXMBAB9zAQAzcwEARHMBAFpzAQCGcwEAnnMBALBzAQC/cwEA03MBAOdzAQD6cwEAD3QBABx0AQAsdAEAVHQBAGh0AQCHdAEAmXQBAK90AQDQdAEA23QBAPR0AQAFdQEAGHUBACt1AQBKdQEAY3UBAIN1AQCXdQEApXUBAMJ1AQDVdQEA7XUBAAx2AQAvdgEAWHYBAIF2AQCtdgEAz3YBAPl2AQAddwEAQncBAGR3AQCKdwEAqHcBAMV3AQDcdwEA7HcBAP13AQAZeAEAOHgBAE14AQBmeAEAf3gBAJl4AQCxeAEAzHgBAO14AQAFeQEAH3kBADd5AQBReQEAZ3kBAH15AQCZeQEAuHkBAMl5AQDaeQEA6XkBAP55AQAYegEAKXoBAFh6AQB1egEAh3oBAJ56AQC4egEAyHoBAOB6AQD4egEACnsBACV7AQA1ewEAQ3sBAFd7AQBxewEAgHsBAJ97AQC8ewEA3nsBAP57AQALfAEAFnwBAD18AQBifAEAi3wBALJ8AQDVfAEA+XwBAB59AQBIfQEAbX0BAIJ9AQCdfQEAsn0BAMt9AQD4fQEADX4BACl+AQBPfgEAbX4BAIN+AQCVfgEAvX4BANJ+AQD3fgEAHH8BADN/AQBMfwEAZX8BAHx/AQCTfwEAs38BANN/AQDzfwEAE4ABADCAAQBNgAEAcIABAISAAQCYgAEAroABAMSAAQD0gAEA/4ABACeBAQA9gQEAU4EBAG+BAQCHgQEAmIEBAKuBAQDIgQEA1YEBAOKBAQDtgQEA94EBAAiCAQASggEAHIIBAC6CAQA4ggEARoIBAFSCAQBrggEAgIIBAJOCAQCjggEAvYIBANKCAQDqggEAB4MBABeDAQAogwEAOIMBAEuDAQBegwEAb4MBAIWDAQCWgwEAs4MBAMyDAQDggwEA9oMBABeEAQAthAEAQYQBAFSEAQBohAEAiIQBAKuEAQDOhAEA5IQBAACFAQAfhQEAOoUBAFSFAQB1hQEAmoUBALqFAQDWhQEA6IUBAP2FAQAQhgEAKIYBAECGAQBjhgEAfIYBAIuGAQCYhgEAsoYBAMyGAQDUhgEA4IYBAPqGAQAehwEANocBAEWHAQBthwEAhocBAKmHAQDAhwEAzIcBAN2HAQDyhwEACYgBADWIAQBUiAEAgIgBAJqIAQCmiAEAuogBAM6IAQDgiAEA+ogBABKJAQA0iQEAWYkBAG2JAQCDiQEAjYkBAJWJAQCkiQEArIkBAMWJAQDSiQEA54kBAPuJAQAbigEARYoBAFqKAQBoigEAdYoBAICKAQCJigEAkIoBAJqKAQCligEAy4oBANuKAQD3igEAEIsBACWLAQAsiwEAPIsBAE+LAQBjiwEAbYsBAIeLAQCaiwEAq4sBALiLAQDXiwEA5osBAPiLAQAPjAEAIowBAD2MAQBVjAEAYYwBAHCMAQCBjAEAj4wBAKOMAQDJjAEA1owBAOGMAQD6jAEAFo0BAB+NAQAsjQEAO40BAFCNAQBbjQEAZI0BAHKNAQCDjQEAlo0BAJ+NAQCxjQEAvY0BAMuNAQDgjQEAAo4BAB+OAQA0jgEASI4BAFmOAQBqjgEAdY4BAIqOAQCXjgEAuY4BAMmOAQDUjgEA644BAAKPAQAljwEAOI8BAFePAQB0jwEAio8BAKyPAQDEjwEA4I8BAPePAQAIkAEAGZABADCQAQBqkAEAiZABAKKQAQC6kAEAzJABAOqQAQD7kAEAGJEBACmRAQA5kQEAVZEBAG6RAQB5kQEAj5EBAKmRAQDIkQEA7JEBAAySAQAgkgEAMpIBAEOSAQBckgEAcpIBAISSAQCXkgEAsJIBAMaSAQDekgEA9ZIBAAyTAQAfkwEAM5MBAE2TAQBkkwEAcpMBAIuTAQCekwEArZMBAL2TAQDTkwEA55MBAACUAQAhlAEARpQBAGaUAQB+lAEAkZQBAKmUAQC3lAEAw5QBAM2UAQDflAEA85QBAAWVAQASlQEAI5UBAEaVAQBslQEAfZUBAJKVAQCllQEAupUBAMiVAQDjlQEA/pUBABaWAQAqlgEAQJYBAFSWAQBwlgEAfpYBAIqWAQCWlgEArJYBAMmWAQDklgEA+5YBABSXAQAtlwEAUpcBAHqXAQCQlwEAopcBALaXAQDPlwEA3pcBAOuXAQD4lwEACJgBABqYAQAomAEAP5gBAFWYAQBnmAEAe5gBAI+YAQClmAEAwZgBAOWYAQAMmQEAJJkBAEaZAQBYmQEAapkBAH+ZAQCSmQEAoZkBALKZAQDPmQEA75kBAAiaAQAimgEAPpoBAFSaAQBomgEAfZoBAJiaAQCzmgEA35oBAAGbAQAYmwEAN5sBAFybAQB6mwEAlZsBAKubAQC+mwEA05sBAOebAQDvmwEABJwBAB6cAQArnAEAOJwBAD+cAQBUnAEAaJwBAHqcAQCInAEAmJwBAK+cAQDOnAEA7JwBAAidAQAgnQEAOp0BAFudAQCJnQEAoJ0BALadAQDKnQEA2p0BAOydAQAFngEAHJ4BAC6eAQA+ngEAWZ4BAGqeAQCFngEAnJ4BAKieAQDEngEA154BAPaeAQAanwEAQJ8BAF2fAQCGnwEApJ8BAMKfAQDfnwEAEKABAECgAQBhoAEAc6ABAIGgAQCaoAEAs6ABAMSgAQDXoAEA8KABAAehAQAXoQEALaEBAD6hAQBXoQEAZqEBAIOhAQCToQEAqqEBALqhAQDSoQEA7qEBAP+hAQAcogEAM6IBAEuiAQBdogEAeKIBAIyiAQCiogEAwqIBAOWiAQD/ogEAFqMBACejAQA5owEAS6MBAHWjAQCLowEAnKMBAK6jAQC9owEA2KMBAPGjAQAMpAEALaQBAECkAQBLpAEAaqQBAIukAQCmpAEAyqQBAOakAQD6pAEAIqUBAEylAQBspQEAg6UBAJalAQCypQEAzqUBAO6lAQAFpgEAK6YBAEGmAQBWpgEAcaYBAIqmAQCopgEAyKYBAPKmAQAbpwEAQacBAGOnAQCApwEAl6cBALSnAQDLpwEA7qcBAAWoAQAYqAEALagBAFCoAQBwqAEAgagBAJqoAQCsqAEAvKgBANmoAQD+qAEAG6kBAEKpAQBlqQEAiKkBAKypAQC+qQEA36kBAAeqAQAzqgEASaoBAFyqAQB8qgEAiqoBALGqAQDDqgEA6aoBAAarAQAiqwEAQqsBAGCrAQCHqwEAoKsBALSrAQDkqwEA8KsBABWsAQA4rAEASqwBAFasAQBurAEAh6wBAKKsAQC/rAEA46wBAAWtAQA+rQEAWq0BAHytAQChrQEAwa0BAOKtAQACrgEAHK4BADuuAQBhrgEAg64BAKquAQC5rgEA0K4BAOeuAQAJrwEAKa8BAD+vAQBirwEAhq8BAKSvAQDRrwEACLABAC+wAQBYsAEAhbABAJWwAQC+sAEA67ABABSxAQAxsQEASrEBAGmxAQCGsQEAoLEBAMexAQDfsQEACrIBACGyAQAusgEAPrIBAFmyAQB4sgEAjbIBAKeyAQDJsgEA47IBAPqyAQAJswEAJbMBAEmzAQBzswEAlrMBAK+zAQC+swEA3bMBAPmzAQAbtAEARbQBAF60AQBrtAEAf7QBAJO0AQC3tAEAzbQBAO20AQAKtQEAJ7UBAEe1AQBctQEAfLUBAJO1AQCmtQEAtrUBANa1AQD5tQEAFbYBACu2AQBOtgEAYbYBAIK2AQCetgEAurYBAOK2AQARtwEAPbcBAFu3AQB6twEAnbcBAMC3AQDstwEAErgBADu4AQBeuAEAfLgBAKK4AQC4uAEAzLgBAN24AQDuuAEAArkBACS5AQA5uQEAWLkBAHe5AQCHuQEAsrkBAN65AQADugEAMLoBAFG6AQB9ugEAjroBAKi6AQDGugEA6boBAPy6AQAUuwEAMbsBAFe7AQCEuwEArLsBAM+7AQD8uwEANLwBAF28AQCJvAEAubwBAOW8AQAavQEANr0BAF+9AQCDvQEAmr0BAL+9AQDYvQEA8r0BAAS+AQAmvgEAT74BAGq+AQCNvgEAs74BAPC+AQAIvwEAHr8BADK/AQBQvwEAbb8BAIi/AQCwvwEA1r8BAOy/AQALwAEAKMABAEvAAQBrwAEAisABAKfAAQDMwAEA6sABAAbBAQAcwQEAOsEBAFHBAQBmwQEAgcEBAJbBAQCxwQEAz8EBAO/BAQAOwgEAKsIBAFDCAQBuwgEAhcIBAJbCAQCywgEAzsIBAOPCAQD3wgEACMMBACPDAQA8wwEAXcMBAHjDAQCUwwEAucMBANfDAQD3wwEACcQBACPEAQBExAEAY8QBAHHEAQB7xAEAhcQBAJHEAQCyxAEAz8QBAAHFAQArxQEAVMUBAGfFAQCOxQEAscUBAOTFAQAHxgEAJMYBAEnGAQBpxgEAiMYBAK7GAQDVxgEAAscBADrHAQBYxwEAescBAJPHAQC+xwEA2ccBAPfHAQATyAEAK8gBAETIAQBhyAEAgMgBAKHIAQC4yAEA18gBAO/IAQAEyQEAIskBAEXJAQBdyQEAf8kBAJ3JAQDCyQEA4skBAP3JAQAiygEAQ8oBAE7KAQBkygEAjcoBALXKAQDLygEA7soBAP7KAQASywEAHcsBACfLAQA4ywEAR8sBAFLLAQBnywEAessBAI3LAQClywEAv8sBANvLAQD6ywEAF8wBADrMAQBWzAEAi8wBAK3MAQDGzAEA3swBAPXMAQAXzQEAPs0BAF7NAQB0zQEAiM0BAKjNAQDKzQEA5c0BAADOAQAazgEANc4BAEjOAQBszgEAhM4BAJ3OAQCzzgEAyM4BAOLOAQD4zgEADM8BACPPAQBDzwEAac8BAIfPAQCkzwEAw88BAOXPAQAI0AEAJ9ABAE3QAQBx0AEAk9ABALPQAQDb0AEA8dABAAzRAQAv0QEARdEBAGXRAQCJ0QEAr9EBAM7RAQDn0QEAAdIBACHSAQAu0gEAR9IBAF7SAQB10gEAhtIBAJ/SAQCw0gEAyNIBANrSAQD60gEAE9MBADTTAQBb0wEAd9MBAJDTAQCm0wEAxNMBAOXTAQAG1AEAItQBAEDUAQBV1AEAcdQBAJjUAQDA1AEA6dQBAAjVAQAr1QEAS9UBAHTVAQCa1QEAq9UBAL/VAQDQ1QEA59UBAA/WAQAy1gEAVNYBAHbWAQCU1gEAtNYBANvWAQAC1wEAI9cBAD3XAQBZ1wEAf9cBAKHXAQDD1wEA69cBABXYAQBA2AEAZ9gBAH/YAQCa2AEAstgBANDYAQDs2AEACtkBAB3ZAQA02QEARtkBAFnZAQBx2QEAh9kBAJTZAQCk2QEAs9kBAMHZAQDL2QEA19kBAOvZAQAC2gEAENoBAB7aAQA32gEAS9oBAFzaAQB02gEAeNoBAH/aAQCJ2gEAl9oBAKPaAQCu2gEAvdoBANjaAQDx2gEAC9sBABbbAQAh2wEAKtsBAD/bAQBS2wEAWdsBAHLbAQCU2wEApNsBALXbAQDC2wEA1tsBAOrbAQAD3AEAGNwBAB/cAQAr3AEAP9wBAEbcAQBN3AEAXtwBAHjcAQCD3AEAk9wBAJvcAQCm3AEAtdwBANLcAQDZ3AEA8twBAATdAQAN3QEAKN0BADndAQBH3QEAUd0BAG3dAQCE3QEAld0BAKjdAQC/3QEA290BAADeAQAi3gEAL94BAEXeAQBb3gEAZ94BAH/eAQCU3gEAsd4BAMfeAQDm3gEA/d4BAA7fAQAp3wEASt8BAF7fAQBz3wEAkd8BALHfAQDB3wEA1N8BAOffAQD83wEAGOABACzgAQA44AEAVuABAGbgAQB54AEAk+ABALjgAQDG4AEA2uABAOPgAQD74AEAE+EBACvhAQBE4QEAWuEBAF7hAQBy4QEA",nameLen_b64:"EgAaABMAFAAeAAwACQAZABEAEAAUAA8ACAASABcAHgAGABAADAAHABYAFwALABcADAAeAB4AGwAcACQAFwAWABQAFAAUABUAFgAUABUAFAAPAA4AIAANAA0AEAAeABoAFwAaABEAFgAZABwAHQAfABwAEgAJABcAKwA3ADYAFgAXAB4ADwArABMAEAAQACEAGwAeACEAKQAaABMAFAAUAAkAFwAUABQAEgAYAAsADgAOAAoAGQAeAA0ACQAKAA8ACwATABEAEwAJAAoADwALABMAEQATABYAIQAPAB8AEgARAA8ADgAUABgACAARABEAIgAOABYADAAPABIAFwAWABkAIgAoABcAKQAJABEAFgATAAsADwATABgAEwAdABMAGQAPAB8ADwARACIAFAAWABAAIwAKABIADQAMABYAEwAiACUAFQAcABEAHQApABUAFwAhAB0AHgAaABYAEgAjACUAHwAWABkAHQAaACQAGAAQABwADgAVABkAHAAVAA8ADQARABMAFQAVAB8AGgAVABkAGgAXABcADwASABEAGAAVABIACQAOABAAFwATACAAHAAlABoAGQAcABkAHgAZABYAEQALABAAFQARAB0AGwAnABIAKAAXACkAHAAsAA0AHgAdAB4AEgAVACEAFwAoACUAGAAZABcAIQAmABoAFwAfABoALwAVABgAGAATABUADwATAAkAFwAeAAsADgANAA0AEQAVABUAEwAxABUAJAAVABMACQALAA4ACAAKABMAFAARAA8AEgAPABEACQAIABsAGgAdABkAFgAeACAAJgAoACIAKgAlAC0ANwAxADIAKwAsAD0APgA/ADoAHwAaABMAHgApABsACQAfABkAEQAXABsAEQAUAB8AFQATABYAIwAcABQAIgASAAsACQARAA8AIwAoACUAHgAQABAAJQAlABoACgAgACIAKgAVACUAEQASABEAIAATAAwAGwASABwAHwAgACAADwARABcAEAAKAAsAFwAUABMAGAANAA4AIwAWAAwADwAUAB4ADQAJABIAEQAXABkACwAXAAoADQAYAA8AEQAaABkAGgASABkAFwAYABkAFwAZABEAFQAXAA8AFQAYABcAGQAfACUAEwAVABsAFgAeAB0AJQAYACEAIwAdACYAIAAjABYAFgAiABUAHgAdACgAMgAiABAAGgAtACsAFQAgAB8AFQARABQAGQANAB0AKwANAA4ADQANAA0AEgAXABMAEwAVAAgAIQATABwAGAAcAAsADwAWABkAHAAcAB0ACgAXABEADwANABEAEgAQAA8AFQAOABUAFQAiAA0AHAAcAB8AHgAaABgAGQAaACEAFAAVABQAFAAvACoAGQAYABsACgAYABYAEQATABEAHwAJABcAFwAgACMAJAAVABUADQAQABwAIAAXAAoACwAZAA0ADQAdABEAGgAZABAADAARABEADQAWABYAHgAQABcAEQANABYACgATAA4ABwAYABcAGgAVABIACwAHAA0ADQAMABwAIgAhAA0AEQAOABAAFAAUAA8AEgAUAA0ADwAbABQAEAAVABcAGQAPAA8AGwAJAA8AEgAPAA8AFAAaAA8AFQARABEAEwATABcAEAAXAA0AEAAQAA4AGQAdABkACwALAA4ADQARAA0ADQANABAADwAOABUAFQANAAwAEgAOAAkAFQAQABAADAAMABAAFAANABAAEAAPAA8AEwASAAoAEAAKABUADAAVAAcACAALAA8ACgAcAB8AIwAeABsAHgAdABEAEQAJABQADwAPABMAFwANAA8AGQAYAAgAEwATAAsAEQANAA8AEQAQAA8ADAALAAsACwAJAAsACAAIAAoADAAUAAsADwAZAA0ACgAJAA4ADAAMABAAFQAQAAsACAAKAAkAGAAUAA8AEQAIAAkAEAAVABcADAAOAAsADwAMAA4ACwAMAA0ACQAOAAYACwAIAAsACAASAA8ACwASAA8AEwAQABEADgASAA8AEwASAAwADwAXABcADQAOABoAEgAaABkAKAAQABAADwALABEADAAJACMAGAAUABwAFgAUABMAHgAeABQAGQAUABMAEgAaABcACAATAA4AAwARABEAHwARABkAHQAjAA4ACAANABAAEAANAAsAFQAUABoAFgAPAA8AFwAOABIACQAIAAcACwAGAAoACAAWAAsAGgAYACAAFgAWACIAIgArACYAJQArABAAGAAaAAwAEgATABYAFQAWAA0AEAAUABcAJAARAAsAEwAPAAkAEgAPAAoAEQAYABEAFgAWABUAGAAZABwAGwAVABQAHAAjACAAHwARAAoACwARABEADAAJAAkAFQANABYAGAAXACgAEgASAAsADQALABYAFQAaAAoACQARABcADgAHAAsAFgAWABAAFQAMAA8ACAANABEAEAARAA0AIgAKAA0ADwASAAQADgASAA4ADQAMAAwACgATABEAEAATABEAFgAPAAwAGwAaACcALQAlABsAIQAWABYAGwAZABUAGgAaABoAJgAVABUAGQATABEAEgARAB0AEwAJABsADwAQAAkADAAXADQADAASAAoAEQAdAAkAFQADAAQABQAmAB8AEwAMABAAFAANABMADgAQAA8ACQAIAAgACQAhABAADgAWABgAHwAhABQAFgAMABcAGAAaABoAFwAXAB0AGAATACMAEAAXABgAGgAaABcAGQAZAB0ADwAaABsAHQAdABoAGgAgABsACgAYABAAEAAQABcAGQATABgAGgAiABUAFAAJABgAGAALAA8ADwAQAA0AHAAbAAwAGwALAA4AIAAKABIAHgAPABAAEwAWABsAHQAUABEAEAAPAAwAIwAhAB4ACwAbABMADgALABMAEwATABMAEAAQABcAFwAcABwADgAOABMADgAYABYADQArABwAKwAcAB8AEAAfABAAHwAQAB8AEAAaABIAGAAXABsAFgAYABMAEwAUABIAFgAPABsAHQATAAwAFQATAAwACgAdAB0AJwAkAB0AEgAkAA8AGwAWABMAGAAUABgAHQARABMAGQAgACcAFQATAA0ACQAPAAoAEQAOABYAFgAbABsAEwAeAA4AEQAQABMAFAARABkAEQARABAAEAAVAA0AFAAIABgAFwARABUADQASABIAHQAcABQABwARABgAGQAYACAADAAXAB8AGwAVAA8AFQAbABYAFAAUABYAHAAQAA0AFgAbACMACgAQABMAEAAgAA8AEwARABIAHgAaABMAGAAXACIAEwAcAA4AGAAOABEAGQAVABMADwAcABkAHAAjABoAEAAgAC0AFAAPABMAIQANAA8ADwAbACQADgASABMAHgASABUAGgAiABcAFgAXACEAKwAYACQAHQAmABcAHwAWAB4AIwAVABEADQAgABIAGwAOABkADAAxABkAMAAwABoAGQAeAB0AGAAcABkAEgAYABgAHwAmACkAIwAUAB4AEQAXABwAHgAXAA0AEAASABIACgAVAA4AEwAVABIAHAAXABcADwApACkAGQAQABkADwAJABwADgAWABUAFwAKABQAEQASABsAGAAXABYAGQAhABMACwASABoAFgATABUAEgANABAAGAATAA0AEgAPACQAGAAjACUAGgAeABoAFwAHABsAHwAeABUAHgAYACAAHwAkAB8ADwAMABoAEwARABQAHQAgABIAIQARAA4AFwARABAAEAAbABkAEwAZABYAIQAdABQAEwAYACwAHQAbAAwAHgAiABkAGAAgABoAFQAXABMAIQAYABAAFwAeAB0AJgAWABsAFAAdABMAFgAlACEALAAtAC8ALwAsACwAMgAXAAkAHwAaABMAFwATABwAIAAfACEAKAAZABkAGQAcABIAFAAbABwAIgAUACYAFwAbABkAGAAaAB8AIQAaABwAGAAWAB4AIAAPABIAFwANABQAHAAZACAAGAAbAB8AIQAiACQAIQAhACEAHQAfABwAHAAcABAAEgAeAB0AHwAYABEAEQARABEAEQARABQAJAATABIAFwAVACcAIQAlABoAGwAjABgAJwArABAAHAAWAB4AGwAgABgAEwAhACAAGwASAA8AGQAUABsAEgAOABQAEAARABUAFgAfABAAIQAVAB8AHQApACEAJQANABkAFgARABoAFQAIACEADwAbAB4AIgAhABYALgAXABAAFwAcABQAGwAaACIAIQAaAA8AEwAUABQAHAApABAAIAAjABkAFgAcABoAHQAOAA8AJgAnABwAKAAYAB0AIQAjABsAGwAXABwAGgAfABMAEAAPABYAGAAcAB0AJQAdABsAGQAvACIAFQATACUAFgARACAAHgAyACUAKwAeABoAJgAbACkAIwAhAB8AKgAWABoAFgAUABEAEQAeAB0AFAAXABAAEQAHAAwAEQAOABUAEwAWABYAEwAKABIAFQATABEADAAVABQAGAAXABAAEwAKAA8AGQAUABQAGgAZABIAIgAjABUAHAATABYAGwAVABEAIAAaAA0AGQAdABwAHwAaAB0AHgAZABcAGQAjABkAIAANACMALwAHABUAFAAPABQAFQAYABUAHgAlACQAFgAUAA0AEAAVABoAGAAVABYAKwAtACIAHAAdABYAHgAdAB8AIwAcABgAGgAWABYAFQAdACIAFwAiACAAIQATABYAHQAMAB8AGgAeAB0AGgAbAB4AGAAZABkAGAAZACEACgAQACkAEwAkABcAJAAXABsAJQASABEADAAXABMAFQAMABAADgATABoAGwAZAA4AIQAcACQAJAASAB4AFwAaACEAEQATABEAEgASABMAHwAUABYAFgAaABoAGgAWACgAGwAbABsAFgARABUAFgArACoAJQAlAB0AFQAWABoAFgAQABAAKQAjABAAGwAhACYAJAAXABUAGwAaACcALQApAAgAGAAdABUAGQAQABQADwAfAAsAJgARAC0AOAAyABoAIAAqABUAHAAaABYAEgANABQAJQAsACYAKgAoACsAOgASACoANAA4ADgAMwAwAC8AMAAsAC4AKgAqADoAOQArACoAOQAbAB0AIgAmACkAJgAnABAAHAAuACwAHwAfABgAJAAoACsAHQAgAB8AGwANACsAMwA2ADQAIAAgABEAJwAbAB8AHgAbACsAIgArACsAKgAQAC0AFgASABkADgAUAAkACQAXABsAGQAQAB0AGAATABkAJwAMABgAEAAeAB0AFwAhAB4AFQAfABcAGAApABoAFgAbABYAHwAXABoAFgATABsAGAAYACUAFgAfABcAGgAWADEAGQA2ABwAGwAaABoAJAAdAB4AFAApAB8ALwAlADoAMAAiACUAGQARABcAHAAfAB8AJQAPABAAEgAWACMAEAAwADIAMwA+ABcAEgAUABQAHwApABUAMwA0ABwAGwAZACEAFQAWAA8ACwAOAA0AEgAtACUAFwAQABAAGAAPABMAGQAXABMADgAVABUABAAHAA4AGgAMAAoACgAQABMAGAAOACIAFwAdABgAHgAbAB8AFgATABYAFgAVABgAGgAVABEAFAASABUADQAKAAcAEwAfAB4AFwAWABoAGQAmACUAEQAWABYAHAAbACEAFQATABIAGgAnACEAFgAeAB4AIAAdACMAJgAZACEAEAAcABEAIQAcABgAFgAZABgAEQAWABkAFwAZABsAIgAaAB4ADAALABAADAALABwADgARABYAIQAkACYAJQAmADEAMwAyABoAGwAeACAAHwAgACsALQAsACcAJwApACgAKQAdABgAGAAUAAsAFgAXABkAGwASABwAFAAcABYAHQAXACcAFAAcAAoAFgAYAAoACgAVABoAGwATABsADQAOAA8ABwAOABYAIQAiABkAFgAaABMAFAAMABcADQAUABAAFgARAAkAGAAeABkAFgASABQAGwAMABMAJgAaACUADwARABgAKgARACEAHgAcABQAGAAeACAACAAPABMACgAXABkAFgAWAA4AHAAOAB0AGAAXABcAFwAhABwACgARABMAFwAeACIAFAANABAAEwAjABIAFQATACAAEAAXABcAEQAlACAAFQAaABYAEQALABgAEgAYABMAHgAUAA0AHQAnABUAFwAVABkAGQAVABUAHwAfAB4AHgAeACUAFgApABMAEQAdABgAGAAbABsAHgAdAB4AHwAOABoAFgAVABYADgAVABMAEAAUABYAHAAcABsAEwAYAB4ADQALABsAGwARAB4AHgAeAB4ALAANAA0AFQAVACUAJgAMABAAIAAZACAAGgAaABMAFgAbAAwAKQANABMAGAAXABEAEwAZABUADAANABUAHgAWABwAEgAfACIADwAPABEADQASABIAEwAUABQAGAAkACEAFwAWACQADwASAB0AGwAvABkACwARABIAGAAOABwAHQAfABUAKQAqABsAIgASACMAEwAQACQAEgAdABkAGQAcAB0AHQAVABcAHwAfAB0AHQAgACEAHQAYABEAMgAUAB4ADQAcAB0AHQAWABEAFQASABkAIQAnAB4ALgAXABQAEQAfAB8AHQAdABwAGAAhACEAHQAVAB8AGQAjADcAEAAIABYAEwAWABYADAALABgAHwAUABcACgAOAAkADAAcABcAIQAnABcAIwAXABsAGQAfABMAJgAkABkAFAAaABgAEgAoACAACwAaAB0AGwAlABgAGAAbABsAKgAnABcAKgAjAB4AHgAeABwAKAAcACMAFAAeABoAHAAaACIAIgATABEAJwAiADEAJwAqACAADQAWABgAGgApACAAIAA1ADUADgAUABgAHwAmACYAHQAxADIAMgA0ADMAIwAaACsAKAAaACoAGgA+AD4AHQAdABUAGAAjAEQAIAAhAC4AIAAhAC4ALwAiABkAIAAdABoAEgAPABMAIwAhACEAGQAUABUACgASABEAFgAeACwAHQAdAAgAHQAVACgAKQAeABoAFwATABkAEAAdAB0AJwAnACcALwAVADoAFAATABgACQAXACwAEwAkACAAKwAbADEAIwAZACMAFQA2ABYAEwAdABEAFQAMACwAKwAsACUAGgAuADYACAAEAAQACgADABsAEQAZABYAFQASAAkAEgAWABgALAATACIAHgAOACUAJwAtABUAHAAcACIAFAAmACgAIgAhACAAFQAhABwADAAoACAAJQAZABQAHAAvABwAGQAeACkAIQAeACYAIgAkAC8ADgAZABAAEAAPABcAGgAqACAAIQAPACEAKQAhABcAEQATAA4AEQAaAB0AEgAjABoAEgAXABwAHQAoACMAHwAVABgAGwAZAAsAEwAPABYAGwAVABQAFwASAA8ADQAUAB4AFgAPABoAGAAfACAAFgAXAAsAEgAUABkAHwAcAB8AGAAoABAAFQAMAB4AEQAbABEAGAAWABcAHgAPABEAEAAhABAADQAUABMAEgARAA8AFAAMAAkACwATAB4AHQAZABUAHQAWABsAGgAdABEAEQAQABwADwAIABQAJAAjAA8AFwAQAAgADwAaACkAGAAXAAwACwAjABcAHQAcABwAGwAgABMAFQATABoAKAALAA0AGAAVABgAGAAVACQAGwAnAB8AFwAfABsAJQATAA4ADAAWABUAGAAaABwAJQAnABQAFQAKAA8ADwARABAAEQASABEAFwAUAB4AFAALABQAEwAaACEAGwAVABMAFQAWAB0AGQASABIAHgAMAA4AKAAVAB8AIQAgACQAIQAaACUAIgAZABQAGwAQAA4AIgAbAAwAFwAOABMADAATABoAFAAYABoAHQARABUAJgAQAAwAGAAUABoADwAMAAkADgAWABEAIAAhABEAIQAhACQAFAAbABAAEgANABQAEQAWABIAFQAfABkAFgAWACYAFQAQAA4AEQAbAAsADgAYABUACgASABAADgARABsAGAAQABMAGAAXAA4AEQAbAAwACwAOABEADwASAAoAFAANABcAEAAYABgAHwAfABcAEgAHAB4AJgAlABkAGAAKAAUADAASAAcAFwAbAA8AFAAbABcADwAJAA4AEwAWABMAEgAfABoAFgALABUAFQAOAAoAFgAeABEAFQAWABUAEQAUAA0AEAAPACUADQAMABIAKwAUABQAHQAXACAAHQAWACEAGgApABQADwAKAAsAHgAZACIADgAOAA4AKAApABAADwANAA8AEQAWABwAHgAbAAwACAAVABwAHQAVABQAFQARABQAHAAOABAADwAUAA4AFAAaABYAEgAUABUAEwAMABcADAAZABcANwAkABsAGQAQABMADQAwAA0AFgAYABsAGgAWABgAEAANACEAJwAOAA0AEwAiABQAGgATABMAFwAZACAAGgALABYAHwALACEAHwARABwAIwAkABgAEgAoAB8AFAAOABEAGwAXABMADAAUAA8ADQAMABIAGAARACMAHwARABkAFQAcABcAGgAZABIAFQAVAA8AJAARABMAJAAYAA8ADgAbABkADgARABAAFwAdABwAHQASABsAKgAcABQAFgAbABMAFQAcABUAEQARABEADgAWAA0ALgAYABcAEgAUABoAHQAuACYAIgAqABMAIgAfAB0AFgATABkADAAaABoAFgAUABIAFQAcACAAJgALABUAEQAVAAsACwANABwAEwANACsALwAeACIAHgAUABEALAAuABcADAASABgAGAASACgAIwAUABgAHAAjABEAFwAXABkACAAMAAsADQARABEAEQAUABQAEwARAAsADQANABYACgAEAAYAGQAaAA0AEAALAAsACAANAAkAFAANAA0ADQASABQAEAARABIADAAJABMADgAJABQAGgAOAD8AKAAcABMAEgAeABgAFQAdAB4ACwAVABMAEAAlACkAEAAPACUAEAAgACEAIQAeACgAFQAaAAQAGgARACEAEwAhACYACgAgAA8AFgAUAA8AHAAUABoAGwAeABAAEAAUABUADAAdABUAFgANABAAEQAUABQAEQAQAAwAGgAOABoAGwAJADAADQAWACAALAAhAB4AGAAcACMAFQAtABIAGgAYABYAEQALABsAFAAfABgAEwAcABcADAASABIAEQAWAA0ADgATABoAFAAWAB8AIQAtABwAHQAYABEAGAAZABEAEwAaAA4AGAAMABEAEgAZAA0AEwAXACUAHwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAZAA8ADwAPAA8AHwAWABgAIQAeABoAHQATABAADwAbACYAGgAdABgAGwAUABQAEgAOABIAHwAdABcAFwAZABcAGQAXABYAGAAQABkAEAAmABgAIQAgABwAHwAYABUAFQAZABUAFAApABMAGQAOABAAHAAHAA8AKwAVABUAGQAbAB0AIQAfABkAFwASACgAFQAgACcAJgAKABIALgAQAAwAGwAQACAAJAAfABsAHgAaABkAIQAXABIAFgAjACUAHwAiACcAHgAYABwALAAjABsAGgAVACEAHAAeAA0AEgAlACUALgAkACUAHQAMAAsADAAVAAkAFgAeAA4AFgAYABIAJwAlABcAHAAXABkAFwAWABgAIwAZACMAHwAbAB0AHgAnABsAJwApACwAGQARABYAGQAWABYAEQALABkAFgAmACMAFgAmACMAGAAfABoAGwAkACkAIwAcAC0ALAA3ACsAKgAuACoAMgAmACoAJgAbAB4AEAAOACEAIAARAAwACgAKABkAHQARABwAGwAnAB4AHgAXABYAJwAeAA8AGwAVABgAGgAcAA8ADgAeABcAHwAfABwAGAAVABYAEQASABQAEwAVABEAGAAXACkACwAfAAwAEgATABgADwATAAkAFgASABEAIwAiACAAAwAbACEAEAAaACcAHQAaAB0ADwAWACEAFAAVABgAGAAbABYAGQAQAA4AHAANAAoADwAQABAAFwAeABUAFgAYABsAIwAOABAAFgAbACQAGQAlABIAGQAPAAoAEwAaABEADQAYACAAFAAcAA0AEQAKAAoABAAYACMAFAAMABUAEwAdABoAJAAQAAgAEgAdABUAFgASABsAFwApACMAEgAKACYAJAAgACAAHAAjACAAIAAgABMAGAApABcAFAAhABIADwATAAwADAAKABUABwANADEADQARAAsAFAATACMAIgArACYAHgAfACEAJgAmAB0AHQArAAkAEwAQAAwAEAATABYAGQAsACEAIAAeABEAFQAPAAwACwASABQADAAcABYAEgAWAA8AFAATABMACgAfAA4AEAAQABEAEgARABAAGgALAA0AEwAlACIAGwAUACMAFwAWACQAKQAqACoAKAAdAB0AJgAfACYAIwAmABcAIAAaABkAFwAjABoAGwAUABcANwAxAB0AHwAnACYAJAAtACUAJQAlABUAEQAZABgAMgALABcAIwAqACsAHAAhAB0ABwAJAAgAFgALABIAEQAVAA8AEQAJAB0AFQAZAAsADgAOAA8ABwAYABYADgAOAAsAEQAQABcAEAAQACIAGQAaABQAHwAXAAkAHQAHAA4ADwAJAAsAFgAUABEAFgAsABgAEgAPABQAFAATABUADQAQACgAFAAfABIAFgAhAAsAGQARABMAEwAfABkAIAAUAA4AHQATABgAHwAjACkAKQAsACIAKgAkACUAIgAmAB4AHQAXABAAEQAcAB8AFQAZABkAGgAYABsAIQAYABoAGAAaABYAFgAcAB8AEQARAA8AFQAaABEALwAdABIAFwAaABAAGAAYABIAGwAQAA4AFAAaAA8AHwAdACIAIAANAAsAJwAlACkAJwAjACQAJQAqACUAFQAbABUAGQAtABUAHAAmAB4AFgASACgAFQAlACUAFwAZABkAFwAXACAAIAAgACAAHQAdACMAFAAUABYAFgAwAAsAKAAWABYAHAAYABEAEwAdAA0ADQALAAoAEQAKAAoAEgAKAA4ADgAXABUAEwAQABoAFQAYAB0AEAARABAAEwATABEAFgARAB0AGQAUABYAIQAWABQAEwAUACAAIwAjABYAHAAfABsAGgAhACUAIAAcABIAFQATABgAGAAjABkADwANABoAGgAIAAwAGgAkABgADwAoABkAIwAXAAwAEQAVABcALAAfACwAGgAMABQAFAASABoAGAAiACUAFAAWAAoACAAPAAgAGQANABUAFAAgACoAFQAOAA0ACwAJAAcACgALACYAEAAcABkAFQAHABAAEwAUAAoAGgATABEADQAfAA8AEgAXABMAGwAYAAwADwARAA4AFAAmAA0ACwAZABwACQANAA8AFQALAAkADgARABMACQASAAwADgAVACIAHQAVABQAEQARAAsAFQANACIAEAALABcAFwAjABMAHwAdABYAIgAYABwAFwARABEAFwA6AB8AGQAYABIAHgARAB0AEQAQABwAGQALABYAGgAfACQAIAAUABIAEQAZABYAEgATABkAFgAYABcAFwATABQAGgAXAA4AGQATAA8AEAAWABQAGQAhACUAIAAYABMAGAAOAAwACgASABQAEgANABEAIwAmABEAFQATABUADgAbABsAGAAUABYAFAAcAA4ADAAMABYAHQAbABcAGQAZACUAKAAWABIAFAAZAA8ADQANABAAEgAOABcAFgASABQAFAAWABwAJAAnABgAIgASABIAFQATAA8AEQAdACAAGQAaABwAFgAUABUAGwAbACwAIgAXAB8AJQAeABsAFgATABUAFAAIABUAGgANAA0ABwAVABQAEgAOABAAFwAfAB4AHAAYABoAIQAuABcAFgAUABAAEgAZABcAEgAQABsAEQAbABcADAAcABMAHwAkACYAHQApAB4AHgAdADEAMAAhABIADgAZABkAEQATABkAFwAQABYAEQAZAA8AHQAQABcAEAAYABwAEQAdABcAGAASABsAFAAWACAAIwAaABcAEQASABIAKgAWABEAEgAPABsAGQAbACEAEwALAB8AIQAbACQAHAAUACgAKgAgABcAEwAcABwAIAAXACYAFgAVABsAGQAeACAAKgApACYAIgAdABcAHQAXACMAFwATABUAIwAgABEAGQASABAAHQAlAB0AJwAjACMAJAASACEAKAAsABYAEwAgAA4AJwASACYAHQAcACAAHgAnABkAFAAwAAwAJQAjABIADAAYABkAGwAdACQAIgA5ABwAIgAlACAAIQAgABoAHwAmACIAJwAPABcAFwAiACAAFgAjACQAHgAtADcAJwApAC0AEAApAC0AKQAdABkAHwAdABoAJwAYACsAFwANABAAGwAfABUAGgAiABoAFwAPABwAJAAqACMAGQAPAB8AHAAiACoAGQANABQAFAAkABYAIAAdAB0AIAAVACAAFwATABAAIAAjABwAFgAjABMAIQAcABwAKAAvACwAHgAfACMAIwAsACYAKQAjAB4AJgAWABQAEQARABQAIgAVAB8AHwAQACsALAAlAC0AIQAsABEAGgAeACMAEwAYAB0AJgAtACgAIwAtADgAKQAsADAALAA1ABwAKQAkABcAJQAZABoAEgAiACkAGwAjACYAPQAYABYAFAAeAB0AGwAoACYAFgAfAB0AIwAgAB8AHQAlAB4AHAAWAB4AFwAVABsAFQAbAB4AIAAfABwAJgAeABcAEQAcABwAFQAUABEAGwAZACEAGwAcACUAHgAgABIAGgAhAB8ADgAKAAoADAAhAB0AMgAqACkAEwAnACMAMwAjAB0AJQAgAB8AJgAnAC0AOAAeACIAGQArABsAHgAcABgAGQAdAB8AIQAXAB8AGAAVAB4AIwAYACIAHgAlACAAGwAlACEACwAWACkAKAAWACMAEAAUAAsACgARAA8ACwAVABMAEwAYABoAHAAfAB0AIwAcADUAIgAZABgAFwAiACcAIAAWABQAIAAiABsAGwAaABsAEwAkABgAGQAWABUAGgAWABQAFwAgACYAHgAdAB8AIgAjAB8AJgAkACIAIAAoABYAGwAjABYAIAAkACYAHwAZABoAIAANABkAFwAXABEAGQARABgAEgAgABkAIQAnABwAGQAWAB4AIQAhABwAHgAVABwAJwAoACkAHwAjACAAKQAmABEAFAARABcAKAAjACIAIgAeACAAJwAnACEAGgAcACYAIgAiACgAKgArACcAGAAbABgAHgAcAB4AEwAXABIAEwAYABYADQAQAA8ADgAKAAwAFAAXAA4ADgAZABQAEQAYAAQABwAKAA4ADAALAA8AGwAZABoACwALAAkAFQATAAcAGQAiABAAEQANABQAFAAZABUABwAMABQABwAHABEAGgALABAACAALAA8AHQAHABkAEgAJABsAEQAOAAoAHAAXABEAEwAXABwAJQAiAA0AFgAWAAwAGAAVAB0AFgAfABcAEQAbACEAFAAVAB4AIAAQABMAEwAVABwAFAAMAB4AEAATABoAJQAOABQACQAYABgAGAAZABYABAAUABgA"};function tv(A){if(void 0!==w)return Uint8Array.from(w.from(A,"base64"));for(var e=atob(A),n=new Uint8Array(e.length),t=0;t>>1,o=A[a];if(ot))return a;r=a-1}}return -1}(a,E,S,n);if(!(I<0)){var d=tQ[o[I]],B=tP[s[I]],m=c[I],C=u[I];return{vr:d,vm:B,name:tT.slice(m,m+C)}}}}}function tU(A){if("string"==typeof A&&8===A.length){var e=parseInt(A.slice(0,4),16),n=parseInt(A.slice(4,8),16);if(Number.isFinite(e)&&Number.isFinite(n))for(var t=0;t=i.groupMin&&e<=i.groupMax&&n===i.elem)return{vr:i.vr,vm:i.vm,name:i.name}}}}function t_(A){return("0000"+A).slice(-4)}function tb(){for(var A=[],e=tN(),n=e.groups,t=e.groupStart,i=e.elems,r=e.vrCode,a=e.vmCode,o=e.nameOff,s=e.nameLen,c=0;c11&&-1!==A.indexOf('"')}function tV(A){return A.slice(1,5)+A.slice(6,10)}var tx=new Proxy(Object.create(null),{get:function(A,e){if("string"==typeof e){if(Object.prototype.hasOwnProperty.call(A,e))return A[e];if(tL.has(e))return tL.get(e);if(11===e.length&&"("===e[0]&&","===e[5]&&")"===e[10]){var n=tV(e),t=tF(n)||tU(n);if(!t)return;var i=L(L({tag:e},t),{},{version:"DICOM"});return tL.set(e,i),i}if(8===e.length){var r=tF(e);if(r||(r=tU(e)),!r)return;var a=L(L({tag:"("+e.slice(0,4)+","+e.slice(4,8)+")"},r),{},{version:"DICOM"});return tL.set(e,a),a}if(tq(e)){if(!tk)return;var o=tk.lookupPrivateTag(e);if(!o)return;var s=L(L({tag:e},o),{},{version:"PrivateTag"});return tL.set(e,s),s}}},has:function(A,e){if("string"!=typeof e)return!1;if(tL.has(e))return!0;if(11===e.length&&"("===e[0]&&","===e[5]&&")"===e[10]){var n=tV(e);return void 0!==tF(n)||void 0!==tU(n)}return 8===e.length?void 0!==tF(e)||void 0!==tU(e):!!tq(e)&&!!tk&&void 0!==tk.lookupPrivateTag(e)}}),tH={get:function(A,e){return"__isProxy"==e||(e in A?A[e]:A[0][e])},set:function(A,e,n){return"number"==typeof e||e in A?A[e]=n:A[0][e]=n,!0}},tY=function(A,e){if(A.__isProxy)return A;var n=e;if(void 0===n){if("object"!==x(A)||Array.isArray(A)&&1!==A.length)return A;n=Array.isArray(A)?A[0]:A}return Array.isArray(A)?(A.length=0,A.push(n),new Proxy(A,tH)):new Proxy([n],tH)},tJ=function(){function A(e){J(this,A),this.customDictionary=e,this.customNameMap=A._generateCustomNameMap(e)}return K(A,[{key:"denaturalizeDataset",value:function(e){return A.denaturalizeDataset(e,this.customNameMap)}}],[{key:"punctuateTag",value:function(A){if(-1!==A.indexOf(","))return A;if(8===A.length&&A===A.match(/[0-9a-fA-F]*/)[0]){var e=A.toUpperCase();return"("+e.substring(0,4)+","+e.substring(4,8)+")"}}},{key:"unpunctuateTag",value:function(A){return -1===A.indexOf(",")?A:A.substring(1,10).replace(",","")}},{key:"parseIntFromTag",value:function(e){return parseInt("0x"+A.unpunctuateTag(e))}},{key:"tagAsIntegerFromName",value:function(e){var n=A.nameMap[e];return void 0!=n?this.parseIntFromTag(n.tag):void 0}},{key:"cleanDataset",value:function(e){var n={};return Object.keys(e).forEach(function(t){var i=Object.assign({},e[t]);if("SQ"==i.vr){var r=[];Object.keys(i.Value).forEach(function(e){r.push(A.cleanDataset(i.Value[e]))}),i.Value=r}else i.Value=Object.keys(i.Value).map(function(A){var e=i.Value[A];return"String"==e.constructor.name?e.replace(/\0/,""):e});n[t]=i}),n}},{key:"namifyDataset",value:function(e){var n={};return Object.keys(e).forEach(function(t){var i=Object.assign({},e[t]);if("SQ"==i.vr){var r=[];Object.keys(i.Value).forEach(function(e){r.push(A.namifyDataset(i.Value[e]))}),i.Value=r}var a=A.punctuateTag(t),o=A.dictionary[a],s=t;o&&(s=o.name),n[s]=i}),n}},{key:"naturalizeDataset",value:function(e){var n=nj.addTagAccessors({_vrMap:{}});return Object.keys(e).forEach(function(t){var i=e[t],r=A.punctuateTag(t),a=A.dictionary[r],o=t;if(a&&(o=a.name,"ox"==a.vr&&(n._vrMap[o]=i.vr),i.vr!==a.vr&&(n._vrMap[o]=i.vr)),void 0===i.Value)n[o]=null,i.InlineBinary?n[o]={InlineBinary:i.InlineBinary}:i.BulkDataURI&&(n[o]={BulkDataURI:i.BulkDataURI});else{if("SQ"===i.vr){var s=[];Object.keys(i.Value).forEach(function(e){s.push(A.naturalizeDataset(i.Value[e]))}),n[o]=s}else n[o]=i.Value;if(1===n[o].length){var c=n[o][0];c&&"object"===x(c)&&!c.length?n[o]=tY(n[o],c):n[o]=c}}}),n}},{key:"denaturalizeValue",value:function(A){var e=A;if(Array.isArray(e)){if(A.some(function(A){return void 0===A}))throw Error("There are undefined values at the array naturalValue in DicomMetaDictionary.denaturalizeValue")}else e=[e];return e.map(function(A){return"Number"==A.constructor.name?String(A):A})}},{key:"denaturalizeDataset",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:A.nameMap,t={};return Object.keys(e).forEach(function(i){var r=n[i];if(r){var a=e[i];if(void 0===a)return;var o=e._vrMap&&e._vrMap[i]?e._vrMap[i]:r.vr,s=nj.addTagAccessors({vr:o});if(s.Value=e[i],null!==a){"ox"==r.vr&&(e._vrMap&&e._vrMap[i]?s.vr=e._vrMap[i]:v.error("No value representation given for",i));var c=nj.createByTypeString(s.vr);if(s.Value=A.denaturalizeValue(s.Value),"SQ"==r.vr){for(var u=[],l=0;le)?(v.warn("Truncating value ".concat(A," of ").concat(i," because it is longer than ").concat(e)),A.slice(0,e)):A}))}t[A.unpunctuateTag(r.tag)]=s}else -1==["_vrMap","_meta"].indexOf(i)&&v.warn("Unknown name in dataset",i,":",e[i])}),t}},{key:"uid",value:function(){for(var A="2.25."+Math.floor(1+9*Math.random()),e=0;e<38;e++)A+=Math.floor(10*Math.random());return A}},{key:"date",value:function(){return new Date().toISOString().replace(/-/g,"").slice(0,8)}},{key:"time",value:function(){return new Date().toISOString().replace(/:/g,"").slice(11,17)}},{key:"dateTime",value:function(){return new Date().toISOString().replace(/[:\-TZ]/g,"")}},{key:"_generateNameMap",value:function(){A.nameMap={};for(var e=tb(),n=0;n>>16}},{key:"element",value:function(){return 65535&this.value}},{key:"isPixelDataTag",value:function(){return this.is(0x7fe00010)}},{key:"isPrivateCreator",value:function(){var A=this.group(),e=this.element();return A%2==1&&e<256&&e>0}},{key:"isMetaInformation",value:function(){return 8>this.group()}},{key:"isPrivateValue",value:function(){var A=this.group(),e=this.element();return A%2==1&&e>256}},{key:"write",value:function(A,e,n,t,i){var r=nj.createByTypeString(e),a=I._normalizeSyntax(t),o=a===nT,s=a===nT||a===ny,c=this.isPixelDataTag()&&I.isEncapsulated(t),u=A.isLittleEndian;A.setEndian(s),A.writeUint16(this.group()),A.writeUint16(this.element());var l,E=new nP(256);E.setEndian(s),l="OW"==e||"OB"==e||"UN"==e?r.writeBytes(E,n,a,c,i):"SQ"==e?r.writeBytes(E,n,a,i):r.writeBytes(E,n,i),"SQ"==e&&(l=0xffffffff);var S=E.size+4;if(o)A.writeUint32(l),S+=4;else{var g=!r.isLength32()&&l>=65536&&0xffffffff!==l;r.isLength32()||g?(A.writeAsciiString(g?"UN":r.type),A.writeUint16(0),A.writeUint32(l),S+=8):(A.writeAsciiString(r.type),A.writeUint16(l),S+=4)}return A.concat(E),A.setEndian(u),S}}],[{key:"setDicomMessageClass",value:function(A){I=A}},{key:"fromString",value:function(e){var n=parseInt(e.substring(0,4),16),t=parseInt(e.substring(4),16);return A.fromNumbers(n,t)}},{key:"fromPString",value:function(e){var n=parseInt(e.substring(1,5),16),t=parseInt(e.substring(6,10),16);return A.fromNumbers(n,t)}},{key:"fromNumbers",value:function(e,n){return new A((e<<16|n)>>>0)}},{key:"readTag",value:function(e){var n=e.readUint16(),t=e.readUint16();return A.fromNumbers(n,t)}},{key:"getNextSequenceItemData",value:function(A){var e=this.readTag(A);if(e.is(0xfffee000)){var n=A.readUint32(),t=A.getBuffer(A.offset,A.offset+n);return A.increment(n),t}if(e.is(0xfffee0dd)){if(0!==A.readUint32())throw Error("SequenceDelimiterItem tag value was not zero");return null}throw Error("Invalid tag in sequence")}}])}();nj.setTagClass(tK);var tX=["SQ","OF","OW","OB","UN","LT"],tj=function(){function A(){J(this,A)}return K(A,null,[{key:"read",value:function(A,e,n){var t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return v.warn("DicomMessage.read to be deprecated after dcmjs 0.24.x"),this._read(A,e,{ignoreErrors:n,untilTag:t,includeUntilTagValue:i})}},{key:"readTag",value:function(A,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,t=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return v.warn("DicomMessage.readTag to be deprecated after dcmjs 0.24.x"),this._readTag(A,e,{untilTag:n,includeUntilTagValue:t})}},{key:"_read",value:function(e,n){var t,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{ignoreErrors:!1,untilTag:null,includeUntilTagValue:!1,stopOnGreaterTag:!1},r=i.ignoreErrors,a=i.untilTag,o=i.stopOnGreaterTag,s={};try{for(;!e.end();){t=e.offset;var c=A._readTag(e,n,i),u=c.tag.toCleanString();if(a&&o&&u>a){e.offset=t;break}if(u===nU.SpecificCharacterSet){if(c.values.length>0){var l=c.values[0];if((l=l.replace(/[_ ]/g,"-").toLowerCase())in n_)l=n_[l],e.setDecoder(new TextDecoder(l));else if(r)v.warn("Unsupported character set: ".concat(l,", using default character set"));else throw Error("Unsupported character set: ".concat(l))}if(c.values.length>1)if(r)v.warn("Using multiple character sets is not supported, proceeding with just the first character set",c.values);else throw Error("Using multiple character sets is not supported: ".concat(c.values));c.values=["ISO_IR 192"]}if(s[u]=nj.addTagAccessors({vr:c.vr.type}),s[u].Value=c.values,s[u]._rawValue=c.rawValues,a&&a===u)break}return s}catch(A){if(r)return v.warn("WARN:",A),s;throw A}}},{key:"_normalizeSyntax",value:function(A){return A==nT||A==ny||A==nO?A:ny}},{key:"isEncapsulated",value:function(A){return!nN[A]}},{key:"readFile",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ignoreErrors:!1,untilTag:null,includeUntilTagValue:!1,noCopy:!1,forceStoreRaw:!1},t=new nR(e,null,{noCopy:n.noCopy});if(t.reset(),t.increment(128),"DICM"!==t.readAsciiString(4))throw Error("Invalid DICOM file, expected header is missing");var i=t.offset,r=A._readTag(t,ny),a={};if(r.tag.cleanString!==nU.FileMetaInformationGroupLength){if(!n.ignoreErrors)throw Error("Invalid DICOM file, meta length tag is malformed or not present.");t.offset=i,a=A._read(t,ny,{untilTag:"00030000",stopOnGreaterTag:!0,ignoreErrors:!0})}else{var o=r.values[0],s=t.more(o);a=A._read(s,ny,n)}var c=a[nU.TransferSyntaxUID].Value[0];c===nv&&(t=new nQ(t,{noCopy:n.noCopy})),c=A._normalizeSyntax(c);var u=A._read(t,c,n),l=new tR(a);return l.dict=u,l}},{key:"writeTagObject",value:function(A,e,n,t,i,r){tK.fromString(e).write(A,n,t,i,r)}},{key:"write",value:function(e,n,t,i){var r=0;return Object.keys(e).sort().forEach(function(a){var o=tK.fromString(a),s=e[a],c=s.vr,u=A._getTagWriteValues(c,s);r+=o.write(n,c,u,t,i)}),r}},{key:"_getTagWriteValues",value:function(A,e){if(!e._rawValue)return e.Value;var n,t=nj.createByTypeString(A);return(n=Array.isArray(e._rawValue)?e._rawValue.map(function(A){return t.applyFormatting(A)}):t.applyFormatting(e._rawValue),function A(e,n){if(Object.is(e,n))return!0;if("object"!==x(e)||"object"!==x(n)||null===e||null===n)return!1;var t=Object.keys(e),i=Object.keys(n);if(t.length!==i.length)return!1;for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:{untilTag:null,includeUntilTagValue:!1},i=t.untilTag,r=t.includeUntilTagValue,a=n==nT,o=n==nT||n==ny,s=e.isLittleEndian;e.setEndian(o);var c=tK.readTag(e);if(i===c.toCleanString()&&null!==i&&!r)return{tag:c,vr:0,values:0};var u,l=null,E=null;if(a){l=e.readUint32();var S=A.lookupTag(c);u=S?S.vr:0xffffffff==l?"SQ":c.isPixelDataTag()?"OW":"xs"==u?"US":c.isPrivateCreator()?"LO":"UN",E=nj.createByTypeString(u)}else"UN"===(u=e.readVR())&&A.lookupTag(c)&&A.lookupTag(c).vr?(u=A.lookupTag(c).vr,E=nj.parseUnknownVr(u)):E=nj.createByTypeString(u),E.isLength32()?(e.increment(2),l=e.readUint32()):l=e.readUint16();var g=[],I=[];if(E.isBinary()&&l>E.maxLength&&!E.noMultiple)for(var d=l/E.maxLength,B=0;B++>>1,l=n[u],E=t[u],S=t$.slice(l,l+E);if(AS)s=u+1;else{var g=tz[i[u]],I=tZ[r[u]],d=a[u],B=o[u];return{vr:g,vm:I,name:t0.slice(d,d+B)}}}},nameBlob:t0,vmTable:tZ,vrTable:tz}),t3=function(){function A(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};J(this,A),this.rootURL=e.rootURL,this.progressCallback=e.progressCallback}return K(A,[{key:"request",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments.length>2?arguments[2]:void 0,i=A.responseType(e),r=A.endpointService(e),a=this.rootURL+"/"+r+e,o=!0;return Object.keys(n).forEach(function(A){o?(a+="?",o=!1):a+="&",a+=A+"="+encodeURIComponent(n[A])}),new Promise((function(A,e){var n=new XMLHttpRequest;n.open("GET",a),n.responseType=i,n.onload=function(){A(n.response)},n.onprogress=this.progressCallback,n.onerror=function(A){v.error(n.response),e(A)},n.send(t)}).bind(this))}},{key:"patients",value:function(){return this.request("patients")}},{key:"studies",value:function(A){return this.request("studies",{PatientID:A})}},{key:"series",value:function(A){return this.request("series",{StudyInstanceUID:A})}},{key:"instances",value:function(A,e){return this.request("instances",{StudyInstanceUID:A,SeriesInstanceUID:e})}},{key:"instance",value:function(A,e,n){return this.request("wado",{requestType:"WADO",studyUID:A,seriesUID:e,objectUID:n,contentType:"application/dicom"})}},{key:"tests",value:function(){new A({rootURL:"http://quantome.org:4242/dcm4chee-arc/aets/DCM4CHEE"}).patients().then(function(A){A.forEach(function(A){v.info(A)})})}}],[{key:"responseType",value:function(A){var e={wado:"arraybuffer"};return e[A]?e[A]:"json"}},{key:"endpointService",value:function(A){var e={wado:""};return -1!=Object.keys(e).indexOf(A)?e[A]:"rs/"}},{key:"randomEntry",value:function(A){return A[Math.floor(Math.random()*A.length)]}}])}(),t5=function(){function A(){J(this,A)}return K(A,null,[{key:"d65WhitePointXYZ",value:function(){return[.950456,1,1.088754]}},{key:"dicomlab2RGB",value:function(e){return A.lab2RGB(A.dicomlab2LAB(e))}},{key:"rgb2DICOMLAB",value:function(e){return A.lab2DICOMLAB(A.rgb2LAB(e))}},{key:"dicomlab2LAB",value:function(A){return[100*A[0]/65535,255*A[1]/65535-128,255*A[2]/65535-128]}},{key:"lab2DICOMLAB",value:function(A){return[65535*A[0]/100,(A[1]+128)*65535/255,(A[2]+128)*65535/255]}},{key:"rgb2LAB",value:function(e){return A.xyz2LAB(A.rgb2XYZ(e))}},{key:"gammaCorrection",value:function(A){return A<=.0031306684425005883?12.92*A:1.055*Math.pow(A,1/2.4)-.055}},{key:"invGammaCorrection",value:function(A){return A<=.0404482362771076?A/12.92:Math.pow((A+.055)/1.055,2.4)}},{key:"rgb2XYZ",value:function(e){var n=A.invGammaCorrection(e[0]),t=A.invGammaCorrection(e[1]),i=A.invGammaCorrection(e[2]);return[.41239558896741424*n+.3575834307637148*t+.18049264738170157*i,.21258623078559555*n+.7151703037034108*t+.07220049864333623*i,.019297215491746945*n+.11918386458084854*t+.9504971251315798*i]}},{key:"xyz2LAB",value:function(e){var n=A.d65WhitePointXYZ(),t=e[0]/n[0],i=e[1]/n[1],r=e[2]/n[2];return t=A.labf(t),[116*(i=A.labf(i))-16,500*(t-i),200*(i-(r=A.labf(r)))]}},{key:"lab2RGB",value:function(e){return A.xyz2RGB(A.lab2XYZ(e))}},{key:"lab2XYZ",value:function(e){var n=(e[0]+16)/116,t=n+e[1]/500,i=n-e[2]/200,r=A.d65WhitePointXYZ();return[r[0]*A.labfInv(t),r[1]*A.labfInv(n),r[2]*A.labfInv(i)]}},{key:"xyz2RGB",value:function(e){var n=3.2406*e[0]-1.5372*e[1]-.4986*e[2],t=-.9689*e[0]+1.8758*e[1]+.0415*e[2],i=.0557*e[0]-.204*e[1]+1.057*e[2],r=Math.min(n,t);return(r=Math.min(r,i))<0&&(n-=r,t-=r,i-=r),[A.gammaCorrection(n),A.gammaCorrection(t),A.gammaCorrection(i)]}},{key:"labf",value:function(A){return A>=.008856451679035631?Math.pow(A,.333333333333333):841/108*A+4/29}},{key:"labfInv",value:function(A){return A>=.20689655172413793?A*A*A:108/841*(A-4/29)}}])}();function t6(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:nk,e={information:null,_init:function(A){e.information=(null==A?void 0:A.information)||{},this.information=e.information},addTag:function(e,n,t){var i;if((null==(i=this.current)?void 0:i.level)===0&&A.has(n)){var r=nb[n]||n;this.information[r]=null;var a=e(n,t);return this.current._trackInformation=r,a}return e(n,t)},value:function(A,e){var n;if(null!=(n=this.current)&&n._trackInformation){var t=this.current._trackInformation;this.information[t]=e,this.current._trackInformation=null}return A(e)}};return e}var t7=K(function A(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length,t=Array(n>1?n-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:void 0;this.current=null,this.fmi=null,this.dict=null,this.information=null;var n,t=Ar(this.filters);try{for(t.s();!(n=t.n()).done;)null==(A=n.value._init)||A.call(this,e)}catch(A){t.e(A)}finally{t.f()}}},{key:"_createMethodChains",value:function(){for(var A=this,e=0,n=["addTag","startObject","pop","value"];e=0;r--)!function(){var e=A.filters[r];if(e&&"function"==typeof e[t]){var n=e[t],a=i;i=function(){for(var e=arguments.length,t=Array(e),i=0;i0&&void 0!==arguments[0]?arguments[0]:{},n=this.current?(null!=(A=this.current.level)?A:0)+1:0;this.current&&this.value(e),this.current={parent:this.current,dest:e,type:"object",level:n}}},{key:"_basePop",value:function(){var A,e,n,t,i=null!=(A=null==(e=(n=this.current).pop)?void 0:e.call(n))?A:this.current.dest;return i.InlineBinary&&console.log("********* InlineBinary already set",i,this.current),null===i.Value?i.Value=[]:(null==(t=i.Value)?void 0:t.length)===1&&(null===i.Value[0]||void 0===i.Value[0])&&(i.Value=[]),this.current=this.current.parent,i}},{key:"_baseValue",value:function(A){var e;if(Array.isArray(this.current.dest))return void this.current.dest.push(A);(e=this.current.dest).Value||(e.Value=[]),this.current.dest.Value.push(A)}},{key:"getTransferSyntaxUID",value:function(){if(this.fmi){var A,e="00020010";if(null!=(A=this.fmi[e])&&A.Value&&Array.isArray(this.fmi[e].Value)&&this.fmi[e].Value.length>0)return this.fmi[e].Value[0]}}}]),iA=v.getLogger("AsyncDicomReader"),ie=function(){var A,e,n,t,i,r,a,o,s,c,u,l,E;function S(){var A,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};J(this,S),X(this,"syntax",ny),this.isLittleEndian=null==e?void 0:e.isLittleEndian,this.maxFragmentSize=null!=(A=null==e?void 0:e.maxFragmentSize)?A:0x8000000,this.stream=new nR(null,this.isLittleEndian,L({clearBuffers:!0},e))}return K(S,[{key:"readPreamble",value:(A=Y(q().mark(function A(){var e,n;return q().wrap(function(A){for(;;)switch(A.prev=A.next){case 0:return e=this.stream,A.next=1,e.ensureAvailable();case 1:if(e.reset(),e.increment(128),"DICM"===e.readAsciiString(4)){A.next=5;break}return e.reset(),A.next=2,e.ensureAvailable(4);case 2:if(e.setEndian(!0),n=e.readUint16(),e.readUint16(),e.reset(),2!==n){A.next=3;break}return A.abrupt("return",S.PART10_NO_PREAMBLE);case 3:return A.next=4,this.detectRawEncoding();case 4:return A.abrupt("return",!1);case 5:return A.abrupt("return",!0);case 6:case"end":return A.stop()}},A,this)})),function(){return A.apply(this,arguments)})},{key:"detectRawEncoding",value:(e=Y(q().mark(function A(){var e,n,t,i,r,a,o;return q().wrap(function(A){for(;;)switch(A.prev=A.next){case 0:return e=this.stream,A.next=1,e.ensureAvailable(8);case 1:if(e.reset(),e.setEndian(!0),n=e.readUint16(),e.readUint16(),2!==n){A.next=2;break}throw Error("Invalid DICOM file: stream starts with meta (0002,xxxx) but was not handled as Part 10");case 2:return t=e.peekUint8(0),i=e.peekUint8(1),A.next=3,e.ensureAvailable(8);case 3:if(r=e.view.getUint32(e.offset,!0),!((a=function(A){return A>=65&&A<=90||A>=97&&A<=122})(t)&&a(i))){A.next=7;break}if(o=String.fromCharCode(t,i).toUpperCase(),!nL.has(o)){A.next=4;break}this.syntax=ny,A.next=6;break;case 4:if(r%2==0){A.next=5;break}throw Error("Invalid DICOM file: detected LEI encoding but length is odd (".concat(r,"), which is not allowed in DICOM"));case 5:this.syntax=nT;case 6:A.next=9;break;case 7:if(r%2==0){A.next=8;break}throw Error("Invalid DICOM file: detected LEI encoding but length is odd (".concat(r,"), which is not allowed in DICOM"));case 8:this.syntax=nT;case 9:e.reset();case 10:case"end":return A.stop()}},A,this)})),function(){return e.apply(this,arguments)})},{key:"readFile",value:(n=Y(q().mark(function A(){var e,n,t,i,r,a,o,s,c,u=arguments;return q().wrap(function(A){for(;;)switch(A.prev=A.next){case 0:return e=u.length>0&&void 0!==u[0]?u[0]:void 0,A.next=1,this.readPreamble();case 1:if((n=A.sent)!==S.PART10_NO_PREAMBLE){A.next=4;break}return A.next=2,this.readMeta(L(L({},e),{},{ignoreErrors:!0}));case 2:return this.meta=A.sent,(t=(null==e?void 0:e.listener)||new t7).information&&((r=t.information).transferSyntaxUid=this.syntax,r.sopInstanceUid=null==(i=this.meta)||null==(i=i[nU.MediaStoreSOPInstanceUID])?void 0:i.Value[0]),this.dict||(this.dict={}),t.startObject(this.dict),A.next=3,this.read(t,e);case 3:case 5:case 8:return this.dict=A.sent,A.abrupt("return",this);case 4:if(n){A.next=6;break}return this.meta={},(a=(null==e?void 0:e.listener)||new t7).information&&(a.information.transferSyntaxUid=this.syntax),this.dict||(this.dict={}),a.startObject(this.dict),A.next=5,this.read(a,e);case 6:return A.next=7,this.readMeta(e);case 7:return this.meta=A.sent,(o=(null==e?void 0:e.listener)||new t7).information&&((c=o.information).transferSyntaxUid=this.syntax,c.sopInstanceUid=null==(s=this.meta)||null==(s=s[nU.MediaStoreSOPInstanceUID])?void 0:s.Value[0]),this.dict||(this.dict={}),o.startObject(this.dict),A.next=8,this.read(o,e);case 9:case"end":return A.stop()}},A,this)})),function(){return n.apply(this,arguments)})},{key:"readMeta",value:(t=Y(q().mark(function A(){var e,n,t,i,r,a,o=arguments;return q().wrap(function(A){for(;;)switch(A.prev=A.next){case 0:return e=o.length>0&&void 0!==o[0]?o[0]:void 0,n=this.stream,A.next=1,n.ensureAvailable();case 1:if(t=n.offset,(i=this.readTagHeader()).tag===nU.FileMetaInformationGroupLength){A.next=4;break}if(null!=e&&e.ignoreErrors){A.next=2;break}throw Error("Invalid DICOM file, meta length tag is malformed or not present.");case 2:return n.offset=t,A.next=3,n.ensureAvailable((null==e?void 0:e.maxSizeMeta)||10240);case 3:this.meta=tj._read(n,ny,{untilTag:"00030000",stopOnGreaterTag:!0,ignoreErrors:!0}),A.next=6;break;case 4:return r=i.vrObj.readBytes(n),A.next=5,n.ensureAvailable(r);case 5:a=n.more(r),this.meta=tj._read(a,ny,{});case 6:return this.syntax=this.meta[nU.TransferSyntaxUID].Value[0],A.abrupt("return",this.meta);case 7:case"end":return A.stop()}},A,this)})),function(){return t.apply(this,arguments)})},{key:"read",value:(i=Y(q().mark(function A(e,n){var t,i,r,a,o,s,c;return q().wrap(function(A){for(;;)switch(A.prev=A.next){case 0:return t=(null==n?void 0:n.untilOffset)||Number.MAX_SAFE_INTEGER,this.listener=e,i=this.stream,A.next=1,i.ensureAvailable();case 1:if(!(i.offset0)){A.next=12;break}return A.next=11,this.readRawBinary(r);case 12:return A.next=13,this.readSingle(r,e,n);case 13:return e.pop(),A.next=14,this.stream.ensureAvailable();case 14:A.next=1;break;case 15:return A.abrupt("return",e.pop());case 16:case"end":return A.stop()}},A,this)})),function(A,e){return i.apply(this,arguments)})},{key:"readSequence",value:(r=Y(q().mark(function A(e,n,t){var i,r,a,o,s,c,u,l,E;return q().wrap(function(A){for(;;)switch(A.prev=A.next){case 0:i=n.length,r=this.stream,a=this.syntax,o=-1===i?Number.MAX_SAFE_INTEGER:r.offset+i;case 1:if(!(E=r.offset=parseInt(o),A.next=2,this.readOffsets();case 2:c=A.sent,(a||s)&&!c&&(c=[0]),c&&c.push(Number.MAX_SAFE_INTEGER/2),u=t.offset,l=0,E=null;case 3:return iA.debug("readCompressed frame loop",l),t.consume(),A.next=4,t.ensureAvailable();case 4:if((S=this.readTagHeader()).tag!==nU.SequenceDelimitationEnd){A.next=5;break}return E&&i.pop(),A.abrupt("return");case 5:if(S.tag===nU.Item){A.next=6;break}throw Error("frame tag isn't item: ".concat(S.tag));case 6:return g=S.length,E||(E=[],i.startObject(E)),A.next=7,this._emitSplitValues(g);case 7:(!c||t.offset>=c[l+1]+u)&&(E=null,i.pop(),l++),A.next=3;break;case 8:case"end":return A.stop()}},A,this)})),function(A){return o.apply(this,arguments)})},{key:"readOffsets",value:(s=Y(q().mark(function A(){var e,n,t,i;return q().wrap(function(A){for(;;)switch(A.prev=A.next){case 0:if((e=this.readTagHeader()).tag===nU.Item){A.next=1;break}throw Error("Offsets tag is missing: ".concat(e.tag));case 1:if(0!==e.length){A.next=2;break}return A.abrupt("return");case 2:return n=[],t=e.length/4,A.next=3,this.stream.ensureAvailable(e.length);case 3:for(i=0;i1)){A.next=4;break}if(l=null==(o=i.information)?void 0:o.rows,E=null==(s=i.information)?void 0:s.columns,S=null==(c=i.information)?void 0:c.samplesPerPixel,g=null==(u=i.information)?void 0:u.bitsAllocated,l*E*S*g%8==0){A.next=3;break}if(1!==g){A.next=2;break}return A.next=1,this.readUncompressedBitFrame(e);case 1:return A.abrupt("return",A.sent);case 2:throw Error("Odd frame length must be single bit: ".concat(l,",").concat(E," ").concat(S," ").concat(g));case 3:if(t%r==0){A.next=4;break}throw Error("Invalid frame length: ".concat(t," for ").concat(r," frames"));case 4:I=0;case 5:if(!(I>7-Q&1&&(h[P]|=1<<7-T);s.value(f),s.pop()}case 5:case"end":return A.stop()}},A,this)})),function(A){return u.apply(this,arguments)})},{key:"readRawBinary",value:(l=Y(q().mark(function A(e){var n;return q().wrap(function(A){for(;;)switch(A.prev=A.next){case 0:return n=e.length,A.next=1,this._emitSplitValues(n);case 1:case"end":return A.stop()}},A,this)})),function(A){return l.apply(this,arguments)})},{key:"isSequence",value:function(A){var e=A.vr,n=A.length;return"SQ"===e||"UN"===e&&-1===n}},{key:"readTagHeader",value:function(){var A,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{untilTag:null,includeUntilTagValue:!1},n=this.stream,t=this.syntax,i=e.untilTag,r=e.includeUntilTagValue,a=t==nT,o=t!==nO;n.setEndian(o);var s=tK.readTag(n),c=s.cleanString;if(i&&i===c&&!r)return{tag:c,tagObj:s,vr:0,values:0,isUntilTag:!0};var u=null,l=null,E=0===s.group();if(s.isInstruction())u=n.readUint32(),l=nj.createByTypeString("UN");else if(a&&!E){u=n.readUint32();var S,g,I=tj.lookupTag(s);S=I?I.vr:0xffffffff==u?"SQ":s.isPixelDataTag()?"OW":"xs"==S?(null==(g=this.listener.information)?void 0:g.pixelRepresentation)===0?"SS":"US":s.isPrivateCreator()?"LO":"UN",l=nj.createByTypeString(S)}else"UN"===(S=n.readVR())&&null!=(A=tj.lookupTag(s))&&A.vr?(S=tj.lookupTag(s).vr,l=nj.parseUnknownVr(S)):l=nj.createByTypeString(S),l.isLength32()?(n.increment(2),u=n.readUint32()):u=n.readUint16();var d=tJ.punctuateTag(c),B=tJ.dictionary[d];return{vrObj:l,vr:l.type,tag:c,tagObj:s,vm:null==B?void 0:B.vm,name:null==B?void 0:B.name,length:0xffffffff===u?-1:u}}},{key:"readSingle",value:(E=Y(q().mark(function A(e,n,t){var i,r,a,o,s,c,u,l,E,S,g;return q().wrap(function(A){for(;;)switch(A.prev=A.next){case 0:return i=e.length,r=this.stream,a=this.syntax,A.next=1,this.stream.ensureAvailable(i);case 1:if(o=nj.createByTypeString(e.vr),s=[],o.isBinary()&&i>o.maxLength&&!o.noMultiple)for(c=i/o.maxLength,u=0;u++0)){A.next=4;break}if(!((g=(g=Ae(s,1)[0]).replace(/[_ ]/g,"-").toLowerCase())in n_)){A.next=2;break}g=n_[g],this.stream.setDecoder(new TextDecoder(g)),A.next=4;break;case 2:if(!(null!=t&&t.ignoreErrors)){A.next=3;break}v.warn("Unsupported character set: ".concat(g,", using default character set")),A.next=4;break;case 3:throw Error("Unsupported character set: ".concat(g));case 4:s=["ISO_IR 192"];case 5:return(Array.isArray(s)?s:[s]).forEach(function(A){return n.value(A)}),A.abrupt("return",s);case 6:case"end":return A.stop()}},A,this)})),function(A,e,n){return E.apply(this,arguments)})}])}();function it(A){var e=new Uint8Array(2);e[1]=1;var n=A._meta.TransferSyntaxUID&&A._meta.TransferSyntaxUID.Value&&A._meta.TransferSyntaxUID.Value[0]?A._meta.TransferSyntaxUID.Value[0]:"1.2.840.10008.1.2.1";A._meta={MediaStorageSOPClassUID:A.SOPClassUID,MediaStorageSOPInstanceUID:A.SOPInstanceUID,ImplementationVersionName:"dcmjs-0.0",TransferSyntaxUID:n,ImplementationClassUID:"2.25.80302813137786398554742050926734630921603366648225212145404",FileMetaInformationVersion:e.buffer};var t=new tR(tJ.denaturalizeDataset(A._meta));return t.dict=tJ.denaturalizeDataset(A),t}function ii(A){return w.from(it(A).write())}function ir(A){return new Blob([ii(A)],{type:"application/dicom"})}X(ie,"PART10_NO_PREAMBLE",Symbol("PART10_NO_PREAMBLE"));var ia=K(function A(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};J(this,A),this.options=JSON.parse(JSON.stringify(n));var t=this.options;t.Manufacturer=n.Manufacturer||"Unspecified",t.ManufacturerModelName=n.ManufacturerModelName||"Unspecified",t.SeriesDescription=n.SeriesDescription||"Research Derived series",t.SeriesNumber=n.SeriesNumber||"99",t.SoftwareVersions=n.SoftwareVersions||"0",t.DeviceSerialNumber=n.DeviceSerialNumber||"1";var i=tJ.date(),r=tJ.time();t.SeriesDate=n.SeriesDate||i,t.SeriesTime=n.SeriesTime||r,t.ContentDate=n.ContentDate||i,t.ContentTime=n.ContentTime||r,t.SOPInstanceUID=n.SOPInstanceUID||tJ.uid(),t.SeriesInstanceUID=n.SeriesInstanceUID||tJ.uid(),t.ClinicalTrialTimePointID=n.ClinicalTrialTimePointID||"",t.ClinicalTrialCoordinatingCenterName=n.ClinicalTrialCoordinatingCenterName||"",t.ClinicalTrialSeriesID=n.ClinicalTrialSeriesID||"",t.ImageComments=n.ImageComments||"NOT FOR CLINICAL USE",t.ContentQualification="RESEARCH",this.referencedDatasets=e,this.referencedDataset=this.referencedDatasets[0],this.dataset={_vrMap:this.referencedDataset._vrMap,_meta:this.referencedDataset._meta},this.derive()},[{key:"assignToDataset",value:function(A){var e=this;Object.keys(A).forEach(function(n){return e.dataset[n]=A[n]})}},{key:"assignFromReference",value:function(A){var e=this;A.forEach(function(A){return e.dataset[A]=e.referencedDataset[A]||""})}},{key:"assignFromOptions",value:function(A){var e=this;A.forEach(function(A){return e.dataset[A]=e.options[A]||""})}},{key:"derive",value:function(){this.assignFromReference(["AccessionNumber","ReferringPhysicianName","StudyDate","StudyID","StudyTime","PatientName","PatientID","PatientBirthDate","PatientSex","PatientAge","StudyInstanceUID","StudyID"]),this.assignFromOptions(["Manufacturer","SoftwareVersions","DeviceSerialNumber","ManufacturerModelName","SeriesDescription","SeriesNumber","ImageComments","SeriesDate","SeriesTime","ContentDate","ContentTime","ContentQualification","SOPInstanceUID","SeriesInstanceUID"])}}],[{key:"copyDataset",value:function(A){return JSON.parse(JSON.stringify(A))}}]),io=function(A){function e(A){var n,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};J(this,e);var i=(n=U(this,e,[A,t])).options;return i.ContentLabel=t.ContentLabel||"",i.ContentDescription=t.ContentDescription||"",i.ContentCreatorName=t.ContentCreatorName||"",n}return j(e,A),K(e,[{key:"derive",value:function(){AA(z(e.prototype),"derive",this).call(this),this.assignToDataset({ImageType:["DERIVED","PRIMARY"],LossyImageCompression:"00",InstanceNumber:"1"}),this.assignFromReference(["SOPClassUID","Modality","FrameOfReferenceUID","PositionReferenceIndicator","NumberOfFrames","Rows","Columns","SamplesPerPixel","PhotometricInterpretation","BitsStored","HighBit"]),this.assignFromOptions(["ContentLabel","ContentDescription","ContentCreatorName"]),this.referencedDataset.SharedFunctionalGroupsSequence&&(this.dataset.SharedFunctionalGroupsSequence=ia.copyDataset(this.referencedDataset.SharedFunctionalGroupsSequence)),this.referencedDataset.PerFrameFunctionalGroupsSequence&&(this.dataset.PerFrameFunctionalGroupsSequence=ia.copyDataset(this.referencedDataset.PerFrameFunctionalGroupsSequence)),this.dataset.PixelData=new ArrayBuffer(this.referencedDataset.PixelData.byteLength)}}])}(ia),is=function(A){function e(A){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return J(this,e),U(this,e,[A,n])}return j(e,A),K(e,[{key:"derive",value:function(){AA(z(e.prototype),"derive",this).call(this),this.assignFromReference(["WindowCenter","WindowWidth","BitsAllocated","PixelRepresentation","BodyPartExamined","Laterality","PatientPosition","RescaleSlope","RescaleIntercept","PixelPresentation","VolumetricProperties","VolumeBasedCalculationTechnique","PresentationLUTShape"])}}])}(io),ic=function(A){function e(A){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{includeSliceSpacing:!0};return J(this,e),U(this,e,[A,n])}return j(e,A),K(e,[{key:"derive",value:function(){AA(z(e.prototype),"derive",this).call(this),this.assignToDataset({SOPClassUID:tJ.sopClassUIDsByName.Segmentation,Modality:"SEG",SamplesPerPixel:"1",PhotometricInterpretation:"MONOCHROME2",BitsAllocated:"1",BitsStored:"1",HighBit:"0",PixelRepresentation:"0",LossyImageCompression:"00",SegmentationType:"BINARY",ContentLabel:"SEGMENTATION"});var A=tJ.uid();if(this.dataset.DimensionOrganizationSequence={DimensionOrganizationUID:A},this.dataset.DimensionIndexSequence=[{DimensionOrganizationUID:A,DimensionIndexPointer:6422539,FunctionalGroupPointer:6422538,DimensionDescriptionLabel:"ReferencedSegmentNumber"},{DimensionOrganizationUID:A,DimensionIndexPointer:2097202,FunctionalGroupPointer:2134291,DimensionDescriptionLabel:"ImagePositionPatient"}],this.dataset.SegmentSequence=[],this.referencedDataset.ReferencedSeriesSequence)this.dataset.ReferencedSeriesSequence=ia.copyDataset(this.referencedDataset.ReferencedSeriesSequence);else{for(var n=[],t=0;t1&&void 0!==arguments[1]?arguments[1]:{};return J(this,e),U(this,e,[A,n])}return j(e,A),K(e,[{key:"derive",value:function(){AA(z(e.prototype),"derive",this).call(this),this.assignToDataset({}),this.assignFromReference([])}}])}(ia),il=function(A){function e(A){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return J(this,e),U(this,e,[A,n])}return j(e,A),K(e,[{key:"derive",value:function(){AA(z(e.prototype),"derive",this).call(this),this.assignToDataset({SOPClassUID:tJ.sopClassUIDsByName.EnhancedSR,Modality:"SR",ValueType:"CONTAINER"}),this.assignFromReference([])}}])}(ia),iE=function(){function A(e){J(this,A),this.datasets=e,this.dataset=void 0}return K(A,[{key:"normalize",value:function(){return"No normalization defined"}}],[{key:"consistentSOPClassUIDs",value:function(A){var e;return A.forEach(function(A){if(A.SOPClassUID&&(e||(e=A.SOPClassUID),A.SOPClassUID!==e))return void v.error("inconsistent sopClassUIDs: ",A.SOPClassUID,e)}),e}},{key:"normalizerForSOPClassUID",value:function(A){A=A.replace(/[^0-9.]/g,"");var e=tJ.sopClassUIDsByName,n={};return n[e.NMImage]=im,n[e.CTImage]=iC,n[e.ParametricMapStorage]=ip,n[e.MRImage]=ig,n[e.EnhancedCTImage]=iI,n[e.LegacyConvertedEnhancedCTImage]=iI,n[e.EnhancedMRImage]=id,n[e.LegacyConvertedEnhancedMRImage]=id,n[e.EnhancedUSVolume]=iB,n[e.PETImage]=iD,n[e.EnhancedPETImage]=iD,n[e.LegacyConvertedEnhancedPETImage]=iD,n[e.Segmentation]=ih,n[e.DeformableSpatialRegistration]=iM,n[e.OphthalmicPhotography8BitImage]=iw,n[e.OphthalmicTomographyImage]=iR,n[e.LabelmapSegmentation]=ih,n[A]}},{key:"isMultiframeSOPClassUID",value:function(A){var e=tJ.sopClassUIDsByName;return -1!==[e.NMImage,e.EnhancedMRImage,e.LegacyConvertedEnhancedMRImage,e.EnhancedCTImage,e.LegacyConvertedEnhancedCTImage,e.EnhancedUSVolume,e.EnhancedPETImage,e.LegacyConvertedEnhancedPETImage,e.Segmentation,e.ParametricMapStorage,e.OphthalmicTomographyImage,e.LabelmapSegmentation].indexOf(A)}},{key:"isMultiframeDataset",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dataset,n=e.SOPClassUID.replace(/[^0-9.]/g,"");return A.isMultiframeSOPClassUID(n)}},{key:"normalizeToDataset",value:function(e){var n=A.consistentSOPClassUIDs(e),t=A.normalizerForSOPClassUID(n);if(!t)return void v.error("no normalizerClass for ",n);var i=new t(e);return i.normalize(),i.dataset}}])}(),iS=function(A){function e(){return J(this,e),U(this,e,arguments)}return j(e,A),K(e,[{key:"normalize",value:function(){this.convertToMultiframe(),this.normalizeMultiframe()}},{key:"convertToMultiframe",value:function(){if(1===this.datasets.length&&iE.isMultiframeDataset(this.datasets[0])){this.dataset=this.datasets[0];return}this.derivation=new is(this.datasets),this.dataset=this.derivation.dataset;var A=this.dataset,n=this.datasets[0];A.NumberOfFrames=this.datasets.length,A.SOPClassUID=n.SOPClassUID,A.Rows=n.Rows,A.Columns=n.Columns,A.BitsAllocated=n.BitsAllocated,A.PixelRepresentation=n.PixelRepresentation,A.RescaleSlope=n.RescaleSlope||"1",A.RescaleIntercept=n.RescaleIntercept||"0";var t=n.ImagePositionPatient,i=n.ImageOrientationPatient.slice(0,3),r=n.ImageOrientationPatient.slice(3,6),a=e.vec3CrossProduct(i,r),o=[];this.datasets.forEach(function(A){var n=A.ImagePositionPatient.slice(),i=e.vec3Subtract(n,t),r=e.vec3Dot(i,a);o.push([r,A])}),o.sort(function(A,e){return e[0]-A[0]}),16!==A.BitsAllocated&&v.error("Only works with 16 bit data, not "+String(this.dataset.BitsAllocated)),n._vrMap&&!n._vrMap.PixelData?(v.warn("No vr map given for pixel data, using OW"),A._vrMap={PixelData:"OW"}):A._vrMap={PixelData:n._vrMap.PixelData};var s=n.PixelData.byteLength;A.PixelData=new ArrayBuffer(A.NumberOfFrames*s);var c=0;o.forEach(function(e){var n=e[1],t=new Uint16Array(n.PixelData),i=new Uint16Array(A.PixelData,c*s,s/2);try{i.set(t)}catch(t){if(t instanceof RangeError){var r="Error inserting pixels in PixelData\n"+"frameSize ".concat(s,"\n")+"NumberOfFrames ".concat(A.NumberOfFrames,"\n")+"pair ".concat(e,"\n")+"dataset PixelData size ".concat(n.PixelData.length);v.error(r)}}c++}),A.NumberOfFrames<2&&v.error("Cannot populate shared groups uniquely without multiple frames");var u=Ae(o[0],2),l=u[0],E=u[1],S=Math.abs(o[1][0]-l);A.SharedFunctionalGroupsSequence={PlaneOrientationSequence:{ImageOrientationPatient:E.ImageOrientationPatient},PixelMeasuresSequence:{PixelSpacing:E.PixelSpacing,SpacingBetweenSlices:S,SliceThickness:S}},A.ReferencedSeriesSequence={SeriesInstanceUID:E.SeriesInstanceUID,ReferencedInstanceSequence:[]},A.PerFrameFunctionalGroupsSequence=[],o.forEach(function(e){var n=e[1];A.PerFrameFunctionalGroupsSequence.push({PlanePositionSequence:{ImagePositionPatient:n.ImagePositionPatient},FrameVOILUTSequence:{WindowCenter:n.WindowCenter,WindowWidth:n.WindowWidth}}),A.ReferencedSeriesSequence.ReferencedInstanceSequence.push({ReferencedSOPClassUID:n.SOPClassUID,ReferencedSOPInstanceUID:n.SOPInstanceUID})});var g=tJ.uid();this.dataset.DimensionOrganizationSequence={DimensionOrganizationUID:g},this.dataset.DimensionIndexSequence=[{DimensionOrganizationUID:g,DimensionIndexPointer:2097202,FunctionalGroupPointer:2134291,DimensionDescriptionLabel:"ImagePositionPatient"}]}},{key:"normalizeMultiframe",value:function(){var A=this.dataset;if(!A.NumberOfFrames)return void v.error("Missing number or frames not supported");A.PixelRepresentation||(A.PixelRepresentation=1),A.StudyID&&""!==A.StudyID||(A.StudyID="No Study ID"),-1===["R","L"].indexOf(A.Laterality)&&delete A.Laterality,A.PresentationLUTShape||(A.PresentationLUTShape="IDENTITY"),A.SharedFunctionalGroupsSequence||v.error("Can only process multiframe data with SharedFunctionalGroupsSequence"),"PROSTATE"===A.BodyPartExamined&&(A.SharedFunctionalGroupsSequence.FrameAnatomySequence={AnatomicRegionSequence:{CodeValue:"T-9200B",CodingSchemeDesignator:"SRT",CodeMeaning:"Prostate"},FrameLaterality:"U"});var e=A.RescaleIntercept||0,n=A.RescaleSlope||1;A.SharedFunctionalGroupsSequence.PixelValueTransformationSequence={RescaleIntercept:e,RescaleSlope:n,RescaleType:"US"};var t=1;if(this.datasets.forEach(function(e){1===A.NumberOfFrames&&(A.PerFrameFunctionalGroupsSequence=[A.PerFrameFunctionalGroupsSequence]),A.PerFrameFunctionalGroupsSequence[t-1].FrameContentSequence={FrameAcquisitionDuration:0,StackID:1,InStackPositionNumber:t,DimensionIndexValues:t};var n=e.AcquisitionDate+e.AcquisitionTime;if(!isNaN(n)){var i=A.PerFrameFunctionalGroupsSequence[t-1].FrameContentSequence;i.FrameAcquisitionDateTime=n,i.FrameReferenceDateTime=n}t++}),A.WindowCenter&&A.WindowWidth&&(Array.isArray(A.WindowCenter)||(A.WindowCenter=[A.WindowCenter]),Array.isArray(A.WindowWidth)||(A.WindowWidth=[A.WindowWidth])),(!A.WindowCenter||!A.WindowWidth)&&(A.WindowCenter=[],A.WindowWidth=[],A.PerFrameFunctionalGroupsSequence)){var i={center:0,width:0,count:0};A.PerFrameFunctionalGroupsSequence.forEach(function(A){if(A.FrameVOILUT){var e=A.FrameVOILUTSequence.WindowCenter,n=A.FrameVOILUTSequence.WindowWidth;A.FrameVOILUTSequence&&e&&n&&(Array.isArray(e)&&(e=e[0]),Array.isArray(n)&&(n=n[0]),i.center+=Number(e),i.width+=Number(n),i.count++)}}),i.count>0&&(A.WindowCenter.push(String(i.center/i.count)),A.WindowWidth.push(String(i.width/i.count)))}0===A.WindowCenter.length&&(A.WindowCenter=[300]),0===A.WindowWidth.length&&(A.WindowWidth=[500])}}],[{key:"vec3CrossProduct",value:function(A,e){var n=A[0],t=A[1],i=A[2],r=e[0],a=e[1],o=e[2],s=[];return s[0]=t*o-i*a,s[1]=i*r-n*o,s[2]=n*a-t*r,s}},{key:"vec3Subtract",value:function(A,e){var n=[];return n[0]=A[0]-e[0],n[1]=A[1]-e[1],n[2]=A[2]-e[2],n}},{key:"vec3Dot",value:function(A,e){return A[0]*e[0]+A[1]*e[1]+A[2]*e[2]}}])}(iE),ig=function(A){function e(){return J(this,e),U(this,e,arguments)}return j(e,A),K(e,[{key:"normalize",value:function(){AA(z(e.prototype),"normalize",this).call(this),this.dataset.SOPClassUID="LegacyConvertedEnhancedMRImage"}},{key:"normalizeMultiframe",value:function(){AA(z(e.prototype),"normalizeMultiframe",this).call(this);var A=this.dataset;A.ImageType&&A.ImageType.constructor&&"Array"==A.ImageType.constructor.name&&4==A.ImageType.length||(A.ImageType=["ORIGINAL","PRIMARY","OTHER","NONE"]),A.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence={FrameType:A.ImageType,PixelPresentation:"MONOCHROME",VolumetricProperties:"VOLUME",VolumeBasedCalculationTechnique:"NONE",ComplexImageComponent:"MAGNITUDE",AcquisitionContrast:"UNKNOWN"}}}])}(iS),iI=function(A){function e(){return J(this,e),U(this,e,arguments)}return j(e,A),K(e,[{key:"normalize",value:function(){AA(z(e.prototype),"normalize",this).call(this)}}])}(iS),id=function(A){function e(){return J(this,e),U(this,e,arguments)}return j(e,A),K(e,[{key:"normalize",value:function(){AA(z(e.prototype),"normalize",this).call(this)}}])}(iS),iB=function(A){function e(){return J(this,e),U(this,e,arguments)}return j(e,A),K(e,[{key:"normalize",value:function(){AA(z(e.prototype),"normalize",this).call(this)}}])}(iS),im=function(A){function e(){return J(this,e),U(this,e,arguments)}return j(e,A),K(e,[{key:"normalize",value:function(){AA(z(e.prototype),"normalize",this).call(this);var A=tJ.sopClassUIDsByName;this.dataset.SOPClassUID=A.NMImage}}])}(iS),iC=function(A){function e(){return J(this,e),U(this,e,arguments)}return j(e,A),K(e,[{key:"normalize",value:function(){AA(z(e.prototype),"normalize",this).call(this);var A=tJ.sopClassUIDsByName;this.dataset.SOPClassUID=A.EnhancedCTImage}}])}(iS),iD=function(A){function e(){return J(this,e),U(this,e,arguments)}return j(e,A),K(e,[{key:"normalize",value:function(){AA(z(e.prototype),"normalize",this).call(this);var A=tJ.sopClassUIDsByName;this.dataset.SOPClassUID=A.EnhancedPETImage}}])}(iS),ih=function(A){function e(){return J(this,e),U(this,e,arguments)}return j(e,A),K(e,[{key:"normalize",value:function(){AA(z(e.prototype),"normalize",this).call(this)}}])}(iS),ip=function(A){function e(){return J(this,e),U(this,e,arguments)}return j(e,A),K(e,[{key:"normalize",value:function(){AA(z(e.prototype),"normalize",this).call(this);var A=this.datasets[0];32!==A.BitsAllocated&&v.error("Only works with 32 bit data, not "+String(A.BitsAllocated))}}])}(iS),iM=function(A){function e(){return J(this,e),U(this,e,arguments)}return j(e,A),K(e,[{key:"normalize",value:function(){this.dataset=this.datasets[0]}}])}(iE),iw=function(A){function e(){return J(this,e),U(this,e,arguments)}return j(e,A),K(e,[{key:"normalize",value:function(){this.dataset=this.datasets[0]}}])}(iE),iR=function(A){function e(){return J(this,e),U(this,e,arguments)}return j(e,A),K(e,[{key:"normalize",value:function(){AA(z(e.prototype),"normalize",this).call(this)}}])}(iS);ic.setNormalizer(iE);var iQ=K(function A(e){J(this,A),this.TIDIncludeGroups=e;var n=[],t=[];this.ImageLibraryContentSequence=n,this.CurrentRequestedProcedureEvidenceSequence=t,this.PersonObserverName={RelationshipType:"HAS OBS CONTEXT",ValueType:"PNAME",ConceptNameCodeSequence:{CodeValue:"121008",CodingSchemeDesignator:"DCM",CodeMeaning:"Person Observer Name"},PersonName:"unknown^unknown"},this.tid1500={ConceptNameCodeSequence:{CodeValue:"126000",CodingSchemeDesignator:"DCM",CodeMeaning:"Imaging Measurement Report"},ContinuityOfContent:"SEPARATE",PerformedProcedureCodeSequence:[],CompletionFlag:"COMPLETE",VerificationFlag:"UNVERIFIED",ReferencedPerformedProcedureStepSequence:[],InstanceNumber:1,CurrentRequestedProcedureEvidenceSequence:t,CodingSchemeIdentificationSequence:{CodingSchemeDesignator:"99dcmjs",CodingSchemeName:"Codes used for dcmjs",CodingSchemeVersion:"0",CodingSchemeResponsibleOrganization:"https://github.com/dcmjs-org/dcmjs"},ContentTemplateSequence:{MappingResource:"DCMR",TemplateIdentifier:"1500"},ContentSequence:[{RelationshipType:"HAS CONCEPT MOD",ValueType:"CODE",ConceptNameCodeSequence:tY({CodeValue:"121049",CodingSchemeDesignator:"DCM",CodeMeaning:"Language of Content Item and Descendants"}),ConceptCodeSequence:tY({CodeValue:"en",CodingSchemeDesignator:"RFC5646",CodeMeaning:"English"}),ContentSequence:tY({RelationshipType:"HAS CONCEPT MOD",ValueType:"CODE",ConceptNameCodeSequence:tY({CodeValue:"121046",CodingSchemeDesignator:"DCM",CodeMeaning:"Country of Language"}),ConceptCodeSequence:tY({CodeValue:"US",CodingSchemeDesignator:"ISO3166_1",CodeMeaning:"United States"})})},this.PersonObserverName,{RelationshipType:"HAS CONCEPT MOD",ValueType:"CODE",ConceptNameCodeSequence:tY({CodeValue:"121058",CodingSchemeDesignator:"DCM",CodeMeaning:"Procedure reported"}),ConceptCodeSequence:tY({CodeValue:"363679005",CodingSchemeDesignator:"SCT",CodeMeaning:"Imaging procedure"})},{RelationshipType:"CONTAINS",ValueType:"CONTAINER",ConceptNameCodeSequence:{CodeValue:"111028",CodingSchemeDesignator:"DCM",CodeMeaning:"Image Library"},ContinuityOfContent:"SEPARATE",ContentSequence:{RelationshipType:"CONTAINS",ValueType:"CONTAINER",ConceptNameCodeSequence:{CodeValue:"126200",CodingSchemeDesignator:"DCM",CodeMeaning:"Image Library Group"},ContinuityOfContent:"SEPARATE",ContentSequence:n}}]}},[{key:"validate",value:function(){}},{key:"contentItem",value:function(A){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.PersonName&&(this.PersonObserverName.PersonName=e.PersonName);var n=Array.isArray(A)?A:[A];return this.addTID1501MeasurementGroups(n,e),this.tid1500}},{key:"addTID1501MeasurementGroups",value:function(A){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.CurrentRequestedProcedureEvidenceSequence,t=this.ImageLibraryContentSequence,i=e.sopInstanceUIDsToSeriesInstanceUIDMap;if(A.length>1&&void 0===i)throw Error("addTID1501MeasurementGroups provided with ".concat(A.length," derivationSourceDatasets, with no sopInstanceUIDsToSeriesInstanceUIDMap in options."));var r=this.TIDIncludeGroups.TID1501MeasurementGroups;if(r){var a=[];r.forEach(function(A){a=a.concat(A.contentItem())});var o=[];r.forEach(function(e){e.TID300Measurements.forEach(function(e){var r=e.ReferencedSOPSequence.ReferencedSOPInstanceUID;if(!o.includes(r)){if(t.push({RelationshipType:"CONTAINS",ValueType:"IMAGE",ReferencedSOPSequence:e.ReferencedSOPSequence}),1===A.length)a=A[0];else{var a,s=i[r];a=A.find(function(A){return A.SeriesInstanceUID===s})}n.push({StudyInstanceUID:a.StudyInstanceUID,ReferencedSeriesSequence:{SeriesInstanceUID:a.SeriesInstanceUID,ReferencedSOPSequence:e.ReferencedSOPSequence}}),o.push(r)}})});var s={RelationshipType:"CONTAINS",ValueType:"CONTAINER",ConceptNameCodeSequence:{CodeValue:"126010",CodingSchemeDesignator:"DCM",CodeMeaning:"Imaging Measurements"},ContinuityOfContent:"SEPARATE",ContentSequence:a};this.tid1500.ContentSequence.push(s)}}}]),iP=K(function A(e){J(this,A),this.TID300Measurements=e},[{key:"contentItem",value:function(){var A=this,e=this.TID300Measurements,n=[];return e.forEach(function(e){n.push(A.getMeasurementGroup(e.contentItem()))}),n}},{key:"getMeasurementGroup",value:function(A){return{RelationshipType:"CONTAINS",ValueType:"CONTAINER",ConceptNameCodeSequence:{CodeValue:"125007",CodingSchemeDesignator:"DCM",CodeMeaning:"Measurement Group"},ContinuityOfContent:"SEPARATE",ContentSequence:An(A)}}}]),iT=function(A){return Array.isArray(A)?A:[A]},iy=function(A){return function(e){return e.ConceptNameCodeSequence.CodeMeaning===A}},iv={CodingSchemeDesignator:"DCM",CodeValue:"121071"},iO={CodingSchemeDesignator:"SCT",CodeValue:"363698007"},iN={CodingSchemeDesignator:"SRT",CodeValue:"G-C0E3"},iG=function(A,e,n){var t=A.ConceptNameCodeSequence;if(t){var i=t.CodingSchemeDesignator,r=t.CodeValue;return i==e.CodingSchemeDesignator&&r==e.CodeValue||n&&i==n.CodingSchemeDesignator&&r==n.CodeValue}},iF=function(){function A(){J(this,A)}return K(A,null,[{key:"getSetupMeasurementData",value:function(A){var e=iT(A.ContentSequence),n=e.find(function(A){return iG(A,iv)}),t=e.filter(function(A){return iG(A,iO,iN)})||[],i=e.find(function(A){return"NUM"===A.ValueType}),r=iT(i.ContentSequence).find(function(A){return"SCOORD"===A.ValueType}),a=r.ContentSequence.ReferencedSOPSequence,o=a.ReferencedSOPInstanceUID,s=a.ReferencedFrameNumber,c={sopInstanceUid:o,frameIndex:s||1,complete:!0,finding:n?tY(n.ConceptCodeSequence):void 0,findingSites:t.map(function(A){return tY(A.ConceptCodeSequence)})};c.finding&&(c.description=c.finding.CodeMeaning);var u=c.findingSites&&c.findingSites[0];return u&&(c.location=u[0]&&u[0].CodeMeaning||u.CodeMeaning),{defaultState:c,findingGroup:n,findingSiteGroups:t,NUMGroup:i,SCOORDGroup:r,ReferencedSOPSequence:a,ReferencedSOPInstanceUID:o,ReferencedFrameNumber:s}}},{key:"generateReport",value:function(A,e,n){var t=[],i=Object.keys(A)[0];if(!i)throw Error("No measurements provided.");var r=e.get("generalSeriesModule",i),a=r.studyInstanceUID,o=r.seriesInstanceUID;Object.keys(A).forEach(function(n){var i=e.get("sopCommonModule",n),r=e.get("frameNumber",n),a=A[n],o=Object.keys(a),s={ReferencedSOPClassUID:i.sopClassUID,ReferencedSOPInstanceUID:i.sopInstanceUID};iE.isMultiframeSOPClassUID(i.sopClassUID)&&(s.ReferencedFrameNumber=r);var c=[];o.forEach(function(A){var e=function(A,e,n){var t=e[A],i=iF.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE[A];if(t&&t.data&&t.data.length&&i)return new iP(t.data.map(function(A){var e;return(e=i.getTID300RepresentationArguments(A)).ReferencedSOPSequence=n,new i.TID300Representation(e)}))}(A,a,s);e&&c.push(e)}),t=t.concat(c)});var s=new iQ({TID1501MeasurementGroups:t},n),c=new Uint8Array(2);c[1]=1;var u={StudyInstanceUID:a,SeriesInstanceUID:o},l={FileMetaInformationVersion:{Value:[c.buffer],vr:"OB"},TransferSyntaxUID:{Value:["1.2.840.10008.1.2.1"],vr:"UI"},ImplementationClassUID:{Value:[tJ.uid()],vr:"UI"},ImplementationVersionName:{Value:["dcmjs"],vr:"SH"}};u._meta=l,u._vrMap={PixelData:"OW"};var E=new il([u]),S=s.contentItem(u);return E.dataset=Object.assign(E.dataset,S),E.dataset._meta=l,E}},{key:"generateToolState",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("1500"!==e.ContentTemplateSequence.TemplateIdentifier)throw Error("This package can currently only interpret DICOM SR TID 1500");var t=iT(e.ContentSequence).find(iy("Imaging Measurements")),i=iT(t.ContentSequence).filter(iy("Measurement Group")),r={},a=A.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE,o=[];return Object.keys(a).forEach(function(A){o.push(a[A]),r[A]=[]}),i.forEach(function(A){var t=iT(A.ContentSequence).find(function(A){return"Tracking Identifier"===A.ConceptNameCodeSequence.CodeMeaning}).TextValue,i=n.getToolClass?n.getToolClass(A,e,o):o.find(function(A){return A.isValidCornerstoneTrackingIdentifier(t)});if(i){var a=i.getMeasurementData(A);console.log("=== ".concat(i.toolType," ===")),console.log(a),r[i.toolType].push(a)}}),r}},{key:"registerTool",value:function(e){A.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE[e.utilityToolType]=e,A.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE[e.toolType]=e,A.MEASUREMENT_BY_TOOLTYPE[e.toolType]=e.utilityToolType}}])}();iF.MEASUREMENT_BY_TOOLTYPE={},iF.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE={},iF.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE={};var iU=K(function A(e){J(this,A),this.ReferencedSOPSequence=e.ReferencedSOPSequence,this.props=e},[{key:"getMeasurement",value:function(A){return[].concat(An(this.getTrackingGroups()),An(this.getFindingGroup()),An(this.getFindingSiteGroups()),An(A))}},{key:"getTrackingGroups",value:function(){return[{RelationshipType:"HAS OBS CONTEXT",ValueType:"TEXT",ConceptNameCodeSequence:{CodeValue:"112039",CodingSchemeDesignator:"DCM",CodeMeaning:"Tracking Identifier"},TextValue:this.props.trackingIdentifierTextValue||"web annotation"},{RelationshipType:"HAS OBS CONTEXT",ValueType:"UIDREF",ConceptNameCodeSequence:{CodeValue:"112040",CodingSchemeDesignator:"DCM",CodeMeaning:"Tracking Unique Identifier"},UID:tJ.uid()}]}},{key:"getFindingGroup",value:function(){var A=this.props.finding;if(!A)return[];var e=A.CodeValue,n=A.CodingSchemeDesignator,t=A.CodeMeaning;return[{RelationshipType:"CONTAINS",ValueType:"CODE",ConceptNameCodeSequence:tY({CodeValue:"121071",CodingSchemeDesignator:"DCM",CodeMeaning:"Finding"}),ConceptCodeSequence:tY({CodeValue:e,CodingSchemeDesignator:n,CodeMeaning:t})}]}},{key:"getFindingSiteGroups",value:function(){return(this.props.findingSites||[]).map(function(A){var e=A.CodeValue,n=A.CodingSchemeDesignator,t=A.CodeMeaning;return{RelationshipType:"CONTAINS",ValueType:"CODE",ConceptNameCodeSequence:tY({CodeValue:"363698007",CodingSchemeDesignator:"SCT",CodeMeaning:"Finding Site"}),ConceptCodeSequence:tY({CodeValue:e,CodingSchemeDesignator:n,CodeMeaning:t})}})}},{key:"flattenPoints",value:function(A){var e=A.points,n=A.use3DSpatialCoordinates,t=void 0!==n&&n,i=[];return e.forEach(function(A){i.push(A[0]||A.x),i.push(A[1]||A.y),t&&i.push(A[2]||A.z)}),i}}]),i_=K(function A(e){var n=e.graphicType,t=e.graphicData,i=e.use3DSpatialCoordinates,r=e.referencedSOPSequence,a=e.referencedFrameOfReferenceUID;J(this,A),this.graphicType=n,this.graphicData=t,this.use3DSpatialCoordinates=void 0!==i&&i,this.referencedSOPSequence=r,this.referencedFrameOfReferenceUID=a},[{key:"contentItem",value:function(){var A={RelationshipType:"INFERRED FROM",ValueType:this.use3DSpatialCoordinates?"SCOORD3D":"SCOORD",GraphicType:this.graphicType,GraphicData:this.graphicData};return this.use3DSpatialCoordinates?A.ReferencedFrameOfReferenceUID=this.referencedFrameOfReferenceUID:A.ContentSequence={RelationshipType:"SELECTED FROM",ValueType:"IMAGE",ReferencedSOPSequence:this.referencedSOPSequence},A}}]),ib=function(A){function e(){return J(this,e),U(this,e,arguments)}return j(e,A),K(e,[{key:"getPoints",value:function(){throw Error("getPoints() must be implemented by subclass")}},{key:"getConceptNameCodeSequence",value:function(){throw Error("getConceptNameCodeSequence() must be implemented")}},{key:"getMeasuredValueSequence",value:function(){return null}},{key:"buildGraphicContent",value:function(){var A=this.props,e=A.use3DSpatialCoordinates,n=void 0!==e&&e,t=A.ReferencedSOPSequence,i=A.ReferencedFrameOfReferenceUID;return new i_({graphicType:"POLYLINE",graphicData:this.flattenPoints({points:this.getPoints(),use3DSpatialCoordinates:n}),use3DSpatialCoordinates:n,referencedSOPSequence:t,referencedFrameOfReferenceUID:i}).contentItem()}},{key:"contentItem",value:function(){var A=this.getConceptNameCodeSequence(),e=this.getMeasuredValueSequence();return this.getMeasurement([{RelationshipType:"CONTAINS",ValueType:"NUM",ConceptNameCodeSequence:A,MeasuredValueSequence:e,ContentSequence:this.buildGraphicContent()}])}}])}(iU),ik={};[{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"mm",CodeMeaning:"mm"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"mm2",CodeMeaning:"mm2"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"[hnsf'U]",CodeMeaning:"Hounsfield unit"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"{counts}",CodeMeaning:"Counts"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"{counts}/s",CodeMeaning:"Counts per second"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"{propcounts}",CodeMeaning:"Proportional to counts"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"{propcounts}/s",CodeMeaning:"Proportional to counts per second"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"cm2",CodeMeaning:"cm2"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"cm2/ml",CodeMeaning:"cm2/ml"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"%",CodeMeaning:"Percent"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"Bq/ml",CodeMeaning:"Becquerels/milliliter"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"mg/min/ml",CodeMeaning:"Milligrams/minute/milliliter"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"umol/min/ml",CodeMeaning:"Micromole/minute/milliliter"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"ml/min/g",CodeMeaning:"Milliliter/minute/gram"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"ml/g",CodeMeaning:"Milliliter/gram"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"/cm",CodeMeaning:"/Centimeter"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"umol/ml",CodeMeaning:"Micromole/milliliter"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"g/ml{SUVbw}",CodeMeaning:"Standardized Uptake Value body weight"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"g/ml{SUVlbm}",CodeMeaning:"Standardized Uptake Value lean body mass (James)"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"g/ml{SUVlbm(James128)}",CodeMeaning:"Standardized Uptake Value lean body mass (James 128 multiplier)"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"g/ml{SUVlbm(Janma)}",CodeMeaning:"Standardized Uptake Value lean body mass (Janma)"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"cm2/ml{SUVbsa}",CodeMeaning:"Standardized Uptake Value body surface area"},{CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"g/ml{SUVibw}",CodeMeaning:"Standardized Uptake Value ideal body weight"}].forEach(function(A){ik[A.CodeValue]=A});var iL={CodeValue:"1",CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeMeaning:"px"};["px","px\xb2"].forEach(function(A){ik[A]=iL}),ik.HU={CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"[hnsf'U]",CodeMeaning:"Hounsfield unit"},ik["mm\xb2"]={CodingSchemeDesignator:"UCUM",CodingSchemeVersion:"1.4",CodeValue:"mm2",CodeMeaning:"mm2"};var iq=function(A){if(!A)return iL;var e=A.indexOf(" "),n=-1===e?A:A.substring(0,e),t=ik[A]||ik[n];return t||(v.error("Unspecified units",A),{CodeValue:"[arb'U]{".concat(A,"}"),CodingSchemeDesignator:"UCUM",CodeMeaning:"arbitrary ".concat(A)})};iq.measurementMap=ik;var iV=function(A){function e(){return J(this,e),U(this,e,arguments)}return j(e,A),K(e,[{key:"getPoints",value:function(){var A=this.props;return[A.point1,A.point2]}},{key:"getConceptNameCodeSequence",value:function(){return{CodeValue:"410668003",CodingSchemeDesignator:"SCT",CodeMeaning:"Length"}}},{key:"getMeasuredValueSequence",value:function(){var A=this.props,e=A.distance,n=A.unit;return{MeasurementUnitsCodeSequence:iq(void 0===n?"mm":n),NumericValue:e}}}])}(ib),ix="cornerstoneTools@^4.0.0",iH="Length",iY=function(){function A(){J(this,A)}return K(A,null,[{key:"getMeasurementData",value:function(e){var n=iF.getSetupMeasurementData(e),t=n.defaultState,i=n.NUMGroup,r=n.SCOORDGroup,a=L(L({},t),{},{length:i.MeasuredValueSequence.NumericValue,toolType:A.toolType,handles:{start:{},end:{},textBox:{hasMoved:!1,movesIndependently:!1,drawnIndependently:!0,allowedOutsideImage:!0,hasBoundingBox:!0}}}),o=Ae(r.GraphicData,4);return a.handles.start.x=o[0],a.handles.start.y=o[1],a.handles.end.x=o[2],a.handles.end.y=o[3],a}},{key:"getTID300RepresentationArguments",value:function(A){var e=A.handles,n=A.finding,t=A.findingSites;return{point1:e.start,point2:e.end,distance:A.length,trackingIdentifierTextValue:"cornerstoneTools@^4.0.0:Length",finding:n,findingSites:t||[]}}}])}();iY.toolType=iH,iY.utilityToolType=iH,iY.TID300Representation=iV,iY.isValidCornerstoneTrackingIdentifier=function(A){if(!A.includes(":"))return!1;var e=Ae(A.split(":"),2),n=e[0],t=e[1];return n===ix&&t===iH},iF.registerTool(iY);var iJ=function(){function A(){J(this,A)}return K(A,null,[{key:"createNumericMeasurement",value:function(A,e,n,t,i){var r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=r.scoordContentItem,o=void 0===a?null:a,s={RelationshipType:"CONTAINS",ValueType:"NUM",ConceptNameCodeSequence:{CodeValue:A,CodingSchemeDesignator:e,CodeMeaning:n},MeasuredValueSequence:{MeasurementUnitsCodeSequence:iq(i),NumericValue:t}};return o&&(s.ContentSequence=o),s}},{key:"createAreaMeasurement",value:function(e,n,t){var i=t.scoordContentItem;return A.createNumericMeasurement("42798000","SCT","Area",e,n,{scoordContentItem:i})}},{key:"createRadiusMeasurement",value:function(e,n,t){var i=t.scoordContentItem;return A.createNumericMeasurement("131190003","SCT","Radius",e,n,{scoordContentItem:i})}},{key:"createMaxMeasurement",value:function(e,n,t){var i=t.scoordContentItem;return A.createNumericMeasurement("56851009","SCT","Maximum",e,n,{scoordContentItem:i})}},{key:"createMinMeasurement",value:function(e,n,t){var i=t.scoordContentItem;return A.createNumericMeasurement("255605001","SCT","Minimum",e,n,{scoordContentItem:i})}},{key:"createMeanMeasurement",value:function(e,n,t){var i=t.scoordContentItem;return A.createNumericMeasurement("373098007","SCT","Mean",e,n,{scoordContentItem:i})}},{key:"createStdDevMeasurement",value:function(e,n,t){var i=t.scoordContentItem;return A.createNumericMeasurement("386136009","SCT","Standard Deviation",e,n,{scoordContentItem:i})}},{key:"createPerimeterMeasurement",value:function(e,n,t){var i=t.scoordContentItem;return A.createNumericMeasurement("131191004","SCT","Perimeter",e,n,{scoordContentItem:i})}}])}(),iW=function(A){function e(){return J(this,e),U(this,e,arguments)}return j(e,A),K(e,[{key:"contentItem",value:function(){var A=this.props,e=A.points,n=A.area,t=A.areaUnit,i=A.ReferencedSOPSequence,r=A.use3DSpatialCoordinates,a=void 0!==r&&r,o=A.perimeter,s=A.unit,c=A.modalityUnit,u=A.min,l=A.max,E=A.mean,S=A.stdDev,g=A.ReferencedFrameOfReferenceUID,I=this.flattenPoints({points:e,use3DSpatialCoordinates:a}),d=[{value:o,unit:void 0===s?"mm":s,builder:iJ.createPerimeterMeasurement},{value:n,unit:void 0===t?"mm2":t,builder:iJ.createAreaMeasurement},{value:l,unit:c,builder:iJ.createMaxMeasurement},{value:u,unit:c,builder:iJ.createMinMeasurement},{value:E,unit:c,builder:iJ.createMeanMeasurement},{value:S,unit:c,builder:iJ.createStdDevMeasurement}],B=new i_({graphicType:"POLYLINE",graphicData:I,use3DSpatialCoordinates:a,referencedSOPSequence:i,referencedFrameOfReferenceUID:g}).contentItem(),m=d.filter(function(A){return void 0!==A.value}).map(function(A,e){return A.builder(A.value,A.unit,{scoordContentItem:0===e?B:null})});return this.getMeasurement(m)}}])}(iU),iK=function(){function A(){J(this,A)}return K(A,null,[{key:"getMeasurementData",value:function(e){for(var n=iF.getSetupMeasurementData(e),t=n.defaultState,i=n.SCOORDGroup,r=n.NUMGroup,a=L(L({},t),{},{toolType:A.toolType,handles:{points:[],textBox:{active:!1,hasMoved:!1,movesIndependently:!1,drawnIndependently:!0,allowedOutsideImage:!0,hasBoundingBox:!0}},cachedStats:{area:r?r.MeasuredValueSequence.NumericValue:0},color:void 0,invalidated:!0}),o=i.GraphicData,s=0;sc?(u.push({x:l.x-s,y:l.y}),u.push({x:l.x+s,y:l.y}),u.push({x:l.x,y:l.y-c}),u.push({x:l.x,y:l.y+c})):(u.push({x:l.x,y:l.y-c}),u.push({x:l.x,y:l.y+c}),u.push({x:l.x-s,y:l.y}),u.push({x:l.x+s,y:l.y})),{area:o,points:u,trackingIdentifierTextValue:"cornerstoneTools@^4.0.0:EllipticalRoi",finding:t,findingSites:i||[]}}}])}();i0.toolType=i$,i0.utilityToolType=i$,i0.TID300Representation=iZ,i0.isValidCornerstoneTrackingIdentifier=function(A){if(!A.includes(":"))return!1;var e=Ae(A.split(":"),2),n=e[0],t=e[1];return n===ix&&t===i$},iF.registerTool(i0);var i1=function(A){function e(){return J(this,e),U(this,e,arguments)}return j(e,A),K(e,[{key:"contentItem",value:function(){var A=this.props,e=A.points,n=A.ReferencedSOPSequence,t=A.use3DSpatialCoordinates,i=void 0!==t&&t,r=A.perimeter,a=A.area,o=A.areaUnit,s=A.unit,c=A.max,u=A.min,l=A.mean,E=A.stdDev,S=A.radiusUnit,g=A.modalityUnit,I=A.ReferencedFrameOfReferenceUID,d=A.radius,B=this.flattenPoints({points:e,use3DSpatialCoordinates:i}),m=[{value:r,unit:void 0===s?"mm":s,builder:iJ.createPerimeterMeasurement},{value:a,unit:void 0===o?"mm2":o,builder:iJ.createAreaMeasurement},{value:d,unit:S,builder:iJ.createRadiusMeasurement},{value:c,unit:g,builder:iJ.createMaxMeasurement},{value:u,unit:g,builder:iJ.createMinMeasurement},{value:l,unit:g,builder:iJ.createMeanMeasurement},{value:E,unit:g,builder:iJ.createStdDevMeasurement}],C=new i_({graphicType:"CIRCLE",graphicData:B,use3DSpatialCoordinates:i,referencedSOPSequence:n,referencedFrameOfReferenceUID:I}).contentItem(),D=m.filter(function(A){return void 0!==A.value}).map(function(A,e){return A.builder(A.value,A.unit,{scoordContentItem:0===e?C:null})});return this.getMeasurement(D)}}])}(iU),i2="CircleRoi",i9=function(){function A(){J(this,A)}return K(A,null,[{key:"getMeasurementData",value:function(e){var n=iF.getSetupMeasurementData(e),t=n.defaultState,i=n.NUMGroup,r=n.SCOORDGroup.GraphicData,a={x:r[0],y:r[1]},o={x:r[2],y:r[3]};return L(L({},t),{},{toolType:A.toolType,active:!1,cachedStats:{area:i?i.MeasuredValueSequence.NumericValue:0,radius:0,perimeter:0},handles:{end:L(L({},o),{},{highlight:!1,active:!1}),initialRotation:0,start:L(L({},a),{},{highlight:!1,active:!1}),textBox:{hasMoved:!1,movesIndependently:!1,drawnIndependently:!0,allowedOutsideImage:!0,hasBoundingBox:!0}},invalidated:!0,visible:!0})}},{key:"getTID300RepresentationArguments",value:function(A){var e=A.cachedStats,n=void 0===e?{}:e,t=A.handles,i=A.finding,r=A.findingSites,a=t.start,o=t.end,s=n.area,c=n.areaUnit,u=n.unit,l=n.radius,E=2*Math.PI*l,S=[];return S.push(a),S.push(o),{area:s,areaUnit:void 0===c?"mm2":c,perimeter:E,unit:void 0===u?"mm":u,radius:l,points:S,trackingIdentifierTextValue:"cornerstoneTools@^4.0.0:CircleRoi",finding:i,findingSites:r||[]}}}])}();i9.toolType=i2,i9.utilityToolType=i2,i9.TID300Representation=i1,i9.isValidCornerstoneTrackingIdentifier=function(A){if(!A.includes(":"))return!1;var e=Ae(A.split(":"),2),n=e[0],t=e[1];return n===ix&&t===i2},iF.registerTool(i9);var i4=function(A){function e(){return J(this,e),U(this,e,arguments)}return j(e,A),K(e,[{key:"contentItem",value:function(){var A=this.props,e=A.points,n=A.ReferencedSOPSequence,t=A.use3DSpatialCoordinates,i=void 0!==t&&t,r=A.ReferencedFrameOfReferenceUID,a=e[0],o=new i_({graphicType:"POINT",graphicData:i?[a.x,a.y,a.z]:[a.x,a.y],use3DSpatialCoordinates:i,referencedSOPSequence:n,referencedFrameOfReferenceUID:r}).contentItem();return this.getMeasurement([{RelationshipType:"CONTAINS",ValueType:"NUM",ConceptNameCodeSequence:{CodeValue:"111010",CodingSchemeDesignator:"DCM",CodeMeaning:"Center"},MeasuredValueSequence:{NumericValue:0,MeasurementUnitsCodeSequence:{CodeValue:"1",CodingSchemeDesignator:"UCUM",CodeMeaning:"no units"}},ContentSequence:o}])}}])}(iU),i8="ArrowAnnotate",i3="CORNERSTONEFREETEXT",i5=function(){function A(){J(this,A)}return K(A,null,[{key:"getMeasurementData",value:function(e){var n=iF.getSetupMeasurementData(e),t=n.defaultState,i=n.SCOORDGroup,r=n.findingGroup.ConceptCodeSequence.CodeMeaning,a=i.GraphicData;return L(L({},t),{},{toolType:A.toolType,active:!1,handles:{start:{x:a[0],y:a[1],highlight:!0,active:!1},end:{x:4==a.length?a[2]:a[0]+20,y:4==a.length?a[3]:a[1]+20,highlight:!0,active:!1},textBox:{hasMoved:!1,movesIndependently:!1,drawnIndependently:!0,allowedOutsideImage:!0,hasBoundingBox:!0}},invalidated:!0,text:r,visible:!0})}},{key:"getTID300RepresentationArguments",value:function(A){var e=[A.handles.start,A.handles.end],n=A.finding,t={points:e,trackingIdentifierTextValue:"cornerstoneTools@^4.0.0:ArrowAnnotate",findingSites:A.findingSites||[]};return n&&n.CodeValue===i3||(n={CodeValue:i3,CodingSchemeDesignator:"CST4",CodeMeaning:A.text}),t.finding=n,t}}])}();i5.toolType=i8,i5.utilityToolType=i8,i5.TID300Representation=i4,i5.isValidCornerstoneTrackingIdentifier=function(A){if(!A.includes(":"))return!1;var e=Ae(A.split(":"),2),n=e[0],t=e[1];return n===ix&&t===i8},iF.registerTool(i5);var i6=Q(function(){if(p)return h;p=1;var A=C?m:(C=1,m=function(A){for(var e=Array(A),n=0;n=0;--l)o[l]=E,E*=a[l]}if(void 0===s){s=0;for(var l=0;lMath.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===n&&o.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]); if(s0>s1){ if(s1>s2){ return [2,1,0]; }else if(s0>s2){ return [1,2,0]; }else{ return [1,0,2]; } }else if(s0>s2){ return [2,0,1]; }else if(s2>s1){ return [0,1,2]; }else{ return [0,2,1]; }}})")):o.push("ORDER})")),o.push("proto.set=function "+t+"_set("+u.join(",")+",v){"),a?o.push("return this.data.set("+l+",v)}"):o.push("return this.data["+l+"]=v}"),o.push("proto.get=function "+t+"_get("+u.join(",")+"){"),a?o.push("return this.data.get("+l+")}"):o.push("return this.data["+l+"]}"),o.push("proto.index=function "+t+"_index(",u.join(),"){return "+l+"}"),o.push("proto.hi=function "+t+"_hi("+u.join(",")+"){return new "+t+"(this.data,"+c.map(function(A){return"(typeof i"+A+"!=='number'||i"+A+"<0)?this.shape["+A+"]:i"+A+"|0"}).join(",")+","+c.map(function(A){return"this.stride["+A+"]"}).join(",")+",this.offset)}");var g=c.map(function(A){return"a"+A+"=this.shape["+A+"]"}),I=c.map(function(A){return"c"+A+"=this.stride["+A+"]"});o.push("proto.lo=function "+t+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+g.join(",")+","+I.join(","));for(var d=0;d=0){ d=i"+d+"|0; b+=c"+d+"*d; a"+d+"-=d}");o.push("return new "+t+"(this.data,"+c.map(function(A){return"a"+A}).join(",")+","+c.map(function(A){return"c"+A}).join(",")+",b)}"),o.push("proto.step=function "+t+"_step("+u.join(",")+"){var "+c.map(function(A){return"a"+A+"=this.shape["+A+"]"}).join(",")+","+c.map(function(A){return"b"+A+"=this.stride["+A+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var d=0;d=0){c=(c+this.stride["+d+"]*i"+d+")|0}else{a.push(this.shape["+d+"]);b.push(this.stride["+d+"])}");o.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),o.push("return function construct_"+t+"(data,shape,stride,offset){return new "+t+"(data,"+c.map(function(A){return"shape["+A+"]"}).join(",")+","+c.map(function(A){return"stride["+A+"]"}).join(",")+",offset)}");var s=Function("CTOR_LIST","ORDER",o.join("\n"));return s(r[e],i)}(S,g.length-1));var c=g[u+1];return c(t,a,o,s)}}());function i7(A,e){return[A[1]*e[2]-A[2]*e[1],A[2]*e[0]-A[0]*e[2],A[0]*e[1]-A[1]*e[0]]}var rA={h:function(A){return[A[0],A[1],A[2],-A[3],-A[4],-A[5]]},v:function(A){return[-A[0],-A[1],-A[2],A[3],A[4],A[5]]},hv:function(A){return[-A[0],-A[1],-A[2],-A[3],-A[4],-A[5]]}};function re(A,e,n){for(var t=Math.cos(n),i=Math.sin(n),r=1-t,a=e[0]*A[0]+e[1]*A[1]+e[2]*A[2],o=[],s=i7(e,A),c=0;c<=2;c++)o[c]=A[c]*t+s[c]*i+e[c]*a*r,o[c]*=-1;return o}function rn(A,e){var n=[A[0],A[1],A[2]],t=[A[3],A[4],A[5]],i=i7(n,t),r=re(n,i,e),a=re(t,i,e);return[].concat(An(r),An(a))}var rt={h:function(A){for(var e=Ae(A.shape,2),n=e[0],t=e[1],i=i6(new Uint8Array(n*t),[n,t]),r=0;r2&&void 0!==arguments[2]?arguments[2]:{includeSliceSpacing:!0},t=e.toolState,i=e.segments,r=A[0],a={x:r.columns,y:r.rows,z:A.length};if(a.xy=a.x*a.y,!function(A,e){for(var n=0,t=0;tMath.abs(A[0]-e[0])&&1e-5>Math.abs(A[1]-e[1])&&1e-5>Math.abs(A[2]-e[2])&&1e-5>Math.abs(A[3]-e[3])&&1e-5>Math.abs(A[4]-e[4])&&1e-5>Math.abs(A[5]-e[5])}function rc(A,e,n,t){for(var i,r=n*t,a=((i=new Uint32Array(16))[0]=1,i[1]=64,i),o=[],s=0;s=o.length)break;var l=function(A,e){for(var n=A[e],t=1;t=129){for(var u=257-a,l=r+1,E=0;E-1},AR.prototype.set=function(A,e){var n=this.__data__,t=Ay(n,A);return t<0?n.push([A,e]):n[t][1]=e,this},AQ.prototype.clear=function(){this.__data__={hash:new Aw,map:new(AS||AR),string:new Aw}},AQ.prototype.delete=function(A){return AN(this,A).delete(A)},AQ.prototype.get=function(A){return AN(this,A).get(A)},AQ.prototype.has=function(A){return AN(this,A).has(A)},AQ.prototype.set=function(A,e){return AN(this,A).set(A,e),this},AP.prototype.clear=function(){this.__data__=new AR},AP.prototype.delete=function(A){return this.__data__.delete(A)},AP.prototype.get=function(A){return this.__data__.get(A)},AP.prototype.has=function(A){return this.__data__.has(A)},AP.prototype.set=function(A,e){var n=this.__data__;if(n instanceof AR){var t=n.__data__;if(!AS||t.length<199)return t.push([A,e]),this;n=this.__data__=new AQ(t)}return n.set(A,e),this};var AF=Ac?Y(Ac,Object):function(){return[]},AU=function(A){return AA.call(A)};function A_(A){var e=A&&A.constructor;return A===("function"==typeof e&&e.prototype||X)}function Ab(A){if(null!=A){try{return Z.call(A)}catch(A){}try{return A+""}catch(A){}}return""}function Ak(A,e){return A===e||A!=A&&e!=e}(AE&&AU(new AE(new ArrayBuffer(1)))!=C||AS&&AU(new AS)!=c||Ag&&AU(Ag.resolve())!=E||AI&&AU(new AI)!=g||Ad&&AU(new Ad)!=B)&&(AU=function(A){var e=AA.call(A),n=e==l?A.constructor:void 0,t=n?Ab(n):void 0;if(t)switch(t){case Am:return C;case AC:return c;case AD:return E;case Af:return g;case Ah:return B}return e});var AL=Array.isArray;function Aq(A){var e;return null!=A&&"number"==typeof(e=A.length)&&e>-1&&e%1==0&&e<=0x1fffffffffffff&&!Ax(A)}var AV=Au||function(){return!1};function Ax(A){var e=AH(A)?AA.call(A):"";return e==o||e==s}function AH(A){var e=typeof A;return!!A&&("object"==e||"function"==e)}function AY(A){return Aq(A)?function(A,e){var n,t,r,a,o,s=AL(A)||(r=t=n=A)&&"object"==typeof r&&Aq(t)&&$.call(n,"callee")&&(!Ao.call(n,"callee")||AA.call(n)==i)?function(A,e){for(var n=-1,t=Array(A);++n-1&&a%1==0&&a2&&void 0!==arguments[2]?arguments[2]:{},t=A[0].imageId.includes("?frame");return rd(function(A,e,n){var t=[];if(e){var i=A[0].data.byteArray.buffer,r=tj.readFile(i),a=tJ.naturalizeDataset(r.dict);a._meta=tJ.namifyDataset(r.meta),t.push(a)}else for(var o=0;o3&&void 0!==arguments[3]&&arguments[3],T=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.001,y=tj.readFile(e),O=tJ.naturalizeDataset(y.dict);O._meta=tJ.namifyDataset(y.meta);var G=iE.normalizeToDataset([O]),F=n.get("imagePlaneModule",A[0]),U=n.get("generalSeriesModule",A[0]).seriesInstanceUID,_="FrameOfReferenceUID"in G;_&&(F||console.warn("Insufficient metadata, imagePlaneModule missing."),t=Array.isArray(F.rowCosines)?[].concat(An(F.rowCosines),An(F.columnCosines)):[F.rowCosines.x,F.rowCosines.y,F.rowCosines.z,F.columnCosines.x,F.columnCosines.y,F.columnCosines.z],(i=[])[0]=t,i[1]=rA.h(t),i[2]=rA.v(t),r=rn(t,Math.PI/2),i[3]=r,i[4]=rA.h(r),i[5]=rA.v(r),i[6]=rn(t,Math.PI),i[7]=rn(t,1.5*Math.PI),M=i);var b=G.Columns*G.Rows,k=(a=G,o=U,s=a.SegmentSequence,c=[],{seriesInstanceUid:o,data:Array.isArray(s)?[void 0].concat(An(s)):[void 0,s]});if("1.2.840.10008.1.2.5"===G._meta.TransferSyntaxUID.Value[0]){if(w=ru(Array.isArray(G.PixelData)?G.PixelData:[G.PixelData],G.Rows,G.Columns),1===G.BitsStored)return void console.warn("No implementation for rle + bitbacking.")}else if(!(w=function(A){var e,n=A.SegmentationType;if(void 0===(e=Array.isArray(A.PixelData)?A.PixelData[0]:A.PixelData)&&v.error("This segmentation pixeldata is undefined."),"BINARY"===n)return N.unpack(e);var t=new Uint8Array(e),i=A.MaximumFractionalValue;if(void 0===t.find(function(A){return 0!==A&&A!==i}))return v.warn("This segmentation object is actually binary... processing as such."),t}(G)))throw Error("Fractional segmentations are not yet supported");R=_?(u=G,l=M,E=[F.rows,F.columns,A.length],S=T,g=u.SharedFunctionalGroupsSequence,I=u.PerFrameFunctionalGroupsSequence,d=g.PlaneOrientationSequence?g.PlaneOrientationSequence.ImageOrientationPatient:void 0,B=I[0],m=d||B.PlaneOrientationSequence.ImageOrientationPatient,l.some(function(A){return rh(m,A,S)})?"Planar":(C=m,D=l[0],f=S,h=Math.abs(C[0]*D[0]+C[1]*D[1]+C[2]*D[2]),p=Math.abs(C[3]*D[3]+C[4]*D[4]+C[5]*D[5]),(h1))return!0}}catch(A){B.e(A)}finally{B.f()}return!1}(w,G,A,M,n,T)),R){case"Planar":Q=L?rm:rD;break;case"Perpendicular":throw Error("Segmentations orthogonal to the acquisition plane of the source data are not yet supported.");case"Oblique":throw Error("Segmentations oblique to the acquisition plane of the source data are not yet supported.")}var q=[];q[0]=[];var V=[],x=b*A.length*2,H=[];return H[0]=new ArrayBuffer(x),Q(V,q,H,w,G,A,M,n,T),{labelmapBufferArray:H,segMetadata:k,segmentsOnFrame:V,segmentsOnFrameArray:q}},fillSegmentation:rd},rI={includeSliceSpacing:!0,rleEncode:!0};function rd(A,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},t=Object.assign({},rI,n),i=Array.isArray(e)?e:[e],r=0,a=[],o=0;o=d&&(n[B]=new ArrayBuffer(I),e[B]=[],d++),m=n[B].slice(0),C=rS(e[B]),c=0;break}else T[O]=M,v=!0;v&&(C[P]||(C[P]=[]),C[P].push(M),A[P]||(A[P]=[]),A[P].push(M)),h=c}(h))continue;n[B]=m.slice(0),e[B]=rS(C),m=n[B=0].slice(0),C=rS(e[B])}}var rC=function(A,e){var n=A.PerFrameFunctionalGroupsSequence,t=A.SharedFunctionalGroupsSequence,i=n[e];return i&&i.SegmentIdentificationSequence?i.SegmentIdentificationSequence.ReferencedSegmentNumber:t.SegmentIdentificationSequence?t.SegmentIdentificationSequence.ReferencedSegmentNumber:void 0};function rD(A,e,n,t,i,r,a,o,s){for(var c=i.SharedFunctionalGroupsSequence,u=i.PerFrameFunctionalGroupsSequence,l=i.Rows,E=i.Columns,S=c.PlaneOrientationSequence?c.PlaneOrientationSequence.ImageOrientationPatient:void 0,g=E*l,I=0,d=u.length;I1||iE.isMultiframeSOPClassUID(l))&&(m.ReferencedFrameNumber=I);var D=[];B.forEach(function(A){var e=function(A,e,n,t){var i=e[A],r=rU.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE[A];if(i&&i.data&&i.data.length&&r)return new iP(i.data.map(function(A){var e;return(e=r.getTID300RepresentationArguments(A,t)).ReferencedSOPSequence=n,new r.TID300Representation(e)}))}(A,d,m,t);e&&D.push(e)}),r=r.concat(D)});var c=new iQ({TID1501MeasurementGroups:r},i),u=new il(o),l=c.contentItem(o,{sopInstanceUIDsToSeriesInstanceUIDMap:a});return u.dataset=Object.assign(u.dataset,l),u.dataset._meta=s,u}},{key:"generateToolState",value:function(e,n,t,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};if("1500"!==e.ContentTemplateSequence.TemplateIdentifier)throw Error("This package can currently only interpret DICOM SR TID 1500");var a=iT(e.ContentSequence).find(iy("Imaging Measurements")),o=iT(a.ContentSequence).filter(iy("Measurement Group")),s={},c=A.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE,u=[];return Object.keys(c).forEach(function(A){u.push(c[A]),s[A]=[]}),o.forEach(function(A){var a=iT(A.ContentSequence).find(function(A){return"Tracking Identifier"===A.ConceptNameCodeSequence.CodeMeaning}).TextValue,o=r.getToolClass?r.getToolClass(A,e,u):u.find(function(A){return A.isValidCornerstoneTrackingIdentifier(a)});if(o){var c=o.getMeasurementData(A,n,t,i);console.log("=== ".concat(o.toolType," ===")),console.log(c),s[o.toolType].push(c)}}),s}},{key:"registerTool",value:function(e){A.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE[e.utilityToolType]=e,A.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE[e.toolType]=e,A.MEASUREMENT_BY_TOOLTYPE[e.toolType]=e.utilityToolType}}])}();rU.MEASUREMENT_BY_TOOLTYPE={},rU.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE={},rU.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE={};var r_="Cornerstone3DTools@^0.1.0",rb="Length",rk="".concat(r_,":").concat(rb),rL=function(){function A(){J(this,A)}return K(A,null,[{key:"getMeasurementData",value:function(e,n,t,i){for(var r=rU.getSetupMeasurementData(e,n,i,A.toolType),a=r.defaultState,o=r.NUMGroup,s=r.SCOORDGroup,c=r.ReferencedFrameNumber,u=a.annotation.metadata.referencedImageId,l=s.GraphicData,E=[],S=0;SMath.sqrt(Math.pow(d[0][0]-d[1][0],2)+Math.pow(d[0][1]-d[1][1],2)+Math.pow(d[0][2]-d[1][2],2))?(n=I,t=d):(n=d,t=I);var B=e(u,n[0]),m=e(u,n[1]),C=e(u,t[0]),D=e(u,t[1]);return{longAxis:{point1:{x:B[0],y:B[1]},point2:{x:m[0],y:m[1]}},shortAxis:{point1:{x:C[0],y:C[1]},point2:{x:D[0],y:D[1]}},longAxisLength:E,shortAxisLength:S,trackingIdentifierTextValue:rV,finding:r,findingSites:a||[]}}}])}();rx.toolType=rq,rx.utilityToolType=rq,rx.TID300Representation=iX,rx.isValidCornerstoneTrackingIdentifier=function(A){if(!A.includes(":"))return!1;var e=Ae(A.split(":"),2),n=e[0],t=e[1];return n===r_&&t===rq},rU.registerTool(rx);var rH="undefined"!=typeof Float32Array?Float32Array:Array,rY=Math.random;function rJ(A){return A>=0?Math.round(A):A%.5==0?Math.floor(A):Math.round(A)}function rW(){var A=new rH(3);return rH!=Float32Array&&(A[0]=0,A[1]=0,A[2]=0),A}function rK(A){var e=A[0],n=A[1],t=A[2];return Math.sqrt(e*e+n*n+t*t)}function rX(A,e,n){var t=new rH(3);return t[0]=A,t[1]=e,t[2]=n,t}function rj(A,e,n){return A[0]=e[0]-n[0],A[1]=e[1]-n[1],A[2]=e[2]-n[2],A}function rz(A,e,n){return A[0]=e[0]*n[0],A[1]=e[1]*n[1],A[2]=e[2]*n[2],A}function rZ(A,e,n){return A[0]=e[0]/n[0],A[1]=e[1]/n[1],A[2]=e[2]/n[2],A}function r$(A,e){var n=e[0]-A[0],t=e[1]-A[1],i=e[2]-A[2];return Math.sqrt(n*n+t*t+i*i)}function r0(A,e){var n=e[0]-A[0],t=e[1]-A[1],i=e[2]-A[2];return n*n+t*t+i*i}function r1(A){var e=A[0],n=A[1],t=A[2];return e*e+n*n+t*t}function r2(A,e){var n=e[0],t=e[1],i=e[2],r=n*n+t*t+i*i;return r>0&&(r=1/Math.sqrt(r)),A[0]=e[0]*r,A[1]=e[1]*r,A[2]=e[2]*r,A}function r9(A,e){return A[0]*e[0]+A[1]*e[1]+A[2]*e[2]}var r4=function(){var A=rW();return function(e,n,t,i,r,a){var o,s;for(n||(n=3),t||(t=0),s=i?Math.min(i*n+t,e.length):e.length,o=t;oMath.abs(Math.abs(M)-1)?R=[E[0],E[1],E[2],E[3]]:1e-4>Math.abs(w-1)?R=[E[2],E[3],E[0],E[1]]:console.warn("OBLIQUE ELLIPSE NOT YET SUPPORTED"),a.annotation.data={handles:{points:An(R),activeHandleIndex:0,textBox:{hasMoved:!1}},cachedStats:X({},"imageId:".concat(u),{area:o?o.MeasuredValueSequence.NumericValue:0}),frameNumber:c},a}},{key:"getTID300RepresentationArguments",value:function(A,e){var n=A.data,t=A.finding,i=A.findingSites,r=A.metadata,a=n.cachedStats,o=n.handles,s=r.referencedImageId;if(!s)throw Error("EllipticalROI.getTID300RepresentationArguments: referencedImageId is not defined");var c=e(s,o.points[0]),u=e(s,o.points[1]),l=e(s,o.points[2]),E=e(s,o.points[3]),S=Math.abs(c[1]-u[1]),g=Math.abs(l[0]-E[0]),I=[];S>g?(I.push({x:c[0],y:c[1]}),I.push({x:u[0],y:u[1]}),I.push({x:l[0],y:l[1]}),I.push({x:E[0],y:E[1]})):(I.push({x:l[0],y:l[1]}),I.push({x:E[0],y:E[1]}),I.push({x:c[0],y:c[1]}),I.push({x:u[0],y:u[1]}));var d=(void 0===a?{}:a)["imageId:".concat(s)]||{};return{area:d.area,mean:d.mean,max:d.max,min:d.min,stdDev:d.stdDev,points:I,trackingIdentifierTextValue:r5,finding:t,findingSites:i||[]}}}])}();r6.toolType=r3,r6.utilityToolType=r3,r6.TID300Representation=iZ,r6.isValidCornerstoneTrackingIdentifier=function(A){if(!A.includes(":"))return!1;var e=Ae(A.split(":"),2),n=e[0],t=e[1];return n===r_&&t.toLowerCase()===r3.toLowerCase()},rU.registerTool(r6);var r7=function(A){function e(){return J(this,e),U(this,e,arguments)}return j(e,A),K(e,[{key:"getPoints",value:function(){return this.props.points}},{key:"getConceptNameCodeSequence",value:function(){return tY({CodeValue:"111010",CodingSchemeDesignator:"DCM",CodeMeaning:"label"})}},{key:"getMeasuredValueSequence",value:function(){return{NumericValue:0,MeasurementUnitsCodeSequence:{CodeValue:"1",CodingSchemeDesignator:"UCUM",CodeMeaning:"no units"}}}}])}(ib),aA="ArrowAnnotate",ae="".concat(r_,":").concat(aA),an=rT.codeValues,at=rT.CodingSchemeDesignator,ai=function(){function A(){J(this,A)}return K(A,null,[{key:"getMeasurementData",value:function(e,n,t,i){for(var r=rU.getSetupMeasurementData(e,n,i,A.toolType),a=r.defaultState,o=r.SCOORDGroup,s=r.ReferencedFrameNumber,c=a.annotation.metadata.referencedImageId,u=a.annotation.metadata.label,l=o.GraphicData,E=[],S=0;S1&&void 0!==arguments[1]?arguments[1]:3;switch(e){case 1:return Math.abs(A);case 2:return Math.sqrt(A[0]*A[0]+A[1]*A[1]);case 3:return Math.sqrt(A[0]*A[0]+A[1]*A[1]+A[2]*A[2]);default:for(var n=0,t=0;t2&&void 0!==arguments[2]?arguments[2]:0;if(n+e.length>A.length)return!1;for(var t=n,i=0;i2&&void 0!==arguments[2]?arguments[2]:0,t=arguments.length>3?arguments[3]:void 0,i=A.length;t&&(i=Math.min(n+t,A.length));for(var r=n;r9?"":"0")+A}function aL(A){var e=A.getHours(),n=A.getMinutes(),t=A.getSeconds(),i=A.getMilliseconds();return ak(e)+ak(n)+ak(t)+i}function aq(A){var e=A.getFullYear(),n=A.getMonth()+1,t=A.getDate();return e+ak(n)+ak(t)}Object.freeze(a_);var aV=function(A){function e(){J(this,e);for(var A=arguments.length,n=Array(A),t=0;t1)throw Error("Only one of the following options should be provided: 'referencedRegions', 'referencedVolume', or 'referencedSegmentation'.");if(void 0!==A.referencedRegions){if(!("object"===x(A.referencedRegions)||A.referencedRegions instanceof Array))throw Error("Option 'referencedRegions' must have type Array.");if(0===A.referencedRegions.length)throw Error("Option 'referencedRegion' must have non-zero length.");A.referencedRegions.forEach(function(A){if(!A||!(A instanceof a6)&&!(A instanceof a7))throw Error("Items of option 'referencedRegion' must have type ImageRegion or ImageRegion3D.");t.ContentSequence.push(A)})}else if(void 0!==A.referencedVolume){if(!(A.referencedVolume instanceof oA))throw Error("Items of option 'referencedVolume' must have type VolumeSurface.");t.ContentSequence.push(A.referencedVolume)}else if(void 0!==A.referencedSegmentation){if(!(A.referencedSegmentation instanceof oi||A.referencedSegmentation instanceof ot))throw Error("Option 'referencedSegmentation' must have type ReferencedSegmentation or ReferencedSegmentationFrame.");t.ContentSequence.push(A.referencedSegmentation)}return n[0]=t,n}return j(e,A),K(e)}(oD),oh=function(A){function e(A){J(this,e);var n=[void 0!==A.referencedRegion,void 0!==A.referencedSegmentation].reduce(function(A,e){return A+e});if(0===n)throw Error("One of the following options must be provided: 'referencedRegion', 'referencedSegmentation'.");if(n>1)throw Error("Only one of the following options should be provided: 'referencedRegion', 'referencedSegmentation'.");return U(this,e,[{trackingIdentifier:A.trackingIdentifier,referencedRegions:[A.referencedRegion],referencedSegmentation:A.referencedSegmentation,referencedRealWorldValueMap:A.referencedRealWorldValueMap,timePointContext:A.timePointContext,findingType:A.findingType,session:A.session,measurements:A.measurements,qualitativeEvaluations:A.qualitativeEvaluations}])}return j(e,A),K(e)}(of),op=function(A){function e(A){return J(this,e),U(this,e,[{trackingIdentifier:A.trackingIdentifier,referencedRegions:A.referencedRegions,referencedSegmentation:A.referencedSegmentation,referencedRealWorldValueMap:A.referencedRealWorldValueMap,timePointContext:A.timePointContext,findingType:A.findingType,session:A.session,measurements:A.measurements,qualitativeEvaluations:A.qualitativeEvaluations}])}return j(e,A),K(e)}(of),oM=function(A){function e(A){if(J(this,e),n=U(this,e),void 0===A.derivation)throw Error("Option 'derivation' is required for MeasurementsDerivedFromMultipleROIMeasurements.");var n,t,i=new az({name:A.derivation});if(i.ContentSequence=new aV,void 0===A.measurementGroups)throw Error("Option 'measurementGroups' is required for MeasurementsDerivedFromMultipleROIMeasurements.");if(!("object"===x(A.measurementGroups)||A.measurementGroups instanceof Array))throw Error("Option 'measurementGroups' must have type Array.");if(A.measurementGroups.forEach(function(A){var e;if(!A||!(A instanceof oh)&&!(A instanceof op))throw Error("Items of option 'measurementGroups' must have type PlanarROIMeasurementsAndQualitativeEvaluations or VolumetricROIMeasurementsAndQualitativeEvaluations.");A[0].RelationshipType="R-INFERRED FROM",(e=i.ContentSequence).push.apply(e,An(A))}),void 0!==A.measurementProperties){if(!(A.measurementProperties instanceof os))throw Error("Option 'measurementProperties' must have type MeasurementProperties.");(t=i.ContentSequence).push.apply(t,An(A.measurementProperties))}return n.push(i),n}return j(e,A),K(e)}(oa),ow=function(A){function e(A){return J(this,e),U(this,e,[{trackingIdentifier:A.trackingIdentifier,referencedRealWorldValueMap:A.referencedRealWorldValueMap,timePointContext:A.timePointContext,findingType:A.findingType,session:A.session,measurements:A.measurements,qualitativeEvaluations:A.qualitativeEvaluations}])}return j(e,A),K(e)}(oD),oR=function(A){function e(A){var n;if(J(this,e),n=U(this,e),void 0!==A.method){var t=new aH({name:new av({value:"370129005",meaning:"Measurement Method",schemeDesignator:"SCT"}),value:A.method,relationshipType:a_.HAS_CONCEPT_MOD});n.push(t)}if(void 0!==A.findingSites){if(!("object"===x(A.findingSites)||A.findingSites instanceof Array))throw Error("Option 'findingSites' must have type Array.");A.findingSites.forEach(function(A){if(!A||!(A instanceof on))throw Error("Items of option 'findingSites' must have type FindingSite.");n.push(A)})}if(void 0===A.measurements)throw Error("Options 'measurements' is required ROIMeasurements.");if(!("object"===x(A.measurements)||A.measurements instanceof Array))throw Error("Option 'measurements' must have type Array.");if(0===A.measurements.length)throw Error("Option 'measurements' must have non-zero length.");return A.measurements.forEach(function(A){if(!A||!(A instanceof oo))throw Error("Items of option 'measurements' must have type Measurement.");n.push(A)}),n}return j(e,A),K(e)}(oa),oQ=function(A){function e(A){if(J(this,e),r=U(this,e),void 0===A.observationContext)throw Error("Option 'observationContext' is required for MeasurementReport.");if(void 0===A.procedureReported)throw Error("Option 'procedureReported' is required for MeasurementReport.");var n,t,i,r,a=new aZ({name:new av({value:"126000",schemeDesignator:"DCM",meaning:"Imaging Measurement Report"}),templateID:"1500"});if(a.ContentSequence=new aV,void 0===A.languageOfContentItemAndDescendants)throw Error("Option 'languageOfContentItemAndDescendants' is required for MeasurementReport.");if(!(A.languageOfContentItemAndDescendants instanceof oC))throw Error("Option 'languageOfContentItemAndDescendants' must have type LanguageOfContentItemAndDescendants.");if((n=a.ContentSequence).push.apply(n,An(A.languageOfContentItemAndDescendants)),(t=a.ContentSequence).push.apply(t,An(A.observationContext)),(A.procedureReported.constructor===av||A.procedureReported.constructor===ay)&&(A.procedureReported=[A.procedureReported]),!("object"===x(A.procedureReported)||A.procedureReported instanceof Array))throw Error("Option 'procedureReported' must have type Array.");A.procedureReported.forEach(function(A){var e=new aH({name:new av({value:"121058",meaning:"Procedure reported",schemeDesignator:"DCM"}),value:A,relationshipType:a_.HAS_CONCEPT_MOD});a.ContentSequence.push(e)});var o=new oT;if((i=a.ContentSequence).push.apply(i,An(o)),[void 0!==A.imagingMeasurements,void 0!==A.derivedImagingMeasurements,void 0!==A.qualitativeEvaluations].reduce(function(A,e){return A+e})>1)throw Error("Only one of the following options should be provided: 'imagingMeasurements', 'derivedImagingMeasurement', 'qualitativeEvaluations'.");if(void 0!==A.imagingMeasurements){var s=new aZ({name:new av({value:"126010",meaning:"Imaging Measurements",schemeDesignator:"DCM"}),relationshipType:a_.CONTAINS});s.ContentSequence=_(aV,An(A.imagingMeasurements)),a.ContentSequence.push(s)}else if(void 0!==A.derivedImagingMeasurements){var c=new aZ({name:new av({value:"126011",meaning:"Derived Imaging Measurements",schemeDesignator:"DCM"}),relationshipType:a_.CONTAINS});c.ContentSequence=_(aV,An(A.derivedImagingMeasurements)),a.ContentSequence.push(c)}else if(void 0!==A.qualitativeEvaluations){var u=new aZ({name:new av({value:"C0034375",meaning:"Qualitative Evaluations",schemeDesignator:"UMLS"}),relationshipType:a_.CONTAINS});u.ContentSequence=_(aV,An(A.qualitativeEvaluations)),a.ContentSequence.push(u)}return r.push(a),r}return j(e,A),K(e)}(oa),oP=function(A){function e(A){if(J(this,e),n=U(this,e),void 0===A.timePoint)throw Error("Option 'timePoint' is required for TimePointContext.");var n,t=new aY({name:new av({value:"C2348792",meaning:"Time Point",schemeDesignator:"UMLS"}),value:A.timePoint,relationshipType:a_.HAS_OBS_CONTEXT});if(n.push(t),void 0!==A.timePointType){var i=new aH({name:new av({value:"126072",meaning:"Time Point Type",schemeDesignator:"DCM"}),value:A.timePointType,relationshipType:a_.HAS_OBS_CONTEXT});n.push(i)}if(void 0!==A.timePointOrder){var r=new az({name:new av({value:"126073",meaning:"Time Point Order",schemeDesignator:"DCM"}),value:A.timePointOrder,relationshipType:a_.HAS_OBS_CONTEXT});n.push(r)}if(void 0!==A.subjectTimePointIdentifier){var a=new az({name:new av({value:"126070",meaning:"Subject Time Point Identifier",schemeDesignator:"DCM"}),value:A.subjectTimePointIdentifier,relationshipType:a_.HAS_OBS_CONTEXT});n.push(a)}if(void 0!==A.protocolTimePointIdentifier){var o=new az({name:new av({value:"126071",meaning:"Protocol Time Point Identifier",schemeDesignator:"DCM"}),value:A.protocolTimePointIdentifier,relationshipType:a_.HAS_OBS_CONTEXT});n.push(o)}return void 0!==A.temporalOffsetFromEvent&&n.push(A.temporalOffsetFromEvent),n}return j(e,A),K(e)}(oa),oT=function(A){function e(){J(this,e);var A=U(this,e),n=new aZ({name:new av({value:"111028",meaning:"Image Library",schemeDesignator:"DCM"}),relationshipType:a_.CONTAINS});return A.push(n),A}return j(e,A),K(e)}(oa),oy=function(A){function e(A){if(J(this,e),n=U(this,e),void 0===A.name)throw Error("Option 'name' is required for AlgorithmIdentification.");if(void 0===A.version)throw Error("Option 'version' is required for AlgorithmIdentification.");var n,t=new aY({name:new av({value:"111001",meaning:"Algorithm Name",schemeDesignator:"DCM"}),value:A.name,relationshipType:a_.HAS_CONCEPT_MOD});n.push(t);var i=new aY({name:new av({value:"111003",meaning:"Algorithm Version",schemeDesignator:"DCM"}),value:A.version,relationshipType:a_.HAS_CONCEPT_MOD});if(n.push(i),void 0!==A.parameters){if(!("object"===x(A.parameters)||A.parameters instanceof Array))throw Error("Option 'parameters' must have type Array.");A.parameters.forEach(function(A){var e=new aY({name:new av({value:"111002",meaning:"Algorithm Parameter",schemeDesignator:"DCM"}),value:A,relationshipType:a_.HAS_CONCEPT_MOD});n.push(e)})}return n}return j(e,A),K(e)}(oa),ov=function(A){function e(A){if(J(this,e),n=U(this,e),void 0===A.uid)throw Error("Option 'uid' is required for TrackingIdentifier.");if(void 0!==A.identifier){var n,t=new aY({name:new av({value:"112039",meaning:"Tracking Identifier",schemeDesignator:"DCM"}),value:A.identifier,relationshipType:a_.HAS_OBS_CONTEXT});n.push(t)}var i=new aj({name:new av({value:"112040",meaning:"Tracking Unique Identifier",schemeDesignator:"DCM"}),value:A.uid,relationshipType:a_.HAS_OBS_CONTEXT});return n.push(i),n}return j(e,A),K(e)}(oa),oO=Object.freeze({__proto__:null,AlgorithmIdentification:oy,DeviceObserverIdentifyingAttributes:og,ImageLibrary:oT,LanguageOfContentItemAndDescendants:oC,Measurement:oo,MeasurementAndQualitativeEvaluationGroup:ow,MeasurementReport:oQ,MeasurementsDerivedFromMultipleROIMeasurements:oM,ObservationContext:ol,ObserverContext:oE,PersonObserverIdentifyingAttributes:oS,PlanarROIMeasurementsAndQualitativeEvaluations:oh,ROIMeasurements:oR,SubjectContext:oI,SubjectContextDevice:om,SubjectContextFetus:od,SubjectContextSpecimen:oB,TimePointContext:oP,TrackingIdentifier:ov,VolumetricROIMeasurementsAndQualitativeEvaluations:op}),oN=["00080054","00080100","00080102","00080103","00080104","00080105","00080106","00080107","0008010B","0008010D","0008010F","00080117","00080118","00080119","00080120","00080121","00080122","00081120","00081150","00081155","00081160","00081190","00081199","00100010","00100020","00100021","00100022","00100024","00100026","00100027","00100028","00100030","00100032","00100033","00100034","00100035","00100040","00100200","00100212","00100213","00100214","00100215","00100216","00100217","00100218","00100219","00100221","00100222","00100223","00100229","00101001","00101002","00101100","00102160","00102201","00102202","00102292","00102293","00102294","00102295","00102296","00102297","00102298","00102299","00104000","00120062","00120063","00120064","0020000D","00400031","00400032","00400033","00400035","00400036","00400039","0040003A","0040E001","0040E010","0040E020","0040E021","0040E022","0040E023","0040E024","0040E025","0040E030","0040E031","0062000B","00880130","00880140","00080100","00080102","00080103","00080104","00080105","00080106","00080107","0008010B","0008010D","0008010F","00080117","00080118","00080119","00080120","00080121","00080122","00081080","00081084","00101010","00101020","00101021","00101022","00101023","00101024","00101030","00102000","00102110","00102180","001021A0","001021B0","001021C0","001021D0","00102203","00380010","00380014","00380060","00380062","00380064","00380500","00400031","00400032","00400033","00080020","00080030","00080050","00080051","00080080","00080081","00080082","00080090","00080096","0008009C","0008009D","00080100","00080102","00080103","00080104","00080105","00080106","00080107","0008010B","0008010D","0008010F","00080117","00080118","00080119","00080120","00080121","00080122","00081030","00081032","00081048","00081049","00081060","00081062","00081110","00081150","00081155","0020000D","00200010","00321034","00400031","00400032","00400033","00401012","00401101","00401102","00401103","00401104","00120010","00120020","00120021","00120030","00120031","00120040","00120042","00120081","00120082","00120020","00120050","00120051","00120052","00120053","00120083","00120084","00120085"],oG=Object.freeze({__proto__:null,Comprehensive3DSR:K(function A(e){var n=this;if(J(this,A),void 0===e.evidence)throw Error("Option 'evidence' is required for Comprehensive3DSR.");if(!("object"===x(e.evidence)||e.evidence instanceof Array))throw Error("Option 'evidence' must have type Array.");if(0===e.evidence.length)throw Error("Option 'evidence' must have non-zero length.");if(void 0===e.content)throw Error("Option 'content' is required for Comprehensive3DSR.");if(void 0===e.seriesInstanceUID)throw Error("Option 'seriesInstanceUID' is required for Comprehensive3DSR.");if(void 0===e.seriesNumber)throw Error("Option 'seriesNumber' is required for Comprehensive3DSR.");if(void 0===e.seriesDescription)throw Error("Option 'seriesDescription' is required for Comprehensive3DSR.");if(void 0===e.sopInstanceUID)throw Error("Option 'sopInstanceUID' is required for Comprehensive3DSR.");if(void 0===e.instanceNumber)throw Error("Option 'instanceNumber' is required for Comprehensive3DSR.");if(void 0===e.manufacturer)throw Error("Option 'manufacturer' is required for Comprehensive3DSR.");if(this.SOPClassUID="1.2.840.10008.5.1.4.1.1.88.34",this.SOPInstanceUID=e.sopInstanceUID,this.Modality="SR",this.SeriesDescription=e.seriesDescription,this.SeriesInstanceUID=e.seriesInstanceUID,this.SeriesNumber=e.seriesNumber,this.InstanceNumber=e.instanceNumber,this.Manufacturer=e.manufacturer,void 0!==e.institutionName&&(this.InstitutionName=e.institutionName,void 0!==e.institutionalDepartmentName&&(this.InstitutionalDepartmentName=e.institutionDepartmentName)),e.isComplete?this.CompletionFlag="COMPLETE":this.CompletionFlag="PARTIAL",e.isVerified){if(void 0===e.verifyingObserverName)throw Error("Verifying Observer Name must be specified if SR document has been verified.");if(void 0===e.verifyingOrganization)throw Error("Verifying Organization must be specified if SR document has been verified.");this.VerificationFlag="VERIFIED";var t={};t.VerifyingObserverName=e.verifyingObserverName,t.VerifyingOrganization=e.verifyingOrganization,t.VerificationDateTime=tJ.dateTime(),this.VerifyingObserverSequence=[t]}else this.VerificationFlag="UNVERIFIED";e.isFinal?this.PreliminaryFlag="FINAL":this.PreliminaryFlag="PRELIMINARY",this.ContentDate=tJ.date(),this.ContentTime=tJ.time(),Object.keys(e.content).forEach(function(A){n[A]=e.content[A]});var i={};e.evidence.forEach(function(A){if(A.StudyInstanceUID!==e.evidence[0].StudyInstanceUID)throw Error("Referenced data sets must all belong to the same study.");A.SeriesInstanceUID in i||(i[A.SeriesInstanceUID]=[]);var n={};n.ReferencedSOPClassUID=A.SOPClassUID,n.ReferencedSOPInstanceUID=A.SOPInstanceUID,i[A.SeriesInstanceUID].push(n)});var r={};if(r.StudyInstanceUID=e.evidence[0].StudyInstanceUID,r.ReferencedSeriesSequence=[],Object.keys(i).forEach(function(A){var e={};e.SeriesInstanceUID=A,e.ReferencedSOPSequence=i[A],r.ReferencedSeriesSequence.push(e)}),void 0!==e.requestedProcedures){if(!("object"===x(e.requestedProcedures)||e.requestedProcedures instanceof Array))throw Error("Option 'requestedProcedures' must have type Array.");this.ReferencedRequestSequence=_(aV,An(e.requestedProcedures)),this.CurrentRequestedProcedureEvidenceSequence=[r]}else this.PertinentOtherEvidenceSequence=[r];if(void 0!==e.previousVersions){var a={};e.previousVersions.forEach(function(A){if(A.StudyInstanceUID!=e.evidence[0].StudyInstanceUID)throw Error("Previous version data sets must belong to the same study.");var n={};n.ReferencedSOPClassUID=A.SOPClassUID,n.ReferencedSOPInstanceUID=A.SOPInstanceUID,a[A.SeriesInstanceUID].push(n)});var o={};o.StudyInstanceUID=e.previousVersions[0].StudyInstanceUID,o.ReferencedSeriesSequence=[],Object.keys(a).forEach(function(A){var e={};e.SeriesInstanceUID=A,e.ReferencedSOPSequence=a[A],o.ReferencedSeriesSequence.push(e)}),this.PredecessorDocumentsSequence=[o]}if(void 0!==e.performedProcedureCodes){if(!("object"===x(e.performedProcedureCodes)||e.performedProcedureCodes instanceof Array))throw Error("Option 'performedProcedureCodes' must have type Array.");this.PerformedProcedureCodeSequence=_(aV,An(e.performedProcedureCodes))}else this.PerformedProcedureCodeSequence=[];this.ReferencedPerformedProcedureStepSequence=[],oN.forEach(function(A){var t=tJ.punctuateTag(A),i=tJ.dictionary[t];if(void 0!==i){var r=i.name,a=e.evidence[0][r];void 0!==a&&(n[r]=a)}})})}),oF=["PatientID","PatientName","SeriesDate","AccessionNumber","SeriesDescription","StudyTime","ContentTime","ReferringPhysicianName","PatientBirthDate","PatientSex","ClinicalTrialSiteID","ClinicalTrialSiteName","ClinicalTrialSubjectID","ClinicalTrialSubjectReadingID","ClinicalTrialTimePointID","ClinicalTrialTimePointDescription","ContrastBolusAgent","StudyID","InstanceCreationDate","StudyDate","ContentDate","DateOfSecondaryCapture","DateOfLastCalibration","DateOfLastDetectorCalibration","FrameAcquisitionDatetime","FrameReferenceDatetime","StudyVerifiedDate","StudyReadDate","ScheduledStudyStartDate","ScheduledStudyStopDate","StudyArrivalDate","StudyCompletionDate","ScheduledAdmissionDate","ScheduledDischargeDate","DischargeDate","SPSStartDate","SPSEndDate","PPSStartDate","PPSEndDate","IssueDateOfImagingServiceRequest","VerificationDateTime","ObservationDateTime","DateTime","Date","RefDatetime","AcquisitionDate","OverlayDate","CurveDate","AcquisitionDatetime","SeriesTime","AcquisitionTime","OverlayTime","CurveTime","InstitutionName","InstitutionAddress","ReferringPhysicianAddress","ReferringPhysicianPhoneNumbers","ReferringPhysiciansIDSeq","TimezoneOffsetFromUTC","StationName","StudyDescription","InstitutionalDepartmentName","PhysicianOfRecord","PhysicianOfRecordIdSeq","PerformingPhysicianName","PerformingPhysicianIdSeq","NameOfPhysicianReadingStudy","PhysicianReadingStudyIdSeq","OperatorName","OperatorsIdentificationSeq","AdmittingDiagnosisDescription","AdmittingDiagnosisCodeSeq","RefStudySeq","RefPPSSeq","RefPatientSeq","RefImageSeq","DerivationDescription","SourceImageSeq","IdentifyingComments","IssuerOfPatientID","PatientBirthTime","PatientInsurancePlanCodeSeq","PatientPrimaryLanguageCodeSeq","PatientPrimaryLanguageModifierCodeSeq","OtherPatientIDs","OtherPatientNames","OtherPatientIDsSeq","PatientBirthName","PatientAge","PatientSize","PatientWeight","PatientAddress","InsurancePlanIdentification","PatientMotherBirthName","MilitaryRank","BranchOfService","MedicalRecordLocator","MedicalAlerts","ContrastAllergies","CountryOfResidence","RegionOfResidence","PatientPhoneNumbers","EthnicGroup","Occupation","SmokingStatus","AdditionalPatientHistory","PregnancyStatus","LastMenstrualDate","PatientReligiousPreference","PatientSexNeutered","ResponsiblePerson","ResponsibleOrganization","PatientComments","DeviceSerialNumber","PlateID","GeneratorID","CassetteID","GantryID","ProtocolName","AcquisitionDeviceProcessingDescription","AcquisitionComments","DetectorID","AcquisitionProtocolDescription","ContributionDescription","ModifyingDeviceID","ModifyingDeviceManufacturer","ModifiedImageDescription","ImageComments","ImagePresentationComments","StudyIDIssuer","ScheduledStudyLocation","ScheduledStudyLocationAET","ReasonforStudy","RequestingPhysician","RequestingService","RequestedProcedureDescription","RequestedContrastAgent","StudyComments","AdmissionID","IssuerOfAdmissionID","ScheduledPatientInstitutionResidence","AdmittingDate","AdmittingTime","DischargeDiagnosisDescription","SpecialNeeds","ServiceEpisodeID","IssuerOfServiceEpisodeId","ServiceEpisodeDescription","CurrentPatientLocation","PatientInstitutionResidence","PatientState","ReferencedPatientAliasSeq","VisitComments","ScheduledStationAET","ScheduledPerformingPhysicianName","SPSDescription","ScheduledStationName","SPSLocation","PreMedication","PerformedStationAET","PerformedStationName","PerformedLocation","PerformedStationNameCodeSeq","PPSID","PPSDescription","RequestAttributesSeq","PPSComments","AcquisitionContextSeq","PatientTransportArrangements","RequestedProcedureLocation","NamesOfIntendedRecipientsOfResults","IntendedRecipientsOfResultsIDSequence","PersonAddress","PersonTelephoneNumbers","RequestedProcedureComments","ReasonForTheImagingServiceRequest","OrderEnteredBy","OrderEntererLocation","OrderCallbackPhoneNumber","ImagingServiceRequestComments","ConfidentialityPatientData","ScheduledStationNameCodeSeq","ScheduledStationGeographicLocCodeSeq","PerformedStationGeoLocCodeSeq","ScheduledHumanPerformersSeq","ActualHumanPerformersSequence","HumanPerformersOrganization","HumanPerformersName","VerifyingOrganization","VerifyingObserverName","AuthorObserverSequence","ParticipantSequence","CustodialOrganizationSeq","VerifyingObserverIdentificationCodeSeq","PersonName","ContentSeq","OverlayData","OverlayComments","IconImageSequence","TopicSubject","TopicAuthor","TopicKeyWords","TextString","Arbitrary","TextComments","ResultsIDIssuer","InterpretationRecorder","InterpretationTranscriber","InterpretationText","InterpretationAuthor","InterpretationApproverSequence","PhysicianApprovingInterpretation","InterpretationDiagnosisDescription","ResultsDistributionListSeq","DistributionName","DistributionAddress","InterpretationIdIssuer","Impressions","ResultComments","DigitalSignaturesSeq","DataSetTrailingPadding"];tk=t8;var oU={DICOMWEB:t3,adapters:{Cornerstone:{Length:iY,FreehandRoi:iK,Bidirectional:iz,EllipticalRoi:i0,CircleRoi:i9,ArrowAnnotate:i5,MeasurementReport:iF,Segmentation:{generateSegmentation:function(A,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{includeSliceSpacing:!0},t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:4;return 4===t?rg.generateSegmentation(A,e,n):3===t?ro.generateSegmentation(A,e,n):void console.warn("No generateSegmentation adapater for cornerstone version ".concat(t,", exiting."))},generateToolState:function(A,e,n){var t=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.001,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:4;return 4===r?rg.generateToolState(A,e,n,t,i):3===r?ro.generateToolState(A,e,n):void console.warn("No generateToolState adapater for cornerstone version ".concat(r,", exiting."))},fillSegmentation:function(A,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{includeSliceSpacing:!0},t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:4;if(4===t)return rg.fillSegmentation(A,e,n);console.warn("No generateSegmentation adapater for cornerstone version ".concat(t,", exiting."))}},CobbAngle:rw,Angle:rQ,RectangleRoi:rP},Cornerstone3D:{Length:rL,Bidirectional:rx,EllipticalROI:r6,ArrowAnnotate:ai,Probe:ao,PlanarFreehandROI:au,MeasurementReport:rU,CodeScheme:rT,CORNERSTONE_3D_TAG:r_},VTKjs:{Segmentation:al},DICOMMicroscopyViewer:{Polyline:aS,Polygon:aI,Point:ad,Circle:aB,Ellipse:am,MeasurementReport:aE}},constants:nq,data:{BitArray:N,ReadBufferStream:nR,DeflatedReadBufferStream:nQ,WriteBufferStream:nP,DicomDict:tR,DicomMessage:tj,DicomMetaDictionary:tJ,Tag:tK,ValueRepresentation:nj,Colors:t5,datasetToDict:it,datasetToBuffer:ii,datasetToBlob:ir},derivations:{DerivedDataset:ia,DerivedPixels:io,DerivedImage:is,Segmentation:ic,StructuredReport:il,ParametricMap:iu},normalizers:{Normalizer:iE,ImageNormalizer:iS,MRImageNormalizer:ig,EnhancedMRImageNormalizer:id,EnhancedUSVolumeNormalizer:iB,CTImageNormalizer:iC,PETImageNormalizer:iD,SEGImageNormalizer:ih,DSRNormalizer:iM},sr:{coding:aO,contentItems:or,documents:oG,templates:oO,valueTypes:a9},utilities:{TID1500:{TID1500MeasurementReport:iQ,TID1501MeasurementGroup:iP},TID300:{TID300Measurement:iU,Point:i4,Length:iV,ArrowAnnotate:r7,CobbAngle:rp,Bidirectional:iX,Polyline:iW,Polygon:ag,Ellipse:iZ,Circle:i1,Calibration:aC,unit2CodingValue:iq},message:{containsToken:ap,findToken:aM,identifyBoundary:ah,uint8ArrayToString:aD,stringToUint8Array:af,multipartEncode:function(A){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:aw(),n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/dicom",t=af("\r\n--".concat(e,"\r\n").concat("Content-Type: ".concat(n),"\r\n\r\n")),i=af("\r\n--".concat(e,"--")),r=t.length,a=i.length,o=0,s=A.map(function(A){var e=new Uint8Array(A),n=e.length;return o+=r+n+a,e}),c=new Uint8Array(o);c.set(t,0);var u=0;return s.forEach(function(A){c.set(t,u),c.set(A,u+r),u+=r+A.length}),c.set(i,u),{data:c.buffer,boundary:e}},multipartDecode:function(A){var e,n=new Uint8Array(A),t=af("\r\n\r\n"),i=aM(n,t,0,1e3);if(-1===i)throw Error("Response message has no multipart mime header");var r=ah(aD(n,0,i));if(!r)throw Error("Header of response message does not specify boundary");for(var a=af(r),o=[],s=i+t.length;-1!==e&&-1!==(e=aM(n,a,s));){var c=e-s-2,u=A.slice(s,s+c);o.push(u);var l=aM(n,t,e+1,1e3);if(-1===l)break;s=l+t.length}return o},guid:aw},addAccessors:tY,orientation:ra,compression:rl,dicomJson:nH,DicomMetadataListener:t7,ArrayBufferExpanderFilter:{value:function(A,e){if(Array.isArray(e)&&e.length>0&&e.every(function(A){return A instanceof ArrayBuffer||ArrayBuffer.isView(A)})){var n=this.current;this.startObject([]);var t,i=Ar(e);try{for(i.s();!(t=i.n()).done;){var r=t.value;this.value(r)}}catch(A){i.e(A)}finally{i.f()}var a=this.pop();n.dest.Value=a.Value||a}else A(e)}},toFloat:np,toInt:nM,createInformationFilter:t6},log:v,anonymizer:{cleanTags:function(A){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;void 0==e&&(e={"00100010":"ANON^PATIENT","00100020":"ANON^ID"}),(void 0!=n?n:oF).forEach(function(n){var t=tJ.nameMap[n];if(t&&"PrivateTag"!=t.version){var i,r=t.tag,a=tK.fromPString(r).toCleanString();A[a]&&(i=a in e?[e[a]]:[],A[a]=nj.addTagAccessors(A[a]),A[a].Value=i)}})},getTagsNameToEmpty:function(){return[].concat(oF)}},async:{AsyncDicomReader:ie}};tR.setDicomMessageClass(tj),nj.setDicomMessageClass(tj),nj.setTagClass(tK),tK.setDicomMessageClass(tj)}}]); \ No newline at end of file diff --git a/_next/static/chunks/481.6d33ebcca51aa184.js b/_next/static/chunks/481.6d33ebcca51aa184.js new file mode 100644 index 0000000000000000000000000000000000000000..33886746c12e969f2e1bc213a63127815a8425a7 --- /dev/null +++ b/_next/static/chunks/481.6d33ebcca51aa184.js @@ -0,0 +1,558 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[481],{6547:(e,t,r)=>{r.d(t,{Ay:()=>w});var a=r(17042),n=r(11701),o=r(25881),s={States:{IS_START:0,IS_NONE:0,IS_ROTATE:1,IS_PAN:2,IS_SPIN:3,IS_DOLLY:4,IS_CAMERA_POSE:11,IS_WINDOW_LEVEL:1024,IS_SLICE:1025}},l=r(91923),{vtkErrorMacro:i,VOID:u}=a.Ay,c={enabled:!0,priority:0,processEvents:!0,subscribedEvents:[]};function d(e,t,r={}){Object.assign(t,c,r),a.Ay.obj(e,t),a.Ay.event(e,t,"InteractionEvent"),a.Ay.event(e,t,"StartInteractionEvent"),a.Ay.event(e,t,"EndInteractionEvent"),a.Ay.get(e,t,["_interactor","enabled"]),a.Ay.setGet(e,t,["priority","processEvents"]),a.Ay.moveToProtected(e,t,["interactor"]);t.classHierarchy.push("vtkInteractorObserver");let n={...e};function o(){for(;t.subscribedEvents.length;)t.subscribedEvents.pop().unsubscribe()}function s(){l.Ay.handledEvents.forEach(r=>{e[`handle${r}`]&&t.subscribedEvents.push(t._interactor[`on${r}`](a=>t.processEvents?e[`handle${r}`](a):u,t.priority))})}e.setInteractor=r=>{r!==t._interactor&&(o(),t._interactor=r,r&&t.enabled&&s(),e.modified())},e.setEnabled=r=>{r!==t.enabled&&(o(),r&&(t._interactor?s():i(` + The interactor must be set before subscribing to events + `)),t.enabled=r,e.modified())},e.computeDisplayToWorld=(e,r,a,n)=>e?t._interactor.getView().displayToWorld(r,a,n,e):null,e.computeWorldToDisplay=(e,r,a,n)=>e?t._interactor.getView().worldToDisplay(r,a,n,e):null,e.setPriority=e=>{n.setPriority(e)&&t._interactor&&(o(),s())}}var p={newInstance:a.Ay.newInstance(d,"vtkInteractorObserver"),extend:d,...{computeWorldToDisplay:function(e,t,r,a){return e.getRenderWindow().getViews()[0].worldToDisplay(t,r,a,e)},computeDisplayToWorld:function(e,t,r,a){return e.getRenderWindow().getViews()[0].displayToWorld(t,r,a,e)}}},{States:m}=s,g={Rotate:m.IS_ROTATE,Pan:m.IS_PAN,Spin:m.IS_SPIN,Dolly:m.IS_DOLLY,CameraPose:m.IS_CAMERA_POSE,WindowLevel:m.IS_WINDOW_LEVEL,Slice:m.IS_SLICE},h={state:m.IS_NONE,handleObservers:1,autoAdjustCameraClippingRange:1};function v(e,t,r={}){Object.assign(t,h,r),p.extend(e,t,r),a.Ay.setGet(e,t,["focusedRenderer"]),t.classHierarchy.push("vtkInteractorStyle"),Object.keys(g).forEach(r=>{a.Ay.event(e,t,`Start${r}Event`),e[`start${r}`]=()=>{t.state===m.IS_NONE&&(t.state=g[r],t._interactor.requestAnimation(e),e.invokeStartInteractionEvent({type:"StartInteractionEvent"}),e[`invokeStart${r}Event`]({type:`Start${r}Event`}))},a.Ay.event(e,t,`End${r}Event`),e[`end${r}`]=()=>{t.state===g[r]&&(t.state=m.IS_NONE,t._interactor.cancelAnimation(e),e.invokeEndInteractionEvent({type:"EndInteractionEvent"}),e[`invokeEnd${r}Event`]({type:`End${r}Event`}),t._interactor.render())}}),t.getRenderer=e=>t.focusedRenderer||e.pokedRenderer,e.handleKeyPress=e=>{let r=t._interactor;switch(e.key){case"r":case"R":t.getRenderer(e).resetCamera(),r.render();break;case"w":case"W":t.getRenderer(e).getActors().forEach(e=>{let t=e.getProperty();t.setRepresentationToWireframe&&t.setRepresentationToWireframe()}),r.render();break;case"s":case"S":t.getRenderer(e).getActors().forEach(e=>{let t=e.getProperty();t.setRepresentationToSurface&&t.setRepresentationToSurface()}),r.render();break;case"v":case"V":t.getRenderer(e).getActors().forEach(e=>{let t=e.getProperty();t.setRepresentationToPoints&&t.setRepresentationToPoints()}),r.render()}}}var f={newInstance:a.Ay.newInstance(v,"vtkInteractorStyle"),extend:v,...s},{States:S}=s,y={motionFactor:10,zoomFactor:10,wheelDolly:!1};function T(e,t,r={}){Object.assign(t,y,r),f.extend(e,t,r),a.Ay.setGet(e,t,["motionFactor","zoomFactor"]),t.classHierarchy.push("vtkInteractorStyleTrackballCamera"),e.handleMouseMove=r=>{let a=r.position,n=t.getRenderer(r);switch(t.state){case S.IS_ROTATE:e.handleMouseRotate(n,a),e.invokeInteractionEvent({type:"InteractionEvent"});break;case S.IS_PAN:e.handleMousePan(n,a),e.invokeInteractionEvent({type:"InteractionEvent"});break;case S.IS_DOLLY:t.wheelDolly||(e.handleMouseDolly(n,a),e.invokeInteractionEvent({type:"InteractionEvent"}));break;case S.IS_SPIN:e.handleMouseSpin(n,a),e.invokeInteractionEvent({type:"InteractionEvent"})}t.previousPosition=a},e.handleButton3D=r=>{if(r&&r.pressed&&r.device===o.pF.RightController&&(r.input===o.pd.Trigger||r.input===o.pd.TrackPad))return void e.startCameraPose();r&&!r.pressed&&r.device===o.pF.RightController&&(r.input===o.pd.Trigger||r.input===o.pd.TrackPad)&&t.state===S.IS_CAMERA_POSE&&e.endCameraPose()},e.handleMove3D=r=>{t.state===S.IS_CAMERA_POSE&&e.updateCameraPose(r)},e.updateCameraPose=e=>{let r=t.getRenderer(e).getActiveCamera(),a=r.getPhysicalTranslation(),n=.025*r.getPhysicalScale(),o=r.physicalOrientationToWorldDirection([e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w]);r.setPhysicalTranslation(a[0]+o[0]*n,a[1]+o[1]*n,a[2]+o[2]*n)},e.handleLeftButtonPress=r=>{t.previousPosition=r.position,r.shiftKey?r.controlKey||r.altKey?e.startDolly():e.startPan():r.controlKey||r.altKey?e.startSpin():e.startRotate()},e.handleLeftButtonRelease=()=>{switch(t.state){case S.IS_DOLLY:e.endDolly();break;case S.IS_PAN:e.endPan();break;case S.IS_SPIN:e.endSpin();break;case S.IS_ROTATE:e.endRotate()}},e.handleStartMouseWheel=()=>{t.wheelDolly=!0,e.startDolly()},e.handleEndMouseWheel=()=>{e.endDolly(),t.wheelDolly=!1},e.handleStartPinch=r=>{t.previousScale=r.scale,e.startDolly()},e.handleEndPinch=()=>{e.endDolly()},e.handleStartRotate=r=>{t.previousRotation=r.rotation,e.startRotate()},e.handleEndRotate=()=>{e.endRotate()},e.handleStartPan=r=>{t.previousTranslation=r.translation,e.startPan()},e.handleEndPan=()=>{e.endPan()},e.handlePinch=r=>{e.dollyByFactor(t.getRenderer(r),r.scale/t.previousScale),t.previousScale=r.scale},e.handlePan=r=>{let a=t.getRenderer(r).getActiveCamera(),n=a.getFocalPoint(),o=(n=e.computeWorldToDisplay(t.getRenderer(r),n[0],n[1],n[2]))[2],s=r.translation,l=t.previousTranslation,i=e.computeDisplayToWorld(t.getRenderer(r),n[0]+s[0]-l[0],n[1]+s[1]-l[1],o),u=e.computeDisplayToWorld(t.getRenderer(r),n[0],n[1],o),c=[];c[0]=u[0]-i[0],c[1]=u[1]-i[1],c[2]=u[2]-i[2],n=a.getFocalPoint();let d=a.getPosition();a.setFocalPoint(c[0]+n[0],c[1]+n[1],c[2]+n[2]),a.setPosition(c[0]+d[0],c[1]+d[1],c[2]+d[2]),t._interactor.getLightFollowCamera()&&t.getRenderer(r).updateLightsGeometryToFollowCamera(),a.orthogonalizeViewUp(),t.previousTranslation=r.translation},e.handleRotate=e=>{let r=t.getRenderer(e).getActiveCamera();r.roll(e.rotation-t.previousRotation),r.orthogonalizeViewUp(),t.previousRotation=e.rotation},e.handleMouseRotate=(e,r)=>{if(!t.previousPosition)return;let a=t._interactor,n=r.x-t.previousPosition.x,o=r.y-t.previousPosition.y,s=a.getView().getViewportSize(e),l=-.1,i=-.1;s[0]&&s[1]&&(l=-20/s[1],i=-20/s[0]);let u=n*i*t.motionFactor,c=o*l*t.motionFactor,d=e.getActiveCamera();Number.isNaN(u)||Number.isNaN(c)||(d.azimuth(u),d.elevation(c),d.orthogonalizeViewUp()),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange(),a.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()},e.handleMouseSpin=(e,r)=>{if(!t.previousPosition)return;let a=t._interactor,o=e.getActiveCamera(),s=a.getView().getViewportCenter(e),l=(0,n.WK)(Math.atan2(t.previousPosition.y-s[1],t.previousPosition.x-s[0])),i=(0,n.WK)(Math.atan2(r.y-s[1],r.x-s[0]))-l;Number.isNaN(i)||(o.roll(i),o.orthogonalizeViewUp())},e.handleMousePan=(r,a)=>{if(!t.previousPosition)return;let n=r.getActiveCamera(),o=n.getFocalPoint(),s=(o=e.computeWorldToDisplay(r,o[0],o[1],o[2]))[2],l=e.computeDisplayToWorld(r,a.x,a.y,s),i=e.computeDisplayToWorld(r,t.previousPosition.x,t.previousPosition.y,s),u=[];u[0]=i[0]-l[0],u[1]=i[1]-l[1],u[2]=i[2]-l[2],o=n.getFocalPoint();let c=n.getPosition();n.setFocalPoint(u[0]+o[0],u[1]+o[1],u[2]+o[2]),n.setPosition(u[0]+c[0],u[1]+c[1],u[2]+c[2]),t._interactor.getLightFollowCamera()&&r.updateLightsGeometryToFollowCamera()},e.handleMouseDolly=(r,a)=>{if(!t.previousPosition)return;let n=a.y-t.previousPosition.y,o=t._interactor.getView().getViewportCenter(r),s=t.motionFactor*n/o[1];e.dollyByFactor(r,1.1**s)},e.handleMouseWheel=r=>{let a=1-r.spinY/t.zoomFactor;e.dollyByFactor(t.getRenderer(r),a)},e.dollyByFactor=(e,r)=>{if(Number.isNaN(r))return;let a=e.getActiveCamera();a.getParallelProjection()?a.setParallelScale(a.getParallelScale()/r):(a.dolly(r),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange()),t._interactor.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()}}var w={newInstance:a.Ay.newInstance(T,"vtkInteractorStyleTrackballCamera"),extend:T}},36481:(e,t,r)=>{r.d(t,{Ay:()=>eV});var a=r(17042),n=r(87352);function o(e){return e}function s(e){return null===e||"null"===e?null:"true"===e||"false"!==e&&(void 0!==e&&"undefined"!==e?"["===e[0]&&"]"===e[e.length-1]?e.substring(1,e.length-1).split(",").map(e=>s(e.trim())):""===e||Number.isNaN(Number(e))?e:Number(e):void 0)}r(30536);var l=r(19047),i=r(91923);r(89473),r(12412);var u=r(6547),c=r(1943),d=r(628);r(67368);var p=r(47224),m=r(68916),g=r(72288),h=r(57787),v=r(72867),f=r(59780),{vtkErrorMacro:S}=a.o$,y=["setBindGroup","setIndexBuffer","setVertexBuffer","draw","drawIndexed"],T={description:null,handle:null,boundPipeline:null,pipelineHash:null,pipelineSettings:null,replaceShaderCodeFunction:null,depthTextureView:null,label:null},w={newInstance:(0,a.UI)(function(e,t,r={}){Object.assign(t,T,r),(0,a.WL)(e,t),t.description={colorAttachments:[{view:void 0,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:void 0,depthLoadOp:"clear",depthClearValue:0,depthStoreOp:"store"}},t.replaceShaderCodeFunction=e=>{let t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let r=t.getCode();r=f.Ay.substitute(r,"//VTK::RenderEncoder::Impl",["output.outColor = computedColor;"]).result,t.setCode(r)},t.pipelineSettings={primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater-equal",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]}},t.colorTextureViews=[],(0,a.Jt)(e,t,["boundPipeline","colorTextureViews"]),(0,a.V0)(e,t,["depthTextureView","description","handle","label","pipelineHash","pipelineSettings","replaceShaderCodeFunction"]);t.classHierarchy.push("vtkWebGPURenderEncoder"),e.begin=e=>{t.drawCallbacks=[],t.handle=e.beginRenderPass(t.description),t.label&&t.handle.pushDebugGroup(t.label)},e.end=()=>{for(let r=0;r{if(t.boundPipeline===e)return;t.handle.setPipeline(e.getHandle());let r=e.getPipelineDescription(),a=r.fragment?.targets;if(t.colorTextureViews.length!==a.length)console.log(`mismatched attachment counts on pipeline ${a.length} while encoder has ${t.colorTextureViews.length}`),console.trace();else for(let e=0;e{t.replaceShaderCodeFunction(e)},e.setColorTextureView=(e,r)=>{t.colorTextureViews[e]!==r&&(t.colorTextureViews[e]=r)},e.activateBindGroup=e=>{let r=t.boundPipeline.getDevice(),a=t.boundPipeline.getBindGroupLayoutIndex(e.getLabel());if(a<0)return void S(`vtkWebGPURenderEncoder: could not find bind group layout ${e.getLabel()}`);t.handle.setBindGroup(a,e.getBindGroup(r));let n=r.getBindGroupLayoutDescription(e.getBindGroupLayout(r)),o=r.getBindGroupLayoutDescription(t.boundPipeline.getBindGroupLayout(a));n!==o&&(console.log(`renderEncoder ${t.pipelineHash} mismatched bind group layouts bind group has +${n} + versus pipeline +${o} +`),console.trace())},e.attachTextureViews=()=>{for(let e=0;e{for(let a=0;at.handle[y[r]](...e)},"vtkWebGPURenderEncoder")},C=r(51555),P=r(43561),x=r(65020),b={renderEncoder:null,colorTexture:null,depthTexture:null},I={newInstance:a.Ay.newInstance(function(e,t,r={}){Object.assign(t,b,r),m.Ay.extend(e,t,r),a.Ay.get(e,t,["colorTexture","depthTexture"]),t.classHierarchy.push("vtkWebGPUOpaquePass"),e.traverse=(r,a)=>{if(t.deleted)return;t._currentParent=a;let n=a.getDevice();if(t.renderEncoder)t.colorTexture.resize(a.getCanvas().width,a.getCanvas().height),t.depthTexture.resize(a.getCanvas().width,a.getCanvas().height);else{e.createRenderEncoder(),t.colorTexture=x.Ay.newInstance({label:"opaquePassColor"}),t.colorTexture.create(n,{width:a.getCanvas().width,height:a.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});let r=t.colorTexture.createView("opaquePassColorTexture");t.renderEncoder.setColorTextureView(0,r),t.depthFormat="depth32float",t.depthTexture=x.Ay.newInstance({label:"opaquePassDepth"}),t.depthTexture.create(n,{width:a.getCanvas().width,height:a.getCanvas().height,format:t.depthFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});let o=t.depthTexture.createView("opaquePassDepthTexture");t.renderEncoder.setDepthTextureView(o)}t.renderEncoder.attachTextureViews(),e.setCurrentOperation("opaquePass"),r.setRenderEncoder(t.renderEncoder),r.traverse(e)},e.getColorTextureView=()=>t.renderEncoder.getColorTextureViews()[0],e.getDepthTextureView=()=>t.renderEncoder.getDepthTextureView(),e.createRenderEncoder=()=>{t.renderEncoder=w.newInstance({label:"OpaquePass"}),t.renderEncoder.setPipelineHash("op")},e.releaseGraphicsResources=()=>{t.renderEncoder=null,t.colorTexture=null,t.depthTexture=null}},"vtkWebGPUOpaquePass")},R=` +//VTK::Mapper::Dec + +//VTK::TCoord::Dec + +//VTK::RenderEncoder::Dec + +//VTK::IOStructs::Dec + +@fragment +fn main( +//VTK::IOStructs::Input +) +//VTK::IOStructs::Output +{ + var output: fragmentOutput; + + var tcoord: vec2 = vec2(i32(input.fragPos.x), i32(input.fragPos.y)); + var reveal: f32 = textureLoad(oitpAccumTexture, tcoord, 0).r; + if (reveal == 1.0) { discard; } + var tcolor: vec4 = textureLoad(oitpColorTexture, tcoord, 0); + var total: f32 = max(tcolor.a, 0.01); + var computedColor: vec4 = vec4(tcolor.r/total, tcolor.g/total, tcolor.b/total, 1.0 - reveal); + + //VTK::RenderEncoder::Impl + return output; +} +`,E={colorTextureView:null,depthTextureView:null},V={newInstance:a.Ay.newInstance(function(e,t,r={}){Object.assign(t,E,r),m.Ay.extend(e,t,r),a.Ay.setGet(e,t,["colorTextureView","depthTextureView"]),t.classHierarchy.push("vtkWebGPUOrderIndependentTranslucentPass"),e.traverse=(r,a)=>{if(t.deleted)return;t._currentParent=a;let n=a.getDevice();if(t.translucentRenderEncoder)t.translucentColorTexture.resizeToMatch(t.colorTextureView.getTexture()),t.translucentAccumulateTexture.resizeToMatch(t.colorTextureView.getTexture());else{e.createRenderEncoder(),e.createFinalEncoder(),t.translucentColorTexture=x.Ay.newInstance({label:"translucentPassColor"}),t.translucentColorTexture.create(n,{width:a.getCanvas().width,height:a.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});let r=t.translucentColorTexture.createView("oitpColorTexture");t.translucentRenderEncoder.setColorTextureView(0,r),t.translucentAccumulateTexture=x.Ay.newInstance({label:"translucentPassAccumulate"}),t.translucentAccumulateTexture.create(n,{width:a.getCanvas().width,height:a.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});let o=t.translucentAccumulateTexture.createView("oitpAccumTexture");t.translucentRenderEncoder.setColorTextureView(1,o),t.fullScreenQuad=v.Ay.newInstance(),t.fullScreenQuad.setDevice(a.getDevice()),t.fullScreenQuad.setPipelineHash("oitpfsq"),t.fullScreenQuad.setTextureViews(t.translucentRenderEncoder.getColorTextureViews()),t.fullScreenQuad.setFragmentShaderTemplate(R)}t.translucentRenderEncoder.setDepthTextureView(t.depthTextureView),t.translucentRenderEncoder.attachTextureViews(),e.setCurrentOperation("translucentPass"),r.setRenderEncoder(t.translucentRenderEncoder),r.traverse(e),e.finalPass(a,r)},e.finalPass=(e,r)=>{t.translucentFinalEncoder.setColorTextureView(0,t.colorTextureView),t.translucentFinalEncoder.attachTextureViews(),t.translucentFinalEncoder.begin(e.getCommandEncoder()),r.scissorAndViewport(t.translucentFinalEncoder),t.fullScreenQuad.prepareAndDraw(t.translucentFinalEncoder),t.translucentFinalEncoder.end()},e.getTextures=()=>[t.translucentColorTexture,t.translucentAccumulateTexture],e.createRenderEncoder=()=>{t.translucentRenderEncoder=w.newInstance({label:"translucentRender"});let e=t.translucentRenderEncoder.getDescription();e.colorAttachments=[{view:void 0,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:void 0,clearValue:[1,0,0,0],loadOp:"clear",storeOp:"store"}],e.depthStencilAttachment={view:void 0,depthLoadOp:"load",depthStoreOp:"store"},t.translucentRenderEncoder.setReplaceShaderCodeFunction(e=>{let t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addOutput("f32","outAccum"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let r=t.getCode();r=f.Ay.substitute(r,"//VTK::RenderEncoder::Impl",["var w: f32 = computedColor.a * pow(0.1 + input.fragPos.z, 2.0);","output.outColor = vec4(computedColor.rgb*w, w);","output.outAccum = computedColor.a;"]).result,t.setCode(r)}),t.translucentRenderEncoder.setPipelineHash("oitpr"),t.translucentRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!1,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcFactor:"one",dstFactor:"one"}}},{format:"r16float",blend:{color:{srcFactor:"zero",dstFactor:"one-minus-src"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createFinalEncoder=()=>{t.translucentFinalEncoder=w.newInstance({label:"translucentFinal"}),t.translucentFinalEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t.translucentFinalEncoder.setReplaceShaderCodeFunction(e=>{let t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let r=t.getCode();r=f.Ay.substitute(r,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(r)}),t.translucentFinalEncoder.setPipelineHash("oitpf"),t.translucentFinalEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.releaseGraphicsResources=()=>{t.translucentRenderEncoder=null,t.translucentFinalEncoder=null,t.translucentColorTexture=null,t.translucentAccumulateTexture=null,t.fullScreenQuad=null}},"vtkWebGPUOrderIndependentTranslucentPass")},A=r(11701),_=r(70125),D=r(44293),B=r(44238),O=r(40577),N=r(23985),U=r(53038),M=r(55540),F=r(53014),G=r(85250),z=` +//VTK::Renderer::Dec + +//VTK::Mapper::Dec + +//VTK::TCoord::Dec + +//VTK::Volume::TraverseDec + +//VTK::RenderEncoder::Dec + +//VTK::IOStructs::Dec + +fn getTextureValue(vTex: texture_3d, tpos: vec4) -> f32 +{ + // todo multicomponent support + return textureSampleLevel(vTex, clampSampler, tpos.xyz, 0.0).r; +} + +fn intersectRayBoundsWithClipPlanes(vNum: i32, minPosSC: vec4, rayStepSC: vec4, rayBounds: vec2) -> vec2 +{ + var result: vec2 = rayBounds; + let clipCount: i32 = i32(volumeSSBO.values[vNum].clipPlaneStates.x); + if (clipCount <= 0) + { + return result; + } + + ${Array.from({length:6},(e,t)=>` + if (clipCount > ${t}) + { + let clipPlane${t}: vec4 = volumeSSBO.values[vNum].clipPlane${t}; + let rayDirRatio${t}: f32 = dot(rayStepSC, clipPlane${t}); + let equationResult${t}: f32 = dot(minPosSC, clipPlane${t}); + + let absRayDirRatio${t}: f32 = abs(rayDirRatio${t}); + if (absRayDirRatio${t} > 1e-6) + { + let intersection${t}: f32 = -equationResult${t} / rayDirRatio${t}; + result.x = select(result.x, max(result.x, intersection${t}), rayDirRatio${t} > 0.0); + result.y = select(result.y, min(result.y, intersection${t}), rayDirRatio${t} < 0.0); + } + else if (equationResult${t} < 0.0) + { + result.x = result.y; + } + + if (result.x >= result.y) + { + return result; + } + }`).join("\n")} + + return result; +} + +fn getGradient(vTex: texture_3d, tpos: vec4, vNum: i32, scalar: f32) -> vec4 +{ + var result: vec4; + + var tstep: vec4 = volumeSSBO.values[vNum].tstep; + result.x = getTextureValue(vTex, tpos + vec4(tstep.x, 0.0, 0.0, 1.0)) - scalar; + result.y = getTextureValue(vTex, tpos + vec4(0.0, tstep.y, 0.0, 1.0)) - scalar; + result.z = getTextureValue(vTex, tpos + vec4(0.0, 0.0, tstep.z, 1.0)) - scalar; + result.w = 0.0; + + // divide by spacing as that is our delta + result = result / volumeSSBO.values[vNum].spacing; + // now we have a gradient in unit tcoords + + var grad: f32 = length(result.xyz); + if (grad > 0.0) + { + // rotate to View Coords, needed for lighting and shading + var nMat: mat4x4 = rendererUBO.SCVCMatrix * volumeSSBO.values[vNum].planeNormals; + result = nMat * result; + result = result / length(result); + } + + // store gradient magnitude in .w + result.w = grad; + + return result; +} + +fn processVolume(vTex: texture_3d, vNum: i32, cNum: i32, posSC: vec4, tfunRows: f32) -> vec4 +{ + var outColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0); + + // convert to tcoords and reject if outside the volume + var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*posSC; + if (tpos.x < 0.0 || tpos.y < 0.0 || tpos.z < 0.0 || + tpos.x > 1.0 || tpos.y > 1.0 || tpos.z > 1.0) { return outColor; } + + var scalar: f32 = getTextureValue(vTex, tpos); + + var coord: vec2 = + vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift, + (0.5 + 2.0 * f32(vNum)) / tfunRows); + var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0); + + var gofactor: f32 = 1.0; + var normal: vec4 = vec4(0.0,0.0,0.0,0.0); + if (componentSSBO.values[cNum].gomin < 1.0 || volumeSSBO.values[vNum].shade[0] > 0.0) + { + normal = getGradient(vTex, tpos, vNum, scalar); + if (componentSSBO.values[cNum].gomin < 1.0) + { + gofactor = clamp(normal.a*componentSSBO.values[cNum].goScale + componentSSBO.values[cNum].goShift, + componentSSBO.values[cNum].gomin, componentSSBO.values[cNum].gomax); + } + } + + coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift); + var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r; + + if (volumeSSBO.values[vNum].shade[0] > 0.0) + { + color = color*abs(normal.z); + } + + outColor = vec4(color.rgb, gofactor * opacity); + + return outColor; +} + +// adjust the start and end point of a raycast such that it intersects the unit cube. +// This function is used to take a raycast starting point and step vector +// and numSteps and return the startijng and ending steps for intersecting the +// unit cube. Recall for a 3D texture, the unit cube is the range of texture coordsinates +// that have valid values. So this funtion can be used to take a ray in texture coordinates +// and bound it to intersecting the texture. +// +fn adjustBounds(tpos: vec4, tstep: vec4, numSteps: f32) -> vec2 +{ + var result: vec2 = vec2(0.0, numSteps); + var tpos2: vec4 = tpos + tstep*numSteps; + + // move tpos to the start of the volume + var adjust: f32 = + min( + max(tpos.x/tstep.x, (tpos.x - 1.0)/tstep.x), + min( + max((tpos.y - 1.0)/tstep.y, tpos.y/tstep.y), + max((tpos.z - 1.0)/tstep.z, tpos.z/tstep.z))); + if (adjust < 0.0) + { + result.x = result.x - adjust; + } + + // adjust length to the end + adjust = + max( + min(tpos2.x/tstep.x, (tpos2.x - 1.0)/tstep.x), + max( + min((tpos2.y - 1.0)/tstep.y, tpos2.y/tstep.y), + min((tpos2.z - 1.0)/tstep.z, tpos2.z/tstep.z))); + if (adjust > 0.0) + { + result.y = result.y - adjust; + } + + return result; +} + +fn getSimpleColor(scalar: f32, vNum: i32, cNum: i32) -> vec4 +{ + // how many rows (tfuns) do we have in our tfunTexture + var tfunRows: f32 = f32(textureDimensions(tfunTexture).y); + + var coord: vec2 = + vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift, + (0.5 + 2.0 * f32(vNum)) / tfunRows); + var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0); + coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift); + var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r; + return vec4(color.rgb, opacity); +} + +fn traverseMax(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4) +{ + // convert to tcoords and reject if outside the volume + var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance; + var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC; + var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC); + var tstep: vec4 = tpos2 - tpos; + + var rayBounds: vec2 = intersectRayBoundsWithClipPlanes( + vNum, + minPosSC, + rayStepSC, + adjustBounds(tpos, tstep, numSteps)); + + // did we hit anything + if (rayBounds.x >= rayBounds.y) + { + traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0); + return; + } + + tpos = tpos + tstep*rayBounds.x; + var curDist: f32 = rayBounds.x; + var maxVal: f32 = -1.0e37; + loop + { + var scalar: f32 = getTextureValue(vTex, tpos); + if (scalar > maxVal) + { + maxVal = scalar; + } + + // increment position + curDist = curDist + 1.0; + tpos = tpos + tstep; + + // check if we have reached a terminating condition + if (curDist > rayBounds.y) { break; } + } + + // process to get the color and opacity + traverseVals[vNum] = getSimpleColor(maxVal, vNum, cNum); +} + +fn traverseMin(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4) +{ + // convert to tcoords and reject if outside the volume + var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance; + var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC; + var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC); + var tstep: vec4 = tpos2 - tpos; + + var rayBounds: vec2 = intersectRayBoundsWithClipPlanes( + vNum, + minPosSC, + rayStepSC, + adjustBounds(tpos, tstep, numSteps)); + + // did we hit anything + if (rayBounds.x >= rayBounds.y) + { + traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0); + return; + } + + tpos = tpos + tstep*rayBounds.x; + var curDist: f32 = rayBounds.x; + var minVal: f32 = 1.0e37; + loop + { + var scalar: f32 = getTextureValue(vTex, tpos); + if (scalar < minVal) + { + minVal = scalar; + } + + // increment position + curDist = curDist + 1.0; + tpos = tpos + tstep; + + // check if we have reached a terminating condition + if (curDist > rayBounds.y) { break; } + } + + // process to get the color and opacity + traverseVals[vNum] = getSimpleColor(minVal, vNum, cNum); +} + +fn traverseAverage(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4) +{ + // convert to tcoords and reject if outside the volume + var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance; + var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC; + var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC); + var tstep: vec4 = tpos2 - tpos; + + var rayBounds: vec2 = intersectRayBoundsWithClipPlanes( + vNum, + minPosSC, + rayStepSC, + adjustBounds(tpos, tstep, numSteps)); + + // did we hit anything + if (rayBounds.x >= rayBounds.y) + { + traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0); + return; + } + + let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange; + tpos = tpos + tstep*rayBounds.x; + var curDist: f32 = rayBounds.x; + var avgVal: f32 = 0.0; + var sampleCount: f32 = 0.0; + loop + { + var sample: f32 = getTextureValue(vTex, tpos); + // right now leave filtering off until WebGL changes get merged + // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y) + // { + avgVal = avgVal + sample; + sampleCount = sampleCount + 1.0; + // } + + // increment position + curDist = curDist + 1.0; + tpos = tpos + tstep; + + // check if we have reached a terminating condition + if (curDist > rayBounds.y) { break; } + } + + if (sampleCount <= 0.0) + { + traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0); + return; + } + + // process to get the color and opacity + traverseVals[vNum] = getSimpleColor(avgVal/sampleCount, vNum, cNum); +} + +fn traverseAdditive(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4) +{ + // convert to tcoords and reject if outside the volume + var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance; + var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC; + var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC); + var tstep: vec4 = tpos2 - tpos; + + var rayBounds: vec2 = intersectRayBoundsWithClipPlanes( + vNum, + minPosSC, + rayStepSC, + adjustBounds(tpos, tstep, numSteps)); + + // did we hit anything + if (rayBounds.x >= rayBounds.y) + { + traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0); + return; + } + + let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange; + tpos = tpos + tstep*rayBounds.x; + var curDist: f32 = rayBounds.x; + var sumVal: f32 = 0.0; + loop + { + var sample: f32 = getTextureValue(vTex, tpos); + // right now leave filtering off until WebGL changes get merged + // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y) + // { + sumVal = sumVal + sample; + // } + // increment position + curDist = curDist + 1.0; + tpos = tpos + tstep; + + // check if we have reached a terminating condition + if (curDist > rayBounds.y) { break; } + } + + // process to get the color and opacity + traverseVals[vNum] = getSimpleColor(sumVal, vNum, cNum); +} + +fn composite(rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4) -> vec4 +{ + // initial ray position is at the beginning + var rayPosSC: vec4 = minPosSC; + + // how many rows (tfuns) do we have in our tfunTexture + var tfunRows: f32 = f32(textureDimensions(tfunTexture).y); + + var curDist: f32 = 0.0; + var computedColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0); + var sampleColor: vec4; + var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance; +//VTK::Volume::TraverseCalls +//VTK::Volume::TraverseInit + + loop + { + // for each volume, sample and accumulate color +//VTK::Volume::CompositeCalls + + // increment position + curDist = curDist + mapperUBO.SampleDistance; + rayPosSC = rayPosSC + rayStepSC; + + // check if we have reached a terminating condition + if (curDist > rayLengthSC) { break; } + if (computedColor.a > 0.98) { break; } + } + return computedColor; +} + +@fragment +fn main( +//VTK::IOStructs::Input +) +//VTK::IOStructs::Output +{ + var output: fragmentOutput; + + var rayMax: f32 = textureSampleLevel(maxTexture, clampSampler, input.tcoordVS, 0.0).r; + var rayMin: f32 = textureSampleLevel(minTexture, clampSampler, input.tcoordVS, 0.0).r; + + // discard empty rays + if (rayMax <= rayMin) { discard; } + else + { + // compute start and end ray positions in view coordinates + var minPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMax, 1.0); + minPosSC = minPosSC * (1.0 / minPosSC.w); + var maxPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMin, 1.0); + maxPosSC = maxPosSC * (1.0 / maxPosSC.w); + + var rayLengthSC: f32 = distance(minPosSC.xyz, maxPosSC.xyz); + var rayStepSC: vec4 = (maxPosSC - minPosSC)*(mapperUBO.SampleDistance/rayLengthSC); + rayStepSC.w = 0.0; + + var computedColor: vec4; + +//VTK::Volume::Loop + +//VTK::RenderEncoder::Impl + } + + return output; +} +`,W=new Float64Array(16),L=new Float64Array(16),k={volumes:null,rowLength:1024,lastVolumeLength:0},$={newInstance:a.Ay.newInstance(function(e,t,r={}){Object.assign(t,k,r),v.Ay.extend(e,t,r),t.fragmentShaderTemplate=z,t.UBO=O.Ay.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SampleDistance","f32"),t.SSBO=M.Ay.newInstance({label:"volumeSSBO"}),t.componentSSBO=M.Ay.newInstance({label:"componentSSBO"}),t.lutBuildTime={},a.Ay.obj(t.lutBuildTime,{mtime:0}),t.clipPlanes=Array.from({length:6},()=>[0,0,0,0]);t.classHierarchy.push("vtkWebGPUVolumePassFSQ"),e.replaceShaderPosition=(e,t,r)=>{let a=t.getShaderDescription("vertex");a.addBuiltinOutput("vec4","@builtin(position) Position");let n=a.getCode();n=f.Ay.substitute(n,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);"]).result,a.setCode(n),t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderVolume=(e,r,a)=>{let n=r.getShaderDescription("fragment"),o=n.getCode(),s=[],l=[],i=[];for(let e=0;e = volumeSSBO.values[${e}].SCTCMatrix*minPosSC;`),l.push(` var tpos2_${e}: vec4 = volumeSSBO.values[${e}].SCTCMatrix*(minPosSC + rayStepSC);`),l.push(` var tstep${e}: vec4 = tpos2_${e} - tpos${e};`),l.push(` var rayBounds${e}: vec2 = intersectRayBoundsWithClipPlanes(${e}, minPosSC, rayStepSC, adjustBounds(tpos${e}, tstep${e}, numSteps));`),s.push(` if (curDist >= rayBounds${e}.x * mapperUBO.SampleDistance && curDist <= rayBounds${e}.y * mapperUBO.SampleDistance) {`),s.push(` sampleColor = processVolume(volTexture${e}, ${e}, ${t.rowStarts[e]}, rayPosSC, tfunRows);`),s.push(` computedColor = vec4( + sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb, + (1.0 - computedColor.a)*sampleColor.a + computedColor.a);`),s.push(" }")):(i.push(` sampleColor = traverseVals[${e}];`),i.push(` computedColor = vec4( + sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb, + (1.0 - computedColor.a)*sampleColor.a + computedColor.a);`));o=f.Ay.substitute(o,"//VTK::Volume::CompositeCalls",s).result,o=f.Ay.substitute(o,"//VTK::Volume::TraverseCalls",i).result,o=f.Ay.substitute(o,"//VTK::Volume::TraverseInit",l).result,o=f.Ay.substitute(o,"//VTK::Volume::TraverseDec",[`var traverseVals: array,${t.volumes.length}>;`]).result;let u=!1;for(let e=0;e{let a=e.getMTime();for(let e=0;e{let a=Math.max(e.getMTime(),t.WebGPURenderer.getStabilizedTime());for(let e=0;enew Float64Array(4*t.volumes.length)),i=new Float64Array(4*t.volumes.length),u=new Float64Array(4*t.volumes.length),c=new Float64Array(4*t.volumes.length),d=new Float64Array(4*t.volumes.length),p=new Float64Array(4*t.volumes.length);for(let e=0;e"),t.SSBO.addEntry("planeNormals","mat4x4"),t.SSBO.addEntry("shade","vec4"),t.SSBO.addEntry("tstep","vec4"),t.SSBO.addEntry("spacing","vec4"),t.SSBO.addEntry("ipScalarRange","vec4"),(0,F.G_)(t.SSBO,"clipPlane"),t.SSBO.addEntry("clipPlaneStates","vec4"),t.SSBO.setAllInstancesFromArray("SCTCMatrix",o),t.SSBO.setAllInstancesFromArray("planeNormals",s),t.SSBO.setAllInstancesFromArray("shade",c),t.SSBO.setAllInstancesFromArray("tstep",u),t.SSBO.setAllInstancesFromArray("spacing",d),t.SSBO.setAllInstancesFromArray("ipScalarRange",p);for(let e=0;e<6;e++)t.SSBO.setAllInstancesFromArray(`clipPlane${e}`,l[e]);t.SSBO.setAllInstancesFromArray("clipPlaneStates",i),t.SSBO.send(r),t.componentSSBO.clearData(),t.componentSSBO.setNumberOfInstances(t.numRows);let m=new Float64Array(t.numRows),g=new Float64Array(t.numRows),h=new Float64Array(t.numRows),v=new Float64Array(t.numRows),f=new Float64Array(t.numRows),S=new Float64Array(t.numRows),y=new Float64Array(t.numRows),T=new Float64Array(t.numRows),w=0;for(let e=0;e{n();let r=t.volumes[0].getRenderable().getMapper().getSampleDistance();for(let e=0;e{t.pipelineHash="volfsq";for(let e=0;e{if(!t.volumes||t.volumes.length!==r.length){t.volumes=[...r],e.modified();return}for(let a=0;a{let e=o();return e.push(t.componentSSBO),e.push(t.clampSampler),e}},"vtkWebGPUVolumePassFSQ")},{Representation:H}=_.Ay,{BufferUsage:K,PrimitiveTypes:j}=B.Ay,q=[[0,4,6],[0,6,2],[1,3,7],[1,7,5],[0,5,4],[0,1,5],[2,6,7],[2,7,3],[0,3,1],[0,2,3],[4,5,7],[4,7,6]],Q=` +//VTK::Renderer::Dec + +//VTK::Select::Dec + +//VTK::VolumePass::Dec + +//VTK::TCoord::Dec + +//VTK::RenderEncoder::Dec + +//VTK::Mapper::Dec + +//VTK::IOStructs::Dec + +@fragment +fn main( +//VTK::IOStructs::Input +) +//VTK::IOStructs::Output +{ + var output : fragmentOutput; + + //VTK::Select::Impl + + //VTK::TCoord::Impl + + //VTK::VolumePass::Impl + + // use the maximum (closest) of the current value and the zbuffer + // the blend func will then take the min to find the farthest stop value + var stopval: f32 = max(input.fragPos.z, textureLoad(opaquePassDepthTexture, vec2(i32(input.fragPos.x), i32(input.fragPos.y)), 0)); + + //VTK::RenderEncoder::Impl + return output; +} +`,Y=` +//VTK::Renderer::Dec + +//VTK::Mapper::Dec + +//VTK::TCoord::Dec + +//VTK::RenderEncoder::Dec + +//VTK::IOStructs::Dec + +@fragment +fn main( +//VTK::IOStructs::Input +) +//VTK::IOStructs::Output +{ + var output: fragmentOutput; + + var computedColor: vec4 = textureSample(volumePassColorTexture, + volumePassColorTextureSampler, mapperUBO.tscale*input.tcoordVS); + + //VTK::RenderEncoder::Impl + return output; +} +`,X={colorTextureView:null,depthTextureView:null,volumes:null},Z={newInstance:a.Ay.newInstance(function(e,t,r={}){Object.assign(t,X,r),m.Ay.extend(e,t,r),t._mapper=D.Ay.newInstance(),t._mapper.setFragmentShaderTemplate(Q),t._mapper.getShaderReplacements().set("replaceShaderVolumePass",(e,t,r)=>{t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")}),t._boundsPoly=l.Ay.newInstance(),t._lastMTimes=[],a.Ay.setGet(e,t,["colorTextureView","depthTextureView"]),t.classHierarchy.push("vtkWebGPUVolumePass"),e.initialize=r=>{t._clearEncoder||e.createClearEncoder(r),t._mergeEncoder||e.createMergeEncoder(r),t._copyEncoder||e.createCopyEncoder(r),t._depthRangeEncoder||e.createDepthRangeEncoder(r),t.fullScreenQuad||(t.fullScreenQuad=$.newInstance(),t.fullScreenQuad.setDevice(r.getDevice()),t.fullScreenQuad.setTextureViews([...t._depthRangeEncoder.getColorTextureViews()])),t._volumeCopyQuad||(t._volumeCopyQuad=v.Ay.newInstance(),t._volumeCopyQuad.setPipelineHash("volpassfsq"),t._volumeCopyQuad.setDevice(r.getDevice()),t._volumeCopyQuad.setFragmentShaderTemplate(Y),t._copyUBO=O.Ay.newInstance({label:"mapperUBO"}),t._copyUBO.addEntry("tscale","vec2"),t._volumeCopyQuad.setUBO(t._copyUBO),t._volumeCopyQuad.setTextureViews([t._colorTextureView]))},e.traverse=(r,a)=>{if(t.deleted)return;t._currentParent=a,e.initialize(a),e.computeTiming(a),e.renderDepthBounds(r,a),t._firstGroup=!0;let n=a.getDevice(),o=n.getHandle().limits.maxSampledTexturesPerShaderStage-4;if(t.volumes.length>o){let n=r.getRenderable().getActiveCamera().getPosition(),s=[];for(let e=0;es[t]-s[e]);let i=[],u=l.length%o;for(let n=0;n=u&&(e.rayCastPass(a,r,i),i=[],u=o,t._firstGroup=!1)}else e.rayCastPass(a,r,t.volumes);if(t._volumeCopyQuad.setWebGPURenderer(r),t._useSmallViewport){let e=t._colorTextureView.getTexture().getWidth(),r=t._colorTextureView.getTexture().getHeight();t._copyUBO.setArray("tscale",[t._smallViewportWidth/e,t._smallViewportHeight/r])}else t._copyUBO.setArray("tscale",[1,1]);t._copyUBO.sendIfNeeded(n),t._copyEncoder.setColorTextureView(0,t.colorTextureView),t._copyEncoder.attachTextureViews(),t._copyEncoder.begin(a.getCommandEncoder()),r.scissorAndViewport(t._copyEncoder),t._volumeCopyQuad.prepareAndDraw(t._copyEncoder),t._copyEncoder.end()},e.delete=a.Ay.chain(()=>{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)},e.delete),e.computeTiming=e=>{let r=e.getRenderable().getInteractor();null==t._lastScale&&(t._lastScale=t.volumes[0].getRenderable().getMapper().getInitialInteractionScale()||1),t._useSmallViewport=!1,r.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._colorTexture.resize(e.getCanvas().width,e.getCanvas().height),t._animationRateSubscription||(t._animationRateSubscription=r.onAnimationFrameRateUpdate(()=>{let e=t.volumes[0].getRenderable().getMapper();if(e.getAutoAdjustSampleDistances()){let e=r.getRecentAnimationFrameRate();t._lastScale=t._lastScale*r.getDesiredUpdateRate()/e,t._lastScale>400&&(t._lastScale=400)}else t._lastScale=e.getImageSampleDistance()*e.getImageSampleDistance();t._lastScale<1.5&&(t._lastScale=1.5)}))},e.rayCastPass=(e,r,a)=>{let n=t._firstGroup?t._clearEncoder:t._mergeEncoder;n.attachTextureViews(),n.begin(e.getCommandEncoder());let o=t._colorTextureView.getTexture().getWidth(),s=t._colorTextureView.getTexture().getHeight();if(t._useSmallViewport){let r=e.getCanvas(),a=1/Math.sqrt(t._lastScale);t._smallViewportWidth=Math.ceil(a*r.width),t._smallViewportHeight=Math.ceil(a*r.height),o=t._smallViewportWidth,s=t._smallViewportHeight}n.getHandle().setViewport(0,0,o,s,0,1),n.getHandle().setScissorRect(0,0,o,s),t.fullScreenQuad.setWebGPURenderer(r),t.fullScreenQuad.setVolumes(a),t.fullScreenQuad.prepareAndDraw(n),n.end()},e.renderDepthBounds=(r,a)=>{e.updateDepthPolyData(r);let n=t._boundsPoly,o=n.getPoints(),s=n.getPolys(),l={hash:`vp${s.getMTime()}`,usage:K.Index,cells:s,numberOfPoints:o.getNumberOfPoints(),primitiveType:j.Triangles,representation:H.SURFACE},i=a.getDevice().getBufferManager().getBuffer(l);t._mapper.getVertexInput().setIndexBuffer(i),l={usage:K.PointArray,format:"float32x4",hash:`vp${o.getMTime()}${s.getMTime()}`,dataArray:o,indexBuffer:i,packExtra:!0};let u=a.getDevice().getBufferManager().getBuffer(l);t._mapper.getVertexInput().addBuffer(u,["vertexBC"]),t._mapper.setNumberOfVertices(u.getSizeInBytes()/u.getStrideInBytes()),e.drawDepthRange(r,a)},e.updateDepthPolyData=e=>{let r=!1;for(let e=0;e{t._depthRangeTexture.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeTexture2.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeEncoder.attachTextureViews(),e.setCurrentOperation("volumeDepthRangePass"),r.setRenderEncoder(t._depthRangeEncoder),r.volumeDepthRangePass(!0),t._mapper.setWebGPURenderer(r),t._mapper.prepareToDraw(t._depthRangeEncoder),t._mapper.registerDrawCallback(t._depthRangeEncoder),r.volumeDepthRangePass(!1)},e.createDepthRangeEncoder=e=>{let r=e.getDevice();t._depthRangeEncoder=w.newInstance({label:"VolumePass DepthRange"}),t._depthRangeEncoder.setPipelineHash("volr"),t._depthRangeEncoder.setReplaceShaderCodeFunction(e=>{let t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor1"),t.addOutput("vec4","outColor2");let r=t.getCode();r=f.Ay.substitute(r,"//VTK::RenderEncoder::Impl",["output.outColor1 = vec4(input.fragPos.z, 0.0, 0.0, 0.0);","output.outColor2 = vec4(stopval, 0.0, 0.0, 0.0);"]).result,t.setCode(r)}),t._depthRangeEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:null,clearValue:[1,1,1,1],loadOp:"clear",storeOp:"store"}]}),t._depthRangeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"max"},alpha:{srcFactor:"one",dstFactor:"one",operation:"max"}}},{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"min"},alpha:{srcFactor:"one",dstFactor:"one",operation:"min"}}}]}}),t._depthRangeTexture=x.Ay.newInstance({label:"volumePassMaxDepth"}),t._depthRangeTexture.create(r,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});let a=t._depthRangeTexture.createView("maxTexture");t._depthRangeEncoder.setColorTextureView(0,a),t._depthRangeTexture2=x.Ay.newInstance({label:"volumePassDepthMin"}),t._depthRangeTexture2.create(r,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});let n=t._depthRangeTexture2.createView("minTexture");t._depthRangeEncoder.setColorTextureView(1,n),t._mapper.setDevice(e.getDevice()),t._mapper.setTextureViews([t.depthTextureView])},e.createClearEncoder=e=>{t._colorTexture=x.Ay.newInstance({label:"volumePassColor"}),t._colorTexture.create(e.getDevice(),{width:e.getCanvas().width,height:e.getCanvas().height,format:"bgra8unorm",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC}),t._colorTextureView=t._colorTexture.createView("volumePassColorTexture"),t._colorTextureView.addSampler(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._clearEncoder=w.newInstance({label:"VolumePass Clear"}),t._clearEncoder.setColorTextureView(0,t._colorTextureView),t._clearEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"}]}),t._clearEncoder.setPipelineHash("volpf"),t._clearEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createCopyEncoder=e=>{t._copyEncoder=w.newInstance({label:"volumePassCopy"}),t._copyEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._copyEncoder.setPipelineHash("volcopypf"),t._copyEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createMergeEncoder=e=>{t._mergeEncoder=w.newInstance({label:"volumePassMerge"}),t._mergeEncoder.setColorTextureView(0,t._colorTextureView),t._mergeEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._mergeEncoder.setReplaceShaderCodeFunction(e=>{let t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let r=t.getCode();r=f.Ay.substitute(r,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(r)}),t._mergeEncoder.setPipelineHash("volpf"),t._mergeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.setVolumes=r=>{if(!t.volumes||t.volumes.length!==r.length){t.volumes=[...r],e.modified();return}for(let a=0;a{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null),t._clearEncoder=null,t._mergeEncoder=null,t._copyEncoder=null,t._depthRangeEncoder=null,t._colorTexture=null,t._colorTextureView=null,t._depthRangeTexture=null,t._depthRangeTexture2=null,t._volumeCopyQuad=null,t.fullScreenQuad=null,t._copyUBO=null,t.colorTextureView=null,t.depthTextureView=null}},"vtkWebGPUVolumePass")},J=` +//VTK::Mapper::Dec + +//VTK::TCoord::Dec + +//VTK::RenderEncoder::Dec + +//VTK::IOStructs::Dec + +@fragment +fn main( +//VTK::IOStructs::Input +) +//VTK::IOStructs::Output +{ + var output: fragmentOutput; + + var texCoord: vec2 = + vec2(i32(input.fragPos.x), i32(input.fragPos.y)); + var computedColor: vec4 = clamp( + textureLoad(opaquePassColorTexture, texCoord, 0), + vec4(0.0), + vec4(1.0) + ); + + //VTK::RenderEncoder::Impl + return output; +} +`,ee={opaqueActorCount:0,translucentActorCount:0,volumes:null,opaqueRenderEncoder:null,translucentPass:null,volumePass:null},et={newInstance:a.Ay.newInstance(function(e,t,r={}){Object.assign(t,ee,r),m.Ay.extend(e,t,r),a.Ay.setGet(e,t,["opaquePass","translucentPass","volumePass"]),t.classHierarchy.push("vtkForwardPass"),e.traverse=(r,a=null)=>{if(t.deleted)return;t._currentParent=a,e.setCurrentOperation("buildPass"),r.traverse(e),t.opaquePass||(t.opaquePass=I.newInstance());let n=r.getRenderable().getNumberOfLayers(),o=r.getChildren();for(let a=0;a0&&(t.translucentPass||(t.translucentPass=V.newInstance()),t.translucentPass.setColorTextureView(t.opaquePass.getColorTextureView()),t.translucentPass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.translucentPass.traverse(s,r)),t.volumes.length>0&&(t.volumePass||(t.volumePass=Z.newInstance()),t.volumePass.setColorTextureView(t.opaquePass.getColorTextureView()),t.volumePass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.volumePass.setVolumes(t.volumes),t.volumePass.traverse(s,r)),e.finalPass(r,s))}},e.finalPass=(r,a)=>{t._finalBlitEncoder||e.createFinalBlitEncoder(r),t._finalBlitOutputTextureView.createFromTextureHandle(r.getCurrentTexture(),{depth:1,format:r.getPresentationFormat()}),t._finalBlitEncoder.attachTextureViews(),t._finalBlitEncoder.begin(r.getCommandEncoder()),a.scissorAndViewport(t._finalBlitEncoder),t._fullScreenQuad.prepareAndDraw(t._finalBlitEncoder),t._finalBlitEncoder.end()},e.createFinalBlitEncoder=e=>{t._finalBlitEncoder=w.newInstance({label:"forwardPassBlit"}),t._finalBlitEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._finalBlitEncoder.setPipelineHash("fpf"),t._finalBlitEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:e.getPresentationFormat(),blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]}}),t._fsqSampler=C.Ay.newInstance({label:"finalPassSampler"}),t._fsqSampler.create(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._fullScreenQuad=v.Ay.newInstance(),t._fullScreenQuad.setDevice(e.getDevice()),t._fullScreenQuad.setPipelineHash("fpfsq"),t._fullScreenQuad.setTextureViews([t.opaquePass.getColorTextureView()]),t._fullScreenQuad.setAdditionalBindables([t._fsqSampler]),t._fullScreenQuad.setFragmentShaderTemplate(J),t._fullScreenQuad.getShaderReplacements().set("replaceShaderTCoord",(e,t)=>{let r=t.getShaderDescription("vertex");r.hasOutput("tcoordVS")||r.addOutput("vec2","tcoordVS"),t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")}),t._finalBlitOutputTextureView=P.Ay.newInstance(),t._finalBlitEncoder.setColorTextureView(0,t._finalBlitOutputTextureView)},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.addVolume=e=>{t.volumes.push(e)},e.releaseGraphicsResources=()=>{t.opaquePass?.releaseGraphicsResources?.(),t.translucentPass?.releaseGraphicsResources?.(),t.volumePass?.releaseGraphicsResources?.(),t.opaquePass=null,t.translucentPass=null,t.volumePass=null,t._finalBlitEncoder=null,t._finalBlitOutputTextureView=null,t._fullScreenQuad=null,t._fsqSampler=null}},"vtkForwardPass")},{VtkDataTypes:er}=n.Ay,ea={handle:null,device:null},en={newInstance:a.Ay.newInstance(function(e,t,r={}){Object.assign(t,ea,r),a.Ay.obj(e,t),a.Ay.setGet(e,t,["device"]);function n(e){if(e.imageData){e.dataArray=e.imageData.getPointData().getScalars(),e.time=e.dataArray.getMTime(),e.nativeArray=e.dataArray.getData();let t=e.imageData.getDimensions();switch(e.width=t[0],e.height=t[1],e.depth=t[2],e.dataArray.getNumberOfComponents()){case 1:e.format="r";break;case 2:e.format="rg";break;default:e.format="rgba"}switch(e.dataArray.getDataType()){case er.UNSIGNED_CHAR:e.format+="8unorm";break;case er.FLOAT:case er.UNSIGNED_INT:case er.INT:case er.DOUBLE:case er.UNSIGNED_SHORT:case er.SHORT:default:e.format+="16float"}}e.image&&(e.width=e.image.width,e.height=e.image.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.usage=GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT),e.jsImageData&&(e.width=e.jsImageData.width,e.height=e.jsImageData.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.nativeArray=e.jsImageData.data,e.usage=GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT),e.imageBitmap&&(e.width=e.imageBitmap.width,e.height=e.imageBitmap.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.usage=GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT),e.canvas&&(e.width=e.canvas.width,e.height=e.canvas.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.usage=GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT)}function o(e){let r=x.Ay.newInstance({label:e.label});return r.create(t.device,{width:e.width,height:e.height,depth:e.depth,format:e.format,usage:e.usage,mipLevel:e.mipLevel}),(e.nativeArray||e.image||e.canvas||e.imageBitmap)&&r.writeImageData(e),r}t.classHierarchy.push("vtkWebGPUTextureManager"),e.getTexture=e=>e.hash?t.device.getCachedObject(e.hash,o,e):o(e),e.getTextureForImageData=e=>{let r={time:e.getMTime()};return r.imageData=e,n(r),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)},e.getTextureForVTKTexture=(e,r)=>{let a={time:e.getMTime(),label:r};return e.getInputData()?a.imageData=e.getInputData():e.getImage()?a.image=e.getImage():e.getJsImageData()?a.jsImageData=e.getJsImageData():e.getImageBitmap()?a.imageBitmap=e.getImageBitmap():e.getCanvas()&&(a.canvas=e.getCanvas()),n(a),a.mipLevel=e.getMipLevel(),a.hash=a.time+a.format+a.mipLevel,t.device.getTextureManager().getTexture(a)}})},eo=class extends Map{constructor(){super(),this.registry=new FinalizationRegistry(e=>{let t=super.get(e);t&&t.deref&&void 0===t.deref()&&super.delete(e)})}getValue(e){let t=super.get(e);if(t){let r=t.deref();if(void 0!==r)return r;super.delete(e)}}setValue(e,t){let r;return t&&"object"==typeof t&&(r=new WeakRef(t),this.registry.register(t,e),super.set(e,r)),r}},es={handle:null,pipelines:null,shaderCache:null,bindGroupLayouts:null,bufferManager:null,textureManager:null},el={newInstance:(0,a.UI)(function(e,t,r={}){Object.assign(t,es,r),(0,a.WL)(e,t),(0,a.V0)(e,t,["handle"]),(0,a.Jt)(e,t,["bufferManager","shaderCache","textureManager"]),t.objectCache=new eo,t.shaderCache=f.Ay.newInstance(),t.shaderCache.setDevice(e),t.bindGroupLayouts=[],t.bufferManager=B.Ay.newInstance(),t.bufferManager.setDevice(e),t.textureManager=en.newInstance(),t.textureManager.setDevice(e),t.pipelines={},t.classHierarchy.push("vtkWebGPUDevice"),e.initialize=e=>{t.handle=e},e.createCommandEncoder=()=>t.handle.createCommandEncoder(),e.submitCommandEncoder=e=>{t.handle.queue.submit([e.finish()])},e.getShaderModule=e=>t.shaderCache.getShaderModule(e),e.getBindGroupLayout=e=>{if(!e.entries)return null;for(let t=0;t{for(let r=0;re in t.pipelines?t.pipelines[e]:null,e.createPipeline=(r,a)=>{a.initialize(e,r),t.pipelines[r]=a},e.onSubmittedWorkDone=()=>t.handle.queue.onSubmittedWorkDone(),e.hasCachedObject=e=>t.objectCache.getValue(e),e.getCachedObject=(e,r,...a)=>{if(!e)return vtkErrorMacro("attempt to cache an object without a hash"),null;let n=t.objectCache.getValue(e);if(n)return n;let o=r(...a);return t.objectCache.setValue(e,o),o}},"vtkWebGPUDevice")},ei=r(21122),eu=r(56971),ec=r(28193),ed={selectionRenderEncoder:null,colorTexture:null,depthTexture:null},ep={newInstance:a.Ay.newInstance(function(e,t,r={}){Object.assign(t,ed,r),m.Ay.extend(e,t,r),a.Ay.get(e,t,["colorTexture","depthTexture"]),t.classHierarchy.push("vtkWebGPUHardwareSelectionPass"),e.traverse=(r,a)=>{if(t.deleted)return;t._currentParent=null,e.setCurrentOperation("buildPass"),r.traverse(e);let n=r.getDevice();if(t.selectionRenderEncoder)t.colorTexture.resize(r.getCanvas().width,r.getCanvas().height),t.depthTexture.resizeToMatch(t.colorTexture);else{e.createRenderEncoder(),t.colorTexture=x.Ay.newInstance({label:"hardwareSelectorColor"}),t.colorTexture.create(n,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba32uint",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});let a=t.colorTexture.createView("hardwareSelectColorTexture");t.selectionRenderEncoder.setColorTextureView(0,a),t.depthTexture=x.Ay.newInstance({label:"hardwareSelectorDepth"}),t.depthTexture.create(n,{width:r.getCanvas().width,height:r.getCanvas().height,format:"depth32float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});let o=t.depthTexture.createView("hardwareSelectDepthTexture");t.selectionRenderEncoder.setDepthTextureView(o)}t.selectionRenderEncoder.attachTextureViews(),a.setRenderEncoder(t.selectionRenderEncoder),e.setCurrentOperation("cameraPass"),a.traverse(e),e.setCurrentOperation("opaquePass"),a.traverse(e)},e.createRenderEncoder=()=>{t.selectionRenderEncoder=w.newInstance({label:"HardwareSelectionPass"}),t.selectionRenderEncoder.setPipelineHash("sel"),t.selectionRenderEncoder.setReplaceShaderCodeFunction(e=>{let t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let r=t.getCode();r=f.Ay.substitute(r,"//VTK::Select::Impl",[" var compositeID: u32 = 0u;"," var attributeID: u32 = compositeID;"]).result,r=f.Ay.substitute(r,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(mapperUBO.PropID, compositeID, attributeID + 1u, 0u);"]).result,t.setCode(r)}),t.selectionRenderEncoder.getDescription().colorAttachments[0].clearValue=[0,0,0,0],t.selectionRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba32uint",blend:void 0}]}})}},"vtkWebGPUHardwareSelectionPass")},{SelectionContent:em,SelectionField:eg}=eu.Ay,{FieldAssociations:eh}=ei.Ay,{vtkErrorMacro:ev}=a.Ay;function ef(e,t,r,a){let n=((r.height-t-1)*r.colorBufferWidth+e)*4+a;return r.colorValues[n]}var eS={_selectionPropMap:null,_selectionProps:null},ey={newInstance:a.Ay.newInstance(function(e,t,r={}){Object.assign(t,eS,r),ec.Ay.extend(e,t,r),t._selectionPass=ep.newInstance(),t._selectionPropMap=new Map,t._selectionProps=[],a.Ay.setGet(e,t,["_WebGPURenderWindow"]),a.Ay.moveToProtected(e,t,["WebGPURenderWindow"]),t.classHierarchy.push("vtkWebGPUHardwareSelector"),e.getPropIDForSelection=(e,r=null)=>{if(t._selectionPropMap.has(e))return t._selectionPropMap.get(e);let a=t._selectionProps.length;return t._selectionPropMap.set(e,a),t._selectionProps.push(r),a},e.endSelection=()=>{t.WebGPURenderer.setSelector(null)},e.getSourceDataAsync=async r=>{let a;if(!r||!t._WebGPURenderWindow)return ev("Renderer and view must be set before calling Select."),!1;t._WebGPURenderWindow.getRenderable().preRender(),t._WebGPURenderWindow.getInitialized()||(t._WebGPURenderWindow.initialize(),await new Promise(e=>{t._WebGPURenderWindow.onInitialized(e)}));let n=t._WebGPURenderWindow.getViewNodeFor(r);if(!n)return!1;let o=n.getSuppressClear(),s=n.getSelector();t._selectionPropMap.clear(),t._selectionProps=[],n.setSuppressClear(!0),n.setSelector(e);try{t._selectionPass.traverse(t._WebGPURenderWindow,n)}finally{n.setSelector(s),n.setSuppressClear(o)}let l=t._WebGPURenderWindow.getDevice(),i=t._selectionPass.getColorTexture(),u=t._selectionPass.getDepthTexture(),c={area:[0,0,i.getWidth()-1,i.getHeight()-1],captureZValues:t.captureZValues,fieldAssociation:t.fieldAssociation,props:[...t._selectionProps],renderer:r,webGPURenderer:n,webGPURenderWindow:t._WebGPURenderWindow,width:i.getWidth(),height:i.getHeight()};c.colorBufferWidth=16*Math.floor((c.width+15)/16),c.colorBufferSizeInBytes=c.colorBufferWidth*c.height*16;let d=h.Ay.newInstance({label:"hardwareSelectColorBuffer"});d.setDevice(l),d.create(c.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);let p=t._WebGPURenderWindow.getCommandEncoder();p.copyTextureToBuffer({texture:i.getHandle()},{buffer:d.getHandle(),bytesPerRow:16*c.colorBufferWidth,rowsPerImage:c.height},{width:c.width,height:c.height,depthOrArrayLayers:1}),t.captureZValues&&(c.zbufferBufferWidth=64*Math.floor((c.width+63)/64),(a=h.Ay.newInstance({label:"hardwareSelectDepthBuffer"})).setDevice(l),c.zbufferSizeInBytes=c.height*c.zbufferBufferWidth*4,a.create(c.zbufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST),p.copyTextureToBuffer({texture:u.getHandle(),aspect:"depth-only"},{buffer:a.getHandle(),bytesPerRow:4*c.zbufferBufferWidth,rowsPerImage:c.height},{width:c.width,height:c.height,depthOrArrayLayers:1})),l.submitCommandEncoder(p);let m=d.mapAsync(GPUMapMode.READ);if(t.captureZValues){let e=a.mapAsync(GPUMapMode.READ);await Promise.all([m,e]),c.depthValues=new Float32Array(a.getMappedRange().slice()),a.unmap()}else await m;return c.colorValues=new Uint32Array(d.getMappedRange().slice()),d.unmap(),c.generateSelection=(e,t,r,a)=>(function(e,t,r,a,n){let o=Math.floor(t),s=Math.floor(r),l=Math.floor(a),i=Math.floor(n),u=new Map,c=[0,0];for(let t=s;t<=i;t++)for(let r=o;r<=l;r++){let a=function e(t,r,a,n){let o=a<0?0:a;if(0===o){if(n[0]=r[0],n[1]=r[1],r[0]<0||r[0]>=t.width||r[1]<0||r[1]>=t.height)return null;let e=ef(r[0],r[1],t,0);if(e<=0||e-1>=(t.props?.length??0))return null;let a={};a.propID=e-1,a.prop=t.props?.[a.propID];let o=ef(r[0],r[1],t,1);(o<0||o>0xffffff)&&(o=0),a.compositeID=o-1;let s=ef(r[0],r[1],t,2);if(s<1&&(s=o),a.attributeID=s-1,t.captureZValues){let e=(t.height-r[1]-1)*t.zbufferBufferWidth+r[0];a.zValue=t.depthValues[e],a.zValue=t.webGPURenderer.convertToOpenGLDepth(a.zValue),a.displayPosition=r}return a}let s=[r[0],r[1]],l=[0,0],i=e(t,r,0,n);if(i)return i;for(let r=1;rr?s[1]-r:0;a<=s[1]+r;++a)if(l[1]=a,s[0]>=r&&(l[0]=s[0]-r,i=e(t,l,0,n))||(l[0]=s[0]+r,i=e(t,l,0,n)))return i;for(let a=s[0]>=r?s[0]-(r-1):0;a<=s[0]+(r-1);++a)if(l[0]=a,s[1]>=r&&(l[1]=s[1]-r,i=e(t,l,0,n))||(l[1]=s[1]+r,i=e(t,l,0,n)))return i}return n[0]=r[0],n[1]=r[1],null}(e,[r,t],0,c);if(a){let t=`${a.propID} ${a.compositeID}`;if(u.has(t)){let r=u.get(t);r.pixelCount++,e.captureZValues&&a.zValue{let a=eu.Ay.newInstance();switch(a.setContentType(em.INDICES),d){case eh.FIELD_ASSOCIATION_CELLS:a.setFieldType(eg.CELL);break;case eh.FIELD_ASSOCIATION_POINTS:a.setFieldType(eg.POINT);break;default:ev("Unknown field association")}a.getProperties().propID=t.info.propID,a.getProperties().prop=t.info.prop,a.getProperties().compositeID=t.info.compositeID,a.getProperties().attributeID=t.info.attributeID,a.getProperties().pixelCount=t.pixelCount,e.captureZValues&&(a.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],a.getProperties().worldPosition=e.webGPURenderWindow.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,e.renderer)),a.setSelectionList(t.attributeIDs),p[m]=a,m++}),p})(c,e,t,r,a),c}},"vtkWebGPUHardwareSelector")},eT=r(74978),{vtkErrorMacro:ew,vtkWarningMacro:eC}=a.Ay,eP={position:"absolute",top:0,left:0,width:"100%",height:"100%"},ex={initialized:!1,initializing:!1,handlingDeviceLost:!1,deviceGeneration:0,deviceLostInfo:null,context:null,adapter:null,device:null,canvas:null,cursorVisibility:!0,cursor:"pointer",containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1,nextPropID:1,xrSupported:!1,presentationFormat:null},eb=a.Ay.newInstance(function(e,t,r={}){Object.assign(t,ex,r),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",g.Ay.extend(e,t,r),t.myFactory=eT.Ay.newInstance(),t.renderPasses[0]=et.newInstance(),t.selector||(t.selector=ey.newInstance(),t.selector.setWebGPURenderWindow(e)),a.Ay.event(e,t,"imageReady"),a.Ay.event(e,t,"initialized"),a.Ay.event(e,t,"deviceLost"),a.Ay.get(e,t,["commandEncoder","deviceLostInfo","device","presentationFormat","useBackgroundImage","xrSupported"]),a.Ay.setGet(e,t,["initialized","context","canvas","device","renderPasses","notifyStartCaptureImage","cursor","useOffScreen"]),a.Ay.setGetArray(e,t,["size"],2),a.Ay.event(e,t,"windowResizeEvent");t.classHierarchy.push("vtkWebGPURenderWindow"),e.getViewNodeFactory=()=>t.myFactory;let n=[0,0];async function o(r=t.imageFormat){let a=document.createElement("canvas"),n=a.getContext("2d");a.width=t.canvas.width,a.height=t.canvas.height;let s=await e.getPixelsAsync(),l=new ImageData(s.colorValues,s.width,s.height);n.putImageData(l,0,0);let i=t.canvas.getBoundingClientRect();t.renderable.getRenderers().forEach(e=>{e.getViewProps().forEach(e=>{if(e.getContainer){let t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.context&&(t.context.unconfigure(),t.presentationFormat=navigator.gpu.getPreferredCanvasFormat(t.adapter),t.context.configure({device:t.device.getHandle(),format:t.presentationFormat,alphaMode:"premultiplied",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_DST,width:t.size[0],height:t.size[1]}),t._configured=!0)},e.getCurrentTexture=()=>t.context.getCurrentTexture(),e.buildPass=r=>{r?t.renderable&&(e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize()):t.initialized&&(t._configured||e.recreateSwapChain(),t.commandEncoder=t.device.createCommandEncoder())},e.initialize=()=>{if(!t.initializing){if(t.initializing=!0,t.deviceLostInfo=null,!navigator.gpu)return void ew("WebGPU is not enabled.");e.create3DContextAsync().then(()=>{t.initialized=!0,t.deleted||e.invokeInitialized()})}},e.setContainer=r=>{t.el&&t.el!==r&&(t.canvas.parentNode!==t.el&&ew("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==r&&(t.el=r,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){let{width:e,height:r}=t.el.getBoundingClientRect();t.containerSize=[e,r]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.size,e.create3DContextAsync=async()=>{if(t.adapter=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),!t.deleted){var r,a;if(t.device=el.newInstance(),t.device.initialize(await t.adapter.requestDevice({requiredLimits:{maxBufferSize:t.adapter.limits.maxBufferSize,maxStorageBufferBindingSize:t.adapter.limits.maxStorageBufferBindingSize,maxUniformBufferBindingSize:t.adapter.limits.maxUniformBufferBindingSize}})),t.deleted){t.device=null;return}t.deviceGeneration+=1,r=t.device.getHandle(),a=t.deviceGeneration,r.lost.then(r=>{!function(r,a){if(t.deleted||a!==t.deviceGeneration||t.handlingDeviceLost)return;t.handlingDeviceLost=!0,t.deviceLostInfo=r;let n=r?.reason??"unknown",o=r?.message||"WebGPU device was lost.";if(eC(`WebGPU device lost (${n}): ${o}`),e.releaseGraphicsResources(),e.invokeDeviceLost({reason:n,message:o,recoverable:"destroyed"!==n}),"destroyed"!==n){let r=e.onInitialized(()=>{r.unsubscribe(),t.deleted||e.traverseAllPasses()});e.initialize()}t.handlingDeviceLost=!1}(r,a)}),t.context=t.canvas.getContext("webgpu")}},e.releaseGraphicsResources=()=>{if(t.renderPasses)for(let e=0;e{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=(r="image/png",{resetCamera:a=!1,size:n=null,scale:o=1}={})=>{if(t.deleted)return null;t.imageFormat=r;let s=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:n||1!==o?n||t.size.map(e=>e*o):null},new Promise((r,n)=>{let o=e.onImageReady(n=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=s,o.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach(({restoreParamsFn:e,arg:t})=>e(t)),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),r(n);else{let r=document.createElement("img");if(r.style=eP,r.src=n,t._screenshot.placeHolder=t.el.appendChild(r),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),a){let e=!0!==a;t._screenshot.cameras=t.renderable.getRenderers().map(t=>{let r=t.getActiveCamera(),n=r.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?a:t.resetCamera,restoreParamsFn:r.set,arg:JSON.parse(JSON.stringify(n))}}),t._screenshot.cameras.forEach(({resetCameraFn:e,resetCameraArgs:t})=>e(t))}e.traverseAllPasses()}})})},e.traverseAllPasses=()=>{if(!t.deleted)if(t.initialized){if(t.renderPasses)for(let r=0;r{o()}))}else{e.initialize();let t=e.onInitialized(()=>{t.unsubscribe(),e.traverseAllPasses()})}},e.setViewStream=r=>t.viewStream!==r&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=r,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady(t=>e.setBackgroundImage(t.image)),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.getUniquePropID=()=>t.nextPropID++,e.getPropFromID=e=>{for(let r=0;r{let e=t.device,r=t.renderPasses[0].getOpaquePass().getColorTexture(),a={width:r.getWidth(),height:r.getHeight()};a.colorBufferWidth=32*Math.floor((a.width+31)/32),a.colorBufferSizeInBytes=a.colorBufferWidth*a.height*8;let n=h.Ay.newInstance();n.setDevice(e),n.create(a.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);let o=t.device.createCommandEncoder();o.copyTextureToBuffer({texture:r.getHandle()},{buffer:n.getHandle(),bytesPerRow:8*a.colorBufferWidth,rowsPerImage:a.height},{width:a.width,height:a.height,depthOrArrayLayers:1}),e.submitCommandEncoder(o),await n.mapAsync(GPUMapMode.READ),a.colorValues=new Uint16Array(n.getMappedRange().slice()),n.unmap();let s=new Uint8ClampedArray(a.height*a.width*4);for(let e=0;e{let t=ey.newInstance();return t.setWebGPURenderWindow(e),t};let s=e.setSize;e.setSize=(t,r)=>{let a=s(t,r);return a&&e.invokeWindowResizeEvent({width:t,height:r}),a},e.delete=a.Ay.chain(e.delete,e.setViewStream)},"vtkWebGPURenderWindow");(0,d.p$)("WebGPU",eb),(0,eT.c9)("vtkRenderWindow",eb);var eI=({toNativeType:s,extractURLParameters:function(e=!0,t=window.location.search){let r={},a=e?s:o;return new URLSearchParams(t).forEach((e,t)=>{t&&(r[t]=!e||a(e))}),r}}).extractURLParameters(),eR={background:[.32,.34,.43],listenWindowResize:!0,container:null};function eE(e,t,r={}){Object.assign(t,eR,r),a.Ay.obj(e,t),a.Ay.get(e,t,["renderWindow","renderer","_apiSpecificRenderWindow","interactor","container"]),a.Ay.moveToProtected(e,t,["_apiSpecificRenderWindow"]),a.Ay.event(e,t,"resize");let n=e.invokeResize;delete e.invokeResize,t.renderWindow=d.Ay.newInstance(),t.renderer=c.Ay.newInstance(),t.renderWindow.addRenderer(t.renderer),t._apiSpecificRenderWindow=t.renderWindow.newAPISpecificView(eI.viewAPI??t.defaultViewAPI),t.renderWindow.addView(t._apiSpecificRenderWindow),t.interactor=i.Ay.newInstance(),t.interactor.setInteractorStyle(u.Ay.newInstance()),t.interactor.setView(t._apiSpecificRenderWindow),t.interactor.initialize(),e.setBackground=t.renderer.setBackground,e.setBackground(...t.background),e.resize=()=>{if(t.container){let e=t.container.getBoundingClientRect(),r=window.devicePixelRatio||1;t._apiSpecificRenderWindow.setSize(Math.floor(e.width*r),Math.floor(e.height*r)),n(),t.renderWindow.render()}},e.setContainer=e=>{t.container&&t.interactor.unbindEvents(t.container),t.container=e,t._apiSpecificRenderWindow.setContainer(t.container),t.container&&t.interactor.bindEvents(t.container)},e.delete=a.Ay.chain(e.setContainer,t._apiSpecificRenderWindow.delete,()=>{window.removeEventListener("resize",e.resize)},e.delete),t.listenWindowResize&&window.addEventListener("resize",e.resize),e.resize()}var eV={newInstance:a.Ay.newInstance(eE),extend:eE}}}]); \ No newline at end of file diff --git a/_next/static/chunks/4bd1b696-409494caf8c83275.js b/_next/static/chunks/4bd1b696-409494caf8c83275.js new file mode 100644 index 0000000000000000000000000000000000000000..ccff7c3f98fd1b201540af592e7e7ad7c082ac42 --- /dev/null +++ b/_next/static/chunks/4bd1b696-409494caf8c83275.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[441],{59248:(e,n,t)=>{var r,l=t(95704),a=t(45009),o=t(12115),u=t(47650);function i(e){var n="https://react.dev/errors/"+e;if(1I||(e.current=R[I],R[I]=null,I--)}function j(e,n){R[++I]=e.current,e.current=n}var V=U(null),H=U(null),Q=U(null),B=U(null);function W(e,n){switch(j(Q,n),j(H,e),j(V,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?sg(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)e=sy(n=sg(n),e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}$(V),j(V,e)}function q(){$(V),$(H),$(Q)}function K(e){null!==e.memoizedState&&j(B,e);var n=V.current,t=sy(n,e.type);n!==t&&(j(H,e),j(V,t))}function Y(e){H.current===e&&($(V),$(H)),B.current===e&&($(B),s7._currentValue=A)}function X(e){if(void 0===nI)try{throw Error()}catch(e){var n=e.stack.trim().match(/\n( *(at )?)/);nI=n&&n[1]||"",nU=-1)":-1l||i[r]!==s[l]){var c="\n"+i[r].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=r&&0<=l);break}}}finally{G=!1,Error.prepareStackTrace=t}return(t=e?e.displayName||e.name:"")?X(t):""}function J(e){try{var n="",t=null;do n+=function(e,n){switch(e.tag){case 26:case 27:case 5:return X(e.type);case 16:return X("Lazy");case 13:return e.child!==n&&null!==n?X("Suspense Fallback"):X("Suspense");case 19:return X("SuspenseList");case 0:case 15:return Z(e.type,!1);case 11:return Z(e.type.render,!1);case 1:return Z(e.type,!0);case 31:return X("Activity");default:return""}}(e,t),t=e,e=e.return;while(e);return n}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}var ee=Object.prototype.hasOwnProperty,en=a.unstable_scheduleCallback,et=a.unstable_cancelCallback,er=a.unstable_shouldYield,el=a.unstable_requestPaint,ea=a.unstable_now,eo=a.unstable_getCurrentPriorityLevel,eu=a.unstable_ImmediatePriority,ei=a.unstable_UserBlockingPriority,es=a.unstable_NormalPriority,ec=a.unstable_LowPriority,ef=a.unstable_IdlePriority,ed=a.log,ep=a.unstable_setDisableYieldValue,em=null,eh=null;function eg(e){if("function"==typeof ed&&ep(e),eh&&"function"==typeof eh.setStrictMode)try{eh.setStrictMode(em,e)}catch(e){}}var ey=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(ev(e)/eb|0)|0},ev=Math.log,eb=Math.LN2,ek=256,ew=4194304;function eS(e){var n=42&e;if(0!==n)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194048&e;case 4194304:case 8388608:case 0x1000000:case 0x2000000:return 0x3c00000&e;case 0x4000000:return 0x4000000;case 0x8000000:return 0x8000000;case 0x10000000:return 0x10000000;case 0x20000000:return 0x20000000;case 0x40000000:return 0;default:return e}}function ex(e,n,t){var r=e.pendingLanes;if(0===r)return 0;var l=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var u=0x7ffffff&r;return 0!==u?0!=(r=u&~a)?l=eS(r):0!=(o&=u)?l=eS(o):t||0!=(t=u&~e)&&(l=eS(t)):0!=(u=r&~a)?l=eS(u):0!==o?l=eS(o):t||0!=(t=r&~e)&&(l=eS(t)),0===l?0:0!==n&&n!==l&&0==(n&a)&&((a=l&-l)>=(t=n&-n)||32===a&&0!=(4194048&t))?n:l}function eE(e,n){return 0==(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)}function ez(){var e=ek;return 0==(4194048&(ek<<=1))&&(ek=256),e}function eC(){var e=ew;return 0==(0x3c00000&(ew<<=1))&&(ew=4194304),e}function eP(e){for(var n=[],t=0;31>t;t++)n.push(e);return n}function eN(e,n){e.pendingLanes|=n,0x10000000!==n&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function eL(e,n,t){e.pendingLanes|=n,e.suspendedLanes&=~n;var r=31-ey(n);e.entangledLanes|=n,e.entanglements[r]=0x40000000|e.entanglements[r]|4194090&t}function eT(e,n){var t=e.entangledLanes|=n;for(e=e.entanglements;t;){var r=31-ey(t),l=1<=tr),to=!1;function tu(e,n){switch(e){case"keyup":return -1!==tn.indexOf(n.keyCode);case"keydown":return 229!==n.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ti(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var ts=!1,tc={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function tf(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===n?!!tc[e.type]:"textarea"===n}function td(e,n,t,r){nw?nS?nS.push(r):nS=[r]:nw=r,0<(n=sr(n,"onChange")).length&&(t=new nQ("onChange","change",null,t,r),e.push({event:t,listeners:n}))}var tp=null,tm=null;function th(e){i8(e,0)}function tg(e){if(ne(eK(e)))return e}function ty(e,n){if("change"===e)return n}var tv=!1;if(nP){if(nP){var tb="oninput"in document;if(!tb){var tk=document.createElement("div");tk.setAttribute("oninput","return;"),tb="function"==typeof tk.oninput}r=tb}else r=!1;tv=r&&(!document.documentMode||9=n)return{node:r,offset:n-e};e=t}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=tL(r)}}function t_(e){e=null!=e&&null!=e.ownerDocument&&null!=e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;for(var n=nn(e.document);n instanceof e.HTMLIFrameElement;){try{var t="string"==typeof n.contentWindow.location.href}catch(e){t=!1}if(t)e=n.contentWindow;else break;n=nn(e.document)}return n}function tF(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&("input"===n&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===n||"true"===e.contentEditable)}var tD=nP&&"documentMode"in document&&11>=document.documentMode,tO=null,tM=null,tA=null,tR=!1;function tI(e,n,t){var r=t.window===t?t.document:9===t.nodeType?t:t.ownerDocument;tR||null==tO||tO!==nn(r)||(r="selectionStart"in(r=tO)&&tF(r)?{start:r.selectionStart,end:r.selectionEnd}:{anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},tA&&tN(tA,r)||(tA=r,0<(r=sr(tM,"onSelect")).length&&(n=new nQ("onSelect","select",null,n,t),e.push({event:n,listeners:r}),n.target=tO)))}function tU(e,n){var t={};return t[e.toLowerCase()]=n.toLowerCase(),t["Webkit"+e]="webkit"+n,t["Moz"+e]="moz"+n,t}var t$={animationend:tU("Animation","AnimationEnd"),animationiteration:tU("Animation","AnimationIteration"),animationstart:tU("Animation","AnimationStart"),transitionrun:tU("Transition","TransitionRun"),transitionstart:tU("Transition","TransitionStart"),transitioncancel:tU("Transition","TransitionCancel"),transitionend:tU("Transition","TransitionEnd")},tj={},tV={};function tH(e){if(tj[e])return tj[e];if(!t$[e])return e;var n,t=t$[e];for(n in t)if(t.hasOwnProperty(n)&&n in tV)return tj[e]=t[n];return e}nP&&(tV=document.createElement("div").style,"AnimationEvent"in window||(delete t$.animationend.animation,delete t$.animationiteration.animation,delete t$.animationstart.animation),"TransitionEvent"in window||delete t$.transitionend.transition);var tQ=tH("animationend"),tB=tH("animationiteration"),tW=tH("animationstart"),tq=tH("transitionrun"),tK=tH("transitionstart"),tY=tH("transitioncancel"),tX=tH("transitionend"),tG=new Map,tZ="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function tJ(e,n){tG.set(e,n),eJ(n,[e])}tZ.push("scrollEnd");var t0="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if("object"==typeof l&&"function"==typeof l.emit)return void l.emit("uncaughtException",e);console.error(e)},t1=[],t2=0,t3=0;function t4(){for(var e=t2,n=t3=t2=0;n>=o,l-=o,rk=1<<32-ey(n)+l|t<h?(g=f,f=null):g=f.sibling;var y=p(l,f,u[h],i);if(null===y){null===f&&(f=g);break}e&&f&&null===y.alternate&&n(l,f),o=a(y,o,h),null===c?s=y:c.sibling=y,c=y,f=g}if(h===u.length)return t(l,f),rL&&rS(l,h),s;if(null===f){for(;hg?(y=h,h=null):y=h.sibling;var b=p(l,h,v.value,s);if(null===b){null===h&&(h=y);break}e&&h&&null===b.alternate&&n(l,h),o=a(b,o,g),null===f?c=b:f.sibling=b,f=b,h=y}if(v.done)return t(l,h),rL&&rS(l,g),c;if(null===h){for(;!v.done;g++,v=u.next())null!==(v=d(l,v.value,s))&&(o=a(v,o,g),null===f?c=v:f.sibling=v,f=v);return rL&&rS(l,g),c}for(h=r(h);!v.done;g++,v=u.next())null!==(v=m(h,l,g,v.value,s))&&(e&&null!==v.alternate&&h.delete(null===v.key?g:v.key),o=a(v,o,g),null===f?c=v:f.sibling=v,f=v);return e&&h.forEach(function(e){return n(l,e)}),rL&&rS(l,g),c}(s,c,f=b.call(f),h)}if("function"==typeof f.then)return u(s,c,ly(f),h);if(f.$$typeof===S)return u(s,c,rG(s,f),h);lb(s,f)}return"string"==typeof f&&""!==f||"number"==typeof f||"bigint"==typeof f?(f=""+f,null!==c&&6===c.tag?(t(s,c.sibling),(h=l(c,f)).return=s):(t(s,c),(h=ri(f,s.mode,h)).return=s),o(s=h)):t(s,c)}(u,s,c,f);return lh=null,h}catch(e){if(e===la||e===lu)throw e;var b=rt(29,e,null,u.mode);return b.lanes=f,b.return=u,b}finally{}}}var lw=lk(!0),lS=lk(!1),lx=!1;function lE(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function lz(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function lC(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function lP(e,n,t){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,0!=(2&uM)){var l=r.pending;return null===l?n.next=n:(n.next=l.next,l.next=n),r.pending=n,n=t7(e),t9(e,null,t),n}return t8(e,r,n,t),t7(e)}function lN(e,n,t){if(null!==(n=n.updateQueue)&&(n=n.shared,0!=(4194048&t))){var r=n.lanes;r&=e.pendingLanes,t|=r,n.lanes=t,eT(e,t)}}function lL(e,n){var t=e.updateQueue,r=e.alternate;if(null!==r&&t===(r=r.updateQueue)){var l=null,a=null;if(null!==(t=t.firstBaseUpdate)){do{var o={lane:t.lane,tag:t.tag,payload:t.payload,callback:null,next:null};null===a?l=a=o:a=a.next=o,t=t.next}while(null!==t);null===a?l=a=n:a=a.next=n}else l=a=n;t={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=t;return}null===(e=t.lastBaseUpdate)?t.firstBaseUpdate=n:e.next=n,t.lastBaseUpdate=n}var lT=!1;function l_(){if(lT){var e=r9;if(null!==e)throw e}}function lF(e,n,t,r){lT=!1;var l=e.updateQueue;lx=!1;var a=l.firstBaseUpdate,o=l.lastBaseUpdate,u=l.shared.pending;if(null!==u){l.shared.pending=null;var i=u,s=i.next;i.next=null,null===o?a=s:o.next=s,o=i;var c=e.alternate;null!==c&&(u=(c=c.updateQueue).lastBaseUpdate)!==o&&(null===u?c.firstBaseUpdate=s:u.next=s,c.lastBaseUpdate=i)}if(null!==a){var f=l.baseState;for(o=0,c=s=i=null,u=a;;){var d=-0x20000001&u.lane,p=d!==u.lane;if(p?(uI&d)===d:(r&d)===d){0!==d&&d===r5&&(lT=!0),null!==c&&(c=c.next={lane:0,tag:u.tag,payload:u.payload,callback:null,next:null});e:{var h=e,g=u;switch(d=n,g.tag){case 1:if("function"==typeof(h=g.payload)){f=h.call(t,f,d);break e}f=h;break e;case 3:h.flags=-65537&h.flags|128;case 0:if(null==(d="function"==typeof(h=g.payload)?h.call(t,f,d):h))break e;f=m({},f,d);break e;case 2:lx=!0}}null!==(d=u.callback)&&(e.flags|=64,p&&(e.flags|=8192),null===(p=l.callbacks)?l.callbacks=[d]:p.push(d))}else p={lane:d,tag:u.tag,payload:u.payload,callback:u.callback,next:null},null===c?(s=c=p,i=f):c=c.next=p,o|=d;if(null===(u=u.next))if(null===(u=l.shared.pending))break;else u=(p=u).next,p.next=null,l.lastBaseUpdate=p,l.shared.pending=null}null===c&&(i=f),l.baseState=i,l.firstBaseUpdate=s,l.lastBaseUpdate=c,null===a&&(l.shared.lanes=0),uW|=o,e.lanes=o,e.memoizedState=f}}function lD(e,n){if("function"!=typeof e)throw Error(i(191,e));e.call(n)}function lO(e,n){var t=e.callbacks;if(null!==t)for(e.callbacks=null,e=0;ea?a:8;var o=O.T,u={};O.T=u,a9(e,!1,n,t);try{var i=l(),s=O.S;if(null!==s&&s(u,i),null!==i&&"object"==typeof i&&"function"==typeof i.then){var c,f,d=(c=[],f={status:"pending",value:null,reason:null,then:function(e){c.push(e)}},i.then(function(){f.status="fulfilled",f.value=r;for(var e=0;e title"))),sd(a,r,t),a[eR]=e,eX(a),r=a;break e;case"link":var o=s1("link","href",l).get(r+(t.href||""));if(o){for(var u=0;u<\/script>",a=a.removeChild(a.firstChild);break;case"select":a="string"==typeof r.is?o.createElement("select",{is:r.is}):o.createElement("select"),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a="string"==typeof r.is?o.createElement(l,{is:r.is}):o.createElement(l)}}a[eR]=n,a[eI]=r;e:for(o=n.child;null!==o;){if(5===o.tag||6===o.tag)a.appendChild(o.stateNode);else if(4!==o.tag&&27!==o.tag&&null!==o.child){o.child.return=o,o=o.child;continue}if(o===n)break;for(;null===o.sibling;){if(null===o.return||o.return===n)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(n.stateNode=a,sd(a,l,r),l){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break;case"img":r=!0;break;default:r=!1}r&&oK(n)}}return oJ(n),oY(n,n.type,null===e?null:e.memoizedProps,n.pendingProps,t),null;case 6:if(e&&null!=n.stateNode)e.memoizedProps!==r&&oK(n);else{if("string"!=typeof r&&null===n.stateNode)throw Error(i(166));if(e=Q.current,rA(n)){if(e=n.stateNode,t=n.memoizedProps,r=null,null!==(l=rP))switch(l.tag){case 27:case 5:r=l.memoizedProps}e[eR]=n,(e=!!(e.nodeValue===t||null!==r&&!0===r.suppressHydrationWarning||ss(e.nodeValue,t)))||rD(n,!0)}else(e=sh(e).createTextNode(r))[eR]=n,n.stateNode=e}return oJ(n),null;case 31:if(t=n.memoizedState,null===e||null!==e.memoizedState){if(r=rA(n),null!==t){if(null===e){if(!r)throw Error(i(318));if(!(e=null!==(e=n.memoizedState)?e.dehydrated:null))throw Error(i(557));e[eR]=n}else rR(),0==(128&n.flags)&&(n.memoizedState=null),n.flags|=4;oJ(n),e=!1}else t=rI(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=t),e=!0;if(!e){if(256&n.flags)return lW(n),n;return lW(n),null}if(0!=(128&n.flags))throw Error(i(558))}return oJ(n),null;case 13:if(r=n.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(l=rA(n),null!==r&&null!==r.dehydrated){if(null===e){if(!l)throw Error(i(318));if(!(l=null!==(l=n.memoizedState)?l.dehydrated:null))throw Error(i(317));l[eR]=n}else rR(),0==(128&n.flags)&&(n.memoizedState=null),n.flags|=4;oJ(n),l=!1}else l=rI(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=l),l=!0;if(!l){if(256&n.flags)return lW(n),n;return lW(n),null}}if(lW(n),0!=(128&n.flags))return n.lanes=t,n;return t=null!==r,e=null!==e&&null!==e.memoizedState,t&&(r=n.child,l=null,null!==r.alternate&&null!==r.alternate.memoizedState&&null!==r.alternate.memoizedState.cachePool&&(l=r.alternate.memoizedState.cachePool.pool),a=null,null!==r.memoizedState&&null!==r.memoizedState.cachePool&&(a=r.memoizedState.cachePool.pool),a!==l&&(r.flags|=2048)),t!==e&&t&&(n.child.flags|=8192),oG(n,n.updateQueue),oJ(n),null;case 4:return q(),null===e&&i7(n.stateNode.containerInfo),oJ(n),null;case 10:return rQ(n.type),oJ(n),null;case 19:if($(lq),null===(r=n.memoizedState))return oJ(n),null;if(l=0!=(128&n.flags),null===(a=r.rendering))if(l)oZ(r,!1);else{if(0!==uB||null!==e&&0!=(128&e.flags))for(e=n.child;null!==e;){if(null!==(a=lK(e))){for(n.flags|=128,oZ(r,!1),n.updateQueue=e=a.updateQueue,oG(n,e),n.subtreeFlags=0,e=t,t=n.child;null!==t;)ra(t,e),t=t.sibling;return j(lq,1&lq.current|2),rL&&rS(n,r.treeForkCount),n.child}e=e.sibling}null!==r.tail&&ea()>u1&&(n.flags|=128,l=!0,oZ(r,!1),n.lanes=4194304)}else{if(!l)if(null!==(e=lK(a))){if(n.flags|=128,l=!0,n.updateQueue=e=e.updateQueue,oG(n,e),oZ(r,!0),null===r.tail&&"hidden"===r.tailMode&&!a.alternate&&!rL)return oJ(n),null}else 2*ea()-r.renderingStartTime>u1&&0x20000000!==t&&(n.flags|=128,l=!0,oZ(r,!1),n.lanes=4194304);r.isBackwards?(a.sibling=n.child,n.child=a):(null!==(e=r.last)?e.sibling=a:n.child=a,r.last=a)}if(null!==r.tail)return e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ea(),e.sibling=null,t=lq.current,j(lq,l?1&t|2:1&t),rL&&rS(n,r.treeForkCount),e;return oJ(n),null;case 22:case 23:return lW(n),lU(),r=null!==n.memoizedState,null!==e?null!==e.memoizedState!==r&&(n.flags|=8192):r&&(n.flags|=8192),r?0!=(0x20000000&t)&&0==(128&n.flags)&&(oJ(n),6&n.subtreeFlags&&(n.flags|=8192)):oJ(n),null!==(t=n.updateQueue)&&oG(n,t.retryQueue),t=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(t=e.memoizedState.cachePool.pool),r=null,null!==n.memoizedState&&null!==n.memoizedState.cachePool&&(r=n.memoizedState.cachePool.pool),r!==t&&(n.flags|=2048),null!==e&&$(ln),null;case 24:return t=null,null!==e&&(t=e.memoizedState.cache),n.memoizedState.cache!==t&&(n.flags|=2048),rQ(r2),oJ(n),null;case 25:case 30:return null}throw Error(i(156,n.tag))}(n.alternate,n,uQ);if(null!==t){uR=t;return}if(null!==(n=n.sibling)){uR=n;return}uR=n=e}while(null!==n);0===uB&&(uB=5)}function iE(e,n){do{var t=function(e,n){switch(rz(n),n.tag){case 1:return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 3:return rQ(r2),q(),0!=(65536&(e=n.flags))&&0==(128&e)?(n.flags=-65537&e|128,n):null;case 26:case 27:case 5:return Y(n),null;case 31:if(null!==n.memoizedState){if(lW(n),null===n.alternate)throw Error(i(340));rR()}return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 13:if(lW(n),null!==(e=n.memoizedState)&&null!==e.dehydrated){if(null===n.alternate)throw Error(i(340));rR()}return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 19:return $(lq),null;case 4:return q(),null;case 10:return rQ(n.type),null;case 22:case 23:return lW(n),lU(),null!==e&&$(ln),65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 24:return rQ(r2),null;default:return null}}(e.alternate,e);if(null!==t){t.flags&=32767,uR=t;return}if(null!==(t=e.return)&&(t.flags|=32768,t.subtreeFlags=0,t.deletions=null),!n&&null!==(e=e.sibling)){uR=e;return}uR=e=t}while(null!==e);uB=6,uR=null}function iz(e,n,t,r,l,a,o,u,s){e.cancelPendingCommit=null;do iT();while(0!==u4);if(0!=(6&uM))throw Error(i(327));if(null!==n){if(n===e.current)throw Error(i(177));if(!function(e,n,t,r,l,a){var o=e.pendingLanes;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=t,e.entangledLanes&=t,e.errorRecoveryDisabledLanes&=t,e.shellSuspendCounter=0;var u=e.entanglements,i=e.expirationTimes,s=e.hiddenUpdates;for(t=o&~t;0g&&(o=g,g=h,h=o);var y=tT(u,h),v=tT(u,g);if(y&&v&&(1!==p.rangeCount||p.anchorNode!==y.node||p.anchorOffset!==y.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var b=f.createRange();b.setStart(y.node,y.offset),p.removeAllRanges(),h>g?(p.addRange(b),p.extend(v.node,v.offset)):(b.setEnd(v.node,v.offset),p.addRange(b))}}}}for(f=[],p=u;p=p.parentNode;)1===p.nodeType&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for("function"==typeof u.focus&&u.focus(),u=0;ut?32:t,O.T=null,t=u7,u7=null;var a=u8,o=u5;if(u4=0,u6=u8=null,u5=0,0!=(6&uM))throw Error(i(331));var u=uM;if(uM|=4,u_(a.current),uE(a,a.current,o,t),uM=u,iW(0,!1),eh&&"function"==typeof eh.onPostCommitFiberRoot)try{eh.onPostCommitFiberRoot(em,a)}catch(e){}return!0}finally{M.p=l,O.T=r,iL(e,n)}}function iF(e,n,t){n=rd(t,n),n=og(e.stateNode,n,2),null!==(e=lP(e,n,2))&&(eN(e,2),iB(e))}function iD(e,n,t){if(3===e.tag)iF(e,e,t);else for(;null!==n;){if(3===n.tag){iF(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"==typeof n.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===u3||!u3.has(r))){e=rd(t,e),null!==(r=lP(n,t=oy(2),2))&&(ov(t,r,n,e),eN(r,2),iB(r));break}}n=n.return}}function iO(e,n,t){var r=e.pingCache;if(null===r){r=e.pingCache=new uO;var l=new Set;r.set(n,l)}else void 0===(l=r.get(n))&&(l=new Set,r.set(n,l));l.has(t)||(uH=!0,l.add(t),e=iM.bind(null,e,n,t),n.then(e,e))}function iM(e,n,t){var r=e.pingCache;null!==r&&r.delete(n),e.pingedLanes|=e.suspendedLanes&t,e.warmLanes&=~t,uA===e&&(uI&t)===t&&(4===uB||3===uB&&(0x3c00000&uI)===uI&&300>ea()-u0?0==(2&uM)&&ip(e,0):uK|=t,uX===uI&&(uX=0)),iB(e)}function iA(e,n){0===n&&(n=eC()),null!==(e=t5(e,n))&&(eN(e,n),iB(e))}function iR(e){var n=e.memoizedState,t=0;null!==n&&(t=n.retryLane),iA(e,t)}function iI(e,n){var t=0;switch(e.tag){case 31:case 13:var r=e.stateNode,l=e.memoizedState;null!==l&&(t=l.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}null!==r&&r.delete(n),iA(e,t)}var iU=null,i$=null,ij=!1,iV=!1,iH=!1,iQ=0;function iB(e){e!==i$&&null===e.next&&(null===i$?iU=i$=e:i$=i$.next=e),iV=!0,ij||(ij=!0,sx(function(){0!=(6&uM)?en(eu,iq):iK()}))}function iW(e,n){if(!iH&&iV){iH=!0;do for(var t=!1,r=iU;null!==r;){if(!n)if(0!==e){var l=r.pendingLanes;if(0===l)var a=0;else{var o=r.suspendedLanes,u=r.pingedLanes;a=0xc000095&(a=(1<<31-ey(42|e)+1)-1&(l&~(o&~u)))?0xc000095&a|1:a?2|a:0}0!==a&&(t=!0,iG(r,a))}else a=uI,0==(3&(a=ex(r,r===uA?a:0,null!==r.cancelPendingCommit||-1!==r.timeoutHandle)))||eE(r,a)||(t=!0,iG(r,a));r=r.next}while(t);iH=!1}}function iq(){iK()}function iK(){iV=ij=!1;var e,n=0;0===iQ||((e=window.event)&&"popstate"===e.type?e===sb||(sb=e,0):(sb=null,1))||(n=iQ);for(var t=ea(),r=null,l=iU;null!==l;){var a=l.next,o=iY(l,t);0===o?(l.next=null,null===r?iU=a:r.next=a,null===a&&(i$=r)):(r=l,(0!==n||0!=(3&o))&&(iV=!0)),l=a}0!==u4&&5!==u4||iW(n,!1),0!==iQ&&(iQ=0)}function iY(e,n){for(var t=e.suspendedLanes,r=e.pingedLanes,l=e.expirationTimes,a=-0x3c00001&e.pendingLanes;0 title"):null)}function s3(e){return"stylesheet"!==e.type||0!=(3&e.state.loading)}var s4=null;function s8(){if(this.count--,0===this.count){if(this.stylesheets)s5(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var s6=null;function s5(e,n){e.stylesheets=null,null!==e.unsuspend&&(e.count++,s6=new Map,n.forEach(s9,e),s6=null,s8.call(e))}function s9(e,n){if(!(4&n.state.loading)){var t=s6.get(e);if(t)var r=t.get(null);else{t=new Map,s6.set(e,t);for(var l=e.querySelectorAll("link[data-precedence],style[data-precedence]"),a=0;a{n.r(t),n.d(t,{ViewerMemory:()=>s});var r=n(95155),a=n(12115),l=n(55545),c=n(36178);function s(){let[e,t]=(0,a.useState)(null);(0,a.useEffect)(()=>{function e(){try{let e=(0,c.wn)();t({mb:Math.round(e.bytes/1e6),maxMb:Math.round(e.max/1e6),volumes:e.volumes})}catch(e){}}e();let n=setInterval(e,2e3);return()=>clearInterval(n)},[]);let n=e&&e.maxMb>0?e.mb/e.maxMb:0;return(0,r.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{title:e?"Viewer memory: ".concat(e.mb," MB of ").concat(e.maxMb," MB, ").concat(e.volumes," volumes resident"):"Viewer memory",className:(0,l.cn)("measurement text-[9px]",n>.8?"text-signal-concern":"text-clinical-dim"),children:e?"".concat(e.mb," MB \xb7 ").concat(e.volumes," vol"):"—"}),(0,r.jsx)("button",{type:"button",onClick:()=>(0,c.CB)(),title:"Release all volumes and rebuild the renderer. Use if the images stop appearing.",className:"rounded border border-clinical-600 px-1.5 py-0.5 text-[9px] text-clinical-muted transition-colors hover:border-signal-info/60 hover:text-clinical-text",children:"reset viewer"})]})}}}]); \ No newline at end of file diff --git a/_next/static/chunks/646.c2c67a3e35c59670.js b/_next/static/chunks/646.c2c67a3e35c59670.js new file mode 100644 index 0000000000000000000000000000000000000000..ae1aaf7f7e5d83e28204fe045300e0a4757691ef --- /dev/null +++ b/_next/static/chunks/646.c2c67a3e35c59670.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[646],{12479:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a}});let r=n(14232),o=r.useLayoutEffect,l=r.useEffect;function a(e){let{headManager:t,reduceComponentsToState:n}=e;function a(){if(t&&t.mountedInstances){let o=r.Children.toArray(Array.from(t.mountedInstances).filter(Boolean));t.updateHead(n(o,e))}}return o(()=>{var n;return null==t||null==(n=t.mountedInstances)||n.add(e.children),()=>{var n;null==t||null==(n=t.mountedInstances)||n.delete(e.children)}}),o(()=>(t&&(t._pendingUpdate=a),()=>{t&&(t._pendingUpdate=a)})),l(()=>(t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null),()=>{t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null)})),null}},18438:(e,t)=>{function n(e){let{ampFirst:t=!1,hybrid:n=!1,hasQuery:r=!1}=void 0===e?{}:e;return t||n&&r}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isInAmpMode",{enumerable:!0,get:function(){return n}})},31646:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return u}});let r=n(64252),o=n(37876),l=r._(n(14232)),a=r._(n(97918)),i={400:"Bad Request",404:"This page could not be found",405:"Method Not Allowed",500:"Internal Server Error"};function d(e){let{req:t,res:n,err:r}=e;return{statusCode:n&&n.statusCode?n.statusCode:r?r.statusCode:404,hostname:window.location.hostname}}let s={error:{fontFamily:'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',height:"100vh",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},desc:{lineHeight:"48px"},h1:{display:"inline-block",margin:"0 20px 0 0",paddingRight:23,fontSize:24,fontWeight:500,verticalAlign:"top"},h2:{fontSize:14,fontWeight:400,lineHeight:"28px"},wrap:{display:"inline-block"}};class u extends l.default.Component{render(){let{statusCode:e,withDarkMode:t=!0}=this.props,n=this.props.title||i[e]||"An unexpected error has occurred";return(0,o.jsxs)("div",{style:s.error,children:[(0,o.jsx)(a.default,{children:(0,o.jsx)("title",{children:e?e+": "+n:"Application error: a client-side exception has occurred"})}),(0,o.jsxs)("div",{style:s.desc,children:[(0,o.jsx)("style",{dangerouslySetInnerHTML:{__html:"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}"+(t?"@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}":"")}}),e?(0,o.jsx)("h1",{className:"next-error-h1",style:s.h1,children:e}):null,(0,o.jsx)("div",{style:s.wrap,children:(0,o.jsxs)("h2",{style:s.h2,children:[this.props.title||e?n:(0,o.jsxs)(o.Fragment,{children:["Application error: a client-side exception has occurred"," ",!!this.props.hostname&&(0,o.jsxs)(o.Fragment,{children:["while loading ",this.props.hostname]})," ","(see the browser console for more information)"]}),"."]})})]})]})}}u.displayName="ErrorPage",u.getInitialProps=d,u.origGetInitialProps=d,("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},55066:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"AmpStateContext",{enumerable:!0,get:function(){return r}});let r=n(64252)._(n(14232)).default.createContext({})},97918:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{default:function(){return y},defaultHead:function(){return c}});let r=n(64252),o=n(88365),l=n(37876),a=o._(n(14232)),i=r._(n(12479)),d=n(55066),s=n(74324),u=n(18438);function c(e){void 0===e&&(e=!1);let t=[(0,l.jsx)("meta",{charSet:"utf-8"},"charset")];return e||t.push((0,l.jsx)("meta",{name:"viewport",content:"width=device-width"},"viewport")),t}function p(e,t){return"string"==typeof t||"number"==typeof t?e:t.type===a.default.Fragment?e.concat(a.default.Children.toArray(t.props.children).reduce((e,t)=>"string"==typeof t||"number"==typeof t?e:e.concat(t),[])):e.concat(t)}n(76456);let f=["name","httpEquiv","charSet","itemProp"];function h(e,t){let{inAmpMode:n}=t;return e.reduce(p,[]).reverse().concat(c(n).reverse()).filter(function(){let e=new Set,t=new Set,n=new Set,r={};return o=>{let l=!0,a=!1;if(o.key&&"number"!=typeof o.key&&o.key.indexOf("$")>0){a=!0;let t=o.key.slice(o.key.indexOf("$")+1);e.has(t)?l=!1:e.add(t)}switch(o.type){case"title":case"base":t.has(o.type)?l=!1:t.add(o.type);break;case"meta":for(let e=0,t=f.length;e{let n=e.key||t;return a.default.cloneElement(e,{key:n})})}let y=function(e){let{children:t}=e,n=(0,a.useContext)(d.AmpStateContext),r=(0,a.useContext)(s.HeadManagerContext);return(0,l.jsx)(i.default,{reduceComponentsToState:h,headManager:r,inAmpMode:(0,u.isInAmpMode)(n),children:t})};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)}}]); \ No newline at end of file diff --git a/_next/static/chunks/658-3bc27228933a69df.js b/_next/static/chunks/658-3bc27228933a69df.js new file mode 100644 index 0000000000000000000000000000000000000000..674642738a2763547365a03bfa79f7cb6abe41b7 --- /dev/null +++ b/_next/static/chunks/658-3bc27228933a69df.js @@ -0,0 +1,1987 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[658],{622:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>n});let n=function(e,t,r){return Math.min(Math.max(t,e),r)}},628:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>u,p$:()=>a});var n=r(17042),i=Object.create(null);function a(e,t){i[e]=t}function o(e,t={}){return i[e]&&i[e](t)}var s={defaultViewAPI:"WebGL",renderers:[],views:[],interactor:null,neverRendered:!0,numberOfLayers:1,childRenderWindows:[]};function l(e,t,r={}){Object.assign(t,s,r),n.Ay.obj(e,t),n.Ay.setGet(e,t,["interactor","numberOfLayers","_views","defaultViewAPI"]),n.Ay.get(e,t,["neverRendered"]),n.Ay.getArray(e,t,["renderers","childRenderWindows"]),n.Ay.moveToProtected(e,t,["views"]),n.Ay.event(e,t,"completion"),t.classHierarchy.push("vtkRenderWindow"),e.addRenderer=r=>{e.hasRenderer(r)||(r.setRenderWindow(e),t.renderers.push(r),e.modified())},e.removeRenderer=r=>{t.renderers=t.renderers.filter(e=>e!==r),e.modified()},e.hasRenderer=e=>-1!==t.renderers.indexOf(e),e.newAPISpecificView=(e,r={})=>o(e||t.defaultViewAPI,r),e.addView=r=>{e.hasView(r)||(r.setRenderable(e),t._views.push(r),e.modified())},e.removeView=r=>{t._views=t._views.filter(e=>e!==r),e.modified()},e.hasView=e=>-1!==t._views.indexOf(e),e.preRender=()=>{t.renderers.forEach(e=>{e.isActiveCameraCreated()||e.resetCamera()})},e.render=()=>{e.preRender(),t.interactor?t.interactor.render():t._views.forEach(e=>e.traverseAllPasses())},e.getStatistics=()=>{let e={propCount:0,invisiblePropCount:0,gpuMemoryMB:0};return t._views.forEach(t=>{t.getGraphicsMemoryInfo&&(e.gpuMemoryMB+=t.getGraphicsMemoryInfo()/1e6)}),t.renderers.forEach(r=>{let n=r.getViewProps(),i=t._views[0].getViewNodeFor(r);n.forEach(t=>{if(t.getVisibility()){e.propCount+=1;let r=t.getMapper&&t.getMapper();if(r&&r.getPrimitiveCount){let t=i.getViewNodeFor(r);if(t){t.getAllocatedGPUMemoryInBytes&&(e.gpuMemoryMB+=t.getAllocatedGPUMemoryInBytes()/1e6);let n=r.getPrimitiveCount();Object.keys(n).forEach(t=>{e[t]||(e[t]=0),e[t]+=n[t]})}}}else e.invisiblePropCount+=1})}),e.str=Object.keys(e).map(t=>`${t}: ${e[t]}`).join("\n"),e},e.captureImages=(r="image/png",i={})=>(n.Ay.setImmediate(e.render),t._views.map(e=>e.captureNextImage?e.captureNextImage(r,i):void 0).filter(e=>!!e)),e.addRenderWindow=r=>!t.childRenderWindows.includes(r)&&(t.childRenderWindows.push(r),e.modified(),!0),e.removeRenderWindow=r=>{let n=t.childRenderWindows.findIndex(e=>e===r);return!(n<0)&&(t.childRenderWindows.splice(n,1),e.modified(),!0)}}var u={newInstance:n.Ay.newInstance(l,"vtkRenderWindow"),extend:l,registerViewConstructor:a,listViewAPIs:function(){return Object.keys(i)},newAPISpecificView:o}},685:(e,t,r)=>{"use strict";r.d(t,{x:()=>l});var n=r(97938),i=r(20549),a=r(1705),o=r(8889),s=r(6297);class l{async load(e,t){let r=this.getDataSet(e);if(!r)throw Error(`[PlanarViewport] No registered planar dataset for ${e}`);if(!t)throw Error(`[PlanarViewport] No load options were provided for ${e}`);if(!r.imageIds.length)throw Error("[PlanarViewport] Cannot load an empty planar dataset");let s=Math.min(Math.max(0,r.initialImageIdIndex??0),r.imageIds.length-1),l=void 0===r.initialImageIdIndex?void 0:s;if(t.renderMode===a.T.VTK_VOLUME_SLICE||t.renderMode===a.T.CPU_VOLUME){let n=(0,o.A)(t.volumeId),a=await (0,i.createAndCacheVolume)(n,{imageIds:r.imageIds});a.load();let s=a.imageIds?a.imageIds:r.imageIds,u=l;if(void 0!==l&&s!==r.imageIds){let e=r.imageIds[l],t=s.indexOf(e);t>=0?u=t:console.warn(`[PlanarViewport] initialImageIdIndex remap failed: imageId "${e}" not found in the volume imageIds; using the original index ${l}`)}return{id:e,type:"image",imageIds:s,initialImageIdIndex:u,acquisitionOrientation:t.acquisitionOrientation,imageData:r.imageData,imageVolume:a,reference:r.reference,renderMode:t.renderMode,useWorldCoordinateImageData:r.useWorldCoordinateImageData,volumeId:n}}let u=r.image&&r.image.imageId===r.imageIds[s]?r.image:await (0,n.loadAndCacheImage)(r.imageIds[s]);return{id:e,type:"image",imageIds:r.imageIds,image:u,imageData:r.imageData,initialImageIdIndex:l,acquisitionOrientation:t.acquisitionOrientation,reference:r.reference,renderMode:t.renderMode,useWorldCoordinateImageData:r.useWorldCoordinateImageData,volumeId:t.volumeId}}getDataSet(e){var t;let r=(0,s.QV)(e);if((t=r)&&"object"==typeof t&&Array.isArray(t.imageIds)&&0!==t.imageIds.length&&(void 0===t.initialImageIdIndex||"number"==typeof t.initialImageIdIndex)&&(void 0===t.volumeId||"string"==typeof t.volumeId))return r}}},760:(e,t,r)=>{"use strict";r.d(t,{D:()=>o});var n=r(70192),i=r(87195);let a=!1;function o(){if(a)return;a=!0;let e=(0,n.G_)(),t=(0,i.zj)().computeWorker,o={maxWorkerInstances:1,autoTerminateOnIdle:t?.autoTerminateOnIdle??{enabled:!0,idleTimeThreshold:2e3}};e.registerWorker("compute",()=>new Worker(r.tu(new URL(r.p+r.u(694),r.b)),{name:"compute",type:void 0}),o)}},836:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>O});var n=r(17042),i=r(99298),a=r(87352),o=r(69927),s=r(57236);r(10463);var l=r(3570),u=r(35666),c=r(5889),d=r(72188),p=r(56929),m=r(61052),h=r(9731),f=r(86077),g=r(32037),v=r(28245),y=r(89988),b=r(67931),I=r(85250),x=r(37843),{vtkErrorMacro:C}=n.o$,{SlicingMode:A}=l.A,T={VBOBuildTime:0,VBOBuildString:null,openGLTexture:null,tris:null,imagemat:null,imagematinv:null,colorTexture:null,pwfTexture:null,labelOutlineThicknessTexture:null,labelOutlineOpacityTexture:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0};function S(e,t,r={}){Object.assign(t,T,r),d.A.extend(e,t,r),y.A.implementReplaceShaderCoincidentOffset(e,t,r),y.A.implementBuildShadersWithReplacements(e,t,r),t.tris=f.Ay.newInstance(),t.imagemat=I.identity(new Float64Array(16)),t.imagematinv=I.identity(new Float64Array(16)),t.projectionToWorld=I.identity(new Float64Array(16)),t.idxToView=I.identity(new Float64Array(16)),t.idxNormalMatrix=x.identity(new Float64Array(9)),t.modelToView=I.identity(new Float64Array(16)),t.projectionToView=I.identity(new Float64Array(16)),(0,n.V0)(e,t,[]),t.VBOBuildTime={},(0,n.WL)(t.VBOBuildTime);function l(r){t.openGLTexture.releaseGraphicsResources(r),[t._colorTransferFunc,t._pwFunc,t._labelOutlineThicknessArray,t._labelOutlineOpacity].forEach(t=>r.unregisterGraphicsResourceUser(t,e))}t.classHierarchy.push("vtkOpenGLImageMapper"),e.buildPass=r=>{if(r){t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");let r=t._openGLRenderWindow;t._openGLRenderWindow=t._openGLRenderer.getLastAncestorOfType("vtkOpenGLRenderWindow"),r&&!r.isDeleted()&&r!==t._openGLRenderWindow&&l(r),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow);let n=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera(),t.openGLCamera),t.renderable.isA("vtkImageMapper")&&t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=(r,n)=>{r&&(t.currentRenderPass=n,e.render())},e.zBufferPass=r=>{r&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,r)=>t.renderable.getResolveCoincidentTopology()==s.XK.PolygonOffset?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{let r=t.openGLImageSlice.getRenderable(),n=t._openGLRenderer.getRenderable();e.renderPiece(n,r)},e.getShaderTemplate=(e,t,r)=>{e.Vertex=g.A,e.Fragment=v.A,e.Geometry=""},e.replaceShaderValues=(r,n,i)=>{let a=r.Vertex,o=r.Fragment;a=h.A.substitute(a,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,a=h.A.substitute(a,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result,a=h.A.substitute(a,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result,a=h.A.substitute(a,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result;let s=t.openGLTexture.getComponents(),l=i.getProperty().getIndependentComponents(),u=["varying vec2 tcoordVCVSOutput;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D texture1;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;"];if(i.getProperty().getUseLabelOutline()&&(u=u.concat(["uniform sampler2D labelOutlineTexture1;","uniform sampler2D labelOutlineOpacityTexture1;"])),l){for(let e=1;e0&&r.push(n)}return r}(` + #ifdef vtkImageLabelOutlineOn + vec3 centerPosIS = fragCoordToIndexSpace(gl_FragCoord); + float centerValue = texture2D(texture1, getSliceCoords(centerPosIS, sliceAxis)).r; + bool pixelOnBorder = false; + vec3 tColor = texture2D(colorTexture1, vec2(centerValue * cscale0 + cshift0, 0.5)).rgb; + float scalarOpacity = texture2D(pwfTexture1, vec2(centerValue * pwfscale0 + pwfshift0, 0.5)).r; + float opacityToUse = scalarOpacity * opacity; + int segmentIndex = int(centerValue * 255.0); + float textureCoordinate = float(segmentIndex - 1) / 1024.0; + float textureValue = texture2D(labelOutlineTexture1, vec2(textureCoordinate, 0.5)).r; + float outlineOpacity = texture2D(labelOutlineOpacityTexture1, vec2(textureCoordinate, 0.5)).r; + int actualThickness = int(textureValue * 255.0); + + if (segmentIndex == 0){ + gl_FragData[0] = vec4(0.0, 0.0, 0.0, 0.0); + return; + } + + for (int i = -actualThickness; i <= actualThickness; i++) { + for (int j = -actualThickness; j <= actualThickness; j++) { + if (i == 0 && j == 0) { + continue; + } + vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i), + gl_FragCoord.y + float(j), + gl_FragCoord.z, gl_FragCoord.w); + vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord); + float value = texture2D(texture1, getSliceCoords(neighborPosIS, sliceAxis)).r; + if (value != centerValue) { + pixelOnBorder = true; + break; + } + } + if (pixelOnBorder == true) { + break; + } + } + if (pixelOnBorder == true) { + gl_FragData[0] = vec4(tColor, outlineOpacity); + } + else { + gl_FragData[0] = vec4(tColor, opacityToUse); + } + #else + float intensity = texture2D(texture1, tcoordVCVSOutput).r; + vec3 tcolor = texture2D(colorTexture1, vec2(intensity * cscale0 + cshift0, 0.5)).rgb; + float scalarOpacity = texture2D(pwfTexture1, vec2(intensity * pwfscale0 + pwfshift0, 0.5)).r; + gl_FragData[0] = vec4(tcolor, scalarOpacity * opacity); + #endif + `)]).result;break;case 2:o=h.A.substitute(o,"//VTK::TCoord::Impl",["vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);","float intensity = tcolor.r*cscale0 + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(intensity, 0.5)).rgb, pwfscale0*tcolor.g + pwfshift0);"]).result;break;case 3:o=h.A.substitute(o,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, opacity);"]).result;break;default:o=h.A.substitute(o,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, tcolor.a);"]).result}t.haveSeenDepthRequest&&(o=h.A.substitute(o,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,o=h.A.substitute(o,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),r.Vertex=a,r.Fragment=o,e.replaceShaderClip(r,n,i),e.replaceShaderCoincidentOffset(r,n,i)},e.replaceShaderClip=(e,r,i)=>{let a=e.Vertex,o=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&((0,n.Bl)("OpenGL has a limit of 6 clipping planes"),e=6),a=h.A.substitute(a,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,a=h.A.substitute(a,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,o=h.A.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,o=h.A.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=a,e.Fragment=o},e.getNeedToRebuildShaders=(e,r,n)=>{let i=t.openGLTexture.getComponents(),a=n.getProperty().getIndependentComponents(),o=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(o=!0),(!!(o||t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||e.getProgram()?.getHandle()===0||e.getShaderSourceTime().getMTime(){if(t.lastBoundBO=r,e.getNeedToRebuildShaders(r,n,i)){let a={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(a,n,i);let o=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);o!==r.getProgram()&&(r.setProgram(o),r.getVAO().releaseGraphicsResources()),r.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(r.getProgram());r.getVAO().bind(),e.setMapperShaderParameters(r,n,i),e.setCameraShaderParameters(r,n,i),e.setPropertyShaderParameters(r,n,i)},e.setMapperShaderParameters=(r,i,a)=>{r.getCABO().getElementCount()&&(t.VBOBuildTime>r.getAttributeUpdateTime().getMTime()||r.getShaderSourceTime().getMTime()>r.getAttributeUpdateTime().getMTime())&&(r.getProgram().isAttributeUsed("vertexMC")&&!r.getVAO().addAttributeArray(r.getProgram(),r.getCABO(),"vertexMC",r.getCABO().getVertexOffset(),r.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)&&C("Error setting vertexMC in shader VAO."),r.getProgram().isAttributeUsed("tcoordMC")&&r.getCABO().getTCoordOffset()&&!r.getVAO().addAttributeArray(r.getProgram(),r.getCABO(),"tcoordMC",r.getCABO().getTCoordOffset(),r.getCABO().getStride(),t.context.FLOAT,r.getCABO().getTCoordComponents(),t.context.FALSE)&&C("Error setting tcoordMC in shader VAO."),r.getAttributeUpdateTime().modified());let o=t.openGLTexture.getTextureUnit();r.getProgram().setUniformi("texture1",o);let s=t.openGLTexture.getComponents(),l=a.getProperty().getIndependentComponents();if(l)for(let e=0;e6&&((0,n.Bl)("OpenGL has a limit of 6 clipping planes"),e=6);let i=r.getCABO().getCoordShiftAndScaleEnabled()?r.getCABO().getInverseShiftAndScaleMatrix():null,o=i?I.copy(t.imagematinv,a.getMatrix()):a.getMatrix();i&&(I.transpose(o,o),I.multiply(o,o,i),I.transpose(o,o)),I.transpose(t.imagemat,t.currentInput.getIndexToWorld()),I.multiply(t.imagematinv,o,t.imagemat);let s=[];for(let r=0;r{let a=r.getProgram(),o=t.openGLImageSlice.getKeyMatrices(),s=t.currentInput,l=s.getIndexToWorld();I.multiply(t.imagemat,o.mcwc,l);let u=t.openGLCamera.getKeyMatrices(n);if(I.multiply(t.imagemat,u.wcpc,t.imagemat),r.getCABO().getCoordShiftAndScaleEnabled()){let e=r.getCABO().getInverseShiftAndScaleMatrix();I.multiply(t.imagemat,t.imagemat,e)}if(a.setUniformMatrix("MCPCMatrix",t.imagemat),!0===i.getProperty().getUseLabelOutline()){let r=s.getWorldToIndex(),i=s.getDimensions(),o=t.renderable.getClosestIJKAxis().ijkMode;o===A.NONE&&(o=A.K),a.setUniform3i("imageDimensions",i[0],i[1],i[2]),a.setUniformi("sliceAxis",o),a.setUniformMatrix("vWCtoIDX",r);let l=t.openGLCamera.getKeyMatrices(n);I.invert(t.projectionToWorld,l.wcpc),t.openGLCamera.getKeyMatrices(n),a.setUniformMatrix("PCWCMatrix",t.projectionToWorld);let u=e.getRenderTargetSize();a.setUniformf("vpWidth",u[0]),a.setUniformf("vpHeight",u[1]);let c=e.getRenderTargetOffset();a.setUniformf("vpOffsetX",c[0]/u[0]),a.setUniformf("vpOffsetY",c[1]/u[1])}},e.setPropertyShaderParameters=(e,t,r)=>{let n=e.getProgram(),i=r.getProperty().getOpacity();n.setUniformf("opacity",i)},e.renderPieceStart=(r,n)=>{e.updateBufferObjects(r,n),t.lastBoundBO=null},e.renderPieceDraw=(r,n)=>{let i=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),n.getProperty().getUseLabelOutline()&&(t.labelOutlineThicknessTexture.activate(),t.labelOutlineOpacityTexture.activate()),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,r,n),i.drawArrays(i.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),n.getProperty().getUseLabelOutline()&&(t.labelOutlineThicknessTexture.deactivate(),t.labelOutlineOpacityTexture.deactivate()),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.renderPiece=(r,n)=>{if(e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getCurrentImage(),e.invokeEvent({type:"EndEvent"}),!t.currentInput)return void C("No input!");e.renderPieceStart(r,n),e.renderPieceDraw(r,n),e.renderPieceFinish(r,n)},e.updateBufferObjects=(t,r)=>{e.getNeedToRebuildBufferObjects(t,r)&&e.buildBufferObjects(t,r)},e.getNeedToRebuildBufferObjects=(r,n)=>t.VBOBuildTime.getMTime(){let s,l=t.currentInput;if(!l)return;let d=l.getPointData()&&l.getPointData().getScalars();if(!d)return;let p=d.getDataType(),h=d.getNumberOfComponents(),f=n.getProperty(),g=f.getInterpolationType(),v=f.getIndependentComponents(),y=v?h:1,I=v?2*y:1,x=[];for(let e=0;e1);let y=[A.X,A.Y,A.Z].includes(t.renderable.getSlicingMode())?R:M,b=l.getSpatialExtent(),I=d.getData(),x=null;if(D===A.I){x=new I.constructor(e[2]*e[1]*h);let t=0;for(let r=0;r{let n=r.getProperty().getLabelOutlineOpacity();"number"==typeof n&&(n=t._cachedLabelOutlineOpacityObj?.[0]===n?t._cachedLabelOutlineOpacityObj:[n],t._cachedLabelOutlineOpacityObj=n);let a=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(a?.oglObject?.getHandle()&&a?.hash===o)t.labelOutlineOpacityTexture=a.oglObject;else{let r=t.renderable.getLabelOutlineTextureWidth();r<=0&&(r=t.context.getParameter(t.context.MAX_TEXTURE_SIZE));let a=new Float32Array(+r);for(let e=0;e{let n=r.getProperty().getLabelOutlineThicknessByReference(),a=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(a?.oglObject?.getHandle()&&a?.hash===o)t.labelOutlineThicknessTexture=a.oglObject;else{let r=t.renderable.getLabelOutlineTextureWidth();r<=0&&(r=t.context.getParameter(t.context.MAX_TEXTURE_SIZE));let a=new Uint8Array(+r);for(let e=0;e{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];let{usize:e,vsize:r}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,r]},e.getRenderTargetOffset=()=>{let{lowerLeftU:e,lowerLeftV:r}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,r]},e.delete=(0,n.cy)(()=>{t._openGLRenderWindow&&l(t._openGLRenderWindow)},e.delete)}var w=(0,n.UI)(S,"vtkOpenGLImageMapper"),O={newInstance:w,extend:S};(0,p.c9)("vtkAbstractImageMapper",w)},850:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});class n{static imageIdToFrames(e){let t=e.match(this.frameRangeExtractor);if(!t||!t[2])return null;let r=t[2].split("-").map(e=>Number(e));return 1===r.length?r[0]:r}static imageIdToFrameEnd(e){let t=this.imageIdToFrames(e);return Array.isArray(t)?t[1]:t}static imageIdToFrameStart(e){let t=this.imageIdToFrames(e);return Array.isArray(t)?t[0]:t}static framesToString(e){return Array.isArray(e)?`${e[0]}-${e[1]}`:String(e)}static framesToImageId(e,t){let r=e.match(this.frameRangeExtractor);if(!r||!r[2])return null;let n=this.framesToString(t);return e.replace(this.frameRangeExtractor,`${r[1]}${n}`)}}n.frameRangeExtractor=/(\/frames\/|[&?]frameNumber=)([^/&?]*)/i;let i=n},1049:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(50923),i=r(97633),a=r(39083);function o(e){let{width:t,height:r}=e.getCanvas(),{sliceToIndexMatrix:o,indexToSliceMatrix:s}=e.getSliceViewInfo(),l=(0,a.e)(e,[0,0]),u=(0,a.e)(e,[t-1,0]),c=(0,a.e)(e,[0,r-1]),d=n.jb(n.vt(),u,l),p=n.jb(n.vt(),c,l),m=n.$A(n.vt(),d,p);n.S8(d,d),n.S8(p,p),n.S8(m,m);let h=Math.max(Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2])),f=Math.max(Math.abs(p[0]),Math.abs(p[1]),Math.abs(p[2]));if(!i.aI(1,h)||!i.aI(1,f))throw Error("getCurrentVolumeViewportSlice is not available for rotate/oblique viewports");let{voxelManager:g}=e.getImageData(),v=e.getSliceViewInfo(),y=g.getSliceData(v);return{width:v.width,height:v.height,scalarData:y,sliceToIndexMatrix:o,indexToSliceMatrix:s}}},1222:(e,t,r)=>{"use strict";let n=r(24757),i=r(6975);function a(e,t){return function(){throw Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}e.exports.Type=r(50026),e.exports.Schema=r(62069),e.exports.FAILSAFE_SCHEMA=r(14099),e.exports.JSON_SCHEMA=r(91180),e.exports.CORE_SCHEMA=r(34533),e.exports.DEFAULT_SCHEMA=r(87431),e.exports.load=n.load,e.exports.loadAll=n.loadAll,e.exports.dump=i.dump,e.exports.YAMLException=r(26735),e.exports.types={binary:r(21598),float:r(14291),map:r(1343),null:r(63518),pairs:r(59052),set:r(44165),timestamp:r(42109),bool:r(58011),int:r(27492),merge:r(67633),omap:r(2666),seq:r(88822),str:r(25970)},e.exports.safeLoad=a("safeLoad","load"),e.exports.safeLoadAll=a("safeLoadAll","loadAll"),e.exports.safeDump=a("safeDump","dump")},1343:(e,t,r)=>{"use strict";e.exports=new(r(50026))("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},1537:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>u});var n=r(17042),i=r(9731),a=r(80187),o=["lastShaderProgramBound","context","_openGLRenderWindow"],s={lastShaderProgramBound:null,shaderPrograms:null,context:null};function l(e,t,r={}){Object.assign(t,s,r),t.shaderPrograms={},n.Ay.obj(e,t),n.Ay.setGet(e,t,o),n.Ay.moveToProtected(e,t,["openGLRenderWindow"]),t.classHierarchy.push("vtkShaderCache"),e.replaceShaderValues=(e,r,n)=>{let a=r;n.length>0&&(a=i.A.substitute(a,"VSOut","GSOut").result);let o=t._openGLRenderWindow.getWebgl2(),s="\n",l="#version 100\n";o?l="#version 300 es\n#define attribute in\n#define textureCube texture\n#define texture2D texture\n#define textureCubeLod textureLod\n#define texture2DLod textureLod\n":(t.context.getExtension("OES_standard_derivatives"),t.context.getExtension("EXT_frag_depth")&&(s="#extension GL_EXT_frag_depth : enable\n"),t.context.getExtension("EXT_shader_texture_lod")&&(s+="#extension GL_EXT_shader_texture_lod : enable\n#define textureCubeLod textureCubeLodEXT\n#define texture2DLod texture2DLodEXT")),a=i.A.substitute(a,"//VTK::System::Dec",[`${l} +`,o?"":"#extension GL_OES_standard_derivatives : enable\n",s,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;let u=i.A.substitute(e,"//VTK::System::Dec",[`${l} +`,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;if(o){u=i.A.substitute(u,"varying","out").result,a=i.A.substitute(a,"varying","in").result;let e="",t=0;for(;a.includes(`gl_FragData[${t}]`);)a=i.A.substitute(a,`gl_FragData\\[${t}\\]`,`fragOutput${t}`).result,e+=`layout(location = ${t}) out vec4 fragOutput${t}; +`,t++;a=i.A.substitute(a,"//VTK::Output::Dec",e).result}return{VSSource:u,FSSource:a,GSSource:i.A.substitute(n,"//VTK::System::Dec",l).result}},e.readyShaderProgramArray=(t,r,n)=>{let i=e.replaceShaderValues(t,r,n),a=e.getShaderProgram(i.VSSource,i.FSSource,i.GSSource);return e.readyShaderProgram(a)},e.readyShaderProgram=t=>t&&(t.getCompiled()||t.compileShader())&&e.bindShaderProgram(t)?t:null,e.getShaderProgram=(e,r,n)=>{let o=`${e}${r}${n}`,s=a.hash(o);if(!(s in t.shaderPrograms)){let a=i.A.newInstance();return a.setContext(t.context),a.getVertexShader().setSource(e),a.getFragmentShader().setSource(r),n&&a.getGeometryShader().setSource(n),a.setMd5Hash(s),t.shaderPrograms[s]=a,a}return t.shaderPrograms[s]},e.releaseGraphicsResources=r=>{e.releaseCurrentShaderProgram(),Object.keys(t.shaderPrograms).map(e=>t.shaderPrograms[e]).forEach(e=>e.cleanup()),t.shaderPrograms={}},e.releaseCurrentShaderProgram=()=>{t.lastShaderProgramBound&&(t.lastShaderProgramBound.cleanup(),t.lastShaderProgramBound=null)},e.bindShaderProgram=e=>(t.lastShaderProgramBound===e||(t.lastShaderProgramBound&&t.lastShaderProgramBound.release(),e.bind(),t.lastShaderProgramBound=e),1)}var u={newInstance:n.Ay.newInstance(l,"vtkShaderCache"),extend:l}},1571:(e,t,r)=>{"use strict";r.d(t,{A:()=>R});var n=r(70192),i=r(4101),a=r(78378),o=r(17964),s=r(50923),l=r(62775),u=r(62196),c=r(60212),d=r(34699),p=r(79159),m=r(33845),h=r(93022),f=r(4546),g=r(28402);let{addCanvasPointsToArray:v,pointsAreWithinCloseContourProximity:y,getFirstLineSegmentIntersectionIndexes:b,getSubPixelSpacingAndXYDirections:I}=m.XL;function x(e,t,r){let{currentPoints:s,element:l}=e.detail,c=s.canvas,{viewport:d}=(0,n.kJ)(l),p=(0,u.A)(e.detail.event)===this.configuration.contourHoleAdditionModifierKey,{spacing:m,xDir:h,yDir:f}=I(d,this.configuration.subPixelResolution)||{};m&&h&&f&&(this.isDrawing=!0,this.drawData={canvasPoints:[c],polylineIndex:0,contourHoleProcessingEnabled:p,newAnnotation:!0},this.commonData={annotation:t,viewportIdsToRender:r,spacing:m,xDir:h,yDir:f,movingTextBox:!1},o.wk.isInteractingWithTool=!0,l.addEventListener(a.sV.MOUSE_UP,this.mouseUpDrawCallback),l.addEventListener(a.sV.MOUSE_DRAG,this.mouseDragDrawCallback),l.addEventListener(a.sV.MOUSE_CLICK,this.mouseUpDrawCallback),l.addEventListener(a.sV.TOUCH_END,this.mouseUpDrawCallback),l.addEventListener(a.sV.TOUCH_DRAG,this.mouseDragDrawCallback),l.addEventListener(a.sV.TOUCH_TAP,this.mouseUpDrawCallback),(0,i.lY)(l))}function C(e){o.wk.isInteractingWithTool=!1,e.removeEventListener(a.sV.MOUSE_UP,this.mouseUpDrawCallback),e.removeEventListener(a.sV.MOUSE_DRAG,this.mouseDragDrawCallback),e.removeEventListener(a.sV.MOUSE_CLICK,this.mouseUpDrawCallback),e.removeEventListener(a.sV.TOUCH_END,this.mouseUpDrawCallback),e.removeEventListener(a.sV.TOUCH_DRAG,this.mouseDragDrawCallback),e.removeEventListener(a.sV.TOUCH_TAP,this.mouseUpDrawCallback),(0,i.Q_)(e)}function A(e){let t=e.detail,{currentPoints:r,element:i}=t,o=r.world,l=r.canvas,{viewport:u}=(0,n.kJ)(i),{annotation:p,viewportIdsToRender:m,xDir:h,yDir:f,spacing:g,movingTextBox:b}=this.commonData,{polylineIndex:I,canvasPoints:x,newAnnotation:C}=this.drawData;this.createMemo(i,p,{newAnnotation:C});let A=x[x.length-1],T=u.canvasToWorld(A),S=s.vt();s.Re(S,o,T);let w=Math.abs(s.Om(S,h)),O=Math.abs(s.Om(S,f));if(!(w<=g[0])||!(O<=g[1])){if(b){this.isDrawing=!1;let{deltaPoints:e}=t,r=e.world,{textBox:n}=p.data.handles,{worldPosition:i}=n;i[0]+=r[0],i[1]+=r[1],i[2]+=r[2],n.hasMoved=!0}else{let t=this.findCrossingIndexDuringCreate(e);if(void 0!==t&&y(x[0],x[t],this.configuration.closeContourProximity))this.applyCreateOnCross(e,t);else{let e=v(i,x,l,this.commonData);this.drawData.polylineIndex=I+e}p.invalidated=!0}(0,c.A)(m),p.invalidated&&(0,d.triggerAnnotationModified)(p,i,a.wi.HandlesUpdated)}}function T(e){let{allowOpenContours:t}=this.configuration,{canvasPoints:r,contourHoleProcessingEnabled:n}=this.drawData,i=r[0],a=r[r.length-1],{element:o}=e.detail;this.doneEditMemo(),this.drawData.newAnnotation=!1,t&&!y(i,a,this.configuration.closeContourProximity)?this.completeDrawOpenContour(o,{contourHoleProcessingEnabled:n}):this.completeDrawClosedContour(o,{contourHoleProcessingEnabled:n})}function S(e,t){this.removeCrossedLinesOnCompleteDraw();let{canvasPoints:r}=this.drawData,{contourHoleProcessingEnabled:i,minPointsToSave:a}=t??{};if(a&&r.length{"use strict";r.d(t,{T:()=>n.T});var n=r(96167)},1760:(e,t,r)=>{"use strict";r.d(t,{A:()=>T});var n=r(70192),i=r(20644),a=r(78378),o=r(93022),s=r(73904),l=r(53686),u=r(74065),c=r(83101);class d extends l.A{constructor(e,t){super(e,t)}static getContourSequence(e,t){let{data:r}=e,n=[];for(let e of r.contour.polyline)for(let t of e)n.push(t.toFixed(2));let{referencedImageId:i}=e.metadata,a=t.get("ImageSopInstanceReference",i);return{NumberOfContourPoints:n.length/3,ContourImageSequence:a,ContourGeometricType:"CLOSED_PLANAR",ContourData:n}}renderAnnotation(e,t){let r=!1,{viewport:n}=e,{element:i}=n;if(!n.getRenderingEngine())return console.warn("Rendering Engine has been destroyed"),r;let a=(0,o.getAnnotations)(this.getToolName(),i);if(!a?.length||(a=this.filterInteractableAnnotationsForElement(i,a),!a?.length))return r;let s=this.getTargetId(n),l={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let n=0;nthis.moveAnnotation(e,t))}updateContourPolyline(e,t,r,n){let i=this.configuration?.decimate||{};(0,u.A)(e,t,r,{decimate:{enabled:!!i.enabled,epsilon:i.epsilon},updateWindingDirection:n?.updateWindingDirection})}getPolylinePoints(e){return e.data.contour?.polyline??e.data.polyline}renderAnnotationInstance(e){let{enabledElement:t,annotationStyle:r,svgDrawingHelper:n}=e,i=e.annotation;if(i.parentAnnotationUID)return;let{annotationUID:a}=i,{viewport:o}=t,{worldToCanvas:l}=o,u=this.getPolylinePoints(i).map(e=>l(e)),{lineWidth:d,lineDash:p,color:m,fillColor:h,fillOpacity:f}=r,g=[u,...(0,c.A)(i,o)];return(0,s.kd)(n,a,"contourPolyline",g,{color:m,lineDash:p,lineWidth:Math.max(.1,d),fillColor:h,fillOpacity:f}),!0}}var p=r(49007),m=r(91401),h=r(98723),f=r(64029),g=r(42306),v=r(51200),y=r(41067),b=r(69435),I=r(46702),x=r(86779),C=r(88710),A=r(32207);class T extends d{constructor(e,t){super(e,t),this.configuration.interpolation?.enabled&&m.A.addTool(this.getToolName())}recordTouchLiftCommit(e){this._touchLiftCommit={canvasPoint:e,time:Date.now()}}isTouchTapEchoOfLiftCommit(e){if(!this._touchLiftCommit)return!1;let{canvasPoint:t,time:r}=this._touchLiftCommit;return Date.now()-r<=2*T.TOUCH_TAP_TOLERANCE_MS?(0,i.A)(e,t)<=T.TOUCH_TAP_MAX_CANVAS_DISTANCE&&(this._touchLiftCommit=void 0,!0):(this._touchLiftCommit=void 0,!1)}onSetToolConfiguration(){this.configuration.interpolation?.enabled?m.A.addTool(this.getToolName()):m.A.removeTool(this.getToolName())}isContourSegmentationTool(){return!0}createAnnotation(e){let{element:t}=e.detail,r=(0,n.kJ)(t);if(!r)return;let{viewport:i}=r,a=super.createAnnotation(e);if(!this.isContourSegmentationTool())return a;let o=(0,y.T)(i.id);if(!o)throw Error("No active segmentation detected, create one before using scissors tool");if(!o.representationData.Contour)throw Error("A contour segmentation must be active");let{segmentationId:s}=o,l=(0,I.Q)(s);return n.BF.deepMerge(a,{data:{segmentation:{segmentationId:s,segmentIndex:l}}})}addAnnotation(e,t){let r=super.addAnnotation(e,t);return this.isContourSegmentationTool()&&(0,h.V0)(e),r}cancelAnnotation(e){this.isContourSegmentationTool()&&(0,h.M)(e),super.cancelAnnotation(e)}getAnnotationStyle(e){let t=super.getAnnotationStyle(e);if(!this.isContourSegmentationTool())return t;let r=this._getContourSegmentationStyle(e);return n.BF.deepMerge(t,r)}renderAnnotationInstance(e){let{annotation:t}=e,{invalidated:r}=t,n=super.renderAnnotationInstance(e);if(r&&this.isContourSegmentationTool()){let{segmentationId:e}=t.data.segmentation;(0,p.triggerSegmentationDataModified)(e);let r=(0,b.P)(e).map(e=>{let t=(0,g.getToolGroupForViewport)(e);return t?.id}).filter(e=>null!=e);(0,f._)(r)}return n}filterInteractableAnnotationsForElement(e,t){if(!t||!t.length)return;let r=super.filterInteractableAnnotationsForElement(e,t);if(!r||!r.length)return;let{viewport:i}=(0,n.kJ)(e);return r.filter(e=>{let t=e?.data?.segmentation?.segmentationId;return!t||!!A._6.getSegmentationRepresentation(i.id,{segmentationId:t,type:a.D_.Contour})})}_getContourSegmentationStyle(e){let t=e.annotation,{segmentationId:r,segmentIndex:n}=t.data.segmentation,{viewportId:i}=e.styleSpecifier,o=(0,v.r$)(i,{segmentationId:r});if(!o?.length)return{};o.length>1?o.find(e=>e.segmentationId===r&&e.type===a.D_.Contour):o[0];let{autoGenerated:s}=t,l=(0,x.getLockedSegmentIndices)(r).includes(n),{color:u,fillColor:c,lineWidth:d,fillOpacity:p,lineDash:m,visibility:h}=(0,C.u)({segmentationId:r,segmentIndex:n,viewportId:i,autoGenerated:s});return{color:u,fillColor:c,lineWidth:d,fillOpacity:p,lineDash:m,textbox:{color:u},visibility:h,locked:l}}}T.PreviewSegmentIndex=255},1827:(e,t,r)=>{"use strict";function n(e,t,r,n){let[i,a,o]=t,s=i*a,l=0,u=0,c=0,[d,p,m]=r.map(Math.round);for(let t=m-n;t<=m+n;t++)if(!(t<0)&&!(t>=o)){for(let r=p-n;r<=p+n;r++)if(!(r<0)&&!(r>=a))for(let a=d-n;a<=d+n;a++){if(a<0||a>=i)continue;let n=e[t*s+r*i+a];l+=n,u+=n*n,c++}}if(0===c){let t=m*s+p*i+d;return t>=0&&tn})},1943:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>I});var n=r(17042),i=r(11701),a=r(58804),o=r(13827),s=r(38376),{vtkErrorMacro:l}=n.Ay,u={background:[0,0,0],background2:[.2,.2,.2],gradientBackground:!1,viewport:[0,0,1,1],aspect:[1,1],pixelAspect:[1,1],props:[],actors2D:[]};function c(e,t,r={}){Object.assign(t,u,r),n.Ay.obj(e,t),n.Ay.event(e,t,"event"),n.Ay.setGet(e,t,["gradientBackground"]),n.Ay.setGetArray(e,t,["viewport"],4),n.Ay.setGetArray(e,t,["background","background2"],3),t.classHierarchy.push("vtkViewport"),e.getViewProps=()=>t.props,e.hasViewProp=e=>t.props.includes(e),e.addViewProp=r=>{r&&!e.hasViewProp(r)&&t.props.push(r)},e.removeViewProp=e=>{let r=t.props.filter(t=>t!==e);t.props.length!==r.length&&(t.props=r)},e.removeAllViewProps=()=>{t.props=[]},e.getViewPropsWithNestedProps=()=>{let e=[];t.actors2D=[];for(let r=0;r0)?t.actors2D=t.actors2D.concat(n):function e(t,r=[]){r.push(t);let n=t.getNestedProps();if(n&&n.length)for(let t=0;te.getLayerNumber()-t.getLayerNumber()),e=e.concat(t.actors2D)},e.addActor2D=e.addViewProp,e.removeActor2D=t=>{e.removeViewProp(t)},e.getActors2D=()=>(t.actors2D=[],t.props.forEach(e=>{t.actors2D=t.actors2D.concat(e.getActors2D())}),t.actors2D),e.displayToView=()=>l("call displayToView on your view instead"),e.viewToDisplay=()=>l("callviewtodisplay on your view instead"),e.getSize=()=>l("call getSize on your View instead"),e.normalizedDisplayToProjection=(t,r,n)=>{let i=e.normalizedDisplayToNormalizedViewport(t,r,n);return e.normalizedViewportToProjection(i[0],i[1],i[2])},e.normalizedDisplayToNormalizedViewport=(e,r,n)=>{let i=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[(e-t.viewport[0])/i[0],(r-t.viewport[1])/i[1],n]},e.normalizedViewportToProjection=(e,t,r)=>[2*e-1,2*t-1,2*r-1],e.projectionToNormalizedDisplay=(t,r,n)=>{let i=e.projectionToNormalizedViewport(t,r,n);return e.normalizedViewportToNormalizedDisplay(i[0],i[1],i[2])},e.normalizedViewportToNormalizedDisplay=(e,r,n)=>{let i=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[e*i[0]+t.viewport[0],r*i[1]+t.viewport[1],n]},e.projectionToNormalizedViewport=(e,t,r)=>[(e+1)*.5,(t+1)*.5,(r+1)*.5],e.PickPropFrom=()=>l("vtkViewport::PickPropFrom - NOT IMPLEMENTED")}n.Ay.newInstance(c,"vtkViewport");var d={extend:c},p=r(85250),m=r(50923),{vtkDebugMacro:h,vtkErrorMacro:f,vtkWarningMacro:g}=n.o$;function v(e){return()=>f(`vtkRenderer::${e} - NOT IMPLEMENTED`)}var y={pickedProp:null,activeCamera:null,allBounds:[],ambient:[1,1,1],allocatedRenderTime:100,timeFactor:1,automaticLightCreation:!0,twoSidedLighting:!0,lastRenderTimeInSeconds:-1,renderWindow:null,lights:[],actors:[],volumes:[],lightFollowCamera:!0,numberOfPropsRendered:0,propArray:null,pathArray:null,layer:0,preserveColorBuffer:!1,preserveDepthBuffer:!1,computeVisiblePropBounds:(0,i.Z6)(),interactive:!0,nearClippingPlaneTolerance:0,clippingRangeExpansion:.05,erase:!0,draw:!0,useShadows:!1,useDepthPeeling:!1,occlusionRatio:0,maximumNumberOfPeels:4,selector:null,delegate:null,texturedBackground:!1,backgroundTexture:null,environmentTexture:null,environmentTextureDiffuseStrength:1,environmentTextureSpecularStrength:1,useEnvironmentTextureAsBackground:!1,pass:0};function b(e,t,r={}){for(Object.assign(t,y,r),d.extend(e,t,r),t.background||(t.background=[0,0,0,1]);t.background.length<3;)t.background.push(0);3===t.background.length&&t.background.push(1),(0,n.Jt)(e,t,["_renderWindow","allocatedRenderTime","timeFactor","lastRenderTimeInSeconds","numberOfPropsRendered","lastRenderingUsedDepthPeeling","selector"]),(0,n.V0)(e,t,["twoSidedLighting","lightFollowCamera","automaticLightCreation","erase","draw","nearClippingPlaneTolerance","clippingRangeExpansion","backingStore","interactive","layer","preserveColorBuffer","preserveDepthBuffer","useDepthPeeling","occlusionRatio","maximumNumberOfPeels","delegate","backgroundTexture","texturedBackground","environmentTexture","environmentTextureDiffuseStrength","environmentTextureSpecularStrength","useEnvironmentTextureAsBackground","useShadows","pass"]),(0,n._e)(e,t,["actors","volumes","lights"]),(0,n.eH)(e,t,["background"],4,1),(0,n.Vy)(e,t,["renderWindow"]);t.classHierarchy.push("vtkRenderer");let l={type:"ComputeVisiblePropBoundsEvent",renderer:e},u={type:"ResetCameraClippingRangeEvent",renderer:e},c={type:"ResetCameraEvent",renderer:e};e.updateCamera=()=>(t.activeCamera||(h("No cameras are on, creating one."),e.getActiveCameraAndResetIfCreated()),t.activeCamera.render(e),!0),e.updateLightsGeometryToFollowCamera=()=>{let r=e.getActiveCameraAndResetIfCreated();t.lights.forEach(e=>{e.lightTypeIsSceneLight()||(e.lightTypeIsHeadLight()?(e.setPositionFrom(r.getPositionByReference()),e.setFocalPointFrom(r.getFocalPointByReference()),e.modified(r.getMTime())):e.lightTypeIsCameraLight()?e.setTransformMatrix(r.getCameraLightTransformMatrix(p.create())):f("light has unknown light type",e.get()))})},e.updateLightGeometry=()=>!t.lightFollowCamera||e.updateLightsGeometryToFollowCamera(),e.allocateTime=v("allocateTime"),e.updateGeometry=v("updateGeometry"),e.getVTKWindow=()=>t._renderWindow,e.setLayer=r=>{h(e.getClassName(),e,"setting Layer to ",r),t.layer!==r&&(t.layer=r,e.modified()),e.setPreserveColorBuffer(!!r)},e.setActiveCamera=r=>t.activeCamera!==r&&(t.activeCamera=r,e.modified(),e.invokeEvent({type:"ActiveCameraEvent",camera:r}),!0),e.makeCamera=()=>{let t=o.Ay.newInstance();return e.invokeEvent({type:"CreateCameraEvent",camera:t}),t},e.getActiveCamera=()=>(t.activeCamera||(t.activeCamera=e.makeCamera()),t.activeCamera),e.getActiveCameraAndResetIfCreated=()=>(t.activeCamera||(e.getActiveCamera(),e.resetCamera()),t.activeCamera),e.getActors=()=>(t.actors=[],t.props.forEach(e=>{t.actors=t.actors.concat(e.getActors())}),t.actors),e.addActor=e.addViewProp,e.removeActor=r=>{t.actors=t.actors.filter(e=>e!==r),e.removeViewProp(r),e.modified()},e.removeAllActors=()=>{e.getActors().forEach(t=>{e.removeViewProp(t)}),t.actors=[],e.modified()},e.getVolumes=()=>(t.volumes=[],t.props.forEach(e=>{t.volumes=t.volumes.concat(e.getVolumes())}),t.volumes),e.addVolume=e.addViewProp,e.removeVolume=r=>{t.volumes=t.volumes.filter(e=>e!==r),e.removeViewProp(r),e.modified()},e.removeAllVolumes=()=>{e.getVolumes().forEach(t=>{e.removeViewProp(t)}),t.volumes=[],e.modified()},e.hasLight=e=>t.lights.includes(e),e.addLight=r=>{r&&!e.hasLight(r)&&(t.lights.push(r),e.modified())},e.removeLight=r=>{t.lights=t.lights.filter(e=>e!==r),e.modified()},e.removeAllLights=()=>{t.lights=[],e.modified()},e.setLightCollection=r=>{t.lights=r,e.modified()},e.makeLight=s.Ay.newInstance,e.createLight=()=>{t.automaticLightCreation&&(t._createdLight&&(e.removeLight(t._createdLight),t._createdLight.delete(),t._createdLight=null),t._createdLight=e.makeLight(),e.addLight(t._createdLight),t._createdLight.setLightTypeToHeadLight(),t._createdLight.setPosition(e.getActiveCamera().getPosition()),t._createdLight.setFocalPoint(e.getActiveCamera().getFocalPoint()))},e.normalizedDisplayToWorld=(t,r,n,i)=>{let a=e.normalizedDisplayToProjection(t,r,n);return a=e.projectionToView(a[0],a[1],a[2],i),e.viewToWorld(a[0],a[1],a[2])},e.worldToNormalizedDisplay=(t,r,n,i)=>{let a=e.worldToView(t,r,n);return a=e.viewToProjection(a[0],a[1],a[2],i),e.projectionToNormalizedDisplay(a[0],a[1],a[2])},e.viewToWorld=(e,r,n)=>{if(null===t.activeCamera)return f("ViewToWorld: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];let i=t.activeCamera.getViewMatrix();p.invert(i,i),p.transpose(i,i);let a=new Float64Array([e,r,n]);return m.Z0(a,a,i),a},e.projectionToView=(e,r,n,i)=>{if(null===t.activeCamera)return f("ProjectionToView: no active camera, cannot compute projection to view, returning 0,0,0"),[0,0,0];let a=t.activeCamera.getProjectionMatrix(i,-1,1);p.invert(a,a),p.transpose(a,a);let o=new Float64Array([e,r,n]);return m.Z0(o,o,a),o},e.worldToView=(e,r,n)=>{if(null===t.activeCamera)return f("WorldToView: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];let i=t.activeCamera.getViewMatrix();p.transpose(i,i);let a=new Float64Array([e,r,n]);return m.Z0(a,a,i),a},e.viewToProjection=(e,r,n,i)=>{if(null===t.activeCamera)return f("ViewToProjection: no active camera, cannot compute view to projection, returning 0,0,0"),[0,0,0];let a=t.activeCamera.getProjectionMatrix(i,-1,1);p.transpose(a,a);let o=new Float64Array([e,r,n]);return m.Z0(o,o,a),o},e.computeVisiblePropBounds=()=>{t.allBounds[0]=a.Ay.INIT_BOUNDS[0],t.allBounds[1]=a.Ay.INIT_BOUNDS[1],t.allBounds[2]=a.Ay.INIT_BOUNDS[2],t.allBounds[3]=a.Ay.INIT_BOUNDS[3],t.allBounds[4]=a.Ay.INIT_BOUNDS[4],t.allBounds[5]=a.Ay.INIT_BOUNDS[5];let r=!0;e.invokeEvent(l);for(let e=0;et.allBounds[1]&&(t.allBounds[1]=e[1]),e[2]t.allBounds[3]&&(t.allBounds[3]=e[3]),e[4]t.allBounds[5]&&(t.allBounds[5]=e[5]))}}return r&&((0,i.pE)(t.allBounds),h("Can't compute bounds, no 3D props are visible")),t.allBounds},e.resetCamera=(r=null)=>{let n=r||e.computeVisiblePropBounds(),a=[0,0,0];if(!(0,i.Ae)(n))return h("Cannot reset camera!"),!1;let o=null;if(!e.getActiveCamera())return f("Trying to reset non-existent camera"),!1;o=t.activeCamera.getViewPlaneNormal(),t.activeCamera.setViewAngle(30),a[0]=(n[0]+n[1])/2,a[1]=(n[2]+n[3])/2,a[2]=(n[4]+n[5])/2;let s=n[1]-n[0],l=n[3]-n[2],u=n[5]-n[4];s*=s,l*=l,u*=u;let d=s+l+u;d=.5*Math.sqrt(d=0===d?1:d);let p=(0,i.el)(t.activeCamera.getViewAngle()),m=d,v=d/Math.sin(.5*p),y=t.activeCamera.getViewUp();return Math.abs((0,i.Om)(y,o))>.999&&(g("Resetting view-up since view plane normal is parallel"),t.activeCamera.setViewUp(-y[2],y[0],y[1])),t.activeCamera.setFocalPoint(a[0],a[1],a[2]),t.activeCamera.setPosition(a[0]+v*o[0],a[1]+v*o[1],a[2]+v*o[2]),e.resetCameraClippingRange(n),t.activeCamera.setParallelScale(m),t.activeCamera.setPhysicalScale(d),t.activeCamera.setPhysicalTranslation(-a[0],-a[1],-a[2]),e.invokeEvent(c),!0},e.resetCameraClippingRange=(r=null)=>{let n=r||e.computeVisiblePropBounds();if(!(0,i.Ae)(n))return h("Cannot reset camera clipping range!"),!1;if(e.getActiveCameraAndResetIfCreated(),!t.activeCamera)return f("Trying to reset clipping range of non-existent camera"),!1;let a=t.activeCamera.computeClippingRange(n),o=0;return o=t.activeCamera.getParallelProjection()?.2*t.activeCamera.getParallelScale():.2*Math.tan((0,i.el)(t.activeCamera.getViewAngle())/2)*a[1],a[1]-a[0]=a[1]?.01*a[1]:a[0],t.nearClippingPlaneTolerance||(t.nearClippingPlaneTolerance=.01),a[0]{e!==t._renderWindow&&(t._vtkWindow=e,t._renderWindow=e)},e.visibleActorCount=()=>t.props.filter(e=>e.getVisibility()).length,e.visibleVolumeCount=e.visibleActorCount,e.getMTime=()=>{let e=t.mtime,r=t.activeCamera?t.activeCamera.getMTime():0;r>e&&(e=r);let n=t._createdLight?t._createdLight.getMTime():0;return n>e&&(e=n),e},e.getTransparent=()=>!!t.preserveColorBuffer,e.isActiveCameraCreated=()=>!!t.activeCamera}var I={newInstance:(0,n.UI)(b,"vtkRenderer"),extend:b}},1953:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});let n={viewport:{}};var i=r(77280),a=r(68266);function o(e,t,r,o){let s;if(void 0===e)throw Error("getDefaultViewport: parameter canvas must not be undefined");if(void 0===t)return Object.assign({},{scale:1,translation:{x:0,y:0},voi:{windowWidth:void 0,windowCenter:void 0,voiLUTFunction:i.yX.LINEAR},invert:!1,pixelReplication:!1,rotation:0,hflip:!1,vflip:!1,modalityLUT:void 0,voiLUT:void 0,colormap:void 0,labelmap:!1,displayedArea:{tlhc:{x:1,y:1},brhc:{x:1,y:1},rowPixelSpacing:1,columnPixelSpacing:1,presentationSizeMode:"NONE"}},n.viewport);let l=(0,a.A)(e,t,0).scaleFactor;return"PT"===r&&t.isPreScaled?s={windowWidth:5,windowCenter:2.5}:void 0!==t.windowWidth&&void 0!==t.windowCenter&&(s={windowWidth:Array.isArray(t.windowWidth)?t.windowWidth[0]:t.windowWidth,windowCenter:Array.isArray(t.windowCenter)?t.windowCenter[0]:t.windowCenter}),{scale:l,translation:{x:0,y:0},voi:s,invert:t.invert,pixelReplication:!1,rotation:0,hflip:!1,vflip:!1,modalityLUT:t.modalityLUT,modality:r,voiLUT:t.voiLUT,colormap:void 0!==o?o:t.colormap,displayedArea:{tlhc:{x:1,y:1},brhc:{x:t.columns,y:t.rows},rowPixelSpacing:void 0===t.rowPixelSpacing?1:t.rowPixelSpacing,columnPixelSpacing:void 0===t.columnPixelSpacing?1:t.columnPixelSpacing,presentationSizeMode:"NONE"}}}},2127:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DocumentOrShadowRootImpl=void 0;class r{}t.DocumentOrShadowRootImpl=r},2523:(e,t,r)=>{"use strict";r.d(t,{A:()=>ea}),r(54261);var n=r(85643),i=r(56109),a=r(86216),o=r(3533),s=r(50923),l=r(85250),u=r(91336),c=r(3922),d=r(39216),p=r(35972),m=r(82332),h=r(6297),f=r(50987),g=r(60251),v=r(74092),y=r(65110),b=r(62455),I=r(97748),x=r(42422),C=r(69228),A=r(88824),T=r(48320),S=r(16841),w=r(62553),O=r(23703),P=r(55580),_=r(19157),E=r(58373),D=r(96945),R=r(46947),M=r(77280),N=r(97938),V=r(92391),L=r(57752),B=r(9871),F=r(1953),U=r(48548);function k(e,t){return(0,U.A)(e).transformPoint(t)}function G(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function W(e){let t=G();return[e[0]/t,e[1]/t]}function z(e){let t=G();return[e[0]*t,e[1]*t]}var H=r(46732),j=r(54268),$=r(42215),K=r(44191),q=r(7494),X=r(68266),Y=r(92336),Z=r(3793),J=r(74798),Q=r(47241);function ee(e,t,r,n){let i=s.o8(e);if(r&&s.ze(i,i),t){let e=s.$A(s.vt(),n,i);s.S8(e,e),i=function(e,t){let r=s.Om(e,t),n=s.hs(s.vt(),t,2*r);return s.jb(s.vt(),e,n)}(i,e)}return i}var et=r(11937),er=r(80069);let en=m.coreLog.getLogger("RenderingEngine","StackViewport");class ei extends P.A{constructor(e){super(e),this.imageIds=[],this.imageKeyToIndexMap=new Map,this.currentImageIdIndex=0,this.targetImageIdIndex=0,this.imagesLoader=this,this.globalDefaultProperties={},this.perImageIdDefaultProperties=new Map,this.voiUpdatedWithSetProperties=!1,this.sharpening=0,this.smoothing=0,this.invert=!1,this.initialInvert=!1,this.initialTransferFunctionNodes=null,this.stackInvalidated=!1,this._publishCalibratedEvent=!1,this.updateRenderingPipeline=()=>{this._configureRenderingPipeline()},this.setSharpening=e=>{this.sharpening=e,this.render()},this.setSmoothing=e=>{this.smoothing=e,this.render()},this.getRenderPasses=()=>{if(!this.shouldUseCustomRenderPass())return null;let e=[];try{return this.smoothing>0&&e.push((0,er.y)(this.smoothing)),this.sharpening>0&&e.push((0,er.b)(this.sharpening)),e.length?e:null}catch(e){return console.warn("Failed to create custom render passes:",e),null}},this.resize=()=>{this.useCPURendering&&this._resizeCPU()},this._resizeCPU=()=>{this._cpuFallbackEnabledElement.viewport&&(0,H.A)(this._cpuFallbackEnabledElement)},this.getFrameOfReferenceUID=e=>this.getImagePlaneReferenceData(e)?.FrameOfReferenceUID,this.getCornerstoneImage=()=>this.csImage,this.createActorMapper=e=>{let t=a.Ay.newInstance();t.setInputData(e);let r=o.Ay.newInstance();return r.setMapper(t),e.getPointData().getScalars().getNumberOfComponents()>1&&r.getProperty().setIndependentComponents(!1),r},this.getNumberOfSlices=()=>this.imageIds.length,this.getDefaultProperties=e=>{let t;return(void 0!==e&&(t=this.perImageIdDefaultProperties.get(e)),void 0!==t)?t:{...this.globalDefaultProperties}},this.getProperties=()=>{let{colormap:e,voiRange:t,VOILUTFunction:r,interpolationType:n,invert:i,voiUpdatedWithSetProperties:a}=this;return{colormap:e,voiRange:t,VOILUTFunction:r,interpolationType:n,invert:i,isComputedVOI:!a,sharpening:this.sharpening,smoothing:this.smoothing}},this.resetCameraForResize=()=>this.resetCamera({resetPan:!0,resetZoom:!0,resetToCenter:!0,resetAspectRatio:!0,suppressEvents:!0}),this.getRotationCPU=()=>{let{viewport:e}=this._cpuFallbackEnabledElement;return e.rotation},this.getRotationGPU=()=>{let{viewUp:e,viewPlaneNormal:t,flipVertical:r,flipHorizontal:n}=this.getCameraNoRotation(),i=ee(this.initialViewUp,n,r,t),a=180*s.g7(i,e)/Math.PI,o=s.$A(s.vt(),i,e);return s.Om(o,t)>=0?a:(360-a)%360},this.setRotation=e=>{let t=this.getCamera();if(this.useCPURendering?this.setRotationCPU(e):this.setRotationGPU(e),this._suppressCameraModifiedEvents)return;let r={previousCamera:t,camera:this.getCamera(),element:this.element,viewportId:this.id,renderingEngineId:this.renderingEngineId};(0,C.A)(this.element,M.sV.CAMERA_MODIFIED,r)},this.renderImageObject=e=>{this._setCSImage(e),(this.useCPURendering?this._updateToDisplayImageCPU:this._updateActorToDisplayImageId).call(this,e)},this._setCSImage=e=>{e.isPreScaled=e.preScale?.scaled,this.csImage=e},this.canvasToWorldCPU=(e,t=[0,0,0])=>{if(!this._cpuFallbackEnabledElement.image)return;let[r,n]=(0,B.A)(this._cpuFallbackEnabledElement,z(e)),{origin:i,spacing:a,direction:o}=this.getImageData(),l=o.slice(0,3),u=o.slice(3,6);return s.Ln(t,i,l,r*a[0]),s.Ln(t,t,u,n*a[1]),t},this.worldToCanvasCPU=e=>{let{spacing:t,direction:r,origin:n}=this.getImageData(),i=r.slice(0,3),a=r.slice(3,6),o=s.Re(s.vt(),e,n),l=[s.Om(o,i)/t[0],s.Om(o,a)/t[1]];return W(k(this._cpuFallbackEnabledElement,l))},this.canvasToWorldGPUContextPool=e=>{let t=this.getRenderer(),r=this.getVtkActiveCamera(),n=r.getClippingRange(),i=r.getDistance();r.setClippingRange(i,i+.1);let a=window.devicePixelRatio||1,{width:o,height:s}=this.canvas,l=[e[0]*a,e[1]*a],[u,c,d,p]=t.getViewport(),m=[u+l[0]/o*(d-u),c+(1-l[1]/s)*(p-c),0],h=t.normalizedDisplayToProjection(m[0],m[1],m[2]),f=t.projectionToView(h[0],h[1],h[2],o/s),g=t.viewToWorld(f[0],f[1],f[2]);return r.setClippingRange(n[0],n[1]),[g[0],g[1],g[2]]},this.canvasToWorldGPUTiled=e=>{let t=this.getRenderer(),r=this.getVtkActiveCamera(),n=r.getClippingRange(),i=r.getDistance();r.setClippingRange(i,i+.1);let a=this.getRenderingEngine().offscreenMultiRenderWindow.getOpenGLRenderWindow(),o=a.getSize(),s=window.devicePixelRatio||1,l=[e[0]*s,e[1]*s],u=[l[0]+this.sx,l[1]+this.sy];u[1]=o[1]-u[1];let c=a.displayToWorld(u[0],u[1],0,t);return r.setClippingRange(n[0],n[1]),[c[0],c[1],c[2]]},this.worldToCanvasGPUContextPool=e=>{let t=this.getRenderer(),r=this.getVtkActiveCamera(),n=r.getClippingRange(),i=r.getDistance();r.setClippingRange(i,i+.1);let a=window.devicePixelRatio||1,{width:o,height:s}=this.canvas,l=t.worldToView(e[0],e[1],e[2]),u=t.viewToProjection(l[0],l[1],l[2],o/s),c=t.projectionToNormalizedDisplay(u[0],u[1],u[2]),[d,p,m,h]=t.getViewport(),f=(c[0]-d)/(m-d)*o,g=(1-(c[1]-p)/(h-p))*s;return r.setClippingRange(n[0],n[1]),[f/a,g/a]},this.worldToCanvasGPUTiled=e=>{let t=this.getRenderer(),r=this.getVtkActiveCamera(),n=r.getClippingRange(),i=r.getDistance();r.setClippingRange(i,i+.1);let a=this.getRenderingEngine().offscreenMultiRenderWindow.getOpenGLRenderWindow(),o=a.getSize(),s=a.worldToDisplay(...e,t);s[1]=o[1]-s[1];let l=[s[0]-this.sx,s[1]-this.sy];r.setClippingRange(n[0],n[1]);let u=window.devicePixelRatio||1;return[l[0]/u,l[1]/u]},this.getCurrentImageIdIndex=()=>this.currentImageIdIndex,this.getSliceIndex=()=>this.currentImageIdIndex,this.getTargetImageIdIndex=()=>this.targetImageIdIndex,this.getImageIds=()=>this.imageIds,this.getCurrentImageId=(e=this.getCurrentImageIdIndex())=>this.imageIds[e],this.hasImageId=e=>this.imageKeyToIndexMap.has(e),this.hasImageURI=e=>this.imageKeyToIndexMap.has(e),this.customRenderViewportToCanvas=()=>{if(!this.useCPURendering)throw Error("Custom cpu rendering pipeline should only be hit in CPU rendering mode");return this._cpuFallbackEnabledElement.image?((0,_.A)(this._cpuFallbackEnabledElement,this.cpuRenderingInvalidated),this.cpuRenderingInvalidated=!1):this.fillWithBackgroundColor(),{canvas:this.canvas,element:this.element,viewportId:this.id,renderingEngineId:this.renderingEngineId,viewportStatus:this.viewportStatus}},this.renderingPipelineFunctions={getImageData:{cpu:this.getImageDataCPU,gpu:this.getImageDataGPU},setColormap:{cpu:this.setColormapCPU,gpu:this.setColormapGPU},getCamera:{cpu:this.getCameraCPU,gpu:super.getCamera},setCamera:{cpu:this.setCameraCPU,gpu:super.setCamera},getPan:{cpu:this.getPanCPU,gpu:super.getPan},setPan:{cpu:this.setPanCPU,gpu:super.setPan},getZoom:{cpu:this.getZoomCPU,gpu:super.getZoom},setZoom:{cpu:this.setZoomCPU,gpu:super.setZoom},getAspectRatio:{cpu:this.getAspectRatioCPU,gpu:super.getAspectRatio},setAspectRatio:{cpu:this.setAspectRatioCPU,gpu:super.setAspectRatio},setVOI:{cpu:this.setVOICPU,gpu:this.setVOIGPU},getRotation:{cpu:this.getRotationCPU,gpu:this.getRotationGPU},setInterpolationType:{cpu:this.setInterpolationTypeCPU,gpu:this.setInterpolationTypeGPU},setInvertColor:{cpu:this.setInvertColorCPU,gpu:this.setInvertColorGPU},resetCamera:{cpu:(e={})=>{let{resetPan:t=!0,resetZoom:r=!0}=e;return this.resetCameraCPU({resetPan:t,resetZoom:r}),!0},gpu:(e={})=>{let{resetPan:t=!0,resetZoom:r=!0,resetAspectRatio:n=!0}=e;return this.resetCameraGPU({resetPan:t,resetZoom:r,resetAspectRatio:n}),!0}},canvasToWorld:{cpu:this.canvasToWorldCPU,gpu:{tiled:this.canvasToWorldGPUTiled,contextPool:this.canvasToWorldGPUContextPool}},worldToCanvas:{cpu:this.worldToCanvasCPU,gpu:{tiled:this.worldToCanvasGPUTiled,contextPool:this.worldToCanvasGPUContextPool}},getRenderer:{cpu:()=>this.getCPUFallbackError("getRenderer"),gpu:{tiled:this.getRendererTiled,contextPool:this.getRendererContextPool}},getDefaultActor:{cpu:()=>this.getCPUFallbackError("getDefaultActor"),gpu:super.getDefaultActor},getActors:{cpu:()=>this.getCPUFallbackError("getActors"),gpu:super.getActors},getActor:{cpu:()=>this.getCPUFallbackError("getActor"),gpu:super.getActor},setActors:{cpu:()=>this.getCPUFallbackError("setActors"),gpu:super.setActors},addActors:{cpu:()=>this.getCPUFallbackError("addActors"),gpu:super.addActors},addActor:{cpu:()=>this.getCPUFallbackError("addActor"),gpu:super.addActor},removeAllActors:{cpu:()=>this.getCPUFallbackError("removeAllActors"),gpu:super.removeAllActors},unsetColormap:{cpu:this.unsetColormapCPU,gpu:this.unsetColormapGPU}},this.scaling={},this.modality=null,this.useCPURendering=(0,$.LH)(),this._configureRenderingPipeline(),this.useCPURendering?this._resetCPUFallbackElement():this._resetGPUViewport(),this.currentImageIdIndex=0,this.targetImageIdIndex=0,this.resetCamera(),this.initializeElementDisabledHandler()}setUseCPURendering(e){this.useCPURendering=e,this._configureRenderingPipeline(e)}static get useCustomRenderingPipeline(){return(0,$.LH)()}_configureRenderingPipeline(e){let t=(0,et.q)();for(let r in this.useCPURendering=e??(0,$.LH)(),this.renderingPipelineFunctions)if(Object.prototype.hasOwnProperty.call(this.renderingPipelineFunctions,r)){let e=this.renderingPipelineFunctions[r];this.useCPURendering?this[r]=e.cpu:"object"==typeof e.gpu&&e.gpu.tiled&&e.gpu.contextPool?this[r]=t?e.gpu.contextPool:e.gpu.tiled:this[r]=e.gpu}this.useCPURendering?this._resetCPUFallbackElement():this._resetGPUViewport()}_resetCPUFallbackElement(){this._cpuFallbackEnabledElement={canvas:this.canvas,renderingTools:{},transform:new Y.d,viewport:{rotation:0,aspectRatio:[1,1]}}}_resetGPUViewport(){let e=this.getRenderer(),t=n.Ay.newInstance();e.setActiveCamera(t);this.initialViewUp=[0,-1,0],t.setDirectionOfProjection(-0,-0,1),t.setViewUp(...this.initialViewUp),t.setParallelProjection(!0),t.setThicknessFromFocalPoint(.1),t.setFreezeFocalPoint(!0)}shouldUseCustomRenderPass(){return!this.useCPURendering}initializeElementDisabledHandler(){c.A.addEventListener(M.sV.ELEMENT_DISABLED,function e(){clearTimeout(this.debouncedTimeout),c.A.removeEventListener(M.sV.ELEMENT_DISABLED,e)})}getImageDataGPU(){let e=this.getDefaultActor();if(!e||!(0,f.e)(e))return;let{actor:t}=e,r=t.getMapper().getInputData(),n=this.csImage;return{dimensions:r.getDimensions(),spacing:r.getSpacing(),origin:r.getOrigin(),direction:r.getDirection(),get scalarData(){return n?.voxelManager.getScalarData()},imageData:t.getMapper().getInputData(),metadata:{Modality:this.modality,FrameOfReferenceUID:this.getFrameOfReferenceUID()},scaling:this.scaling,hasPixelSpacing:this.hasPixelSpacing,calibration:{...n?.calibration,...this.calibration},preScale:{...n?.preScale},voxelManager:n?.voxelManager}}getImageDataCPU(){let{metadata:e}=this._cpuFallbackEnabledElement;if(!e)return;let t=e.spacing,r=this.csImage;return{dimensions:e.dimensions,spacing:t,origin:e.origin,direction:e.direction,metadata:{Modality:this.modality,FrameOfReferenceUID:this.getFrameOfReferenceUID()},scaling:this.scaling,imageData:{getDirection:()=>e.direction,getDimensions:()=>e.dimensions,getScalarData:()=>this.cpuImagePixelData,getSpacing:()=>t,worldToIndex:e=>{let t=this.worldToCanvasCPU(e),r=(0,B.A)(this._cpuFallbackEnabledElement,z(t));return[r[0],r[1],0]},indexToWorld:(e,t)=>{let r=k(this._cpuFallbackEnabledElement,[e[0],e[1]]);return this.canvasToWorldCPU(W(r),t)}},scalarData:this.cpuImagePixelData,hasPixelSpacing:this.hasPixelSpacing,calibration:{...r?.calibration,...this.calibration},preScale:{...r?.preScale},voxelManager:r?.voxelManager}}calibrateIfNecessary(e,t){let r=d.get("calibratedPixelSpacing",e),n=this.calibration!==r,i=r?.scale;return this.hasPixelSpacing=i>0||!t.usingDefaultValues&&t.rowPixelSpacing>0,t.calibration=r,n&&(this.calibration=r,this._publishCalibratedEvent=!0,this._calibrationEvent={scale:i,calibration:r}),t}setDefaultProperties(e,t){null==t?this.globalDefaultProperties=e:(this.perImageIdDefaultProperties.set(t,e),this.getCurrentImageId()===t&&this.setProperties(e))}clearDefaultProperties(e){null==e?(this.globalDefaultProperties={},this.resetProperties()):(this.perImageIdDefaultProperties.delete(e),this.resetToDefaultProperties())}setProperties({colormap:e,voiRange:t,VOILUTFunction:r,invert:n,interpolationType:i,sharpening:a,smoothing:o}={},s=!1){this.viewportStatus=this.csImage?M.Dt.PRE_RENDER:M.Dt.LOADING,this.globalDefaultProperties={colormap:this.globalDefaultProperties.colormap??e,voiRange:this.globalDefaultProperties.voiRange??t,VOILUTFunction:this.globalDefaultProperties.VOILUTFunction??r,invert:this.globalDefaultProperties.invert??n,interpolationType:this.globalDefaultProperties.interpolationType??i,sharpening:this.globalDefaultProperties.sharpening??a,smoothing:this.globalDefaultProperties.smoothing??o},void 0!==e&&this.setColormap(e),void 0!==t&&this.setVOI(t,{suppressEvents:s,voiUpdatedWithSetProperties:!0}),void 0!==r&&this.setVOILUTFunction(r,s),void 0!==n&&this.setInvertColor(n),void 0!==i&&this.setInterpolationType(i),void 0!==a&&this.setSharpening(a),void 0!==o&&this.setSmoothing(o)}resetProperties(){this.cpuRenderingInvalidated=!0,this.voiUpdatedWithSetProperties=!1,this.viewportStatus=M.Dt.PRE_RENDER,this.fillWithBackgroundColor(),this.useCPURendering&&(this._cpuFallbackEnabledElement.renderingTools={}),this._resetProperties(),this.render()}_resetProperties(){let e;if(e=this._isCurrentImagePTPrescaled()?this._getDefaultPTPrescaledVOIRange():this._getVOIRangeForCurrentImage(),this.setVOI(e),this.setInvertColor(this.initialInvert),this.setInterpolationType(M.VO.LINEAR),!this.useCPURendering){let e=this.getTransferFunction();(0,v.setTransferFunctionNodes)(e,this.initialTransferFunctionNodes);let t=(0,v.getTransferFunctionNodes)(e).reduce((e,t)=>(e.push(t[0],t[1],t[2],t[3]),e),[]),r=this.getDefaultActor(),n=g.findMatchingColormap(t,r.actor);this.setColormap(n)}}resetToDefaultProperties(){let e;this.cpuRenderingInvalidated=!0,this.viewportStatus=M.Dt.PRE_RENDER,this.fillWithBackgroundColor(),this.useCPURendering&&(this._cpuFallbackEnabledElement.renderingTools={});let t=this.getCurrentImageId(),r=this.perImageIdDefaultProperties.get(t)||this.globalDefaultProperties;r.colormap?.name&&this.setColormap(r.colormap),e=void 0==r.voiRange?this._getVOIRangeForCurrentImage():r.voiRange,this.setVOI(e),this.setInterpolationType(M.VO.LINEAR),this.setInvertColor(!1),this.render()}_getVOIFromCache(){return this.voiUpdatedWithSetProperties?this.voiRange:this._isCurrentImagePTPrescaled()?this._getDefaultPTPrescaledVOIRange():this._getVOIRangeForCurrentImage()??this.voiRange}_setPropertiesFromCache(){let e=this._getVOIFromCache(),{colormap:t,VOILUTFunction:r,interpolationType:n,invert:i,sharpening:a,smoothing:o}=this.getProperties();void 0!==r&&this.setVOILUTFunction(r,!0),this.setVOI(e),void 0!==t&&(this.setColormap(t),this.invert=!1),this.setInterpolationType(n),this.setInvertColor(i),void 0!==a&&this.setSharpening(a),void 0!==o&&this.setSmoothing(o)}getCameraCPU(){let{metadata:e,viewport:t}=this._cpuFallbackEnabledElement;if(!e)return{};let{direction:r}=e,n=r.slice(6,9).map(e=>-e),i=r.slice(3,6).map(e=>-e);if(t.rotation){let e=l.fromRotation(l.create(),t.rotation*Math.PI/180,n);i=s.Z0(s.vt(),i,e)}let a=[this.element.clientWidth/2,this.element.clientHeight/2],o=this.canvasToWorld(a),u=this.canvasToWorld([0,0]),c=this.canvasToWorld([0,this.element.clientHeight]);return{parallelProjection:!0,focalPoint:o,position:[0,0,0],parallelScale:s.Io(u,c)/2,scale:t.scale,viewPlaneNormal:[n[0],n[1],n[2]],aspectRatio:t.aspectRatio??[1,1],viewUp:[i[0],i[1],i[2]],flipHorizontal:this.flipHorizontal,flipVertical:this.flipVertical}}setAspectRatioForViewport(e,t=!0){let{viewport:r,image:n}=this._cpuFallbackEnabledElement;if(!t){r.aspectRatio=e;return}let{clientWidth:i,clientHeight:a}=this.element,{rowPixelSpacing:o,columnPixelSpacing:s,width:l,height:u}=n,c=(([e,t])=>e/t)(r.aspectRatio||[1,1]),d=(([e,t])=>e/t)(e),p=i/a,m=a*o*.5,h=e=>{let t=l*s*e,r=u*o;if(t/r>p)return m/(i/t);let n=.5*r;return e<1?n/e:n},f=h(d)/h(c);r.aspectRatio=e,r.parallelScale&&(r.parallelScale*=f,r.scale=m/r.parallelScale)}setCameraCPU(e){let{viewport:t,image:r}=this._cpuFallbackEnabledElement,n=this.getCameraCPU(),{focalPoint:i,parallelScale:a,scale:o,flipHorizontal:s,flipVertical:l,aspectRatio:c,isFitViewportAfterStretch:d}=e,{clientHeight:p}=this.element;if(i){let e=this.worldToCanvasCPU(i),r=(0,B.A)(this._cpuFallbackEnabledElement,z(e)),a=this.worldToCanvasCPU(n.focalPoint),o=(0,B.A)(this._cpuFallbackEnabledElement,z(a)),s=u.vt();u.Re(s,u.fA(r[0],r[1]),u.fA(o[0],o[1]));let l=(0,q.A)({x:s[0],y:s[1]},t);t.translation.x-=l.x,t.translation.y-=l.y}if(a){let{rowPixelSpacing:e}=r;t.scale=p*e*.5/a,t.parallelScale=a}if(o){let{rowPixelSpacing:e}=r;t.scale=o,t.parallelScale=p*e*.5/o}c&&this.setAspectRatioForViewport(c,d),(void 0!==s||void 0!==l)&&this.setFlipCPU({flipHorizontal:s,flipVertical:l}),this._cpuFallbackEnabledElement.transform=(0,L.A)(this._cpuFallbackEnabledElement);let m={previousCamera:n,camera:this.getCamera(),element:this.element,viewportId:this.id,renderingEngineId:this.renderingEngineId};(0,C.A)(this.element,M.sV.CAMERA_MODIFIED,m)}getPanCPU(){let{viewport:e}=this._cpuFallbackEnabledElement;return[e.translation?.x??0,e.translation?.y??0]}setPanCPU(e){let t=this.getCameraCPU();this.setCameraCPU({...t,focalPoint:[...e.map(e=>-e),0]})}getZoomCPU(){let{viewport:e}=this._cpuFallbackEnabledElement;return e.scale}setZoomCPU(e){let t=this.getCameraCPU();this.setCameraCPU({...t,scale:e})}getAspectRatioCPU(){let{aspectRatio:e}=this.getCameraCPU();return e??this.options?.aspectRatio??[1,1]}setAspectRatioCPU(e,t=!0,r=!1){let n=this.getCameraCPU();r&&(this.options.aspectRatio=e),this.setCameraCPU({...n,aspectRatio:e,isFitViewportAfterStretch:t})}setFlipCPU({flipHorizontal:e,flipVertical:t}){let{viewport:r}=this._cpuFallbackEnabledElement;void 0!==e&&(r.hflip=e,this.flipHorizontal=r.hflip),void 0!==t&&(r.vflip=t,this.flipVertical=r.vflip)}setVOILUTFunction(e,t){if(this.useCPURendering)throw Error("VOI LUT function is not supported in CPU rendering");let r=this._getValidVOILUTFunction(e),n=!1;this.VOILUTFunction!==r&&(n=!0),this.VOILUTFunction=r;let{voiRange:i}=this.getProperties();this.setVOI(i,{suppressEvents:t,forceRecreateLUTFunction:n})}setRotationCPU(e){let{viewport:t}=this._cpuFallbackEnabledElement;t.rotation=e}setRotationGPU(e){let t=this.getPan(this.fitToCanvasCamera),r=this.getPan(),n=u.jb([0,0],t,r);this.setPan(n,!1);let{flipVertical:i,flipHorizontal:a,viewPlaneNormal:o}=this.getCamera(),s=ee(this.initialViewUp,a,i,o);this.setCameraNoEvent({viewUp:s}),this.getVtkActiveCamera().roll(-e);let l=this.getPan(),c=this.getPan(this.fitToCanvasCamera),d=u.jb([0,0],l,c),p=u.WQ([0,0],t,d);this.setPan(p,!1)}setInterpolationTypeGPU(e){let t=this.getDefaultActor();if(!t||!(0,f.e)(t))return;let{actor:r}=t;r.getProperty().setInterpolationType(e),this.interpolationType=e}setInterpolationTypeCPU(e){let{viewport:t}=this._cpuFallbackEnabledElement;t.pixelReplication=e!==M.VO.LINEAR,this.interpolationType=e}setInvertColorCPU(e){let{viewport:t}=this._cpuFallbackEnabledElement;t&&(t.invert=e,this.invert=e)}setInvertColorGPU(e){let t=this.getDefaultActor();if(t&&(0,f.e)(t)){if((0,f.N)(t,"vtkVolume")){let r=t.actor.getProperty().getRGBTransferFunction(0);(!this.invert&&e||this.invert&&!e)&&(0,T.A)(r),this.invert=e}else if((0,f.N)(t,"vtkImageSlice")){let r=t.actor.getProperty().getRGBTransferFunction(0);(!this.invert&&e||this.invert&&!e)&&(0,T.A)(r),this.invert=e}}}setVOICPU(e,t={}){let{suppressEvents:r=!1}=t,{viewport:n,image:i}=this._cpuFallbackEnabledElement;if(!n||!i)return;if(void 0===e){let{windowWidth:t,windowCenter:r}=i,a=Array.isArray(t)?t[0]:t,o=Array.isArray(r)?r[0]:r;n.voi={windowWidth:a,windowCenter:o,voiLUTFunction:i.voiLUTFunction};let{lower:s,upper:l}=(0,O.A)(a,o,i.voiLUTFunction);e={lower:s,upper:l}}else{let{lower:t,upper:r}=e,{windowCenter:a,windowWidth:o}=y.toWindowLevel(t,r);n.voi||(n.voi={windowWidth:0,windowCenter:0,voiLUTFunction:i.voiLUTFunction}),n.voi.windowWidth=o,n.voi.windowCenter=a}this.voiRange=e;let a={viewportId:this.id,range:e};r||(0,C.A)(this.element,M.sV.VOI_MODIFIED,a)}getTransferFunction(){let e=this.getDefaultActor();if(e&&(0,f.e)(e))return e.actor.getProperty().getRGBTransferFunction(0)}setVOIGPU(e,t={}){let{suppressEvents:r=!1,forceRecreateLUTFunction:n=!1,voiUpdatedWithSetProperties:i=!1}=t;if(e&&this.voiRange&&this.voiRange.lower===e.lower&&this.voiRange.upper===e.upper&&!n&&!this.stackInvalidated)return;let a=this.getDefaultActor();if(!a||!(0,f.e)(a))return;let o=a.actor,s=e;if(void 0===s){let e=o.getMapper().getInputData().getPointData().getScalars().getRange();s={lower:e[0],upper:e[1]}}o.getProperty().setUseLookupTableScalarRange(!0);let l=o.getProperty().getRGBTransferFunction(0),u=this.VOILUTFunction===M.yX.SAMPLED_SIGMOID;if((u||!l||n)&&(l=(u?I.A:b.A)(s),this.invert&&(0,T.A)(l),o.getProperty().setRGBTransferFunction(0,l),this.initialTransferFunctionNodes=(0,v.getTransferFunctionNodes)(l)),u||l.setRange(s.lower,s.upper),this.voiRange=s,this.voiUpdatedWithSetProperties||(this.voiUpdatedWithSetProperties=i),r)return;let c={viewportId:this.id,range:s,VOILUTFunction:this.VOILUTFunction};(0,C.A)(this.element,M.sV.VOI_MODIFIED,c)}_addScalingToViewport(e){if(this.scaling.PT)return;let{suvbw:t,suvlbm:r,suvbsa:n}=e,i={};r&&(i.suvbwToSuvlbm=r/t),n&&(i.suvbwToSuvbsa=n/t),this.scaling.PT=i}getImageDataMetadata(e){let t=e.imageId,{numberOfComponents:r,origin:n,direction:i,dimensions:a,spacing:o,numVoxels:s,imagePixelModule:l,voiLUTFunction:u,modality:c,scalingFactor:d,calibration:m}=(0,p.T)(e);"PT"===c&&d&&this._addScalingToViewport(d),this.modality=c;let h=this._getValidVOILUTFunction(u);this.VOILUTFunction=h,this.calibration=m;let f=this._getImagePlaneModule(t);return this.useCPURendering||(f=this.calibrateIfNecessary(t,f)),{bitsAllocated:l.bitsAllocated,numberOfComponents:r,origin:n,direction:i,dimensions:a,spacing:o,numVoxels:s,imagePlaneModule:f,imagePixelModule:l}}matchImagesForOverlay(e,t){return(e=>{let r=d.get(M.nb.IMAGE_PLANE,t),n=d.get(M.nb.IMAGE_PLANE,e),i=r.imageOrientationPatient,a=n.imageOrientationPatient;if(i&&a){if((0,A.n4)(r.imageOrientationPatient,n.imageOrientationPatient)){let t=r.imagePositionPatient,i=n.imagePositionPatient;if(t&&i&&(0,A.n4)(t,i)){let t=r.rows,i=r.columns,a=n.rows,o=n.columns;if(t===a&&i===o)return e}}}else{let t=r.rows,i=r.columns,a=n.rows,o=n.columns;if(t===a&&i===o)return e}})(e)}getImagePlaneReferenceData(e=this.getCurrentImageIdIndex()){let t=this.imageIds[e];if(!t)return;let r=d.get(M.nb.IMAGE_PLANE,t);if(!r)return;let{imagePositionPatient:n,frameOfReferenceUID:i}=r,{rowCosines:a,columnCosines:o}=r;return a||=[1,0,0],o||=[0,1,0],{FrameOfReferenceUID:i,viewPlaneNormal:s.$A([0,0,0],o,a),cameraFocalPoint:n,referencedImageId:t,sliceIndex:e}}_getCameraOrientation(e){let t=e.slice(6,9).map(e=>-e),r=e.slice(3,6).map(e=>-e);return{viewPlaneNormal:[t[0],t[1],t[2]],viewUp:[r[0],r[1],r[2]]}}createVTKImageData({origin:e,direction:t,dimensions:r,spacing:n,numberOfComponents:i,pixelArray:a}){return(0,R.IQ)({origin:e,direction:t,dimensions:r,spacing:n,numberOfComponents:i,pixelArray:new a.constructor(a.length)})}_createVTKImageData({origin:e,direction:t,dimensions:r,spacing:n,numberOfComponents:i,pixelArray:a}){try{this._imageData=this.createVTKImageData({origin:e,direction:t,dimensions:r,spacing:n,numberOfComponents:i,pixelArray:a})}catch(e){en.error(e)}}async setStack(e,t=0){if(this._throwIfDestroyed(),this.clearDisplaySets(),this.imageIds=e,t>e.length)throw Error("Current image index is greater than the number of images in the stack");this.imageKeyToIndexMap.clear(),e.forEach((e,t)=>{this.imageKeyToIndexMap.set(e,t),this.imageKeyToIndexMap.set((0,w.A)(e),t)}),this.currentImageIdIndex=t,this.targetImageIdIndex=t;let r=d.get(S.A.IMAGE_RETRIEVE_CONFIGURATION,e[t],"stack");this.imagesLoader=r?(r.create||K.Ke)(r):this,this.stackInvalidated=!0,this.flipVertical=!1,this.flipHorizontal=!1,this.voiRange=null,this.interpolationType=M.VO.LINEAR,this.invert=!1,this.viewportStatus=M.Dt.LOADING,this.fillWithBackgroundColor(),this.useCPURendering&&(this._cpuFallbackEnabledElement.renderingTools={},delete this._cpuFallbackEnabledElement.viewport.colormap);let n=await this._setImageIdIndex(t),i={imageIds:e,viewportId:this.id,element:this.element,currentImageIdIndex:t};return(0,C.A)(this.element,M.sV.VIEWPORT_NEW_IMAGE_SET,i),n}async setDisplaySets(...e){await this.mountDisplaySets(e,async e=>{let t=(0,h.$B)(e.displaySetId);if(!t?.imageIds?.length)throw Error(`[StackViewport] No registered imageIds for display set ${e.displaySetId}`);let r="number"==typeof t.initialImageIdIndex?t.initialImageIdIndex:0;await this.setStack(t.imageIds,r)})}_throwIfDestroyed(){if(this.isDisabled)throw Error("The stack viewport has been destroyed and is no longer usable. Renderings will not be performed. If you are using the same viewportId and have re-enabled the viewport, you need to grab the new viewport instance using renderingEngine.getViewport(viewportId), instead of using your lexical scoped reference to the viewport instance.")}_checkVTKImageDataMatchesCornerstoneImage(e,t){if(!t)return!1;let[r,n]=t.getSpacing(),[i,a]=t.getDimensions(),o=this._getImagePlaneModule(e.imageId),s=t.getDirection(),l=s.slice(0,3),u=s.slice(3,6),c=t.getPointData().getScalars().getDataType(),d=(0,A.n4)(r,e.columnPixelSpacing),p=(0,A.n4)(n,e.rowPixelSpacing),m=d||null===e.columnPixelSpacing&&1===r,h=p||null===e.rowPixelSpacing&&1===n,f=i===e.columns,g=a===e.rows,v=(0,A.n4)(o.rowCosines,l),y=(0,A.n4)(o.columnCosines,u),b=c===e.voxelManager.getScalarData().constructor.name;return m&&h&&f&&g&&v&&y&&b}_updateVTKImageDataFromCornerstoneImage(e){let t=this._getImagePlaneModule(e.imageId).imagePositionPatient;null==t&&(t=[0,0,0]),this._imageData.setOrigin(t);let r=this.getActor(this.id);r&&(r.referencedId=e.imageId),(0,x.J)(this._imageData,e)}_loadAndDisplayImage(e,t){return this.useCPURendering?this._loadAndDisplayImageCPU(e,t):this._loadAndDisplayImageGPU(e,t)}_loadAndDisplayImageCPU(e,t){return new Promise((r,n)=>{function i(e,t,n){if(this.currentImageIdIndex!==t)return;let i=e.voxelManager.getScalarData(),a=e.preScale,o=a?.scalingParameters,s=a?.scaled&&o?.rescaleIntercept%1!=0||o?.rescaleSlope%1!=0;if(i instanceof Float32Array&&s){let t={min:e.minPixelValue,max:e.maxPixelValue},r=Math.abs(t.max-t.min)/65535,n=t.min,a=i.length,o=new Uint16Array(a),s=65535,l=0;for(let e=0;eo:e.getPixelData=()=>o,e.preScale={...e.preScale,scaled:!1}}this._setCSImage(e),this.viewportStatus=M.Dt.PRE_RENDER;let l={image:e,imageId:n,imageIdIndex:t,viewportId:this.id,renderingEngineId:this.renderingEngineId};(0,C.A)(this.element,M.sV.STACK_NEW_IMAGE,l),this._updateToDisplayImageCPU(e),this.render(),this.currentImageIdIndex=t,r(n)}function a(e,t,r){this.suppressEvents||(0,C.A)(c.A,M.sV.IMAGE_LOAD_ERROR,{error:e,imageIdIndex:t,imageId:r}),n(e)}let o=M.Yw.Interaction,s={imageId:e,imageIdIndex:t,viewportId:this.id,renderingEngineId:this.renderingEngineId};(0,C.A)(this.element,M.sV.PRE_STACK_NEW_IMAGE,s),V.A.addRequest((function(e,t,r){return(0,N.loadAndCacheImage)(e,r).then(r=>{i.call(this,r,t,e)},r=>{a.call(this,r,t,e)})}).bind(this,e,t,{useRGBA:!0,requestType:o}),o,{imageId:e,imageIdIndex:t},-5)})}successCallback(e,t){let r=this.imageIds.indexOf(e);if(this.currentImageIdIndex!==r)return;let n=this.csImage?.imageFrame,i=t?.imageFrame;(n?.photometricInterpretation||this.csImage?.photometricInterpretation)!==(i?.photometricInterpretation||t?.photometricInterpretation)&&(this.stackInvalidated=!0),this._setCSImage(t);let a={image:t,imageId:e,imageIdIndex:r,viewportId:this.id,renderingEngineId:this.renderingEngineId};this._updateActorToDisplayImageId(t),(0,C.A)(this.element,M.sV.STACK_NEW_IMAGE,a),this.render(),this.currentImageIdIndex=r}errorCallback(e,t,r){if(!t)return;let n=this.imageIds.indexOf(e);(0,C.A)(c.A,M.sV.IMAGE_LOAD_ERROR,{error:r,imageIdIndex:n,imageId:e})}getLoaderImageOptions(e){let t=this.imageIds.indexOf(e),{transferSyntaxUID:r}=d.get(M.nb.TRANSFER_SYNTAX,e)||{};return{useRGBA:!1,transferSyntaxUID:r,priority:5,requestType:M.Yw.Interaction,additionalDetails:{imageId:e,imageIdIndex:t}}}async loadImages(e,t){let r=await Promise.allSettled(e.map(e=>{let r=this.getLoaderImageOptions(e);return(0,N.loadAndCacheImage)(e,r).then(r=>(t.successCallback(e,r),e),r=>(t.errorCallback(e,!0,r),e))})),n=r.filter(e=>"rejected"===e.status);if(n&&n.length){let e=new CustomEvent(M.sV.IMAGE_LOAD_ERROR,{detail:n,cancelable:!0});c.A.dispatchEvent(e)}return r}_loadAndDisplayImageGPU(e,t){if(!e)return void console.warn("No image id set yet to load");let r={imageId:e,imageIdIndex:t,viewportId:this.id,renderingEngineId:this.renderingEngineId};return(0,C.A)(this.element,M.sV.PRE_STACK_NEW_IMAGE,r),this.imagesLoader.loadImages([e],this).then(()=>e)}_updateToDisplayImageCPU(e){let t=this.getImageDataMetadata(e),r=(0,F.A)(this.canvas,e,this.modality,this._cpuFallbackEnabledElement.viewport.colormap),{windowCenter:n,windowWidth:i,voiLUTFunction:a}=r.voi;this.voiRange=(0,O.A)(i,n,a),this._cpuFallbackEnabledElement.image=e,this._cpuFallbackEnabledElement.metadata={...t},this.cpuImagePixelData=e.voxelManager.getScalarData();let o=Object.assign({},r,this._cpuFallbackEnabledElement.viewport);this._cpuFallbackEnabledElement.viewport=this.stackInvalidated?r:o,this.stackInvalidated=!1,this.cpuRenderingInvalidated=!0,this._cpuFallbackEnabledElement.transform=(0,L.A)(this._cpuFallbackEnabledElement)}getSliceViewInfo(){throw Error("Method not implemented.")}addImages(e){let t=[];e.forEach(e=>{let{imageId:r,...n}=e,i=j.Ay.getImage(r),{origin:a,dimensions:o,direction:s,spacing:l,numberOfComponents:u}=this.getImageDataMetadata(i),c=this.createVTKImageData({origin:a,dimensions:o,direction:s,spacing:l,numberOfComponents:u,pixelArray:i.voxelManager.getScalarData()}),d=this.createActorMapper(c);d&&(t.push({uid:e.actorUID??(0,Z.A)(),actor:d,referencedId:r,...n}),e.callback&&e.callback({imageActor:d,imageId:e.imageId}))}),this.addActors(t)}_updateActorToDisplayImageId(e){let t=this._checkVTKImageDataMatchesCornerstoneImage(e,this._imageData),r=this.stackInvalidated,n=this.getViewPresentation();if(t&&!r){this._updateVTKImageDataFromCornerstoneImage(e),this.resetCameraNoEvent(),this.setViewPresentation(n),this._setPropertiesFromCache(),this.stackActorReInitialized=!1;return}let{origin:i,direction:a,dimensions:o,spacing:s,numberOfComponents:l,imagePixelModule:u}=this.getImageDataMetadata(e),c=e.voxelManager.getScalarData();this._createVTKImageData({origin:i,direction:a,dimensions:o,spacing:s,numberOfComponents:l,pixelArray:c}),this._updateVTKImageDataFromCornerstoneImage(e);let d=this.createActorMapper(this._imageData),p=this.getActors();p.length&&p[0].uid===this.id?p[0].actor=d:p.unshift({uid:this.id,actor:d,referencedId:e.imageId}),this.setActors(p);let{viewPlaneNormal:m,viewUp:h}=this._getCameraOrientation(a),f=this.getCamera();if(this.setCameraNoEvent({viewUp:h,viewPlaneNormal:m}),this.initialViewUp=h,this.resetCameraNoEvent(),this.setViewPresentation(n),this.triggerCameraEvent(this.getCamera(),f),r){let t="MONOCHROME1"===u.photometricInterpretation;this.stackInvalidated=!0;let r=this._getInitialVOIRange(e);this.setVOI(r,{forceRecreateLUTFunction:!!t}),this.initialInvert=!!t,this.setInvertColor(this.invert||this.initialInvert)}else this.stackInvalidated=!0,this._setPropertiesFromCache();this.stackInvalidated=!1,this.stackActorReInitialized=!0,this._publishCalibratedEvent&&this.triggerCalibrationEvent()}_getInitialVOIRange(e){if(this.voiRange&&this.voiUpdatedWithSetProperties)return this.voiRange;let{windowCenter:t,windowWidth:r,voiLUTFunction:n}=e,i=(0,O.A)(r,t,n);return this._getPTPreScaledRange()||i}_getPTPreScaledRange(){if(this._isCurrentImagePTPrescaled())return this._getDefaultPTPrescaledVOIRange()}_isCurrentImagePTPrescaled(){return"PT"===this.modality&&!!this.csImage.isPreScaled&&!!this.csImage.preScale?.scalingParameters.suvbw}_getDefaultPTPrescaledVOIRange(){return{lower:0,upper:5}}async _setImageIdIndex(e){if(e>=this.imageIds.length)throw Error(`ImageIdIndex provided ${e} is invalid, the stack only has ${this.imageIds.length} elements`);this.currentImageIdIndex=e,this.hasPixelSpacing=!0,this.viewportStatus=M.Dt.PRE_RENDER;let t=await this._loadAndDisplayImage(this.imageIds[e],e);if(this.perImageIdDefaultProperties.size>=1){let e=this.perImageIdDefaultProperties.get(t);void 0!==e?this.setProperties(e):void 0!==this.globalDefaultProperties&&this.setProperties(this.globalDefaultProperties)}return t}resetCameraCPU({resetPan:e=!0,resetZoom:t=!0}){let{image:r}=this._cpuFallbackEnabledElement;if(!r)return;!function(e,t=!0,r=!0){let{canvas:n,image:i,viewport:a}=e,o=(0,X.A)(n,i,0).scaleFactor;a.vflip=!1,a.hflip=!1,t&&(a.translation.x=0,a.translation.y=0),r&&(a.displayedArea.tlhc.x=1,a.displayedArea.tlhc.y=1,a.displayedArea.brhc.x=i.columns,a.displayedArea.brhc.y=i.rows,a.scale=o)}(this._cpuFallbackEnabledElement,e,t);let{scale:n}=this._cpuFallbackEnabledElement.viewport,{clientWidth:i,clientHeight:a}=this.element,o=this.canvasToWorldCPU([i/2,a/2]);this.setCameraCPU({focalPoint:o,scale:n})}resetCameraGPU(e){return this.setCamera({flipHorizontal:!1,flipVertical:!1,viewUp:this.initialViewUp}),super.resetCamera({resetToCenter:!0,...e})}scroll(e,t=!0,r=!1){let n=this.imageIds;if(isNaN(this.targetImageIdIndex))return;let i=this.targetImageIdIndex,a=n.length,o=i+e;o=r?(o+a)%a:Math.max(0,Math.min(a-1,o)),this.targetImageIdIndex=o;let s=n[o];j.Ay.isLoaded(s)||!t?this.setImageIdIndex(o):(clearTimeout(this.debouncedTimeout),this.debouncedTimeout=window.setTimeout(()=>{this.setImageIdIndex(o)},40));let l={newImageIdIndex:o,imageId:s,direction:e};o!==i&&(0,C.A)(this.element,M.sV.STACK_VIEWPORT_SCROLL,l)}setImageIdIndex(e){if(this._throwIfDestroyed(),this.currentImageIdIndex===e)return Promise.resolve(this.getCurrentImageId());let t=this._setImageIdIndex(e);return this.targetImageIdIndex=e,t}calibrateSpacing(e){let t=this.getImageIds().indexOf(e);this.stackInvalidated=!0,this._loadAndDisplayImage(e,t)}triggerCameraEvent(e,t){let r={previousCamera:t,camera:e,element:this.element,viewportId:this.id,renderingEngineId:this.renderingEngineId};this.suppressEvents||(0,C.A)(this.element,M.sV.CAMERA_MODIFIED,r)}triggerCalibrationEvent(){let{imageData:e}=this.getImageData(),t={element:this.element,viewportId:this.id,renderingEngineId:this.renderingEngineId,imageId:this.getCurrentImageId(),imageData:e,worldToIndex:e.getWorldToIndex(),...this._calibrationEvent};this.suppressEvents||(0,C.A)(this.element,M.sV.IMAGE_SPACING_CALIBRATED,t),this._publishCalibratedEvent=!1}jumpToWorld(e){let t=this.getImageIds(),{direction:r,spacing:n}=this.getImageData(),i=(0,Q.A)({direction:r,spacing:n,imageIds:t},e,this.getCamera().viewPlaneNormal,{ignoreSpacing:!0}),a=t.indexOf(i);return -1!==a&&(this.setImageIdIndex(a),this.render(),!0)}getRendererContextPool(){return this.getRenderingEngine().getRenderer(this.id)}getRendererTiled(){let e=this.getRenderingEngine();if(!e||e.hasBeenDestroyed)throw Error("Rendering engine has been destroyed");return e.offscreenMultiRenderWindow?.getRenderer(this.id)}_getVOIRangeForCurrentImage(){let{windowCenter:e,windowWidth:t,voiLUTFunction:r}=this.csImage;return(0,O.A)(t,e,r)}_getValidVOILUTFunction(e){return Object.values(M.yX).includes(e)?e:M.yX.LINEAR}getSliceInfo(){let e=this.getSliceIndex(),{dimensions:t}=this.getImageData();return{width:t[0],height:t[1],sliceIndex:e,slicePlane:2}}isReferenceViewable(e,t={}){let r=this.getCurrentImageIdIndex(),n=this.imageIds[r];if(!n||!e)return!1;let{referencedImageId:i,multiSliceReference:a}=e;if(i){if(i===n)return!0;e.referencedImageURI||=(0,w.A)(i);let{referencedImageURI:o}=e,s=this.imageKeyToIndexMap.get(o);return!!(t.asOverlay&&this.matchImagesForOverlay(n,i))||void 0!==s&&(!!t.withNavigation||r<=(a&&this.imageKeyToIndexMap.get(a.referencedImageId))&&r>=s)}if(!super.isReferenceViewable(e,{...t,withOrientation:t?.asVolume}))return!1;if(e.volumeId||e.FrameOfReferenceUID)return t.asVolume;let{cameraFocalPoint:o}=e;if(t.asNearbyProjection&&o){let{spacing:e,direction:t,origin:r}=this.getImageData(),n=t.slice(6,9),i=(0,J.A)({direction:t,spacing:e},n),a=s.Re(s.vt(),o,r);if(Math.abs(s.Om(a,n))<=i/2)return!0}return!1}getViewReference(e={}){let{sliceIndex:t=this.getCurrentImageIdIndex()}=e,r=super.getViewReference(e),n=this.getCurrentImageId(t);if(n){if(r.referencedImageId=n,this.getCurrentImageIdIndex()!==t){let e=this.getImagePlaneReferenceData(t);if(!e)return;Object.assign(r,e)}return r}}setViewReference(e){if(!e?.referencedImageId){e?.sliceIndex!==void 0&&this.scroll(e.sliceIndex-this.targetImageIdIndex);return}let{referencedImageId:t}=e;e.referencedImageURI||=(0,w.A)(t);let{referencedImageURI:r}=e,n=this.imageKeyToIndexMap.get(r);if(void 0===n)return void en.error(`No image URI found for ${r}`);this.scroll(n-this.targetImageIdIndex)}getViewReferenceId(e={}){let{sliceIndex:t=this.currentImageIdIndex}=e;return`imageId:${this.imageIds[t]}`}getSliceIndexForImage(e){if(e){if("string"==typeof e)return this.imageKeyToIndexMap.get(e);if(e.referencedImageId)return this.imageKeyToIndexMap.get(e.referencedImageId)}}getCPUFallbackError(e){return Error(`method ${e} cannot be used during CPU Fallback mode`)}fillWithBackgroundColor(){let e=this.getRenderingEngine();e&&e.fillCanvasWithBackgroundColor(this.canvas,this.options.background)}unsetColormapCPU(){delete this._cpuFallbackEnabledElement.viewport.colormap,this._cpuFallbackEnabledElement.renderingTools={},this.cpuRenderingInvalidated=!0,this.fillWithBackgroundColor(),this.render()}setColormapCPU(e){this.colormap=e;let t=(0,E.Qu)(e);t?this._cpuFallbackEnabledElement.viewport.colormap=t:delete this._cpuFallbackEnabledElement.viewport.colormap,this._cpuFallbackEnabledElement.renderingTools={},this.fillWithBackgroundColor(),this.cpuRenderingInvalidated=!0,this.render();let r={viewportId:this.id,colormap:e};(0,C.A)(this.element,M.sV.COLORMAP_MODIFIED,r)}setColormapGPU(e){let t=this.getDefaultActor().actor.getProperty(),r=t.getRGBTransferFunction(),n=g.resolveColormap(e.name);if(r)r.applyColorMap(n),r.setMappingRange(this.voiRange.lower,this.voiRange.upper),t.setRGBTransferFunction(0,r);else{let e=i.Ay.newInstance();e.applyColorMap(n),e.setMappingRange(this.voiRange.lower,this.voiRange.upper),t.setRGBTransferFunction(0,e)}this.colormap=e,this.render();let a={viewportId:this.id,colormap:e};(0,C.A)(this.element,M.sV.COLORMAP_MODIFIED,a)}unsetColormapGPU(){throw Error("unsetColormapGPU not implemented.")}_getImagePlaneModule(e){let t=(0,D.SJ)(e);return this.hasPixelSpacing=!t.usingDefaultValues||this.calibration?.scale>0||this.calibration?.rowPixelSpacing>0,this.calibration||=t.calibration,t}isInAcquisitionPlane(){return!0}}let ea=ei},2666:(e,t,r)=>{"use strict";let n=r(50026),i=Object.prototype.hasOwnProperty,a=Object.prototype.toString;e.exports=new n("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;let t={};for(let r=0,n=e.length;r{"use strict";r.d(t,{A:()=>i});var n=r(70192);let i=function(e){if(!e?.length||!n.BF.isValidVolume(e))return;let t=n.PP.generateVolumeId(e),r=n.PP.getVolume(t);return r||(r=n.UH.createAndCacheVolumeFromImagesSync(t,e))}},2997:(e,t,r)=>{"use strict";r(63306),r(4453),r(42018),r(93022)},3075:(e,t,r)=>{"use strict";function n(e,t){let r=e.length,{rescaleSlope:n,rescaleIntercept:i,suvbw:a}=t;if("PT"===t.modality&&"number"==typeof a)for(let t=0;tn})},3570:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var n={SlicingMode:{NONE:-1,I:0,J:1,K:2,X:3,Y:4,Z:5}}},3721:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>o});let n=["SEG","RTSTRUCT","RTPLAN","SR","PR","KO"],i=({modality:e,representationUID:t})=>!t&&(!e||!n.includes(e));function a(e,t){if(!i(e,t))return!1;let{targetPredicate:r}=t?.configuration??{};return!r||r(e,t)}let o={isPixelData:i,firstPixelData:(e,t)=>{let r=e.find(e=>a(e,t));return r?[r]:[]},allPixelData:(e,t)=>e.filter(e=>a(e,t)),first:e=>e.length?[e[0]]:[],all:e=>e,forModality:(...e)=>({modality:t})=>e.includes(t),forId:e=>({displaySetUID:t,referencedId:r,targetId:n})=>t?.includes(e)||r?.includes(e)||n.includes(e)}},3793:(e,t,r)=>{"use strict";function n(){return"function"==typeof crypto.randomUUID?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))}r.d(t,{A:()=>n})},3922:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});class n{constructor(){this.listeners={},this.debouncedListeners={}}reset(){this.listeners={},this.debouncedListeners={}}addEventListenerOnce(e,t){let r=n=>{this.removeEventListener(e,r),t.call(this,n)};this.addEventListener(e,r)}addEventListener(e,t){this.listeners[e]||(this.listeners[e]=[]),-1===this.listeners[e].indexOf(t)&&this.listeners[e].push(t)}addEventListenerDebounced(e,t,r){this.debouncedListeners[e]=this.debouncedListeners[e]||{};let n=this.debouncedListeners[e];if(!n[t]){let i=e=>{n[t]&&clearTimeout(n[t].timeoutId),n[t].timeoutId=setTimeout(()=>{t.call(this,e)},r)};n[t]={original:t,handle:i,timeoutId:null},this.addEventListener(e,i)}}removeEventListenerDebounced(e,t){if(this.debouncedListeners[e]?.[t]){let r=this.debouncedListeners[e][t];this.removeEventListener(e,r.handle),clearTimeout(r.timeoutId),delete this.debouncedListeners[e][t]}}removeEventListener(e,t){if(!this.listeners[e])return;let r=this.listeners[e],n=r.length;for(let e=0;e{"use strict";r.d(t,{A:()=>s});var n=r(5721);function i(e,t){for(var r=Array(t),n=0;nt||void 0===r&&t>=t)&&(r=t);else{let n=-1;for(let i of e)null!=(i=t(i,++n,e))&&(r>i||void 0===r&&i>=i)&&(r=i)}return r}(e,a),n=Array(r);++te[t][0])),s=(0,n.A)(t.map(t=>e[t][1]));if(e[0]?.length!==3)return o(i(a,r),i(s,r));{let l=(0,n.A)(t.map(t=>e[t][2]));return o(i(a,r),i(s,r),i(l,r))}}(e,function(e,t){let r=[],[n,i]=t,a=i-n+1,o=Math.floor(a/e),s=0,l=Math.round((a-1)/(o-1)*0)+n;for(;l<=i;)r.push(l),l=Math.round((a-1)/(o-1)*++s)+n;return r}(u,[c,d])),...m]}},4453:(e,t,r)=>{"use strict";r(42018)},4515:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChildNodeImpl=void 0;let n=r(79663),i=r(47518);class a{before(...e){let t=n.Cast.asNode(this),r=t._parent;if(null===r)return;let a=t._previousSibling,o=!0;for(;o&&a;){o=!1;for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterDataImpl=void 0;let n=r(92787),i=r(47518);class a extends n.NodeImpl{_data;constructor(e){super(),this._data=e}get data(){return this._data}set data(e){(0,i.characterData_replaceData)(this,0,this._data.length,e)}get length(){return this._data.length}substringData(e,t){return(0,i.characterData_substringData)(this,e,t)}appendData(e){return(0,i.characterData_replaceData)(this,this._data.length,0,e)}insertData(e,t){(0,i.characterData_replaceData)(this,e,0,t)}deleteData(e,t){(0,i.characterData_replaceData)(this,e,t,"")}replaceData(e,t,r){(0,i.characterData_replaceData)(this,e,t,r)}get previousElementSibling(){throw Error("Mixin: NonDocumentTypeChildNode not implemented.")}get nextElementSibling(){throw Error("Mixin: NonDocumentTypeChildNode not implemented.")}before(){throw Error("Mixin: ChildNode not implemented.")}after(){throw Error("Mixin: ChildNode not implemented.")}replaceWith(){throw Error("Mixin: ChildNode not implemented.")}remove(){throw Error("Mixin: ChildNode not implemented.")}}t.CharacterDataImpl=a},4546:(e,t,r)=>{"use strict";var n;r.d(t,{W:()=>n}),function(e){e[e.CounterClockwise=-1]="CounterClockwise",e[e.Unknown=0]="Unknown",e[e.Clockwise=1]="Clockwise"}(n||(n={}))},4849:(e,t,r)=>{"use strict";function n(e,t){e.imageIds?.forEach((r,n)=>{let i=function(e,t){let r=e.imageIds??[],n=e.referencedImageIds??r;if(n.length)return e.referencedImageIds?.length&&r.length>n.length&&r.length%n.length==0?n[t%n.length]:n[t]}(e,n);i&&r&&t(i,r,n)})}function i(e,t){let r=[];return n(e,(e,n)=>{e===t&&r.push(n)}),r}function a(e){let t=new Map;return n(e,e=>{t.set(e,(t.get(e)??0)+1)}),Array.from(t.values()).some(e=>e>1)}r.d(t,{Zd:()=>n,dm:()=>a,s_:()=>i})},4937:(e,t,r)=>{"use strict";r.d(t,{e:()=>l});var n=r(54268),i=r(14098),a=r(20549),o=r(8889),s=r(6297);class l{async load(e,t){if(!t)throw Error(`[VolumeViewport3D] No load options were provided for ${e}`);let r=this.getDataSet(e);if("vtkVolume3d"===t.renderMode){if(!r?.imageIds?.length)throw Error(`[VolumeViewport3D] No registered volume dataset for ${e}`);let t=(0,o.A)(r.volumeId??e),n=await (0,a.createAndCacheVolume)(t,{imageIds:r.imageIds});return n.load(),{id:e,type:"image",imageIds:n.imageIds||r.imageIds,imageVolume:n,renderMode:"vtkVolume3d",volumeId:t}}let s=r?.geometryId||e;return{id:e,type:"geometry",geometry:n.Ay.getGeometry(s)||await (0,i.yu)(s,r?.geometryLoadOptions),geometryId:s,renderMode:"vtkGeometry3d"}}getDataSet(e){var t;let r=(0,s.$B)(e);if(t=r,(0,s.T0)(t)&&(void 0===t.geometryId||"string"==typeof t.geometryId)&&(void 0===t.volumeId||"string"==typeof t.volumeId)&&(void 0===t.geometryLoadOptions||"object"==typeof t.geometryLoadOptions&&!Array.isArray(t.geometryLoadOptions)))return r}}},5101:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringWalker=void 0;class r{_chars;_length;_pointer=0;_codePoint;_c;_remaining;_substring;constructor(e){this._chars=Array.from(e),this._length=this._chars.length}get eof(){return this._pointer>=this._length}get length(){return this._length}codePoint(){if(void 0===this._codePoint)if(this.eof)this._codePoint=-1;else{let e=this._chars[this._pointer].codePointAt(0);void 0!==e?this._codePoint=e:this._codePoint=-1}return this._codePoint}c(){return void 0===this._c&&(this._c=this.eof?"":this._chars[this._pointer]),this._c}remaining(){return void 0===this._remaining&&(this._remaining=this.eof?"":this._chars.slice(this._pointer+1).join("")),this._remaining}substring(){return void 0===this._substring&&(this._substring=this.eof?"":this._chars.slice(this._pointer).join("")),this._substring}get pointer(){return this._pointer}set pointer(e){e!==this._pointer&&(this._pointer=e,this._codePoint=void 0,this._c=void 0,this._remaining=void 0,this._substring=void 0)}}t.StringWalker=r},5205:(e,t,r)=>{"use strict";r.d(t,{wV:()=>n.wV}),r(78378),r(75405);var n=r(97132)},5309:(e,t)=>{"use strict";var r,n,i,a,o,s,l;Object.defineProperty(t,"__esModule",{value:!0}),t.HowToCompare=t.WhatToShow=t.FilterResult=t.Position=t.NodeType=t.EventPhase=t.BoundaryPosition=void 0,function(e){e[e.Before=0]="Before",e[e.Equal=1]="Equal",e[e.After=2]="After"}(r||(t.BoundaryPosition=r={})),function(e){e[e.None=0]="None",e[e.Capturing=1]="Capturing",e[e.AtTarget=2]="AtTarget",e[e.Bubbling=3]="Bubbling"}(n||(t.EventPhase=n={})),function(e){e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=3]="Text",e[e.CData=4]="CData",e[e.EntityReference=5]="EntityReference",e[e.Entity=6]="Entity",e[e.ProcessingInstruction=7]="ProcessingInstruction",e[e.Comment=8]="Comment",e[e.Document=9]="Document",e[e.DocumentType=10]="DocumentType",e[e.DocumentFragment=11]="DocumentFragment",e[e.Notation=12]="Notation"}(i||(t.NodeType=i={})),function(e){e[e.SameNode=0]="SameNode",e[e.Disconnected=1]="Disconnected",e[e.Preceding=2]="Preceding",e[e.Following=4]="Following",e[e.Contains=8]="Contains",e[e.ContainedBy=16]="ContainedBy",e[e.ImplementationSpecific=32]="ImplementationSpecific"}(a||(t.Position=a={})),function(e){e[e.Accept=1]="Accept",e[e.Reject=2]="Reject",e[e.Skip=3]="Skip"}(o||(t.FilterResult=o={})),function(e){e[e.All=0xffffffff]="All",e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=4]="Text",e[e.CDataSection=8]="CDataSection",e[e.EntityReference=16]="EntityReference",e[e.Entity=32]="Entity",e[e.ProcessingInstruction=64]="ProcessingInstruction",e[e.Comment=128]="Comment",e[e.Document=256]="Document",e[e.DocumentType=512]="DocumentType",e[e.DocumentFragment=1024]="DocumentFragment",e[e.Notation=2048]="Notation"}(s||(t.WhatToShow=s={})),function(e){e[e.StartToStart=0]="StartToStart",e[e.StartToEnd=1]="StartToEnd",e[e.EndToEnd=2]="EndToEnd",e[e.EndToStart=3]="EndToStart"}(l||(t.HowToCompare=l={}))},5357:(e,t,r)=>{"use strict";r.r(t),r.d(t,{DefaultHistoryMemo:()=>s,HistoryMemo:()=>o});var n=r(3922),i=r(31913);let a={HISTORY_UNDO:"CORNERSTONE_TOOLS_HISTORY_UNDO",HISTORY_REDO:"CORNERSTONE_TOOLS_HISTORY_REDO"};class o{constructor(e="Tools",t=50){this.position=-1,this.redoAvailable=0,this.undoAvailable=0,this.ring=[],this.isRecordingGrouped=!1,this.label=e,this._size=t}get size(){return this._size}set size(e){this.ring=Array(e),this._size=e,this.position=-1,this.redoAvailable=0,this.undoAvailable=0}get canUndo(){return this.undoAvailable>0}get canRedo(){return this.redoAvailable>0}undo(e=1){for(;e>0&&this.undoAvailable>0;){let t=this.ring[this.position];for(let e of(0,i._)(t).reverse())e.restoreMemo(!0),this.dispatchHistoryEvent({item:e,isUndo:!0});e--,this.redoAvailable++,this.undoAvailable--,this.position=(this.position-1+this.size)%this.size}}undoIf(e){return!!(this.undoAvailable>0&&e(this.ring[this.position]))&&(this.undo(),!0)}dispatchHistoryEvent({item:e,isUndo:t}){e.id&&n.A.dispatchEvent(new CustomEvent(t?a.HISTORY_UNDO:a.HISTORY_REDO,{detail:{isUndo:t,id:e.id,operationType:e.operationType||"annotation",memo:e}}))}redo(e=1){for(;e>0&&this.redoAvailable>0;){let t=(this.position+1)%this.size,r=this.ring[t];for(let e of(0,i._)(r).reverse())e.restoreMemo(!1),this.dispatchHistoryEvent({item:e,isUndo:!1});e--,this.position=t,this.undoAvailable++,this.redoAvailable--}}initializeGroupItem(){this.redoAvailable=0,this.undoAvailable{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NonDocumentTypeChildNodeImpl=void 0;let n=r(79663);class i{get previousElementSibling(){let e=n.Cast.asNode(this)._previousSibling;for(;e;)if(n.Guard.isElementNode(e))return e;else e=e._previousSibling;return null}get nextElementSibling(){let e=n.Cast.asNode(this)._nextSibling;for(;e;)if(n.Guard.isElementNode(e))return e;else e=e._nextSibling;return null}}t.NonDocumentTypeChildNodeImpl=i},5454:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let n=e=>e&&"object"==typeof e&&"[object RegExp]"!==Object.prototype.toString.call(e)&&"[object Date]"!==Object.prototype.toString.call(e),i=(e,t)=>t&&!0===t.clone&&n(e)?o(Array.isArray(e)?[]:{},e,t):e,a=(e,t,r)=>{let a=e.slice();return t.forEach(function(t,s){void 0===a[s]?a[s]=i(t,r):n(t)?a[s]=o(e[s],t,r):-1===e.indexOf(t)&&(a[s]=i(t,r))}),a},o=(e={},t={},r)=>{let s=Array.isArray(t),l=(r||{arrayMerge:a}).arrayMerge||a;return s?Array.isArray(e)?l(e,t,r):i(t,r):((e,t,r)=>{let a={};return n(e)&&Object.keys(e).forEach(function(t){a[t]=i(e[t],r)}),Object.keys(t).forEach(function(s){n(t[s])&&e[s]?a[s]=o(e[s],t[s],r):a[s]=i(t[s],r)}),a})(e,t,r)},s=o},5490:(e,t,r)=>{"use strict";r.d(t,{W:()=>s});var n=r(50923),i=r(70192);let{p8:a}=i.Jj,o=1-a;function s(e,t){let{viewPlaneNormal:r}=t,a=e.filter(e=>{let t=e.metadata.viewPlaneNormal;if(!t){let{referencedImageId:r}=e.metadata,{imageOrientationPatient:a}=i.wx.get("imagePlaneModule",r),o=n.fA(a[0],a[1],a[2]),s=n.fA(a[3],a[4],a[5]);t=n.vt(),n.$A(t,o,s),e.metadata.viewPlaneNormal=t}let a=Math.abs(n.Om(r,t))>o;return t&&a});return a.length?a:[]}},5541:(e,t,r)=>{"use strict";var n;r.d(t,{A:()=>i}),function(e){e.LINEAR="LINEAR",e.SAMPLED_SIGMOID="SIGMOID",e.LINEAR_EXACT="LINEAR_EXACT"}(n||(n={}));let i=n},5663:(e,t,r)=>{"use strict";r.d(t,{A:()=>u});var n=r(48185),i=r(37579),a=r(79267);let o=a.p8*a.p8,s=e=>Math.abs(Math.abs(e)-1)s(e[t])||s(e[t+1])||s(e[t+2]);function u(e,t,r){let a,o,s=e.getMapper().getInputData();if(l(o=s.getDirection(),0)&&l(o,3)&&l(o,6))a=(0,i.A)(e);else{let[e,t,r]=s.getDimensions();a=[[0,0,0],[e-1,0,0],[0,t-1,0],[e-1,t-1,0],[0,0,r-1],[e-1,0,r-1],[0,t-1,r-1],[e-1,t-1,r-1]].map(e=>s.indexToWorld(e))}let u=n.A.buildFromDegree().identity().rotateFromDirections(t,[1,0,0]);a.forEach(e=>u.apply(e));let c=[...r];u.apply(c);let d=c[0],p=1/0,m=-1/0;for(let e=0;e<8;e++){let t=a[e][0];t>m&&(m=t),t{"use strict";function n(e,t,r,n,i){var a=e*e,o=a*e;return((1-3*e+3*a-o)*t+(4-6*a+3*o)*r+(1+3*e+3*a-3*o)*n+o*i)/6}function i(e){var t=e.length-1;return function(r){var i=r<=0?r=0:r>=1?(r=1,t-1):Math.floor(r*t),a=e[i],o=e[i+1],s=i>0?e[i-1]:2*a-o,l=ii,H:()=>n})},5800:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(70192),i=r(43385);let a=function(e){let t,{representationData:r}=(0,i.T)(e);if(!r.Labelmap)return;let{volumeId:a}=r.Labelmap;if(a&&(t=n.PP.getVolume(a)))return t;let{imageIds:o}=r.Labelmap;if((a=n.PP.generateVolumeId(o),o&&0!==o.length)&&n.BF.isValidVolume(o))return n.UH.createAndCacheVolumeFromImagesSync(a,o)}},5801:(e,t,r)=>{"use strict";r(70192),r(97442),r(38031),r(42306),r(5068)},5889:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>a,B_:()=>n,dJ:()=>i});var n={CLAMP_TO_EDGE:0,REPEAT:1,MIRRORED_REPEAT:2},i={NEAREST:0,LINEAR:1,NEAREST_MIPMAP_NEAREST:2,NEAREST_MIPMAP_LINEAR:3,LINEAR_MIPMAP_NEAREST:4,LINEAR_MIPMAP_LINEAR:5},a={Wrap:n,Filter:i}},5965:(e,t,r)=>{"use strict";r.d(t,{R:()=>a});var n=r(70192),i=r(78378);function a(e){(0,n.Hl)(n.tX,i.sV.SEGMENTATION_ADDED,{segmentationId:e})}},6001:(e,t,r)=>{"use strict";r.d(t,{hH:()=>s,hO:()=>l});var n=r(70192),i=r(49007);let{VoxelManager:a,RLEVoxelMap:o}=n.BF;function s(e,t){var r=e,i=t;let o=a.createRLEHistoryVoxelManager(i);return{segmentationId:r,restoreMemo:u,commitMemo:c,segmentationVoxelManager:i,voxelManager:o,id:n.BF.uuidv4(),operationType:"labelmap"}}function l(e){return{undo:()=>e.restoreMemo(!0),redo:()=>e.restoreMemo(!1)}}function u(e){let t=!1!==e,r=this.priorSteps??[],n=this.postSteps??[],a=()=>{let{segmentationVoxelManager:e,undoVoxelManager:r,redoVoxelManager:n}=this,a=t?r:n;if(!a)return;a.forEach(({value:t,pointIJK:r})=>{e.setAtIJKPoint(r,t)});let o=a.getArrayOfModifiedSlices();(0,i.triggerSegmentationDataModified)(this.segmentationId,o)};if(t){for(let e=n.length-1;e>=0;e--)n[e].undo();a();for(let e=r.length-1;e>=0;e--)r[e].undo()}else{for(let e of r)e.redo();for(let e of(a(),n))e.redo()}}function c(){if(this.redoVoxelManager)return!0;let e=!!(this.priorSteps?.length||this.postSteps?.length);if(!this.voxelManager.modifiedSlices.size)return e;let{segmentationVoxelManager:t}=this,r=a.createRLEHistoryVoxelManager(t);for(let e of(o.copyMap(r.map,this.voxelManager.map),this.voxelManager.modifiedSlices.keys()))r.modifiedSlices.add(e);this.undoVoxelManager=r;let n=a.createRLEVolumeVoxelManager({dimensions:this.segmentationVoxelManager.dimensions});return this.redoVoxelManager=n,r.forEach(({index:e,pointIJK:r,value:i})=>{let a=t.getAtIJKPoint(r);a!==i&&n.setAtIndex(e,a)}),!0}},6088:(e,t,r)=>{"use strict";r(93022),r(21167),r(63306)},6285:(e,t,r)=>{"use strict";r.d(t,{NU:()=>c,VU:()=>o,X3:()=>s,Yo:()=>l,sh:()=>u});var n=r(1705),i=r(59085),a=r(24346);function o(e){let{projection:t,rendering:r,viewState:i}=e;return t?t.currentImageIdIndex:r.renderMode===n.T.CPU_IMAGE||r.renderMode===n.T.VTK_IMAGE?(0,a.nb)({fallbackImageIdIndex:r.currentImageIdIndex,viewState:i}):r.currentImageIdIndex}function s(e){let t=e.view.activeSourceICamera;if(t?.focalPoint&&"number"==typeof t.parallelScale&&t.viewPlaneNormal&&t.viewUp)return t}function l(e){let t=s(e.ctx);if(!t)return[0,0,0];let{canvasWidth:r,canvasHeight:n}=(0,i.fi)(e.canvas);return(0,i.KR)({camera:t,canvasWidth:r,canvasHeight:n,canvasPos:e.canvasPos})}function u(e){let t=s(e.ctx);if(!t)return[0,0];let{canvasWidth:r,canvasHeight:n}=(0,i.fi)(e.canvas);return(0,i.Mx)({camera:t,canvasWidth:r,canvasHeight:n,worldPos:e.worldPos})}function c(e){var t;let{ctx:r,data:n,dataId:i,frameOfReferenceUID:o,imageIds:l,rendering:u,sliceIndex:c,viewState:d={}}=e,p=(0,a.a8)({viewState:d,data:n,frameOfReferenceUID:o,imageIds:l,rendering:u,renderContext:r,sliceIndex:c});if(!p)return;let m=p.toICamera(),h=r.viewport.isCurrentDataId(i);return h&&(r.view.activeSourceICamera=m),{activeSourceICamera:h?m:s(r)||m,currentImageIdIndex:p.state.currentImageIdIndex,isSourceBinding:h,maxImageIdIndex:p.state.maxImageIdIndex,presentation:{pan:(t=p).pan,zoom:t.zoom,scale:t.scale,rotation:t.rotation,flipHorizontal:t.state.viewState.flipHorizontal??!1,flipVertical:t.state.viewState.flipVertical??!1},resolvedICamera:m,resolvedView:p}}},6297:(e,t,r)=>{"use strict";r.d(t,{$B:()=>a,Pv:()=>s,QV:()=>o,T0:()=>u,_d:()=>l});var n=r(18025);function i(e){return n.A.get(n.A.VIEWPORT_V2_DISPLAY_SET,e)}function a(e){let t=i(e);return d(t)?{imageIds:t}:u(t)?t:void 0}function o(e){let t=i(e);return d(t)?{imageIds:t}:u(t)?"kind"in t&&t.kind&&"planar"!==t.kind?void 0:t:void 0}function s(e){var t;let r=i(e);return c(t=r)&&"wsi"===t.kind&&d(t.imageIds)&&c(t.options)&&p(t.options.webClient)?r:c(r)&&d(r.imageIds)&&c(r.options)&&p(r.options.webClient)?{imageIds:r.imageIds,kind:"wsi",options:{miniNavigationOverlay:r.options.miniNavigationOverlay,webClient:r.options.webClient}}:void 0}function l(e){var t;let r=i(e);return"string"==typeof r?r:d(r)&&r[0]?r[0]:c(t=r)&&("video"===t.kind||"ecg"===t.kind)&&"string"==typeof t.sourceDataId?r.sourceDataId:e}function u(e){return c(e)&&d(e.imageIds)}function c(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function d(e){return Array.isArray(e)&&e.every(e=>"string"==typeof e)}function p(e){return c(e)&&"function"==typeof e.getDICOMwebMetadata}},6342:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JSONCBWriter=void 0;let n=r(39409);class i extends n.BaseCBWriter{_hasChildren=[];_additionalLevel=0;constructor(e){super(e)}frontMatter(){return""}declaration(e,t,r){return""}docType(e,t,r){return""}comment(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.comment)+this._sep()+this._val(e)+this._sep()+"}"}text(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.text)+this._sep()+this._val(e)+this._sep()+"}"}instruction(e,t){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.ins)+this._sep()+this._val(t?e+" "+t:e)+this._sep()+"}"}cdata(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.cdata)+this._sep()+this._val(e)+this._sep()+"}"}attribute(e,t){return this._comma()+this._beginLine(1)+"{"+this._sep()+this._key(this._builderOptions.convert.att+e)+this._sep()+this._val(t)+this._sep()+"}"}openTagBegin(e){let t=this._comma()+this._beginLine()+"{"+this._sep()+this._key(e)+this._sep()+"{";return this._additionalLevel++,this.hasData=!0,t+=this._beginLine()+this._key(this._builderOptions.convert.text)+this._sep()+"[",this._hasChildren.push(!1),t}openTagEnd(e,t,r){if(!t)return"";{let e=this._sep()+"]";return this._additionalLevel--,e+=this._beginLine()+"}"+this._sep()+"}"}}closeTag(e){let t=this._beginLine()+"]";return this._additionalLevel--,t+=this._beginLine()+"}"+this._sep()+"}"}beginElement(e){}endElement(e){this._hasChildren.pop()}_beginLine(e=0){return this._writerOptions.prettyPrint?(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level+e):""}_indent(e){return e+this._additionalLevel<=0?"":this._writerOptions.indent.repeat(e+this._additionalLevel)}_comma(){let e=this._hasChildren[this._hasChildren.length-1]?",":"";return this._hasChildren.length>0&&(this._hasChildren[this._hasChildren.length-1]=!0),e}_sep(){return this._writerOptions.prettyPrint?" ":""}_key(e){return'"'+e+'":'}_val(e){return JSON.stringify(e)}}t.JSONCBWriter=i},6529:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(39216);function i(e){let t,r=e[0],{pixelRepresentation:i,bitsAllocated:a,bitsStored:o,highBit:s,photometricInterpretation:l,samplesPerPixel:u}=(0,n.get)("imagePixelModule",r),c=[],d=(0,n.get)("voiLutModule",r);if(d){let{windowWidth:e,windowCenter:r}=d;if(t=d?.voiLUTFunction,Array.isArray(e))for(let t=0;t{"use strict";function n(e,t){switch(e){case"Float32Array":return Float32Array;case"Uint8Array":return Uint8Array;case"Uint32Array":return Uint32Array;case"Uint16Array":case"Int16Array":if(!t)return"Uint16Array"===e?Uint16Array:Int16Array;return console.debug(`${e} is not supported for volume rendering, switching back to Float32Array`),Float32Array;default:if(!e)return Float32Array;throw Error("TargetBuffer should be Float32Array, Uint8Array, Uint16Array, Int16Array, or Uint32Array")}}function i(e,t,r={}){let{isVolumeBuffer:a=!1}=r,o=n(e,a);return{numBytes:t*o.BYTES_PER_ELEMENT,TypedArrayConstructor:o}}r.d(t,{h:()=>i,j:()=>n})},6600:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(27321),i=r(68759),a=r(65704);let o=function(e,t,r,o,s,l={},u=""){let{color:c,fill:d,width:p,lineWidth:m,lineDash:h,fillOpacity:f,strokeOpacity:g}=Object.assign({color:"rgb(0, 255, 0)",fill:"transparent",width:"2",lineDash:void 0,lineWidth:void 0,strokeOpacity:1,fillOpacity:1},l),v=(0,n.A)(t,"circle",r),y=e.getSvgNode(v),b={cx:`${o[0]}`,cy:`${o[1]}`,r:`${s}`,stroke:c,fill:d,"stroke-width":m||p,"stroke-dasharray":h,"fill-opacity":f,"stroke-opacity":g};if(y)(0,i.A)(b,y),e.setNodeTouched(v);else{let t=document.createElementNS("http://www.w3.org/2000/svg","circle");""!==u&&t.setAttribute("data-id",u),(0,a.A)(b,t),e.appendNode(t,v)}}},6913:(e,t,r)=>{"use strict";r.d(t,{A:()=>u});var n=r(50923),i=r(72661),a=r(77280),o=r(16376),s=r(32916),l=r(55291);function u(e,t,r,c="_thumbnails",d={displayArea:{imageArea:[1,1]}}){if(!e||!(e instanceof HTMLCanvasElement))throw Error("canvas element is required");let p=!t.imageId,m=!p&&t,h=p&&t,f=m.imageId||h.volumeId,g=`renderGPUViewport-${f}`,v=document.createElement("div"),y=window.devicePixelRatio||1;d.displayArea||(d.displayArea={imageArea:[1,1]});let b=e.width,I=e.height;v.style.width=`${b/y+i.p8}px`,v.style.height=`${I/y+i.p8}px`,v.style.visibility="hidden",v.style.position="absolute",document.body.appendChild(v);let x=g.split(":").join("-");v.setAttribute("viewport-id-for-remove",x);let C=(0,i.Ay)(v),A=(0,o.lD)(c)||new s.A(c),T=A.getViewport(g);if(!T){let e={viewportId:g,type:p?a.NV.ORTHOGRAPHIC:a.NV.STACK,element:v,defaultOptions:{...d,suppressEvents:!0}};A.enableElement(e),T=A.getViewport(g)}return new Promise(i=>{let o=!1,{viewReference:s}=d,u=t=>{if(o)return;if(s){let e=s;s=null,T.setViewReference(e),T.render();return}e.getContext("2d").drawImage(C,0,0,C.width,C.height,0,0,e.width,e.height);let r=T.canvasToWorld([0,0]),l=T.canvasToWorld([C.width/y,0]),c=T.canvasToWorld([0,C.height/y]),d=n.jb([0,0,0],T.canvasToWorld([1/y,0]),r),p=n.jb([0,0,0],T.canvasToWorld([0,1/y]),r);o=!0,v.removeEventListener(a.sV.IMAGE_RENDERED,u),setTimeout(()=>{A.disableElement(g),document.querySelectorAll(`[viewport-id-for-remove="${x}"]`).forEach(e=>{e.remove()})},0),i({origin:r,bottomLeft:c,topRight:l,thicknessMm:1,rightVector:d,downVector:p})};v.addEventListener(a.sV.IMAGE_RENDERED,u),p?T.setVolumes([h],!1,!0):T.renderImageObject(t),T.resetCamera(),"PT"!==r||(0,l.A)(m)||T.setProperties({voiRange:{lower:m.minPixelValue,upper:m.maxPixelValue}}),T.render()})}},6927:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(50923),i=r(39216),a=r(77280),o=r(35290);function s(e,t){let r,{imagePositionPatient:s,imageOrientationPatient:l}=i.get(a.nb.IMAGE_PLANE,e[0]);if(!t){let e=n.fA(l[0],l[1],l[2]),r=n.fA(l[3],l[4],l[5]);t=n.vt(),n.$A(t,e,r)}let u="wadouri"===e[0].split(":")[0],c=(0,o.A)(e);function d(e){let{imagePositionPatient:r}=i.get(a.nb.IMAGE_PLANE,e),o=n.vt();return n.jb(o,s,r),n.Om(o,t)}if(u){let t=[e[0],e[Math.floor(e.length/2)]];r=e,d(t[0])-d(t[1])<0&&r.reverse()}else{let t=e.map(e=>({distance:d(e),imageId:e}));t.sort((e,t)=>t.distance-e.distance),r=t.map(e=>e.imageId)}let{imagePositionPatient:p}=i.get(a.nb.IMAGE_PLANE,r[0]);return{zSpacing:c,origin:p,sortedImageIds:r}}},6972:(e,t,r)=>{"use strict";r(60332),r(55623),r(5800)},6975:(e,t,r)=>{"use strict";let n=r(55839),i=r(26735),a=r(87431),o=Object.prototype.toString,s=Object.prototype.hasOwnProperty,l={};l[0]="\\0",l[7]="\\a",l[8]="\\b",l[9]="\\t",l[10]="\\n",l[11]="\\v",l[12]="\\f",l[13]="\\r",l[27]="\\e",l[34]='\\"',l[92]="\\\\",l[133]="\\N",l[160]="\\_",l[8232]="\\L",l[8233]="\\P";let u=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],c=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function d(e){this.schema=e.schema||a,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=n.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=function(e,t){if(null===t)return{};let r={},n=Object.keys(t);for(let i=0,a=n.length;i=32&&e<=126||e>=161&&e<=55295&&8232!==e&&8233!==e||e>=57344&&e<=65533&&65279!==e||e>=65536&&e<=1114111}function g(e){return f(e)&&65279!==e&&13!==e&&10!==e}function v(e,t,r){let n=g(e),i=n&&!h(e);return(r?n:n&&44!==e&&91!==e&&93!==e&&123!==e&&125!==e)&&35!==e&&!(58===t&&!i)||g(t)&&!h(t)&&35===e||58===t&&i}function y(e,t){let r,n=e.charCodeAt(t);return n>=55296&&n<=56319&&t+1=56320&&r<=57343?(n-55296)*1024+r-56320+65536:n}function b(e){return/^\n* /.test(e)}function I(e,t){let r=b(e)?String(t):"",n="\n"===e[e.length-1];return r+(n&&("\n"===e[e.length-2]||"\n"===e)?"+":n?"":"-")+"\n"}function x(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function C(e,t){let r,n;if(""===e||" "===e[0])return e;let i=/ [^ ]/g,a=0,o=0,s=0,l="";for(;r=i.exec(e);)(s=r.index)-a>t&&(n=o>a?o:s,l+="\n"+e.slice(a,n),a=n+1),o=s;return l+="\n",e.length-a>t&&o>a?l+=e.slice(a,o)+"\n"+e.slice(o+1):l+=e.slice(a),l.slice(1)}function A(e,t,r,n){let i="",a=e.tag;for(let a=0,o=r.length;a tag resolver accepts not "'+n+'" style');e.dump=r}return!0}}return!1}function S(e,t,r,a,s,d,g){let w,O;e.tag=null,e.dump=r,T(e,r,!1)||T(e,r,!0);let P=o.call(e.dump),_=a;a&&(a=e.flowLevel<0||e.flowLevel>t);let E="[object Object]"===P||"[object Array]"===P;if(E&&(O=-1!==(w=e.duplicates.indexOf(r))),(null!==e.tag&&"?"!==e.tag||O||2!==e.indent&&t>0)&&(s=!1),O&&e.usedDuplicates[w])e.dump="*ref_"+w;else{if(E&&O&&!e.usedDuplicates[w]&&(e.usedDuplicates[w]=!0),"[object Object]"===P)a&&0!==Object.keys(e.dump).length?(!function(e,t,r,n){let a="",o=e.tag,s=Object.keys(r);if(!0===e.sortKeys)s.sort();else if("function"==typeof e.sortKeys)s.sort(e.sortKeys);else if(e.sortKeys)throw new i("sortKeys must be a boolean or a function");for(let i=0,o=s.length;i1024;c&&(e.dump&&10===e.dump.charCodeAt(0)?o+="?":o+="? "),o+=e.dump,c&&(o+=m(e,t)),S(e,t+1,u,!0,c)&&(e.dump&&10===e.dump.charCodeAt(0)?o+=":":o+=": ",o+=e.dump,a+=o)}e.tag=o,e.dump=a||"{}"}(e,t,e.dump,s),O&&(e.dump="&ref_"+w+e.dump)):(!function(e,t,r){let n="",i=e.tag,a=Object.keys(r);for(let i=0,o=a.length;i1024&&(o+="? "),o+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),S(e,t,l,!1,!1)&&(o+=e.dump,n+=o))}e.tag=i,e.dump="{"+n+"}"}(e,t,e.dump),O&&(e.dump="&ref_"+w+" "+e.dump));else if("[object Array]"===P)a&&0!==e.dump.length?(e.noArrayIndent&&!g&&t>0?A(e,t-1,e.dump,s):A(e,t,e.dump,s),O&&(e.dump="&ref_"+w+e.dump)):(!function(e,t,r){let n="",i=e.tag;for(let i=0,a=r.length;i=65536?c+=2:c++){if(!f(d=y(e,c)))return 5;C=C&&v(d,p,s),p=d}else{for(c=0;c=65536?c+=2:c++){if(10===(d=y(e,c)))m=!0,I&&(g=g||c-x-1>n&&" "!==e[x+1],x=c);else if(!f(d))return 5;C=C&&v(d,p,s),p=d}g=g||I&&c-x-1>n&&" "!==e[x+1]}return m||g?r>9&&b(e)?5:o?2===a?5:2:g?4:3:!C||o||i(e)?2===a?5:2:1}(D,d||e.flowLevel>-1&&t>=e.flowLevel,e.indent,a,function(t){for(let r=0,n=e.implicitTypes.length;r"+I(D,e.indent)+x(p(function(e,t){let r,n,i,a=/(\n+)([^\n]*)/g,o=(a.lastIndex=i=-1!==(i=e.indexOf("\n"))?i:e.length,C(e.slice(0,i),t)),s="\n"===e[0]||" "===e[0];for(;n=a.exec(e);){let e=n[1],i=n[2];r=" "===i[0],o+=e+(s||r||""===i?"":"\n")+C(i,t),s=r}return o}(D,a),r));case 5:return'"'+function(e){let t="",r=0;for(let a=0;a=65536?a+=2:a++){let o=l[r=y(e,a)];!o&&f(r)?(t+=e[a],r>=65536&&(t+=e[a+1])):t+=o||function(e){let t,r,a=e.toString(16).toUpperCase();if(e<=255)t="x",r=2;else if(e<=65535)t="u",r=4;else if(e<=0xffffffff)t="U",r=8;else throw new i("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+t+n.repeat("0",r-a.length)+a}(r)}return t}(D,a)+'"';default:throw new i("impossible error: invalid scalar style")}}())}else{if("[object Undefined]"===P||e.skipInvalid)return!1;throw new i("unacceptable kind of an object to dump "+P)}if(null!==e.tag&&"?"!==e.tag){let t=encodeURI("!"===e.tag[0]?e.tag.slice(1):e.tag).replace(/!/g,"%21");t="!"===e.tag[0]?"!"+t:"tag:yaml.org,2002:"===t.slice(0,18)?"!!"+t.slice(18):"!<"+t+">",e.dump=t+" "+e.dump}}return!0}e.exports.dump=function(e,t){let r=new d(t=t||{});r.noRefs||function(e,t){let r=[],n=[];!function e(t,r,n){if(null!==t&&"object"==typeof t){let i=r.indexOf(t);if(-1!==i)-1===n.indexOf(i)&&n.push(i);else if(r.push(t),Array.isArray(t))for(let i=0,a=t.length;i{"use strict";r.d(t,{A:()=>m});var n=r(17042),i=r(58804),a=r(85250),o=r(5434),{vtkErrorMacro:s}=n.Ay,l=new Float64Array(16),u=new Float64Array(4);function c(e,t){let r=e.getNormalByReference(),n=e.getOriginByReference();return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=-(r[0]*n[0]+r[1]*n[1]+r[2]*n[2]),t}var d={clippingPlanes:[]},p={extend:function(e,t,r={}){Object.assign(t,d,r),n.Ay.obj(e,t),n.Ay.algo(e,t,1,0),t.clippingPlanes||(t.clippingPlanes=[]),t.classHierarchy.push("vtkAbstractMapper"),e.update=()=>{e.getInputData()},e.addClippingPlane=r=>!!r.isA("vtkPlane")&&!t.clippingPlanes.includes(r)&&(t.clippingPlanes.push(r),e.modified(),!0),e.getNumberOfClippingPlanes=()=>t.clippingPlanes.length,e.removeAllClippingPlanes=()=>0!==t.clippingPlanes.length&&(t.clippingPlanes.length=0,e.modified(),!0),e.removeClippingPlane=r=>{let n=t.clippingPlanes.indexOf(r);return -1!==n&&(t.clippingPlanes.splice(n,1),e.modified(),!0)},e.getClippingPlanes=()=>t.clippingPlanes,e.getClippingPlanesMTime=()=>{let e=0;for(let r=0;r{if(t)if(Array.isArray(t)){let r=t.length;for(let n=0;n{if(r<0||r>=t.clippingPlanes?.length)return void s(`Clipping plane index ${r} is out of range.`);let i=n||new Float64Array(4);return c(t.clippingPlanes[r],u),a.invert(l,e),a.transpose(l,l),o.Z0(i,u,l),i},e.getClippingPlaneInDataCoords=(e,r,n)=>{let i=t.clippingPlanes;if(i){let t=i.length;if(r>=0&&r{n.Ay.vtkErrorMacro("vtkAbstractMapper3D.computeBounds - NOT IMPLEMENTED")};let a=e.getBounds;e.getBounds=()=>(e.computeBounds(),a());let o=e.getBoundsByReference;e.getBoundsByReference=()=>(e.computeBounds(),o()),e.getCenter=()=>{let r=e.getBoundsByReference();return t.center=i.Ay.isValid(r)?i.Ay.getCenter(r):null,t.center?.slice()},e.getLength=()=>{let t=e.getBoundsByReference();return i.Ay.getDiagonalLength(t)}}}},7286:(e,t,r)=>{"use strict";r.d(t,{N:()=>i,r:()=>n});class n{constructor(e=[]){this.paths=[],e.forEach(e=>this.add(e))}register(e){this.add(e)}add(e){if(this.paths.find(t=>t.id===e.id))return void console.debug(`[DefaultRenderPathResolver] Duplicate render path registration ignored for "${e.id}"`);this.paths.push(e)}resolve(e,t,r){let n=this.paths.find(n=>n.type===e&&n.matches(t,r));if(!n)throw Error(`No render path for ${e}/${t.type}/${r.renderMode}`);return n}}let i=new n},7373:(e,t,r)=>{"use strict";r.d(t,{fT:()=>o,j_:()=>l,l2:()=>s});var n=r(5541),i=r(72795),a=r(65110);function o(e,t){let{lower:r,upper:i}=t.voiRange,o=i-r,s=t.VOILUTFunction,l=e=>!0===t.invert?1-e:e;if(s===n.A.SAMPLED_SIGMOID||"SIGMOID"===s){let{windowCenter:t,windowWidth:n}=a.toWindowLevel(r,i);return l(1/(1+Math.exp(-4*(e-t)/Math.max(Math.abs(n),1e-12))))}return l(0!==o&&Number.isFinite(o)?u((e-r)/o):0)}function s(e,t){let{lower:r,upper:o}=t.voiRange,s=t.VOILUTFunction,l=!0===t.invert?u(1-u(e)):u(e);if(s===n.A.SAMPLED_SIGMOID||"SIGMOID"===s){let{windowCenter:e,windowWidth:t}=a.toWindowLevel(r,o),n=c(l,1e-6,.999999);return(0,i.i)(n,e,t)}let d=o-r;return 0!==d&&Number.isFinite(d)?r+l*d:r}function l(e,t,r){let n=Math.min(e,t),i=Math.max(e,t),a=s(n,r),o=s(i,r);return{rawMin:Math.min(a,o),rawMax:Math.max(a,o)}}function u(e){return Number.isFinite(e)?c(e,0,1):0}function c(e,t,r){return Math.min(r,Math.max(t,e))}},7399:(e,t,r)=>{"use strict";r.d(t,{O4:()=>c,Sk:()=>u,lG:()=>i,n7:()=>n,p8:()=>s});var n,i,a=r(70192),o=r(91336);let s=1e-7;function l(e,t){return e[0]*t[1]-e[1]*t[0]}function u(e,t){return a.BF.isEqual(e,t,s)}function c(e,t,r,n){let i=o.Re(o.vt(),t,e),a=o.Re(o.vt(),n,r),c=l(i,a),d=o.Re(o.vt(),r,e),p=l(d,i);if(Math.abs(c)e>=-s&&e<=1+s;if(f(d)&&u(r,o.Ln(o.vt(),e,i,d)))return r;if(f(p)&&u(n,o.Ln(o.vt(),e,i,p)))return n;if(f(m)&&u(e,o.Ln(o.vt(),r,a,m)))return e;if(f(h)&&u(t,o.Ln(o.vt(),r,a,h)))return t}return null}let m=l(d,a)/c,h=p/c;return m>=-s&&m<=1+s&&h>=-s&&h<=1+s?[e[0]+m*i[0],e[1]+m*i[1]]:null}!function(e){e[e.Vertex=0]="Vertex",e[e.Intersection=1]="Intersection"}(n||(n={})),function(e){e[e.Entering=0]="Entering",e[e.Exiting=1]="Exiting",e[e.Unknown=2]="Unknown"}(i||(i={}))},7494:(e,t,r)=>{"use strict";function n(e,t){let{hflip:r,vflip:n,rotation:i}=t;if(e.x*=r?-1:1,e.y*=n?-1:1,0!==i){let t=i*Math.PI/180,r=Math.cos(t),n=Math.sin(t),a=e.x*r-e.y*n,o=e.x*n+e.y*r;e.x=a,e.y=o}return e}r.d(t,{A:()=>n})},7506:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EmptySet=void 0;class r{get size(){return 0}add(e){throw Error("Cannot add to an empty set.")}clear(){}delete(e){return!1}forEach(e,t){}has(e){return!1}[Symbol.iterator](){return new n}entries(){return new n}keys(){return new n}values(){return new n}get[Symbol.toStringTag](){return"EmptySet"}}t.EmptySet=r;class n{[Symbol.iterator](){return this}next(){return{done:!0,value:null}}}},7842:(e,t,r)=>{"use strict";r.d(t,{A:()=>d});var n=r(77280),i=r(92336),a=r(69228),o=r(55580),s=r(31608),l=r(6297),u=r(39935);class c extends o.A{constructor(e){super({...e,canvas:e.canvas||(0,s.oI)(e.element)}),this.imageId=null,this.channels=[],this.waveformData=null,this.ecgWidth=0,this.ecgHeight=0,this.channelScale=0,this.ecgCamera={panWorld:[0,0],parallelScale:1},this.getProperties=()=>({visibleChannels:this.channels.map((e,t)=>e.visible?t:-1).filter(e=>e>=0)}),this.resetCamera=()=>(this.refreshRenderValues(),this.canvasContext.fillRect(0,0,this.canvas.width,this.canvas.height),this.renderFrame(),!0),this.getFrameOfReferenceUID=()=>`ecg-viewport-${this.id}`,this.resize=()=>{let e=this.canvas,{clientWidth:t,clientHeight:r}=e;(e.width!==t||e.height!==r)&&(e.width=t,e.height=r),this.waveformData&&(this.computeChannelScale(),this.recalculateHeight()),this.refreshRenderValues(),this.renderFrame()},this.canvasToWorld=(e,t=[0,0,0])=>{if(!this.waveformData)return t[0]=0,t[1]=0,t[2]=0,t;let r=this.getWorldToCanvasRatio(),n=this.ecgCamera.panWorld,i=this.computeChannelLayouts(),a=[e[0]/r-n[0],e[1]/r-n[1]],o=0;for(let e=0;e{if(!this.waveformData)return[0,0];let t=this.getWorldToCanvasRatio(),r=this.ecgCamera.panWorld,n=this.computeChannelLayouts(),i=Math.round(e[2]);if(i<0||i>=n.length)return[0,0];let a=n[i];return[e[0]/this.waveformData.numberOfSamples*this.ecgWidth*t+r[0]*t,(a.baseline-e[1]*this.channelScale)*t+r[1]*t]},this.getRotation=()=>0,this.getNumberOfSlices=()=>1,this.getCurrentImageIdIndex=()=>0,this.getCurrentImageId=()=>this.imageId,this.getSliceIndex=()=>0,this.getImageIds=()=>this.imageId?[this.imageId]:[],this.scroll=()=>{},this.customRenderViewportToCanvas=()=>{this.renderFrame()},this.renderFrame=()=>{if(!this.waveformData)return;let e=window.devicePixelRatio||1,t=this.getTransform().getMatrix(),r=this.canvasContext;r.resetTransform(),r.fillStyle=u.ECG_RENDERING_COLORS.background,r.fillRect(0,0,this.canvas.width,this.canvas.height),r.setTransform(t[0]/e,t[1]/e,t[2]/e,t[3]/e,t[4]/e,t[5]/e);let i=this.computeChannelLayouts();this.drawGrid(r),this.drawTraces(r,i),this.drawLabels(r,i),r.resetTransform(),this.setRendered(),(0,a.A)(this.element,n.sV.IMAGE_RENDERED,{element:this.element,viewportId:this.id,viewport:this,renderingEngineId:this.renderingEngineId})},this.getMiddleSliceData=()=>{throw Error("Method not implemented for ECG viewport.")},this.canvasContext=this.canvas.getContext("2d"),this.renderingEngineId=e.renderingEngineId,this.element.setAttribute("data-viewport-uid",this.id),this.element.setAttribute("data-rendering-engine-uid",this.renderingEngineId),this.addEventListeners(),this.resize()}static get useCustomRenderingPipeline(){return!0}addEventListeners(){this.canvas.addEventListener(n.sV.ELEMENT_DISABLED,this.elementDisabledHandler)}removeEventListeners(){this.canvas.removeEventListener(n.sV.ELEMENT_DISABLED,this.elementDisabledHandler)}elementDisabledHandler(){this.removeEventListeners()}async setEcg(e){this.clearDisplaySets(),this.imageId=e;let{waveform:t,calibration:r}=await (0,u.loadECGWaveform)(e);this.channels=t.channels.map(e=>({...e,visible:!0})),this.waveformData={...t,channels:this.channels,multiplexGroupLabel:t.multiplexGroupLabel},this.calibration=r,this.ecgWidth=Math.ceil(this.waveformData.numberOfSamples*u.ECG_SECONDS_WIDTH/this.waveformData.samplingFrequency),this.computeChannelScale(),this.recalculateHeight(),this.refreshRenderValues(),this.renderFrame()}async setDisplaySets(...e){await this.mountDisplaySets(e,async e=>{let t=(0,l._d)(e.displaySetId);await this.setEcg(t)})}setChannelVisibility(e,t){e>=0&&e({name:e.name,visible:e.visible}))}getWaveformData(){return this.waveformData}getContentDimensions(){return{width:this.ecgWidth,height:this.ecgHeight}}computeChannelScale(){let e=(0,u.getVisibleECGChannelsByFlag)(this.channels);if(0===e.length||0===this.ecgWidth){this.channelScale=0;return}let t=1;for(let r of e)t=Math.max(t,r.max-r.min);let r=this.canvas.offsetHeight&&this.canvas.offsetWidth?this.canvas.offsetHeight/this.canvas.offsetWidth:2/3,n=(this.ecgWidth*r-u.ECG_CHANNEL_SPACING*e.length)/e.length;this.channelScale=n/(1.25*t)}recalculateHeight(){this.ecgHeight=(0,u.computeECGHeight)((0,u.getVisibleECGChannelsByFlag)(this.channels),this.channelScale)}computeChannelLayouts(){return(0,u.computeECGChannelLayouts)({visibleChannels:(0,u.getVisibleECGChannelsByFlag)(this.channels),channelScale:this.channelScale})}setProperties(e){if(void 0!==e.visibleChannels){for(let t=0;tthis.canvas.offsetHeight&&(e=this.canvas.offsetHeight/this.ecgHeight);let t=Math.floor(this.ecgWidth*e),r=Math.floor(this.ecgHeight*e),n=(this.canvas.offsetWidth-t)/2,i=(this.canvas.offsetHeight-r)/2,a=n/e,o=i/e;this.ecgCamera.panWorld=[a,o],this.ecgCamera.parallelScale=e}getWorldToCanvasRatio(){return this.ecgCamera.parallelScale}getTransform(){let e=this.ecgCamera.panWorld,t=window.devicePixelRatio||1,r=this.getWorldToCanvasRatio(),n=1/r,a=[this.canvas.offsetWidth/2,this.canvas.offsetHeight/2],o=[a[0]*n,a[1]*n],s=new i.d;return s.scale(t,t),s.translate(a[0],a[1]),s.scale(r,r),s.translate(e[0],e[1]),s.translate(-o[0],-o[1]),s}drawGrid(e){(0,u.drawECGGrid)(e,{ecgWidth:this.ecgWidth,ecgHeight:this.ecgHeight,channelScale:this.channelScale})}drawTraces(e,t){(0,u.drawECGTraces)({ctx:e,layouts:t,ecgWidth:this.ecgWidth,channelScale:this.channelScale})}drawLabels(e,t){(0,u.drawECGLabels)(e,t,this.getWorldToCanvasRatio())}getImageData(){if(!this.waveformData)return null;let e=[this.waveformData.numberOfSamples,65536,this.waveformData.numberOfChannels],t=[1,1,1],r=[1,0,0,0,1,0,0,0,1];return{dimensions:e,spacing:t,origin:[0,0,0],direction:r,imageData:{getDirection:()=>r,getDimensions:()=>e,getRange:()=>[0,1],getSpacing:()=>t,worldToIndex:e=>[e[0],e[1]+32768,e[2]],indexToWorld:e=>[e[0],e[1]-32768,e[2]]},hasPixelSpacing:!1,calibration:this.calibration,preScale:{scaled:!1},metadata:{Modality:"ECG"}}}getSliceViewInfo(){throw Error("Method not implemented for ECG viewport.")}}let d=c},7957:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>w});var n=r(17042),i=r(99298),a=r(87352),o=r(69927),s=r(57236);r(10463);var l=r(35666),u=r(5889),c=r(72188),d=r(56929),p=r(61052),m=r(9731),h=r(86077),f=r(32037),g=r(28245),v=r(89988),y=r(67931),b=r(53163),I=r(85250),x=r(50923),{vtkErrorMacro:C}=n.Ay,A={currentRenderPass:null,volumeTexture:null,colorTexture:null,pwfTexture:null,tris:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,lastIndependentComponents:0,imagemat:null,imagematinv:null};function T(e,t,r={}){Object.assign(t,A,r),c.A.extend(e,t,r),v.A.implementReplaceShaderCoincidentOffset(e,t,r),n.Ay.algo(e,t,2,0),t.tris=h.Ay.newInstance(),t.volumeTexture=null,t.colorTexture=null,t.pwfTexture=null,t.imagemat=I.identity(new Float64Array(16)),t.imagematinv=I.identity(new Float64Array(16)),t.VBOBuildTime={},n.Ay.obj(t.VBOBuildTime,{mtime:0});function d(r){[t._scalars,t._colorTransferFunc,t._pwFunc].forEach(t=>r.unregisterGraphicsResourceUser(t,e))}t.classHierarchy.push("vtkOpenGLImageCPRMapper"),e.buildPass=r=>{if(r){t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");let r=t._openGLRenderWindow;t._openGLRenderWindow=t._openGLRenderer.getLastAncestorOfType("vtkOpenGLRenderWindow"),r&&!r.isDeleted()&&r!==t._openGLRenderWindow&&d(r),t.context=t._openGLRenderWindow.getContext(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera(),t.openGLCamera),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow)}},e.opaquePass=(r,n)=>{r&&(t.currentRenderPass=n,e.render())},e.opaqueZBufferPass=r=>{r&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.getCoincidentParameters=(e,r)=>t.renderable.getResolveCoincidentTopology()===s.XK.PolygonOffset?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{let r=t.openGLImageSlice.getRenderable(),n=t._openGLRenderer.getRenderable();e.renderPiece(n,r)},e.renderPiece=(r,n)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),e.invokeEvent({type:"EndEvent"}),t.renderable.preRenderCheck()&&(t.currentImageDataInput=t.renderable.getInputData(0),t.currentCenterlineInput=t.renderable.getOrientedCenterline(),e.renderPieceStart(r,n),e.renderPieceDraw(r,n),e.renderPieceFinish(r,n))},e.renderPieceStart=(t,r)=>{e.updateBufferObjects(t,r)},e.renderPieceDraw=(r,n)=>{let i=t.context;t.volumeTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,r,n),i.drawArrays(i.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.volumeTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(r,n)=>{e.getNeedToRebuildBufferObjects(r,n)&&e.buildBufferObjects(r,n),n.getProperty().getInterpolationType()===l.V.NEAREST?(t.volumeTexture.setMinificationFilter(u.dJ.NEAREST),t.volumeTexture.setMagnificationFilter(u.dJ.NEAREST),t.colorTexture.setMinificationFilter(u.dJ.NEAREST),t.colorTexture.setMagnificationFilter(u.dJ.NEAREST),t.pwfTexture.setMinificationFilter(u.dJ.NEAREST),t.pwfTexture.setMagnificationFilter(u.dJ.NEAREST)):(t.volumeTexture.setMinificationFilter(u.dJ.LINEAR),t.volumeTexture.setMagnificationFilter(u.dJ.LINEAR),t.colorTexture.setMinificationFilter(u.dJ.LINEAR),t.colorTexture.setMagnificationFilter(u.dJ.LINEAR),t.pwfTexture.setMinificationFilter(u.dJ.LINEAR),t.pwfTexture.setMagnificationFilter(u.dJ.LINEAR))},e.getNeedToRebuildBufferObjects=(r,n)=>{let i=t.VBOBuildTime.getMTime();return i{let s=t.currentImageDataInput,l=t.currentCenterlineInput,u=n.getProperty(),c=s?.getPointData()?.getScalars();if(!c)return;let d=t._openGLRenderWindow.getGraphicsResourceForObject(c),m=(0,y.eS)(s,c),h=!d?.oglObject?.getHandle()||d?.hash!==m,f=u.getUpdatedExtents(),g=!!f.length;if(h){t.volumeTexture=p.Ay.newInstance(),t.volumeTexture.setOpenGLRenderWindow(t._openGLRenderWindow);let r=s.getDimensions();t.volumeTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.volumeTexture.resetFormatAndType(),t.volumeTexture.create3DFilterableFromDataArray({width:r[0],height:r[1],depth:r[2],dataArray:c,preferSizeOverAccuracy:t.renderable.getPreferSizeOverAccuracy()}),t._openGLRenderWindow.setGraphicsResourceForObject(c,t.volumeTexture,m),c!==t._scalars&&(t._openGLRenderWindow.registerGraphicsResourceUser(c,e),t._openGLRenderWindow.unregisterGraphicsResourceUser(t._scalars,e)),t._scalars=c}else t.volumeTexture=d.oglObject;if(g){u.setUpdatedExtents([]);let e=s.getDimensions();t.volumeTexture.create3DFilterableFromDataArray({width:e[0],height:e[1],depth:e[2],dataArray:c,updatedExtents:f})}let v=c.getNumberOfComponents(),b=n.getProperty(),I=b.getIndependentComponents(),x=I?v:1,C=I?2*x:1,A=[];for(let e=0;e{let i=t.volumeTexture.getComponents(),a=n.getProperty().getIndependentComponents(),o=!!t.renderable.getCenterPoint(),s=t.renderable.getUseUniformOrientation(),l=t.renderable.isProjectionEnabled()&&t.renderable.getProjectionMode();return(0===e.getProgram()||t.lastUseCenterPoint!==o||t.lastUseUniformOrientation!==s||t.lastProjectionMode!==l||t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||t.lastTextureComponents!==i||t.lastIndependentComponents!==a)&&(t.lastUseCenterPoint=o,t.lastUseUniformOrientation=s,t.lastProjectionMode=l,t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=i,t.lastIndependentComponents=a,!0)},e.buildShaders=(t,r,n)=>{e.getShaderTemplate(t,r,n),e.replaceShaderValues(t,r,n)},e.replaceShaderValues=(r,n,i)=>{let a=r.Vertex,o=r.Fragment,s=["vec3 applyQuaternionToVec(vec4 q, vec3 v) {"," float uvx = q.y * v.z - q.z * v.y;"," float uvy = q.z * v.x - q.x * v.z;"," float uvz = q.x * v.y - q.y * v.x;"," float uuvx = q.y * uvz - q.z * uvy;"," float uuvy = q.z * uvx - q.x * uvz;"," float uuvz = q.x * uvy - q.y * uvx;"," float w2 = q.w * 2.0;"," uvx *= w2;"," uvy *= w2;"," uvz *= w2;"," uuvx *= 2.0;"," uuvy *= 2.0;"," uuvz *= 2.0;"," return vec3(v.x + uvx + uuvx, v.y + uvy + uuvy, v.z + uvz + uuvz);","}"];a=m.A.substitute(a,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,a=m.A.substitute(a,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result;let l=["attribute vec3 centerlinePosition;","attribute float quadIndex;","uniform float width;","out vec2 quadOffsetVSOutput;","out vec3 centerlinePosVSOutput;"],u=t.renderable.isProjectionEnabled(),c=t.renderable.getUseUniformOrientation();c?(l.push("out vec3 samplingDirVSOutput;","uniform vec4 centerlineOrientation;","uniform vec3 tangentDirection;",...s),u&&l.push("out vec3 projectionDirVSOutput;","uniform vec3 bitangentDirection;")):l.push("out vec4 centerlineTopOrientationVSOutput;","out vec4 centerlineBotOrientationVSOutput;","attribute vec4 centerlineTopOrientation;","attribute vec4 centerlineBotOrientation;"),a=m.A.substitute(a,"//VTK::Color::Dec",l).result;let d=["quadOffsetVSOutput = vec2(width * (mod(quadIndex, 2.0) == 0.0 ? -0.5 : 0.5), quadIndex > 1.0 ? 0.0 : 1.0);","centerlinePosVSOutput = centerlinePosition;"];c?(d.push("samplingDirVSOutput = applyQuaternionToVec(centerlineOrientation, tangentDirection);"),u&&d.push("projectionDirVSOutput = applyQuaternionToVec(centerlineOrientation, bitangentDirection);")):d.push("centerlineTopOrientationVSOutput = centerlineTopOrientation;","centerlineBotOrientationVSOutput = centerlineBotOrientation;"),a=m.A.substitute(a,"//VTK::Color::Impl",d).result;let p=t.volumeTexture.getComponents(),h=i.getProperty().getIndependentComponents(),f=["uniform mat4 MCTCMatrix; // Model coordinates to texture coordinates","in vec2 quadOffsetVSOutput;","in vec3 centerlinePosVSOutput;","uniform highp sampler3D volumeTexture;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;"];u&&f.push("uniform int projectionSlabNumberOfSamples;","uniform float projectionConstantOffset;","uniform float projectionStepLength;"),c?(f.push("in vec3 samplingDirVSOutput;"),u&&f.push("in vec3 projectionDirVSOutput;")):(f.push("uniform vec3 tangentDirection;","in vec4 centerlineTopOrientationVSOutput;","in vec4 centerlineBotOrientationVSOutput;",...s),u&&f.push("uniform vec3 bitangentDirection;"));let g=t.renderable.getCenterPoint();if(g&&f.push("uniform vec3 globalCenterPoint;"),h){for(let e=1;e 0.999 || qCosAngle < -0.999) {"," // Use LERP instead of SLERP when the two quaternions are close or opposite"," interpolatedOrientation = normalize(mix(q0, q1, quadOffsetVSOutput.y));","} else {"," float omega = acos(qCosAngle);"," interpolatedOrientation = normalize(sin((1.0 - quadOffsetVSOutput.y) * omega) * q0 + sin(quadOffsetVSOutput.y * omega) * q1);","}","vec3 samplingDirection = applyQuaternionToVec(interpolatedOrientation, tangentDirection);"),u&&v.push("vec3 projectionDirection = applyQuaternionToVec(interpolatedOrientation, bitangentDirection);")),g?v.push("float baseOffset = dot(samplingDirection, globalCenterPoint - centerlinePosVSOutput);","float horizontalOffset = quadOffsetVSOutput.x + baseOffset;"):v.push("float horizontalOffset = quadOffsetVSOutput.x;"),v.push("vec3 volumePosMC = centerlinePosVSOutput + horizontalOffset * samplingDirection;","vec3 volumePosTC = (MCTCMatrix * vec4(volumePosMC, 1.0)).xyz;","if (any(lessThan(volumePosTC, vec3(0.0))) || any(greaterThan(volumePosTC, vec3(1.0))))","{"," // set the background color and exit"," gl_FragData[0] = backgroundColor;"," return;","}"),u){let e=t.renderable.getProjectionMode();switch(e){case b.v.MIN:v.push("const vec4 initialProjectionTextureValue = vec4(1.0);");break;case b.v.MAX:case b.v.AVERAGE:default:v.push("const vec4 initialProjectionTextureValue = vec4(0.0);")}switch(v.push("vec3 projectionScaledDirection = (MCTCMatrix * vec4(projectionDirection, 0.0)).xyz;","vec3 projectionStep = projectionStepLength * projectionScaledDirection;","vec3 projectionStartPosition = volumePosTC + projectionConstantOffset * projectionScaledDirection;","vec4 tvalue = initialProjectionTextureValue;","for (int projectionSampleIdx = 0; projectionSampleIdx < projectionSlabNumberOfSamples; ++projectionSampleIdx) {"," vec3 projectionSamplePosition = projectionStartPosition + float(projectionSampleIdx) * projectionStep;"," vec4 sampledTextureValue = texture(volumeTexture, projectionSamplePosition);"),e){case b.v.MAX:v.push(" tvalue = max(tvalue, sampledTextureValue);");break;case b.v.MIN:v.push(" tvalue = min(tvalue, sampledTextureValue);");break;case b.v.AVERAGE:default:v.push(" tvalue = tvalue + sampledTextureValue;")}v.push("}"),e===b.v.AVERAGE&&v.push("tvalue = tvalue / float(projectionSlabNumberOfSamples);")}else v.push("vec4 tvalue = texture(volumeTexture, volumePosTC);");if(h){let e=["r","g","b","a"];for(let t=0;t{let a=e.Vertex,o=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(n.Ay.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6),a=m.A.substitute(a,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,a=m.A.substitute(a,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,o=m.A.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,o=m.A.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=a,e.Fragment=o},e.getShaderTemplate=(e,t,r)=>{e.Vertex=f.A,e.Fragment=g.A,e.Geometry=""},e.setMapperShaderParameters=(r,i,a)=>{let o=r.getProgram(),s=r.getCABO();s.getElementCount()&&(t.VBOBuildTime.getMTime()>r.getAttributeUpdateTime().getMTime()||r.getShaderSourceTime().getMTime()>r.getAttributeUpdateTime().getMTime())&&(o.isAttributeUsed("vertexMC")&&!r.getVAO().addAttributeArray(o,s,"vertexMC",s.getVertexOffset(),s.getStride(),t.context.FLOAT,3,t.context.FALSE)&&C("Error setting vertexMC in shader VAO."),r.getCABO().getCustomData().forEach(e=>{e&&o.isAttributeUsed(e.name)&&!r.getVAO().addAttributeArray(o,s,e.name,e.offset,s.getStride(),t.context.FLOAT,e.components,t.context.FALSE)&&C(`Error setting ${e.name} in shader VAO.`)}),r.getAttributeUpdateTime().modified());let l=t.volumeTexture.getTextureUnit();if(o.setUniformi("volumeTexture",l),o.setUniformf("width",t.renderable.getWidth()),r.getProgram().setUniform4fv("backgroundColor",t.renderable.getBackgroundColor()),o.isUniformUsed("tangentDirection")){let e=t.renderable.getTangentDirection();r.getProgram().setUniform3fArray("tangentDirection",e)}if(o.isUniformUsed("bitangentDirection")){let e=t.renderable.getBitangentDirection();r.getProgram().setUniform3fArray("bitangentDirection",e)}if(o.isUniformUsed("centerlineOrientation")){let e=t.renderable.getUniformOrientation();r.getProgram().setUniform4fv("centerlineOrientation",e)}if(o.isUniformUsed("globalCenterPoint")){let e=t.renderable.getCenterPoint();o.setUniform3fArray("globalCenterPoint",e)}if(t.renderable.isProjectionEnabled()){let e=t.renderable.getProjectionSlabThickness(),r=t.renderable.getProjectionSlabNumberOfSamples();o.setUniformi("projectionSlabNumberOfSamples",r),o.setUniformf("projectionConstantOffset",-.5*e),o.setUniformf("projectionStepLength",e/(r-1))}let u=t.currentImageDataInput,c=u.getWorldToIndex(),d=I.fromScaling(new Float32Array(16),x.DI([],u.getDimensions())),p=I.mul(d,d,c);if(o.setUniformMatrix("MCTCMatrix",p),t.haveSeenDepthRequest&&r.getProgram().setUniformi("depthRequest",+!!t.renderDepth),t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(n.Ay.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6);let r=s.getCoordShiftAndScaleEnabled()?s.getInverseShiftAndScaleMatrix():null,i=r?I.copy(t.imagematinv,a.getMatrix()):a.getMatrix();r&&(I.transpose(i,i),I.multiply(i,i,r),I.transpose(i,i)),I.transpose(t.imagemat,t.currentImageDataInput.getIndexToWorld()),I.multiply(t.imagematinv,i,t.imagemat);let l=[];for(let r=0;r{let i=t.openGLImageSlice.getKeyMatrices().mcwc,a=t.openGLCamera.getKeyMatrices(r).wcpc;if(I.multiply(t.imagemat,a,i),e.getCABO().getCoordShiftAndScaleEnabled()){let r=e.getCABO().getInverseShiftAndScaleMatrix();I.multiply(t.imagemat,t.imagemat,r)}e.getProgram().setUniformMatrix("MCPCMatrix",t.imagemat)},e.setPropertyShaderParameters=(e,r,n)=>{let i=e.getProgram(),a=n.getProperty(),o=a.getOpacity();i.setUniformf("opacity",o);let s=t.volumeTexture.getComponents(),l=a.getIndependentComponents();if(l)for(let e=0;e{if(e.getNeedToRebuildShaders(r,n,i)){let a={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(a,n,i);let o=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);o!==r.getProgram()&&(r.setProgram(o),r.getVAO().releaseGraphicsResources()),r.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(r.getProgram());r.getVAO().bind(),e.setMapperShaderParameters(r,n,i),e.setCameraShaderParameters(r,n,i),e.setPropertyShaderParameters(r,n,i)},e.delete=n.Ay.chain(()=>{t._openGLRenderWindow&&d(t._openGLRenderWindow)},e.delete)}var S=n.Ay.newInstance(T,"vtkOpenGLImageCPRMapper"),w={newInstance:S,extend:T};(0,d.c9)("vtkImageCPRMapper",S)},8605:(e,t,r)=>{"use strict";r.d(t,{M:()=>a,u:()=>i});let n=[{name:"touch-action",attribute:"data-prior-touch-action"},{name:"user-select",attribute:"data-prior-user-select"},{name:"-webkit-user-select",attribute:"data-prior-webkit-user-select"},{name:"-webkit-touch-callout",attribute:"data-prior-webkit-touch-callout"}];function i(e){n.forEach(({name:t,attribute:r})=>{e.hasAttribute(r)||e.setAttribute(r,e.style.getPropertyValue(t)),e.style.setProperty(t,"none")})}function a(e){n.forEach(({name:t,attribute:r})=>{if(!e.hasAttribute(r))return;let n=e.getAttribute(r);n?e.style.setProperty(t,n):e.style.removeProperty(t),e.removeAttribute(r)})}},8735:(e,t,r)=>{"use strict";r.d(t,{e:()=>eD,I:()=>eR});var n=r(10115),i=r(7286),a=r(50923);function o(e,t){var r,n;let i=(r=e.reference,n=e.volumeId||t.referencedIdFallback,r?"segmentation"===r.kind?{reference:r,referencedId:r.labelmapId??r.representationUID??r.segmentationId,...r.representationUID?{representationUID:r.representationUID}:{}}:{reference:r,referencedId:function(e){switch(e.kind){case"data":return e.dataId;case"image":return e.imageId;case"volume":return e.volumeId;case"geometry":return e.geometryId;case"segmentation":return e.labelmapId??e.representationUID??e.segmentationId}}(r)}:n?{referencedId:n}:{}),a=t.actor,o=t.mapper??("function"==typeof a.getMapper?a.getMapper():void 0);return{uid:t.uid,actor:a,actorMapper:{actor:a,mapper:o,renderMode:t.renderMode},...i}}var s=r(63247),l=r(57752),u=r(9871),c=r(7494),d=r(1953),p=r(46947),m=r(46732),h=r(19157),f=r(58373),g=r(77280),v=r(97938),y=r(39216),b=r(1705),I=r(35972),x=r(69228),C=r(3793),A=r(65110),T=r(9638);function S(e){return{tlhc:{x:1,y:1},brhc:{x:Math.max(e.columns,1),y:Math.max(e.rows,1)},rowPixelSpacing:e.rowPixelSpacing??1,columnPixelSpacing:e.columnPixelSpacing??1,presentationSizeMode:"NONE"}}function w(e,t={}){(0,x.A)(e.viewport.element,g.sV.STACK_NEW_IMAGE,{image:t.image,imageId:t.imageId??t.image?.imageId,imageIdIndex:t.imageIdIndex,viewportId:e.viewportId,renderingEngineId:e.renderingEngineId})}function O(e,t){let r=t.camera?.orientation;(!r||r===g.KY.ACQUISITION||void 0!==t.acquisitionOrientation&&r===t.acquisitionOrientation)&&"number"==typeof t.imageIdIndex&&t.imageIds[t.imageIdIndex]?w(e,{imageId:t.imageIds[t.imageIdIndex],imageIdIndex:t.imageIdIndex}):w(e),"number"==typeof t.imageIdIndex&&(0,x.A)(e.viewport.element,g.sV.VOLUME_NEW_IMAGE,{imageIndex:t.imageIdIndex,numberOfSlices:t.maxImageIdIndex+1,viewportId:e.viewportId,renderingEngineId:e.renderingEngineId})}var P=r(6285);class _{async addData(e,t,r){let n;if(!t.image)throw Error("[PlanarViewport] CPU rendering requires an image");e.display.activateRenderMode(b.T.CPU_IMAGE),N(t.image);let i=new s.A({getImageData:()=>this.getImageData(n)},t.image);i.setVisibility(!0);let a=(0,d.A)(e.cpu.canvas,t.image,V(t.image));a.displayedArea=S(t.image);let u={canvas:e.cpu.canvas,image:t.image,renderingTools:{},viewport:a};return(0,m.A)(u,!0),u.transform=(0,l.A)(u),n={renderMode:b.T.CPU_IMAGE,actorEntryUID:(0,C.A)(),enabledElement:u,compatibilityActor:i,currentImageIdIndex:t.initialImageIdIndex??0,defaultVOIRange:(0,p.c4)(t.image),dataPresentation:void 0,fitScale:R(u.viewport.scale),loadRequestId:0,renderingInvalidated:!0},w(e,{image:t.image,imageIdIndex:t.initialImageIdIndex??0}),{rendering:n,updateDataPresentation:e=>{this.updateDataPresentation(n,e)},applyViewState:r=>{this.applyViewState(e,n,t.id,r,t.imageIds)},getFrameOfReferenceUID:()=>this.getFrameOfReferenceUID(n),getActorEntry:e=>o(e,{actor:n.compatibilityActor,mapper:n.compatibilityActor.getMapper(),renderMode:b.T.CPU_IMAGE,uid:n.actorEntryUID,referencedIdFallback:n.enabledElement.image?.imageId}),getImageData:()=>this.getImageData(n),render:()=>{this.render(e,n,t.id)},resize:()=>{this.resize(e,n,t.id)},removeData:()=>{this.removeData(e,n)}}}updateDataPresentation(e,t){e.dataPresentation=t,D(e,e.dataPresentation)}applyViewState(e,t,r,n,i){let a=t.enabledElement.image;e.display.activateRenderMode(b.T.CPU_IMAGE);let o=a?(0,P.NU)({ctx:e,dataId:r,imageIds:i,rendering:t,viewState:n}):void 0,s=(0,P.VU)({projection:o,rendering:t,viewState:n});if(o&&M(t,o.presentation,o.resolvedICamera),s===(t.lastRequestedImageIdIndex??t.currentImageIdIndex)||s<0||s>=i.length)return;t.lastRequestedImageIdIndex=s;let l=++t.loadRequestId;(0,v.loadAndCacheImage)(i[s]).then(n=>{l===t.loadRequestId&&B({ctx:e,dataId:r,image:n,imageIdIndex:s,props:t.dataPresentation,rendering:t})})}canvasToWorld(e,t,r){return(0,P.Yo)({canvas:e.cpu.canvas,canvasPos:r,ctx:e})}worldToCanvas(e,t,r){return(0,P.sh)({canvas:e.cpu.canvas,ctx:e,worldPos:r})}getFrameOfReferenceUID(e){let t=e.enabledElement.image?.imageId,r=t?y.get(g.nb.IMAGE_PLANE,t):void 0;return r?.frameOfReferenceUID}getImageData(e){let t=e.enabledElement.image;if(t)return L(t,this.getFrameOfReferenceUID(e))}render(e,t,r){e.viewport.isCurrentDataId(r)&&(function(e){let{enabledElement:t,renderingInvalidated:r}=e;t.image&&((0,h.A)(t,r),e.renderingInvalidated=!1)}(t),function(e){for(let t of e.viewport.getOverlayActors())t.actorMapper?.renderMode===b.T.CPU_IMAGE&&t.actor.render(void 0,e.cpu.context)}(e),e.display.markRendered(),(0,x.A)(e.viewport.element,g.sV.IMAGE_RENDERED,{element:e.viewport.element,viewportId:e.viewportId,renderingEngineId:e.renderingEngineId,viewportStatus:g.Dt.RENDERED}))}resize(e,t,r){(0,m.A)(t.enabledElement,!0);let n=t.enabledElement.image,i=e.viewport.getViewState();if(!n)return;let a=(0,P.NU)({ctx:e,dataId:r,rendering:t,viewState:i});t.fitScale=R((0,d.A)(t.enabledElement.canvas,n,V(n)).scale),t.renderingInvalidated=!0,a&&M(t,a.presentation,a.resolvedICamera)}removeData(e,t){let{enabledElement:r}=t;e.cpu.context.setTransform(1,0,0,1,0,0),e.cpu.context.clearRect(0,0,e.cpu.canvas.width,e.cpu.canvas.height),r.image=void 0}}class E{constructor(){this.id="planar:cpu-image-slice",this.type=g.NV.PLANAR_NEXT}matches(e,t){return"image"===e.type&&t.renderMode===b.T.CPU_IMAGE}createRenderPath(){return new _}selectContext(e){return{viewportId:e.viewportId,renderingEngineId:e.renderingEngineId,type:e.type,viewport:e.viewport,renderPath:e.renderPath,view:e.view,display:e.display,cpu:e.cpu}}}function D(e,t){let{enabledElement:r,defaultVOIRange:n}=e,{viewport:i}=r,a=r.canvas,o=t?.voiRange??n;if(a.style.display=t?.visible===!1?"none":"",a.style.opacity=String(t?.opacity??1),i.colormap=(0,f.Qu)(t?.colormap,r.image?.colormap),i.invert=t?.invert??!1,o){let{windowCenter:e,windowWidth:t}=(0,A.toWindowLevel)(o.lower,o.upper);i.voi={windowCenter:e,windowWidth:t,voiLUTFunction:r.image?.voiLUTFunction}}e.renderingInvalidated=!0,t?.interpolationType!==void 0&&(i.pixelReplication=t.interpolationType!==g.VO.LINEAR)}function R(e){return Array.isArray(e)?e[1]:e??1}function M(e,t,r){let{enabledElement:n,fitScale:i}=e,o=n.viewport,s=t?.pan??[0,0],d=Math.max(t?.zoom??1,.001);o.hflip=t?.flipHorizontal??!1,o.vflip=t?.flipVertical??!1,o.rotation=t?.rotation??0,o.scale="number"==typeof r?.parallelScale?function(e){let{canvas:t,columnPixelSpacing:r,parallelScale:n,presentationScale:i,rowPixelSpacing:a}=e,o=Math.max((n??1)*2,1e-6),s=t.height/o,l=(0,T.OB)(i);if(Math.abs(l-1)>1e-6){let e=Math.max(t.height,1),n=Math.max(t.width,1);return[Math.max(n*(r||1)/Math.max(n/e*o*(1/l),1e-6),1e-6),Math.max(e*(a||1)/o,1e-6)]}return Math.max(Math.min(a||1,r||1)*s,1e-6)}({canvas:n.canvas,parallelScale:r.parallelScale,presentationScale:r.presentationScale,columnPixelSpacing:n.image?.columnPixelSpacing||1,rowPixelSpacing:n.image?.rowPixelSpacing||1}):[i*(t?.scale?.[0]??d),i*d],o.parallelScale=r?.parallelScale,o.translation=r?.focalPoint?function(e,t){let{image:r,viewport:n}=e,i=n.translation||{x:0,y:0};if(!r)return i;n.translation={x:0,y:0},e.transform=(0,l.A)(e);let o=(0,u.A)(e,[e.canvas.width/2,e.canvas.height/2]),s=function(e,t){let{image:r,viewport:n}=e;if(!r)return[0,0];let{spacing:i,direction:o,origin:s}=(0,I.T)(r),l=o.slice(0,3),u=o.slice(3,6),c=n.displayedArea,d=(c?.tlhc.x??1)-1,p=(c?.tlhc.y??1)-1,m=a.Re(a.vt(),t,s);return[a.Om(m,l)/i[0]+.5-d,a.Om(m,u)/i[1]+.5-p]}(e,t),d=(0,c.A)({x:s[0]-o[0],y:s[1]-o[1]},n);return n.translation=i,{x:-d.x,y:-d.y}}(n,r.focalPoint):function(e,t){let{viewport:r}=e,n=r.translation||{x:0,y:0};r.translation={x:0,y:0};let i=(0,l.A)(e).transformPoint([0,0]);r.translation={x:1,y:0};let a=(0,l.A)(e).transformPoint([0,0]);r.translation={x:0,y:1};let o=(0,l.A)(e).transformPoint([0,0]);r.translation=n;let s=[a[0]-i[0],a[1]-i[1]],u=[o[0]-i[0],o[1]-i[1]],c=s[0]*u[1]-s[1]*u[0];return 1e-6>Math.abs(c)?{x:0,y:0}:{x:(t[0]*u[1]-t[1]*u[0])/c,y:(s[0]*t[1]-s[1]*t[0])/c}}(n,s),n.transform=(0,l.A)(n)}function N(e){e.isPreScaled=e.preScale?.scaled}function V(e){return e.preScale?.scalingParameters?.modality||y.get(g.nb.GENERAL_SERIES,e.imageId)?.modality}function L(e,t){let r=(0,I.T)(e),{dimensions:n,direction:i,modality:o,origin:s,spacing:l}=r,u=y.get("calibratedPixelSpacing",e.imageId),c=u?{...r.calibration,...u}:r.calibration,d=i.slice(0,3),p=i.slice(3,6),m=e.voxelManager?.getScalarData()||e.getPixelData?.();return{dimensions:n,spacing:l,origin:s,direction:i,metadata:{Modality:o,FrameOfReferenceUID:t},imageData:{getDirection:()=>i,getDimensions:()=>n,getScalarData:()=>m,getSpacing:()=>l,worldToIndex:e=>{let t=a.Re(a.vt(),e,s);return[a.Om(t,d)/l[0],a.Om(t,p)/l[1],0]},indexToWorld:e=>{let t=[...s];return a.Ln(t,t,d,e[0]*l[0]),a.Ln(t,t,p,e[1]*l[1]),t}},scalarData:m,scaling:e.scaling,hasPixelSpacing:!!(e.rowPixelSpacing||e.columnPixelSpacing),calibration:c,preScale:e.preScale,voxelManager:e.voxelManager}}async function B(e){let{ctx:t,dataId:r,image:n,imageIdIndex:i,props:a,rendering:o}=e,s=o.enabledElement;N(n);let l=t.viewport.getViewState(),u=(0,d.A)(t.cpu.canvas,n,V(n)),c=s.viewport;u.displayedArea=S(n),s.image=n,s.viewport={...u,hflip:c?.hflip??u.hflip,invert:u.invert,pixelReplication:c?.pixelReplication??u.pixelReplication,rotation:c?.rotation??u.rotation,translation:c?.translation??u.translation,vflip:c?.vflip??u.vflip},o.currentImageIdIndex=i,o.defaultVOIRange=(0,p.c4)(n),o.fitScale=R(u.scale),o.renderingInvalidated=!0,t.viewport.invalidateResolvedView(),o.compatibilityActor.getMapper().getInputData().setDerivedImage(n),D(o,a);let m=(0,P.NU)({ctx:t,dataId:r,rendering:o,viewState:l});m&&M(o,m.presentation,m.resolvedICamera),w(t,{image:n,imageIdIndex:i}),t.display.renderNow()}var F=r(3922),U=r(72661),k=r(37128),G=r(10807),W=r(42215),z=r(79267),H=r(36039),j=r(74798);function $(e,t,r=.995){let n=e.direction.slice(0,3),i=e.direction.slice(3,6),o=e.direction.slice(6,9),s=[a.Om(t,n),a.Om(t,i),a.Om(t,o)],l=s.map(e=>Math.abs(e)),u=Math.max(...l),c=l.indexOf(u);if(!(ut!==c).some(e=>e>1-r))return{axis:c,sign:s[c]>=0?1:-1}}function K(e,t){if(!(t<-.5001)&&!(t>e-.5+1e-4))return Math.min(e-1,Math.max(0,t))}function q(e){return Math.floor(e+.5-1e-6)}function X(e,t,r=1e-6){for(let n=0;n<3;n++)if(n!==t&&Math.abs(e[n])>r)return!1;return!0}function Y(e){return Math.round(1e6*e)}class Z{constructor(){this.completeScalarDataCache=new WeakMap,this.axisAlignedGeometryCache=new WeakMap}clearCachedVoxelManager(e){this.completeScalarDataCache.delete(e),this.axisAlignedGeometryCache.delete(e)}getCompleteScalarDataArray(e){let t=this.completeScalarDataCache.get(e);if(t)return t;let r=e.getCompleteScalarDataArray?.();if(r)return r.length&&this.completeScalarDataCache.set(e,r),r}sampleAxisAligned(e){let{volume:t,voxelManager:r,pixelData:n,width:i,height:a,rowStartIndex:o,xStepIndexDelta:s,yStepIndexDelta:l,right:u,up:c,normal:d,interpolationType:p,numberOfComponents:m,fallbackMin:h,fallbackMax:f}=e;if(1!==m||!r.getCompleteScalarDataArray)return;let g=$(t,d),v=$(t,u),y=$(t,c);if(!g||!v||!y||g.axis===v.axis||g.axis===y.axis||v.axis===y.axis)return;let b=this.getCompleteScalarDataArray(r);if(!b?.length)return;let I=n instanceof Float32Array||n instanceof Float64Array,x=this.trySampleFixedAxisAligned({volume:t,voxelManager:r,scalarData:b,pixelData:n,width:i,height:a,rowStartIndex:o,xStepIndexDelta:s,yStepIndexDelta:l,rightAxis:v,upAxis:y,normalAxis:g,interpolationType:p,fallbackMin:h,fallbackMax:f,preserveFloatScalarSamples:I});return x||this.sampleGeneralAxisAligned({scalarData:b,pixelData:n,dimensions:t.dimensions,width:i,height:a,rowStartIndex:o,xStepIndexDelta:s,yStepIndexDelta:l,interpolationType:p,fallbackMin:h,fallbackMax:f,preserveFloatScalarSamples:I})}sampleGeneralAxisAligned(e){let{scalarData:t,pixelData:r,dimensions:n,width:i,height:a,rowStartIndex:o,xStepIndexDelta:s,yStepIndexDelta:l,interpolationType:u,fallbackMin:c,fallbackMax:d,preserveFloatScalarSamples:p}=e,m=1/0,h=-1/0,f=0,g=o[0],v=o[1],y=o[2];for(let e=0;e8){let e=m.keys().next().value;m.delete(e)}return f}createAxisInterpolationPlan(e,t,r,n,i){let a=new Int32Array(n),o=new Int32Array(n),s=new Float64Array(n),l=new Uint8Array(n),u=t;for(let t=0;tr&&(i=r),n?Math.round(i):i}function ee(e,t){te.max&&(e.max=t)}function et(e,t){return a.Re([0,0,0],e,t)}function er(e,t,r=1e-4){return a.Io(e,t)<=r}function en(e,t){let r=e.direction.slice(0,3),n=e.direction.slice(3,6),i=e.direction.slice(6,9);return[J(t,r)/e.spacing[0],J(t,n)/e.spacing[1],J(t,i)/e.spacing[2]]}class ei{constructor(){this.sampleSequence=0,this.scalarViewportSampler=new Z,this.scalarRangeCache=new WeakMap,this.sliceArrayPool=new Map}clearCachedScalarRange(e){this.scalarRangeCache.delete(e),this.scalarViewportSampler.clearCachedVoxelManager(e)}releaseSampledSliceState(e){let t=e?.image.getPixelData?.();!t||!ArrayBuffer.isView(t)||t instanceof DataView||this.releaseSliceArray(t)}clearSliceArrayPool(){this.sliceArrayPool.clear()}getScalarDataRange(e){let t;t=this.scalarViewportSampler.getCompleteScalarDataArray(e)??e.getScalarData();let r=1/0,n=-1/0;for(let e=0;en&&(n=i))}return{min:r,max:n}}getCameraBasis(e){let t=a.S8(a.vt(),e.viewPlaneNormal),r=a.S8(a.vt(),e.viewUp),n=a.$A(a.vt(),r,t);a.Bw(n)e.lower?e:r>t?{lower:t,upper:r}:{lower:t,upper:t+1}}getFallbackStoredRange(e){let t=e.voxelManager,[r,n]=t.getRange(),i=Number.isFinite(r)?Math.floor(r):0,a=Number.isFinite(n)?Math.ceil(n):i+1;if(a<=i){let e=this.scalarRangeCache.get(t);if(e)return e;let r=this.getScalarDataRange(t);Number.isFinite(r.min)&&(i=Math.floor(r.min)),Number.isFinite(r.max)&&(a=Math.ceil(r.max))}a<=i&&(a=i+1);let o={min:i,max:a};return this.scalarRangeCache.set(t,o),o}createOrUpdateEnabledElement(e){let{enabledElement:t,canvas:r,image:n,modality:i}=e;return t?(t.canvas=r,t.image=n,t.options||={},t.options.transparentBackground=!0,t.viewport=(0,d.A)(r,n,i),t):{canvas:r,image:n,options:{transparentBackground:!0},renderingTools:{},viewport:(0,d.A)(r,n,i)}}updateCPUFallbackViewport(e){let{enabledElement:t,sampledSliceState:r,camera:n,dataPresentation:i,defaultVOIRange:a}=e,o=r.image.rowPixelSpacing||1,s=r.image.columnPixelSpacing||1,l=et(n.focalPoint,r.translationReferenceFocalPoint),u=t.viewport,c=this.getResolvedVOIRange(i?.voiRange??a,r.image.minPixelValue??0,r.image.maxPixelValue??1);u.translation={x:-J(l,r.right)/s,y:J(l,r.up)/o},u.scale=function(e){let{camera:t,canvas:r,columnPixelSpacing:n,rowPixelSpacing:i}=e,a=Math.max((t.parallelScale??1)*2,z.p8),o=r.height/a,s=(0,T.OB)(t.presentationScale);if(Math.abs(s-1)>z.p8){let e=Math.max(r.height,1),t=Math.max(r.width,1);return[Math.max(t*(n||1)/Math.max(t/e*a*(1/s),z.p8),z.p8),Math.max(e*(i||1)/a,z.p8)]}return Math.max(Math.min(i||1,n||1)*o,z.p8)}({canvas:t.canvas,camera:n,columnPixelSpacing:s,rowPixelSpacing:o}),u.parallelScale=n.parallelScale,u.colormap=(0,f.Qu)(i?.colormap,r.image.colormap,{voiRange:c}),u.invert=i?.invert??!1,u.pixelReplication=i?.interpolationType===g.VO.NEAREST,u.voi={windowCenter:(c.lower+c.upper)/2,windowWidth:Math.max(c.upper-c.lower,1),voiLUTFunction:g.yX.LINEAR}}needsResample(e){return"reuse"!==this.getResampleDecision(e)}getResampleDecision(e){let{sampledSliceState:t,width:r,height:n,camera:i,dataPresentation:a,deferViewportResample:o=!1}=e;if(!t)return"resample";let{right:s,up:l,normal:u}=this.getCameraBasis(i),c=i.focalPoint,d=a?.interpolationType??g.VO.LINEAR,p=et(c,t.focalPoint),m=Math.abs(J(p,t.normal)),h=t.image.columnPixelSpacing||1,f=t.image.rowPixelSpacing||1,v=Math.abs(J(p,t.right))/h,y=Math.abs(J(p,t.up))/f,b=t.samplingMode??"viewport",I=Math.max(i.parallelScale??1,z.p8),x=(0,T.OB)(i.presentationScale),C=!er(t.right,s)||!er(t.up,l)||!er(t.normal,u),A=m>.5*t.spacingInNormalDirection;return t.canvasWidth!==r||t.canvasHeight!==n||t.interpolationType!==d||C||A?"resample":"source-slice"!==b&&(Math.abs(t.parallelScale-I)>1e-4*I||Math.abs(t.scaleRatio-x)>1e-4||v>.001||y>.001||v>.35*t.image.width||y>.35*t.image.height)?o?"defer":"resample":"reuse"}sampleSliceImage(e){let{volume:t,width:r,height:n,camera:i,dataPresentation:o,useViewportSamplingForLinear:s=!0}=e,{right:l,up:u,normal:c}=this.getCameraBasis(i),d=this.getVolumeNumberOfComponents(t),p=1===d&&this.shouldPreserveFloatScalarSamples(t),m=o?.interpolationType??g.VO.LINEAR,h=m!==g.VO.NEAREST&&s?void 0:this.trySampleOrthogonalSliceFromVoxelManager(t,i,l,u,c,m),f=this.getFallbackStoredRange(t),v=this.getResolvedVOIRange(o?.voiRange,f.min,f.max);if(h)return{image:this.createSliceImage(t,h.scalarData,h.width,h.height,h.columnPixelSpacing,h.rowPixelSpacing,h.minPixelValue,h.maxPixelValue,h.numberOfComponents,v),samplingMode:"source-slice",focalPoint:a.o8(i.focalPoint),translationReferenceFocalPoint:a.o8(h.translationReferenceFocalPoint),right:a.o8(l),up:a.o8(u),normal:a.o8(c),spacingInNormalDirection:Math.max((0,j.A)(t,c),z.p8),canvasWidth:r,canvasHeight:n,parallelScale:Math.max(i.parallelScale??1,z.p8),scaleRatio:(0,T.OB)(i.presentationScale),interpolationType:m};let y=t.voxelManager;if(!y)throw Error("[PlanarViewport] CPU volume rendering requires voxels");let b=Math.max(i.parallelScale??1,z.p8),I=2*b,x=r/Math.max(n,1)*I*(1/(0,T.OB)(i.presentationScale)),C=x/Math.max(r,1),A=I/Math.max(n,1),S=-x/2+C/2,w=I/2-A/2,O=H.A.worldToIndexContinuous(t,i.focalPoint),P=en(t,[l[0]*S+u[0]*w,l[1]*S+u[1]*w,l[2]*S+u[2]*w]),_=en(t,[l[0]*C,l[1]*C,l[2]*C]),E=en(t,[-u[0]*A,-u[1]*A,-u[2]*A]),D=this.getSliceArrayConstructor(t,f.min,f.max,d,p),R=this.acquireSliceArray(D,r*n*d),M=[O[0]+P[0],O[1]+P[1],O[2]+P[2]],N={min:1/0,max:-1/0},V=this.scalarViewportSampler.sampleAxisAligned({volume:t,voxelManager:y,pixelData:R,width:r,height:n,rowStartIndex:M,xStepIndexDelta:_,yStepIndexDelta:E,right:l,up:u,normal:c,interpolationType:m,numberOfComponents:d,fallbackMin:f.min,fallbackMax:f.max});if(V)N.min=V.min,N.max=V.max;else{let e=[...M];for(let i=0;iN.min?p?N.max:Math.ceil(N.max):Math.max(L+1,f.max);return{image:this.createSliceImage(t,R,r,n,x/Math.max(r,1),I/Math.max(n,1),L,B,d,v),samplingMode:"viewport",focalPoint:a.o8(i.focalPoint),translationReferenceFocalPoint:a.o8(i.focalPoint),right:a.o8(l),up:a.o8(u),normal:a.o8(c),spacingInNormalDirection:Math.max((0,j.A)(t,c),z.p8),canvasWidth:r,canvasHeight:n,parallelScale:b,scaleRatio:(0,T.OB)(i.presentationScale),interpolationType:m}}trySampleOrthogonalSliceFromVoxelManager(e,t,r,n,i,o){let s=e.voxelManager;if(!s)return;let l=$(e,i),u=$(e,r),c=$(e,n);if(!l||!u||!c||l.axis===u.axis||l.axis===c.axis||u.axis===c.axis)return;let d=c.axis,p=-c.sign,m=u.sign,h=this.getVolumeNumberOfComponents(e),f=H.A.worldToIndexContinuous(e,t.focalPoint)[l.axis],v=Math.round(f),y=e.dimensions[l.axis]-.5;if(f<-.5001||f>y+1e-4||o!==g.VO.NEAREST&&Math.abs(f-v)>1e-4)return;let b=o===g.VO.NEAREST?Math.min(e.dimensions[l.axis]-1,Math.max(0,q(f))):v;if(b<0||b>=e.dimensions[l.axis])return;let I=[(e.dimensions[0]-1)/2,(e.dimensions[1]-1)/2,(e.dimensions[2]-1)/2],x=1===h&&this.shouldPreserveFloatScalarSamples(e);I[l.axis]=b;let C=function(e,t){let[r,n,i]=t,[o,s,l]=e.spacing,u=e.direction.slice(0,3),c=e.direction.slice(3,6),d=e.direction.slice(6,9),p=a.C([0,0,0],e.origin);return a.Ln(p,p,u,o*r),a.Ln(p,p,c,s*n),a.Ln(p,p,d,l*i),p}(e,I),A=e.dimensions[u.axis],T=e.dimensions[d],S=this.getFallbackStoredRange(e),w=this.getSliceArrayConstructor(e,S.min,S.max,h,x),O=this.acquireSliceArray(w,A*T*h),P={min:1/0,max:-1/0},_=[0,0,0];_[l.axis]=b;for(let e=0;e0?e:T-1-e;for(let t=0;t0?t:A-1-t,this.writeVoxelValue(O,e*A+t,s.getAtIJK(_[0],_[1],_[2]),h,S.min,S.max,P)}return Number.isFinite(P.min)||(P.min=S.min),(!Number.isFinite(P.max)||P.max<=P.min)&&(P.max=Math.max(P.min+1,S.max)),{scalarData:O,width:A,height:T,columnPixelSpacing:e.spacing[u.axis],rowPixelSpacing:e.spacing[d],minPixelValue:x?P.min:Math.floor(P.min),maxPixelValue:x?P.max:Math.ceil(P.max),numberOfComponents:h,translationReferenceFocalPoint:C}}sampleVoxelAtContinuousIndex(e,t,r,n,i){let a=function(e,t){let r=[0,0,0];for(let n=0;n<3;n++){let i=K(e[n],t[n]);if(void 0===i)return;r[n]=i}return r}(t,r);return a?n<2?H.A.sampleAtContinuousIndex(e,t,a,i):i===g.VO.NEAREST?this.sampleNearestColorAtContinuousIndex(e,t,a,n):this.sampleLinearColorAtContinuousIndex(e,t,a,n):n<2?NaN:this.createDefaultColorSample(n)}sampleNearestColorAtContinuousIndex(e,t,r,n){let i=Math.floor(r[0]+.5-1e-6),a=Math.floor(r[1]+.5-1e-6),o=Math.floor(r[2]+.5-1e-6);return i<0||i>=t[0]||a<0||a>=t[1]||o<0||o>=t[2]?this.createDefaultColorSample(n):this.toColorSample(e.getAtIJK(i,a,o),n)}sampleLinearColorAtContinuousIndex(e,t,r,n){let[i,a,o]=r;if(i<0||i>t[0]-1||a<0||a>t[1]-1||o<0||o>t[2]-1)return this.createDefaultColorSample(n);let s=Math.floor(i),l=Math.floor(a),u=Math.floor(o),c=Math.min(s+1,t[0]-1),d=Math.min(l+1,t[1]-1),p=Math.min(u+1,t[2]-1),m=i-s,h=a-l,f=o-u,g=1-m,v=1-h,y=1-f,b=this.toColorSample(e.getAtIJK(s,l,u),n),I=this.toColorSample(e.getAtIJK(c,l,u),n),x=this.toColorSample(e.getAtIJK(s,d,u),n),C=this.toColorSample(e.getAtIJK(c,d,u),n),A=this.toColorSample(e.getAtIJK(s,l,p),n),T=this.toColorSample(e.getAtIJK(c,l,p),n),S=this.toColorSample(e.getAtIJK(s,d,p),n),w=this.toColorSample(e.getAtIJK(c,d,p),n),O=this.createDefaultColorSample(n);for(let e=0;eNumber(e[r]??0));let r=Number(e)||0;return Array.from({length:t},()=>r)}createDefaultColorSample(e){return Array.from({length:e},()=>0)}writeVoxelValue(e,t,r,n,i,a,o){if(n<2){let n=Q(Number(r),i,a,!(e instanceof Float32Array||e instanceof Float64Array));e[t]=n,ee(o,n);return}let s=this.toColorSample(r,n),l=t*n;for(let t=0;t1?e.voxelManager?.getConstructor()||Uint8Array:i?Float32Array:t>=0&&r<=65535?Uint16Array:t>=-32768&&r<=32767?Int16Array:Int32Array}acquireSliceArray(e,t){let r=this.getSliceArrayPoolKey(e,t),n=this.sliceArrayPool.get(r),i=n?.pop();return i||new e(t)}releaseSliceArray(e){let t=e.constructor,r=this.getSliceArrayPoolKey(t,e.length),n=this.sliceArrayPool.get(r);n||(n=[],this.sliceArrayPool.set(r,n)),n.length<1&&n.push(e)}getSliceArrayPoolKey(e,t){let r=e.name||"SliceArray";return`${r}:${t}`}createSliceImage(e,t,r,n,i,a,o,s,l,u){let c=u&&u.upper>u.lower?u:{lower:o,upper:s},d=Math.max(1,c.upper-c.lower),p=(c.lower+c.upper)/2,m=`cpuVolumeSlice:${e.volumeId}:${++this.sampleSequence}`,h=H.A.createImageVoxelManager({width:r,height:n,scalarData:t,numberOfComponents:l,id:m});return{imageId:m,intercept:0,windowCenter:p,windowWidth:d,voiLUTFunction:g.yX.LINEAR,isPreScaled:e.isPreScaled,scaling:e.scaling,color:l>1,numberOfComponents:l,dataType:t.constructor.name,slope:1,minPixelValue:o,maxPixelValue:s,rows:n,columns:r,getCanvas:void 0,height:n,width:r,rgba:4===l,columnPixelSpacing:i,rowPixelSpacing:a,FrameOfReferenceUID:e.metadata?.FrameOfReferenceUID,invert:!1,photometricInterpretation:l>1?"RGB":void 0,getPixelData:()=>t,voxelManager:h,sizeInBytes:t.byteLength}}shouldPreserveFloatScalarSamples(e){return e.metadata?.Modality==="PT"}}class ea{constructor(){this.sampler=new ei}async addData(e,t,r){let n;if(!t.imageVolume)throw Error("[PlanarViewport] CPU volume rendering requires a prepared image volume");let i=await (0,G.l)(t.imageVolume),a=new s.A({getImageData:()=>this.getImageData(n)},t.imageVolume.imageIds?.length?{imageId:t.imageVolume.imageIds[0]}:{});return a.setVisibility(!0),e.display.activateRenderMode(b.T.CPU_VOLUME),n={renderMode:b.T.CPU_VOLUME,actorEntryUID:(0,C.A)(),compatibilityActor:a,imageVolume:t.imageVolume,imageIds:t.imageIds,acquisitionOrientation:t.acquisitionOrientation,layerCanvas:(0,U.Nw)(null,e.cpu.canvas.width,e.cpu.canvas.height),currentImageIdIndex:t.initialImageIdIndex??0,maxImageIdIndex:t.imageIds.length-1,defaultVOIRange:i,renderingInvalidated:!0,compositeActor:t.reference?.kind==="segmentation",removeStreamingSubscriptions:(()=>{let r,i,a=!0,o=-1/0,s=function(){let e=(0,W.D0)().rendering?.planar?.cpuVolume?.volumeModifiedThrottleMs;return Number.isFinite(e)?Math.max(0,Math.trunc(e)):0}(),l=()=>{a&&(o=performance.now(),e.display.renderNow())},u=function(e,t){let r=r=>{let n=r.detail;n?.volumeId===e&&t(r.type)};return F.A.addEventListener(g.sV.IMAGE_VOLUME_MODIFIED,r),F.A.addEventListener(g.sV.IMAGE_VOLUME_LOADING_COMPLETED,r),()=>{F.A.removeEventListener(g.sV.IMAGE_VOLUME_MODIFIED,r),F.A.removeEventListener(g.sV.IMAGE_VOLUME_LOADING_COMPLETED,r)}}(t.volumeId,u=>{if(!a)return;let c=u===g.sV.IMAGE_VOLUME_LOADING_COMPLETED,d=t.imageVolume.voxelManager;d?.invalidateCache?.(),d&&this.sampler.clearCachedScalarRange(d),eo(n),n.pendingVolumeLoadCallback=!1,this.releaseSampledSliceState(n),n.renderingInvalidated=!0,u===g.sV.IMAGE_VOLUME_MODIFIED?(()=>{if(s<=0)return l();if(void 0!==i)return;let e=Math.max(0,s-(performance.now()-o));if(0===e)return l();i=window.setTimeout(()=>{i=void 0,l()},e)})():(void 0!==i&&(window.clearTimeout(i),i=void 0),e.display.renderNow()),a&&c&&(e.display.setNeedsRender(),r=window.requestAnimationFrame(()=>{r=void 0,a&&(c&&(d?.invalidateCache?.(),d&&this.sampler.clearCachedScalarRange(d),this.releaseSampledSliceState(n),n.renderingInvalidated=!0),e.display.renderNow())}))});return()=>{a=!1,n.pendingVolumeLoadCallback=!1,this.releaseSampledSliceState(n),void 0!==r&&(window.cancelAnimationFrame(r),r=void 0),void 0!==i&&(window.clearTimeout(i),i=void 0),u()}})()},O(e,{camera:e.viewport.getViewState(),acquisitionOrientation:n.acquisitionOrientation,imageIds:n.imageIds,imageIdIndex:n.currentImageIdIndex,maxImageIdIndex:n.maxImageIdIndex}),{rendering:n,updateDataPresentation:r=>{this.updateDataPresentation(e,n,t.id,r)},applyViewState:r=>{this.applyViewState(e,n,t.id,r)},getFrameOfReferenceUID:()=>this.getFrameOfReferenceUID(n),getActorEntry:e=>o(e,{actor:n.compatibilityActor,renderMode:b.T.CPU_VOLUME,uid:n.actorEntryUID,referencedIdFallback:e.volumeId}),getImageData:()=>this.getImageData(n),render:()=>{this.render(e,n)},resize:()=>{this.resize(e,n,t.id)},removeData:()=>{this.removeData(e,n)}}}updateDataPresentation(e,t,r,n){let i=t.dataPresentation?.interpolationType,{slabThickness:a,...o}=n||{};if(t.dataPresentation=Object.keys(o).length?o:void 0,i!==t.dataPresentation?.interpolationType)return void this.syncRenderCamera(e,t,r,e.viewport.getViewState());t.renderingInvalidated=!0}applyViewState(e,t,r,n){e.display.activateRenderMode(b.T.CPU_VOLUME),this.syncRenderCamera(e,t,r,n)}canvasToWorld(e,t,r){return(0,P.Yo)({canvas:e.cpu.canvas,canvasPos:r,ctx:e})}worldToCanvas(e,t,r){return(0,P.sh)({canvas:e.cpu.canvas,ctx:e,worldPos:r})}getFrameOfReferenceUID(e){return e.imageVolume.metadata?.FrameOfReferenceUID}getImageData(e){var t=e.imageVolume;let r=t.imageData;return r?{dimensions:r.getDimensions(),spacing:r.getSpacing(),origin:r.getOrigin(),direction:r.getDirection(),imageData:r,metadata:{Modality:t.metadata?.Modality,FrameOfReferenceUID:t.metadata?.FrameOfReferenceUID},get scalarData(){return t.voxelManager?.getScalarData()},scaling:t.scaling,hasPixelSpacing:t.hasPixelSpacing,voxelManager:t.voxelManager}:void 0}render(e,t){var r,n,i,a,o;if(e.display.activateRenderMode(b.T.CPU_VOLUME),e.cpu.canvas.style.display="",e.cpu.canvas.style.opacity="1",t.dataPresentation?.visible===!1)return void el(e);let s=t.imageVolume.loadStatus,l=!!(((r=t.imageVolume).framesLoaded??0)>0||(r.framesProcessed??0)>0||(r.framesUpdated??0)>0);if(!(void 0===s||!0===s.loaded||l)){t.pendingVolumeLoadCallback||(t.pendingVolumeLoadCallback=!0,t.imageVolume.load()),e.display.setNeedsRender();return}if(t.pendingVolumeLoadCallback=!1,!e.cpu.canvas.width||!e.cpu.canvas.height)return;let u=(0,P.X3)(e);if(!u)return;el(e),n=t.layerCanvas,i=e.cpu.canvas,(n.width!==i.width||n.height!==i.height)&&(n.width=i.width,n.height=i.height,1)&&(t.renderingInvalidated=!0);let c=(0,W.D0)().rendering?.planar?.cpuVolume?.useViewportSamplingForLinear===!0,d=t.forceHighQualityResample?"resample":this.sampler.getResampleDecision({sampledSliceState:t.sampledSliceState,width:e.cpu.canvas.width,height:e.cpu.canvas.height,camera:u,dataPresentation:t.dataPresentation,deferViewportResample:c}),p="resample"===d;"defer"===d?(a=e,eo(o=t),a.display.setNeedsRender(),o.deferredResampleTimeoutId=window.setTimeout(()=>{o.deferredResampleTimeoutId=void 0,o.forceHighQualityResample=!0,o.renderingInvalidated=!0,a.display.renderNow()},80)):eo(t);let m=t.sampledSliceState;p&&(this.releaseSampledSliceState(t),t.forceHighQualityResample=!1,m=t.sampledSliceState=this.sampler.sampleSliceImage({volume:t.imageVolume,width:e.cpu.canvas.width,height:e.cpu.canvas.height,camera:u,dataPresentation:t.dataPresentation,useViewportSamplingForLinear:c})),m&&(p&&(t.renderingInvalidated=!0),t.enabledElement=this.sampler.createOrUpdateEnabledElement({enabledElement:t.enabledElement,canvas:t.layerCanvas,image:m.image,modality:t.imageVolume.metadata?.Modality}),this.sampler.updateCPUFallbackViewport({enabledElement:t.enabledElement,sampledSliceState:m,camera:u,dataPresentation:t.dataPresentation,defaultVOIRange:t.defaultVOIRange}),t.defaultVOIRange||=this.sampler.getResolvedVOIRange(t.dataPresentation?.voiRange,m.image.minPixelValue??0,m.image.maxPixelValue??1),p&&t.compatibilityActor.getMapper().getInputData().setDerivedImage(m.image),t.compositeActor?function(e){let t=e.enabledElement;if(!t)return;let r=e.layerCanvas.getContext("2d");r&&(r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,e.layerCanvas.width,e.layerCanvas.height),r.imageSmoothingEnabled=!t.viewport.pixelReplication,(0,k.A)(t,r),e.compatibilityActor.render(void 0,r))}(t):(0,h.A)(t.enabledElement,t.renderingInvalidated),t.renderingInvalidated=!1,function(e,t){let r=t.dataPresentation?.opacity??1;r<=0||(e.cpu.context.save(),e.cpu.context.globalAlpha=r,e.cpu.context.drawImage(t.layerCanvas,0,0),e.cpu.context.restore())}(e,t),e.display.markRendered(),(0,x.A)(e.viewport.element,g.sV.IMAGE_RENDERED,{element:e.viewport.element,viewportId:e.viewportId,renderingEngineId:e.renderingEngineId,viewportStatus:g.Dt.RENDERED}))}resize(e,t,r){this.syncRenderCamera(e,t,r,e.viewport.getViewState())}removeData(e,t){let{removeStreamingSubscriptions:r}=t;eo(t),r?.(),this.releaseSampledSliceState(t),this.sampler.clearSliceArrayPool?.()}syncRenderCamera(e,t,r,n){let i=(0,P.NU)({ctx:e,dataId:r,rendering:t,viewState:n});if(!i)return;let{currentImageIdIndex:a,maxImageIdIndex:o}=i,s=a!==t.currentImageIdIndex,l=o!==t.maxImageIdIndex;t.currentImageIdIndex=a,t.maxImageIdIndex=o,t.renderingInvalidated=!0,(s||l)&&e.viewport.invalidateResolvedView(),s&&O(e,{camera:n,acquisitionOrientation:t.acquisitionOrientation,imageIds:t.imageIds,imageIdIndex:t.currentImageIdIndex,maxImageIdIndex:t.maxImageIdIndex})}releaseSampledSliceState(e){this.sampler.releaseSampledSliceState?.(e.sampledSliceState),e.sampledSliceState=void 0}}function eo(e){void 0!==e.deferredResampleTimeoutId&&(window.clearTimeout(e.deferredResampleTimeoutId),e.deferredResampleTimeoutId=void 0)}class es{constructor(){this.id="planar:cpu-volume-slice",this.type=g.NV.PLANAR_NEXT}matches(e,t){return"image"===e.type&&t.renderMode===b.T.CPU_VOLUME}createRenderPath(){return new ea}selectContext(e){return{viewportId:e.viewportId,renderingEngineId:e.renderingEngineId,type:e.type,viewport:e.viewport,renderPath:e.renderPath,view:e.view,display:e.display,cpu:e.cpu}}}function el(e){e.cpu.composition.clearedRenderPassId!==e.cpu.composition.renderPassId&&(e.cpu.context.setTransform(1,0,0,1,0,0),e.cpu.context.clearRect(0,0,e.cpu.canvas.width,e.cpu.canvas.height),e.cpu.context.fillStyle="#000",e.cpu.context.fillRect(0,0,e.cpu.canvas.width,e.cpu.canvas.height),e.cpu.composition.clearedRenderPassId=e.cpu.composition.renderPassId)}var eu=r(86216),ec=r(3533),ed=r(42422),ep=r(59085),em=r(76348);class eh{async addData(e,t,r){if(!t.image)throw Error("[PlanarViewport] VTK image rendering requires an image");let n=eu.Ay.newInstance(),i=ec.Ay.newInstance(),a=t.imageData??(0,p.ev)(t.image);e.display.activateRenderMode(b.T.VTK_IMAGE),n.setInputData(a),i.setMapper(n),a.getPointData().getScalars().getNumberOfComponents()>1&&i.getProperty().setIndependentComponents(!1),e.vtk.renderer.addActor(i);let s={renderMode:b.T.VTK_IMAGE,actorEntryUID:(0,C.A)(),actor:i,currentImage:t.image,mapper:n,imageData:a,useWorldCoordinateImageData:t.useWorldCoordinateImageData,currentImageIdIndex:t.initialImageIdIndex??0,defaultVOIRange:(0,p.c4)(t.image),dataPresentation:void 0,loadRequestId:0};return"overlay"!==r.role&&w(e,{image:t.image,imageIdIndex:t.initialImageIdIndex??0}),{rendering:s,updateDataPresentation:e=>{this.updateDataPresentation(s,e)},applyViewState:r=>{this.applyViewState(e,s,t.id,r,t.imageIds)},getFrameOfReferenceUID:()=>this.getFrameOfReferenceUID(s),getActorEntry:e=>o(e,{actor:s.actor,mapper:s.mapper,renderMode:b.T.VTK_IMAGE,uid:s.actorEntryUID,referencedIdFallback:s.currentImage.imageId}),getImageData:()=>this.getImageData(s),resize:()=>{this.resize(e,s,t.id)},removeData:()=>{this.removeData(e,s)}}}updateDataPresentation(e,t){e.dataPresentation=t,(0,p.kl)({actor:e.actor,defaultVOIRange:e.defaultVOIRange,defaultVOILUTFunction:e.currentImage?.voiLUTFunction,props:{interpolationType:g.VO.LINEAR,...t}})}applyViewState(e,t,r,n,i){if(e.display.activateRenderMode(b.T.VTK_IMAGE),t.useWorldCoordinateImageData)return;let a=(0,P.NU)({ctx:e,dataId:r,imageIds:i,rendering:t,viewState:n}),o=(0,P.VU)({projection:a,rendering:t,viewState:n});if(a&&(ev(e,t,a.resolvedICamera),a.isSourceBinding&&(0,em.hH)({renderer:e.vtk.renderer,activeSourceICamera:a.resolvedICamera})),o===(t.lastRequestedImageIdIndex??t.currentImageIdIndex)||o<0||o>=i.length)return;t.lastRequestedImageIdIndex=o;let s=++t.loadRequestId;(0,v.loadAndCacheImage)(i[o]).then(n=>{s===t.loadRequestId&&eg({ctx:e,dataId:r,image:n,rendering:t,imageIdIndex:o,dataPresentation:t.dataPresentation})})}canvasToWorld(e,t){return(0,ep.Dh)({canvas:e.vtk.canvas,renderer:e.vtk.renderer,canvasPos:t})}worldToCanvas(e,t){return(0,ep.nM)({canvas:e.vtk.canvas,renderer:e.vtk.renderer,worldPos:t})}getFrameOfReferenceUID(e){let t=e.currentImage.imageId,r=t?y.get(g.nb.IMAGE_PLANE,t):void 0;return r?.frameOfReferenceUID}getImageData(e){return L(e.currentImage,this.getFrameOfReferenceUID(e))}removeData(e,t){let{actor:r}=t;e.vtk.renderer.removeActor(r)}resize(e,t,r){if(t.useWorldCoordinateImageData)return void e.display.requestRender();let n=e.viewport.getViewState(),i=(0,P.NU)({ctx:e,dataId:r,rendering:t,viewState:n});i&&(ev(e,t,i.resolvedICamera),i.isSourceBinding&&(0,em.hH)({renderer:e.vtk.renderer,activeSourceICamera:i.resolvedICamera})),e.display.requestRender()}}class ef{constructor(){this.id="planar:vtk-image-mapper",this.type=g.NV.PLANAR_NEXT}matches(e,t){return"image"===e.type&&t.renderMode===b.T.VTK_IMAGE}createRenderPath(){return new eh}selectContext(e){return{viewportId:e.viewportId,renderingEngineId:e.renderingEngineId,type:e.type,viewport:e.viewport,renderPath:e.renderPath,view:e.view,display:e.display,vtk:e.vtk}}}async function eg(e){let{ctx:t,dataId:r,image:n,rendering:i,imageIdIndex:a,dataPresentation:o}=e,s=t.viewport.getViewState(),{actor:l,mapper:u}=i,c=i.imageData;c&&function(e,t){let r=e.getPointData?.()?.getScalars?.();if(!r)return!1;let[n,i]=e.getDimensions();if(n!==t.columns||i!==t.rows||r.getDataType()!==t.voxelManager.getScalarData().constructor.name)return!1;let a=t.color?3:1;return r.getNumberOfComponents()===a}(c,n)?((0,ed.J)(c,n),(0,p.rp)(c,n)):(c=(0,p.ev)(n),u.setInputData(c)),i.currentImage=n,i.imageData=c,i.currentImageIdIndex=a,i.defaultVOIRange=(0,p.c4)(n),t.viewport.invalidateResolvedView(),c.getPointData().getScalars().getNumberOfComponents()>1&&l.getProperty().setIndependentComponents(!1),(0,p.kl)({actor:l,defaultVOIRange:i.defaultVOIRange,defaultVOILUTFunction:n.voiLUTFunction,props:{interpolationType:o?.interpolationType??g.VO.LINEAR,...o}});let d=(0,P.NU)({ctx:t,dataId:r,rendering:i,viewState:s});d&&(ev(t,i,d.resolvedICamera),d.isSourceBinding&&(0,em.hH)({renderer:t.vtk.renderer,activeSourceICamera:d.resolvedICamera})),d?.isSourceBinding&&w(t,{image:n,imageIdIndex:a}),t.display.requestRender()}function ev(e,t,r){(0,em.lW)({actor:t.actor,activeSourceICamera:r})}var ey=r(22783),eb=r(36195),eI=r(20549);async function ex(e,t,r,n=!1){let{volumeId:i,callback:a}=e,o=await (0,eI.loadVolume)(i);if(!o)throw Error(`imageVolume with id: ${i} does not exist`);let{imageData:s,vtkOpenGLTexture:l}=o,u=o.loadStatus,c=ey.Ay.newInstance(),d=eb.c2.newInstance();(!u||u.loaded)&&l.modified(),d.setInputData(s),d.setSlicePlane(c),d.setSlabThickness(0),d.setScalarTexture?.(l),d.modified();let p=ec.Ay.newInstance();p.setMapper(d);let m=s.get("numberOfComponents");(m?.numberOfComponents??1)>1&&p.getProperty().setIndependentComponents(!1);let h=p.getProperty();h.set({viewportId:r},!0),await (0,G.A)(p,o);let f=h.getColorWindow?.(),v=h.getColorLevel?.();if(255===f&&127.5===v){let e=o.voxelManager?.getRange?.();e?.length===2&&(h.setColorWindow(e[1]-e[0]),h.setColorLevel((e[1]+e[0])/2))}return a&&a({volumeActor:p,volumeId:i}),n||function(e,t,r,n){let i=r.getProperty().getRGBTransferFunction(0);if(!i)return;let a=i.getRange(),o={viewportId:t,range:{lower:a[0],upper:a[1]},volumeId:n};(0,x.A)(e,g.sV.VOI_MODIFIED,o)}(t,r,p,i),{actor:p,slicePlane:c}}var eC=r(10355),eA=r(63467);function eT(e){let t=[];return e.forEach(([e,r])=>{let n=t[t.length-1];if(n&&n[0]===e){n[1]=r;return}t.push([e,r])}),t}function eS(e){return Math.max(0,Math.min(1,e))}function ew(e,t){if(t&&Number.isFinite(t.lower)&&Number.isFinite(t.upper))return t;let r=e.getMapper()?.getInputData?.(),n=r?.getPointData?.()?.getScalars?.()?.getRange?.();if(n&&Number.isFinite(n[0])&&Number.isFinite(n[1]))return{lower:n[0],upper:n[1]};let i=e.getProperty().getRGBTransferFunction(0)?.getRange?.();return i&&Number.isFinite(i[0])&&Number.isFinite(i[1])?{lower:i[0],upper:i[1]}:{lower:0,upper:1}}class eO{async addData(e,t,r){var n,i;let a=t.imageVolume,s="overlay"===r.role&&t.reference?.kind==="segmentation";if(!a)throw Error("[PlanarViewport] Volume rendering requires a prepared image volume");let{actor:l}=await ex({volumeId:t.volumeId},e.viewport.element,e.viewportId,!0),u=l.getMapper();e.display.activateRenderMode(b.T.VTK_VOLUME_SLICE),e.vtk.renderer.addActor(l);let c=l.getProperty().getRGBTransferFunction(0),d=c?.getRange?.(),p={renderMode:b.T.VTK_VOLUME_SLICE,actorEntryUID:(0,C.A)(),actor:l,overlayOrder:(n=e.vtk.renderer,i=l,Math.max(0,n.getActors().filter(e=>e?.getClassName?.()==="vtkImageSlice").indexOf(i))),imageVolume:a,imageIds:t.imageIds,acquisitionOrientation:t.acquisitionOrientation,mapper:u,currentImageIdIndex:t.initialImageIdIndex??0,maxImageIdIndex:t.imageIds.length-1,defaultVOIRange:d?{lower:d[0],upper:d[1]}:void 0,dataPresentation:void 0,isSegmentationOverlay:s},m=null,h=function(e,t){let r=r=>{let n=r.detail;n?.volumeId===e&&t(r.type)};return F.A.addEventListener(g.sV.IMAGE_VOLUME_MODIFIED,r),F.A.addEventListener(g.sV.IMAGE_VOLUME_LOADING_COMPLETED,r),()=>{F.A.removeEventListener(g.sV.IMAGE_VOLUME_MODIFIED,r),F.A.removeEventListener(g.sV.IMAGE_VOLUME_LOADING_COMPLETED,r)}}(t.volumeId,t=>{if(t===g.sV.IMAGE_VOLUME_MODIFIED&&u.modified(),!(p.isSegmentationOverlay&&(p.dataPresentation?.slabThickness??0)>0))return void e.display.requestRender();null!==m&&clearTimeout(m),m=setTimeout(()=>{m=null,e.display.requestRender()},240)});return p.removeStreamingSubscriptions=()=>{null!==m&&(clearTimeout(m),m=null),h()},a.load(()=>{e.display.requestRender()}),O(e,{camera:e.viewport.getViewState(),acquisitionOrientation:p.acquisitionOrientation,imageIds:p.imageIds,imageIdIndex:p.currentImageIdIndex,maxImageIdIndex:p.maxImageIdIndex}),{rendering:p,updateDataPresentation:t=>{this.updateDataPresentation(e,p,t)},applyViewState:r=>{this.applyViewState(e,p,t.id,r)},getFrameOfReferenceUID:()=>this.getFrameOfReferenceUID(p),getActorEntry:e=>o(e,{actor:p.actor,mapper:p.mapper,renderMode:b.T.VTK_VOLUME_SLICE,uid:p.actorEntryUID,referencedIdFallback:e.volumeId}),getImageData:()=>this.getImageData(p),render:()=>{this.render(e)},resize:()=>{this.resize(e,p,t.id)},removeData:()=>{this.removeData(e,p)}}}updateDataPresentation(e,t,r){t.dataPresentation=r,function(e){let{actor:t,defaultVOIRange:r,mapper:n,props:i}=e,a=t.getProperty(),o=i?.voiRange??r;if(t.setVisibility(i?.visible!==!1),i?.interpolationType!==void 0&&a.setInterpolationType(i.interpolationType),i?.blendMode!==void 0){let e=(0,eA.IQ)(i.blendMode);void 0!==e&&n.setSlabType(e)}if(n.setSlabThickness((0,eA.tF)(i?.slabThickness)),i?.opacity!==void 0&&function(e){let{actor:t,opacity:r,voiRange:n}=e;if(2>function(e){let t=e.getMapper()?.getInputData?.(),r=t?.getPointData?.()?.getScalars?.(),n=t?.get?.("numberOfComponents");return r?.getNumberOfComponents?.()??n?.numberOfComponents??1}(t))return t.getProperty().setOpacity(r);let i=eC.Ay.newInstance(),a=ew(t,n);i.addPoint(a.lower,r),a.upper>a.lower&&i.addPoint(a.upper,r),t.getProperty().setScalarOpacity(0,i)}({actor:t,opacity:i.opacity,voiRange:o}),!o)return;let s=(0,p.Fp)({colormap:i?.colormap,invert:i?.invert,voiRange:o});a.setUseLookupTableScalarRange(!0),a.setRGBTransferFunction(0,s),function(e){let{actor:t,colormap:r,voiRange:n}=e;if(!r||void 0===r.opacity&&void 0===r.threshold)return;let i=void 0!==r.threshold?function(e){let t=e.getMapper()?.getInputData?.(),r=t?.get?.("voxelManager")?.voxelManager,n=r?.getRange?.();if(n&&Number.isFinite(n[0])&&Number.isFinite(n[1])&&n[1]>n[0])return{lower:n[0],upper:n[1]};let i=t?.getPointData?.()?.getScalars?.()?.getRange?.();if(i&&Number.isFinite(i[0])&&Number.isFinite(i[1])&&i[1]>i[0])return{lower:i[0],upper:i[1]}}(t)??ew(t,n):ew(t,n),a=eC.Ay.newInstance();(function(e){let{colormap:t,range:r,fallbackOpacity:n}=e,i=r.upper-r.lower,a=Math.max(.001*Math.abs(i),.001),o=void 0!==t.threshold?Math.max(r.lower,Math.min(r.upper,t.threshold)):void 0;if(Array.isArray(t.opacity)&&t.opacity.length){let e=t.opacity.map(({opacity:e,value:t})=>({opacity:eS(e),value:r.lower+t*i})).sort((e,t)=>e.value-t.value);if(void 0===o)return eT(e.map(({value:e,opacity:t})=>[e,t]));let s=function(e,t,r){if(!t.length)return eS(r);if(e<=t[0].value)return t[0].opacity;for(let r=1;r0?(e-n.value)/t:0;return eS(n.opacity+(i.opacity-n.opacity)*r)}}return t[t.length-1].opacity}(o,e,n),l=[[r.lower,0],[Math.max(r.lower,o-a),0],[o,s]];if(e.forEach(({value:e,opacity:t})=>{e>o&&l.push([e,t])}),o=r.upper?[[r.lower,0],[r.upper,0]]:[[r.lower,0],[Math.max(r.lower,o-a),0],[o,s],[r.upper,s]]})({colormap:r,range:i,fallbackOpacity:function(e){let t=e.getProperty().getScalarOpacity(0),r=t?.getDataPointer?.();if(!r?.length)return e.getProperty().getOpacity?.()??1;let n=0;for(let e=1;en&&(n=r[e]);return eS(n||1)}(t)}).forEach(([e,t])=>{a.addPoint(e,t)}),t.getProperty().setScalarOpacity(0,a)}({actor:t,colormap:i?.colormap,voiRange:o})}({actor:t.actor,defaultVOIRange:t.isSegmentationOverlay?void 0:t.defaultVOIRange,mapper:t.mapper,props:t.dataPresentation});let n=(0,P.X3)(e);e_(t.mapper,n),(0,em.lW)({actor:t.actor,activeSourceICamera:n}),eE(t.actor,n,t.overlayOrder),e.vtk.renderer.resetCameraClippingRange()}applyViewState(e,t,r,n){e.display.activateRenderMode(b.T.VTK_VOLUME_SLICE),this.syncRenderCamera(e,t,r,n,!0)}syncRenderCamera(e,t,r,n,i){let a=(0,P.NU)({ctx:e,dataId:r,rendering:t,viewState:n});if(!a)return;a.isSourceBinding&&(0,em.hH)({renderer:e.vtk.renderer,activeSourceICamera:a.resolvedICamera}),(0,em.lW)({actor:t.actor,activeSourceICamera:a.activeSourceICamera});let o=a.currentImageIdIndex!==t.currentImageIdIndex,s=a.maxImageIdIndex!==t.maxImageIdIndex;t.currentImageIdIndex=a.currentImageIdIndex,t.maxImageIdIndex=a.maxImageIdIndex,(o||s)&&e.viewport.invalidateResolvedView(),e_(t.mapper,a.activeSourceICamera),eE(t.actor,a.activeSourceICamera,t.overlayOrder),e.vtk.renderer.resetCameraClippingRange(),i&&o&&O(e,{camera:n,acquisitionOrientation:t.acquisitionOrientation,imageIds:t.imageIds,imageIdIndex:t.currentImageIdIndex,maxImageIdIndex:t.maxImageIdIndex})}canvasToWorld(e,t){return(0,ep.Dh)({canvas:e.vtk.canvas,renderer:e.vtk.renderer,canvasPos:t})}worldToCanvas(e,t){return(0,ep.nM)({canvas:e.vtk.canvas,renderer:e.vtk.renderer,worldPos:t})}getFrameOfReferenceUID(e){return e.imageVolume.metadata?.FrameOfReferenceUID}getImageData(e){var t=e.imageVolume;let r=t.imageData;return r?{dimensions:r.getDimensions(),spacing:r.getSpacing(),origin:r.getOrigin(),direction:r.getDirection(),imageData:r,metadata:{Modality:t.metadata?.Modality,FrameOfReferenceUID:t.metadata?.FrameOfReferenceUID},get scalarData(){return t.voxelManager?.getScalarData()},scaling:t.scaling,hasPixelSpacing:t.hasPixelSpacing,voxelManager:t.voxelManager}:void 0}render(e){e.display.requestRender()}resize(e,t,r){let n=e.viewport.getViewState();this.syncRenderCamera(e,t,r,n,!1),e.display.requestRender()}removeData(e,t){let{actor:r,removeStreamingSubscriptions:n}=t;n?.(),e.vtk.renderer.removeActor(r)}}class eP{constructor(){this.id="planar:vtk-volume-slice",this.type=g.NV.PLANAR_NEXT}matches(e,t){return"image"===e.type&&t.renderMode===b.T.VTK_VOLUME_SLICE}createRenderPath(){return new eO}selectContext(e){return{viewportId:e.viewportId,renderingEngineId:e.renderingEngineId,type:e.type,viewport:e.viewport,renderPath:e.renderPath,view:e.view,display:e.display,vtk:e.vtk}}}function e_(e,t){if(!t?.focalPoint||!t.viewPlaneNormal)return;let r=function(e){let t=e.getSlicePlane?.();if(t)return t;let r=ey.Ay.newInstance();return e.setSlicePlane(r),r}(e);r.setOrigin(...t.focalPoint),r.setNormal(...t.viewPlaneNormal)}function eE(e,t,r=0){if(!t?.viewPlaneNormal||r<=0)return void e.setPosition(0,0,0);let[n,i,a]=t.viewPlaneNormal,o=1e-4*r;e.setPosition(n*o,i*o,a*o)}function eD(){return[new E,new es,new ef,new eP,...(0,n.Vz)()]}function eR(e=eD()){return new i.r(e)}},8889:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(54268);let i="cornerstoneStreamingImageVolume";function a(e){return n.Ay.getVolume(e)||n.Ay.getVolumeLoadObject(e)||e.startsWith(`${i}:`)||e.includes(":")?e:`${i}:${e}`}},9128:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseReader=void 0;let n=r(24065);class i{_builderOptions;static _entityTable={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};constructor(e){this._builderOptions=e,e.parser&&Object.assign(this,e.parser)}_docType(e,t,r,n){return e.dtd({name:t,pubID:r,sysID:n})}_comment(e,t){return e.com(t)}_text(e,t){return e.txt(t)}_instruction(e,t,r){return e.ins(t,r)}_cdata(e,t){return e.dat(t)}_element(e,t,r){return void 0===t?e.ele(r):e.ele(t,r)}_attribute(e,t,r,n){return void 0===t?e.att(r,n):e.att(t,r,n)}_sanitize(e){return(0,n.sanitizeInput)(e,this._builderOptions.invalidCharReplacement)}_decodeText(e){return null==e?e:e.replace(/&(quot|amp|apos|lt|gt);/g,(e,t)=>i._entityTable[t]).replace(/&#(?:x([a-fA-F0-9]+)|([0-9]+));/g,(e,t,r)=>String.fromCodePoint(parseInt(t||r,t?16:10)))}_decodeAttributeValue(e){return this._decodeText(e)}parse(e,t){return this._parse(e,t)}docType(e,t,r,n){return this._docType(e,t,r,n)}comment(e,t){return this._comment(e,t)}text(e,t){return this._text(e,t)}instruction(e,t,r){return this._instruction(e,t,r)}cdata(e,t){return this._cdata(e,t)}element(e,t,r){return this._element(e,t,r)}attribute(e,t,r,n){return this._attribute(e,t,r,n)}sanitize(e){return this._sanitize(e)}}t.BaseReader=i},9435:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isCodeUnitPrefix=s,t.isCodeUnitLessThan=function(e,t){if(s(t,e))return!1;if(s(e,t))return!0;for(let r=0;r=97&&e<=122?t+=String.fromCodePoint(e-32):t+=r}return t},t.asciiCaseInsensitiveMatch=function(e,t){return c(e)===c(t)},t.asciiEncode=function(e){return console.assert(u(e),"asciiEncode requires an ASCII string."),l(e)},t.asciiDecode=function(e){for(let t of e)console.assert((0,a.isASCIIByte)(t),"asciiDecode requires an ASCII byte sequence.");return(0,i.isomorphicDecode)(e)},t.stripNewlines=function(e){return e.replace(/[\n\r]/g,"")},t.normalizeNewlines=function(e){return e.replace(/\r\n/g,"\n").replace(/\r/g,"\n")},t.stripLeadingAndTrailingASCIIWhitespace=d,t.stripAndCollapseASCIIWhitespace=function(e){return d(e.replace(/[\t\n\f\r ]{2,}/g," "))},t.collectASequenceOfCodePoints=p,t.skipASCIIWhitespace=m,t.strictlySplit=function e(t,r){if(!(0,o.isArray)(t))return e(Array.from(t),r);let n={position:0},i=[],a=p(e=>r!==e,t,n);for(i.push(a);n.positionr!==e,t,n));return i},t.splitAStringOnASCIIWhitespace=function e(t){if(!(0,o.isArray)(t))return e(Array.from(t));let r={position:0},i=[];for(m(t,r);r.position!n.ASCIIWhiteSpace.test(e),t,r);i.push(e),m(t,r)}return i},t.splitAStringOnCommas=function e(t){if(!(0,o.isArray)(t))return e(Array.from(t));let r={position:0},n=[];for(;r.position","!==e,t,r);n.push(d(e)),r.position=65&&e<=90?t+=String.fromCodePoint(e+32):t+=r}return t}function d(e){return e.replace(/^[\t\n\f\r ]+/,"").replace(/[\t\n\f\r ]+$/,"")}function p(e,t,r){if(!(0,o.isArray)(t))return p(e,Array.from(t),r);let n="";for(;r.positionn.ASCIIWhiteSpace.test(e),e,t)}},9638:(e,t,r)=>{"use strict";r.d(t,{OB:()=>c,Ws:()=>l,XL:()=>n,Yl:()=>s,aD:()=>o,dq:()=>u});let n=.001,i=new Set(["fit","fitAspect","fitWidth","fitHeight","absolute"]);function a(e){return"number"==typeof e&&Number.isFinite(e)?Math.max(e,n):1}function o(e){if(Array.isArray(e))return[a(e[0]),a(e[1])];let t=a(e);return[t,t]}function s(e){return o(e)}function l(e){return o(e)[1]}function u(e){return i.has(e||"")?e:"fit"}function c(e){let[t,r]=o(e);return t/r}},9731:(e,t,r)=>{"use strict";r.d(t,{A:()=>c});var n=r(17042),{vtkErrorMacro:i}=n.Ay,a={shaderType:"Unknown",source:"",error:"",handle:0,dirty:!1,context:null},o={newInstance:n.Ay.newInstance(function(e,t,r={}){Object.assign(t,a,r),n.Ay.obj(e,t),n.Ay.setGet(e,t,["shaderType","source","error","handle","context"]),t.classHierarchy.push("vtkShader"),e.compile=()=>{let e=t.context.VERTEX_SHADER;if(!t.source||!t.source.length||"Unknown"===t.shaderType)return!1;if(0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0),e="Fragment"===t.shaderType?t.context.FRAGMENT_SHADER:t.context.VERTEX_SHADER,t.handle=t.context.createShader(e),t.context.shaderSource(t.handle,t.source),t.context.compileShader(t.handle),!t.context.getShaderParameter(t.handle,t.context.COMPILE_STATUS)){let e=t.context.getShaderInfoLog(t.handle);return i(`Error compiling shader '${t.source}': ${e}`),t.context.deleteShader(t.handle),t.handle=0,!1}return!0},e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0,t.dirty=!0)}},"vtkShader")},{vtkErrorMacro:s}=n.Ay,l={vertexShaderHandle:0,fragmentShaderHandle:0,geometryShaderHandle:0,vertexShader:null,fragmentShader:null,geometryShader:null,linked:!1,bound:!1,compiled:!1,error:"",handle:0,numberOfOutputs:0,attributesLocs:null,uniformLocs:null,md5Hash:0,context:null,lastCameraMTime:null};function u(e,t,r={}){Object.assign(t,l,r),t.attributesLocs={},t.uniformLocs={},t.vertexShader=o.newInstance(),t.vertexShader.setShaderType("Vertex"),t.fragmentShader=o.newInstance(),t.fragmentShader.setShaderType("Fragment"),t.geometryShader=o.newInstance(),t.geometryShader.setShaderType("Geometry"),n.Ay.obj(e,t),n.Ay.get(e,t,["lastCameraMTime"]),n.Ay.setGet(e,t,["error","handle","compiled","bound","md5Hash","vertexShader","fragmentShader","geometryShader","linked"]),t.classHierarchy.push("vtkShaderProgram"),e.compileShader=()=>t.vertexShader.compile()?t.fragmentShader.compile()?e.attachShader(t.vertexShader)&&e.attachShader(t.fragmentShader)?e.link()?(e.setCompiled(!0),1):(s(`Links failed: ${t.error}`),0):(s(t.error),0):(s(t.fragmentShader.getSource().split("\n").map((e,t)=>`${t}: ${e}`).join("\n")),s(t.fragmentShader.getError()),0):(s(t.vertexShader.getSource().split("\n").map((e,t)=>`${t}: ${e}`).join("\n")),s(t.vertexShader.getError()),0),e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(e.release(),0!==t.vertexShaderHandle&&(t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=0),0!==t.fragmentShaderHandle&&(t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=0),t.context.deleteProgram(t.handle),t.handle=0,e.setCompiled(!1))},e.bind=()=>(!!t.linked||!!e.link())&&(t.context.useProgram(t.handle),e.setBound(!0),!0),e.isBound=()=>!!t.bound,e.release=()=>{t.context.useProgram(null),e.setBound(!1)},e.setContext=e=>{t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.link=()=>!!t.linked||(0===t.handle?(t.error="Program has not been initialized, and/or does not have shaders.",!1):(t.uniformLocs={},t.context.linkProgram(t.handle),t.context.getProgramParameter(t.handle,t.context.LINK_STATUS))?(e.setLinked(!0),t.attributeLocs={},!0):(s(`Error linking shader ${t.context.getProgramInfoLog(t.handle)}`),t.handle=0,!1)),e.setUniformMatrix=(r,n)=>{let i=e.findUniform(r);if(-1===i)return t.error=`Could not set uniform ${r} . No such uniform.`,!1;let a=new Float32Array(n);return t.context.uniformMatrix4fv(i,!1,a),!0},e.setUniformMatrix3x3=(r,n)=>{let i=e.findUniform(r);if(-1===i)return t.error=`Could not set uniform ${r} . No such uniform.`,!1;let a=new Float32Array(n);return t.context.uniformMatrix3fv(i,!1,a),!0},e.setUniformf=(r,n)=>{let i=e.findUniform(r);return -1===i?(t.error=`Could not set uniform ${r} . No such uniform.`,!1):(t.context.uniform1f(i,n),!0)},e.setUniformfv=(r,n)=>{let i=e.findUniform(r);return -1===i?(t.error=`Could not set uniform ${r} . No such uniform.`,!1):(t.context.uniform1fv(i,n),!0)},e.setUniformi=(r,n)=>{let i=e.findUniform(r);return -1===i?(t.error=`Could not set uniform ${r} . No such uniform.`,!1):(t.context.uniform1i(i,n),!0)},e.setUniformiv=(r,n)=>{let i=e.findUniform(r);return -1===i?(t.error=`Could not set uniform ${r} . No such uniform.`,!1):(t.context.uniform1iv(i,n),!0)},e.setUniform2f=(r,n,i)=>{let a=e.findUniform(r);if(-1===a)return t.error=`Could not set uniform ${r} . No such uniform.`,!1;if(void 0===i)throw RangeError("Invalid number of values for array");return t.context.uniform2f(a,n,i),!0},e.setUniform2fv=(r,n)=>{let i=e.findUniform(r);return -1===i?(t.error=`Could not set uniform ${r} . No such uniform.`,!1):(t.context.uniform2fv(i,n),!0)},e.setUniform2i=(r,n,i)=>{let a=e.findUniform(r);if(-1===a)return t.error=`Could not set uniform ${r} . No such uniform.`,!1;if(void 0===i)throw RangeError("Invalid number of values for array");return t.context.uniform2i(a,n,i),!0},e.setUniform2iv=(r,n)=>{let i=e.findUniform(r);return -1===i?(t.error=`Could not set uniform ${r} . No such uniform.`,!1):(t.context.uniform2iv(i,n),!0)},e.setUniform3f=(r,n,i,a)=>{let o=e.findUniform(r);if(-1===o)return t.error=`Could not set uniform ${r} . No such uniform.`,!1;if(void 0===a)throw RangeError("Invalid number of values for array");return t.context.uniform3f(o,n,i,a),!0},e.setUniform3fArray=(r,n)=>{let i=e.findUniform(r);if(-1===i)return t.error=`Could not set uniform ${r} . No such uniform.`,!1;if(!Array.isArray(n)||3!==n.length)throw RangeError("Invalid number of values for array");return t.context.uniform3f(i,n[0],n[1],n[2]),!0},e.setUniform3fv=(r,n)=>{let i=e.findUniform(r);return -1===i?(t.error=`Could not set uniform ${r} . No such uniform.`,!1):(t.context.uniform3fv(i,n),!0)},e.setUniform3i=(r,...n)=>{let i=e.findUniform(r);if(-1===i)return t.error=`Could not set uniform ${r} . No such uniform.`,!1;let a=n;if(1===a.length&&Array.isArray(a[0])&&(a=a[0]),3!==a.length)throw RangeError("Invalid number of values for array");return t.context.uniform3i(i,a[0],a[1],a[2]),!0},e.setUniform3iv=(r,n)=>{let i=e.findUniform(r);return -1===i?(t.error=`Could not set uniform ${r} . No such uniform.`,!1):(t.context.uniform3iv(i,n),!0)},e.setUniform4f=(r,...n)=>{let i=e.findUniform(r);if(-1===i)return t.error=`Could not set uniform ${r} . No such uniform.`,!1;let a=n;if(1===a.length&&Array.isArray(a[0])&&(a=a[0]),4!==a.length)throw RangeError("Invalid number of values for array");return t.context.uniform4f(i,a[0],a[1],a[2],a[3]),!0},e.setUniform4fv=(r,n)=>{let i=e.findUniform(r);return -1===i?(t.error=`Could not set uniform ${r} . No such uniform.`,!1):(t.context.uniform4fv(i,n),!0)},e.setUniform4i=(r,...n)=>{let i=e.findUniform(r);if(-1===i)return t.error=`Could not set uniform ${r} . No such uniform.`,!1;let a=n;if(1===a.length&&Array.isArray(a[0])&&(a=a[0]),4!==a.length)throw RangeError("Invalid number of values for array");return t.context.uniform4i(i,a[0],a[1],a[2],a[3]),!0},e.setUniform4iv=(r,n)=>{let i=e.findUniform(r);return -1===i?(t.error=`Could not set uniform ${r} . No such uniform.`,!1):(t.context.uniform4iv(i,n),!0)},e.findUniform=e=>{if(!e||!t.linked)return -1;let r=t.uniformLocs[e];return void 0!==r?r:null===(r=t.context.getUniformLocation(t.handle,e))?(t.error=`Uniform ${e} not found in current shader program.`,t.uniformLocs[e]=-1,-1):(t.uniformLocs[e]=r,r)},e.isUniformUsed=e=>{if(!e)return!1;let r=t.uniformLocs[e];return void 0!==r?null!==r:t.linked?(r=t.context.getUniformLocation(t.handle,e),t.uniformLocs[e]=r,null!==r):(s("attempt to find uniform when the shader program is not linked"),!1)},e.isAttributeUsed=e=>{if(!e)return!1;if(e in t.attributeLocs)return!0;if(!t.linked)return s("attempt to find uniform when the shader program is not linked"),!1;let r=t.context.getAttribLocation(t.handle,e);return -1!==r&&(t.attributeLocs[e]=r,!0)},e.attachShader=r=>{if(0===r.getHandle())return t.error="Shader object was not initialized, cannot attach it.",!1;if("Unknown"===r.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;if(0===t.handle){let e=t.context.createProgram();if(0===e)return t.error="Could not create shader program.",!1;t.handle=e,t.linked=!1}return"Vertex"===r.getShaderType()&&(0!==t.vertexShaderHandle&&t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=r.getHandle()),"Fragment"===r.getShaderType()&&(0!==t.fragmentShaderHandle&&t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=r.getHandle()),t.context.attachShader(t.handle,r.getHandle()),e.setLinked(!1),!0},e.detachShader=e=>{if(0===e.getHandle())return t.error="shader object was not initialized, cannot attach it.",!1;if("Unknown"===e.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;switch(0===t.handle&&(t.error="This shader program has not been initialized yet."),e.getShaderType()){case"Vertex":if(t.vertexShaderHandle!==e.getHandle())return t.error="The supplied shader was not attached to this program.",!1;return t.context.detachShader(t.handle,e.getHandle()),t.vertexShaderHandle=0,t.linked=!1,!0;case"Fragment":if(t.fragmentShaderHandle!==e.getHandle())return t.error="The supplied shader was not attached to this program.",!1;return t.context.detachShader(t.handle,e.getHandle()),t.fragmentShaderHandle=0,t.linked=!1,!0;default:return!1}},e.setContext=e=>{t.context=e,t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.setLastCameraMTime=e=>{t.lastCameraMTime=e}}var c={newInstance:n.Ay.newInstance(u,"vtkShaderProgram"),extend:u,substitute:function(e,t,r,n){let i="string"==typeof r?r:r.join("\n"),a=!1===n?t:RegExp(t,"g"),o=e.replace(a,i);return{replace:o!==i,result:o}}}},9871:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(48548);function i(e,t){let r=(0,n.A)(e);return r.invert(),r.transformPoint(t)}},10037:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XLink=t.SVG=t.MathML=t.XMLNS=t.XML=t.HTML=void 0,t.HTML="http://www.w3.org/1999/xhtml",t.XML="http://www.w3.org/XML/1998/namespace",t.XMLNS="http://www.w3.org/2000/xmlns/",t.MathML="http://www.w3.org/1998/Math/MathML",t.SVG="http://www.w3.org/2000/svg",t.XLink="http://www.w3.org/1999/xlink"},10054:(e,t,r)=>{"use strict";r(29103),r(836),r(29201),r(88296),r(80039),r(64079),r(52046),r(16116),r(7957),r(79026);var n=r(17042),i=r(57236);r(10463);var a=r(3570),o=r(35666),s=r(59780),l=r(72867),u=r(40577),c=r(53014),d=r(74978),p={SINGLE:"single",DEPENDENT_LA:"dependent-la",DEPENDENT_RGB:"dependent-rgb",DEPENDENT_RGBA:"dependent-rgba",INDEPENDENT_1:"independent-1",INDEPENDENT_2:"independent-2",INDEPENDENT_3:"independent-3",INDEPENDENT_4:"independent-4"},m={IMAGE:0,COLOR_LUT:1,OPACITY_LUT:2,LABEL_OUTLINE_THICKNESS:3,LABEL_OUTLINE_OPACITY:4};function h(e,t){if(e)switch(t){case 1:return p.INDEPENDENT_1;case 2:return p.INDEPENDENT_2;case 3:return p.INDEPENDENT_3;default:return p.INDEPENDENT_4}switch(t){case 1:return p.SINGLE;case 2:return p.DEPENDENT_LA;case 3:return p.DEPENDENT_RGB;default:return p.DEPENDENT_RGBA}}function f(e,t="tfunRows"){return`${2*e+.5} / ${t}`}function g(e,t,r){if(t.apply(e)){let t=e.getIndependentComponents();return`${e.getMTime()}-${t}-${r}`}return"0"}var v=r(85250),y=r(5434),{vtkErrorMacro:b}=n.o$,{SlicingMode:I}=a.A,x=` +//VTK::Renderer::Dec + +//VTK::Mapper::Dec + +//VTK::TCoord::Dec + +//VTK::Image::Dec + +//VTK::Clip::Dec + +//VTK::RenderEncoder::Dec + +//VTK::IOStructs::Dec + +@fragment +fn main( +//VTK::IOStructs::Input +) +//VTK::IOStructs::Output +{ + var output: fragmentOutput; + + //VTK::Clip::Impl + + //VTK::Select::Impl + + //VTK::Image::Sample + + // var computedColor: vec4 = vec4(1.0,0.7, 0.5, 1.0); + + //VTK::Position::Impl + +//VTK::RenderEncoder::Impl + + return output; +} +`,C=new Float64Array(16),A=new Float64Array(16),T=new Float64Array(16),S=new Float64Array(3),w=new Float64Array(3),O=new Float64Array(4),P=new Float64Array(4),_={imageState:null,rowLength:1024};function E(e,t,r={}){Object.assign(t,_,r),l.Ay.extend(e,t,r),e.setFragmentShaderTemplate(x),t.UBO=u.Ay.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SCTCMatrix","mat4x4"),t.UBO.addEntry("Origin","vec4"),t.UBO.addEntry("Axis2","vec4"),t.UBO.addEntry("Axis1","vec4"),t.UBO.addEntry("cScale","vec4"),t.UBO.addEntry("cShift","vec4"),t.UBO.addEntry("oScale","vec4"),t.UBO.addEntry("oShift","vec4"),t.UBO.addEntry("componentWeight","vec4"),t.UBO.addEntry("Opacity","f32"),t.UBO.addEntry("CoincidentFactor","f32"),t.UBO.addEntry("CoincidentOffset","f32"),(0,c.G_)(t.UBO,"ClipPlane"),t.UBO.addEntry("NumClipPlanes","u32"),t.lutBuildTime={},(0,n.WL)(t.lutBuildTime,{mtime:0}),t.imagemat=v.identity(new Float64Array(16)),t.imagematinv=v.identity(new Float64Array(16)),t.cScale=new Float32Array(4),t.cShift=new Float32Array(4),t.oScale=new Float32Array(4),t.oShift=new Float32Array(4),t.componentWeight=new Float32Array(4),t.colorTmpTable=new Float32Array(3*t.rowLength),t.opacityTmpTable=new Float32Array(t.rowLength),t.colorLUTArray=null,t.opacityLUTArray=null,t.clipPlanes=Array.from({length:6},()=>[0,0,0,0]),t.VBOBuildTime={},(0,n.WL)(t.VBOBuildTime);t.classHierarchy.push("vtkWebGPUImageMapper"),e.ensureTextureSampler=(e,r)=>{e&&!function(e,t){let r=e?.getSampler?.();if(!r)return!1;let n=r.getOptions();return n.minFilter===t.minFilter&&n.magFilter===t.magFilter&&n.addressModeU===(t.addressModeU??"clamp-to-edge")&&n.addressModeV===(t.addressModeV??"clamp-to-edge")&&n.addressModeW===(t.addressModeW??"clamp-to-edge")}(e,r)&&e.addSampler(t.device,r)},e.computeImageState=()=>{let r=t.WebGPUImageSlice.getRenderable().getProperty(),n=e.getTextureViews()[m.IMAGE]?.getTexture().getNumberOfComponents()??1,i=r.getIndependentComponents();return{actorProperty:r,numberOfComponents:n,independentComponents:i,numberOfIComponents:i?n:1,useLabelOutline:r.getUseLabelOutline()&&!i&&1===n,textureChannelMode:h(i,n)}},e.getImageState=()=>t.imageState??e.computeImageState(),e.buildPass=r=>{if(r){t.WebGPUImageSlice=e.getFirstAncestorOfType("vtkWebGPUImageSlice"),t.WebGPURenderer=t.WebGPUImageSlice.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice();let r=t.WebGPURenderer.getRenderable();t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(r.getActiveCamera())}},e.translucentPass=t=>{t&&e.render()},e.zBufferPass=t=>{t&&e.render()},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.render=()=>{if(t.renderable.update(),t.currentInput=t.renderable.getCurrentImage(),!t.currentInput)return void b("No input!");e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw)},e.getCoincidentParameters=()=>t.renderable.getResolveCoincidentTopology()==i.XK.PolygonOffset?t.renderable.getCoincidentTopologyPolygonOffsetParameters():{factor:0,offset:0},e.computePipelineHash=()=>{let r=t.currentInput.getExtent(),n=e.getImageState();r[0]===r[1]||r[2]===r[3]||r[4]===r[5]?(t.dimensions=2,t.pipelineHash="img2"):(t.dimensions=3,t.pipelineHash="img3"),t.pipelineHash+=n.textureChannelMode,n.useLabelOutline&&(t.pipelineHash+="outline"),t.pipelineHash+=t.renderEncoder.getPipelineHash()},e.updateUBO=()=>{let r=t.UBO.getSendTime(),n=t.WebGPUImageSlice.getRenderable(),i=n.getMapper(),a=t.renderable.getClippingPlanesMTime();if(e.getMTime()>r||t.renderable.getMTime()>r||n.getProperty().getMTime()>r||a>r){let r=i.getCurrentImage(),a=t.WebGPURenderer.getStabilizedCenterByReference();v.identity(C),v.translate(C,C,a);let o=n.getMatrix();v.transpose(A,o),v.invert(A,A),v.multiply(C,A,C);let s=r.getWorldToIndex();v.multiply(C,s,C),v.invert(T,C),S[0]=.5,S[1]=.5,S[2]=.5,v.fromTranslation(A,S),v.multiply(C,A,C);let l=r.getDimensions();v.identity(A),w[0]=1/l[0],w[1]=1/l[1],w[2]=1/l[2],v.scale(A,A,w),v.multiply(C,A,C),t.UBO.setArray("SCTCMatrix",C);let u=t.currentInput.getExtent(),{ijkMode:d}=t.renderable.getClosestIJKAxis(),p=t.renderable.getSlice();d!==t.renderable.getSlicingMode()&&(p=t.renderable.getSliceAtPosition(p));let m=2,h=0,f=1;d===I.I?(m=0,h=1,f=2):d===I.J&&(m=1,h=2,f=0),O[m]=p,O[h]=u[2*h]-.5,O[f]=u[2*f]-.5,O[3]=1,y.Z0(O,O,T),t.UBO.setArray("Origin",O),P[m]=p,P[h]=u[2*h+1]+.5,P[f]=u[2*f]-.5,P[3]=1,y.Z0(P,P,T),y.Re(P,P,O),P[3]=1,t.UBO.setArray("Axis1",P),P[m]=p,P[h]=u[2*h]-.5,P[f]=u[2*f+1]+.5,P[3]=1,y.Z0(P,P,T),y.Re(P,P,O),P[3]=1,t.UBO.setArray("Axis2",P);let{cScale:g,cShift:b,oScale:x,oShift:_,componentWeight:E}=t;g[0]=1,g[1]=1,g[2]=1,g[3]=1,b[0]=0,b[1]=0,b[2]=0,b[3]=0,x[0]=1,x[1]=1,x[2]=1,x[3]=1,_[0]=0,_[1]=0,_[2]=0,_[3]=0,E[0]=1,E[1]=1,E[2]=1,E[3]=1;let D=t.textureViews[0].getTexture().getScale(),{numberOfComponents:R,independentComponents:M}=e.getImageState(),N=n.getProperty();for(let e=0;e0){v.fromTranslation(A,[-a[0],-a[1],-a[2]]),(0,c.Z6)(t.renderable,A,t.clipPlanes);for(let e=0;e{let r=e.getImageState(),{actorProperty:n}=r,i=r.numberOfIComponents,a=g(n,n.getRGBTransferFunction,i);if(t.colorTextureString!==a){t.numRows=i;let r=2*t.numRows*t.rowLength*4;t.colorLUTArray&&t.colorLUTArray.length===r||(t.colorLUTArray=new Uint8ClampedArray(r));let o=t.colorLUTArray,s=n.getRGBTransferFunction();if(s){let e=t.colorTmpTable;for(let r=0;r{let r=e.getImageState(),{actorProperty:n}=r,i=r.numberOfIComponents;t.numRows=i;let a=g(n,n.getPiecewiseFunction,i);if(t.opacityTextureString!==a){let r=2*t.numRows*t.rowLength;t.opacityLUTArray&&t.opacityLUTArray.length===r||(t.opacityLUTArray=new Float32Array(r));let o=t.opacityLUTArray,s=t.opacityTmpTable;for(let e=0;e{let r=t.WebGPUImageSlice.getRenderable().getProperty().getLabelOutlineThicknessByReference(),n=Math.max(1,t.renderable.getLabelOutlineTextureWidth()),i=`${r.join("-")}-${n}`;if(t.labelOutlineThicknessString!==i){let a=new Uint8Array(n);for(let e=0;e{let r=t.WebGPUImageSlice.getRenderable().getProperty().getLabelOutlineOpacity(),n=Array.isArray(r)?r:[r],i=Math.max(1,t.renderable.getLabelOutlineTextureWidth()),a=`${n.join("-")}-${i}`;if(t.labelOutlineOpacityString!==a){let r=new Float32Array(i);for(let e=0;e{a();let r=t.device.getTextureManager().getTextureForImageData(t.currentInput),n=t.textureViews;if(!n[m.IMAGE]||n[m.IMAGE].getTexture()!==r){let t=r.createView("imgTexture");e.ensureTextureSampler(t,{minFilter:"linear",magFilter:"linear"}),n[m.IMAGE]=t}t.imageState=e.computeImageState(),e.updateLUTImage(),e.updateOpacityLUTImage(),t.imageState.useLabelOutline?(e.updateLabelOutlineThicknessTexture(),e.updateLabelOutlineOpacityTexture()):t.textureViews.length=Math.min(t.textureViews.length,m.OPACITY_LUT+1),e.updateUBO();let i=t.WebGPUImageSlice.getRenderable().getProperty().getInterpolationType()===o.V.NEAREST?"nearest":"linear";e.ensureTextureSampler(n[m.IMAGE],{minFilter:i,magFilter:i})};let d=e.getShaderReplacements();e.replaceShaderPosition=(e,r,n)=>{let i=r.getShaderDescription("vertex");i.addBuiltinOutput("vec4","@builtin(position) Position"),i.addOutput("vec4","vertexSC");let a=i.getCode(),o=["var pos: vec4 = mapperUBO.Origin +"," (vertexBC.x * 0.5 + 0.5) * mapperUBO.Axis1 + (vertexBC.y * 0.5 + 0.5) * mapperUBO.Axis2;","pos.w = 1.0;"];2===t.dimensions?o.push("var tcoord : vec2 = (mapperUBO.SCTCMatrix * pos).xy;"):o.push("var tcoord : vec3 = (mapperUBO.SCTCMatrix * pos).xyz;"),o.push("pos = rendererUBO.SCPCMatrix * pos;","pos.z = clamp(pos.z - 0.000016 * mapperUBO.CoincidentOffset * pos.w, 0.0, pos.w);","output.tcoordVS = tcoord;","output.vertexSC = pos;","output.Position = rendererUBO.SCPCMatrix * pos;"),a=s.Ay.substitute(a,"//VTK::Position::Impl",o).result,i.setCode(a)},d.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,r,n)=>{let i=r.getShaderDescription("vertex");2===t.dimensions?i.addOutput("vec2","tcoordVS"):i.addOutput("vec3","tcoordVS")},d.set("replaceShaderTCoord",e.replaceShaderTCoord),e.replaceShaderImage=(r,n,i)=>{let a=n.getShaderDescription("fragment"),o=a.getCode(),l=e.getImageState();switch(o=s.Ay.substitute(o,"//VTK::Image::Sample",[" var computedColor: vec4 ="," textureSampleLevel(imgTexture, imgTextureSampler, input.tcoordVS, 0.0);","//VTK::Image::Sample"]).result,l.textureChannelMode){case p.SINGLE:if(l.useLabelOutline){let e=3===t.dimensions?[" let centerCoord: vec3 = input.tcoordVS;"," let stepX: vec3 = dpdx(input.tcoordVS);"," let stepY: vec3 = dpdy(input.tcoordVS);"," let clampMin: vec3 = vec3(0.0);"," let clampMax: vec3 = vec3(1.0);"]:[" let centerCoord: vec2 = input.tcoordVS;"," let stepX: vec2 = dpdx(input.tcoordVS);"," let stepY: vec2 = dpdy(input.tcoordVS);"," let clampMin: vec2 = vec2(0.0);"," let clampMax: vec2 = vec2(1.0);"];o=s.Ay.substitute(o,"//VTK::Image::Sample",[...e," let centerValue: f32 = textureSampleLevel("," imgTexture,"," imgTextureSampler,"," centerCoord,"," 0.0).r;"," let segmentIndex: i32 = i32(round(centerValue * 255.0));"," if (segmentIndex == 0) {"," computedColor = vec4(0.0);"," } else {"," let colorCoord: vec2 = vec2("," centerValue * mapperUBO.cScale.r + mapperUBO.cShift.r,"," 0.5);"," let tColor: vec4 ="," textureSampleLevel(tfunTexture, tfunTextureSampler, colorCoord, 0.0);"," let opacityCoord: vec2 = vec2("," centerValue * mapperUBO.oScale.r + mapperUBO.oShift.r,"," 0.5);"," let scalarOpacity: f32 ="," textureSampleLevel(ofunTexture, ofunTextureSampler, opacityCoord, 0.0).r;"," let outlineWidth: i32 = i32(textureDimensions(labelOutlineTexture).x);"," let outlineIndex: i32 = clamp(segmentIndex - 1, 0, outlineWidth - 1);"," let outlineCoord: vec2 = vec2("," (f32(outlineIndex) + 0.5) / f32(outlineWidth),"," 0.5);"," let thicknessValue: f32 = textureSampleLevel("," labelOutlineTexture,"," labelOutlineTextureSampler,"," outlineCoord,"," 0.0).r;"," let outlineOpacity: f32 = textureSampleLevel("," labelOutlineOpacityTexture,"," labelOutlineOpacityTextureSampler,"," outlineCoord,"," 0.0).r;"," let actualThickness: i32 = i32(round(thicknessValue * 255.0));"," var pixelOnBorder: bool = false;"," if (actualThickness > 0) {"," for (var i: i32 = -actualThickness; i <= actualThickness; i++) {"," for (var j: i32 = -actualThickness; j <= actualThickness; j++) {"," if (i == 0 && j == 0) {"," continue;"," }"," let neighborCoord = clamp("," centerCoord + f32(i) * stepX + f32(j) * stepY,"," clampMin,"," clampMax);"," let neighborValue: f32 = textureSampleLevel("," imgTexture,"," imgTextureSampler,"," neighborCoord,"," 0.0).r;"," if (neighborValue != centerValue) {"," pixelOnBorder = true;"," break;"," }"," }"," if (pixelOnBorder) {"," break;"," }"," }"," }"," if (pixelOnBorder) {"," computedColor = vec4(tColor.rgb, outlineOpacity);"," } else {"," computedColor = vec4("," tColor.rgb,"," scalarOpacity * mapperUBO.Opacity);"," }"," }"]).result}else o=s.Ay.substitute(o,"//VTK::Image::Sample",[" let scalar: f32 = computedColor.r;"," var colorCoord: vec2 ="," vec2(scalar * mapperUBO.cScale.r + mapperUBO.cShift.r, 0.5);"," let tColor: vec4 ="," textureSampleLevel(tfunTexture, tfunTextureSampler, colorCoord, 0.0);"," var opacityCoord: vec2 ="," vec2(scalar * mapperUBO.oScale.r + mapperUBO.oShift.r, 0.5);"," let scalarOpacity: f32 ="," textureSampleLevel(ofunTexture, ofunTextureSampler, opacityCoord, 0.0).r;"," computedColor = vec4(tColor.rgb, scalarOpacity * mapperUBO.Opacity);"]).result;break;case p.INDEPENDENT_1:o=s.Ay.substitute(o,"//VTK::Image::Sample",[" let tfunRows: f32 = f32(textureDimensions(tfunTexture).y);"," let scalar: f32 = computedColor.r;",` let rowCoord: f32 = ${f(0)};`," let colorCoord: vec2 ="," vec2(scalar * mapperUBO.cScale.r + mapperUBO.cShift.r, rowCoord);"," let tColor: vec4 ="," textureSampleLevel(tfunTexture, tfunTextureSampler, colorCoord, 0.0);"," computedColor = vec4("," tColor.rgb * mapperUBO.componentWeight.r,"," mapperUBO.Opacity);"]).result;break;case p.INDEPENDENT_2:o=s.Ay.substitute(o,"//VTK::Image::Sample",[" let tfunRows: f32 = f32(textureDimensions(tfunTexture).y);"," // Independent component LUT rows are duplicated, so sample the"," // center of row 2 * componentIndex for each component."," let rawColor: vec4 = computedColor;",` let rowCoord0: f32 = ${f(0)};`,` let rowCoord1: f32 = ${f(1)};`," let scalar0: f32 = rawColor.r;"," let scalar1: f32 = rawColor.g;"," let color0: vec3 = mapperUBO.componentWeight.r *"," textureSampleLevel("," tfunTexture,"," tfunTextureSampler,"," vec2(scalar0 * mapperUBO.cScale.r + mapperUBO.cShift.r, rowCoord0),"," 0.0).rgb;"," let color1: vec3 = mapperUBO.componentWeight.g *"," textureSampleLevel("," tfunTexture,"," tfunTextureSampler,"," vec2(scalar1 * mapperUBO.cScale.g + mapperUBO.cShift.g, rowCoord1),"," 0.0).rgb;"," let weight0: f32 = mapperUBO.componentWeight.r *"," textureSampleLevel("," ofunTexture,"," ofunTextureSampler,"," vec2(scalar0 * mapperUBO.oScale.r + mapperUBO.oShift.r, rowCoord0),"," 0.0).r;"," let weight1: f32 = mapperUBO.componentWeight.g *"," textureSampleLevel("," ofunTexture,"," ofunTextureSampler,"," vec2(scalar1 * mapperUBO.oScale.g + mapperUBO.oShift.g, rowCoord1),"," 0.0).r;"," let weightSum: f32 = max(weight0 + weight1, 1.0e-6);"," computedColor = vec4("," color0 * (weight0 / weightSum) + color1 * (weight1 / weightSum),"," mapperUBO.Opacity);"]).result;break;case p.INDEPENDENT_3:o=s.Ay.substitute(o,"//VTK::Image::Sample",[" let tfunRows: f32 = f32(textureDimensions(tfunTexture).y);"," let rawColor: vec4 = computedColor;",` let rowCoord0: f32 = ${f(0)};`,` let rowCoord1: f32 = ${f(1)};`,` let rowCoord2: f32 = ${f(2)};`," let scalar0: f32 = rawColor.r;"," let scalar1: f32 = rawColor.g;"," let scalar2: f32 = rawColor.b;"," let color0: vec3 = mapperUBO.componentWeight.r *"," textureSampleLevel("," tfunTexture,"," tfunTextureSampler,"," vec2(scalar0 * mapperUBO.cScale.r + mapperUBO.cShift.r, rowCoord0),"," 0.0).rgb;"," let color1: vec3 = mapperUBO.componentWeight.g *"," textureSampleLevel("," tfunTexture,"," tfunTextureSampler,"," vec2(scalar1 * mapperUBO.cScale.g + mapperUBO.cShift.g, rowCoord1),"," 0.0).rgb;"," let color2: vec3 = mapperUBO.componentWeight.b *"," textureSampleLevel("," tfunTexture,"," tfunTextureSampler,"," vec2(scalar2 * mapperUBO.cScale.b + mapperUBO.cShift.b, rowCoord2),"," 0.0).rgb;"," let weight0: f32 = mapperUBO.componentWeight.r *"," textureSampleLevel("," ofunTexture,"," ofunTextureSampler,"," vec2(scalar0 * mapperUBO.oScale.r + mapperUBO.oShift.r, rowCoord0),"," 0.0).r;"," let weight1: f32 = mapperUBO.componentWeight.g *"," textureSampleLevel("," ofunTexture,"," ofunTextureSampler,"," vec2(scalar1 * mapperUBO.oScale.g + mapperUBO.oShift.g, rowCoord1),"," 0.0).r;"," let weight2: f32 = mapperUBO.componentWeight.b *"," textureSampleLevel("," ofunTexture,"," ofunTextureSampler,"," vec2(scalar2 * mapperUBO.oScale.b + mapperUBO.oShift.b, rowCoord2),"," 0.0).r;"," let weightSum: f32 = max(weight0 + weight1 + weight2, 1.0e-6);"," computedColor = vec4("," color0 * (weight0 / weightSum) + color1 * (weight1 / weightSum) + color2 * (weight2 / weightSum),"," mapperUBO.Opacity);"]).result;break;case p.INDEPENDENT_4:o=s.Ay.substitute(o,"//VTK::Image::Sample",[" let tfunRows: f32 = f32(textureDimensions(tfunTexture).y);"," let rawColor: vec4 = computedColor;",` let rowCoord0: f32 = ${f(0)};`,` let rowCoord1: f32 = ${f(1)};`,` let rowCoord2: f32 = ${f(2)};`,` let rowCoord3: f32 = ${f(3)};`," let scalar0: f32 = rawColor.r;"," let scalar1: f32 = rawColor.g;"," let scalar2: f32 = rawColor.b;"," let scalar3: f32 = rawColor.a;"," let color0: vec3 = mapperUBO.componentWeight.r *"," textureSampleLevel("," tfunTexture,"," tfunTextureSampler,"," vec2(scalar0 * mapperUBO.cScale.r + mapperUBO.cShift.r, rowCoord0),"," 0.0).rgb;"," let color1: vec3 = mapperUBO.componentWeight.g *"," textureSampleLevel("," tfunTexture,"," tfunTextureSampler,"," vec2(scalar1 * mapperUBO.cScale.g + mapperUBO.cShift.g, rowCoord1),"," 0.0).rgb;"," let color2: vec3 = mapperUBO.componentWeight.b *"," textureSampleLevel("," tfunTexture,"," tfunTextureSampler,"," vec2(scalar2 * mapperUBO.cScale.b + mapperUBO.cShift.b, rowCoord2),"," 0.0).rgb;"," let color3: vec3 = mapperUBO.componentWeight.a *"," textureSampleLevel("," tfunTexture,"," tfunTextureSampler,"," vec2(scalar3 * mapperUBO.cScale.a + mapperUBO.cShift.a, rowCoord3),"," 0.0).rgb;"," let weight0: f32 = mapperUBO.componentWeight.r *"," textureSampleLevel("," ofunTexture,"," ofunTextureSampler,"," vec2(scalar0 * mapperUBO.oScale.r + mapperUBO.oShift.r, rowCoord0),"," 0.0).r;"," let weight1: f32 = mapperUBO.componentWeight.g *"," textureSampleLevel("," ofunTexture,"," ofunTextureSampler,"," vec2(scalar1 * mapperUBO.oScale.g + mapperUBO.oShift.g, rowCoord1),"," 0.0).r;"," let weight2: f32 = mapperUBO.componentWeight.b *"," textureSampleLevel("," ofunTexture,"," ofunTextureSampler,"," vec2(scalar2 * mapperUBO.oScale.b + mapperUBO.oShift.b, rowCoord2),"," 0.0).r;"," let weight3: f32 = mapperUBO.componentWeight.a *"," textureSampleLevel("," ofunTexture,"," ofunTextureSampler,"," vec2(scalar3 * mapperUBO.oScale.a + mapperUBO.oShift.a, rowCoord3),"," 0.0).r;"," let weightSum: f32 = max(weight0 + weight1 + weight2 + weight3, 1.0e-6);"," computedColor = vec4("," color0 * (weight0 / weightSum) + color1 * (weight1 / weightSum) + color2 * (weight2 / weightSum) + color3 * (weight3 / weightSum),"," mapperUBO.Opacity);"]).result;break;case p.DEPENDENT_LA:o=s.Ay.substitute(o,"//VTK::Image::Sample",[" let rawColor: vec4 = computedColor;"," let intensity: f32 = rawColor.r * mapperUBO.cScale.r + mapperUBO.cShift.r;"," let tColor: vec4 ="," textureSampleLevel(tfunTexture, tfunTextureSampler, vec2(intensity, 0.5), 0.0);"," computedColor = vec4("," tColor.rgb,"," rawColor.g * mapperUBO.oScale.r + mapperUBO.oShift.r);"]).result;break;case p.DEPENDENT_RGB:o=s.Ay.substitute(o,"//VTK::Image::Sample",[" let rawColor: vec4 ="," computedColor * vec4(mapperUBO.cScale.x) + vec4(mapperUBO.cShift.x);"," computedColor = vec4("," textureSampleLevel(tfunTexture, tfunTextureSampler, vec2(rawColor.r, 0.5), 0.0).r,"," textureSampleLevel(tfunTexture, tfunTextureSampler, vec2(rawColor.g, 0.5), 0.0).r,"," textureSampleLevel(tfunTexture, tfunTextureSampler, vec2(rawColor.b, 0.5), 0.0).r,"," mapperUBO.Opacity);"]).result;break;case p.DEPENDENT_RGBA:o=s.Ay.substitute(o,"//VTK::Image::Sample",[" let rawColor: vec4 ="," computedColor * vec4(mapperUBO.cScale.x) + vec4(mapperUBO.cShift.x);"," computedColor = vec4("," textureSampleLevel(tfunTexture, tfunTextureSampler, vec2(rawColor.r, 0.5), 0.0).r,"," textureSampleLevel(tfunTexture, tfunTextureSampler, vec2(rawColor.g, 0.5), 0.0).r,"," textureSampleLevel(tfunTexture, tfunTextureSampler, vec2(rawColor.b, 0.5), 0.0).r,"," rawColor.a);"]).result;break;default:o=s.Ay.substitute(o,"//VTK::Image::Sample",[" let scalar: f32 = computedColor.r;"," var colorCoord: vec2 ="," vec2(scalar * mapperUBO.cScale.r + mapperUBO.cShift.r, 0.5);"," computedColor = textureSampleLevel(tfunTexture, tfunTextureSampler, colorCoord, 0.0);"]).result}a.setCode(o)},d.set("replaceShaderImage",e.replaceShaderImage),e.replaceShaderClip=(e,t,r)=>{let n=t.getShaderDescription("fragment"),i=n.getCode(),a=(0,c.JE)({countName:"mapperUBO.NumClipPlanes",planePrefix:"mapperUBO.ClipPlane",positionName:"input.vertexSC"});i=s.Ay.substitute(i,"//VTK::Clip::Impl",[...a,"//VTK::Clip::Impl"]).result,n.setCode(i)},d.set("replaceShaderClip",e.replaceShaderClip),e.replaceShaderCoincidentOffset=(e,t,r)=>{let n=t.getShaderDescription("fragment");if(!n)return;n.addBuiltinInput("vec4","@builtin(position) fragPos"),n.addBuiltinOutput("f32","@builtin(frag_depth) fragDepth");let i=n.getCode();i=s.Ay.substitute(i,"//VTK::Position::Impl",[" var coincidentDepth: f32 = input.fragPos.z;"," if (mapperUBO.CoincidentFactor != 0.0) {"," let cscale = length(vec2(dpdx(input.fragPos.z), dpdy(input.fragPos.z)));"," coincidentDepth = coincidentDepth - mapperUBO.CoincidentFactor * cscale;"," }"," output.fragDepth = clamp(coincidentDepth, 0.0, 1.0);"]).result,n.setCode(i)},d.set("replaceShaderCoincidentOffset",e.replaceShaderCoincidentOffset),e.replaceShaderSelect=(e,t,r)=>{let n=t.getShaderDescription("fragment");if(!n)return;let i=n.getCode();i=s.Ay.substitute(i,"//VTK::Select::Impl",[" var compositeID: u32 = 0u;"," var attributeID: u32 = 0u;"]).result,n.setCode(i)},d.set("replaceShaderSelect",e.replaceShaderSelect)}var D=(0,n.UI)(E,"vtkWebGPUImageMapper"),R={extend:E};(0,d.c9)("vtkAbstractImageMapper",D);var M=r(72188),N={bufferShift:void 0,keyMatrixTime:null,keyMatrices:null,propID:void 0},V=(0,n.UI)(function(e,t,r={}){Object.assign(t,N,r),M.A.extend(e,t,r),t.keyMatricesTime={},(0,n.WL)(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},t.keyMatrixTime={},(0,n.WL)(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:v.identity(new Float64Array(16))},t.bufferShift=[0,0,0,0],(0,n.Jt)(e,t,["propID","keyMatricesTime"]),t.classHierarchy.push("vtkWebGPUImageSlice"),e.buildPass=r=>{t.renderable&&t.renderable.getVisibility()&&r&&t.renderable&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.traverseZBufferPass=r=>{!t.renderable||!t.renderable.getNestedVisibility()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(r,!0),t.children.forEach(e=>{e.traverse(r)}),e.apply(r,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=r=>{!t.renderable||!t.renderable.getNestedVisibility()||!t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(r,!0),t.children.forEach(e=>{e.traverse(r)}),e.apply(r,!1))},e.traverseTranslucentPass=r=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(r,!0),t.children.forEach(e=>{e.traverse(r)}),e.apply(r,!1))},e.queryPass=(e,r)=>{e&&t.renderable&&t.renderable.getVisibility()&&(t.renderable.getIsOpaque()?r.incrementOpaqueActorCount():r.incrementTranslucentActorCount())},e.getBufferShift=r=>(e.getKeyMatrices(r),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();let r=t.renderable.getMatrix(),n=e.getStabilizedCenterByReference();t.bufferShift[0]=r[3]-n[0],t.bufferShift[1]=r[7]-n[1],t.bufferShift[2]=r[11]-n[2],v.transpose(t.keyMatrices.bcwc,r),t.renderable.getIsIdentity()?v.identity(t.keyMatrices.normalMatrix):(v.copy(t.keyMatrices.normalMatrix,t.keyMatrices.bcwc),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,v.invert(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),v.transpose(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),v.translate(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),v.translate(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-n[0],-n[1],-n[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}},"vtkWebGPUImageSlice");(0,d.c9)("vtkImageSlice",V),r(94065),r(47858);var L={propID:void 0,keyMatricesTime:null},B=n.Ay.newInstance(function(e,t,r={}){Object.assign(t,L,r),M.A.extend(e,t,r),t.keyMatricesTime={},n.Ay.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={bcwc:new Float64Array(16),bcsc:new Float64Array(16)},n.Ay.get(e,t,["propID","keyMatricesTime"]);t.classHierarchy.push("vtkWebGPUVolume"),e.buildPass=r=>{t.renderable&&t.renderable.getVisibility()&&r&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),t.renderable.getMapper().update())},e.queryPass=(r,n)=>{if(r){if(!t.renderable||!t.renderable.getVisibility())return;let r=t.renderable.getMapper().getBounds();r&&6===r.length&&!(r[0]>r[1])&&n.addVolume(e)}};let i=new Float64Array(3),a=new Float64Array(3);e.getBoundingCubePoints=(e,r)=>{let n=t.renderable.getMapper().getInputData();if(!n)return;let o=n.getExtent(),s=t.renderable.getMatrix(),l=0;for(let t=4;t<6;t++){i[2]=o[t];for(let t=2;t<4;t++){i[1]=o[t];for(let t=0;t<2;t++){i[0]=o[t],n.indexToWorld(i,a);let u=r+3*l;e[u++]=s[0]*a[0]+s[1]*a[1]+s[2]*a[2]+s[3],e[u++]=s[4]*a[0]+s[5]*a[1]+s[6]*a[2]+s[7],e[u++]=s[8]*a[0]+s[9]*a[1]+s[10]*a[2]+s[11],l++}}}},e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();let r=t.renderable.getMatrix(),n=e.getStabilizedCenterByReference();v.transpose(t.keyMatrices.bcwc,r),v.translate(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-n[0],-n[1],-n[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}},"vtkWebGPUVolume");(0,d.c9)("vtkVolume",B);var F=r(44293),U=r(51555),k=r(44238),G=r(53163),{BufferUsage:W}=k.Ay,z=` +//VTK::Renderer::Dec + +//VTK::Mapper::Dec + +//VTK::IOStructs::Dec + +@vertex +fn main( +//VTK::IOStructs::Input +) +//VTK::IOStructs::Output +{ + var output : vertexOutput; + + //VTK::ImageCPR::Impl + + return output; +} +`,H=` +//VTK::Renderer::Dec + +//VTK::Mapper::Dec + +//VTK::Clip::Dec + +//VTK::Coincident::Dec + +//VTK::RenderEncoder::Dec + +//VTK::IOStructs::Dec + +fn applyQuaternionToVec(q: vec4, v: vec3) -> vec3 +{ + let uv = cross(q.xyz, v); + let uuv = cross(q.xyz, uv); + return v + (2.0 * q.w) * uv + 2.0 * uuv; +} + +fn quaternionLerpOrSlerp(q0In: vec4, q1In: vec4, t: f32) -> vec4 +{ + var q0 = normalize(q0In); + var q1 = normalize(q1In); + var cosAngle = dot(q0, q1); + if (cosAngle < 0.0) + { + q1 = -q1; + cosAngle = -cosAngle; + } + if (cosAngle > 0.999) + { + return normalize((1.0 - t) * q0 + t * q1); + } + let omega = acos(cosAngle); + let sinOmega = max(sin(omega), 0.000001); + let w0 = sin((1.0 - t) * omega) / sinOmega; + let w1 = sin(t * omega) / sinOmega; + return normalize(w0 * q0 + w1 * q1); +} + +fn getComponent(v: vec4, idx: u32) -> f32 +{ + if (idx == 0u) { return v.x; } + if (idx == 1u) { return v.y; } + if (idx == 2u) { return v.z; } + return v.w; +} + +fn sampleColorTF(value: f32) -> vec4 +{ + return textureSampleLevel(colorTexture, cprSampler, vec2(value, 0.5), 0.0); +} + +fn sampleScalarColor(value: f32) -> vec3 +{ + return sampleColorTF(value).rgb; +} + +fn sampleColorRow(value: f32, row: f32) -> vec4 +{ + return textureSampleLevel(colorTexture, cprSampler, vec2(value, row), 0.0); +} + +fn sampleOpacityRow(value: f32, row: f32) -> f32 +{ + return textureSampleLevel(pwfTexture, cprSampler, vec2(value, row), 0.0).r; +} + +fn getProjectedValue(volumePosTC: vec3, projectionDirection: vec3) -> vec4 +{ + let scaledDirection = + (mapperUBO.MCTCMatrix * vec4(projectionDirection, 0.0)).xyz; + let projectionStep = mapperUBO.ProjectionParams.z * scaledDirection; + let projectionStart = volumePosTC + mapperUBO.ProjectionParams.y * scaledDirection; + + var tvalue = vec4(0.0); + if (mapperUBO.ProjectionMode == ${G.v.MIN}u) + { + tvalue = vec4(1.0); + } + + for (var projectionSampleIdx: u32 = 0u; + projectionSampleIdx < mapperUBO.ProjectionSamples; + projectionSampleIdx = projectionSampleIdx + 1u) + { + let projectionSamplePosition = + projectionStart + f32(projectionSampleIdx) * projectionStep; + let sampledTextureValue = + textureSampleLevel(volumeTexture, cprSampler, projectionSamplePosition, 0.0); + + if (mapperUBO.ProjectionMode == ${G.v.MAX}u) + { + tvalue = max(tvalue, sampledTextureValue); + } + else if (mapperUBO.ProjectionMode == ${G.v.MIN}u) + { + tvalue = min(tvalue, sampledTextureValue); + } + else + { + tvalue = tvalue + sampledTextureValue; + } + } + + if (mapperUBO.ProjectionMode == ${G.v.AVERAGE}u) + { + tvalue = tvalue / max(f32(mapperUBO.ProjectionSamples), 1.0); + } + return tvalue; +} + +@fragment +fn main( +//VTK::IOStructs::Input +) +//VTK::IOStructs::Output +{ + var output : fragmentOutput; + + var interpolatedOrientation = mapperUBO.UniformOrientation; + if (mapperUBO.UseUniformOrientation == 0u) + { + interpolatedOrientation = quaternionLerpOrSlerp( + input.centerlineBottomOrientationVS, + input.centerlineTopOrientationVS, + input.quadOffsetVS.y + ); + } + let samplingDirection = applyQuaternionToVec( + interpolatedOrientation, + mapperUBO.TangentDirection.xyz + ); + let projectionDirection = applyQuaternionToVec( + interpolatedOrientation, + mapperUBO.BitangentDirection.xyz + ); + + var horizontalOffset = input.quadOffsetVS.x; + if (mapperUBO.UseCenterPoint != 0u) + { + let baseOffset = dot( + samplingDirection, + mapperUBO.GlobalCenterPoint.xyz - input.centerlinePosVS + ); + horizontalOffset = horizontalOffset + baseOffset; + } + + let volumePosMC = input.centerlinePosVS + horizontalOffset * samplingDirection; + //VTK::Clip::Impl + let volumePosTC = + (mapperUBO.MCTCMatrix * vec4(volumePosMC, 1.0)).xyz; + + if (any(volumePosTC < vec3(0.0)) || any(volumePosTC > vec3(1.0))) + { + var computedColor = mapperUBO.BackgroundColor; + //VTK::RenderEncoder::Impl + return output; + } + + var tvalue = textureSampleLevel(volumeTexture, cprSampler, volumePosTC, 0.0); + if (mapperUBO.ProjectionSamples > 1u) + { + tvalue = getProjectedValue(volumePosTC, projectionDirection); + } + + var computedColor = vec4(0.0); + if (mapperUBO.IndependentComponents != 0u) + { + var sumColor = vec3(0.0); + var sumWeight = 0.0; + for (var c: u32 = 0u; c < mapperUBO.NumComponents; c = c + 1u) + { + let row = (f32(c) + 0.5) / max(f32(mapperUBO.NumComponents), 1.0); + let componentValue = getComponent(tvalue, c); + let lutValue = componentValue * getComponent(mapperUBO.CScale, c) + + getComponent(mapperUBO.CShift, c); + let opacityValue = componentValue * getComponent(mapperUBO.PWFScale, c) + + getComponent(mapperUBO.PWFShift, c); + let componentMix = getComponent(mapperUBO.ComponentMix, c); + let color = sampleColorRow(lutValue, row).rgb; + let weight = componentMix * sampleOpacityRow(opacityValue, row); + sumColor = sumColor + weight * color; + sumWeight = sumWeight + weight; + } + + let finalColor = select(sumColor, sumColor / max(sumWeight, 0.000001), sumWeight > 0.0); + if (mapperUBO.NumComponents == 1u) + { + computedColor = vec4(finalColor, sumWeight * mapperUBO.Opacity); + } + else + { + computedColor = vec4(finalColor, mapperUBO.Opacity); + } + } + else if (mapperUBO.NumComponents == 1u) + { + let intensity = tvalue.r; + let lutValue = intensity * mapperUBO.CScale.x + mapperUBO.CShift.x; + let opacityValue = intensity * mapperUBO.PWFScale.x + mapperUBO.PWFShift.x; + computedColor = vec4( + sampleScalarColor(lutValue), + sampleOpacityRow(opacityValue, 0.5) * mapperUBO.Opacity + ); + } + else if (mapperUBO.NumComponents == 2u) + { + let intensity = tvalue.r * mapperUBO.CScale.x + mapperUBO.CShift.x; + computedColor = vec4( + sampleScalarColor(intensity), + mapperUBO.PWFScale.x * tvalue.g + mapperUBO.PWFShift.x + ); + } + else if (mapperUBO.NumComponents == 3u) + { + let tcolor = mapperUBO.CScale * tvalue + mapperUBO.CShift; + computedColor = vec4( + sampleColorTF(tcolor.r).r, + sampleColorTF(tcolor.g).r, + sampleColorTF(tcolor.b).r, + mapperUBO.Opacity + ); + } + else + { + let tcolor = mapperUBO.CScale * tvalue + mapperUBO.CShift; + computedColor = vec4( + sampleColorTF(tcolor.r).r, + sampleColorTF(tcolor.g).r, + sampleColorTF(tcolor.b).r, + tcolor.a + ); + } + + //VTK::Select::Impl + //VTK::Coincident::Impl + //VTK::RenderEncoder::Impl + return output; +} +`,j=new Float64Array(16),$=new Float64Array(16),K=[0,0,0,1],q=[0,1,3,0,3,2],X={rowLength:1024,currentImageDataInput:null,currentCenterlineInput:null,colorTextureString:null,pwfTextureString:null,cprSampler:null},Y=n.Ay.newInstance(function(e,t,r={}){Object.assign(t,X,r),F.Ay.extend(e,t,r),e.setVertexShaderTemplate(z),e.setFragmentShaderTemplate(H),t.UBO=u.Ay.newInstance({label:"mapperUBO"}),t.UBO.addEntry("BCSCMatrix","mat4x4"),t.UBO.addEntry("MCTCMatrix","mat4x4"),t.UBO.addEntry("BackgroundColor","vec4"),t.UBO.addEntry("GlobalCenterPoint","vec4"),t.UBO.addEntry("UniformOrientation","vec4"),t.UBO.addEntry("TangentDirection","vec4"),t.UBO.addEntry("BitangentDirection","vec4"),t.UBO.addEntry("ComponentMix","vec4"),t.UBO.addEntry("CScale","vec4"),t.UBO.addEntry("CShift","vec4"),t.UBO.addEntry("PWFScale","vec4"),t.UBO.addEntry("PWFShift","vec4"),t.UBO.addEntry("ProjectionParams","vec4"),(0,c.G_)(t.UBO,"ClipPlane"),t.UBO.addEntry("Width","f32"),t.UBO.addEntry("Opacity","f32"),t.UBO.addEntry("CoincidentFactor","f32"),t.UBO.addEntry("CoincidentOffset","f32"),t.UBO.addEntry("PropID","u32"),t.UBO.addEntry("NumClipPlanes","u32"),t.UBO.addEntry("ProjectionSamples","u32"),t.UBO.addEntry("ProjectionMode","u32"),t.UBO.addEntry("NumComponents","u32"),t.UBO.addEntry("IndependentComponents","u32"),t.UBO.addEntry("UseUniformOrientation","u32"),t.UBO.addEntry("UseCenterPoint","u32");t.classHierarchy.push("vtkWebGPUImageCPRMapper"),e.getCoincidentParameters=()=>t.renderable.getResolveCoincidentTopology()===i.XK.PolygonOffset?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.buildPass=r=>{r&&(t.WebGPUImageSlice=e.getFirstAncestorOfType("vtkWebGPUImageSlice"),t.WebGPURenderer=t.WebGPUImageSlice.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice(),e.setWebGPURenderer(t.WebGPURenderer))},e.opaquePass=t=>{t&&e.render()},e.translucentPass=t=>{t&&e.render()},e.zBufferPass=t=>{t&&e.render()},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.render=()=>{t.renderable.update(),t.renderable.preRenderCheck()&&(t.currentImageDataInput=t.renderable.getInputData(0),t.currentCenterlineInput=t.renderable.getOrientedCenterline(),e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw))},e.computePipelineHash=()=>{let r=Math.min(t.renderable.getNumberOfClippingPlanes(),6),n=e.getCoincidentParameters();t.pipelineHash=`cprcp${r}co${n?.factor||n?.offset?1:0}${t.renderEncoder.getPipelineHash()}`},e.updateGeometry=()=>{let r=t.currentCenterlineInput,n=r?.getNumberOfPoints?.()??0,i=n<=1?0:n-1;if(!i)return void e.setNumberOfVertices(0);let a=t.renderable.getHeight(),o=t.renderable.getWidth(),s=r.getDistancesToFirstPoint(),l=r.getPoints(),u=r.getOrientations()??[],c=6*i,d=new Float32Array(3*c),p=new Float32Array(3*c),m=new Uint32Array(c),h=new Float32Array(4*c),f=new Float32Array(4*c),g=[0,0,0],v=[0,0,0];for(let e=0;e1?r:t,d[u+2]=0;let y=s>1?v:g;p[u]=y[0],p[u+1]=y[1],p[u+2]=y[2],m[l]=s,h[c]=n[0],h[c+1]=n[1],h[c+2]=n[2],h[c+3]=n[3],f[c]=i[0],f[c+1]=i[1],f[c+2]=i[2],f[c+3]=i[3]}}let y=t.device.getBufferManager(),b=Math.max(t.renderable.getMTime(),r.getMTime(),r.getPoints().getMTime());[[`cpr-vertex-${b}`,d,"float32x3",["vertexMC"]],[`cpr-centerline-${b}`,p,"float32x3",["centerlinePosition"]],[`cpr-quad-${b}`,m,"uint32",["quadIndex"]],[`cpr-top-${b}`,h,"float32x4",["centerlineTopOrientation"]],[`cpr-bottom-${b}`,f,"float32x4",["centerlineBottomOrientation"]]].forEach(([e,r,n,i])=>{let a=y.getBuffer({hash:e,nativeArray:r,usage:W.RawVertex,format:n});t.vertexInput.addBuffer(a,i)}),e.setNumberOfVertices(c)},e.updateVolumeTexture=()=>{let e=t.device.getTextureManager().getTextureForImageData(t.currentImageDataInput);t.textureViews[0]&&t.textureViews[0].getTexture()===e||(t.textureViews[0]=e.createView("volumeTexture"))},e.updateColorTexture=()=>{let e=t.WebGPUImageSlice.getRenderable().getProperty(),r=t.currentImageDataInput?.getPointData()?.getScalars();if(!r)return;let n=r.getNumberOfComponents(),i=e.getIndependentComponents()?n:1,a=g(e,e.getRGBTransferFunction,i);if(t.colorTextureString===a)return;let o=new Uint8ClampedArray(t.rowLength*i*4),s=new Float32Array(3*t.rowLength);if(e.getRGBTransferFunction())for(let r=0;r{let e=t.WebGPUImageSlice.getRenderable().getProperty(),r=t.currentImageDataInput?.getPointData()?.getScalars();if(!r)return;let n=r.getNumberOfComponents(),i=e.getIndependentComponents()?n:1,a=g(e,e.getPiecewiseFunction,i);if(t.pwfTextureString===a)return;let o=new Float32Array(t.rowLength*i),s=new Float32Array(t.rowLength);if(e.getPiecewiseFunction())for(let r=0;r{let r=t.UBO.getSendTime(),n=t.WebGPUImageSlice.getRenderable(),i=n.getProperty(),a=t.currentImageDataInput;if(e.getMTime()<=r&&t.renderable.getMTime()<=r&&n.getMTime()<=r&&i.getMTime()<=r&&a.getMTime()<=r&&t.WebGPURenderer.getStabilizedTime()<=r)return;let o=t.WebGPURenderer.getStabilizedCenterByReference();v.transpose(j,n.getMatrix()),v.translate(j,j,[-o[0],-o[1],-o[2]]),t.UBO.setArray("BCSCMatrix",j);let s=a.getWorldToIndex(),l=a.getDimensions();v.identity($),v.scale($,$,[1/Math.max(l[0],1),1/Math.max(l[1],1),1/Math.max(l[2],1)]),v.multiply(j,$,s),t.UBO.setArray("MCTCMatrix",j);let u=t.renderable.getCenterPoint();t.UBO.setArray("GlobalCenterPoint",[...u??[0,0,0],1]),t.UBO.setValue("UseCenterPoint",+!!u),t.UBO.setArray("BackgroundColor",t.renderable.getBackgroundColor()),t.UBO.setArray("TangentDirection",[...t.renderable.getTangentDirection(),0]),t.UBO.setArray("BitangentDirection",[...t.renderable.getBitangentDirection(),0]),t.UBO.setArray("UniformOrientation",t.renderable.getUniformOrientation()),t.UBO.setValue("UseUniformOrientation",+!!t.renderable.getUseUniformOrientation()),t.UBO.setValue("Width",t.renderable.getWidth()),t.UBO.setValue("Opacity",i.getOpacity()),t.UBO.setValue("PropID",t.WebGPUImageSlice.getPropID());let c=Math.min(t.renderable.getNumberOfClippingPlanes(),6);t.UBO.setValue("NumClipPlanes",c);let d=[0,0,0,0];for(let e=0;e<6;++e)d.fill(0),e1?h/(m-1):0,0]);let f=a.getPointData().getScalars().getNumberOfComponents(),g=i.getIndependentComponents(),y=[0,0,0,0],b=[1,1,1,1],I=[0,0,0,0],x=[1,1,1,1],C=[0,0,0,0],A=t.textureViews[0].getTexture().getScale();for(let e=0;e0?r:1;b[e]=A/o,I[e]=-n/o+.5;let s=i.getPiecewiseFunction(t);if(s){let t=s.getRange(),r=t[1]-t[0],n=.5*(t[1]+t[0]),i=Math.abs(r)>0?r:1;x[e]=A/i,C[e]=-n/i+.5}}t.UBO.setValue("NumComponents",f),t.UBO.setValue("IndependentComponents",+!!g),t.UBO.setArray("ComponentMix",y),t.UBO.setArray("CScale",b),t.UBO.setArray("CShift",I),t.UBO.setArray("PWFScale",x),t.UBO.setArray("PWFShift",C),t.UBO.sendIfNeeded(t.device)};let n=e.updateBuffers;e.updateBuffers=()=>{n(),e.updateGeometry(),e.updateVolumeTexture(),e.updateColorTexture(),e.updateOpacityTexture(),e.updateUBO();let r=t.WebGPUImageSlice.getRenderable().getProperty().getInterpolationType()===o.V.NEAREST?"nearest":"linear";t.cprSampler&&t.cprSampler.getOptions().minFilter===r||(t.cprSampler=U.Ay.newInstance({label:"cprSampler"}),t.cprSampler.create(t.device,{minFilter:r,magFilter:r}),t.additionalBindables=[t.cprSampler])},e.replaceShaderImageCPR=(e,t)=>{let r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position"),r.addOutput("vec2","quadOffsetVS"),r.addOutput("vec3","centerlinePosVS"),r.addOutput("vec4","centerlineTopOrientationVS"),r.addOutput("vec4","centerlineBottomOrientationVS");let n=r.getCode();n=s.Ay.substitute(n,"//VTK::ImageCPR::Impl",["let isLeft = quadIndex == 0u || quadIndex == 2u;","let isTop = quadIndex == 0u || quadIndex == 1u;","output.quadOffsetVS = vec2("," mapperUBO.Width * select(0.5, -0.5, isLeft),"," select(0.0, 1.0, isTop)",");","output.centerlinePosVS = centerlinePosition;","output.centerlineTopOrientationVS = centerlineTopOrientation;","output.centerlineBottomOrientationVS = centerlineBottomOrientation;","let posSC = mapperUBO.BCSCMatrix * vec4(vertexMC, 1.0);","output.Position = rendererUBO.SCPCMatrix * posSC;"]).result,r.setCode(n)},t.shaderReplacements.set("replaceShaderImageCPR",e.replaceShaderImageCPR),e.replaceShaderClip=(e,r)=>{let n=r.getShaderDescription("fragment"),i=n.getCode();if(!t.renderable.getNumberOfClippingPlanes()){i=s.Ay.substitute(i,"//VTK::Clip::Impl",[]).result,n.setCode(i);return}let a=(0,c.JE)({countName:"mapperUBO.NumClipPlanes",planePrefix:"mapperUBO.ClipPlane",positionName:"vec4(volumePosMC, 1.0)"});i=s.Ay.substitute(i,"//VTK::Clip::Impl",[...a]).result,n.setCode(i)},t.shaderReplacements.set("replaceShaderClip",e.replaceShaderClip),e.replaceShaderCoincident=(t,r)=>{let n=r.getShaderDescription("fragment"),i=n.getCode(),a=e.getCoincidentParameters();if(!a||0===a.factor&&0===a.offset){i=s.Ay.substitute(i,"//VTK::Coincident::Dec",[]).result,i=s.Ay.substitute(i,"//VTK::Coincident::Impl",[]).result,n.setCode(i);return}n.addBuiltinInput("vec4","@builtin(position) fragPos"),n.addBuiltinOutput("f32","@builtin(frag_depth) fragDepth"),i=s.Ay.substitute(i,"//VTK::Coincident::Dec",[]).result,i=s.Ay.substitute(i,"var output : fragmentOutput;",["var output : fragmentOutput;","var coincidentDepth = input.fragPos.z + mapperUBO.CoincidentOffset;","if (mapperUBO.CoincidentFactor != 0.0) {"," let cscale = length(vec2(dpdx(input.fragPos.z), dpdy(input.fragPos.z)));"," coincidentDepth = coincidentDepth + mapperUBO.CoincidentFactor * cscale;","}","output.fragDepth = clamp(coincidentDepth, 0.0, 1.0);"]).result,i=s.Ay.substitute(i,"//VTK::Coincident::Impl",[""]).result,n.setCode(i)},t.shaderReplacements.set("replaceShaderCoincident",e.replaceShaderCoincident),e.replaceShaderRenderEncoder=(e,r)=>{if(e.includes("sel")){let e=r.getShaderDescription("fragment");e.addOutput("vec4","outColor");let t=e.getCode();t=s.Ay.substitute(t,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(mapperUBO.PropID, 0u, 0u, 0u);"]).result,e.setCode(t);return}t.renderEncoder.replaceShaderCode(r)},t.shaderReplacements.set("replaceShaderRenderEncoder",e.replaceShaderRenderEncoder)},"vtkWebGPUImageCPRMapper");(0,d.c9)("vtkImageCPRMapper",Y);var Z=r(87352),J=r(19047),Q=r(87592),ee=r(51680),et=r(21626),er=r(27255),en=r(69927),ei=r(47596),ea=r(38460),eo=r(72663),es=r(38008),el=r(21241),{vtkErrorMacro:eu}=n.Ay,ec=new Float64Array(16),ed=new Float32Array(4),ep=new Float32Array(4),em=new Float32Array(4),eh=new Float32Array(4),ef=new Float32Array(4),eg=[0,0,1],ev=[0,0,0],ey=new Float32Array(4),eb=new Float32Array(4),eI=new Float32Array(4),ex=["r","g","b","a"];function eC(e){return`OutlineTangent1_${e}`}function eA(e){return`OutlineTangent2_${e}`}function eT(e){return`OutlineTexelSize_${e}`}function eS(e){return 0===e?"imgTexture":`imgTexture${e+1}`}function ew(e){return 0===e?"SCTCMatrix":`WCTCMatrix${e}`}function eO(e){return e.multiTexturePerVolumeEnabled?e.currentValidInputs.length:m.COLOR_LUT}function eP(e){return eO(e)+1+1}function e_(e,t,r,n,i=0){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e}function eE(e,t){t.vertexInput.setIndexBuffer(null),t.vertexInput.removeBufferIfPresent("vertexBC"),t.vertexInput.removeBufferIfPresent("vertexNormal"),e.setNumberOfVertices(0)}function eD(e,t,r,n,i,a){var s;let l=eS(a),u=function(e,t,r){let n=t.getPointData().getScalars().getMTime(),i=e.scalarTextures[r];if(i&&i.mtime===n)return i.texture;let a=e.device.getTextureManager().getTextureForImageData(t);return e.scalarTextures[r]={texture:a,mtime:n},a}(t,n,a);t.textureViews[a]&&t.textureViews[a].getTexture()===u||(t.textureViews[a]=u.createView(l));let c=(s=(0,ea.Oi)(r,i),s?.getInterpolationType()===o.V.NEAREST?"nearest":"linear");e.ensureTextureSampler(t.textureViews[a],{minFilter:c,magFilter:c})}function eR(){return GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST}function eM(e){return 2===e?"xy":"xyz"}var eN={currentValidInputs:null,resliceGeom:null,resliceGeomUpdateString:null,multiTexturePerVolumeEnabled:!1,numberOfComponents:0,labelOutlineProperties:[],_labelOutlineThicknessHash:null,_labelOutlineOpacityHash:null,scalarTextures:[]},eV=n.Ay.newInstance(function(e,t,r={}){Object.assign(t,eN,r),R.extend(e,t,r),n.Ay.get(e,t,["scalarTextures"]);let i=e.computeImageState;e.computeImageState=()=>{if(t.multiTexturePerVolumeEnabled&&t.currentValidInputs?.length)return{actorProperty:(0,ea.Oi)(t.WebGPUImageSlice.getRenderable(),t.currentValidInputs[0].inputIndex),numberOfComponents:t.numberOfComponents,independentComponents:!0,numberOfIComponents:t.numberOfComponents,useLabelOutline:t.labelOutlineProperties.length>0,textureChannelMode:h(!0,t.numberOfComponents)};let e=i();return e.useLabelOutline=t.labelOutlineProperties.length>0,e};let a=e.updateLUTImage;e.updateLUTImage=()=>{if(!t.multiTexturePerVolumeEnabled)return void a();let r=e.getImageState(),n=t.WebGPUImageSlice.getRenderable(),i=r.numberOfIComponents,o=(0,eo.gP)({currentValidInputs:t.currentValidInputs,independentComponents:!0,numberOfRows:i,kind:"color",getInputProperty:e=>(0,ea.Oi)(n,e)});if(t.colorTextureString===o)return;t.numRows=i;let s=2*t.numRows*t.rowLength*4;t.colorLUTArray&&t.colorLUTArray.length===s||(t.colorLUTArray=new Uint8ClampedArray(s));let l=t.colorLUTArray,u=t.colorTmpTable,c=4*t.rowLength;l.fill(0);for(let e=0;e{if(!t.multiTexturePerVolumeEnabled)return void o();let r=e.getImageState(),n=t.WebGPUImageSlice.getRenderable(),i=r.numberOfIComponents,a=(0,eo.gP)({currentValidInputs:t.currentValidInputs,independentComponents:!0,numberOfRows:i,kind:"opacity",getInputProperty:e=>(0,ea.Oi)(n,e)});if(t.opacityTextureString===a)return;t.numRows=i;let s=2*t.numRows*t.rowLength;t.opacityLUTArray&&t.opacityLUTArray.length===s||(t.opacityLUTArray=new Float32Array(s));let l=t.opacityLUTArray,u=t.opacityTmpTable;l.fill(1);for(let e=0;e{t.scalarTextures=[...r],e.modified()},e.releaseGraphicsResources=()=>{t.vertexInput.releaseGraphicsResources(),t.textureViews.length=0,t.imageState=null,t.pipelineHash=null,t._labelOutlineThicknessHash=null,t._labelOutlineOpacityHash=null,t.colorTextureString=null,t.opacityTextureString=null},t.UBO.addEntry("StabilizedCenter","vec4"),t.UBO.addEntry("BackgroundColor","vec4"),t.UBO.addEntry("PlaneNormalWC","vec4");for(let e=0;e<4;e++)e>0&&t.UBO.addEntry(ew(e),"mat4x4"),t.UBO.addEntry(eC(e),"vec4"),t.UBO.addEntry(eA(e),"vec4"),t.UBO.addEntry(eT(e),"vec4");t.UBO.addEntry("SlabThickness","f32"),t.UBO.addEntry("SlabType","f32"),t.UBO.addEntry("SlabTrapezoid","f32"),t.UBO.addEntry("SlabSampleStep","f32"),t.UBO.addEntry("PropID","u32"),t.outlineFilter=er.Ay.newInstance(),t.cutter=ee.Ay.newInstance(),t.lineToSurfaceFilter=et.Ay.newInstance(),t.transform=Q.Ay.newInstance(),t.classHierarchy.push("vtkWebGPUImageResliceMapper"),e.buildPass=r=>{r&&(t.WebGPUImageSlice=e.getFirstAncestorOfType("vtkWebGPUImageSlice"),t.WebGPURenderer=t.WebGPUImageSlice.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice())},e.render=()=>{t.renderable.update();let{currentValidInputs:r,labelOutlineProperties:n}=function(e,t){let r=[],n=[],i=t.getNumberOfInputPorts();for(let a=0;a1,t.numberOfComponents=t.multiTexturePerVolumeEnabled?i:o.getNumberOfComponents(),t.currentInput=a,e.updateResliceGeometry(),e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.numberOfVertices&&t.renderEncoder.registerDrawCallback(t.pipeline,e.draw)},e.computePipelineHash=()=>{let r=t.currentInput.getExtent(),n=e.getImageState(),i=t.WebGPUImageSlice.getRenderable();r[0]===r[1]||r[2]===r[3]||r[4]===r[5]?(t.dimensions=2,t.pipelineHash="reslice2"):(t.dimensions=3,t.pipelineHash="reslice3"),t.pipelineHash+=n.textureChannelMode,n.useLabelOutline&&(t.pipelineHash+="outline"),t.pipelineHash+=`ind${+!!n.independentComponents}`,t.pipelineHash+=`slab${+(t.renderable.getSlabThickness()>0)}`,t.pipelineHash+=`norm${+!!t.vertexInput.hasAttribute("vertexNormal")}`,t.multiTexturePerVolumeEnabled&&(t.pipelineHash+=`multi${t.numberOfComponents}`),t.pipelineHash+=`in${t.currentValidInputs.length}`,t.pipelineHash+=`lbl${t.currentValidInputs.map(({inputIndex:e})=>(0,ea.Oi)(i,e)?.getUseLabelOutline()?"1":"0").join("")}`,t.pipelineHash+=`comp${t.numberOfComponents}`,t.pipelineHash+=t.renderEncoder.getPipelineHash()},e.updateResliceGeometry=()=>{let e=t.currentInput,{resGeomString:r,slicePD:n,slicePlane:i,orthoSlicing:a,orthoAxis:o}=(0,el.A5)(t.renderable,e);if(!t.resliceGeom||t.resliceGeomUpdateString!==r){if(n)t.resliceGeom||(t.resliceGeom=J.Ay.newInstance()),t.resliceGeom.getPoints().setData(n.getPoints().getData(),3),t.resliceGeom.getPolys().setData(n.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(n.getPointData().getNormals());else if(!i||!e)return void eu("Unable to build reslice geometry.");else if(t.resliceGeom||(t.resliceGeom=J.Ay.newInstance()),a){let{points:r,polys:n,normalsData:a}=(0,el.GP)(e,i,o,t.transform);t.resliceGeom.getPoints().setData(r,3),t.resliceGeom.getPolys().setData(n,1),t.resliceGeom.getPointData().setNormals(Z.Ay.newInstance({numberOfComponents:3,values:a,name:"Normals"}))}else{let{points:r,polys:n,normalsData:a}=(0,el.jr)(e,i,t.outlineFilter,t.cutter,t.lineToSurfaceFilter);t.resliceGeom.getPoints().setData(r,3),t.resliceGeom.getPolys().setData(n,1);let o=Z.Ay.newInstance({numberOfComponents:3,values:a,name:"Normals"});t.resliceGeom.getPointData().setNormals(o)}t.resliceGeomUpdateString=r,t.resliceGeom.modified()}},e.updateGeometryBuffers=()=>{let r=t.resliceGeom,n=r?.getPoints(),i=r?.getPolys();if(!n||!i||!i.getNumberOfValues())return void eE(e,t);let a=t.device,o=a.getBufferManager().getBuffer({hash:`ResliceIdx${i.getMTime()}${n.getNumberOfPoints()}`,usage:ei.Sd.Index,cells:i,numberOfPoints:n.getNumberOfPoints(),primitiveType:ei.JV.Triangles,representation:en.YL.SURFACE});if(!o||!o.getFlatSize()||!o.getIndexCount())return void eE(e,t);t.vertexInput.setIndexBuffer(o),t.vertexInput.addBuffer(a.getBufferManager().getBuffer({hash:`ReslicePts${n.getMTime()}I${o.getMTime()}float32x4`,usage:ei.Sd.PointArray,format:"float32x4",dataArray:n,indexBuffer:o,shift:0,packExtra:!0}),["vertexBC"]);let s=t.renderable.getSlabThickness()>0,l=s?r.getPointData().getNormals():null;s&&l?t.vertexInput.addBuffer(a.getBufferManager().getBuffer({hash:`ResliceNorm${l.getMTime()}I${o.getMTime()}float32x3`,usage:ei.Sd.PointArray,format:"float32x3",dataArray:l,indexBuffer:o}),["vertexNormal"]):t.vertexInput.removeBufferIfPresent("vertexNormal"),e.setTopology("triangle-list"),e.setNumberOfVertices(o.getIndexCount())},e.updateUBO=()=>{let r=t.WebGPUImageSlice.getRenderable(),n=(0,ea.Oi)(r,t.currentValidInputs[0].inputIndex),i=r.getMapper(),a=i.getSlicePlane(),o=t.WebGPURenderer.getStabilizedCenterByReference(),s=e.getImageState(),l=t.currentInput;v.copy(ec,l.getIndexToWorld()),v.translate(ec,ec,[-.5,-.5,-.5]),v.scale(ec,ec,l.getDimensions()),v.invert(ec,ec),t.UBO.setArray("SCTCMatrix",ec);for(let e=1;e<4;e++){let r=t.currentValidInputs[e]?.imageData;r?(v.copy(ec,r.getIndexToWorld()),v.translate(ec,ec,[-.5,-.5,-.5]),v.scale(ec,ec,r.getDimensions()),v.invert(ec,ec),t.UBO.setArray(ew(e),ec)):t.UBO.setArray(ew(e),v.identity(ec))}t.UBO.setArray("StabilizedCenter",e_(eb,o[0],o[1],o[2])),t.UBO.setArray("BackgroundColor",t.renderable.getBackgroundColorByReference());let u=t.currentInput.getSpacing(),c=.5*Math.min(u[0],u[1],u[2]);t.UBO.setValue("SlabThickness",i.getSlabThickness()),t.UBO.setValue("SlabType",i.getSlabType()),t.UBO.setValue("SlabTrapezoid",i.getSlabTrapezoidIntegration()),t.UBO.setValue("SlabSampleStep",c);let{planeNormal:d,tangent1:p,tangent2:h}=(0,es.s)(a,eg);t.UBO.setArray("PlaneNormalWC",e_(eb,d[0],d[1],d[2]));for(let e=0;e<4;e++){let r=t.currentValidInputs[e]?.imageData;if(r){let{tangent1:n,tangent2:i,texelSize:a}=(0,es.m)(r,p,h,ev);t.UBO.setArray(eC(e),e_(ey,n[0],n[1],n[2])),t.UBO.setArray(eA(e),e_(ey,i[0],i[1],i[2])),t.UBO.setArray(eT(e),e_(ey,a[0],a[1],a[2]))}else t.UBO.setArray(eC(e),eI),t.UBO.setArray(eA(e),eI),t.UBO.setArray(eT(e),eI)}!function(e,t,r,n){ed.fill(1),ep.fill(0),em.fill(1),eh.fill(0),ef.fill(1);let{numberOfComponents:i,independentComponents:a}=n;for(let n=0;n{if(e.updateGeometryBuffers(),!t.currentInput||!t.numberOfVertices)return;let r=t.WebGPUImageSlice.getRenderable(),n=t.currentValidInputs.length;if(t.multiTexturePerVolumeEnabled)for(let i=0;i{let i=r.getShaderDescription("vertex");i.addBuiltinOutput("vec4","@builtin(position) Position"),i.addOutput("vec4","vertexSC");let a=t.renderable.getSlabThickness()>0,o=i.getCode(),l=["var vertexWC: vec4 = vec4(vertexBC.xyz, 1.0);","var vertexSC: vec4 = vertexWC - mapperUBO.StabilizedCenter;","vertexSC.w = 1.0;"];2===t.dimensions?l.push("output.tcoordVS = (mapperUBO.SCTCMatrix * vertexWC).xy;"):l.push("output.tcoordVS = (mapperUBO.SCTCMatrix * vertexWC).xyz;"),l.push("output.worldPosVS = vertexWC.xyz;"),a&&l.push(n.hasAttribute("vertexNormal")?"output.normalWC = normalize(vertexNormal);":"output.normalWC = mapperUBO.PlaneNormalWC.xyz;"),l.push("output.vertexSC = vertexSC;","var pos: vec4 = rendererUBO.SCPCMatrix * vertexSC;","pos.z = clamp(pos.z - 0.000016 * mapperUBO.CoincidentOffset * pos.w, 0.0, pos.w);","output.Position = pos;"),o=s.Ay.substitute(o,"//VTK::Position::Impl",l).result,i.setCode(o)},e.getShaderReplacements().set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,r,n)=>{let i=r.getShaderDescription("vertex");2===t.dimensions?i.addOutput("vec2","tcoordVS"):i.addOutput("vec3","tcoordVS"),i.addOutput("vec3","worldPosVS"),t.renderable.getSlabThickness()>0&&i.addOutput("vec3","normalWC")},e.getShaderReplacements().set("replaceShaderTCoord",e.replaceShaderTCoord),e.replaceShaderImage=(r,n,i)=>{let a=n.getShaderDescription("fragment"),o=a.getCode(),l=e.getImageState(),u=t.currentValidInputs.length,c=2===t.dimensions?{sampleCoordType:"vec2",coordFromWorldNeg:"(mapperUBO.SCTCMatrix * vec4(worldNeg, 1.0)).xy",coordFromWorldPos:"(mapperUBO.SCTCMatrix * vec4(worldPos, 1.0)).xy",coordBounds:"all(sampleCoord >= vec2(0.0)) && all(sampleCoord <= vec2(1.0))",negBounds:"all(coordNeg >= vec2(0.0)) && all(coordNeg <= vec2(1.0))",posBounds:"all(coordPos >= vec2(0.0)) && all(coordPos <= vec2(1.0))"}:{sampleCoordType:"vec3",coordFromWorldNeg:"(mapperUBO.SCTCMatrix * vec4(worldNeg, 1.0)).xyz",coordFromWorldPos:"(mapperUBO.SCTCMatrix * vec4(worldPos, 1.0)).xyz",coordBounds:"all(sampleCoord >= vec3(0.0)) && all(sampleCoord <= vec3(1.0))",negBounds:"all(coordNeg >= vec3(0.0)) && all(coordNeg <= vec3(1.0))",posBounds:"all(coordPos >= vec3(0.0)) && all(coordPos <= vec3(1.0))"};switch(o=s.Ay.substitute(o,"//VTK::Image::Dec",["fn vtkCompositeSlab(currVal: vec4, valToComp: vec4, slabType: i32, trapezoid: i32) -> vec4 {"," if (slabType == 0) { return min(currVal, valToComp); }"," if (slabType == 1) { return max(currVal, valToComp); }"," if (trapezoid > 0) { return currVal + 0.5 * valToComp; }"," return currVal + valToComp;","}"]).result,o=s.Ay.substitute(o,"//VTK::Image::Sample",function(e,t,r){let n=e.renderable.getSlabThickness()>0,i=e.multiTexturePerVolumeEnabled?` var rawValue: vec4 = ${r("input.worldPosVS")};`:" var rawValue: vec4 = textureSampleLevel(imgTexture, imgTextureSampler, sampleCoord, 0.0);",a=[` let sampleCoord: ${t.sampleCoordType} = input.tcoordVS;`," var computedColor: vec4;",` if (!(${t.coordBounds})) {`," computedColor = mapperUBO.BackgroundColor;"," } else {",i];if(n){let n="textureSampleLevel(imgTexture, imgTextureSampler, coordNeg, 0.0)",i="textureSampleLevel(imgTexture, imgTextureSampler, coordPos, 0.0)";e.multiTexturePerVolumeEnabled&&(n=r("worldNeg"),i=r("worldPos")),a.push(" if (mapperUBO.SlabThickness > 0.0) {"," var numSlices: i32 = 1;"," var distTraveled: f32 = mapperUBO.SlabSampleStep;"," var trapezoid: i32 = 0;"," let slabNormal: vec3 = normalize(input.normalWC);"," while (distTraveled < mapperUBO.SlabThickness * 0.5) {"," distTraveled = distTraveled + mapperUBO.SlabSampleStep;"," let fnumSlices: f32 = f32(numSlices);"," var localStep: f32 = fnumSlices * mapperUBO.SlabSampleStep;"," if (distTraveled > mapperUBO.SlabThickness * 0.5) {"," localStep = mapperUBO.SlabThickness * 0.5;"," trapezoid = i32(mapperUBO.SlabTrapezoid);"," }"," let worldNeg: vec3 = input.worldPosVS - localStep * slabNormal;",` let coordNeg: ${t.sampleCoordType} = ${t.coordFromWorldNeg};`,` if (${t.negBounds}) {`,` rawValue = vtkCompositeSlab(rawValue, ${n}, i32(mapperUBO.SlabType), trapezoid);`," numSlices += 1;"," }"," let worldPos: vec3 = input.worldPosVS + localStep * slabNormal;",` let coordPos: ${t.sampleCoordType} = ${t.coordFromWorldPos};`,` if (${t.posBounds}) {`,` rawValue = vtkCompositeSlab(rawValue, ${i}, i32(mapperUBO.SlabType), trapezoid);`," numSlices += 1;"," }"," }"," if (i32(mapperUBO.SlabType) == 2) {"," rawValue = rawValue / f32(numSlices);"," }"," }")}return a.push(" computedColor = rawValue;"," //VTK::Image::Sample"," }"),a}(t,c,e=>(function(e,t,r){let n=[],i=eM(e.dimensions);for(let e=0;e<4;e++)if(e(${r}, 1.0)).${i}`;n.push(`textureSampleLevel(${t}, ${t}Sampler, ${a}, 0.0).r`)}else n.push("0.0");return`vec4(${n.join(", ")})`})(t,u,e))).result,l.textureChannelMode){case p.SINGLE:case p.INDEPENDENT_1:o=s.Ay.substitute(o,"//VTK::Image::Sample",function(e,t,r){let n=eM(e.dimensions);return r?[" let centerValue: f32 = computedColor.r;"," let segmentIndex: u32 = u32(centerValue * 255.0);"," if (segmentIndex == 0u) {"," computedColor = vec4(0.0, 0.0, 0.0, 0.0);"," } else {"," let textureCoordinate: f32 = f32(segmentIndex - 1u) / 255.0;"," let labelmapRow: f32 = 0.5 / f32(textureDimensions(labelOutlineThickness, 0).y);"," let thicknessValue: f32 = textureSampleLevel(labelOutlineThickness, labelOutlineThicknessSampler, vec2(textureCoordinate, labelmapRow), 0.0).r;"," let outlineOpacity: f32 = textureSampleLevel(labelOutlineOpacity, labelOutlineOpacitySampler, vec2(textureCoordinate, labelmapRow), 0.0).r;"," let actualThickness: i32 = i32(thicknessValue * 255.0);"," let scalar: f32 = centerValue;"," let colorCoord: vec2 = vec2(scalar * mapperUBO.cScale.r + mapperUBO.cShift.r, 0.5);"," let tColor: vec4 = textureSampleLevel(tfunTexture, tfunTextureSampler, colorCoord, 0.0);"," let opacityCoord: vec2 = vec2(scalar * mapperUBO.oScale.r + mapperUBO.oShift.r, 0.5);"," let scalarOpacity: f32 = textureSampleLevel(ofunTexture, ofunTextureSampler, opacityCoord, 0.0).r;"," var pixelOnBorder: bool = false;"," for (var i: i32 = -actualThickness; i <= actualThickness; i++) {"," for (var j: i32 = -actualThickness; j <= actualThickness; j++) {"," if (i == 0 && j == 0) { continue; }",` let neighborCoord: ${t.sampleCoordType} = sampleCoord + f32(i) * mapperUBO.OutlineTangent1_0.${n} * mapperUBO.OutlineTexelSize_0.${n} + f32(j) * mapperUBO.OutlineTangent2_0.${n} * mapperUBO.OutlineTexelSize_0.${n};`,` if (!(${t.coordBounds.replace(/sampleCoord/g,"neighborCoord")})) {`," pixelOnBorder = true;"," break;"," }"," let neighborValue: f32 = textureSampleLevel(imgTexture, imgTextureSampler, neighborCoord, 0.0).r;"," if (neighborValue != centerValue) {"," pixelOnBorder = true;"," break;"," }"," }"," if (pixelOnBorder) { break; }"," }"," if (pixelOnBorder) {"," computedColor = vec4(tColor.rgb, outlineOpacity);"," } else {"," computedColor = vec4(tColor.rgb, scalarOpacity * mapperUBO.Opacity);"," }"," }"]:[" let scalar: f32 = computedColor.r;"," let colorCoord: vec2 = vec2(scalar * mapperUBO.cScale.r + mapperUBO.cShift.r, 0.5);"," let tColor: vec4 = textureSampleLevel(tfunTexture, tfunTextureSampler, colorCoord, 0.0);"," let opacityCoord: vec2 = vec2(scalar * mapperUBO.oScale.r + mapperUBO.oShift.r, 0.5);"," let scalarOpacity: f32 = textureSampleLevel(ofunTexture, ofunTextureSampler, opacityCoord, 0.0).r;"," computedColor = vec4(tColor.rgb, scalarOpacity * mapperUBO.Opacity);"]}(t,c,l.useLabelOutline)).result;break;case p.INDEPENDENT_2:case p.INDEPENDENT_3:case p.INDEPENDENT_4:o=s.Ay.substitute(o,"//VTK::Image::Sample",function(e,t){let r=new Map(e.labelOutlineProperties.map(({arrayIndex:e},t)=>[e,t])),n=function(e,t){let r=[];for(let n=0;n = vec4(0.0);"];for(let t=0;t = vec2(scalar${t} * mapperUBO.cScale[${t}] + mapperUBO.cShift[${t}], ${e});`,` let tColor${t}: vec4 = textureSampleLevel(tfunTexture, tfunTextureSampler, colorCoord${t}, 0.0);`,` let opacityCoord${t}: vec2 = vec2(scalar${t} * mapperUBO.oScale[${t}] + mapperUBO.oShift[${t}], ${e});`,` let alpha${t}: f32 = textureSampleLevel(ofunTexture, ofunTextureSampler, opacityCoord${t}, 0.0).r * mapperUBO.componentWeight[${t}] * mapperUBO.Opacity;`)}for(let e=0;e 0.0) {`,` let sampleCoord${o}: ${t.sampleCoordType} = (mapperUBO.${ew(o)} * vec4(input.worldPosVS, 1.0)).${i};`,` let segmentIndex${o}: u32 = u32(scalar${o} * 255.0);`,` let textureCoordinate${o}: f32 = f32(segmentIndex${o} - 1u) / 255.0;`,` let labelmapRow${o}: f32 = (${n}.0 + 0.5) / f32(textureDimensions(labelOutlineThickness, 0).y);`,` let thickness${o}: i32 = i32(textureSampleLevel(labelOutlineThickness, labelOutlineThicknessSampler, vec2(textureCoordinate${o}, labelmapRow${o}), 0.0).r * 255.0);`,` let outlineOpacity${o}: f32 = textureSampleLevel(labelOutlineOpacity, labelOutlineOpacitySampler, vec2(textureCoordinate${o}, labelmapRow${o}), 0.0).r;`,` var pixelOnBorder${o}: bool = false;`,` for (var ii${o}: i32 = -thickness${o}; ii${o} <= thickness${o}; ii${o}++) {`,` for (var jj${o}: i32 = -thickness${o}; jj${o} <= thickness${o}; jj${o}++) {`,` if (ii${o} == 0 && jj${o} == 0) { continue; }`,` let neighborCoord${o}: ${t.sampleCoordType} = sampleCoord${o} + f32(ii${o}) * mapperUBO.${eC(o)}.${i} * mapperUBO.${eT(o)}.${i} + f32(jj${o}) * mapperUBO.${eA(o)}.${i} * mapperUBO.${eT(o)}.${i};`,` if (!(${t.coordBounds.replace(/sampleCoord/g,`neighborCoord${o}`)})) { pixelOnBorder${o} = true; break; }`,` let neighborValue${o}: f32 = textureSampleLevel(${e}, ${e}Sampler, neighborCoord${o}, 0.0).r;`,` if (neighborValue${o} != scalar${o}) { pixelOnBorder${o} = true; break; }`," }",` if (pixelOnBorder${o}) { break; }`," }",` let finalAlpha${o}: f32 = select(alpha${o}, outlineOpacity${o}, pixelOnBorder${o});`,` convergentColor = vec4(mix(convergentColor.rgb, tColor${o}.rgb, finalAlpha${o}), max(convergentColor.a, finalAlpha${o}));`," }")}else a.push(` convergentColor = vec4(mix(convergentColor.rgb, tColor${o}.rgb, alpha${o}), max(convergentColor.a, alpha${o}));`)}return a.push(" computedColor = convergentColor;"),a}(t,c)).result;break;default:o=s.Ay.substitute(o,"//VTK::Image::Sample",function(e){switch(e){case p.DEPENDENT_LA:return[" let rawColor: vec4 = computedColor;"," let intensity: f32 = rawColor.r * mapperUBO.cScale.r + mapperUBO.cShift.r;"," let tColor: vec4 ="," textureSampleLevel(tfunTexture, tfunTextureSampler, vec2(intensity, 0.5), 0.0);"," computedColor = vec4("," tColor.rgb,"," rawColor.g * mapperUBO.oScale.r + mapperUBO.oShift.r);"];case p.DEPENDENT_RGB:return[" let rawColor: vec4 ="," computedColor * vec4(mapperUBO.cScale.x) + vec4(mapperUBO.cShift.x);"," computedColor = vec4("," textureSampleLevel(tfunTexture, tfunTextureSampler, vec2(rawColor.r, 0.5), 0.0).r,"," textureSampleLevel(tfunTexture, tfunTextureSampler, vec2(rawColor.g, 0.5), 0.0).r,"," textureSampleLevel(tfunTexture, tfunTextureSampler, vec2(rawColor.b, 0.5), 0.0).r,"," mapperUBO.Opacity);"];case p.DEPENDENT_RGBA:return[" let rawColor: vec4 ="," computedColor * vec4(mapperUBO.cScale.x) + vec4(mapperUBO.cShift.x);"," computedColor = vec4("," textureSampleLevel(tfunTexture, tfunTextureSampler, vec2(rawColor.r, 0.5), 0.0).r,"," textureSampleLevel(tfunTexture, tfunTextureSampler, vec2(rawColor.g, 0.5), 0.0).r,"," textureSampleLevel(tfunTexture, tfunTextureSampler, vec2(rawColor.b, 0.5), 0.0).r,"," rawColor.a);"];default:return[" let scalar: f32 = computedColor.r;"," let colorCoord: vec2 = vec2(scalar * mapperUBO.cScale.r + mapperUBO.cShift.r, 0.5);"," computedColor = textureSampleLevel(tfunTexture, tfunTextureSampler, colorCoord, 0.0);"]}}(l.textureChannelMode)).result}a.setCode(o)},e.getShaderReplacements().set("replaceShaderImage",e.replaceShaderImage),e.updateLabelOutlineThicknessTexture=()=>{if(!t.labelOutlineProperties.length)return;let{dataArrays:r,hash:n,width:i,height:a}=(0,ea.oG)(t.labelOutlineProperties,e=>e.getLabelOutlineThicknessByReference());if(n===t._labelOutlineThicknessHash)return;t._labelOutlineThicknessHash=n;let o=new Uint8Array(i*a);(0,ea.X1)(o,r,i);let s=t.device.getTextureManager().getTexture({hash:`irm-outline-thickness-${n}`,nativeArray:o,width:i,height:a,depth:1,format:"r8unorm",usage:eR()}).createView("labelOutlineThickness");e.ensureTextureSampler(s,{minFilter:"nearest",magFilter:"nearest"}),t.textureViews[eP(t)]=s},e.updateLabelOutlineOpacityTexture=()=>{if(!t.labelOutlineProperties.length)return;let{dataArrays:r,hash:n,width:i,height:a}=(0,ea.oG)(t.labelOutlineProperties,e=>{let t=e.getLabelOutlineOpacity();return"number"==typeof t?[t]:t});if(n===t._labelOutlineOpacityHash)return;t._labelOutlineOpacityHash=n;let o=new Float32Array(i*a);(0,ea.X1)(o,r,i);let s=t.device.getTextureManager().getTexture({hash:`irm-outline-opacity-${n}`,nativeArray:o,width:i,height:a,depth:1,format:"r16float",usage:eR()}).createView("labelOutlineOpacity");e.ensureTextureSampler(s,{minFilter:"nearest",magFilter:"nearest"}),t.textureViews[eP(t)+1]=s},e.delete=n.Ay.chain(()=>{e.releaseGraphicsResources(),t.outlineFilter?.delete?.(),t.cutter?.delete?.(),t.lineToSurfaceFilter?.delete?.(),t.transform?.delete?.()},e.delete)},"vtkWebGPUImageResliceMapper");(0,d.c9)("vtkImageResliceMapper",eV)},10106:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XMLStringLexer=void 0;let n=r(24992);class i{_str;_index;_length;_options={skipWhitespaceOnlyText:!1};err={line:-1,col:-1,index:-1,str:""};constructor(e,t){this._str=e,this._index=0,this._length=e.length,t&&(this._options.skipWhitespaceOnlyText=t.skipWhitespaceOnlyText||!1)}nextToken(){if(this.eof())return{type:n.TokenType.EOF};let e=this.skipIfStartsWith("<")?this.openBracket():this.text();return this._options.skipWhitespaceOnlyText&&e.type===n.TokenType.Text&&i.isWhiteSpaceToken(e)&&(e=this.nextToken()),e}openBracket(){if(this.skipIfStartsWith("?"))if(!this.skipIfStartsWith("xml"))return this.pi();else if(i.isSpace(this._str[this._index]))return this.declaration();else return this.seek(-3),this.pi();if(this.skipIfStartsWith("!"))if(this.skipIfStartsWith("--"))return this.comment();else{if(this.skipIfStartsWith("[CDATA["))return this.cdata();if(this.skipIfStartsWith("DOCTYPE"))return this.doctype();this.throwError("Invalid '!' in opening tag.")}else if(this.skipIfStartsWith("/"))return this.closeTag();else return this.openTag()}declaration(){let e="",t="",r="";for(;!this.eof();){if(this.skipSpace(),this.skipIfStartsWith("?>"))return{type:n.TokenType.Declaration,version:e,encoding:t,standalone:r};{let[n,i]=this.attribute();"version"===n?e=i:"encoding"===n?t=i:"standalone"===n?r=i:this.throwError("Invalid attribute name: "+n)}}this.throwError("Missing declaration end symbol `?>`")}doctype(){let e="",t="";this.skipSpace();let r=this.takeUntil2("[",">",!0);return this.skipSpace(),this.skipIfStartsWith("PUBLIC")?(e=this.quotedString(),t=this.quotedString()):this.skipIfStartsWith("SYSTEM")&&(t=this.quotedString()),this.skipSpace(),this.skipIfStartsWith("[")&&(this.skipUntil("]"),this.skipIfStartsWith("]")||this.throwError("Missing end bracket of DTD internal subset")),this.skipSpace(),this.skipIfStartsWith(">")||this.throwError("Missing doctype end symbol `>`"),{type:n.TokenType.DocType,name:r,pubId:e,sysId:t}}pi(){let e=this.takeUntilStartsWith("?>",!0);if(this.eof()&&this.throwError("Missing processing instruction end symbol `?>`"),this.skipSpace(),this.skipIfStartsWith("?>"))return{type:n.TokenType.PI,target:e,data:""};let t=this.takeUntilStartsWith("?>");return this.eof()&&this.throwError("Missing processing instruction end symbol `?>`"),this.seek(2),{type:n.TokenType.PI,target:e,data:t}}text(){let e=this.takeUntil("<");return{type:n.TokenType.Text,data:e}}comment(){let e=this.takeUntilStartsWith("--\x3e");return this.eof()&&this.throwError("Missing comment end symbol `--\x3e`"),this.seek(3),{type:n.TokenType.Comment,data:e}}cdata(){let e=this.takeUntilStartsWith("]]>");return this.eof()&&this.throwError("Missing CDATA end symbol `]>`"),this.seek(3),{type:n.TokenType.CDATA,data:e}}openTag(){this.skipSpace();let e=this.takeUntil2(">","/",!0);if(this.skipSpace(),this.skipIfStartsWith(">"))return{type:n.TokenType.Element,name:e,attributes:[],selfClosing:!1};if(this.skipIfStartsWith("/>"))return{type:n.TokenType.Element,name:e,attributes:[],selfClosing:!0};let t=[];for(;!this.eof();){if(this.skipSpace(),this.skipIfStartsWith(">"))return{type:n.TokenType.Element,name:e,attributes:t,selfClosing:!1};if(this.skipIfStartsWith("/>"))return{type:n.TokenType.Element,name:e,attributes:t,selfClosing:!0};let r=this.attribute();t.push(r)}this.throwError("Missing opening element tag end symbol `>`")}closeTag(){this.skipSpace();let e=this.takeUntil(">",!0);return this.skipSpace(),this.skipIfStartsWith(">")||this.throwError("Missing closing element tag end symbol `>`"),{type:n.TokenType.ClosingTag,name:e}}attribute(){this.skipSpace();let e=this.takeUntil("=",!0);return this.skipSpace(),this.skipIfStartsWith("=")||this.throwError("Missing equals sign before attribute value"),[e,this.quotedString()]}quotedString(){this.skipSpace();let e=this.take(1);i.isQuote(e)||this.throwError("Missing start quote character before quoted value");let t=this.takeUntil(e);return this.skipIfStartsWith(e)||this.throwError("Missing end quote character after quoted value"),t}eof(){return this._index>=this._length}skipIfStartsWith(e){let t=e.length;if(1===t)if(this._str[this._index]===e)return this._index++,!0;else return!1;for(let r=0;rthis._length&&(this._index=this._length)}skipSpace(){for(;!this.eof()&&i.isSpace(this._str[this._index]);)this._index++}take(e){if(1===e)return this._str[this._index++];let t=this._index;return this.seek(e),this._str.slice(t,this._index)}takeUntil(e,t=!1){let r=this._index;for(;this._indexthis._index){a=r.index;break}throw this.err={line:n,col:this._index-i,index:this._index,str:this._str.substring(i,a)},Error(e+"\nIndex: "+this.err.index+"\nLn: "+this.err.line+", Col: "+this.err.col+"\nInput: "+this.err.str)}[Symbol.iterator](){return this._index=0,{next:(function(){let e=this.nextToken();return e.type===n.TokenType.EOF?{done:!0,value:null}:{done:!1,value:e}}).bind(this)}}}t.XMLStringLexer=i},10115:(e,t,r)=>{"use strict";r.d(t,{FF:()=>d,Fi:()=>f,H6:()=>m,Vz:()=>v,cg:()=>g,mK:()=>h,pI:()=>p});var n=r(70639),i=r(96167);let a=new Map,o=new Map,s=[],l=!1;function u(){l||(l=!0,c({backend:n.A.GPU,renderModes:{image:{id:i.T.VTK_IMAGE},volume:{id:i.T.VTK_VOLUME_SLICE}},surface:"vtk"}),c({backend:n.A.CPU,renderModes:{image:{id:i.T.CPU_IMAGE},volume:{id:i.T.CPU_VOLUME}},surface:"cpu"}))}function c({backend:e,name:t,renderModes:r,surface:i="vtk"}){if(u(),e===n.A.Auto)throw Error(`Render backend id "${n.A.Auto}" is reserved for the automatic backend resolution`);if(a.has(e))throw Error(`Render backend "${e}" is already registered`);if(!r?.image?.id)throw Error(`Render backend "${e}" must declare renderModes.image`);if(r.volume&&r.volume.id===r.image.id)throw Error(`Render backend "${e}" must use distinct render modes for image and volume`);let l=[[r.image.id,"image"]];for(let[t]of(r.volume&&l.push([r.volume.id,"volume"]),l)){let r=o.get(t);if(r&&r.backend!==e)throw Error(`Render mode "${t}" is already provided by render backend "${r.backend}"`)}if(t&&Object.prototype.hasOwnProperty.call(n.A,t))throw Error(`Render backend constant "${String(t)}" already exists`);for(let[t,n]of(a.set(e,{backend:e,renderModes:r,surface:i}),l))o.set(t,{backend:e,kind:n,surface:i});t&&((0,n.d)(t,e),s.push(t))}function d(e){return u(),a.has(e)}function p(e,t){let r=(u(),a.get(e));if(!r)throw Error(`Unknown render backend "${e}". Register it with registerRenderBackend() first.`);let n=r.renderModes[t];if(!n)throw Error(`Render backend "${e}" does not support ${t}-backed rendering`);return n.id}function m(e){return u(),e?o.get(e)?.backend:void 0}function h(e){return u(),!!e&&o.get(e)?.kind==="volume"}function f(e){return u(),!!e&&o.get(e)?.kind==="image"}function g(e){return u(),e&&o.get(e)?.surface||"vtk"}function v(){u();let e=[];for(let t of a.values()){let{image:r,volume:n}=t.renderModes;for(let t of[r,n])t?.createDefinition&&e.push(t.createDefinition())}return e}},10353:(e,t,r)=>{"use strict";r.d(t,{YY:()=>l,he:()=>u});var n=r(70192),i=r(78378),a=r(12577),o=r(93022);let s=new Set;function l(e){if((0,o.getAnnotation)(e))return!s.has(e)}function u(e){let t=!s.has(e);return!function(e,t=!0){var r,l,u,c,d,p,m;let h=Object.freeze({lastVisible:[],lastHidden:[],hidden:[]});e&&(t?(r=e,l=s,u=h,l.delete(r)&&(u.lastVisible.push(r),(0,o.getAnnotation)(r).isVisible=!0)):(c=e,d=s,p=h,d.has(c)||(d.add(c),(0,a.zN)(c)&&(0,a.PW)(c),p.lastHidden.push(c),(0,o.getAnnotation)(c).isVisible=!1))),((m=h).lastHidden.length>0||m.lastVisible.length>0)&&(s.forEach(e=>void m.hidden.push(e)),(0,n.Hl)(n.tX,i.sV.ANNOTATION_VISIBILITY_CHANGE,m))}(e,t),t}},10355:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>s});var n=r(17042),{vtkErrorMacro:i}=n.Ay,a={range:[0,0],clamping:!0,allowDuplicateScalars:!1};function o(e,t,r={}){Object.assign(t,a,r),n.Ay.obj(e,t),t.nodes=[],n.Ay.setGet(e,t,["allowDuplicateScalars","clamping"]),n.Ay.setArray(e,t,["range"],2),n.Ay.getArray(e,t,["range"]),t.classHierarchy.push("vtkPiecewiseFunction"),e.getSize=()=>t.nodes.length,e.getType=()=>{let e,r=0,n=0;t.nodes.length>0&&(r=t.nodes[0].y);for(let i=1;ir)switch(n){case 0:case 1:n=1;break;default:n=3}else switch(n){case 0:case 2:n=2;break;default:n=3}if(r=e,3===n)break}switch(n){case 0:return"Constant";case 1:return"NonDecreasing";case 2:return"NonIncreasing";default:return"Varied"}},e.getDataPointer=()=>{let e=t.nodes.length;if(t.function=null,e>0){t.function=[];for(let r=0;r{if(0===t.nodes.length)return 0;let e=1,r=0;for(;r0?t.nodes[r-1].x:t.clamping?-Number.MAX_VALUE:t.nodes[0].x},e.getNodeValue=(e,r)=>{let n=t.nodes.length;return e<0||e>=n?(i("Index out of range!"),-1):(r[0]=t.nodes[e].x,r[1]=t.nodes[e].y,r[2]=t.nodes[e].midpoint,r[3]=t.nodes[e].sharpness,1)},e.setNodeValue=(r,n)=>{let a=t.nodes.length;if(r<0||r>=a)return i("Index out of range!"),-1;let o=t.nodes[r].x;return t.nodes[r].x=n[0],t.nodes[r].y=n[1],t.nodes[r].midpoint=n[2],t.nodes[r].sharpness=n[3],o!==n[0]?e.sortAndUpdateRange():e.modified(),1},e.addPoint=(t,r)=>e.addPointLong(t,r,.5,0),e.addPointLong=(r,n,a,o)=>{let s;if(a<0||a>1)return i("Midpoint outside range [0.0, 1.0]"),-1;if(o<0||o>1)return i("Sharpness outside range [0.0, 1.0]"),-1;for(t.allowDuplicateScalars||e.removePoint(r),t.nodes.push({x:r,y:n,midpoint:a,sharpness:o}),e.sortAndUpdateRange(),s=0;s{t.nodes!==r&&(t.nodes=r,e.sortAndUpdateRange())},e.sortAndUpdateRange=()=>{t.nodes.sort((e,t)=>e.x-t.x),e.updateRange()||e.modified()},e.updateRange=()=>{let r=t.range.slice(),n=t.nodes.length;return n?(t.range[0]=t.nodes[0].x,t.range[1]=t.nodes[n-1].x):(t.range[0]=0,t.range[1]=0),(r[0]!==t.range[0]||r[1]!==t.range[1])&&(e.modified(),!0)},e.removePoint=r=>{let n;for(n=0;n=t.nodes.length)return -1;let i=n,a=!1;return t.nodes.splice(n,1),(0===n||n===t.nodes.length)&&(a=e.updateRange()),a||e.modified(),i},e.removeAllPoints=()=>{t.nodes=[],e.sortAndUpdateRange()},e.addSegment=(r,n,i,a)=>{e.sortAndUpdateRange();for(let e=0;e=r&&t.nodes[e].x<=i?t.nodes.splice(e,1):e++;e.addPoint(r,n,.5,0),e.addPoint(i,a,.5,0)},e.getValue=t=>{let r=[];return e.getTable(t,t,1,r),r[0]},e.adjustRange=r=>{if(r.length<2)return 0;let n=e.getRange();n[0]r[1]?e.addPoint(r[1],e.getValue(r[1])):e.addPoint(r[1],e.getValue(n[1])),e.sortAndUpdateRange();for(let e=0;e=r[0]&&t.nodes[e].x<=r[1]?t.nodes.splice(e,1):++e;return e.sortAndUpdateRange(),1},e.estimateMinNumberOfSamples=(t,r)=>Math.ceil((r-t)/e.findMinimumXDistance()),e.findMinimumXDistance=()=>{let e=t.nodes.length;if(e<2)return -1;let r=t.nodes[1].x-t.nodes[0].x;for(let n=0;n{let o,s=0,l=t.nodes.length,u=0;0!==l&&(u=t.nodes[l-1].y);let c=0,d=0,p=0,m=0,h=0,f=0,g=0;for(o=0;o1?e+o/(n-1)*(r-e):.5*(e+r);st.nodes[s].x;)++s.99999&&(f=.99999));if(s>=l)i[v]=t.clamping?u:0;else if(0===s)i[v]=t.clamping?t.nodes[0].y:0;else{let e=(c-d)/(p-d);if(e=e.99)if(e<.5){i[v]=m;continue}else{i[v]=h;continue}if(g<.01){i[v]=(1-e)*m+e*h;continue}e<.5?e=.5*(2*e)**(1+10*g):e>.5&&(e=1-.5*((1-e)*2)**(1+10*g));let t=e*e,r=t*e,n=2*r-3*t+1,a=-2*r+3*t,o=r-2*t+e,s=r-t,l=(1-g)*(h-m);i[v]=n*m+a*h+o*l+s*l;let u=mh?m:h;i[v]=i[v]y?y:i[v]}}}}var s={newInstance:n.Ay.newInstance(o,"vtkPiecewiseFunction"),extend:o}},10458:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(19431);function i(e,t,r){if(2!==e.length||2!==t.length||2!==r.length)throw Error("lineStart, lineEnd, and point should have 2 elements of [x, y]");return Math.sqrt((0,n.A)(e,t,r))}},10463:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>l});var n=r(17042),i=r(57236);function a(e,t,r){r.forEach(r=>{e[`get${r.method}`]=()=>t[r.key],e[`set${r.method}`]=n.Ay.objectSetterMap.object(e,t,{name:r.key,params:["factor","offset"]})})}var o=["Polygon","Line","Point"],s={modified:()=>void 0};a(s,{Polygon:{factor:2,offset:0},Line:{factor:1,offset:-1},Point:{factor:0,offset:-2}},o.map(e=>({key:e,method:`ResolveCoincidentTopology${e}OffsetParameters`})));var l={implementCoincidentTopologyMethods:function(e,t){void 0===t.resolveCoincidentTopology&&(t.resolveCoincidentTopology=!1),n.Ay.setGet(e,t,["resolveCoincidentTopology"]),t.topologyOffset={Polygon:{factor:0,offset:0},Line:{factor:0,offset:0},Point:{factor:0,offset:0}},Object.keys(i.Ay).forEach(t=>{e[t]=i.Ay[t]}),Object.keys(s).filter(e=>"modified"!==e).forEach(t=>{e[t]=s[t]}),a(e,t.topologyOffset,o.map(e=>({key:e,method:`RelativeCoincidentTopology${e}OffsetParameters`}))),e.getCoincidentTopologyPolygonOffsetParameters=()=>{let t=s.getResolveCoincidentTopologyPolygonOffsetParameters(),r=e.getRelativeCoincidentTopologyPolygonOffsetParameters();return{factor:t.factor+r.factor,offset:t.offset+r.offset}},e.getCoincidentTopologyLineOffsetParameters=()=>{let t=s.getResolveCoincidentTopologyLineOffsetParameters(),r=e.getRelativeCoincidentTopologyLineOffsetParameters();return{factor:t.factor+r.factor,offset:t.offset+r.offset}},e.getCoincidentTopologyPointOffsetParameter=()=>{let t=s.getResolveCoincidentTopologyPointOffsetParameters(),r=e.getRelativeCoincidentTopologyPointOffsetParameters();return{factor:t.factor+r.factor,offset:t.offset+r.offset}}},staticOffsetAPI:s,otherStaticMethods:i.Ay,CATEGORIES:o,Resolve:i.XK}},10598:(e,t,r)=>{"use strict";var n=r(70192),i=r(97442),a=r(59998),o=r(73904),s=r(34470),l=r(4101),u=r(60212),c=r(10353),d=r(34699),p=r(894);class m extends p.A{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{shadow:!0,preventHandleOutsideImage:!1}}){super(e,t),this.addNewAnnotation=e=>{let t,r,{currentPoints:a,element:o}=e.detail,c=a.world,d=(0,n.kJ)(o),{viewport:p,renderingEngine:m}=d;this.isDrawing=!0;let{viewPlaneNormal:h,viewUp:f}=p.getCamera(),g=this.getTargetId(p);if(p instanceof n.hS)t=g.split("imageId:")[1];else{r=n.BF.getVolumeId(g);let e=n.PP.getVolume(r);t=n.BF.getClosestImageId(e,c,h)}let v={highlighted:!0,invalidated:!0,metadata:{viewPlaneNormal:[...h],enabledElement:d,viewUp:[...f],FrameOfReferenceUID:p.getFrameOfReferenceUID(),referencedImageId:t,toolName:this.getToolName(),volumeId:r},data:{label:"",handles:{textBox:{hasMoved:!1,worldPosition:null,worldBoundingBox:null},points:[[...c],[...c],[...c],[...c]],activeHandleIndex:null},segmentationId:null}};(0,i.lC)(v,o);let y=(0,s.Q0)(o,this.getToolName());return this.editData={annotation:v,viewportIdsToRender:y,handleIndex:3,newAnnotation:!0,hasMoved:!1},this._activateDraw(o),(0,l.lY)(o),e.preventDefault(),(0,u.A)(y),v},this.renderAnnotation=(e,t)=>{let r=!1,{viewport:n}=e,{element:s}=n,l=(0,i.Rh)(this.getToolName(),s);if(!l?.length||(l=this.filterInteractableAnnotationsForElement(s,l),!l?.length))return r;let u={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let e=0;en.worldToCanvas(e));u.annotationUID=m;let y=this.getStyle("lineWidth",u,p),b=this.getStyle("lineDash",u,p),I=this.getStyle("color",u,p);if(!n.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}(0,d.triggerAnnotationModified)(p,s),(0,c.YY)(m)&&((0,a.Gh)(m)||this.editData||null===g||(i=[v[g]]),i&&(0,o.qX)(t,m,"0",i,{color:I}),(0,o.tk)(t,m,"0",v[0],v[3],{color:I,lineDash:b,lineWidth:y}),r=!0)}return r}}}m.toolName="RectangleROIThreshold"},10807:(e,t,r)=>{"use strict";r.d(t,{A:()=>p,l:()=>c});var n=r(56109),i=r(97938),a=r(39216),o=r(65110),s=r(77280),l=r(54268);let u=s.Yw.Prefetch;async function c(e){let t=function(e){let t,{imageIds:r,metadata:n}=e;if(r?.length){let e=Math.floor(r.length/2),n=r[e],i=a.get(s.nb.VOI_LUT,n);if(i&&i.windowWidth&&i.windowCenter){i?.voiLUTFunction&&((t={}).voiLUTFunction=i?.voiLUTFunction);let{windowWidth:e,windowCenter:r}=i,n=Array.isArray(e)?e[0]:e,a=Array.isArray(r)?r[0]:r;0!==n&&(t={windowWidth:n,windowCenter:a})}}else t=n.voiLut[0];if(t&&(0!==t.windowWidth||0!==t.windowCenter)){let{lower:e,upper:r}=o.toLowHighRange(Number(t.windowWidth),Number(t.windowCenter),t.voiLUTFunction);if(isNaN(e)||isNaN(r))return;return{lower:e,upper:r}}}(e);return!t&&e.imageIds.length&&function(e){let{imageIds:t,referencedImageIds:r}=e;if(r?.length)return!0;let n=t[Math.floor(t.length/2)];return!(!n||n.startsWith("derived:"))&&n.includes(":")}(e)&&(t=await d(e),t=function(e,t){var r,n;let i=e.imageIds,o=Math.floor(i.length/2),l=i[o];return(r=(a.get(s.nb.GENERAL_SERIES,l)||{}).modality,n=e,"PT"===r&&n.isPreScaled&&n.scaling?.PT.suvbw)?{lower:0,upper:5}:t}(e,t)),t}async function d(e){let t,{imageIds:r}=e,n=Math.floor(r.length/2),o=e.imageIds[n],{modality:c}=a.get(s.nb.GENERAL_SERIES,o)||{},d=a.get(s.nb.MODALITY_LUT,o)||{},p={rescaleSlope:d.rescaleSlope,rescaleIntercept:d.rescaleIntercept,modality:c};if("PT"===c){let e=a.get(s.nb.SCALING,o);e&&(t={...p,suvbw:e.suvbw})}let m={priority:0,requestType:u,preScale:{scalingParameters:t}},h=l.Ay.getImage(o);e.referencedImageIds?.length||(h=await (0,i.loadAndCacheImage)(o,{...m,ignoreCache:!0}));let{min:f,max:g}=h.voxelManager.getMinMax();return f?.length>1&&(f=Math.min(...f),g=Math.max(...g)),{lower:f,upper:g}}let p=async function e(e,t){let r=await c(t);r&&(0!==r.lower||0!==r.upper)&&void 0!==r.lower&&void 0!==r.upper&&(function(e){let t=e.getProperty(),r=t.getRGBTransferFunction(0);return r||((r=n.Ay.newInstance()).addRGBPoint(0,0,0,0),r.addRGBPoint(1,1,1,1),t.setRGBTransferFunction(0,r),"setUseLookupTableScalarRange"in t&&t.setUseLookupTableScalarRange?.(!0)),r})(e).setMappingRange(r.lower,r.upper)}},10830:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(70192),i=r(50923),a=r(91336);let o=(e,t,r,o)=>{let{xDir:s,yDir:l,spacing:u}=o,{viewport:c}=(0,n.kJ)(e);if(!t.length)return t.push(r),console.log(">>>>> !canvasPoints. :: RETURN"),1;let d=c.canvasToWorld(t[t.length-1]),p=c.canvasToWorld(r),m=i.vt();i.Re(m,p,d);let h=Math.abs(i.Om(m,s)),f=Math.abs(i.Om(m,l)),g=Math.max(Math.floor(h/u[0]),Math.floor(f/u[0]));if(g>1){let e=t[t.length-1],n=a.xg(e,r),i=a.vt();a.Re(i,r,e),a.hZ(i,i[0]/n,i[1]/n);let o=n/g;for(let r=1;r<=g;r++)t.push([e[0]+o*i[0]*r,e[1]+o*i[1]*r])}else t.push(r);return g}},10871:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shadowTree_signalASlotChange=l,t.shadowTree_isConnected=function(e){return i.Guard.isDocumentNode((0,o.tree_rootNode)(e,!0))},t.shadowTree_isAssigned=function(e){return null!==e._assignedSlot},t.shadowTree_findASlot=u,t.shadowTree_findSlotables=c,t.shadowTree_findFlattenedSlotables=function e(t){let r=[],n=(0,o.tree_rootNode)(t);if(!i.Guard.isShadowRoot(n))return r;let s=c(t);if((0,a.isEmpty)(s))for(let e of t._children)i.Guard.isSlotable(e)&&s.push(e);for(let t of s)if(i.Guard.isSlot(t)&&i.Guard.isShadowRoot((0,o.tree_rootNode)(t))){let n=e(t);r.push(...n)}else r.push(t);return r},t.shadowTree_assignSlotables=d,t.shadowTree_assignSlotablesForATree=function(e){let t=(0,o.tree_getFirstDescendantNode)(e,!0,!1,e=>i.Guard.isSlot(e));for(;null!==t;)d(t),t=(0,o.tree_getNextDescendantNode)(e,t,!0,!1,e=>i.Guard.isSlot(e))},t.shadowTree_assignASlot=function(e){let t=u(e);null!==t&&d(t)};let n=r(60957),i=r(79663),a=r(16950),o=r(29963),s=r(38020);function l(e){n.dom.window._signalSlots.add(e),(0,s.observer_queueAMutationObserverMicrotask)()}function u(e,t=!1){let r=i.Cast.asNode(e)._parent;if(null===r)return null;let n=r._shadowRoot||null;if(null===n||t&&"open"!==n._mode)return null;let a=(0,o.tree_getFirstDescendantNode)(n,!1,!0,e=>i.Guard.isSlot(e));for(;null!==a;){if(a._name===e._name)return a;a=(0,o.tree_getNextDescendantNode)(n,a,!1,!0,e=>i.Guard.isSlot(e))}return null}function c(e){let t=[],r=(0,o.tree_rootNode)(e);if(!i.Guard.isShadowRoot(r))return t;for(let n of r._host._children)i.Guard.isSlotable(n)&&u(n)===e&&t.push(n);return t}function d(e){let t=c(e);if(t.length===e._assignedNodes.length){let r=!0;for(let n=0;n{"use strict";r.d(t,{AL:()=>a,F4:()=>i,Pd:()=>o});let n=new WeakMap;function i(e){n.set(e,[])}function a(e,t){let r=n.get(e);r||(r=[],n.set(e,r)),r.push({x:t.x,y:t.y,width:t.width,height:t.height})}function o(e){return n.get(e)||[]}},11107:(e,t,r)=>{"use strict";r.d(t,{I:()=>i});var n=Object.defineProperty,i=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:"Module"}),r}},11185:(e,t,r)=>{"use strict";r.d(t,{QG:()=>i,Y2:()=>n,gI:()=>a,vU:()=>o});let n=36,i=6,a=24,o=300},11239:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(91336),i=r(95525);function a(e,t,r,o=!0){let s,l;o?(l=e.length-1,s=0):(l=0,s=1);let u=[];for(let n=s;n{let i=[e[r[0]],e[r[1]]],a=[(i[0][0]+i[1][0])/2,(i[0][1]+i[1][1])/2];c.push(n.Io(a,t))});let d=Math.min(...c);return{segment:u[c.indexOf(d)],distance:d}}},11292:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XMLWriter=void 0;let n=r(16950),i=r(5309),a=r(81320),o=r(79663);class s extends a.BaseWriter{_refs;_indentation={};_lengthToLastNewline=0;constructor(e,t){super(e),this._writerOptions=(0,n.applyDefaults)(t,{wellFormed:!1,headless:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,width:0,allowEmptyTags:!1,indentTextOnlyNodes:!1,spaceBeforeSlash:!1})}serialize(e){return this._refs={suppressPretty:!1,emptyNode:!1,markup:""},e.nodeType!==i.NodeType.Document||this._writerOptions.headless||this.declaration(this._builderOptions.version,this._builderOptions.encoding,this._builderOptions.standalone),this.serializeNode(e,this._writerOptions.wellFormed),this._writerOptions.prettyPrint&&this._refs.markup.slice(-this._writerOptions.newline.length)===this._writerOptions.newline&&(this._refs.markup=this._refs.markup.slice(0,-this._writerOptions.newline.length)),this._refs.markup}declaration(e,t,r){this._beginLine(),this._refs.markup+='",this._endLine()}docType(e,t,r){this._beginLine(),t&&r?this._refs.markup+="':t?this._refs.markup+="':r?this._refs.markup+="':this._refs.markup+="",this._endLine()}openTagBegin(e){this._beginLine(),this._refs.markup+="<"+e}openTagEnd(e,t,r){if(this._refs.suppressPretty=!1,this._refs.emptyNode=!1,this._writerOptions.prettyPrint&&!t&&!r){let e=!0,t=!0,r=this.currentNode.firstChild,n=0,i=0;for(;r;){if(o.Guard.isExclusiveTextNode(r))i++;else if(o.Guard.isCDATASectionNode(r))n++;else{e=!1,t=!1;break}""!==r.data&&(t=!1),r=r.nextSibling}this._refs.suppressPretty=!this._writerOptions.indentTextOnlyNodes&&e&&(n<=1&&0===i||0===n),this._refs.emptyNode=t}(r||t||this._refs.emptyNode)&&this._writerOptions.allowEmptyTags?this._refs.markup+=">":this._refs.markup+=r?" />":t||this._refs.emptyNode?this._writerOptions.spaceBeforeSlash?" />":"/>":">",this._endLine()}closeTag(e){this._refs.emptyNode||(this._beginLine(),this._refs.markup+=""),this._refs.suppressPretty=!1,this._refs.emptyNode=!1,this._endLine()}attribute(e,t){let r=e+'="'+t+'"';this._writerOptions.prettyPrint&&this._writerOptions.width>0&&this._refs.markup.length-this._lengthToLastNewline+1+r.length>this._writerOptions.width?(this._endLine(),this._beginLine(),this._refs.markup+=this._indent(1)+r):this._refs.markup+=" "+r}text(e){""!==e&&(this._beginLine(),this._refs.markup+=e,this._endLine())}cdata(e){""!==e&&(this._beginLine(),this._refs.markup+="",this._endLine())}comment(e){this._beginLine(),this._refs.markup+="\x3c!--"+e+"--\x3e",this._endLine()}instruction(e,t){this._beginLine(),this._refs.markup+="",this._endLine()}_beginLine(){this._writerOptions.prettyPrint&&!this._refs.suppressPretty&&(this._refs.markup+=this._indent(this._writerOptions.offset+this.level))}_endLine(){this._writerOptions.prettyPrint&&!this._refs.suppressPretty&&(this._refs.markup+=this._writerOptions.newline,this._lengthToLastNewline=this._refs.markup.length)}_indent(e){if(e<=0)return"";{if(void 0!==this._indentation[e])return this._indentation[e];let t=this._writerOptions.indent.repeat(e);return this._indentation[e]=t,t}}}t.XMLWriter=s},11455:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dom_runRemovingSteps=function(e,t){},t.dom_runCloningSteps=function(e,t,r,n){},t.dom_runAdoptingSteps=function(e,t){},t.dom_runAttributeChangeSteps=function(e,t,r,i,a){for(let o of(n.dom.features.slots&&(c.call(e,e,t,r,i,a),u.call(e,e,t,r,i,a)),d.call(e,e,t,i,a),e._attributeChangeSteps))o.call(e,e,t,r,i,a)},t.dom_runInsertionSteps=function(e){},t.dom_runNodeIteratorPreRemovingSteps=function(e,t){l.call(e,e,t)},t.dom_hasSupportedTokens=function(e){return s.has(e)},t.dom_getSupportedTokens=function(e){return s.get(e)||new Set},t.dom_runEventConstructingSteps=function(e){},t.dom_runChildTextContentChangeSteps=function(e){};let n=r(60957),i=r(29963),a=r(79663),o=r(10871),s=new Map;function l(e,t){if(t!==e._root&&(0,i.tree_isAncestorOf)(e._reference,t,!0)){if(e._pointerBeforeReference)for(;;){let r=(0,i.tree_getFollowingNode)(e._root,t);if(null!==r&&(0,i.tree_isDescendantOf)(e._root,r,!0)&&!(0,i.tree_isDescendantOf)(t,r,!0)){e._reference=r;return}if(null===r){e._pointerBeforeReference=!1;return}}if(null===t._previousSibling)null!==t._parent&&(e._reference=t._parent);else{let r=t._previousSibling,n=(0,i.tree_getFirstDescendantNode)(t._previousSibling,!0,!1);for(;null!==n;)null!==n&&(r=n),n=(0,i.tree_getNextDescendantNode)(t._previousSibling,n,!0,!1);e._reference=r}}}function u(e,t,r,n,s){a.Guard.isSlot(e)&&"name"===t&&null===s&&n!==r&&(null!==n||""!==r)&&(""!==n||null!==r)&&(null===n||""===n?e._name="":e._name=n,(0,o.shadowTree_assignSlotablesForATree)((0,i.tree_rootNode)(e)))}function c(e,t,r,n,i){a.Guard.isSlotable(e)&&"slot"===t&&null===i&&n!==r&&(null!==n||""!==r)&&(""!==n||null!==r)&&(null===n||""===n?e._name="":e._name=n,(0,o.shadowTree_isAssigned)(e)&&(0,o.shadowTree_assignSlotables)(e._assignedSlot),(0,o.shadowTree_assignASlot)(e))}function d(e,t,r,n){"id"===t&&null===n&&(r?e._uniqueIdentifier=r:e._uniqueIdentifier=void 0)}},11480:(e,t,r)=>{"use strict";r.d(t,{L:()=>i});var n=r(85250);function i(e){let[t,r]=e;return n.fromScaling(n.create(),[t,r,1])}},11492:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(87635),i=r(70547);let a=function(e,t,r){let a=!0,o=!0;if("function"!=typeof e)throw TypeError("Expected a function");return(0,i.A)(r)&&(a="leading"in r?!!r.leading:a,o="trailing"in r?!!r.trailing:o),(0,n.A)(e,t,{leading:a,trailing:o,maxWait:t})}},11526:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HTMLCollectionImpl=void 0;let n=r(57226),i=r(47518),a=r(79663),o=r(16950);class s{_live=!0;_root;_filter;static reservedNames=["_root","_live","_filter","length","item","namedItem","get","set"];constructor(e,t){return this._root=e,this._filter=t,new Proxy(this,this)}get length(){let e=0,t=(0,i.tree_getFirstDescendantNode)(this._root,!1,!1,e=>a.Guard.isElementNode(e)&&this._filter(e));for(;null!==t;)e++,t=(0,i.tree_getNextDescendantNode)(this._root,t,!1,!1,e=>a.Guard.isElementNode(e)&&this._filter(e));return e}item(e){let t=0,r=(0,i.tree_getFirstDescendantNode)(this._root,!1,!1,e=>a.Guard.isElementNode(e)&&this._filter(e));for(;null!==r;){if(t===e)return r;t++,r=(0,i.tree_getNextDescendantNode)(this._root,r,!1,!1,e=>a.Guard.isElementNode(e)&&this._filter(e))}return null}namedItem(e){if(""===e)return null;let t=(0,i.tree_getFirstDescendantNode)(this._root,!1,!1,e=>a.Guard.isElementNode(e)&&this._filter(e));for(;null!=t;){if(t._uniqueIdentifier===e)return t;if(t._namespace===n.namespace.HTML)for(let r=0;ra.Guard.isElementNode(e)&&this._filter(e))}return null}[Symbol.iterator](){let e=this._root,t=this._filter,r=(0,i.tree_getFirstDescendantNode)(e,!1,!1,e=>a.Guard.isElementNode(e)&&t(e));return{next(){if(null===r)return{done:!0,value:null};{let n={done:!1,value:r};return r=(0,i.tree_getNextDescendantNode)(e,r,!1,!1,e=>a.Guard.isElementNode(e)&&t(e)),n}}}}get(e,t,r){if(!(0,o.isString)(t)||-1!==s.reservedNames.indexOf(t))return Reflect.get(e,t,r);let n=Number(t);return isNaN(n)?e.namedItem(t)||void 0:e.item(n)||void 0}set(e,t,r,n){if(!(0,o.isString)(t)||-1!==s.reservedNames.indexOf(t))return Reflect.set(e,t,r,n);let a=Number(t),l=isNaN(a)?e.namedItem(t)||void 0:e.item(a)||void 0;return!!l&&!!l._parent&&((0,i.mutation_replace)(l,r,l._parent),!0)}static _create(e,t=()=>!0){return new s(e,t)}}t.HTMLCollectionImpl=s},11601:(e,t,r)=>{"use strict";r.d(t,{p:()=>i});var n=r(19204);function i(e,t,r){let i=(0,n.c)(e,t,r);if(!i)throw Error("Invalid viewport type");return i.modality}},11623:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ShadowRootImpl=void 0;let n=r(43918),i=r(16950),a=r(47518);class o extends n.DocumentFragmentImpl{_host;_mode;constructor(e,t){super(),this._host=e,this._mode=t}get mode(){return this._mode}get host(){return this._host}_getTheParent(e){return e._composedFlag||(0,i.isEmpty)(e._path)||(0,a.tree_rootNode)(e._path[0].invocationTarget)!==this?this._host:null}static _create(e,t){return new o(t,"closed")}}t.ShadowRootImpl=o},11701:(e,t,r)=>{"use strict";r.d(t,{$A:()=>D,Ae:()=>ef,Ay:()=>eP,BE:()=>em,EN:()=>eI,HK:()=>_,L3:()=>eg,LI:()=>f,LQ:()=>ev,M8:()=>eA,ML:()=>H,Md:()=>Y,Nc:()=>ep,Om:()=>E,RI:()=>g,Re:()=>w,S7:()=>F,S8:()=>M,WK:()=>h,WQ:()=>S,Z6:()=>eT,aA:()=>N,bi:()=>eo,eE:()=>ei,el:()=>m,fm:()=>L,hT:()=>es,m6:()=>U,nY:()=>j,n_:()=>k,pE:()=>eh,r6:()=>A,rx:()=>en,tP:()=>C,xb:()=>R,xk:()=>eS}),r(11107);var n=r(17042),i=r(39311),a=r(68173),{vtkErrorMacro:o,vtkWarningMacro:s}=n.Ay,l=0;function u(e){return()=>o(`vtkMath::${e} - NOT IMPLEMENTED`)}function c(e,t,r,n){let i;for(let a=0;a0&&(n="+"),+`${Math.round(`${+r[0]}e${n}${+r[1]+t}`)}e-${t}`}function Y(e,t=[0,0,0],r=0){return t[0]=X(e[0],r),t[1]=X(e[1],r),t[2]=X(e[2],r),t}function Z(e,t,r,n){let i,a,o,l,u,c,m,h,f,g,v,y,b,I,x,C,A=p(t),T=p(t),S=(e,t,r)=>{I=e[t],b=e[r],e[t]=I-y*(b+I*g),e[r]=b+y*(I-b*g)};for(K(t,n),u=0;u3&&Math.abs(r[u])+I===Math.abs(r[u])&&Math.abs(r[l])+I===Math.abs(r[l]))e[u*t+l]=0;else if(Math.abs(e[u*t+l])>m){for(Math.abs(b=r[l]-r[u])+I===Math.abs(b)?f=e[u*t+l]/b:(f=1/(Math.abs(h=.5*b/e[u*t+l])+Math.sqrt(1+h*h)),h<0&&(f=-f)),x=1/Math.sqrt(1+f*f),g=(y=f*x)/(1+x),b=f*e[u*t+l],T[u]-=b,T[l]+=b,r[u]-=b,r[l]+=b,e[u*t+l]=0,a=0;a<=u-1;a++)S(e,a*t+u,a*t+l);for(a=u+1;a<=l-1;a++)S(e,u*t+a,a*t+l);for(a=l+1;a=20)return s("vtkMath::Jacobi: Error extracting eigenfunctions"),0;for(a=0;a=C||1e-12>Math.abs(r[i]-C))&&(C=r[o=i]);o!==a&&(r[o]=r[a],r[a]=C,d(n,t,a,o))}let w=(t>>1)+(1&t);for(c=0,i=0;i=0&&c++;if(c(r=a>i?a:i)?o:r,n[e]=1,0!==r&&(n[e]/=r)}let a=Math.abs(t[0])*n[0],o=Math.abs(t[3])*n[1],s=Math.abs(t[6])*n[2];i[0]=0,o>=(r=a)&&(r=o,i[0]=1),s>=r&&(i[0]=2),0!==i[0]&&(d(t,3,i[0],0),n[i[0]]=n[0]);let l=Math.abs(t[4])*n[1],u=Math.abs(t[7])*n[2];i[1]=1,u>=(r=l)&&(i[1]=2,d(t,3,1,2)),i[2]=2;let c=0;if(0>z(t)){c=1;for(let e=0;e<9;e++)t[e]=-t[e]}let m=p(4);if(J(t,m),q(m,t),c)for(let e=0;e<9;e++)t[e]=-t[e];1!==i[1]&&d(t,3,i[1],1),0!==i[0]&&d(t,3,i[0],0)}function ee(e,t,r){let n,i,a,o,s,l;if(Z([...e],3,t,r),t[0]===t[1]&&t[0]===t[2])return void $(r);for(W(r,r),n=0;n<3;n++)if(t[(n+1)%3]===t[(n+2)%3]){for(i=1,l=Math.abs(r[3*n]),o=0;i<3;i++)l<(s=Math.abs(r[3*n+i]))&&(l=s,o=i);o!==n&&(s=t[o],t[o]=t[n],t[n]=s,c(r,3,n,o)),r[3*o+o]<0&&(r[3*o]=-r[3*o],r[3*o+1]=-r[3*o+1],r[3*o+2]=-r[3*o+2]),i=(o+1)%3,a=(o+2)%3,r[3*i]=0,r[3*i+1]=0,r[3*i+2]=0,r[3*i+i]=1;let e=D([r[3*o],r[3*o+1],r[3*o+2]],[r[3*i],r[3*i+1],r[3*i+2]],[]);M(e);let u=D(e,[r[3*o],r[3*o+1],r[3*o+2]],[]);for(let t=0;t<3;t++)r[3*a+t]=e[t],r[3*i+t]=u[t];W(r,r);return}for(n=1,l=Math.abs(r[0]),o=0;n<3;n++)l<(s=Math.abs(r[3*n]))&&(l=s,o=n);if(0!==o){let e=t[o];t[o]=t[0],t[0]=e,c(r,3,o,0)}if(Math.abs(r[4])z(r)&&(r[6]=-r[6],r[7]=-r[7],r[8]=-r[8]),W(r,r)}function et(e,t,r){let n,i,a,o,l,u,c,d=0,m=p(r);for(n=0;no&&(o=c);if(0===o)return s("Unable to factor linear system"),0;m[n]=1/o}for(i=0;i=o&&(o=u,d=n)}if(i!==d){for(a=0;a=Math.abs(e[i*r+i]))return s("Unable to factor linear system"),0;if(i!==r-1)for(u=1/e[i*r+i],n=i+1;n=0)for(a=o;a<=i-1;a++)l-=e[i*n+a]*r[a];else 0!==l&&(o=i);r[i]=l}for(i=n-1;i>=0;i--){for(l=r[i],a=i+1;al?l=a:al?l=o:o0?(l-u)/l:0)>0?(r=i===l?s*(a-o)/(l-u):a===l?1/3+s*(o-i)/(l-u):2/3+s*(i-a)/(l-u))<0&&(r+=1):r=0,t[0]=r,t[1]=n,t[2]=c}function es(e,t){let r,n,i,[a,o,s]=e,l=1/3,u=1/6,c=2/3,d=5/6;a>1/6&&a<=l?(n=1,r=(l-a)/u,i=0):a>l&&a<=.5?(n=1,i=(a-l)/u,r=0):a>.5&&a<=c?(i=1,n=(c-a)/u,r=0):a>c&&a<=d?(i=1,r=(a-c)/u,n=0):a>d&&a<=1?(r=1,i=(1-a)/u,n=0):(r=1,n=a/u,i=0),r=o*r+(1-o),n=o*n+(1-o),i=o*i+(1-o),r*=s,n*=s,i*=s,t[0]=r,t[1]=n,t[2]=i}function el(e,t){let[r,n,i]=e,a=(r+16)/116,o=n/500+a,s=a-i/200;a**3>.008856?a**=3:a=(a-16/116)/7.787,o**3>.008856?o**=3:o=(o-16/116)/7.787,s**3>.008856?s**=3:s=(s-16/116)/7.787,t[0]=.9505*o,t[1]=+a,t[2]=1.089*s}function eu(e,t){let[r,n,i]=e,a=r/.9505,o=n/1,s=i/1.089;a>.008856?a**=1/3:a=7.787*a+16/116,o>.008856?o**=1/3:o=7.787*o+16/116,s>.008856?s**=1/3:s=7.787*s+16/116,t[0]=116*o-16,t[1]=500*(a-o),t[2]=200*(o-s)}function ec(e,t){let[r,n,i]=e,a=3.2406*r+-1.5372*n+-.4986*i,o=-.9689*r+1.8758*n+.0415*i,s=.0557*r+-.204*n+1.057*i;a>.0031308?a=1.055*a**(1/2.4)-.055:a*=12.92,o>.0031308?o=1.055*o**(1/2.4)-.055:o*=12.92,s>.0031308?s=1.055*s**(1/2.4)-.055:s*=12.92;let l=a;l1&&(a/=l,o/=l,s/=l),a<0&&(a=0),o<0&&(o=0),s<0&&(s=0),t[0]=a,t[1]=o,t[2]=s}function ed(e,t){let[r,n,i]=e;r>.04045?r=((r+.055)/1.055)**2.4:r/=12.92,n>.04045?n=((n+.055)/1.055)**2.4:n/=12.92,i>.04045?i=((i+.055)/1.055)**2.4:i/=12.92,t[0]=.4124*r+.3576*n+.1805*i,t[1]=.2126*r+.7152*n+.0722*i,t[2]=.0193*r+.1192*n+.9505*i}function ep(e,t){let r=[0,0,0];ed(e,r),eu(r,t)}function em(e,t){let r=[0,0,0];el(e,r),ec(r,t)}function eh(e){return e[0]=1,e[1]=-1,e[2]=1,e[3]=-1,e[4]=1,e[5]=-1,e}function ef(e){return!(e[1]-e[0]<0)}function eg(e,t,r){return er?r:e}function ev(e,t,r,n=[0,0,0]){return n[0]=eg(e[0],t[0],r[0]),n[1]=eg(e[1],t[1],r[1]),n[2]=eg(e[2],t[2],r[2]),n}var ey=u("GetScalarTypeFittingRange"),eb=u("GetAdjustedScalarRange"),eI=e=>!Number.isFinite(e),{isFinite:ex,isNaN:eC}=Number,eA=eC;function eT(){return[].concat([Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE])}function eS(e,t=3){let r=Array(t),n=Array(t);for(let e=0;e0;i--){let a=-1/0,o=0,s=0;for(let l=0;l<=i;++l){let u=r[l];for(let r=0;r<=i;++r){let i=Math.abs(e[u+t*n[r]]);i>a&&(a=i,o=l,s=r)}}[r[i],r[o]]=[r[o],r[i]],[n[i],n[s]]=[n[s],n[i]]}let i=Array(t*t).fill(0);for(let a=0;a15?t.toString(16):`0${t.toString(16)}`}function eO(e){return Math.round(255*e)}var eP={Pi:()=>Math.PI,ldexp:function(e,t){return t>1023?898846567431158e293*e*2**(t-1023):t<-1074?5e-324*e*2**(t+1074):e*2**t},radiansFromDegrees:m,degreesFromRadians:h,round:f,floor:g,ceil:v,ceilLog2:I,min:y,max:b,arrayMin:function(e,t=0,r=1){let n=1/0;for(let i=t,a=e.length;i=0;--i)if(r[i]l&&s>u?(i=0,a=1,o=2):l>u?(i=1,a=2,o=0):(i=2,a=0,o=1);let d=e[i]/c,p=e[a]/c,m=e[o]/c,h=Math.sqrt(d*d+m*m);if(0!==n){let e=Math.sin(n),s=Math.cos(n);t&&(t[i]=(m*s-d*p*e)/h,t[a]=e*h,t[o]=(-(d*s)-p*m*e)/h),r&&(r[i]=(-(m*e)-d*p*s)/h,r[a]=s*h,r[o]=(d*e-p*m*s)/h)}else t&&(t[i]=m/h,t[a]=0,t[o]=-d/h),r&&(r[i]=-d*p/h,r[a]=h,r[o]=-p*m/h)},projectVector:function(e,t,r){let n=E(t,t);if(0===n)return r[0]=0,r[1]=0,r[2]=0,!1;let i=E(e,t)/n;for(let e=0;e<3;e++)r[e]=t[e];return O(r,i),!0},projectVector2D:function(e,t,r){let n=V(t,t);if(0===n)return r[0]=0,r[1]=0,!1;let i=V(e,t)/n;for(let e=0;e<2;e++)r[e]=t[e];return P(r,i),!0},distance2BetweenPoints:L,angleBetweenVectors:function(e,t){let r=[0,0,0];return D(e,t,r),Math.atan2(R(r),E(e,t))},gaussianAmplitude:function(e,t,r){return 1/Math.sqrt(2*Math.PI*t)*Math.exp(-(Math.abs(e-r)**2)/(2*t))},gaussianWeight:function(e,t,r){return Math.exp(-(Math.abs(e-r)**2)/(2*t))},dot2D:V,outer2D:function(e,t,r){r[0]=e[0]*t[0],r[1]=e[0]*t[1],r[2]=e[1]*t[0],r[3]=e[1]*t[1]},norm2D:B,normalize2D:F,determinant2x2:U,LUFactor3x3:function(e,t){let r,n,i,a=[0,0,0];for(let t=0;t<3;t++)i=Math.abs(e[3*t]),(n=Math.abs(e[3*t+1]))>i&&(i=n),(n=Math.abs(e[3*t+2]))>i&&(i=n),a[t]=1/i;i=a[0]*Math.abs(e[0]),r=0,(n=a[1]*Math.abs(e[3]))>=i&&(i=n,r=1),(n=a[2]*Math.abs(e[6]))>=i&&(r=2),0!==r&&(c(e,3,r,0),a[r]=a[0]),t[0]=r,e[3]/=e[0],e[6]/=e[0],e[4]-=e[3]*e[1],e[7]-=e[6]*e[1],i=a[1]*Math.abs(e[4]),r=1,(n=a[2]*Math.abs(e[7]))>=i&&(r=2,c(e,3,1,2),a[2]=a[1]),t[1]=r,e[7]/=e[4],e[5]-=e[3]*e[2],e[8]-=e[6]*e[2]+e[7]*e[5],t[2]=2},LUSolve3x3:function(e,t,r){let n=r[t[0]];r[t[0]]=r[0],r[0]=n,n=r[t[1]],r[t[1]]=r[1],r[1]=n-e[3]*r[0],n=r[t[2]],r[t[2]]=r[2],r[2]=n-e[6]*r[0]-e[7]*r[1],r[2]/=e[8],r[1]=(r[1]-e[5]*r[2])/e[4],r[0]=(r[0]-e[1]*r[1]-e[2]*r[2])/e[0]},linearSolve3x3:function(e,t,r){let n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=+U(s,c,l,d),m=-U(o,u,l,d),h=+U(o,u,s,c),f=-U(i,c,a,d),g=+U(n,u,a,d),v=-U(n,u,i,c),y=+U(i,s,a,l),b=-U(n,o,a,l),I=+U(n,o,i,s),x=n*p+i*m+a*h,C=p*t[0]+f*t[1]+y*t[2],A=m*t[0]+g*t[1]+b*t[2],T=h*t[0]+v*t[1]+I*t[2];r[0]=C/x,r[1]=A/x,r[2]=T/x},multiply3x3_vect3:k,multiply3x3_mat3:G,multiplyMatrix:function(e,t,r,n,i,a,s){n!==i&&o("Number of columns of A must match number of rows of B.");let l=[...e],u=[...t];for(let e=0;en&&(n=Math.abs(e[r*t+i]));for(let n=0;n1e-12&&(h=0,m[c]=0);if(h&&1===i)return s("Detected homogeneous system (Y=0), calling SolveHomogeneousLeastSquares()"),ea(e,t,r,a);if(h)g=1;else for(c=0;ct[1]?t[1]:e)-t[0])/(t[1]-t[0])),r},getScalarTypeFittingRange:ey,getAdjustedScalarRange:eb,extentIsWithinOtherExtent:function(e,t){if(!e||!t)return 0;for(let r=0;r<6;r+=2)if(e[r]t[r+1]||e[r+1]t[r+1])return 0;return 1},boundsIsWithinOtherBounds:function(e,t,r){if(!e||!t)return 0;for(let n=0;n<6;n+=2)if(e[n]+r[n/2]t[n+1]||e[n+1]+r[n/2]t[n+1])return 0;return 1},pointIsWithinBounds:function(e,t,r){if(!e||!t||!r)return 0;for(let n=0;n<3;n++)if(e[n]+r[n]t[2*n+1])return 0;return 1},solve3PointCircle:function(e,t,r,n){let i=p(3),a=p(3),o=p(3),s=p(3),l=p(3),u=p(3);for(let n=0;n<3;++n)i[n]=e[n]-t[n],a[n]=t[n]-r[n],o[n]=r[n]-e[n],s[n]=-i[n],l[n]=-a[n],u[n]=-o[n];let c=R(s),d=R(l),m=R(o),h=p(3);D(i,a,h);let f=R(h),g=2*f*f,v=d*d*E(i,u)/g,y=m*m*E(s,a)/g,b=c*c*E(o,l)/g;for(let i=0;i<3;++i)n[i]=v*e[i]+y*t[i]+b*r[i];return c*d*m/(2*f)},inf:1/0,negInf:-1/0,isInf:eI,isNan:eC,isNaN:eC,isFinite:ex,createUninitializedBounds:eT,getMajorAxisIndex:function(e){let t=-1,r=-1;for(let n=0;nt&&(r=n,t=i)}return r},getMinorAxisIndex:function(e){let t=1/0,r=-1;for(let n=0;n{"use strict";r.d(t,{P:()=>i});var n=r(50923);function i(e,t,r){let i=n.$A(n.vt(),t,r);n.S8(i,i);let a=e.getSpatialExtent(),o=a[0],s=a[1],l=a[2],u=a[3],c=a[4],d=a[5];return[[o,l,c],[s,l,c],[o,u,c],[s,u,c],[o,l,d],[s,l,d],[o,u,d],[s,u,d]].map(a=>{let o=[0,0,0];return e.indexToWorld(a,o),[n.Om(o,i),n.Om(o,r),n.Om(o,t)]})}},11877:(e,t,r)=>{"use strict";r.d(t,{A:()=>d});var n=r(77280),i=r(2523),a=r(62685),o=r(92449),s=r(92154),l=r(35088),u=r(69228),c=r(3922);function d(e,t){if(!(0,l.Ay)(e.element))throw Error("Scroll::Viewport is not enabled (it might be disabled)");if(e instanceof i.A&&0===e.getImageIds().length)throw Error("Scroll::Stack Viewport has no images");let{volumeId:r,delta:d,scrollSlabs:p}=t;if(e instanceof a.A)!function(e,t,r,i=!1){let{numScrollSteps:a,currentStepIndex:l,sliceRangeInfo:d}=(0,o.A)(e,t,i);if(0===a||!d)return;let{sliceRange:p,spacingInNormalDirection:m,camera:h}=d,{focalPoint:f,viewPlaneNormal:g,position:v}=h,{newFocalPoint:y,newPosition:b}=(0,s.A)(f,v,p,g,m,r);e.setCamera({focalPoint:y,position:b}),e.render();let I=l+r,x={volumeId:t,viewport:e,delta:r,desiredStepIndex:I,currentStepIndex:l,numScrollSteps:a,currentImageId:e.getCurrentImageId()};(I>a||I<0)&&e.getCurrentImageId()?(0,u.A)(c.A,n.sV.VOLUME_VIEWPORT_SCROLL_OUT_OF_BOUNDS,x):(0,u.A)(c.A,n.sV.VOLUME_VIEWPORT_SCROLL,x)}(e,r,d,p);else{if("function"!=typeof e.getCurrentImageIdIndex||"function"!=typeof e.scroll)return;let r=e.getCurrentImageIdIndex();(r+d>e.getImageIds().length-1||r+d<0)&&(0,u.A)(c.A,n.sV.STACK_SCROLL_OUT_OF_BOUNDS,{imageIdIndex:r,direction:d}),e.scroll(d,t.debounceLoading,t.loop)}}},11937:(e,t,r)=>{"use strict";r.d(t,{q:()=>a});var n=r(42215),i=r(77280);function a(){let e=(0,n.D0)();return e?.rendering?.renderingEngineMode===i.FJ.ContextPool}},12138:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(63701),i=r(68742);function a(e,t,r,o=!0){let s=[],l=(0,n.A)(e,t,r,o);for(let n=0;n{"use strict";r(70192),r(36908),r(6972),r(5966),r(91006),r(46702)},12323:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WindowImpl=void 0;let n=r(34976),i=r(16950),a=r(47518);class o extends n.EventTargetImpl{_currentEvent;_signalSlots=new Set;_mutationObserverMicrotaskQueued=!1;_mutationObservers=new Set;_associatedDocument;_iteratorList=new i.FixedSizeSet;constructor(){super(),this._associatedDocument=(0,a.create_document)()}get document(){return this._associatedDocument}get event(){return this._currentEvent}static _create(){return new o}}t.WindowImpl=o},12412:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>R});var n=r(17042),i=r(11701),a=r(87352),o=r(58804),s=r(21122),l=r(54261),u=r(36119),c=r(72571),d=r(99298),p=r(64541),{vtkErrorMacro:m}=n.Ay,h={numberOfColors:256,hueRange:[0,.66667],saturationRange:[1,1],valueRange:[1,1],alphaRange:[1,1],nanColor:[.5,0,0,1],belowRangeColor:[0,0,0,1],aboveRangeColor:[1,1,1,1],useAboveRangeColor:!1,useBelowRangeColor:!1,alpha:1},f={newInstance:n.Ay.newInstance(function(e,t,r={}){Object.assign(t,h,r),p.Ay.extend(e,t,r),t.table||(t.table=[]),t.buildTime={},n.Ay.obj(t.buildTime),t.opaqueFlagBuildTime={},n.Ay.obj(t.opaqueFlagBuildTime,{mtime:0}),t.insertTime={},n.Ay.obj(t.insertTime,{mtime:0}),n.Ay.get(e,t,["buildTime"]),n.Ay.setGet(e,t,["numberOfColors","useAboveRangeColor","useBelowRangeColor"]),n.Ay.setArray(e,t,["alphaRange","hueRange","saturationRange","valueRange"],2),n.Ay.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),n.Ay.getArray(e,t,["hueRange","saturationRange","valueRange","alphaRange","nanColor","belowRangeColor","aboveRangeColor"]),t.classHierarchy.push("vtkLookupTable"),e.isOpaque=()=>{if(t.opaqueFlagBuildTime.getMTime()!1,e.getNumberOfAvailableColors=()=>t.table.length/4-3,e.linearIndexLookup=(e,t)=>{let r=0,n=Number(e);return Math.floor(r=nt.range[1]?t.maxIndex+1+1.5:(r=(n+t.shift)*t.scale){let a=4*((0,i.M8)(t)?Math.floor(n.maxIndex+1.5+2):e.linearIndexLookup(t,n));return r.slice(a,a+4)},e.indexedLookupFunction=(r,n,i)=>{let a=e.getAnnotatedValueIndexInternal(r);-1===a&&(a=t.numberOfColors+2);let o=4*a;return[n[o],n[o+1],n[o+2],n[o+3]]},e.lookupShiftAndScale=(e,t)=>{t.shift=-e[0],t.scale=Number.MAX_VALUE,e[1]>e[0]&&(t.scale=(t.maxIndex+1)/(e[1]-e[0]))},e.mapScalarsThroughTable=(r,n,i,a)=>{let o=e.linearLookup;t.indexedLookup&&(o=e.indexedLookupFunction);let s=e.getMappingRange(),l={maxIndex:e.getNumberOfColors()-1,range:s,shift:0,scale:0};e.lookupShiftAndScale(s,l);let c=e.getAlpha(),d=r.getNumberOfTuples(),p=r.getNumberOfComponents(),m=n.getData(),h=r.getData();if(c>=1){if(i===u.y0.RGBA)for(let e=0;e{let r=0,n=0,a=0,o=0,s=t.numberOfColors-1;s&&(r=(t.hueRange[1]-t.hueRange[0])/s,n=(t.saturationRange[1]-t.saturationRange[0])/s,a=(t.valueRange[1]-t.valueRange[0])/s,o=(t.alphaRange[1]-t.alphaRange[0])/s),t.table.length=4*s+16;let l=[],u=[];for(let e=0;e<=s;e++)l[0]=t.hueRange[0]+e*r,l[1]=t.saturationRange[0]+e*n,l[2]=t.valueRange[0]+e*a,(0,i.hT)(l,u),u[3]=t.alphaRange[0]+e*o,t.table[4*e]=255*u[0]+.5,t.table[4*e+1]=255*u[1]+.5,t.table[4*e+2]=255*u[2]+.5,t.table[4*e+3]=255*u[3]+.5;e.buildSpecialColors(),t.buildTime.modified()},e.setTable=r=>{if(Array.isArray(r)){let n=r[0].length;t.numberOfColors=r.length;let i=4-n,a=0;for(let e=0;e{let{numberOfColors:e}=t,r=t.table,n=(e+0)*4;t.useBelowRangeColor||0===e?(r[n]=255*t.belowRangeColor[0]+.5,r[n+1]=255*t.belowRangeColor[1]+.5,r[n+2]=255*t.belowRangeColor[2]+.5,r[n+3]=255*t.belowRangeColor[3]+.5):(r[n]=r[0],r[n+1]=r[1],r[n+2]=r[2],r[n+3]=r[3]),n=(e+1)*4,t.useAboveRangeColor||0===e?(r[n]=255*t.aboveRangeColor[0]+.5,r[n+1]=255*t.aboveRangeColor[1]+.5,r[n+2]=255*t.aboveRangeColor[2]+.5,r[n+3]=255*t.aboveRangeColor[3]+.5):(r[n]=r[4*(e-1)+0],r[n+1]=r[4*(e-1)+1],r[n+2]=r[4*(e-1)+2],r[n+3]=r[4*(e-1)+3]),r[n=(e+2)*4]=255*t.nanColor[0]+.5,r[n+1]=255*t.nanColor[1]+.5,r[n+2]=255*t.nanColor[2]+.5,r[n+3]=255*t.nanColor[3]+.5},e.build=()=>{(t.table.length<1||e.getMTime()>t.buildTime.getMTime()&&t.insertTime.getMTime()<=t.buildTime.getMTime())&&e.forceBuild()},t.table.length>0&&(e.buildSpecialColors(),t.insertTime.modified())},"vtkLookupTable")},g=r(7033),v=r(10463),y=r(67127),{FieldAssociations:b}=s.Ay,{staticOffsetAPI:I,otherStaticMethods:x}=v.Ay,{ColorMode:C,ScalarMode:A,GetArray:T}=c.Ay,{VectorMode:S}=u.Ay,{VtkDataTypes:w}=a.Ay;function O(e){return()=>n.Ay.vtkErrorMacro(`vtkMapper::${e} - NOT IMPLEMENTED`)}function P(e,t,r){let n,i,a,o,s=Math.floor(t),l=s%(2*r[0]);l{let r=e.getInputData();r?(t.static||e.update(),o.Ay.setBounds(t.bounds,r.getBounds())):o.Ay.reset(t.bounds)},e.setForceCompileOnly=e=>{t.forceCompileOnly=e},e.setSelectionWebGLIdsToVTKIds=e=>{t.selectionWebGLIdsToVTKIds=e},e.createDefaultLookupTable=()=>{t.lookupTable=f.newInstance()},e.getColorModeAsString=()=>n.Ay.enumToString(C,t.colorMode),e.setColorModeToDefault=()=>e.setColorMode(0),e.setColorModeToMapScalars=()=>e.setColorMode(1),e.setColorModeToDirectScalars=()=>e.setColorMode(2),e.getScalarModeAsString=()=>n.Ay.enumToString(A,t.scalarMode),e.setScalarModeToDefault=()=>e.setScalarMode(0),e.setScalarModeToUsePointData=()=>e.setScalarMode(1),e.setScalarModeToUseCellData=()=>e.setScalarMode(2),e.setScalarModeToUsePointFieldData=()=>e.setScalarMode(3),e.setScalarModeToUseCellFieldData=()=>e.setScalarMode(4),e.setScalarModeToUseFieldData=()=>e.setScalarMode(5),e.getAbstractScalars=(e,r,n,i,a)=>{if(!e||!t.scalarVisibility)return{scalars:null,cellFlag:!1};let o=null,s=!1;if(r===A.DEFAULT)(o=e.getPointData().getScalars())||(o=e.getCellData().getScalars(),s=!0);else if(r===A.USE_POINT_DATA)o=e.getPointData().getScalars();else if(r===A.USE_CELL_DATA)o=e.getCellData().getScalars(),s=!0;else if(r===A.USE_POINT_FIELD_DATA){let t=e.getPointData();o=n===T.BY_ID?t.getArrayByIndex(i):t.getArrayByName(a)}else if(r===A.USE_CELL_FIELD_DATA){let t=e.getCellData();s=!0,o=n===T.BY_ID?t.getArrayByIndex(i):t.getArrayByName(a)}else if(r===A.USE_FIELD_DATA){let t=e.getFieldData();o=n===T.BY_ID?t.getArrayByIndex(i):t.getArrayByName(a)}return{scalars:o,cellFlag:s}},e.mapScalars=(r,n)=>{let{scalars:i,cellFlag:a}=e.getAbstractScalars(r,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName);if(t.areScalarsMappedFromCells=a,!i){t.colorCoordinates=null,t.colorTextureMap=null,t.colorMapColors=null;return}let o=`${e.getMTime()}${i.getMTime()}${n}`;if(t.colorBuildString!==o){if(t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]),e.canUseTextureMapForColoring(i,a))t.mapScalarsToTexture(i,a,n);else{t.colorCoordinates=null,t.colorTextureMap=null;let r=e.getLookupTable();r&&(r.build(),t.colorMapColors=r.mapScalars(i,t.colorMode,t.fieldDataTupleId))}t.colorBuildString=`${e.getMTime()}${i.getMTime()}${n}`}},t.mapScalarsToTexture=(r,n,o)=>{let s=t.lookupTable.getRange(),u=t.lookupTable.usingLogScale(),c=t.lookupTable.getAlpha(),d=u?[Math.log10(s[0]),Math.log10(s[1])]:s;if(t.colorMapColors=null,null==t.colorTextureMap||e.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getAlpha()!==o){t.lookupTable.setAlpha(o),t.colorTextureMap=null,t.lookupTable.build();let e=t.lookupTable.getNumberOfAvailableColors();t.numberOfColorsInRange=Math.min(Math.max(e,2),n?0x1fffffffd:4094);let r=t.numberOfColorsInRange+3,i=t.numberOfColorsInRange+2,s=n?[Math.min(Math.ceil(r/1),2048),Math.min(Math.ceil(r/2048),2048),Math.min(Math.ceil(r/4194304),2048)]:[i,2,1],p=new Float64Array(s[0]*s[1]*s[2]);p.fill(NaN);let m=t.numberOfColorsInRange,h=m+2,f=[0,0,0],g=d[0],v=d[1]-d[0];for(let e=0;e=s[0]||f[0]<0){let e=f[2]%2==0?1:-1;f[0]-=n,f[1]+=e,(f[1]>=s[1]||f[1]<0)&&(f[1]-=e,f[2]++)}}let y=a.Ay.newInstance({numberOfComponents:1,values:p}),b=t.lookupTable.mapScalars(y,t.colorMode,0);t.colorTextureMap=l.Ay.newInstance(),t.colorTextureMap.setDimensions(s),t.colorTextureMap.getPointData().setScalars(b),t.lookupTable.setAlpha(c)}t.colorCoordinates=function(e,t,r,n,o,s,l){let u=Array(arguments.length);for(let e=0;e=I,C=s[2]<=1?2:3,A=a.Ay.newInstance({numberOfComponents:C,values:new Float32Array(b*C)}),T=A.getData(),S=[0,0,0];P(S,o+2,s);let w=0,O=0,E=[.5,.5,.5];for(let e=0;eo&&(t=o+1),P(E,t,s)}else{E[1]=.49;let t=(e-f)*g;t>1e3?E[0]=1e3:t<-1e3?E[0]=-1e3:E[0]=t}for(let e=0;e1?-1:t.lookupTable.getVectorComponent(),d,u,t.numberOfColorsInRange,t.colorTextureMap.getDimensions(),n)},e.getIsOpaque=()=>{let r=e.getInputData(),n=e.getAbstractScalars(r,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!t.scalarVisibility||null==n)return!0;let i=e.getLookupTable();return!i||(i.build(),i.areScalarsOpaque(n,t.colorMode,-1))},e.canUseTextureMapForColoring=(e,r)=>!!r&&t.colorMode!==C.DIRECT_SCALARS||!(!t.interpolateScalarsBeforeMapping||t.lookupTable&&t.lookupTable.getIndexedLookup())&&!!e&&(t.colorMode!==C.DEFAULT||e.getDataType()!==w.UNSIGNED_CHAR)&&t.colorMode!==C.DIRECT_SCALARS,e.clearColorArrays=()=>{t.colorMapColors=null,t.colorCoordinates=null,t.colorTextureMap=null},e.getLookupTable=()=>(t.lookupTable||e.createDefaultLookupTable(),t.lookupTable),e.getMTime=()=>{let e=t.mtime;if(null!==t.lookupTable){let r=t.lookupTable.getMTime();e=r>e?r:e}return e},e.getPrimitiveCount=()=>{let t=e.getInputData();return{points:t.getPoints().getNumberOfValues()/3,verts:t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells(),lines:t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells(),triangles:t.getPolys().getNumberOfValues()-3*t.getPolys().getNumberOfCells()}},e.acquireInvertibleLookupTable=O("AcquireInvertibleLookupTable"),e.valueToColor=O("ValueToColor"),e.colorToValue=O("ColorToValue"),e.useInvertibleColorFor=O("UseInvertibleColorFor"),e.clearInvertibleColor=O("ClearInvertibleColor"),e.processSelectorPixelBuffers=(e,r)=>{if(!e||!t.selectionWebGLIdsToVTKIds||!t.populateSelectionSettings)return;let n=e.getRawPixelBuffer(y.T.ID_LOW24),i=e.getRawPixelBuffer(y.T.ID_HIGH24),a=e.getCurrentPass(),o=e.getFieldAssociation(),s=null;o===b.FIELD_ASSOCIATION_POINTS?s=t.selectionWebGLIdsToVTKIds.points:o===b.FIELD_ASSOCIATION_CELLS&&(s=t.selectionWebGLIdsToVTKIds.cells),s&&r.forEach(t=>{if(a===y.T.ID_LOW24){let r=0;i&&(r+=i[t],r*=256),r+=n[t+2],r*=256,r+=n[t+1],r*=256;let a=s[r+=n[t]],o=e.getPixelBuffer(y.T.ID_LOW24);o[t]=255&a,o[t+1]=(65280&a)>>8,o[t+2]=(0xff0000&a)>>16}else if(a===y.T.ID_HIGH24&&i){let r=s[(((0+i[t])*256+n[t+2])*256+n[t+1])*256+n[t]];e.getPixelBuffer(y.T.ID_HIGH24)[t]=(0xff000000&r)>>24}})}}var R={newInstance:n.Ay.newInstance(D,"vtkMapper"),extend:D,...I,...x,...c.Ay}},12577:(e,t,r)=>{"use strict";r.d(t,{L6:()=>s,PW:()=>l,zN:()=>u});var n=r(70192),i=r(78378),a=r(93022);let o=new Set;function s(e,t=!0,r=!1){t?function(e,t=!1){let r=c();if(!t){d(o,r);let t=(0,a.getAnnotation)(e);t&&(t.isSelected=!0)}if(e&&!o.has(e)){o.add(e),r.added.push(e);let t=(0,a.getAnnotation)(e);t&&(t.isSelected=!0)}p(r,o)}(e,r):l(e)}function l(e){let t=c();e?o.delete(e)&&(t.removed.push(e),(0,a.getAnnotation)(e).isSelected=!1):d(o,t),p(t,o)}function u(e){return o.has(e)}function c(){return Object.freeze({added:[],removed:[],selection:[]})}function d(e,t){e.forEach(r=>{if(e.delete(r)){t.removed.push(r);let e=(0,a.getAnnotation)(r);e&&(e.isSelected=!1)}})}function p(e,t){(e.added.length>0||e.removed.length>0)&&(t.forEach(t=>void e.selection.push(t)),(0,n.Hl)(n.tX,i.sV.ANNOTATION_SELECTION_CHANGE,e))}},12668:(e,t,r)=>{"use strict";function n(e){return{timeRange:[...e.timeRange],valueRange:[...e.valueRange],scrollOffset:0,anchorCanvas:[.5,.5],scale:1,scaleMode:"fit",rotation:0}}function i(e){var t;return{timeRange:[...e.timeRange],valueRange:[...e.valueRange],...void 0!==e.scrollOffset?{scrollOffset:e.scrollOffset}:{},anchorCanvas:[(t=e.anchorCanvas??[.5,.5])[0],t[1]],scale:Math.max(e.scale??1,.001),scaleMode:"fit",rotation:0,...e.anchorWorld?{anchorWorld:u(e.anchorWorld)}:{}}}function a(e){var t;let{metrics:r,camera:n,canvas:i}=e,a=Math.max(n?.scale??1,.001),o=r.worldToCanvasRatio*a,s=r.ecgWidth*o,l=r.ecgHeight*o,c=(i.clientWidth-s)/2,d=(i.clientHeight-l)/2,p=[(t=n?.anchorCanvas??[.5,.5])[0],t[1]],m=u(n?.anchorWorld)??[r.ecgWidth/2,r.ecgHeight/2],h=i.clientWidth*p[0]-m[0]*o,f=i.clientHeight*p[1]-m[1]*o;return{anchorWorld:m,anchorCanvas:p,canvasHeight:i.clientHeight,canvasWidth:i.clientWidth,centeredXOffset:c,centeredYOffset:d,effectiveRatio:o,xOffset:h,yOffset:f}}function o(e){return[e.xOffset-e.centeredXOffset,e.yOffset-e.centeredYOffset]}function s(e,t){return[(t.canvasWidth*t.anchorCanvas[0]-(t.centeredXOffset+e[0]))/t.effectiveRatio,(t.canvasHeight*t.anchorCanvas[1]-(t.centeredYOffset+e[1]))/t.effectiveRatio]}function l(e,t){return[(e[0]-t.xOffset)/t.effectiveRatio,(e[1]-t.yOffset)/t.effectiveRatio]}function u(e){return e?[e[0],e[1]]:void 0}r.d(t,{$3:()=>i,H3:()=>l,Kw:()=>s,MY:()=>a,cP:()=>o,hl:()=>n})},12732:(e,t,r)=>{"use strict";r.d(t,{d:()=>i});var n=r(79923);function i(e,t){let r=e.getActors?.()??[],i=t?r.find(e=>e.referencedId===t)??r.find(e=>e.referencedId?.endsWith(`:${t}`)):void 0;return i?.referencedId??(t?(0,n.A)(t):void 0)??e.getDefaultActor?.()?.referencedId}},13026:(e,t,r)=>{"use strict";r(91401)},13032:(e,t,r)=>{"use strict";r.d(t,{i:()=>N,A:()=>L});var n,i=r(76879),a=r(73502),o=r(3922),s=r(3793),l=r(69228),u=r(56872),c=r(35881),d=r(72661),p=r(8605),m=r(42215),h=r(42684),f=r(17774),g=r(77280);let v={WIDTH:160,WIDE_WIDTH:360,HEIGHT:96,TEXT_PADDING:3,TEXT_Y_OFFSET:2,GRAPH_Y_OFFSET:15,GRAPH_WIDTH:150,GRAPH_HEIGHT:70,FONT_SIZE:9,FONT_FAMILY:"Helvetica,Arial,sans-serif",GRAPH_ALPHA:.9},y={UPDATE_INTERVAL:1e3,MAX_MS_VALUE:200,MAX_FPS_VALUE:300,OVERLAY_STYLES:{position:"fixed",top:"0px",right:"0px",left:"auto",zIndex:"9999",cursor:"move",opacity:"0.9",display:"flex",flexDirection:"row",alignItems:"flex-start",gap:"4px",maxWidth:"calc(100vw - 8px)",userSelect:"none"},POSITION_STORAGE_KEY:"cornerstone-stats-overlay-position"},b={BYTES_TO_MB:1048576,MS_PER_SECOND:1e3},I=[{name:"FPS",foregroundColor:"#0ff",backgroundColor:"#002"},{name:"MS",foregroundColor:"#0f0",backgroundColor:"#020"},{name:"MB",foregroundColor:"#f08",backgroundColor:"#201"},{name:"VIEWPORT BINDINGS",foregroundColor:"#fc0",backgroundColor:"#221100"}];!function(e){e[e.FPS=0]="FPS",e[e.MS=1]="MS",e[e.MEMORY=2]="MEMORY",e[e.RENDER_MODES=3]="RENDER_MODES"}(n||(n={}));class x{constructor(){let e=I[n.RENDER_MODES];this.dom=document.createElement("div"),this.dom.style.cssText=` + width:min(720px, max(${v.WIDE_WIDTH}px, calc(100vw - ${v.WIDTH+24}px))); + min-width:0; + min-height:${v.HEIGHT}px; + background:${e.backgroundColor}; + color:${e.foregroundColor}; + font:${v.FONT_SIZE+2}px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; + padding:8px; + box-sizing:border-box; + max-height:min(520px, calc(100vh - 16px)); + overflow:auto; + border:1px solid rgba(255, 204, 0, 0.35); + border-radius:4px; + box-shadow:0 8px 28px rgba(0, 0, 0, 0.35); + `;let t=document.createElement("div");t.textContent=e.name,t.style.cssText=` + margin-bottom:8px; + font-weight:700; + letter-spacing:0.08em; + text-transform:uppercase; + `,this.dom.appendChild(t),this.list=document.createElement("div"),this.list.style.cssText=` + display:flex; + flex-direction:column; + gap:8px; + line-height:1.35; + font-weight:normal; + color:#fff3bf; + `,this.dom.appendChild(this.list)}update(){}setContent(e){if(this.list.replaceChildren(),!e.length)return void this.list.appendChild(w("(no viewports)"));for(let t of e){let e=function(e){let t={source:0,overlay:1,data:2};return[...e].sort((e,r)=>{let n=t[e.role]-t[r.role];return 0!==n?n:e.dataId.localeCompare(r.dataId)})}(t.bindings),r=document.createElement("div");r.style.cssText=` + padding:7px; + background:rgba(0, 0, 0, 0.18); + border:1px solid rgba(255, 204, 0, 0.18); + border-radius:4px; + `;let n=`${t.renderingEngineId}/${t.viewportId}`,i=document.createElement("div");i.title=n,i.style.cssText=` + display:flex; + align-items:center; + justify-content:space-between; + gap:8px; + margin-bottom:6px; + color:#ffd84d; + font-weight:700; + `;let a=document.createElement("div");a.style.cssText=` + display:flex; + align-items:center; + gap:6px; + min-width:0; + `;let o=document.createElement("span");if(o.textContent=C(n,72),o.style.cssText=` + min-width:0; + overflow:hidden; + text-overflow:ellipsis; + white-space:nowrap; + `,a.appendChild(o),t.viewportType){let e=document.createElement("span");e.textContent=t.viewportType,e.title=t.viewportType,e.style.cssText=` + flex:0 0 auto; + padding:2px 6px; + background:rgba(255, 204, 0, 0.14); + border:1px solid rgba(255, 204, 0, 0.4); + border-radius:3px; + color:#ffe08a; + font-size:${v.FONT_SIZE}px; + font-weight:700; + letter-spacing:0.03em; + `,a.appendChild(e)}i.appendChild(a);let s=document.createElement("span");if(s.textContent=`${e.length} binding${1===e.length?"":"s"}`,s.style.cssText=` + flex:0 0 auto; + color:#c9b05a; + font-size:${v.FONT_SIZE}px; + font-weight:600; + `,i.appendChild(s),r.appendChild(i),!e.length){r.appendChild(w("(no bindings)")),this.list.appendChild(r);continue}for(let t of e)r.appendChild(function(e){let t=document.createElement("div");t.style.cssText=` + display:grid; + grid-template-columns:74px minmax(0, 1fr); + gap:8px; + padding:6px; + margin-top:4px; + background:rgba(255, 255, 255, 0.045); + border-radius:4px; + `;let r=A[e.role],n=document.createElement("div");n.textContent=r.label,n.style.cssText=` + align-self:start; + padding:3px 5px; + background:${r.background}; + border:1px solid ${r.border}; + border-radius:3px; + color:${r.color}; + font-size:${v.FONT_SIZE}px; + font-weight:800; + letter-spacing:0.04em; + text-align:center; + `,t.appendChild(n);let i=document.createElement("div");return i.style.cssText=` + display:flex; + flex-direction:column; + gap:3px; + min-width:0; + `,S(i,"mode",e.renderMode,48),S(i,"data",e.dataId,76),e.actorUID&&e.actorUID!==e.dataId&&S(i,"actor",e.actorUID,76),e.referencedId&&e.referencedId!==e.dataId&&e.referencedId!==e.actorUID&&S(i,"ref",e.referencedId,76),e.scalarType&&S(i,"type",function(e,t){let r=e.replace(/Array$/,"");return t&&t>1?`${r} x${t}`:r}(e.scalarType,e.numberOfComponents),40),e.scalarRange&&S(i,"range",function([e,t]){return`${T(e)} .. ${T(t)}`}(e.scalarRange),56),t.appendChild(i),t}(t));this.list.appendChild(r)}}}function C(e,t){if(e.length<=t)return e;let r=Math.ceil((t-1)/2),n=Math.floor((t-1)/2);return`${e.slice(0,r)}...${e.slice(-n)}`}let A={source:{background:"rgba(0, 104, 126, 0.34)",border:"rgba(92, 225, 255, 0.4)",color:"#9decff",label:"SOURCE"},overlay:{background:"rgba(165, 102, 0, 0.3)",border:"rgba(255, 205, 83, 0.45)",color:"#ffd76d",label:"OVERLAY"},data:{background:"rgba(96, 101, 116, 0.28)",border:"rgba(187, 195, 214, 0.32)",color:"#dce5ff",label:"DATA"}};function T(e){return Number.isInteger(e)?String(e):Number(e.toFixed(2)).toString()}function S(e,t,r,n){let i=document.createElement("div");i.style.cssText=` + display:grid; + grid-template-columns:42px minmax(0, 1fr); + gap:6px; + min-width:0; + `;let a=document.createElement("span");a.textContent=t,a.style.cssText=` + color:#a9954c; + font-size:${v.FONT_SIZE}px; + font-weight:700; + text-transform:uppercase; + `,i.appendChild(a);let o=document.createElement("span");o.textContent=C(r,n),o.title=r,o.style.cssText=` + min-width:0; + overflow:hidden; + text-overflow:ellipsis; + white-space:nowrap; + color:#fff7d6; + `,i.appendChild(o),e.appendChild(i)}function w(e){let t=document.createElement("div");return t.textContent=e,t.style.cssText=` + color:#b7a865; + font-style:italic; + `,t}class O{constructor(e,t,r){this.minValue=1/0,this.maxValue=0,this.name=e,this.foregroundColor=t,this.backgroundColor=r,this.devicePixelRatio=Math.round(window.devicePixelRatio||1),this.dimensions=this.calculateDimensions(),this.dom=this.createCanvas(),this.context=this.initializeContext(),this.drawInitialPanel()}update(e,t){this.updateMinMax(e),this.clearTextArea(),this.drawText(e),this.scrollGraph(),this.drawNewValue(e,t)}calculateDimensions(){let e=this.devicePixelRatio;return{width:v.WIDTH*e,height:v.HEIGHT*e,textX:v.TEXT_PADDING*e,textY:v.TEXT_Y_OFFSET*e,graphX:v.TEXT_PADDING*e,graphY:v.GRAPH_Y_OFFSET*e,graphWidth:v.GRAPH_WIDTH*e,graphHeight:v.GRAPH_HEIGHT*e}}createCanvas(){let e=document.createElement("canvas");return e.width=this.dimensions.width,e.height=this.dimensions.height,e.style.cssText=`width:${v.WIDTH}px;height:${v.HEIGHT}px`,e}initializeContext(){let e=this.dom.getContext("2d");if(!e)throw Error("Failed to get 2D context");return e.font=`bold ${v.FONT_SIZE*this.devicePixelRatio}px ${v.FONT_FAMILY}`,e.textBaseline="top",e}drawInitialPanel(){let{width:e,height:t,textX:r,textY:n,graphX:i,graphY:a,graphWidth:o,graphHeight:s}=this.dimensions;this.context.fillStyle=this.backgroundColor,this.context.fillRect(0,0,e,t),this.context.fillStyle=this.foregroundColor,this.context.fillText(this.name,r,n),this.context.fillRect(i,a,o,s),this.context.fillStyle=this.backgroundColor,this.context.globalAlpha=v.GRAPH_ALPHA,this.context.fillRect(i,a,o,s),this.context.globalAlpha=1}updateMinMax(e){this.minValue=Math.min(this.minValue,e),this.maxValue=Math.max(this.maxValue,e)}clearTextArea(){let{width:e,graphY:t}=this.dimensions;this.context.fillStyle=this.backgroundColor,this.context.fillRect(0,0,e,t)}drawText(e){let{textX:t,textY:r}=this.dimensions,n=this.formatText(e);this.context.fillStyle=this.foregroundColor,this.context.fillText(n,t,r)}formatText(e){let t=Math.round(e),r=Math.round(this.minValue),n=Math.round(this.maxValue);return`${t} ${this.name} (${r}-${n})`}scrollGraph(){let{graphX:e,graphY:t,graphWidth:r,graphHeight:n}=this.dimensions,i=this.devicePixelRatio;this.context.drawImage(this.dom,e+i,t,r-i,n,e,t,r-i,n)}drawNewValue(e,t){let{graphX:r,graphY:n,graphWidth:i,graphHeight:a}=this.dimensions,o=this.devicePixelRatio,s=r+i-o;this.context.fillStyle=this.foregroundColor,this.context.fillRect(s,n,o,a);let l=Math.round((1-e/t)*a);this.context.fillStyle=this.backgroundColor,this.context.globalAlpha=v.GRAPH_ALPHA,this.context.fillRect(s,n,o,l),this.context.globalAlpha=1}}class P{constructor(){this.dom=null,this.startTime=0,this.lastUpdateTime=0,this.frameCount=0,this.panels=new Map,this.metricsColumn=null,this.bindingsColumn=null,this.animationFrameId=null,this.isSetup=!1,this.dragPointerId=null,this.dragOffsetX=0,this.dragOffsetY=0,this.handlePointerDown=e=>this.onPointerDown(e),this.handlePointerMove=e=>this.onPointerMove(e),this.handlePointerUp=e=>this.onPointerUp(e)}static getInstance(){return P.instance||(P.instance=new P),P.instance}setup(){if(!this.isSetup)try{this.dom=this.createOverlayElement(),this.startTime=performance.now(),this.lastUpdateTime=this.startTime,this.initializePanels(),this.applyOverlayStyles(),this.restorePosition(),this.attachDragHandlers(),document.body.appendChild(this.dom),this.startLoop(),this.isSetup=!0}catch(e){console.warn("Failed to setup stats overlay:",e)}}cleanup(){this.stopLoop(),this.detachDragHandlers(),this.dom&&this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.dom=null,this.metricsColumn=null,this.bindingsColumn=null,this.panels.clear(),this.isSetup=!1}showPanel(e){}update(){this.startTime=this.updateStats()}createOverlayElement(){return document.createElement("div")}applyOverlayStyles(){Object.assign(this.dom.style,y.OVERLAY_STYLES)}initializePanels(){this.initializePanelColumns();let e=new O(I[n.FPS].name,I[n.FPS].foregroundColor,I[n.FPS].backgroundColor);this.addPanel(n.FPS,e);let t=new O(I[n.MS].name,I[n.MS].foregroundColor,I[n.MS].backgroundColor);if(this.addPanel(n.MS,t),this.isMemoryAvailable()){let e=new O(I[n.MEMORY].name,I[n.MEMORY].foregroundColor,I[n.MEMORY].backgroundColor);this.addPanel(n.MEMORY,e)}this.addPanel(n.RENDER_MODES,new x)}initializePanelColumns(){this.metricsColumn=document.createElement("div"),this.metricsColumn.style.cssText=` + display:flex; + flex-direction:column; + flex:0 0 auto; + `,this.bindingsColumn=document.createElement("div"),this.bindingsColumn.style.cssText=` + display:flex; + flex-direction:column; + flex:0 1 auto; + min-width:0; + `,this.dom.appendChild(this.metricsColumn),this.dom.appendChild(this.bindingsColumn)}isMemoryAvailable(){return void 0!==performance.memory}addPanel(e,t){((e===n.RENDER_MODES?this.bindingsColumn:this.metricsColumn)??this.dom).appendChild(t.dom),this.panels.set(e,t)}startLoop(){let e=()=>{this.update(),this.animationFrameId=requestAnimationFrame(e)};this.animationFrameId=requestAnimationFrame(e)}stopLoop(){null!==this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}updateStats(){this.frameCount++;let e=performance.now(),t=e-this.startTime,r=this.panels.get(n.MS);if(r&&r.update(t,y.MAX_MS_VALUE),e>=this.lastUpdateTime+y.UPDATE_INTERVAL){let t=this.frameCount*b.MS_PER_SECOND/(e-this.lastUpdateTime),r=this.panels.get(n.FPS);r&&r.update(t,y.MAX_FPS_VALUE),this.lastUpdateTime=e,this.frameCount=0,this.updateMemoryPanel(),this.updateRenderModesPanel()}return e}updateRenderModesPanel(){let e=this.panels.get(n.RENDER_MODES);if(!(e instanceof x))return;let t=[];for(let e of a.A.getAll())if(e&&!e.hasBeenDestroyed)for(let r of e.getViewports()){let n=r._debug?.renderModes;t.push({renderingEngineId:e.id,viewportId:r.id,viewportType:r.type,bindings:this.getViewportBindingDebugEntries(r,n??{})})}e.setContent(t)}getViewportBindingDebugEntries(e,t){let r=e.getActors?.()??[],n=e.getSourceDataId?.(),i=Object.entries(t);return i.length?i.map(([t,i])=>{var a,o;let s=_(e,t,n),l="source"===s?e.getDefaultActor?.():(a=r,o=t,a.find(e=>e.uid===o||e.representationUID===o||e.referencedId===o));return{actorUID:l?.uid,dataId:t,referencedId:l?.referencedId,renderMode:i,role:s,...E(l)}}):r.map(t=>{let r=t.representationUID??t.uid??"";return{actorUID:t.uid,dataId:r,referencedId:t.referencedId,renderMode:"-",role:_(e,r,n),...E(t)}})}updateMemoryPanel(){let e=this.panels.get(n.MEMORY);if(!e)return;let t=performance;if(t.memory){let r=t.memory.usedJSHeapSize/b.BYTES_TO_MB,n=t.memory.jsHeapSizeLimit/b.BYTES_TO_MB;e.update(r,n)}}attachDragHandlers(){this.dom?.addEventListener("pointerdown",this.handlePointerDown)}detachDragHandlers(){this.dom?.removeEventListener("pointerdown",this.handlePointerDown),window.removeEventListener("pointermove",this.handlePointerMove),window.removeEventListener("pointerup",this.handlePointerUp),window.removeEventListener("pointercancel",this.handlePointerUp)}onPointerDown(e){if(!this.dom||0!==e.button)return;this.dragPointerId=e.pointerId;let t=this.dom.getBoundingClientRect();this.dragOffsetX=e.clientX-t.left,this.dragOffsetY=e.clientY-t.top,this.setPosition(t.left,t.top),window.addEventListener("pointermove",this.handlePointerMove),window.addEventListener("pointerup",this.handlePointerUp),window.addEventListener("pointercancel",this.handlePointerUp),e.preventDefault()}onPointerMove(e){this.dragPointerId===e.pointerId&&this.dom&&this.setPosition(e.clientX-this.dragOffsetX,e.clientY-this.dragOffsetY)}onPointerUp(e){if(this.dragPointerId!==e.pointerId||!this.dom)return;this.dragPointerId=null,window.removeEventListener("pointermove",this.handlePointerMove),window.removeEventListener("pointerup",this.handlePointerUp),window.removeEventListener("pointercancel",this.handlePointerUp);let t=this.dom.getBoundingClientRect();this.savePosition(t.left,t.top)}setPosition(e,t){if(!this.dom)return;let r=this.clampToViewport(e,t);this.dom.style.left=`${r.left}px`,this.dom.style.top=`${r.top}px`,this.dom.style.right="auto",this.dom.style.bottom="auto"}clampToViewport(e,t){if(!this.dom)return{left:e,top:t};let r=this.dom.offsetWidth,n=this.dom.offsetHeight;return{left:Math.min(Math.max(0,e),Math.max(0,window.innerWidth-r)),top:Math.min(Math.max(0,t),Math.max(0,window.innerHeight-n))}}restorePosition(){let e=this.readSavedPosition();e&&this.setPosition(e.left,e.top)}readSavedPosition(){try{let e=window.localStorage.getItem(y.POSITION_STORAGE_KEY);if(!e)return null;let t=JSON.parse(e);if("number"!=typeof t?.left||"number"!=typeof t?.top||!Number.isFinite(t.left)||!Number.isFinite(t.top))return null;return{left:t.left,top:t.top}}catch{return null}}savePosition(e,t){try{window.localStorage.setItem(y.POSITION_STORAGE_KEY,JSON.stringify({left:e,top:t}))}catch{}}}function _(e,t,r){let n=e.getDisplaySetRole?.(t);return"source"===n||"overlay"===n?n:r&&t===r?"source":"data"}function E(e){let t=e?.actor?.getMapper?.()?.getInputData?.();if(!t)return{};try{let e=t.getPointData?.()?.getScalars?.();if(e?.getDataType){let t=e.getNumberOfComponents?.()??1,r=t>1?e.getRange?.(0):e.getRange?.();return{scalarType:e.getDataType(),scalarRange:D(r),numberOfComponents:t}}let r=t.getScalarData?.();if(r?.constructor?.name){let e=Number.isFinite(t.minPixelValue)&&Number.isFinite(t.maxPixelValue)?[t.minPixelValue,t.maxPixelValue]:void 0;return{scalarType:r.constructor.name,scalarRange:D(e)}}}catch{}return{}}function D(e){if(e&&!(e.length<2)&&Number.isFinite(e[0])&&Number.isFinite(e[1]))return[e[0],e[1]]}P.instance=null;let R=P.getInstance();var M=r(41652);let N=2;class V{constructor(e){if(this._needsRender=new Set,this._animationFrameSet=!1,this._animationFrameHandle=null,this.renderFrameOfReference=e=>{let t=this._getViewportsAsArray().map(t=>{if(t.getFrameOfReferenceUID()===e)return t.id});this.renderViewports(t)},this.id=e||(0,s.A)(),this.useCPURendering=(0,m.LH)(),a.A.set(this),!(0,m.Dh)())throw Error("@cornerstonejs/core is not initialized, run init() first");this._viewports=new Map,this.hasBeenDestroyed=!1;let t=(0,m.D0)();t?.debug?.statsOverlay&&R.setup()}enableElement(e){let t=this._normalizeViewportInputEntry(e);this._throwIfDestroyed();let{element:r,viewportId:n}=t;if(!r)throw Error("No element provided");this.getViewport(n)&&this.disableElement(n);let{type:i}=t;(0,c.A)(i)?this.addCustomViewport(t):this.enableVTKjsDrivenViewport(t);let a=(0,d.Ay)(r),{background:o}=t.defaultOptions;this.fillCanvasWithBackgroundColor(a,o)}disableElement(e){this._throwIfDestroyed();let t=this.getViewport(e);if(!t)return void console.warn(`viewport ${e} does not exist`);this._resetViewport(t),!(0,c.A)(t.type)&&this.offscreenMultiRenderWindow&&this.offscreenMultiRenderWindow.removeRenderer(e),this._removeViewport(e),t.isDisabled=!0,this._needsRender.delete(e),this.getViewports().length||this._clearAnimationFrame()}disableViewport(e){this.disableElement(e)}setViewports(e){let t=this._normalizeViewportInputEntries(e);this._throwIfDestroyed(),this._reset();let r=[],n=[];t.forEach(e=>{(0,c.A)(e.type)?n.push(e):r.push(e)}),this.setVtkjsDrivenViewports(r),this.setCustomViewports(n),t.forEach(e=>{let t=(0,d.Ay)(e.element),{background:r}=e.defaultOptions;this.fillCanvasWithBackgroundColor(t,r)})}resize(e=!0,t=!0){this._throwIfDestroyed();let r=this._getViewportsAsArray(),n=[],i=[];r.forEach(e=>{(0,c.q)(e)?i.push(e):n.push(e)}),n.length&&this._resizeVTKViewports(n,t,e),i.length&&this._resizeUsingCustomResizeHandler(i,t,e)}getViewport(e){return this._viewports?.get(e)}getViewports(){return this._throwIfDestroyed(),this._getViewportsAsArray()}render(){let e=this.getViewports().map(e=>e.id);this._setViewportsToBeRenderedNextFrame(e)}renderViewports(e){this._setViewportsToBeRenderedNextFrame(e)}renderViewport(e){this._setViewportsToBeRenderedNextFrame([e])}destroy(){if(this.hasBeenDestroyed)return;R.cleanup();let e=this._getViewportsAsArray();this._reset(),this.offscreenMultiRenderWindow&&(e.forEach(e=>{this.offscreenMultiRenderWindow&&!(0,c.q)(e)&&this.offscreenMultiRenderWindow.getRenderer(e.id)&&this.offscreenMultiRenderWindow.removeRenderer(e.id)}),this.offscreenMultiRenderWindow.delete(),delete this.offscreenMultiRenderWindow),a.A.delete(this.id),this.hasBeenDestroyed=!0}fillCanvasWithBackgroundColor(e,t){let r=e.getContext("2d");r.fillStyle=t?(0,M.J)(t):"black",r.fillRect(0,0,e.width,e.height)}_normalizeViewportInputEntry(e){let t=e.type,{type:r}=e,{defaultOptions:n}=e;if((0,m.xu)()){let e=V.NEXT_TYPE_REMAP[r];e&&(r=e)}let i=n;return i&&0!==Object.keys(i).length||(i={background:[0,0,0],orientation:null,displayArea:null},t===u.A.ORTHOGRAPHIC&&(i={...i,orientation:g.KY.AXIAL})),{...e,requestedType:t!==r||(0,m.xu)()?t:void 0,type:r,defaultOptions:i}}_normalizeViewportInputEntries(e){let t=[];return e.forEach(e=>{t.push(this._normalizeViewportInputEntry(e))}),t}_resizeUsingCustomResizeHandler(e,t=!0,r=!0){e.forEach(e=>{e.resizeForRenderingEngine({keepCamera:t})}),r&&this.render()}_removeViewport(e){if(!this.getViewport(e))return void console.warn(`viewport ${e} does not exist`);this._viewports.delete(e)}addCustomViewport(e){let{element:t,viewportId:r,type:n,defaultOptions:a}=e;t.tabIndex=-1,(0,p.u)(t);let s=(0,d.Ay)(t),{clientWidth:u,clientHeight:c}=s;(s.width!==u||s.height!==c)&&(s.width=u,s.height=c);let m={id:r,renderingEngineId:this.id,element:t,type:n,canvas:s,sx:0,sy:0,sWidth:u,sHeight:c,defaultOptions:a||{}},f=new((0,h.aZ)(e))(m);f.requestedType=n,this._viewports.set(r,f);let g={element:t,viewportId:r,renderingEngineId:this.id};(0,l.A)(o.A,i.A.ELEMENT_ENABLED,g)}getRenderer(e){return this.offscreenMultiRenderWindow.getRenderer(e)}getOffscreenMultiRenderWindow(e){if(!this.offscreenMultiRenderWindow)throw Error("Offscreen multi render window is not available.");return this.offscreenMultiRenderWindow}setCustomViewports(e){e.forEach(e=>{this.addCustomViewport(e)})}_getViewportsAsArray(){return Array.from(this._viewports.values())}_setViewportsToBeRenderedNextFrame(e){e.forEach(e=>{this._needsRender.add(e);let t=this._viewports.get(e);t&&(t.viewportStatus=f.A.NEEDS_RENDER)}),this._render()}_render(){this._needsRender.size>0&&!this._animationFrameSet&&(this._animationFrameHandle=window.requestAnimationFrame(this._renderFlaggedViewports),this._animationFrameSet=!0)}_resetViewport(e){let t=this.id,{element:r,canvas:n,id:a}=e;e.removeWidgets(),(0,l.A)(o.A,i.A.ELEMENT_DISABLED,{element:r,viewportId:a,renderingEngineId:t}),e.destroy?.(),r.removeAttribute("data-viewport-uid"),r.removeAttribute("data-rendering-engine-uid"),(0,p.M)(r),n.getContext("2d").clearRect(0,0,n.width,n.height)}_clearAnimationFrame(){window.cancelAnimationFrame(this._animationFrameHandle),this._needsRender.clear(),this._animationFrameSet=!1,this._animationFrameHandle=null}_reset(){this._getViewportsAsArray().forEach(e=>{this._resetViewport(e)}),this._clearAnimationFrame(),this._viewports=new Map}_throwIfDestroyed(){if(this.hasBeenDestroyed)throw Error("this.destroy() has been manually called to free up memory, can not longer use this instance. Instead make a new one.")}}V.NEXT_TYPE_REMAP={[u.A.STACK]:u.A.PLANAR_NEXT,[u.A.ORTHOGRAPHIC]:u.A.PLANAR_NEXT,[u.A.VIDEO]:u.A.VIDEO_NEXT,[u.A.WHOLE_SLIDE]:u.A.WHOLE_SLIDE_NEXT,[u.A.ECG]:u.A.ECG_NEXT,[u.A.VOLUME_3D]:u.A.VOLUME_3D_NEXT};let L=V},13123:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AbortControllerImpl=void 0;let n=r(47518);class i{_signal;constructor(){this._signal=(0,n.create_abortSignal)()}get signal(){return this._signal}abort(){(0,n.abort_signalAbort)(this._signal)}}t.AbortControllerImpl=i},13312:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(50923);function i(e,t,r,i){let a=n.vt();n.$A(a,t,e);let o=n.fA(...r),s=n.fA(...i),l=n.vt();n.Re(l,o,s);let u=n.Bw(l);if(u<1e-4)return{worldWidth:0,worldHeight:0};let c=n.Om(l,a)/(u*n.Bw(a));return{worldWidth:Math.sqrt(1-c*c)*u,worldHeight:c*u}}},13402:(e,t,r)=>{"use strict";r.d(t,{F:()=>u});var n=r(54268),i=r(59408),a=r(77280),o=r(92391),s=r(32876),l=r(97938);function u(e,t){if(!t||!t.imageIds||!t.imageIds.length)throw Error("ImageIds must be provided to create a streaming image volume");let r=async function(){if("wadouri"===t.imageIds[0].split(":")[0]){let[r,i]=[Math.floor(t.imageIds.length/2),t.imageIds.length-1];await Promise.all([0,r,i].map(r=>n.Ay.isLoaded(t.imageIds[r])?Promise.resolve(!0):new Promise((n,i)=>{let s=t.imageIds[r];o.A.addRequest(async()=>{(0,l.loadImage)(s).then(()=>{console.log(`Prefetched imageId: ${s}`),n(!0)}).catch(e=>{i(e)})},a.Yw.Prefetch,{volumeId:e},1)}))).catch(console.error)}let{dimensions:r,spacing:u,origin:c,direction:d,metadata:p,imageIds:m,dataType:h,numberOfComponents:f}=(0,s.D)(t.imageIds,e);return new i.A({volumeId:e,metadata:p,dimensions:r,spacing:u,origin:c,direction:d,imageIds:m,dataType:h,numberOfComponents:f},{imageIds:m,loadStatus:{loaded:!1,loading:!1,cancelled:!1,cachedFrames:[],callbacks:[]}})}();return{promise:r,decache:()=>{r.then(e=>{e.destroy(),e=null})},cancel:()=>{r.then(e=>{e.cancelLoading()})}}}},13827:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>p});var n=r(17042),i=r(11701),a=r(85250),o=r(5434),s=r(50923),l=r(49963),{vtkDebugMacro:u}=n.Ay,c={position:[0,0,1],focalPoint:[0,0,0],viewUp:[0,1,0],directionOfProjection:[0,0,-1],parallelProjection:!1,useHorizontalViewAngle:!1,viewAngle:30,parallelScale:1,clippingRange:[.01,1000.01],windowCenter:[0,0],viewPlaneNormal:[0,0,1],useOffAxisProjection:!1,screenBottomLeft:[-.5,-.5,-.5],screenBottomRight:[.5,-.5,-.5],screenTopRight:[.5,.5,-.5],freezeFocalPoint:!1,projectionMatrix:null,viewMatrix:null,modelTransformMatrix:null,cameraLightTransform:a.create(),physicalTranslation:[0,0,0],physicalScale:1,physicalViewUp:[0,1,0],physicalViewNorth:[0,0,-1]};function d(e,t,r={}){Object.assign(t,c,r),n.Ay.obj(e,t),n.Ay.get(e,t,["distance"]),n.Ay.setGet(e,t,["parallelProjection","useHorizontalViewAngle","viewAngle","parallelScale","useOffAxisProjection","freezeFocalPoint","physicalScale","modelTransformMatrix"]),n.Ay.getArray(e,t,["directionOfProjection","viewPlaneNormal","position","focalPoint"]),n.Ay.setGetArray(e,t,["clippingRange","windowCenter"],2),n.Ay.setGetArray(e,t,["viewUp","screenBottomLeft","screenBottomRight","screenTopRight","physicalTranslation","physicalViewUp","physicalViewNorth"],3),function(e,t){t.classHierarchy.push("vtkCamera");let r=new Float64Array(3),n=new Float64Array([0,0,-1]),c=new Float64Array([0,1,0]),d=a.identity(new Float64Array(16)),p=a.identity(new Float64Array(16)),m=new Float64Array(3),h=new Float64Array(3),f=new Float64Array(3),g=a.identity(new Float64Array(16)),v=a.identity(new Float64Array(16)),y=new Float64Array(3),b=new Float64Array(3);function I(){t.viewPlaneNormal[0]=-t.directionOfProjection[0],t.viewPlaneNormal[1]=-t.directionOfProjection[1],t.viewPlaneNormal[2]=-t.directionOfProjection[2]}e.orthogonalizeViewUp=()=>{e.getViewMatrix(d),t.viewUp[0]=d[4],t.viewUp[1]=d[5],t.viewUp[2]=d[6],e.modified()},e.setPosition=(r,n,i)=>{(r!==t.position[0]||n!==t.position[1]||i!==t.position[2])&&(t.position[0]=r,t.position[1]=n,t.position[2]=i,e.computeDistance(),e.modified())},e.setFocalPoint=(r,n,i)=>{(r!==t.focalPoint[0]||n!==t.focalPoint[1]||i!==t.focalPoint[2])&&(t.focalPoint[0]=r,t.focalPoint[1]=n,t.focalPoint[2]=i,e.computeDistance(),e.modified())},e.setDistance=r=>{if(t.distance===r)return;t.distance=r,t.distance<1e-20&&(t.distance=1e-20,u("Distance is set to minimum."));let n=t.directionOfProjection;t.focalPoint[0]=t.position[0]+n[0]*t.distance,t.focalPoint[1]=t.position[1]+n[1]*t.distance,t.focalPoint[2]=t.position[2]+n[2]*t.distance,e.modified()},e.computeDistance=()=>{let e=t.focalPoint[0]-t.position[0],r=t.focalPoint[1]-t.position[1],n=t.focalPoint[2]-t.position[2];if(t.distance=Math.sqrt(e*e+r*r+n*n),t.distance<1e-20){t.distance=1e-20,u("Distance is set to minimum.");let e=t.directionOfProjection;t.focalPoint[0]=t.position[0]+e[0]*t.distance,t.focalPoint[1]=t.position[1]+e[1]*t.distance,t.focalPoint[2]=t.position[2]+e[2]*t.distance}t.directionOfProjection[0]=e/t.distance,t.directionOfProjection[1]=r/t.distance,t.directionOfProjection[2]=n/t.distance,I()},e.dolly=r=>{if(r<=0)return;let n=t.distance/r;e.setPosition(t.focalPoint[0]-n*t.directionOfProjection[0],t.focalPoint[1]-n*t.directionOfProjection[1],t.focalPoint[2]-n*t.directionOfProjection[2])},e.roll=r=>{let n=t.position,s=t.focalPoint,l=t.viewUp,u=new Float64Array([l[0],l[1],l[2],0]);a.identity(g);let c=new Float64Array([s[0]-n[0],s[1]-n[1],s[2]-n[2]]);a.rotate(g,g,(0,i.el)(r),c),o.Z0(u,u,g),t.viewUp[0]=u[0],t.viewUp[1]=u[1],t.viewUp[2]=u[2],e.modified()},e.azimuth=r=>{let n=t.focalPoint;a.identity(v),a.translate(v,v,n),a.rotate(v,v,(0,i.el)(r),t.viewUp),a.translate(v,v,[-n[0],-n[1],-n[2]]),s.Z0(y,t.position,v),e.setPosition(y[0],y[1],y[2])},e.yaw=r=>{let n=t.position;a.identity(v),a.translate(v,v,n),a.rotate(v,v,(0,i.el)(r),t.viewUp),a.translate(v,v,[-n[0],-n[1],-n[2]]),s.Z0(b,t.focalPoint,v),e.setFocalPoint(b[0],b[1],b[2])},e.elevation=r=>{let n=t.focalPoint;e.getViewMatrix(d);let o=[-d[0],-d[1],-d[2]];a.identity(v),a.translate(v,v,n),a.rotate(v,v,(0,i.el)(r),o),a.translate(v,v,[-n[0],-n[1],-n[2]]),s.Z0(y,t.position,v),e.setPosition(y[0],y[1],y[2])},e.pitch=r=>{let n=t.position;e.getViewMatrix(d);let o=[d[0],d[1],d[2]];a.identity(v),a.translate(v,v,n),a.rotate(v,v,(0,i.el)(r),o),a.translate(v,v,[-n[0],-n[1],-n[2]]),s.Z0(b,t.focalPoint,v),e.setFocalPoint(...b)},e.zoom=r=>{r<=0||(t.parallelProjection?t.parallelScale/=r:t.viewAngle/=r,e.modified())},e.translate=(r,n,a)=>{let o=[r,n,a];(0,i.WQ)(t.position,o,t.position),(0,i.WQ)(t.focalPoint,o,t.focalPoint),e.computeDistance(),e.modified()},e.applyTransform=r=>{let n=[...t.viewUp,1],i=[],a=[],s=[];n[0]+=t.position[0],n[1]+=t.position[1],n[2]+=t.position[2],o.Z0(i,[...t.position,1],r),o.Z0(a,[...t.focalPoint,1],r),o.Z0(s,n,r),s[0]-=i[0],s[1]-=i[1],s[2]-=i[2],e.setPosition(...i.slice(0,3)),e.setFocalPoint(...a.slice(0,3)),e.setViewUp(...s.slice(0,3))},e.getThickness=()=>t.clippingRange[1]-t.clippingRange[0],e.setThickness=r=>{let n=r;n<1e-20&&(n=1e-20,u("Thickness is set to minimum.")),e.setClippingRange(t.clippingRange[0],t.clippingRange[0]+n)},e.setThicknessFromFocalPoint=r=>{let n=r;n<1e-20&&(n=1e-20,u("Thickness is set to minimum.")),e.setClippingRange(t.distance-n/2,t.distance+n/2)},e.setRoll=e=>{},e.getRoll=()=>{},e.setObliqueAngles=(e,t)=>{},e.getOrientation=()=>{},e.getOrientationWXYZ=()=>{},e.getFrustumPlanes=(t=1,r=new Float64Array(24))=>{let n=[[1,0,0,1],[-1,0,0,1],[0,1,0,1],[0,-1,0,1],[0,0,1,1],[0,0,-1,1]],a=e.getCompositeProjectionMatrix(t,-1,1);for(let e=0;e<6;e++)o.Z0(n[e],n[e],a),(0,i.aA)(n[e]),r[4*e+0]=n[e][0],r[4*e+1]=n[e][1],r[4*e+2]=n[e][2],r[4*e+3]=n[e][3];return r},e.getCameraLightTransformMatrix=e=>(a.copy(e,t.cameraLightTransform),e),e.computeCameraLightTransform=()=>{e.getViewMatrix(d),a.invert(d,d),a.fromScaling(p,[t.distance,t.distance,t.distance]),a.multiply(d,d,p),a.identity(t.cameraLightTransform),a.translate(t.cameraLightTransform,d,[0,0,-1])},e.deepCopy=e=>{},e.physicalOrientationToWorldDirection=e=>{let t=l.fA(e[0],e[1],e[2],e[3]),r=l.vt(),n=l.fA(0,0,1,0);return l.Xr(r,t),l.lw(n,t,n),l.lw(n,n,r),[n[0],n[1],n[2]]},e.getPhysicalToWorldMatrix=t=>{e.getWorldToPhysicalMatrix(t),a.invert(t,t)},e.getWorldToPhysicalMatrix=e=>{a.identity(e);let r=[3];(0,i.$A)(t.physicalViewNorth,t.physicalViewUp,r),e[0]=r[0],e[1]=r[1],e[2]=r[2],e[4]=t.physicalViewUp[0],e[5]=t.physicalViewUp[1],e[6]=t.physicalViewUp[2],e[8]=-t.physicalViewNorth[0],e[9]=-t.physicalViewNorth[1],e[10]=-t.physicalViewNorth[2],a.transpose(e,e),s.hZ(m,1/t.physicalScale,1/t.physicalScale,1/t.physicalScale),a.scale(e,e,m),a.translate(e,e,t.physicalTranslation)},e.computeViewParametersFromViewMatrix=i=>{a.invert(d,i),s.Z0(m,r,d),e.computeDistance();let o=t.distance;e.setPosition(m[0],m[1],m[2]),s.Z0(h,n,d),s.Re(h,h,m),s.S8(h,h),e.setDirectionOfProjection(h[0],h[1],h[2]),s.Z0(f,c,d),s.Re(f,f,m),s.S8(f,f),e.setViewUp(f[0],f[1],f[2]),e.setDistance(o)},e.computeViewParametersFromPhysicalMatrix=t=>{e.getWorldToPhysicalMatrix(d),a.multiply(d,t,d),e.computeViewParametersFromViewMatrix(d)},e.setViewMatrix=r=>{t.viewMatrix=r,t.viewMatrix&&(e.computeViewParametersFromViewMatrix(t.viewMatrix),a.transpose(t.viewMatrix,t.viewMatrix))},e.getViewMatrix=(e=new Float64Array(16))=>(t.viewMatrix?t.modelTransformMatrix?a.multiply(e,t.modelTransformMatrix,t.viewMatrix):a.copy(e,t.viewMatrix):(a.lookAt(e,t.position,t.focalPoint,t.viewUp),a.transpose(e,e),t.modelTransformMatrix&&a.multiply(e,t.modelTransformMatrix,e)),e),e.setProjectionMatrix=e=>{t.projectionMatrix=e},e.getProjectionMatrix=(e,r,n)=>{let o=new Float64Array(16);if(a.identity(o),t.projectionMatrix){let e=1/t.physicalScale;return s.hZ(m,e,e,e),a.copy(o,t.projectionMatrix),a.scale(o,o,m),a.transpose(o,o),o}a.identity(d);let l=t.clippingRange[1]-t.clippingRange[0],u=[t.clippingRange[0]+(r+1)*l/2,t.clippingRange[0]+(n+1)*l/2];if(t.parallelProjection){let r=t.parallelScale*e,n=t.parallelScale,i=(t.windowCenter[0]-1)*r,o=(t.windowCenter[0]+1)*r,s=(t.windowCenter[1]-1)*n,l=(t.windowCenter[1]+1)*n;a.ortho(d,i,o,s,l,u[0],u[1]),a.transpose(d,d)}else if(t.useOffAxisProjection)throw Error("Off-Axis projection is not supported at this time");else{let r,n,a=Math.tan((0,i.el)(t.viewAngle)/2);!0===t.useHorizontalViewAngle?(r=t.clippingRange[0]*a,n=t.clippingRange[0]*a/e):(r=t.clippingRange[0]*a*e,n=t.clippingRange[0]*a);let o=(t.windowCenter[0]-1)*r,s=(t.windowCenter[0]+1)*r,l=(t.windowCenter[1]-1)*n,c=(t.windowCenter[1]+1)*n,p=u[0],m=u[1];d[0]=2*p/(s-o),d[5]=2*p/(c-l),d[2]=(o+s)/(s-o),d[6]=(l+c)/(c-l),d[10]=-(p+m)/(m-p),d[14]=-1,d[11]=-2*p*m/(m-p),d[15]=0}return a.copy(o,d),o},e.getCompositeProjectionMatrix=(t,r,n)=>{let i=e.getViewMatrix(),o=e.getProjectionMatrix(t,r,n);return a.multiply(o,i,o),o},e.setDirectionOfProjection=(e,r,n)=>{if(t.directionOfProjection[0]===e&&t.directionOfProjection[1]===r&&t.directionOfProjection[2]===n)return;t.directionOfProjection[0]=e,t.directionOfProjection[1]=r,t.directionOfProjection[2]=n;let i=t.directionOfProjection;t.focalPoint[0]=t.position[0]+i[0]*t.distance,t.focalPoint[1]=t.position[1]+i[1]*t.distance,t.focalPoint[2]=t.position[2]+i[2]*t.distance,I()},e.setDeviceAngles=(r,n,o,l)=>{let u=[3];(0,i.$A)(t.physicalViewNorth,t.physicalViewUp,u);let c=a.identity(new Float64Array(16));a.rotate(c,c,(0,i.el)(r),t.physicalViewUp),a.rotate(c,c,(0,i.el)(n),u),a.rotate(c,c,(0,i.el)(o),t.physicalViewNorth),a.rotate(c,c,(0,i.el)(-l),t.physicalViewUp);let d=new Float64Array([-t.physicalViewUp[0],-t.physicalViewUp[1],-t.physicalViewUp[2]]),p=new Float64Array(t.physicalViewNorth);s.Z0(d,d,c),s.Z0(p,p,c),e.setDirectionOfProjection(d[0],d[1],d[2]),e.setViewUp(p[0],p[1],p[2]),e.modified()},e.setOrientationWXYZ=(t,r,n,o)=>{let u=a.identity(new Float64Array(16));if(0!==t&&(0!==r||0!==n||0!==o)){let e=(0,i.el)(t),s=l.vt();l.x8(s,[r,n,o],e),a.fromQuat(u,s)}let c=new Float64Array(3);s.Z0(c,[0,0,-1],u);let d=new Float64Array(3);s.Z0(d,[0,1,0],u),e.setDirectionOfProjection(...c),e.setViewUp(...d),e.modified()},e.computeClippingRange=e=>{let r=null,n=null;r=t.viewPlaneNormal,n=t.position;let i=-r[0],a=-r[1],o=-r[2],s=-(i*n[0]+a*n[1]+o*n[2]),l=[i*e[0]+a*e[2]+o*e[4]+s,1e-18];for(let t=0;t<2;t++)for(let r=0;r<2;r++)for(let n=0;n<2;n++){let u=i*e[n]+a*e[2+r]+o*e[4+t]+s;l[0]=ul[1]?u:l[1]}return l}}(e,t)}var p={newInstance:n.Ay.newInstance(d,"vtkCamera"),extend:d}},13898:(e,t,r)=>{"use strict";function n(e,t){let r=e.getSize();for(let n=0;nn})},13905:function(e,t,r){var n;!function(e,i,a){function o(e){var t=this,r="";t.next=function(){var e=t.b,r=t.c,n=t.d,i=t.a;return e=e<<25^e>>>7^r,r=r-n|0,n=n<<24^n>>>8^i,i=i-e|0,t.b=e=e<<20^e>>>12^r,t.c=r=r-n|0,t.d=n<<16^r>>>16^i,t.a=i-e|0},t.a=0,t.b=0,t.c=-0x61c88647,t.d=0x517cc1b7,e===Math.floor(e)?(t.a=e/0x100000000|0,t.b=0|e):r+=e;for(var n=0;n>>0)/0x100000000};return i.double=function(){do var e=((r.next()>>>11)+(r.next()>>>0)/0x100000000)/2097152;while(0===e);return e},i.int32=r.next,i.quick=i,n&&("object"==typeof n&&s(n,r),i.state=function(){return s(r,{})}),i}i&&i.exports?i.exports=l:r.amdD&&r.amdO?void 0===(n=(function(){return l}).call(t,r,t,i))||(i.exports=n):this.tychei=l}(0,e=r.nmd(e),r.amdD)},14036:(e,t,r)=>{"use strict";r.d(t,{r:()=>o});var n=r(73971),i=r(11663),a=r(20552);let o=new n.A("EraseCircle",a.A.erase,...i.pB.compositions).strategyFunction},14098:(e,t,r)=>{"use strict";let n;r.d(t,{yu:()=>d}),r(69955);var i=r(54268);r(77280),r(89349);var a=r(76879),o=r(3922),s=r(69228),l=r(26444);let u={beforeSend(e){}},c={};async function d(e,t){if(void 0===e)throw Error("createAndCacheGeometry: parameter geometryId must not be undefined");let r=i.Ay.getGeometryLoadObject(e);return void 0!==r||(r=function(e,t){let r=e.indexOf(":"),i=e.substring(0,r),l=c[i];if(null==l){if(null==n||"function"!=typeof n)throw Error(`No geometry loader for scheme ${i} has been registered`);l=n}let d=l(e,t,u);return d.promise.then(function(e){(0,s.A)(o.A,a.A.GEOMETRY_LOADED,{geometry:e})},function(t){(0,s.A)(o.A,a.A.GEOMETRY_LOADED_FAILED,{geometryId:e,error:t})}),d}(e,t),await i.Ay.putGeometryLoadObject(e,r)),r.promise}c.mesh=l.R},14099:(e,t,r)=>{"use strict";e.exports=new(r(62069))({explicit:[r(25970),r(88822),r(1343)]})},14171:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CommentImpl=void 0;let n=r(5309),i=r(4530),a=r(48040);class o extends i.CharacterDataImpl{_nodeType=n.NodeType.Comment;constructor(e=""){super(e)}static _create(e,t=""){let r=new o(t);return r._nodeDocument=e,r}}t.CommentImpl=o,(0,a.idl_defineConst)(o.prototype,"_nodeType",n.NodeType.Comment)},14291:(e,t,r)=>{"use strict";let n=r(55839),i=r(50026),a=RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),o=RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),s=/^[-+]?[0-9]+e/;e.exports=new i("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!!a.test(e)&&(!!isFinite(parseFloat(e,10))||o.test(e))},construct:function(e){let t=e.toLowerCase(),r="-"===t[0]?-1:1;return("+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t)?1===r?1/0:-1/0:".nan"===t?NaN:r*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||n.isNegativeZero(e))},represent:function(e,t){if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(1/0===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(-1/0===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(n.isNegativeZero(e))return"-0.0";let r=e.toString(10);return s.test(r)?r.replace("e",".e"):r},defaultStyle:"lowercase"})},14645:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n={hotIron:{name:"Hot Iron",numOfColors:256,colors:[[0,0,0,255],[2,0,0,255],[4,0,0,255],[6,0,0,255],[8,0,0,255],[10,0,0,255],[12,0,0,255],[14,0,0,255],[16,0,0,255],[18,0,0,255],[20,0,0,255],[22,0,0,255],[24,0,0,255],[26,0,0,255],[28,0,0,255],[30,0,0,255],[32,0,0,255],[34,0,0,255],[36,0,0,255],[38,0,0,255],[40,0,0,255],[42,0,0,255],[44,0,0,255],[46,0,0,255],[48,0,0,255],[50,0,0,255],[52,0,0,255],[54,0,0,255],[56,0,0,255],[58,0,0,255],[60,0,0,255],[62,0,0,255],[64,0,0,255],[66,0,0,255],[68,0,0,255],[70,0,0,255],[72,0,0,255],[74,0,0,255],[76,0,0,255],[78,0,0,255],[80,0,0,255],[82,0,0,255],[84,0,0,255],[86,0,0,255],[88,0,0,255],[90,0,0,255],[92,0,0,255],[94,0,0,255],[96,0,0,255],[98,0,0,255],[100,0,0,255],[102,0,0,255],[104,0,0,255],[106,0,0,255],[108,0,0,255],[110,0,0,255],[112,0,0,255],[114,0,0,255],[116,0,0,255],[118,0,0,255],[120,0,0,255],[122,0,0,255],[124,0,0,255],[126,0,0,255],[128,0,0,255],[130,0,0,255],[132,0,0,255],[134,0,0,255],[136,0,0,255],[138,0,0,255],[140,0,0,255],[142,0,0,255],[144,0,0,255],[146,0,0,255],[148,0,0,255],[150,0,0,255],[152,0,0,255],[154,0,0,255],[156,0,0,255],[158,0,0,255],[160,0,0,255],[162,0,0,255],[164,0,0,255],[166,0,0,255],[168,0,0,255],[170,0,0,255],[172,0,0,255],[174,0,0,255],[176,0,0,255],[178,0,0,255],[180,0,0,255],[182,0,0,255],[184,0,0,255],[186,0,0,255],[188,0,0,255],[190,0,0,255],[192,0,0,255],[194,0,0,255],[196,0,0,255],[198,0,0,255],[200,0,0,255],[202,0,0,255],[204,0,0,255],[206,0,0,255],[208,0,0,255],[210,0,0,255],[212,0,0,255],[214,0,0,255],[216,0,0,255],[218,0,0,255],[220,0,0,255],[222,0,0,255],[224,0,0,255],[226,0,0,255],[228,0,0,255],[230,0,0,255],[232,0,0,255],[234,0,0,255],[236,0,0,255],[238,0,0,255],[240,0,0,255],[242,0,0,255],[244,0,0,255],[246,0,0,255],[248,0,0,255],[250,0,0,255],[252,0,0,255],[254,0,0,255],[255,0,0,255],[255,2,0,255],[255,4,0,255],[255,6,0,255],[255,8,0,255],[255,10,0,255],[255,12,0,255],[255,14,0,255],[255,16,0,255],[255,18,0,255],[255,20,0,255],[255,22,0,255],[255,24,0,255],[255,26,0,255],[255,28,0,255],[255,30,0,255],[255,32,0,255],[255,34,0,255],[255,36,0,255],[255,38,0,255],[255,40,0,255],[255,42,0,255],[255,44,0,255],[255,46,0,255],[255,48,0,255],[255,50,0,255],[255,52,0,255],[255,54,0,255],[255,56,0,255],[255,58,0,255],[255,60,0,255],[255,62,0,255],[255,64,0,255],[255,66,0,255],[255,68,0,255],[255,70,0,255],[255,72,0,255],[255,74,0,255],[255,76,0,255],[255,78,0,255],[255,80,0,255],[255,82,0,255],[255,84,0,255],[255,86,0,255],[255,88,0,255],[255,90,0,255],[255,92,0,255],[255,94,0,255],[255,96,0,255],[255,98,0,255],[255,100,0,255],[255,102,0,255],[255,104,0,255],[255,106,0,255],[255,108,0,255],[255,110,0,255],[255,112,0,255],[255,114,0,255],[255,116,0,255],[255,118,0,255],[255,120,0,255],[255,122,0,255],[255,124,0,255],[255,126,0,255],[255,128,4,255],[255,130,8,255],[255,132,12,255],[255,134,16,255],[255,136,20,255],[255,138,24,255],[255,140,28,255],[255,142,32,255],[255,144,36,255],[255,146,40,255],[255,148,44,255],[255,150,48,255],[255,152,52,255],[255,154,56,255],[255,156,60,255],[255,158,64,255],[255,160,68,255],[255,162,72,255],[255,164,76,255],[255,166,80,255],[255,168,84,255],[255,170,88,255],[255,172,92,255],[255,174,96,255],[255,176,100,255],[255,178,104,255],[255,180,108,255],[255,182,112,255],[255,184,116,255],[255,186,120,255],[255,188,124,255],[255,190,128,255],[255,192,132,255],[255,194,136,255],[255,196,140,255],[255,198,144,255],[255,200,148,255],[255,202,152,255],[255,204,156,255],[255,206,160,255],[255,208,164,255],[255,210,168,255],[255,212,172,255],[255,214,176,255],[255,216,180,255],[255,218,184,255],[255,220,188,255],[255,222,192,255],[255,224,196,255],[255,226,200,255],[255,228,204,255],[255,230,208,255],[255,232,212,255],[255,234,216,255],[255,236,220,255],[255,238,224,255],[255,240,228,255],[255,242,232,255],[255,244,236,255],[255,246,240,255],[255,248,244,255],[255,250,248,255],[255,252,252,255],[255,255,255,255]]},pet:{name:"PET",numColors:256,colors:[[0,0,0,255],[0,2,1,255],[0,4,3,255],[0,6,5,255],[0,8,7,255],[0,10,9,255],[0,12,11,255],[0,14,13,255],[0,16,15,255],[0,18,17,255],[0,20,19,255],[0,22,21,255],[0,24,23,255],[0,26,25,255],[0,28,27,255],[0,30,29,255],[0,32,31,255],[0,34,33,255],[0,36,35,255],[0,38,37,255],[0,40,39,255],[0,42,41,255],[0,44,43,255],[0,46,45,255],[0,48,47,255],[0,50,49,255],[0,52,51,255],[0,54,53,255],[0,56,55,255],[0,58,57,255],[0,60,59,255],[0,62,61,255],[0,65,63,255],[0,67,65,255],[0,69,67,255],[0,71,69,255],[0,73,71,255],[0,75,73,255],[0,77,75,255],[0,79,77,255],[0,81,79,255],[0,83,81,255],[0,85,83,255],[0,87,85,255],[0,89,87,255],[0,91,89,255],[0,93,91,255],[0,95,93,255],[0,97,95,255],[0,99,97,255],[0,101,99,255],[0,103,101,255],[0,105,103,255],[0,107,105,255],[0,109,107,255],[0,111,109,255],[0,113,111,255],[0,115,113,255],[0,117,115,255],[0,119,117,255],[0,121,119,255],[0,123,121,255],[0,125,123,255],[0,128,125,255],[1,126,127,255],[3,124,129,255],[5,122,131,255],[7,120,133,255],[9,118,135,255],[11,116,137,255],[13,114,139,255],[15,112,141,255],[17,110,143,255],[19,108,145,255],[21,106,147,255],[23,104,149,255],[25,102,151,255],[27,100,153,255],[29,98,155,255],[31,96,157,255],[33,94,159,255],[35,92,161,255],[37,90,163,255],[39,88,165,255],[41,86,167,255],[43,84,169,255],[45,82,171,255],[47,80,173,255],[49,78,175,255],[51,76,177,255],[53,74,179,255],[55,72,181,255],[57,70,183,255],[59,68,185,255],[61,66,187,255],[63,64,189,255],[65,63,191,255],[67,61,193,255],[69,59,195,255],[71,57,197,255],[73,55,199,255],[75,53,201,255],[77,51,203,255],[79,49,205,255],[81,47,207,255],[83,45,209,255],[85,43,211,255],[86,41,213,255],[88,39,215,255],[90,37,217,255],[92,35,219,255],[94,33,221,255],[96,31,223,255],[98,29,225,255],[100,27,227,255],[102,25,229,255],[104,23,231,255],[106,21,233,255],[108,19,235,255],[110,17,237,255],[112,15,239,255],[114,13,241,255],[116,11,243,255],[118,9,245,255],[120,7,247,255],[122,5,249,255],[124,3,251,255],[126,1,253,255],[128,0,255,255],[130,2,252,255],[132,4,248,255],[134,6,244,255],[136,8,240,255],[138,10,236,255],[140,12,232,255],[142,14,228,255],[144,16,224,255],[146,18,220,255],[148,20,216,255],[150,22,212,255],[152,24,208,255],[154,26,204,255],[156,28,200,255],[158,30,196,255],[160,32,192,255],[162,34,188,255],[164,36,184,255],[166,38,180,255],[168,40,176,255],[170,42,172,255],[171,44,168,255],[173,46,164,255],[175,48,160,255],[177,50,156,255],[179,52,152,255],[181,54,148,255],[183,56,144,255],[185,58,140,255],[187,60,136,255],[189,62,132,255],[191,64,128,255],[193,66,124,255],[195,68,120,255],[197,70,116,255],[199,72,112,255],[201,74,108,255],[203,76,104,255],[205,78,100,255],[207,80,96,255],[209,82,92,255],[211,84,88,255],[213,86,84,255],[215,88,80,255],[217,90,76,255],[219,92,72,255],[221,94,68,255],[223,96,64,255],[225,98,60,255],[227,100,56,255],[229,102,52,255],[231,104,48,255],[233,106,44,255],[235,108,40,255],[237,110,36,255],[239,112,32,255],[241,114,28,255],[243,116,24,255],[245,118,20,255],[247,120,16,255],[249,122,12,255],[251,124,8,255],[253,126,4,255],[255,128,0,255],[255,130,4,255],[255,132,8,255],[255,134,12,255],[255,136,16,255],[255,138,20,255],[255,140,24,255],[255,142,28,255],[255,144,32,255],[255,146,36,255],[255,148,40,255],[255,150,44,255],[255,152,48,255],[255,154,52,255],[255,156,56,255],[255,158,60,255],[255,160,64,255],[255,162,68,255],[255,164,72,255],[255,166,76,255],[255,168,80,255],[255,170,85,255],[255,172,89,255],[255,174,93,255],[255,176,97,255],[255,178,101,255],[255,180,105,255],[255,182,109,255],[255,184,113,255],[255,186,117,255],[255,188,121,255],[255,190,125,255],[255,192,129,255],[255,194,133,255],[255,196,137,255],[255,198,141,255],[255,200,145,255],[255,202,149,255],[255,204,153,255],[255,206,157,255],[255,208,161,255],[255,210,165,255],[255,212,170,255],[255,214,174,255],[255,216,178,255],[255,218,182,255],[255,220,186,255],[255,222,190,255],[255,224,194,255],[255,226,198,255],[255,228,202,255],[255,230,206,255],[255,232,210,255],[255,234,214,255],[255,236,218,255],[255,238,222,255],[255,240,226,255],[255,242,230,255],[255,244,234,255],[255,246,238,255],[255,248,242,255],[255,250,246,255],[255,252,250,255],[255,255,255,255]]},hotMetalBlue:{name:"Hot Metal Blue",numColors:256,colors:[[0,0,0,255],[0,0,2,255],[0,0,4,255],[0,0,6,255],[0,0,8,255],[0,0,10,255],[0,0,12,255],[0,0,14,255],[0,0,16,255],[0,0,17,255],[0,0,19,255],[0,0,21,255],[0,0,23,255],[0,0,25,255],[0,0,27,255],[0,0,29,255],[0,0,31,255],[0,0,33,255],[0,0,35,255],[0,0,37,255],[0,0,39,255],[0,0,41,255],[0,0,43,255],[0,0,45,255],[0,0,47,255],[0,0,49,255],[0,0,51,255],[0,0,53,255],[0,0,55,255],[0,0,57,255],[0,0,59,255],[0,0,61,255],[0,0,63,255],[0,0,65,255],[0,0,67,255],[0,0,69,255],[0,0,71,255],[0,0,73,255],[0,0,75,255],[0,0,77,255],[0,0,79,255],[0,0,81,255],[0,0,83,255],[0,0,84,255],[0,0,86,255],[0,0,88,255],[0,0,90,255],[0,0,92,255],[0,0,94,255],[0,0,96,255],[0,0,98,255],[0,0,100,255],[0,0,102,255],[0,0,104,255],[0,0,106,255],[0,0,108,255],[0,0,110,255],[0,0,112,255],[0,0,114,255],[0,0,116,255],[0,0,117,255],[0,0,119,255],[0,0,121,255],[0,0,123,255],[0,0,125,255],[0,0,127,255],[0,0,129,255],[0,0,131,255],[0,0,133,255],[0,0,135,255],[0,0,137,255],[0,0,139,255],[0,0,141,255],[0,0,143,255],[0,0,145,255],[0,0,147,255],[0,0,149,255],[0,0,151,255],[0,0,153,255],[0,0,155,255],[0,0,157,255],[0,0,159,255],[0,0,161,255],[0,0,163,255],[0,0,165,255],[0,0,167,255],[3,0,169,255],[6,0,171,255],[9,0,173,255],[12,0,175,255],[15,0,177,255],[18,0,179,255],[21,0,181,255],[24,0,183,255],[26,0,184,255],[29,0,186,255],[32,0,188,255],[35,0,190,255],[38,0,192,255],[41,0,194,255],[44,0,196,255],[47,0,198,255],[50,0,200,255],[52,0,197,255],[55,0,194,255],[57,0,191,255],[59,0,188,255],[62,0,185,255],[64,0,182,255],[66,0,179,255],[69,0,176,255],[71,0,174,255],[74,0,171,255],[76,0,168,255],[78,0,165,255],[81,0,162,255],[83,0,159,255],[85,0,156,255],[88,0,153,255],[90,0,150,255],[93,2,144,255],[96,4,138,255],[99,6,132,255],[102,8,126,255],[105,9,121,255],[108,11,115,255],[111,13,109,255],[114,15,103,255],[116,17,97,255],[119,19,91,255],[122,21,85,255],[125,23,79,255],[128,24,74,255],[131,26,68,255],[134,28,62,255],[137,30,56,255],[140,32,50,255],[143,34,47,255],[146,36,44,255],[149,38,41,255],[152,40,38,255],[155,41,35,255],[158,43,32,255],[161,45,29,255],[164,47,26,255],[166,49,24,255],[169,51,21,255],[172,53,18,255],[175,55,15,255],[178,56,12,255],[181,58,9,255],[184,60,6,255],[187,62,3,255],[190,64,0,255],[194,66,0,255],[198,68,0,255],[201,70,0,255],[205,72,0,255],[209,73,0,255],[213,75,0,255],[217,77,0,255],[221,79,0,255],[224,81,0,255],[228,83,0,255],[232,85,0,255],[236,87,0,255],[240,88,0,255],[244,90,0,255],[247,92,0,255],[251,94,0,255],[255,96,0,255],[255,98,3,255],[255,100,6,255],[255,102,9,255],[255,104,12,255],[255,105,15,255],[255,107,18,255],[255,109,21,255],[255,111,24,255],[255,113,26,255],[255,115,29,255],[255,117,32,255],[255,119,35,255],[255,120,38,255],[255,122,41,255],[255,124,44,255],[255,126,47,255],[255,128,50,255],[255,130,53,255],[255,132,56,255],[255,134,59,255],[255,136,62,255],[255,137,65,255],[255,139,68,255],[255,141,71,255],[255,143,74,255],[255,145,76,255],[255,147,79,255],[255,149,82,255],[255,151,85,255],[255,152,88,255],[255,154,91,255],[255,156,94,255],[255,158,97,255],[255,160,100,255],[255,162,103,255],[255,164,106,255],[255,166,109,255],[255,168,112,255],[255,169,115,255],[255,171,118,255],[255,173,121,255],[255,175,124,255],[255,177,126,255],[255,179,129,255],[255,181,132,255],[255,183,135,255],[255,184,138,255],[255,186,141,255],[255,188,144,255],[255,190,147,255],[255,192,150,255],[255,194,153,255],[255,196,156,255],[255,198,159,255],[255,200,162,255],[255,201,165,255],[255,203,168,255],[255,205,171,255],[255,207,174,255],[255,209,176,255],[255,211,179,255],[255,213,182,255],[255,215,185,255],[255,216,188,255],[255,218,191,255],[255,220,194,255],[255,222,197,255],[255,224,200,255],[255,226,203,255],[255,228,206,255],[255,229,210,255],[255,231,213,255],[255,233,216,255],[255,235,219,255],[255,237,223,255],[255,239,226,255],[255,240,229,255],[255,242,232,255],[255,244,236,255],[255,246,239,255],[255,248,242,255],[255,250,245,255],[255,251,249,255],[255,253,252,255],[255,255,255,255]]},pet20Step:{name:"PET 20 Step",numColors:256,colors:[[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255]]},gray:{name:"Gray",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[1,1,1]],green:[[0,0,0],[1,1,1]],blue:[[0,0,0],[1,1,1]]}},jet:{name:"Jet",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[.35,0,0],[.66,1,1],[.89,1,1],[1,.5,.5]],green:[[0,0,0],[.125,0,0],[.375,1,1],[.64,1,1],[.91,0,0],[1,0,0]],blue:[[0,.5,.5],[.11,1,1],[.34,1,1],[.65,0,0],[1,0,0]]}},hsv:{name:"HSV",numColors:256,gamma:1,segmentedData:{red:[[0,1,1],[.15873,1,1],[.174603,.96875,.96875],[.333333,.03125,.03125],[.349206,0,0],[.666667,0,0],[.68254,.03125,.03125],[.84127,.96875,.96875],[.857143,1,1],[1,1,1]],green:[[0,0,0],[.15873,.9375,.9375],[.174603,1,1],[.507937,1,1],[.666667,.0625,.0625],[.68254,0,0],[1,0,0]],blue:[[0,0,0],[.333333,0,0],[.349206,.0625,.0625],[.507937,1,1],[.84127,1,1],[.857143,.9375,.9375],[1,.09375,.09375]]}},hot:{name:"Hot",numColors:256,gamma:1,segmentedData:{red:[[0,.0416,.0416],[.365079,1,1],[1,1,1]],green:[[0,0,0],[.365079,0,0],[.746032,1,1],[1,1,1]],blue:[[0,0,0],[.746032,0,0],[1,1,1]]}},cool:{name:"Cool",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[1,1,1]],green:[[0,1,1],[1,0,0]],blue:[[0,1,1],[1,1,1]]}},spring:{name:"Spring",numColors:256,gamma:1,segmentedData:{red:[[0,1,1],[1,1,1]],green:[[0,0,0],[1,1,1]],blue:[[0,1,1],[1,0,0]]}},summer:{name:"Summer",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[1,1,1]],green:[[0,.5,.5],[1,1,1]],blue:[[0,.4,.4],[1,.4,.4]]}},autumn:{name:"Autumn",numColors:256,gamma:1,segmentedData:{red:[[0,1,1],[1,1,1]],green:[[0,0,0],[1,1,1]],blue:[[0,0,0],[1,0,0]]}},winter:{name:"Winter",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[1,0,0]],green:[[0,0,0],[1,1,1]],blue:[[0,1,1],[1,.5,.5]]}},bone:{name:"Bone",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[.746032,.652778,.652778],[1,1,1]],green:[[0,0,0],[.365079,.319444,.319444],[.746032,.777778,.777778],[1,1,1]],blue:[[0,0,0],[.365079,.444444,.444444],[1,1,1]]}},copper:{name:"Copper",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[.809524,1,1],[1,1,1]],green:[[0,0,0],[1,.7812,.7812]],blue:[[0,0,0],[1,.4975,.4975]]}},spectral:{name:"Spectral",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[.05,.4667,.4667],[.1,.5333,.5333],[.15,0,0],[.2,0,0],[.25,0,0],[.3,0,0],[.35,0,0],[.4,0,0],[.45,0,0],[.5,0,0],[.55,0,0],[.6,0,0],[.65,.7333,.7333],[.7,.9333,.9333],[.75,1,1],[.8,1,1],[.85,1,1],[.9,.8667,.8667],[.95,.8,.8],[1,.8,.8]],green:[[0,0,0],[.05,0,0],[.1,0,0],[.15,0,0],[.2,0,0],[.25,.4667,.4667],[.3,.6,.6],[.35,.6667,.6667],[.4,.6667,.6667],[.45,.6,.6],[.5,.7333,.7333],[.55,.8667,.8667],[.6,1,1],[.65,1,1],[.7,.9333,.9333],[.75,.8,.8],[.8,.6,.6],[.85,0,0],[.9,0,0],[.95,0,0],[1,.8,.8]],blue:[[0,0,0],[.05,.5333,.5333],[.1,.6,.6],[.15,.6667,.6667],[.2,.8667,.8667],[.25,.8667,.8667],[.3,.8667,.8667],[.35,.6667,.6667],[.4,.5333,.5333],[.45,0,0],[.5,0,0],[.55,0,0],[.6,0,0],[.65,0,0],[.7,0,0],[.75,0,0],[.8,0,0],[.85,0,0],[.9,0,0],[.95,0,0],[1,.8,.8]]}},coolwarm:{name:"CoolWarm",numColors:256,gamma:1,segmentedData:{red:[[0,.2298057,.2298057],[.03125,.26623388,.26623388],[.0625,.30386891,.30386891],[.09375,.342804478,.342804478],[.125,.38301334,.38301334],[.15625,.424369608,.424369608],[.1875,.46666708,.46666708],[.21875,.509635204,.509635204],[.25,.552953156,.552953156],[.28125,.596262162,.596262162],[.3125,.639176211,.639176211],[.34375,.681291281,.681291281],[.375,.722193294,.722193294],[.40625,.761464949,.761464949],[.4375,.798691636,.798691636],[.46875,.833466556,.833466556],[.5,.865395197,.865395197],[.53125,.897787179,.897787179],[.5625,.924127593,.924127593],[.59375,.944468518,.944468518],[.625,.958852946,.958852946],[.65625,.96732803,.96732803],[.6875,.969954137,.969954137],[.71875,.966811177,.966811177],[.75,.958003065,.958003065],[.78125,.943660866,.943660866],[.8125,.923944917,.923944917],[.84375,.89904617,.89904617],[.875,.869186849,.869186849],[.90625,.834620542,.834620542],[.9375,.795631745,.795631745],[.96875,.752534934,.752534934],[1,.705673158,.705673158]],green:[[0,.298717966,.298717966],[.03125,.353094838,.353094838],[.0625,.406535296,.406535296],[.09375,.458757618,.458757618],[.125,.50941904,.50941904],[.15625,.558148092,.558148092],[.1875,.604562568,.604562568],[.21875,.648280772,.648280772],[.25,.688929332,.688929332],[.28125,.726149107,.726149107],[.3125,.759599947,.759599947],[.34375,.788964712,.788964712],[.375,.813952739,.813952739],[.40625,.834302879,.834302879],[.4375,.849786142,.849786142],[.46875,.860207984,.860207984],[.5,.86541021,.86541021],[.53125,.848937047,.848937047],[.5625,.827384882,.827384882],[.59375,.800927443,.800927443],[.625,.769767752,.769767752],[.65625,.734132809,.734132809],[.6875,.694266682,.694266682],[.71875,.650421156,.650421156],[.75,.602842431,.602842431],[.78125,.551750968,.551750968],[.8125,.49730856,.49730856],[.84375,.439559467,.439559467],[.875,.378313092,.378313092],[.90625,.312874446,.312874446],[.9375,.24128379,.24128379],[.96875,.157246067,.157246067],[1,.01555616,.01555616]],blue:[[0,.753683153,.753683153],[.03125,.801466763,.801466763],[.0625,.84495867,.84495867],[.09375,.883725899,.883725899],[.125,.917387822,.917387822],[.15625,.945619588,.945619588],[.1875,.968154911,.968154911],[.21875,.98478814,.98478814],[.25,.995375608,.995375608],[.28125,.999836203,.999836203],[.3125,.998151185,.998151185],[.34375,.990363227,.990363227],[.375,.976574709,.976574709],[.40625,.956945269,.956945269],[.4375,.931688648,.931688648],[.46875,.901068838,.901068838],[.5,.865395561,.865395561],[.53125,.820880546,.820880546],[.5625,.774508472,.774508472],[.59375,.726736146,.726736146],[.625,.678007945,.678007945],[.65625,.628751763,.628751763],[.6875,.579375448,.579375448],[.71875,.530263762,.530263762],[.75,.481775914,.481775914],[.78125,.434243684,.434243684],[.8125,.387970225,.387970225],[.84375,.343229596,.343229596],[.875,.300267182,.300267182],[.90625,.259301199,.259301199],[.9375,.220525627,.220525627],[.96875,.184115123,.184115123],[1,.150232812,.150232812]]}},blues:{name:"Blues",numColors:256,gamma:1,segmentedData:{red:[[0,.9686274528503418,.9686274528503418],[.125,.8705882430076599,.8705882430076599],[.25,.7764706015586853,.7764706015586853],[.375,.6196078658103943,.6196078658103943],[.5,.41960784792900085,.41960784792900085],[.625,.25882354378700256,.25882354378700256],[.75,.12941177189350128,.12941177189350128],[.875,.0313725508749485,.0313725508749485],[1,.0313725508749485,.0313725508749485]],green:[[0,.9843137264251709,.9843137264251709],[.125,.9215686321258545,.9215686321258545],[.25,.8588235378265381,.8588235378265381],[.375,.7921568751335144,.7921568751335144],[.5,.6823529601097107,.6823529601097107],[.625,.572549045085907,.572549045085907],[.75,.4431372582912445,.4431372582912445],[.875,.3176470696926117,.3176470696926117],[1,.1882352977991104,.1882352977991104]],blue:[[0,1,1],[.125,.9686274528503418,.9686274528503418],[.25,.9372549057006836,.9372549057006836],[.375,.8823529481887817,.8823529481887817],[.5,.8392156958580017,.8392156958580017],[.625,.7764706015586853,.7764706015586853],[.75,.7098039388656616,.7098039388656616],[.875,.6117647290229797,.6117647290229797],[1,.41960784792900085,.41960784792900085]]}}}},14958:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=r(31320).BF.ZX},15005:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(85250),i=r(39216);let a={},o={add:(e,t)=>{let[r,n]=e,i=`${r}_${n}`;a[i]||(a[i]={}),a[i]=t},get:(e,t,r)=>{if("spatialRegistrationModule"!==e)return;let i=`${t}_${r}`;if(a[i])return a[i];let o=`${r}_${t}`;if(a[o])return n.invert(n.create(),a[o])}};(0,i.addProvider)(o.get.bind(o));let s=o},15009:(e,t,r)=>{"use strict";r.d(t,{R:()=>i,p:()=>a});var n=r(70192);function i(e,t,r,n,o=.25){let s;for(let i of a(e,t,{targetVolumeId:r,stepSize:o})){let t=n(e.getIntensityFromWorld(i),i);t&&(s=t)}return s}function a(e,t,{targetVolumeId:r,stepSize:i}){let a=e.getCamera(),{viewPlaneNormal:s}=a,{spacingInNormalDirection:l}=n.BF.getTargetVolumeAndSpacingInNormalDir(e,a,r),u=l*i||1,c=e.getBounds(),d=[],p=[...t];for(;o(p,c);)d.push([...p]),p[0]+=s[0]*u,p[1]+=s[1]*u,p[2]+=s[2]*u;for(p=[...t];o(p,c);)d.push([...p]),p[0]-=s[0]*u,p[1]-=s[1]*u,p[2]-=s[2]*u;return d}let o=function(e,t){let[r,n,i,a,o,s]=t;return e[0]>r+10&&e[0]i+10&&e[1]o+10&&e[2]{"use strict";r.d(t,{A:()=>a});var n=r(39216),i=r(77280);function a(e){let t=n.get(i.nb.MODALITY_LUT,e)||{},{modality:r}=n.get(i.nb.GENERAL_SERIES,e)||{},a={rescaleSlope:t.rescaleSlope||1,rescaleIntercept:t.rescaleIntercept??0,modality:r},o=n.get(i.nb.SCALING,e)||{};return{...a,..."PT"===r&&{suvbw:o.suvbw,suvbsa:o.suvbsa,suvlbm:o.suvlbm},..."RTDOSE"===r&&{doseGridScaling:o.DoseGridScaling,doseSummation:o.DoseSummation,doseType:o.DoseType,doseUnit:o.DoseUnit}}}},15344:(e,t,r)=>{"use strict";r.d(t,{A:()=>h});var n=r(53725),i=r(77280),a=r(98197),o=r(92049),s=r(19667),l=r(6297),u=r(20556),c=r(61310),d=r(73589);class p extends d.A{get zoom(){return Math.max(this.state.viewState.scale??1,.001)}get pan(){return this.getCanvasMapping()?(0,u.uP)(this.getCanvasMapping()):[0,0]}get rotation(){return this.state.viewState.rotation??0}canvasToWorld(e){let t=this.getCanvasMapping();return[(e[0]-t.left)/t.worldToCanvasRatio,(e[1]-t.top)/t.worldToCanvasRatio,0]}worldToCanvas(e){let t=this.getCanvasMapping();return[t.left+e[0]*t.worldToCanvasRatio,t.top+e[1]*t.worldToCanvasRatio]}getFrameOfReferenceUID(){return this.state.frameOfReferenceUID}withZoom(e,t){let r=Math.max(e,.001);if(!t)return this.cloneWithViewState({...this.state.viewState,scale:r,scaleMode:"fit"});let n=this.canvasToWorld(t);return this.cloneWithViewState({...this.state.viewState,anchorCanvas:[t[0]/Math.max(this.state.containerWidth,1),t[1]/Math.max(this.state.containerHeight,1)],anchorWorld:[n[0],n[1]],scale:r,scaleMode:"fit"})}withPan(e){return this.cloneWithViewState({...this.state.viewState,anchorWorld:(0,u.Kw)([e[0],e[1]],this.getCanvasMapping())})}buildICamera(){let e=this.getCanvasMapping();return{parallelProjection:!0,focalPoint:this.canvasToWorld([this.state.containerWidth/2,this.state.containerHeight/2]),position:[0,0,0],viewUp:[0,-1,0],parallelScale:this.state.containerHeight/2/Math.max(e.worldToCanvasRatio,.001),viewPlaneNormal:[0,0,1],rotation:this.rotation}}getCanvasMapping(){return this.cachedCanvasMapping||=(0,u.ak)({camera:this.state.viewState,containerHeight:this.state.containerHeight,containerWidth:this.state.containerWidth,intrinsicHeight:this.state.intrinsicHeight,intrinsicWidth:this.state.intrinsicWidth,objectFit:this.state.objectFit})||{left:0,top:0,width:Math.max(this.state.intrinsicWidth,1),height:Math.max(this.state.intrinsicHeight,1),containerWidth:Math.max(this.state.containerWidth,1),containerHeight:Math.max(this.state.containerHeight,1),intrinsicWidth:Math.max(this.state.intrinsicWidth,1),intrinsicHeight:Math.max(this.state.intrinsicHeight,1),anchorWorld:[0,0],anchorCanvas:[.5,.5],worldToCanvasRatio:1},this.cachedCanvasMapping}cloneWithViewState(e){return new p({...this.state,viewState:e})}}class m extends n.A{static get useCustomRenderingPipeline(){return!0}constructor(e){super(e),this.type=i.NV.VIDEO_NEXT,this.renderingEngineId=e.renderingEngineId,this.element.style.position=this.element.style.position||"relative",this.element.style.overflow="hidden",this.element.style.background=this.element.style.background||"#000",this.dataProvider=e.dataProvider||new s.Q,this.renderPathResolver=e.renderPathResolver||(0,c.h)(),this.renderContext={viewportId:this.id,renderingEngineId:this.renderingEngineId,type:"video",element:this.element},this.viewState=(0,u.vd)(),this.element.setAttribute("data-viewport-uid",this.id),this.element.setAttribute("data-rendering-engine-uid",this.renderingEngineId)}async setDisplaySets(...e){for(let[t,{displaySetId:r}]of(this.removeAllData(),e.entries())){await this.addDisplaySet(r,{renderMode:"video2d",role:0===t?"source":"overlay"});let e=this.getBinding(r);if(!e)continue;this.setDefaultDataPresentation(r,{visible:!0,opacity:1,playbackRate:1,loop:!0,muted:!0,objectFit:"contain"});let n=this.getVideoDataFromBinding(e);if(!n)throw Error(`[VideoViewport] Loaded data for ${r} is not a valid video stream`);this.viewState=(0,u.vd)(),n.frameRange[0]>1&&(this.viewState.currentTimeSeconds=(0,a.frameNumberToTimeSeconds)(n.frameRange[0],n.fps)),this.modified(),this.trackVideoElement(),await this.primeInitialFrame(n)}}removeData(e){let t=this.getFirstBinding()?.data.id;super.removeData(e),t===e&&(this.untrackVideoElement(),this.trackVideoElement())}getViewReference(e={}){let t=e.frameNumber??("number"==typeof e.sliceIndex?e.sliceIndex+1:this.getFrameNumber()),r="number"==typeof e.sliceIndex?e.sliceIndex:t-1,n="number"==typeof r?this.getCurrentImageId(r):this.getCurrentImageId(),i=this.getFirstBinding()?.data.id;return{FrameOfReferenceUID:this.getFrameOfReferenceUID(),dataId:i,dimensionGroupNumber:t,referencedImageId:n,sliceIndex:r}}getCurrentImageId(e=this.getCurrentImageIdIndex()){let t=(0,l._d)(this.getFirstBinding()?.data.id||"");if(t)return(0,o.Hf)(t,e+1)}getViewReferenceId(e={}){let t=e.sliceIndex;return void 0===t?`videoId:${this.getCurrentImageId()}`:`videoId:${this.getCurrentImageId(t)}`}setViewReference(e){if("number"==typeof e.dimensionGroupNumber)return void this.setFrameNumber(e.dimensionGroupNumber);"number"==typeof e.sliceIndex&&this.setFrameNumber(e.sliceIndex+1)}getSliceIndex(){return this.getCurrentImageIdIndex()}getZoom(){return this.getResolvedView()?.zoom??Math.max(this.viewState.scale??1,.001)}setZoom(e,t){let r=this.getResolvedView();if(r)return void this.applyResolvedViewState(r.withZoom(e,t).state.viewState);this.setViewState({scale:Math.max(e,.001),scaleMode:"fit"})}getPan(){return this.getResolvedView()?.pan??[0,0]}setPan(e){let t=this.getResolvedView();t&&this.applyResolvedViewState(t.withPan(e).state.viewState)}getResolvedView(){let e=this.getVideoElement(),t=this.getVideoData();if(e&&t)return new p({viewState:this.viewState,containerHeight:this.element.clientHeight,containerWidth:this.element.clientWidth,frameOfReferenceUID:t.metadata.imagePlaneModule?.frameOfReferenceUID||t.renderedUrl,intrinsicHeight:e.videoHeight||this.element.clientHeight,intrinsicWidth:e.videoWidth||this.element.clientWidth,objectFit:this.getDisplaySetPresentation(t.id)?.objectFit,payload:t})}getReferenceViewContexts(){let e=this.getFirstBinding(),t=this.getVideoData();if(!e||!t)return super.getReferenceViewContexts();let r=(0,l._d)(e.data.id),n=this.getFrameNumber();return[{dataId:e.data.id,dataIds:[e.data.id,r],frameOfReferenceUID:this.getFrameOfReferenceUID(),imageIds:this.getImageIds(),currentImageIdIndex:n-1,dimensionGroupNumber:n,numDimensionGroups:t.numberOfFrames}]}play(){let e=this.getVideoElement();return e?e.play().then(()=>void 0).catch(()=>void 0):Promise.resolve()}pause(){this.getVideoElement()?.pause(),this.syncCameraCurrentTimeFromElement()}seek(e){let t=this.getVideoData(),r=t?.durationSeconds?Math.max(t.durationSeconds,0):1/0;this.setViewState({currentTimeSeconds:Math.max(0,Math.min(e,r))})}setFrameNumber(e){let t=this.getVideoData();t&&this.seek((0,a.frameNumberToTimeSeconds)(e,t.fps))}setPlaybackRate(e){let t=this.getFirstBinding()?.data.id;t&&this.setDisplaySetPresentation(t,{playbackRate:e})}scroll(e=1,t=!0,r=!1){let n=this.getVideoData();if(!n?.fps)return;this.pause();let i=(0,a.frameNumberToTimeSeconds)(n.frameRange[0],n.fps),o=n.durationSeconds??(0,a.frameNumberToTimeSeconds)(n.frameRange[1],n.fps),s=this.getCurrentTime()+e/n.fps;if(r){let e=Math.max(o-i,1/n.fps);for(;so;)s-=e}else s=Math.max(i,Math.min(s,o));this.seek(s)}getFrameRate(){return this.getVideoData()?.fps??0}getNumberOfFrames(){return this.getVideoData()?.numberOfFrames??0}getNumberOfSlices(){return this.getImageIds().length||this.getNumberOfFrames()}getCurrentTime(){return this.syncCameraCurrentTimeFromElement(),this.viewState.currentTimeSeconds??0}getFrameNumber(){let e=this.getVideoData();if(!e)return 1;let t=(0,a.timeSecondsToFrameNumber)(this.getCurrentTime(),e.fps);return Math.max(e.frameRange[0],Math.min(t,e.frameRange[1]))}getCurrentImageIdIndex(){return Math.max(0,this.getFrameNumber()-1)}getImageIds(){let e=this.getFirstBinding()?.data.id,t=this.getVideoData();if(!e||!t)return[];let r=(0,l._d)(e),n=Array(t.numberOfFrames);for(let e=1;e<=t.numberOfFrames;e++)try{n[e-1]=(0,o.Hf)(r,e)}catch{return[r]}return n}render(){if(this.isDestroyed)return}customRenderViewportToCanvas(){this.render()}resetViewState(){if(this.isDestroyed)return!1;let e=this.getCameraForEvent(),{currentTimeSeconds:t}=this.viewState;return this.viewState=this.normalizeViewState({...(0,u.vd)(),currentTimeSeconds:t}),this.modified(e),this.triggerCameraResetEvent(),!0}dispose(){this.destroy()}getUseCustomRenderingPipeline(){return!0}normalizeViewState(e){return(0,u.l3)(e)}onDestroy(){this.untrackVideoElement()}getVideoElement(){return this.getVideoRendering()?.element}getVideoData(){let e=this.getCurrentBinding();if(e)return this.getVideoDataFromBinding(e)}getVideoDataFromBinding(e){var t;if("object"==typeof(t=e.data)&&null!==t&&"video"===t.type&&"string"==typeof t.renderedUrl&&"number"==typeof t.fps&&"number"==typeof t.numberOfFrames&&Array.isArray(t.frameRange)&&2===t.frameRange.length&&"number"==typeof t.frameRange[0]&&"number"==typeof t.frameRange[1])return e.data}getVideoRendering(){let e=this.getFirstBinding();if(e&&"video2d"===e.rendering.renderMode)return e.rendering}syncCameraCurrentTimeFromElement(){let e=this.getVideoElement();if(!e)return;let t=Math.max(0,e.currentTime||0);t!==(this.viewState.currentTimeSeconds??0)&&(this.viewState={...this.viewState,currentTimeSeconds:t})}trackVideoElement(){let e=this.getVideoElement();if(!e||this.trackedVideoElement===e)return;this.untrackVideoElement();let t=()=>{this.syncCameraCurrentTimeFromElement()};e.addEventListener("loadedmetadata",t),e.addEventListener("seeked",t),e.addEventListener("timeupdate",t),this.trackedVideoElement=e,this.cleanupTrackedVideoElement=()=>{e.removeEventListener("loadedmetadata",t),e.removeEventListener("seeked",t),e.removeEventListener("timeupdate",t)},t()}untrackVideoElement(){this.cleanupTrackedVideoElement?.(),this.cleanupTrackedVideoElement=void 0,this.trackedVideoElement=void 0}applyResolvedViewState(e){this.setViewState(e)}async primeInitialFrame(e){let t=this.getVideoElement();if(!t)return;await f(t);let r=e.frameRange[0]>1?(0,a.frameNumberToTimeSeconds)(e.frameRange[0],e.fps):0;try{await t.play().catch(()=>void 0)}catch(e){}await g(t,r),await v(t),t.pause(),this.syncCameraCurrentTimeFromElement()}}let h=m;async function f(e){e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA||await new Promise(t=>{let r=()=>{n(),t()},n=()=>{e.removeEventListener("loadeddata",r),e.removeEventListener("canplay",r)};e.addEventListener("loadeddata",r,{once:!0}),e.addEventListener("canplay",r,{once:!0})})}async function g(e,t){.001>=Math.abs((e.currentTime||0)-t)||await new Promise(r=>{let n=()=>{e.removeEventListener("seeked",n),r()};e.addEventListener("seeked",n,{once:!0}),e.currentTime=t})}async function v(e){let t=e.requestVideoFrameCallback;if(t)return void await new Promise(r=>{t.call(e,()=>r())});await new Promise(e=>requestAnimationFrame(()=>e()))}},15376:e=>{!function(){var t={675:function(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>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>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="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=a.length;o0)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},72:function(e,t,r){"use strict";var n=r(675),i=r(783),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|m(n,i),l=o(a),u=l.write(n,i);return u!==a&&(l=l.slice(0,u)),l}if(ArrayBuffer.isView(e))return d(e);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(_(e,ArrayBuffer)||e&&_(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(_(e,SharedArrayBuffer)||e&&_(e.buffer,SharedArrayBuffer)))return function(e,t,r){var n;if(t<0||e.byteLength=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function m(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||_(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 S(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return O(e).length;default:if(i)return n?-1:S(e).length;t=(""+t).toLowerCase(),i=!0}}function h(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;a0x7fffffff?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;as&&(r=s-l),a=r;a>=0;a--){for(var d=!0,p=0;pr&&(e+=" ... "),""},a&&(s.prototype[a]=s.prototype.inspect),s.prototype.compare=function(e,t,r,n,i){if(_(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;d239?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 p=n,m=p.length;if(m<=4096)return String.fromCharCode.apply(String,p);for(var h="",f=0;fr)throw RangeError("Trying to access beyond buffer length")}function I(e,t,r,n,i,a){if(!s.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw RangeError("Index out of range")}function x(e,t,r,n,i,a){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function C(e,t,r,n,a){return t*=1,r>>>=0,a||x(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function A(e,t,r,n,a){return t*=1,r>>>=0,a||x(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}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,p=this.length-t;if((void 0===r||r>p)&&(r=p),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var m=!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>8,i.push(r%256),i.push(n);return i}(e,this.length-c),this,c,d);default:if(m)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),m=!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>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],i=1,a=0;++a>>=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=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},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=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=(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=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;I(this,e,t,r,i,0)}var a=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;I(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=function(e,t,r){return e*=1,t>>>=0,r||I(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||I(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||I(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||I(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=function(e,t,r){return e*=1,t>>>=0,r||I(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);I(this,e,t,r,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a>>=0,!n){var i=Math.pow(2,8*r-1);I(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||I(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||I(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||I(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||I(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||I(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 C(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return C(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return A(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return A(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=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=0;--a)e[a+t]=this[a+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return 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>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&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 w(e){for(var t=[],r=0;r=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function _(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var E=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}()},783:function(e,t){t.read=function(e,t,r,n,i){var a,o,s=8*i-n-1,l=(1<>1,c=-7,d=r?i-1:0,p=r?-1:1,m=e[t+d];for(d+=p,a=m&(1<<-c)-1,m>>=-c,c+=s;c>0;a=256*a+e[t+d],d+=p,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+e[t+d],d+=p,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:1/0*(m?-1:1);o+=Math.pow(2,n),a-=u}return(m?-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<>1,p=5960464477539062e-23*(23===i),m=n?0:a-1,h=n?1:-1,f=+(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+=p/l:t+=p*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+m]=255&s,m+=h,s/=256,i-=8);for(o=o<0;e[r+m]=255&o,m+=h,o/=256,u-=8);e[r+m-h]|=128*f}}},r={};function n(e){var i=r[e];if(void 0!==i)return i.exports;var a=r[e]={exports:{}},o=!0;try{t[e](a,a.exports,n),o=!1}finally{o&&delete r[e]}return a.exports}n.ab="//",e.exports=n(72)}()},15695:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>c,C3:()=>u});var n=r(88243),i=r(82006);function a(){return{maxIJKs:[]}}function o(e,t){let{value:r}=t,{maxIJKs:n}=e,i=n.length;if("number"!=typeof r||i>=10&&r=n[i-1].value)n.push(a);else for(let e=0;e=10&&n.splice(0,1)}function s(e,t,r){let{spacing:n,calibration:a}=r,{volumeUnit:o}=(0,i.Op)({calibration:a,hasPixelSpacing:!0},[]),s=n?n[0]*n[1]*n[2]:1;return t.volume={value:Array.isArray(t.count.value)?t.count.value.map(e=>e*s):t.count.value*s,unit:o,name:"volume",label:"Volume"},t.maxIJKs=e.maxIJKs.filter(e=>void 0!==e.pointIJK),t.array.push(t.volume),e.maxIJKs=[],t}class l extends n.O{static statsInit(e){super.statsInit(e),this.volumetricState=a()}static statsCallback(e){super.statsCallback(e),o(this.volumetricState,e)}static getStatistics(e){let t={...e,unit:e?.unit||"none",calibration:e?.calibration,hasPixelSpacing:e?.hasPixelSpacing},r=super.getStatistics(t);return s(this.volumetricState,r,t)}}l.volumetricState=a();class u extends n.B{constructor(e){super(e),this.volumetricState=a()}statsInit(e){super.statsInit(e),this.volumetricState=a()}statsCallback(e){super.statsCallback(e),o(this.volumetricState,e)}getStatistics(e){let t={...e,unit:e?.unit||"none",calibration:e?.calibration,hasPixelSpacing:e?.hasPixelSpacing},r=super.getStatistics(t);return s(this.volumetricState,r,t)}}let c=l},15721:(e,t,r)=>{"use strict";r(67058),r(33174)},15798:(e,t,r)=>{"use strict";r.d(t,{x:()=>l,m:()=>u});var n=r(77280),i=r(31290);function a(e){return e?[e[0],e[1],e[2]]:void 0}function o(e){var t;return{...e,clippingRange:(t=e.clippingRange)?[t[0],t[1]]:void 0,focalPoint:a(e.focalPoint),position:a(e.position),viewPlaneNormal:a(e.viewPlaneNormal),viewUp:a(e.viewUp)}}let s="volume3d";function l(e){let{viewport:t}=e,r=e.resolvedView??t.getResolvedView?.(),n=e.camera??t.getViewState?.(),i=r?.toICamera()??n;if(!i)return;let l=o(i),u=e.canvasWidth??t.canvas?.clientWidth??t.element?.clientWidth??1,c=e.canvasHeight??t.canvas?.clientHeight??t.element?.clientHeight??1,d=e.frameOfReferenceUID??r?.getFrameOfReferenceUID()??t.getFrameOfReferenceUID?.();return{kind:s,adapterId:s,canvasHeight:c,canvasWidth:u,dataId:e.dataId,frameOfReferenceUID:d,presentation:{camera:o(l),position:function(e){if(e.focalPoint)return{kind:"focalPoint",worldPoint:a(e.focalPoint)}}(l),rotation:l.rotation,scale:function(e){let{camera:t,canvasHeight:r}=e;if("number"==typeof t.parallelScale)return{kind:"physical",mmPerCanvasPixel:2*t.parallelScale/Math.max(r,1)}}({camera:l,canvasHeight:c})},rendererCamera:o(l),resolvedView:r,spaces:{canvas:!!r,renderer:!0,world:!!(r||l.focalPoint)},transforms:r?{canvasToWorld:e=>r.canvasToWorld(e),worldToCanvas:e=>r.worldToCanvas(e)}:void 0,viewState:o(l),viewportType:t.type}}let u={id:s,viewportTypes:[n.NV.VOLUME_3D_NEXT],getSnapshot:e=>l(e),getPresentation:e=>(function(e){return{...e.presentation,camera:o(e.presentation.camera)}})(e),withPresentation:(e,t,r)=>(function(e,t){return o({...e.presentation.camera,...Object.prototype.hasOwnProperty.call(t,"camera")?t.camera??{}:t})})(e,t),applyToRenderer:(e,t)=>{(function(e){return!!(e&&"object"==typeof e&&"vtk"in e&&e.vtk?.renderer)})(t)&&(0,i.A)(t,e.rendererCamera,{resetClippingRange:!0})}}},16116:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>E});var n=r(17042),i=r(99298),a=r(87352),o=r(58804),s=r(69927),l=r(42021),u=r(23985),c=r(5889),d=r(72188),p=r(56929),m=r(61052),h=r(73543),f=r(9731),g=r(78744),v=r(86077),y=r(89988),b=r(67931),I=r(53013),x=r(85250),C=r(37843),A=r(50923),{vtkWarningMacro:T,vtkErrorMacro:S}=n.o$,w={idxToView:x.identity(new Float64Array(16)),vecISToVCMatrix:C.identity(new Float64Array(9)),modelToView:x.identity(new Float64Array(16)),projectionToView:x.identity(new Float64Array(16)),projectionToWorld:x.identity(new Float64Array(16))},O={context:null,VBOBuildTime:null,scalarTextures:[],_scalarTexturesCore:[],opacityTexture:null,_opacityTextureCore:null,colorTexture:null,_colorTextureCore:null,labelOutlineThicknessTexture:null,_labelOutlineThicknessTextureCore:null,jitterTexture:null,tris:null,framebuffer:null,copyShader:null,copyVAO:null,lastXYF:1,targetXYF:1,zBufferTexture:null,lastZBufferTexture:null,fullViewportTime:1,idxToView:null,vecISToVCMatrix:null,modelToView:null,projectionToView:null,avgWindowArea:0,avgFrameTime:0};function P(e,t,r={}){Object.assign(t,O,r),d.A.extend(e,t,r),y.A.implementBuildShadersWithReplacements(e,t,r),t.VBOBuildTime={},(0,n.WL)(t.VBOBuildTime,{mtime:0}),t.tris=v.Ay.newInstance(),t.jitterTexture=m.Ay.newInstance(),t.jitterTexture.setWrapS(c.B_.REPEAT),t.jitterTexture.setWrapT(c.B_.REPEAT),t.framebuffer=h.Ay.newInstance(),(0,n.V0)(e,t,["context"]);function p(e){return e.getUseLabelOutline()||t.renderable.getBlendMode()===u.N.LABELMAP_EDGE_PROJECTION_BLEND}t.classHierarchy.push("vtkOpenGLVolumeMapper");let _=new Map;function E(t,r,n){r!==n&&(!function(t,r){if(!r)return;let n=(_.get(r)??0)-1;n<=0?(t.unregisterGraphicsResourceUser(r,e),_.delete(r)):_.set(r,n)}(t,r),function(t,r){if(!r)return;let n=_.get(r)??0;_.set(r,n+1),n<=0&&t.registerGraphicsResourceUser(r,e)}(t,n))}function D(t){[..._.keys()].forEach(r=>t.unregisterGraphicsResourceUser(r,e))}e.buildPass=()=>{t.zBufferTexture=null},e.zBufferPass=(e,r)=>{if(e){let e=r.getZBufferTexture();e!==t.zBufferTexture&&(t.zBufferTexture=e)}},e.opaqueZBufferPass=(t,r)=>e.zBufferPass(t,r),e.volumePass=(r,n)=>{if(r){let r=t._openGLRenderWindow;t._openGLRenderWindow=e.getLastAncestorOfType("vtkOpenGLRenderWindow"),r&&!r.isDeleted()&&r!==t._openGLRenderWindow&&D(r),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.jitterTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLVolume=e.getFirstAncestorOfType("vtkOpenGLVolume");let n=t.openGLVolume.getRenderable();t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");let i=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(i.getActiveCamera(),t.openGLCamera),e.renderPiece(i,n)}},e.getShaderTemplate=(e,t,r)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkVolumeVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexDC;\n\nvarying vec3 vertexVCVSOutput;\nuniform mat4 PCVCMatrix;\n\nuniform float dcxmin;\nuniform float dcxmax;\nuniform float dcymin;\nuniform float dcymax;\n\nvoid main()\n{\n // dcsmall is the device coords reduced to the\n // x y area covered by the volume\n vec4 dcsmall = vec4(\n dcxmin + 0.5 * (vertexDC.x + 1.0) * (dcxmax - dcxmin),\n dcymin + 0.5 * (vertexDC.y + 1.0) * (dcymax - dcymin),\n vertexDC.z,\n vertexDC.w);\n vec4 vcpos = PCVCMatrix * dcsmall;\n vertexVCVSOutput = vcpos.xyz/vcpos.w;\n gl_Position = dcsmall;\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkVolumeFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the volume mappers fragment shader\n\nconst float infinity = 3.402823466e38;\n\n// the output of this shader\n//VTK::Output::Dec\n\nin vec3 vertexVCVSOutput;\n\n// From Sources\\Rendering\\Core\\VolumeProperty\\Constants.js\n#define COMPOSITE_BLEND 0\n#define MAXIMUM_INTENSITY_BLEND 1\n#define MINIMUM_INTENSITY_BLEND 2\n#define AVERAGE_INTENSITY_BLEND 3\n#define ADDITIVE_INTENSITY_BLEND 4\n#define RADON_TRANSFORM_BLEND 5\n#define LABELMAP_EDGE_PROJECTION_BLEND 6\n\n#define vtkNumberOfLights //VTK::NumberOfLights\n#define vtkMaxLaoKernelSize //VTK::MaxLaoKernelSize\n#define vtkNumberOfComponents //VTK::NumberOfComponents\n#define vtkBlendMode //VTK::BlendMode\n#define vtkMaximumNumberOfSamples //VTK::MaximumNumberOfSamples\n\n//VTK::EnabledColorFunctions\n\n//VTK::EnabledLightings\n\n//VTK::EnabledMultiTexturePerVolume\n\n//VTK::EnabledGradientOpacity\n\n//VTK::EnabledIndependentComponents\n\n//VTK::vtkProportionalComponents\n\n//VTK::vtkForceNearestComponents\n\nuniform int twoSidedLighting;\n\n#if vtkMaxLaoKernelSize > 0\n vec2 kernelSample[vtkMaxLaoKernelSize];\n#endif\n\n// Textures\n#ifdef EnabledMultiTexturePerVolume\n #define vtkNumberOfVolumeTextures vtkNumberOfComponents\n#else\n #define vtkNumberOfVolumeTextures 1\n#endif\nuniform highp sampler3D volumeTexture[vtkNumberOfVolumeTextures];\nuniform sampler2D colorTexture;\nuniform sampler2D opacityTexture;\nuniform sampler2D jtexture;\nuniform sampler2D labelOutlineThicknessTexture;\n\nstruct Volume {\n // ---- Volume geometry settings ----\n\n vec3 originVC; // in VC\n vec3 spacing; // in VC per IC\n vec3 inverseSpacing; // 1/spacing\n ivec3 dimensions; // in IC\n vec3 inverseDimensions; // 1/vec3(dimensions)\n mat3 vecISToVCMatrix; // convert from IS to VC without translation\n mat3 vecVCToISMatrix; // convert from VC to IS without translation\n mat4 PCWCMatrix;\n mat4 worldToIndex;\n float diagonalLength; // in VC, this is: length(size)\n\n // ---- Texture settings ----\n\n // Texture shift and scale\n vec4 colorTextureScale;\n vec4 colorTextureShift;\n vec4 opacityTextureScale;\n vec4 opacityTextureShift;\n\n // The heights defined below are the locations for the up to four components\n // of the transfer functions. The transfer functions have a height of (2 *\n // numberOfComponents) pixels so the values are computed to hit the middle of\n // the two rows for that component\n vec4 transferFunctionsSampleHeight;\n\n // ---- Mode specific settings ----\n\n // Independent component default preset settings per component\n vec4 independentComponentMix;\n\n // Additive / average blending mode settings\n vec4 ipScalarRangeMin;\n vec4 ipScalarRangeMax;\n\n // ---- Rendering settings ----\n\n // Lighting\n float ambient;\n float diffuse;\n float specular;\n float specularPower;\n int computeNormalFromOpacity;\n\n // Gradient opacity\n vec4 gradientOpacityScale;\n vec4 gradientOpacityShift;\n vec4 gradientOpacityMin;\n vec4 gradientOpacityMax;\n\n // Volume shadow\n float volumetricScatteringBlending;\n float globalIlluminationReach;\n float anisotropy;\n float anisotropySquared;\n\n // LAO\n int kernelSize;\n int kernelRadius;\n\n // Label outline\n float outlineOpacity;\n};\nuniform Volume volume;\n\nstruct Light {\n vec3 color;\n vec3 positionVC;\n vec3 directionVC; // normalized\n vec3 halfAngleVC;\n vec3 attenuation;\n float exponent;\n float coneAngle;\n int isPositional;\n};\n#if vtkNumberOfLights > 0\n uniform Light lights[vtkNumberOfLights];\n#endif\n\nuniform float vpWidth;\nuniform float vpHeight;\nuniform float vpOffsetX;\nuniform float vpOffsetY;\n\n// Bitmasks for label outline\nconst int MAX_SEGMENT_INDEX = 256; // Define as per expected maximum\n#define MAX_SEGMENTS 256\n#define UINT_SIZE 32\n// We add UINT_SIZE - 1, as we want the ceil of the division instead of the\n// floor\n#define BITMASK_SIZE ((MAX_SEGMENTS + UINT_SIZE - 1) / UINT_SIZE)\nuint labelOutlineBitmasks[BITMASK_SIZE];\n\n// Set the corresponding bit in the bitmask\nvoid setLabelOutlineBit(int segmentIndex) {\n int arrayIndex = segmentIndex / UINT_SIZE;\n int bitIndex = segmentIndex % UINT_SIZE;\n labelOutlineBitmasks[arrayIndex] |= 1u << bitIndex;\n}\n\n// Check if a bit is set in the bitmask\nbool isLabelOutlineBitSet(int segmentIndex) {\n int arrayIndex = segmentIndex / UINT_SIZE;\n int bitIndex = segmentIndex % UINT_SIZE;\n return ((labelOutlineBitmasks[arrayIndex] & (1u << bitIndex)) != 0u);\n}\n\n// if you want to see the raw tiled\n// data in webgl1 uncomment the following line\n// #define debugtile\n\n// camera values\nuniform float camThick;\nuniform float camNear;\nuniform float camFar;\nuniform int cameraParallel;\n\n//VTK::ClipPlane::Dec\n\n// A random number between 0 and 1 that only depends on the fragment\n// It uses the jtexture, so this random seed repeats by blocks of 32 fragments\n// in screen space\nfloat fragmentSeed;\n\n// sample texture is global\nuniform float sampleDistance;\nuniform float volumeShadowSampleDistance;\n\n// declaration for intermixed geometry\n//VTK::ZBuffer::Dec\n\n//=======================================================================\n// global and custom variables (a temporary section before photorealistics\n// rendering module is complete)\nvec3 rayDirVC;\n\n#define INV4PI 0.0796\n#define EPSILON 0.001\n#define PI 3.1415\n#define PI2 9.8696\n\nvec4 rawSampleTexture(vec3 pos) {\n #ifdef EnabledMultiTexturePerVolume\n vec4 rawSample;\n rawSample[0] = texture(volumeTexture[0], pos)[0];\n #if vtkNumberOfComponents > 1\n rawSample[1] = texture(volumeTexture[1], pos)[0];\n #endif\n #if vtkNumberOfComponents > 2\n rawSample[2] = texture(volumeTexture[2], pos)[0];\n #endif\n #if vtkNumberOfComponents > 3\n rawSample[3] = texture(volumeTexture[3], pos)[0];\n #endif\n return rawSample;\n #else\n return texture(volumeTexture[0], pos);\n #endif\n}\n\nvec4 rawFetchTexture(ivec3 pos) {\n #ifdef EnabledMultiTexturePerVolume\n vec4 rawSample;\n #if vtkNumberOfComponents > 0\n rawSample[0] = texelFetch(volumeTexture[0], pos, 0)[0];\n #endif\n #if vtkNumberOfComponents > 1\n rawSample[1] = texelFetch(volumeTexture[1], pos, 0)[0];\n #endif\n #if vtkNumberOfComponents > 2\n rawSample[2] = texelFetch(volumeTexture[2], pos, 0)[0];\n #endif\n #if vtkNumberOfComponents > 3\n rawSample[3] = texelFetch(volumeTexture[3], pos, 0)[0];\n #endif\n return rawSample;\n #else\n return texelFetch(volumeTexture[0], pos, 0);\n #endif\n}\n\nvec4 getTextureValue(vec3 pos) {\n vec4 tmp = rawSampleTexture(pos);\n\n // Force nearest\n #if defined(vtkComponent0ForceNearest) || \\\n defined(vtkComponent1ForceNearest) || \\\n defined(vtkComponent2ForceNearest) || \\\n defined(vtkComponent3ForceNearest)\n vec3 nearestPos = (floor(pos * vec3(volume.dimensions)) + 0.5) *\n volume.inverseDimensions;\n vec4 nearestValue = rawSampleTexture(nearestPos);\n #ifdef vtkComponent0ForceNearest\n tmp[0] = nearestValue[0];\n #endif\n #ifdef vtkComponent1ForceNearest\n tmp[1] = nearestValue[1];\n #endif\n #ifdef vtkComponent2ForceNearest\n tmp[2] = nearestValue[2];\n #endif\n #ifdef vtkComponent3ForceNearest\n tmp[3] = nearestValue[3];\n #endif\n #endif\n\n // Set alpha when using dependent components\n #ifndef EnabledIndependentComponents\n #if vtkNumberOfComponents == 1\n tmp.a = tmp.r;\n #endif\n #if vtkNumberOfComponents == 2\n tmp.a = tmp.g;\n #endif\n #if vtkNumberOfComponents == 3\n tmp.a = length(tmp.rgb);\n #endif\n #endif\n\n return tmp;\n}\n\n// `height` is usually `volume.transferFunctionsSampleHeight[component]`\n// when using independent component and `0.5` otherwise. Don't move the if\n// statement in these function, as the callers usually already knows if it is\n// using independent component or not\nfloat getOpacityFromTexture(float scalar, int component, float height) {\n float scaledScalar = scalar * volume.opacityTextureScale[component] +\n volume.opacityTextureShift[component];\n return texture2D(opacityTexture, vec2(scaledScalar, height)).r;\n}\nvec3 getColorFromTexture(float scalar, int component, float height) {\n float scaledScalar = scalar * volume.colorTextureScale[component] +\n volume.colorTextureShift[component];\n return texture2D(colorTexture, vec2(scaledScalar, height)).rgb;\n}\n\nfloat getRadonOpacity(vec4 tValue) {\n #ifdef EnabledIndependentComponents\n return getOpacityFromTexture(tValue.r, 0, 0.5);\n #else\n #if vtkNumberOfComponents == 1\n return getOpacityFromTexture(tValue.r, 0, 0.5);\n #endif\n #if vtkNumberOfComponents == 2\n return getOpacityFromTexture(tValue.a, 1, 0.5);\n #endif\n #if vtkNumberOfComponents == 3\n return getOpacityFromTexture(tValue.a, 0, 0.5);\n #endif\n #if vtkNumberOfComponents == 4\n return getOpacityFromTexture(tValue.a, 3, 0.5);\n #endif\n #endif\n}\n\nvec3 getRadonColor(float normalizedRayIntensity) {\n float colorCoord = clamp(normalizedRayIntensity, 0.0, 1.0);\n return texture2D(colorTexture, vec2(colorCoord, 0.5)).rgb;\n}\n\n//=======================================================================\n// transformation between VC and IS space\n\n// convert vector position from idx to vc\nvec3 posIStoVC(vec3 posIS) {\n return volume.vecISToVCMatrix * posIS + volume.originVC;\n}\n\n// convert vector position from vc to idx\nvec3 posVCtoIS(vec3 posVC) {\n return volume.vecVCToISMatrix * (posVC - volume.originVC);\n}\n\n// Rotate vector to view coordinate\nvec3 vecISToVC(vec3 dirIS) {\n return volume.vecISToVCMatrix * dirIS;\n}\n\n// Rotate vector to idx coordinate\nvec3 vecVCToIS(vec3 dirVC) {\n return volume.vecVCToISMatrix * dirVC;\n}\n\n//=======================================================================\n// Given a normal compute the gradient opacity factors\nfloat computeGradientOpacityFactor(float normalMag, int component) {\n float goscale = volume.gradientOpacityScale[component];\n float goshift = volume.gradientOpacityShift[component];\n float gomin = volume.gradientOpacityMin[component];\n float gomax = volume.gradientOpacityMax[component];\n return clamp(normalMag * goscale + goshift, gomin, gomax);\n}\n\n#ifdef vtkClippingPlanesOn\n bool isPointClipped(vec3 posVC) {\n for (int i = 0; i < clip_numPlanes; ++i) {\n if (dot(vec3(vClipPlaneOrigins[i] - posVC), vClipPlaneNormals[i]) > 0.0) {\n return true;\n }\n }\n return false;\n }\n#endif\n\n//=======================================================================\n// compute the normal and gradient magnitude for a position, uses forward\n// difference\n\n// The output normal is in VC\nvec4 computeDensityNormal(vec3 opacityUCoords[2], float opacityTextureHeight,\n float gradientOpacity, int component) {\n // Pass the scalars through the opacity functions\n vec4 opacityG;\n opacityG.x += getOpacityFromTexture(opacityUCoords[0].x, component,\n opacityTextureHeight);\n opacityG.y += getOpacityFromTexture(opacityUCoords[0].y, component,\n opacityTextureHeight);\n opacityG.z += getOpacityFromTexture(opacityUCoords[0].z, component,\n opacityTextureHeight);\n opacityG.x -= getOpacityFromTexture(opacityUCoords[1].x, component,\n opacityTextureHeight);\n opacityG.y -= getOpacityFromTexture(opacityUCoords[1].y, component,\n opacityTextureHeight);\n opacityG.z -= getOpacityFromTexture(opacityUCoords[1].z, component,\n opacityTextureHeight);\n\n // Divide by spacing and convert to VC\n opacityG.xyz *= gradientOpacity * volume.inverseSpacing;\n opacityG.w = length(opacityG.xyz);\n if (opacityG.w == 0.0) {\n return vec4(0.0);\n }\n\n // Normalize\n opacityG.xyz = normalize(vecISToVC(opacityG.xyz));\n\n return opacityG;\n}\n\n// The output normal is in VC\nvec4 computeNormalForDensity(vec3 posIS, out vec3 scalarInterp[2],\n const int opacityComponent) {\n vec3 offsetedPosIS;\n for (int axis = 0; axis < 3; ++axis) {\n // Positive direction\n offsetedPosIS = posIS;\n offsetedPosIS[axis] += volume.inverseDimensions[axis];\n scalarInterp[0][axis] =\n getTextureValue(offsetedPosIS)[opacityComponent];\n #ifdef vtkClippingPlanesOn\n if (isPointClipped(posIStoVC(offsetedPosIS))) {\n scalarInterp[0][axis] = 0.0;\n }\n #endif\n\n // Negative direction\n offsetedPosIS = posIS;\n offsetedPosIS[axis] -= volume.inverseDimensions[axis];\n scalarInterp[1][axis] =\n getTextureValue(offsetedPosIS)[opacityComponent];\n #ifdef vtkClippingPlanesOn\n if (isPointClipped(posIStoVC(offsetedPosIS))) {\n scalarInterp[1][axis] = 0.0;\n }\n #endif\n }\n\n vec4 result;\n result.xyz = (scalarInterp[0] - scalarInterp[1]) * volume.inverseSpacing;\n result.w = length(result.xyz);\n if (result.w == 0.0) {\n return vec4(0.0);\n }\n result.xyz = normalize(vecISToVC(result.xyz));\n return result;\n}\n\nvec4 fragCoordToPCPos(vec4 fragCoord) {\n return vec4((fragCoord.x / vpWidth - vpOffsetX - 0.5) * 2.0,\n (fragCoord.y / vpHeight - vpOffsetY - 0.5) * 2.0,\n (fragCoord.z - 0.5) * 2.0, 1.0);\n}\n\nvec4 pcPosToWorldCoord(vec4 pcPos) {\n return volume.PCWCMatrix * pcPos;\n}\n\nvec3 fragCoordToIndexSpace(vec4 fragCoord) {\n vec4 pcPos = fragCoordToPCPos(fragCoord);\n vec4 worldCoord = pcPosToWorldCoord(pcPos);\n vec4 vertex = (worldCoord / worldCoord.w);\n\n vec3 index = (volume.worldToIndex * vertex).xyz;\n\n // half voxel fix for labelmapOutline\n return (index + vec3(0.5)) * volume.inverseDimensions;\n}\n\nvec3 fragCoordToWorld(vec4 fragCoord) {\n vec4 pcPos = fragCoordToPCPos(fragCoord);\n vec4 worldCoord = pcPosToWorldCoord(pcPos);\n return worldCoord.xyz;\n}\n\n//=======================================================================\n// Compute the normals and gradient magnitudes for a position for independent\n// components The output normals are in VC\nmat4 computeMat4Normal(vec3 posIS, vec4 tValue) {\n vec3 xvec = vec3(volume.inverseDimensions.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, volume.inverseDimensions.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, volume.inverseDimensions.z);\n\n vec4 distX = getTextureValue(posIS + xvec) - getTextureValue(posIS - xvec);\n vec4 distY = getTextureValue(posIS + yvec) - getTextureValue(posIS - yvec);\n vec4 distZ = getTextureValue(posIS + zvec) - getTextureValue(posIS - zvec);\n\n // divide by spacing\n distX *= 0.5 * volume.inverseSpacing.x;\n distY *= 0.5 * volume.inverseSpacing.y;\n distZ *= 0.5 * volume.inverseSpacing.z;\n\n mat4 result;\n\n // optionally compute the 1st component\n #if vtkNumberOfComponents > 0 && !defined(vtkComponent0Proportional)\n {\n const int component = 0;\n vec3 normal = vec3(distX[component], distY[component], distZ[component]);\n float normalLength = length(normal);\n if (normalLength > 0.0) {\n normal = normalize(vecISToVC(normal));\n }\n result[component] = vec4(normal, normalLength);\n }\n #endif\n\n // optionally compute the 2nd component\n #if vtkNumberOfComponents > 1 && !defined(vtkComponent1Proportional)\n {\n const int component = 1;\n vec3 normal = vec3(distX[component], distY[component], distZ[component]);\n float normalLength = length(normal);\n if (normalLength > 0.0) {\n normal = normalize(vecISToVC(normal));\n }\n result[component] = vec4(normal, normalLength);\n }\n #endif\n\n // optionally compute the 3rd component\n #if vtkNumberOfComponents > 2 && !defined(vtkComponent2Proportional)\n {\n const int component = 2;\n vec3 normal = vec3(distX[component], distY[component], distZ[component]);\n float normalLength = length(normal);\n if (normalLength > 0.0) {\n normal = normalize(vecISToVC(normal));\n }\n result[component] = vec4(normal, normalLength);\n }\n #endif\n\n // optionally compute the 4th component\n #if vtkNumberOfComponents > 3 && !defined(vtkComponent3Proportional)\n {\n const int component = 3;\n vec3 normal = vec3(distX[component], distY[component], distZ[component]);\n float normalLength = length(normal);\n if (normalLength > 0.0) {\n normal = normalize(vecISToVC(normal));\n }\n result[component] = vec4(normal, normalLength);\n }\n #endif\n\n return result;\n}\n\n//=======================================================================\n// global shadow - secondary ray\n\n// henyey greenstein phase function\nfloat phaseFunction(float cos_angle) {\n // divide by 2.0 instead of 4pi to increase intensity\n float anisotropy = volume.anisotropy;\n if (abs(anisotropy) <= EPSILON) {\n // isotropic scatter returns 0.5 instead of 1/4pi to increase intensity\n return 0.5;\n }\n float anisotropy2 = volume.anisotropySquared;\n return ((1.0 - anisotropy2) /\n pow(1.0 + anisotropy2 - 2.0 * anisotropy * cos_angle, 1.5)) /\n 2.0;\n}\n\n// Compute the two intersection distances of the ray with the volume in VC\n// The entry point is `rayOriginVC + distanceMin * rayDirVC` and the exit point\n// is `rayOriginVC + distanceMax * rayDirVC` If distanceMin < distanceMax, the\n// volume is not intersected The ray origin is inside the box when distanceMin <\n// 0.0 < distanceMax\nvec2 rayIntersectVolumeDistances(vec3 rayOriginVC, vec3 rayDirVC) {\n // Compute origin and direction in IS\n vec3 rayOriginIS = posVCtoIS(rayOriginVC);\n vec3 rayDirIS = vecVCToIS(rayDirVC);\n // Don't check for infinity as the min/max combination afterward will always\n // find an intersection before infinity\n vec3 invDir = 1.0 / rayDirIS;\n\n // We have: bound = origin + t * dir\n // So: t = (1/dir) * (bound - origin)\n vec3 distancesTo0 = invDir * (vec3(0.0) - rayOriginIS);\n vec3 distancesTo1 = invDir * (vec3(1.0) - rayOriginIS);\n // Min and max distances to plane intersection per plane\n vec3 dMinPerAxis = min(distancesTo0, distancesTo1);\n vec3 dMaxPerAxis = max(distancesTo0, distancesTo1);\n // Overall first and last intersection\n float distanceMin = max(dMinPerAxis.x, max(dMinPerAxis.y, dMinPerAxis.z));\n float distanceMax = min(dMaxPerAxis.x, min(dMaxPerAxis.y, dMaxPerAxis.z));\n return vec2(distanceMin, distanceMax);\n}\n\n//=======================================================================\n// local ambient occlusion\n#if vtkMaxLaoKernelSize > 0\n\n // Return a random point on the unit sphere\n vec3 sampleDirectionUniform(int rayIndex) {\n // Each ray of each fragment should be different, two sources of randomness\n // are used. Only depends on ray index\n vec2 rayRandomness = kernelSample[rayIndex];\n // Only depends on fragment\n float fragmentRandomness = fragmentSeed;\n // Merge both source of randomness in a single uniform random variable using\n // the formula (x+y < 1 ? x+y : x+y-1). The simpler formula (x+y)/2 doesn't\n // result in a uniform distribution\n vec2 mergedRandom = rayRandomness + vec2(fragmentRandomness);\n mergedRandom -= vec2(greaterThanEqual(mergedRandom, vec2(1.0)));\n\n // Insipred by:\n // https://karthikkaranth.me/blog/generating-random-points-in-a-sphere/#better-choice-of-spherical-coordinates\n float u = mergedRandom[0];\n float v = mergedRandom[1];\n float theta = u * 2.0 * PI;\n float phi = acos(2.0 * v - 1.0);\n float sinTheta = sin(theta);\n float cosTheta = cos(theta);\n float sinPhi = sin(phi);\n float cosPhi = cos(phi);\n return vec3(sinPhi * cosTheta, sinPhi * sinTheta, cosPhi);\n }\n\n float computeLAO(vec3 posVC, vec4 normalVC, float originalOpacity) {\n // apply LAO only at selected locations, otherwise return full brightness\n if (normalVC.w <= 0.0 || originalOpacity <= 0.05) {\n return 1.0;\n }\n\n #ifdef EnabledGradientOpacity\n float gradientOpacityFactor = computeGradientOpacityFactor(normalVC.w, 0);\n #endif\n\n float visibilitySum = 0.0;\n float weightSum = 0.0;\n for (int i = 0; i < volume.kernelSize; i++) {\n // Only sample on an hemisphere around the normalVC.xyz axis, so\n // normalDotRay should be negative\n vec3 rayDirectionVC = sampleDirectionUniform(i);\n float normalDotRay = dot(normalVC.xyz, rayDirectionVC);\n if (normalDotRay > 0.0) {\n // Flip rayDirectionVC when it is in the wrong hemisphere\n rayDirectionVC = -rayDirectionVC;\n normalDotRay = -normalDotRay;\n }\n\n vec3 currPosIS = posVCtoIS(posVC);\n float visibility = 1.0;\n vec3 randomDirStepIS = vecVCToIS(rayDirectionVC * sampleDistance);\n for (int j = 0; j < volume.kernelRadius; j++) {\n currPosIS += randomDirStepIS;\n // If out of the volume, we are done\n if (any(lessThan(currPosIS, vec3(0.0))) ||\n any(greaterThan(currPosIS, vec3(1.0)))) {\n break;\n }\n float opacity = getOpacityFromTexture(getTextureValue(currPosIS).r, 0, 0.5);\n #ifdef EnabledGradientOpacity\n opacity *= gradientOpacityFactor;\n #endif\n visibility *= 1.0 - opacity;\n // If visibility is less than EPSILON, consider it to be 0\n if (visibility < EPSILON) {\n visibility = 0.0;\n break;\n }\n }\n float rayWeight = -normalDotRay;\n visibilitySum += visibility * rayWeight;\n weightSum += rayWeight;\n }\n\n // If no sample, LAO factor is one\n if (weightSum == 0.0) {\n return 1.0;\n }\n\n // LAO factor is the average visibility:\n // - visibility low => ambient low\n // - visibility high => ambient high\n float lao = visibilitySum / weightSum;\n\n // Reduce variance by clamping\n return clamp(lao, 0.3, 1.0);\n }\n#endif\n\n//=======================================================================\n// Volume shadows\n#if vtkNumberOfLights > 0\n\n // Non-memoised version\n float computeVolumeShadowWithoutCache(vec3 posVC, vec3 lightDirNormVC) {\n // modify sample distance with a random number between 1.5 and 3.0\n float rayStepLength =\n volumeShadowSampleDistance * mix(1.5, 3.0, fragmentSeed);\n\n // in case the first sample near surface has a very tiled light ray, we need\n // to offset start position\n vec3 initialPosVC = posVC + rayStepLength * lightDirNormVC;\n\n #ifdef vtkClippingPlanesOn\n float clippingPlanesMaxDistance = infinity;\n for (int i = 0; i < clip_numPlanes; ++i) {\n // Find distance of intersection with the plane\n // Points are clipped when:\n // dot(planeOrigin - (rayOrigin + distance * rayDirection), planeNormal) > 0\n // This is equivalent to:\n // dot(planeOrigin - rayOrigin, planeNormal) - distance * dot(rayDirection,\n // planeNormal) > 0.0\n // We precompute the dot products, so we clip ray points when:\n // dotOrigin - distance * dotDirection > 0.0\n float dotOrigin =\n dot(vClipPlaneOrigins[i] - initialPosVC, vClipPlaneNormals[i]);\n if (dotOrigin > 0.0) {\n // The initialPosVC is clipped by this plane\n return 1.0;\n }\n float dotDirection = dot(lightDirNormVC, vClipPlaneNormals[i]);\n if (dotDirection < 0.0) {\n // We only hit the plane if dotDirection is negative, as (distance is\n // positive)\n float intersectionDistance =\n dotOrigin / dotDirection; // negative divided by negative => positive\n clippingPlanesMaxDistance =\n min(clippingPlanesMaxDistance, intersectionDistance);\n }\n }\n #endif\n\n vec2 intersectionDistances =\n rayIntersectVolumeDistances(initialPosVC, lightDirNormVC);\n\n if (intersectionDistances[1] <= intersectionDistances[0] ||\n intersectionDistances[1] <= 0.0) {\n // Volume not hit or behind the ray\n return 1.0;\n }\n\n // When globalIlluminationReach is 0, no sample at all\n // When globalIlluminationReach is 1, the ray will go through the whole\n // volume\n float maxTravelDistance = mix(0.0, volume.diagonalLength,\n volume.globalIlluminationReach);\n float startDistance = max(intersectionDistances[0], 0.0);\n float endDistance = min(intersectionDistances[1], startDistance + maxTravelDistance);\n #ifdef vtkClippingPlanesOn\n endDistance = min(endDistance, clippingPlanesMaxDistance);\n #endif\n if (endDistance - startDistance < 0.0) {\n return 1.0;\n }\n\n // These two variables are used to compute posIS, without having to call\n // VCtoIS at each step\n vec3 initialPosIS = posVCtoIS(initialPosVC);\n // The light dir is scaled and rotated, but not translated, as it is a\n // vector (w = 0)\n vec3 scaledLightDirIS = vecVCToIS(lightDirNormVC);\n\n float shadow = 1.0;\n for (float currentDistance = startDistance; currentDistance <= endDistance;\n currentDistance += rayStepLength) {\n vec3 posIS = initialPosIS + currentDistance * scaledLightDirIS;\n vec4 scalar = getTextureValue(posIS);\n float opacity = getOpacityFromTexture(scalar.r, 0, 0.5);\n #if defined(EnabledGradientOpacity) && !defined(EnabledIndependentComponents)\n vec3 scalarInterp[2];\n vec4 normal = computeNormalForDensity(posIS, scalarInterp, 3);\n float opacityFactor = computeGradientOpacityFactor(normal.w, 0);\n opacity *= opacityFactor;\n #endif\n shadow *= 1.0 - opacity;\n\n // Early termination if shadow coeff is near 0.0\n if (shadow < EPSILON) {\n return 0.0;\n }\n }\n return shadow;\n }\n\n // Some cache for volume shadows\n struct {\n vec3 posVC;\n float shadow;\n } cachedShadows[vtkNumberOfLights];\n\n // Memoised version\n float computeVolumeShadow(vec3 posVC, vec3 lightDirNormVC, int lightIdx) {\n if (posVC == cachedShadows[lightIdx].posVC) {\n return cachedShadows[lightIdx].shadow;\n }\n float shadow = computeVolumeShadowWithoutCache(posVC, lightDirNormVC);\n cachedShadows[lightIdx].posVC = posVC;\n cachedShadows[lightIdx].shadow = shadow;\n return shadow;\n }\n\n#endif\n\n//=======================================================================\n// surface light contribution\n#if vtkNumberOfLights > 0\n vec3 applyLighting(vec3 tColor, vec4 normalVC) {\n vec3 diffuse = vec3(0.0, 0.0, 0.0);\n vec3 specular = vec3(0.0, 0.0, 0.0);\n for (int lightIdx = 0; lightIdx < vtkNumberOfLights; lightIdx++) {\n float df = dot(normalVC.xyz, lights[lightIdx].directionVC);\n if (df > 0.0) {\n diffuse += df * lights[lightIdx].color;\n float sf = dot(normalVC.xyz, -lights[lightIdx].halfAngleVC);\n if (sf > 0.0) {\n specular += pow(sf, volume.specularPower) * lights[lightIdx].color;\n }\n }\n }\n return tColor * (diffuse * volume.diffuse + volume.ambient) +\n specular * volume.specular;\n }\n\n vec3 applySurfaceShadowLighting(vec3 tColor, float alpha, vec3 posVC,\n vec4 normalVC) {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n for (int ligthIdx = 0; ligthIdx < vtkNumberOfLights; ligthIdx++) {\n vec3 vertLightDirection;\n float attenuation;\n if (lights[ligthIdx].isPositional == 1) {\n vertLightDirection = posVC - lights[ligthIdx].positionVC;\n float lightDistance = length(vertLightDirection);\n // Normalize with precomputed length\n vertLightDirection = vertLightDirection / lightDistance;\n // Base attenuation\n vec3 attenuationPolynom = lights[ligthIdx].attenuation;\n attenuation =\n 1.0 / (attenuationPolynom[0] +\n lightDistance * (attenuationPolynom[1] +\n lightDistance * attenuationPolynom[2]));\n // Cone attenuation\n float coneDot = dot(vertLightDirection, lights[ligthIdx].directionVC);\n // Per OpenGL standard cone angle is 90 or less for a spot light\n if (lights[ligthIdx].coneAngle <= 90.0) {\n if (coneDot >= cos(radians(lights[ligthIdx].coneAngle))) {\n // Inside the cone\n attenuation *= pow(coneDot, lights[ligthIdx].exponent);\n } else {\n // Outside the cone\n attenuation = 0.0;\n }\n }\n } else {\n vertLightDirection = lights[ligthIdx].directionVC;\n attenuation = 1.0;\n }\n\n float ndotL = dot(normalVC.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting == 1) {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0) {\n // Diffuse\n diffuse += ndotL * attenuation * lights[ligthIdx].color;\n // Specular\n float vdotR =\n dot(-rayDirVC, normalize(vertLightDirection - 2.0 * ndotL * normalVC.xyz));\n if (vdotR > 0.0) {\n specular += pow(vdotR, volume.specularPower) * attenuation *\n lights[ligthIdx].color;\n }\n }\n }\n #if vtkMaxLaoKernelSize > 0\n float laoFactor = computeLAO(posVC, normalVC, alpha);\n #else\n const float laoFactor = 1.0;\n #endif\n return tColor * (diffuse * volume.diffuse +\n volume.ambient * laoFactor) +\n specular * volume.specular;\n }\n\n vec3 applyVolumeShadowLighting(vec3 tColor, vec3 posVC) {\n // Here we have no effect of cones and no attenuation\n vec3 diffuse = vec3(0.0);\n for (int lightIdx = 0; lightIdx < vtkNumberOfLights; lightIdx++) {\n vec3 lightDirVC = lights[lightIdx].isPositional == 1\n ? normalize(lights[lightIdx].positionVC - posVC)\n : -lights[lightIdx].directionVC;\n float shadowCoeff = computeVolumeShadow(posVC, lightDirVC, lightIdx);\n float phaseAttenuation = phaseFunction(dot(rayDirVC, lightDirVC));\n diffuse += phaseAttenuation * shadowCoeff * lights[lightIdx].color;\n }\n return tColor * (diffuse * volume.diffuse + volume.ambient);\n }\n#endif\n\n// LAO of surface shadows and volume shadows only work with dependent components\nvec3 applyAllLightning(vec3 tColor, float alpha, vec3 posVC,\n vec4 surfaceNormalVC) {\n #if vtkNumberOfLights > 0\n // 0 <= volCoeff < EPSILON => only surface shadows\n // EPSILON <= volCoeff < 1 - EPSILON => mix of surface and volume shadows\n // 1 - EPSILON <= volCoeff => only volume shadows\n float volCoeff = volume.volumetricScatteringBlending *\n (1.0 - alpha / 2.0) *\n (1.0 - atan(surfaceNormalVC.w) * INV4PI);\n\n // Compute surface lighting if needed\n vec3 surfaceShadedColor = tColor;\n #ifdef EnableSurfaceLighting\n if (volCoeff < 1.0 - EPSILON) {\n surfaceShadedColor =\n applySurfaceShadowLighting(tColor, alpha, posVC, surfaceNormalVC);\n }\n #endif\n\n // Compute volume lighting if needed\n vec3 volumeShadedColor = tColor;\n #ifdef EnableVolumeLighting\n if (volCoeff >= EPSILON) {\n volumeShadedColor = applyVolumeShadowLighting(tColor, posVC);\n }\n #endif\n\n // Return the right mix\n if (volCoeff < EPSILON) {\n // Surface shadows\n return surfaceShadedColor;\n }\n if (volCoeff >= 1.0 - EPSILON) {\n // Volume shadows\n return volumeShadedColor;\n }\n // Mix of surface and volume shadows\n return mix(surfaceShadedColor, volumeShadedColor, volCoeff);\n #endif\n return tColor;\n}\n\nvec4 getColorForLabelOutline() {\n vec3 centerPosIS =\n fragCoordToIndexSpace(gl_FragCoord); // pos in texture space\n vec4 centerValue = getTextureValue(centerPosIS);\n bool pixelOnBorder = false;\n vec4 tColor = vec4(getColorFromTexture(centerValue.r, 0, 0.5),\n getOpacityFromTexture(centerValue.r, 0, 0.5));\n\n int segmentIndex = int(centerValue.r * 255.0);\n\n // Use texture sampling for outlineThickness\n float textureCoordinate = float(segmentIndex - 1) / 1024.0;\n float textureValue =\n texture2D(labelOutlineThicknessTexture, vec2(textureCoordinate, 0.5)).r;\n int actualThickness = int(textureValue * 255.0);\n\n // If it is the background (segment index 0), we should quickly bail out.\n // Previously, this was determined by tColor.a, which was incorrect as it\n // prevented the outline from appearing when the fill is 0.\n if (segmentIndex == 0) {\n return vec4(0, 0, 0, 0);\n }\n\n // Only perform outline check on fragments rendering voxels that aren't\n // invisible. Saves a bunch of needless checks on the background.\n // TODO define epsilon when building shader?\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 && j == 0) {\n continue;\n }\n\n vec4 neighborPixelCoord =\n vec4(gl_FragCoord.x + float(i), gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n vec4 value = getTextureValue(neighborPosIS);\n\n // If any of my neighbours are not the same value as I\n // am, this means I am on the border of the segment.\n // We can break the loops\n if (any(notEqual(value, centerValue))) {\n pixelOnBorder = true;\n break;\n }\n }\n\n if (pixelOnBorder == true) {\n break;\n }\n }\n\n // If I am on the border, I am displayed at full opacity\n if (pixelOnBorder == true) {\n tColor.a = volume.outlineOpacity;\n }\n\n return tColor;\n}\n\nvec4 getColorForAdditivePreset(vec4 tValue, vec3 posVC, vec3 posIS) {\n // compute normals\n mat4 normalMat = computeMat4Normal(posIS, tValue);\n vec4 normalLights[2];\n normalLights[0] = normalMat[0];\n normalLights[1] = normalMat[1];\n #if vtkNumberOfLights > 0\n if (volume.computeNormalFromOpacity == 1) {\n for (int component = 0; component < 2; ++component) {\n vec3 scalarInterp[2];\n float height = volume.transferFunctionsSampleHeight[component];\n computeNormalForDensity(posIS, scalarInterp, component);\n normalLights[component] =\n computeDensityNormal(scalarInterp, height, 1.0, component);\n }\n }\n #endif\n\n // compute opacities\n float opacities[2];\n opacities[0] = getOpacityFromTexture(\n tValue[0], 0, volume.transferFunctionsSampleHeight[0]);\n opacities[1] = getOpacityFromTexture(\n tValue[1], 1, volume.transferFunctionsSampleHeight[1]);\n #ifdef EnabledGradientOpacity\n for (int component = 0; component < 2; ++component) {\n opacities[component] *=\n computeGradientOpacityFactor(normalMat[component].a, component);\n }\n #endif\n float opacitySum = opacities[0] + opacities[1];\n if (opacitySum <= 0.0) {\n return vec4(0.0);\n }\n\n // mix the colors and opacities\n vec3 colors[2];\n for (int component = 0; component < 2; ++component) {\n float sampleHeight = volume.transferFunctionsSampleHeight[component];\n vec3 color = getColorFromTexture(tValue[component], component, sampleHeight);\n color = applyAllLightning(color, opacities[component], posVC,\n normalLights[component]);\n colors[component] = color;\n }\n vec3 mixedColor =\n (opacities[0] * colors[0] + opacities[1] * colors[1]) / opacitySum;\n return vec4(mixedColor, min(1.0, opacitySum));\n}\n\nvec4 getColorForColorizePreset(vec4 tValue, vec3 posVC, vec3 posIS) {\n // compute normals\n mat4 normalMat = computeMat4Normal(posIS, tValue);\n vec4 normalLight = normalMat[0];\n #if vtkNumberOfLights > 0\n if (volume.computeNormalFromOpacity == 1) {\n vec3 scalarInterp[2];\n float height = volume.transferFunctionsSampleHeight[0];\n computeNormalForDensity(posIS, scalarInterp, 0);\n normalLight = computeDensityNormal(scalarInterp, height, 1.0, 0);\n }\n #endif\n\n // compute opacities\n float opacity = getOpacityFromTexture(\n tValue[0], 0, volume.transferFunctionsSampleHeight[0]);\n #ifdef EnabledGradientOpacity\n opacity *= computeGradientOpacityFactor(normalMat[0].a, 0);\n #endif\n\n // colorizing component\n vec3 colorizingColor = getColorFromTexture(\n tValue[0], 1, volume.transferFunctionsSampleHeight[1]);\n float colorizingOpacity = getOpacityFromTexture(\n tValue[1], 1, volume.transferFunctionsSampleHeight[1]);\n\n // mix the colors and opacities\n vec3 color =\n getColorFromTexture(tValue[0], 0,\n volume.transferFunctionsSampleHeight[0]) *\n mix(vec3(1.0), colorizingColor, colorizingOpacity);\n color = applyAllLightning(color, opacity, posVC, normalLight);\n return vec4(color, opacity);\n}\n\nvec4 getColorForDefaultIndependentPreset(vec4 tValue, vec3 posIS) {\n\n // compute the normal vectors as needed\n #if defined(EnabledGradientOpacity) || vtkNumberOfLights > 0\n mat4 normalMat = computeMat4Normal(posIS, tValue);\n #endif\n\n // process color and opacity for each component\n // initial value of alpha is determined by wether the first component is\n // proportional or not\n #if defined(vtkComponent0Proportional)\n // when it is proportional, it starts at 1 (neutral for multiplications)\n float alpha = 1.0;\n #else\n // when it is not proportional, it starts at 0 (neutral for additions)\n float alpha = 0.0;\n #endif\n\n vec3 mixedColor = vec3(0.0);\n #if vtkNumberOfComponents > 0\n {\n const int component = 0;\n vec3 color = getColorFromTexture(\n tValue[component], component,\n volume.transferFunctionsSampleHeight[component]);\n float opacity = getOpacityFromTexture(\n tValue[component], component,\n volume.transferFunctionsSampleHeight[component]);\n #if !defined(vtkComponent0Proportional)\n float alphaContribution = volume.independentComponentMix[component] * opacity;\n #ifdef EnabledGradientOpacity\n alphaContribution *= computeGradientOpacityFactor(normalMat[component].a, component);\n #endif\n alpha += alphaContribution;\n #if vtkNumberOfLights > 0\n color = applyLighting(color, normalMat[component]);\n #endif\n #else\n color *= opacity;\n alpha *= mix(opacity, 1.0,\n (1.0 - volume.independentComponentMix[component]));\n #endif\n mixedColor += volume.independentComponentMix[component] * color;\n }\n #endif\n #if vtkNumberOfComponents > 1\n {\n const int component = 1;\n vec3 color = getColorFromTexture(\n tValue[component], component,\n volume.transferFunctionsSampleHeight[component]);\n float opacity = getOpacityFromTexture(\n tValue[component], component,\n volume.transferFunctionsSampleHeight[component]);\n #if !defined(vtkComponent1Proportional)\n float alphaContribution = volume.independentComponentMix[component] * opacity;\n #ifdef EnabledGradientOpacity\n alphaContribution *= computeGradientOpacityFactor(normalMat[component].a, component);\n #endif\n alpha += alphaContribution;\n #if vtkNumberOfLights > 0\n color = applyLighting(color, normalMat[component]);\n #endif\n #else\n color *= opacity;\n alpha *= mix(opacity, 1.0,\n (1.0 - volume.independentComponentMix[component]));\n #endif\n mixedColor += volume.independentComponentMix[component] * color;\n }\n #endif\n #if vtkNumberOfComponents > 2\n {\n const int component = 2;\n vec3 color = getColorFromTexture(\n tValue[component], component,\n volume.transferFunctionsSampleHeight[component]);\n float opacity = getOpacityFromTexture(\n tValue[component], component,\n volume.transferFunctionsSampleHeight[component]);\n #if !defined(vtkComponent2Proportional)\n float alphaContribution = volume.independentComponentMix[component] * opacity;\n #ifdef EnabledGradientOpacity\n alphaContribution *= computeGradientOpacityFactor(normalMat[component].a, component);\n #endif\n alpha += alphaContribution;\n #if vtkNumberOfLights > 0\n color = applyLighting(color, normalMat[component]);\n #endif\n #else\n color *= opacity;\n alpha *= mix(opacity, 1.0,\n (1.0 - volume.independentComponentMix[component]));\n #endif\n mixedColor += volume.independentComponentMix[component] * color;\n }\n #endif\n #if vtkNumberOfComponents > 3\n {\n const int component = 3;\n vec3 color = getColorFromTexture(\n tValue[component], component,\n volume.transferFunctionsSampleHeight[component]);\n float opacity = getOpacityFromTexture(\n tValue[component], component,\n volume.transferFunctionsSampleHeight[component]);\n #if !defined(vtkComponent3Proportional)\n float alphaContribution = volume.independentComponentMix[component] * opacity;\n #ifdef EnabledGradientOpacity\n alphaContribution *= computeGradientOpacityFactor(normalMat[component].a, component);\n #endif\n alpha += alphaContribution;\n #if vtkNumberOfLights > 0\n color = applyLighting(color, normalMat[component]);\n #endif\n #else\n color *= opacity;\n alpha *= mix(opacity, 1.0,\n (1.0 - volume.independentComponentMix[component]));\n #endif\n mixedColor += volume.independentComponentMix[component] * color;\n }\n #endif\n\n return vec4(mixedColor, alpha);\n}\n\nvec4 getColorForDependentComponents(vec4 tValue, vec3 posVC, vec3 posIS) {\n #if defined(EnabledGradientOpacity) || vtkNumberOfLights > 0\n // use component 3 of the opacity texture as getTextureValue() sets alpha to\n // the opacity value\n vec3 scalarInterp[2];\n vec4 normal0 = computeNormalForDensity(posIS, scalarInterp, 3);\n float gradientOpacity = computeGradientOpacityFactor(normal0.a, 0);\n #endif\n\n // get color and opacity\n #if vtkNumberOfComponents == 1\n vec3 tColor = getColorFromTexture(tValue.r, 0, 0.5);\n float alpha = getOpacityFromTexture(tValue.r, 0, 0.5);\n #endif\n #if vtkNumberOfComponents == 2\n vec3 tColor = vec3(tValue.r * volume.colorTextureScale[0] +\n volume.colorTextureShift[0]);\n float alpha = getOpacityFromTexture(tValue.a, 1, 0.5);\n #endif\n #if vtkNumberOfComponents == 3\n vec3 tColor = tValue.rgb * volume.colorTextureScale.rgb +\n volume.colorTextureShift.rgb;\n float alpha = getOpacityFromTexture(tValue.a, 0, 0.5);\n #endif\n #if vtkNumberOfComponents == 4\n vec3 tColor = tValue.rgb * volume.colorTextureScale.rgb +\n volume.colorTextureShift.rgb;\n float alpha = getOpacityFromTexture(tValue.a, 3, 0.5);\n #endif\n\n // Apply gradient opacity\n #if defined(EnabledGradientOpacity)\n alpha *= gradientOpacity;\n #endif\n\n #if vtkNumberOfComponents == 1\n if (alpha < EPSILON) {\n return vec4(0.0);\n }\n #endif\n\n // lighting\n #if vtkNumberOfLights > 0\n vec4 normalLight;\n if (volume.computeNormalFromOpacity == 1) {\n if (normal0[3] != 0.0) {\n normalLight =\n computeDensityNormal(scalarInterp, 0.5, gradientOpacity, 0);\n if (normalLight[3] == 0.0) {\n normalLight = normal0;\n }\n }\n } else {\n normalLight = normal0;\n }\n tColor = applyAllLightning(tColor, alpha, posVC, normalLight);\n #endif\n\n return vec4(tColor, alpha);\n}\n\nvec4 getColorForValue(vec4 tValue, vec3 posVC, vec3 posIS) {\n #ifdef EnableColorForValueFunctionId0\n return getColorForDependentComponents(tValue, posVC, posIS);\n #endif\n\n #ifdef EnableColorForValueFunctionId1\n return getColorForAdditivePreset(tValue, posVC, posIS);\n #endif\n\n #ifdef EnableColorForValueFunctionId2\n return getColorForColorizePreset(tValue, posVC, posIS);\n #endif\n\n #ifdef EnableColorForValueFunctionId3\n /*\n * Mix the color information from all the independent components to get a\n * single rgba output. See other shader functions like\n * `getColorForAdditivePreset` to learn how to create a custom color mix.\n * The custom color mix should return a value, but if it doesn't, it will\n * fallback on the default shading\n */\n //VTK::CustomColorMix\n #endif\n\n #if defined(EnableColorForValueFunctionId4) || defined(EnableColorForValueFunctionId3)\n return getColorForDefaultIndependentPreset(tValue, posIS);\n #endif\n\n #ifdef EnableColorForValueFunctionId5\n return getColorForLabelOutline();\n #endif\n}\n\nbool valueWithinScalarRange(vec4 val) {\n #if vtkNumberOfComponents > 1 && !defined(EnabledIndependentComponents)\n return false;\n #endif\n vec4 rangeMin = volume.ipScalarRangeMin;\n vec4 rangeMax = volume.ipScalarRangeMax;\n for (int component = 0; component < vtkNumberOfComponents; ++component) {\n if (val[component] < rangeMin[component] ||\n rangeMax[component] < val[component]) {\n return false;\n }\n }\n return true;\n}\n\n#if vtkBlendMode == LABELMAP_EDGE_PROJECTION_BLEND\n bool checkOnEdgeForNeighbor(int xFragmentOffset, int yFragmentOffset,\n int segmentIndex, vec3 stepIS) {\n vec3 volumeDimensions = vec3(volume.dimensions);\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(xFragmentOffset),\n gl_FragCoord.y + float(yFragmentOffset),\n gl_FragCoord.z, gl_FragCoord.w);\n vec3 originalNeighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n\n vec3 neighborPosIS = originalNeighborPosIS;\n for (int k = 0; k < vtkMaximumNumberOfSamples / 2; ++k) {\n ivec3 texCoord = ivec3(neighborPosIS * volumeDimensions);\n vec4 texValue = rawFetchTexture(texCoord);\n if (int(texValue.g) == segmentIndex) {\n // not on edge\n return false;\n }\n neighborPosIS += stepIS;\n }\n\n neighborPosIS = originalNeighborPosIS;\n for (int k = 0; k < vtkMaximumNumberOfSamples / 2; ++k) {\n ivec3 texCoord = ivec3(neighborPosIS * volumeDimensions);\n vec4 texValue = rawFetchTexture(texCoord);\n if (int(texValue.g) == segmentIndex) {\n // not on edge\n return false;\n }\n neighborPosIS -= stepIS;\n }\n\n // onedge\n float sampleHeight = volume.transferFunctionsSampleHeight[1];\n vec3 tColorSegment =\n getColorFromTexture(float(segmentIndex), 1, sampleHeight);\n float pwfValueSegment =\n getOpacityFromTexture(float(segmentIndex), 1, sampleHeight);\n gl_FragData[0] = vec4(tColorSegment, pwfValueSegment);\n return true;\n }\n#endif\n\nvec4 getColorAtPos(vec3 posVC) {\n vec3 posIS = posVCtoIS(posVC);\n vec4 texValue = getTextureValue(posIS);\n return getColorForValue(texValue, posVC, posIS);\n}\n\n//=======================================================================\n// Apply the specified blend mode operation along the ray's path.\n//\nvoid applyBlend(vec3 rayOriginVC, vec3 rayDirVC, float minDistance,\n float maxDistance) {\n // start slightly inside and apply some jitter\n vec3 stepVC = rayDirVC * sampleDistance;\n float raySteps = (maxDistance - minDistance) / sampleDistance;\n\n // Avoid 0.0 jitter\n float jitter = 0.01 + 0.99 * fragmentSeed;\n\n #if vtkBlendMode == COMPOSITE_BLEND\n // now map through opacity and color\n vec3 firstPosVC = rayOriginVC + minDistance * rayDirVC;\n vec4 firstColor = getColorAtPos(firstPosVC);\n\n // handle very thin volumes\n if (raySteps <= 1.0) {\n firstColor.a = 1.0 - pow(1.0 - firstColor.a, raySteps);\n gl_FragData[0] = firstColor;\n return;\n }\n\n // first color only counts for `jitter` factor of the step\n firstColor.a = 1.0 - pow(1.0 - firstColor.a, jitter);\n vec4 color = vec4(firstColor.rgb * firstColor.a, firstColor.a);\n vec3 posVC = firstPosVC + jitter * stepVC;\n float stepsTraveled = jitter;\n\n for (int i = 0; i < vtkMaximumNumberOfSamples; ++i) {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) {\n break;\n }\n vec4 tColor = getColorAtPos(posVC);\n\n color = color + vec4(tColor.rgb * tColor.a, tColor.a) * (1.0 - color.a);\n stepsTraveled++;\n posVC += stepVC;\n if (color.a > 0.99) {\n color.a = 1.0;\n break;\n }\n }\n\n if (color.a < 0.99 && (raySteps - stepsTraveled) > 0.0) {\n vec3 endPosVC = rayOriginVC + maxDistance * rayDirVC;\n vec4 tColor = getColorAtPos(endPosVC);\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps - stepsTraveled);\n\n float mix = (1.0 - color.a);\n color = color + vec4(tColor.rgb * tColor.a, tColor.a) * mix;\n }\n\n gl_FragData[0] = vec4(color.rgb / color.a, color.a);\n #endif\n\n #if vtkBlendMode == MAXIMUM_INTENSITY_BLEND || \\\n vtkBlendMode == MINIMUM_INTENSITY_BLEND\n // Find maximum/minimum intensity along the ray.\n\n // Define the operation we will use (min or max)\n #if vtkBlendMode == MAXIMUM_INTENSITY_BLEND\n #define OP max\n #else\n #define OP min\n #endif\n\n vec3 posVC = rayOriginVC + minDistance * rayDirVC;\n float stepsTraveled = 0.0;\n\n // Find a value to initialize the selected variables\n vec4 selectedValue;\n vec3 selectedPosVC;\n vec3 selectedPosIS;\n {\n vec3 posIS = posVCtoIS(posVC);\n selectedValue = getTextureValue(posIS);\n selectedPosVC = posVC;\n selectedPosIS = posIS;\n }\n\n // If the clipping range is shorter than the sample distance\n // we can skip the sampling loop along the ray.\n if (raySteps <= 1.0) {\n gl_FragData[0] = getColorForValue(selectedValue, selectedPosVC, selectedPosIS);\n return;\n }\n\n posVC += jitter * stepVC;\n stepsTraveled += jitter;\n\n // Sample along the ray until vtkMaximumNumberOfSamples,\n // ending slightly inside the total distance\n for (int i = 0; i < vtkMaximumNumberOfSamples; ++i) {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) {\n break;\n }\n\n // Get selected values\n vec3 posIS = posVCtoIS(posVC);\n vec4 previousSelectedValue = selectedValue;\n vec4 currentValue = getTextureValue(posIS);\n selectedValue = OP(selectedValue, currentValue);\n if (previousSelectedValue != selectedValue) {\n selectedPosVC = posVC;\n selectedPosIS = posIS;\n }\n\n // Otherwise, continue along the ray\n stepsTraveled++;\n posVC += stepVC;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posVC = rayOriginVC + maxDistance * rayDirVC;\n {\n vec3 posIS = posVCtoIS(posVC);\n vec4 previousSelectedValue = selectedValue;\n vec4 currentValue = getTextureValue(posIS);\n selectedValue = OP(selectedValue, currentValue);\n if (previousSelectedValue != selectedValue) {\n selectedPosVC = posVC;\n selectedPosIS = posIS;\n }\n }\n\n gl_FragData[0] = getColorForValue(selectedValue, selectedPosVC, selectedPosIS);\n #endif\n\n #if vtkBlendMode == ADDITIVE_INTENSITY_BLEND || \\\n vtkBlendMode == AVERAGE_INTENSITY_BLEND\n vec4 sum = vec4(0.);\n #if vtkBlendMode == AVERAGE_INTENSITY_BLEND\n float totalWeight = 0.0;\n #endif\n vec3 posVC = rayOriginVC + minDistance * rayDirVC;\n float stepsTraveled = 0.0;\n\n vec3 posIS = posVCtoIS(posVC);\n vec4 value = getTextureValue(posIS);\n\n if (raySteps <= 1.0) {\n gl_FragData[0] = getColorForValue(value * raySteps, posVC, posIS);\n return;\n }\n\n if (valueWithinScalarRange(value)) {\n sum += value * jitter;\n #if vtkBlendMode == AVERAGE_INTENSITY_BLEND\n totalWeight += jitter;\n #endif\n }\n posVC += jitter * stepVC;\n stepsTraveled += jitter;\n\n // Sample along the ray until vtkMaximumNumberOfSamples,\n // ending slightly inside the total distance\n for (int i = 0; i < vtkMaximumNumberOfSamples; ++i) {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) {\n break;\n }\n\n posIS = posVCtoIS(posVC);\n value = getTextureValue(posIS);\n // One can control the scalar range by setting the AverageIPScalarRange to\n // disregard scalar values, not in the range of interest, from the average\n // computation. Notes:\n // - We are comparing all values in the texture to see if any of them\n // are outside of the scalar range. In the future we might want to allow\n // scalar ranges for each component.\n if (valueWithinScalarRange(value)) {\n sum += value;\n #if vtkBlendMode == AVERAGE_INTENSITY_BLEND\n totalWeight++;\n #endif\n }\n\n stepsTraveled++;\n posVC += stepVC;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posVC = rayOriginVC + maxDistance * rayDirVC;\n posIS = posVCtoIS(posVC);\n value = getTextureValue(posIS);\n if (valueWithinScalarRange(value)) {\n sum += value;\n #if vtkBlendMode == AVERAGE_INTENSITY_BLEND\n totalWeight += raySteps - stepsTraveled;\n #endif\n }\n\n #if vtkBlendMode == AVERAGE_INTENSITY_BLEND\n sum /= vec4(totalWeight, totalWeight, totalWeight, 1.0);\n #endif\n\n gl_FragData[0] = getColorForValue(sum, posVC, posIS);\n #endif\n\n #if vtkBlendMode == RADON_TRANSFORM_BLEND\n float normalizedRayIntensity = 1.0;\n vec3 firstPosVC = rayOriginVC + minDistance * rayDirVC;\n vec3 posVC = firstPosVC;\n float stepsTraveled = 0.0;\n\n // handle very thin volumes\n if (raySteps <= 1.0) {\n vec3 posIS = posVCtoIS(posVC);\n vec4 tValue = getTextureValue(posIS);\n normalizedRayIntensity -= raySteps * sampleDistance *\n getRadonOpacity(tValue);\n gl_FragData[0] =\n vec4(getRadonColor(normalizedRayIntensity), 1.0);\n return;\n }\n\n vec3 firstPosIS = posVCtoIS(firstPosVC);\n vec4 firstValue = getTextureValue(firstPosIS);\n normalizedRayIntensity -=\n jitter * sampleDistance * getRadonOpacity(firstValue);\n\n posVC += jitter * stepVC;\n stepsTraveled += jitter;\n\n for (int i = 0; i < vtkMaximumNumberOfSamples; ++i) {\n if (stepsTraveled + 1.0 >= raySteps) {\n break;\n }\n\n vec3 posIS = posVCtoIS(posVC);\n vec4 value = getTextureValue(posIS);\n // Convert scalar value to normalizedRayIntensity coefficient and\n // accumulate normalizedRayIntensity\n normalizedRayIntensity -=\n sampleDistance * getRadonOpacity(value);\n\n posVC += stepVC;\n stepsTraveled++;\n }\n\n if ((raySteps - stepsTraveled) > 0.0) {\n vec3 endPosIS = clamp(\n posVCtoIS(rayOriginVC + maxDistance * rayDirVC),\n vec3(0.0), vec3(1.0));\n vec4 endValue = getTextureValue(endPosIS);\n normalizedRayIntensity -=\n (raySteps - stepsTraveled) * sampleDistance * getRadonOpacity(endValue);\n }\n\n // map normalizedRayIntensity to color\n gl_FragData[0] =\n vec4(getRadonColor(normalizedRayIntensity), 1.0);\n #endif\n\n #if vtkBlendMode == LABELMAP_EDGE_PROJECTION_BLEND\n // Only works with a single volume\n vec3 posVC = rayOriginVC + minDistance * rayDirVC;\n float stepsTraveled = 0.0;\n vec3 posIS = posVCtoIS(posVC);\n vec4 tValue = getTextureValue(posIS);\n if (raySteps <= 1.0) {\n gl_FragData[0] = getColorForValue(tValue, posVC, posIS);\n return;\n }\n\n vec3 stepIS = vecVCToIS(stepVC);\n vec4 value = tValue;\n posIS += jitter * stepIS;\n stepsTraveled += jitter;\n vec3 maxPosIS = posIS; // Store the position of the max value\n int segmentIndex = int(value.g);\n bool originalPosHasSeenNonZero = false;\n\n if (segmentIndex != 0) {\n // Tried using the segment index in an boolean array but reading\n // from the array by dynamic indexing was horrondously slow\n // so use bit masking instead and assign 1 to the bit corresponding to the\n // segment index and later check if the bit is set via bit operations\n setLabelOutlineBit(segmentIndex);\n }\n\n // Sample along the ray until vtkMaximumNumberOfSamples,\n // ending slightly inside the total distance\n for (int i = 0; i < vtkMaximumNumberOfSamples; ++i) {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) {\n break;\n }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n segmentIndex = int(tValue.g);\n\n if (segmentIndex != 0) {\n originalPosHasSeenNonZero = true;\n setLabelOutlineBit(segmentIndex);\n }\n\n if (tValue.r > value.r) {\n value = tValue; // Update the max value\n maxPosIS = posIS; // Update the position where max occurred\n }\n\n // Otherwise, continue along the ray\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = posVCtoIS(rayOriginVC + maxDistance * rayDirVC);\n tValue = getTextureValue(posIS);\n\n if (tValue.r > value.r) {\n value = tValue; // Update the max value\n maxPosIS = posIS; // Update the position where max occurred\n }\n\n // If we have not seen any non-zero segments, we can return early\n // and grab color from the actual center value first component (image)\n if (!originalPosHasSeenNonZero) {\n vec3 maxPosVC = posIStoVC(maxPosIS);\n gl_FragData[0] = getColorForValue(value, maxPosVC, maxPosIS);\n return;\n }\n\n vec3 neighborRayStepsIS = stepIS;\n float neighborRaySteps = raySteps;\n bool shouldLookInAllNeighbors = false;\n\n vec3 volumeSpacings = volume.spacing;\n float minVoxelSpacing =\n min(volumeSpacings[0], min(volumeSpacings[1], volumeSpacings[2]));\n vec4 base =\n vec4(gl_FragCoord.x, gl_FragCoord.y, gl_FragCoord.z, gl_FragCoord.w);\n\n vec4 baseXPlus = vec4(gl_FragCoord.x + 1.0, gl_FragCoord.y, gl_FragCoord.z,\n gl_FragCoord.w);\n vec4 baseYPlus = vec4(gl_FragCoord.x, gl_FragCoord.y + 1.0, gl_FragCoord.z,\n gl_FragCoord.w);\n\n vec3 baseWorld = fragCoordToWorld(base);\n vec3 baseXPlusWorld = fragCoordToWorld(baseXPlus);\n vec3 baseYPlusWorld = fragCoordToWorld(baseYPlus);\n\n float XPlusDiff = length(baseXPlusWorld - baseWorld);\n float YPlusDiff = length(baseYPlusWorld - baseWorld);\n\n float minFragSpacingWorld = min(XPlusDiff, YPlusDiff);\n\n for (int s = 1; s < MAX_SEGMENT_INDEX; s++) {\n // bail out quickly if the segment index has not\n // been seen by the center segment\n if (!isLabelOutlineBitSet(s)) {\n continue;\n }\n\n // Use texture sampling for outlineThickness so that we can have\n // per segment thickness\n float textureCoordinate = float(s - 1) / 1024.0;\n float textureValue =\n texture2D(labelOutlineThicknessTexture, vec2(textureCoordinate, 0.5)).r;\n\n int actualThickness = int(textureValue * 255.0);\n\n // check the extreme points in the neighborhood since there is a better\n // chance of finding the edge there, so that we can bail out\n // faster if we find the edge\n bool onEdge = checkOnEdgeForNeighbor(-actualThickness, -actualThickness, s,\n stepIS) ||\n checkOnEdgeForNeighbor(actualThickness, actualThickness, s,\n stepIS) ||\n checkOnEdgeForNeighbor(actualThickness, -actualThickness, s,\n stepIS) ||\n checkOnEdgeForNeighbor(-actualThickness, +actualThickness, s,\n stepIS);\n\n if (onEdge) {\n return;\n }\n\n // since the next step is computationally expensive, we need to perform\n // some optimizations to avoid it if possible. One of the optimizations\n // is to check the whether the minimum of the voxel spacing is greater than\n // the 2 * the thickness of the outline segment. If that is the case\n // then we can safely skip the next step since we can be sure that the\n // the previous 4 checks on the extreme points would caught the entirety\n // of the all the fragments inside. i.e., this happens when we zoom out,\n if (minVoxelSpacing >\n (2.0 * float(actualThickness) - 1.0) * minFragSpacingWorld) {\n continue;\n }\n\n // Loop through the rest, skipping the processed extremes and the center\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 && j == 0)\n continue; // Skip the center\n if (abs(i) == actualThickness && abs(j) == actualThickness)\n continue; // Skip corners\n if (checkOnEdgeForNeighbor(i, j, s, stepIS)) {\n return;\n }\n }\n }\n }\n\n float sampleHeight = volume.transferFunctionsSampleHeight[0];\n vec3 tColor0 = getColorFromTexture(value.r, 0, sampleHeight);\n float pwfValue0 = getOpacityFromTexture(value.r, 0, sampleHeight);\n gl_FragData[0] = vec4(tColor0, pwfValue0);\n #endif\n}\n\n//=======================================================================\n// given a\n// - ray direction (rayDir)\n// - starting point (vertexVCVSOutput)\n// - bounding planes of the volume\n// - optionally depth buffer values\n// - far clipping plane\n// compute the start/end distances of the ray we need to cast\nvec2 computeRayDistances(vec3 rayOriginVC, vec3 rayDirVC) {\n vec2 dists = rayIntersectVolumeDistances(rayOriginVC, rayDirVC);\n\n //VTK::ClipPlane::Impl\n\n // do not go behind front clipping plane\n dists.x = max(0.0, dists.x);\n\n // do not go PAST far clipping plane\n float farDist = -camThick / rayDirVC.z;\n dists.y = min(farDist, dists.y);\n\n // Do not go past the zbuffer value if set\n // This is used for intermixing opaque geometry\n //VTK::ZBuffer::Impl\n\n return dists;\n}\n\nfloat getFragmentSeed() {\n // This first noise has a diagonal pattern\n float firstNoise =\n fract(sin(dot(gl_FragCoord.xy, vec2(12.9898, 78.233))) * 43758.5453);\n // This second noise is made out of blocks of CPU generated noise\n float secondNoise = texture2D(jtexture, gl_FragCoord.xy / 32.0).r;\n // Combine the two sources of noise in a way that the distribution is uniform\n // in [0,1[\n float noiseSum = firstNoise + secondNoise;\n return noiseSum < 1.0 ? noiseSum : noiseSum - 1.0;\n}\n\nvoid main() {\n fragmentSeed = getFragmentSeed();\n\n if (cameraParallel == 1) {\n // Camera is parallel, so the rayDir is just the direction of the camera.\n rayDirVC = vec3(0.0, 0.0, -1.0);\n } else {\n // camera is at 0,0,0 so rayDir for perspective is just the vc coord\n rayDirVC = normalize(vertexVCVSOutput);\n }\n\n vec3 rayOriginVC = vertexVCVSOutput;\n vec2 rayStartEndDistancesVC = computeRayDistances(rayOriginVC, rayDirVC);\n if (rayStartEndDistancesVC[1] <= rayStartEndDistancesVC[0] ||\n rayStartEndDistancesVC[1] <= 0.0) {\n // Volume not hit or behind the ray\n discard;\n }\n\n // Perform the blending operation along the ray\n applyBlend(rayOriginVC, rayDirVC, rayStartEndDistancesVC[0], rayStartEndDistancesVC[1]);\n}\n",e.Geometry=""},e.replaceShaderValues=(e,r,n)=>{let i=e.Fragment;i=f.A.substitute(i,"//VTK::EnabledColorFunctions",`#define EnableColorForValueFunctionId${t.previousState.colorForValueFunctionId}`).result;let a=[];t.previousState.surfaceLightingEnabled&&a.push("Surface"),t.previousState.volumeLightingEnabled&&a.push("Volume"),i=f.A.substitute(i,"//VTK::EnabledLightings",a.map(e=>`#define Enable${e}Lighting`)).result,t.previousState.multiTexturePerVolumeEnabled&&(i=f.A.substitute(i,"//VTK::EnabledMultiTexturePerVolume","#define EnabledMultiTexturePerVolume").result),t.previousState.useIndependentComponents&&(i=f.A.substitute(i,"//VTK::EnabledIndependentComponents","#define EnabledIndependentComponents").result),t.previousState.gradientOpacityEnabled&&(i=f.A.substitute(i,"//VTK::EnabledGradientOpacity","#define EnabledGradientOpacity").result),i=f.A.substitute(i,"//VTK::vtkProportionalComponents",t.previousState.proportionalComponents.map(e=>`#define vtkComponent${e}Proportional`).join("\n")).result,i=f.A.substitute(i,"//VTK::vtkForceNearestComponents",t.previousState.forceNearestComponents.map(e=>`#define vtkComponent${e}ForceNearest`).join("\n")).result,t.previousState.hasZBufferTexture&&(i=f.A.substitute(i,"//VTK::ZBuffer::Dec",["uniform sampler2D zBufferTexture;","uniform float vpZWidth;","uniform float vpZHeight;"]).result,i=f.A.substitute(i,"//VTK::ZBuffer::Impl",["vec4 depthVec = texture2D(zBufferTexture, vec2(gl_FragCoord.x / vpZWidth, gl_FragCoord.y/vpZHeight));","float zdepth = (depthVec.r*256.0 + depthVec.g)/257.0;","zdepth = zdepth * 2.0 - 1.0;","if (cameraParallel == 0) {","zdepth = -2.0 * camFar * camNear / (zdepth*(camFar-camNear)-(camFar+camNear)) - camNear;}","else {","zdepth = (zdepth + 1.0) * 0.5 * (camFar - camNear);}\n","zdepth = -zdepth/rayDirVC.z;","dists.y = min(zdepth,dists.y);"]).result),i=f.A.substitute(i,"//VTK::BlendMode",`${t.previousState.blendMode}`).result,i=f.A.substitute(i,"//VTK::NumberOfLights",`${t.previousState.numberOfLights}`).result,i=f.A.substitute(i,"//VTK::MaxLaoKernelSize",`${t.previousState.maxLaoKernelSize}`).result,i=f.A.substitute(i,"//VTK::NumberOfComponents",`${t.previousState.numberOfComponents}`).result,e.Fragment=i=f.A.substitute(i,"//VTK::MaximumNumberOfSamples",`${t.previousState.maximumNumberOfSamples}`).result;let o=t.previousState.numberOfClippingPlanes;o>0&&(i=f.A.substitute(i,"//VTK::ClipPlane::Dec",["uniform vec3 vClipPlaneNormals[6];","uniform float vClipPlaneDistances[6];","uniform vec3 vClipPlaneOrigins[6];","uniform int clip_numPlanes;","//VTK::ClipPlane::Dec","#define vtkClippingPlanesOn"],!1).result,i=f.A.substitute(i,"//VTK::ClipPlane::Impl",[`for(int i = 0; i < ${o}; i++) {`," float rayDirRatio = dot(rayDirVC, vClipPlaneNormals[i]);"," float equationResult = dot(vertexVCVSOutput, vClipPlaneNormals[i]) + vClipPlaneDistances[i];"," if (rayDirRatio == 0.0)"," {"," if (equationResult < 0.0) dists.x = dists.y;"," continue;"," }"," float result = -1.0 * equationResult / rayDirRatio;"," if (rayDirRatio < 0.0) dists.y = min(dists.y, result);"," else dists.x = max(dists.x, result);","}","//VTK::ClipPlane::Impl"],!1).result),e.Fragment=i},e.getNeedToRebuildShaders=(r,n,i)=>{let a=!!t.zBufferTexture,s=t.currentValidInputs.length,c=t.numberOfLights,d=t.numberOfComponents,m=t.useIndependentComponents,h=i.getProperties(),f=t.currentValidInputs[0],g=h[f.inputIndex],v=f.imageData.getBounds(),y=Math.ceil(o.Ay.getDiagonalLength(v)/e.getCurrentSampleDistance(n));y>t.renderable.getMaximumSamplesPerRay()&&T(`The number of steps required ${y} is larger than the specified maximum number of steps ${t.renderable.getMaximumSamplesPerRay()}. +Please either change the volumeMapper sampleDistance or its maximum number of samples.`);let b=m?d:1,x=!1;for(let e=0;eC&&g.getLocalAmbientOcclusion()&&g.getAmbient()>0&&(C=A);let S=t.renderable.getClippingPlanes().length,w=t.renderable.getViewSpecificProperties().OpenGL?.ShaderReplacements,O=t.currentRenderPass?.getShaderReplacement(),P=t.renderable.getBlendMode(),_=(()=>{if(P!==u.N.LABELMAP_EDGE_PROJECTION_BLEND&&p(g))return 5;if(m)switch(g.getColorMixPreset()){case l.dM.ADDITIVE:return 1;case l.dM.COLORIZE:return 2;case l.dM.CUSTOM:return 3;default:return 4}return 0})(),E=1>g.getVolumetricScatteringBlending(),D=g.getVolumetricScatteringBlending()>0,R=!1;for(let e=0;e1,gradientOpacityEnabled:x};return!(r.getProgram()?.getHandle()!==0&&t.previousState&&I(t.previousState,V))&&(t.previousState=V,!0)},e.updateShaders=(r,n,i)=>{if(e.getNeedToRebuildShaders(r,n,i)){let a={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(a,n,i);let o=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);if(!o)return S("Error compiling volume mapper shader program."),r.setProgram(null),!1;o!==r.getProgram()&&(r.setProgram(o),r.getVAO().releaseGraphicsResources()),r.getShaderSourceTime().modified()}else if(!t._openGLRenderWindow.getShaderCache().readyShaderProgram(r.getProgram()))return r.setProgram(null),!1;return r.getVAO().bind(),e.setMapperShaderParameters(r,n,i),e.setCameraShaderParameters(r,n,i),e.setPropertyShaderParameters(r,n,i),e.getClippingPlaneShaderParameters(r,n,i),!0},e.setMapperShaderParameters=(r,n,i)=>{let a=r.getProgram();if(!a)return;r.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>r.getAttributeUpdateTime().getMTime()||r.getShaderSourceTime().getMTime()>r.getAttributeUpdateTime().getMTime())&&(a.isAttributeUsed("vertexDC")&&!r.getVAO().addAttributeArray(a,r.getCABO(),"vertexDC",r.getCABO().getVertexOffset(),r.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)&&S("Error setting vertexDC in shader VAO."),r.getAttributeUpdateTime().modified());let o=e.getCurrentSampleDistance(n);a.setUniformf("sampleDistance",o);let s=o*t.renderable.getVolumeShadowSamplingDistFactor();a.setUniformf("volumeShadowSampleDistance",s),t.scalarTextures.forEach((e,t)=>{a.setUniformi(`volumeTexture[${t}]`,e.getTextureUnit())});let l=i.getProperties()[t.currentValidInputs[0].inputIndex].getIpScalarRange(),u=new Float32Array(4),c=new Float32Array(4),d=(e,t,r)=>{t?.dataComputedScale?.length&&(u[e]=l[0]*t.dataComputedScale[r]+t.dataComputedOffset[r],c[e]=l[1]*t.dataComputedScale[r]+t.dataComputedOffset[r],u[e]=(u[e]-t.offset[r])/t.scale[r],c[e]=(c[e]-t.offset[r])/t.scale[r])};if(t.previousState.multiTexturePerVolumeEnabled)t.scalarTextures.forEach((e,t)=>{d(t,e.getVolumeInfo(),0)});else{let e=t.scalarTextures[0].getVolumeInfo();for(let t=0;t<4;++t)d(t,e,t)}let p="volume";if(a.setUniform4f(`${p}.ipScalarRangeMin`,u[0],u[1],u[2],u[3]),a.setUniform4f(`${p}.ipScalarRangeMax`,c[0],c[1],c[2],c[3]),null!==t.zBufferTexture){a.setUniformi("zBufferTexture",t.zBufferTexture.getTextureUnit());let e=t._useSmallViewport?[t._smallViewportWidth,t._smallViewportHeight]:t._openGLRenderWindow.getFramebufferSize();a.setUniformf("vpZWidth",e[0]),a.setUniformf("vpZHeight",e[1])}},e.setCameraShaderParameters=(r,n,i)=>{let{idxToView:a,vecISToVCMatrix:s,modelToView:l,projectionToView:u,projectionToWorld:c}=w,d=t.openGLCamera.getKeyMatrices(n),m=t.openGLVolume.getKeyMatrices();x.multiply(l,d.wcvc,m.mcwc);let h=r.getProgram(),f=t.openGLCamera.getRenderable(),g=f.getParallelProjection(),v=f.getClippingRange();h.setUniformf("camThick",v[1]-v[0]),h.setUniformf("camNear",v[0]),h.setUniformf("camFar",v[1]),h.setUniformi("cameraParallel",g);let y=t.currentValidInputs[0],b=y.imageData.getBounds(),I=o.Ay.getCorners(b,[]).map(e=>{if(A.Z0(e,e,l),!g){let t=-v[0]/(e[2]*A.Bw(e));A.hs(e,e,t)}return A.Z0(e,e,d.vcpc),e}),T=o.Ay.addPoints([...o.Ay.INIT_BOUNDS],I);h.setUniformf("dcxmin",T[0]),h.setUniformf("dcxmax",T[1]),h.setUniformf("dcymin",T[2]),h.setUniformf("dcymax",T[3]);let S=e.getRenderTargetSize();h.setUniformf("vpWidth",S[0]),h.setUniformf("vpHeight",S[1]);let O=e.getRenderTargetOffset();h.setUniformf("vpOffsetX",O[0]/S[0]),h.setUniformf("vpOffsetY",O[1]/S[1]),x.invert(u,d.vcpc),h.setUniformMatrix("PCVCMatrix",u),h.setUniformi("twoSidedLighting",n.getTwoSidedLighting());let P=Array(2*t.previousState.maxLaoKernelSize);for(let e=0;e0){let e=0;n.getLights().forEach(t=>{if(t.getSwitch()>0){let r=`lights[${e}]`,n=t.getColor(),i=t.getIntensity(),a=A.hs([],n,i);h.setUniform3fv(`${r}.color`,a);let o=t.getTransformedPosition();A.Z0(o,o,l),h.setUniform3fv(`${r}.positionVC`,o);let s=[...t.getDirection()];A.ei(s,s,d.normalMatrix),A.S8(s,s),h.setUniform3fv(`${r}.directionVC`,s);let u=[-.5*s[0],-.5*s[1],-.5*(s[2]-1)];h.setUniform3fv(`${r}.halfAngleVC`,u);let c=t.getAttenuationValues();h.setUniform3fv(`${r}.attenuation`,c);let p=t.getExponent();h.setUniformf(`${r}.exponent`,p);let m=t.getConeAngle();h.setUniformf(`${r}.coneAngle`,m);let f=t.getPositional();h.setUniformi(`${r}.isPositional`,f),e++}})}let _="volume",E=i.getProperties()[y.inputIndex],D=y.imageData,R=D.getSpatialExtent(),M=D.getSpacing(),N=D.getDimensions(),V=D.getIndexToWorld(),L=D.getWorldToIndex(),B=D.getDirectionByReference();x.multiply(a,l,V),h.setUniform3fv(`${_}.spacing`,M);let F=A.DI([],M);h.setUniform3fv(`${_}.inverseSpacing`,F),h.setUniform3iv(`${_}.dimensions`,N),h.setUniform3fv(`${_}.inverseDimensions`,A.DI([],N)),h.setUniformMatrix(`${_}.worldToIndex`,L),s.fill(0);let U=A.lw(new Float64Array(3),N,M);s[0]=U[0],s[4]=U[1],s[8]=U[2],C.multiply(s,B,s),C.multiply(s,m.normalMatrix,s),C.multiply(s,d.normalMatrix,s),h.setUniformMatrix3x3(`${_}.vecISToVCMatrix`,s),h.setUniformMatrix3x3(`${_}.vecVCToISMatrix`,C.invert(new Float32Array(9),s));let k=A.fA(R[0],R[2],R[4]),G=A.Z0(new Float64Array(3),k,a);h.setUniform3fv(`${_}.originVC`,G);let W=A.Bw(U);if(h.setUniformf(`${_}.diagonalLength`,W),p(E)){let e=f.getDistance();f.setClippingRange(e,e+.1);let r=t.openGLCamera.getKeyMatrices(n);x.invert(c,r.wcpc),f.setClippingRange(v[0],v[1]),t.openGLCamera.getKeyMatrices(n),h.setUniformMatrix(`${_}.PCWCMatrix`,c)}if(E.getVolumetricScatteringBlending()>0&&(h.setUniformf(`${_}.globalIlluminationReach`,E.getGlobalIlluminationReach()),h.setUniformf(`${_}.volumetricScatteringBlending`,E.getVolumetricScatteringBlending()),h.setUniformf(`${_}.anisotropy`,E.getAnisotropy()),h.setUniformf(`${_}.anisotropySquared`,E.getAnisotropy()**2)),E.getLocalAmbientOcclusion()&&E.getAmbient()>0){let e=E.getLAOKernelSize();h.setUniformi(`${_}.kernelSize`,e);let t=E.getLAOKernelRadius();h.setUniformi(`${_}.kernelRadius`,t)}else h.setUniformi(`${_}.kernelSize`,0)},e.setPropertyShaderParameters=(e,r,n)=>{let i=e.getProgram();i.setUniformi("jtexture",t.jitterTexture.getTextureUnit());let a=n.getProperties();i.setUniformi("labelOutlineThicknessTexture",t.labelOutlineThicknessTexture.getTextureUnit()),i.setUniformi("opacityTexture",t.opacityTexture.getTextureUnit()),i.setUniformi("colorTexture",t.colorTexture.getTextureUnit());let o="volume",s=a[t.currentValidInputs[0].inputIndex],l=t.previousState.numberOfComponents,u=t.previousState.useIndependentComponents;if(u){let e=new Float32Array(4);for(let t=0;t0){i.setUniformf(`${o}.ambient`,s.getAmbient()),i.setUniformf(`${o}.diffuse`,s.getDiffuse()),i.setUniformf(`${o}.specular`,s.getSpecular());let e=s.getSpecularPower();i.setUniformf(`${o}.specularPower`,0===e?1:e)}},e.getClippingPlaneShaderParameters=(e,r,n)=>{if(t.renderable.getClippingPlanes().length>0){let n=t.openGLCamera.getKeyMatrices(r),i=[],a=[],o=[],s=t.renderable.getClippingPlanes(),l=s.length;for(let e=0;e{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)},()=>{t._openGLRenderWindow&&D(t._openGLRenderWindow)},e.delete),e.getRenderTargetSize=()=>{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];let{usize:e,vsize:r}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,r]},e.getRenderTargetOffset=()=>{let{lowerLeftU:e,lowerLeftV:r}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,r]},e.getCurrentSampleDistance=e=>{let r=e.getVTKWindow().getInteractor(),n=t.renderable.getSampleDistance();return r.isAnimating()?n*t.renderable.getInteractionSampleDistanceFactor():n},e.renderPieceStart=(r,n)=>{let i=r.getVTKWindow().getInteractor();if(t._lastScale||(t._lastScale=t.renderable.getInitialInteractionScale()),t._useSmallViewport=!1,i.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._animationRateSubscription||(t._animationRateSubscription=i.onAnimationFrameRateUpdate(()=>{if(t.renderable.getAutoAdjustSampleDistances()){let e=i.getRecentAnimationFrameRate(),r=i.getDesiredUpdateRate()/e;(r>1.15||r<.85)&&(t._lastScale*=r),t._lastScale>400&&(t._lastScale=400),t._lastScale<1.5&&(t._lastScale=1.5)}else t._lastScale=t.renderable.getImageSampleDistance()*t.renderable.getImageSampleDistance()})),t._useSmallViewport){let e=t._openGLRenderWindow.getFramebufferSize(),r=1/Math.sqrt(t._lastScale);if(t._smallViewportWidth=Math.ceil(r*e[0]),t._smallViewportHeight=Math.ceil(r*e[1]),t._smallViewportHeight>e[1]&&(t._smallViewportHeight=e[1]),t._smallViewportWidth>e[0]&&(t._smallViewportWidth=e[0]),t.framebuffer.saveCurrentBindingsAndBuffers(),null===t.framebuffer.getGLFramebuffer())t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer();else{let r=t.framebuffer.getSize();r&&r[0]===e[0]&&r[1]===e[1]||(t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer())}t.framebuffer.bind();let n=t.context;n.clearColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clear(n.COLOR_BUFFER_BIT),n.viewport(0,0,t._smallViewportWidth,t._smallViewportHeight),t.fvp=[t._smallViewportWidth/e[0],t._smallViewportHeight/e[1]]}t.context.disable(t.context.DEPTH_TEST),e.updateBufferObjects(r,n);let a=n.getProperties();t.currentValidInputs.forEach(({inputIndex:e})=>{let r=a[e].getInterpolationType(),n=t.scalarTextures[e];r===l.VO.NEAREST?(n.setMinificationFilter(c.dJ.NEAREST),n.setMagnificationFilter(c.dJ.NEAREST)):(n.setMinificationFilter(c.dJ.LINEAR),n.setMagnificationFilter(c.dJ.LINEAR))}),null!==t.zBufferTexture&&t.zBufferTexture.activate()},e.renderPieceDraw=(r,n)=>{let i=t.context,a=[...t.scalarTextures,t.colorTexture,t.opacityTexture,t.labelOutlineThicknessTexture,t.jitterTexture];if(a.forEach(e=>e.activate()),!e.updateShaders(t.tris,r,n))return void a.forEach(e=>e.deactivate());i.drawArrays(i.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),a.forEach(e=>e.deactivate())},e.renderPieceFinish=(e,r)=>{if(null!==t.zBufferTexture&&t.zBufferTexture.deactivate(),t._useSmallViewport){if(t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader){t.copyShader=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray("//VTK::System::Dec\nattribute vec4 vertexDC;\nuniform vec2 tfactor;\nvarying vec2 tcoord;\nvoid main() { tcoord = vec2(vertexDC.x*0.5 + 0.5, vertexDC.y*0.5 + 0.5) * tfactor; gl_Position = vertexDC; }","//VTK::System::Dec\n//VTK::Output::Dec\nuniform sampler2D texture1;\nvarying vec2 tcoord;\nvoid main() { gl_FragData[0] = texture2D(texture1,tcoord); }","");let e=t.copyShader;t.copyVAO=g.Ay.newInstance(),t.copyVAO.setOpenGLRenderWindow(t._openGLRenderWindow),t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(e,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||S("Error setting vertexDC in copy shader VAO.")}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(t.copyShader);let e=t._openGLRenderWindow.getFramebufferSize();t.context.viewport(0,0,e[0],e[1]);let r=t.framebuffer.getColorTexture();r.activate(),t.copyShader.setUniformi("texture",r.getTextureUnit()),t.copyShader.setUniform2f("tfactor",t.fvp[0],t.fvp[1]);let n=t.context;n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),r.deactivate(),n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA)}},e.renderPiece=(r,n)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update();let i=t.renderable.getNumberOfInputPorts();t.currentValidInputs=[];for(let e=0;e0){let e=n.getProperties(),i=t.currentValidInputs[0],o=i.imageData.getPointData().getScalars(),s=e[i.inputIndex];s.getShade()&&t.renderable.getBlendMode()===u.N.COMPOSITE_BLEND&&r.getLights().forEach(e=>{e.getSwitch()>0&&a++});let l=t.currentValidInputs.length;t.numberOfComponents=l>1?l:o.getNumberOfComponents(),t.useIndependentComponents=function(e,t){let r=e.getIndependentComponents(),n=e.getColorMixPreset();return r&&t>=2||!!n}(s,t.numberOfComponents)}a!==t.numberOfLights&&(t.numberOfLights=a,e.modified()),e.invokeEvent({type:"EndEvent"}),0!==t.currentValidInputs.length&&(e.renderPieceStart(r,n),e.renderPieceDraw(r,n),e.renderPieceFinish(r,n))},e.updateBufferObjects=(t,r)=>{e.getNeedToRebuildBufferObjects(t,r)&&e.buildBufferObjects(t,r)},e.getNeedToRebuildBufferObjects=(r,n)=>t.VBOBuildTime.getMTime()t.VBOBuildTime.getMTime()!!e?.getHandle())||!t.colorTexture?.getHandle()||!t.opacityTexture?.getHandle()||!t.labelOutlineThicknessTexture?.getHandle()||!t.jitterTexture?.getHandle(),e.buildBufferObjects=(r,n)=>{if(!t.jitterTexture.getHandle()){let e=new Float32Array(1024);for(let t=0;t<1024;++t)e[t]=Math.random();t.jitterTexture.setMinificationFilter(c.dJ.NEAREST),t.jitterTexture.setMagnificationFilter(c.dJ.NEAREST),t.jitterTexture.create2DFromRaw({width:32,height:32,numComps:1,dataType:i.JA.FLOAT,data:e})}let o=n.getProperties(),l=o[t.currentValidInputs[0].inputIndex],u=t.numberOfComponents,d=t.useIndependentComponents,p=d?u:1,h=[];for(let e=0;e{let i=o[r],a=e.getPointData().getScalars(),s=t._openGLRenderWindow.getGraphicsResourceForObject(a),l=(0,b.eS)(e,a),u=!s?.oglObject?.getHandle()||s?.hash!==l,c=i.getUpdatedExtents(),d=!!c.length;if(u&&!d){let r=m.Ay.newInstance();r.setOpenGLRenderWindow(t._openGLRenderWindow);let o=e.getDimensions();r.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),r.resetFormatAndType(),r.create3DFilterableFromDataArray({width:o[0],height:o[1],depth:o[2],dataArray:a,preferSizeOverAccuracy:i.getPreferSizeOverAccuracy()}),t._openGLRenderWindow.setGraphicsResourceForObject(a,r,l),t.scalarTextures[n]=r}else t.scalarTextures[n]=s.oglObject;if(d){i.setUpdatedExtents([]);let r=e.getDimensions();t.scalarTextures[n].create3DFilterableFromDataArray({width:r[0],height:r[1],depth:r[2],dataArray:a,updatedExtents:c})}E(t._openGLRenderWindow,t._scalarTexturesCore[n],a),t._scalarTexturesCore[n]=a});let A=l.getLabelOutlineThickness(),T=t._openGLRenderWindow.getGraphicsResourceForObject(A),S=A.join("-");if(T?.oglObject?.getHandle()&&T?.hash===S)t.labelOutlineThicknessTexture=T.oglObject;else{let e=m.Ay.newInstance();e.setOpenGLRenderWindow(t._openGLRenderWindow);let r=t.renderable.getLabelOutlineTextureWidth();r<=0&&(r=t.context.getParameter(t.context.MAX_TEXTURE_SIZE));let n=new Uint8Array(+r);for(let e=0;e1?1:-1,e[3*t+2]=-1;let r=new Uint16Array(8);r[0]=3,r[1]=0,r[2]=1,r[3]=3,r[4]=3,r[5]=0,r[6]=3,r[7]=2;let n=a.Ay.newInstance({numberOfComponents:3,values:e});n.setName("points");let i=a.Ay.newInstance({numberOfComponents:1,values:r});t.tris.getCABO().createVBO(i,"polys",s.YL.SURFACE,{points:n,cellOffset:0})}t.VBOBuildTime.modified()}}var _=(0,n.UI)(P,"vtkOpenGLVolumeMapper"),E={newInstance:_,extend:P};(0,p.c9)("vtkVolumeMapper",_)},16376:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>o,lD:()=>i,qO:()=>a});var n=r(73502);function i(e){return n.A.get(e)}function a(){return n.A.getAll()}let o=i},16410:(e,t,r)=>{"use strict";r.d(t,{A:()=>u});var n=r(70192),i=r(40812),a=r(31895),o=r(11185);r(3721);let{DefaultHistoryMemo:s}=n.BF.HistoryMemo;class l{get configurationTyped(){return this.configuration}constructor(e,t){this.handlesMultiTouchGestures=!1,this.isPrimary=!1;let r=l.mergeDefaultProps(l.defaults,t),{configuration:a={},supportedInteractionTypes:o,toolGroupId:s}=n.BF.deepMerge(r,e);this.toolGroupId=s,this.supportedInteractionTypes=o||[],this.configuration=Object.assign({},a),this.mode=i.A.Disabled}static mergeDefaultProps(e={},t){return t?n.BF.deepMerge(e,t):e}static isSpecifiedTargetId(e){return(t,{targetId:r})=>r.includes(e)}get toolName(){return this.getToolName()}getToolName(){return this.constructor.toolName}applyActiveStrategy(e,t){let{strategies:r,activeStrategy:n}=this.configuration;return r[n]?.call(this,e,t)}applyActiveStrategyCallback(e,t,r,...n){let{strategies:i,activeStrategy:a}=this.configuration;if(!i[a])throw Error(`applyActiveStrategyCallback: active strategy ${a} not found, check tool configuration or spellings`);return i[a][r]?.call(this,e,t,...n)}setConfiguration(e){this.configuration=n.BF.deepMerge(this.configuration,e)}setActiveStrategy(e){this.setConfiguration({activeStrategy:e})}_isTouchInteraction(e){let t=e?.detail?.eventName;return t===a.A.TOUCH_START||t===a.A.TOUCH_START_ACTIVATE||t===a.A.TOUCH_DRAG||t===a.A.TOUCH_END||t===a.A.TOUCH_TAP||t===a.A.TOUCH_PRESS}getTargetImageData(e){if(e.startsWith("imageId:")){let t=e.split("imageId:")[1],r=n.BF.imageIdToURI(t),i=n.BF.getViewportsWithImageURI(r);if(i&&i.length&&(i=i.filter(e=>e.getCurrentImageId()===t))&&i.length)return i[0].getImageData()}else if(e.startsWith("volumeId:")){let t=n.BF.getVolumeId(e),r=n.BF.getViewportsWithVolumeId(t);if(!r||!r.length)return;return r[0].getImageData(t)}else if(e.startsWith("videoId:")){let t=n.BF.imageIdToURI(e),r=n.BF.getViewportsWithImageURI(t);if(!r||!r.length)return;return r[0].getImageData()}else throw Error('getTargetIdImage: targetId must start with "imageId:" or "volumeId:"')}getTargetId(e,t){return this.getMeasurementTargets(e,t)[0]}getMeasurementTargets(e,t){let{targetsFilter:r,isPreferredTargetId:n}=this.configurationTyped;if(n&&t?.cachedStats){for(let[r,i]of Object.entries(t.cachedStats))if(n(e,{targetId:r,cachedStat:i}))return[r]}if(r)return r(this.getMeasurementTargetCandidates(e,t),{viewport:e,configuration:this.configurationTyped,data:t}).map(e=>e.targetId);let i=e.getViewReferenceId?.();if(i)return[i];throw Error("getMeasurementTargets: viewport must have a getViewReferenceId method")}getMeasurementTargetCandidates(e,t){let r=[],i=l.getViewportDisplaySets(e),a=e.getActors?.()||[];for(let o=0;oe.volumeId===s),m=p?.imageIds??(c.imageIds?.length?c.imageIds:void 0),h=p?.instance??l.getExemplarInstance(m);r.push({targetId:d,referencedId:s,representationUID:u,displaySet:p?.displaySet,displaySetUID:p?.displaySetUID,instance:h,modality:h?.Modality??c.metadata?.Modality,imageIds:m,index:o})}if(!r.length){let t=e.getViewReferenceId?.();if(t){let e=i[0];r.push({targetId:t,index:0,displaySet:e?.displaySet,displaySetUID:e?.displaySetUID,instance:e?.instance,modality:e?.modality,imageIds:e?.imageIds})}}return r}static getViewportDisplaySets(e){let t=e.getDisplaySets?.();if(!t?.length)return[];let r=n.BF.genericViewportDisplaySetMetadataProvider;return t.map(({displaySetId:e})=>{let t=r.get(r.VIEWPORT_V2_DISPLAY_SET,e),i=Array.isArray(t)?t:t?.imageIds,a=i?.map(e=>n.wx.get("displaySetModule",e)).find(e=>void 0!==e),o=a?.imageIds?.length?Array.from(a.imageIds):i,s=a??t,u=a?.instances?.[0]??l.getExemplarInstance(o);return{displaySetUID:a?.displaySetId??e,displaySet:s,instance:u,imageIds:o,volumeId:t?.volumeId,modality:u?.Modality??(o?.length?n.wx.get("generalSeriesModule",o[0])?.modality:void 0)}})}static getExemplarInstance(e){if(e?.length)return n.wx.get("instance",e[0])}static findCachedStatsTargetId(e,t){if(e?.cachedStats)return Object.keys(e.cachedStats).find(e=>e.startsWith("volumeId:")&&n.BF.getVolumeId(e)===t)}ensureCachedStatsTargets(e,t,r){let n=!1,i=e.cachedStats??={};for(let e of t){let t=i[e];(!t||r?.(t))&&(i[e]={},n=!0)}return n}undo(){this.doneEditMemo(),s.undo()}redo(){s.redo()}static createZoomPanMemo(e){if(!(0,n.sv)(e)||!(0,n.qV)(e))return;let t={pan:e.getPan(),zoom:e.getZoom()},r={restoreMemo:()=>{let r=e.getPan(),n=e.getZoom();e.setZoom(t.zoom),e.setPan(t.pan),"function"==typeof e.render&&e.render(),t.pan=r,t.zoom=n}};return s.push(r),r}doneEditMemo(){this.memo?.commitMemo?.()&&s.push(this.memo),this.memo=null}static startGroupRecording(){s.startGroupRecording()}static endGroupRecording(){s.endGroupRecording()}static calculateLengthInIndex(e,t,r=!1){let n=e?.scale||1,i=e?.scaleY||n,a=e?.scaleZ||n,o=0,s=t.length,l=+!r,u=r?t[s-1]:t[0];for(let e=l;e{"use strict";r.d(t,{A:()=>s});var n=r(39216);let i=new Map,a="imageRetrieveConfiguration",o={IMAGE_RETRIEVE_CONFIGURATION:a,clear:()=>{i.clear()},add:(e,t)=>{i.set(e,t)},clone:()=>new Map(i),restore:e=>{i.clear(),e.forEach((e,t)=>{i.set(t,e)})},get:(e,...t)=>{if(e===a)return t.map(e=>i.get(e)).find(e=>void 0!==e)}};(0,n.addProvider)(o.get.bind(o));let s=o},16857:(e,t,r)=>{"use strict";function n(e){return"number"==typeof e?e?e<0?-1:1:e==e?0:NaN:NaN}function i(e,t,r,a,o=!1){let[s,l]=e,[u,c]=t,[d,p]=r,[m,h]=a;if(o){let e=(s-u)*(p-h)-(l-c)*(d-m);if(1e-10>Math.abs(e))return;let t=((s-d)*(p-h)-(l-p)*(d-m))/e;return[s+t*(u-s),l+t*(c-l)]}let f=c-l,g=s-u,v=u*l-s*c,y=f*d+g*p+v,b=f*m+g*h+v;if(0!==y&&0!==b&&n(y)===n(b))return;let I=h-p,x=d-m,C=m*p-d*h,A=I*s+x*l+C,T=I*u+x*c+C;if(0!==A&&0!==T&&n(A)===n(T))return;let S=f*x-I*g;return[(g*C-x*v)/S,(I*v-f*C)/S]}r.d(t,{A:()=>i})},16950:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringWalker=t.Lazy=t.CompareCache=t.ObjectCache=t.FixedSizeSet=void 0,t.applyMixin=function(e,t,...r){Object.getOwnPropertyNames(t.prototype).forEach(n=>{if("constructor"!==n){if(-1!==r.indexOf(n)){let t=Object.getOwnPropertyDescriptor(e.prototype,n);t&&Object.defineProperty(e.prototype,"_"+n,t)}let i=Object.getOwnPropertyDescriptor(t.prototype,n);i&&Object.defineProperty(e.prototype,n,i)}})},t.applyDefaults=function e(t,r,n=!1){let i=u(t||{});return l(r,(t,r)=>{f(r)?i[t]=e(i[t],r,n):(n||void 0===i[t])&&(i[t]=r)}),i},t.forEachArray=function(e,t,r){e.forEach(t,r)},t.forEachObject=l,t.arrayLength=function(e){return m(e)?e.size:e.length},t.objectLength=function(e){return h(e)?e.size:Object.keys(e).length},t.getObjectValue=function(e,t){return h(e)?e.get(t):e[t]},t.removeObjectValue=function(e,t){h(e)?e.delete(t):delete e[t]},t.clone=u,t.isBoolean=function(e){return"boolean"==typeof e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isFunction=c,t.isObject=d,t.isArray=p,t.isSet=m,t.isMap=h,t.isEmpty=function(e){if(p(e))return!e.length;if(m(e))return!e.size;if(h(e))return!e.size;if(d(e)){for(let t in e)if(e.hasOwnProperty(t))return!1;return!0}return!1},t.isPlainObject=f,t.isIterable=function(e){return e&&"function"==typeof e[Symbol.iterator]},t.getValue=function(e){return c(e.valueOf)?e.valueOf():e},t.utf8Encode=function(e){let t=new Uint8Array(4*e.length),r=0;for(let n=0;n>6|192;else{if(i>55295&&i<56320){if(++n>=e.length)throw Error("Incomplete surrogate pair.");let a=e.charCodeAt(n);if(a<56320||a>57343)throw Error("Invalid surrogate character.");i=65536+((1023&i)<<10)+(1023&a),t[r++]=i>>18|240,t[r++]=i>>12&63|128}else t[r++]=i>>12|224;t[r++]=i>>6&63|128}t[r++]=63&i|128}return t.subarray(0,r)},t.utf8Decode=function(e){let t="",r=0;for(;r127)if(n>191&&n<224){if(r>=e.length)throw Error("Incomplete 2-byte sequence.");n=(31&n)<<6|63&e[r++]}else if(n>223&&n<240){if(r+1>=e.length)throw Error("Incomplete 3-byte sequence.");n=(15&n)<<12|(63&e[r++])<<6|63&e[r++]}else if(n>239&&n<248){if(r+2>=e.length)throw Error("Incomplete 4-byte sequence.");n=(7&n)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++]}else throw Error("Unknown multi-byte start.");if(n<=65535)t+=String.fromCharCode(n);else if(n<=1114111)n-=65536,t+=String.fromCharCode(n>>10|55296),t+=String.fromCharCode(1023&n|56320);else throw Error("Code point exceeds UTF-16 limit.")}return t};var n=r(92047);Object.defineProperty(t,"FixedSizeSet",{enumerable:!0,get:function(){return n.FixedSizeSet}});var i=r(40397);Object.defineProperty(t,"ObjectCache",{enumerable:!0,get:function(){return i.ObjectCache}});var a=r(17773);Object.defineProperty(t,"CompareCache",{enumerable:!0,get:function(){return a.CompareCache}});var o=r(88864);Object.defineProperty(t,"Lazy",{enumerable:!0,get:function(){return o.Lazy}});var s=r(5101);function l(e,t,r){if(h(e))e.forEach((e,n)=>t.call(r,n,e));else for(let n in e)e.hasOwnProperty(n)&&t.call(r,n,e[n])}function u(e){if(c(e))return e;if(p(e)){let t=[];for(let r of e)t.push(u(r));return t}if(!f(e))return e;{let t={};for(let r in e)if(e.hasOwnProperty(r)){let n=e[r];t[r]=u(n)}return t}}function c(e){return!!e&&"function"==typeof e}function d(e){let t=typeof e;return!!e&&("function"===t||"object"===t)}function p(e){return Array.isArray(e)}function m(e){return e instanceof Set}function h(e){return e instanceof Map}function f(e){if(d(e)){let t=Object.getPrototypeOf(e),r=t.constructor;return t&&r&&"function"==typeof r&&r instanceof r&&Function.prototype.toString.call(r)===Function.prototype.toString.call(Object)}return!1}Object.defineProperty(t,"StringWalker",{enumerable:!0,get:function(){return s.StringWalker}})},17042:(e,t,r)=>{"use strict";r.d(t,{cG:()=>A,e5:()=>j,cy:()=>X,Ay:()=>es,f0:()=>K,Jt:()=>L,_e:()=>G,o$:()=>s,Vy:()=>H,UI:()=>q,OE:()=>T,W2:()=>S,WL:()=>N,Ak:()=>U,V0:()=>k,eH:()=>z,Bl:()=>b});var n=r(11107),i=r(30756),a=class extends Array{push(){for(let e=0;e$,TYPED_ARRAYS:()=>A,VOID:()=>c,_capitalize:()=>O,algo:()=>j,capitalize:()=>w,chain:()=>X,debounce:()=>J,default:()=>es,event:()=>K,formatBytesToProperUnit:()=>_,formatNumbersWithThousandSeparator:()=>E,get:()=>L,getArray:()=>G,isVtkObject:()=>Y,keystore:()=>ee,measurePromiseExecution:()=>M,moveToProtected:()=>H,newInstance:()=>q,newTypedArray:()=>T,newTypedArrayFrom:()=>S,normalizeWheel:()=>eo,obj:()=>N,proxy:()=>en,proxyPropertyMapping:()=>ei,proxyPropertyState:()=>ea,requiredParam:()=>u,set:()=>U,setArray:()=>W,setGet:()=>k,setGetArray:()=>z,setImmediateVTK:()=>R,setLoggerFunction:()=>f,throttle:()=>Q,traverseInstanceTree:()=>Z,uncapitalize:()=>P,vtkDebugMacro:()=>y,vtkErrorMacro:()=>b,vtkInfoMacro:()=>v,vtkLogMacro:()=>g,vtkOnceErrorMacro:()=>C,vtkWarningMacro:()=>I}),l=0,u=e=>{throw Error(`Named parameter '${e}' is missing`)},c=Symbol("void"),d={};function p(){}["log","debug","info","warn","error","time","timeEnd","group","groupEnd"].forEach(e=>{d[e]=p});var m=globalThis.console&&globalThis.console.hasOwnProperty("log")?globalThis.console:d,h={debug:p,error:m.error||p,info:m.info||p,log:m.log||p,warn:m.warn||p};function f(e,t){h[e]&&(h[e]=t||p)}function g(...e){h.log(...e)}function v(...e){h.info(...e)}function y(...e){h.debug(...e)}function b(...e){h.error(...e)}function I(...e){h.warn(...e)}var x={};function C(e){x[e]||(h.error(e),x[e]=!0)}var A=Object.create(null);A.Float32Array=Float32Array,A.Float64Array=Float64Array,A.Uint8Array=Uint8Array,A.Int8Array=Int8Array,A.Uint16Array=Uint16Array,A.Int16Array=Int16Array,A.Uint32Array=Uint32Array,A.Int32Array=Int32Array,A.Uint8ClampedArray=Uint8ClampedArray;try{A.BigInt64Array=BigInt64Array,A.BigUint64Array=BigUint64Array}catch{}function T(e,...t){return new(A[e]||Float64Array)(...t)}function S(e,...t){return(A[e]||Float64Array).from(...t)}function w(e){return e.charAt(0).toUpperCase()+e.slice(1)}function O(e){return w("_"===e[0]?e.slice(1):e)}function P(e){return e.charAt(0).toLowerCase()+e.slice(1)}function _(e,t=2,r=1e3){let n=["TB","GB","MB","KB"],i=Number(e),a="B";for(;i>r;)i/=r,a=n.pop();return`${i.toFixed(t)} ${a}`}function E(e,t=" "){let r=[],n=e;for(;n>1e3;)r.push(`000${n%1e3}`.slice(-3)),n=Math.floor(n/1e3);return n>0&&r.push(n),r.reverse(),r.join(t)}function D(e){Object.keys(e).forEach(t=>{Array.isArray(e[t])&&(e[t]=[].concat(e[t]))})}function R(e){setTimeout(e,0)}function M(e,t){let r=performance.now();e.finally(()=>{t(performance.now()-r)})}function N(e={},t={}){D(t);let r=[];if(Number.isInteger(t.mtime)||(t.mtime=++l),"classHierarchy"in t){if(!(t.classHierarchy instanceof a)){let e=new a;for(let r=0;r!!t.deleted,e.modified=n=>{if(t.deleted)return void b("instance deleted - cannot call any method");n&&nt&&t(e)))},e.onModified=e=>{if(t.deleted)return b("instance deleted - cannot call any method"),null;let n=r.length;return r.push(e),Object.freeze({unsubscribe:function(){r[n]=null}})},e.getMTime=()=>t.mtime,e.isA=e=>{let r=t.classHierarchy.length;for(;r--;)if(t.classHierarchy[r]===e)return!0;return!1},e.getClassName=(e=0)=>t.classHierarchy[t.classHierarchy.length-1-e],e.set=(r={},n=!1,i=!1)=>{let a=!1;return Object.keys(r).forEach(o=>{let s=i?null:e[`set${w(o)}`];s&&Array.isArray(r[o])&&s.length>1?a=s(...r[o])||a:s?a=s(r[o])||a:(-1!==["mtime"].indexOf(o)||n||I(`Warning: Set value to model directly ${o}, ${r[o]}`),a=t[o]!==r[o]||a,t[o]=r[o])}),a},e.get=(...e)=>{if(!e.length)return t;let r={};return e.forEach(e=>{r[e]=t[e]}),r},e.getReferenceByName=e=>t[e],e.delete=()=>{Object.keys(t).forEach(e=>delete t[e]),r.forEach((e,t)=>{r[t]=null}),t.deleted=!0},e.getState=({preserveTypedArrays:r=!1}={})=>{if(t.deleted)return null;let n={preserveTypedArrays:r},i={...t,vtkClass:e.getClassName()};Object.keys(i).forEach(e=>{if(null===i[e]||void 0===i[e]||"_"===e[0])delete i[e];else if(i[e].isA)i[e]=i[e].getState(n);else if(Array.isArray(i[e]))i[e]=i[e].map(e=>e&&e.isA?e.getState(n):e);else{var t;t=i[e],Object.values(A).some(e=>t instanceof e)&&!r&&(i[e]=Array.from(i[e]))}});let a={};return Object.keys(i).sort().forEach(e=>{a[e]=i[e]}),a.mtime&&delete a.mtime,a},e.shallowCopy=(r,n=!1)=>{if(r.getClassName()!==e.getClassName())throw Error(`Cannot ShallowCopy ${r.getClassName()} into ${e.getClassName()}`);let i=r.get(),a=Object.keys(t).sort();Object.keys(i).sort().forEach(e=>{let r=a.indexOf(e);-1===r?n&&y(`add ${e} in shallowCopy`):a.splice(r,1),t[e]=i[e]}),a.length&&n&&y(`Untouched keys: ${a.join(", ")}`),e.modified()},e.toJSON=function(){return e.getState()},e}var V={object:(e,t,r)=>function(){return{...t[r.name]}}};function L(e,t,r){r.forEach(r=>{if("object"==typeof r){let n=V[r.type];n?e[`get${O(r.name)}`]=n(e,t,r):e[`get${O(r.name)}`]=()=>t[r.name]}else e[`get${O(r)}`]=()=>t[r]})}var B={enum(e,t,r){let n=`_on${O(r.name)}Changed`;return i=>{if("string"==typeof i){if(void 0!==r.enum[i])return t[r.name]!==r.enum[i]&&(t[r.name]=r.enum[i],e.modified(),!0);throw b(`Set Enum with invalid argument ${r}, ${i}`),RangeError("Set Enum with invalid string argument")}if("number"==typeof i){if(t[r.name]!==i){if(-1!==Object.keys(r.enum).map(e=>r.enum[e]).indexOf(i)){let a=t[r.name];return t[r.name]=i,t[n]?.(e,t,i,a),e.modified(),!0}throw b(`Set Enum outside numeric range ${r}, ${i}`),RangeError("Set Enum outside numeric range")}return!1}throw b(`Set Enum with invalid argument (String/Number) ${r}, ${i}`),TypeError("Set Enum with invalid argument (String/Number)")}},object(e,t,r){r.params?.length===1&&I('Setter of type "object" with a single "param" field is not supported');let n=`_on${O(r.name)}Changed`;return(...i)=>{let a;if(a=i.length>1&&r.params?.length?r.params.reduce((e,t,r)=>Object.assign(e,{[t]:i[r]}),{}):i[0],!o(t[r.name],a)){let i=t[r.name];return t[r.name]=a,t[n]?.(e,t,a,i),e.modified(),!0}return!1}}};function F(e){if("object"==typeof e){let t=B[e.type];if(t)return(r,n)=>t(r,n,e);throw b(`No setter for field ${e}`),TypeError("No setter for field")}return function(t,r){let n=`_on${O(e)}Changed`;return function(i){if(r.deleted)return b("instance deleted - cannot call any method"),!1;if(r[e]!==i){let a=r[e.name];return r[e]=i,r[n]?.(t,r,i,a),t.modified(),!0}return!1}}}function U(e,t,r){r.forEach(r=>{"object"==typeof r?e[`set${O(r.name)}`]=F(r)(e,t):e[`set${O(r)}`]=F(r)(e,t)})}function k(e,t,r){L(e,t,r),U(e,t,r)}function G(e,t,r){r.forEach(r=>{e[`get${O(r)}`]=()=>t[r]?Array.from(t[r]):t[r],e[`get${O(r)}ByReference`]=()=>t[r]})}function W(e,t,r,n,i){r.forEach(r=>{if(t[r]&&n&&t[r].length!==n)throw RangeError(`Invalid initial number of values for array (${r})`);let a=`_on${O(r)}Changed`;e[`set${O(r)}`]=(...o)=>{let s;if(t.deleted)return b("instance deleted - cannot call any method"),!1;let l=o,u=!1;if(1===l.length&&(null==l[0]||l[0].length>=0)&&(l=l[0],u=!0),null==l)s=t[r]!==l;else{if(n&&l.length!==n)if(l.length{let n=t[r];e.forEach((e,t)=>{n[t]=e})}})}function z(e,t,r,n,i){G(e,t,r),W(e,t,r,n,i)}function H(e,t,r){for(let e=0;e=t.numberOfInputs?void b(`algorithm ${e.getClassName()} only has ${t.numberOfInputs} input ports. To add more input ports, use addInputData()`):void((t.inputData[n]!==r||t.inputConnection[n])&&(t.inputData[n]=r,t.inputConnection[n]=null,e.modified&&e.modified()))}function o(r,n=0){if(t.deleted)return void b("instance deleted - cannot call any method");if(n>=t.numberOfInputs){let r=`algorithm ${e.getClassName()} only has `;b(r+=`${t.numberOfInputs} input ports. To add more input ports, use addInputConnection()`);return}t.inputData[n]=null,t.inputConnection[n]=r}function s(){let e=t.numberOfInputs;for(;e&&!t.inputData[e-1]&&!t.inputConnection[e-1];)e--;return e===t.numberOfInputs&&t.numberOfInputs++,e}function l(r=0){return t.deleted?(b("instance deleted - cannot call any method"),null):(e.shouldUpdate()&&e.update(),t.output[r])}if(t.inputData?t.inputData=t.inputData.map(i.A):t.inputData=[],t.inputConnection?t.inputConnection=t.inputConnection.map(i.A):t.inputConnection=[],t.output?t.output=t.output.map(i.A):t.output=[],t.inputArrayToProcess?t.inputArrayToProcess=t.inputArrayToProcess.map(i.A):t.inputArrayToProcess=[],t.numberOfInputs=r,e.shouldUpdate=()=>{let r=e.getMTime(),i=1/0,a=n;for(;a--;){if(!t.output[a]||t.output[a].isDeleted())return!0;let e=t.output[a].getMTime();if(ei)return!0;return!1},t.numberOfInputs){let r=t.numberOfInputs;for(;r--;)t.inputData.push(null),t.inputConnection.push(null);e.setInputData=a,e.setInputConnection=o,e.addInputData=function(e){if(t.deleted)return void b("instance deleted - cannot call any method");a(e,s())},e.addInputConnection=function(e){if(t.deleted)return void b("instance deleted - cannot call any method");o(e,s())},e.getInputData=function(e=0){return t.inputConnection[e]&&(t.inputData[e]=t.inputConnection[e]()),t.inputData[e]},e.getInputConnection=function(e=0){return t.inputConnection[e]}}n&&(e.getOutputData=l,e.getOutputPort=function(t=0){let r=()=>l(t);return r.filter=e,r}),e.update=()=>{let r=[];if(t.numberOfInputs){let n=0;for(;nt.numberOfInputs,e.getNumberOfOutputPorts=()=>n||t.output.length,e.getInputArrayToProcess=e=>{let r=t.inputArrayToProcess[e],n=t.inputData[e];return r&&n?n[`get${r.fieldAssociation}`]().getArray(r.arrayName):null},e.setInputArrayToProcess=(e,r,n,i="Scalars")=>{for(;t.inputArrayToProcess.lengthn.apply(e,arguments),1-i);else if(n.apply(e,arguments)===$)break}}},e[`on${O(r)}`]=(e,i=0)=>{if(!e.apply)return console.error(`Invalid callback for event ${r}`),null;if(t.deleted)return b("instance deleted - cannot call any method"),null;let s=a++;return n.push([s,e,i]),n.sort((e,t)=>t[2]-e[2]),Object.freeze({unsubscribe:function(){o(s)}})},e.delete=()=>{i(),n.forEach(([e])=>o(e))}}function q(e,t){let r=(t={})=>{let r={};return e(r,{},t),Object.freeze(r)};return t&&i.A.register(t,r),r}function X(...e){return(...t)=>e.filter(e=>!!e).map(e=>e(...t))}function Y(e){return e&&e.isA&&e.isA("vtkObject")}function Z(e,t,r=[],n=[]){if(Y(e)){if(n.indexOf(e)>=0)return r;n.push(e);let i=t(e);void 0!==i&&r.push(i);let a=e.get();Object.keys(a).forEach(e=>{let i=a[e];Array.isArray(i)?i.forEach(e=>{Z(e,t,r,n)}):Z(i,t,r,n)})}return r}function J(e,t,r){let n,i=(...i)=>{let a=this,o=r&&!n;clearTimeout(n),n=setTimeout(()=>{n=null,r||e.apply(a,i)},t),o&&e.apply(a,i)};return i.cancel=()=>clearTimeout(n),i}function Q(e,t){let r=!1,n=null;function i(){r=!1,null!==n&&(a(...n),n=null)}function a(...o){if(r){n=o;return}r=!0,e(...o),setTimeout(i,t)}return a}function ee(e,t,r={}){t.keystore=Object.assign(t.keystore||{},r),e.setKey=(e,r)=>{t.keystore[e]=r},e.getKey=e=>t.keystore[e],e.getAllKeys=()=>Object.keys(t.keystore),e.deleteKey=e=>delete t.keystore[e],e.clearKeystore=()=>e.getAllKeys().forEach(e=>delete t.keystore[e])}var et=1,er="__root__";function en(e,t){ee(e,t);let r=e.delete;t.proxyId=`${et++}`,t.ui=JSON.parse(JSON.stringify(t.ui||[])),L(e,t,["proxyId","proxyGroup","proxyName"]),k(e,t,["proxyManager"]);let n={},i={};function a(e,t){i[t]||(i[t]=[]);let r=i[t];for(let t=0;t{t.ui=JSON.parse(JSON.stringify(r||[])),Object.keys(n).forEach(e=>delete n[e]),Object.keys(i).forEach(e=>delete i[e]),a(t.ui,er),e.modified()},e.updateProxyProperty=(e,t)=>{let r=n[e];r?Object.assign(r,t):n[e]={...t}},e.activate=()=>{if(t.proxyManager){let r=`setActive${O(e.getProxyGroup().slice(0,-1))}`;t.proxyManager[r]&&t.proxyManager[r](e)}},t.propertyLinkSubscribers={},e.registerPropertyLinkForGC=(e,r)=>{r in t.propertyLinkSubscribers||(t.propertyLinkSubscribers[r]=[]),t.propertyLinkSubscribers[r].push(e)},e.gcPropertyLinks=r=>{let n=t.propertyLinkSubscribers[r]||[];for(;n.length;)n.pop().unbind(e)},t.propertyLinkMap={},e.getPropertyLink=(e,r=!1)=>{if(t.propertyLinkMap[e])return t.propertyLinkMap[e];let n=null,i=[],a=0,o=!1;function s(r,l=!1){if(o)return null;let u=[],c=null;for(a=i.length;a--;){let e=i[a];e.instance===r?c=e:u.push(e)}if(!c)return null;let d=c.instance[`get${O(c.propertyName)}`]();if(!function(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;rl(r,n)}},unbind:l,unsubscribe:function(){for(;i.length;)i.pop().subscription.unsubscribe()},persistent:r};return t.propertyLinkMap[e]=u,u},e.listPropertyNames=()=>o().map(e=>e.name),e.getPropertyByName=e=>o().find(t=>t.name===e),e.getPropertyDomainByName=e=>(n[e]||{}).domain,e.getProxySection=()=>({id:t.proxyId,name:t.proxyGroup,ui:t.ui,properties:o()}),e.delete=()=>{let n=Object.keys(t.propertyLinkMap),i=n.length;for(;i--;)t.propertyLinkMap[n[i]].unsubscribe();Object.keys(t.propertyLinkSubscribers).forEach(e.gcPropertyLinks),r()},e.getState=()=>null,R(function(){if(t.links)for(let r=0;r{for(;i.length;)i.pop().unsubscribe();n()}}function ea(e,t,r={},n={}){t.this=e;let i=Object.keys(n),a=i.length;for(;a--;){let o=i[a];t[o]=n[o];let s=r[o];e[`set${O(o)}`]=r=>{r!==t[o]&&(t[o]=r,function(e){let r=Object.keys(e),n=r.length;for(;n--;){let i=r[n];t[i].set(e[i])}}(s[r]),e.modified())}}i.length&&L(e,t,i)}function eo(e){let t=0,r=0,n=0,i=0;return"detail"in e&&(r=e.detail),"wheelDelta"in e&&(r=-e.wheelDelta/120),"wheelDeltaY"in e&&(r=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=r,r=0),n=10*t,i=10*r,"deltaY"in e&&(i=e.deltaY),"deltaX"in e&&(n=e.deltaX),(n||i)&&e.deltaMode&&(1===e.deltaMode?(n*=40,i*=40):(n*=800,i*=800)),n&&!t&&(t=n<1?-1:1),i&&!r&&(r=i<1?-1:1),{spinX:t,spinY:r||t,pixelX:n,pixelY:i||n}}var es={algo:j,capitalize:w,chain:X,debounce:J,enumToString:function(e,t){return Object.keys(e).find(r=>e[r]===t)},event:K,EVENT_ABORT:$,formatBytesToProperUnit:_,formatNumbersWithThousandSeparator:E,get:L,getArray:G,getCurrentGlobalMTime:function(){return l},isVtkObject:Y,keystore:ee,measurePromiseExecution:M,moveToProtected:H,newInstance:q,newTypedArray:T,newTypedArrayFrom:S,normalizeWheel:eo,obj:N,proxy:en,proxyPropertyMapping:ei,proxyPropertyState:ea,safeArrays:D,set:U,setArray:W,setGet:k,setGetArray:z,setImmediate:R,setLoggerFunction:f,throttle:Q,traverseInstanceTree:Z,TYPED_ARRAYS:A,uncapitalize:P,VOID:c,vtkDebugMacro:y,vtkErrorMacro:b,vtkInfoMacro:v,vtkLogMacro:g,vtkOnceErrorMacro:C,vtkWarningMacro:I,objectSetterMap:B,requiredParam:u}},17191:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(50923);function i(e,t,r,i){let a=n.vt();n.$A(a,t,e);let o=n.fA(...r),s=n.fA(...i),l=n.vt();n.Re(l,o,s);let u=n.Bw(l);if(u<1e-4)return{worldWidth:0,worldHeight:0};let c=n.Om(l,a)/(u*n.Bw(a));return{worldWidth:Math.sqrt(1-c*c)*u,worldHeight:c*u}}},17242:(e,t,r)=>{"use strict";r.d(t,{gm:()=>n.g});var n=r(56099)},17329:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.traversal_filter=function(e,t){if(e._activeFlag)throw new i.InvalidStateError;let r=t._nodeType-1;if((e.whatToShow&1<{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.customElement_isValidCustomElementName=function(e){return!(!r.test(e)||n.has(e))},t.customElement_isValidElementName=function(e){return i.has(e)},t.customElement_isVoidElementName=function(e){return a.has(e)},t.customElement_isValidShadowHostName=function(e){return o.has(e)},t.customElement_enqueueACustomElementUpgradeReaction=function(e,t){},t.customElement_enqueueACustomElementCallbackReaction=function(e,t,r){},t.customElement_upgrade=function(e,t){},t.customElement_tryToUpgrade=function(e){},t.customElement_lookUpACustomElementDefinition=function(e,t,r,n){return null};let r=/[a-z]([\0-\t\x2D\._a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*-([\0-\t\x2D\._a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*/,n=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]),i=new Set(["article","aside","blockquote","body","div","footer","h1","h2","h3","h4","h5","h6","header","main","nav","p","section","span"]),a=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]),o=new Set(["article","aside","blockquote","body","div","footer","h1","h2","h3","h4","h5","h6","header","main","nav","p","section","span"])},17673:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var n=r(91336),i=r(31677),a=r(7399),o=r(59061),s=r(41602);function l(e,t){if(e.length<3)return[];if(t.length<3)return[e.slice()];let r=t.slice();if((0,s.A)(e,t))return[];let l=(0,i.A)(e),u=(0,i.A)(r);Math.sign(l)===Math.sign(u)&&Math.abs(u)>a.p8&&r.reverse();let c=[];for(let t=0;t{let n=[],i=0;for(let o=0;o(0===t?e.seg1Idx:e.seg2Idx)===o).sort((e,r)=>(0===t?e.alpha1:e.alpha2)-(0===t?r.alpha1:r.alpha2)))){if(n.length>0&&(0,a.Sk)(n[n.length-1].coordinates,e.coord)){n[n.length-1].isIntersection||(n[n.length-1].isIntersection=!0,n[n.length-1].intersectionInfo=e,n[n.length-1].alpha=0===t?e.alpha1:e.alpha2);continue}n.push({id:`${t}_i${i++}`,coordinates:e.coord,type:a.n7.Intersection,originalPolyIndex:t,next:null,prev:null,isIntersection:!0,visited:!1,alpha:0===t?e.alpha1:e.alpha2,intersectionInfo:e})}}let o=[];if(n.length>0){o.push(n[0]);for(let e=1;e0)for(let e=0;e{if(e.isIntersection){let r=e.intersectionInfo,i=m.find(t=>t.isIntersection&&(0,a.Sk)(t.coordinates,e.coordinates)&&t.intersectionInfo.seg1Idx===r.seg1Idx&&t.intersectionInfo.seg2Idx===r.seg2Idx);if(i){e.partnerNode=i,i.partnerNode=e;let r=e.prev.coordinates,s=e.coordinates,l=i.next.coordinates;n.Re(n.vt(),s,r),n.Re(n.vt(),l,s);let u=[(e.prev.coordinates[0]+e.coordinates[0])/2,(e.prev.coordinates[1]+e.coordinates[1])/2];(0,o.A)(t,u)?e.intersectionDir=a.lG.Exiting:e.intersectionDir=a.lG.Entering}else e.isIntersection=!1}}),p.forEach(e=>delete e.intersectionInfo),m.forEach(e=>delete e.intersectionInfo);let h=[];for(let e=0;eu){console.warn("Subtraction: Max iterations reached, possible infinite loop.");break}i.visited=!0,0!==n.length&&(0,a.Sk)(n[n.length-1],i.coordinates)||n.push(i.coordinates),i.isIntersection&&(s?i.intersectionDir===a.lG.Entering&&i.partnerNode&&(i=i.partnerNode,s=!1):i.partnerNode?(i=i.partnerNode,s=!0):console.warn("Subtraction: Intersection on source without partner.")),i=i.next}while(i!==r||!s);n.length>=3&&((0,a.Sk)(n[0],n[n.length-1])&&n.pop(),n.length>=3&&h.push(n))}return h}},17773:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CompareCache=void 0;class r{_limit;_items=new Map;constructor(e=1e3){this._limit=e}check(e,t){if(this._items.get(e)===t)return!0;if(this._items.get(t)===e)return!1;let r=.5>Math.random();if(r?this._items.set(e,t):this._items.set(t,e),this._items.size>this._limit){let e=this._items.keys().next();e.done||this._items.delete(e.value)}return r}}t.CompareCache=r},17774:(e,t,r)=>{"use strict";var n;r.d(t,{A:()=>i}),function(e){e.NO_DATA="noData",e.LOADING="loading",e.PRE_RENDER="preRender",e.NEEDS_RENDER="needsRender",e.RESIZE="resize",e.RENDERED="rendered"}(n||(n={}));let i=n},17935:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(31320);let i=n.BF.AR,{Le:a}=n.BF},17964:(e,t,r)=>{"use strict";r.d(t,{wk:()=>i}),r(70192);var n=r(42279);n.A;let i={isInteractingWithTool:!1,isMultiPartToolActive:!1,tools:{},toolGroups:[],synchronizers:[],svgNodeCache:n.A,enabledElements:[],handleRadius:6}},18025:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(39216);let i="genericViewportDisplaySet",a=new Map,o={VIEWPORT_V2_DISPLAY_SET:i,add(e,t){a.set(e,t)},get(e,t){if(e===i)return a.get(t)},remove(e){a.delete(e)},clear(){a.clear()}};(0,n.addProvider)(o.get);let s=o},18110:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(16376),i=r(66384);function a(e){let t=(0,n.qO)(),r=[];return t.forEach(t=>{t.getViewports().filter(i.hz).forEach(t=>{t.hasImageURI(e)&&r.push(t)})}),r}},18236:(e,t,r)=>{"use strict";function n(e){return e.segmentOrder?.length?[...e.segmentOrder]:Object.keys(e.segments).map(Number).sort((e,t)=>e-t)}function i(e){return`${e}-storage-0`}function a(e){let t=e.representationData.Labelmap;if(!t)return;t.labelmaps||={};let r=function(e,t){let r=t.primaryLabelmapId;if(r&&t.labelmaps?.[r])return r;let n=Object.keys(t.labelmaps??{})[0]??i(e.segmentationId);return t.primaryLabelmapId=n,n}(e,t);return t.labelmaps[r]||=function(e,t,r=i(e.segmentationId)){let n={labelmapId:r,storageKind:t.volumeId?"volume":"stack",labelToSegmentIndex:{}};return null!=t.volumeId&&(n.volumeId=t.volumeId),null!=t.referencedVolumeId&&(n.referencedVolumeId=t.referencedVolumeId),null!=t.referencedImageIds&&(n.referencedImageIds=t.referencedImageIds),null!=t.imageIds&&(n.imageIds=t.imageIds),n}(e,t,r),t.segmentBindings||={},t.sourceRepresentationName||="binaryLabelmap",n(e).forEach(e=>{t.segmentBindings[e]||={labelmapId:r,labelValue:e}}),Object.values(t.labelmaps).forEach(e=>{e.labelToSegmentIndex={}}),Object.entries(t.segmentBindings).forEach(([e,r])=>{let n=t.labelmaps[r.labelmapId];n&&(n.labelToSegmentIndex||={},n.labelToSegmentIndex[r.labelValue]=Number(e))}),t}r.d(t,{gV:()=>n,uk:()=>a})},18459:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>p});var n=r(17042),i=r(85643),a=r(11701),o=r(85250),s=r(50923),l=r(11480),u=r(66368);let c={isPerformingCoordinateTransformation:!1};function d(e,t,r={}){Object.assign(t,c,r),i.Ay.extend(e,t,r),n.Ay.setGet(e,t,["isPerformingCoordinateTransformation"]),function(e,t){t.classHierarchy.push("vtkSlabCamera");let r=o.identity(new Float64Array(16)),n=new Float64Array(3);e.getProjectionMatrix=(e,i,c)=>{let d=o.create();if(t.projectionMatrix){let e=1/t.physicalScale;return s.hZ(n,e,e,e),o.copy(d,t.projectionMatrix),o.scale(d,d,n),o.transpose(d,d),d}o.identity(r);let p=t.clippingRange[0],m=t.clippingRange[1];t.isPerformingCoordinateTransformation&&(p=t.distance,m=t.distance+.1);let h=m-p,f=[p+(i+1)*h/2,p+(c+1)*h/2];if(t.parallelProjection){let n=t.parallelScale*e,i=t.parallelScale,a=(t.windowCenter[0]-1)*n,s=(t.windowCenter[0]+1)*n,l=(t.windowCenter[1]-1)*i,u=(t.windowCenter[1]+1)*i;o.ortho(r,a,s,l,u,f[0],f[1]),o.transpose(r,r)}else if(t.useOffAxisProjection)throw Error("Off-Axis projection is not supported at this time");else{let n,i,o=Math.tan(a.Ay.radiansFromDegrees(t.viewAngle)/2);!0===t.useHorizontalViewAngle?(n=p*o,i=p*o/e):(n=p*o*e,i=p*o);let s=(t.windowCenter[0]-1)*n,l=(t.windowCenter[0]+1)*n,u=(t.windowCenter[1]-1)*i,c=(t.windowCenter[1]+1)*i,d=f[0],m=f[1];r[0]=2*d/(l-s),r[5]=2*d/(c-u),r[2]=(s+l)/(l-s),r[6]=(u+c)/(c-u),r[10]=-(d+m)/(m-d),r[14]=-1,r[11]=-2*d*m/(m-d),r[15]=0}let[g,v]=(0,u.x)(t.aspectRatio);if(1!==g||1!==v){let e=(0,l.L)([g,v]);o.multiply(r,e,r)}return o.copy(d,r),d}}(e,t)}let p={newInstance:n.Ay.newInstance(d,"vtkSlabCamera"),extend:d}},18533:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>y});var n=r(17042),i=r(54914),a=r(11701),o=r(10355),s=r(56109),l=r(42021),{InterpolationType:u,OpacityMode:c,FilterMode:d,ColorMixPreset:p}=l.Ay,{vtkErrorMacro:m}=n.Ay;function h(e,t,r={}){if(Object.assign(t,{colorMixPreset:p.DEFAULT,independentComponents:!0,interpolationType:u.FAST_LINEAR,shade:!1,ambient:.1,diffuse:.7,specular:.2,specularPower:10,useLabelOutline:!1,labelOutlineThickness:[1],labelOutlineOpacity:1,ipScalarRange:[-1e6,1e6],filterMode:d.OFF,preferSizeOverAccuracy:!1,computeNormalFromOpacity:!1,volumetricScatteringBlending:0,globalIlluminationReach:0,anisotropy:0,localAmbientOcclusion:!1,LAOKernelSize:15,LAOKernelRadius:7,updatedExtents:[],...r}),n.Ay.obj(e,t),!t.componentData){t.componentData=[];for(let e=0;e<4;++e)t.componentData.push({colorChannels:1,grayTransferFunction:null,rGBTransferFunction:null,scalarOpacity:null,scalarOpacityUnitDistance:1,opacityMode:c.FRACTIONAL,gradientOpacityMinimumValue:0,gradientOpacityMinimumOpacity:0,gradientOpacityMaximumValue:1,gradientOpacityMaximumOpacity:1,useGradientOpacity:!1,componentWeight:1,forceNearestInterpolation:!1})}n.Ay.setGet(e,t,["colorMixPreset","independentComponents","interpolationType","shade","ambient","diffuse","specular","specularPower","useLabelOutline","labelOutlineOpacity","filterMode","preferSizeOverAccuracy","computeNormalFromOpacity","volumetricScatteringBlending","globalIlluminationReach","anisotropy","localAmbientOcclusion","LAOKernelSize","LAOKernelRadius","updatedExtents"]),n.Ay.setGetArray(e,t,["ipScalarRange"],2),n.Ay.setGetArray(e,t,["labelOutlineThickness"]);t.classHierarchy.push("vtkVolumeProperty");let i={...e};e.getMTime=()=>{let e,r=t.mtime;for(let n=0;n<4;n++)1===t.componentData[n].colorChannels?t.componentData[n].grayTransferFunction&&(r=r>(e=t.componentData[n].grayTransferFunction.getMTime())?r:e):3===t.componentData[n].colorChannels&&t.componentData[n].rGBTransferFunction&&(r=r>(e=t.componentData[n].rGBTransferFunction.getMTime())?r:e),t.componentData[n].scalarOpacity&&(r=r>(e=t.componentData[n].scalarOpacity.getMTime())?r:e),t.componentData[n].gradientOpacity&&!t.componentData[n].disableGradientOpacity&&(r=r>(e=t.componentData[n].gradientOpacity.getMTime())?r:e);return r},e.getColorChannels=e=>e<0||e>3?(m("Bad index - must be between 0 and 3"),0):t.componentData[e].colorChannels,e.setGrayTransferFunction=(r=0,n=null)=>{let i=!1;return t.componentData[r].grayTransferFunction!==n&&(t.componentData[r].grayTransferFunction=n,i=!0),1!==t.componentData[r].colorChannels&&(t.componentData[r].colorChannels=1,i=!0),i&&e.modified(),i},e.getGrayTransferFunction=(r=0)=>(null===t.componentData[r].grayTransferFunction&&(t.componentData[r].grayTransferFunction=o.Ay.newInstance(),t.componentData[r].grayTransferFunction.addPoint(0,0),t.componentData[r].grayTransferFunction.addPoint(1024,1),1!==t.componentData[r].colorChannels&&(t.componentData[r].colorChannels=1),e.modified()),t.componentData[r].grayTransferFunction),e.setRGBTransferFunction=(r=0,n=null)=>{let i=!1;return t.componentData[r].rGBTransferFunction!==n&&(t.componentData[r].rGBTransferFunction=n,i=!0),3!==t.componentData[r].colorChannels&&(t.componentData[r].colorChannels=3,i=!0),i&&e.modified(),i},e.getRGBTransferFunction=(r=0)=>(null===t.componentData[r].rGBTransferFunction&&(t.componentData[r].rGBTransferFunction=s.Ay.newInstance(),t.componentData[r].rGBTransferFunction.addRGBPoint(0,0,0,0),t.componentData[r].rGBTransferFunction.addRGBPoint(1024,1,1,1),3!==t.componentData[r].colorChannels&&(t.componentData[r].colorChannels=3),e.modified()),t.componentData[r].rGBTransferFunction),e.setScalarOpacity=(r=0,n=null)=>t.componentData[r].scalarOpacity!==n&&(t.componentData[r].scalarOpacity=n,e.modified(),!0),e.getScalarOpacity=(r=0)=>(null===t.componentData[r].scalarOpacity&&(t.componentData[r].scalarOpacity=o.Ay.newInstance(),t.componentData[r].scalarOpacity.addPoint(0,1),t.componentData[r].scalarOpacity.addPoint(1024,1),e.modified()),t.componentData[r].scalarOpacity),e.setComponentWeight=(r=0,n=1)=>{if(r<0||r>=4)return m("Invalid index"),!1;let i=Math.min(1,Math.max(0,n));return t.componentData[r].componentWeight!==i&&(t.componentData[r].componentWeight=i,e.modified(),!0)},e.getComponentWeight=(e=0)=>e<0||e>=4?(m("Invalid index"),0):t.componentData[e].componentWeight,e.setInterpolationTypeToNearest=()=>e.setInterpolationType(u.NEAREST),e.setInterpolationTypeToLinear=()=>e.setInterpolationType(u.LINEAR),e.setInterpolationTypeToFastLinear=()=>e.setInterpolationType(u.FAST_LINEAR),e.getInterpolationTypeAsString=()=>n.Ay.enumToString(u,t.interpolationType),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode","forceNearestInterpolation"].forEach(r=>{let i=n.Ay.capitalize(r);e[`set${i}`]=(n,i)=>t.componentData[n][`${r}`]!==i&&(t.componentData[n][`${r}`]=i,e.modified(),!0)}),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode","forceNearestInterpolation"].forEach(r=>{let i=n.Ay.capitalize(r);e[`get${i}`]=e=>t.componentData[e][`${r}`]}),e.setAverageIPScalarRange=(t,r)=>{console.warn("setAverageIPScalarRange is deprecated use setIpScalarRange"),e.setIpScalarRange(t,r)},e.getFilterModeAsString=()=>n.Ay.enumToString(d,t.filterMode),e.setFilterModeToOff=()=>{e.setFilterMode(d.OFF)},e.setFilterModeToNormalized=()=>{e.setFilterMode(d.NORMALIZED)},e.setFilterModeToRaw=()=>{e.setFilterMode(d.RAW)},e.setGlobalIlluminationReach=e=>i.setGlobalIlluminationReach((0,a.L3)(e,0,1)),e.setVolumetricScatteringBlending=e=>i.setVolumetricScatteringBlending((0,a.L3)(e,0,1)),e.setAnisotropy=e=>i.setAnisotropy((0,a.L3)(e,-.99,.99)),e.setLAOKernelSize=e=>i.setLAOKernelSize((0,a.RI)((0,a.L3)(e,1,32))),e.setLAOKernelRadius=e=>i.setLAOKernelRadius(e>=1?e:1)}var f={newInstance:n.Ay.newInstance(h,"vtkVolumeProperty"),extend:h,...l.Ay},g={mapper:null};function v(e,t,r={}){Object.assign(t,g,r),i.Ay.extend(e,t,r),t.boundsMTime={},n.Ay.obj(t.boundsMTime),n.Ay.setGet(e,t,["mapper"]),t.classHierarchy.push("vtkVolume"),e.getVolumes=()=>[e],e.makeProperty=f.newInstance,e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let r=t.mapper.getMTime();e=r>e?r:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),e=(r=t.mapper.getInput().getMTime())>e?r:e)}return e}}var y={newInstance:n.Ay.newInstance(v,"vtkVolume"),extend:v}},18579:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ParentNodeImpl=void 0;let n=r(79663),i=r(47518);class a{get children(){return(0,i.create_htmlCollection)(n.Cast.asNode(this))}get firstElementChild(){let e=n.Cast.asNode(this)._firstChild;for(;e;)if(n.Guard.isElementNode(e))return e;else e=e._nextSibling;return null}get lastElementChild(){let e=n.Cast.asNode(this)._lastChild;for(;e;)if(n.Guard.isElementNode(e))return e;else e=e._previousSibling;return null}get childElementCount(){let e=0;for(let t of n.Cast.asNode(this)._children)n.Guard.isElementNode(t)&&e++;return e}prepend(...e){let t=n.Cast.asNode(this),r=(0,i.parentNode_convertNodesIntoANode)(e,t._nodeDocument);(0,i.mutation_preInsert)(r,t,t._firstChild)}append(...e){let t=n.Cast.asNode(this),r=(0,i.parentNode_convertNodesIntoANode)(e,t._nodeDocument);(0,i.mutation_append)(r,t)}querySelector(e){let t=n.Cast.asNode(this),r=(0,i.selectors_scopeMatchASelectorsString)(e,t);return 0===r.length?null:r[0]}querySelectorAll(e){let t=n.Cast.asNode(this),r=(0,i.selectors_scopeMatchASelectorsString)(e,t);return(0,i.create_nodeListStatic)(t,r)}}t.ParentNodeImpl=a},18695:(e,t,r)=>{"use strict";function n(e){return Array.isArray(e)?e.some(e=>Number.isNaN(e)):Number.isNaN(e)}r.d(t,{A:()=>n})},19012:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var n=r(22911),i=r(24887),a=r(3793),o=r(20549),s=r(54268);function l(e,t,r={}){let u=s.Ay.getVolume(e);if(!u)throw Error(`Referenced volume with id ${e} does not exist.`);let{metadata:c,spacing:d,direction:p,dimensions:m}=u,{minX:h,maxX:f,minY:g,maxY:v,minZ:y,maxZ:b}=t,I=[Math.min(h,f),Math.min(g,v),Math.min(y,b)],x=(0,i.A)(u.imageData,I),C=[Math.abs(f-h)+1,Math.abs(v-g)+1,Math.abs(b-y)+1],{targetBuffer:A}=r,T={metadata:c,dimensions:C,spacing:d,origin:x,direction:p,targetBuffer:A,scalarData:A?.type==="Float32Array"?new Float32Array(C[0]*C[1]*C[2]):void 0},S=(0,o.createLocalVolume)((0,a.A)(),T),w=S.voxelManager.getCompleteScalarDataArray(),O=C[0]*C[1],P=m[0]*m[1],_=u.voxelManager.getCompleteScalarDataArray();for(let e=0;e{"use strict";r.d(t,{Ay:()=>k});var n=r(30756),i=r(17042),a=r(73416),o=r(40815),s={array:null,maxId:0,extend:0},l={newInstance:i.Ay.newInstance(function(e,t,r={}){Object.assign(t,s,r),i.Ay.obj(e,t),t.classHierarchy.push("vtkCellLinks"),e.buildLinks=r=>{let n=r.getPoints().getNumberOfPoints(),i=r.getNumberOfCells(),a=new Uint32Array(n);if(r.isA("vtkPolyData")){for(let t=0;t{e.incrementLinkCount(t)})}e.allocateLinks(n),t.maxId=n-1;for(let t=0;t{e.insertCellReference(r,a[r]++,t)})}}else{for(let t=0;t{e.incrementLinkCount(t)});e.allocateLinks(n),t.maxId=n-1;for(let t=0;t{e.insertCellReference(r,a[r]++,t)})}},e.allocate=(e,r=1e3)=>{t.array=Array(e).fill().map(()=>({ncells:0,cells:null})),t.extend=r,t.maxId=-1},e.initialize=()=>{t.array=null},e.getLink=e=>t.array[e],e.getNcells=e=>t.array[e].ncells,e.getCells=e=>t.array[e].cells,e.insertNextPoint=e=>{t.array.push({ncells:e,cells:Array(e)}),++t.maxId},e.insertNextCellReference=(e,r)=>{t.array[e].cells[t.array[e].ncells++]=r},e.deletePoint=e=>{t.array[e].ncells=0,t.array[e].cells=null},e.removeCellReference=(e,r)=>{t.array[r].cells=t.array[r].cells.filter(t=>t!==e),t.array[r].ncells=t.array[r].cells.length},e.addCellReference=(e,r)=>{t.array[r].cells[t.array[r].ncells++]=e},e.resizeCellList=(e,r)=>{t.array[e].cells.length=r},e.squeeze=()=>{var e=t.maxId+1;let r=e;for(e>=t.array.length&&(r+=t.array.length);r>t.array.length;)t.array.push({ncells:0,cells:null});t.array.length=r},e.reset=()=>{t.maxId=-1},e.deepCopy=e=>{t.array=[...e.array],t.extend=e.extend,t.maxId=e.maxId},e.incrementLinkCount=e=>{++t.array[e].ncells},e.allocateLinks=e=>{for(let r=0;r{t.array[e].cells[r]=n}},"vtkCellLinks")},u=r(82382),c=r(57956),d=r(95917),p=r(21122),m=r(30536),h={};function f(e,t,r={}){Object.assign(t,h,r),p.Ay.extend(e,t,r),i.Ay.setGet(e,t,["points"]);t.classHierarchy.push("vtkPointSet"),t.points?t.points=(0,n.A)(t.points):t.points=m.Ay.newInstance(),e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.getBounds=()=>t.points?.getBounds(),e.computeBounds=()=>{t.points?.computeBounds()};let a=e.shallowCopy;e.shallowCopy=(e,r=!1)=>{a(e,r),t.points=m.Ay.newInstance(),t.points.shallowCopy(e.getPoints())};let o=e.getMTime;e.getMTime=()=>{let e=o();return Math.max(e,t.points?.getMTime()??e)};let s=e.initialize;e.initialize=()=>(t.points?.initialize(),s())}i.Ay.newInstance(f,"vtkPointSet");var g={extend:f},v=r(39535),y=r(11701),b=r(22783),I=r(58804),x={elements:[]},C={newInstance:i.Ay.newInstance(function(e,t,r={}){Object.assign(t,x,r),i.Ay.obj(e,t),t.classHierarchy.push("vtkPriorityQueue"),e.push=(e,r)=>{let n=t.elements.findIndex(t=>t.priority>e);t.elements.splice(n,0,{priority:e,element:r})},e.pop=()=>t.elements.length>0?t.elements.shift().element:null,e.deleteById=e=>{t.elements=t.elements.filter(({element:t})=>t.id!==e)},e.length=()=>t.elements.length},"vtkPriorityQueue")},A=r(30407),T={FAILURE:-1,OUTSIDE:0,INSIDE:1,INTERSECTION:2,ON_LINE:3};function S(e,t,r,n,i){return(n[e]-r[e])*(i[t]-r[t])-(i[e]-r[e])*(n[t]-r[t])}var w={firstPoint:null,pointCount:0,tris:[]};function O(e,t,r={}){Object.assign(t,w,r),i.Ay.obj(e,t);function n(e){let r=[0,0,0],n=[0,0,0],i=[0,0,0],a=[0,0,0];(0,y.Re)(e.point,e.previous.point,r),(0,y.Re)(e.next.point,e.point,n),(0,y.Re)(e.previous.point,e.next.point,i),(0,y.$A)(r,n,a);let o=(0,y.Om)(a,t.normal);if(o<=0)return -1;let s=(0,y.xb)(r)+(0,y.xb)(n)+(0,y.xb)(i);return s*s/o}function a(e,r){t.pointCount-=1;let i=e.previous,a=e.next;t.tris=t.tris.concat(e.point),t.tris=t.tris.concat(a.point),t.tris=t.tris.concat(i.point),i.next=a,a.previous=i,r.deleteById(i.id),r.deleteById(a.id);let o=n(i);o>0&&r.push(o,i);let s=n(a);s>0&&r.push(s,a),e.id===t.firstPoint.id&&(t.firstPoint=a)}t.classHierarchy.push("vtkPolygon"),e.triangulate=()=>t.firstPoint?function(){!function(){let e=[0,0,0],r=[0,0,0];t.normal=[0,0,0];let n=[...t.firstPoint.point],i=t.firstPoint;for(let a=0;a0&&e.push(t,r),r=r.next}for(;t.pointCount>2&&e.length()>0;)if(t.pointCount===e.length())a(e.pop(),e);else{let r=e.pop();(function(e){if(t.pointCount<=3)return!0;let r=e.previous,n=e.next,i=[0,0,0];(0,y.Re)(n.point,r.point,i);let a=[0,0,0];if((0,y.$A)(i,t.normal,a),(0,y.S8)(a),0===(0,y.xb)(a))return!1;let o=b.Ay.evaluate(a,r.point,n.next.point),s=o>1e-6?1:o<-1e-6?-1:0,l=+(s<0);for(let e=n.next.next;e.id!==r.id;e=e.next){let t=e.previous,i=(o=b.Ay.evaluate(a,r.point,e.point))>1e-6?1:o<-1e-6?-1:0;if(i!==s){if(l||(l=+(i<=0)),d.Ay.intersection(r.point,n.point,e.point,t.point,[0],[0])===A.Z.YES_INTERSECTION)return!1;s=i}}return 1===l})(r)&&a(r,e)}return t.pointCount<=2}():null,e.setPoints=e=>{t.pointCount=e.length,t.firstPoint={id:0,point:e[0],next:null,previous:null};let r=t.firstPoint;for(let n=1;nt.tris}var P={newInstance:i.Ay.newInstance(O,"vtkPolygon"),extend:O,...{PolygonWithPointIntersectionState:T,pointInPolygon:function(e,t,r,n){let i,a;if(e[0]r[1]||e[1]r[3]||e[2]r[5])return T.OUTSIDE;if(11920929e-14>=(0,y.S8)(n))return T.FAILURE;let o=1e-8*((r[1]-r[0])*(r[1]-r[0])+(r[3]-r[2])*(r[3]-r[2])+(r[5]-r[4])*(r[5]-r[4]));o*=o,o=0===o?11920929e-14:o;let s=[],l=[];for(let r=0;r0&&i<1)return T.INSIDE}Math.abs(n[0])>Math.abs(n[1])?Math.abs(n[0])>Math.abs(n[2])?(i=1,a=2):(i=0,a=1):Math.abs(n[1])>Math.abs(n[2])?(i=0,a=2):(i=0,a=1);let u=0;for(let r=0;re[a]&&S(i,a,s,l,e)>0&&++u:l[a]<=e[a]&&0>S(i,a,s,l,e)&&--u;return 0===u?T.OUTSIDE:T.INSIDE},getBounds:function(e,t,r){let n=e.length,i=[];t.getPoint(e[0],i),r[0]=i[0],r[1]=i[0],r[2]=i[1],r[3]=i[1],r[4]=i[2],r[5]=i[2];for(let a=1;a{t.triangle.initialize(e,r),n(e,r)},e.getCellType=()=>u.vZ.VTK_TRIANGLE_STRIP,e.getCellDimension=()=>2,e.getNumberOfEdges=()=>t.pointsIds.length,e.getNumberOfFaces=()=>0,e.evaluatePosition=(e,r,n,i,a)=>{let o=[0,0,0],s=Number.MAX_VALUE,l=0,u=[],c=[],d=[];n[2]=0,c[0]=0,c[1]=0,c[2]=0;let p=t.triangle.getPoints();p.setNumberOfPoints(3);let m=t.triangle.getPointsIds().length;for(let e=0;e=0&&(g{let a=[[0,1,2],[1,0,2]],o=e%2,s=t.pointsIds.length;for(let e=0;e{let i=[[0,1,2],[1,0,2]],a=e%2,o=t.triangle.getPointsIds();return o[0]=t.pointsIds[i[a][0]],o[1]=t.pointsIds[i[a][1]],o[2]=t.pointsIds[i[a][2]],t.triangle.cellBoundary(0,r,n)},e.getEdge=e=>{let r,n,i=t.pointsIds.length;return 0===e?(r=0,n=1):e===i-1?(r=e-1,n=e):(r=e-1,n=e+1),t.line.getPointsIds()[0]=t.pointsIds[r],t.line.getPointsIds()[1]=t.pointsIds[n],t.line.getPoints().setPoint(0,t.points.getPoint(r)),t.line.getPoints().setPoint(1,t.points.getPoint(n)),t.line},e.intersectWithLine=(e,r,n,i,a)=>{let o=t.pointsIds.length-2,s=t.triangle.getPoints();s.setNumberOfPoints(3);for(let l=0;l{let e=t.points.getNumberOfPoints()-2;t.tris=Array(3*e);let r=[[0,1,2],[1,0,2]];for(let n=0;nt.tris,e.derivatives=(e,r,n,i,a)=>{let o=[];t.points.getPoint(e,o);let s=[];t.points.getPoint(e+1,s);let l=[];t.points.getPoint(e+2,l);let u=t.triangle.getPoints();u.setPoint(0,...o),u.setPoint(1,...s),u.setPoint(2,...l),t.triangle.derivatives(0,r,n,i,a)},e.getParametricCenter=e=>(e[0]=.333333,e[1]=.333333,e[2]=0,Math.floor((t.pointsIds.length-2)/2)),e.contour=(e,t,r,n,i,a,o,s,l,u,c)=>D("vtkTriangleStrip.contour - NOT IMPLEMENTED"),e.clip=(e,r,n,i,a,o,s,l,u,c)=>{let d=t.points.getNumberOfPoints()-2,p=new Float32Array(3),m=r.newClone();m.setNumberOfComponents(r.getNumberOfComponents()),m.setData(p,r.getNumberOfComponents());let h=t.triangle.getPoints();h.setNumberOfPoints(3);let f=t.triangle.getPointsIds(),g=[0,0,0];for(let v=0;ve.toUpperCase()).replace(/\s+/g,"")}function i(){t.cells=void 0,t.links=void 0}t.classHierarchy.push("vtkPolyData"),V.forEach(o=>{e[`getNumberOf${r(o)}`]=()=>t[o].getNumberOfCells(),t[o]?t[o]=(0,n.A)(t[o]):t[o]=a.Ay.newInstance(),t[`_on${r(o)}Changed`]=i}),e.getNumberOfCells=()=>V.reduce((e,r)=>e+t[r].getNumberOfCells(),0);let o=e.shallowCopy;e.shallowCopy=(e,r=!1)=>{o(e,r),V.forEach(r=>{t[r]=a.Ay.newInstance(),t[r].shallowCopy(e.getReferenceByName(r))})};let s=e.getMTime;e.getMTime=()=>V.reduce((e,r)=>Math.max(e,t[r]?.getMTime()??e),s());let d=e.initialize;e.initialize=()=>(V.forEach(e=>t[e]?.initialize()),i(),d()),e.buildCells=()=>{let r=e.getNumberOfVerts(),n=e.getNumberOfLines(),i=e.getNumberOfPolys(),a=e.getNumberOfStrips(),o=r+n+i+a,s=new Uint8Array(o),l=s,d=new Uint32Array(o),p=d;if(r){let e=0;t.verts.getCellSizes().forEach((t,r)=>{p[r]=e,l[r]=t>1?u.vZ.VTK_POLY_VERTEX:u.vZ.VTK_VERTEX,e+=t+1}),p=p.subarray(r),l=l.subarray(r)}if(n){let e=0;t.lines.getCellSizes().forEach((t,r)=>{p[r]=e,l[r]=t>2?u.vZ.VTK_POLY_LINE:u.vZ.VTK_LINE,1===t&&L("Building VTK_LINE ",r," with only one point, but VTK_LINE needs at least two points. Check the input."),e+=t+1}),p=p.subarray(n),l=l.subarray(n)}if(i){let e=0;t.polys.getCellSizes().forEach((t,r)=>{switch(p[r]=e,t){case 3:l[r]=u.vZ.VTK_TRIANGLE;break;case 4:l[r]=u.vZ.VTK_QUAD;break;default:l[r]=u.vZ.VTK_POLYGON}t<3&&L("Building VTK_TRIANGLE ",r," with less than three points, but VTK_TRIANGLE needs at least three points. Check the input."),e+=t+1}),p+=p.subarray(i),l+=l.subarray(i)}if(a){let e=0;l.fill(u.vZ.VTK_TRIANGLE_STRIP,0,a),t.strips.getCellSizes().forEach((t,r)=>{p[r]=e,e+=t+1})}t.cells=c.Ay.newInstance(),t.cells.setCellTypes(o,s,d)},e.buildLinks=(r=0)=>{null==t.cells&&e.buildCells(),t.links=l.newInstance(),r>0?t.links.allocate(r):t.links.allocate(e.getPoints().getNumberOfPoints()),t.links.buildLinks(e)},e.getCellType=e=>t.cells.getCellType(e),e.getCellPoints=r=>{let n=e.getCellType(r),i=null;switch(n){case u.vZ.VTK_VERTEX:case u.vZ.VTK_POLY_VERTEX:i=t.verts;break;case u.vZ.VTK_LINE:case u.vZ.VTK_POLY_LINE:i=t.lines;break;case u.vZ.VTK_TRIANGLE:case u.vZ.VTK_QUAD:case u.vZ.VTK_POLYGON:i=t.polys;break;case u.vZ.VTK_TRIANGLE_STRIP:i=t.strips;break;default:return i=null,{type:0,cellPointIds:null}}let a=t.cells.getCellLocation(r);return{cellType:n,cellPointIds:i.getCell(a)}},e.getPointCells=e=>t.links.getCells(e),e.getCellEdgeNeighbors=(e,r,n)=>{let i=t.links.getLink(r),a=t.links.getLink(n);return i.cells.filter(t=>t!==e&&-1!==a.cells.indexOf(t))},e.getCell=(t,r=null)=>{let n=e.getCellPoints(t),i=r||B[n.cellType].newInstance();return i.initialize(e.getPoints(),n.cellPointIds),i},e.getMaxCellSize=()=>V.reduce((e,r)=>Math.max(e,t[r]?.getMaxCellSize?.()??0),0)}(e,t)}var k={newInstance:i.Ay.newInstance(U,"vtkPolyData"),extend:U}},19157:(e,t,r)=>{"use strict";function n(){return window.performance?performance.now():Date.now()}function i(e,t,r){if(r){let e=Math.max(...r.lut).toString(2).length-8,t=r.lut[0]>>e,n=r.lut[r.lut.length-1]>>e,i=r.firstValueMapped+r.lut.length-1;return function(a){return a=i?n:r.lut[a-r.firstValueMapped]>>e}}return function(r){return Math.min(Math.max(((r-(t-.5))/(e-1)+.5)*255,0),255)}}r.d(t,{A:()=>b});var a=r(37128);function o(e,t){let r=e.renderingTools.lastRenderedImageId,n=e.renderingTools.lastRenderedViewport;return t.imageId!==r||!n||n.windowCenter!==e.viewport.voi.windowCenter||n.windowWidth!==e.viewport.voi.windowWidth||n.invert!==e.viewport.invert||n.rotation!==e.viewport.rotation||n.hflip!==e.viewport.hflip||n.vflip!==e.viewport.vflip||n.modalityLUT!==e.viewport.modalityLUT||n.voiLUT!==e.viewport.voiLUT||n.colormap!==e.viewport.colormap}function s(e,t){let r=e.renderingTools.renderCanvas;r.width=t.width,r.height=t.height;let n=r.getContext("2d");n.fillStyle="white",n.fillRect(0,0,r.width,r.height);let i=n.getImageData(0,0,t.width,t.height);e.renderingTools.renderCanvasContext=n,e.renderingTools.renderCanvasData=i}function l(e){let t=e.image.imageId,r=e.viewport,n=e.image.color;return e.renderingTools.lastRenderedImageId=t,e.renderingTools.lastRenderedIsColor=n,e.renderingTools.lastRenderedViewport={windowCenter:r.voi.windowCenter,windowWidth:r.voi.windowWidth,invert:r.invert,rotation:r.rotation,hflip:r.hflip,vflip:r.vflip,modalityLUT:r.modalityLUT,voiLUT:r.voiLUT,colormap:r.colormap},e.renderingTools}var u=r(72661);function c(e,t){if(void 0===e)throw Error("renderColorImage: enabledElement parameter must not be undefined");let r=e.image;if(void 0===r)throw Error("renderColorImage: image must be loaded before it can be drawn");let c=e.canvas.getContext("2d");c.setTransform(1,0,0,1,0,0),c.fillStyle="black",c.fillRect(0,0,e.canvas.width,e.canvas.height),c.imageSmoothingEnabled=!e.viewport.pixelReplication,(0,a.A)(e,c);let d=function(e,t,r){var a;let l=e.renderingTools.lastRenderedIsColor;e.renderingTools.renderCanvas&&l||(e.renderingTools.renderCanvas=(0,u.Nw)(null,t.width,t.height));let c=e.renderingTools.renderCanvas,{windowWidth:d,windowCenter:p}=e.viewport.voi;if((256===d||255===d)&&(128===p||127===p)&&!e.viewport.invert&&t.getCanvas&&t.getCanvas())return t.getCanvas();if(!o(e,t)&&!r)return c;e.renderingTools.renderCanvasContext&&c.width===t.width&&c.height===t.height||s(e,t);let m=n(),h=(a=e.viewport,void 0!==t.cachedLut&&t.cachedLut.windowCenter===a.voi.windowCenter&&t.cachedLut.windowWidth===a.voi.windowWidth&&t.cachedLut.invert===a.invert||(!function(e,t,r,n,a){let o=e.maxPixelValue,s=e.minPixelValue,l=Math.min(s,0);void 0===e.cachedLut&&(e.cachedLut={},e.cachedLut.lutArray=new Uint8ClampedArray(o-l+1));let u=e.cachedLut.lutArray,c=i(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r,void 0);if(n)for(let e=s;e<=o;e++)u[e+-l]=255-c(e);else for(let e=s;e<=o;e++)u[e+-l]=c(e)}(t,a.voi.windowWidth,a.voi.windowCenter,a.invert),t.cachedLut.windowWidth=a.voi.windowWidth,t.cachedLut.windowCenter=a.voi.windowCenter,t.cachedLut.invert=a.invert),t.cachedLut.lutArray);t.stats=t.stats||{},t.stats.lastLutGenerateTime=n()-m;let f=e.renderingTools.renderCanvasData,g=e.renderingTools.renderCanvasContext;return t.rgba?!function(e,t,r){let i=n(),a=e.getPixelData();e.stats.lastGetPixelDataTime=n()-i;let o=e.minPixelValue,s=0,l=0,u=a.length;if(i=n(),o<0)for(;l0||void 0!==r.voi.windowWidth&&void 0!==r.voi.windowCenter)return;let n=t.maxPixelValue*t.slope+t.intercept,i=t.minPixelValue*t.slope+t.intercept,a=n-i,o=(n+i)/2;void 0===e.voi?e.voi={windowWidth:a,windowCenter:o,voiLUTFunction:t.voiLUTFunction}:(e.voi.windowWidth=a,e.voi.windowCenter=o)}(t,e),!function(e,t,r,n,a,o){let s=e.maxPixelValue,l=e.minPixelValue,u=Math.min(l,0);void 0===e.cachedLut&&(e.cachedLut={},e.cachedLut.lutArray=new Uint8ClampedArray(s-u+1));let c=e.cachedLut.lutArray,d=function(e,t,r){if(r){let e=r.lut[0],t=r.lut[r.lut.length-1],n=r.firstValueMapped+r.lut.length;return i=>i=n?t:r.lut[i]}return r=>r*e+t}(e.slope,e.intercept,a),p=i(t,r,o);if(e.isPreScaled)if(n)for(let e=l;e<=s;e++)c[e+-u]=255-p(e);else for(let e=l;e<=s;e++)c[e+-u]=p(e);else if(n)for(let e=l;e<=s;e++)c[e+-u]=255-p(d(e));else for(let e=l;e<=s;e++)c[e+-u]=p(d(e))}(e,t.voi.windowWidth,t.voi.windowCenter,t.invert,t.modalityLUT,t.voiLUT),e.cachedLut.windowWidth=t.voi.windowWidth,e.cachedLut.windowCenter=t.voi.windowCenter,e.cachedLut.invert=t.invert,e.cachedLut.voiLUT=t.voiLUT,e.cachedLut.modalityLUT=t.modalityLUT),e.cachedLut.lutArray}function m(e,t){if(void 0===e)throw Error("drawImage: enabledElement parameter must not be undefined");let r=e.image;if(void 0===r)throw Error("drawImage: image must be loaded before it can be drawn");let i=e.canvas.getContext("2d");i.setTransform(1,0,0,1,0,0),i.fillStyle="black",i.fillRect(0,0,e.canvas.width,e.canvas.height),i.imageSmoothingEnabled=!e.viewport.pixelReplication,(0,a.A)(e,i);let c=function(e,t,r,i=!0){let a=e.renderingTools.lastRenderedIsColor;(!e.renderingTools.renderCanvas||a)&&(e.renderingTools.renderCanvas=(0,u.Nw)(null,t.width,t.height),s(e,t));let l=e.renderingTools.renderCanvas;if(!o(e,t)&&!r)return l;(l.width!==t.width||l.height!==t.height)&&s(e,t),t.stats=t.stats||{};let c=e.renderingTools.renderCanvasData,d=e.renderingTools.renderCanvasContext,m=n();t.stats.lastLutGenerateTime=n()-m;let{viewport:h}=e;if("PT"===h.modality&&t.isPreScaled){let{windowWidth:e,windowCenter:r}=h.voi,i=r-e/2,a=255/(r+e/2-i);!function(e,t,r){let i=n(),a=e.voxelManager.getScalarData();e.stats.lastGetPixelDataTime=n()-i;let o=a.length,s=3,l=0;for(i=n();l255-(e-i)*a:e=>(e-i)*a,c.data)}else{let e=p(t,h,r);i?function(e,t,r){let i=n(),a=e.voxelManager.getScalarData();e.stats.lastGetPixelDataTime=n()-i;let o=a.length,s=e.minPixelValue,l=3,u=0;if(i=n(),a instanceof Int16Array)if(s<0)for(;u(0,v.q)(Math.floor(255-(e-n)*i),0,255):e=>(0,v.q)(Math.floor((e-n)*i),0,255),b,d.data)}else{let i=p(t,e.viewport,r);t.stats=t.stats||{},t.stats.lastLutGenerateTime=n()-c,f(t,i,b,d.data)}return c=n(),m.putImageData(d,0,0),t.stats.lastPutImageDataTime=n()-c,i}(e,r,t),d=e.viewport.displayedArea.tlhc.x-1,m=e.viewport.displayedArea.tlhc.y-1,y=e.viewport.displayedArea.brhc.x-d,b=e.viewport.displayedArea.brhc.y-m;i.drawImage(c,d,m,y,b,0,0,y,b),e.renderingTools=l(e)}function b(e,t){let r=e.image;if(!e.canvas||!e.image)return;let i=n();if(r.stats={lastGetPixelDataTime:-1,lastStoredPixelDataToCanvasImageDataTime:-1,lastPutImageDataTime:-1,lastRenderTime:-1,lastLutGenerateTime:-1},r){let n=r.render;n||(n=e.viewport.colormap?y:r.color?c:m),n(e,t)}let a=n()-i;r.stats.lastRenderTime=a,e.invalid=!1,e.needsRedraw=!1}},19204:(e,t,r)=>{"use strict";r.d(t,{c:()=>o});var n=r(66384),i=r(79923),a=r(12732);function o(e,t,r){if(!r)throw Error("getVolume is required, use the utilities export instead");if((0,n.oX)(e)){let n=(0,a.d)(e,t),i=n?r(n):void 0,o=e.getImageData?.();return{modality:i?.metadata?.Modality??o?.metadata?.Modality,isPreScaled:s(i?.scaling)}}if("function"==typeof e.setVolumes){let n=t?(0,i.A)(t):e.getVolumeId(),a=n?r(n):void 0;return{modality:a?.metadata?.Modality,isPreScaled:s(a?.scaling)}}if("function"==typeof e.setStack){let{preScale:t}=e.getImageData()||{};return{modality:e.modality,isPreScaled:!!t?.scaled}}}function s(e){return!!e&&Object.keys(e).length>0}},19275:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeListImpl=void 0;let n=r(60957),i=r(16950),a=r(47518);class o{_live=!0;_root;_filter=null;_length=0;constructor(e){return this._root=e,new Proxy(this,this)}get length(){return this._root._children.size}item(e){if(e<0||e>this.length-1)return null;if(ee.next()}}).bind(this)}}entries(){return{[Symbol.iterator]:(function(){let e=this[Symbol.iterator](),t=0;return{next(){let r=e.next();return r.done?{done:!0,value:null}:{done:!1,value:[t++,r.value]}}}}).bind(this)}}[Symbol.iterator](){return this._root._children[Symbol.iterator]()}forEach(e,t){void 0===t&&(t=n.dom.window);let r=0;for(let n of this._root._children)e.call(t,n,r++,this)}get(e,t,r){if(!(0,i.isString)(t))return Reflect.get(e,t,r);let n=Number(t);return isNaN(n)?Reflect.get(e,t,r):e.item(n)||void 0}set(e,t,r,n){if(!(0,i.isString)(t))return Reflect.set(e,t,r,n);let o=Number(t);if(isNaN(o))return Reflect.set(e,t,r,n);let s=e.item(o)||void 0;return!!s&&!!s._parent&&((0,a.mutation_replace)(s,r,s._parent),!0)}static _create(e){return new o(e)}}t.NodeListImpl=o},19431:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(30983);function i(e,t,r){return(0,n.A)(e,t,r).distanceSquared}},19667:(e,t,r)=>{"use strict";r.d(t,{Q:()=>a});var n=r(98197),i=r(6297);class a{async load(e){let t=(0,i._d)(e),r=(0,n.loadVideoStreamMetadata)(t);return{id:e,type:"video",renderedUrl:r.renderedUrl,fps:r.cineRate||30,numberOfFrames:r.numberOfFrames||1,frameRange:[1,r.numberOfFrames||1],modality:r.modality,metadata:r.metadata}}}},20549:(e,t,r)=>{"use strict";r.r(t),r.d(t,{createAndCacheDerivedLabelmapVolume:()=>O,createAndCacheDerivedVolume:()=>b,createAndCacheVolume:()=>y,createAndCacheVolumeFromImages:()=>I,createAndCacheVolumeFromImagesSync:()=>x,createLocalLabelmapVolume:()=>P,createLocalVolume:()=>C,getUnknownVolumeLoaderSchema:()=>w,getVolumeLoaderSchemes:()=>T,loadVolume:()=>v,registerUnknownVolumeLoader:()=>S,registerVolumeLoader:()=>A}),r(10054);var n=r(94302),i=r(54268),a=r(76879),o=r(3922),s=r(69228),l=r(21483),u=r(3793),c=r(36039),d=r(97938),p=r(32876),m=r(13402);let h={},f=m.F;function g(e,t){let r=e.indexOf(":"),n=e.substring(0,r),i=h[n];if(null==i){if(null==f||"function"!=typeof f)throw Error(`No volume loader for scheme ${n} has been registered`);i=f}let l=i(e,t);return l.promise.then(function(e){(0,s.A)(o.A,a.A.VOLUME_LOADED,{volume:e})},function(t){(0,s.A)(o.A,a.A.VOLUME_LOADED_FAILED,{volumeId:e,error:t})}),l}function v(e,t={imageIds:[]}){if(void 0===e)throw Error("loadVolume: parameter volumeId must not be undefined");let r=i.Ay.getVolumeLoadObject(e);return void 0!==r?r.promise:(r=g(e,t)).promise.then(e=>e)}async function y(e,t){if(void 0===e)throw Error("createAndCacheVolume: parameter volumeId must not be undefined");let r=i.Ay.getVolumeLoadObject(e);return void 0!==r||(r=g(e,t),i.Ay.putVolumeLoadObject(e,r)),r.promise}function b(e,t){let r=i.Ay.getVolume(e);if(!r)throw Error(`Cannot created derived volume: Referenced volume with id ${e} does not exist.`);let{volumeId:a}=t,{voxelRepresentation:o}=t;void 0===a&&(a=(0,u.A)());let{metadata:s,dimensions:c,spacing:p,origin:m,direction:h}=r,f=r.isDynamicVolume()?r.getCurrentDimensionGroupImageIds():r.imageIds??[],g=(0,d.createAndCacheDerivedImages)(f,{targetBuffer:t.targetBuffer,voxelRepresentation:o}),v=g[0].dataType,y=g.map(e=>e.imageId),b=new n.Q({volumeId:a,dataType:v,metadata:(0,l.G)(s),dimensions:[c[0],c[1],c[2]],spacing:p,origin:m,direction:h,referencedVolumeId:e,imageIds:y,referencedImageIds:r.imageIds??[]});return i.Ay.putVolumeSync(a,b),b}async function I(e,t){if(void 0===t)throw Error("createAndCacheVolumeFromImages: parameter imageIds must not be undefined");if(void 0===e)throw Error("createAndCacheVolumeFromImages: parameter volumeId must not be undefined");let r=i.Ay.getVolume(e);return r||(0===t.filter(e=>!i.Ay.getImage(e)).length?x(e,t):await y(e,{imageIds:t}))}function x(e,t){if(void 0===t)throw Error("createAndCacheVolumeFromImagesSync: parameter imageIds must not be undefined");if(void 0===e)throw Error("createAndCacheVolumeFromImagesSync: parameter volumeId must not be undefined");let r=i.Ay.getVolume(e);if(r)return r;let a=(0,p.D)(t,e),o=new n.Q({volumeId:e,dataType:a.dataType,metadata:(0,l.G)(a.metadata),dimensions:a.dimensions,spacing:a.spacing,origin:a.origin,direction:a.direction,referencedVolumeId:a.referencedVolumeId,imageIds:a.imageIds,referencedImageIds:a.referencedImageIds});return i.Ay.putVolumeSync(e,o),o}function C(e,t={}){let r,{metadata:a,dimensions:o,spacing:s,origin:u,direction:p,scalarData:m,referencedImageIds:h,referencedVolumeId:f,targetBuffer:g,preventCache:v=!1}=t,y=i.Ay.getVolume(e);if(y)return y;let b=o[0]*o[1],I=m?m.constructor.name:g?.type??"Float32Array",x=b*o[2];switch(I){case"Uint8Array":case"Int8Array":r=x;break;case"Uint16Array":case"Int16Array":r=2*x;break;case"Float32Array":r=4*x}if(!i.Ay.isCacheable(r))throw Error(`Cannot created derived volume: Volume with id ${e} is not cacheable.`);let A=[],T=[];for(let t=0;t{"use strict";r.d(t,{A:()=>P});var n=r(48937);let i={[n.A.OnInteractionStart]:e=>{let{segmentIndex:t,labelValue:r,previewSegmentIndex:n,segmentationVoxelManager:i,centerIJK:a,viewPlaneNormal:o,segmentationImageData:s,configuration:l}=e;if(!l?.useCenterSegmentIndex){e.centerSegmentIndexInfo.segmentIndex=null,e.centerSegmentIndexInfo.hasSegmentIndex=!1,e.centerSegmentIndexInfo.hasPreviewIndex=!1;return}let u=!1,c=!1,d=[...i.getBoundsIJK()];if(Math.abs(o[0])>.8?d[0]=[a[0],a[0]]:Math.abs(o[1])>.8?d[1]=[a[1],a[1]]:Math.abs(o[2])>.8&&(d[2]=[a[2],a[2]]),i.forEach(({value:e})=>{u||=e===(r??t),c||=e===n},{imageData:s,isInObject:e.isInObject,boundsIJK:d}),!u&&!c){e.centerSegmentIndexInfo.segmentIndex=null;return}let p=i.getAtIJKPoint(a);e.centerSegmentIndexInfo.segmentIndex=p,e.centerSegmentIndexInfo.hasSegmentIndex=u,e.centerSegmentIndexInfo.hasPreviewIndex=c}};var a=r(50923),o=r(41918);let s={[n.A.Initialize]:e=>{let{operationName:t,centerIJK:r,segmentationVoxelManager:i,imageVoxelManager:s,configuration:l,segmentIndex:u,viewport:c}=e;if(!l?.threshold?.isDynamic||!r||!u||t===n.A.RejectPreview||t===n.A.OnInteractionEnd)return;let d=i.getBoundsIJK(),{range:p,dynamicRadius:m=0}=l.threshold,h=p?0:m,{viewPlaneNormal:f}=(0,o.A)(c);if(!f)return;let g=d.map((e,t)=>{let[n,i]=e;return[Math.max(n,r[t]-h),Math.min(i,r[t]+h)]});Math.abs(f[0])>.8?g[0]=[r[0],r[0]]:Math.abs(f[1])>.8?g[1]=[r[1],r[1]]:Math.abs(f[2])>.8&&(g[2]=[r[2],r[2]]);let v=p||[1/0,-1/0],y=h*h;s.forEach(({value:e,pointIJK:t})=>{if(a.lo(r,t)>y)return;let n=Array.isArray(e)?a.Il(e):e;v[0]=Math.min(n,v[0]),v[1]=Math.max(n,v[1])},{boundsIJK:g}),l.threshold.range=v},[n.A.OnInteractionStart]:e=>{let{configuration:t}=e;t?.threshold?.isDynamic&&(t.threshold.range=null)},[n.A.ComputeInnerCircleRadius]:e=>{let{configuration:t,viewport:r}=e,n=t?.threshold;if(!n)return;let{dynamicRadius:i=0,isDynamic:a}=n;if(!a){n.dynamicRadiusInCanvas=0;return}if(0===i)return;let o=r.getImageData();if(!o)return;let{spacing:s}=o,l=[r.element.clientWidth/2,r.element.clientHeight/2],u=i*s[0],c=r.canvasToWorld(l).map(e=>e+u),d=r.worldToCanvas(c),p=Math.abs(l[0]-d[0]);n.dynamicRadiusInCanvas||(n.dynamicRadiusInCanvas=0),n.dynamicRadiusInCanvas=3+p}},l={[n.A.Initialize]:e=>{e.segmentIndex=0}};var u=r(49007),c=r(67358);let d={[n.A.OnInteractionEnd]:e=>{let{previewSegmentIndex:t,segmentIndex:r,labelValue:n,viewport:i,segmentationVoxelManager:a,activeStrategy:o,memo:s}=e;if("THRESHOLD_INSIDE_SPHERE_WITH_ISLAND_REMOVAL"!==o||null===r)return;let l=new c.A,d=s?.voxelManager||a;if(!l.initialize(i,d,{previewSegmentIndex:t,segmentIndex:n??r}))return;l.floodFillSegmentIsland(),l.removeExternalIslands(),l.removeInternalIslands();let p=d.getArrayOfModifiedSlices();p&&(0,u.triggerSegmentationDataModified)(e.segmentationId,p,t)}};var p=r(70192),m=r(36814),h=r(19921),f=r(69435);let g={[n.A.Preview]:function(e){let{previewSegmentIndex:t,configuration:r,enabledElement:n}=e;if(!t||!r)return;this.onInteractionStart?.(n,e);let i=this.fill(n,e);return i&&this.onInteractionEnd?.(n,e),i},[n.A.Initialize]:e=>{let{segmentIndex:t,previewColor:r,previewSegmentIndex:n}=e;if(e.modified=!1,null==n||null==t)return;let i=(0,f.P)(e.segmentationId);i?.forEach(t=>{(0,h.setSegmentIndexColor)(t,e.segmentationId,n,r)}),e.modified=!0},[n.A.AcceptPreview]:e=>{let{previewSegmentIndex:t,segmentationVoxelManager:r,memo:n,segmentIndex:i,labelValue:a,centerSegmentIndexInfo:o}=e||{},{changedIndices:s}=o||{};r.forEach(({index:e})=>{let o=r.getAtIndex(e);s?.length>0?s.includes(e)&&n.voxelManager.setAtIndex(e,0):o===t&&n.voxelManager.setAtIndex(e,a??i)}),(0,m.Q)(e.segmentationId,r.getArrayOfModifiedSlices(),i),e.centerSegmentIndexInfo.changedIndices=[]},[n.A.RejectPreview]:e=>{e&&p.BF.HistoryMemo.DefaultHistoryMemo.undoIf(t=>{if(!t?.voxelManager)return!1;let{segmentationVoxelManager:r}=t,n=!1;return r.forEach(({value:t})=>{t===e.previewSegmentIndex&&(n=!0)}),n})}},v={[n.A.Fill]:e=>{let{segmentsLocked:t,segmentationImageData:r,segmentationVoxelManager:n,brushStrategy:i,centerIJK:a}=e,o=i.createIsInThreshold?.(e),{setValue:s}=i,l=o?r=>{let{value:n,index:i}=r;!t.includes(n)&&o(i)&&s(e,r)}:t=>s(e,t);n.forEach(l,{imageData:r,isInObject:e.isInObject,boundsIJK:e.isInObjectBoundsIJK}),n.addPoint(a)}};var y=r(43385),b=r(66442);let I={[n.A.INTERNAL_setValue]:(e,{value:t,index:r})=>{let{segmentsLocked:n,previewSegmentIndex:i,memo:a,segmentationVoxelManager:o,centerSegmentIndexInfo:s,segmentIndex:l,labelValue:u,labelmapId:c,segmentationId:d}=e,p=o.getAtIndex(r),m=(0,y.T)(d),h=m&&c?(0,b.Mx)(m,c,p):p;if(!n.includes(h)&&(s||p!==(u??l))&&(s?.segmentIndex===0||p!==(u??l))){if(s?.segmentIndex===null)return void a.voxelManager.setAtIndex(r,i??u??l);if(!i){let e=u??l;s&&(e=s.segmentIndex),a.voxelManager.setAtIndex(r,e);return}!function({operationData:e,existingValue:t,index:r}){let{previewSegmentIndex:n,memo:i,centerSegmentIndexInfo:a,previewOnHover:o,segmentIndex:s,labelValue:l}=e,u=l??s,{hasPreviewIndex:c,hasSegmentIndex:d,segmentIndex:p}=a;if(0===p&&d&&c)return t===u||o||t===n&&i.voxelManager.setAtIndex(r,0);if(0===p&&d&&!c){if(0===t||t!==u)return;i.voxelManager.setAtIndex(r,n),a.changedIndices.push(r);return}if(0===p&&!d&&c)return t===u||o||t===n&&i.voxelManager.setAtIndex(r,0);if(0===p&&!d&&!c)return t===u||t===n&&i.voxelManager.setAtIndex(r,n);if(p===n&&d&&c||p===n&&!d&&c||p===u&&d&&c||p===u&&d&&!c){if(t===u)return;i.voxelManager.setAtIndex(r,n)}}({operationData:e,existingValue:p,index:r})}}},x={[n.A.CreateIsInThreshold]:e=>{let{imageVoxelManager:t,segmentIndex:r,configuration:n}=e;if(n&&r)return e=>{let r=t.getAtIndex(e),i=Array.isArray(r)?a.Bw(r):r,{threshold:o}=n||{};return!o?.range?.length||o.range[0]<=i&&i<=o.range[1]}}};var C=r(81038);let A={[n.A.GetStatistics]:function(e,t,r){let{indices:n}=r,{segmentationId:i,viewport:a}=t;(0,C.A)({segmentationId:i,segmentIndices:n})}};var T=r(58956),S=r(25931),w=r(73904);let O={[n.A.CalculateCursorGeometry]:function(e,t){if(!t)return;let{configuration:r,activeStrategy:n,hoverData:i}=t,{viewport:s}=e,l=(0,o.A)(s),{brushSize:u}=r;if(!l.viewUp||!l.viewPlaneNormal)return;let c=a.fA(l.viewUp[0],l.viewUp[1],l.viewUp[2]),d=a.fA(l.viewPlaneNormal[0],l.viewPlaneNormal[1],l.viewPlaneNormal[2]),p=a.vt();a.$A(p,c,d);let{canvasToWorld:m}=s,{centerCanvas:h}=i,f=m([h[0],h[1]]),g=a.vt(),v=a.vt(),y=a.vt(),b=a.vt();for(let e=0;e<=2;e++)g[e]=f[e]-c[e]*u,v[e]=f[e]+c[e]*u,y[e]=f[e]-p[e]*u,b[e]=f[e]+p[e]*u;if(!i)return;let{brushCursor:I}=i,{data:x}=I;void 0===x.handles&&(x.handles={}),x.handles.points=[g,v,y,b],x.editPoints=[...x.handles.points];let C=r.strategies[n];"function"==typeof C?.computeInnerCircleRadius&&C.computeInnerCircleRadius({configuration:r,viewport:s}),x.invalidated=!1},[n.A.RenderCursor]:function(e,t,r){if(!t)return;let{configuration:n,hoverData:i}=t,{viewport:a}=e,{brushCursor:o}=i,s=o.metadata;if(!s)return;let l=s.brushCursorUID||"brushCursor",u=o.data,c=`rgb(${s.segmentColor?.slice(0,3)||[0,0,0]})`;if(!a.getRenderingEngine())return void console.warn("Rendering Engine has been destroyed");let d=u.handles?.points||[];d?.length;let p=[];for(let e=0;ea.worldToCanvas(e)),n=r[0],i=r[1],o=[Math.floor((n[0]+i[0])/2),Math.floor((n[1]+i[1])/2)],s=Math.round(Math.abs(n[1]-o[1]));p.push({center:o,radius:s})}let m=p[p.length-1];p.length>1&&(0,w.kd)(r,l,"stroke-preview",p.map(e=>e.center),{color:c,lineWidth:2*m.radius,strokeOpacity:.35,lineCap:"round",lineJoin:"round",lineDash:0===this.centerSegmentIndexInfo.segmentIndex?"6,4":void 0}),m&&(0,w.hp)(r,l,"current-circle",m.center,m.radius,{color:c,lineWidth:2,strokeOpacity:1,lineDash:0===this.centerSegmentIndexInfo.segmentIndex?[1,2]:null},"brush-cursor");let{dynamicRadiusInCanvas:h}=n?.threshold||{dynamicRadiusInCanvas:0};h&&m&&(0,w.hp)(r,l,"dynamic-radius",m.center,h,{color:c},"brush-cursor")}},P={determineSegmentIndex:i,dynamicThreshold:s,erase:l,islandRemoval:d,preview:g,regionFill:v,setValue:I,threshold:x,labelmapStatistics:A,ensureSegmentationVolumeFor3DManipulation:T.A,ensureImageVolumeFor3DManipulation:S.A,circularCursor:O}},20556:(e,t,r)=>{"use strict";function n(){return{currentTimeSeconds:0,anchorCanvas:[.5,.5],scale:1,scaleMode:"fit",rotation:0}}function i(e){var t;return{...void 0!==e.currentTimeSeconds?{currentTimeSeconds:Math.max(0,e.currentTimeSeconds)}:{},anchorCanvas:[(t=e.anchorCanvas??[.5,.5])[0],t[1]],scale:Math.max(e.scale??1,.001),scaleMode:"fit",rotation:e.rotation??0,...e.anchorWorld?{anchorWorld:l(e.anchorWorld)}:{}}}function a(e){var t;let{containerWidth:r,containerHeight:n,intrinsicWidth:i,intrinsicHeight:a,objectFit:o="contain",camera:s}=e;if(!r||!n||!i||!a)return;let u=Math.min(r/i,n/a),c=Math.max(r/i,n/a),d=i*u,p=a*u;switch(o){case"cover":d=i*c,p=a*c;break;case"fill":d=r,p=n;break;case"none":d=i,p=a;break;case"scale-down":{let e=Math.min(1,u);d=i*e,p=a*e}}let m=Math.max(s?.scale??1,.001);d*=m,p*=m;let h=d/i,f=[(t=s?.anchorCanvas??[.5,.5])[0],t[1]],g=l(s?.anchorWorld)??[i/2,a/2];return{left:r*f[0]-g[0]*h,top:n*f[1]-g[1]*h,width:d,height:p,containerWidth:r,containerHeight:n,intrinsicWidth:i,intrinsicHeight:a,anchorWorld:g,anchorCanvas:f,worldToCanvasRatio:h}}function o(e){return[e.left/e.worldToCanvasRatio,e.top/e.worldToCanvasRatio]}function s(e,t){return[t.containerWidth*t.anchorCanvas[0]/t.worldToCanvasRatio-e[0],t.containerHeight*t.anchorCanvas[1]/t.worldToCanvasRatio-e[1]]}function l(e){return e?[e[0],e[1]]:void 0}r.d(t,{Kw:()=>s,ak:()=>a,l3:()=>i,uP:()=>o,vd:()=>n})},20644:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(27501);function i(e,t){return Math.sqrt((0,n.A)(e,t))}},20832:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});class n{constructor(){}static getContourSequence(e,t){let{data:r}=e,{projectionPoints:n,projectionPointsImageIds:i}=r.cachedStats;return n.map((e,r)=>{var n;let a=[...(n=e)[0],...n[1],...n[3],...n[2]].flat().map(e=>e.toFixed(2)),o=function(e,t){let r=t.get("sopCommonModule",e);return{ReferencedSOPClassUID:r.sopClassUID,ReferencedSOPInstanceUID:r.sopInstanceUID}}(i[r],t);return{NumberOfContourPoints:a.length/3,ContourImageSequence:o,ContourGeometricType:"CLOSED_PLANAR",ContourData:a}})}}n.toolName="RectangleROIStartEndThreshold";class i{constructor(){}static convert(e,t,r){if(!e?.data)throw Error("Tool data is empty");if(!e.metadata||!e.metadata.referencedImageId)throw Error("Tool data is not associated with any imageId");let{toolName:n}=e.metadata,a=i.TOOL_NAMES[n];if(!a)throw Error(`Unknown tool type: ${n}, cannot convert to RTSSReport`);let o=a.getContourSequence(e,r),s=t.color?.slice(0,3)||[Math.floor(255*Math.random()),Math.floor(255*Math.random()),Math.floor(255*Math.random())];return{ReferencedROINumber:t.segmentIndex,ROIDisplayColor:s,ContourSequence:Array.isArray(o)?o:[o]}}static register(e){i.TOOL_NAMES[e.toolName]=e}}i.TOOL_NAMES={},i.register(n);let a=i},21122:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>A});var n=r(30756),i=r(17042),a=r(11701),o=r(58804),s=r(87352),{vtkErrorMacro:l,vtkWarningMacro:u}=i.Ay,c={arrays:[],copyFieldFlags:[],doCopyAllOn:!0,doCopyAllOff:!1};function d(e,t,r={}){Object.assign(t,c,r),i.Ay.obj(e,t);t.classHierarchy.push("vtkFieldData");let a=e.getState;t.arrays&&(t.arrays=t.arrays.map(e=>({data:(0,n.A)(e.data)}))),e.initialize=()=>{e.initializeFields(),e.copyAllOn(),e.clearFieldFlags()},e.initializeFields=()=>{t.arrays=[],t.copyFieldFlags={},e.modified()},e.copyStructure=r=>{e.initializeFields(),t.copyFieldFlags=r.getCopyFieldFlags().map(e=>e),t.arrays=r.getArrays().map(e=>({data:e}))},e.getNumberOfArrays=()=>t.arrays.length,e.getNumberOfActiveArrays=()=>t.arrays.length,e.addArray=r=>{let n=r.getName(),{array:i,index:a}=e.getArrayWithIndex(n);return null!=i?(t.arrays[a]={data:r},a):(t.arrays=[].concat(t.arrays,{data:r}),t.arrays.length-1)},e.removeAllArrays=()=>{t.arrays=[]},e.removeArray=r=>{let n=t.arrays.findIndex(e=>e.data.getName()===r);return e.removeArrayByIndex(n)},e.removeArrayByIndex=e=>-1!==e&&et.arrays.map(e=>e.data),e.getArray=t=>"number"==typeof t?e.getArrayByIndex(t):e.getArrayByName(t),e.getArrayByName=e=>t.arrays.reduce((t,r,n)=>r.data.getName()===e?r.data:t,null),e.getArrayWithIndex=e=>{let r=t.arrays.findIndex(t=>t.data.getName()===e);return{array:-1!==r?t.arrays[r].data:null,index:r}},e.getArrayByIndex=e=>e>=0&&ee.getArrayWithIndex(t).index>=0,e.getArrayName=e=>{let r=t.arrays[e];return r?r.data.getName():""},e.getCopyFieldFlags=()=>t.copyFieldFlags,e.getFlag=e=>t.copyFieldFlags[e],e.passData=(r,n=-1,a=-1)=>{r.getArrays().forEach(o=>{let u=e.getFlag(o.getName());if(!1!==u&&!(t.doCopyAllOff&&!0!==u)&&o){let t=e.getArrayByName(o.getName());if(t)if(o.getNumberOfComponents()===t.getNumberOfComponents())if(n>-1&&n-1?a:n;t.insertTuple(e,o.getTuple(n))}else t.insertTuples(0,o.getTuples());else l("Unhandled case in passData");else if(n<0||n>o.getNumberOfTuples())e.addArray(o),r.getAttributes(o).forEach(t=>{e.setAttribute(o,t)});else{let l=o.getNumberOfComponents(),u=o.getNumberOfValues(),c=a>-1?a:n;u<=c*l&&(u=(c+1)*l),(t=s.Ay.newInstance({name:o.getName(),dataType:o.getDataType(),numberOfComponents:l,values:i.Ay.newTypedArray(o.getDataType(),u),size:0})).insertTuple(c,o.getTuple(n)),e.addArray(t),r.getAttributes(o).forEach(r=>{e.setAttribute(t,r)})}}})},e.interpolateData=(r,n=-1,a=-1,o=-1,c=.5)=>{r.getArrays().forEach(d=>{let p=e.getFlag(d.getName());if(!1!==p&&!(t.doCopyAllOff&&!0!==p)&&d){let t=e.getArrayByName(d.getName());if(t)if(d.getNumberOfComponents()===t.getNumberOfComponents())if(n>-1&&n-1?o:n;t.interpolateTuple(e,d,n,d,a,c),u("Unexpected case in interpolateData")}else t.insertTuples(d.getTuples());else l("Unhandled case in interpolateData");else if(n<0||a<0||n>d.getNumberOfTuples())e.addArray(d),r.getAttributes(d).forEach(t=>{e.setAttribute(d,t)});else{let l=d.getNumberOfComponents(),u=d.getNumberOfValues(),p=o>-1?o:n;u<=p*l&&(u=(p+1)*l),(t=s.Ay.newInstance({name:d.getName(),dataType:d.getDataType(),numberOfComponents:l,values:i.Ay.newTypedArray(d.getDataType(),u),size:0})).interpolateTuple(p,d,n,d,a,c),e.addArray(t),r.getAttributes(d).forEach(r=>{e.setAttribute(t,r)})}}})},e.copyFieldOn=e=>{t.copyFieldFlags[e]=!0},e.copyFieldOff=e=>{t.copyFieldFlags[e]=!1},e.copyAllOn=()=>{(!t.doCopyAllOn||t.doCopyAllOff)&&(t.doCopyAllOn=!0,t.doCopyAllOff=!1,e.modified())},e.copyAllOff=()=>{(t.doCopyAllOn||!t.doCopyAllOff)&&(t.doCopyAllOn=!1,t.doCopyAllOff=!0,e.modified())},e.clearFieldFlags=()=>{t.copyFieldFlags={}},e.deepCopy=e=>{t.arrays=e.getArrays().map(e=>{let t=e.newClone();return t.deepCopy(e),{data:t}})},e.copyFlags=e=>e.getCopyFieldFlags().map(e=>e),e.reset=()=>t.arrays.forEach(e=>e.data.reset()),e.getMTime=()=>t.arrays.reduce((e,t)=>t.data.getMTime()>e?t.data.getMTime():e,t.mtime),e.getNumberOfComponents=()=>t.arrays.reduce((e,t)=>e+t.data.getNumberOfComponents(),0),e.getNumberOfTuples=()=>t.arrays.length>0?t.arrays[0].getNumberOfTuples():0,e.getState=e=>{let r=a(e);return r&&(r.arrays=t.arrays.map(t=>({data:t.data.getState(e)}))),r}}i.Ay.newInstance(d,"vtkFieldData");var p={extend:d},m=r(76826),{AttributeTypes:h,AttributeCopyOperations:f}=m.Ay,{vtkWarningMacro:g}=i.Ay,v={activeScalars:-1,activeVectors:-1,activeTensors:-1,activeNormals:-1,activeTCoords:-1,activeGlobalIds:-1,activePedigreeIds:-1};function y(e,t,r={}){Object.assign(t,v,r),p.extend(e,t,r),i.Ay.setGet(e,t,["activeScalars","activeNormals","activeTCoords","activeVectors","activeTensors","activeGlobalIds","activePedigreeIds"]),t.arrays||(t.arrays={});let n=["Scalars","Vectors","Normals","TCoords","Tensors","GlobalIds","PedigreeIds"];function a(e){let t=n.find(t=>h[t.toUpperCase()]===e||"number"!=typeof e&&t.toLowerCase()===e.toLowerCase());return void 0===t&&(t=null),t}t.classHierarchy.push("vtkDataSetAttributes");let o={...e};e.checkNumberOfComponents=e=>!0,e.setAttribute=(r,n)=>{let i=a(n);if(r&&"PEDIGREEIDS"===i.toUpperCase()&&!r.isA("vtkDataArray"))return g(`Cannot set attribute ${i}. The attribute must be a vtkDataArray.`),-1;if(r&&!e.checkNumberOfComponents(r,i))return g(`Cannot set attribute ${i}. Incorrect number of components.`),-1;if(r){let n=e.addArray(r);t[`active${i}`]=n}else t[`active${i}`]=-1;return e.modified(),t[`active${i}`]},e.getAttributes=t=>n.filter(r=>e[`get${r}`]()===t),e.setActiveAttributeByName=(t,r)=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,r),e.setActiveAttributeByIndex=(r,n)=>{let i=a(n);if(r>=0&&re[`get${a(t)}`](),e.removeAllArrays=()=>{n.forEach(e=>{t[`active${e}`]=-1}),o.removeAllArrays()},e.removeArrayByIndex=e=>(-1!==e&&n.forEach(r=>{e===t[`active${r}`]?t[`active${r}`]=-1:e{let n=`active${r}`;e[`get${r}`]=()=>e.getArrayByIndex(t[n]),e[`set${r}`]=t=>e.setAttribute(t,r),e[`setActive${r}`]=t=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,r),e[`copy${r}Off`]=()=>{let e=r.toUpperCase();t.copyAttributeFlags[f.PASSDATA][h[e]]=!1},e[`copy${r}On`]=()=>{let e=r.toUpperCase();t.copyAttributeFlags[f.PASSDATA][h[e]]=!0}}),e.initializeAttributeCopyFlags=()=>{t.copyAttributeFlags=[],Object.keys(f).filter(e=>"ALLCOPY"!==e).forEach(e=>{t.copyAttributeFlags[f[e]]=Object.keys(h).filter(e=>"NUM_ATTRIBUTES"!==e).reduce((e,t)=>(e[h[t]]=!0,e),[])}),t.copyAttributeFlags[f.COPYTUPLE][h.GLOBALIDS]=!1,t.copyAttributeFlags[f.INTERPOLATE][h.GLOBALIDS]=!1,t.copyAttributeFlags[f.COPYTUPLE][h.PEDIGREEIDS]=!1},e.initialize=i.Ay.chain(e.initialize,e.initializeAttributeCopyFlags),t.dataArrays&&Object.keys(t.dataArrays).length&&Object.keys(t.dataArrays).forEach(r=>{t.dataArrays[r].ref||"vtkDataArray"!==t.dataArrays[r].type||e.addArray(s.Ay.newInstance(t.dataArrays[r]))});let l=e.shallowCopy;e.shallowCopy=(e,r)=>{l(e,r),t.arrays=e.getArrays().map(e=>{let t=e.newClone();return t.shallowCopy(e,r),{data:t}})},e.initializeAttributeCopyFlags()}var b={newInstance:i.Ay.newInstance(y,"vtkDataSetAttributes"),extend:y,...m.Ay},I=["pointData","cellData","fieldData"],x={};function C(e,t,r={}){Object.assign(t,x,r),i.Ay.obj(e,t),i.Ay.setGet(e,t,I),i.Ay.getArray(e,t,["bounds"],6);t.classHierarchy.push("vtkDataSet"),I.forEach(e=>{t[e]?t[e]=(0,n.A)(t[e]):t[e]=b.newInstance()}),e.computeBounds=()=>{if(t.modifiedTime&&t.computeTime&&t.modifiedTime>t.computeTime||!t.computeTime){let r=e.getPoints();r?.getNumberOfPoints()?o.Ay.setBounds(t.bounds,r.getBoundsByReference()):t.bounds=a.Ay.createUninitializedBounds(),t.computeTime=i.Ay.getCurrentGlobalMTime()}},e.getLength2=()=>{let t=e.getBoundsByReference();return t&&6===t.length?o.Ay.getDiagonalLength2(t):0},e.getLength=()=>Math.sqrt(e.getLength2()),e.getCenter=()=>{let t=e.getBoundsByReference();return t&&6===t.length?o.Ay.getCenter(t):[0,0,0]},e.getCellBounds=t=>{let r=e.getCell(t);return r?r.getBounds():a.Ay.createUninitializedBounds()},e.getBounds=i.Ay.chain(()=>e.computeBounds,e.getBounds),e.getBoundsByReference=i.Ay.chain(()=>e.computeBounds,e.getBoundsByReference);let s=e.shallowCopy;e.shallowCopy=(e,r=!1)=>{s(e,r),I.forEach(r=>{t[r]=b.newInstance(),t[r].shallowCopy(e.getReferenceByName(r))})};let l=e.getMTime;e.getMTime=()=>I.reduce((e,r)=>Math.max(e,t[r]?.getMTime()??e),l()),e.initialize=()=>(I.forEach(e=>t[e]?.initialize()),e)}var A={newInstance:i.Ay.newInstance(C,"vtkDataSet"),extend:C,...{FieldDataTypes:{UNIFORM:0,DATA_OBJECT_FIELD:0,COORDINATE:1,POINT_DATA:1,POINT:2,POINT_FIELD_DATA:2,CELL:3,CELL_FIELD_DATA:3,VERTEX:4,VERTEX_FIELD_DATA:4,EDGE:5,EDGE_FIELD_DATA:5,ROW:6,ROW_DATA:6},FieldAssociations:{FIELD_ASSOCIATION_POINTS:0,FIELD_ASSOCIATION_CELLS:1,FIELD_ASSOCIATION_NONE:2,FIELD_ASSOCIATION_POINTS_THEN_CELLS:3,FIELD_ASSOCIATION_VERTICES:4,FIELD_ASSOCIATION_EDGES:5,FIELD_ASSOCIATION_ROWS:6,NUMBER_OF_ASSOCIATIONS:7}}}},21167:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(70192),i=r(41918);let{isEqual:a}=n.BF;function o(e){let{metadata:t}=e;return(0,n.zb)().filter(e=>{if(e.FrameOfReferenceUID===t.FrameOfReferenceUID){let r=e.viewport,{viewPlaneNormal:n,viewUp:o}=(0,i.A)(r);return!!n&&a(n,t.viewPlaneNormal)&&(!t.viewUp||a(o,t.viewUp))}}).map(e=>e.viewport)}},21241:(e,t,r)=>{"use strict";r.d(t,{A5:()=>u,GP:()=>d,jr:()=>c});var n=r(11701),i=r(22783),a=r(50923),o=r(37843),s=[0,0,0];function l(e,t,r){for(let n=0;n.999999)return[!0,t]}return[!1,2]}(i)}}else{(p=i.Ay.newInstance()).setNormal(0,0,1);let n=[0,1,0,1,0,1];t&&(n=c),p.setOrigin(n[0],n[2],.5*(n[4]+n[5])),e.setSlicePlane(p),r=`Plane${p.getMTime()}Image${t?.getMTime?.()??0}`}return{resGeomString:r,slicePD:d,slicePlane:p,orthoSlicing:l,orthoAxis:u}}function c(e,t,r,i,a){r.setInputData(e),i.setInputConnection(r.getOutputPort()),i.setCutFunction(t),a.setInputConnection(i.getOutputPort()),a.update();let o=a.getOutputData(),s=o.getPoints().getData(),u=o.getPolys().getData(),c=[...t.getNormal()];n.Ay.normalize(c);let d=o.getPoints().getNumberOfPoints(),p=new Float32Array(3*d);return l(p,c,d),{points:s,polys:u,normalsData:p}}function d(e,t,r,i){let a=new Float32Array(12),o=e.worldToIndex(t.getOrigin(),[0,0,0]),s=[(r+1)%3,(r+2)%3].sort(),u=e.getSpatialExtent(),c=0;for(let e=0;e<2;++e)for(let t=0;t<2;++t)a[c+r]=o[r],a[c+s[0]]=u[2*s[0]+t],a[c+s[1]]=u[2*s[1]+e],c+=3;i.setMatrix(e.getIndexToWorld()),i.transformPoints(a,a);let d=new Uint16Array([3,0,1,3,3,0,3,2]),p=[...t.getNormal()];n.Ay.normalize(p);let m=new Float32Array(12);return l(m,p,4),{points:a,polys:d,normalsData:m}}},21339:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(31320);n.fX.ov;let i=n.fX.ov},21432:(e,t,r)=>{"use strict";function n(e){return!!(e&&"function"==typeof e.getZoom&&"function"==typeof e.setZoom)}function i(e){return!!(e&&"function"==typeof e.getPan&&"function"==typeof e.setPan)}function a(e){return!!(e&&"function"==typeof e.getFrameOfReferenceUID)}r.d(t,{IU:()=>a,qV:()=>n,sv:()=>i})},21483:(e,t,r)=>{"use strict";function n(e){if("function"==typeof structuredClone)try{return structuredClone(e)}catch{}return function e(t,r){if(null===t||"object"!=typeof t)return t;let n=r.get(t);if(n)return n;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Map){let n=new Map;return r.set(t,n),t.forEach((t,i)=>{n.set(e(i,r),e(t,r))}),n}if(t instanceof Set){let n=new Set;return r.set(t,n),t.forEach(t=>{n.add(e(t,r))}),n}if(Array.isArray(t)){let n=[];return r.set(t,n),t.forEach((t,i)=>{n[i]=e(t,r)}),n}let i={};return r.set(t,i),Reflect.ownKeys(t).forEach(n=>{i[n]=e(t[n],r)}),i}(e,new WeakMap)}r.d(t,{G:()=>n})},21569:(e,t,r)=>{"use strict";r.d(t,{A:()=>m});var n=r(72661),i=r(53725),a=r(77280),o=r(39935),s=r(54763),l=r(22233),u=r(12668),c=r(73589);class d extends c.A{get zoom(){return Math.max(this.state.viewState.scale??1,.001)}get pan(){return(0,u.cP)(this.getCanvasMapping())}canvasToWorld(e){let t=this.getCanvasMapping(),r=this.getChannelLayouts(),n=[(e[0]-t.xOffset)/t.effectiveRatio,(e[1]-t.yOffset)/t.effectiveRatio],i=0;for(let e=0;e=r.length?[0,0]:[e[0]/this.state.waveform.numberOfSamples*this.state.metrics.ecgWidth*t.effectiveRatio+t.xOffset,(r[n].baseline-e[1]*this.state.metrics.channelScale)*t.effectiveRatio+t.yOffset]}getFrameOfReferenceUID(){return this.state.frameOfReferenceUID}withZoom(e,t){let r=Math.max(e,.001);return t?this.cloneWithViewState({...this.state.viewState,anchorWorld:(0,u.H3)(t,this.getCanvasMapping()),anchorCanvas:[t[0]/Math.max(this.state.canvas.clientWidth,1),t[1]/Math.max(this.state.canvas.clientHeight,1)],scale:r,scaleMode:"fit"}):this.cloneWithViewState({...this.state.viewState,scale:r,scaleMode:"fit"})}withPan(e){return this.cloneWithViewState({...this.state.viewState,anchorWorld:(0,u.Kw)([e[0],e[1]],this.getCanvasMapping())})}buildICamera(){let e=this.getCanvasMapping(),t=[this.state.canvas.clientWidth/2,this.state.canvas.clientHeight/2];return{parallelProjection:!0,focalPoint:this.canvasToWorld(t),position:[0,0,0],viewUp:[0,-1,0],parallelScale:this.state.canvas.clientHeight/2/Math.max(e.effectiveRatio,.001),viewPlaneNormal:[0,0,1]}}getCanvasMapping(){return this.cachedCanvasMapping||=(0,u.MY)({canvas:this.state.canvas,camera:this.state.viewState,metrics:this.state.metrics}),this.cachedCanvasMapping}getChannelLayouts(){return(0,o.computeECGChannelLayouts)({visibleChannels:(0,o.getVisibleECGChannels)(this.state.waveform.channels,this.state.dataPresentation?.visibleChannels),channelScale:this.state.metrics.channelScale})}cloneWithViewState(e){return new d({...this.state,viewState:e})}}class p extends i.A{static get useCustomRenderingPipeline(){return!0}getUseCustomRenderingPipeline(){return!0}constructor(e){super(e),this.type=a.NV.ECG_NEXT,this.renderingEngineId=e.renderingEngineId,this.canvas=(0,n.Ay)(this.element),this.canvasContext=this.canvas.getContext("2d"),this.dataProvider=e.dataProvider||new s.c,this.renderPathResolver=e.renderPathResolver||(0,l.X)(),this.renderContext={viewportId:this.id,type:"ecg",renderingEngineId:this.renderingEngineId,element:this.element,canvas:this.canvas,canvasContext:this.canvasContext},this.viewState=(0,u.hl)({timeRange:[0,1],valueRange:[-1,1]}),this.element.setAttribute("data-viewport-uid",this.id),this.element.setAttribute("data-rendering-engine-uid",this.renderingEngineId),this.resize()}async setDisplaySets(...e){for(let{displaySetId:t}of(this.removeAllData(),e)){let e=await this.loadWaveformData(t),r=e.numberOfSamples/e.samplingFrequency*1e3;this.setDefaultDataPresentation(t,{visible:!0,opacity:1,visibleChannels:e.channels.map((e,t)=>t),lineWidth:1,amplitudeScale:1,showGrid:!0}),this.viewState=(0,u.hl)({timeRange:[0,r],valueRange:(0,o.getDefaultECGValueRange)(e)}),await this.addLoadedData(t,e,{renderMode:"signal2d"})}}getWaveformData(){return this.getWaveformBindingData()??null}getViewReference(e={}){let t=this.getFirstBinding()?.data.id;return{FrameOfReferenceUID:this.getFrameOfReferenceUID(),dataId:t,referencedImageId:this.getCurrentImageId(),sliceIndex:0}}getViewReferenceId(e={}){return`imageId:${this.getCurrentImageId()}`}setViewReference(e){}getSliceIndex(){return 0}getZoom(){return this.getResolvedView()?.zoom??Math.max(this.viewState.scale??1,.001)}normalizeViewState(e){return(0,u.$3)(e)}getReferenceViewContexts(){let e=this.getFirstBinding();return e?[{dataId:e.data.id,dataIds:[e.data.id],frameOfReferenceUID:this.getFrameOfReferenceUID(),imageIds:[e.data.id],currentImageIdIndex:0}]:super.getReferenceViewContexts()}setZoom(e,t){let r=this.getResolvedView();if(r)return void this.applyResolvedViewState(r.withZoom(e,t).state.viewState);this.setViewState({scale:Math.max(e,.001),scaleMode:"fit"})}getPan(){return this.getResolvedView()?.pan??[0,0]}setPan(e){let t=this.getResolvedView();t&&this.applyResolvedViewState(t.withPan(e).state.viewState)}getVisibleChannels(){let e=this.getWaveformBindingData();if(!e)return[];let t=e.id,r=new Set(this.getDisplaySetPresentation(t)?.visibleChannels||e.channels.map((e,t)=>t));return e.channels.map((e,t)=>({name:e.name,visible:r.has(t)}))}getContentDimensions(){let e=this.getCurrentRendering();return e?{width:e.metrics.ecgWidth,height:e.metrics.ecgHeight}:{width:0,height:0}}resize(){let{clientWidth:e,clientHeight:t}=this.canvas;if(this.canvas.width!==e||this.canvas.height!==t){let r=window.devicePixelRatio||1;this.canvas.width=Math.floor(Math.max(1,e)*r),this.canvas.height=Math.floor(Math.max(1,t)*r)}this.render()}render(){this.renderBindings()}customRenderViewportToCanvas(){this.render()}resetViewState(){let e=this.getCameraForEvent();return this.viewState=(0,u.hl)({timeRange:this.viewState.timeRange,valueRange:this.viewState.valueRange}),this.modified(e),this.triggerCameraResetEvent(),!0}getRotation(){return 0}scroll(){}getCurrentImageId(){let e=this.getFirstBinding();return e?.data.id}getCurrentImageIdIndex(){return 0}getImageIds(){let e=this.getFirstBinding();return e?[e.data.id]:[]}getImageData(){let e=this.getWaveformBindingData();if(!e)return null;let t=[e.numberOfSamples,65536,e.channels.length],r=[1,1,1],n=[1,0,0,0,1,0,0,0,1];return{dimensions:t,spacing:r,origin:[0,0,0],direction:n,imageData:{getDirection:()=>n,getDimensions:()=>t,getRange:()=>[0,1],getSpacing:()=>r,worldToIndex:e=>[e[0],e[1]+32768,e[2]],indexToWorld:e=>[e[0],e[1]-32768,e[2]]},scalarData:new Int16Array(0),hasPixelSpacing:!1,preScale:{scaled:!1},metadata:{Modality:"ECG",FrameOfReferenceUID:""}}}setScaleAtCanvasPoint(e,t){let r=this.getResolvedView();if(!r)return void this.setZoom(e);this.applyResolvedViewState(r.withZoom(e,t).state.viewState)}async loadWaveformData(e){let t=await this.dataProvider.load(e);if(!h(t))throw Error(`[ECGViewport] Loaded data for ${e} is not a valid ECG waveform`);return t}getWaveformBindingData(){let e=this.getFirstBinding();if(e&&h(e.data))return e.data}getCurrentRendering(){let e=this.getFirstBinding();if(e&&"signal2d"===e.rendering.renderMode)return e.rendering}getResolvedView(){let e=this.getWaveformBindingData(),t=this.getCurrentRendering();if(e&&t)return new d({viewState:this.viewState,canvas:this.canvas,dataPresentation:this.getDisplaySetPresentation(e.id),frameOfReferenceUID:`ecg-viewport-${this.id}`,metrics:t.metrics,waveform:e})}applyResolvedViewState(e){this.setViewState(e)}}let m=p;function h(e){return"object"==typeof e&&null!==e&&"ecg"===e.type&&Array.isArray(e.channels)&&"number"==typeof e.numberOfSamples&&"number"==typeof e.samplingFrequency&&"number"==typeof e.numberOfChannels}},21598:(e,t,r)=>{"use strict";let n=r(50026),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";e.exports=new n("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;let t=0,r=e.length;for(let n=0;n64)){if(r<0)return!1;t+=6}}return t%8==0},construct:function(e){let t=e.replace(/[\r\n=]/g,""),r=t.length,n=0,a=[];for(let e=0;e>16&255),a.push(n>>8&255),a.push(255&n)),n=n<<6|i.indexOf(t.charAt(e));let o=r%4*6;return 0===o?(a.push(n>>16&255),a.push(n>>8&255),a.push(255&n)):18===o?(a.push(n>>10&255),a.push(n>>2&255)):12===o&&a.push(n>>4&255),new Uint8Array(a)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){let t="",r=0,n=e.length;for(let a=0;a>18&63],t+=i[r>>12&63],t+=i[r>>6&63],t+=i[63&r]),r=(r<<8)+e[a];let a=n%3;return 0===a?(t+=i[r>>18&63],t+=i[r>>12&63],t+=i[r>>6&63],t+=i[63&r]):2===a?(t+=i[r>>10&63],t+=i[r>>4&63],t+=i[r<<2&63],t+=i[64]):1===a&&(t+=i[r>>2&63],t+=i[r<<4&63],t+=i[64],t+=i[64]),t}})},21601:(e,t,r)=>{"use strict";r.d(t,{A:()=>W});var n=r(56109),i=r(91336),a=r(50923),o=r(54268),s=r(79267),l=r(77280),u=r(56872),c=r(3922),d=r(42215),p=r(69228),m=r(60251),h=r(48320),f=r(97748),g=r(22911),v=r(52971),y=r(74092),b=r(20549),I=r(8889),x=r(6297),C=r(52219),A=r(25102),T=r(55580),S=r(18459),w=r(92449),O=r(50987),P=r(92154),_=r(28478),E=r(88824),D=r(91711),R=r(3793),M=r(39216),N=r(79657),V=r(11937),L=r(99963);let B=e=>!("number"==typeof e&&Number.isFinite(e));var F=r(92557),U=r(80069);class k extends T.A{constructor(e){if(super(e),this.useCPURendering=!1,this.sharpening=0,this.smoothing=0,this.perVolumeIdDefaultProperties=new Map,this.viewportProperties={},this.volumeIds=new Set,this.setRotation=e=>{let t=this.getPan(this.fitToCanvasCamera),r=this.getPan(),n=this.getCamera(),o=i.jb([0,0],t,r);this.setPan(o,!1);let{flipVertical:s}=this.getCamera(),u=s?a.ze([0,0,0],this.initialViewUp):this.initialViewUp;this.setCameraNoEvent({viewUp:u}),this.rotateCamera(e);let c=this.getPan(),d=this.getPan(this.fitToCanvasCamera),m=i.jb([0,0],c,d),h=i.WQ([0,0],t,m);if(this.setPan(h,!1),this._suppressCameraModifiedEvents)return;let f={previousCamera:n,camera:this.getCamera(),element:this.element,viewportId:this.id,renderingEngineId:this.renderingEngineId};(0,p.A)(this.element,l.sV.CAMERA_MODIFIED,f)},this.setSharpening=e=>{this.sharpening=e,this.render()},this.setSmoothing=e=>{this.smoothing=e,this.render()},this.getRenderPasses=()=>{if(!this.shouldUseCustomRenderPass())return null;let e=[];try{return this.smoothing>0&&e.push((0,U.y)(this.smoothing)),this.sharpening>0&&e.push((0,U.b)(this.sharpening)),e.length?e:null}catch(e){return console.warn("Failed to create custom render passes:",e),null}},this.getDefaultProperties=e=>{let t;return(void 0!==e&&(t=this.perVolumeIdDefaultProperties.get(e)),void 0!==t)?t:{...this.globalDefaultProperties}},this.getProperties=e=>{if(!this._getApplicableVolumeActor(e))return;let{colormap:t,VOILUTFunction:r,interpolationType:n,invert:i,slabThickness:a,preset:s}=this.viewportProperties;if(e||=this.getVolumeId(),!o.Ay.getVolume(e))return null;let l=this.getActors().find(t=>t.referencedId===e);if(!l)return;let u=l.actor.getProperty().getRGBTransferFunction(0),[c,d]=this.viewportProperties?.VOILUTFunction==="SIGMOID"?(0,_.A)(u):u.getRange(),p=this.getColormap(e);return{colormap:e&&p?p:t,voiRange:{lower:c,upper:d},VOILUTFunction:r,interpolationType:n,invert:i,slabThickness:a,preset:s,sharpening:this.sharpening,smoothing:this.smoothing}},this.getColormap=e=>{let t=this._getApplicableVolumeActor(e);if(!t)return;let{volumeActor:r}=t,{nodes:n}=this._getOrCreateColorTransferFunction(e).getState(),i=n.reduce((e,t)=>(e.push(t.x,t.r,t.g,t.b),e),[]),a=(0,m.findMatchingColormap)(i,r)||{},{opacity:o,opacityMapping:s,threshold:l}=(0,m.getOpacityState)(r);return a.opacity=o,a.opacityMapping=s,a.threshold=l,a},this.getRotation=()=>{let{viewUp:e,viewPlaneNormal:t,flipVertical:r}=this.getCameraNoRotation(),n=r?a.ze([0,0,0],this.initialViewUp):this.initialViewUp;if(!n)return 0;let i=180*a.g7(n,e)/Math.PI,o=a.$A([0,0,0],n,e);return a.Om(o,t)>=0?i:(360-i)%360},this.getFrameOfReferenceUID=()=>this._FrameOfReferenceUID,this.canvasToWorldTiled=e=>{let t=this.getVtkActiveCamera();t.setIsPerformingCoordinateTransformation?.(!0);let r=this.getRenderer(),n=this.getVtkDisplayCoordsTiled(e),i=this.getRenderingEngine().offscreenMultiRenderWindow.getOpenGLRenderWindow().displayToWorld(n[0],n[1],n[2],r);return t.setIsPerformingCoordinateTransformation?.(!1),[i[0],i[1],i[2]]},this.canvasToWorldContextPool=e=>{let t=this.getVtkActiveCamera();t.setIsPerformingCoordinateTransformation?.(!0);let r=this.getRenderer(),n=window.devicePixelRatio||1,{width:i,height:a}=this.canvas,[o,s,l,u]=r.getViewport(),c=[e[0]*n,e[1]*n],d=[o+c[0]/i*(l-o),s+(1-c[1]/a)*(u-s),0],p=r.normalizedDisplayToProjection(d[0],d[1],d[2]),m=r.projectionToView(p[0],p[1],p[2],i/a),h=r.viewToWorld(m[0],m[1],m[2]);return t.setIsPerformingCoordinateTransformation?.(!1),[h[0],h[1],h[2]]},this.getVtkDisplayCoordsTiled=e=>{let t=window.devicePixelRatio||1,r=[e[0]*t,e[1]*t],n=this.getRenderingEngine().offscreenMultiRenderWindow.getOpenGLRenderWindow().getSize(),i=[r[0]+this.sx,r[1]+this.sy];return i[1]=n[1]-i[1],[i[0],i[1],0]},this.getVtkDisplayCoordsContextPool=e=>{let t=window.devicePixelRatio||1,r=[e[0]*t,e[1]*t],n=this.getRenderer(),{width:i,height:a}=this.canvas,[o,s,l,u]=n.getViewport(),c=u-s,d=r[0]/i*(l-o)*i,p=r[1]/a*c*a,m=[d,c*a-p];return[m[0],m[1],0]},this.worldToCanvasTiled=e=>{let t=this.getVtkActiveCamera();t.setIsPerformingCoordinateTransformation?.(!0);let r=this.getRenderer(),n=this.getRenderingEngine().offscreenMultiRenderWindow.getOpenGLRenderWindow(),i=n.getSize(),a=n.worldToDisplay(...e,r);a[1]=i[1]-a[1];let o=[a[0]-this.sx,a[1]-this.sy],s=window.devicePixelRatio||1,l=[o[0]/s,o[1]/s];return t.setIsPerformingCoordinateTransformation(!1),l},this.worldToCanvasContextPool=e=>{let t=this.getVtkActiveCamera();t.setIsPerformingCoordinateTransformation?.(!0);let r=this.getRenderer(),{width:n,height:i}=this.canvas,[a,o,s,l]=r.getViewport(),u=r.worldToView(e[0],e[1],e[2]),c=r.viewToProjection(u[0],u[1],u[2],n/i),d=r.projectionToNormalizedDisplay(c[0],c[1],c[2]),p=(d[0]-a)/(s-a),m=(d[1]-o)/(l-o),h=window.devicePixelRatio||1;return t.setIsPerformingCoordinateTransformation(!1),[p*n/h,(1-m)*i/h]},this.hasImageURI=e=>this.getActors().filter(e=>(0,O.N)(e,"vtkVolume")).some(({uid:t,referencedId:r})=>{let n=o.Ay.getVolume(r||t);return!!n?.getImageIdIndex&&(void 0!==n.getImageIdIndex(e)||void 0!==n.getImageURIIndex(e))}),this.getImageIds=e=>{let t=this._getApplicableVolumeActor(e);if(!t)throw Error(`No actor found for the given volumeId: ${e}`);let r=t.volumeId,n=o.Ay.getVolume(r);if(!n)throw Error(`imageVolume with id: ${r} does not exist in cache`);return n.imageIds},this.renderingPipelineFunctions={worldToCanvas:{tiled:this.worldToCanvasTiled,contextPool:this.worldToCanvasContextPool},canvasToWorld:{tiled:this.canvasToWorldTiled,contextPool:this.canvasToWorldContextPool},getVtkDisplayCoords:{tiled:this.getVtkDisplayCoordsTiled,contextPool:this.getVtkDisplayCoordsContextPool},getRenderer:{tiled:this.getRendererTiled,contextPool:this.getRendererContextPool}},this.useCPURendering=(0,d.LH)(),this.useCPURendering)throw Error("VolumeViewports cannot be used whilst CPU Fallback Rendering is enabled.");this._configureRenderingPipeline();let t=this.getRenderer(),r=S.Ay.newInstance();switch(t.setActiveCamera(r),this.type){case u.A.ORTHOGRAPHIC:case u.A.VOLUME_3D:r.setParallelProjection(!0);break;case u.A.PERSPECTIVE:r.setParallelProjection(!1);break;default:throw Error(`Unrecognized viewport type: ${this.type}`)}this.initializeVolumeNewImageEventDispatcher()}static get useCustomRenderingPipeline(){return!1}isOrientationChangeable(){return!0}getSliceViewInfo(){throw Error("Method not implemented.")}applyViewOrientation(e,t=!0,r=!1){let{viewPlaneNormal:n,viewUp:i}=this._getOrientationVectors(e)||{};if(!n||!i)return;let a=this.getVtkActiveCamera();a.setDirectionOfProjection(-n[0],-n[1],-n[2]),a.setViewUpFrom(i),this.initialViewUp=i,t&&this.resetCamera({resetOrientation:!1,resetRotation:!1,suppressEvents:r})}initializeVolumeNewImageEventDispatcher(){let e=(function(e){let{viewportId:t}=e.detail;t===this.id&&!this.isDisabled&&this.getImageData()&&(0,A.A)(e)}).bind(this),t=(function(r){let{viewportId:n}=r.detail;n===this.id&&(this.element.removeEventListener(l.sV.CAMERA_MODIFIED,e),c.A.removeEventListener(l.sV.ELEMENT_DISABLED,t),(0,A.g)(n))}).bind(this);this.element.removeEventListener(l.sV.CAMERA_MODIFIED,e),this.element.addEventListener(l.sV.CAMERA_MODIFIED,e),c.A.addEventListener(l.sV.ELEMENT_DISABLED,t)}setVOILUTFunction(e,t,r){Object.values(l.yX).includes(e)||(e=l.yX.LINEAR);let{voiRange:n}=this.getProperties();this.setVOI(n,t,r),this.viewportProperties.VOILUTFunction=e}setColormap(e,t,r){let i=this._getApplicableVolumeActor(t);if(!i)return;let{volumeActor:a}=i,o=n.Ay.newInstance(),s=m.resolveColormap(e.name);if(!s)throw Error(`Colormap ${e} not found`);let u=a.getProperty().getRGBTransferFunction(0).getRange();if(o.applyColorMap(s),o.setMappingRange(u[0],u[1]),a.getProperty().setRGBTransferFunction(0,o),this.viewportProperties.colormap=e,this._applyColormapOpacity(e,a),!r){let e=this.getColormap(t),r={viewportId:this.id,colormap:e,volumeId:t};(0,p.A)(this.element,l.sV.VOI_MODIFIED,r),(0,p.A)(this.element,l.sV.COLORMAP_MODIFIED,r)}}_applyColormapOpacity(e,t){let r=Array.isArray(e.opacityMapping)?e.opacityMapping:Array.isArray(e.opacity)?e.opacity:void 0,n="number"==typeof e.opacity?e.opacity:void 0;void 0!==r?(0,m.updateOpacityMapping)(t,r,n):void 0!==n&&(0,m.updateOpacity)(t,n)}setOpacity(e,t){let r=this._getApplicableVolumeActor(t);if(!r)return;let{volumeActor:n}=r;this._applyColormapOpacity(e,n),this.viewportProperties.colormap||(this.viewportProperties.colormap={});let{opacity:i,opacityMapping:a}=(0,m.getOpacityState)(n);this.viewportProperties.colormap.opacity=i,this.viewportProperties.colormap.opacityMapping=a;let o=this.getColormap(t),s={viewportId:this.id,colormap:o,volumeId:t};(0,p.A)(this.element,l.sV.COLORMAP_MODIFIED,s)}setInvert(e,t,r){let n=this._getApplicableVolumeActor(t);if(!n)return;let i=n.volumeId,a=this._getOrCreateColorTransferFunction(i);if((0,h.A)(a),this.viewportProperties.invert=e,!r){let e={...this.getVOIModifiedEventDetail(i),invertStateChanged:!0};(0,p.A)(this.element,l.sV.VOI_MODIFIED,e)}}getVOIModifiedEventDetail(e){let t=this._getApplicableVolumeActor(e);if(!t)throw Error(`No actor found for the given volumeId: ${e}`);let r=t.volumeActor.getProperty().getRGBTransferFunction(0).getMappingRange(),n=this.getColormap(e),{VOILUTFunction:i,invert:a}=this.getProperties(e);return{viewportId:this.id,range:{lower:r[0],upper:r[1]},volumeId:t.volumeId,VOILUTFunction:i,colormap:n,invert:a}}_getOrCreateColorTransferFunction(e){let t=this._getApplicableVolumeActor(e);if(!t)return null;let{volumeActor:r}=t,i=r.getProperty().getRGBTransferFunction(0);if(i)return i;let a=n.Ay.newInstance();return r.getProperty().setRGBTransferFunction(0,a),a}setInterpolationType(e,t){let r=this._getApplicableVolumeActor(t);if(!r)return;let{volumeActor:n}=r;n.getProperty().setInterpolationType(e),this.viewportProperties.interpolationType=e}setVOI(e,t,r=!1){let n=this._getApplicableVolumeActor(t);if(!n)return;let{volumeActor:i}=n,a=n.volumeId;if(void 0===e)throw Error("voiRangeToUse is undefined, need to implement this in the new volume model");if([e.lower,e.upper].some(B))return void console.warn("VOI range contains invalid values, ignoring setVOI request",e);let{VOILUTFunction:o}=this.getProperties(a);if(o===l.yX.SAMPLED_SIGMOID){let t=(0,f.A)(e);i.getProperty().setRGBTransferFunction(0,t)}else{let{lower:t,upper:r}=e;i.getProperty().getRGBTransferFunction(0).setRange(t,r)}if(!r){let e={...this.getVOIModifiedEventDetail(a)};(0,p.A)(this.element,l.sV.VOI_MODIFIED,e)}this.viewportProperties.voiRange=e}rotateCamera(e){let t=e-this.getRotation();this.getVtkActiveCamera().roll(-t)}setDefaultProperties(e,t){null==t?this.globalDefaultProperties=e:this.perVolumeIdDefaultProperties.set(t,e)}clearDefaultProperties(e){null==e?(this.globalDefaultProperties={},this.resetProperties()):(this.perVolumeIdDefaultProperties.delete(e),this.resetToDefaultProperties(e))}getViewReference(e={}){let t=super.getViewReference(e),r=this.getVolumeId(e);if(e?.forFrameOfReference!==!0&&(t.volumeId=r),"number"!=typeof e?.sliceIndex)return t;let{viewPlaneNormal:n}=t,i=e?.sliceIndex-this.getSliceIndex(),{sliceRangeInfo:a}=(0,w.A)(this,r,!0),{sliceRange:o,spacingInNormalDirection:s,camera:l}=a,{focalPoint:u,position:c}=l,{newFocalPoint:d}=(0,P.A)(u,c,o,n,s,i);return t.cameraFocalPoint=d,t}isReferenceViewable(e,t){if(!e.FrameOfReferenceUID||!super.isReferenceViewable(e,t))return!1;if(t?.withNavigation){let{referencedImageId:t}=e;return!t||this.hasImageURI(t)}let r=this.getSliceIndex(),{sliceIndex:n}=e;return Array.isArray(n)?n[0]<=r&&r<=n[1]:void 0===n||n===r}scroll(e=1){let t=this.getVolumeId(),{sliceRangeInfo:r}=(0,w.A)(this,t,!0);if(!r)return;let{sliceRange:n,spacingInNormalDirection:i,camera:a}=r,{focalPoint:o,viewPlaneNormal:s,position:l}=a,{newFocalPoint:u,newPosition:c}=(0,P.A)(o,l,n,s,i,e);this.setCamera({focalPoint:u,position:c}),this.render()}setBestOrentation(e,t){if(!e&&!t)return;let{viewPlaneNormal:r}=this.getCamera();if(G(r,t)&&G(r,e))return;let n=this._getAcquisitionPlaneOrientation();if(G(n.viewPlaneNormal,t)&&G(n.viewPlaneNormal,e))return void this.setOrientation(n);for(let r of Object.values(L.A))if(G(r.viewPlaneNormal,t)&&G(r.viewPlaneNormal,e))return void this.setOrientation(r);let i=a.$A(a.vt(),t||n.viewPlaneNormal,e);a.S8(i,i),this.setOrientation({viewPlaneNormal:i})}setViewPlane(e){let{point:t,inPlaneVector1:r,inPlaneVector2:n,FrameOfReferenceUID:i}=e;this.setBestOrentation(r,n);let{focalPoint:o,viewPlaneNormal:s}=this.getCamera(),l=a.Re(a.vt(),t,o),u=a.Om(l,s),c=a.Ln(a.vt(),o,s,u);this.setViewReference({FrameOfReferenceUID:i,cameraFocalPoint:c,viewPlaneNormal:s})}setViewReference(e){if(!e)return;let t=this.getVolumeId(),{FrameOfReferenceUID:r,cameraFocalPoint:n,referencedImageId:i,planeRestriction:o,viewPlaneNormal:s,viewUp:u}=e,{sliceIndex:c}=e;if(o&&!s)return this.setViewPlane(o);let{focalPoint:d,viewPlaneNormal:p,position:m}=this.getCamera(),h=(0,E.WC)(p,s),f=(0,E.Ay)(p,s);if("number"==typeof c&&void 0!==t&&e.volumeId===t&&(h||f)){let{currentStepIndex:e,sliceRangeInfo:r,numScrollSteps:n}=(0,w.A)(this,t,!0),{sliceRange:i,spacingInNormalDirection:a}=r;h&&(c=n-c-1);let o=c-e,{newFocalPoint:s,newPosition:l}=(0,P.A)(d,m,i,p,a,o);this.setCamera({focalPoint:s,position:l})}else if(r===this.getFrameOfReferenceUID()){if(s&&!h&&!f){this.setOrientation({viewPlaneNormal:s,viewUp:u},!0,!0),this.setViewReference(e);return}if(i&&this.isInAcquisitionPlane()){let{imagePositionPatient:e}=M.get(l.nb.IMAGE_PLANE,i),{focalPoint:t}=this.getCamera(),r=a.Re(a.vt(),t,e),n=a.Om(r,p),o=a.Ln(a.vt(),t,[-p[0],-p[1],-p[2]],n),s=a.Re(a.vt(),o,t),u=a.WQ(a.vt(),m,s);this.setCamera({focalPoint:o,position:u}),this.render();return}if(n){let e=a.Re([0,0,0],n,d),t=s??p,r=a.Om(e,t);(0,E.Ay)(r,0)||a.hs(e,t,r);let i=a.WQ([0,0,0],d,e),o=a.WQ([0,0,0],m,e);this.setCamera({focalPoint:i,position:o})}}else throw Error(`Incompatible view refs: ${r}!==${this.getFrameOfReferenceUID()}`)}setThreshold(e,t){let r=this._getApplicableVolumeActor(t);if(!r)return;let{volumeActor:n}=r;(0,m.updateThreshold)(n,e.threshold),this.viewportProperties.colormap||(this.viewportProperties.colormap={}),this.viewportProperties.colormap.threshold=e.threshold;let i=this.getColormap(t),a={viewportId:this.id,colormap:i,volumeId:t};(0,p.A)(this.element,l.sV.COLORMAP_MODIFIED,a)}setProperties({voiRange:e,VOILUTFunction:t,invert:r,colormap:n,preset:i,interpolationType:a,slabThickness:o,sampleDistanceMultiplier:s,sharpening:l,smoothing:u}={},c,d=!1){null==this.globalDefaultProperties&&this.setDefaultProperties({voiRange:e,VOILUTFunction:t,invert:r,colormap:n,preset:i,slabThickness:o,sampleDistanceMultiplier:s}),void 0!==r&&this.viewportProperties.invert!==r&&this.setInvert(r,c,d),n?.name&&this.setColormap(n,c,d),(n?.opacity!=null||n?.opacityMapping!=null)&&this.setOpacity(n,c),n?.threshold!=null&&this.setThreshold(n,c),void 0!==e&&this.setVOI(e,c,d),void 0!==a&&this.setInterpolationType(a),void 0!==t&&this.setVOILUTFunction(t,c,d),void 0!==i&&this.setPreset(i,c,d),void 0!==o&&this.setSlabThickness(o),void 0!==s&&this.setSampleDistanceMultiplier(s),void 0!==l&&this.setSharpening(l),void 0!==u&&this.setSmoothing(u)}shouldUseCustomRenderPass(){return!this.useCPURendering}_restoreVolumeRenderingDefaults(e,t){if(!(0,O.e)(e))return;let r=this.getDefaultProperties(t);if(r?.preset||r?.colormap)this.setProperties(r,t,!0);else{let t=e.actor.getProperty().getRGBTransferFunction(0);(0,y.setTransferFunctionNodes)(t,this.initialTransferFunctionNodes)}}resetToDefaultProperties(e){let t=this.globalDefaultProperties;t.colormap?.name&&this.setColormap(t.colormap,e),t.colormap?.opacity!=null&&this.setOpacity(t.colormap,e),void 0!==t.voiRange&&this.setVOI(t.voiRange,e),void 0!==t.VOILUTFunction&&this.setVOILUTFunction(t.VOILUTFunction,e),void 0!==t.invert&&this.setInvert(t.invert,e),void 0!==t.slabThickness&&(this.setSlabThickness(t.slabThickness),this.viewportProperties.slabThickness=t.slabThickness),void 0!==t.sampleDistanceMultiplier&&this.setSampleDistanceMultiplier(t.sampleDistanceMultiplier),void 0!==t.preset&&this.setPreset(t.preset,e,!1),this.render()}setPreset(e,t,r){let n=this._getApplicableVolumeActor(t);if(!n)return;let{volumeActor:i}=n,a="string"==typeof e?s.E3.find(t=>t.name===e):e;a&&((0,D.A)(i,a),this.viewportProperties.preset=a.name,this.render(),r||(0,p.A)(this.element,l.sV.PRESET_MODIFIED,{viewportId:this.id,volumeId:n.volumeId,actor:i,presetName:a.name}))}setSampleDistanceMultiplier(e){}async setVolumes(e,t=!1,r=!1){this.clearDisplaySets();let n=e[0].volumeId,i=o.Ay.getVolume(n);if(!i)throw Error(`imageVolume with id: ${n} does not exist, you need to create/allocate the volume first`);let a=i.metadata.FrameOfReferenceUID;this._isValidVolumeInputArray(e,a),this._FrameOfReferenceUID=a,e.forEach(e=>{this._addVolumeId(e.volumeId)});let s=[];for(let t=0;t{let t=(0,x.$B)(e.displaySetId);if(!t?.imageIds?.length)throw Error(`[VolumeViewport] No registered imageIds for display set ${e.displaySetId}`);let r=(0,I.A)(t.volumeId??e.displaySetId);o.Ay.getVolume(r)||(await (0,b.createAndCacheVolume)(r,{imageIds:t.imageIds})).load();let n={volumeId:r,...e.options??{}};await this.setVolumes([n])})}async addVolumes(e,t=!1,r=!1){let n=o.Ay.getVolume(e[0].volumeId);if(!n)throw Error(`imageVolume with id: ${n.volumeId} does not exist`);let i=[];this._isValidVolumeInputArray(e,this._FrameOfReferenceUID),e.forEach(e=>{this._addVolumeId(e.volumeId)});for(let t=0;tt.referencedId===e);if(!r)return;return{volumeActor:r.actor,volumeId:e,actorUID:r.uid}}let r=t[0];return{volumeActor:r.actor,volumeId:r.referencedId,actorUID:r.uid}}async _isValidVolumeInputArray(e,t){let r=e.length;for(let n=1;nt.referencedId===e);if(!t||!(0,O.N)(t,"vtkVolume"))return;let r=t.actor,n=o.Ay.getVolume(e),i=r.getMapper().getInputData();return{dimensions:i.getDimensions(),spacing:i.getSpacing(),origin:i.getOrigin(),direction:i.getDirection(),imageData:r.getMapper().getInputData(),metadata:{Modality:n?.metadata?.Modality,FrameOfReferenceUID:n?.metadata?.FrameOfReferenceUID},get scalarData(){return n?.voxelManager?.getScalarData()},scaling:n?.scaling,hasPixelSpacing:!0,voxelManager:n?.voxelManager}}setCameraClippingRange(){throw Error("Method not implemented.")}getSliceIndex(){throw Error("Method not implemented.")}setCamera(e,t){super.setCamera(e,t),this.setCameraClippingRange()}_setVolumeActors(e){for(let t=0;t{e.slabThickness>t&&(t=e.slabThickness)}),t}getIntensityFromWorld(e){let t=this.getDefaultActor();if(!(0,O.N)(t,"vtkVolume"))return;let{actor:r}=t,n=r.getMapper().getInputData(),i=o.Ay.getVolume(this.getVolumeId()),a=(0,g.A)(n,e);return i.voxelManager.getAtIJKPoint(a)}getVolumeId(e){let t=this.getActors();if(!t)return;if(!e?.volumeId){let e=t.find(e=>"vtkVolume"===e.actor.getClassName());return e?.referencedId||e?.uid}let r=t.find(t=>"vtkVolume"===t.actor.getClassName()&&t.referencedId===e?.volumeId);return r?.referencedId||r?.uid}getViewReferenceId(e={}){let{volumeId:t,sliceIndex:r}=e;if(!t){let e=this.getActors();if(!e||!(t=e.find(e=>"vtkVolume"===e.actor.getClassName())?.referencedId))return}let n=this.getSliceIndex();r??=n;let{viewPlaneNormal:i}=this.getCamera();return(0,F.A)({sliceIndex:r,viewPlaneNormal:i,volumeId:t})}_addVolumeId(e){this.volumeIds.add(e)}getAllVolumeIds(){return Array.from(this.volumeIds)}_configureRenderingPipeline(){let e=(0,V.q)();for(let t in this.renderingPipelineFunctions)if(Object.prototype.hasOwnProperty.call(this.renderingPipelineFunctions,t)){let r=this.renderingPipelineFunctions[t];this[t]=e?r.contextPool:r.tiled}}}function G(e,t){return!t||(0,E.Ay)(a.Om(e,t),0)}let W=k},21626:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>c});var n=r(17042),i=r(73416),a=r(19047),{vtkErrorMacro:o}=n.Ay,s=class{constructor(){this.segmentMapping={},this.segments=[null],this.faces=[]}addSegment(e){let t=e[0],r=e[e.length-1];if(t===r||e.length<2)return;let n=this.segmentMapping[t],i=this.segmentMapping[r];if(void 0!==n&&void 0!==i)if(Math.abs(n)===Math.abs(i)){let a=n0)for(let t=1;t0){let t=this.segments[n];for(let r=1;r0){let r=this.segments[i];for(let t=1;t{let r=e[0];if(!r)return void o("Invalid or missing input");let n=t[0]?.initialize()||a.Ay.newInstance();n.shallowCopy(r);let l=new s,u=r.getLines().getData(),c=0;for(;c{"use strict";r.d(t,{J:()=>c,X:()=>d});var n=r(7286),i=r(77280),a=r(69228),o=r(39935),s=r(12668);class l{async addData(e,t,r){let n={renderMode:"signal2d",canvas:e.canvas,canvasContext:e.canvasContext,metrics:{ecgWidth:1,ecgHeight:1,channelScale:1,worldToCanvasRatio:1,xOffsetCanvas:0,yOffsetCanvas:0}};return{rendering:n,updateDataPresentation:e=>{this.updateDataPresentation(n,e)},applyViewState:e=>{this.applyViewState(n,e)},getFrameOfReferenceUID:()=>this.getFrameOfReferenceUID(e),render:()=>{this.render(e,n,t)},removeData:()=>{this.removeData()}}}updateDataPresentation(e,t){e.currentDataPresentation=t}applyViewState(e,t){e.currentCamera=t}getFrameOfReferenceUID(e){return`ecg-viewport-${e.viewportId}`}render(e,t,r){!function(e,t,r){let{canvas:n,canvasContext:l,currentCamera:u,currentDataPresentation:c}=t;if(!u)return;let d=(0,o.getVisibleECGChannels)(r.channels,c?.visibleChannels);(0,o.ensureECGCanvasSize)(n);let p=(0,o.computeECGRenderMetrics)({canvas:n,visibleChannels:d,windowMs:Math.max(1,u.timeRange[1]-u.timeRange[0]),valueRange:u.valueRange}),m=(0,o.computeECGChannelLayouts)({visibleChannels:d,channelScale:p.channelScale}),h=function(e,t){let r=e.numberOfSamples/e.samplingFrequency*1e3,n=Math.max(0,Math.min(t.timeRange[0],r)),i=Math.max(n+1,t.timeRange[1]),a=Math.max(n+1,Math.min(i,r)),o=Math.max(0,Math.min(e.numberOfSamples-1,Math.floor(n/1e3*e.samplingFrequency))),s=Math.max(o+1,Math.min(e.numberOfSamples,Math.ceil(a/1e3*e.samplingFrequency)));return{startMs:n,endMs:a,startIndex:o,endIndex:s}}(r,u),f=window.devicePixelRatio||1;t.metrics=p;let{effectiveRatio:g,xOffset:v,yOffset:y}=function(e,t,r){let n=(0,s.MY)({metrics:e,camera:t,canvas:r});return{effectiveRatio:n.effectiveRatio,xOffset:n.xOffset,yOffset:n.yOffset}}(p,u,n);l.resetTransform(),l.fillStyle="#000000",l.fillRect(0,0,n.width,n.height),c?.visible!==!1&&(l.globalAlpha=c?.opacity??1,l.setTransform(g*f,0,0,g*f,v*f,y*f),(0,o.drawECGGrid)(l,p,{showGrid:c?.showGrid}),(0,o.drawECGTraces)({ctx:l,layouts:m,ecgWidth:p.ecgWidth,channelScale:p.channelScale,startIndex:h.startIndex,endIndex:h.endIndex,lineWidth:c?.lineWidth,amplitudeScale:c?.amplitudeScale}),(0,o.drawECGLabels)(l,m,p.worldToCanvasRatio),l.resetTransform(),l.globalAlpha=1,(0,a.A)(e.element,i.sV.IMAGE_RENDERED,{element:e.element,viewportId:e.viewportId,renderingEngineId:e.renderingEngineId,rendering:t}))}(e,t,r)}removeData(){}}class u{constructor(){this.id="ecg:canvas-signal",this.type=i.NV.ECG_NEXT}matches(e,t){return"ecg"===e.type&&"signal2d"===t.renderMode}createRenderPath(){return new l}}function c(){return[new u]}function d(e=c()){return new n.r(e)}},22477:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeIteratorImpl=void 0;let n=r(38485),i=r(47518);class a extends n.TraverserImpl{_iteratorCollection;_reference;_pointerBeforeReference;constructor(e,t,r){super(e),this._iteratorCollection=void 0,this._reference=t,this._pointerBeforeReference=r,(0,i.nodeIterator_iteratorList)().add(this)}get referenceNode(){return this._reference}get pointerBeforeReferenceNode(){return this._pointerBeforeReference}nextNode(){return(0,i.nodeIterator_traverse)(this,!0)}previousNode(){return(0,i.nodeIterator_traverse)(this,!1)}detach(){(0,i.nodeIterator_iteratorList)().delete(this)}static _create(e,t,r){return new a(e,t,r)}}t.NodeIteratorImpl=a},22706:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectWriter=void 0;let n=r(16950),i=r(5309),a=r(81320);class o extends a.BaseWriter{_currentList;_currentIndex;_listRegister;constructor(e,t){super(e),this._writerOptions=(0,n.applyDefaults)(t,{format:"object",wellFormed:!1,group:!1,verbose:!1})}serialize(e){return this._currentList=[],this._currentIndex=0,this._listRegister=[this._currentList],this.serializeNode(e,this._writerOptions.wellFormed),this._process(this._currentList,this._writerOptions)}_process(e,t){if(0===e.length)return{};let r={},a=!1,o=0,s=0,l=0,u=0;for(let t=0;t2)for(let r of e)t[i+(o++).toString()]=r;else t[a>1?i+(o++).toString():i]=e;return o}beginElement(e){let t=[];if(0===this._currentList.length)this._currentList.push({[e]:t});else{let r=this._currentList[this._currentList.length-1];this._isElementNode(r,e)?0!==r[e].length&&(0,n.isArray)(r[e][0])?r[e].push(t):r[e]=[r[e],t]:this._currentList.push({[e]:t})}this._currentIndex++,this._listRegister.length>this._currentIndex?this._listRegister[this._currentIndex]=t:this._listRegister.push(t),this._currentList=t}endElement(){this._currentList=this._listRegister[--this._currentIndex]}attribute(e,t){if(0===this._currentList.length)this._currentList.push({"@":{[e]:t}});else{let r=this._currentList[this._currentList.length-1];this._isAttrNode(r)?r["@"][e]=t:this._currentList.push({"@":{[e]:t}})}}comment(e){if(0===this._currentList.length)this._currentList.push({"!":e});else{let t=this._currentList[this._currentList.length-1];this._isCommentNode(t)?(0,n.isArray)(t["!"])?t["!"].push(e):t["!"]=[t["!"],e]:this._currentList.push({"!":e})}}text(e){if(0===this._currentList.length)this._currentList.push({"#":e});else{let t=this._currentList[this._currentList.length-1];this._isTextNode(t)?(0,n.isArray)(t["#"])?t["#"].push(e):t["#"]=[t["#"],e]:this._currentList.push({"#":e})}}instruction(e,t){let r=""===t?e:e+" "+t;if(0===this._currentList.length)this._currentList.push({"?":r});else{let e=this._currentList[this._currentList.length-1];this._isInstructionNode(e)?(0,n.isArray)(e["?"])?e["?"].push(r):e["?"]=[e["?"],r]:this._currentList.push({"?":r})}}cdata(e){if(0===this._currentList.length)this._currentList.push({$:e});else{let t=this._currentList[this._currentList.length-1];this._isCDATANode(t)?(0,n.isArray)(t.$)?t.$.push(e):t.$=[t.$,e]:this._currentList.push({$:e})}}_isAttrNode(e){return"@"in e}_isTextNode(e){return"#"in e}_isCommentNode(e){return"!"in e}_isInstructionNode(e){return"?"in e}_isCDATANode(e){return"$"in e}_isElementNode(e,t){return t in e}_getAttrKey(){return this._builderOptions.convert.att}_getNodeKey(e){switch(e){case i.NodeType.Comment:return this._builderOptions.convert.comment;case i.NodeType.Text:return this._builderOptions.convert.text;case i.NodeType.ProcessingInstruction:return this._builderOptions.convert.ins;case i.NodeType.CData:return this._builderOptions.convert.cdata;default:throw Error("Invalid node type.")}}}t.ObjectWriter=o},22783:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>g});var n=r(17042),i=r(11701),a=r(53188),o="coincide",s="disjoint";function l(e,t,r){return Math.abs(r[0]*(e[0]-t[0])+r[1]*(e[1]-t[1])+r[2]*(e[2]-t[2]))}function u(e,t,r,n){let a=[];(0,i.Re)(e,t,a);let o=(0,i.Om)(r,a);n[0]=e[0]-o*r[0],n[1]=e[1]-o*r[1],n[2]=e[2]-o*r[2]}function c(e,t,r){let n=(0,i.Om)(e,t),a=(0,i.Om)(t,t);return 0===a&&(a=1),r[0]=e[0]-n*t[0]/a,r[1]=e[1]-n*t[1]/a,r[2]=e[2]-n*t[2]/a,r}function d(e,t,r,n){let a=[];(0,i.Re)(e,t,a);let o=(0,i.Om)(r,a),s=(0,i.Om)(r,r);0!==s?(n[0]=e[0]-o*r[0]/s,n[1]=e[1]-o*r[1]/s,n[2]=e[2]-o*r[2]/s):(n[0]=e[0],n[1]=e[1],n[2]=e[2])}function p(e,t,r,n){let a={intersection:!1,betweenPoints:!1,t:Number.MAX_VALUE,x:[]},o=[],s=[];(0,i.Re)(t,e,o),(0,i.Re)(r,e,s);let l=(0,i.Om)(n,s),u=(0,i.Om)(n,o);return(u<0?-u:u)<=(l<0?-(1e-6*l):1e-6*l)||(a.t=l/u,a.x[0]=e[0]+a.t*o[0],a.x[1]=e[1]+a.t*o[1],a.x[2]=e[2]+a.t*o[2],a.intersection=!0,a.betweenPoints=a.t>=0&&a.t<=1),a}function m(e,t,r,n){let a,l={intersection:!1,l0:[],l1:[],error:null},u=[];(0,i.$A)(t,n,u);let c=u.map(e=>Math.abs(e));if(c[0]+c[1]+c[2]<1e-6){let n=[];return(0,i.Re)(e,r,n),0===(0,i.Om)(t,n)?l.error=o:l.error=s,l}a=c[0]>c[1]&&c[0]>c[2]?"x":c[1]>c[2]?"y":"z";let d=[],p=-(0,i.Om)(t,e),m=-(0,i.Om)(n,r);switch(a){case"x":d[0]=0,d[1]=(m*t[2]-p*n[2])/u[0],d[2]=(p*n[1]-m*t[1])/u[0];break;case"y":d[0]=(p*n[2]-m*t[2])/u[1],d[1]=0,d[2]=(m*t[0]-p*n[0])/u[1];break;case"z":d[0]=(m*t[1]-p*n[1])/u[2],d[1]=(p*n[0]-m*t[0])/u[2],d[2]=0}return l.l0=d,(0,i.WQ)(d,u,l.l1),l.intersection=!0,l}var h={normal:[0,0,1],origin:[0,0,0]};function f(e,t,r={}){Object.assign(t,h,r),a.Ay.extend(e,t,r),n.Ay.setGetArray(e,t,["normal","origin"],3),t.classHierarchy.push("vtkPlane"),e.distanceToPlane=e=>l(e,t.origin,t.normal),e.projectPoint=(e,r)=>{u(e,t.origin,t.normal,r)},e.projectVector=(e,r)=>c(e,t.normal,r),e.push=e=>{if(0!==e)for(let r=0;r<3;r++)t.origin[r]+=e*t.normal[r]},e.generalizedProjectPoint=(e,r)=>{d(e,t.origin,t.normal,r)},e.evaluateFunction=(e,r,n)=>Array.isArray(e)?t.normal[0]*(e[0]-t.origin[0])+t.normal[1]*(e[1]-t.origin[1])+t.normal[2]*(e[2]-t.origin[2]):t.normal[0]*(e-t.origin[0])+t.normal[1]*(r-t.origin[1])+t.normal[2]*(n-t.origin[2]),e.evaluateGradient=e=>[t.normal[0],t.normal[1],t.normal[2]],e.intersectWithLine=(e,r)=>p(e,r,t.origin,t.normal),e.intersectWithPlane=(e,r)=>m(e,r,t.origin,t.normal)}var g={newInstance:n.Ay.newInstance(f,"vtkPlane"),extend:f,...{evaluate:function(e,t,r){return e[0]*(r[0]-t[0])+e[1]*(r[1]-t[1])+e[2]*(r[2]-t[2])},distanceToPlane:l,projectPoint:u,projectVector:c,generalizedProjectPoint:d,intersectWithLine:p,intersectWithPlane:m,DISJOINT:s,COINCIDE:o}}},22911:(e,t,r)=>{"use strict";function n(e,t){return e.worldToIndex(t).map(Math.round)}function i(e,t){return e.worldToIndex(t)}r.d(t,{A:()=>n,p:()=>i})},22958:(e,t,r)=>{"use strict";function n(e,t){let r=e,n=t?.numDimensions||2,i=3===n;if(!Array.isArray(e[0])){let t=e.length/n;r=Array(e.length/n);for(let a=0;at?s:t,l=l>n?l:n,i&&(u=ud?c:d)}return i?{minX:a,maxX:s,minY:o,maxY:l,minZ:u,maxZ:c}:{minX:a,maxX:s,minY:o,maxY:l}}r.d(t,{A:()=>n})},23230:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=function(e){return!!(e&&"function"==typeof e.setVolumes&&"function"==typeof e.addVolumes)}},23246:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectReader=void 0;let n=r(16950),i=r(9128);class a extends i.BaseReader{_parse(e,t){let r=this._builderOptions,i=null;return(0,n.isFunction)(t)?i=this.parse(e,t.call(this)):(0,n.isArray)(t)||(0,n.isSet)(t)?(0,n.forEachArray)(t,t=>i=this.parse(e,t),this):(0,n.isMap)(t)||(0,n.isObject)(t)?(0,n.forEachObject)(t,(t,a)=>{if((0,n.isFunction)(a)&&(a=a.call(this)),r.ignoreConverters||0!==t.indexOf(r.convert.att))if(r.ignoreConverters||0!==t.indexOf(r.convert.text))if(r.ignoreConverters||0!==t.indexOf(r.convert.cdata))if(r.ignoreConverters||0!==t.indexOf(r.convert.comment))if(r.ignoreConverters||0!==t.indexOf(r.convert.ins)){if(((0,n.isArray)(a)||(0,n.isSet)(a))&&(0,n.isEmpty)(a));else if(((0,n.isMap)(a)||(0,n.isObject)(a))&&(0,n.isEmpty)(a))i=this.element(e,void 0,this.sanitize(t))||i;else if(r.keepNullNodes||null!=a)if((0,n.isArray)(a)||(0,n.isSet)(a))(0,n.forEachArray)(a,r=>{let n={};n[t]=r,i=this.parse(e,n)},this);else if((0,n.isMap)(a)||(0,n.isObject)(a)){let r=this.element(e,void 0,this.sanitize(t));r&&(i=r,this.parse(r,a))}else if(null==a||(0,n.isString)(a)&&""===a)i=this.element(e,void 0,this.sanitize(t))||i;else{let r=this.element(e,void 0,this.sanitize(t));r&&(i=r,this.text(r,this._decodeText(this.sanitize(a?.toString()))))}}else if((0,n.isString)(a)){let t=a.indexOf(" "),r=-1===t?a:a.substr(0,t),n=-1===t?"":a.substr(t+1);i=this.instruction(e,this.sanitize(r),this.sanitize(n))||i}else(0,n.isArray)(a)||(0,n.isSet)(a)?(0,n.forEachArray)(a,t=>{let r=t.indexOf(" "),n=-1===r?t:t.substr(0,r),a=-1===r?"":t.substr(r+1);i=this.instruction(e,this.sanitize(n),this.sanitize(a))||i},this):(0,n.forEachObject)(a,(t,r)=>i=this.instruction(e,this.sanitize(t),this.sanitize(r))||i,this);else(0,n.isArray)(a)||(0,n.isSet)(a)?(0,n.forEachArray)(a,t=>i=this.comment(e,this.sanitize(t))||i,this):i=this.comment(e,this.sanitize(a?.toString()))||i;else(0,n.isArray)(a)||(0,n.isSet)(a)?(0,n.forEachArray)(a,t=>i=this.cdata(e,this.sanitize(t))||i,this):i=this.cdata(e,this.sanitize(a?.toString()))||i;else i=(0,n.isMap)(a)||(0,n.isObject)(a)?this.parse(e,a):this.text(e,this._decodeText(this.sanitize(a?.toString())))||i;else if(t===r.convert.att)if((0,n.isArray)(a)||(0,n.isSet)(a))throw Error("Invalid attribute: "+a.toString()+". "+e._debugInfo());else(0,n.forEachObject)(a,(t,r)=>{i=this.attribute(e,void 0,this.sanitize(t),this._decodeAttributeValue(this.sanitize(r)))||i});else i=this.attribute(e,void 0,this.sanitize(t.substring(r.convert.att.length)),this._decodeAttributeValue(this.sanitize(a?.toString())))||i},this):(r.keepNullNodes||null!=t)&&(i=this.text(e,this._decodeText(this.sanitize(t?.toString())))||i),i||e}}t.ObjectReader=a},23278:(e,t,r)=>{"use strict";r.d(t,{bp:()=>m,ft:()=>p});let n={iconContent:"",iconSize:16,viewBox:{x:16,y:16},mousePoint:{x:8,y:8},mousePointerGroupString:` + + + `},i={x:127,y:60},a=` + +`,o=` + + +`,s='',l='',u='',c={Angle:d(n,{name:"Angle",iconContent:``,viewBox:{x:1792,y:1792}}),ArrowAnnotate:d(n,{name:"ArrowAnnotate",iconContent:` + + `,viewBox:{x:24,y:24}}),Bidirectional:d(n,{name:"Bidirectional",iconContent:` + + + + + + + `,viewBox:{x:48,y:48}}),CobbAngle:d(n,{name:"CobbAngle",iconContent:` + + + + + `,viewBox:{x:32,y:32}}),CircleROI:d(n,{name:"CircleROI",iconContent:'',viewBox:{x:32,y:32}}),EllipticalROI:d(n,{name:"EllipticalROI",iconContent:``,viewBox:{x:32,y:32}}),FreehandROI:d(n,{name:"FreehandROI",iconContent:` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `,viewBox:{x:18,y:18}}),FreehandROISculptor:d(n,{name:"FreehandROISculptor",iconContent:` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `,viewBox:{x:18,y:18}}),Length:d(n,{name:"Length",iconContent:` + + `,viewBox:{x:24,y:24}}),Height:d(n,{name:"Height",iconContent:'',viewBox:{x:24,y:24}}),Probe:d(n,{name:"Probe",iconContent:``,viewBox:{x:1792,y:1792}}),RectangleROI:d(n,{name:"RectangleROI",iconContent:``,viewBox:{x:1792,y:1792}}),Label:d(n,{name:"Label",iconContent:``,viewBox:{x:1792,y:1792}}),Crosshairs:d(n,{name:"Crosshairs",iconContent:``,viewBox:{x:1792,y:1792}}),Eraser:d(n,{name:"Eraser",iconContent:``,viewBox:{x:2048,y:1792}}),Magnify:d(n,{name:"Magnify",iconContent:``,viewBox:{x:512,y:512}}),Pan:d(n,{name:"Pan",iconContent:``,viewBox:{x:1792,y:1792}}),Rotate:d(n,{name:"Rotate",iconContent:``,viewBox:{x:1792,y:1792}}),StackScroll:d(n,{name:"StackScroll",iconContent:``,viewBox:{x:24,y:28}}),WindowLevelRegion:d(n,{name:"WindowLevelRegion",iconContent:``,viewBox:{x:1792,y:1792}}),WindowLevel:d(n,{name:"WindowLevel",iconContent:` + + `,viewBox:{x:18,y:18}}),Zoom:d(n,{name:"Zoom",iconContent:` + + `,viewBox:{x:640,y:512}}),SegmentationFreeHandEraseInside:d(n,{name:"SegmentationFreeHandEraseInside",iconContent:`${s} ${a}`,viewBox:i}),SegmentationFreeHandFillInside:d(n,{name:"SegmentationFreeHandFillInside",iconContent:`${s} ${o}`,viewBox:i}),SegmentationFreeHandEraseOutside:d(n,{name:"SegmentationFreeHandEraseOutside",iconContent:`${s} ${a}`,viewBox:i}),SegmentationFreeHandFillOutside:d(n,{name:"SegmentationFreeHandFillOutside",iconContent:`${s} ${o}`,viewBox:i}),SegmentationRectangleEraseInside:d(n,{name:"SegmentationRectangleEraseInside",iconContent:`${l} ${a}`,viewBox:i}),RectangleScissor:d(n,{name:"RectangleScissor",iconContent:`${l} ${o}`,viewBox:i}),"RectangleScissor.FILL_INSIDE":d(n,{name:"RectangleScissor.FILL_INSIDE",iconContent:`${l} ${o}`,viewBox:i}),"RectangleScissor.FILL_OUTSIDE":d(n,{name:"RectangleScissor.FILL_OUTSIDE",iconContent:`${l} ${o}`,viewBox:i}),"RectangleScissor.ERASE_OUTSIDE":d(n,{name:"RectangleScissor.ERASE_OUTSIDE",iconContent:`${l} ${a}`,viewBox:i}),"RectangleScissor.ERASE_INSIDE":d(n,{name:"RectangleScissor.ERASE_INSIDE",iconContent:`${l} ${a}`,viewBox:i}),CircleScissor:d(n,{name:"CircleScissor",iconContent:`${u} ${o}`,viewBox:i}),"CircleScissor.FILL_INSIDE":d(n,{name:"CircleScissor.FILL_INSIDE",iconContent:`${u} ${o}`,viewBox:i}),"CircleScissor.ERASE_OUTSIDE":d(n,{name:"CircleScissor.ERASE_OUTSIDE",iconContent:`${u} ${a}`,viewBox:i}),"CircleScissor.FILL_OUTSIDE":d(n,{name:"CircleScissor.FILL_OUTSIDE",iconContent:`${u} ${o}`,viewBox:i})};function d(e,t){return Object.assign(Object.create(e),{...t,name:t.name||e.name})}function p(e){return c[e]}let m=Object.keys(c)},23537:(e,t,r)=>{"use strict";r.d(t,{Dn:()=>p,FI:()=>m,o9:()=>d,sg:()=>u,yR:()=>c});var n=r(70192),i=r(46702),a=r(43385),o=r(88129),s=r(58956),l=r(25931);let u=(e,t)=>{(0,n.Hl)(n.tX,n.fX.sV.WEB_WORKER_PROGRESS,{progress:t,type:e})},c=(e,t)=>{let r=(0,a.T)(e);if(!r?.representationData)return console.debug("getSegmentationDataForWorker: segmentation missing or not ready",e),null;let{representationData:o}=r,{Labelmap:s}=o;if(!s)return console.debug("No labelmap found for segmentation",e),null;let l=s.volumeId,u=s.imageIds,c=!!l;if(!c&&u){let e=u.map(e=>n.PP.getImage(e).referencedImageId);c=n.BF.isValidVolume(e)}let d=t;return d?Array.isArray(d)||(d=[d,255]):d=[(0,i.Q)(e)],{operationData:{segmentationId:e,volumeId:l,imageIds:u},segVolumeId:l,segImageIds:u,reconstructableVolume:c,indices:d}},d=e=>(0,o.S)({operationData:e,strategy:{ensureSegmentationVolumeFor3DManipulation:s.A.ensureSegmentationVolumeFor3DManipulation,ensureImageVolumeFor3DManipulation:l.A.ensureImageVolumeFor3DManipulation}}),p=e=>{let t=[],r=[];for(let i of e){let e=n.PP.getImage(i),a=e.getPixelData(),{origin:o,direction:s,spacing:l,dimensions:u}=n.BF.getImageDataMetadata(e);t.push({scalarData:a,dimensions:u,spacing:l,origin:o,direction:s});let c=e.referencedImageId;if(c){let e=n.PP.getImage(c);if(!e)continue;let t=e.getPixelData(),i=e.voxelManager,a=[e.rowPixelSpacing,e.columnPixelSpacing];r.push({scalarData:t,dimensions:i?i.dimensions:[e.columns,e.rows,1],spacing:a})}}return{segmentationInfo:t,imageInfo:r}},m=(e,t)=>{let r;if(e){let t=n.PP.getVolume(e).imageIds,i=n.PP.getImage(t[0]);i&&(r=i.referencedImageId)}else t?.length&&(r=n.PP.getImage(t[0]).referencedImageId);let i=n.PP.getImage(r),a=n.wx.get("scalingModule",r);return{refImageId:r,modalityUnitOptions:{isPreScaled:!!i?.preScale?.scaled,isSuvScaled:"number"==typeof a?.suvbw}}}},23668:(e,t,r)=>{"use strict";r.r(t),r.d(t,{isPointOnPlane:()=>u,linePlaneIntersection:()=>a,planeDistanceToPoint:()=>l,planeEquation:()=>o,threePlaneIntersection:()=>s});var n=r(37843),i=r(79267);function a(e,t,r){let[n,i,a]=e,[o,s,l]=t,[u,c,d,p]=r,m=o-n,h=s-i,f=l-a,g=-1*(u*n+c*i+d*a-p)/(u*m+c*h+d*f);return[m*g+n,h*g+i,f*g+a]}function o(e,t,r=!1){let[n,i,a]=e,s=n*t[0]+i*t[1]+a*t[2];if(r){let e=Math.sqrt(n*n+i*i+a*a);return[n/e,i/e,a/e,s/e]}return[n,i,a,s]}function s(e,t,r){let[i,a,o,s]=e,[l,u,c,d]=t,[p,m,h,f]=r,g=n.fromValues(i,l,p,a,u,m,o,c,h),v=n.fromValues(s,d,f,a,u,m,o,c,h),y=n.fromValues(i,l,p,s,d,f,o,c,h),b=n.fromValues(i,l,p,a,u,m,s,d,f),I=n.determinant(v)/n.determinant(g);return[I,n.determinant(y)/n.determinant(g),n.determinant(b)/n.determinant(g)]}function l(e,t,r=!1){let[n,i,a,o]=e,[s,u,c]=t,d=n*s+i*u+a*c-o,p=Math.abs(d)/Math.sqrt(n*n+i*i+a*a);return(r?Math.sign(d):1)*p}function u(e,t,r=i.p8){return l(t,e){"use strict";r.d(t,{A:()=>a});var n=r(77280),i=r(65110);function a(e,t,r=n.yX.LINEAR){let o,s;if("number"==typeof t&&"number"==typeof e?(o=t,s=e):Array.isArray(t)&&Array.isArray(e)&&(o=t[0],s=e[0]),void 0!==o&&void 0!==s)return(0,i.toLowHighRange)(s,o,r)}},23838:(e,t,r)=>{"use strict";r.d(t,{p:()=>i});var n=r(70192);function i(e){let t,r=n.BF.getRandomSampleFromArray(e,50);for(let e=0;e<3;e++)if(r.every((t,r,n)=>1e-6>Math.abs(t[e]-n[0][e]))){t=e;break}if(void 0===t)throw Error("Cannot find a shared dimension index for polyline, probably oblique plane");let i=[],a=(t+1)%3,o=(t+2)%3;for(let t=0;t{"use strict";r.d(t,{A:()=>i,N:()=>n});var n={COMPOSITE_BLEND:0,MAXIMUM_INTENSITY_BLEND:1,MINIMUM_INTENSITY_BLEND:2,AVERAGE_INTENSITY_BLEND:3,ADDITIVE_INTENSITY_BLEND:4,RADON_TRANSFORM_BLEND:5,LABELMAP_EDGE_PROJECTION_BLEND:6},i={BlendMode:n}},24065:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createDocument=function(){let e=new n.DOMImplementation().createDocument(null,"root",null);return e.documentElement&&e.removeChild(e.documentElement),e},t.sanitizeInput=function(e,t){if(null==e)return e;{if(void 0===t)return e+"";let r="";e+="";for(let n=0;n=32&&i<=55295||i>=57344&&i<=65533)r+=e.charAt(n);else if(i>=55296&&i<=56319&&n=56320&&o<=57343?(r+=String.fromCodePoint(i=(i-55296)*1024+o-56320+65536),n++):r+=(0,a.isString)(t)?t:t(e.charAt(n),n,e)}else r+=(0,a.isString)(t)?t:t(e.charAt(n),n,e)}return r}};let n=r(59244),i=r(95663),a=r(16950);i.dom.setFeatures(!1)},24106:(e,t,r)=>{"use strict";function n(e,t){if(e===t)return!0;if(null==e||null==t)return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch(r){return console.debug("Error in JSON.stringify during deep comparison:",r),e===t}}r.d(t,{b:()=>n})},24346:(e,t,r)=>{"use strict";r.d(t,{_D:()=>v,a8:()=>y,nb:()=>d});var n=r(1705),i=r(32166),a=r(73589),o=r(59085),s=r(76348),l=r(68456),u=r(98115),c=r(9638);function d(e){let{fallbackImageIdIndex:t,viewState:r}=e;return r?.slice?.kind==="stackIndex"?r.slice.imageIdIndex:t}function p(e){return[e[0],e[1]]}class m extends a.A{get pan(){return p(this.getPresentation().pan)}get zoom(){return this.getPresentation().zoom}get scale(){return p(this.getPresentation().scale)}get rotation(){return this.getPresentation().rotation}getSliceBasis(){return this.cachedSliceBasis||=this.buildSliceBasis(),this.cachedSliceBasis}canvasToWorld(e){return(0,o.KR)({camera:this.requireResolvedICamera(),canvasHeight:this.state.canvasHeight,canvasPos:e,canvasWidth:this.state.canvasWidth})}worldToCanvas(e){return(0,o.Mx)({camera:this.requireResolvedICamera(),canvasHeight:this.state.canvasHeight,canvasWidth:this.state.canvasWidth,worldPos:e})}getFrameOfReferenceUID(){return this.state.frameOfReferenceUID}withZoom(e,t){return this.withScale(e,t)}withScale(e,t){let r=(0,c.aD)(e);if(!t)return this.cloneWithViewState({...this.state.viewState,displayArea:void 0,scale:r,scaleMode:"fit"});let n=this.canvasToWorld(t);return this.cloneWithViewState({...this.state.viewState,anchorCanvas:[t[0]/Math.max(this.state.canvasWidth,1),t[1]/Math.max(this.state.canvasHeight,1)],anchorWorld:n,displayArea:void 0,scale:r,scaleMode:"fit"})}withPan(e){let t=this.pan,[r,n]=this.state.viewState.anchorCanvas??[.5,.5];return this.cloneWithViewState({...this.state.viewState,anchorCanvas:[r+(e[0]-t[0])/Math.max(this.state.canvasWidth,1),n+(e[1]-t[1])/Math.max(this.state.canvasHeight,1)],displayArea:void 0})}flipHorizontal(){return this.cloneWithViewState({...this.state.viewState,flipHorizontal:!this.state.viewState.flipHorizontal})}flipVertical(){return this.cloneWithViewState({...this.state.viewState,flipVertical:!this.state.viewState.flipVertical})}indexToWorld(e){}buildICamera(){return(0,s.hI)({camera:this.state.viewState,canvasHeight:this.state.canvasHeight,canvasWidth:this.state.canvasWidth,sliceBasis:this.getSliceBasis()})}getPresentation(){return this.cachedPresentation||=(0,s.iV)({camera:this.state.viewState,canvasHeight:this.state.canvasHeight,canvasWidth:this.state.canvasWidth,sliceBasis:this.getSliceBasis()}),this.cachedPresentation}requireResolvedICamera(){let e=this.toICamera();if(!e.focalPoint||"number"!=typeof e.parallelScale||!e.viewPlaneNormal||!e.viewUp)throw Error("[PlanarResolvedView] Failed to compute planar viewState");return{focalPoint:(0,i.A)(e.focalPoint),parallelScale:e.parallelScale,presentationScale:e.presentationScale?p(e.presentationScale):void 0,viewPlaneNormal:(0,i.A)(e.viewPlaneNormal),viewUp:(0,i.A)(e.viewUp)}}createViewStateState(e){return{...this.state,viewState:(0,u.Kh)(e)}}}class h extends m{constructor(e){super({...e,viewState:(0,u.Kh)(e.viewState||(0,u.Mn)())})}buildSliceBasis(){let e={canvasHeight:this.state.canvasHeight,canvasWidth:this.state.canvasWidth,image:this.state.image};return this.state.usePixelGridCenter?(0,l.id)(e):(0,l.IY)(e)}cloneWithViewState(e){return new h(this.createViewStateState(e))}}class f extends m{constructor(e){let{sliceBasis:t,...r}=e;super({...r,viewState:(0,u.Kh)(e.viewState||(0,u.Mn)())}),this.cachedSliceBasis=t}indexToWorld(e){return this.state.imageVolume.imageData?.indexToWorld(e)}buildSliceBasis(){return(this.state.usePixelGridCenter?l.vu:l.P8)({viewState:this.state.viewState,canvasHeight:this.state.canvasHeight,canvasWidth:this.state.canvasWidth,imageIdIndex:(0,l.Dn)({viewState:this.state.viewState,fallbackImageIdIndex:this.state.currentImageIdIndex}),imageVolume:this.state.imageVolume,orientation:this.state.viewState.orientation}).sliceBasis}cloneWithViewState(e){return new f(this.createViewStateState(e))}}function g(e){return e.currentImageIdIndex}function v(e){let{renderContext:t,rendering:r}=e;if(r.renderMode===n.T.CPU_IMAGE||r.renderMode===n.T.CPU_VOLUME){if(!t.cpu)throw Error("[PlanarResolvedView] CPU render paths require a CPU canvas context");return(0,o.fi)(t.cpu.canvas)}if(!t.vtk)throw Error("[PlanarResolvedView] VTK render paths require a VTK canvas context");return{canvasHeight:t.vtk.canvas.clientHeight||t.vtk.canvas.height,canvasWidth:t.vtk.canvas.clientWidth||t.vtk.canvas.width}}function y(e){let{data:t,frameOfReferenceUID:r,imageIds:i,canvasDimensions:a,renderContext:o,rendering:s,sliceIndex:u}=e;if(!s)return;let{canvasHeight:c,canvasWidth:p}=a??v({renderContext:o,rendering:s}),m=e.viewState;if(s.renderMode===n.T.CPU_IMAGE||s.renderMode===n.T.VTK_IMAGE){let e=(s.renderMode===n.T.CPU_IMAGE?s.enabledElement?.image:s.currentImage)||t?.image;if(!e)return;let a=d({fallbackImageIdIndex:g(s),viewState:m}),o=i?.length??t?.imageIds.length,l="number"==typeof o&&o>0?o-1:Math.max(a,g(s),0);return new h({viewState:m,canvasHeight:c,canvasWidth:p,currentImageIdIndex:a,frameOfReferenceUID:r,image:e,maxImageIdIndex:l,usePixelGridCenter:s.renderMode===n.T.CPU_IMAGE})}if(s.renderMode===n.T.CPU_VOLUME||s.renderMode===n.T.VTK_VOLUME_SLICE){let e="number"==typeof u?{...m,slice:{kind:"stackIndex",imageIdIndex:u}}:m,t=(0,l.LK)(s.dataPresentation?.interpolationType)?l.vu:l.P8,i="number"==typeof u?u:(0,l.Dn)({viewState:e,fallbackImageIdIndex:s.currentImageIdIndex}),{currentImageIdIndex:a,maxImageIdIndex:o,sliceBasis:d}=t({viewState:e,canvasHeight:c,canvasWidth:p,imageIdIndex:i,imageVolume:s.imageVolume,orientation:e.orientation});return new f({viewState:e,canvasHeight:c,canvasWidth:p,currentImageIdIndex:a,frameOfReferenceUID:r,imageVolume:s.imageVolume,maxImageIdIndex:o,sliceBasis:d,usePixelGridCenter:s.renderMode===n.T.CPU_VOLUME&&(0,l.LK)(s.dataPresentation?.interpolationType)})}}},24433:(e,t,r)=>{"use strict";r.r(t),r.d(t,{addWSIMiniNavigationOverlayCss:()=>d,getDicomMicroscopyViewer:()=>c,getWSIImageDataMetadata:()=>p,loadWSIData:()=>m});var n=r(50923),i=r(77280),a=r(42215),o=r(39216);let s=` +.DicomMicroscopyViewer { + --ol-partial-background-color: rgba(127, 127, 127, 0.7); + --ol-foreground-color: #000000; + --ol-subtle-foreground-color: #000; + --ol-subtle-background-color: rgba(78, 78, 78, 0.5); +} + +.DicomMicroscopyViewer .ol-box { + box-sizing: border-box; + border-radius: 2px; + border: 1.5px solid var(--ol-background-color); + background-color: var(--ol-partial-background-color); +} + +.DicomMicroscopyViewer .ol-mouse-position { + top: 8px; + right: 8px; + position: absolute; +} + +.DicomMicroscopyViewer .ol-scale-line { + background: var(--ol-partial-background-color); + border-radius: 4px; + bottom: 8px; + left: 8px; + padding: 2px; + position: absolute; +} + +.DicomMicroscopyViewer .ol-scale-line-inner { + border: 1px solid var(--ol-subtle-foreground-color); + border-top: none; + color: var(--ol-foreground-color); + font-size: 10px; + text-align: center; + margin: 1px; + will-change: contents, width; + transition: all 0.25s; +} + +.DicomMicroscopyViewer .ol-scale-bar { + position: absolute; + bottom: 8px; + left: 8px; +} + +.DicomMicroscopyViewer .ol-scale-bar-inner { + display: flex; +} + +.DicomMicroscopyViewer .ol-scale-step-marker { + width: 1px; + height: 15px; + background-color: var(--ol-foreground-color); + float: right; + z-index: 10; +} + +.DicomMicroscopyViewer .ol-scale-step-text { + position: absolute; + bottom: -5px; + font-size: 10px; + z-index: 11; + color: var(--ol-foreground-color); + text-shadow: + -1.5px 0 var(--ol-partial-background-color), + 0 1.5px var(--ol-partial-background-color), + 1.5px 0 var(--ol-partial-background-color), + 0 -1.5px var(--ol-partial-background-color); +} + +.DicomMicroscopyViewer .ol-scale-text { + position: absolute; + font-size: 12px; + text-align: center; + bottom: 25px; + color: var(--ol-foreground-color); + text-shadow: + -1.5px 0 var(--ol-partial-background-color), + 0 1.5px var(--ol-partial-background-color), + 1.5px 0 var(--ol-partial-background-color), + 0 -1.5px var(--ol-partial-background-color); +} + +.DicomMicroscopyViewer .ol-scale-singlebar { + position: relative; + height: 10px; + z-index: 9; + box-sizing: border-box; + border: 1px solid var(--ol-foreground-color); +} + +.DicomMicroscopyViewer .ol-scale-singlebar-even { + background-color: var(--ol-subtle-foreground-color); +} + +.DicomMicroscopyViewer .ol-scale-singlebar-odd { + background-color: var(--ol-background-color); +} + +.DicomMicroscopyViewer .ol-unsupported { + display: none; +} + +.DicomMicroscopyViewer .ol-viewport, +.DicomMicroscopyViewer .ol-unselectable { + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; + -webkit-tap-highlight-color: transparent; +} + +.DicomMicroscopyViewer .ol-viewport canvas { + all: unset; +} + +.DicomMicroscopyViewer .ol-selectable { + -webkit-touch-callout: default; + -webkit-user-select: text; + -moz-user-select: text; + user-select: text; +} + +.DicomMicroscopyViewer .ol-grabbing { + cursor: -webkit-grabbing; + cursor: -moz-grabbing; + cursor: grabbing; +} + +.DicomMicroscopyViewer .ol-grab { + cursor: move; + cursor: -webkit-grab; + cursor: -moz-grab; + cursor: grab; +} + +.DicomMicroscopyViewer .ol-control { + position: absolute; + background-color: var(--ol-subtle-background-color); + border-radius: 4px; +} + +.DicomMicroscopyViewer .ol-zoom { + top: 0.5em; + left: 0.5em; +} + +.DicomMicroscopyViewer .ol-rotate { + top: 0.5em; + right: 0.5em; + transition: + opacity 0.25s linear, + visibility 0s linear; +} + +.DicomMicroscopyViewer .ol-rotate.ol-hidden { + opacity: 0; + visibility: hidden; + transition: + opacity 0.25s linear, + visibility 0s linear 0.25s; +} + +.DicomMicroscopyViewer .ol-zoom-extent { + top: 4.643em; + left: 0.5em; +} + +.DicomMicroscopyViewer .ol-full-screen { + right: 0.5em; + top: 0.5em; +} + +.DicomMicroscopyViewer .ol-control button { + display: block; + margin: 1px; + padding: 0; + color: var(--ol-subtle-foreground-color); + font-weight: bold; + text-decoration: none; + font-size: inherit; + text-align: center; + height: 1.375em; + width: 1.375em; + line-height: 0.4em; + background-color: var(--ol-background-color); + border: none; + border-radius: 2px; +} + +.DicomMicroscopyViewer .ol-control button::-moz-focus-inner { + border: none; + padding: 0; +} + +.DicomMicroscopyViewer .ol-zoom-extent button { + line-height: 1.4em; +} + +.DicomMicroscopyViewer .ol-compass { + display: block; + font-weight: normal; + will-change: transform; +} + +.DicomMicroscopyViewer .ol-touch .ol-control button { + font-size: 1.5em; +} + +.DicomMicroscopyViewer .ol-touch .ol-zoom-extent { + top: 5.5em; +} + +.DicomMicroscopyViewer .ol-control button:hover, +.DicomMicroscopyViewer .ol-control button:focus { + text-decoration: none; + outline: 1px solid var(--ol-subtle-foreground-color); + color: var(--ol-foreground-color); +} + +.DicomMicroscopyViewer .ol-zoom .ol-zoom-in { + border-radius: 2px 2px 0 0; +} + +.DicomMicroscopyViewer .ol-zoom .ol-zoom-out { + border-radius: 0 0 2px 2px; +} + +.DicomMicroscopyViewer .ol-attribution { + text-align: right; + bottom: 0.5em; + right: 0.5em; + max-width: calc(100% - 1.3em); + display: flex; + flex-flow: row-reverse; + align-items: center; +} + +.DicomMicroscopyViewer .ol-attribution a { + color: var(--ol-subtle-foreground-color); + text-decoration: none; +} + +.DicomMicroscopyViewer .ol-attribution ul { + margin: 0; + padding: 1px 0.5em; + color: var(--ol-foreground-color); + text-shadow: 0 0 2px var(--ol-background-color); + font-size: 12px; +} + +.DicomMicroscopyViewer .ol-attribution li { + display: inline; + list-style: none; +} + +.DicomMicroscopyViewer .ol-attribution li:not(:last-child):after { + content: ' '; +} + +.DicomMicroscopyViewer .ol-attribution img { + max-height: 2em; + max-width: inherit; + vertical-align: middle; +} + +.DicomMicroscopyViewer .ol-attribution button { + flex-shrink: 0; +} + +.DicomMicroscopyViewer .ol-attribution.ol-collapsed ul { + display: none; +} + +.DicomMicroscopyViewer .ol-attribution:not(.ol-collapsed) { + background: var(--ol-partial-background-color); +} + +.DicomMicroscopyViewer .ol-attribution.ol-uncollapsible { + bottom: 0; + right: 0; + border-radius: 4px 0 0; +} + +.DicomMicroscopyViewer .ol-attribution.ol-uncollapsible img { + margin-top: -0.2em; + max-height: 1.6em; +} + +.DicomMicroscopyViewer .ol-attribution.ol-uncollapsible button { + display: none; +} + +.DicomMicroscopyViewer .ol-zoomslider { + top: 4.5em; + left: 0.5em; + height: 200px; +} + +.DicomMicroscopyViewer .ol-zoomslider button { + position: relative; + height: 10px; +} + +.DicomMicroscopyViewer .ol-touch .ol-zoomslider { + top: 5.5em; +} + +.DicomMicroscopyViewer .ol-overviewmap { + left: 0.5em; + bottom: 0.5em; +} + +.DicomMicroscopyViewer .ol-overviewmap.ol-uncollapsible { + bottom: 0; + left: 0; + border-radius: 0 4px 0 0; +} + +.DicomMicroscopyViewer .ol-overviewmap .ol-overviewmap-map, +.DicomMicroscopyViewer .ol-overviewmap button { + display: block; +} + +.DicomMicroscopyViewer .ol-overviewmap .ol-overviewmap-map { + border: 1px solid var(--ol-subtle-foreground-color); + height: 150px; + width: 150px; +} + +.DicomMicroscopyViewer .ol-overviewmap:not(.ol-collapsed) button { + bottom: 0; + left: 0; + position: absolute; +} + +.DicomMicroscopyViewer .ol-overviewmap.ol-collapsed .ol-overviewmap-map, +.DicomMicroscopyViewer .ol-overviewmap.ol-uncollapsible button { + display: none; +} + +.DicomMicroscopyViewer .ol-overviewmap:not(.ol-collapsed) { + background: var(--ol-subtle-background-color); +} + +.DicomMicroscopyViewer .ol-overviewmap-box { + border: 0.5px dotted var(--ol-subtle-foreground-color); +} + +.DicomMicroscopyViewer .ol-overviewmap .ol-overviewmap-box:hover { + cursor: move; +} + +@layout-header-background: #007ea3; +@primary-color: #007ea3; +@processing-color: #8cb8c6; +@success-color: #3f9c35; +@warning-color: #eeaf30; +@error-color: #96172e; +@font-size-base: 14px; + +.DicomMicroscopyViewer .ol-tooltip { + font-size: 16px !important; +} +`;var l=r(62553);let u="wsiViewportOverlayCss";async function c(){return(0,a.a)("dicom-microscopy-viewer")}function d(){if(document.getElementById(u))return;let e=document.createElement("style");e.innerText=s,e.setAttribute("id",u),document.getElementsByTagName("head")[0].append(e)}function p(e){let{metadataDicomweb:t,imageIds:r,imageIndex:a=0}=e,s=t.reduce((e,t)=>e?.NumberOfFrames{let t=r.getDICOMwebMetadata(e);Object.defineProperty(t,"isMultiframe",{value:t.isMultiframe,enumerable:!1}),Object.defineProperty(t,"frameNumber",{value:void 0,enumerable:!1});let n=t["00080008"]?.Value;n?.length===1&&(t["00080008"].Value=n[0].split("\\"));let i=t["00200052"]?.Value?.[0];return a?i!==a&&(t["00200052"].Value=[a]):a=i,t}),s=[];return o.forEach(e=>{let t=new i.metadata.VLWholeSlideMicroscopyImage({metadata:e}),r=t.ImageType[2];("VOLUME"===r||"THUMBNAIL"===r)&&s.push(t)}),{volumeImages:s,metadataDicomweb:o,metadata:p({metadataDicomweb:s,imageIds:t}),frameOfReferenceUID:a,imageURISet:new Set(t.map(e=>(0,l.A)(e)))}}},24757:(e,t,r)=>{"use strict";let n=r(55839),i=r(26735),a=r(32171),o=r(87431),s=Object.prototype.hasOwnProperty,l=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,u=/[\x85\u2028\u2029]/,c=/[,\[\]{}]/,d=/^(?:!|!!|![0-9A-Za-z-]+!)$/,p=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function m(e){return Object.prototype.toString.call(e)}function h(e){return 10===e||13===e}function f(e){return 9===e||32===e}function g(e){return 9===e||32===e||10===e||13===e}function v(e){return 44===e||91===e||93===e||123===e||125===e}function y(e){switch(e){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:case 9:return" ";case 110:return"\n";case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1b";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"\x85";case 95:return"\xa0";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function b(e,t,r){"__proto__"===t?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:r}):e[t]=r}let I=Array(256),x=Array(256);for(let e=0;e<256;e++)I[e]=+!!y(e),x[e]=y(e);function C(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||o,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.maxDepth="number"==typeof t.maxDepth?t.maxDepth:100,this.maxTotalMergeKeys="number"==typeof t.maxTotalMergeKeys?t.maxTotalMergeKeys:1e4,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.totalMergeKeys=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function A(e,t){let r={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return r.snippet=a(r),new i(t,r)}function T(e,t){throw A(e,t)}function S(e,t){e.onWarning&&e.onWarning.call(null,A(e,t))}function w(e,t,r){let n=e.anchorMapTransactions;if(0!==n.length){let r=n[n.length-1];s.call(r,t)||(r[t]={existed:s.call(e.anchorMap,t),value:e.anchorMap[t]})}e.anchorMap[t]=r}function O(e){return{position:e.position,line:e.line,lineStart:e.lineStart,lineIndent:e.lineIndent,firstTabInLine:e.firstTabInLine,tag:e.tag,anchor:e.anchor,kind:e.kind,result:e.result}}function P(e,t){e.position=t.position,e.line=t.line,e.lineStart=t.lineStart,e.lineIndent=t.lineIndent,e.firstTabInLine=t.firstTabInLine,e.tag=t.tag,e.anchor=t.anchor,e.kind=t.kind,e.result=t.result}let _={YAML:function(e,t,r){null!==e.version&&T(e,"duplication of %YAML directive"),1!==r.length&&T(e,"YAML directive accepts exactly one argument");let n=/^([0-9]+)\.([0-9]+)$/.exec(r[0]);null===n&&T(e,"ill-formed argument of the YAML directive");let i=parseInt(n[1],10),a=parseInt(n[2],10);1!==i&&T(e,"unacceptable YAML version of the document"),e.version=r[0],e.checkLineBreaks=a<2,1!==a&&2!==a&&S(e,"unsupported YAML version of the document")},TAG:function(e,t,r){let n;2!==r.length&&T(e,"TAG directive accepts exactly two arguments");let i=r[0];n=r[1],d.test(i)||T(e,"ill-formed tag handle (first argument) of the TAG directive"),s.call(e.tagMap,i)&&T(e,'there is a previously declared suffix for "'+i+'" tag handle'),p.test(n)||T(e,"ill-formed tag prefix (second argument) of the TAG directive");try{n=decodeURIComponent(n)}catch(t){T(e,"tag prefix is malformed: "+n)}e.tagMap[i]=n}};function E(e,t,r,n){if(t=32&&r<=1114111||T(e,"expected valid JSON character")}else l.test(i)&&T(e,"the stream contains non-printable characters");e.result+=i}}function D(e,t,r,i){n.isObject(r)||T(e,"cannot merge mappings; the provided source object is unacceptable");let a=Object.keys(r);for(let n=0,o=a.length;ne.maxTotalMergeKeys&&T(e,"merge keys exceeded maxTotalMergeKeys ("+e.maxTotalMergeKeys+")"),s.call(t,o)||(b(t,o,r[o]),i[o]=!0)}}function R(e,t,r,n,i,a,o,l,u){if(Array.isArray(i)){i=Array.prototype.slice.call(i);for(let t=0,r=i.length;t1&&(e.result+=n.repeat("\n",t-1))}function B(e,t){let r=e.tag,n=e.anchor,i=[],a=!1;if(-1!==e.firstTabInLine)return!1;null!==e.anchor&&w(e,e.anchor,i);let o=e.input.charCodeAt(e.position);for(;0!==o&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,T(e,"tab characters must not be used in indentation")),45===o&&g(e.input.charCodeAt(e.position+1)));){if(a=!0,e.position++,N(e,!0,-1)&&e.lineIndent<=t){i.push(null),o=e.input.charCodeAt(e.position);continue}let r=e.line;if(U(e,t,3,!1,!0),i.push(e.result),N(e,!0,-1),o=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>t)&&0!==o)T(e,"bad indentation of a sequence entry");else if(e.lineIndentt)&&(h&&(i=e.line,a=e.lineStart,o=e.position),U(e,t,4,!0,n)&&(h?p=e.result:m=e.result),h||(R(e,u,c,d,p,m,i,a,o),d=p=m=null),N(e,!0,-1),y=e.input.charCodeAt(e.position)),(e.line===I||e.lineIndent>t)&&0!==y)T(e,"bad indentation of a mapping entry");else if(e.lineIndent=e.maxDepth&&T(e,"nesting exceeded maxDepth ("+e.maxDepth+")"),e.depth+=1,null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null;let _=o=l=4===r||3===r;if(i&&N(e,!0,-1)&&(C=!0,e.lineIndent>t?b=1:e.lineIndent===t?b=0:e.lineIndentt?b=1:e.lineIndent===t?b=0:e.lineIndent=0;t-=1){let r=a[o[t]];r.existed?e.anchorMap[o[t]]=r.value:delete e.anchorMap[o[t]]}return P(e,i),!1}(e,S,S.position-S.lineStart,m)||o&&function(e,t){let r,i,a=1,o=!1,s=!1,l=t,u=0,c=!1,d=e.input.charCodeAt(e.position);if(124===d)r=!1;else{if(62!==d)return!1;r=!0}for(e.kind="scalar",e.result="";0!==d;)if(43===(d=e.input.charCodeAt(++e.position))||45===d)1===a?a=43===d?3:2:T(e,"repeat of a chomping mode identifier");else{var p;if((i=(p=d)>=48&&p<=57?p-48:-1)>=0)0===i?T(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?T(e,"repeat of an indentation width identifier"):(l=t+i-1,s=!0);else break}if(f(d)){do d=e.input.charCodeAt(++e.position);while(f(d));if(35===d)do d=e.input.charCodeAt(++e.position);while(!h(d)&&0!==d)}for(;0!==d;){for(M(e),e.lineIndent=0,d=e.input.charCodeAt(e.position);(!s||e.lineIndentl&&(l=e.lineIndent),h(d)){u++;continue}if(s||0!==l||T(e,"missing indentation for block scalar"),e.lineIndent0){let t=i,r=0;for(;t>0;t--)(i=function(e){if(e>=48&&e<=57)return e-48;let t=32|e;return t>=97&&t<=102?t-97+10:-1}(a=e.input.charCodeAt(++e.position)))>=0?r=(r<<4)+i:T(e,"expected hexadecimal character");e.result+=(s=r)<=65535?String.fromCharCode(s):String.fromCharCode((s-65536>>10)+55296,(s-65536&1023)+56320),e.position++}else T(e,"unknown escape sequence")}r=n=e.position}else h(a)?(E(e,r,n,!0),L(e,N(e,!1,t)),r=n=e.position):e.position===e.lineStart&&V(e)?T(e,"unexpected end of the document within a double quoted scalar"):(e.position++,f(a)||(n=e.position));T(e,"unexpected end of the stream within a double quoted scalar")}(e,m)?A=!0:function(e){let t=e.input.charCodeAt(e.position);if(42!==t)return!1;t=e.input.charCodeAt(++e.position);let r=e.position;for(;0!==t&&!g(t)&&!v(t);)t=e.input.charCodeAt(++e.position);e.position===r&&T(e,"name of an alias node must contain at least one character");let n=e.input.slice(r,e.position);return s.call(e.anchorMap,n)||T(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],N(e,!0,-1),!0}(e)?(A=!0,(null!==e.tag||null!==e.anchor)&&T(e,"alias node should not have any properties")):function(e,t,r){let n,i,a,o,s,l,u=e.kind,c=e.result,d=e.input.charCodeAt(e.position);if(g(d)||v(d)||35===d||38===d||42===d||33===d||124===d||62===d||39===d||34===d||37===d||64===d||96===d)return!1;if(63===d||45===d){let t=e.input.charCodeAt(e.position+1);if(g(t)||r&&v(t))return!1}for(e.kind="scalar",e.result="",n=i=e.position,a=!1;0!==d;){if(58===d){let t=e.input.charCodeAt(e.position+1);if(g(t)||r&&v(t))break}else if(35===d){if(g(e.input.charCodeAt(e.position-1)))break}else if(e.position===e.lineStart&&V(e)||r&&v(d))break;else if(h(d)){if(o=e.line,s=e.lineStart,l=e.lineIndent,N(e,!1,-1),e.lineIndent>=t){a=!0,d=e.input.charCodeAt(e.position);continue}e.position=i,e.line=o,e.lineStart=s,e.lineIndent=l;break}a&&(E(e,n,i,!1),L(e,e.line-o),n=i=e.position,a=!1),f(d)||(i=e.position+1),d=e.input.charCodeAt(++e.position)}return E(e,n,i,!1),!!e.result||(e.kind=u,e.result=c,!1)}(e,m,1===r)&&(A=!0,null===e.tag&&(e.tag="?")),null!==e.anchor&&w(e,e.anchor,e.result)}else 0===b&&(A=l&&B(e,y));if(null===e.tag)null!==e.anchor&&w(e,e.anchor,e.result);else if("?"===e.tag){null!==e.result&&"scalar"!==e.kind&&T(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"');for(let t=0,r=e.implicitTypes.length;t"),null!==e.result&&u.kind!==e.kind&&T(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+u.kind+'", not "'+e.kind+'"'),u.resolve(e.result,e.tag)?(e.result=u.construct(e.result,e.tag),null!==e.anchor&&w(e,e.anchor,e.result)):T(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),e.depth-=1,null!==e.tag||null!==e.anchor||A}function k(e,t){e=String(e),t=t||{},0!==e.length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));let r=new C(e,t),n=e.indexOf("\0");for(-1!==n&&(r.position=n,T(r,"null byte is not allowed in input")),r.input+="\0";32===r.input.charCodeAt(r.position);)r.lineIndent+=1,r.position+=1;for(;r.position0)&&37===t);){n=!0,t=e.input.charCodeAt(++e.position);let r=e.position;for(;0!==t&&!g(t);)t=e.input.charCodeAt(++e.position);let i=e.input.slice(r,e.position),a=[];for(i.length<1&&T(e,"directive name must not be less than one character in length");0!==t;){for(;f(t);)t=e.input.charCodeAt(++e.position);if(35===t){do t=e.input.charCodeAt(++e.position);while(0!==t&&!h(t));break}if(h(t))break;for(r=e.position;0!==t&&!g(t);)t=e.input.charCodeAt(++e.position);a.push(e.input.slice(r,e.position))}0!==t&&M(e),s.call(_,i)?_[i](e,i,a):S(e,'unknown document directive "'+i+'"')}if(N(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,N(e,!0,-1)):n&&T(e,"directives end mark is expected"),U(e,e.lineIndent-1,4,!1,!0),N(e,!0,-1),e.checkLineBreaks&&u.test(e.input.slice(r,e.position))&&S(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&V(e)){46===e.input.charCodeAt(e.position)&&(e.position+=3,N(e,!0,-1));return}e.position{"use strict";function n(e,t){return e.indexToWorld(t)}r.d(t,{A:()=>n})},24992:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.TokenType=void 0,function(e){e[e.EOF=0]="EOF",e[e.Declaration=1]="Declaration",e[e.DocType=2]="DocType",e[e.Element=3]="Element",e[e.Text=4]="Text",e[e.CDATA=5]="CDATA",e[e.PI=6]="PI",e[e.Comment=7]="Comment",e[e.ClosingTag=8]="ClosingTag"}(r||(t.TokenType=r={}))},25002:(e,t,r)=>{"use strict";r.d(t,{A:()=>u});var n=r(70192),i=r(17964),a=r(78378),o=r(4101);let{getSubPixelSpacingAndXYDirections:s}=r(33845).XL;function l(e,t,r,l){this.isDrawing=!0;let{element:u}=e.detail,{viewport:c}=(0,n.kJ)(u),{spacing:d,xDir:p,yDir:m}=s(c,this.configuration.subPixelResolution),h=t.data.contour.polyline.map(c.worldToCanvas);0===t.data.handles.activeHandleIndex&&h.reverse();let f=!1;l?.worldPosition&&(f=!0),this.drawData={canvasPoints:h,polylineIndex:h.length-1},this.commonData={annotation:t,viewportIdsToRender:r,spacing:d,xDir:p,yDir:m,movingTextBox:f},i.wk.isInteractingWithTool=!0,u.addEventListener(a.sV.MOUSE_UP,this.mouseUpDrawCallback),u.addEventListener(a.sV.MOUSE_DRAG,this.mouseDragDrawCallback),u.addEventListener(a.sV.MOUSE_CLICK,this.mouseUpDrawCallback),u.addEventListener(a.sV.TOUCH_END,this.mouseUpDrawCallback),u.addEventListener(a.sV.TOUCH_DRAG,this.mouseDragDrawCallback),u.addEventListener(a.sV.TOUCH_TAP,this.mouseUpDrawCallback),(0,o.lY)(u)}let u=function(e){e.activateOpenContourEndEdit=l.bind(e)}},25102:(e,t,r)=>{"use strict";r.d(t,{A:()=>u,g:()=>l});var n=r(47776),i=r(69228),a=r(77280),o=r(16376);let s={};function l(e){void 0!==s[e]&&delete s[e]}let u=function(e){let{renderingEngineId:t,viewportId:r}=e.detail,l=(0,o.lD)(t).getViewport(r);if(!("setVolumes"in l))throw Error("volumeNewImageEventDispatcher: viewport does not have setVolumes method");void 0===s[l.id]&&(s[l.id]=0);let u=(0,n.A)(l);if(!u)return void console.warn(`volumeNewImageEventDispatcher: sliceData is undefined for viewport ${l.id}`);let{numberOfSlices:c,imageIndex:d}=u;s[l.id]!==d&&(s[l.id]=d,(0,i.A)(l.element,a.sV.VOLUME_NEW_IMAGE,{imageIndex:d,viewportId:r,renderingEngineId:t,numberOfSlices:c}))}},25294:(e,t,r)=>{"use strict";r.d(t,{N9:()=>n.N,Pf:()=>a.P,g1:()=>i.A,g6:()=>a.g,qV:()=>o.qV,rE:()=>n.r,sv:()=>o.sv});var n=r(7286),i=r(53725),a=r(30113),o=r(21432);r(62004),r(80405),r(39113),r(27112),r(48196)},25931:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(70192),i=r(48937),a=r(43385),o=r(2911);let s={[i.A.EnsureImageVolumeFor3DManipulation]:e=>{let t,{operationData:r,viewport:i}=e;if(i){if(t=i.getImageIds(),!n.BF.isValidVolume(t))throw Error("Volume is not reconstructable for sphere manipulation")}else t=(0,a.T)(r.segmentationId).representationData.Labelmap.imageIds.map(e=>n.PP.getImage(e).referencedImageId);let s=(0,o.A)(t);if(!s)throw Error("Failed to create or get image volume");r.imageVoxelManager=s.voxelManager,r.imageData=s.imageData}}},25970:(e,t,r)=>{"use strict";e.exports=new(r(50026))("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})},26221:(e,t,r)=>{"use strict";r.d(t,{Qk:()=>s,Ry:()=>c,VQ:()=>u});var n=r(70192),i=r(65509),a=r(40454),o=r(37406);function s(e,t){let r,{segmentIndex:n}=t,s=t.overwriteSegmentIndices??[];if(!n)return{segmentIndex:n,labelValue:0,overwriteSegmentIndices:s,protectedSegmentIndices:[],crossLayerEraseBindings:[],movedSegment:!1};let l=(0,a.hM)(e,n),u=l?(0,i.Hs)(e,l.labelmapId):void 0;if(!l||!u)return{segmentIndex:n,labelValue:n,overwriteSegmentIndices:s,protectedSegmentIndices:[],crossLayerEraseBindings:[],movedSegment:!1};let c=u,d=l.labelmapId,p=l.labelValue,m=!1,h=function(e,t,r,n=[]){return(0,a.I3)(e,t).filter(e=>e!==r&&!n.includes(e))}(e,d,n,s);if(function(e,t,r,n,i={}){if(!n||!r.length)return!1;let o=new Set(r),s=!1;return n.forEach(({value:r})=>{if(!r||s)return;let n=(0,a.Mx)(e,t,Number(r));n&&o.has(n)&&(s=!0)},{imageData:i.segmentationImageData,isInObject:i.isInObject,boundsIJK:i.isInObjectBoundsIJK}),s}(e,d,h,t.segmentationVoxelManager,{segmentationImageData:t.segmentationImageData,isInObject:t.isInObject,isInObjectBoundsIJK:t.isInObjectBoundsIJK})){let i=(t.moveSegmentToPrivateLabelmap??o.J)(e,n,{moveStepCallback:e=>r=e}),s=(0,a.hM)(e,n);i&&s?(c=i,d=s.labelmapId,p=s.labelValue,m=i.labelmapId!==u.labelmapId):i&&(c=i,d=i.labelmapId,p=1,m=i.labelmapId!==u.labelmapId)}return{segmentIndex:n,labelmapId:d,labelValue:p,sourceLayer:u,activeLayer:c,overwriteSegmentIndices:s,protectedSegmentIndices:h,crossLayerEraseBindings:function(e,t,r=[]){return t&&r.length?r.map(t=>(0,a.hM)(e,t)).filter(e=>!!e&&e.labelmapId!==t):[]}(e,d,s),movedSegment:m,moveStep:r}}function l(e){return"function"==typeof e?.getCurrentImageId?e.getCurrentImageId():void 0}function u(e,t={}){let r=function(e,t={}){let r=function(e,t){var r;let n=t.imageId??l(t.viewport);if(!n)return -1;let i=t.sourceLayer?.imageIds?.indexOf(n)??-1;if(i>=0)return i;let a=e.imageIds?.indexOf(n)??-1;return a>=0?a:(r=t.viewport,"function"==typeof r?.getImageIds?r.getImageIds():[]).indexOf(n)}(e,t);return r>=0?e.imageIds?.[r]:e.imageIds?.[0]}(e,t);if(t.preferVolume||e.volumeId||t.viewport instanceof n.ei){let t=(0,i.kL)(e);return{imageId:r,imageData:t?.imageData,voxelManager:t?.voxelManager,volume:t}}let a=r?n.PP.getImage(r):void 0;return{imageId:r,voxelManager:a?.voxelManager,image:a}}function c(e,t,r){if(!t?.crossLayerEraseBindings?.length)return[];let a=new Set;return t.crossLayerEraseBindings.forEach(t=>{let o=(0,i.Hs)(e,t.labelmapId);if(o){if(r.viewport instanceof n.ei||o.volumeId)return void function(e,t,r,n){let a=(0,i.kL)(e);if(!a)return;let o=[];a.voxelManager.forEach(({value:e,index:n,pointIJK:i})=>{if(e!==t.labelValue)return;let s=a.imageData.indexToWorld(i);r.isInObject(s)&&(a.voxelManager.setAtIndex(n,0),o.push(n))},{imageData:a.imageData,boundsIJK:r.isInObjectBoundsIJK}),o.length&&r.crossLayerEraseCallback?.({voxelManager:a.voxelManager,labelValue:t.labelValue,indices:o}),a.voxelManager?.getArrayOfModifiedSlices?.()?.forEach(e=>n.add(e))}(o,t,r,a);!function(e,t,r,n){let i=r.viewport,a=l(r.viewport)??r.imageId,{image:o,voxelManager:s}=u(e,{viewport:r.viewport,imageId:a});if(!o||!s)return;let c=[];s.forEach(({value:e,index:n,pointIJK:i})=>{if(e!==t.labelValue)return;let a=r.referenceImageData.indexToWorld(i);r.isInObject(a)&&(s.setAtIndex(n,0),c.push(n))},{imageData:r.referenceImageData,boundsIJK:r.isInObjectBoundsIJK}),c.length&&r.crossLayerEraseCallback?.({voxelManager:s,labelValue:t.labelValue,indices:c});let d=i.getCurrentImageIdIndex?.();"number"==typeof d&&n.add(d)}(o,t,r,a)}}),Array.from(a)}},26361:(e,t,r)=>{"use strict";r(70192),r(78378),r(760),r(23537)},26444:(e,t,r)=>{"use strict";r.d(t,{R:()=>s});var n=r(89349),i=r(77280),a=r(3922),o=r(69228);function s(e,t,r){return{promise:new Promise((n,i)=>{l(e,t,r).then(n).catch(i)}),cancelFn:void 0,decache:()=>{}}}async function l(e,t,r){let s=e.split(":").slice(1).join(":"),l=await function({url:e,signal:t,onload:r,loaderOptions:n}){return new Promise(async(s,l)=>{let u=new XMLHttpRequest;u.open("GET",e,!0);let c={},d=await n.beforeSend(u,c),p=Object.assign({},c,d);u.responseType="arraybuffer",Object.keys(p).forEach(function(e){null!==p[e]&&u.setRequestHeader(e,p[e])});let m=function(e){r&&"function"==typeof r&&r(),t&&t.removeEventListener("abort",h),s(u.response)},h=()=>{u.abort(),u.removeEventListener("load",m),l(Error("Request aborted"))};u.addEventListener("load",m),u.onprogress=function(t){var r,n;r=t.loaded,n=t.total,(0,o.A)(a.A,i.sV.GEOMETRY_LOAD_PROGRESS,{data:{url:e,loaded:r,total:n}})},t&&t.aborted?(u.abort(),l(Error("Request aborted"))):t&&t.addEventListener("abort",h),u.send()})}({url:s,loaderOptions:r});if(!t||!("geometryData"in t))throw Error("Mesh must have a geometryData");return(0,n.q)(s,{...t.geometryData,arrayBuffer:l})}},26447:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.node_stringReplaceAll=function(e,t){let r=null;""!==e&&(r=(0,o.create_text)(t._nodeDocument,e)),(0,u.mutation_replaceAll)(r,t)},t.node_clone=function e(t,r=null,a=!1){let s;if(null===r&&(r=t._nodeDocument),i.Guard.isElementNode(t))for(let n of(s=(0,c.element_createAnElement)(r,t._localName,t._namespace,t._namespacePrefix,t._is,!1),t._attributeList)){let t=e(n,r);(0,c.element_append)(t,s)}else if(i.Guard.isDocumentNode(t)){let e=(0,o.create_document)();e._encoding=t._encoding,e._contentType=t._contentType,e._URL=t._URL,e._origin=t._origin,e._type=t._type,e._mode=t._mode,s=e}else if(i.Guard.isDocumentTypeNode(t))s=(0,o.create_documentType)(r,t._name,t._publicId,t._systemId);else if(i.Guard.isAttrNode(t)){let e=(0,o.create_attr)(r,t.localName);e._namespace=t._namespace,e._namespacePrefix=t._namespacePrefix,e._value=t._value,s=e}else s=i.Guard.isExclusiveTextNode(t)?(0,o.create_text)(r,t._data):i.Guard.isCDATASectionNode(t)?(0,o.create_cdataSection)(r,t._data):i.Guard.isCommentNode(t)?(0,o.create_comment)(r,t._data):i.Guard.isProcessingInstructionNode(t)?(0,o.create_processingInstruction)(r,t._target,t._data):i.Guard.isDocumentFragmentNode(t)?(0,o.create_documentFragment)(r):Object.create(t);if(i.Guard.isDocumentNode(s)?(s._nodeDocument=s,r=s):s._nodeDocument=r,n.dom.features.steps&&(0,l.dom_runCloningSteps)(s,t,r,a),a)for(let n of t._children){let t=e(n,r,!0);(0,u.mutation_append)(t,s)}return s},t.node_equals=function e(t,r){if(t._nodeType!==r._nodeType)return!1;if(i.Guard.isDocumentTypeNode(t)&&i.Guard.isDocumentTypeNode(r)){if(t._name!==r._name||t._publicId!==r._publicId||t._systemId!==r._systemId)return!1}else if(i.Guard.isElementNode(t)&&i.Guard.isElementNode(r)){if(t._namespace!==r._namespace||t._namespacePrefix!==r._namespacePrefix||t._localName!==r._localName||t._attributeList.length!==r._attributeList.length)return!1}else if(i.Guard.isAttrNode(t)&&i.Guard.isAttrNode(r)){if(t._namespace!==r._namespace||t._localName!==r._localName||t._value!==r._value)return!1}else if(i.Guard.isProcessingInstructionNode(t)&&i.Guard.isProcessingInstructionNode(r)){if(t._target!==r._target||t._data!==r._data)return!1}else if(i.Guard.isCharacterDataNode(t)&&i.Guard.isCharacterDataNode(r)&&t._data!==r._data)return!1;if(i.Guard.isElementNode(t)&&i.Guard.isElementNode(r)){let n={};for(let e of t._attributeList)n[e._localName]=e;for(let t of r._attributeList){let r=n[t._localName];if(!r||!e(r,t))return!1}}if(t._children.size!==r._children.size)return!1;let n=t._children[Symbol.iterator](),a=r._children[Symbol.iterator](),o=n.next(),s=a.next();for(;!o.done&&!s.done;){if(!e(o.value,s.value))return!1;o=n.next(),s=a.next()}return!0},t.node_listOfElementsWithQualifiedName=function(e,t){return"*"===e?(0,o.create_htmlCollection)(t):"html"===t._nodeDocument._type?(0,o.create_htmlCollection)(t,function(t){return t._namespace===a.namespace.HTML&&t._qualifiedName===e.toLowerCase()||t._namespace!==a.namespace.HTML&&t._qualifiedName===e}):(0,o.create_htmlCollection)(t,function(t){return t._qualifiedName===e})},t.node_listOfElementsWithNamespace=function(e,t,r){return(""===e&&(e=null),"*"===e&&"*"===t)?(0,o.create_htmlCollection)(r):"*"===e?(0,o.create_htmlCollection)(r,function(e){return e._localName===t}):"*"===t?(0,o.create_htmlCollection)(r,function(t){return t._namespace===e}):(0,o.create_htmlCollection)(r,function(r){return r._localName===t&&r._namespace===e})},t.node_listOfElementsWithClassNames=function(e,t){let r=(0,s.orderedSet_parse)(e);if(0===r.size)return(0,o.create_htmlCollection)(t,()=>!1);let n="quirks"!==t._nodeDocument._mode;return(0,o.create_htmlCollection)(t,function(e){let t=e.classList;return(0,s.orderedSet_contains)(t._tokenSet,r,n)})},t.node_locateANamespacePrefix=function e(t,r){if(t._namespace===r&&null!==t._namespacePrefix)return t._namespacePrefix;for(let e=0;e{"use strict";function t(e,t){let r="",n=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(r+="\n\n"+e.mark.snippet),n+" "+r):n}function r(e,r){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=r,this.message=t(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error().stack||""}r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r.prototype.toString=function(e){return this.name+": "+t(this,e)},e.exports=r},26980:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(50923),i=r(39216);let a=function(e,t){let r=(0,i.get)("imagePlaneModule",e);if(!r)throw Error(`No imagePlaneModule found for imageId: ${e}`);let{columnCosines:a,rowCosines:o,imagePositionPatient:s}=r,{columnPixelSpacing:l,rowPixelSpacing:u}=r;l||=1,u||=1;let c=n.vt();n.Ln(c,s,a,-l/2),n.Ln(c,c,o,-u/2);let d=n.vt();return n.jb(d,t,c),[n.Om(d,o)/u,n.Om(d,a)/l]}},27109:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let n=Symbol("LastRuntimeId"),i={};function a(e,t,r){return(function(e,t,r){let n=e[t];n instanceof Array||Object.defineProperty(e,t,{value:n=[0]});for(let e=!0,t=0;e&&t0?r:0xffffffff)>>>0).join("string"==typeof t?t:"-")}},27112:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>o.A,Dl:()=>a.D,er:()=>i.e,fB:()=>s,zp:()=>a.z});var n=r(15798),i=r(4937),a=r(96277),o=r(92882);let s={adapter:n.m,getSnapshot:n.x}},27255:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>l});var n=r(17042),i=r(83734),{vtkErrorMacro:a}=n.Ay,o={};function s(e,t,r={}){Object.assign(t,o,r),n.Ay.obj(e,t),n.Ay.algo(e,t,1,1),t._cubeSource=i.Ay.newInstance(),n.Ay.moveToProtected(e,t,["cubeSource","tmpOut"]);t.classHierarchy.push("vtkImageDataOutlineFilter");let l={...e};e.requestData=(e,r)=>{let n=e[0];if(!n||!n.isA("vtkImageData"))return void a("Invalid or missing input");let i=n.getSpatialExtent();if(!i)return void a("Unable to fetch spatial extents of input image.");t._cubeSource.setBounds(i),t._cubeSource.setMatrix(n.getIndexToWorld()),r[0]=t._cubeSource.getOutputData()},e.getMTime=()=>Math.max(l.getMTime(),t._cubeSource.getMTime()),e.setGenerateFaces=t._cubeSource.setGenerateFaces,e.setGenerateLines=t._cubeSource.setGenerateLines,e.getGenerateFaces=t._cubeSource.getGenerateFaces,e.getGenerateLines=t._cubeSource.getGenerateLines}var l={newInstance:n.Ay.newInstance(s,"vtkImageDataOutlineFilter"),extend:s}},27321:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=function(e,t,r){return`${e}::${t}::${r}`}},27492:(e,t,r)=>{"use strict";let n=r(55839);function i(e){let t=e,r=1,n=t[0];if(("-"===n||"+"===n)&&("-"===n&&(r=-1),n=(t=t.slice(1))[0]),"0"===t)return 0;if("0"===n){if("b"===t[1])return r*parseInt(t.slice(2),2);if("x"===t[1])return r*parseInt(t.slice(2),16);if("o"===t[1])return r*parseInt(t.slice(2),8)}return r*parseInt(t,10)}e.exports=new(r(50026))("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){var t,r,n;if(null===e)return!1;let a=e.length,o=0,s=!1;if(!a)return!1;let l=e[o];if(("-"===l||"+"===l)&&(l=e[++o]),"0"===l){if(o+1===a)return!0;if("b"===(l=e[++o])){for(o++;o=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102))return!1;s=!0}return s&&isFinite(i(e))}if("o"===l){for(o++;o=48&&r<=55))return!1;s=!0}return s&&isFinite(i(e))}}for(;o=48&&n<=57))return!1;s=!0}return!!s&&isFinite(i(e))},construct:function(e){return i(e)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1==0&&!n.isNegativeZero(e)},represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},27501:(e,t,r)=>{"use strict";function n(e,t){if(e.length!==t.length)throw Error("Both points should have the same dimensionality");let[r,n,i=0]=e,[a,o,s=0]=t,l=a-r,u=o-n,c=s-i;return l*l+u*u+c*c}r.d(t,{A:()=>n})},27520:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(95525);function i(e,t,r,a=!0){let o,s;a?(s=e.length-1,o=0):(s=0,o=1);for(let i=o;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseJSONFromBytes=function(e){let t=(0,n.utf8Decode)(e);return JSON.parse.call(void 0,t)},t.serializeJSONToBytes=function(e){let t=JSON.stringify.call(void 0,e);return(0,n.utf8Encode)(t)},t.parseJSONIntoInfraValues=function(e){return i(JSON.parse.call(void 0,e))},t.convertAJSONDerivedJavaScriptValueToAnInfraValue=i;let n=r(16950);function i(e){if(null===e||(0,n.isString)(e)||(0,n.isNumber)(e))return e;if((0,n.isArray)(e)){let t=[];for(let r of e)t.push(i(r));return t}if((0,n.isObject)(e)){let t=new Map;for(let r in e)if(e.hasOwnProperty(r)){let n=e[r];t.set(r,i(n))}return t}return e}},28193:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>s});var n=r(17042),{FieldAssociations:i}=r(21122).Ay,a={fieldAssociation:i.FIELD_ASSOCIATION_CELLS,captureZValues:!1};function o(e,t,r={}){Object.assign(t,a,r),n.Ay.obj(e,t),n.Ay.setGet(e,t,["fieldAssociation","captureZValues"]),t.classHierarchy.push("vtkHardwareSelector"),e.getSourceDataAsync=async(e,t,r,n,i)=>{},e.selectAsync=async(t,r,n,i,a)=>{let o=await e.getSourceDataAsync(t,r,n,i,a);return o?o.generateSelection(r,n,i,a):[]}}var s={newInstance:n.Ay.newInstance(o,"vtkHardwareSelector"),extend:o}},28245:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var n="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the polydata mappers fragment shader\n\nuniform int PrimitiveIDOffset;\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// optional color passed in from the vertex shader, vertexColor\n//VTK::Color::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// Depth Peeling Support\n//VTK::DepthPeeling::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// label outline \n//VTK::LabelOutline::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n//VTK::LabelOutlineHelperFunction\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Clip::Impl\n\n //VTK::Color::Impl\n\n // Generate the normal if we are not passed in one\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Light::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n"},28478:(e,t,r)=>{"use strict";function n(e){let t=[],[r,n]=e.getRange();e.getTable(r,n,1024,t),t=t.filter((e,t)=>t%3==0);let i=[...Array(1024).keys()].map((e,t)=>r+(n-r)/1023*t),a=t[256],o=Math.log((1-a)/a),s=i[256],l=t[768],u=Math.log((1-l)/l),c=Math.round(4*(i[768]-s)/(o-u)),d=Math.round(s+c*o/4);return[Math.round(d-c/2),Math.round(d+c/2)]}r.d(t,{A:()=>n})},28712:(e,t,r)=>{"use strict";function n(e){let t=0x811c9dc5;for(let r=0;r>>0).toString(36)}r.d(t,{A:()=>n})},28790:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StaticRangeImpl=void 0;let n=r(31846),i=r(32008),a=r(79663);class o extends n.AbstractRangeImpl{_start;_end;constructor(e){if(super(),a.Guard.isDocumentTypeNode(e.startContainer)||a.Guard.isAttrNode(e.startContainer)||a.Guard.isDocumentTypeNode(e.endContainer)||a.Guard.isAttrNode(e.endContainer))throw new i.InvalidNodeTypeError;this._start=[e.startContainer,e.startOffset],this._end=[e.endContainer,e.endOffset]}}t.StaticRangeImpl=o},29010:(e,t,r)=>{"use strict";r.d(t,{A:()=>a,i:()=>s});let n=Symbol("DefinedCursors"),i=new Set(["alias","all-scroll","auto","cell","col-resize","context-menu","copy","crosshair","default","e-resize","ew-resize","grab","grabbing","help","move","ne-resize","nesw-resize","no-drop","none","not-allowed","n-resize","ns-resize","nw-resize","nwse-resize","pointer","progress","row-resize","se-resize","s-resize","sw-resize","text","vertical-text","wait","w-resize","zoom-in","zoom-out"]);class a{constructor(e,t){this.name=e+"",this.fallback=t}getName(){return this.name+""}addFallbackStyleProperty(e){let{fallback:t}=this;return t instanceof a?`${e}, ${t.getStyleProperty()}`:e+""}getStyleProperty(){return this.addFallbackStyleProperty(this.name)+""}static getDefinedCursor(e){let t=o(a,n),r=t.get(e);return r instanceof a?r:i.has(e)?(r=new a(e),t.set(e,r),r):void 0}static setDefinedCursor(e,t){return t instanceof a&&(o(a,n).set(e,t),!0)}}function o(e,t){let r=e[t];return r instanceof Map||Object.defineProperty(e,t,{value:r=new Map}),r}let s=i.values()},29103:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>d});var n=r(17042),i=r(72188),a=r(56929),o=r(37843),s=r(85250),l={context:null,lastRenderer:null,keyMatrixTime:null,keyMatrices:null};function u(e,t,r={}){Object.assign(t,l,r),i.A.extend(e,t,r),t.keyMatrixTime={},(0,n.WL)(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(9),vcpc:new Float64Array(16),wcvc:new Float64Array(16),wcpc:new Float64Array(16)},(0,n.V0)(e,t,["context","keyMatrixTime"]),t.classHierarchy.push("vtkOpenGLCamera"),e.buildPass=r=>{r&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext())},e.opaquePass=e=>{if(e){let e=t._openGLRenderer.getTiledSizeAndOrigin();t.context.viewport(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize),t.context.scissor(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize)}},e.translucentPass=e.opaquePass,e.zBufferPass=e.opaquePass,e.opaqueZBufferPass=e.opaquePass,e.volumePass=e.opaquePass,e.getKeyMatrices=r=>{if(r!==t.lastRenderer||t._openGLRenderWindow.getMTime()>t.keyMatrixTime.getMTime()||e.getMTime()>t.keyMatrixTime.getMTime()||r.getMTime()>t.keyMatrixTime.getMTime()||t.renderable.getMTime()>t.keyMatrixTime.getMTime()){t.renderable.getViewMatrix(t.keyMatrices.wcvc),o.fromMat4(t.keyMatrices.normalMatrix,t.keyMatrices.wcvc),o.invert(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),s.transpose(t.keyMatrices.wcvc,t.keyMatrices.wcvc);let e=t._openGLRenderer.getAspectRatio();s.copy(t.keyMatrices.vcpc,t.renderable.getProjectionMatrix(e,-1,1)),s.transpose(t.keyMatrices.vcpc,t.keyMatrices.vcpc),s.multiply(t.keyMatrices.wcpc,t.keyMatrices.vcpc,t.keyMatrices.wcvc),t.keyMatrixTime.modified(),t.lastRenderer=r}return t.keyMatrices}}var c=(0,n.UI)(u),d={newInstance:c,extend:u};(0,a.c9)("vtkCamera",c)},29107:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.YAMLCBWriter=void 0;let n=r(39409);class i extends n.BaseCBWriter{_rootWritten=!1;_additionalLevel=0;constructor(e){if(super(e),e.indent.length<2)throw Error("YAML indententation string must be at least two characters long.");if(e.offset<0)throw Error("YAML offset should be zero or a positive number.")}frontMatter(){return this._beginLine()+"---"}declaration(e,t,r){return""}docType(e,t,r){return""}comment(e){return this._beginLine()+this._key(this._builderOptions.convert.comment)+" "+this._val(e)}text(e){return this._beginLine()+this._key(this._builderOptions.convert.text)+" "+this._val(e)}instruction(e,t){return this._beginLine()+this._key(this._builderOptions.convert.ins)+" "+this._val(t?e+" "+t:e)}cdata(e){return this._beginLine()+this._key(this._builderOptions.convert.cdata)+" "+this._val(e)}attribute(e,t){this._additionalLevel++;let r=this._beginLine()+this._key(this._builderOptions.convert.att+e)+" "+this._val(t);return this._additionalLevel--,r}openTagBegin(e){let t=this._beginLine()+this._key(e);return this._rootWritten||(this._rootWritten=!0),this.hasData=!0,this._additionalLevel++,t+=this._beginLine(!0)+this._key(this._builderOptions.convert.text)}openTagEnd(e,t,r){return t?" "+this._val(""):""}closeTag(e){return this._additionalLevel--,""}beginElement(e){}endElement(e){}_beginLine(e=!1){return(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level,e)}_indent(e,t){if(e+this._additionalLevel<=0)return"";{let r=this._writerOptions.indent.repeat(e+this._additionalLevel);return!t&&this._rootWritten?r.substr(0,r.length-2)+"-"+r.substr(-1,1):r}}_key(e){return'"'+e+'":'}_val(e){return JSON.stringify(e)}}t.YAMLCBWriter=i},29201:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>c});var n=r(17042),i=r(72188),a=r(56929),o=r(85250),s={context:null,keyMatrixTime:null,keyMatrices:null};function l(e,t,r={}){Object.assign(t,s,r),i.A.extend(e,t,r),t.keyMatrixTime={},(0,n.WL)(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:o.identity(new Float64Array(16))},(0,n.V0)(e,t,["context"]),t.classHierarchy.push("vtkOpenGLImageSlice"),e.buildPass=r=>{t.renderable&&t.renderable.getVisibility()&&r&&t.renderable&&(t._openGLRenderWindow=e.getLastAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.traverseZBufferPass=r=>{!t.renderable||!t.renderable.getNestedVisibility()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(r,!0),t.children.forEach(e=>{e.traverse(r)}),e.apply(r,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=r=>{!t.renderable||!t.renderable.getNestedVisibility()||!t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(r,!0),t.children.forEach(e=>{e.traverse(r)}),e.apply(r,!1))},e.traverseTranslucentPass=r=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(r,!0),t.children.forEach(e=>{e.traverse(r)}),e.apply(r,!1))},e.queryPass=(e,r)=>{e&&t.renderable&&t.renderable.getVisibility()&&(t.renderable.getIsOpaque()?r.incrementOpaqueActorCount():r.incrementTranslucentActorCount())},e.zBufferPass=(t,r)=>e.opaquePass(t,r),e.opaqueZBufferPass=(t,r)=>e.opaquePass(t,r),e.opaquePass=(e,r)=>{e&&t.context.depthMask(!0)},e.translucentPass=(e,r)=>{t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(o.copy(t.keyMatrices.mcwc,t.renderable.getMatrix()),o.transpose(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.keyMatrixTime.modified()),t.keyMatrices)}var u=(0,n.UI)(l,"vtkOpenGLImageSlice"),c={newInstance:u,extend:l};(0,a.c9)("vtkImageSlice",u)},29234:(e,t,r)=>{"use strict";var n;r.d(t,{A:()=>i}),function(e){e.CONTOUR="CONTOUR",e.SURFACE="SURFACE",e.MESH="MESH"}(n||(n={}));let i=n},29302:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NonElementParentNodeImpl=void 0;let n=r(79663),i=r(47518);class a{getElementById(e){let t=(0,i.tree_getFirstDescendantNode)(n.Cast.asNode(this),!1,!1,e=>n.Guard.isElementNode(e));for(;null!==t;){if(t._uniqueIdentifier===e)return t;t=(0,i.tree_getNextDescendantNode)(n.Cast.asNode(this),t,!1,!1,e=>n.Guard.isElementNode(e))}return null}}t.NonElementParentNodeImpl=a},29470:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(27321),i=r(65704),a=r(68759);let o=function(e,t,r,o,s={},l){let u,{color:c,handleRadius:d,width:p,lineWidth:m,fill:h,type:f,opacity:g}=Object.assign({color:"rgb(0, 255, 0)",handleRadius:"6",width:"2",lineWidth:void 0,fill:"transparent",type:"circle",opacity:1},s),v=m||p,y=(0,n.A)(t,"handle",`hg-${r}-index-${l}`);if("circle"===f)u={cx:`${o[0]}`,cy:`${o[1]}`,r:d,stroke:c,fill:h,"stroke-width":v,opacity:g};else if("rect"===f){let e=1.5*parseFloat(d),t=o[0]-.5*e,r=o[1]-.5*e;u={x:`${t}`,y:`${r}`,width:`${e}`,height:`${e}`,stroke:c,fill:h,"stroke-width":v,rx:`${.1*e}`,opacity:g}}else throw Error(`Unsupported handle type: ${f}`);let b=e.getSvgNode(y);if(b)(0,a.A)(u,b),e.setNodeTouched(y);else{let t=document.createElementNS("http://www.w3.org/2000/svg",f);(0,i.A)(u,t),e.appendNode(t,y)}}},29544:(e,t,r)=>{"use strict";function n(e,t){return"function"==typeof e?.[t]}function i(e){return n(e,"getCurrentImageId")&&n(e,"getCurrentImageIdIndex")&&n(e,"getImageIds")&&n(e,"hasImageURI")}r.d(t,{hz:()=>i})},29963:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tree_getFirstDescendantNode=s,t.tree_getNextDescendantNode=l,t.tree_getDescendantNodes=u,t.tree_getDescendantElements=function(e,t=!1,r=!1,i){return t||0!==e._children.size?{[Symbol.iterator]:()=>{let a=u(e,t,r,e=>n.Guard.isElementNode(e))[Symbol.iterator](),o=a.next().value;return{next(){for(;o&&i&&!i(o);)o=a.next().value;if(null===o)return{done:!0,value:null};{let e={done:!1,value:o};return o=a.next().value,e}}}}}:o()},t.tree_getSiblingNodes=function(e,t=!1,r){return e._parent&&0!==e._parent._children.size?{[Symbol.iterator](){let n=e._parent?e._parent._firstChild:null;return{next(){for(;n&&(r&&!r(n)||!t&&n===e);)n=n._nextSibling;if(null===n)return{done:!0,value:null};{let e={done:!1,value:n};return n=n._nextSibling,e}}}}}:o()},t.tree_getFirstAncestorNode=c,t.tree_getNextAncestorNode=d,t.tree_getAncestorNodes=function(e,t=!1,r){return t||e._parent?{[Symbol.iterator](){let n=c(e,t,r);return{next(){if(null===n)return{done:!0,value:null};{let i={done:!1,value:n};return n=d(e,n,t,r),i}}}}}:o()},t.tree_getCommonAncestor=function(e,t){if(e===t)return e._parent;let r=[],n=[],i=c(e,!0);for(;null!==i;)r.push(i),i=d(e,i,!0);let a=c(t,!0);for(;null!==a;)n.push(a),a=d(t,a,!0);let o=r.length,s=n.length,l=null;for(let e=Math.min(o,s);e>0;e--){let e=r[--o];if(e!==n[--s])break;l=e}return l},t.tree_getFollowingNode=function(e,t){if(t._firstChild)return t._firstChild;if(t._nextSibling)return t._nextSibling;for(;;){let r=t._parent;if(null===r||r===e)return null;if(r._nextSibling)return r._nextSibling;t=r}},t.tree_getPrecedingNode=function(e,t){return t===e?null:t._previousSibling?(t=t._previousSibling)._lastChild?t._lastChild:t:t._parent},t.tree_isConstrained=function e(t){switch(t._nodeType){case i.NodeType.Document:let r=!1,n=!1;for(let e of t._children)switch(e._nodeType){case i.NodeType.ProcessingInstruction:case i.NodeType.Comment:break;case i.NodeType.DocumentType:if(r||n)return!1;r=!0;break;case i.NodeType.Element:if(n)return!1;n=!0;break;default:return!1}break;case i.NodeType.DocumentFragment:case i.NodeType.Element:for(let e of t._children)switch(e._nodeType){case i.NodeType.Element:case i.NodeType.Text:case i.NodeType.ProcessingInstruction:case i.NodeType.CData:case i.NodeType.Comment:break;default:return!1}break;case i.NodeType.DocumentType:case i.NodeType.Text:case i.NodeType.ProcessingInstruction:case i.NodeType.CData:case i.NodeType.Comment:return!t.hasChildNodes()}for(let r of t._children)if(!e(r))return!1;return!0},t.tree_nodeLength=p,t.tree_isEmpty=function(e){return 0===p(e)},t.tree_rootNode=m,t.tree_isDescendantOf=function(e,t,r=!1,n=!1){let i=s(e,r,n);for(;null!==i;){if(i===t)return!0;i=l(e,i,r,n)}return!1},t.tree_isAncestorOf=h,t.tree_isHostIncludingAncestorOf=function e(t,r,i=!1){if(h(t,r,i))return!0;let a=m(t);return!!(n.Guard.isDocumentFragmentNode(a)&&null!==a._host&&e(a._host,r,i))},t.tree_isSiblingOf=function(e,t,r=!1){return e!==t?null!==e._parent&&e._parent===t._parent:!!r},t.tree_isPreceding=function(e,t){let r=f(e),n=f(t);return -1!==r&&-1!==n&&m(e)===m(t)&&nr},t.tree_isParentOf=function(e,t){return e._parent===t},t.tree_isChildOf=function(e,t){return t._parent===e},t.tree_previousSibling=function(e){return e._previousSibling},t.tree_nextSibling=function(e){return e._nextSibling},t.tree_firstChild=function(e){return e._firstChild},t.tree_lastChild=function(e){return e._lastChild},t.tree_treePosition=f,t.tree_index=function(e){let t=0;for(;null!==e._previousSibling;)t++,e=e._previousSibling;return t},t.tree_retarget=function(e,t){for(;;){if(!e||!n.Guard.isNode(e))return e;let r=m(e);if(!n.Guard.isShadowRoot(r)||t&&n.Guard.isNode(t)&&h(r,t,!0,!0))return e;e=r.host}};let n=r(79663),i=r(5309);function a(e,t,r=!1){if(r&&n.Guard.isElementNode(t)&&n.Guard.isShadowRoot(t.shadowRoot)&&t.shadowRoot._firstChild)return t.shadowRoot._firstChild;if(t._firstChild)return t._firstChild;if(t===e)return null;if(t._nextSibling)return t._nextSibling;let i=t._parent;for(;i&&i!==e;){if(i._nextSibling)return i._nextSibling;i=i._parent}return null}function o(){return{[Symbol.iterator]:()=>({next:()=>({done:!0,value:null})})}}function s(e,t=!1,r=!1,n){let i=t?e:a(e,e,r);for(;i&&n&&!n(i);)i=a(e,i,r);return i}function l(e,t,r=!1,n=!1,i){let o=a(e,t,n);for(;o&&i&&!i(o);)o=a(e,o,n);return o}function u(e,t=!1,r=!1,n){return t||0!==e._children.size?{[Symbol.iterator]:()=>{let i=t?e:a(e,e,r);return{next:()=>{for(;i&&n&&!n(i);)i=a(e,i,r);if(null===i)return{done:!0,value:null};{let t={done:!1,value:i};return i=a(e,i,r),t}}}}}:o()}function c(e,t=!1,r){let n=t?e:e._parent;for(;n&&r&&!r(n);)n=n._parent;return n}function d(e,t,r=!1,n){let i=t._parent;for(;i&&n&&!n(i);)i=i._parent;return i}function p(e){return n.Guard.isDocumentTypeNode(e)?0:n.Guard.isCharacterDataNode(e)?e._data.length:e._children.size}function m(e,t=!1){if(t){let t=m(e,!1);return n.Guard.isShadowRoot(t)?m(t._host,!0):t}return e._parent?m(e._parent):e}function h(e,t,r=!1,i=!1){let a=r?e:i&&n.Guard.isShadowRoot(e)?e._host:e._parent;for(;null!==a;){if(a===t)return!0;a=i&&n.Guard.isShadowRoot(a)?a._host:a._parent}return!1}function f(e){let t=m(e),r=0,n=s(t);for(;null!==n;){if(r++,n===e)return r;n=l(t,n)}return -1}},30075:(e,t,r)=>{"use strict";r.d(t,{A:()=>u});var n=r(21483);let i=[[0,-1,0],[0,1,0],[0,0,-1],[0,0,1]],a=[[0,-1,0],[0,1,0]],o=[[0,-1,0],[0,1,0],[0,0,-1]],s=[[0,-1,0],[0,1,0],[0,0,1]];class l{static copyMap(e,t){for(let[r,i]of t.rows)e.rows.set(r,(0,n.G)(i))}constructor(e,t,r=1){this.rows=new Map,this.height=1,this.width=1,this.depth=1,this.jMultiple=1,this.kMultiple=1,this.numComps=1,this.pixelDataConstructor=Uint8Array,this.updateScalarData=function(e){e.fill(0),this.forEach((t,r,n)=>{let{start:i,end:a,value:o}=r;for(let r=i;r{let t=e%this.jMultiple,r=(e-t)/this.jMultiple,n=this.getRLE(t,r);return n?.value??this.defaultValue},this.getRun=(e,t)=>{let r=e+t*this.height;return this.rows.get(r)},this.set=(e,t)=>{if(void 0===t)return;let r=e%this.width,n=(e-r)/this.width,i=this.rows.get(n);if(!i)return void this.rows.set(n,[{start:r,end:r+1,value:t}]);let a=this.findIndex(i,r),o=i[a],s=i[a-1];if(!o){if(!s||s.value!==t||s.end!==r){i[a]={start:r,end:r+1,value:t};return}s.end++;return}let{start:l,end:u,value:c}=o;if(t===c&&r>=l)return;let d={start:r,end:r+1,value:t},p=r>l,m=p?a+1:a,h=p?o:s,f=p?i[a+1]:o;if(h?.value===t&&h?.end===r){h.end++,f?.value===t&&f.start===r+1?(h.end=f.end,i.splice(a,1)):f?.start===r&&(f.start++,f.start===f.end&&(i.splice(a,1),f=i[a],f?.start===r+1&&f.value===t&&(h.end=f.end,i.splice(a,1))));return}if(f?.value===t&&f.start===r+1){f.start--,h?.end>r&&(h.end=r,h.end===h.start&&i.splice(a,1));return}if(f?.start===r&&f.end===r+1){f.value=t;let e=i[a+1];e?.start==r+1&&e.value===t&&(i.splice(a+1,1),f.end=e.end);return}r===f?.start&&f.start++,p&&u>r+1?i.splice(m,0,d,{start:r+1,end:h.end,value:h.value}):i.splice(m,0,d),h?.end>r&&(h.end=r)},this.width=e,this.height=t,this.depth=r,this.jMultiple=e,this.kMultiple=this.jMultiple*t}toIJK(e){let t=e%this.jMultiple,r=(e-t)/this.jMultiple%this.height;return[t,r,Math.floor(e/this.kMultiple)]}toIndex([e,t,r]){return e+r*this.kMultiple+t*this.jMultiple}getRLE(e,t,r=0){let n=this.rows.get(t+r*this.height);if(!n)return;let i=this.findIndex(n,e),a=n[i];return e>=a?.start?a:void 0}has(e){let t=e%this.jMultiple,r=(e-t)/this.jMultiple,n=this.getRLE(t,r);return n?.value!==void 0}delete(e){let t=e%this.width,r=(e-t)/this.width,n=this.rows.get(r);if(!n)return;let i=this.findIndex(n,t),a=n[i];if(!a||a.start>t)return;if(a.end===t+1){a.end--,a.start>=a.end&&(n.splice(i,1),n.length||this.rows.delete(r));return}if(a.start===t)return void a.start++;let o={value:a.value,start:t+1,end:a.end};a.end=t,n.splice(i+1,0,o)}findIndex(e,t){for(let r=0;re&&e[0].value===t);e.push(...o)}return i}fillFrom(e,t){for(let r=t[2][0];r<=t[2][1];r++)for(let n=t[1][0];n<=t[1][1];n++){let i,a;for(let o=t[0][0];o<=t[0][1];o++){let t=e(o,n,r);if(void 0===t){i=void 0;continue}a||(a=[],this.rows.set(n+r*this.height,a)),i&&i.value!==t&&(i=void 0),i||(i={start:o,end:o,value:t},a.push(i)),i.end++}}}findAdjacents(e,{diagonals:t=!0,planar:r=!0,singlePlane:n=!1}){let[l,u,c,d]=e,{start:p,end:m}=l,h=p>0&&this.getRLE(p-1,u,c),f=m0?p-1:p,m=this.height||m<0||m>=this.depth)continue;let h=this.getRun(p,m);if(h)for(let e of h){let t=d||n&&a||r&&l>0&&s||r&&l<0&&o||i;e.end<=g[0]||e.start>=g[1]||v.push([e,p,m,t])}}return v}}l.getScalarData=function(e=Uint8ClampedArray){let t=new e(this.frameSize);return this.map.updateScalarData(t),t};let u=l},30113:(e,t,r)=>{"use strict";r.d(t,{P:()=>l,g:()=>u}),r(77280);var n=r(85271),i=r(15798),a=r(62705),o=r(74832),s=r(44970);class l{constructor(){this.adapters=new Map}register(e){this.adapters.set(e.id,e)}unregister(e){this.adapters.delete(e)}getAdapter(e,t={}){let r=function(e){let t=e.viewportType??e.viewport?.type;return void 0===t?void 0:String(t)}({...t,viewport:e});for(let e of this.adapters.values())if((!t.kind||e.id===t.kind)&&(!r||e.viewportTypes.some(e=>String(e)===r)))return e}get(e,t={}){let r=this.getAdapter(e,t);return r?.getSnapshot({...t,viewport:e})}getPresentation(e,t={}){let r=this.getAdapter(e,t),n=r?.getSnapshot({...t,viewport:e});if(n)return r.getPresentation(n,t.selector)}withPresentation(e,t,r={},n){let i=this.getAdapter(e,r),a=i?.getSnapshot({...r,viewport:e});if(a)return i.withPresentation(a,t,n)}getRegisteredAdapters(){return Array.from(this.adapters.values())}clear(){this.adapters.clear()}}let u=new l;u.register(n.ZD),u.register(i.m),u.register(a.q),u.register(o.c),u.register(s.Y)},30118:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NamespacePrefixMap=void 0;class r{_items={};_nullItems=[];copy(){let e=new r;for(let t in this._items)e._items[t]=this._items[t].slice(0);return e._nullItems=this._nullItems.slice(0),e}get(e,t){let r=null===t?this._nullItems:this._items[t]||null;if(null===r)return null;let n=null;for(let t=0;t{"use strict";r.d(t,{A:()=>i,Z:()=>n});var n={NO_INTERSECTION:0,YES_INTERSECTION:1,ON_LINE:2},i={IntersectionState:n}},30536:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>c});var n=r(17042),i=r(99298),a=r(11701),o=r(87352),{vtkErrorMacro:s}=n.Ay,l={empty:!0,numberOfComponents:3,dataType:i.JA.FLOAT,bounds:[1,-1,1,-1,1,-1]};function u(e,t,r={}){Object.assign(t,l,r),o.Ay.extend(e,t,r),n.Ay.getArray(e,t,["bounds"],6);let i=0;t.classHierarchy.push("vtkPoints"),e.getNumberOfPoints=e.getNumberOfTuples,e.setNumberOfPoints=(r,i=3)=>{e.getNumberOfPoints()!==r&&(t.size=r*i,t.values=n.Ay.newTypedArray(t.dataType,t.size),e.setNumberOfComponents(i),e.modified())},e.setPoint=(t,...r)=>{e.setTuple(t,r)},e.getPoint=e.getTuple,e.findPoint=e.findTuple,e.insertNextPoint=(t,r,n)=>e.insertNextTuple([t,r,n]),e.insertPoint=(t,r)=>e.insertTuple(t,r);let c=e.getBounds;e.getBounds=()=>(i(i{if(3===e.getNumberOfComponents()){let r=e.getRange(0);t.bounds[0]=r[0],t.bounds[1]=r[1];let n=e.getRange(1);t.bounds[2]=n[0],t.bounds[3]=n[1];let i=e.getRange(2);t.bounds[4]=i[0],t.bounds[5]=i[1]}else if(2===e.getNumberOfComponents()){let r=e.getRange(0);t.bounds[0]=r[0],t.bounds[1]=r[1];let n=e.getRange(1);t.bounds[2]=n[0],t.bounds[3]=n[1],t.bounds[4]=0,t.bounds[5]=0}else s(`getBounds called on an array with components of ${e.getNumberOfComponents()}`),(0,a.pE)(t.bounds);i=n.Ay.getCurrentGlobalMTime()},e.setNumberOfComponents(t.numberOfComponents<2?3:t.numberOfComponents)}var c={newInstance:n.Ay.newInstance(u,"vtkPoints"),extend:u}},30600:(e,t,r)=>{"use strict";r.d(t,{I:()=>i});var n=r(59845);class i{constructor(){this._targetsEventListeners=new Map}addEventListener(e,t,r,i){let a=this._targetsEventListeners.get(e);a||(a=new n.A(e),this._targetsEventListeners.set(e,a)),a.addEventListener(t,r,i)}removeEventListener(e,t,r,n){let i=this._targetsEventListeners.get(e);i&&(i.removeEventListener(t,r,n),i.isEmpty&&this._targetsEventListeners.delete(e))}reset(){Array.from(this._targetsEventListeners.entries()).forEach(([e,t])=>{t.reset(),this._targetsEventListeners.delete(e)})}}},30696:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TextImpl=void 0;let n=r(5309),i=r(4530),a=r(47518),o=r(48040);class s extends i.CharacterDataImpl{_nodeType=n.NodeType.Text;_name="";_assignedSlot=null;constructor(e=""){super(e)}get wholeText(){let e="";for(let t of(0,a.text_contiguousTextNodes)(this,!0))e+=t._data;return e}splitText(e){return(0,a.text_split)(this,e)}get assignedSlot(){throw Error("Mixin: Slotable not implemented.")}static _create(e,t=""){let r=new s(t);return r._nodeDocument=e,r}}t.TextImpl=s,(0,o.idl_defineConst)(s.prototype,"_nodeType",n.NodeType.Text)},30756:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n={vtkObject:()=>null};function i(e){if(null==e||e.isA)return e;if(!e.vtkClass)return globalThis.console&&globalThis.console.error&&globalThis.console.error("Invalid VTK object"),null;let t=n[e.vtkClass];if(!t)return globalThis.console&&globalThis.console.error&&globalThis.console.error(`No vtk class found for Object of type ${e.vtkClass}`),null;let r={...e};Object.keys(r).forEach(e=>{r[e]&&"object"==typeof r[e]&&r[e].vtkClass&&(r[e]=i(r[e]))});let a=t(r);return a&&a.modified&&a.modified(),a}i.register=function(e,t){n[e]=t}},30888:(e,t,r)=>{"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}r.d(t,{A:()=>n})},30983:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(27501);function i(e,t,r){let i,a=(0,n.A)(e,t);if(e[0]===t[0]&&e[1]===t[1]&&(i=e),!i){let n=((r[0]-e[0])*(t[0]-e[0])+(r[1]-e[1])*(t[1]-e[1]))/a;i=n<0?e:n>1?t:[e[0]+n*(t[0]-e[0]),e[1]+n*(t[1]-e[1])]}return{point:[...i],distanceSquared:(0,n.A)(r,i)}}},31167:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(31677);function i(e){let t=(0,n.A)(e);return[0,0,t/Math.abs(t)]}},31226:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(50923),i=r(39216);function a(e,t){let r=(0,i.get)("imagePlaneModule",e);if(!r)throw Error(`No imagePlaneModule found for imageId: ${e}`);let{columnCosines:a,rowCosines:o,imagePositionPatient:s}=r,{columnPixelSpacing:l,rowPixelSpacing:u}=r;l||=1,u||=1;let c=n.vt();return n.Ln(c,s,o,u*(t[0]-.5)),n.Ln(c,c,a,l*(t[1]-.5)),Array.from(c)}},31256:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.get=function(e,t){return e.get(t)},t.set=function(e,t,r){e.set(t,r)},t.remove=function(e,t){if((0,n.isFunction)(t)){let r=[];for(let n of e)t.call(null,n)&&r.push(n[0]);for(let t of r)e.delete(t)}else e.delete(t)},t.contains=function(e,t){if(!(0,n.isFunction)(t))return e.has(t);for(let r of e)if(t.call(null,r))return!0;return!1},t.keys=function(e){return new Set(e.keys())},t.values=function(e){return[...e.values()]},t.size=function(e,t){if(void 0===t)return e.size;{let r=0;for(let n of e)t.call(null,n)&&r++;return r}},t.isEmpty=function(e){return 0===e.size},t.forEach=function*(e,t){if(void 0===t)yield*e;else for(let r of e)t.call(null,r)&&(yield r)},t.clone=function(e){return new Map(e)},t.sortInAscendingOrder=function(e,t){let r=Array(...e);return r.sort((e,r)=>t.call(null,e,r)?-1:1),new Map(r)},t.sortInDescendingOrder=function(e,t){let r=Array(...e);return r.sort((e,r)=>t.call(null,e,r)?1:-1),new Map(r)};let n=r(16950)},31290:(e,t,r)=>{"use strict";function n(e,t,r={}){if(!t)return;let i=e.vtk.renderer.getActiveCamera();void 0!==t.parallelProjection&&i.setParallelProjection(t.parallelProjection),t.viewUp&&i.setViewUp(...t.viewUp),t.viewPlaneNormal&&i.setDirectionOfProjection(-t.viewPlaneNormal[0],-t.viewPlaneNormal[1],-t.viewPlaneNormal[2]),t.position&&i.setPosition(...t.position),t.focalPoint&&i.setFocalPoint(...t.focalPoint),void 0!==t.parallelScale&&i.setParallelScale(t.parallelScale),void 0!==t.viewAngle&&i.setViewAngle(t.viewAngle),void 0!==t.clippingRange?i.setClippingRange(...t.clippingRange):r.resetClippingRange&&e.vtk.renderer.resetCameraClippingRange()}r.d(t,{A:()=>n})},31320:(e,t,r)=>{"use strict";r.d(t,{fX:()=>o,wx:()=>s,BF:()=>l});var n,i,a={};r.r(a),r.d(a,{C:()=>h});var o={};r.r(o),r.d(o,{ov:()=>f,nb:()=>v,Cv:()=>g});var s={};r.r(s),r.d(s,{Zi:()=>A,IU:()=>E,_z:()=>_,Jt:()=>D,YA:()=>O,Y2:()=>R,FE:()=>P,hC:()=>T,SD:()=>w,iw:()=>S,Hw:()=>N,Qy:()=>M});var l={};r.r(l),r.d(l,{VD:()=>W,ZX:()=>j,Hf:()=>$,lJ:()=>G,Cc:()=>z,FM:()=>K,YF:()=>U,AR:()=>B,Qy:()=>ee,Le:()=>L});class u{constructor(e){this.fullDate=e}getTimeInSec(){let e=this.fullDate.substring(0,10),t=this.fullDate.substring(11,28),r=parseInt(e.substring(0,4),10),n=e.length>=7?parseInt(e.substring(5,7),10):void 0,i=e.length>=10?parseInt(e.substring(8,10),10):void 0;if(isNaN(r)||void 0!==n&&isNaN(n)||void 0!==i&&isNaN(i)||r>3e3||n&&(n<1||n>12)||i&&(i<1||i>31))throw Error(`invalid date '${e}'`);let a=new Date(`${e}T00:00:00.000000Z`),o=parseInt(t.substring(0,2),10),s=t.length>=5?parseInt(t.substring(3,5),10):void 0,l=t.length>=8?parseInt(t.substring(6,8),10):void 0,u=t.substring(9,15),c=u?parseInt(u,10)*Math.pow(10,-u.length):void 0;if(isNaN(o)||void 0!==s&&isNaN(s)||void 0!==l&&isNaN(l)||void 0!==c&&isNaN(c)||o<0||o>23||s&&(s<0||s>59)||l&&(l<0||l>59)||c&&(c<0||c>999999))throw Error(`invalid time '${t}'`);let d=a.getTime()/1e3;return d+=3600*o,void 0!==s&&(d+=60*s),void 0!==l&&(d+=l),void 0!==c&&(d+=c),d}getTimeInMicroSec(){return 1e6*this.getTimeInSec()}}function c(e,t){let r=`${t.hours||"00"}`.padStart(2,"0"),n=`${t.minutes||"00"}`.padStart(2,"0"),i=`${t.seconds||"00"}`.padStart(2,"0"),a=`${e.month}`.padStart(2,"0"),o=`${e.day}`.padStart(2,"0"),s=`${t.fractionalSeconds||"000000"}`.padEnd(6,"0"),l=`${e.year}-${a}-${o}`,c=`T${r}:${n}:${i}.${s}Z`;return new u(`${l}${c}`)}function d(e){if(null==e||8!==e.length||"string"!=typeof e)throw Error(`invalid DA '${e}'`);let t=parseInt(e.substring(0,4),10),r=parseInt(e.substring(4,6),10),n=parseInt(e.substring(6,8),10);if(!0!=(!isNaN(t)&&r>0&&r<=12&&n>0&&n<=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}}(r,t)))throw Error(`invalid DA '${e}'`);return{year:t,month:r,day:n}}function p(e){if(null==e||e.length<2||"string"!=typeof e)throw Error(`invalid TM '${e}'`);let t=parseInt(e.substring(0,2),10),r=e.length>=4?parseInt(e.substring(2,4),10):void 0,n=e.length>=6?parseInt(e.substring(4,6),10):void 0,i=e.length>=8?e.substring(7,13):void 0,a=i?parseInt(i,10)*Math.pow(10,6-i.length):void 0;if(isNaN(t)||void 0!==r&&isNaN(r)||void 0!==n&&isNaN(n)||void 0!==a&&isNaN(a)||t<0||t>23||r&&(r<0||r>59)||n&&(n<0||n>59)||a&&(a<0||a>999999))throw Error(`invalid TM '${e}'`);return{hours:t,minutes:r,seconds:n,fractionalSeconds:a}}function m(e){if(null==e)throw Error("dateTimeToFullDateInterface : dateTime not defined.");return c(d(e.substring(0,8)),p(e.substring(8)))}function h(e){let t,r,{CorrectedImage:n,Units:i,PhilipsPETPrivateGroup:a,PatientWeight:o,PatientSex:s,PatientSize:l}=e[0];if(!n.includes("ATTN")||!n.includes("DECY"))throw Error(`CorrectedImage must contain "ATTN" and "DECY": ${n}`);if(!e.every(t=>{let r;return t.Units===i&&((r=t.CorrectedImage)===n||Array.isArray(r)&&Array.isArray(n)&&r.length===n.length&&r.every((e,t)=>e===n[t]))&&t.PatientWeight===o&&t.PatientSex===s&&t.PatientSize===l&&t.RadionuclideHalfLife===e[0].RadionuclideHalfLife&&t.RadionuclideTotalDose===e[0].RadionuclideTotalDose&&t.DecayCorrection===e[0].DecayCorrection&&t.SeriesDate===e[0].SeriesDate&&t.SeriesTime===e[0].SeriesTime}))throw Error("The set of instances does not appear to come from one Series. Every instance must have identical values for series-level metadata properties");if(null==o)throw Error("PatientWeight value is missing. It is not possible to calculate the SUV factors");let h=Array(e.length);h=function(e){let{RadionuclideTotalDose:t,RadionuclideHalfLife:r,RadiopharmaceuticalStartDateTime:n,RadiopharmaceuticalStartTime:i,SeriesDate:a}=e[0];if(null==t)throw Error("calculateDecayCorrection : RadionuclideTotalDose value not found.");if(null==r)throw Error("calculateDecayCorrection : RadionuclideHalfLife value not found.");let o=function(e){let{SeriesDate:t,SeriesTime:r,GEPrivatePostInjectionDateTime:n}=e[0],i=Array(e.length),a=c(d(t),p(r)),o=new u("3000-01-01T00:00:00.000000Z"),s=o.getTimeInSec();if(e.forEach(e=>{let{AcquisitionDate:t,AcquisitionTime:r}=e,n=c(d(t),p(r));o=o.getTimeInSec()>=s||n.getTimeInSec()=s)throw Error("Earliest acquisition time or date could not be parsed.");return a.getTimeInSec()<=o.getTimeInSec()?i.fill(a):n?i.fill(m(n)):i.fill(o)}(e),s=function(e){let t,{RadiopharmaceuticalStartDateTime:r,RadiopharmaceuticalStartTime:n,SeriesDate:i}=e;if(r)return m(r);if(n&&i)return t=p(n),c(d(i),t);throw Error(`Invalid input: ${e}`)}({RadiopharmaceuticalStartDateTime:n,RadiopharmaceuticalStartTime:i,SeriesDate:a});return e.map((e,n)=>{let i=o[n].getTimeInSec()-s.getTimeInSec();if(i<0)throw Error("Decay time cannot be less than zero");return 1/(t*Math.pow(2,-i/r))})}(e);let f=Array(e.length),g=1e3*o;if("BQML"===i)f=h.map(function(e){return e*g});else if("CNTS"===i){let t=e.every(e=>{var t,r,n;return e.PhilipsPETPrivateGroup&&(null==(t=e.PhilipsPETPrivateGroup)?void 0:t.SUVScaleFactor)!==null&&(null==(r=e.PhilipsPETPrivateGroup)?void 0:r.SUVScaleFactor)!==void 0&&(null==(n=e.PhilipsPETPrivateGroup)?void 0:n.SUVScaleFactor)!==0}),r=e.every(e=>{var t,r,n;return e.PhilipsPETPrivateGroup&&!(null!=(t=e.PhilipsPETPrivateGroup)&&t.SUVScaleFactor)&&(null==(r=e.PhilipsPETPrivateGroup)?void 0:r.ActivityConcentrationScaleFactor)!==void 0&&(null==(n=e.PhilipsPETPrivateGroup)?void 0:n.ActivityConcentrationScaleFactor)!==0});if(t)f=e.map(e=>e.PhilipsPETPrivateGroup.SUVScaleFactor);else if(r)f=e.map((e,t)=>e.PhilipsPETPrivateGroup.ActivityConcentrationScaleFactor*h[t]*g);else throw Error(`Units are in CNTS, but PhilipsPETPrivateGroup has invalid values: ${JSON.stringify(a)}`)}else if("GML"===i)f.fill(1);else throw Error(`Units has an invalid value: ${i}`);return null==l?console.warn("PatientSize value is missing. It is not possible to calculate the SUV bsa factors"):t=function(e){let{PatientWeight:t,PatientSize:r}=e;return Math.pow(t,.425)*Math.pow(100*r,.725)*71.84}({PatientWeight:o,PatientSize:l}),null==l?console.warn("PatientSize value is missing. It is not possible to calculate the SUV lbm factors"):null==s?console.warn("PatientSex value is missing. It is not possible to calculate the SUV lbm factors"):r=function(e){let t,{PatientSex:r,PatientWeight:n,PatientSize:i}=e,a=n*n/(i*i*1e4);if("F"===r)t=1.07*n-148*a;else if("M"===r)t=1.1*n-120*a;else throw Error(`PatientSex is an invalid value: ${r}`);return 1e3*t}({PatientWeight:o,PatientSex:s,PatientSize:l}),f.map(function(e,n){let i={suvbw:e};return t&&(i.suvbsa=h[n]*t),r&&(i.suvlbm=h[n]*r),i})}!function(e){e.NOT_APPLICABLE="",e.ERMF="ERMF",e.USER="User",e.PROJECTION="Proj",e.REGION="Region",e.ERROR="Error",e.UNCALIBRATED="Uncalibrated",e.CALIBRATED="Calibrated",e.UNKNOWN="Unknown"}(n||(n={}));let f=n;function g(e){return`${e}Add`}!function(e){e.CALIBRATION="calibrationModule",e.CINE="cineModule",e.FRAME_OF_REFERENCE="frameOfReferenceModule",e.GENERAL_IMAGE="generalImageModule",e.GENERAL_SERIES="generalSeriesModule",e.GENERAL_STUDY="generalStudyModule",e.IMAGE_PIXEL="imagePixelModule",e.IMAGE_PLANE="imagePlaneModule",e.IMAGE_URL="imageUrlModule",e.MODALITY_LUT="modalityLutModule",e.MULTIFRAME="multiframeModule",e.NM_MULTIFRAME_GEOMETRY="nmMultiframeGeometryModule",e.OVERLAY_PLANE="overlayPlaneModule",e.PATIENT="patientModule",e.PATIENT_DEMOGRAPHIC="patientDemographicModule",e.PATIENT_STUDY="patientStudyModule",e.PET_IMAGE="petImageModule",e.PET_ISOTOPE="petIsotopeModule",e.PET_SERIES="petSeriesModule",e.SCALING="scalingModule",e.SOP_COMMON="sopCommonModule",e.ULTRASOUND_ENHANCED_REGION="ultrasoundEnhancedRegionModule",e.ECG="ecgModule",e.VOI_LUT="voiLutModule",e.TRANSFER_SYNTAX="transferSyntax",e.PLANE_ORIENTATION="PlaneOrientation",e.PLANE_POSITION="PlanePosition",e.PIXEL_MEASURES="PixelMeasures",e.XRAY_GEOMETRY="XrayGeometry",e.FRAME_PIXEL_DATA="FramePixelData",e.FRAME_MODULE="frameModule",e.URI_MODULE="uriModule",e.WADO_WEB_CLIENT="wadoWebClient",e.INSTANCE="instance",e.IMAGE_SOP_INSTANCE_REFERENCE="ImageSopInstanceReference",e.REFERENCED_SERIES_REFERENCE="ReferencedSeriesReference",e.PREDECESSOR_SEQUENCE="PredecessorSequence",e.STUDY_DATA="StudyData",e.SERIES_DATA="SeriesData",e.IMAGE_DATA="ImageData",e.RTSS_INSTANCE_DATA="RtssInstanceData",e.NEW_INSTANCE_DATA="NewInstanceData",e.RTSS_CONTOUR="metaRTSSContour",e.SEG_BIT="metaSegBitmap",e.SR_ANNOTATION="metaSrAnnotation",e.COMPRESSED_FRAME_DATA="compressedFrameData",e.BASE_IMAGE_ID="baseImageId",e.FRAME_IMAGE_IDS="frameImageIds",e.NATURALIZED="naturalized",e.DISPLAY_SET="displaySetModule"}(i||(i={}));let v=i;var y=r(66122);let b={IMPLICIT_VR_LITTLE_ENDIAN:y.AA.IMPLICIT_LITTLE_ENDIAN,EXPLICIT_VR_LITTLE_ENDIAN:y.AA.EXPLICIT_LITTLE_ENDIAN,DEFLATED_EXPLICIT_VR_LITTLE_ENDIAN:y.AA.DEFLATED_EXPLICIT_LITTLE_ENDIAN,EXPLICIT_VR_BIG_ENDIAN:y.AA.EXPLICIT_BIG_ENDIAN,RLE_LOSSLESS:"1.2.840.10008.1.2.5",MPEG2_MAIN_PROFILE_MAIN_LEVEL:"1.2.840.10008.1.2.4.100",MPEG2_MAIN_PROFILE_MAIN_LEVEL_FRAGMENTABLE:"1.2.840.10008.1.2.4.100.1",MPEG2_MAIN_PROFILE_HIGH_LEVEL:"1.2.840.10008.1.2.4.101",MPEG2_MAIN_PROFILE_HIGH_LEVEL_FRAGMENTABLE:"1.2.840.10008.1.2.4.101.1",MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_1:"1.2.840.10008.1.2.4.102",MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_1_FRAGMENTABLE:"1.2.840.10008.1.2.4.102.1",MPEG4_AVC_H264_BD_COMPATIBLE_HIGH_PROFILE_LEVEL_4_1:"1.2.840.10008.1.2.4.103",MPEG4_AVC_H264_BD_COMPATIBLE_HIGH_PROFILE_LEVEL_4_1_FRAGMENTABLE:"1.2.840.10008.1.2.4.103.1",MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_2D_VIDEO:"1.2.840.10008.1.2.4.104",MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_2D_VIDEO_FRAGMENTABLE:"1.2.840.10008.1.2.4.104.1",MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_3D_VIDEO:"1.2.840.10008.1.2.4.105",MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_3D_VIDEO_FRAGMENTABLE:"1.2.840.10008.1.2.4.105.1",MPEG4_AVC_H264_STEREO_HIGH_PROFILE_LEVEL_4_2:"1.2.840.10008.1.2.4.106",MPEG4_AVC_H264_STEREO_HIGH_PROFILE_LEVEL_4_2_FRAGMENTABLE:"1.2.840.10008.1.2.4.106.1",HEVC_H265_MAIN_PROFILE_LEVEL_5_1:"1.2.840.10008.1.2.4.107",HEVC_H265_MAIN_10_PROFILE_LEVEL_5_1:"1.2.840.10008.1.2.4.108"},I=[],x=new Map,C=new Map;function A(e,t=0){let r;if(!I.some(t=>t.provider===e)){for(r=0;r0;)I.pop();x.clear(),C.clear()}function O(e,t,r){if(void 0!==t)for(let n=0;n{for(let r of[e,g(e)]){let e=x.get(r);if(e)for(let r of e)r?.clearQuery?.(t)}},E=e=>{for(let t of Array.from(new Set([e,g(e)]))){let e=x.get(t);if(e)for(let t of e)t?.clear?.()}},D=(e,...t)=>1===t.length?O(e,t[0]):t.map(t=>t&&O(e,t)).find(e=>void 0!==e);function R(e,t,r=O){let n={};for(let i of t)try{let t=r(i,e);if(t){let e={};for(let r in t)r in t&&(e[M(r)]=t[r]);Object.assign(n,e)}}catch(e){console.error(`Error retrieving ${i} data:`,e)}return n}let M=e=>e.startsWith("sop")?`SOP${e.substring(3)}`:e.startsWith("voi")?`VOI${e.substring(3)}`:(e.endsWith("Id")&&(e=`${e.substring(0,e.length-2)}ID`),e.charAt(0).toUpperCase()+e.slice(1)),N=e=>e.startsWith("SOP")?`sop${e.substring(3)}`:e.startsWith("VOI")?`voi${e.substring(3)}`:(e.endsWith("ID")&&!e.endsWith("UID")&&(e=`${e.substring(0,e.length-2)}Id`),e.charAt(0).toLowerCase()+e.slice(1));var V=r(82280);let L=new Set([b.MPEG2_MAIN_PROFILE_MAIN_LEVEL,b.MPEG2_MAIN_PROFILE_MAIN_LEVEL_FRAGMENTABLE,b.MPEG2_MAIN_PROFILE_HIGH_LEVEL,b.MPEG2_MAIN_PROFILE_HIGH_LEVEL_FRAGMENTABLE,b.MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_1,b.MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_1_FRAGMENTABLE,b.MPEG4_AVC_H264_BD_COMPATIBLE_HIGH_PROFILE_LEVEL_4_1,b.MPEG4_AVC_H264_BD_COMPATIBLE_HIGH_PROFILE_LEVEL_4_1_FRAGMENTABLE,b.MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_2D_VIDEO,b.MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_2D_VIDEO_FRAGMENTABLE,b.MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_3D_VIDEO,b.MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_3D_VIDEO_FRAGMENTABLE,b.MPEG4_AVC_H264_STEREO_HIGH_PROFILE_LEVEL_4_2,b.MPEG4_AVC_H264_STEREO_HIGH_PROFILE_LEVEL_4_2_FRAGMENTABLE,b.HEVC_H265_MAIN_PROFILE_LEVEL_5_1,b.HEVC_H265_MAIN_10_PROFILE_LEVEL_5_1]);function B(e){return!!e&&(Array.isArray(e)?e:[e]).find(e=>L.has(e))}let F=/^[a-zA-Z]+:/;function U(e){if(!e)return"";let t=e.match(F);if(!t)return e;let r=e.substring(t[0].length);return F.test(r)?r:e}let k=new Set(["1.2.840.10008.5.1.4.1.1.1","1.2.840.10008.5.1.4.1.1.1.1","1.2.840.10008.5.1.4.1.1.1.1.1","1.2.840.10008.5.1.4.1.1.1.2","1.2.840.10008.5.1.4.1.1.1.2.1","1.2.840.10008.5.1.4.1.1.1.3","1.2.840.10008.5.1.4.1.1.1.3.1","1.2.840.10008.5.1.4.1.1.12.1","1.2.840.10008.5.1.4.1.1.12.1.1","1.2.840.10008.5.1.4.1.1.12.2","1.2.840.10008.5.1.4.1.1.12.2.1","1.2.840.10008.5.1.4.1.1.12.3"]);function G(e){let{PixelSpacing:t,ImagerPixelSpacing:r,EstimatedRadiographicMagnificationFactor:n,DistanceSourceToDetector:i,DistanceSourceToEntrance:a,DistanceSourceToPatient:o=a}=e;return n>1?n:ot?.[0]||void 0}function W(e){let{PixelSpacing:t,ImagerPixelSpacing:r,PixelSpacingCalibrationType:n}=e;if(t&&"GEOMETRY"===n)return(0,V.n4)(t,r)&&console.warn("Calibration type is geometry, but pixel spacing and imager pixel spacing identical",t,r),{PixelSpacing:t,type:f.ERMF,isProjection:!0};if(t&&"FIDUCIAL"===n)return{PixelSpacing:t,type:f.CALIBRATED,isProjection:!0};if(r){let n=G(e);return n>1?{PixelSpacing:r.map(e=>e/n),type:f.ERMF,isProjection:!0}:!0===n?{PixelSpacing:t,type:f.ERMF,isProjection:!0}:(n&&console.error("Illegal ERMF value:",n),{PixelSpacing:t||r,type:f.PROJECTION,isProjection:!0})}return{PixelSpacing:t,type:f.UNKNOWN,isProjection:!0}}function z(e){let{PixelSpacing:t,SOPClassUID:r}=e;return k.has(r)?W(e):{PixelSpacing:t,type:f.NOT_APPLICABLE,isProjection:!1}}let H=new Map,j={add:(e,t)=>{let r=U(e);H.set(r,t),_(v.IMAGE_PLANE,e)},get:(e,t)=>{if("calibratedPixelSpacing"===e){let e=U(t);return H.get(e)}},clear:()=>{H.clear()}};function $(e,t){let r=/\/frames\/\d+/,n=/([?&])frame=\d+/;if(r.test(e))return e.replace(r,`/frames/${t}`);if(n.test(e))return e.replace(n,(e,r)=>`${r}frame=${t}`);let i=e.includes("?")?"&":"?";return`${e}${i}frame=${t}`}function K(e){if(!e||0===e.length)return null;let t=e[0],r=D("instance",t);if(!r)return null;let n=r.NumberOfFrames;if(!n||n<=1)return null;let i=r.TimeSlotVector;if(!i||!Array.isArray(i))return null;let a=r.SliceVector,o=r.NumberOfSlices;if(i.length!==n)return console.warn("TimeSlotVector length does not match NumberOfFrames:",i.length,"vs",n),null;if(a){if(!Array.isArray(a))return console.warn("SliceVector exists but is not an array. Expected length:",n),null;if(a.length!==n||a.some(e=>void 0===e))return console.warn("SliceVector exists but has invalid length or undefined entries. Expected length:",n,"Actual length:",a.length),null}let s=new Map;for(let e=0;ee-t).map(e=>{let r=s.get(e);return r.sort((e,t)=>e.sliceIndex-t.sliceIndex),r.map(e=>$(t,e.frameIndex+1))}),u=o||l[0]?.length;return l.every(e=>e.length===u)||console.warn("Multiframe 4D split resulted in uneven time slot groups. Expected",u,"slices per time slot."),{imageIdGroups:l,splittingTag:"TimeSlotVector"}}function q(e,t){let r=D(t,e);try{return parseFloat(r)}catch{return}}function X(e,t){return(0,V.IQ)(q(e,t))}function Y(e){let t=D("20011003",e);try{let{InlineBinary:e}=t;if(e){let t=atob(e),r=new ArrayBuffer(t.length),n=new DataView(r);for(let e=0;eNumber(e)-Number(t));if(0===n.length)return null;let i=[];for(let e of n){let n=r.get(e),a=Array.from(n.keys()).sort((e,t)=>e-t);for(let e of a){let r=n.get(e);if(r.sort((e,t)=>e.triggerTime-t.triggerTime),void 0===t)t=r.length;else if(r.length!==t)return null}i.push({stackId:e,positions:a,framesByPosition:n})}if(!t)return null;let a=[];for(let e=0;e{let{imagePositionPatient:t}=D("imagePlaneModule",e)||{};return{imageId:e,imagePositionPatient:t}});if(!r.every(e=>e.imagePositionPatient))return null;let n=(t="imagePositionPatient",r.reduce((e,r)=>((e[r[t]]=e[r[t]]||[]).push(r),e),{})),i=Object.keys(n),a=n[i[0]].length;return 1!==a&&i.every(e=>n[e].length===a)?n:null}(e);if(!n)return{imageIdGroups:[e],splittingTag:null};let i=["TemporalPositionIdentifier","DiffusionBValue","TriggerTime","EchoTime","EchoNumber","PhilipsPrivateBValue","SiemensPrivateBValue","GEPrivateBValue","PetFrameReferenceTime"],a=[e=>q(e,i[0]),e=>q(e,i[1]),e=>q(e,i[2]),e=>q(e,i[3]),e=>q(e,i[4]),Y,Z,J,Q];for(let e=0;ee-t).map(e=>t[e].map(e=>e.imageId)),splittingTag:i[e]}}return{imageIdGroups:[e],splittingTag:null}},et=[[v.TRANSFER_SYNTAX,["TransferSyntaxUID","AvailableTransferSyntaxUID"]],[v.CINE,["FrameTime","RecommendedDisplayFrameRate"]],[v.PET_ISOTOPE,[["RadiopharmaceuticalInfo","00540016"]]],["RadiopharmaceuticalInfo",["RadiopharmaceuticalStartTime","RadiopharmaceuticalStopTime","RadionuclideTotalDose","RadionuclideHalfLife"]],[v.PET_IMAGE,["FrameReferenceTime","ActualFrameDuration"]],[v.PET_SERIES,["CorrectedImage","Units","DecayCorrection"]],[v.PATIENT,["PatientID","PatientName","PatientBirthDate","PatientBirthTime"]],[v.PATIENT_STUDY,["PatientAge","PatientSize","PatientSex","PatientWeight"]],[v.GENERAL_STUDY,["StudyInstanceUID","StudyDescription","StudyDate","StudyTime","AccessionNumber"]],[v.GENERAL_SERIES,["StudyInstanceUID","SeriesInstanceUID","Modality","SeriesDescription","SeriesNumber","SeriesDate","SeriesTime","AcquisitionDate","AcquisitionTime"]],["clinicalTrialModule",["ClinicalTrialSponsorName","ClinicalTrialSiteID","ClinicalTrialSiteName","ClinicalTrialSubjectID"]],[v.SOP_COMMON,["SOPInstanceUID","SOPClassUID"]],[v.ECG,["StudyInstanceUID","SeriesInstanceUID","SeriesDescription","SeriesNumber","SeriesDate","SeriesTime","Modality","SOPInstanceUID","SOPClassUID"]],[v.GENERAL_IMAGE,["SOPInstanceUID","SOPClassUID","InstanceNumber","InstanceCreationDate","InstanceCreationTime","ContentTime","LossyImageCompression","LossyImageCompressionRatio","LossyImageCompressionMethod","FrameOfReferenceUID","NumberOfFrames","PixelSpacing"]],[v.IMAGE_PLANE,["ImagerPixelSpacing","ImageOrientationPatient","ImagePositionPatient","SpacingBetweenSlices","SliceThickness","SliceLocation"]],[v.IMAGE_PIXEL,["SamplesPerPixel","PhotometricInterpretation","PlanarConfiguration","Rows","Columns","BitsAllocated","BitsStored","HighBit","PixelRepresentation",["SmallestPixelValue","00280106"],["LargestPixelValue","00280107"],"PixelPaddingValue","PixelPaddingRangeLimit","RedPaletteColorLookupTableDescriptor","GreenPaletteColorLookupTableDescriptor","BluePaletteColorLookupTableDescriptor","AlphaPaletteColorLookupTableDescriptor","RedPaletteColorLookupTableData","GreenPaletteColorLookupTableData","BluePaletteColorLookupTableData","AlphaPaletteColorLookupTableData","PaletteColorLookupTableUID","DistanceSourceToDetector","DistanceSourceToPatient","EstimatedRadiographicMagnificationFactor","DistanceSourceToEntrance","PixelSpacingCalibrationType","PixelSpacingCalibrationDescription","SequenceOfUltrasoundRegions"]],[v.VOI_LUT,["WindowCenter","WindowWidth","VOILUTFunction","WindowCenterWidthExplanation"]],[v.MODALITY_LUT,["RescaleIntercept","RescaleSlope","RescaleType"]],[v.ULTRASOUND_ENHANCED_REGION,["SequenceOfUltrasoundRegions"]],["usRegionChild",["PhysicalDeltaX","PhysicalDeltaY","PhysicalUnitsXDirection","PhysicalUnitsYDirection","RegionLocationMinY0","RegionLocationMaxY1","RegionLocationMinX0","RegionLocationMaxX1","ReferencePixelX0","ReferencePixelY0",["ReferencePhysicalPixelValueY","0018602A"],["ReferencePhysicalPixelValueX","00186028"],"RegionSpatialFormat","RegionDataType","RegionFlags","TransducerFrequency"]],[null,["ReferencedImageSequence","ReferencedSOPClassUID","ReferencedSOPInstanceUID","ReferencedFrameNumber","SharedFunctionalGroupsSequence","PerFrameFunctionalGroupsSequence","PlanePositionSequence","AnatomicRegionSequence","PlaneOrientationSequence","PixelMeasuresSequence","PixelValueTransformationSequence","ParametricMapFrameTypeSequence","RealWorldValueMappingSequence"]]],er=y.Ay.data.DicomMetaDictionary.dictionary,en=y.Ay.data.DicomMetaDictionary.nameMap,ei=new Map,ea=new Map,eo={},es=new Map;for(let[e,t]of et)for(let r of t){let t="string"==typeof r?r:r[0],n="string"==typeof r?void 0:r[1],i=es.get(t);i||(i={hex:n??function(e){let t=en[e];if(t)return t.tag.substring(1,5)+t.tag.substring(6,10)}(t),groups:[]},es.set(t,i)),null!==e&&i.groups.push(e)}for(let[e,{hex:t,groups:r}]of es){if(!t){console.warn(`Tags: keyword "${e}" not found in dcmjs nameMap`);continue}!function(e,t){if(e&&t.name&&e!==t.name)throw Error(`Tag name provided and value don't match: ${e} !== ${t.name}`);t.name||=e,t.lowerName||=N(e),eo[e]=t;let{tag:r}=t;t.primaryGroup||=t.groups?.[0];let{groups:n}=t;if(ea.set(e,t),r&&(t.xTag=`x${r.toLowerCase()}`,t.tag=r.toUpperCase(),ea.set(t.xTag,t),ea.set(t.tag,t),!t.vr)){let e=er[t.tag];e&&(t.vr=e.vr,t.vm=function(e){if(null==e)return null;if("number"==typeof e)return e;let t=parseInt(e,10);return String(t)===e?t:0}(e.vm))}if(n?.length)for(let r of n){let n=ei.get(r);if(!n){n=[t],ei.set(r,n);return}let i=n.findIndex(t=>t.name===e);-1===i?n.push(t):n[i]=t}}(e,function(e,...t){return{tag:e,groups:t,xTag:null,primaryGroup:null,name:null,lowerName:null,vr:null,vm:null}}(t,...r))}let{DicomMetadataListener:el}=y.Ay.utilities,{pp:eu,tZ:ec,gE:ed,Um:ep,uu:em,UA:eh,_E:ef,RZ:eg,UX:ev,bM:ey,HL:eb,U5:eI,Rm:ex}=V.m9,eC=v.FRAME_IMAGE_IDS,eA=v.BASE_IMAGE_ID;class eT{static setCacheDataInternal(e,t,r){let n=this.mapCacheData.get(e);n||(n=new Map,this.mapCacheData.set(e,n)),n.set(t,r),this.clearRelatedDerivedCache(e,t)}static clearRelatedDerivedCache(e,t){var r;let n=this.secondaryTypesByBaseType.get(e);if(null==n?void 0:n.size)for(let e of null!=(r=O(eC,t))?r:new Set([t]))for(let t of n){let r=this.mapCacheData.get(t);null==r||r.delete(e)}}static registerSecondaryTypes(e,t){if(t)for(let r of Array.isArray(t)?t:[t]){let t=this.secondaryTypesByBaseType.get(r);t||(t=new Set,this.secondaryTypesByBaseType.set(r,t)),t.add(e)}}static getCacheData(e,t){var r;return null==(r=this.mapCacheData.get(e))?void 0:r.get(t)}static hasCacheData(e,t){var r;return(null==(r=this.mapCacheData.get(e))?void 0:r.has(t))===!0}static clearCacheData(){this.mapCacheData.clear(),this.secondaryTypesByBaseType.clear(),E(eC),E(eA)}static clearTypedCacheData(e,t){var r,n;let i=this.secondaryTypesByBaseType.get(e),a=this.mapCacheData.get(e);if(t){if(null==a||a.delete(t),null==i?void 0:i.size)for(let e of i)null==(r=this.mapCacheData.get(e))||r.delete(t);(e===v.NATURALIZED||(null==i?void 0:i.size))&&(_(eC,t),_(eA,t));return}if(null==a||a.clear(),null==i?void 0:i.size)for(let e of i)null==(n=this.mapCacheData.get(e))||n.clear();(e===v.NATURALIZED||(null==i?void 0:i.size))&&(E(eC),E(eA))}static fromAsyncLookup(e,t,r,n){if((null==n?void 0:n.noCache)!==!0&&(null==n?void 0:n.reCache)!==!0){let r=this.getCacheData(e,t);if(void 0!==r)return r}let i=r();if(void 0!==i)return i instanceof Promise?i.then(r=>(void 0===r||(null==n?void 0:n.noCache)||this.setCacheDataInternal(e,t,r),r)):((null==n?void 0:n.noCache)||this.setCacheDataInternal(e,t,i),i)}createTypeCacheProvider(e){var t;return t=e,(e,r,n,i)=>eT.fromAsyncLookup(t,r,()=>e(r,n,i),i)}clearCacheData(){eT.clearCacheData()}clearTypedCacheData(e,t){eT.clearTypedCacheData(e,t)}getCacheData(e,t){return eT.getCacheData(e,t)}hasCacheData(e,t){return eT.hasCacheData(e,t)}fromAsyncLookup(e,t,r,n){return eT.fromAsyncLookup(e,t,r,n)}}eT.mapCacheData=new Map,eT.secondaryTypesByBaseType=new Map;class eS extends eT{static setCacheData(e,t,r){this.setCacheDataInternal(e,t,r)}setCacheData(e,t,r){eS.setCacheData(e,t,r)}}function ew(e){return(t,r,n,i)=>(n||=T(e,r,i?.[e]),t(r,n,i))}new eS,ew(v.INSTANCE),ew(v.NATURALIZED);let{AsyncDicomReader:eO}=y.Ay.async;ep.getLogger("tagModules"),v.COMPRESSED_FRAME_DATA;let{C:eP}=a},31377:(e,t,r)=>{"use strict";r(77280),r(3922),r(33174),r(63001).A},31620:()=>{"use strict";var e;!function(e){e.CLOSED_PLANAR="CLOSED_PLANAR",e.OPEN_PLANAR="OPEN_PLANAR"}(e||(e={}))},31665:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(23230);let i=async function(e,t,r,i=!1,a=!1){let o=r.map(t=>{let r=e.getViewport(t);if(!r)throw Error(`Viewport with Id ${t} does not exist`);if(!(0,n.A)(r))throw Error("setVolumesForViewports only supports viewports that implement setVolumes");return r});await Promise.all(o.map(e=>e.setVolumes(t,i,a)))}},31677:(e,t,r)=>{"use strict";function n(e){if(e.length<3)return 0;let t=e[0],r=0;for(let n=0,i=e.length;nn})},31727:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>L});var n=r(17042),i=r(11701),a=r(21122),o=r(34967),s=r(70125),l=r(57236);r(10463);var u=r(67127),c=r(12412),d=r(72188),p=r(56929),m=r(61052),h=r(9731),f=r(86077),g=r(32037),v=r(28245),y=r(89988),b=r(85250),I=r(50923),x=r(37843),{FieldAssociations:C}=a.Ay,{primTypes:A}=f.Ay,{Representation:T,Shading:S}=s.Ay,{ScalarMode:w}=c.Ay,{Filter:O,Wrap:P}=m.Ay,{vtkErrorMacro:_}=n.o$,E={type:"StartEvent"},D={type:"EndEvent"},{CoordinateSystem:R}=o.Ay,M={context:null,VBOBuildTime:0,VBOBuildString:null,primitives:null,primTypes:null,shaderRebuildString:null,tmpMat4:null,ambientColor:[],diffuseColor:[],specularColor:[],lightColor:[],lightDirection:[],lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastSelectionState:u.T.MIN_KNOWN_PASS-1,selectionStateChanged:null,selectionWebGLIdsToVTKIds:null,pointPicking:!1};function N(e,t,r={}){Object.assign(t,M,r),d.A.extend(e,t,r),y.A.implementReplaceShaderCoincidentOffset(e,t,r),y.A.implementBuildShadersWithReplacements(e,t,r),t.primitives=[],t.primTypes=A,t.tmpMat3=x.identity(new Float64Array(9)),t.tmpMat4=b.identity(new Float64Array(16));for(let e=A.Start;e0===n?r?t.copy(e,r):t.identity(e):r?t.multiply(e,e,r):e,r)}t.classHierarchy.push("vtkOpenGLPolyDataMapper"),e.buildPass=r=>{r&&(t.currentRenderPass=null,t.openGLActor=e.getFirstAncestorOfType("vtkOpenGLActor"),t._openGLRenderer=t.openGLActor.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getLastAncestorOfType("vtkOpenGLRenderWindow"),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera(),t.openGLCamera))},e.translucentPass=(r,n)=>{r&&(t.currentRenderPass=n,e.render())},e.zBufferPass=r=>{r&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.render=()=>{let r=t._openGLRenderWindow.getContext();if(t.context!==r){t.context=r;for(let e=A.Start;e{e.Vertex=g.A,e.Fragment=v.A,e.Geometry=""},e.replaceShaderColor=(e,r,n)=>{let i=e.Vertex,a=e.Geometry,o=e.Fragment,s=t.lastBoundBO.getReferenceByName("lastLightComplexity"),l=["uniform float ambient;","uniform float diffuse;","uniform float specular;","uniform float opacityUniform; // the fragment opacity","uniform vec3 ambientColorUniform;","uniform vec3 diffuseColorUniform;"];s&&(l=l.concat(["uniform vec3 specularColorUniform;","uniform float specularPowerUniform;"]));let u=["vec3 ambientColor;"," vec3 diffuseColor;"," float opacity;"];s&&(u=u.concat([" vec3 specularColor;"," float specularPower;"])),u=u.concat([" ambientColor = ambientColorUniform;"," diffuseColor = diffuseColorUniform;"," opacity = opacityUniform;"]),s&&(u=u.concat([" specularColor = specularColorUniform;"," specularPower = specularPowerUniform;"])),0===t.lastBoundBO.getCABO().getColorComponents()||t.drawingEdges||(l=l.concat(["varying vec4 vertexColorVSOutput;"]),i=h.A.substitute(i,"//VTK::Color::Dec",["attribute vec4 scalarColor;","varying vec4 vertexColorVSOutput;"]).result,i=h.A.substitute(i,"//VTK::Color::Impl",["vertexColorVSOutput = scalarColor;"]).result,a=h.A.substitute(a,"//VTK::Color::Dec",["in vec4 vertexColorVSOutput[];","out vec4 vertexColorGSOutput;"]).result,a=h.A.substitute(a,"//VTK::Color::Impl",["vertexColorGSOutput = vertexColorVSOutput[i];"]).result),0===t.lastBoundBO.getCABO().getColorComponents()||t.drawingEdges?(t.renderable.getAreScalarsMappedFromCells()||t.renderable.getInterpolateScalarsBeforeMapping())&&t.renderable.getColorCoordinates()&&!t.drawingEdges?o=h.A.substitute(o,"//VTK::Color::Impl",u.concat([" vec4 texColor = texture2D(texture1, tcoordVCVSOutput.st);"," diffuseColor = texColor.rgb;"," ambientColor = texColor.rgb;"," opacity = opacity*texColor.a;"])).result:(n.getBackfaceProperty()&&!t.drawingEdges&&(l=l.concat(["uniform float opacityUniformBF; // the fragment opacity","uniform float ambientIntensityBF; // the material ambient","uniform float diffuseIntensityBF; // the material diffuse","uniform vec3 ambientColorUniformBF; // ambient material color","uniform vec3 diffuseColorUniformBF; // diffuse material color"]),s?(l=l.concat(["uniform float specularIntensityBF; // the material specular intensity","uniform vec3 specularColorUniformBF; // intensity weighted color","uniform float specularPowerUniformBF;"]),u=u.concat(["if (gl_FrontFacing == false) {"," ambientColor = ambientIntensityBF * ambientColorUniformBF;"," diffuseColor = diffuseIntensityBF * diffuseColorUniformBF;"," specularColor = specularIntensityBF * specularColorUniformBF;"," specularPower = specularPowerUniformBF;"," opacity = opacityUniformBF; }"])):u=u.concat(["if (gl_FrontFacing == false) {"," ambientColor = ambientIntensityBF * ambientColorUniformBF;"," diffuseColor = diffuseIntensityBF * diffuseColorUniformBF;"," opacity = opacityUniformBF; }"])),t.haveCellScalars&&!t.drawingEdges&&(l=l.concat(["uniform samplerBuffer texture1;"])),o=h.A.substitute(o,"//VTK::Color::Impl",u).result):o=h.A.substitute(o,"//VTK::Color::Impl",u.concat([" diffuseColor = vertexColorVSOutput.rgb;"," ambientColor = vertexColorVSOutput.rgb;"," opacity = opacity*vertexColorVSOutput.a;"])).result,o=h.A.substitute(o,"//VTK::Color::Dec",l).result,e.Vertex=i,e.Geometry=a,e.Fragment=o},e.replaceShaderLight=(e,r,n)=>{let i=e.Fragment,a=t.lastBoundBO.getReferenceByName("lastLightComplexity"),o=t.lastBoundBO.getReferenceByName("lastLightCount"),s=[];switch(a){case 0:i=h.A.substitute(i,"//VTK::Light::Impl",[" gl_FragData[0] = vec4(ambientColor * ambient + diffuseColor * diffuse, opacity);"," //VTK::Light::Impl"],!1).result;break;case 1:i=h.A.substitute(i,"//VTK::Light::Impl",[" float df = max(0.0, normalVCVSOutput.z);"," float sf = pow(df, specularPower);"," vec3 diffuseL = df * diffuseColor;"," vec3 specularL = sf * specularColor;"," gl_FragData[0] = vec4(ambientColor * ambient + diffuseL * diffuse + specularL * specular, opacity);"," //VTK::Light::Impl"],!1).result;break;case 2:for(let e=0;e= cos(radians(lightConeAngle${e})))`," {",` attenuation = attenuation * pow(coneDot, lightExponent${e});`," }"," else"," {"," attenuation = 0.0;"," }"," }"," }"," df = max(0.0, attenuation*dot(normalVCVSOutput, -vertLightDirectionVC));",` diffuseL += ((df) * lightColor${e});`," if (dot(normalVCVSOutput, vertLightDirectionVC) < 0.0)"," {",` float sf = sign(df)*attenuation*pow(max(1e-5, + dot(reflect(lightDirectionVC${e}, + normalVCVSOutput), + normalize(-vertexVC.xyz))), + specularPower);`,` specularL += ((sf) * lightColor${e});`," }"]);s=s.concat([" diffuseL = diffuseL * diffuseColor;"," specularL = specularL * specularColor;"," gl_FragData[0] = vec4(ambientColor * ambient + diffuseL * diffuse + specularL * specular, opacity);"," //VTK::Light::Impl"]),i=h.A.substitute(i,"//VTK::Light::Impl",s,!1).result;break;default:_("bad light complexity")}e.Fragment=i},e.replaceShaderNormal=(e,r,n)=>{if(t.lastBoundBO.getReferenceByName("lastLightComplexity")>0){let r=e.Vertex,i=e.Geometry,a=e.Fragment;t.lastBoundBO.getCABO().getNormalOffset()?(r=h.A.substitute(r,"//VTK::Normal::Dec",["attribute vec3 normalMC;","uniform mat3 normalMatrix;","varying vec3 normalVCVSOutput;"]).result,r=h.A.substitute(r,"//VTK::Normal::Impl",["normalVCVSOutput = normalMatrix * normalMC;"]).result,i=h.A.substitute(i,"//VTK::Normal::Dec",["in vec3 normalVCVSOutput[];","out vec3 normalVCGSOutput;"]).result,i=h.A.substitute(i,"//VTK::Normal::Impl",["normalVCGSOutput = normalVCVSOutput[i];"]).result,a=h.A.substitute(a,"//VTK::Normal::Dec",["varying vec3 normalVCVSOutput;"]).result,a=h.A.substitute(a,"//VTK::Normal::Impl",["vec3 normalVCVSOutput = normalize(normalVCVSOutput);"," if (gl_FrontFacing == false) { normalVCVSOutput = -normalVCVSOutput; }"]).result):t.haveCellNormals?(a=h.A.substitute(a,"//VTK::Normal::Dec",["uniform mat3 normalMatrix;","uniform samplerBuffer textureN;"]).result,a=h.A.substitute(a,"//VTK::Normal::Impl",["vec3 normalVCVSOutput = normalize(normalMatrix *"," texelFetchBuffer(textureN, gl_PrimitiveID + PrimitiveIDOffset).xyz);"," if (gl_FrontFacing == false) { normalVCVSOutput = -normalVCVSOutput; }"]).result):t.lastBoundBO.getOpenGLMode(n.getProperty().getRepresentation())===t.context.LINES?(a=h.A.substitute(a,"//VTK::UniformFlow::Impl",[" vec3 fdx = dFdx(vertexVC.xyz);"," vec3 fdy = dFdy(vertexVC.xyz);"," //VTK::UniformFlow::Impl"]).result,a=h.A.substitute(a,"//VTK::Normal::Impl",["vec3 normalVCVSOutput;"," if (abs(fdx.x) > 0.0)"," { fdx = normalize(fdx); normalVCVSOutput = normalize(cross(vec3(fdx.y, -fdx.x, 0.0), fdx)); }"," else { fdy = normalize(fdy); normalVCVSOutput = normalize(cross(vec3(fdy.y, -fdy.x, 0.0), fdy));}"]).result):(a=h.A.substitute(a,"//VTK::Normal::Dec",["uniform int cameraParallel;"]).result,a=h.A.substitute(a,"//VTK::UniformFlow::Impl",[" vec3 fdx = dFdx(vertexVC.xyz);"," vec3 fdy = dFdy(vertexVC.xyz);"," //VTK::UniformFlow::Impl"]).result,a=h.A.substitute(a,"//VTK::Normal::Impl",[" fdx = normalize(fdx);"," fdy = normalize(fdy);"," vec3 normalVCVSOutput = normalize(cross(fdx,fdy));"," if (cameraParallel == 1 && normalVCVSOutput.z < 0.0) { normalVCVSOutput = -1.0*normalVCVSOutput; }"," if (cameraParallel == 0 && dot(normalVCVSOutput,vertexVC.xyz) > 0.0) { normalVCVSOutput = -1.0*normalVCVSOutput; }"]).result),e.Vertex=r,e.Geometry=i,e.Fragment=a}},e.replaceShaderPositionVC=(e,r,n)=>{t.lastBoundBO.replaceShaderPositionVC(e,r,n);let i=e.Vertex,a=e.Geometry,o=e.Fragment;t.lastBoundBO.getReferenceByName("lastLightComplexity")>0?(i=h.A.substitute(i,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,i=h.A.substitute(i,"//VTK::PositionVC::Impl",["vertexVCVSOutput = MCVCMatrix * vertexMC;"," gl_Position = MCPCMatrix * vertexMC;"]).result,i=h.A.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result,a=h.A.substitute(a,"//VTK::PositionVC::Dec",["in vec4 vertexVCVSOutput[];","out vec4 vertexVCGSOutput;"]).result,a=h.A.substitute(a,"//VTK::PositionVC::Impl",["vertexVCGSOutput = vertexVCVSOutput[i];"]).result,o=h.A.substitute(o,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,o=h.A.substitute(o,"//VTK::PositionVC::Impl",["vec4 vertexVC = vertexVCVSOutput;"]).result):(i=h.A.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,i=h.A.substitute(i,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result),e.Vertex=i,e.Geometry=a,e.Fragment=o},e.replaceShaderTCoord=(e,r,n)=>{if(t.lastBoundBO.getCABO().getTCoordOffset()){let r=e.Vertex,n=e.Geometry,i=e.Fragment;if(t.drawingEdges)return;r=h.A.substitute(r,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result;let a=t.openGLActor.getActiveTextures(),o=2,s=2;if(a&&a.length>0&&(o=a[0].getComponents(),a[0].getTarget()===t.context.TEXTURE_CUBE_MAP&&(s=3)),t.renderable.getColorTextureMap()&&(o=t.renderable.getColorTextureMap().getPointData().getScalars().getNumberOfComponents(),s=2),2===s){if(r=h.A.substitute(r,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result,n=h.A.substitute(n,"//VTK::TCoord::Dec",["in vec2 tcoordVCVSOutput[];","out vec2 tcoordVCGSOutput;"]).result,n=h.A.substitute(n,"//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];").result,i=h.A.substitute(i,"//VTK::TCoord::Dec",["varying vec2 tcoordVCVSOutput;","uniform sampler2D texture1;"]).result,a&&a.length>=1)switch(o){case 1:i=h.A.substitute(i,"//VTK::TCoord::Impl",[" vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"]).result;break;case 2:i=h.A.substitute(i,"//VTK::TCoord::Impl",[" vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"," opacity = opacity * tcolor.g;"]).result;break;default:i=h.A.substitute(i,"//VTK::TCoord::Impl",[" vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.rgb;"," diffuseColor = diffuseColor*tcolor.rgb;"," opacity = opacity * tcolor.a;"]).result}}else switch(r=h.A.substitute(r,"//VTK::TCoord::Dec","attribute vec3 tcoordMC; varying vec3 tcoordVCVSOutput;").result,n=h.A.substitute(n,"//VTK::TCoord::Dec",["in vec3 tcoordVCVSOutput[];","out vec3 tcoordVCGSOutput;"]).result,n=h.A.substitute(n,"//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];").result,i=h.A.substitute(i,"//VTK::TCoord::Dec",["varying vec3 tcoordVCVSOutput;","uniform samplerCube texture1;"]).result,o){case 1:i=h.A.substitute(i,"//VTK::TCoord::Impl",[" vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"]).result;break;case 2:i=h.A.substitute(i,"//VTK::TCoord::Impl",[" vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"," opacity = opacity * tcolor.g;"]).result;break;default:i=h.A.substitute(i,"//VTK::TCoord::Impl",[" vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.rgb;"," diffuseColor = diffuseColor*tcolor.rgb;"," opacity = opacity * tcolor.a;"]).result}e.Vertex=r,e.Geometry=n,e.Fragment=i}},e.replaceShaderClip=(e,r,n)=>{let i=e.Vertex,a=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();i=h.A.substitute(i,"//VTK::Clip::Dec",["uniform int numClipPlanes;",`uniform vec4 clipPlanes[${e}];`,`varying float clipDistancesVSOutput[${e}];`]).result,i=h.A.substitute(i,"//VTK::Clip::Impl",[`for (int planeNum = 0; planeNum < ${e}; planeNum++)`," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,a=h.A.substitute(a,"//VTK::Clip::Dec",["uniform int numClipPlanes;",`varying float clipDistancesVSOutput[${e}];`]).result,a=h.A.substitute(a,"//VTK::Clip::Impl",[`for (int planeNum = 0; planeNum < ${e}; planeNum++)`," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=i,e.Fragment=a},e.getCoincidentParameters=(e,r)=>{let n={factor:0,offset:0},i=r.getProperty();if(t.renderable.getResolveCoincidentTopology()==l.XK.PolygonOffset||i.getEdgeVisibility()&&i.getRepresentation()===T.SURFACE){let e=t.lastBoundBO.getPrimitiveType();e===A.Points||i.getRepresentation()===T.POINTS?n=t.renderable.getCoincidentTopologyPointOffsetParameter():e===A.Lines||i.getRepresentation()===T.WIREFRAME?n=t.renderable.getCoincidentTopologyLineOffsetParameters():(e===A.Tris||e===A.TriStrips)&&(n=t.renderable.getCoincidentTopologyPolygonOffsetParameters()),(e===A.TrisEdges||e===A.TriStripsEdges)&&(n=t.renderable.getCoincidentTopologyPolygonOffsetParameters(),n.factor/=2,n.offset/=2)}let a=t._openGLRenderer.getSelector();return a&&a.getFieldAssociation()===C.FIELD_ASSOCIATION_POINTS&&(n.offset-=2),n},e.replaceShaderPicking=(e,r,n)=>{let i=e.Fragment,a=e.Vertex;if(i=h.A.substitute(i,"//VTK::Picking::Dec",["uniform int picking;","//VTK::Picking::Dec"]).result,t._openGLRenderer.getSelector()){switch((t.lastSelectionState===u.T.ID_LOW24||t.lastSelectionState===u.T.ID_HIGH24)&&(a=h.A.substitute(a,"//VTK::Picking::Dec",["flat out int vertexIDVSOutput;\n","uniform int VertexIDOffset;\n"]).result,a=h.A.substitute(a,"//VTK::Picking::Impl"," vertexIDVSOutput = gl_VertexID + VertexIDOffset;\n").result,i=h.A.substitute(i,"//VTK::Picking::Dec","flat in int vertexIDVSOutput;\n").result,i=h.A.substitute(i,"//VTK::Picking::Impl",[" int idx = vertexIDVSOutput;","//VTK::Picking::Impl"]).result),t.lastSelectionState){case u.T.ID_LOW24:i=h.A.substitute(i,"//VTK::Picking::Impl"," gl_FragData[0] = vec4(float(idx%256)/255.0, float((idx/256)%256)/255.0, float((idx/65536)%256)/255.0, 1.0);").result;break;case u.T.ID_HIGH24:i=h.A.substitute(i,"//VTK::Picking::Impl"," gl_FragData[0] = vec4(float((idx/16777216)%256)/255.0, 0.0, 0.0, 1.0);").result;break;default:i=h.A.substitute(i,"//VTK::Picking::Dec","uniform vec3 mapperIndex;").result,i=h.A.substitute(i,"//VTK::Picking::Impl"," gl_FragData[0] = picking != 0 ? vec4(mapperIndex,1.0) : gl_FragData[0];").result}e.Fragment=i,e.Vertex=a}},e.replaceShaderValues=(r,n,i)=>{if(e.replaceShaderColor(r,n,i),e.replaceShaderNormal(r,n,i),e.replaceShaderLight(r,n,i),e.replaceShaderTCoord(r,n,i),e.replaceShaderPicking(r,n,i),e.replaceShaderClip(r,n,i),e.replaceShaderCoincidentOffset(r,n,i),e.replaceShaderPositionVC(r,n,i),t.haveSeenDepthRequest){let e=r.Fragment;e=h.A.substitute(e,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,r.Fragment=e=h.A.substitute(e,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result}},e.getNeedToRebuildShaders=(e,r,n)=>{let i=0,a=0,o=e.getPrimitiveType(),s=t.currentInput,l=!1,u=s.getPointData().getNormals(),c=s.getCellData().getNormals(),d=n.getProperty().getInterpolation()===S.FLAT,p=n.getProperty().getRepresentation(),m=e.getOpenGLMode(p,o);if(m===t.context.TRIANGLES||c&&!u||!d&&u?l=!0:d||m!==t.context.LINES||(l=!0),n.getProperty().getLighting()&&l){i=0;let e=r.getLightsByReference();for(let t=0;t0&&(a++,0===i&&(i=1)),1===i&&(a>1||1!==r.getIntensity()||!r.lightTypeIsHeadLight())&&(i=2),i<3&&r.getPositional()&&(i=3)}}let h=!1,f=t.lastBoundBO.getReferenceByName("lastLightComplexity"),g=t.lastBoundBO.getReferenceByName("lastLightCount");return(f!==i||g!==a)&&(t.lastBoundBO.set({lastLightComplexity:i},!0),t.lastBoundBO.set({lastLightCount:a},!0),h=!0),(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(h=!0),(!!(t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||e.getShaderSourceTime().getMTime(){let i=t.renderable.getViewSpecificProperties().ShadersCallbacks;i&&i.forEach(t=>{t.callback(t.userData,e,r,n)})},e.setMapperShaderParameters=(r,n,i)=>{if(r.getProgram().isUniformUsed("PrimitiveIDOffset")&&r.getProgram().setUniformi("PrimitiveIDOffset",t.primitiveIDOffset),r.getProgram().isUniformUsed("VertexIDOffset")&&r.getProgram().setUniformi("VertexIDOffset",t.vertexIDOffset),r.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>r.getAttributeUpdateTime().getMTime()||r.getShaderSourceTime().getMTime()>r.getAttributeUpdateTime().getMTime())){let e=t.lastBoundBO.getReferenceByName("lastLightComplexity");r.getProgram().isAttributeUsed("vertexMC")&&!r.getVAO().addAttributeArray(r.getProgram(),r.getCABO(),"vertexMC",r.getCABO().getVertexOffset(),r.getCABO().getStride(),t.context.FLOAT,3,!1)&&_("Error setting vertexMC in shader VAO."),r.getProgram().isAttributeUsed("normalMC")&&r.getCABO().getNormalOffset()&&e>0?r.getVAO().addAttributeArray(r.getProgram(),r.getCABO(),"normalMC",r.getCABO().getNormalOffset(),r.getCABO().getStride(),t.context.FLOAT,3,!1)||_("Error setting normalMC in shader VAO."):r.getVAO().removeAttributeArray("normalMC"),t.renderable.getCustomShaderAttributes().forEach((e,n)=>{r.getProgram().isAttributeUsed(`${e}MC`)&&!r.getVAO().addAttributeArray(r.getProgram(),r.getCABO(),`${e}MC`,r.getCABO().getCustomData()[n].offset,r.getCABO().getStride(),t.context.FLOAT,r.getCABO().getCustomData()[n].components,!1)&&_(`Error setting ${e}MC in shader VAO.`)}),r.getProgram().isAttributeUsed("tcoordMC")&&r.getCABO().getTCoordOffset()?r.getVAO().addAttributeArray(r.getProgram(),r.getCABO(),"tcoordMC",r.getCABO().getTCoordOffset(),r.getCABO().getStride(),t.context.FLOAT,r.getCABO().getTCoordComponents(),!1)||_("Error setting tcoordMC in shader VAO."):r.getVAO().removeAttributeArray("tcoordMC"),r.getProgram().isAttributeUsed("scalarColor")&&r.getCABO().getColorComponents()?r.getVAO().addAttributeArray(r.getProgram(),r.getCABO().getColorBO(),"scalarColor",r.getCABO().getColorOffset(),r.getCABO().getColorBOStride(),t.context.UNSIGNED_BYTE,4,!0)||_("Error setting scalarColor in shader VAO."):r.getVAO().removeAttributeArray("scalarColor"),r.getAttributeUpdateTime().modified()}if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes(),n=[],a=r.getCABO().getCoordShiftAndScaleEnabled()?r.getCABO().getInverseShiftAndScaleMatrix():null,o=a?b.copy(t.tmpMat4,i.getMatrix()):i.getMatrix();a&&(b.transpose(o,o),b.multiply(o,o,a),b.transpose(o,o));for(let r=0;r{let a=t.lastBoundBO.getReferenceByName("lastLightComplexity");if(a<2)return;let o=e.getProgram(),s=0,l=r.getLightsByReference();for(let e=0;e0){let e=n.getColorByReference(),a=n.getIntensity();t.lightColor[0]=e[0]*a,t.lightColor[1]=e[1]*a,t.lightColor[2]=e[2]*a;let l=n.getDirection(),u=r.getActiveCamera().getViewMatrix(),c=[...l];n.lightTypeIsSceneLight()&&(c[0]=u[0]*l[0]+u[1]*l[1]+u[2]*l[2],c[1]=u[4]*l[0]+u[5]*l[1]+u[6]*l[2],c[2]=u[8]*l[0]+u[9]*l[1]+u[10]*l[2],(0,i.S8)(c)),t.lightDirection[0]=c[0],t.lightDirection[1]=c[1],t.lightDirection[2]=c[2],(0,i.S8)(t.lightDirection),o.setUniform3fArray(`lightColor${s}`,t.lightColor),o.setUniform3fArray(`lightDirectionVC${s}`,t.lightDirection),s++}}if(a<3)return;let u=r.getActiveCamera().getViewMatrix();b.transpose(u,u),s=0;for(let e=0;e0){let e=t.getTransformedPosition(),r=new Float64Array(3);I.Z0(r,e,u),o.setUniform3fArray(`lightAttenuation${s}`,t.getAttenuationValuesByReference()),o.setUniformi(`lightPositional${s}`,t.getPositional()),o.setUniformf(`lightExponent${s}`,t.getExponent()),o.setUniformf(`lightConeAngle${s}`,t.getConeAngle()),o.setUniform3fArray(`lightPositionVC${s}`,[r[0],r[1],r[2]]),s++}}},e.setCameraShaderParameters=(e,r,n)=>{let i=e.getProgram(),o=t.openGLCamera.getKeyMatrices(r),s=r.getActiveCamera(),l=t.openGLCamera.getKeyMatrixTime().getMTime(),u=i.getLastCameraMTime(),c=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,d=n.getIsIdentity(),p=d?{mcwc:null,normalMatrix:null}:t.openGLActor.getKeyMatrices();if(n.getCoordinateSystem()===R.DISPLAY){let e=t._openGLRenderer.getTiledSizeAndOrigin();b.identity(t.tmpMat4),t.tmpMat4[0]=2/e.usize,t.tmpMat4[12]=-1,t.tmpMat4[5]=2/e.vsize,t.tmpMat4[13]=-1,b.multiply(t.tmpMat4,t.tmpMat4,c),i.setUniformMatrix("MCPCMatrix",t.tmpMat4)}else i.setUniformMatrix("MCPCMatrix",a([o.wcpc,p.mcwc,c],b,t.tmpMat4));i.isUniformUsed("MCVCMatrix")&&i.setUniformMatrix("MCVCMatrix",a([o.wcvc,p.mcwc,c],b,t.tmpMat4)),i.isUniformUsed("normalMatrix")&&i.setUniformMatrix3x3("normalMatrix",a([o.normalMatrix,p.normalMatrix],x,t.tmpMat3)),u!==l&&(i.isUniformUsed("cameraParallel")&&i.setUniformi("cameraParallel",s.getParallelProjection()),i.setLastCameraMTime(l)),d||i.setLastCameraMTime(0)},e.setPropertyShaderParameters=(e,r,n)=>{let i=e.getProgram(),a=n.getProperty(),o=t.drawingEdges||a.getRepresentation()===T.WIREFRAME?a.getEdgeOpacity():a.getOpacity(),s=t.drawingEdges?a.getEdgeColorByReference():a.getAmbientColorByReference(),l=t.drawingEdges?a.getEdgeColorByReference():a.getDiffuseColorByReference(),u=t.drawingEdges?1:a.getAmbient(),c=t.drawingEdges?0:a.getDiffuse(),d=t.drawingEdges?0:a.getSpecular(),p=a.getSpecularPower();i.setUniformf("opacityUniform",o),i.setUniform3fArray("ambientColorUniform",s),i.setUniform3fArray("diffuseColorUniform",l),i.setUniformf("ambient",u),i.setUniformf("diffuse",c);let m=t.lastBoundBO.getReferenceByName("lastLightComplexity");if(m<1)return;let h=a.getSpecularColorByReference();if(i.setUniform3fArray("specularColorUniform",h),i.setUniformf("specularPowerUniform",p),i.setUniformf("specular",d),i.isUniformUsed("ambientIntensityBF")){if(o=(a=n.getBackfaceProperty()).getOpacity(),s=a.getAmbientColor(),u=a.getAmbient(),l=a.getDiffuseColor(),c=a.getDiffuse(),h=a.getSpecularColor(),d=a.getSpecular(),i.setUniformf("ambientIntensityBF",u),i.setUniformf("diffuseIntensityBF",c),i.setUniformf("opacityUniformBF",o),i.setUniform3fArray("ambientColorUniformBF",s),i.setUniform3fArray("diffuseColorUniformBF",l),m<1)return;i.setUniformf("specularIntensityBF",d),i.setUniform3fArray("specularColorUniformBF",h),i.setUniformf("specularPowerUniformBF",p)}},e.updateMaximumPointCellIds=(e,r)=>{let n=t._openGLRenderer.getSelector();if(n){if(t.selectionWebGLIdsToVTKIds?.points?.length){let e=t.selectionWebGLIdsToVTKIds.points.length;n.setMaximumPointId(e-1)}if(t.selectionWebGLIdsToVTKIds?.cells?.length){let e=t.selectionWebGLIdsToVTKIds.cells.length;n.setMaximumCellId(e-1)}n.getFieldAssociation()===C.FIELD_ASSOCIATION_POINTS&&(t.pointPicking=!0)}},e.renderPieceStart=(r,n)=>{t.primitiveIDOffset=0,t.vertexIDOffset=0;let i=function(e){let t=e.getSelector();return t?t.getCurrentPass():u.T.MIN_KNOWN_PASS-1}(t._openGLRenderer);t.lastSelectionState!==i&&(t.selectionStateChanged.modified(),t.lastSelectionState=i),t._openGLRenderer.getSelector()&&t._openGLRenderer.getSelector().renderProp(n),e.updateBufferObjects(r,n),t.renderable.getColorTextureMap()&&t.internalColorTexture.activate(),t.lastBoundBO=null},e.renderPieceDraw=(r,n)=>{let i=n.getProperty().getRepresentation(),a=n.getProperty().getEdgeVisibility()&&i===T.SURFACE,o=t._openGLRenderer.getSelector(),s=o&&o.getFieldAssociation()===C.FIELD_ASSOCIATION_POINTS&&(t.lastSelectionState===u.T.ID_LOW24||t.lastSelectionState===u.T.ID_HIGH24);for(let o=A.Start;o=0)||(t.lastBoundBO=t.primitives[o],t.primitiveIDOffset+=t.primitives[o].drawArrays(r,n,i,e),t.vertexIDOffset+=t.primitives[o].getCABO().getElementCount()))},e.renderPieceFinish=(e,r)=>{t.LastBoundBO&&t.LastBoundBO.getVAO().release(),t.renderable.getColorTextureMap()&&t.internalColorTexture.deactivate()},e.renderPiece=(r,n)=>{if(e.invokeEvent(E),t.renderable.getStatic()||t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent(D),!t.currentInput)return void _("No input!");if(!t.currentInput.getPoints||!t.currentInput.getPoints().getNumberOfValues())return;let i=t.context,a=n.getProperty().getBackfaceCulling(),o=n.getProperty().getFrontfaceCulling();a||o?o?(t._openGLRenderWindow.enableCullFace(),t._openGLRenderWindow.setCullFaceMode(i.FRONT)):(t._openGLRenderWindow.enableCullFace(),t._openGLRenderWindow.setCullFaceMode(i.BACK)):t._openGLRenderWindow.disableCullFace(),e.renderPieceStart(r,n),e.renderPieceDraw(r,n),e.renderPieceFinish(r,n)},e.updateBufferObjects=(t,r)=>{e.getNeedToRebuildBufferObjects(t,r)&&e.buildBufferObjects(t,r),e.updateMaximumPointCellIds()},e.getNeedToRebuildBufferObjects=(r,n)=>{let i=t.VBOBuildTime.getMTime();return!!(i{let n=t.currentInput;if(null===n)return;t.renderable.mapScalars(n,1);let i=t.renderable.getColorMapColors();t.haveCellScalars=!1;let a=t.renderable.getScalarMode();t.renderable.getScalarVisibility()&&(a===w.USE_CELL_DATA||a===w.USE_CELL_FIELD_DATA||a===w.USE_FIELD_DATA||!n.getPointData().getScalars())&&a!==w.USE_POINT_FIELD_DATA&&i&&(t.haveCellScalars=!0);let o=r.getProperty().getInterpolation()!==S.FLAT?n.getPointData().getNormals():null;null===o&&n.getCellData().getNormals()&&(t.haveCellNormals=!0,o=n.getCellData().getNormals());let s=r.getProperty().getRepresentation(),l=n.getPointData().getTCoords();t.openGLActor.getActiveTextures()||(l=null);let u=!1;if(t.renderable.getColorCoordinates()){l=t.renderable.getColorCoordinates(),u=t.renderable.getAreScalarsMappedFromCells(),t.internalColorTexture||(t.internalColorTexture=m.Ay.newInstance({resizable:!0}));let e=t.internalColorTexture;e.setMinificationFilter(O.NEAREST),e.setMagnificationFilter(O.NEAREST),e.setWrapS(P.CLAMP_TO_EDGE),e.setWrapT(P.CLAMP_TO_EDGE),e.setOpenGLRenderWindow(t._openGLRenderWindow);let r=t.renderable.getColorTextureMap(),n=r.getExtent(),i=r.getPointData().getScalars();e.create2DFromRaw({width:n[1]-n[0]+1,height:n[3]-n[2]+1,numComps:i.getNumberOfComponents(),dataType:i.getDataType(),data:i.getData()}),e.activate(),e.sendParameters(),e.deactivate()}let c=t.renderable.getCustomShaderAttributes().map(e=>n.getPointData().getArrayByName(e)),d=`${n.getMTime()}A${s}B${n.getMTime()}C${o?o.getMTime():1}D${i?i.getMTime():1}E${r.getProperty().getEdgeVisibility()}F${l?l.getMTime():1}G${c.map(e=>e.getMTime()).join(",")}`;if(t.VBOBuildString!==d){let e={points:n.getPoints(),normals:o,tcoords:l,colors:i,cellOffset:0,vertexOffset:0,useTCoordsPerCell:u,haveCellScalars:t.haveCellScalars,haveCellNormals:t.haveCellNormals,customAttributes:c};t.renderable.getPopulateSelectionSettings()&&(t.selectionWebGLIdsToVTKIds={points:null,cells:null});let a=[{inRep:"verts",cells:n.getVerts()},{inRep:"lines",cells:n.getLines()},{inRep:"polys",cells:n.getPolys()},{inRep:"strips",cells:n.getStrips()},{inRep:"polys",cells:n.getPolys()},{inRep:"strips",cells:n.getStrips()}],p=r.getProperty().getEdgeVisibility()&&s===T.SURFACE;for(let r=A.Start;r{let e=0;return t.primitives.forEach(t=>{e+=t.getAllocatedGPUMemoryInBytes()}),e}}var V=(0,n.UI)(N,"vtkOpenGLPolyDataMapper"),L={newInstance:V,extend:N};(0,p.c9)("vtkMapper",V)},31846:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractRangeImpl=void 0;class r{get _startNode(){return this._start[0]}get _startOffset(){return this._start[1]}get _endNode(){return this._end[0]}get _endOffset(){return this._end[1]}get _collapsed(){return this._start[0]===this._end[0]&&this._start[1]===this._end[1]}get startContainer(){return this._startNode}get startOffset(){return this._startOffset}get endContainer(){return this._endNode}get endOffset(){return this._endOffset}get collapsed(){return this._collapsed}}t.AbstractRangeImpl=r},31895:(e,t,r)=>{"use strict";var n;r.d(t,{A:()=>i}),function(e){e.TOOL_ACTIVATED="CORNERSTONE_TOOLS_TOOL_ACTIVATED",e.TOOLGROUP_VIEWPORT_ADDED="CORNERSTONE_TOOLS_TOOLGROUP_VIEWPORT_ADDED",e.TOOLGROUP_VIEWPORT_REMOVED="CORNERSTONE_TOOLS_TOOLGROUP_VIEWPORT_REMOVED",e.TOOL_MODE_CHANGED="CORNERSTONE_TOOLS_TOOL_MODE_CHANGED",e.CROSSHAIR_TOOL_CENTER_CHANGED="CORNERSTONE_TOOLS_CROSSHAIR_TOOL_CENTER_CHANGED",e.WORLD_CROSSHAIR_POINT_CHANGED="CORNERSTONE_TOOLS_WORLD_CROSSHAIR_POINT_CHANGED",e.WORLD_CROSSHAIR_POINT_CLEARED="CORNERSTONE_TOOLS_WORLD_CROSSHAIR_POINT_CLEARED",e.WORLD_CROSSHAIR_JUMPED_TO_POINT="CORNERSTONE_TOOLS_WORLD_CROSSHAIR_JUMPED_TO_POINT",e.SLICE_INTERSECTION_LINE_SELECTED="CORNERSTONE_TOOLS_SLICE_INTERSECTION_LINE_SELECTED",e.SLICE_INTERSECTION_MANIPULATION_STARTED="CORNERSTONE_TOOLS_SLICE_INTERSECTION_MANIPULATION_STARTED",e.SLICE_INTERSECTION_MANIPULATION_ENDED="CORNERSTONE_TOOLS_SLICE_INTERSECTION_MANIPULATION_ENDED",e.SLICE_INTERSECTION_SLAB_THICKNESS_CHANGED="CORNERSTONE_TOOLS_SLICE_INTERSECTION_SLAB_THICKNESS_CHANGED",e.VOLUMECROPPINGCONTROL_TOOL_CHANGED="CORNERSTONE_TOOLS_VOLUMECROPPINGCONTROL_TOOL_CHANGED",e.VOLUMECROPPING_TOOL_CHANGED="CORNERSTONE_TOOLS_VOLUMECROPPING_TOOL_CHANGED",e.STACK_PREFETCH_COMPLETE="CORNERSTONE_TOOLS_STACK_PREFETCH_COMPLETE",e.ANNOTATION_ADDED="CORNERSTONE_TOOLS_ANNOTATION_ADDED",e.ANNOTATION_COMPLETED="CORNERSTONE_TOOLS_ANNOTATION_COMPLETED",e.ANNOTATION_MODIFIED="CORNERSTONE_TOOLS_ANNOTATION_MODIFIED",e.ANNOTATION_REMOVED="CORNERSTONE_TOOLS_ANNOTATION_REMOVED",e.ANNOTATION_SELECTION_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_SELECTION_CHANGE",e.ANNOTATION_LOCK_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_LOCK_CHANGE",e.ANNOTATION_VISIBILITY_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_VISIBILITY_CHANGE",e.ANNOTATION_RENDERED="CORNERSTONE_TOOLS_ANNOTATION_RENDERED",e.ANNOTATION_CUT_MERGE_PROCESS_COMPLETED="CORNERSTONE_TOOLS_ANNOTATION_CUT_MERGE_PROCESS_COMPLETED",e.ANNOTATION_INTERPOLATION_PROCESS_COMPLETED="CORNERSTONE_TOOLS_ANNOTATION_INTERPOLATION_PROCESS_COMPLETED",e.INTERPOLATED_ANNOTATIONS_REMOVED="CORNERSTONE_TOOLS_INTERPOLATED_ANNOTATIONS_REMOVED",e.SEGMENTATION_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_MODIFIED",e.SEGMENTATION_RENDERED="CORNERSTONE_TOOLS_SEGMENTATION_RENDERED",e.SEGMENTATION_REPRESENTATION_ADDED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_ADDED",e.SEGMENTATION_ADDED="CORNERSTONE_TOOLS_SEGMENTATION_ADDED",e.SEGMENTATION_REPRESENTATION_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_MODIFIED",e.SEGMENTATION_REMOVED="CORNERSTONE_TOOLS_SEGMENTATION_REMOVED",e.SEGMENTATION_REPRESENTATION_REMOVED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_REMOVED",e.SEGMENTATION_DATA_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_DATA_MODIFIED",e.HISTORY_UNDO="CORNERSTONE_TOOLS_HISTORY_UNDO",e.HISTORY_REDO="CORNERSTONE_TOOLS_HISTORY_REDO",e.KEY_DOWN="CORNERSTONE_TOOLS_KEY_DOWN",e.KEY_UP="CORNERSTONE_TOOLS_KEY_UP",e.MOUSE_DOWN="CORNERSTONE_TOOLS_MOUSE_DOWN",e.MOUSE_UP="CORNERSTONE_TOOLS_MOUSE_UP",e.MOUSE_DOWN_ACTIVATE="CORNERSTONE_TOOLS_MOUSE_DOWN_ACTIVATE",e.MOUSE_DRAG="CORNERSTONE_TOOLS_MOUSE_DRAG",e.MOUSE_MOVE="CORNERSTONE_TOOLS_MOUSE_MOVE",e.MOUSE_CLICK="CORNERSTONE_TOOLS_MOUSE_CLICK",e.MOUSE_DOUBLE_CLICK="CORNERSTONE_TOOLS_MOUSE_DOUBLE_CLICK",e.MOUSE_WHEEL="CORNERSTONE_TOOLS_MOUSE_WHEEL",e.TOUCH_START="CORNERSTONE_TOOLS_TOUCH_START",e.TOUCH_START_ACTIVATE="CORNERSTONE_TOOLS_TOUCH_START_ACTIVATE",e.TOUCH_PRESS="CORNERSTONE_TOOLS_TOUCH_PRESS",e.TOUCH_DRAG="CORNERSTONE_TOOLS_TOUCH_DRAG",e.TOUCH_END="CORNERSTONE_TOOLS_TOUCH_END",e.TOUCH_TAP="CORNERSTONE_TOOLS_TAP",e.TOUCH_SWIPE="CORNERSTONE_TOOLS_SWIPE"}(n||(n={}));let i=n},31906:(e,t,r)=>{"use strict";r.d(t,{k:()=>s,o:()=>o});var n=r(50923),i=r(62553),a=r(88824);function o(e,t,r={}){return!!e&&t.some(t=>{var i,o,s,u,g,v,y,b,I,x;return i=e,o=t,s=r,u=i,g=o,(!u.FrameOfReferenceUID||u.FrameOfReferenceUID===g.frameOfReferenceUID)&&(v=i,y=o,!!(!v.dataId||h([(b=y).dataId,...b.dataIds||[]]).includes(v.dataId)))&&(I=i,x=o,!!(!I.volumeId||m(x).includes(I.volumeId)))&&!!function(e,t,r){if(e.planeRestriction){var i=e.planeRestriction,o=t,s=r;if(i.FrameOfReferenceUID!==o.frameOfReferenceUID)return!1;if(s.withOrientation)return!0;let{cameraFocalPoint:l,viewPlaneNormal:u}=o;if(!l||!u||i.inPlaneVector1&&!(0,a.Ay)(0,n.Om(u,i.inPlaneVector1))||i.inPlaneVector2&&!(0,a.Ay)(0,n.Om(u,i.inPlaneVector2)))return!1;if(s.withNavigation)return!0;let c=n.jb(n.vt(),i.point,l);return(0,a.Ay)(0,n.Om(c,u))}if(!e.viewPlaneNormal)return!0;let{viewPlaneNormal:l}=t;return!!l&&((0,a.Ay)(e.viewPlaneNormal,l)||(0,a.Ay)(n.ze(n.vt(),l),e.viewPlaneNormal)||!!r.withOrientation)}(i,o,s)&&!!function(e,t,r){if(e.planeRestriction&&e.volumeId&&m(t).includes(e.volumeId))return!0;let n=l(e);if(!n.length)return!0;let i=function(e){var t;let r,n=e.imageIds?.length?(t=e.imageIds,(r=c.get(t))||(r=t.map(e=>d(e)),c.set(t,r)),r):[],i=e.imageURIs;if(!i?.length)return n;let a=n.slice(),o=new Set;for(let e of n)for(let t of e)o.add(t);for(let e of i)o.has(e)||(a.push([e]),o.add(e));return a}(t);if(!i.length)return!1;let a=t.currentImageIdIndex??0;if(p(i[a],n))return!0;let o=i.findIndex(e=>p(e,n));if(-1===o)return!1;if(t.allowAnyImageReference||r.withNavigation)return!0;let s=function(e,t){let r=t.multiSliceReference&&l(t.multiSliceReference);if(!r?.length)return;let n=e.findIndex(e=>p(e,r));return -1===n?void 0:n}(i,e);if(void 0!==s){let e=Math.min(o,s),t=Math.max(o,s);return e<=a&&a<=t}return a===o}(i,o,s)&&!!function(e,t,r){let n=void 0!==e.dimensionGroupNumber,i=f(e.dimensionGroupNumber);return!n||!!i&&(t.dimensionGroupNumber===i||!!r.withNavigation&&"number"==typeof t.numDimensionGroups&&i<=t.numDimensionGroups)}(i,o,s)&&function(e,t,r){var n,i;let a=e.sliceIndex;if(void 0===a)return!0;let{currentImageIdIndex:o}=t;if(Array.isArray(a))return"number"==typeof o&&a[0]<=o&&o<=a[1];return!!Number.isFinite(a)&&(o===a||!!r.withNavigation&&(n=a,i=t.imageIds,!i?.length||n>=0&&nt.includes(e))}function m(e){return h([e.volumeId,...e.volumeIds||[]])}function h(e){return Array.from(new Set(e.filter(e=>"string"==typeof e)))}function f(e){if("number"==typeof e&&Number.isInteger(e)&&!(e<1))return e}},31913:(e,t,r)=>{"use strict";function n(e){return Array.isArray(e)?e:[e]}r.d(t,{_:()=>n})},32008:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidCharacterError=t.SyntaxError=t.IndexSizeError=t.NotFoundError=t.HierarchyRequestError=t.NotImplementedError=t.DataCloneError=t.InvalidNodeTypeError=t.TimeoutError=t.QuotaExceededError=t.URLMismatchError=t.AbortError=t.NetworkError=t.SecurityError=t.TypeMismatchError=t.ValidationError=t.InvalidAccessError=t.NamespaceError=t.InvalidModificationError=t.InvalidStateError=t.InUseAttributeError=t.NotSupportedError=t.NoModificationAllowedError=t.NoDataAllowedError=t.WrongDocumentError=t.DOMStringSizeError=t.DOMException=void 0;class r extends Error{name;constructor(e,t=""){super(t),this.name=e}}t.DOMException=r;class n extends r{constructor(e=""){super("DOMStringSizeError",e)}}t.DOMStringSizeError=n;class i extends r{constructor(e=""){super("WrongDocumentError","The object is in the wrong document. "+e)}}t.WrongDocumentError=i;class a extends r{constructor(e=""){super("NoDataAllowedError",e)}}t.NoDataAllowedError=a;class o extends r{constructor(e=""){super("NoModificationAllowedError","The object can not be modified. "+e)}}t.NoModificationAllowedError=o;class s extends r{constructor(e=""){super("NotSupportedError","The operation is not supported. "+e)}}t.NotSupportedError=s;class l extends r{constructor(e=""){super("InUseAttributeError",e)}}t.InUseAttributeError=l;class u extends r{constructor(e=""){super("InvalidStateError","The object is in an invalid state. "+e)}}t.InvalidStateError=u;class c extends r{constructor(e=""){super("InvalidModificationError","The object can not be modified in this way. "+e)}}t.InvalidModificationError=c;class d extends r{constructor(e=""){super("NamespaceError","The operation is not allowed by Namespaces in XML. [XMLNS] "+e)}}t.NamespaceError=d;class p extends r{constructor(e=""){super("InvalidAccessError","The object does not support the operation or argument. "+e)}}t.InvalidAccessError=p;class m extends r{constructor(e=""){super("ValidationError",e)}}t.ValidationError=m;class h extends r{constructor(e=""){super("TypeMismatchError",e)}}t.TypeMismatchError=h;class f extends r{constructor(e=""){super("SecurityError","The operation is insecure. "+e)}}t.SecurityError=f;class g extends r{constructor(e=""){super("NetworkError","A network error occurred. "+e)}}t.NetworkError=g;class v extends r{constructor(e=""){super("AbortError","The operation was aborted. "+e)}}t.AbortError=v;class y extends r{constructor(e=""){super("URLMismatchError","The given URL does not match another URL. "+e)}}t.URLMismatchError=y;class b extends r{constructor(e=""){super("QuotaExceededError","The quota has been exceeded. "+e)}}t.QuotaExceededError=b;class I extends r{constructor(e=""){super("TimeoutError","The operation timed out. "+e)}}t.TimeoutError=I;class x extends r{constructor(e=""){super("InvalidNodeTypeError","The supplied node is incorrect or has an incorrect ancestor for this operation. "+e)}}t.InvalidNodeTypeError=x;class C extends r{constructor(e=""){super("DataCloneError","The object can not be cloned. "+e)}}t.DataCloneError=C;class A extends r{constructor(e=""){super("NotImplementedError","The DOM method is not implemented by this module. "+e)}}t.NotImplementedError=A;class T extends r{constructor(e=""){super("HierarchyRequestError","The operation would yield an incorrect node tree. "+e)}}t.HierarchyRequestError=T;class S extends r{constructor(e=""){super("NotFoundError","The object can not be found here. "+e)}}t.NotFoundError=S;class w extends r{constructor(e=""){super("IndexSizeError","The index is not in the allowed range. "+e)}}t.IndexSizeError=w;class O extends r{constructor(e=""){super("SyntaxError","The string did not match the expected pattern. "+e)}}t.SyntaxError=O;class P extends r{constructor(e=""){super("InvalidCharacterError","The string contains invalid characters. "+e)}}t.InvalidCharacterError=P},32037:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var n="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexMC;\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// picking support\n//VTK::Picking::Dec\n\nvoid main()\n{\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n //VTK::PrimID::Impl\n\n //VTK::PositionVC::Impl\n\n //VTK::Light::Impl\n\n //VTK::Picking::Impl\n}\n"},32090:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Guard=void 0;let n=r(5309);class i{static isNode(e){return!!e&&void 0!==e._nodeType}static isDocumentNode(e){return i.isNode(e)&&e._nodeType===n.NodeType.Document}static isDocumentTypeNode(e){return i.isNode(e)&&e._nodeType===n.NodeType.DocumentType}static isDocumentFragmentNode(e){return i.isNode(e)&&e._nodeType===n.NodeType.DocumentFragment}static isAttrNode(e){return i.isNode(e)&&e._nodeType===n.NodeType.Attribute}static isCharacterDataNode(e){if(!i.isNode(e))return!1;let t=e._nodeType;return t===n.NodeType.Text||t===n.NodeType.ProcessingInstruction||t===n.NodeType.Comment||t===n.NodeType.CData}static isTextNode(e){return i.isNode(e)&&(e._nodeType===n.NodeType.Text||e._nodeType===n.NodeType.CData)}static isExclusiveTextNode(e){return i.isNode(e)&&e._nodeType===n.NodeType.Text}static isCDATASectionNode(e){return i.isNode(e)&&e._nodeType===n.NodeType.CData}static isCommentNode(e){return i.isNode(e)&&e._nodeType===n.NodeType.Comment}static isProcessingInstructionNode(e){return i.isNode(e)&&e._nodeType===n.NodeType.ProcessingInstruction}static isElementNode(e){return i.isNode(e)&&e._nodeType===n.NodeType.Element}static isCustomElementNode(e){return i.isElementNode(e)&&"custom"===e._customElementState}static isShadowRoot(e){return!!e&&void 0!==e.host}static isMouseEvent(e){return!!e&&void 0!==e.screenX&&void 0!=e.screenY}static isSlotable(e){return!!e&&void 0!==e._name&&void 0!==e._assignedSlot&&(i.isTextNode(e)||i.isElementNode(e))}static isSlot(e){return!!e&&void 0!==e._name&&void 0!==e._assignedNodes&&i.isElementNode(e)}static isWindow(e){return!!e&&void 0!==e.navigator}static isEventListener(e){return!!e&&void 0!==e.handleEvent}static isRegisteredObserver(e){return!!e&&void 0!==e.observer&&void 0!==e.options}static isTransientRegisteredObserver(e){return!!e&&void 0!==e.source&&i.isRegisteredObserver(e)}}t.Guard=i},32166:(e,t,r)=>{"use strict";function n(e){return e?[e[0],e[1],e[2]]:void 0}r.d(t,{A:()=>n})},32171:(e,t,r)=>{"use strict";let n=r(55839);function i(e,t,r,n,i){let a="",o="",s=Math.floor(i/2)-1;return n-t>s&&(t=n-s+(a=" ... ").length),r-n>s&&(r=n+s-(o=" ...").length),{str:a+e.slice(t,r).replace(/\t/g,"→")+o,pos:n-t+a.length}}function a(e,t){return n.repeat(" ",t-e.length)+e}e.exports=function(e,t){let r;if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);let o=/\r?\n|\r|\0/g,s=[0],l=[],u=-1;for(;r=o.exec(e.buffer);)l.push(r.index),s.push(r.index+r[0].length),e.position<=r.index&&u<0&&(u=s.length-2);u<0&&(u=s.length-1);let c="",d=Math.min(e.line+t.linesAfter,l.length).toString().length,p=t.maxLength-(t.indent+d+3);for(let r=1;r<=t.linesBefore&&!(u-r<0);r++){let o=i(e.buffer,s[u-r],l[u-r],e.position-(s[u]-s[u-r]),p);c=n.repeat(" ",t.indent)+a((e.line-r+1).toString(),d)+" | "+o.str+"\n"+c}let m=i(e.buffer,s[u],l[u],e.position,p);c+=n.repeat(" ",t.indent)+a((e.line+1).toString(),d)+" | "+m.str+"\n"+n.repeat("-",t.indent+d+3+m.pos)+"^\n";for(let r=1;r<=t.linesAfter&&!(u+r>=l.length);r++){let o=i(e.buffer,s[u+r],l[u+r],e.position-(s[u]-s[u+r]),p);c+=n.repeat(" ",t.indent)+a((e.line+r+1).toString(),d)+" | "+o.str+"\n"}return c.replace(/\n$/,"")}},32488:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(16376),i=r(66384);let a=function(e){let t=(0,n.qO)(),r=[];return t.forEach(t=>{let n=t.getViewports().filter(i.Uv).filter(t=>t.hasVolumeId(e));r.push(...n)}),r}},32854:(e,t,r)=>{"use strict";function n(e,t){let r=[...e];return t>=r.length?(i(r),r):(i(r),r.slice(0,t))}function i(e){for(let t=e.length-1;t>0;t--){let r=Math.floor(Math.random()*(t+1));[e[t],e[r]]=[e[r],e[t]]}}r.d(t,{p:()=>n})},32876:(e,t,r)=>{"use strict";r.d(t,{D:()=>d});var n=r(50923),i=r(6529),a=r(6927),o=r(15057),s=r(64375),l=r(42215),u=r(54268);let c={Uint8Array:"Uint8Array",Int16Array:"Int16Array",Uint16Array:"Uint16Array",Float32Array:"Float32Array"};function d(e,t){let r=(0,i.A)(e),{ImageOrientationPatient:d,PixelSpacing:p,Columns:m,Rows:h}=r,f=n.fA(d[0],d[1],d[2]),g=n.fA(d[3],d[4],d[5]),v=n.vt();n.$A(v,f,g);let{zSpacing:y,origin:b,sortedImageIds:I}=(0,a.A)(e,v),x=e.length,C=[p[1],p[0],y],A=[m,h,x].map(e=>Math.floor(e)),T=[...f,...g,...v];return{dimensions:A,spacing:C,origin:b,dataType:function(e,t){let{BitsAllocated:r,PixelRepresentation:n}=t,i=1===n,a=function(e){let t=[0,Math.floor(e.length/2),e.length-1].map(t=>u.Ay.getImage(e[t]));if(!t.every(Boolean))return null;let r=t[0].getPixelData().constructor.name;return t.every(e=>e.getPixelData().constructor.name===r)&&r in c?c[r]:null}(e);if(a)return a;let[d,p,m]=[0,Math.floor(e.length/2),e.length-1],h=[d,p,m].map(t=>(0,o.A)(e[t])),f=h.some(e=>e.rescaleIntercept<0||e.rescaleSlope<0),g=h.some(e=>(0,s.a)(e)),v=(0,l.lk)();switch(r){case 8:case 24:return"Uint8Array";case 16:if(v&&g)return"Float32Array";if(i||f)return"Int16Array";if(!i&&!f)return"Uint16Array";return"Float32Array";case 32:return"Float32Array";case 64:return"Float64Array";default:throw Error(`Bits allocated of ${r} is not defined to generate scalarData for the volume.`)}}(I,r),direction:T,metadata:r,imageIds:I,volumeId:t,voxelManager:null,numberOfComponents:"RGB"===r.PhotometricInterpretation?3:1}}},32897:(e,t,r)=>{"use strict";function n(e){let t=e.length,r=0,n=t-1;for(let i=0;in})},32916:(e,t,r)=>{"use strict";r.d(t,{A:()=>h});var n=r(13032),i=r(76879),a=r(3922),o=r(69228),s=r(35881),l=r(72661),u=r(36195),c=r(88856),d=r(8605),p=r(42684);class m extends n.A{constructor(e){super(e),this._renderFlaggedViewports=()=>{this._throwIfDestroyed(),this.offscreenMultiRenderWindow&&this.performVtkDrawCall();let e=this._getViewportsAsArray(),t=[];for(let r=0;r{e?.element&&(0,o.A)(e.element,i.A.IMAGE_RENDERED,e)})},this.useCPURendering||this.ensureOffscreenResources()}ensureOffscreenResources(){this.offscreenMultiRenderWindow||(this.offscreenMultiRenderWindow=u.Ig.newInstance(),this.offScreenCanvasContainer=document.createElement("div"),this.offscreenMultiRenderWindow.setContainer(this.offScreenCanvasContainer),(0,c.V)(this.offscreenMultiRenderWindow,this.id))}enableVTKjsDrivenViewport(e){this.ensureOffscreenResources();let t=this._getViewportsAsArray().filter(e=>!1===(0,s.A)(e.type)),r=t.map(e=>e.canvas),n=(0,l.Ay)(e.element);r.push(n);let{offScreenCanvasWidth:i,offScreenCanvasHeight:a}=this._resizeOffScreenCanvas(r),o=this._resize(t,i,a),u={...e,canvas:n};this.addVtkjsDrivenViewport(u,{offScreenCanvasWidth:i,offScreenCanvasHeight:a,xOffset:o})}addVtkjsDrivenViewport(e,t){this.ensureOffscreenResources();let{element:r,canvas:n,viewportId:s,type:l,defaultOptions:u}=e;r.tabIndex=-1,(0,d.u)(r);let{offScreenCanvasWidth:c,offScreenCanvasHeight:m,xOffset:h}=t,{sxStartDisplayCoords:f,syStartDisplayCoords:g,sxEndDisplayCoords:v,syEndDisplayCoords:y,sx:b,sy:I,sWidth:x,sHeight:C}=this._getViewportCoordsOnOffScreenCanvas(e,c,m,h);this.offscreenMultiRenderWindow.addRenderer({viewport:[f,g,v,y],id:s,background:u.background?u.background:[0,0,0]});let A={id:s,element:r,renderingEngineId:this.id,type:l,canvas:n,sx:b,sy:I,sWidth:x,sHeight:C,defaultOptions:u||{}},T=(0,p.aZ)(e);if(!T)throw Error(`Viewport Type ${l} is not supported`);let S=new T(A);S.requestedType=e.requestedType??l,this._viewports.set(s,S);let w={element:r,viewportId:s,renderingEngineId:this.id};S.suppressEvents||(0,o.A)(a.A,i.A.ELEMENT_ENABLED,w)}setVtkjsDrivenViewports(e){if(e.length){let t=e.map(e=>(0,l.Ay)(e.element));t.forEach(e=>{let t=window.devicePixelRatio||1,r=e.getBoundingClientRect();e.width=r.width*t,e.height=r.height*t});let{offScreenCanvasWidth:r,offScreenCanvasHeight:n}=this._resizeOffScreenCanvas(t),i=0;for(let a=0;a(0,l.Ay)(e.element));if(n.forEach(e=>{let t=window.devicePixelRatio||1;e.width=e.clientWidth*t,e.height=e.clientHeight*t}),n.length){let{offScreenCanvasWidth:t,offScreenCanvasHeight:r}=this._resizeOffScreenCanvas(n);this._resize(e,t,r)}e.forEach(e=>{let r=e.getCamera(),n=e.getRotation(),{flipHorizontal:i}=r;e.resetViewStateForResize?e.resetViewStateForResize():e.resetCameraForResize();let a=e.getDisplayArea();t&&(a?(i&&e.setCamera({flipHorizontal:i}),n&&e.setViewPresentation({rotation:n})):e.setCamera(r))}),r&&this.render()}performVtkDrawCall(){let{offscreenMultiRenderWindow:e}=this,t=e.getRenderWindow(),r=e.getRenderers();if(r.length){for(let e=0;ee.height)),i=0;return e.forEach(e=>{i+=e.width}),t.width=i,t.height=n,r.resize(),{offScreenCanvasWidth:i,offScreenCanvasHeight:n}}_resize(e,t,r){let n=0;for(let i=0;i{"use strict";var n;r.d(t,{A:()=>a});let{BlendMode:i}=r(23985).A;!function(e){e[e.COMPOSITE=i.COMPOSITE_BLEND]="COMPOSITE",e[e.MAXIMUM_INTENSITY_BLEND=i.MAXIMUM_INTENSITY_BLEND]="MAXIMUM_INTENSITY_BLEND",e[e.MINIMUM_INTENSITY_BLEND=i.MINIMUM_INTENSITY_BLEND]="MINIMUM_INTENSITY_BLEND",e[e.AVERAGE_INTENSITY_BLEND=i.AVERAGE_INTENSITY_BLEND]="AVERAGE_INTENSITY_BLEND",e[e.LABELMAP_EDGE_PROJECTION_BLEND=i.LABELMAP_EDGE_PROJECTION_BLEND]="LABELMAP_EDGE_PROJECTION_BLEND"}(n||(n={}));let a=n},33235:function(e,t,r){var n;!function(e,i,a){function o(e){var t=this,r="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^(e^e<<1))|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:r+=e;for(var n=0;n>>4),t.next()}function s(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function l(e,t){var r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/0x100000000};return i.double=function(){do var e=((r.next()>>>11)+(r.next()>>>0)/0x100000000)/2097152;while(0===e);return e},i.int32=r.next,i.quick=i,n&&("object"==typeof n&&s(n,r),i.state=function(){return s(r,{})}),i}i&&i.exports?i.exports=l:r.amdD&&r.amdO?void 0===(n=(function(){return l}).call(t,r,t,i))||(i.exports=n):this.xorwow=l}(0,e=r.nmd(e),r.amdD)},33308:(e,t,r)=>{"use strict";function n(e){if(e)return{lower:e.lower,upper:e.upper}}function i(e){return!!(e&&"object"==typeof e&&"viewPlaneNormal"in e)}function a(e,t){let[r,n,i]=e||[],a=Math.hypot(r,n,i);if(!Number.isFinite(r)||!Number.isFinite(n)||!Number.isFinite(i)||a<1e-6)throw Error(`[PlanarViewport] Invalid orientation vector ${t}. Expected a finite non-zero Point3.`);return[r/a,n/a,i/a]}function o(e){if(!i(e))return e;let t={viewPlaneNormal:a(e.viewPlaneNormal,"viewPlaneNormal")};if(e.viewUp&&(t.viewUp=a(e.viewUp,"viewUp"),Math.abs(t.viewPlaneNormal[0]*t.viewUp[0]+t.viewPlaneNormal[1]*t.viewUp[1]+t.viewPlaneNormal[2]*t.viewUp[2])>.001))throw Error("[PlanarViewport] Invalid orientation vectors. viewPlaneNormal and viewUp must be orthogonal.");return t}function s(e){var t;if(!e)return;let r={};void 0!==e.name&&(r.name=e.name);let n=Array.isArray(t=e.opacity)?t.map(({opacity:e,value:t})=>({opacity:e,value:t})):t;return void 0!==n&&(r.opacity=n),void 0!==e.threshold&&(r.threshold=e.threshold),r}function l(e={}){let t=Object.assign({},e);return e.voiRange&&(t.voiRange=n(e.voiRange)),e.colormap&&(t.colormap=s(e.colormap)),void 0!==e.orientation&&(t.orientation=o(e.orientation)),t}function u(e={},t={}){let r=l(e),n=l(t),i=Object.assign({},r);return Object.assign(i,n),n.colormap&&(i.colormap=function(e,t){if(!t)return s(e);if(void 0!==t.name)return s(t);let r=s(e)||{},n=s(t);return n&&Object.assign(r,n),r}(r.colormap,n.colormap)),i}function c(e={}){let t={};return e.colormap&&(t.colormap=s(e.colormap)),e.voiRange&&(t.voiRange=n(e.voiRange)),void 0!==e.invert&&(t.invert=e.invert),void 0!==e.blendMode&&(t.blendMode=e.blendMode),void 0!==e.interpolationType&&(t.interpolationType=e.interpolationType),void 0!==e.opacity&&(t.opacity=e.opacity),void 0!==e.slabThickness&&(t.slabThickness=e.slabThickness),void 0!==e.visible&&(t.visible=e.visible),t}r.d(t,{GY:()=>l,MV:()=>o,V7:()=>i,kv:()=>c,te:()=>u})},33513:(e,t,r)=>{"use strict";function n(e,t){let{center:r,radius:n}=e,i=e.radius2||n*n;return(t[0]-r[0])*(t[0]-r[0])+(t[1]-r[1])*(t[1]-r[1])+(t[2]-r[2])*(t[2]-r[2])<=i}r.d(t,{A:()=>n})},33620:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XMLBuilderCBImpl=void 0;let n=r(92539),i=r(16950),a=r(68107),o=r(47518),s=r(57226),l=r(30118),u=r(94489),c=r(79663),d=r(77349),p=r(6342),m=r(29107),h=r(65240);class f extends h.EventEmitter{static _VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]);_options;_builderOptions;_writer;_fragment;_hasDeclaration=!1;_docTypeName="";_hasDocumentElement=!1;_currentElement;_currentElementSerialized=!1;_openTags=[];_prefixMap;_prefixIndex;_ended=!1;constructor(e,t=!1){super(),this._fragment=t,this._options=(0,i.applyDefaults)(e||{},n.DefaultXMLBuilderCBOptions),this._builderOptions={defaultNamespace:this._options.defaultNamespace,namespaceAlias:this._options.namespaceAlias},"json"===this._options.format?this._writer=new p.JSONCBWriter(this._options):"yaml"===this._options.format?this._writer=new m.YAMLCBWriter(this._options):this._writer=new d.XMLCBWriter(this._options),void 0!==this._options.data&&this.on("data",this._options.data),void 0!==this._options.end&&this.on("end",this._options.end),void 0!==this._options.error&&this.on("error",this._options.error),this._prefixMap=new l.NamespacePrefixMap,this._prefixMap.set("xml",s.namespace.XML),this._prefixIndex={value:1},this._push(this._writer.frontMatter())}ele(e,t,r){if((0,i.isObject)(e)||(0,i.isString)(e)&&(/^\s*/g,">");this._push(this._writer.text(r));let n=this._openTags[this._openTags.length-1];return n&&(n[n.length-1]=!0),this}ins(e,t=""){let r;this._serializeOpenTag(!0);try{r=(0,a.fragment)(this._builderOptions).ins(e,t).first().node}catch(e){return this.emit("error",e),this}return this._options.wellFormed&&(-1!==r.target.indexOf(":")||/^xml$/i.test(r.target))?this.emit("error",Error("Processing instruction target contains invalid characters (well-formed required).")):this._options.wellFormed&&!(0,o.xml_isLegalChar)(r.data)?this.emit("error",Error("Processing instruction data contains invalid characters (well-formed required).")):this._push(this._writer.instruction(r.target,r.data)),this}dat(e){let t;this._serializeOpenTag(!0);try{t=(0,a.fragment)(this._builderOptions).dat(e).first().node}catch(e){return this.emit("error",e),this}return this._push(this._writer.cdata(t.data)),this}dec(e={version:"1.0"}){return this._fragment?this.emit("error",Error("Cannot insert an XML declaration into a document fragment.")):this._hasDeclaration?this.emit("error",Error("XML declaration is already inserted.")):(this._push(this._writer.declaration(e.version||"1.0",e.encoding,e.standalone)),this._hasDeclaration=!0),this}dtd(e){let t;if(this._fragment)return this.emit("error",Error("Cannot insert a DocType declaration into a document fragment.")),this;if(""!==this._docTypeName)return this.emit("error",Error("DocType declaration is already inserted.")),this;if(this._hasDocumentElement)return this.emit("error",Error("Cannot insert DocType declaration after document element.")),this;try{t=(0,a.create)().dtd(e).first().node}catch(e){return this.emit("error",e),this}return this._options.wellFormed&&!(0,o.xml_isPubidChar)(t.publicId)?this.emit("error",Error("DocType public identifier does not match PubidChar construct (well-formed required).")):this._options.wellFormed&&(!(0,o.xml_isLegalChar)(t.systemId)||-1!==t.systemId.indexOf('"')&&-1!==t.systemId.indexOf("'"))?this.emit("error",Error("DocType system identifier contains invalid characters (well-formed required).")):(this._docTypeName=e.name,this._push(this._writer.docType(e.name,t.publicId,t.systemId))),this}import(e){let t=(0,a.fragment)().set(this._options);try{t.import(e)}catch(e){return this.emit("error",e),this}for(let e of t.node.childNodes)this._fromNode(e);return this}up(){return this._serializeOpenTag(!1),this._serializeCloseTag(),this}end(){for(this._serializeOpenTag(!1);this._openTags.length>0;)this._serializeCloseTag();return this._push(null),this}_serializeOpenTag(e){if(this._currentElementSerialized||void 0===this._currentElement)return;let t=this._currentElement.node;if(this._options.wellFormed&&(-1!==t.localName.indexOf(":")||!(0,o.xml_isName)(t.localName)))return void this.emit("error",Error("Node local name contains invalid characters (well-formed required)."));let r="",n=!1,i=this._prefixMap.copy(),a={},l=this._recordNamespaceInformation(t,i,a),u=0===this._openTags.length?null:this._openTags[this._openTags.length-1][1],c=t.namespaceURI;if(null===c&&(c=u),u===c)null!==l&&(n=!0),r=c===s.namespace.XML?"xml:"+t.localName:t.localName,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r));else{let e=t.prefix,o=null;if((null!==e||c!==l)&&(o=i.get(e,c)),"xmlns"===e){if(this._options.wellFormed)return void this.emit("error",Error("An element cannot have the 'xmlns' prefix (well-formed required)."));o=e}null!==o?(r=o+":"+t.localName,null!==l&&l!==s.namespace.XML&&(u=l||null),this._writer.beginElement(r),this._push(this._writer.openTagBegin(r))):null!==e?(e in a&&(e=this._generatePrefix(c,i,this._prefixIndex)),i.set(e,c),r+=e+":"+t.localName,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)),this._push(this._writer.attribute("xmlns:"+e,this._serializeAttributeValue(c,this._options.wellFormed))),null!==l&&(u=l||null)):null===l||null!==l&&l!==c?(n=!0,r+=t.localName,u=c,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)),this._push(this._writer.attribute("xmlns",this._serializeAttributeValue(c,this._options.wellFormed)))):(r+=t.localName,u=c,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)))}this._serializeAttributes(t,i,this._prefixIndex,a,n,this._options.wellFormed);let d=c===s.namespace.HTML;d&&!e&&f._VoidElementNames.has(t.localName)?(this._push(this._writer.openTagEnd(r,!0,!0)),this._writer.endElement(r)):d||e?this._push(this._writer.openTagEnd(r,!1,!1)):(this._push(this._writer.openTagEnd(r,!0,!1)),this._writer.endElement(r)),this._currentElementSerialized=!0,this._openTags.push([r,u,this._prefixMap,e,void 0]),this._isPrefixMapModified(this._prefixMap,i)&&(this._prefixMap=i),this._writer.level++}_serializeCloseTag(){this._writer.level--;let e=this._openTags.pop();if(void 0===e)return void this.emit("error",Error("Last element is undefined."));let[t,r,n,i,a]=e;this._prefixMap=n,i&&(this._push(this._writer.closeTag(t,a)),this._writer.endElement(t))}_push(e){null===e?(this._ended=!0,this.emit("end")):this._ended?this.emit("error",Error("Cannot push to ended stream.")):0!==e.length&&(this._writer.hasData=!0,this.emit("data",e,this._writer.level))}_fromNode(e){if(c.Guard.isElementNode(e)){let t=e.prefix?e.prefix+":"+e.localName:e.localName;for(let r of(null!==e.namespaceURI?this.ele(e.namespaceURI,t):this.ele(t),e.attributes)){let e=r.prefix?r.prefix+":"+r.localName:r.localName;null!==r.namespaceURI?this.att(r.namespaceURI,e,r.value):this.att(e,r.value)}for(let t of e.childNodes)this._fromNode(t);this.up()}else c.Guard.isExclusiveTextNode(e)&&e.data?this.txt(e.data):c.Guard.isCommentNode(e)?this.com(e.data):c.Guard.isCDATASectionNode(e)?this.dat(e.data):c.Guard.isProcessingInstructionNode(e)&&this.ins(e.target,e.data)}_serializeAttributes(e,t,r,n,i,a){let l=a?new u.LocalNameSet:void 0;for(let u of e.attributes){if(!a&&!i&&null===u.namespaceURI){this._push(this._writer.attribute(u.localName,this._serializeAttributeValue(u.value,this._options.wellFormed)));continue}if(a&&l&&l.has(u.namespaceURI,u.localName))return void this.emit("error",Error("Element contains duplicate attributes (well-formed required)."));a&&l&&l.set(u.namespaceURI,u.localName);let e=u.namespaceURI,c=null;if(null!==e)if(c=t.get(u.prefix,e),e===s.namespace.XMLNS){if(u.value===s.namespace.XML||null===u.prefix&&i||null!==u.prefix&&(!(u.localName in n)||n[u.localName]!==u.value)&&t.has(u.localName,u.value))continue;if(a&&u.value===s.namespace.XMLNS)return void this.emit("error",Error("XMLNS namespace is reserved (well-formed required)."));if(a&&""===u.value)return void this.emit("error",Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required)."));"xmlns"===u.prefix&&(c="xmlns")}else null===c&&(c=null!==u.prefix&&(!t.hasPrefix(u.prefix)||t.has(u.prefix,e))?u.prefix:this._generatePrefix(e,t,r),this._push(this._writer.attribute("xmlns:"+c,this._serializeAttributeValue(e,this._options.wellFormed))));if(a&&(-1!==u.localName.indexOf(":")||!(0,o.xml_isName)(u.localName)||"xmlns"===u.localName&&null===e))return void this.emit("error",Error("Attribute local name contains invalid characters (well-formed required)."));this._push(this._writer.attribute((null!==c?c+":":"")+u.localName,this._serializeAttributeValue(u.value,this._options.wellFormed)))}}_serializeAttributeValue(e,t){return t&&null!==e&&!(0,o.xml_isLegalChar)(e)?(this.emit("error",Error("Invalid characters in attribute value.")),""):null===e?"":e.replace(/(?!&(lt|gt|amp|apos|quot);)&/g,"&").replace(//g,">").replace(/"/g,""")}_recordNamespaceInformation(e,t,r){let n=null;for(let i of e.attributes){let e=i.namespaceURI,a=i.prefix;if(e===s.namespace.XMLNS)if(null===a){n=i.value;continue}else{let e=i.localName,n=i.value;if(n===s.namespace.XML||(""===n&&(n=null),t.has(e,n)))continue;t.set(e,n),r[e]=n||""}}return n}_generatePrefix(e,t,r){let n="ns"+r.value;return r.value++,t.set(n,e),n}_isPrefixMapModified(e,t){let r=e._items,n=t._items,i=e._nullItems,a=t._nullItems;for(let e in n){let t=r[e];if(void 0===t)return!0;let i=n[e];if(t.length!==i.length)return!0;for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JSONWriter=void 0;let n=r(22706),i=r(16950),a=r(81320);class o extends a.BaseWriter{constructor(e,t){super(e),this._writerOptions=(0,i.applyDefaults)(t,{wellFormed:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,group:!1,verbose:!1})}serialize(e){let t=(0,i.applyDefaults)(this._writerOptions,{format:"object",wellFormed:!1}),r=new n.ObjectWriter(this._builderOptions,t).serialize(e);return this._beginLine(this._writerOptions,0)+this._convertObject(r,this._writerOptions)}_convertObject(e,t,r=0){let n="",a=this._isLeafNode(e);if((0,i.isArray)(e)){n+="[";let i=e.length,a=0;for(let o of e)n+=this._endLine(t,r+1)+this._beginLine(t,r+1)+this._convertObject(o,t,r+1),a{a&&t.prettyPrint?n+=" ":n+=this._endLine(t,r+1)+this._beginLine(t,r+1),n+=this._key(e),t.prettyPrint&&(n+=" "),n+=this._convertObject(i,t,r+1),s0)return Array(r).join(e.indent)}return""}_endLine(e,t){return e.prettyPrint?e.newline:""}_key(e){return'"'+e+'":'}_val(e){return JSON.stringify(e)}_isLeafNode(e){return 1>=this._descendantCount(e)}_descendantCount(e,t=0){return(0,i.isArray)(e)?(0,i.forEachArray)(e,e=>t+=this._descendantCount(e,t),this):(0,i.isObject)(e)?(0,i.forEachObject)(e,(e,r)=>t+=this._descendantCount(r,t),this):t++,t}}t.JSONWriter=o},34355:(e,t,r)=>{"use strict";r(70192),r(4546),r(33845),r(74065),r(93022),r(36965),r(76818),r(34699),r(60212),r(34470),r(69548),r(42018)},34533:(e,t,r)=>{"use strict";e.exports=r(91180)},34590:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.push=function(e,t){e.push(t)},t.pop=function(e){return e.pop()||null}},34693:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let n={MINIMUM_SLAB_THICKNESS:.05,MAXIMUM_RAY_DISTANCE:1e6};Object.freeze(n);let i=n},34699:(e,t,r)=>{"use strict";r.r(t),r.d(t,{triggerAnnotationAddedForElement:()=>o,triggerAnnotationAddedForFOR:()=>s,triggerAnnotationCompleted:()=>c,triggerAnnotationModified:()=>u,triggerAnnotationRemoved:()=>l,triggerContourAnnotationCompleted:()=>d});var n=r(70192),i=r(78378),a=r(42306);function o(e,t){let{renderingEngine:r,viewportId:a}=(0,n.kJ)(t),o=i.sV.ANNOTATION_ADDED,s={annotation:e,viewportId:a,renderingEngineId:r.id};(0,n.Hl)(n.tX,o,s)}function s(e){let{toolName:t}=e.metadata,r=(0,a.getToolGroupsWithToolName)(t);if(!r.length)return;let o=[];r.forEach(t=>{t.viewportsInfo.forEach(t=>{let{renderingEngineId:r,viewportId:i}=t,{FrameOfReferenceUID:a}=(0,n.b1)(i,r);e.metadata.FrameOfReferenceUID===a&&o.push(t)})});let s=i.sV.ANNOTATION_ADDED,l={annotation:e};if(!o.length)return void(0,n.Hl)(n.tX,s,l);o.forEach(({renderingEngineId:e,viewportId:t})=>{l.viewportId=t,l.renderingEngineId=e,(0,n.Hl)(n.tX,s,l)})}function l(e){let t=i.sV.ANNOTATION_REMOVED;(0,n.Hl)(n.tX,t,e)}function u(e,t,r=i.wi.HandlesUpdated){let{viewportId:a,renderingEngineId:o}=t&&(0,n.kJ)(t)||{},s=i.sV.ANNOTATION_MODIFIED;(0,n.Hl)(n.tX,s,{annotation:e,viewportId:a,renderingEngineId:o,changeType:r})}function c(e){p({annotation:e})}function d(e,t=!1){p({annotation:e,contourHoleProcessingEnabled:t})}function p(e){let t=i.sV.ANNOTATION_COMPLETED;(0,n.Hl)(n.tX,t,e)}},34839:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>I});var n=r(17042),i=r(73543),a=r(68916),o=r(87352),s=r(70125),l=r(61052),u=r(9731),c=r(78744),d=r(86077),{Representation:p}=s.Ay,{vtkErrorMacro:m}=n.Ay;function h(e){e.Fragment=u.A.substitute(e.Fragment,"//VTK::RenderPassFragmentShader::Impl",` + float weight = gl_FragData[0].a * pow(max(1.1 - gl_FragCoord.z, 0.0), 2.0); + gl_FragData[0] = vec4(gl_FragData[0].rgb*weight, gl_FragData[0].a); + gl_FragData[1].r = weight; + `,!1).result}var f=`//VTK::System::Dec + +in vec2 tcoord; + +uniform sampler2D translucentRTexture; +uniform sampler2D translucentRGBATexture; + +// the output of this shader +//VTK::Output::Dec + +void main() +{ + vec4 t1Color = texture(translucentRGBATexture, tcoord); + float t2Color = texture(translucentRTexture, tcoord).r; + gl_FragData[0] = vec4(t1Color.rgb/max(t2Color,0.01), 1.0 - t1Color.a); +} +`,g={framebuffer:null,copyShader:null,tris:null},v={newInstance:n.Ay.newInstance(function(e,t,r={}){Object.assign(t,g,r),a.Ay.extend(e,t,r),t.VBOBuildTime={},n.Ay.obj(t.VBOBuildTime,{mtime:0}),t.tris=d.Ay.newInstance(),n.Ay.get(e,t,["framebuffer"]),t.classHierarchy.push("vtkOpenGLOrderIndependentTranslucentPass"),e.createVertexBuffer=()=>{let e=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1]),r=new Float32Array([0,0,1,0,0,1,1,1]),n=new Uint16Array([4,0,1,3,2]),i=o.Ay.newInstance({numberOfComponents:3,values:e});i.setName("points");let a=o.Ay.newInstance({numberOfComponents:2,values:r});a.setName("tcoords");let s=o.Ay.newInstance({numberOfComponents:1,values:n});t.tris.getCABO().createVBO(s,"polys",p.SURFACE,{points:i,tcoords:a,cellOffset:0}),t.VBOBuildTime.modified()},e.createFramebuffer=e=>{let r=e.getSize(),n=e.getContext();t.framebuffer=i.Ay.newInstance(),t.framebuffer.setOpenGLRenderWindow(e),t.framebuffer.create(...r),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind(),t.translucentRGBATexture=l.Ay.newInstance(),t.translucentRGBATexture.setInternalFormat(n.RGBA16F),t.translucentRGBATexture.setFormat(n.RGBA),t.translucentRGBATexture.setOpenGLDataType(n.HALF_FLOAT),t.translucentRGBATexture.setOpenGLRenderWindow(e),t.translucentRGBATexture.create2DFromRaw({width:r[0],height:r[1],numComps:4,dataType:"Float32Array",data:null}),t.translucentRTexture=l.Ay.newInstance(),t.translucentRTexture.setInternalFormat(n.R16F),t.translucentRTexture.setFormat(n.RED),t.translucentRTexture.setOpenGLDataType(n.HALF_FLOAT),t.translucentRTexture.setOpenGLRenderWindow(e),t.translucentRTexture.create2DFromRaw({width:r[0],height:r[1],numComps:1,dataType:"Float32Array",data:null}),t.translucentZTexture=l.Ay.newInstance(),t.translucentZTexture.setOpenGLRenderWindow(e),t.translucentZTexture.createDepthFromRaw({width:r[0],height:r[1],dataType:"Float32Array",data:null}),t.framebuffer.setColorBuffer(t.translucentRGBATexture,0),t.framebuffer.setColorBuffer(t.translucentRTexture,1),t.framebuffer.setDepthBuffer(t.translucentZTexture)},e.createCopyShader=e=>{t.copyShader=e.getShaderCache().readyShaderProgramArray("//VTK::System::Dec\nattribute vec4 vertexDC;\nattribute vec2 tcoordTC;\nvarying vec2 tcoord;\nvoid main() { tcoord = tcoordTC; gl_Position = vertexDC; }",f,"")},e.createVBO=r=>{let n=r.getContext();t.tris.setOpenGLRenderWindow(r),e.createVertexBuffer();let i=t.copyShader;t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(i,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),n.FLOAT,3,n.FALSE)||m("Error setting vertexDC in copy shader VAO."),t.copyVAO.addAttributeArray(i,t.tris.getCABO(),"tcoordTC",t.tris.getCABO().getTCoordOffset(),t.tris.getCABO().getStride(),n.FLOAT,2,n.FALSE)||m("Error setting vertexDC in copy shader VAO.")},e.traverse=(r,n,i)=>{if(t.deleted)return;let a=r.getSize(),o=r.getContext();if(t._supported=!1,n.getSelector()||!o||!r.getWebgl2()||!o.getExtension("EXT_color_buffer_half_float")&&!o.getExtension("EXT_color_buffer_float")){e.setCurrentOperation("translucentPass"),n.traverse(e);return}if(t._supported=!0,null===t.framebuffer)e.createFramebuffer(r);else{let n=t.framebuffer.getSize();null===n||n[0]!==a[0]||n[1]!==a[1]?(t.framebuffer.releaseGraphicsResources(),t.translucentRGBATexture.releaseGraphicsResources(r),t.translucentRTexture.releaseGraphicsResources(r),t.translucentZTexture.releaseGraphicsResources(r),e.createFramebuffer(r)):(t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind())}o.drawBuffers([o.COLOR_ATTACHMENT0]),o.clearBufferfv(o.COLOR,0,[0,0,0,0]),o.clearBufferfv(o.DEPTH,0,[1]),o.colorMask(!1,!1,!1,!1),i.getOpaqueActorCount()>0&&(i.setCurrentOperation("opaqueZBufferPass"),n.traverse(i)),o.colorMask(!0,!0,!0,!0),o.drawBuffers([o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1]),o.viewport(0,0,a[0],a[1]),o.scissor(0,0,a[0],a[1]),o.clearBufferfv(o.COLOR,0,[0,0,0,1]),o.clearBufferfv(o.COLOR,1,[0,0,0,0]),o.enable(o.DEPTH_TEST),o.enable(o.BLEND),o.blendFuncSeparate(o.ONE,o.ONE,o.ZERO,o.ONE_MINUS_SRC_ALPHA),e.setCurrentOperation("translucentPass"),n.traverse(e),o.drawBuffers([o.NONE]),t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader?e.createCopyShader(r):r.getShaderCache().readyShaderProgram(t.copyShader),t.copyVAO||(t.copyVAO=c.Ay.newInstance(),t.copyVAO.setOpenGLRenderWindow(r)),t.copyVAO.bind(),t.VBOBuildTime.getMTime()t._supported?h:null,e.releaseGraphicsResources=r=>{t.framebuffer&&(t.framebuffer.releaseGraphicsResources(r),t.framebuffer=null),t.translucentRGBATexture&&(t.translucentRGBATexture.releaseGraphicsResources(r),t.translucentRGBATexture=null),t.translucentRTexture&&(t.translucentRTexture.releaseGraphicsResources(r),t.translucentRTexture=null),t.translucentZTexture&&(t.translucentZTexture.releaseGraphicsResources(r),t.translucentZTexture=null),t.copyVAO&&(t.copyVAO.releaseGraphicsResources(r),t.copyVAO=null),t.copyShader&&(t.copyShader.releaseGraphicsResources(r),t.copyShader=null),t.tris&&(t.tris.releaseGraphicsResources(r),t.tris=null),e.modified()}},"vtkOpenGLOrderIndependentTranslucentPass")},y={opaqueActorCount:0,translucentActorCount:0,volumeCount:0,overlayActorCount:0,framebuffer:null,depthRequested:!1};function b(e,t,r={}){Object.assign(t,y,r),a.Ay.extend(e,t,r),n.Ay.get(e,t,["framebuffer","opaqueActorCount","translucentActorCount","volumeCount"]),t.classHierarchy.push("vtkForwardPass"),e.traverse=(r,n=null)=>{if(t.deleted)return;t._currentParent=n,e.setCurrentOperation("buildPass"),r.traverse(e);let a=r.getRenderable().getNumberOfLayers(),o=r.getRenderable().getRenderersByReference();for(let n=0;n0||t.translucentActorCount>0)&&t.volumeCount>0||t.depthRequested){let n=r.getFramebufferSize();null===t.framebuffer&&(t.framebuffer=i.Ay.newInstance()),t.framebuffer.setOpenGLRenderWindow(r),t.framebuffer.saveCurrentBindingsAndBuffers();let a=t.framebuffer.getSize();(null===a||a[0]!==n[0]||a[1]!==n[1])&&(t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer()),t.framebuffer.bind(),e.setCurrentOperation("zBufferPass"),l.traverse(e),t.framebuffer.restorePreviousBindingsAndBuffers(),t.depthRequested=!1}e.setCurrentOperation("cameraPass"),l.traverse(e),t.opaqueActorCount>0&&(e.setCurrentOperation("opaquePass"),l.traverse(e)),t.translucentActorCount>0&&(t.translucentPass||(t.translucentPass=v.newInstance()),t.translucentPass.traverse(r,l,e)),t.volumeCount>0&&(e.setCurrentOperation("volumePass"),l.traverse(e)),t.overlayActorCount>0&&(e.setCurrentOperation("overlayPass"),l.traverse(e))}}},e.getZBufferTexture=()=>t.framebuffer?t.framebuffer.getColorTexture():null,e.requestDepth=()=>{t.depthRequested=!0},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.incrementVolumeCount=()=>t.volumeCount++,e.incrementOverlayActorCount=()=>t.overlayActorCount++}var I={newInstance:n.Ay.newInstance(b,"vtkForwardPass"),extend:b}},34967:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>u});var n=r(17042),i={CoordinateSystem:{DISPLAY:0,WORLD:1}},{CoordinateSystem:a}=i;function o(e){return()=>n.Ay.vtkErrorMacro(`vtkProp::${e} - NOT IMPLEMENTED`)}var s={allocatedRenderTime:10,coordinateSystem:a.WORLD,dragable:!0,estimatedRenderTime:0,paths:null,pickable:!0,renderTimeMultiplier:1,savedEstimatedRenderTime:0,textures:[],useBounds:!0,visibility:!0};function l(e,t,r={}){Object.assign(t,s,r),n.Ay.obj(e,t),n.Ay.get(e,t,["estimatedRenderTime","allocatedRenderTime"]),n.Ay.setGet(e,t,["_parentProp","coordinateSystem","dragable","pickable","renderTimeMultiplier","useBounds","visibility"]),n.Ay.moveToProtected(e,t,["parentProp"]),t.classHierarchy.push("vtkProp"),e.getMTime=()=>{let e=t.mtime;for(let r=0;re&&(e=n)}return e},e.processSelectorPixelBuffers=(e,t)=>{},e.getNestedProps=()=>null,e.getActors=()=>[],e.getActors2D=()=>[],e.getVolumes=()=>[],e.pick=o("pick"),e.hasKey=o("hasKey"),e.getNestedVisibility=()=>t.visibility&&(!t._parentProp||t._parentProp.getNestedVisibility()),e.getNestedPickable=()=>t.pickable&&(!t._parentProp||t._parentProp.getNestedPickable()),e.getNestedDragable=()=>t.dragable&&(!t._parentProp||t._parentProp.getNestedDragable()),e.getRedrawMTime=()=>t.mtime,e.setEstimatedRenderTime=e=>{t.estimatedRenderTime=e,t.savedEstimatedRenderTime=e},e.restoreEstimatedRenderTime=()=>{t.estimatedRenderTime=t.savedEstimatedRenderTime},e.addEstimatedRenderTime=e=>{t.estimatedRenderTime+=e},e.setAllocatedRenderTime=e=>{t.allocatedRenderTime=e,t.savedEstimatedRenderTime=t.estimatedRenderTime,t.estimatedRenderTime=0},e.getSupportsSelection=()=>!1,e.getTextures=()=>t.textures,e.hasTexture=e=>-1!==t.textures.indexOf(e),e.addTexture=r=>{r&&!e.hasTexture(r)&&(t.textures=t.textures.concat(r),e.modified())},e.removeTexture=r=>{let n=t.textures.filter(e=>e!==r);t.textures.length!==n.length&&(t.textures=n,e.modified())},e.removeAllTextures=()=>{t.textures=[],e.modified()},e.setCoordinateSystemToWorld=()=>e.setCoordinateSystem(a.WORLD),e.setCoordinateSystemToDisplay=()=>e.setCoordinateSystem(a.DISPLAY)}var u={newInstance:n.Ay.newInstance(l,"vtkProp"),extend:l,...i}},34976:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventTargetImpl=void 0;let n=r(32008),i=r(79663),a=r(47518);class o{__eventListenerList;get _eventListenerList(){return this.__eventListenerList||(this.__eventListenerList=[])}__eventHandlerMap;get _eventHandlerMap(){return this.__eventHandlerMap||(this.__eventHandlerMap={})}constructor(){}addEventListener(e,t,r={passive:!1,once:!1,capture:!1}){let n,[o,s,l]=(0,a.eventTarget_flattenMore)(r);t&&(n=i.Guard.isEventListener(t)?t:{handleEvent:t},(0,a.eventTarget_addEventListener)(this,{type:e,callback:n,capture:o,passive:s,once:l,removed:!1}))}removeEventListener(e,t,r={capture:!1}){let n=(0,a.eventTarget_flatten)(r);if(t)for(let r=0;r{"use strict";r.d(t,{Ay:()=>a,b1:()=>o,yj:()=>s,zb:()=>l});var n=r(16376),i=r(21432);function a(e){if(!e)return;let{viewportUid:t,renderingEngineUid:r}=e.dataset;return o(t,r)}function o(e,t){if(!t||!e)return;let r=(0,n.Ay)(t);if(!r||r.hasBeenDestroyed)return;let a=r.getViewport(e);if(!a)return;let o=(0,i.IU)(a)?a.getFrameOfReferenceUID():void 0;return{viewport:a,renderingEngine:r,viewportId:e,renderingEngineId:t,FrameOfReferenceUID:o}}function s(e){let t=(0,n.qO)();for(let r=0;r{t.getViewports().forEach(({element:t})=>{e.push(a(t))})}),e}},35154:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createCB=function(e){return new n.XMLBuilderCBImpl(e)},t.fragmentCB=function(e){return new n.XMLBuilderCBImpl(e,!0)};let n=r(68497)},35290:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var n=r(50923),i=r(39216),a=r(77280),o=r(42215);function s(e){return void 0!==e.columnPixelSpacing?e.columnPixelSpacing:void 0!==e.rowPixelSpacing?e.rowPixelSpacing:e.pixelSpacing?.[1]!==void 0?e.pixelSpacing[1]:e.pixelSpacing?.[0]!==void 0?e.pixelSpacing[0]:void 0}function l(e){let t,{imagePositionPatient:r,imageOrientationPatient:l}=i.get(a.nb.IMAGE_PLANE,e[0]);if(1===e.length){let{sliceThickness:t,spacingBetweenSlices:r,columnPixelSpacing:n,rowPixelSpacing:o,pixelSpacing:l}=i.get(a.nb.IMAGE_PLANE,e[0]);if(t)return t;if(r)return r;let u=s({columnPixelSpacing:n,rowPixelSpacing:o,pixelSpacing:l});return void 0!==u?u:1}let u=n.fA(l[0],l[1],l[2]),c=n.fA(l[3],l[4],l[5]),d=n.vt();n.$A(d,u,c);let p=n.fA(r[0],r[1],r[2]);if("wadouri"===e[0].split(":")[0]){let r=[e[0],e[Math.floor(e.length/2)]],o=i.get(a.nb.IMAGE_PLANE,r[1]);if(!o)throw Error("Incomplete metadata required for volume construction.");let s=n.vt(),l=n.fA(o.imagePositionPatient[0],o.imagePositionPatient[1],o.imagePositionPatient[2]);n.jb(s,p,l),t=Math.abs(n.Om(s,d))/Math.floor(e.length/2)}else{let r=e.map(e=>({distance:function(e){let{imagePositionPatient:t}=i.get(a.nb.IMAGE_PLANE,e),r=n.vt(),o=n.fA(t[0],t[1],t[2]);return n.jb(r,p,o),n.Om(r,d)}(e),imageId:e}));r.sort((e,t)=>t.distance-e.distance);let o=r.length;t=Math.abs(r[o-1].distance-r[0].distance)/(o-1)}let{sliceThickness:m,spacingBetweenSlices:h,columnPixelSpacing:f,rowPixelSpacing:g,pixelSpacing:v}=i.get(a.nb.IMAGE_PLANE,e[0]),{strictZSpacingForVolumeViewport:y}=(0,o.D0)().rendering;if((0===t||isNaN(t))&&!y)if(h)console.debug("Could not calculate spacing. Using spacingBetweenSlices"),t=h;else if(m)console.debug("Could not calculate spacing and no spacingBetweenSlices. Using sliceThickness"),t=m;else{let e=s({columnPixelSpacing:f,rowPixelSpacing:g,pixelSpacing:v});e?t=e:(console.debug("Could not calculate spacing and no pixel spacing found. Using default thickness (1 mm)"),t=1)}return t}},35508:function(e,t,r){var n;!function(e,i,a){function o(e){var t,r=this,n=(t=0xefc8249d,function(e){e=String(e);for(var r=0;r>>0,n-=t,n*=t,t=n>>>0,n-=t,t+=0x100000000*n}return(t>>>0)*23283064365386963e-26});r.next=function(){var e=2091639*r.s0+23283064365386963e-26*r.c;return r.s0=r.s1,r.s1=r.s2,r.s2=e-(r.c=0|e)},r.c=1,r.s0=n(" "),r.s1=n(" "),r.s2=n(" "),r.s0-=n(e),r.s0<0&&(r.s0+=1),r.s1-=n(e),r.s1<0&&(r.s1+=1),r.s2-=n(e),r.s2<0&&(r.s2+=1)}function s(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function l(e,t){var r=new o(e),n=t&&t.state,i=r.next;return i.int32=function(){return 0x100000000*r.next()|0},i.double=function(){return i()+(2097152*i()|0)*11102230246251565e-32},i.quick=i,n&&("object"==typeof n&&s(n,r),i.state=function(){return s(r,{})}),i}i&&i.exports?i.exports=l:r.amdD&&r.amdO?void 0===(n=(function(){return l}).call(t,r,t,i))||(i.exports=n):this.alea=l}(0,e=r.nmd(e),r.amdD)},35558:(e,t,r)=>{"use strict";r(70192)},35656:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>eo});var n=r(17042),i=r(19047),a=[];a[45]=62,a[95]=63;var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let e=0;e<64;e++)a[o.charCodeAt(e)]=e;function s(e){return void 0!==a[e.charCodeAt(0)]}var l={toArrayBuffer:function(e){let t=function(e){let t=e.length,r=[],n=null;for(let i=0;i>16&255,n[d++]=c>>8&255,n[d++]=255&c}switch(o%4){case 3:for(;!s(e[u]);)u++;for(c=a[e.charCodeAt(u++)]<<10;!s(e[u]);)u++;for(c|=a[e.charCodeAt(u++)]<<4;!s(e[u]);)u++;c|=a[e.charCodeAt(u++)]>>2,n[d++]=c>>8&255,n[d++]=255&c;break;case 2:for(;!s(e[u]);)u++;for(c=a[e.charCodeAt(u++)]<<2;!s(e[u]);)u++;c|=a[e.charCodeAt(u++)]>>4,n[d++]=255&c;break;case 1:throw Error("BASE64: remain 1 should not happen")}return d}(e,t[r],l,o),l+=(4-t[r].count%4)%4;return i}},u=r(87352),c={name:"",numberOfComponents:1,size:0,dataType:"string"},d=n.Ay.newInstance(function(e,t,r={}){if(Object.assign(t,c,r),!t.empty&&!t.values&&!t.size)throw TypeError("Cannot create vtkStringArray object without: size > 0, values");t.values?Array.isArray(t.values)&&(t.values=[...t.values]):t.values=[],t.values&&(t.size=t.values.length),n.Ay.obj(e,t),n.Ay.set(e,t,["name"]),t.classHierarchy.push("vtkStringArray"),e.getComponent=(e,r=0)=>t.values[e*t.numberOfComponents+r],e.setComponent=(r,n,i)=>{i!==t.values[r*t.numberOfComponents+n]&&(t.values[r*t.numberOfComponents+n]=i,e.modified())},e.getData=()=>t.values,e.getTuple=(e,r=[])=>{let n=t.numberOfComponents||1;r.length&&(r.length=n);let i=e*n;for(let e=0;ee*t.numberOfComponents,e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.values.length,e.getNumberOfTuples=()=>t.values.length/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>d({name:t.name,numberOfComponents:t.numberOfComponents,empty:!0}),e.getName=()=>(t.name||e.setName(`vtkStringArray${e.getMTime()}`),t.name),e.setData=(r,n)=>{t.values=r,t.size=r.length,n&&(t.numberOfComponents=n),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.modified()}},"vtkStringArray"),p={newInstance:d},m=r(37216);r(47535);var h=r(46023),f=Uint8Array,g=Uint16Array,v=Uint32Array,y=new f([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),b=new f([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),I=new f([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),x=function(e,t){for(var r=new g(31),n=0;n<31;++n)r[n]=t+=1<>>1|(21845&P)<<1;_=(61680&(_=(52428&_)>>>2|(13107&_)<<2))>>>4|(3855&_)<<4,O[P]=((65280&_)>>>8|(255&_)<<8)>>>1}for(var E=function(e,t,r){for(var n,i=e.length,a=0,o=new g(t);a>>l]=u}else for(a=0,n=new g(i);a>>15-e[a]);return n},D=new f(288),P=0;P<144;++P)D[P]=8;for(var P=144;P<256;++P)D[P]=9;for(var P=256;P<280;++P)D[P]=7;for(var P=280;P<288;++P)D[P]=8;for(var R=new f(32),P=0;P<32;++P)R[P]=5;var M=E(D,9,1),N=E(R,5,1),V=function(e){for(var t=e[0],r=1;rt&&(t=e[r]);return t},L=function(e,t,r){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(7&t)&r},B=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(7&t)},F=function(e,t,r){(null==t||t<0)&&(t=0),(null==r||r>e.length)&&(r=e.length);var n=new(2==e.BYTES_PER_ELEMENT?g:4==e.BYTES_PER_ELEMENT?v:f)(r-t);return n.set(e.subarray(t,r)),n},U=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],k=function(e,t,r){var n=Error(t||U[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,k),!r)throw n;return n},G=function(e,t,r){var n=e.length;if(!n||r&&r.f&&!r.l)return t||new f(0);var i=!t||r,a=!r||r.i;r||(r={}),t||(t=new f(3*n));var o=function(e){var r=t.length;if(e>r){var n=new f(Math.max(2*r,e));n.set(t),t=n}},s=r.f||0,l=r.p||0,u=r.b||0,c=r.l,d=r.d,p=r.m,m=r.n,h=8*n;do{if(!c){s=L(e,l,1);var g=L(e,l+1,3);if(l+=3,g)if(1==g)c=M,d=N,p=9,m=5;else if(2==g){var v=L(e,l,31)+257,x=L(e,l+10,15)+4,C=v+L(e,l+5,31)+1;l+=14;for(var T=new f(C),S=new f(19),O=0;O>>4;if(U<16)T[O++]=U;else{var G=0,W=0;for(16==U?(W=3+L(e,l,3),l+=2,G=T[O-1]):17==U?(W=3+L(e,l,7),l+=3):18==U&&(W=11+L(e,l,127),l+=7);W--;)T[O++]=G}}var z=T.subarray(0,v),H=T.subarray(v);p=V(z),m=V(H),c=E(z,p,1),d=E(H,m,1)}else k(1);else{var U=((l+7)/8|0)+4,j=e[U-4]|e[U-3]<<8,$=U+j;if($>n){a&&k(0);break}i&&o(u+j),t.set(e.subarray(U,$),u),r.b=u+=j,r.p=l=8*$,r.f=s;continue}if(l>h){a&&k(0);break}}i&&o(u+131072);for(var K=(1<>>4;if((l+=15&G)>h){a&&k(0);break}if(G||k(2),Y<256)t[u++]=Y;else if(256==Y){X=l,c=null;break}else{var Z=Y-254;if(Y>264){var O=Y-257,J=y[O];Z=L(e,l,(1<>>4;Q||k(3),l+=15&Q;var H=w[ee];if(ee>3){var J=b[ee];H+=B(e,l)&(1<h){a&&k(0);break}i&&o(u+131072);for(var et=u+Z;u>3&1)+(t>>4&1);n>0;n-=!e[r++]);return r+(2&t)},H=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},j=function(e){((15&e[0])!=8||e[0]>>>4>7||(e[0]<<8|e[1])%31)&&k(6,"invalid zlib data"),32&e[1]&&k(6,"invalid zlib data: preset dictionaries not supported")},$="undefined"!=typeof TextDecoder&&new TextDecoder;try{$.decode(W,{stream:!0})}catch(e){}"function"==typeof queueMicrotask&&queueMicrotask;var K=r(47817);function q(e,t){return[...e.getElementsByTagName(t)][0]}var X={Int8:Int8Array,UInt8:Uint8Array,Int16:Int16Array,UInt16:Uint16Array,Int32:Int32Array,UInt32:Uint32Array,Int64:Int32Array,UInt64:Uint32Array,Float32:Float32Array,Float64:Float64Array},Y={Int8:1,UInt8:1,Int16:2,UInt16:2,Int32:4,UInt32:4,Int64:8,UInt64:8,Float32:4,Float64:8};function Z(e){let t=e.length-1;return e.filter((e,r)=>r0&&(o=0===a?n*i:(n-1)*i+a);let s={offset:0,uint8:new Uint8Array(new ArrayBuffer(o))},l=function(e,t){let[r]=e;return(e.length-1)*r}(r,0);for(;l>4>7||(e[0]<<8|e[1])%31?G(e,void 0):G((j(e),e.subarray(2,-4)),t)}(new Uint8Array(e.buffer,l,n));s.uint8.set(i,s.offset),s.offset+=i.length,l+=n}return s.uint8}function ee(e,t,r,n,i,a){let o=t.getAttribute("type"),s=t.getAttribute("Name"),u=t.getAttribute("format"),c=Number(t.getAttribute("NumberOfComponents")||"1"),d=null;if("ascii"===u){d=new X[o](e*c);let r=0;t.firstChild.nodeValue.split(/[\s]+/).forEach(e=>{e.trim().length&&(d[r++]=Number(e))})}else if("binary"===u){let e=new Uint8Array(l.toArrayBuffer(t.firstChild.nodeValue.trim()));if("vtkZLibDataCompressor"===r){let t=Q(e,i);d=new X[o](t.buffer),/^U?Int64$/.test(o)&&(d=Z(d))}else d=new X[o](e.buffer,Y[i]),-1!==o.indexOf("Int64")&&(d=Z(d))}else"appended"===u?d=J(new Uint8Array(a,Number(t.getAttribute("offset"))),o,i):console.error("Format not supported",u);return{name:s,values:d,numberOfComponents:c}}function et(e){return new TextDecoder().decode(e).split("\0").slice(0,-1)}var er={},en={extend:function(e,t,r={}){Object.assign(t,er,r),n.Ay.obj(e,t),n.Ay.get(e,t,["url","baseURL"]),n.Ay.setGet(e,t,["dataAccessHelper"]),n.Ay.algo(e,t,0,1),t.classHierarchy.push("vtkXMLReader"),t.dataAccessHelper||(t.dataAccessHelper=m.Ay.get("http")),e.setUrl=(r,n={})=>{t.url=r;let i=r.split("/");return i.pop(),t.baseURL=i.join("/"),e.loadData(n)},e.loadData=(r={})=>(function(e,r={}){return t.dataAccessHelper.fetchBinary(e,r)})(t.url,r).then(e.parseAsArrayBuffer),e.parseAsArrayBuffer=r=>{if(!r)return!1;if(r===t.rawDataBuffer)return!0;e.modified();let{text:i,binaryBuffer:a}=h.A.extractBinary(r,/^\s*\s*_/m,/\n\s*<\/AppendedData>/m);t.rawDataBuffer=r,t.binaryBuffer=a;let o=(0,K.vt)(i).root(),s=o.node,c=s.getAttribute("type"),d=s.getAttribute("compressor"),m=s.getAttribute("byte_order"),f=s.getAttribute("header_type")||"UInt32";if(d&&"vtkZLibDataCompressor"!==d)return console.error("Invalid compressor",d),!1;if(m&&"LittleEndian"!==m)return console.error("Only LittleEndian encoding is supported"),!1;if(c!==t.dataType)return console.error("Invalid data type",c,"expecting",t.dataType),!1;if(q(s,"AppendedData")){let e=q(s,"AppendedData"),r=e.getAttribute("encoding"),n=o.filter(e=>{let{node:t}=e;return t.nodeType===Node.ELEMENT_NODE&&"appended"===t.getAttribute("format")&&t.hasAttribute("offset")},!1,!0).map(e=>({node:e.node,offset:Number(e.node.getAttribute("offset"))}));n.sort((e,t)=>e.offset-t.offset);let i=t.binaryBuffer;"base64"===r&&(i=e.textContent.trim().substr(1));let a=[];for(let e=0;ee+t.length,0)),c=new Uint8Array(u);for(let e=0,t=0;eu.Ay.newInstance(ee(Number(e.getAttribute("NumberOfTuples")),e,y,b,I,x))),...[...v.getElementsByTagName("Array")].filter(e=>"String"===e.getAttribute("type")).map(e=>p.newInstance(function(e,t,r,i,a){let o=e.getAttribute("Name"),s=e.getAttribute("format"),u=Number(e.getAttribute("NumberOfComponents")||"1"),c=Number(e.getAttribute("NumberOfTuples")||"1")*u,d=[];if("ascii"===s){let t=e.firstChild.nodeValue.trim().split(/\s+/),r=0,n=[];for(;d.length{e.parseAsArrayBuffer(t.rawDataBuffer)}},processDataArray:ee,processFieldData:function(e,t,r,n,i,a,o){if(t){let s={};["Scalars","Vectors","Normals","Tensors","TCoords"].forEach(e=>{let n=t.getAttribute(e);n&&(s[n]=r[`set${e}`])});let l=t.getElementsByTagName("DataArray"),c=l.length;for(let t=0;t{let t=e-m;d[p++]=t;for(let e=0;e{let s=e.getElementsByTagName(t.dataType)[0].getElementsByTagName("Piece"),l=s.length;for(let e=0;e0){let l=r.getElementsByTagName(t)[0].getElementsByTagName("DataArray")[0],{values:u,numberOfComponents:c}=en.processDataArray(s,l,n,i,a,o);e[`get${t}`]().setData(u,c)}return s}(r,"Points",l,n,a,o,t.binaryBuffer),c=0;["Verts","Lines","Strips","Polys"].forEach(e=>{c+=function(e,t,r,n,i,a,o){let s=Number(r.getAttribute(`NumberOf${t}`));if(s>0){let l=en.processCells(s,r.getElementsByTagName(t)[0],n,i,a,o);e[`get${t}`]().setData(l)}return s}(r,e,l,n,a,o,t.binaryBuffer)}),en.processFieldData(u,l.getElementsByTagName("PointData")[0],r.getPointData(),n,a,o,t.binaryBuffer),en.processFieldData(c,l.getElementsByTagName("CellData")[0],r.getCellData(),n,a,o,t.binaryBuffer),t.output[e]=r}}}var eo={newInstance:n.Ay.newInstance(ea,"vtkXMLPolyDataReader"),extend:ea}},35666:(e,t,r)=>{"use strict";r.d(t,{A:()=>i,V:()=>n});var n={NEAREST:0,LINEAR:1},i={InterpolationType:n}},35752:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=r(31320).fX.nb},35847:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MapWriter=void 0;let n=r(16950),i=r(22706),a=r(81320);class o extends a.BaseWriter{constructor(e,t){super(e),this._writerOptions=(0,n.applyDefaults)(t,{format:"map",wellFormed:!1,group:!1,verbose:!1})}serialize(e){let t=(0,n.applyDefaults)(this._writerOptions,{format:"object",wellFormed:!1,verbose:!1}),r=new i.ObjectWriter(this._builderOptions,t).serialize(e);return this._convertObject(r)}_convertObject(e){if((0,n.isArray)(e)){for(let t=0;t{"use strict";r.d(t,{A:()=>i,q:()=>a});var n=r(42684);function i(e){return!!(0,n.vC)(e)&&!!(0,n.aZ)({type:e}).useCustomRenderingPipeline}function a(e){return e.getUseCustomRenderingPipeline()}},35954:(e,t,r)=>{"use strict";r.d(t,{n:()=>o});var n=r(54268),i=r(94302),a=r(77280);async function o({viewport:e,options:t}){let{id:r,element:o}=e,s=e.getRenderingEngine(),{background:l}=t,u=t.viewportId||r,c=n.Ay.getVolume(e.getVolumeId());if(!(c instanceof i.Q))throw Error("Currently, you cannot decache a volume that is not an ImageVolume. So, unfortunately, volumes such as nifti (which are basic Volume, without imageIds) cannot be decached.");let d={viewportId:u,type:a.NV.STACK,element:o,defaultOptions:{background:l}},p=e.getViewReference();s.enableElement(d);let m=s.getViewport(u);return await m.setStack(c.imageIds),m.setViewReference(p),m.render(),m}},35972:(e,t,r)=>{"use strict";r.d(t,{T:()=>o});var n=r(50923),i=r(79267),a=r(96945);function o(e){var t;let r,{imagePlaneModule:o,imagePixelModule:s,voiLUTFunction:l,modality:u,scalingFactor:c,calibration:d}=(0,a.KP)(e),{rowCosines:p,columnCosines:m}=o;(null==p||null==m)&&(p=[1,0,0],m=[0,1,0]);let h=n.fA(p[0],p[1],p[2]),f=n.fA(m[0],m[1],m[2]),g=n.vt();n.$A(g,h,f);let v=o.imagePositionPatient;null==v&&(v=[0,0,0]);let y=o.columnPixelSpacing||e.columnPixelSpacing,b=o.rowPixelSpacing||e.rowPixelSpacing,I=e.columns,x=e.rows,C=i.p8;return s.photometricInterpretation||e.sizeInBytes!==3*e.width*e.height||(e.numberOfComponents=3),{numberOfComponents:e.numberOfComponents||(t=s.photometricInterpretation,r=1,("RGB"===t||t?.includes("YBR")||"PALETTE COLOR"===t)&&(r=3),r),origin:v,direction:[...h,...f,...g],dimensions:[I,x,1],spacing:[y,b,C],numVoxels:I*x*1,imagePlaneModule:o,imagePixelModule:s,bitsAllocated:s.bitsAllocated,voiLUTFunction:l,modality:u,scalingFactor:c,calibration:d,scanAxisNormal:g}}},36039:(e,t,r)=>{"use strict";r.d(t,{A:()=>m});var n=r(54268),i=r(77280),a=r(37843),o=r(50923),s=r(30075),l=r(88824),u=r(39262);let c=[0,0,0],d=[0,0,0],p=new WeakMap;class m{get id(){return this._id}constructor(e,t){this.modifiedSlices=new Set,this.boundsIJK=[[1/0,-1/0],[1/0,-1/0],[1/0,-1/0]],this.scalarData=null,this._scalarDataIsCachedExpansion=!1,this._sliceDataCache=null,this.getAtIJK=(e,t,r)=>this._get(e+t*this.width+r*this.frameSize),this.setAtIJK=(e,t,r,n)=>{let i=e+t*this.width+r*this.frameSize,a=this._set(i,n);return!1!==a&&(this.modifiedSlices.add(r),m.addBounds(this.boundsIJK,[e,t,r]),this.invalidateCachedScalarExpansion()),a},this.getAtIJKPoint=([e,t,r])=>this.getAtIJK(e,t,r),this.setAtIJKPoint=([e,t,r],n)=>{this.setAtIJK(e,t,r,n)},this.getAtIndex=e=>this._get(e),this.setAtIndex=(e,t)=>{let r=this._set(e,t);if(!1!==r){let t=this.toIJK(e);this.modifiedSlices.add(t[2]),m.addBounds(this.boundsIJK,t),this.invalidateCachedScalarExpansion()}return r},this.getMiddleSliceData=()=>{let e=Math.floor(this.dimensions[2]/2);return this.getSliceData({sliceIndex:e,slicePlane:2})},this.forEach=(e,t={})=>{let r=t.boundsIJK||this.getBoundsIJK(),n=t.isInObject||this.isInObject||(()=>!0),i=t.returnPoints||!1,a=t.imageData,o=Math.min(r[0][0],r[0][1]),l=Math.max(r[0][0],r[0][1]),c=Math.min(r[1][0],r[1][1]),d=Math.max(r[1][0],r[1][1]),p=Math.min(r[2][0],r[2][1]),m=Math.max(r[2][0],r[2][1]),h=[];if(a)return(0,u.X6)({voxelManager:this,imageData:t.imageData,bounds:[[o,l],[c,d],[p,m]],pointInShapeFn:n,callback:e,returnPoints:i});if(this.map){if(this.map instanceof s.A)return this.rleForEach(e,t);for(let t of this.map.keys()){let r=this.toIJK(t);if(!n(null,r))continue;let a=this._get(t);i&&h.push({value:a,index:t,pointIJK:r,pointLPS:null}),e({value:a,index:t,pointIJK:r,pointLPS:null})}return h}for(let t=p;t<=m;t++){let r=t*this.frameSize;for(let a=c;a<=d;a++){let s=r+a*this.width;for(let r=o,u=s+r;r<=l;r++,u++){let o=this.getAtIndex(u),s=[r,a,t];n(null,s)&&(i&&h.push({value:o,index:u,pointIJK:s,pointLPS:null}),e({value:o,index:u,pointIJK:[r,a,t],pointLPS:null}))}}}return h},this.getSliceData=({sliceIndex:e,slicePlane:t})=>{let r,n,[i,a,o]=this.dimensions,s=i*a,l=e*s,u=this.getConstructor();if("function"!=typeof u)return new Uint8Array(0);switch(t){case 0:n=new u(r=a*o);for(let t=0;t{let n=Array.isArray(r);if(void 0===e&&(e=n?[...r]:r,t=n?[...r]:r),n)for(let n=0;n[0,e-1])}getBoundsIJK(){return this.boundsIJK[0][0]{e[0]=1/0,e[1]=-1/0})}clear(){this.map?.clear(),this.clearBounds(),this.modifiedSlices.clear(),this.points?.clear()}getConstructor(){return this.scalarData?this.scalarData.constructor:this._getConstructor?this._getConstructor():(console.warn("No scalar data available or can be used to get the constructor"),Float32Array)}getArrayOfModifiedSlices(){return Array.from(this.modifiedSlices)}resetModifiedSlices(){this.modifiedSlices.clear()}setBounds(e){this.boundsIJK=e}static addBounds(e,t){e||(e=[[1/0,-1/0],[1/0,-1/0],[1/0,-1/0]]),e[0][0]=Math.min(t[0],e[0][0]),e[0][1]=Math.max(t[0],e[0][1]),e[1][0]=Math.min(t[1],e[1][0]),e[1][1]=Math.max(t[1],e[1][1]),e[2][0]=Math.min(t[2],e[2][0]),e[2][1]=Math.max(t[2],e[2][1])}static getWorldToIndexTransform(e){let t=p.get(e);if(t)return t;let r=e.direction,n=e.spacing,i=a.fromValues(r[0]/n[0],r[3]/n[1],r[6]/n[2],r[1]/n[0],r[4]/n[1],r[7]/n[2],r[2]/n[0],r[5]/n[1],r[8]/n[2]);return p.set(e,i),i}static worldToIndexContinuous(e,t){let r=e.origin;c[0]=t[0]-r[0],c[1]=t[1]-r[1],c[2]=t[2]-r[2];let n=o.ei(d,c,m.getWorldToIndexTransform(e));return[n[0],n[1],n[2]]}static sampleAtWorldCoordinates(e,t,r,n,a=i.VO.LINEAR){if(!e.voxelManager)return NaN;let s=e.origin;c[0]=t-s[0],c[1]=r-s[1],c[2]=n-s[2];let l=o.ei(d,c,m.getWorldToIndexTransform(e));return m.sampleAtContinuousCoordinates(e.voxelManager,e.dimensions,l[0],l[1],l[2],a)}static sampleAtWorld(e,t,r=i.VO.LINEAR){return m.sampleAtWorldCoordinates(e,t[0],t[1],t[2],r)}static sampleAtContinuousIndex(e,t,r,n=i.VO.LINEAR){return m.sampleAtContinuousCoordinates(e,t,r[0],r[1],r[2],n)}static sampleAtContinuousCoordinates(e,t,r,n,a,o){return o===i.VO.NEAREST?m.sampleNearestAtContinuousCoordinates(e,t,r,n,a):m.sampleLinearAtContinuousCoordinates(e,t,r,n,a)}static sampleNearestAtContinuousCoordinates(e,t,r,n,i){let a=Math.floor(r+.5-1e-6),o=Math.floor(n+.5-1e-6),s=Math.floor(i+.5-1e-6),l=t[0],u=t[1],c=t[2];return a<0||a>=l||o<0||o>=u||s<0||s>=c?NaN:Number(e.getAtIJK(a,o,s))}static sampleLinearAtContinuousCoordinates(e,t,r,n,i){let a=t[0],o=t[1],s=t[2];if(r<0||r>a-1||n<0||n>o-1||i<0||i>s-1)return NaN;let l=Math.floor(r),u=Math.floor(n),c=Math.floor(i),d=Math.min(l+1,a-1),p=Math.min(u+1,o-1),m=Math.min(c+1,s-1),h=r-l,f=n-u,g=i-c,v=1-h,y=1-f,b=Number(e.getAtIJK(l,u,c)),I=Number(e.getAtIJK(d,u,c)),x=Number(e.getAtIJK(l,p,c)),C=Number(e.getAtIJK(d,p,c)),A=Number(e.getAtIJK(l,u,m)),T=Number(e.getAtIJK(d,u,m)),S=Number(e.getAtIJK(l,p,m));return((b*v+I*h)*y+(x*v+C*h)*f)*(1-g)+((A*v+T*h)*y+(S*v+Number(e.getAtIJK(d,p,m))*h)*f)*g}addPoint(e){let t=Array.isArray(e)?e[0]+this.width*e[1]+this.frameSize*e[2]:e;this.points||(this.points=new Set),this.points.add(t)}getPoints(){return this.points?[...this.points].map(e=>this.toIJK(e)):[]}setSliceDataValue(e,t,r){if(Array.isArray(r))for(let n=0;n(e*=r,[t[e++],t[e++],t[e++]]),_id:n||"_createRGBScalarVolumeVoxelManager",_set:(e,r)=>{e*=3;let n=!(0,l.Ay)(t[e],r);return t[e++]=r[0],t[e++]=r[1],t[e++]=r[2],n},numberOfComponents:r,scalarData:t});return i.clear=()=>{t.fill(0)},i}static createImageVolumeVoxelManager({dimensions:e,imageIds:t,numberOfComponents:r=1,id:i}){let a=e[0]*e[1],o=e[2],s=Array(o),u=-1,c=null,d=new Set,p=new Set,h=e=>{if(e<0||e>=o)return null;let r=s[e];if(void 0!==r)return r;let i=t[e];if(!i)return d.has(e)||(d.add(e),console.warn(`ImageId not found for sliceIndex: ${e}`)),s[e]=null,null;let a=n.Ay.getImage(i);if(!a?.voxelManager)return p.has(i)||(p.add(i),console.warn(`Image not found for imageId: ${i}`)),null;let l=a.voxelManager;return s[e]=l,l},f=new m(e,{_get:function(e){let t=Math.floor(e/a);if(t<0||t>=o)return null;let r=t===u?c:h(t);return r?(t!==u&&(u=t,c=r),r.getAtIndex(e-t*a)):null},_set:function(e,t){let r=Math.floor(e/a);if(r<0||r>=o)return!1;let n=r===u?c:h(r);if(!n)return!1;r!==u&&(u=r,c=n);let i=e-r*a,s=n.getAtIndex(i),d=!(0,l.Ay)(t,s);return d?(n.setAtIndex(i,t),!0):d},numberOfComponents:r,_getConstructor:()=>{let e=h(0);return e?e.getConstructor():null},_id:i||"createImageVolumeVoxelManager"});return f.invalidateCache=()=>{s.fill(void 0),u=-1,c=null},f.getMiddleSliceData=()=>{let t=Math.floor(e[2]/2);return f.getSliceData({sliceIndex:t,slicePlane:2})},f.clear=()=>{for(let e of t)n.Ay.getImage(e).voxelManager.clear()},f.getRange=()=>{let e=1/0,r=-1/0;for(let i of t){let t=n.Ay.getImage(i);t&&(t.minPixelValuer&&(r=t.maxPixelValue))}return e===1/0&&r===-1/0?[0,0]:[e,r]},f._getScalarDataLength=()=>{let t=h(0);return t?t.getScalarDataLength()*e[2]:0},f.getCompleteScalarDataArray=()=>{let t=f._getConstructor();if(!t)return new Uint8Array(0);let n=new t(f.getScalarDataLength()),i=e[0]*e[1]*r;for(let t=0;t{let a=e[0]*e[1]*r,o=f._getConstructor(),s=1/0,l=-1/0;for(let r=0;r4||r<1||2===r))throw Error(`Number of components ${r} must be 1, 3 or 4`);return r>1?m._createRGBScalarVolumeVoxelManager({dimensions:e,scalarData:t,numberOfComponents:r,id:n}):m._createNumberVolumeVoxelManager({dimensions:e,scalarData:t,id:n})}static createScalarDynamicVolumeVoxelManager({imageIdGroups:e,dimensions:t,dimensionGroupNumber:r=1,timePoint:i=0,numberOfComponents:a=1,id:o}){let s=0;if(void 0!==r?s=r-1:void 0!==i&&(console.warn("Warning: timePoint parameter is deprecated. Please use dimensionGroupNumber instead. timePoint is zero-based while dimensionGroupNumber starts at 1."),s=i),!a){let r=n.Ay.getImage(e[0][0]);if(!r)throw Error("Unable to determine number of components: No image found");if((a=r.getPixelData().length/(t[0]*t[1]))>4||a<1||2===a)throw Error(`Number of components ${a} must be 1, 3 or 4`)}let l=e.map(e=>m.createImageVolumeVoxelManager({dimensions:t,imageIds:e,numberOfComponents:a,id:o})),u=new m(t,{_get:e=>l[s]._get(e),_set:(e,t)=>l[s]._set(e,t),numberOfComponents:a,_id:o||"createScalarDynamicVolumeVoxelManager"});return u.getScalarDataLength=()=>l[s].getScalarDataLength(),u.getConstructor=()=>l[s].getConstructor(),u.getRange=()=>l[s].getRange(),u.getMiddleSliceData=()=>l[s].getMiddleSliceData(),u.setTimePoint=e=>{console.warn("Warning: setTimePoint is deprecated. Please use setDimensionGroupNumber instead. Note that timePoint is zero-based while dimensionGroupNumber starts at 1."),u.setDimensionGroupNumber(e+1)},u.setDimensionGroupNumber=e=>{s=e-1,u._get=e=>l[s]._get(e),u._set=(e,t)=>l[s]._set(e,t)},u.getAtIndexAndTimePoint=(e,t)=>(console.warn("Warning: getAtIndexAndTimePoint is deprecated. Please use getAtIndexAndDimensionGroup instead. Note that timePoint is zero-based while dimensionGroupNumber starts at 1."),u.getAtIndexAndDimensionGroup(e,t+1)),u.getAtIndexAndDimensionGroup=(e,t)=>l[t-1]._get(e),u.getTimePointScalarData=e=>(console.warn("Warning: getTimePointScalarData is deprecated. Please use getDimensionGroupScalarData instead. Note that timePoint is zero-based while dimensionGroupNumber starts at 1."),u.getDimensionGroupScalarData(e+1)),u.getDimensionGroupScalarData=e=>l[e-1].getCompleteScalarDataArray(),u.getCurrentTimePointScalarData=()=>(console.warn("Warning: getCurrentTimePointScalarData is deprecated. Please use getCurrentDimensionGroupScalarData instead."),u.getCurrentDimensionGroupScalarData()),u.getCurrentDimensionGroupScalarData=()=>l[s].getCompleteScalarDataArray(),u.getCompleteScalarDataArray=()=>l[s].getCompleteScalarDataArray(),u.getCurrentTimePoint=()=>(console.warn("Warning: getCurrentTimePoint is deprecated. Please use getCurrentDimensionGroupNumber instead. Note that timePoint is zero-based while dimensionGroupNumber starts at 1."),s),u.getCurrentDimensionGroupNumber=()=>s+1,u}static createImageVoxelManager({width:e,height:t,scalarData:r,numberOfComponents:n=1,id:i}){let a=[e,t,1];if(!n&&((n=r.length/e/t)>4||n<1||2===n))throw Error(`Number of components ${n} must be 1, 3 or 4`);return n>1?m._createRGBScalarVolumeVoxelManager({dimensions:a,scalarData:r,numberOfComponents:n,id:i}):m._createNumberVolumeVoxelManager({dimensions:a,scalarData:r,id:i})}static _createNumberVolumeVoxelManager({dimensions:e,scalarData:t,id:r}){let n=new m(e,{_get:e=>t[e],_set:(e,r)=>{let n=t[e]!==r;return t[e]=r,n},_getConstructor:()=>t.constructor,_id:r||"_createNumberVolumeVoxelManager"});return n.scalarData=t,n.clear=()=>{n.scalarData.fill(0)},n.getMiddleSliceData=()=>{let t=Math.floor(e[2]/2);return n.getSliceData({sliceIndex:t,slicePlane:2})},n}static createMapVoxelManager({dimension:e,id:t}){let r=new Map,n=new m(e,{_get:r.get.bind(r),_set:(e,t)=>r.set(e,t)&&!0,_id:t||"createMapVoxelManager"});return n.map=r,n}static createHistoryVoxelManager(e,t){let r=new Map,{dimensions:n}=e,i=new m(n,{_get:e=>r.get(e),_set:function(e,t){if(r.has(e))t===r.get(e)&&r.delete(e);else{let n=this.sourceVoxelManager.getAtIndex(e);if(n===t)return!1;r.set(e,n)}this.sourceVoxelManager.setAtIndex(e,t)},_id:t||"createHistoryVoxelManager"});return i.map=r,i.scalarData=e.scalarData,i.sourceVoxelManager=e,i}static createRLEHistoryVoxelManager(e,t){let{dimensions:r}=e,n=new s.A(r[0],r[1],r[2]),i=new m(r,{_get:e=>n.get(e),_set:function(e,t){let r=n.get(e);if(void 0===r){let r=this.sourceVoxelManager.getAtIndex(e);if(r===t||void 0===r&&0===t||null===t)return!1;n.set(e,r??0)}else(t===r||null===t)&&(n.delete(e),t=r);this.sourceVoxelManager.setAtIndex(e,t)},_getScalarData:s.A.getScalarData,_updateScalarData:e=>(n.updateScalarData(e),e),_id:t||"createRLEHistoryVoxelManager"});return i.map=n,i.sourceVoxelManager=e,i}static createLazyVoxelManager({dimensions:e,planeFactory:t,id:r}){let n=new Map,[i,a]=e,o=i*a,s=new m(e,{_get:e=>n.get(Math.floor(e/o))[e%o],_set:(e,r)=>{let s=Math.floor(e/o),l=n.get(s);return l||(l=t(i,a),n.set(s,l)),l[e%o]=r,!0},_id:r||"createLazyVoxelManager"});return s.map=n,s}static createRLEVolumeVoxelManager({dimensions:e,id:t}){let[r,n,i]=e,a=new s.A(r,n,i),o=new m(e,{_get:e=>a.get(e),_set:(e,t)=>(a.set(e,t),!0),_getScalarData:s.A.getScalarData,_updateScalarData:e=>(a.updateScalarData(e),e),_id:t||"createRLEVolumeVoxelManager"});return o.map=a,o.getPixelData=a.getPixelData.bind(a),o}static createRLEImageVoxelManager({dimensions:e,id:t}){let[r,n]=e;return m.createRLEVolumeVoxelManager({dimensions:[r,n,1],id:t})}static addInstanceToImage(e){let{width:t,height:r}=e,n=e.voxelManager.getScalarData();if(n.length>=t*r){e.voxelManager=m.createScalarVolumeVoxelManager({dimensions:[t,r,1],scalarData:n});return}e.voxelManager=m.createRLEVolumeVoxelManager({dimensions:[t,r,1]}),e.getPixelData=e.voxelManager.getPixelData,e.sizeInBytes=5120}}},36119:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>i,y0:()=>n});var n={LUMINANCE:1,LUMINANCE_ALPHA:2,RGB:3,RGBA:4},i={VectorMode:{MAGNITUDE:0,COMPONENT:1,RGBCOLORS:2},ScalarMappingTarget:n,Scale:{LINEAR:0,LOG10:1}}},36195:(e,t,r)=>{"use strict";r.d(t,{Ig:()=>ev,c2:()=>eP,wu:()=>eR,uT:()=>eF});var n=r(17042),i=r(67368),a=r(98629),o=r(62347),s=r(29103),l=r(70125),u=r(56929),c=r(62269),d=r(95398),p=r(9731),m=r(86077),h=r(64125),f=r(31727),g=r(37843),v=r(85250),{vtkErrorMacro:y}=n.o$,{Representation:b}=l.Ay,{ObjectType:I}=c.Ay,{PassTypes:x}=h.Ay,C={type:"StartEvent"},A={type:"EndEvent"},T={normalMatrix:null,mcpcMatrix:null,mcwcMatrix:null},S=(0,n.UI)(function(e,t,r={}){Object.assign(t,T,r),f.Ay.extend(e,t,r),t.tmpMat3=g.identity(new Float64Array(9)),t.normalMatrix=g.identity(new Float64Array(9)),t.mcpcMatrix=v.identity(new Float64Array(16)),t.mcvcMatrix=v.identity(new Float64Array(16)),t.tmpColor=[],t.glyphBOBuildTime={},(0,n.WL)(t.glyphBOBuildTime,{mtime:0});t.classHierarchy.push("vtkOpenGLGlyph3DMapper");let i={...e};e.renderPiece=(r,n)=>{if(e.invokeEvent(C),t.renderable.getStatic()||t.renderable.update(),t.currentInput=t.renderable.getInputData(1),e.invokeEvent(A),!t.currentInput)return void y("No input!");if(!t.currentInput.getPoints||!t.currentInput.getPoints().getNumberOfValues())return;let i=t.context;t._openGLRenderWindow.getWebgl2()?(t.hardwareSupport=!0,t.extension=null):t.extension||(t.extension=t.context.getExtension("ANGLE_instanced_arrays"),t.hardwareSupport=!!t.extension);let a=n.getProperty().getBackfaceCulling(),o=n.getProperty().getFrontfaceCulling();a||o?o?(t._openGLRenderWindow.enableCullFace(),t._openGLRenderWindow.setCullFaceMode(i.FRONT)):(t._openGLRenderWindow.enableCullFace(),t._openGLRenderWindow.setCullFaceMode(i.BACK)):t._openGLRenderWindow.disableCullFace(),e.renderPieceStart(r,n),e.renderPieceDraw(r,n),e.renderPieceFinish(r,n)},e.multiply4x4WithOffset=(e,t,r,n)=>{let i=t[0],a=t[1],o=t[2],s=t[3],l=t[4],u=t[5],c=t[6],d=t[7],p=t[8],m=t[9],h=t[10],f=t[11],g=t[12],v=t[13],y=t[14],b=t[15],I=r[n],x=r[n+1],C=r[n+2],A=r[n+3];e[0]=I*i+x*l+C*p+A*g,e[1]=I*a+x*u+C*m+A*v,e[2]=I*o+x*c+C*h+A*y,e[3]=I*s+x*d+C*f+A*b,I=r[n+4],x=r[n+5],C=r[n+6],A=r[n+7],e[4]=I*i+x*l+C*p+A*g,e[5]=I*a+x*u+C*m+A*v,e[6]=I*o+x*c+C*h+A*y,e[7]=I*s+x*d+C*f+A*b,I=r[n+8],x=r[n+9],C=r[n+10],A=r[n+11],e[8]=I*i+x*l+C*p+A*g,e[9]=I*a+x*u+C*m+A*v,e[10]=I*o+x*c+C*h+A*y,e[11]=I*s+x*d+C*f+A*b,I=r[n+12],x=r[n+13],C=r[n+14],A=r[n+15],e[12]=I*i+x*l+C*p+A*g,e[13]=I*a+x*u+C*m+A*v,e[14]=I*o+x*c+C*h+A*y,e[15]=I*s+x*d+C*f+A*b},e.replaceShaderNormal=(e,r,n)=>{if(t.hardwareSupport&&t.lastBoundBO.getReferenceByName("lastLightComplexity")>0){let r=e.Vertex;t.lastBoundBO.getCABO().getNormalOffset()&&(r=p.A.substitute(r,"//VTK::Normal::Dec",["attribute vec3 normalMC;","attribute mat3 gNormal;","uniform mat3 normalMatrix;","varying vec3 normalVCVSOutput;"]).result,r=p.A.substitute(r,"//VTK::Normal::Impl",["normalVCVSOutput = normalMatrix * gNormal * normalMC;"]).result),e.Vertex=r}i.replaceShaderNormal(e,r,n)},e.replaceShaderClip=(e,r,n)=>{if(t.hardwareSupport){let r=e.Vertex,n=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();r=p.A.substitute(r,"//VTK::Clip::Dec",["uniform int numClipPlanes;",`uniform vec4 clipPlanes[${e}];`,`varying float clipDistancesVSOutput[${e}];`]).result,r=p.A.substitute(r,"//VTK::Clip::Impl",[`for (int planeNum = 0; planeNum < ${e}; planeNum++)`," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," vec4 gVertex = gMatrix * vertexMC;"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], gVertex);"," }"]).result,n=p.A.substitute(n,"//VTK::Clip::Dec",["uniform int numClipPlanes;",`varying float clipDistancesVSOutput[${e}];`]).result,n=p.A.substitute(n,"//VTK::Clip::Impl",[`for (int planeNum = 0; planeNum < ${e}; planeNum++)`," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=r,e.Fragment=n}i.replaceShaderClip(e,r,n)},e.replaceShaderColor=(e,r,n)=>{if(t.hardwareSupport&&t.renderable.getColorArray()){let r=e.Vertex,n=e.Geometry,i=e.Fragment,a=t.lastBoundBO.getReferenceByName("lastLightComplexity"),o=["uniform float ambient;","uniform float diffuse;","uniform float specular;","uniform float opacityUniform; // the fragment opacity"];a&&(o=o.concat(["uniform vec3 specularColorUniform;","uniform float specularPowerUniform;"]));let s=["vec3 ambientColor;"," vec3 diffuseColor;"," float opacity;"];a&&(s=s.concat([" vec3 specularColor;"," float specularPower;"])),s=s.concat([" opacity = opacityUniform;"]),a&&(s=s.concat([" specularColor = specularColorUniform;"," specularPower = specularPowerUniform;"])),t.drawingEdges||(o=o.concat(["varying vec4 vertexColorVSOutput;"]),r=p.A.substitute(r,"//VTK::Color::Dec",["attribute vec4 gColor;","varying vec4 vertexColorVSOutput;"]).result,r=p.A.substitute(r,"//VTK::Color::Impl",["vertexColorVSOutput = gColor;"]).result,n=p.A.substitute(n,"//VTK::Color::Dec",["in vec4 vertexColorVSOutput[];","out vec4 vertexColorGSOutput;"]).result,n=p.A.substitute(n,"//VTK::Color::Impl",["vertexColorGSOutput = vertexColorVSOutput[i];"]).result,s=s.concat([" diffuseColor = vertexColorVSOutput.rgb;"," ambientColor = vertexColorVSOutput.rgb;"," opacity = opacity*vertexColorVSOutput.a;"])),i=p.A.substitute(i,"//VTK::Color::Impl",s).result,i=p.A.substitute(i,"//VTK::Color::Dec",o).result,e.Vertex=r,e.Geometry=n,e.Fragment=i}i.replaceShaderColor(e,r,n)},e.replaceShaderPositionVC=(e,r,n)=>{if(t.hardwareSupport){let r=e.Vertex;t.lastBoundBO.getReferenceByName("lastLightComplexity")>0?(r=p.A.substitute(r,"//VTK::PositionVC::Impl",["vec4 gVertexMC = gMatrix * vertexMC;","vertexVCVSOutput = MCVCMatrix * gVertexMC;"," gl_Position = MCPCMatrix * gVertexMC;"]).result,r=p.A.substitute(r,"//VTK::Camera::Dec",["attribute mat4 gMatrix;","uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result):(r=p.A.substitute(r,"//VTK::Camera::Dec",["attribute mat4 gMatrix;","uniform mat4 MCPCMatrix;"]).result,r=p.A.substitute(r,"//VTK::PositionVC::Impl",["vec4 gVertexMC = gMatrix * vertexMC;"," gl_Position = MCPCMatrix * gVertexMC;"]).result),e.Vertex=r}i.replaceShaderPositionVC(e,r,n)},e.replaceShaderPicking=(e,r,n)=>{if(t.hardwareSupport){let t=e.Fragment,r=e.Vertex;r=p.A.substitute(r,"//VTK::Picking::Dec",["attribute vec3 mapperIndexVS;","varying vec3 mapperIndexVSOutput;"]).result,e.Vertex=r=p.A.substitute(r,"//VTK::Picking::Impl"," mapperIndexVSOutput = mapperIndexVS;").result,t=p.A.substitute(t,"//VTK::Picking::Dec",["varying vec3 mapperIndexVSOutput;","uniform vec3 mapperIndex;","uniform int picking;"]).result,e.Fragment=t=p.A.substitute(t,"//VTK::Picking::Impl",[" vec4 pickColor = picking == 2 ? vec4(mapperIndexVSOutput,1.0) : vec4(mapperIndex,1.0);"," gl_FragData[0] = picking != 0 ? pickColor : gl_FragData[0];"]).result}else i.replaceShaderPicking(e,r,n)},e.updateGlyphShaderParameters=(r,n,i,a,o,s,l,u)=>{let c=i.getProgram();if(r){let e=t.normalMatrix,r=9*l,n=t.tmpMat3,i=e[0],a=e[1],o=e[2],u=e[3],d=e[4],p=e[5],m=e[6],h=e[7],f=e[8],g=s[r],v=s[r+1],y=s[r+2],b=s[r+3],I=s[r+4],x=s[r+5],C=s[r+6],A=s[r+7],T=s[r+8];n[0]=g*i+v*u+y*m,n[1]=g*a+v*d+y*h,n[2]=g*o+v*p+y*f,n[3]=b*i+I*u+x*m,n[4]=b*a+I*d+x*h,n[5]=b*o+I*p+x*f,n[6]=C*i+A*u+T*m,n[7]=C*a+A*d+T*h,n[8]=C*o+A*p+T*f,c.setUniformMatrix3x3("normalMatrix",t.tmpMat3)}if(e.multiply4x4WithOffset(t.tmpMat4,t.mcpcMatrix,o,16*l),c.setUniformMatrix("MCPCMatrix",t.tmpMat4),n&&(e.multiply4x4WithOffset(t.tmpMat4,t.mcvcMatrix,o,16*l),c.setUniformMatrix("MCVCMatrix",t.tmpMat4)),a){let e=a.getData();t.tmpColor[0]=e[4*l]/255,t.tmpColor[1]=e[4*l+1]/255,t.tmpColor[2]=e[4*l+2]/255,c.setUniform3fArray("ambientColorUniform",t.tmpColor),c.setUniform3fArray("diffuseColorUniform",t.tmpColor)}u&&c.setUniform3fArray("mapperIndex",u.getPropColorValue())},e.renderPieceDraw=(r,n)=>{let i=n.getProperty().getRepresentation(),a=t.context,o=n.getProperty().getEdgeVisibility()&&i===b.SURFACE,s=t.openGLCamera.getKeyMatrices(r),l=t.openGLActor.getKeyMatrices();g.multiply(t.normalMatrix,s.normalMatrix,l.normalMatrix),v.multiply(t.mcpcMatrix,s.wcpc,l.mcwc),v.multiply(t.mcvcMatrix,s.wcvc,l.mcwc);let u=t.renderable.getMatrixArray(),c=t.renderable.getNormalArray(),d=t.renderable.getColorArray(),p=u.length/16,m=!1;t._openGLRenderer.getSelector()&&t._openGLRenderer.getSelector().getCurrentPass()===x.COMPOSITE_INDEX_PASS&&(m=!0);for(let s=t.primTypes.Start;s{if(e.getCABO().getElementCount()&&(t.glyphBOBuildTime.getMTime()>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime())){e.getProgram().isAttributeUsed("gMatrix")?e.getVAO().addAttributeMatrixWithDivisor(e.getProgram(),t.matrixBuffer,"gMatrix",0,64,t.context.FLOAT,4,!1,1)||y("Error setting gMatrix in shader VAO."):e.getVAO().removeAttributeArray("gMatrix"),e.getProgram().isAttributeUsed("gNormal")?e.getVAO().addAttributeMatrixWithDivisor(e.getProgram(),t.normalBuffer,"gNormal",0,36,t.context.FLOAT,3,!1,1)||y("Error setting gNormal in shader VAO."):e.getVAO().removeAttributeArray("gNormal"),e.getProgram().isAttributeUsed("gColor")?e.getVAO().addAttributeArrayWithDivisor(e.getProgram(),t.colorBuffer,"gColor",0,4,t.context.UNSIGNED_BYTE,4,!0,1,!1)||y("Error setting gColor in shader VAO."):e.getVAO().removeAttributeArray("gColor"),e.getProgram().isAttributeUsed("mapperIndexVS")?e.getVAO().addAttributeArrayWithDivisor(e.getProgram(),t.pickBuffer,"mapperIndexVS",0,4,t.context.UNSIGNED_BYTE,4,!0,1,!1)||y("Error setting mapperIndexVS in shader VAO."):e.getVAO().removeAttributeArray("mapperIndexVS"),i.setMapperShaderParameters(e,r,n),e.getAttributeUpdateTime().modified();return}i.setMapperShaderParameters(e,r,n)},e.getNeedToRebuildBufferObjects=(e,r)=>(t.renderable.buildArrays(),t.VBOBuildTime.getMTime()!!(i.getNeedToRebuildShaders(e,r,n)||e.getShaderSourceTime().getMTime(){let n=t.renderable.getMatrixArray(),{useShiftAndScale:a,coordShift:o,coordScale:s}=(0,d.Yx)(t.renderable.getInputData(0).getPoints());if(t.hardwareSupport){let e=t.renderable.getNormalArray(),r=t.renderable.getColorArray();if(t.matrixBuffer||(t.matrixBuffer=c.Ay.newInstance(),t.matrixBuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.normalBuffer=c.Ay.newInstance(),t.normalBuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorBuffer=c.Ay.newInstance(),t.colorBuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.pickBuffer=c.Ay.newInstance(),t.pickBuffer.setOpenGLRenderWindow(t._openGLRenderWindow)),a){let e=n.buffer,t=(0,d.cW)(o,s);v.invert(t,t);for(let r=0;rt.glyphBOBuildTime.getMTime()){t.matrixBuffer.upload(n,I.ARRAY_BUFFER),t.normalBuffer.upload(e,I.ARRAY_BUFFER),r?t.colorBuffer.upload(r.getData(),I.ARRAY_BUFFER):t.colorBuffer.releaseGraphicsResources();let i=n.length/16,a=new Uint8Array(4*i);for(let e=0;e{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkSphereMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// this shader implements imposters in OpenGL for Spheres\n\nattribute vec4 vertexMC;\nattribute vec2 offsetMC;\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n//VTK::Picking::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\nuniform mat3 normalMatrix; // transform model coordinate directions to view coordinates\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvarying vec4 vertexVCVSOutput;\nvarying float radiusVCVSOutput;\nvarying vec3 centerVCVSOutput;\n\nuniform int cameraParallel;\nuniform float scaleFactor;\n\nvoid main()\n{\n //VTK::Picking::Impl\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n // compute the projected vertex position\n vec2 scaledOffsetMC = scaleFactor * offsetMC;\n vertexVCVSOutput = MCVCMatrix * vertexMC;\n centerVCVSOutput = vertexVCVSOutput.xyz;\n radiusVCVSOutput = length(scaledOffsetMC)*0.5;\n\n // make the triangle face the camera\n if (cameraParallel == 0)\n {\n vec3 dir = normalize(-vertexVCVSOutput.xyz);\n vec3 base2 = normalize(cross(dir,vec3(1.0,0.0,0.0)));\n vec3 base1 = cross(base2,dir);\n vertexVCVSOutput.xyz = vertexVCVSOutput.xyz + scaledOffsetMC.x*base1 + scaledOffsetMC.y*base2;\n }\n else\n {\n // add in the offset\n vertexVCVSOutput.xy = vertexVCVSOutput.xy + scaledOffsetMC;\n }\n\n gl_Position = VCPCMatrix * vertexVCVSOutput;\n}\n",e.Fragment=L.A,e.Geometry=""},e.replaceShaderValues=(e,r,i)=>{let a=e.Vertex,o=e.Fragment;a=p.A.substitute(a,"//VTK::Camera::Dec",["uniform mat4 VCPCMatrix;\n","uniform mat4 MCVCMatrix;"]).result,o=p.A.substitute(o,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,o=p.A.substitute(o,"//VTK::PositionVC::Impl",["vec4 vertexVC = vertexVCVSOutput;\n"]).result,o=p.A.substitute(o,"//VTK::Normal::Dec",["uniform float invertedDepth;\n","uniform int cameraParallel;\n","varying float radiusVCVSOutput;\n","varying vec3 centerVCVSOutput;\n","uniform mat4 VCPCMatrix;\n"]).result;let s="";t.context.getExtension("EXT_frag_depth")&&(s="gl_FragDepthEXT = (pos.z / pos.w + 1.0) / 2.0;\n"),t._openGLRenderWindow.getWebgl2()&&(s="gl_FragDepth = (pos.z / pos.w + 1.0) / 2.0;\n"),o=p.A.substitute(o,"//VTK::Depth::Impl",[" vec3 EyePos;\n"," vec3 EyeDir;\n"," if (cameraParallel != 0) {\n"," EyePos = vec3(vertexVC.x, vertexVC.y, vertexVC.z + 3.0*radiusVCVSOutput);\n"," EyeDir = vec3(0.0,0.0,-1.0); }\n"," else {\n"," EyeDir = vertexVC.xyz;\n"," EyePos = vec3(0.0,0.0,0.0);\n"," float lengthED = length(EyeDir);\n"," EyeDir = normalize(EyeDir);\n"," if (lengthED > radiusVCVSOutput*3.0) {\n"," EyePos = vertexVC.xyz - EyeDir*3.0*radiusVCVSOutput; }\n"," }\n"," EyePos = EyePos - centerVCVSOutput;\n"," EyePos = EyePos/radiusVCVSOutput;\n"," float b = 2.0*dot(EyePos,EyeDir);\n"," float c = dot(EyePos,EyePos) - 1.0;\n"," float d = b*b - 4.0*c;\n"," vec3 normalVCVSOutput = vec3(0.0,0.0,1.0);\n"," if (d < 0.0) { discard; }\n"," else {\n"," float t = (-b - invertedDepth*sqrt(d))*0.5;\n"," normalVCVSOutput = invertedDepth*normalize(EyePos + t*EyeDir);\n"," vertexVC.xyz = normalVCVSOutput*radiusVCVSOutput + centerVCVSOutput;\n"," }\n"," vec4 pos = VCPCMatrix * vertexVC;\n",s]).result,o=p.A.substitute(o,"//VTK::Normal::Impl","").result,t.haveSeenDepthRequest&&(o=p.A.substitute(o,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float computedZ = (pos.z / pos.w + 1.0) / 2.0;","float iz = floor(computedZ * 65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),e.Vertex=a,e.Fragment=o,n.replaceShaderValues(e,r,i)},e.setMapperShaderParameters=(e,r,i)=>{if(e.getCABO().getElementCount()&&(t.VBOBuildTime>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime())&&e.getProgram().isAttributeUsed("offsetMC")&&!e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"offsetMC",12,e.getCABO().getStride(),t.context.FLOAT,2,!1)&&B("Error setting 'offsetMC' in shader VAO."),e.getProgram().isUniformUsed("invertedDepth")&&e.getProgram().setUniformf("invertedDepth",t.invert?-1:1),e.getProgram().isUniformUsed("scaleFactor")){let r=t.currentInput.getPointData();null!=t.renderable.getScaleArray()&&r.hasArray(t.renderable.getScaleArray())?e.getProgram().setUniformf("scaleFactor",t.renderable.getScaleFactor()):e.getProgram().setUniformf("scaleFactor",1)}n.setMapperShaderParameters(e,r,i)},e.setCameraShaderParameters=(e,r,n)=>{let i=e.getProgram(),a=r.getActiveCamera(),o=t.openGLCamera.getKeyMatrices(r);i.isUniformUsed("VCPCMatrix")&&i.setUniformMatrix("VCPCMatrix",o.vcpc);let s=new Float64Array(16);if(i.isUniformUsed("MCVCMatrix"))if(n.getIsIdentity())v.copy(s,o.wcvc),e.getCABO().getCoordShiftAndScaleEnabled()&&v.multiply(s,s,e.getCABO().getInverseShiftAndScaleMatrix()),i.setUniformMatrix("MCVCMatrix",s);else{let r=t.openGLActor.getKeyMatrices();v.multiply(s,o.wcvc,r.mcwc),e.getCABO().getCoordShiftAndScaleEnabled()&&v.multiply(s,s,e.getCABO().getInverseShiftAndScaleMatrix()),i.setUniformMatrix("MCVCMatrix",s)}i.isUniformUsed("cameraParallel")&&e.getProgram().setUniformi("cameraParallel",a.getParallelProjection())},e.getOpenGLMode=(e,r)=>t.context.TRIANGLES,e.buildBufferObjects=(e,r)=>{let n=t.currentInput;if(null===n)return;t.renderable.mapScalars(n,1);let i=t.renderable.getColorMapColors(),a=t.primitives[t.primTypes.Tris].getCABO(),o=n.getPointData(),s=n.getPoints(),l=s.getNumberOfPoints(),u=s.getData(),p=null;null!=t.renderable.getScaleArray()&&o.hasArray(t.renderable.getScaleArray())&&(p=o.getArray(t.renderable.getScaleArray()).getData());let m=null,h=0,f=null;i?(h=i.getNumberOfComponents(),a.setColorOffset(0),a.setColorBOStride(4),m=i.getData(),f=new Uint8Array(3*l*4),a.getColorBO()||a.setColorBO(c.Ay.newInstance()),a.getColorBO().setOpenGLRenderWindow(t._openGLRenderWindow)):a.getColorBO()&&a.setColorBO(null),a.setColorComponents(h);let g=new Float32Array(5*l*3);a.setStride(20);let v=Math.cos((0,N.el)(30)),y=0,b=0,{useShiftAndScale:I,coordShift:x,coordScale:C}=(0,d.Yx)(s);a.setCoordShiftAndScale(I?x:null,I?C:null);let A=0,T=0;for(let e=0;e{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkStickMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// this shader implements imposters in OpenGL for Sticks\n\nattribute vec4 vertexMC;\nattribute vec3 orientMC;\nattribute vec4 offsetMC;\nattribute float radiusMC;\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n//VTK::Picking::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\nuniform mat3 normalMatrix; // transform model coordinate directions to view coordinates\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvarying vec4 vertexVCVSOutput;\nvarying float radiusVCVSOutput;\nvarying float lengthVCVSOutput;\nvarying vec3 centerVCVSOutput;\nvarying vec3 orientVCVSOutput;\n\nuniform int cameraParallel;\n\nvoid main()\n{\n //VTK::Picking::Impl\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n vertexVCVSOutput = MCVCMatrix * vertexMC;\n centerVCVSOutput = vertexVCVSOutput.xyz;\n radiusVCVSOutput = radiusMC;\n lengthVCVSOutput = length(orientMC);\n orientVCVSOutput = normalMatrix * normalize(orientMC);\n\n // make sure it is pointing out of the screen\n if (orientVCVSOutput.z < 0.0)\n {\n orientVCVSOutput = -orientVCVSOutput;\n }\n\n // make the basis\n vec3 xbase;\n vec3 ybase;\n vec3 dir = vec3(0.0,0.0,1.0);\n if (cameraParallel == 0)\n {\n dir = normalize(-vertexVCVSOutput.xyz);\n }\n if (abs(dot(dir,orientVCVSOutput)) == 1.0)\n {\n xbase = normalize(cross(vec3(0.0,1.0,0.0),orientVCVSOutput));\n ybase = cross(xbase,orientVCVSOutput);\n }\n else\n {\n xbase = normalize(cross(orientVCVSOutput,dir));\n ybase = cross(orientVCVSOutput,xbase);\n }\n\n vec3 offsets = offsetMC.xyz*2.0-1.0;\n vertexVCVSOutput.xyz = vertexVCVSOutput.xyz +\n radiusVCVSOutput*offsets.x*xbase +\n radiusVCVSOutput*offsets.y*ybase +\n 0.5*lengthVCVSOutput*offsets.z*orientVCVSOutput;\n\n gl_Position = VCPCMatrix * vertexVCVSOutput;\n}\n",e.Fragment=L.A,e.Geometry=""},e.replaceShaderValues=(e,r,i)=>{let a=e.Vertex,o=e.Fragment;a=p.A.substitute(a,"//VTK::Camera::Dec",["uniform mat4 VCPCMatrix;\n","uniform mat4 MCVCMatrix;"]).result,o=p.A.substitute(o,"//VTK::PositionVC::Dec","varying vec4 vertexVCVSOutput;").result,o=p.A.substitute(o,"//VTK::PositionVC::Impl"," vec4 vertexVC = vertexVCVSOutput;\n").result,o=p.A.substitute(o,"//VTK::Normal::Dec",["uniform int cameraParallel;\n","varying float radiusVCVSOutput;\n","varying vec3 orientVCVSOutput;\n","varying float lengthVCVSOutput;\n","varying vec3 centerVCVSOutput;\n","uniform mat4 VCPCMatrix;\n"]).result;let s="";t.context.getExtension("EXT_frag_depth")&&(s=" gl_FragDepthEXT = (pos.z / pos.w + 1.0) / 2.0;\n"),t._openGLRenderWindow.getWebgl2()&&(s="gl_FragDepth = (pos.z / pos.w + 1.0) / 2.0;\n"),o=p.A.substitute(o,"//VTK::Depth::Impl",[" vec3 EyePos;\n"," vec3 EyeDir;\n"," if (cameraParallel != 0) {\n"," EyePos = vec3(vertexVC.x, vertexVC.y, vertexVC.z + 3.0*radiusVCVSOutput);\n"," EyeDir = vec3(0.0,0.0,-1.0); }\n"," else {\n"," EyeDir = vertexVC.xyz;\n"," EyePos = vec3(0.0,0.0,0.0);\n"," float lengthED = length(EyeDir);\n"," EyeDir = normalize(EyeDir);\n"," if (lengthED > radiusVCVSOutput*3.0) {\n"," EyePos = vertexVC.xyz - EyeDir*3.0*radiusVCVSOutput; }\n"," }\n"," EyePos = EyePos - centerVCVSOutput;\n"," vec3 base1;\n"," if (abs(orientVCVSOutput.z) < 0.99) {\n"," base1 = normalize(cross(orientVCVSOutput,vec3(0.0,0.0,1.0))); }\n"," else {\n"," base1 = normalize(cross(orientVCVSOutput,vec3(0.0,1.0,0.0))); }\n"," vec3 base2 = cross(orientVCVSOutput,base1);\n"," EyePos = vec3(dot(EyePos,base1),dot(EyePos,base2),dot(EyePos,orientVCVSOutput));\n"," EyeDir = vec3(dot(EyeDir,base1),dot(EyeDir,base2),dot(EyeDir,orientVCVSOutput));\n"," EyePos = EyePos/radiusVCVSOutput;\n"," float a = EyeDir.x*EyeDir.x + EyeDir.y*EyeDir.y;\n"," float b = 2.0*(EyePos.x*EyeDir.x + EyePos.y*EyeDir.y);\n"," float c = EyePos.x*EyePos.x + EyePos.y*EyePos.y - 1.0;\n"," float d = b*b - 4.0*a*c;\n"," vec3 normalVCVSOutput = vec3(0.0,0.0,1.0);\n"," if (d < 0.0) { discard; }\n"," else {\n"," float t = (-b - sqrt(d))/(2.0*a);\n"," float tz = EyePos.z + t*EyeDir.z;\n"," vec3 iPoint = EyePos + t*EyeDir;\n"," if (abs(iPoint.z)*radiusVCVSOutput > lengthVCVSOutput*0.5) {\n"," float t2 = (-b + sqrt(d))/(2.0*a);\n"," float tz2 = EyePos.z + t2*EyeDir.z;\n"," if (tz2*radiusVCVSOutput > lengthVCVSOutput*0.5 || tz*radiusVCVSOutput < -0.5*lengthVCVSOutput) { discard; }\n"," else {\n"," normalVCVSOutput = orientVCVSOutput;\n"," float t3 = (lengthVCVSOutput*0.5/radiusVCVSOutput - EyePos.z)/EyeDir.z;\n"," iPoint = EyePos + t3*EyeDir;\n"," vertexVC.xyz = radiusVCVSOutput*(iPoint.x*base1 + iPoint.y*base2 + iPoint.z*orientVCVSOutput) + centerVCVSOutput;\n"," }\n"," }\n"," else {\n"," normalVCVSOutput = iPoint.x*base1 + iPoint.y*base2;\n"," vertexVC.xyz = radiusVCVSOutput*(normalVCVSOutput + iPoint.z*orientVCVSOutput) + centerVCVSOutput;\n"," }\n"," }\n"," vec4 pos = VCPCMatrix * vertexVC;\n",s]).result,o=p.A.substitute(o,"//VTK::Normal::Impl","").result,t.haveSeenDepthRequest&&(o=p.A.substitute(o,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float computedZ = (pos.z / pos.w + 1.0) / 2.0;","float iz = floor(computedZ * 65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),e.Vertex=a,e.Fragment=o,n.replaceShaderValues(e,r,i)},e.setMapperShaderParameters=(e,r,i)=>{e.getCABO().getElementCount()&&(t.VBOBuildTime>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime())&&(e.getProgram().isAttributeUsed("orientMC")&&!e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"orientMC",12,e.getCABO().getStride(),t.context.FLOAT,3,!1)&&G("Error setting 'orientMC' in shader VAO."),e.getProgram().isAttributeUsed("offsetMC")&&!e.getVAO().addAttributeArray(e.getProgram(),e.getCABO().getColorBO(),"offsetMC",0,e.getCABO().getColorBOStride(),t.context.UNSIGNED_BYTE,3,!0)&&G("Error setting 'offsetMC' in shader VAO."),e.getProgram().isAttributeUsed("radiusMC")&&!e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"radiusMC",24,e.getCABO().getStride(),t.context.FLOAT,1,!1)&&G("Error setting 'radiusMC' in shader VAO.")),n.setMapperShaderParameters(e,r,i)},e.setCameraShaderParameters=(e,r,n)=>{let i=e.getProgram(),a=r.getActiveCamera(),o=t.openGLCamera.getKeyMatrices(r);if(i.isUniformUsed("VCPCMatrix")&&i.setUniformMatrix("VCPCMatrix",o.vcpc),n.getIsIdentity())i.isUniformUsed("MCVCMatrix")&&i.setUniformMatrix("MCVCMatrix",o.wcvc),i.isUniformUsed("normalMatrix")&&i.setUniformMatrix3x3("normalMatrix",o.normalMatrix);else{let e=t.openGLActor.getKeyMatrices();if(i.isUniformUsed("MCVCMatrix")){let t=new Float64Array(16);v.multiply(t,o.wcvc,e.mcwc),i.setUniformMatrix("MCVCMatrix",t)}if(i.isUniformUsed("normalMatrix")){let t=new Float64Array(9);g.multiply(t,o.normalMatrix,e.normalMatrix),i.setUniformMatrix3x3("normalMatrix",t)}}i.isUniformUsed("cameraParallel")&&e.getProgram().setUniformi("cameraParallel",a.getParallelProjection())},e.getOpenGLMode=(e,r)=>t.context.TRIANGLES,e.buildBufferObjects=(e,r)=>{let n=t.currentInput;if(null===n)return;t.renderable.mapScalars(n,1);let i=t.renderable.getColorMapColors(),a=t.primitives[t.primTypes.Tris].getCABO(),o=n.getPointData(),s=n.getPoints(),l=s.getNumberOfPoints(),u=s.getData(),d=null,p=0;a.setColorBOStride(4),a.getColorBO()||a.setColorBO(c.Ay.newInstance()),a.getColorBO().setOpenGLRenderWindow(t._openGLRenderWindow),i&&(p=i.getNumberOfComponents(),a.setColorOffset(4),d=i.getData(),a.setColorBOStride(8)),a.setColorComponents(p),a.setStride(28);let m=new Float32Array(7*l*12),h=new Uint8Array(12*l*(d?8:4)),f=null,g=null;null!=t.renderable.getScaleArray()&&o.hasArray(t.renderable.getScaleArray())&&(f=o.getArray(t.renderable.getScaleArray()).getData()),null!=t.renderable.getOrientationArray()&&o.hasArray(t.renderable.getOrientationArray())?g=o.getArray(t.renderable.getOrientationArray()).getData():G(["Error setting orientationArray.\n","You have to specify the stick orientation"]);let v=[0,1,3,0,3,2,2,3,5,2,5,4],y=0,b=0,I=0,x=0;for(let e=0;e=4),h[x++]=255*(v[t]>=2),h[x++]=255,b=e*p,d&&(h[x++]=d[b],h[x++]=d[b+1],h[x++]=d[b+2],h[x++]=d[b+3])}a.setElementCount(I/7),a.upload(m,V.a.ARRAY_BUFFER),a.getColorBO().upload(h,V.a.ARRAY_BUFFER),t.VBOBuildTime.modified()}},"vtkOpenGLStickMapper"),H={newInstance:z};(0,u.c9)("vtkStickMapper",z);var j=r(61052),$=r(52046),K=r(16116),q=r(81522),X=r(87352),Y=r(99298),Z=r(69927),J=r(67931),Q=r(42215);let{vtkErrorMacro:ee}=n.Ay,et={},er={newInstance:n.Ay.newInstance(function(e,t,r={}){Object.assign(t,et,r),E.Ay.extend(e,t,r),r.scalarTexture?t.scalarTextures=[r.scalarTexture]:t.scalarTextures=[],t.scalarTextureStrings=[],t._scalarTexturesCore=[];t.classHierarchy.push("vtkStreamingOpenGLImageResliceMapper");let n=new Map;function i(t,r,i){r!==i&&(!function(t,r){if(!r)return;let i=(n.get(r)??0)-1;i<=0?(t.unregisterGraphicsResourceUser(r,e),n.delete(r)):n.set(r,i)}(t,r),function(t,r){if(!r)return;let i=n.get(r)??0;n.set(r,i+1),i<=0&&t.registerGraphicsResourceUser(r,e)}(t,i))}e.renderPiece=(r,n)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update();let i=t.renderable.getNumberOfInputPorts();t.currentValidInputs=[];for(let e=0;e1,t.numberOfComponents=t.multiTexturePerVolumeEnabled?a:"number"==typeof l?l:s?.getNumberOfComponents?.()??1,e.updateResliceGeometry(),e.renderPieceStart(r,n),e.renderPieceDraw(r,n),e.renderPieceFinish(r,n),e.invokeEvent({type:"EndEvent"})},e.getNeedToRebuildBufferObjects=(r,n)=>{let i=t.labelOutlineProperties.length>0;if(t.VBOBuildTime.getMTime()t.VBOBuildTime.getMTime()0)for(let e=0;e{let a=n.getProperties();t.currentValidInputs.forEach(({imageData:e},r)=>{t.scalarTextures||(t.scalarTextures=[]),t.scalarTextures[r]||(t.scalarTextures[r]=j.Ay.newInstance());let n=t.scalarTextures[r],o=a[r],s=o.getUpdatedExtents(),l=!!s.length;if(n&&"function"==typeof n.hasUpdatedFrames){let r=e.getDimensions(),{dataType:i}=e.get("dataType"),a=t.numberOfComponents;n.setOpenGLRenderWindow(t._openGLRenderWindow),n.enableUseHalfFloat?.(!1);let s=n.getTextureParameters?.(),u=!0;if(s?.dataType===i&&s?.width===r[0]&&s?.height===r[1]&&s?.depth===r[2]&&(u=!1),u){let e=t.context.getExtension("EXT_texture_norm16");n.setOglNorm16Ext((0,Q.up)()?e:null),n.resetFormatAndType(),n.setTextureParameters?.({width:r[0],height:r[1],depth:r[2],numberOfComponents:a,dataType:i}),n.create3DFromRaw({width:r[0],height:r[1],depth:r[2],numComps:a,dataType:i,data:null}),n.update3DFromRaw()}else n.deactivate?.(),n.update3DFromRaw();l&&o.setUpdatedExtents([]);return}let u=e.getPointData().getScalars();if(!u)return void ee("No scalars available for non-streaming reslice mapper");let c=t._openGLRenderWindow.getGraphicsResourceForObject(u),d=(0,J.eS)(e,u);if(c?.oglObject?.getHandle()&&c?.hash===d||l)t.scalarTextures[r]=c.oglObject;else{let n=j.Ay.newInstance();n.setOpenGLRenderWindow(t._openGLRenderWindow);let i=e.getDimensions();n.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),n.resetFormatAndType(),n.create3DFilterableFromDataArray({width:i[0],height:i[1],depth:i[2],dataArray:u}),t._openGLRenderWindow.setGraphicsResourceForObject(u,n,d),t.scalarTextures[r]=n}if(l){o.setUpdatedExtents([]);let n=e.getDimensions();t.scalarTextures[r].create3DFilterableFromDataArray({width:n[0],height:n[1],depth:n[2],dataArray:u,updatedExtents:s})}i(t._openGLRenderWindow,t._scalarTexturesCore[r],u),t._scalarTexturesCore[r]=u});let o=a[t.currentValidInputs[0].inputIndex],s=o.getIndependentComponents(),l=s?t.numberOfComponents:1,u=s?2*l:1,c=[];for(let e=0;e0&&(e.updateLabelOutlineThicknessTexture(t.labelOutlineProperties),e.updateLabelOutlineOpacityTexture(t.labelOutlineProperties));let y=`${t.resliceGeom.getMTime()}A${t.renderable.getSlabThickness()}`;if(!t.tris.getCABO().getElementCount()||t.VBOBuildString!==y){let e=X.Ay.newInstance({numberOfComponents:3,values:t.resliceGeom.getPoints().getData()});e.setName("points");let r=X.Ay.newInstance({numberOfComponents:1,values:t.resliceGeom.getPolys().getData()}),n={points:e,cellOffset:0};if(t.renderable.getSlabThickness()>0){let e=t.resliceGeom.getPointData().getNormals();e?n.normals=e:ee("Slab mode requested without normals")}t.tris.getCABO().createVBO(r,"polys",Z.YL.SURFACE,n)}t.VBOBuildString=y,t.VBOBuildTime.modified()}},"vtkStreamingOpenGLImageResliceMapper")};var en=r(5889),ei=r(23985);let ea={},eo={newInstance:n.Ay.newInstance(function(e,t,r={}){Object.assign(t,ea,r),K.Ay.extend(e,t,r),r.scalarTexture?t.scalarTextures=[r.scalarTexture]:t.scalarTextures=[],t.scalarTextureStrings=[],t._scalarTexturesCore=[],t.previousState={};t.classHierarchy.push("vtkStreamingOpenGLVolumeMapper");let n=new Map;function i(t,r,i){r!==i&&(!function(t,r){if(!r)return;let i=(n.get(r)??0)-1;i<=0?(t.unregisterGraphicsResourceUser(r,e),n.delete(r)):n.set(r,i)}(t,r),function(t,r){if(!r)return;let i=n.get(r)??0;n.set(r,i+1),i<=0&&t.registerGraphicsResourceUser(r,e)}(t,i))}e.renderPiece=(r,n)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update();let i=t.renderable.getNumberOfInputPorts();t.currentValidInputs=[];for(let e=0;e0){let e=n.getProperties(),i=t.currentValidInputs[0],o=i.imageData,s=e[i.inputIndex];s.getShade()&&t.renderable.getBlendMode()===ei.N.COMPOSITE_BLEND&&r.getLights().forEach(e=>{e.getSwitch()>0&&a++});let l=t.currentValidInputs.length,u=l>1,{numberOfComponents:c}=o.get("numberOfComponents");t.numberOfComponents=u?l:c,t.numberOfComponents>1?t.useIndependentComponents=s.getIndependentComponents():t.useIndependentComponents=!1}a!==t.numberOfLights&&(t.numberOfLights=a,e.modified()),e.invokeEvent({type:"EndEvent"}),0!==t.currentValidInputs.length&&(e.renderPieceStart(r,n),e.renderPieceDraw(r,n),e.renderPieceFinish(r,n))},e.buildBufferObjects=(r,n)=>{if(!t.jitterTexture.getHandle()){let e=new Float32Array(1024);for(let t=0;t<1024;++t)e[t]=Math.random();t.jitterTexture.setMinificationFilter(en.dJ.NEAREST),t.jitterTexture.setMagnificationFilter(en.dJ.NEAREST),t.jitterTexture.create2DFromRaw({width:32,height:32,numComps:1,dataType:Y.JA.FLOAT,data:e})}let a=n.getProperties()[t.currentValidInputs[0].inputIndex],o=t.numberOfComponents,s=t.useIndependentComponents,l=s?o:1,u=[];for(let e=0;e{if(t.scalarTextures||(t.scalarTextures=[]),!t.scalarTextures[n])return void console.warn(`ScalarTexture for component ${n} not initialized, skipping.`);let i=t.scalarTextures[n],a=`${e.getMTime()}-${i.getMTime()}`;if(t.scalarTextureStrings||(t.scalarTextureStrings=[]),t.scalarTextureStrings[n]!==a){let r=e.getDimensions();i.setOpenGLRenderWindow(t._openGLRenderWindow),i.enableUseHalfFloat(!1);let o=i.getTextureParameters(),s=e.get("dataType").dataType,l=e.getPointData()?.getScalars()?.getNumberOfComponents?.()??e.get("numberOfComponents").numberOfComponents??1,u=!0;if(o?.dataType===s&&o?.width===r[0]&&o?.height===r[1]&&o?.depth===r[2]&&o?.numberOfComponents===l&&(u=!1),u){let e=t.context.getExtension("EXT_texture_norm16");i.setOglNorm16Ext((0,Q.up)()?e:null),i.resetFormatAndType(),i.setTextureParameters({width:r[0],height:r[1],depth:r[2],numberOfComponents:l,dataType:s}),i.create3DFromRaw({width:r[0],height:r[1],depth:r[2],numComps:l,dataType:s,data:null}),i.update3DFromRaw()}else i.deactivate(),i.update3DFromRaw();t.scalarTextureStrings[n]=a}t._scalarTexturesCore||(t._scalarTexturesCore=[])});let v=a.getLabelOutlineThickness(),y=t._openGLRenderWindow.getGraphicsResourceForObject(v),b=v.join("-");if(y?.oglObject?.getHandle()&&y?.hash===b)t.labelOutlineThicknessTexture=y.oglObject;else{let e=j.Ay.newInstance();e.setOpenGLRenderWindow(t._openGLRenderWindow);let r=t.renderable.getLabelOutlineTextureWidth();r<=0&&(r=t.context.getParameter(t.context.MAX_TEXTURE_SIZE));let n=new Uint8Array(+r);for(let e=0;e1?1:-1,e[3*t+2]=-1;let r=new Uint16Array(8);r[0]=3,r[1]=0,r[2]=1,r[3]=3,r[4]=3,r[5]=0,r[6]=3,r[7]=2;let n=X.Ay.newInstance({numberOfComponents:3,values:e});n.setName("points");let i=X.Ay.newInstance({numberOfComponents:1,values:r});t.tris.getCABO().createVBO(i,"polys",Z.YL.SURFACE,{points:n,cellOffset:0})}t.VBOBuildTime.modified()},e.getNeedToRebuildBufferObjects=(r,n)=>{if(t.VBOBuildTime.getMTime()0)for(let e=0;e0)for(let e=0;e{if(r.isDeleted())return null;let n=0,i=r.getClassName(n++),a=!1,o=Object.keys(t.overrides);for(;i&&!a;)o.includes(i)?a=!0:i=r.getClassName(n++);if(!a)return null;let s=t.getModelInitialValues(r),l=t.overrides[i](s);return l.setMyFactory(e),l},t.overrides=es,t.getModelInitialValues=e=>{let t={},r=e.getClassName();return"vtkSharedVolumeMapper"===r&&(t.scalarTexture=e.getScalarTexture()),"vtkSharedImageResliceMapper"===r&&(t.scalarTexture=e.getScalarTexture()),t},es.vtkActor=a.Ay.newInstance,es.vtkActor2D=o.Ay.newInstance,es.vtkCamera=s.Ay.newInstance,es.vtkGlyph3DMapper=w.newInstance,es.vtkImageMapper=O.Ay.newInstance,es.vtkImageCPRMapper=P.Ay.newInstance,es.vtkImageResliceMapper=E.Ay.newInstance,es.vtkImageSlice=_.Ay.newInstance,es.vtkMapper=f.Ay.newInstance,es.vtkPixelSpaceCallbackMapper=D.Ay.newInstance,es.vtkRenderer=R.Ay.newInstance,es.vtkSkybox=M.Ay.newInstance,es.vtkSphereMapper=k.newInstance,es.vtkStickMapper=H.newInstance,es.vtkTexture=j.Ay.newInstance,es.vtkVolume=$.Ay.newInstance,es.vtkVolumeMapper=K.Ay.newInstance,es.vtkSharedVolumeMapper=eo.newInstance,es.vtkSharedImageResliceMapper=er.newInstance},"vtkStreamingOpenGLViewNodeFactory")},ec=n.Ay.newInstance(function(e,t,r={}){Object.assign(t,r),i.Ay.extend(e,t,r),t.myFactory=eu.newInstance(),es.vtkRenderWindow=ec,t.classHierarchy.push("vtkStreamingOpenGLRenderWindow")},"vtkStreamingOpenGLRenderWindow"),ed={newInstance:ec};var ep=r(1943),em=r(628),eh=r(91923);r(30536),r(19047),r(89473),r(12412);let ef={background:[0,0,0],container:null};function eg(e,t,r={}){Object.assign(t,ef,r),n.Ay.obj(e,t),n.Ay.get(e,t,["renderWindow","openGLRenderWindow","interactor","container"]),n.Ay.event(e,t,"resize");let i=e.invokeResize;delete e.invokeResize,t.renderWindow=em.Ay.newInstance(),t.rendererMap={},t.openGLRenderWindow=ed.newInstance(),t.renderWindow.addView(t.openGLRenderWindow),t.interactor=eh.Ay.newInstance(),t.interactor.setView(t.openGLRenderWindow),t.interactor.initialize(),e.addRenderer=({viewport:e,id:r,background:n})=>{let i=ep.Ay.newInstance({viewport:e,background:n||t.background});t.renderWindow.addRenderer(i),t.rendererMap[r]=i},e.destroy=()=>{t.renderWindow.getInteractor().delete()},e.removeRenderer=r=>{let n=e.getRenderer(r);t.renderWindow.removeRenderer(n),n.delete(),delete t.rendererMap[r]},e.getRenderer=e=>t.rendererMap[e],e.getRenderers=()=>{let{rendererMap:e}=t;return Object.keys(e).map(t=>({id:t,renderer:e[t]}))},e.resize=()=>{if(t.container){let{width:e,height:r}=t.container;t.openGLRenderWindow.setSize(Math.floor(e),Math.floor(r)),i(),t.renderWindow.render()}},e.setContainer=e=>{t.container=e,t.openGLRenderWindow.setContainer(t.container)},e.delete=n.Ay.chain(e.setContainer,e.destroy,t.openGLRenderWindow.delete,e.delete),e.resize()}let ev={newInstance:n.Ay.newInstance(eg),extend:eg};var ey=r(58804),eb=r(10463),eI=r(88838),{SlabTypes:ex}=r(36505).A,{staticOffsetAPI:eC,otherStaticMethods:eA}=eb.Ay;function eT(e,t,r={}){Object.assign(t,{slabThickness:0,slabTrapezoidIntegration:0,slabType:ex.MEAN,slicePlane:null,slicePolyData:null,...r}),eI.A.extend(e,t,r),n.Ay.setGet(e,t,["slabThickness","slabTrapezoidIntegration","slabType","slicePlane","slicePolyData"]),eb.Ay.implementCoincidentTopologyMethods(e,t),t.classHierarchy.push("vtkImageResliceMapper"),e.computeBounds=()=>{let r=e.getInputData();e.getSlicePolyData()?ey.Ay.setBounds(t.bounds,e.getSlicePolyData().getBounds()):r?(ey.Ay.setBounds(t.bounds,r.getBounds()),e.getSlicePlane()&&ey.Ay.cutWithPlane(t.bounds,e.getSlicePlane().getOrigin(),e.getSlicePlane().getNormal())):ey.Ay.reset(t.bounds)}}var eS={newInstance:n.Ay.newInstance(eT,"vtkImageResliceMapper"),extend:eT,...eC,...eA};let ew={scalarTexture:null};function eO(e,t,r={}){Object.assign(t,ew,r),eS.extend(e,t,r),n.Ay.setGet(e,t,["scalarTexture"]);t.classHierarchy.push("vtkSharedImageResliceMapper");let i=e.delete;e.delete=()=>{t.scalarTexture=null,i()}}let eP={newInstance:n.Ay.newInstance(eO,"vtkSharedImageResliceMapper"),extend:eO};var e_=r(54731);let eE={scalarTexture:null};function eD(e,t,r={}){Object.assign(t,eE,r),e_.Ay.extend(e,t,r),n.Ay.setGet(e,t,["scalarTexture"]);t.classHierarchy.push("vtkSharedVolumeMapper");let i=e.delete;e.delete=()=>{t.scalarTexture=null,i()}}let eR={newInstance:n.Ay.newInstance(eD,"vtkSharedVolumeMapper"),extend:eD};var eM=r(54268),eN=r(6560);function eV(e,t){let r=new((0,eN.j)(t))(e.length);return r.set(e),r}let eL={updatedFrames:[]};function eB(e,t,r={}){Object.assign(t,eL,r),j.Ay.extend(e,t,r);t.classHierarchy.push("vtkStreamingOpenGLTexture"),t.updatedFrames=[],t.volumeId=null;let n=e.create3DFilterableFromRaw;e.create3DFilterableFromRaw=({width:e,height:r,depth:i,numberOfComponents:a,dataType:o,data:s,preferSizeOverAccuracy:l})=>{t.inputDataType=o,t.inputNumComps=a,n({width:e,height:r,depth:i,numberOfComponents:a,dataType:o,data:s,preferSizeOverAccuracy:l})};let i=e.updateVolumeInfoForGL;e.updateVolumeInfoForGL=(e,r)=>{let n=i(e,r);return t.volumeInfo.dataComputedScale=[1],t.volumeInfo.dataComputedOffset=[0],n},e.update3DFromRaw=()=>{let{volumeId:r}=t;if(!r)return;let n=eM.Ay.getVolume(r);if(n)return(t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),n.isDynamicVolume())?void function(){let r=eM.Ay.getVolume(t.volumeId),n=r.getCurrentDimensionGroupImageIds();if(n.length){for(let i=0;i{t.updatedFrames[e]=!0,a()},e.modified=()=>{a();let e=eM.Ay.getVolume(t.volumeId);if(!e)return;let r=e.imageIds;for(let e=0;e!t.updatedFrames.length||t.updatedFrames.some(e=>e),e.getUpdatedFrames=()=>t.updatedFrames,e.setVolumeId=e=>{t.volumeId=e},e.getVolumeId=()=>t.volumeId,e.setTextureParameters=({width:e,height:r,depth:n,numberOfComponents:i,dataType:a})=>{t.width??=e,t.height??=r,t.depth??=n,t.inputNumComps??=i,t.inputDataType??=a},e.getTextureParameters=()=>({width:t.width,height:t.height,depth:t.depth,numberOfComponents:t.inputNumComps,dataType:t.inputDataType})}let eF={newInstance:n.Ay.newInstance(eB,"vtkStreamingOpenGLTexture"),extend:eB};r(18459)},36427:(e,t,r)=>{"use strict";r.d(t,{H:()=>o});var n=r(70192);function i(e){return"__proto__"===e||"constructor"===e||"prototype"===e}class a{constructor(e){this.getGroupKey=e=>{if("string"==typeof e)return e;let t=(0,n.kJ)(e);if(!t)throw Error("Element not enabled, you must have an enabled element if you are not providing a FrameOfReferenceUID");return t.FrameOfReferenceUID},this._imageVolumeModifiedHandler=e=>{let{FrameOfReferenceUID:t}=e.detail,r=this.annotations[t];r&&Object.keys(r).forEach(e=>{r[e].forEach(e=>{void 0!==e.invalidated&&(e.invalidated=!0)})})},this.getFramesOfReference=()=>Object.keys(this.annotations),this.getAnnotations=(e,t)=>{let r=this.annotations;return r[e]?t?r[e][t]?r[e][t]:[]:r[e]:[]},this.getAnnotation=e=>{let t=this.annotations;for(let r in t){let n=t[r];for(let t in n)for(let r of n[t])if(e===r.annotationUID)return r}},this.getNumberOfAnnotations=(e,t)=>{let r=this.getAnnotations(e,t);if(!r.length)return 0;if(t)return r.length;let n=0;for(let e in r)n+=r[e].length;return n},this.addAnnotation=(e,t)=>{let{metadata:r}=e,{FrameOfReferenceUID:n,toolName:a}=r;if(i(t=t||n)||i(a))return;let o=this.annotations,s=o[t];s||(o[t]={},s=o[t]);let l=s[a];l||(s[a]=[],l=s[a]),this.preprocessingFn&&(e=this.preprocessingFn(e)),l.push(e)},this.removeAnnotation=e=>{let{annotations:t}=this;for(let r in t){let n=t[r];for(let t in n){let r=n[t],i=r.findIndex(t=>t.annotationUID===e);-1!==i&&(r.splice(i,1),0===r.length&&delete n[t])}0===Object.keys(n).length&&delete t[r]}},this.removeAnnotations=(e,t)=>{let r=this.annotations,n=[];if(!r[e])return n;if(t){let i=r[e][t];if(i)for(let e of i)this.removeAnnotation(e.annotationUID),n.push(e)}else for(let t in r[e])for(let i of r[e][t])this.removeAnnotation(i.annotationUID),n.push(i);return n},this.saveAnnotations=(e,t)=>{let r=this.annotations;if(e&&t){let i=r[e];if(!i)return;let a=i[t];return n.BF.deepClone(a)}if(e){let t=r[e];return n.BF.deepClone(t)}return n.BF.deepClone(r)},this.restoreAnnotations=(e,t,r)=>{let i=this.annotations;if(t&&r){let n=i[t];n||(i[t]={},n=i[t]),n[r]=e}else t?i[t]=e:this.annotations=n.BF.deepClone(e)},this.getAllAnnotations=()=>Object.values(this.annotations).map(e=>Object.values(e)).flat(2),this.getNumberOfAllAnnotations=()=>{let e=0,t=this.annotations;for(let r in t){let n=t[r];for(let t in n)e+=n[t].length}return e},this.removeAllAnnotations=()=>{let e=[];for(let t of this.getAllAnnotations())this.removeAnnotation(t.annotationUID),e.push(t);return e},e||(e=n.BF.uuidv4()),this.annotations={},this.uid=e,n.tX.addEventListener(n.fX.sV.IMAGE_VOLUME_MODIFIED,this._imageVolumeModifiedHandler)}setPreprocessingFn(e){this.preprocessingFn=e}}let o=new a("DEFAULT")},36505:(e,t,r)=>{"use strict";r.d(t,{A:()=>i,m:()=>n});var n={MIN:0,MAX:1,MEAN:2,SUM:3},i={SlabTypes:n}},36898:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var n=r(78378),i=r(42306);let{Active:a,Passive:o,Enabled:s}=n.r$;function l(e,t){let r=e.length,n=[];for(let l=0;l{"use strict";r.d(t,{wk:()=>o}),r(37298),r(59998),r(12577);var n=r(93022),i=r(34699);r(10353),r(36427),r(70192),r(31895);var a=r(60721);let o={...n,...i,resetAnnotationManager:a.c}},36965:(e,t,r)=>{"use strict";r.d(t,{V:()=>a});var n=r(59998),i=r(43385);function a(e){if(e.parentAnnotationUID)return;if(!e.data.segmentation)throw Error("addContourSegmentationAnnotation: annotation does not have a segmentation data");let{segmentationId:t,segmentIndex:r}=e.data.segmentation,a=(0,i.T)(t);a.representationData.Contour||(a.representationData.Contour={annotationUIDsMap:new Map});let{annotationUIDsMap:o}=a.representationData.Contour;o||(o=new Map);let s=o?.get(r);s||(s=new Set,o.set(r,s)),a.segments[r].locked&&(0,n.Un)(e.annotationUID,!0),o.set(r,s.add(e.annotationUID))}},37128:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(57752);function i(e,t,r){if(void 0===e)throw Error("setToPixelCoordinateSystem: parameter enabledElement must not be undefined");if(void 0===t)throw Error("setToPixelCoordinateSystem: parameter context must not be undefined");let i=(0,n.A)(e,r).getMatrix();t.setTransform(i[0],i[1],i[2],i[3],i[4],i[5])}},37190:(e,t,r)=>{"use strict";function n(e){let t,r=e[0],n=e[0],i=e.length;for(let a=1;an})},37209:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DOMParserImpl=void 0;let n=r(47518),i=r(92432);class a{parseFromString(e,t){if("text/html"===t)throw Error("HTML parser not implemented.");try{let r=new i.XMLParserImpl().parse(e);return r._contentType=t,r}catch(a){let e="http://www.mozilla.org/newlayout/xml/parsererror.xml",t=(0,n.create_xmlDocument)(),r=t.createElementNS(e,"parsererror"),i=t.createElementNS(e,"error");return i.setAttribute("message",a.message),r.appendChild(i),t.appendChild(r),t}}}t.DOMParserImpl=a},37216:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>o,uE:()=>a,zy:()=>i});var n={};function i(e){return!!n[e]}function a(e,t){n[e]=t}var o={get:function(e="http",t={}){return n[e](t)},has:i,registerType:a}},37298:(e,t,r)=>{"use strict";r.d(t,{Gu:()=>o});var n=r(59998),i=r(12577),a=r(78378);let o=function(e){if(e){if(e.data&&e.highlighted)return a.dt.Highlighted;if((0,i.zN)(e.annotationUID))return a.dt.Selected;if((0,n.Gh)(e.annotationUID))return a.dt.Locked;if(e.data&&e.autoGenerated)return a.dt.AutoGenerated}return a.dt.Default};r(68764),r(74086)},37406:(e,t,r)=>{"use strict";r.d(t,{J:()=>l});var n=r(70192),i=r(65509),a=r(40454),o=r(76399);function s(e,t){let r=t.referencedImageIds??t.imageIds??[],i=t.imageIds??[],a=i[0]?n.PP.getImage(i[0]):null,o=a?.voxelManager?.getConstructor?.().name??"Uint8Array",s=n.R2.createAndCacheDerivedImages(r,{getDerivedImageId:t=>`${e.segmentationId}-storage-${n.BF.uuidv4()}-${t.slice(-12)}`,targetBuffer:{type:o}});return{labelmapId:`${e.segmentationId}-storage-${n.BF.uuidv4()}`,storageKind:"stack",imageIds:s.map(e=>e.imageId),referencedVolumeId:t.referencedVolumeId,referencedImageIds:r,labelToSegmentIndex:{}}}function l(e,t,r={}){let u=(0,a.hM)(e,t);if(!u)return;let c=(0,i.Hs)(e,u.labelmapId);if(!c)return;if((0,a.I3)(e,c.labelmapId).length<=1)return c;let d=function(e,t){if(t.imageIds?.length||t.referencedImageIds?.length)return s(e,t);if(t.volumeId){let r=n.PP.getVolume(t.volumeId),i=`${e.segmentationId}-storage-${n.BF.uuidv4()}`,a=t.referencedVolumeId??r?.referencedVolumeId??t.volumeId,o=n.UH.createAndCacheDerivedLabelmapVolume(a,{volumeId:i});return{labelmapId:i,storageKind:"volume",volumeId:i,imageIds:o.imageIds,referencedVolumeId:a,referencedImageIds:t.referencedImageIds??r?.referencedImageIds,labelToSegmentIndex:{}}}return s(e,t)}(e,c);(0,i.AD)(e,d);let p=[];if(c.volumeId&&d.volumeId){let e=n.PP.getVolume(c.volumeId),t=n.PP.getVolume(d.volumeId),r=[];e.voxelManager.forEach(({value:n,index:i})=>{n===u.labelValue&&(t.voxelManager.setAtIndex(i,1),e.voxelManager.setAtIndex(i,0),r.push(i))}),r.length&&p.push({source:e.voxelManager,target:t.voxelManager,indices:r})}else{let e=c.imageIds??[],t=d.imageIds??[];e.forEach((e,r)=>{let i=n.PP.getImage(e),a=n.PP.getImage(t[r]);if(!i||!a)return;let o=[];i.voxelManager.forEach(({value:e,index:t})=>{e===u.labelValue&&(a.voxelManager.setAtIndex(t,1),i.voxelManager.setAtIndex(t,0),o.push(t))}),o.length&&p.push({source:i.voxelManager,target:a.voxelManager,indices:o})})}let m={...u},h={labelmapId:d.labelmapId,labelValue:1};return(0,a.Zs)(e,t,{...h}),(0,o.x)(e),r.moveStepCallback?.({undo:()=>{for(let{source:e,target:t,indices:r}of p)for(let n of r)t.setAtIndex(n,0),e.setAtIndex(n,m.labelValue);(0,a.Zs)(e,t,{...m}),(0,i.$n)(e,d.labelmapId),(0,o.x)(e)},redo:()=>{for(let{source:t,target:r,indices:n}of((0,i.AD)(e,d),p))for(let e of n)t.setAtIndex(e,0),r.setAtIndex(e,1);(0,a.Zs)(e,t,{...h}),(0,o.x)(e)}}),d}},37579:(e,t,r)=>{"use strict";function n(e){let t=e.getMapper().getInputData(),r=t.extentToBounds(t.getExtent());return[[r[0],r[2],r[4]],[r[0],r[2],r[5]],[r[0],r[3],r[4]],[r[0],r[3],r[5]],[r[1],r[2],r[4]],[r[1],r[2],r[5]],[r[1],r[3],r[4]],[r[1],r[3],r[5]]]}r.d(t,{A:()=>n})},37843:(e,t,r)=>{"use strict";r.r(t),r.d(t,{add:()=>P,adjoint:()=>m,clone:()=>o,copy:()=>s,create:()=>i,determinant:()=>h,equals:()=>M,exactEquals:()=>R,frob:()=>O,fromMat2d:()=>C,fromMat4:()=>a,fromQuat:()=>A,fromRotation:()=>I,fromScaling:()=>x,fromTranslation:()=>b,fromValues:()=>l,identity:()=>c,invert:()=>p,mul:()=>N,multiply:()=>f,multiplyScalar:()=>E,multiplyScalarAndAdd:()=>D,normalFromMat4:()=>T,projection:()=>S,rotate:()=>v,scale:()=>y,set:()=>u,str:()=>w,sub:()=>V,subtract:()=>_,translate:()=>g,transpose:()=>d});var n=r(97633);function i(){var e=new n.tb(9);return n.tb!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function a(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function o(e){var t=new n.tb(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function s(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function l(e,t,r,i,a,o,s,l,u){var c=new n.tb(9);return c[0]=e,c[1]=t,c[2]=r,c[3]=i,c[4]=a,c[5]=o,c[6]=s,c[7]=l,c[8]=u,c}function u(e,t,r,n,i,a,o,s,l,u){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=u,e}function c(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function d(e,t){if(e===t){var r=t[1],n=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=i}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function p(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=c*o-s*u,p=-c*a+s*l,m=u*a-o*l,h=r*d+n*p+i*m;return h?(h=1/h,e[0]=d*h,e[1]=(-c*n+i*u)*h,e[2]=(s*n-i*o)*h,e[3]=p*h,e[4]=(c*r-i*l)*h,e[5]=(-s*r+i*a)*h,e[6]=m*h,e[7]=(-u*r+n*l)*h,e[8]=(o*r-n*a)*h,e):null}function m(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8];return e[0]=o*c-s*u,e[1]=i*u-n*c,e[2]=n*s-i*o,e[3]=s*l-a*c,e[4]=r*c-i*l,e[5]=i*a-r*s,e[6]=a*u-o*l,e[7]=n*l-r*u,e[8]=r*o-n*a,e}function h(e){var t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8];return t*(u*a-o*l)+r*(-u*i+o*s)+n*(l*i-a*s)}function f(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=r[0],m=r[1],h=r[2],f=r[3],g=r[4],v=r[5],y=r[6],b=r[7],I=r[8];return e[0]=p*n+m*o+h*u,e[1]=p*i+m*s+h*c,e[2]=p*a+m*l+h*d,e[3]=f*n+g*o+v*u,e[4]=f*i+g*s+v*c,e[5]=f*a+g*l+v*d,e[6]=y*n+b*o+I*u,e[7]=y*i+b*s+I*c,e[8]=y*a+b*l+I*d,e}function g(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=r[0],m=r[1];return e[0]=n,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=p*n+m*o+u,e[7]=p*i+m*s+c,e[8]=p*a+m*l+d,e}function v(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=Math.sin(r),m=Math.cos(r);return e[0]=m*n+p*o,e[1]=m*i+p*s,e[2]=m*a+p*l,e[3]=m*o-p*n,e[4]=m*s-p*i,e[5]=m*l-p*a,e[6]=u,e[7]=c,e[8]=d,e}function y(e,t,r){var n=r[0],i=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function b(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}function I(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=0,e[3]=-r,e[4]=n,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function x(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function C(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}function A(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,l=i+i,u=r*o,c=n*o,d=n*s,p=i*o,m=i*s,h=i*l,f=a*o,g=a*s,v=a*l;return e[0]=1-d-h,e[3]=c-v,e[6]=p+g,e[1]=c+v,e[4]=1-u-h,e[7]=m-f,e[2]=p-g,e[5]=m+f,e[8]=1-u-d,e}function T(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],p=t[10],m=t[11],h=t[12],f=t[13],g=t[14],v=t[15],y=r*s-n*o,b=r*l-i*o,I=r*u-a*o,x=n*l-i*s,C=n*u-a*s,A=i*u-a*l,T=c*f-d*h,S=c*g-p*h,w=c*v-m*h,O=d*g-p*f,P=d*v-m*f,_=p*v-m*g,E=y*_-b*P+I*O+x*w-C*S+A*T;return E?(E=1/E,e[0]=(s*_-l*P+u*O)*E,e[1]=(l*w-o*_-u*S)*E,e[2]=(o*P-s*w+u*T)*E,e[3]=(i*P-n*_-a*O)*E,e[4]=(r*_-i*w+a*S)*E,e[5]=(n*w-r*P-a*T)*E,e[6]=(f*A-g*C+v*x)*E,e[7]=(g*I-h*A-v*b)*E,e[8]=(h*C-f*I+v*y)*E,e):null}function S(e,t,r){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/r,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}function w(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"}function O(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}function P(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e}function _(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e}function E(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e}function D(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e[4]=t[4]+r[4]*n,e[5]=t[5]+r[5]*n,e[6]=t[6]+r[6]*n,e[7]=t[7]+r[7]*n,e[8]=t[8]+r[8]*n,e}function R(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]}function M(e,t){var r=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=t[0],m=t[1],h=t[2],f=t[3],g=t[4],v=t[5],y=t[6],b=t[7],I=t[8];return Math.abs(r-p)<=n.p8*Math.max(1,Math.abs(r),Math.abs(p))&&Math.abs(i-m)<=n.p8*Math.max(1,Math.abs(i),Math.abs(m))&&Math.abs(a-h)<=n.p8*Math.max(1,Math.abs(a),Math.abs(h))&&Math.abs(o-f)<=n.p8*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(s-g)<=n.p8*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(l-v)<=n.p8*Math.max(1,Math.abs(l),Math.abs(v))&&Math.abs(u-y)<=n.p8*Math.max(1,Math.abs(u),Math.abs(y))&&Math.abs(c-b)<=n.p8*Math.max(1,Math.abs(c),Math.abs(b))&&Math.abs(d-I)<=n.p8*Math.max(1,Math.abs(d),Math.abs(I))}var N=f,V=_},37972:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(97633),i=r(27501);function a(e){if(e.length<3)return!1;let t=e.length,r=e[0],a=e[t-1],o=(0,i.A)(r,a);return n.aI(0,o)}},37995:(e,t,r)=>{"use strict";r.d(t,{H:()=>a});var n=r(11806);function i(e,t){let r=function(e,t){let r=0,n=e[0][t];for(let i=1;i{"use strict";r.d(t,{m:()=>p,s:()=>d}),r(39311);var n=r(11701),i=r(50923),a=r(37843),o=new Float64Array(9),s=[0,0,0],l=[0,0,0],u=i.vt(),c=i.vt();function d(e,t=[0,0,1]){if(t[0]=0,t[1]=0,t[2]=1,e){let r=e.getNormal();t[0]=r[0],t[1]=r[1],t[2]=r[2]}return n.Ay.normalize(t),s[0]=0,s[1]=0,s[2]=0,l[0]=0,l[1]=0,l[2]=0,e?(n.Ay.perpendiculars(t,s,l,0),(1e-6>n.Ay.norm(s)||1e-6>n.Ay.norm(l))&&(s[0]=1,s[1]=0,s[2]=0,l[0]=0,l[1]=1,l[2]=0)):(s[0]=1,l[1]=1),{planeNormal:t,tangent1:s,tangent2:l}}function p(e,t,r,n){a.set(o,...e.getDirection()),a.invert(o,o),i.ei(u,t,o),i.ei(c,r,o);let s=e.getDimensions(),l=e.getSpacing(),d=Math.min(Math.abs(l[0]),Math.abs(l[1]),Math.abs(l[2]));return n[0]=d/(s[0]*Math.abs(l[0])),n[1]=d/(s[1]*Math.abs(l[1])),n[2]=d/(s[2]*Math.abs(l[2])),{tangent1:u,tangent2:c,texelSize:n}}},38020:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.observer_queueAMutationObserverMicrotask=u,t.observer_notifyMutationObservers=c,t.observer_queueMutationRecord=d,t.observer_queueTreeMutationRecord=function(e,t,r,n,i){d("childList",e,null,null,null,t,r,n,i)},t.observer_queueAttributeMutationRecord=function(e,t,r,n){d("attributes",e,t,r,n,[],[],null,null)};let n=r(60957),i=r(79663),a=r(57226),o=r(73951),s=r(29963),l=r(94579);function u(){let e=n.dom.window;e._mutationObserverMicrotaskQueued||(e._mutationObserverMicrotaskQueued=!0,Promise.resolve().then(()=>{c()}))}function c(){let e=n.dom.window;e._mutationObserverMicrotaskQueued=!1;let t=a.set.clone(e._mutationObservers),r=a.set.clone(e._signalSlots);for(let r of(a.set.empty(e._signalSlots),t)){let e=a.list.clone(r._recordQueue);a.list.empty(r._recordQueue);for(let e=0;ei.Guard.isTransientRegisteredObserver(e)&&e.observer===r)}if(!a.list.isEmpty(e))try{r._callback.call(r,e,r)}catch(e){}}if(n.dom.features.slots)for(let e of r)(0,l.event_fireAnEvent)("slotchange",e,void 0,{bubbles:!0})}function d(e,t,r,n,i,a,l,c,d){let p=new Map,m=(0,s.tree_getFirstAncestorNode)(t,!0);for(;null!==m;){for(let a=0;a{},38376:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>l});var n=r(17042),i=r(11701),a=r(50923),o={switch:!0,intensity:1,color:[1,1,1],position:[0,0,1],focalPoint:[0,0,0],positional:!1,exponent:1,coneAngle:30,coneFalloff:5,attenuationValues:[1,0,0],transformMatrix:null,lightType:"SceneLight",shadowAttenuation:1,direction:[0,0,0],directionMTime:0};function s(e,t,r={}){Object.assign(t,o,r),n.Ay.obj(e,t),n.Ay.setGet(e,t,["intensity","switch","positional","exponent","coneAngle","coneFalloff","transformMatrix","lightType","shadowAttenuation","attenuationValues"]),n.Ay.setGetArray(e,t,["color","position","focalPoint","attenuationValues"],3);t.classHierarchy.push("vtkLight");let l=new Float64Array(3);e.getTransformedPosition=()=>(t.transformMatrix?a.Z0(l,t.position,t.transformMatrix):a.hZ(l,t.position[0],t.position[1],t.position[2]),l),e.getTransformedFocalPoint=()=>(t.transformMatrix?a.Z0(l,t.focalPoint,t.transformMatrix):a.hZ(l,t.focalPoint[0],t.focalPoint[1],t.focalPoint[2]),l),e.getDirection=()=>(t.directionMTime{let r=new Float64Array(3);a.jb(r,t.position,e),t.focalPoint=r},e.setDirectionAngle=(t,r)=>{let n=(0,i.el)(t),a=(0,i.el)(r);e.setPosition(Math.cos(n)*Math.sin(a),Math.sin(n),Math.cos(n)*Math.cos(a)),e.setFocalPoint(0,0,0),e.setPositional(0)},e.setLightTypeToHeadLight=()=>{e.setLightType("HeadLight")},e.setLightTypeToCameraLight=()=>{e.setLightType("CameraLight")},e.setLightTypeToSceneLight=()=>{e.setTransformMatrix(null),e.setLightType("SceneLight")},e.lightTypeIsHeadLight=()=>"HeadLight"===t.lightType,e.lightTypeIsSceneLight=()=>"SceneLight"===t.lightType,e.lightTypeIsCameraLight=()=>"CameraLight"===t.lightType}var l={newInstance:n.Ay.newInstance(s,"vtkLight"),extend:s,LIGHT_TYPES:["HeadLight","CameraLight","SceneLight"]}},38460:(e,t,r)=>{"use strict";function n(e,t){return e?e.getProperty(t)||e.getProperty():null}function i(e,t){let r=[];for(let i=0;in,X1:()=>o,XK:()=>i,oG:()=>a})},38485:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TraverserImpl=void 0;let n=r(5309);class i{_activeFlag;_root;_whatToShow;_filter;constructor(e){this._activeFlag=!1,this._root=e,this._whatToShow=n.WhatToShow.All,this._filter=null}get root(){return this._root}get whatToShow(){return this._whatToShow}get filter(){return this._filter}}t.TraverserImpl=i},38744:(e,t,r)=>{"use strict";r.d(t,{p:()=>o});var n=r(39216),i=r(77280),a=r(88824);function o(e){if(!e.length)return!1;let t=e[0],r=n.get(i.nb.GENERAL_SERIES,t);if(!r)return!1;let{modality:o,seriesInstanceUID:s}=r,l=n.get(i.nb.IMAGE_PLANE,t);if(!l)return!1;let{imageOrientationPatient:u,pixelSpacing:c,frameOfReferenceUID:d,columns:p,rows:m,usingDefaultValues:h}=l;if(h)return!1;let f=!0;for(let t=0;t{"use strict";r.d(t,{e:()=>i});var n=r(22911);function i(e,t){let{imageData:r}=e.getImageData(),i=e.canvasToWorld(t);return(0,n.A)(r,i)}},39113:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>l.A,Iz:()=>s.I,Sy:()=>u,ep:()=>s.e,xn:()=>o.x});var n=r(76348),i=r(85271),a=r(68456),o=r(685),s=r(8735);r(24346),r(6285);var l=r(97470);let u={adapter:i.ZD,getSnapshot:i.IQ,getZoom:i.p,getScale:i.Ql,getPan:i.HT,resolveICamera:n.hI,derivePresentation:n.iV,applyToRenderer:n.hH,createImageSliceBasis:a.IY,createVolumeSliceBasis:a.P8}},39157:(e,t,r)=>{"use strict";r.d(t,{_:()=>o});var n=r(73971),i=r(45826),a=r(20552);let o=new n.A("EraseSphere",a.A.erase,...i.u8.compositions).strategyFunction},39172:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(27321),i=r(65704),a=r(68759);function o(e,t,r,o,s){if(o.length<2)return;let{color:l="rgb(0, 255, 0)",width:u=10,fillColor:c="none",fillOpacity:d=0,lineWidth:p,lineDash:m,closePath:h=!1,markerStartId:f=null,markerEndId:g=null}=s,v=(0,n.A)(t,"polyline",r),y=e.getSvgNode(v),b="";for(let e of o)b+=`${e[0].toFixed(1)}, ${e[1].toFixed(1)} `;if(h){let e=o[0];b+=`${e[0]}, ${e[1]}`}let I={points:b,stroke:l,fill:c,"fill-opacity":d,"stroke-width":p||u,"stroke-dasharray":m,"marker-start":f?`url(#${f})`:"","marker-end":g?`url(#${g})`:""};if(y)(0,a.A)(I,y),e.setNodeTouched(v);else{let t=document.createElementNS("http://www.w3.org/2000/svg","polyline");(0,i.A)(I,t),e.appendNode(t,v)}}},39216:(e,t,r)=>{"use strict";r.r(t),r.d(t,{addProvider:()=>n,get:()=>l,getMetaData:()=>o,getNormalized:()=>u,getTyped:()=>s,removeAllProviders:()=>a,removeProvider:()=>i,toLowerCamelTag:()=>d,toUpperCamelTag:()=>c});let{Zi:n,iw:i,SD:a,YA:o,FE:s,Jt:l,Y2:u,Qy:c,Hw:d}=r(31320).wx},39246:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.characterData_replaceData=function(e,t,r,u){let c=(0,o.tree_nodeLength)(e);if(t>c)throw new a.IndexSizeError(`Offset exceeds character data length. Offset: ${t}, Length: ${c}, Node is ${e.nodeName}.`);t+r>c&&(r=c-t),n.dom.features.mutationObservers&&(0,s.observer_queueMutationRecord)("characterData",e,null,null,e._data,[],[],null,null);let d=e._data.substring(0,t)+u+e._data.substring(t+r);for(let i of(e._data=d,n.dom.rangeList))i._start[0]===e&&i._start[1]>t&&i._start[1]<=t+r&&(i._start[1]=t),i._end[0]===e&&i._end[1]>t&&i._end[1]<=t+r&&(i._end[1]=t),i._start[0]===e&&i._start[1]>t+r&&(i._start[1]+=u.length-r),i._end[0]===e&&i._end[1]>t+r&&(i._end[1]+=u.length-r);n.dom.features.steps&&i.Guard.isTextNode(e)&&null!==e._parent&&(0,l.dom_runChildTextContentChangeSteps)(e._parent)},t.characterData_substringData=function(e,t,r){let n=(0,o.tree_nodeLength)(e);if(t>n)throw new a.IndexSizeError(`Offset exceeds character data length. Offset: ${t}, Length: ${n}, Node is ${e.nodeName}.`);return t+r>n?e._data.substr(t):e._data.substr(t,r)};let n=r(60957),i=r(79663),a=r(32008),o=r(29963),s=r(38020),l=r(11455)},39262:(e,t,r)=>{"use strict";r.d(t,{X6:()=>s,ii:()=>o});var n=r(50923),i=r(96446);function a(e){let t=n.vt(),r=e.getDimensions(),a=i.A.create3(r[0]),o=i.A.create3(r[1]),s=i.A.create3(r[2]),l=e.getDirection(),u=l.slice(0,3),c=l.slice(3,6),d=l.slice(6,9),[p,m,h]=e.getSpacing(),f=e.indexToWorld([0,0,0]),g=n.fA(u[0]*p,u[1]*p,u[2]*p),v=n.fA(c[0]*m,c[1]*m,c[2]*m),y=n.fA(d[0]*h,d[1]*h,d[2]*h),b=n.vt();for(let e=0;e{let[n,i,a]=e,o=3*n,s=3*i,l=3*a;return r[0]=I[o]+x[s]+C[l],r[1]=I[o+1]+x[s+1]+C[l+1],r[2]=I[o+2]+x[s+2]+C[l+2],r}}function o(e,t){let r,{pointInShapeFn:n,callback:i,boundsIJK:o,returnPoints:s=!1}=t;if(e.getScalarData)r=e.getScalarData();else{let t=e.getPointData().getScalars();if(t)r=t.getData();else{let{voxelManager:t}=e.get("voxelManager")||{};t&&(r=t.getCompleteScalarDataArray())}}let l=e.getDimensions(),u=[[0,l[0]],[0,l[1]],[0,l[2]]],c=function({imageData:e,bounds:t,scalarData:r,pointInShapeFn:n,callback:i}){let[[o,s],[l,u],[c,d]]=t,{numComps:p}=e,m=e.getDimensions(),h=a(e),f=[0,0,0],g=p||r.length/m[2]/m[1]/m[0],v=m[0]*g,y=m[1]*v,b=[];for(let e=c;e<=d;e++){f[2]=e;let t=e*y;for(let e=l;e<=u;e++){f[1]=e;let a=t+e*v;for(let e=o;e<=s;e++){f[0]=e;let t=h(f);if(n(t,f)){let n,o=a+e*g;n=g>2?[r[o],r[o+1],r[o+2]]:r[o],b.push({value:n,index:o,pointIJK:f,pointLPS:t.slice()}),i({value:n,index:o,pointIJK:f,pointLPS:t})}}}}return b}({imageData:e,bounds:o||u,scalarData:r,pointInShapeFn:n,callback:i});return s?c:void 0}function s({voxelManager:e,bounds:t,imageData:r,pointInShapeFn:n,callback:i,returnPoints:o}){let[[s,l],[u,c],[d,p]]=t,m=a(r),h=[0,0,0],f=[];for(let t=d;t<=p;t++){h[2]=t;for(let t=u;t<=c;t++){h[1]=t;for(let t=s;t<=l;t++){h[0]=t;let r=m(h);if(n(r,h)){let t=e.toIndex(h),n=e.getAtIndex(t);o&&f.push({value:n,index:t,pointIJK:[...h],pointLPS:r.slice()}),i?.({value:n,index:t,pointIJK:h,pointLPS:r})}}}}return f}},39311:(e,t,r)=>{"use strict";r.d(t,{GY:()=>i,p8:()=>a,zK:()=>n});var n=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],i=[1,0,0,0,1,0,0,0,1],a=1e-6},39409:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseCBWriter=void 0;class r{_builderOptions;_writerOptions;level=0;hasData;constructor(e){this._builderOptions=e,this._writerOptions=e}}t.BaseCBWriter=r},39535:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>u});var n=r(17042),i=r(40815),a=r(95917),o=r(50923),s={orientations:null,distanceFunction:o.xg};function l(e,t,r={}){Object.assign(t,s,r),i.Ay.extend(e,t,r),n.Ay.setGet(e,t,["orientations","distanceFunction"]),t.distancesTime={},n.Ay.obj(t.distancesTime,{mtime:0});t.classHierarchy.push("vtkPolyLine");let u=a.Ay.newInstance();u.getPoints().setNumberOfPoints(2),e.getCellDimension=()=>1,e.intersectWithLine=(r,n,i,a,o,s,l)=>{let c={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null},d=e.getNumberOfPoints()-1,p=Number.MAX_VALUE,m=[0,0,0],h=[0,0,0];for(let e=0;e=r&&f.t<=n){c.intersect=1;let t=u.getParametricDistance(d);if(t(u.getPoints().getData().set(t.points.getData().subarray(3*e,3*(e+2))),u.evaluateLocation(r,n,i)),e.evaluateOrientation=(e,r,n,i)=>(t.orientations?u.setOrientations([t.orientations[e],t.orientations[e+1]]):u.setOrientations(null),u.evaluateOrientation(r,n,i)),e.getDistancesToFirstPoint=()=>{let r=t.distancesTime.getMTime();if(r0){let e=[,,,],n=[,,,],i=0;t.distances[0]=i,t.points.getPoint(0,e);for(let a=1;a{let r=e.getDistancesToFirstPoint();if(r.length<2)return -1;let n=0,i=r.length-1;if(tr[i]||0===r[i])return -1;for(;i-n>1;){let e=Math.floor((n+i)/2);r[e]<=t?n=e:i=e}return n}}var u={newInstance:n.Ay.newInstance(l,"vtkPolyLine"),extend:l}},39536:(e,t,r)=>{"use strict";function n(){let e=new Map,t={apply:(t,r,n)=>e.has(n[0])?e.get(n[0]):t.apply(r,n)},r=Object.create(null);return r.getParameter=(e,r,n,i)=>new Proxy(i.bind(e),t),r.depthMask=(t,r,n,i)=>{var a;return new Proxy(i.bind(t),(a=t.DEPTH_WRITEMASK,{apply:(t,r,n)=>(e.set(a,n[0]),t.apply(r,n))}))},{get(e,t,n){if("__getUnderlyingContext"===t)return()=>e;let i=Reflect.get(e,t,e);i instanceof Function&&(i=i.bind(e));let a=r[t];return a?a(e,t,n,i):i}}}r.d(t,{gJ:()=>n})},39935:(e,t,r)=>{"use strict";r.r(t),r.d(t,{ECG_CHANNEL_SPACING:()=>o,ECG_RENDERING_COLORS:()=>s,ECG_SECONDS_WIDTH:()=>a,computeECGChannelLayouts:()=>h,computeECGHeight:()=>m,computeECGMinMax:()=>u,computeECGRenderMetrics:()=>f,drawECGGrid:()=>g,drawECGLabels:()=>y,drawECGTraces:()=>v,ensureECGCanvasSize:()=>b,getDefaultECGValueRange:()=>c,getVisibleECGChannels:()=>d,getVisibleECGChannelsByFlag:()=>p,loadECGWaveform:()=>l});var n=r(77280),i=r(39216);let a=150,o=5,s={gridMajor:"#7f0000",gridMinor:"#3f0000",baseline:"#7f4c00",trace:"#ffffff",label:"#ffff00",background:"#000000"};async function l(e){let t=i.get(n.nb.ECG,e);if(!t?.waveformData?.retrieveBulkData)throw Error(`[ECG] No ECG waveform data for ${e}`);let{numberOfWaveformChannels:r,numberOfWaveformSamples:a,samplingFrequency:o,waveformBitsAllocated:s=16,waveformSampleInterpretation:l="SS",multiplexGroupLabel:c,channelDefinitionSequence:d=[]}=t,p=await t.waveformData.retrieveBulkData(),m=i.get(n.nb.CALIBRATION,e),h=[];for(let e=0;er&&(r=e[n]);return{min:t,max:r}}function c(e){let t=0,r=0;return(e.channels.forEach(e=>{t=Math.min(t,e.min),r=Math.max(r,e.max)}),t===r)?[-1,1]:[t,r]}function d(e,t){if(!t)return e.filter(e=>e.data.length>0);let r=new Set(t);return e.filter((t,n)=>r.has(n)&&e[n].data.length>0)}function p(e){return e.filter(e=>!1!==e.visible&&e.data.length>0)}function m(e,t){let r=0;return e.forEach(e=>{r+=(e.max-e.min)*t*1.25,r+=o}),r||1}function h(e){let{visibleChannels:t,channelScale:r}=e,n=[],i=0;return t.forEach(e=>{let t=(e.max-e.min)*r*1.25,a=(i+=t+o)+e.min*r;n.push({channel:e,itemHeight:t,yOffset:i,baseline:a})}),n}function f(e){let{canvas:t,visibleChannels:r,windowMs:n,valueRange:i}=e,s=Math.max(1,Math.ceil(n/1e3*a)),[l,u]=i,c=Math.max(1,u-l),d=(s*(t.clientHeight&&t.clientWidth?t.clientHeight/t.clientWidth:2/3)-o*Math.max(1,r.length))/Math.max(1,r.length)/(1.25*c),p=m(r,d),h=Math.min(t.clientWidth/Math.max(1,s),t.clientHeight/Math.max(1,p));return{ecgWidth:s,ecgHeight:p,channelScale:d,worldToCanvasRatio:h,xOffsetCanvas:(t.clientWidth-s*h)/2,yOffsetCanvas:(t.clientHeight-p*h)/2}}function g(e,t,r){if(r?.showGrid===!1||t.channelScale<=0)return;let{ecgWidth:n,ecgHeight:i,channelScale:o}=t,l=100;for(;l*o<8;)l*=2;let u=l*o,c=5*u,d=a/25,p=a/5;e.strokeStyle=s.gridMinor,e.lineWidth=.5,e.beginPath();for(let t=u;t<=i;t+=u)Math.round(t/u)%5!=0&&(e.moveTo(0,t),e.lineTo(n,t));for(let t=d;t<=n;t+=d)Math.round(t/d)%5!=0&&(e.moveTo(t,0),e.lineTo(t,i));e.stroke(),e.strokeStyle=s.gridMajor,e.lineWidth=1,e.beginPath();for(let t=c;t<=i;t+=c)e.moveTo(0,t),e.lineTo(n,t);for(let t=p;t<=n;t+=p)e.moveTo(t,0),e.lineTo(t,i);e.stroke()}function v(e){let{ctx:t,layouts:r,ecgWidth:n,channelScale:i,startIndex:a=0,endIndex:o,lineWidth:l=1,amplitudeScale:u=1}=e;r.forEach(({channel:e,baseline:r})=>{let c=Math.min(o??e.data.length,e.data.length),d=Math.max(0,Math.min(a,c-1)),p=Math.max(1,c-d);t.strokeStyle=s.baseline,t.lineWidth=2,t.beginPath(),t.moveTo(0,r),t.lineTo(n,r),t.stroke(),t.strokeStyle=s.trace,t.lineWidth=l,t.beginPath();for(let a=d;a{let a=i-r+n;e.font=`${n}px monospace`;let o=e.measureText(t.name).width;e.fillStyle=s.background,e.fillRect(5,a-n,o+4,n+4),e.fillStyle=s.label,e.fillText(t.name,5,a)})}function b(e){let t=window.devicePixelRatio||1,r=Math.max(1,e.clientWidth||e.width||1),n=Math.max(1,e.clientHeight||e.height||1),i=Math.floor(r*t),a=Math.floor(n*t);(e.width!==i||e.height!==a)&&(e.width=i,e.height=a)}},39997:(e,t,r)=>{"use strict";r.d(t,{A:()=>I});var n=r(85250),i=r(50923),a=r(77280),o=r(3793),s=r(39216),l=r(92336),u=r(55580),c=r(31608),d=r(79267),p=r(69228),m=r(3922),h=r(62553),f=r(6297),g=r(24433);let v=null,y="CORNERSTONE_TOOLS_ANNOTATION_REMOVED";class b extends u.A{constructor(e){super({...e,canvas:e.canvas||(0,c.oI)(e.element)}),this.imageURISet=new Set,this.internalCamera={rotation:0,centerIndex:[0,0],extent:[0,-2,1,-1],xSpacing:1,ySpacing:1,resolution:1,zoom:1},this.annotationRemovedListener=e=>{let{detail:t}=e,r=t?.annotation?.metadata;if(!r)return void this.postrender();let n=r.referencedImageURI??(r.referencedImageId?(0,h.A)(r.referencedImageId):null);if(n&&!this.hasImageURI(n))return;let i=r.FrameOfReferenceUID??null;i&&i!==this.frameOfReferenceUID||this.postrender()},this.voiRange={lower:0,upper:255},this.getProperties=()=>({voiRange:{...this.voiRange}}),this.resetCamera=()=>!0,this.getNumberOfSlices=()=>1,this.getFrameOfReferenceUID=()=>this.frameOfReferenceUID,this.resize=()=>{let e=this.canvas,{clientWidth:t,clientHeight:r}=e;(e.width!==t||e.height!==r)&&(e.width=t,e.height=r),this.refreshRenderValues()},this.canvasToWorld=e=>{if(!this.metadata)return;let t=this.canvasToIndex(e);return t[1]=-t[1],this.indexToWorld(t)},this.worldToCanvas=e=>{if(!this.metadata)return;let t=this.worldToIndex(e);return t[1]=-t[1],this.indexToCanvas([t[0],t[1],0])},this.postrender=()=>{this.refreshRenderValues(),(0,p.A)(this.element,a.sV.IMAGE_RENDERED,{element:this.element,viewportId:this.id,viewport:this,renderingEngineId:this.renderingEngineId})},this.getRotation=()=>0,this.canvasToIndex=e=>{let t=this.getTransform();t.invert();let r=t.transformPoint(e);return[r[0],r[1],0]},this.indexToCanvas=e=>this.getTransform().transformPoint([e[0],e[1]]),this.customRenderViewportToCanvas=()=>{},this.getImageIds=()=>[this.imageIds[0]],this.renderingEngineId=e.renderingEngineId,this.element.setAttribute("data-viewport-uid",this.id),this.element.setAttribute("data-rendering-engine-uid",this.renderingEngineId),this.element.style.position="relative",this.microscopyElement=document.createElement("div"),this.microscopyElement.setAttribute("class","DicomMicroscopyViewer"),this.microscopyElement.id=(0,o.A)(),this.microscopyElement.innerText="Initial",this.microscopyElement.style.background="grey",this.microscopyElement.style.width="100%",this.microscopyElement.style.height="100%",this.microscopyElement.style.position="absolute",this.microscopyElement.style.left="0",this.microscopyElement.style.top="0";let t=this.element.firstElementChild;t.insertBefore(this.microscopyElement,t.childNodes[1]),this.addEventListeners(),this.addWidget("DicomMicroscopyViewer",{getEnabled:()=>!!this.viewer,setEnabled:()=>{this.elementDisabledHandler()}}),this.resize()}static get useCustomRenderingPipeline(){return!0}addEventListeners(){this.canvas.addEventListener(a.sV.ELEMENT_DISABLED,this.elementDisabledHandler),m.A.addEventListener(y,this.annotationRemovedListener)}removeEventListeners(){this.canvas.removeEventListener(a.sV.ELEMENT_DISABLED,this.elementDisabledHandler),m.A.removeEventListener(y,this.annotationRemovedListener)}elementDisabledHandler(){this.removeEventListeners(),this.viewer?.cleanup(),this.viewer=null,this.element.firstElementChild.removeChild(this.microscopyElement),this.microscopyElement=null,this.imageURISet.clear()}async setFrameNumber(e){}setProperties(e){e.voiRange&&this.setVOI(e.voiRange)}resetProperties(){this.setProperties({voiRange:{lower:0,upper:255}})}setVOI(e){this.voiRange=e;let t=this.setColorTransform(e,this.averageWhite);this.map.getViewport().querySelectorAll(".ol-layers canvas").forEach(e=>{e.style.filter=t})}setAverageWhite(e){this.averageWhite=e,this.setColorTransform(this.voiRange,e)}getScalarData(){return null}computeTransforms(){let e=n.create(),t=n.create();return n.fromTranslation(e,this.metadata.origin),e[0]=this.metadata.direction[0],e[1]=this.metadata.direction[1],e[2]=this.metadata.direction[2],e[4]=this.metadata.direction[3],e[5]=this.metadata.direction[4],e[6]=this.metadata.direction[5],e[8]=this.metadata.direction[6],e[9]=this.metadata.direction[7],e[10]=this.metadata.direction[8],n.scale(e,e,this.metadata.spacing),n.invert(t,e),{indexToWorld:e,worldToIndex:t}}getImageData(){let{metadata:e}=this;if(!e)return null;let{spacing:t}=e;return{dimensions:e.dimensions,spacing:t,numberOfComponents:3,origin:e.origin,direction:e.direction,metadata:{Modality:this.modality,FrameOfReferenceUID:this.frameOfReferenceUID},hasPixelSpacing:this.hasPixelSpacing,calibration:this.calibration,preScale:{scaled:!1},scalarData:this.getScalarData(),imageData:{getDirection:()=>e.direction,getDimensions:()=>e.dimensions,getRange:()=>[0,255],getScalarData:()=>this.getScalarData(),getSpacing:()=>e.spacing,worldToIndex:e=>this.worldToIndex(e),indexToWorld:e=>this.indexToWorld(e)}}}hasImageURI(e){return!!e&&this.imageURISet.has(e)}setCamera(e){let t=this.getCamera(),{parallelScale:r,focalPoint:n}=e,i=this.getView(),{xSpacing:a}=this.internalCamera;if(r){let e=this.element.clientHeight/r;i.setResolution?.(1/a/e)}if(n){let e=this.worldToCanvas(n),t=this.canvasToIndex(e);i.setCenter([t[0],t[1]])}let o=this.getCamera();this.triggerCameraModifiedEventIfNecessary(t,o)}getCurrentImageId(){return this.imageIds[0]}getFrameNumber(){return 1}getCamera(){this.refreshRenderValues();let{resolution:e,xSpacing:t,centerIndex:r}=this.internalCamera,n=this.indexToCanvas([r[0],r[1],0]),i=this.canvasToWorld(n);return{parallelProjection:!0,focalPoint:i,position:i,viewUp:[0,-1,0],parallelScale:this.element.clientHeight*(e*t),viewPlaneNormal:[0,0,1]}}worldToIndexWSI(e){if(!v)return;let t=this.viewer.getAffine(),r=v.applyInverseTransform({coordinate:[e[0],e[1]],affine:t});return[r[0],r[1]]}indexToWorldWSI(e){if(!v)return;let t=v.applyTransform({coordinate:[e[0],e[1]],affine:this.viewer.getAffine()});return[t[0],t[1],0]}worldToIndex(e){let{worldToIndex:t}=this.computeTransforms(),r=i.vt();return i.Z0(r,e,t),r}indexToWorld(e){let{indexToWorld:t}=this.computeTransforms(),r=i.vt(),n=i.fA(...e);return i.Z0(r,n,t),[r[0],r[1],r[2]]}setDataList(e){if(!e.length)return;let{dataId:t}=e[0],r=s.get("genericViewportDisplaySet",t);return r?.imageIds?this.setDataIds(r.imageIds,{webClient:r.options?.webClient}):this.setDataIds([t])}setDataIds(e,t){t?.miniNavigationOverlay!==!1&&(0,g.addWSIMiniNavigationOverlayCss)();let r=t?.webClient||s.get(a.nb.WADO_WEB_CLIENT,e[0]);if(!r)throw Error(`To use setDataIds on WSI data, you must provide metaData.webClient for ${e[0]}.`);return this.setWSI(e,r)}async setWSI(e,t){this.clearDisplaySets(),this.microscopyElement.style.background="black",this.microscopyElement.innerText="Loading",this.imageIds=e;let r=await (0,g.getDicomMicroscopyViewer)();v||=r.utils;let n=await (0,g.loadWSIData)({imageIds:this.imageIds,client:t,dicomMicroscopyViewer:r});this.imageURISet=n.imageURISet,this.frameOfReferenceUID=n.frameOfReferenceUID,this.metadata=n.metadata,this.hasPixelSpacing=n.metadata.hasPixelSpacing;let i=new r.viewer.VolumeImageViewer({client:t,metadata:n.volumeImages,controls:["overview","position"],retrieveRendered:!1,bindings:{}});i.render({container:this.microscopyElement}),i.deactivateDragPanInteraction(),this.viewer=i,this.map=i.getMap(),this.map.on("postrender",this.postrender),this.resize(),this.microscopyElement.innerText="",Object.assign(this.microscopyElement.style,{"--ol-partial-background-color":"rgba(127, 127, 127, 0.7)","--ol-foreground-color":"#000000","--ol-subtle-foreground-color":"#000","--ol-subtle-background-color":"rgba(78, 78, 78, 0.5)",background:"none"})}async setDisplaySets(...e){await this.mountDisplaySets(e,async e=>{let t=(0,f.Pv)(e.displaySetId);if(!t?.imageIds?.length||!t.options?.webClient)throw Error(`[WSIViewport] No registered WSI dataset (imageIds + webClient) for display set ${e.displaySetId}`);!1!==t.options.miniNavigationOverlay&&(0,g.addWSIMiniNavigationOverlayCss)(),await b.prototype.setWSI.call(this,t.imageIds,t.options.webClient)})}scroll(e){let t=this.getCamera();this.setCamera({parallelScale:t.parallelScale*(1+.1*e)})}getSliceIndex(){return 0}getView(){if(!this.viewer)return;let e=this.viewer.getMap(),t=window;return t.map=e,t.viewer=this.viewer,t.view=e?.getView(),t.wsi=this,e?.getView()}refreshRenderValues(){let e=this.getView();if(!e)return;let t=e.getResolution();if(!t||t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectCache=void 0;class r{_limit;_items=new Map;constructor(e=1e3){this._limit=e}get(e){return this._items.get(e)}set(e,t){if(this._items.set(e,t),this._items.size>this._limit){let e=this._items.keys().next();e.done||this._items.delete(e.value)}}delete(e){return this._items.delete(e)}has(e){return this._items.has(e)}clear(){this._items.clear()}get size(){return this._items.size}forEach(e,t){this._items.forEach((r,n)=>e.call(t,n,r))}*keys(){yield*this._items.keys()}*values(){yield*this._items.values()}*entries(){yield*this._items.entries()}*[Symbol.iterator](){yield*this._items}get[Symbol.toStringTag](){return"ObjectCache"}}t.ObjectCache=r},40523:(e,t,r)=>{"use strict";var n;r.d(t,{A:()=>i}),function(e){e.PLY="PLY",e.STL="STL",e.OBJ="OBJ",e.VTP="VTP"}(n||(n={}));let i=n},40534:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>g});var n=r(17042),i=r(87352),a=r(69927),o=r(72188),s=r(56929),l=r(61052),u=r(86077),c=r(85250),d=r(37843),{vtkErrorMacro:p}=n.o$,m={context:null};function h(e,t,r={}){Object.assign(t,m,r),o.A.extend(e,t,r),t.openGLTexture=l.Ay.newInstance(),t.tris=u.Ay.newInstance(),t.keyMatrixTime={},(0,n.WL)(t.keyMatrixTime,{mtime:0}),t.keyMatrices={normalMatrix:d.identity(new Float64Array(9)),mcwc:c.identity(new Float64Array(16))},(0,n.V0)(e,t,["context"]),(0,n.Jt)(e,t,["activeTextures"]),t.classHierarchy.push("vtkOpenGLSkybox"),e.buildPass=r=>{if(r){t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLTexture.setOpenGLRenderWindow(t._openGLRenderWindow);let r=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(r.getActiveCamera(),t.openGLCamera)}},e.queryPass=(e,r)=>{e&&t.renderable&&t.renderable.getVisibility()&&r.incrementOpaqueActorCount()},e.opaquePass=(r,n)=>{if(r&&!t._openGLRenderer.getSelector()){e.updateBufferObjects(),t.context.depthMask(!0),t._openGLRenderWindow.getShaderCache().readyShaderProgram(t.tris.getProgram()),t.openGLTexture.render(t._openGLRenderWindow);let r=t.openGLTexture.getTextureUnit();t.tris.getProgram().setUniformi("sbtexture",r);let n=t._openGLRenderer.getRenderable(),i=t.openGLCamera.getKeyMatrices(n),a=new Float64Array(16);if(c.invert(a,i.wcpc),t.tris.getProgram().setUniformMatrix("IMCPCMatrix",a),"box"===t.lastFormat){let e=n.getActiveCamera().getPosition();t.tris.getProgram().setUniform3f("camPos",e[0],e[1],e[2])}t.tris.getVAO().bind(),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.openGLTexture.deactivate()}},e.updateBufferObjects=()=>{if(!t.tris.getCABO().getElementCount()){let e=new Float32Array(12);for(let t=0;t<4;t++)e[3*t]=t%2*2-1,e[3*t+1]=t>1?1:-1,e[3*t+2]=1;let r=i.Ay.newInstance({numberOfComponents:3,values:e});r.setName("points");let n=new Uint16Array(8);n[0]=3,n[1]=0,n[2]=1,n[3]=3,n[4]=3,n[5]=0,n[6]=3,n[7]=2;let o=i.Ay.newInstance({numberOfComponents:1,values:n});t.tris.getCABO().createVBO(o,"polys",a.YL.SURFACE,{points:r,cellOffset:0})}t.renderable.getFormat()!==t.lastFormat&&(t.lastFormat=t.renderable.getFormat(),"box"===t.lastFormat&&t.tris.setProgram(t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(`//VTK::System::Dec + attribute vec3 vertexMC; + uniform mat4 IMCPCMatrix; + varying vec3 TexCoords; + void main () { + gl_Position = vec4(vertexMC.xyz, 1.0); + vec4 wpos = IMCPCMatrix * gl_Position; + TexCoords = wpos.xyz/wpos.w; + }`,`//VTK::System::Dec + //VTK::Output::Dec + varying vec3 TexCoords; + uniform samplerCube sbtexture; + uniform vec3 camPos; + void main () { + // skybox looks from inside out + // which means we have to adjust + // our tcoords. Otherwise text would + // be flipped + vec3 tc = normalize(TexCoords - camPos); + if (abs(tc.z) < max(abs(tc.x),abs(tc.y))) + { + tc = vec3(1.0, 1.0, -1.0) * tc; + } + else + { + tc = vec3(-1.0, 1.0, 1.0) * tc; + } + gl_FragData[0] = textureCube(sbtexture, tc); + }`,"")),"background"===t.lastFormat&&t.tris.setProgram(t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(`//VTK::System::Dec + attribute vec3 vertexMC; + uniform mat4 IMCPCMatrix; + varying vec2 TexCoords; + void main () { + gl_Position = vec4(vertexMC.xyz, 1.0); + vec4 wpos = IMCPCMatrix * gl_Position; + TexCoords = vec2(vertexMC.x, vertexMC.y)*0.5 + 0.5; + }`,`//VTK::System::Dec + //VTK::Output::Dec + varying vec2 TexCoords; + uniform sampler2D sbtexture; + void main () { + gl_FragData[0] = texture2D(sbtexture, TexCoords); + }`,"")),t.tris.getShaderSourceTime().modified(),t.tris.getVAO().bind(),t.tris.getVAO().addAttributeArray(t.tris.getProgram(),t.tris.getCABO(),"vertexMC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||p("Error setting vertexMC in shader VAO."));let e=t.renderable.getTextures();e.length||p("vtkSkybox requires a texture map"),t.openGLTexture.getRenderable()!==e[0]&&(t.openGLTexture.releaseGraphicsResources(t._openGLRenderWindow),t.openGLTexture.setRenderable(e[0]))}}var f=(0,n.UI)(h),g={newInstance:f,extend:h};(0,s.c9)("vtkSkybox",f)},40577:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>u});var n=r(17042),i=r(53038),{BufferUsage:a}=r(44238).Ay,{vtkErrorMacro:o}=n.Ay,s={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,bindGroupLayoutEntry:null,bindGroupEntry:null};function l(e,t,r={}){Object.assign(t,s,r),n.Ay.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"uniform"}},t.sendTime={},n.Ay.obj(t.sendTime,{mtime:0}),t.bindGroupTime={},n.Ay.obj(t.bindGroupTime,{mtime:0}),t.sendDirty=!0,t.sortDirty=!0,n.Ay.get(e,t,["binding","bindGroupTime"]),n.Ay.setGet(e,t,["bindGroupLayoutEntry","device","label","sizeInBytes"]);function u(r){if(t.UBO)return;e.sortBufferEntries(),e.createView("Float32Array");let n={nativeArray:t.Float32Array,usage:a.UniformArray,label:t.label};t.UBO=r.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),t.sendDirty=!1}t.classHierarchy.push("vtkWebGPUUniformBuffer"),e.addEntry=(e,r)=>{if(t._bufferEntryNames.has(e))return void o(`entry named ${e} already exists`);t.sortDirty=!0,t._bufferEntryNames.set(e,t.bufferEntries.length),t.bufferEntries.push({name:e,type:r,sizeInBytes:i.A.getByteStrideFromShaderFormat(r),offset:-1,nativeType:i.A.getNativeTypeFromShaderFormat(r),packed:!1})},e.sortBufferEntries=()=>{if(!t.sortDirty)return;let e=0,r=[],n=4;for(let e=0;e4&&(i.packed=!0,i.offset=e,r.push(i),e+=i.sizeInBytes)}for(let n=0;n{t.device=e,u(e),t.sendDirty&&(e.getHandle().queue.writeBuffer(t.UBO.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes),t.sendDirty=!1),t.sendTime.modified()},e.createView=e=>{e in t==!1&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes)),t[e]=n.Ay.newTypedArray(e,t.arrayBuffer))},e.setValue=(r,n)=>{e.sortBufferEntries();let i=t._bufferEntryNames.get(r);if(void 0===i)return void o(`entry named ${r} not found in UBO`);let a=t.bufferEntries[i];e.createView(a.nativeType);let s=t[a.nativeType];a.lastValue!==n&&(s[a.offset/s.BYTES_PER_ELEMENT]=n,t.sendDirty=!0),a.lastValue=n},e.setArray=(r,n)=>{e.sortBufferEntries();let i=t._bufferEntryNames.get(r);if(void 0===i)return void o(`entry named ${r} not found in UBO`);let a=t.bufferEntries[i];e.createView(a.nativeType);let s=t[a.nativeType],l=!1;for(let e=0;e(!t.UBO&&t.device&&u(t.device),{resource:{buffer:t.UBO.getHandle()}}),e.getSendTime=()=>t.sendTime.getMTime(),e.getShaderCode=(r,n)=>{e.sortBufferEntries();let i=[`struct ${t.label}Struct +{`];for(let e=0;e ${t.label}: ${t.label}Struct;`),i.join("\n")},e.releaseGraphicsResources=()=>{t.UBO=null,t.bindGroupTime.modified(),t.sendDirty=!0}}var u={newInstance:n.Ay.newInstance(l,"vtkWebGPUUniformBuffer"),extend:l}},40812:(e,t,r)=>{"use strict";var n;r.d(t,{A:()=>i}),function(e){e.Active="Active",e.Passive="Passive",e.Enabled="Enabled",e.Disabled="Disabled"}(n||(n={}));let i=n},40815:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>l});var n=r(17042),i=r(58804),a=r(30536),o={bounds:[-1,-1,-1,-1,-1,-1],pointsIds:[]};function s(e,t,r={}){Object.assign(t,o,r),n.Ay.obj(e,t),t.points||(t.points=a.Ay.newInstance()),n.Ay.get(e,t,["points","pointsIds"]),t.classHierarchy.push("vtkCell"),e.initialize=(e,r=null)=>{if(r){t.pointsIds=r;let i=t.points.getData();i.length!==3*t.pointsIds.length&&(i=n.Ay.newTypedArray(e.getDataType(),3*t.pointsIds.length));let a=e.getData();t.pointsIds.forEach((e,t)=>{let r=3*e,n=3*t;i[n]=a[r],i[++n]=a[++r],i[++n]=a[++r]}),t.points.setData(i)}else{t.points=e,t.pointsIds=Array(e.getNumberOfPoints());for(let r=e.getNumberOfPoints()-1;r>=0;--r)t.pointsIds[r]=r}},e.getBounds=()=>t.points.getBounds(),e.getLength2=()=>{let t=i.Ay.getLengths(e.getBounds());return t[0]*t[0]+t[1]*t[1]+t[2]*t[2]},e.getParametricDistance=e=>{let t,r=0;for(let n=0;n<3;n++)(t=e[n]<0?-e[n]:e[n]>1?e[n]-1:0)>r&&(r=t);return r},e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.deepCopy=e=>{e.initialize(t.points,t.pointsIds)},e.getCellDimension=()=>{},e.intersectWithLine=(e,t,r,n,i,a,o)=>{},e.evaluatePosition=(e,t,r,i,a,o)=>{n.Ay.vtkErrorMacro("vtkCell.evaluatePosition is not implemented.")}}var l={newInstance:n.Ay.newInstance(s,"vtkCell"),extend:s}},41067:(e,t,r)=>{"use strict";r.d(t,{T:()=>i});var n=r(32207);function i(e){return n._6.getActiveSegmentation(e)}},41092:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(36195),i=r(88856);class a{constructor(e,t=""){this.contexts=[],this.offScreenCanvasContainers=[],this.viewportToContext=new Map,this.viewportSizes=new Map,this.contextMaxSizes=new Map;for(let r=0;r=0&&e{if(n===e){let e=this.viewportSizes.get(i);e&&(t=Math.max(t,e.width),r=Math.max(r,e.height))}}),{width:t,height:r}}removeViewport(e){let t=this.viewportToContext.get(e);if(this.viewportToContext.delete(e),this.viewportSizes.delete(e),void 0!==t){let e=this.calculateMaxSizeForContext(t);this.contextMaxSizes.set(t,e)}}destroy(){this.contexts.forEach(e=>{e.delete()}),this.contexts=[],this.offScreenCanvasContainers=[],this.viewportToContext.clear(),this.viewportSizes.clear(),this.contextMaxSizes.clear()}}let o=a},41104:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(71002);function i(e,t=null){return((0,n.C)(e,"getImageSize: parameter image must not be undefined"),(0,n.C)(e.width,"getImageSize: parameter image must have width"),(0,n.C)(e.height,"getImageSize: parameter image must have height"),null!=t&&0!==t&&180!==t)?{height:e.width,width:e.height}:{width:e.width,height:e.height}}},41105:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(27520);function i(e,t){for(let r=0,i=e.length;r{"use strict";r.d(t,{A:()=>l});var n=r(81863),i=r(77280),a=r(52575);let o=r(82332).workerLog.getLogger("registration");class s{constructor(){this.workerRegistry={},this.workerPoolManager=new a.R("webworker")}registerWorker(e,t,r={}){let{maxWorkerInstances:i=1,overwrite:a=!1,autoTerminateOnIdle:s={enabled:!1,idleTimeThreshold:3e3}}=r;if(this.workerRegistry[e]&&!a)return void o.warn(`Worker type '${e}' is already registered...`);a&&this.workerRegistry[e]?.idleCheckIntervalId&&clearInterval(this.workerRegistry[e].idleCheckIntervalId);let l={workerFn:null,instances:[],loadCounters:[],lastActiveTime:[],nativeWorkers:[],autoTerminateOnIdle:s.enabled,idleCheckIntervalId:null,idleTimeThreshold:s.idleTimeThreshold};l.loadCounters=Array(i).fill(0),l.lastActiveTime=Array(i).fill(null);for(let e=0;enull!==e),i=0,a=t.loadCounters[0]||0;for(let e=1;e{let c=async()=>{let{api:a,index:o}=this.getNextWorkerAPI(e);if(!a){let t=Error(`No available worker instance for '${e}'`);console.error(t),u(t);return}try{let s=[];l.length&&(s=l.map(e=>n.BX(e)));let u=this.workerRegistry[e];u.processing=!0;let c=await a[t](r,...s);u.processing=!1,u.lastActiveTime[o]=Date.now(),u.autoTerminateOnIdle&&!u.idleCheckIntervalId&&u.idleTimeThreshold&&(u.idleCheckIntervalId=setInterval(()=>{this.terminateIdleWorkers(e,u.idleTimeThreshold)},u.idleTimeThreshold)),i(c)}catch(r){console.error(`Error executing method '${t}' on worker '${e}':`,r),u(r)}finally{this.workerRegistry[e].loadCounters[o]--}};this.workerPoolManager.addRequest(c,a,s,o)})}terminateIdleWorkers(e,t){let r=this.workerRegistry[e];if(r.processing)return;let n=Date.now();r.instances.forEach((i,a)=>{let o=r.lastActiveTime[a];!(null!==o&&r.loadCounters[a]>0)&&n-o>t&&this.terminateWorkerInstance(e,a)})}terminate(e){let t=this.workerRegistry[e];if(!t)return void console.error(`Worker type '${e}' is not registered.`);t.instances.forEach((t,r)=>{this.terminateWorkerInstance(e,r)})}terminateWorkerInstance(e,t){let r=this.workerRegistry[e],i=r.instances[t];null!==i&&(i[n.A2](),r.nativeWorkers[t].terminate(),r.instances[t]=null,r.lastActiveTime[t]=null)}}let l=s},41602:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(7399);function i(e,t){if(e.length!==t.length)return!1;let r=e.length;if(0===r)return!0;let i=!0;for(let a=0;a{"use strict";function n(e){return Array.isArray(e)?`rgb(${e.map(e=>Math.round(255*e)).join(",")})`:e}r.d(t,{J:()=>n})},41710:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.append=function(e,t){e.push(t)},t.extend=function(e,t){e.push(...t)},t.prepend=function(e,t){e.unshift(t)},t.replace=function(e,t,r){let i=0;for(let a of e){if((0,n.isFunction)(t))t.call(null,a)&&(e[i]=r);else if(a===t){e[i]=r;return}i++}},t.insert=function(e,t,r){e.splice(r,0,t)},t.remove=function(e,t){let r=e.length;for(;r--;){let i=e[r];if((0,n.isFunction)(t))t.call(null,i)&&e.splice(r,1);else if(i===t)return void e.splice(r,1)}},t.empty=function(e){e.length=0},t.contains=function(e,t){for(let r of e)if((0,n.isFunction)(t)){if(t.call(null,r))return!0}else if(r===t)return!0;return!1},t.size=function(e,t){if(void 0===t)return e.length;{let r=0;for(let n of e)t.call(null,n)&&r++;return r}},t.isEmpty=function(e){return 0===e.length},t.forEach=function*(e,t){if(void 0===t)yield*e;else for(let r of e)t.call(null,r)&&(yield r)},t.clone=function(e){return Array(...e)},t.sortInAscendingOrder=function(e,t){return e.sort((e,r)=>t.call(null,e,r)?-1:1)},t.sortInDescendingOrder=function(e,t){return e.sort((e,r)=>t.call(null,e,r)?1:-1)};let n=r(16950)},41831:(e,t,r)=>{"use strict";var n;r.d(t,{A:()=>i}),function(e){e.Interaction="interaction",e.Thumbnail="thumbnail",e.Prefetch="prefetch",e.Compute="compute"}(n||(n={}));let i=n},41918:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(70192);function i(e,t=e.getViewReference()){let r=(n.BF.isGenericViewport(e)?e.getResolvedView()?.toICamera():void 0)||e.getCamera?.()||{},a=n.BF.clonePoint3(t?.cameraFocalPoint||r.focalPoint),o=n.BF.clonePoint3(t?.viewPlaneNormal||r.viewPlaneNormal),s=n.BF.clonePoint3(t?.viewUp||r.viewUp),l=n.BF.clonePoint3(r.position||a&&o&&[a[0]-o[0],a[1]-o[1],a[2]-o[2]]);return{focalPoint:a,position:l,viewPlaneNormal:o,viewUp:s}}},42021:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>o,VO:()=>n,dM:()=>a,tE:()=>i});var n={NEAREST:0,LINEAR:1,FAST_LINEAR:2},i={FRACTIONAL:0,PROPORTIONAL:1},a={DEFAULT:0,ADDITIVE:1,COLORIZE:2,CUSTOM:3},o={InterpolationType:n,OpacityMode:i,ColorMixPreset:a,FilterMode:{OFF:0,NORMALIZED:1,RAW:2}}},42028:(e,t,r)=>{"use strict";r.d(t,{A:()=>c});var n=r(97938),i=r(39216),a=r(77280),o=r(92391),s=r(6913),l=r(50869),u=r(54268);function c(e){let{canvas:t,imageId:r,viewReference:c,requestType:d=a.Yw.Thumbnail,priority:p=-5,renderingEngineId:m="_thumbnails",useCPURendering:h=!1,thumbnail:f=!1,imageAspect:g=!1,viewportOptions:v}=e,y=c?.volumeId,b=y&&!r,I=c&&v?{...v,viewReference:c}:v,x=h?l.A:s.A;return new Promise((e,s)=>{function l(r,n){let{modality:o}=i.get(a.nb.GENERAL_SERIES,n)||{},l=!b&&r,u=b&&r;l&&(l.isPreScaled=l.isPreScaled||l.preScale?.scaled),f&&(t.height=256,t.width=256),g&&l&&(t.width=l&&t.height*l.width/l.height),t.style.width=`${t.width/devicePixelRatio}px`,t.style.height=`${t.height/devicePixelRatio}px`,u&&h&&s(Error("CPU rendering of volume not supported")),x(t,r,o,m,I).then(e)}function c(e,t){console.error(e,t),s(e)}if(y){let e=u.Ay.getVolume(y);e||s(Error(`Volume id ${y} not found in cache`));let t=e.imageIds[0];l(e,t)}else o.A.addRequest((function(e,t,r){return(0,n.loadAndCacheImage)(e,r).then(t=>{l.call(this,t,e)},t=>{c.call(this,t,e)})}).bind(null,r,null,{useRGBA:!!h,requestType:d}),d,{imageId:r},p)})}},42109:(e,t,r)=>{"use strict";let n=r(50026),i=RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),a=RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");e.exports=new n("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==i.exec(e)||null!==a.exec(e))},construct:function(e){let t=0,r=null,n=i.exec(e);if(null===n&&(n=a.exec(e)),null===n)throw Error("Date resolve error");let o=+n[1],s=n[2]-1,l=+n[3];if(!n[4])return new Date(Date.UTC(o,s,l));let u=+n[4],c=+n[5],d=+n[6];if(n[7]){for(t=n[7].slice(0,3);t.length<3;)t+="0";t*=1}n[9]&&(r=(60*n[10]+ +(n[11]||0))*6e4,"-"===n[9]&&(r=-r));let p=new Date(Date.UTC(o,s,l,u,c,d,t));return r&&p.setTime(p.getTime()-r),p},instanceOf:Date,represent:function(e){return e.toISOString()}})},42151:()=>{"use strict";var e;!function(e){e.SUM="SUM",e.AVERAGE="AVERAGE",e.SUBTRACT="SUBTRACT"}(e||(e={}))},42357:(e,t,r)=>{"use strict";r.d(t,{A:()=>o,R:()=>a});var n=r(56872);let i={STACK:n.A.STACK,ORTHOGRAPHIC:n.A.ORTHOGRAPHIC,PERSPECTIVE:n.A.PERSPECTIVE,VOLUME_3D:n.A.VOLUME_3D,VOLUME_3D_NEXT:n.A.VOLUME_3D_NEXT,PLANAR_NEXT:n.A.PLANAR_NEXT,VIDEO:n.A.VIDEO,VIDEO_NEXT:n.A.VIDEO_NEXT,WHOLE_SLIDE:n.A.WHOLE_SLIDE,WHOLE_SLIDE_NEXT:n.A.WHOLE_SLIDE_NEXT,ECG:n.A.ECG,ECG_NEXT:n.A.ECG_NEXT};function a(e,t){if(Object.prototype.hasOwnProperty.call(i,e))throw Error(`Viewport type constant "${String(e)}" already exists`);i[e]=t}let o=i},42422:(e,t,r)=>{"use strict";function n(e,t){let r=t.voxelManager.getScalarData();if(!e.getPointData)return;let n=e.getPointData().getScalars().getData();if(t.color&&t.rgba){let e=new Uint8Array(t.columns*t.rows*3);for(let n=0;ne,n.set(e)}else n.set(r);e.modified()}r.d(t,{J:()=>n})},42684:(e,t,r)=>{"use strict";r.d(t,{aZ:()=>X,vC:()=>q});var n=r(2523),i=r(62685),a=r(56872),o=r(42357),s=r(68337),l=r(58851),u=r(39997),c=r(7842),d=r(21569),p=r(97470),m=r(54268),h=r(34693),f=r(1705),g=r(32166),v=r(30888),y=r(18025),b=r(30113),I=r(77280),x=r(69228),C=r(60251),A=r(74092),T=r(33308),S=r(63467);class w{constructor(e){this.host=e,this.managedDataIds=new Set,this.volumeDataIds=new Map,this.stackSetRequestId=0,this.properties=new Map,this.globalDefaultProperties=new Map,this.perImageIdDefaultProperties=new Map,this.onStackNewImage=e=>{if(0===this.perImageIdDefaultProperties.size)return;let t=e.detail,r=t?.imageId,n=this.resolveTargetDataId();if(!n)return;let i=r?this.getPerImageDefaultProperties(r):void 0,a=this.globalDefaultProperties.get(n),o=i||a;o&&this.setProperties(o)},e.getElement().addEventListener(I.sV.STACK_NEW_IMAGE,this.onStackNewImage)}async setStack(e,t=0){if(!e.length)throw Error("[PlanarViewport] Cannot set an empty stack");let r=++this.stackSetRequestId,n=this.getLegacyStackDataId(),i=Math.min(Math.max(0,t),e.length-1),a=!1;try{if(this.host.removeBindingsExcept(new Set),this.registerDataSet(n,{imageIds:e,initialImageIdIndex:i}),a=!0,await this.host.setDisplaySets({displaySetId:n,options:{orientation:this.host.getRequestedOrientation()}}),r!==this.stackSetRequestId)return e[i];let t=await this.host.setImageIdIndex(i);return this.prunePerImageDefaultProperties(new Set(e)),this.host.getCurrentImageId()||t}catch(e){throw a&&r===this.stackSetRequestId&&this.removeData(n),e}}async setVolumes(e,t=!1,r=!1){await this.mountVolumes(e,!0,r),t&&this.host.render()}async addVolumes(e,t=!1,r=!1){await this.mountVolumes(e,!1,r),t&&this.host.render()}setProperties(e={},t,r=!1){let n="string"==typeof t?t:void 0,i=this.resolveTargetDataId(n);if(!i)return;let a=(0,T.te)(this.properties.get(i)||{},e),o=this.globalDefaultProperties.get(i)||{};this.globalDefaultProperties.set(i,(0,T.te)(e,o)),this.properties.set(i,a),void 0!==e.orientation&&this.host.setCameraOrientation((0,T.MV)(e.orientation)),this.host.setDataPresentationState(i,(0,T.kv)(a)),r||void 0===e.colormap||this.emitColormapModified(i,n)}setDefaultProperties(e={},t){if(null==t){let t=this.resolveTargetDataId();if(!t)return;this.globalDefaultProperties.set(t,(0,T.GY)(e));return}this.setPerImageDefaultProperties(t,(0,T.GY)(e)),this.host.getCurrentImageId()===t&&this.setProperties(e)}clearDefaultProperties(e){if(null==e){let e=this.resolveTargetDataId();e&&this.globalDefaultProperties.delete(e),this.resetProperties();return}this.perImageIdDefaultProperties.delete(e),this.resetToDefaultProperties()}resetToDefaultProperties(){let e=this.resolveTargetDataId();if(!e)return;let t=this.host.getCurrentImageId(),r=(t?this.getPerImageDefaultProperties(t):void 0)||this.globalDefaultProperties.get(e)||{};this.properties.set(e,(0,T.GY)(r)),void 0!==r.orientation&&this.host.setCameraOrientation((0,T.MV)(r.orientation)),this.host.setDataPresentationState(e,(0,T.kv)(r))}getProperties(e){let t=this.resolveTargetDataId(e),r=t?this.host.getDisplaySetPresentation(t):void 0,n=t?this.properties.get(t):void 0,i={...(0,T.GY)(n||{}),...r?(0,T.GY)(r):{},...this.host.getCameraOrientation()?{orientation:(0,T.MV)(this.host.getCameraOrientation())}:{}};if(!i.voiRange&&t){let e=this.host.getDefaultVOIRange(t);e&&(i.voiRange={...e})}return i}resetProperties(e){let t=this.resolveTargetDataId(e);t&&(this.properties.set(t,{}),this.host.setDataPresentationState(t,{}))}getBlendMode(e=[]){let t=this.getBlendModeTargetDataIds(e)[0];if(!t)return;let r=this.host.getDisplaySetPresentation(t)?.blendMode;if(void 0!==r)return r;let n=this.host.getBindingActor(t),i=n?.getMapper?.(),a=i?.getBlendMode?.();return void 0!==a?a:(0,S.Y1)(i?.getSlabType?.())}setBlendMode(e,t=[],r=!1){let n=this.getBlendModeTargetDataIds(t);n.length&&(n.forEach(t=>{let r=(0,T.te)(this.properties.get(t)||{},{blendMode:e});this.properties.set(t,r),this.host.setDisplaySetPresentation(t,{blendMode:e})}),r&&this.host.render())}getNumberOfSlices(){return Math.max(this.host.getImageCount(),this.host.getMaxImageIdIndex()+1)}removeData(e){this.managedDataIds.delete(e)&&this.unregisterDataId(e)}destroy(){let e;for(let t of(this.host.getElement().removeEventListener(I.sV.STACK_NEW_IMAGE,this.onStackNewImage),Array.from(this.managedDataIds)))try{this.unregisterDataId(t)}catch(t){e??=t}if(this.managedDataIds.clear(),this.volumeDataIds.clear(),this.properties.clear(),this.globalDefaultProperties.clear(),this.perImageIdDefaultProperties.clear(),void 0!==e)throw e}getLegacyStackDataId(){return`__planar_v2__:${this.host.getViewportId()}:stack`}getLegacyVolumeDataId(e){return`__planar_v2__:${this.host.getViewportId()}:volume:${e}`}registerDataSet(e,t){y.A.add(e,t),this.managedDataIds.add(e)}async mountVolumes(e,t,r){if(!e.length)return;let n=[];try{for(let t of e){let e=m.Ay.getVolume(t.volumeId);if(!e)throw Error(`imageVolume with id: ${t.volumeId} does not exist, you need to create/allocate the volume first`);let r=this.getLegacyVolumeDataId(t.volumeId);this.registerDataSet(r,{imageIds:e.imageIds,initialImageIdIndex:this.getInitialVolumeImageIdIndex(e.imageIds.length),reference:{kind:"volume",volumeId:t.volumeId},volumeId:t.volumeId}),this.volumeDataIds.set(t.volumeId,r),n.push(r)}t&&this.host.removeBindingsExcept(new Set(n)),this.host.prepareVolumeCompatibilityCamera();let i={orientation:this.host.getRequestedOrientation()},a=this.host.getActiveDataId();await this.host.setDisplaySets(...n.map((e,r)=>({displaySetId:e,options:{...i,role:0===r&&(t||!a)?"source":"overlay"}}))),e.forEach((e,t)=>{let r=n[t];if(void 0!==e.visibility&&this.host.setDisplaySetPresentation(r,{visible:e.visibility}),void 0!==e.blendMode){let t=(0,T.te)(this.properties.get(r)||{},{blendMode:e.blendMode});this.properties.set(r,t),this.host.setDisplaySetPresentation(r,{blendMode:e.blendMode})}void 0!==e.slabThickness&&this.host.setDisplaySetPresentation(r,{slabThickness:e.slabThickness});let i=this.host.getBindingActor(r);if(i&&e.callback){e.callback({volumeActor:i,volumeId:e.volumeId});let t=this.buildVolumePresentationFromActor(r);t&&this.applyVolumePresentation(r,t)}}),r||(0,x.A)(this.host.getElement(),I.sV.VOLUME_VIEWPORT_NEW_VOLUME,{viewportId:this.host.getViewportId(),volumeActors:this.buildVolumeActorEntries(e,n)})}catch(e){throw n.forEach(e=>{this.removeData(e)}),e}}getInitialVolumeImageIdIndex(e){let t=this.host.getCurrentPlanarRendering();return t&&(t.renderMode===f.T.CPU_VOLUME||t.renderMode===f.T.VTK_VOLUME_SLICE)?Math.min(Math.max(0,t.currentImageIdIndex),Math.max(e-1,0)):Math.floor(e/2)}getBlendModeTargetDataIds(e){let t=Array.from(new Set(this.volumeDataIds.values()));return e.length?t.filter(t=>{let r=this.host.getBindingActor(t),n=r?.getUID?.()||r?.uid||(r?.get?.("uid")?.uid??void 0);return!!n&&e.includes(n)}):t}resolveTargetDataId(e){if(e){let t=this.volumeDataIds.get(e)||this.host.findDataIdByVolumeId(e);if(t)return t}return this.host.getActiveDataId()||this.host.getFirstBoundDataId()}emitColormapModified(e,t){let r=t||this.resolveVolumeIdForDataId(e),n=(r?this.buildVolumeColormap(e):void 0)||this.properties.get(e)?.colormap;n&&(0,x.A)(this.host.getElement(),I.sV.COLORMAP_MODIFIED,{viewportId:this.host.getViewportId(),volumeId:r,colormap:n})}applyVolumePresentation(e,t){let r=(0,T.te)(this.properties.get(e)||{},t);this.properties.set(e,r);let n=this.globalDefaultProperties.get(e)||{};this.globalDefaultProperties.set(e,(0,T.te)(r,n)),this.host.setDataPresentationState(e,(0,T.kv)(r))}buildVolumeActorEntries(e,t){return e.flatMap((e,r)=>{let n=this.host.getBindingActor(t[r]);if(!n)return[];let{actorUID:i,slabThickness:a,volumeId:o,...s}=e;return[{uid:i||o,actor:n,slabThickness:a,referencedId:o,...s}]})}buildVolumeColormap(e){let t=this.host.getBindingActor(e),r=t?.getProperty?.().getRGBTransferFunction?.(0);if(!t||!r)return;let n=(0,A.getTransferFunctionNodes)(r).reduce((e,t)=>(e.push(t[0],t[1],t[2],t[3]),e),[]),i=(0,C.findMatchingColormap)(n,t)||{},a=(0,C.getThresholdValue)(t);return void 0===i.opacity&&(i.opacity=(0,C.getMaxOpacity)(t)),null!==a&&(i.threshold=a),Object.keys(i).length?i:void 0}buildVolumePresentationFromActor(e){let t=this.host.getBindingActor(e),r=t?.getProperty?.().getRGBTransferFunction?.(0),n=this.buildVolumeColormap(e),i=t?.getMapper?.(),a=i?.getBlendMode?.()??(0,S.Y1)(i?.getSlabType?.()),o=r?.getRange?.(),s={};return n&&(s.colormap=n),o&&o[1]>o[0]&&(s.voiRange={lower:o[0],upper:o[1]}),void 0!==a&&(s.blendMode=a),Object.keys(s).length?s:void 0}resolveVolumeIdForDataId(e){for(let[t,r]of this.volumeDataIds.entries())if(r===e)return t}getPerImageDefaultProperties(e){let t=this.perImageIdDefaultProperties.get(e);return t&&(this.perImageIdDefaultProperties.delete(e),this.perImageIdDefaultProperties.set(e,t)),t}setPerImageDefaultProperties(e,t){this.perImageIdDefaultProperties.has(e)&&this.perImageIdDefaultProperties.delete(e),this.perImageIdDefaultProperties.set(e,t),this.evictPerImageDefaultProperties()}prunePerImageDefaultProperties(e){for(let t of this.perImageIdDefaultProperties.keys())e.has(t)||this.perImageIdDefaultProperties.delete(t);this.evictPerImageDefaultProperties()}evictPerImageDefaultProperties(){for(;this.perImageIdDefaultProperties.size>2048;){let e=this.perImageIdDefaultProperties.keys().next().value;if(void 0===e)return;this.perImageIdDefaultProperties.delete(e)}}unregisterDataId(e){try{y.A.remove(e)}finally{this.properties.delete(e),this.globalDefaultProperties.delete(e),this.removeVolumeDataId(e)}}removeVolumeDataId(e){for(let[t,r]of this.volumeDataIds.entries())r===e&&this.volumeDataIds.delete(t)}}var O=r(98115),P=r(95704);class _ extends p.A{constructor(){super(...arguments),this.legacyCompatibility=new w(this.createLegacyCompatibilityHost())}cloneTuple(e){if(e)return Array.from(e)}getCamera(){let e=this.getViewState(),t={...e,...this.getCameraForEvent()},r=e.orientation&&"object"==typeof e.orientation?{...e.orientation,viewUp:this.cloneTuple(e.orientation.viewUp),viewPlaneNormal:this.cloneTuple(e.orientation.viewPlaneNormal)}:e.orientation;return{...t,focalPoint:this.cloneTuple(t.focalPoint),position:this.cloneTuple(t.position),viewUp:this.cloneTuple(t.viewUp),viewPlaneNormal:this.cloneTuple(t.viewPlaneNormal),orientation:r}}setCamera(e){let t={};if(this.applyLegacyPlanarPresentationPatch(t,e),this.applyLegacyParallelScalePatch(t,e),this.applyLegacyOrientationPatch(t,e),this.applyLegacyFocalPointPatch(t,e),e.position&&!e.focalPoint&&!Object.keys(t).length)return void this.warnUnsupportedPositionOnlyCameraPatch();Object.keys(t).length&&this.setViewState(t)}getViewPresentation(e){return b.g.getPresentation(this,{selector:e})}setViewPresentation(e){if(!e)return;(0,v.A)(e,"displayArea")&&(this.options={...this.options,displayArea:(0,O.z$)(e.displayArea)});let t=b.g.withPresentation(this,e);t&&this.setViewState(t)}resetCamera(e){return this.resetViewState(e)}resetCameraForResize(){return this.resetViewStateForResize()}get volumeIds(){let e=new Set;for(let t of this.getActors())for(let r of[t.referencedId,t.uid])"string"==typeof r&&m.Ay.getVolume(r)&&e.add(r);return e}get csImage(){return this.getCornerstoneImage()}getCornerstoneImage(){let e=this.getCurrentBinding()?.data;return e?.image}getAllVolumeIds(){return Array.from(this.volumeIds)}applyLegacyPlanarPresentationPatch(e,t){(0,v.A)(t,"orientation")&&(e.orientation=t.orientation),(0,v.A)(t,"anchorWorld")&&(e.anchorWorld=(0,g.A)(t.anchorWorld)),(0,v.A)(t,"anchorCanvas")&&(e.anchorCanvas=t.anchorCanvas?[...t.anchorCanvas]:void 0),(0,v.A)(t,"scale")&&(e.scale=t.scale),(0,v.A)(t,"scaleMode")&&(e.scaleMode=t.scaleMode),(0,v.A)(t,"rotation")&&(e.rotation=t.rotation),(0,v.A)(t,"flipHorizontal")&&(e.flipHorizontal=t.flipHorizontal),(0,v.A)(t,"flipVertical")&&(e.flipVertical=t.flipVertical),(0,v.A)(t,"displayArea")&&(e.displayArea=t.displayArea),(0,v.A)(t,"slice")&&(e.slice=t.slice)}applyLegacyParallelScalePatch(e,t){if("number"!=typeof t.parallelScale)return;let r=this.getResolvedView()?.toICamera();if(!r||"number"!=typeof r.parallelScale)return;let n=this.getScale(),i=Math.max(r.presentationScale?.[1]??n[1]??1,1e-6),a=Math.max(r.presentationScale?.[0]??n[0]??i,1e-6),o=r.parallelScale*i/Math.max(t.parallelScale,1e-6);e.displayArea=void 0,e.scale=[a/i*o,o],e.scaleMode="fit"}applyLegacyOrientationPatch(e,t){if(!t.viewPlaneNormal)return;let r=this.getResolvedView()?.toICamera();e.orientation={viewPlaneNormal:[...t.viewPlaneNormal],viewUp:t.viewUp?[...t.viewUp]:r?.viewUp?[...r.viewUp]:void 0}}applyLegacyFocalPointPatch(e,t){if(!t.focalPoint)return;let r=[...t.focalPoint];e.anchorCanvas=[.5,.5],e.anchorWorld=r,e.displayArea=void 0,this.isVolumeSliceRenderingActive()&&(e.slice={kind:"volumePoint",sliceWorldPoint:r})}isVolumeSliceRenderingActive(){let e=this.getCurrentPlanarRendering();return e?.renderMode===f.T.CPU_VOLUME||e?.renderMode===f.T.VTK_VOLUME_SLICE}warnUnsupportedPositionOnlyCameraPatch(){void 0===P&&console.warn("[PlanarViewportLegacyAdapter] Position-only planar camera patches are unsupported. Use focalPoint, parallelScale, or view state APIs.")}removeData(e){super.removeData(e),this.legacyCompatibility.removeData(e)}getActor(e){return this.getActors().find(t=>t.uid===e)}removeActors(e){let t=!1;e.filter(e=>"string"==typeof e).forEach(e=>{let r=this.findBindingDataIdByActorEntryUID(e);r&&("overlay"===this.getDisplaySetRole(r)&&y.A.remove(r),this.removeData(r),t=!0)}),t&&this.render()}async setStack(e,t=0){return this.legacyCompatibility.setStack(e,t)}async setVolumes(e,t=!1,r=!1){return this.legacyCompatibility.setVolumes(e,t,r)}async addVolumes(e,t=!1,r=!1){return this.legacyCompatibility.addVolumes(e,t,r)}setProperties(e={},t,r=!1){this.legacyCompatibility.setProperties(e,t,r)}getProperties(e){return this.legacyCompatibility.getProperties(e)}resetProperties(e){this.legacyCompatibility.resetProperties(e)}setDefaultProperties(e={},t){this.legacyCompatibility.setDefaultProperties(e,t)}clearDefaultProperties(e){this.legacyCompatibility.clearDefaultProperties(e)}resetToDefaultProperties(){this.legacyCompatibility.resetToDefaultProperties()}getBlendMode(e){return this.legacyCompatibility.getBlendMode(e)}setBlendMode(e,t,r=!1){this.legacyCompatibility.setBlendMode(e,t,r)}getSlabThickness(){let e=h.A.MINIMUM_SLAB_THICKNESS;for(let t of this.getActors())t.slabThickness>e&&(e=t.slabThickness);return e}getNumberOfSlices(){return this.legacyCompatibility.getNumberOfSlices()}onDestroy(){this.legacyCompatibility.destroy(),super.onDestroy()}}var E=r(15344);class D extends E.A{setDataIds(e,t){let r=e[0];if(r)return this.setVideo(r,(t?.viewReference?.sliceIndex||0)+1)}async setVideo(e,t){return await this.setDisplaySets({displaySetId:e}),"number"==typeof t&&this.setFrameNumber(t),this}setProperties(e){let t=this.getFirstBinding()?.data.id;if(!t)return;let r={},n={};"boolean"==typeof e.loop&&(r.loop=e.loop),"boolean"==typeof e.muted&&(r.muted=e.muted),"number"==typeof e.playbackRate&&(r.playbackRate=e.playbackRate),e.pan&&(n.pan=e.pan),e.voiRange&&(r.voiRange=e.voiRange),void 0!==e.invert&&(r.invert=e.invert),Object.keys(r).length&&this.setDisplaySetPresentation(t,r),Object.keys(n).length&&this.setViewPresentation(n)}getViewPresentation(e){return b.g.getPresentation(this,{selector:e})}setViewPresentation(e){if(!e)return;let t=b.g.withPresentation(this,e);t&&this.setViewState(t)}resetCamera(){return this.resetViewState()}getProperties(){let e=this.getFirstBinding()?.data.id,t=e?this.getDisplaySetPresentation(e):void 0,r=this.getViewPresentation();return{invert:t?.invert,loop:t?.loop,muted:t?.muted,pan:r?.pan,playbackRate:t?.playbackRate,voiRange:t?.voiRange}}resetProperties(){let e=this.getFirstBinding()?.data.id;e&&(this.setDisplaySetPresentation(e,{invert:!1,loop:!0,muted:!0,playbackRate:1,voiRange:void 0}),this.setViewPresentation({pan:[0,0],zoom:1}))}setVOI(e){let t=this.getFirstBinding()?.data.id;t&&this.setDisplaySetPresentation(t,{voiRange:e})}setAverageWhite(e){let t=this.getFirstBinding()?.data.id;t&&this.setDisplaySetPresentation(t,{averageWhite:e})}}var R=r(92882),M=r(79267),N=r(91711);class V extends R.A{constructor(){super(...arguments),this.managedDataIds=new Set,this.volumeDataIds=new Map,this.legacyProperties=new Map,this.defaultLegacyProperties=new Map}getCamera(){return this.getViewState()}setCamera(e){this.setViewState(e)}getViewPresentation(){return b.g.getPresentation(this)}setViewPresentation(e){var t;if(!e)return;let r=(t=e)&&"object"==typeof t&&"camera"in t?e:{camera:e},n=b.g.withPresentation(this,r);n&&this.setViewState(n)}resetCamera(){return this.resetViewState()}resetCameraForResize(){return this.resetViewStateForResize()}async setVolumes(e,t=!1,r=!1){await this.mountVolumes(e,!0,r),t&&this.render()}async addVolumes(e,t=!1,r=!1){await this.mountVolumes(e,!1,r),t&&this.render()}setProperties(e={},t,r=!1){let n=this.resolveTargetDataId(t);if(!n)return;let i={...this.legacyProperties.get(n)||{},...e};this.defaultLegacyProperties.has(n)||this.defaultLegacyProperties.set(n,{...e}),this.legacyProperties.set(n,i);let a={};void 0!==e.voiRange&&(a.voiRange=e.voiRange),void 0!==e.invert&&(a.invert=e.invert),void 0!==e.interpolationType&&(a.interpolationType=e.interpolationType),void 0!==e.sampleDistanceMultiplier&&(a.sampleDistanceMultiplier=e.sampleDistanceMultiplier),Object.keys(a).length&&this.setDisplaySetPresentation(n,a),void 0!==e.preset&&this.applyPresetToBinding(n,e.preset,t,r),this.render()}getProperties(e){let t=this.resolveTargetDataId(e);return t?{...this.legacyProperties.get(t)||{}}:{}}resetProperties(e){let t=this.resolveTargetDataId(e);if(!t)return;let r=this.defaultLegacyProperties.get(t)||{};this.legacyProperties.set(t,{...r}),this.setDisplaySetPresentation(t,{voiRange:r.voiRange,invert:r.invert,interpolationType:r.interpolationType,sampleDistanceMultiplier:r.sampleDistanceMultiplier}),void 0!==r.preset&&this.applyPresetToBinding(t,r.preset,e,!1),this.render()}setSampleDistanceMultiplier(e){this.setProperties({sampleDistanceMultiplier:e})}removeData(e){super.removeData(e),this.forgetData(e)}getActors(){return super.getActors()}getDefaultActor(){return super.getDefaultActor()}async mountVolumes(e,t,r){if(!e.length)return;let n=[];try{for(let t of e){let e=m.Ay.getVolume(t.volumeId);if(!e)throw Error(`imageVolume with id: ${t.volumeId} does not exist, you need to create/allocate the volume first`);let r=this.getLegacyVolumeDataId(t.volumeId),i={imageIds:e.imageIds,volumeId:t.volumeId};y.A.add(r,i),this.managedDataIds.add(r),this.volumeDataIds.set(t.volumeId,r),n.push(r)}t&&this.removeBindingsExcept(new Set(n)),await this.setDisplaySets(...n.map(e=>({displaySetId:e,options:{renderMode:"vtkVolume3d"}}))),e.forEach((e,t)=>{let r=n[t];if(void 0!==e.visibility&&this.setDisplaySetPresentation(r,{visible:e.visibility}),e.callback){let t=this.getBindingActor(r);t&&e.callback({volumeActor:t,volumeId:e.volumeId})}}),r||(0,x.A)(this.element,I.sV.VOLUME_VIEWPORT_NEW_VOLUME,{viewportId:this.id,volumeActors:this.buildActorEntries(e,n)})}catch(e){throw n.forEach(e=>{this.forgetData(e)}),e}}buildActorEntries(e,t){return e.flatMap((e,r)=>{let n=this.getBindingActor(t[r]);if(!n)return[];let{actorUID:i,slabThickness:a,volumeId:o,...s}=e;return[{uid:i||o,actor:n,slabThickness:a,referencedId:o,...s}]})}applyPresetToBinding(e,t,r,n){let i="string"==typeof t?M.E3.find(e=>e.name===t):t;if(!i)return;let a=this.getBindingActor(e);a&&((0,N.A)(a,i),n||(0,x.A)(this.element,I.sV.PRESET_MODIFIED,{viewportId:this.id,volumeId:r??this.resolveVolumeIdForDataId(e),actor:a,presetName:i.name}))}getBindingActor(e){let t=this.getBinding(e);if(!t)return;let r=t.rendering;return r?.actor}resolveTargetDataId(e){if(e){let t=this.volumeDataIds.get(e);if(t)return t;for(let[t,r]of this.bindings.entries()){let n=r.rendering;if(n?.imageVolume?.volumeId===e)return t}}return this.bindings.keys().next().value}resolveVolumeIdForDataId(e){for(let[t,r]of this.volumeDataIds.entries())if(r===e)return t}removeBindingsExcept(e){for(let t of Array.from(this.bindings.keys()))e.has(t)||this.removeData(t)}getLegacyVolumeDataId(e){return`__volume3d__:${this.id}:volume:${e}`}forgetData(e){if(this.managedDataIds.delete(e))for(let[t,r]of(y.A.remove(e),this.legacyProperties.delete(e),this.defaultLegacyProperties.delete(e),this.volumeDataIds.entries()))r===e&&this.volumeDataIds.delete(t)}onDestroy(){for(let e of Array.from(this.managedDataIds))y.A.remove(e);this.managedDataIds.clear(),this.volumeDataIds.clear(),this.legacyProperties.clear(),this.defaultLegacyProperties.clear(),super.onDestroy()}}var L=r(81681),B=r(39216),F=r(91832);class U extends L.A{setCamera(e){let t={};if("number"==typeof e.zoom&&(t.zoom=e.zoom),e.centerIndex&&(t.centerIndex=[e.centerIndex[0],e.centerIndex[1]]),"number"==typeof e.rotation&&(t.rotation=e.rotation),"number"==typeof e.resolution&&(t.resolution=e.resolution),"number"==typeof e.parallelScale){let r=this.getImageData()?.spacing?.[0];"number"==typeof r&&r>0&&(t.resolution=1/r/(this.element.clientHeight/Math.max(e.parallelScale,.001)))}if(e.focalPoint){let r=this.getView();if(r){let n=this.worldToCanvas(e.focalPoint),i=(0,F.E5)({canvasPos:n,canvasWidth:this.element.clientWidth,canvasHeight:this.element.clientHeight,view:r});t.centerIndex=[i[0],i[1]]}}Object.keys(t).length&&this.setViewState(t)}getCamera(){return{...this.getViewState(),...this.getCameraForEvent()}}setDataIds(e,t){let r=e[0];if(!r)return;let n=t?.webClient||B.get(I.nb.WADO_WEB_CLIENT,r);if(!n)throw Error(`To use setDataIds on WSI data, you must provide metaData.webClient for ${r}.`);return y.A.add(r,{imageIds:e,kind:"wsi",options:{miniNavigationOverlay:t?.miniNavigationOverlay,webClient:n}}),this.setDisplaySets({displaySetId:r})}async setWSI(e,t){return this.setDataIds(e,{webClient:t})}setProperties(e){let t=this.getActiveDataId();t&&this.setDisplaySetPresentation(t,{voiRange:e.voiRange})}getProperties(){let e=this.getActiveDataId(),t=e?this.getDisplaySetPresentation(e):void 0;return{voiRange:t?.voiRange}}resetProperties(){let e=this.getActiveDataId();e&&this.setDisplaySetPresentation(e,{averageWhite:void 0,voiRange:{lower:0,upper:255}})}getViewPresentation(e){return b.g.getPresentation(this,{selector:e})}setViewPresentation(e){if(!e)return;let t=b.g.withPresentation(this,e);t&&this.setViewState(t)}resetCamera(){return this.resetViewState()}setVOI(e){let t=this.getActiveDataId();t&&this.setDisplaySetPresentation(t,{voiRange:e})}setAverageWhite(e){let t=this.getActiveDataId();t&&this.setDisplaySetPresentation(t,{averageWhite:e})}}class k extends d.A{async setEcg(e){await this.setDisplaySets({displaySetId:e})}setChannelVisibility(e,t){let r=this.getWaveformData(),n=this.getFirstBinding()?.data.id;if(!r||!n)return;let i=new Set((this.getDisplaySetPresentation(n)||{}).visibleChannels||r.channels.map((e,t)=>t));t?i.add(e):i.delete(e),this.setDisplaySetPresentation(n,{visibleChannels:Array.from(i).sort((e,t)=>e-t)})}setProperties(e){let t=this.getFirstBinding()?.data.id;t&&this.setDisplaySetPresentation(t,{visibleChannels:e.visibleChannels})}getProperties(){let e=this.getFirstBinding()?.data.id;return{visibleChannels:e?this.getDisplaySetPresentation(e)?.visibleChannels:void 0}}resetProperties(){let e=this.getWaveformData(),t=this.getFirstBinding()?.data.id;e&&t&&this.setDisplaySetPresentation(t,{visibleChannels:e.channels.map((e,t)=>t)})}getViewPresentation(e){return b.g.getPresentation(this,{selector:e})}setViewPresentation(e){if(!e)return;let t=b.g.withPresentation(this,e);t&&this.setViewState(t)}resetCamera(){return this.resetViewState()}}let G=new Map,W={},z=[],H=new Set,j=!1;function $(){j||(j=!0,K({type:a.A.ORTHOGRAPHIC,ViewportClass:i.A}),K({type:a.A.PERSPECTIVE,ViewportClass:i.A}),K({type:a.A.STACK,ViewportClass:n.A}),K({type:a.A.VOLUME_3D,ViewportClass:s.A}),K({type:a.A.WHOLE_SLIDE,ViewportClass:u.A}),K({type:a.A.ECG,ViewportClass:c.A}),K({type:a.A.VIDEO,ViewportClass:l.A}),K({type:a.A.VOLUME_3D_NEXT,ViewportClass:R.A,resolveClass:({type:e,requestedType:t})=>e===a.A.VOLUME_3D_NEXT&&t===a.A.VOLUME_3D?V:void 0}),K({type:a.A.PLANAR_NEXT,ViewportClass:p.A,resolveClass:({type:e,requestedType:t})=>e===a.A.PLANAR_NEXT&&(t===a.A.STACK||t===a.A.ORTHOGRAPHIC)?_:void 0}),K({type:a.A.VIDEO_NEXT,ViewportClass:E.A,resolveClass:({type:e,requestedType:t})=>e===a.A.VIDEO_NEXT&&t===a.A.VIDEO?D:void 0}),K({type:a.A.ECG_NEXT,ViewportClass:d.A,resolveClass:({type:e,requestedType:t})=>e===a.A.ECG_NEXT&&t===a.A.ECG?k:void 0}),K({type:a.A.WHOLE_SLIDE_NEXT,ViewportClass:L.A,resolveClass:({type:e,requestedType:t})=>e===a.A.WHOLE_SLIDE_NEXT&&t===a.A.WHOLE_SLIDE?U:void 0}))}function K({type:e,name:t,ViewportClass:r,resolveClass:n}){if(G.has(e))throw Error(`Viewport type "${e}" is already registered`);if(t&&Object.prototype.hasOwnProperty.call(o.A,t))throw Error(`Viewport type constant "${t}" already exists`);G.set(e,r),W[e]=r,H.add(e),t&&(0,o.R)(t,e),n&&z.push(n)}function q(e){return $(),H.has(e)}function X(e){for(let t of($(),z)){let r=t(e);if(r)return r}let t=G.get(e.type);if(!t)throw Error(`Unknown viewport type: ${e.type}`);return t}},42776:(e,t,r)=>{"use strict";var n;r.d(t,{A:()=>i}),function(e){e.RLE="RLE",e.Volume="Volume"}(n||(n={}));let i=n},42905:(e,t,r)=>{"use strict";var n=r(70192),i=r(82006),a=r(50923),o=r(97442),s=r(59998),l=r(73904),u=r(34470),c=r(11492),d=r(87635),p=r(17191),m=r(10353),h=r(4101),f=r(60212),g=r(34699),v=r(894),y=r(46704),b=r(83048),I=r(12487),x=r(69340);let{transformWorldToIndex:C}=n.BF;class A extends v.A{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{storePointData:!1,numSlicesToPropagate:10,calculatePointsInsideVolume:!0,getTextLines:T,statsCalculator:b.OA,showTextBox:!1,throttleTimeout:100}}){super(e,t),this.addNewAnnotation=e=>{let t,r,i,{currentPoints:a,element:s}=e.detail,l=a.world,c=(0,n.kJ)(s),{viewport:d,renderingEngine:p}=c;this.isDrawing=!0;let{viewPlaneNormal:m,viewUp:g}=d.getCamera();if(d instanceof n.hS)throw Error("Stack Viewport Not implemented");{let e=this.getTargetId(d);i=n.BF.getVolumeId(e),r=n.PP.getVolume(i),t=n.BF.getClosestImageId(r,l,m)}let v=n.BF.getSpacingInNormalDirection(r,m),y=this._getStartCoordinate(l,m),b=this._getEndCoordinate(l,v,m),I={highlighted:!0,invalidated:!0,metadata:{viewPlaneNormal:[...m],enabledElement:c,viewUp:[...g],FrameOfReferenceUID:d.getFrameOfReferenceUID(),referencedImageId:t,toolName:this.getToolName(),volumeId:i,spacingInNormal:v},data:{label:"",startCoordinate:y,endCoordinate:b,cachedStats:{pointsInVolume:[],projectionPoints:[],projectionPointsImageIds:[t],statistics:[]},handles:{textBox:{hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}},points:[[...l],[...l],[...l],[...l]],activeHandleIndex:null}}};this._computeProjectionPoints(I,r),(0,o.lC)(I,s);let x=(0,u.Q0)(s,this.getToolName());return this.editData={annotation:I,viewportIdsToRender:x,handleIndex:3,newAnnotation:!0,hasMoved:!1},this._activateDraw(s),(0,h.lY)(s),e.preventDefault(),(0,f.A)(x),I},this._endCallback=e=>{let{element:t}=e.detail,{annotation:r,viewportIdsToRender:i,newAnnotation:a,hasMoved:s}=this.editData,{data:l}=r;if(a&&!s)return;l.handles.activeHandleIndex=null,this._deactivateModify(t),this._deactivateDraw(t),(0,h.Q_)(t);let{metadata:u}=r,{enabledElement:c}=u;this.editData=null,this.isDrawing=!1,this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,o.O8)(r.annotationUID);let d=this.getTargetId(c.viewport),p=n.PP.getVolume(d.split(/volumeId:|\?/)[1]);this._computeProjectionPoints(r,p),this._computePointsInsideVolume(r,d,p,c),(0,f.A)(i),a?(0,g.triggerAnnotationCompleted)(r):(0,g.triggerAnnotationModified)(r,t)},this.renderAnnotation=(e,t)=>{let r=!1,{viewport:i}=e,a=(0,o.Rh)(this.getToolName(),i.element);if(!a?.length)return r;a=(0,I.WA)(a,i.getCamera());let u={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let o=0;oi.worldToCanvas(e));u.annotationUID=p;let C=this.getStyle("lineWidth",u,d),A=this.getStyle("lineDash",u,d),T=this.getStyle("color",u,d),S=i.getCamera().focalPoint,w=i.getCamera().viewPlaneNormal,O=this._resolveViewPlaneCoordinate(g,w),P=this._resolveViewPlaneCoordinate(v,w);if(this._isCoordinateTuple(g)){let e=this._getIndexOfCoordinatesForViewplaneNormal(w);h.handles.points.forEach(t=>{t[e]=O}),h.startCoordinate=O}this._isCoordinateTuple(v)&&(h.endCoordinate=P);let _=n.BF.roundToPrecision(O),E=n.BF.roundToPrecision(P),D=this._getCoordinateForViewplaneNormal(S,w),R=n.BF.roundToPrecision(D);if(RMath.max(_,E))continue;for(let e of I.viewport?.volumeIds.values())d.invalidated&&d.metadata.volumeId===e&&this._throttledCalculateCachedStats(d,I);let M=!1;if((R===_||R===E)&&(M=!0),!i.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}if(!(0,m.YY)(p))continue;(0,s.Gh)(p)||this.editData||null===b||!M||(c=[x[b]]),c&&(0,l.qX)(t,p,"0",c,{color:T});let N=A;if(M||(N=2),(0,l.tk)(t,p,"0",x[0],x[3],{color:T,lineDash:N,lineWidth:C}),r=!0,this.configuration.showTextBox){let r=this.configuration.getTextLines(h,{metadata:f});if(!r||0===r.length||!this.renderLinkedTextBoxAnnotation({enabledElement:e,svgDrawingHelper:t,annotation:d,styleSpecifier:u,textLines:r,canvasCoordinates:x}))continue}}return r},this.configuration.calculatePointsInsideVolume?this._throttledCalculateCachedStats=(0,c.A)(this._calculateCachedStatsTool,this.configuration.throttleTimeout,{trailing:!0}):this._throttledCalculateCachedStats=(0,d.A)(this._calculateCachedStatsTool,this.configuration.throttleTimeout)}_isCoordinateTuple(e){return Array.isArray(e)||ArrayBuffer.isView(e)}_resolveViewPlaneCoordinate(e,t){return this._isCoordinateTuple(e)?this._getCoordinateForViewplaneNormal(e,t):e}_computeProjectionPoints(e,t){let{data:r,metadata:n}=e,{viewPlaneNormal:i,spacingInNormal:o}=n,{imageData:s}=t,l=this._resolveViewPlaneCoordinate(r.startCoordinate,i),u=this._resolveViewPlaneCoordinate(r.endCoordinate,i),{points:c}=r.handles,d=C(s,c[0]),p=C(s,c[0]),m=a.vt();s.indexToWorldVec3(d,m);let h=a.vt();s.indexToWorldVec3(p,h);let f=this._getIndexOfCoordinatesForViewplaneNormal(i);2==f?(m[2]=l,h[2]=u):0==f?(m[0]=l,h[0]=u):1==f&&(m[1]=l,h[1]=u);let g=a.vt();a.Re(g,h,m);let v=a.Bw(g);a.S8(g,g);let y=[];for(let e=0;e{let r=a.vt();return a.Ln(r,t,g,e),Array.from(r)}));r.cachedStats.projectionPoints=y}_computePointsInsideVolume(e,t,r,n){let{data:a,metadata:o}=e,{viewPlaneNormal:s,viewUp:l}=o,{viewport:u}=n,c=a.cachedStats.projectionPoints,d=[[]],m=this.getTargetImageData(t),h=a.handles.points[0],f=a.handles.points[3],{worldWidth:g,worldHeight:v}=(0,p.A)(s,l,h,f),b=(0,i.Op)(m,a.habdles),I=Math.abs(g*v)/(b.scale*b.scale),A={isPreScaled:(0,y.u)(u,t),isSuvScaled:this.isSuvScaled(u,t,e.metadata.referencedImageId)},T=(0,x.j)(o.Modality,e.metadata.referencedImageId,A);for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.namespace_validate=o,t.namespace_validateAndExtract=function(e,t){e||(e=null),o(t);let r=t.split(":"),a=2===r.length?r[0]:null,s=2===r.length?r[1]:t;if(a&&null===e)throw new n.NamespaceError("Qualified name includes a prefix but the namespace is null.");if("xml"===a&&e!==i.namespace.XML)throw new n.NamespaceError('Qualified name includes the "xml" prefix but the namespace is not the XML namespace.');if(e!==i.namespace.XMLNS&&("xmlns"===a||"xmlns"===t))throw new n.NamespaceError('Qualified name includes the "xmlns" prefix but the namespace is not the XMLNS namespace.');if(e===i.namespace.XMLNS&&"xmlns"!==a&&"xmlns"!==t)throw new n.NamespaceError('Qualified name does not include the "xmlns" prefix but the namespace is the XMLNS namespace.');return[e,a,s]},t.namespace_extractQName=function(e){o(e);let t=e.split(":");return[2===t.length?t[0]:null,2===t.length?t[1]:e]};let n=r(32008),i=r(57226),a=r(54572);function o(e){if(!(0,a.xml_isName)(e))throw new n.InvalidCharacterError(`Invalid XML name: ${e}`);if(!(0,a.xml_isQName)(e))throw new n.InvalidCharacterError(`Invalid XML qualified name: ${e}.`)}},43385:(e,t,r)=>{"use strict";r.d(t,{T:()=>i});var n=r(32207);function i(e){return n._6.getSegmentation(e)}},43505:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(79267);function i(e){if(e.getParallelProjection())return void e.setClippingRange(-n.Cf.MAXIMUM_RAY_DISTANCE,n.Cf.MAXIMUM_RAY_DISTANCE);e.setClippingRange(n.Cf.MINIMUM_SLAB_THICKNESS,n.Cf.MAXIMUM_RAY_DISTANCE)}},43561:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>l});var n=r(17042),i=r(53038),a=r(51555),o={texture:null,handle:null,sampler:null,label:null};function s(e,t,r={}){Object.assign(t,o,r),n.Ay.obj(e,t),t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},t.bindGroupTime={},n.Ay.obj(t.bindGroupTime,{mtime:0}),n.Ay.get(e,t,["bindGroupTime","texture"]),n.Ay.setGet(e,t,["bindGroupLayoutEntry","label","sampler"]),t.classHierarchy.push("vtkWebGPUTextureView"),e.create=(e,r)=>{t.texture=e,t.options=r,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;let n=i.A.getDetailsFromTextureFormat(t.texture.getFormat());t.bindGroupLayoutEntry.texture.sampleType=n.sampleType},e.createFromTextureHandle=(e,r)=>{t.texture=null,t.options=r,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e,t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;let n=i.A.getDetailsFromTextureFormat(r.format);t.bindGroupLayoutEntry.texture.sampleType=n.sampleType,t.bindGroupTime.modified()},e.getBindGroupEntry=()=>({resource:e.getHandle()}),e.getShaderCode=(e,r)=>{let n="f32";"sint"===t.bindGroupLayoutEntry.texture.sampleType?n="i32":"uint"===t.bindGroupLayoutEntry.texture.sampleType&&(n="u32");let i=`@binding(${e}) @group(${r}) var ${t.label}: texture_${t.options.dimension}<${n}>;`;return"depth"===t.bindGroupLayoutEntry.texture.sampleType&&(i=`@binding(${e}) @group(${r}) var ${t.label}: texture_depth_${t.options.dimension};`),i},e.addSampler=(r,n)=>{let i=a.Ay.newInstance({label:`${t.label}Sampler`});i.create(r,n),e.setSampler(i)},e.getBindGroupTime=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.bindGroupTime),e.getHandle=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.handle)}var l={newInstance:n.Ay.newInstance(s),extend:s}},43918:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DocumentFragmentImpl=void 0;let n=r(5309),i=r(92787),a=r(48040);class o extends i.NodeImpl{_nodeType=n.NodeType.DocumentFragment;_children=new Set;_host;constructor(e=null){super(),this._host=e}getElementById(e){throw Error("Mixin: NonElementParentNode not implemented.")}get children(){throw Error("Mixin: ParentNode not implemented.")}get firstElementChild(){throw Error("Mixin: ParentNode not implemented.")}get lastElementChild(){throw Error("Mixin: ParentNode not implemented.")}get childElementCount(){throw Error("Mixin: ParentNode not implemented.")}prepend(){throw Error("Mixin: ParentNode not implemented.")}append(){throw Error("Mixin: ParentNode not implemented.")}querySelector(e){throw Error("Mixin: ParentNode not implemented.")}querySelectorAll(e){throw Error("Mixin: ParentNode not implemented.")}static _create(e,t=null){let r=new o(t);return r._nodeDocument=e,r}}t.DocumentFragmentImpl=o,(0,a.idl_defineConst)(o.prototype,"_nodeType",n.NodeType.DocumentFragment)},44120:(e,t,r)=>{"use strict";r(63306),r(4453),r(42018),r(93022)},44165:(e,t,r)=>{"use strict";let n=r(50026),i=Object.prototype.hasOwnProperty;e.exports=new n("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;for(let t in e)if(i.call(e,t)&&null!==e[t])return!1;return!0},construct:function(e){return null!==e?e:{}}})},44191:(e,t,r)=>{"use strict";r.d(t,{Ke:()=>g,Ay:()=>v});let n=[{id:"initialImages",retrieveType:"single"}];var i=r(77280);let a=[{offset:-1,imageQualityStatus:i.FU.ADJACENT_REPLICATE},{offset:1,imageQualityStatus:i.FU.ADJACENT_REPLICATE},{offset:2,imageQualityStatus:i.FU.FAR_REPLICATE}],o=[{id:"initialImages",positions:[.5,0,-1],retrieveType:"default",requestType:i.Yw.Thumbnail,priority:5,nearbyFrames:a},{id:"quarterThumb",decimate:4,offset:3,requestType:i.Yw.Thumbnail,retrieveType:"multipleFast",priority:6,nearbyFrames:a},{id:"halfThumb",decimate:4,offset:1,priority:7,requestType:i.Yw.Thumbnail,retrieveType:"multipleFast",nearbyFrames:a},{id:"quarterFull",decimate:4,offset:2,priority:8,requestType:i.Yw.Thumbnail,retrieveType:"multipleFinal"},{id:"halfFull",decimate:4,offset:0,priority:9,requestType:i.Yw.Thumbnail,retrieveType:"multipleFinal"},{id:"threeQuarterFull",decimate:4,offset:1,priority:10,requestType:i.Yw.Thumbnail,retrieveType:"multipleFinal"},{id:"finalFull",decimate:4,offset:3,priority:11,requestType:i.Yw.Thumbnail,retrieveType:"multipleFinal"},{id:"errorRetrieve"}];var s=r(97938),l=r(69228),u=r(77757),c=r(80486),d=r(92391),p=r(54268),m=r(3922);class h{constructor(e){this.stages=e.stages||n,this.retrieveOptions=e.retrieveOptions||{}}loadImages(e,t){return new f(this,e,t).loadImages()}}h.createProgressive=g,h.interleavedRetrieveStages={stages:o},h.singleRetrieveStages={stages:n},h.sequentialRetrieveStages={stages:[{id:"lossySequential",retrieveType:"singleFast"},{id:"finalSequential",retrieveType:"singleFinal"}]};class f{constructor(e,t,r){this.outstandingRequests=0,this.stageStatusMap=new Map,this.displayedIterator=new u.A("displayed"),this.stages=e.stages,this.retrieveOptions=e.retrieveOptions,this.imageIds=t,this.listener=r}async loadImages(){let e=this.createStageRequests();for(let t of(this.outstandingRequests=e.length,e))this.addRequest(t);return 0===this.outstandingRequests?Promise.resolve(null):this.displayedIterator.getDonePromise()}sendRequest(e,t){let{imageId:r,next:n}=e,a=(t,i)=>{this.listener.errorCallback(r,c||!n,t),i&&this.updateStageStatus(e.stage,t)},o=(t.loader||s.loadAndCacheImage)(r,t),l=u.A.as(o),c=!1;return l.forEach(async(t,n)=>{let a=p.Ay.getImageQuality(r);if(!t)return void console.warn("No image retrieved",r);let{imageQualityStatus:o}=t;if(c||=o===i.FU.FULL_RESOLUTION,void 0!==a&&a>o)return void this.updateStageStatus(e.stage,null,!0);this.listener.successCallback(r,t),this.displayedIterator.add(t),n&&this.updateStageStatus(e.stage),function(e,t,r){if(t?.nearbyRequests?.length)for(let n of t.nearbyRequests)try{let{itemId:t,imageQualityStatus:i}=n,a=p.Ay.getImageQuality(t);if(void 0!==a&&a>=i)continue;let o={...r,imageId:t,imageQualityStatus:i};p.Ay.setPartialImage(t,o),e.successCallback(t,o)}catch(e){console.warn("Couldn't fill nearby item ",n.itemId,e)}}(this.listener,e,t)},a).finally(()=>{if(!c&&n)p.Ay.setPartialImage(r,void 0,!0),this.addRequest(n,t.streamingData);else{c||this.listener.errorCallback(r,!0,"Couldn't decode"),this.outstandingRequests--;for(let e=n;e;e=e.next)this.updateStageStatus(e.stage,null,!0)}this.outstandingRequests<=0&&this.displayedIterator.resolve()}),l.getDonePromise().catch(e=>null)}addRequest(e,t={}){let{imageId:r,stage:n}=e,a=this.listener.getLoaderImageOptions(r);if(!a)return;let{retrieveType:o="default"}=n,{retrieveOptions:s}=this,l=s[o]||s.default,u={...a,retrieveType:o,retrieveOptions:l,streamingData:t},c=n.priority??-5,p=n.requestType||i.Yw.Interaction;d.A.addRequest(this.sendRequest.bind(this,e,u),p,{imageId:r},c)}updateStageStatus(e,t,r=!1){let{id:n}=e,a=this.stageStatusMap.get(n);if(a&&(a.imageLoadPendingCount--,t?a.imageLoadFailedCount++:!r&&a.totalImageCount++,r||a.stageStartTime||(a.stageStartTime=Date.now()),!a.imageLoadPendingCount)){let{imageLoadFailedCount:e,totalImageCount:t,stageStartTime:r=Date.now(),startTime:o}=a,s={stageId:n,numberOfFailures:e,numberOfImages:t,stageDurationInMS:r?Date.now()-r:null,startDurationInMS:Date.now()-o};(0,l.A)(m.A,i.sV.IMAGE_RETRIEVAL_STAGE,s),this.stageStatusMap.delete(n)}}createStageRequests(){let e=[],t=new Map,r=(r,n)=>{let i=n<0?this.imageIds.length+n:n<1?Math.floor((this.imageIds.length-1)*n):n,a=this.imageIds[i];if(!a)throw Error(`No value found to add to requests at ${n}`);let o={imageId:a,stage:r,index:i,nearbyRequests:this.findNearbyRequests(i,r)};this.addStageStatus(r);let s=t.get(a);s?s.next=o:e.push(o),t.set(a,o)};for(let e of this.stages)(e.positions||(0,c.A)(this.imageIds,e.decimate||1,e.offset??0)).forEach(t=>{r(e,t)});return e}findNearbyRequests(e,t){let r=[];if(!t.nearbyFrames)return r;for(let n of t.nearbyFrames){let t=e+n.offset;t<0||t>=this.imageIds.length||r.push({itemId:this.imageIds[t],imageQualityStatus:n.imageQualityStatus,index:t})}return r}addStageStatus(e){let{id:t}=e,r=this.stageStatusMap.get(t)||{stageId:t,startTime:Date.now(),stageStartTime:null,totalImageCount:0,imageLoadFailedCount:0,imageLoadPendingCount:0};return r.imageLoadPendingCount++,this.stageStatusMap.set(t,r),r}}function g(e){return new h(e)}let v=h},44238:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>E});var n,i=r(17042),a=r(11701),o=r(87352),s=r(53038),l=r(47596),u=r(57787),{Representation:c}=r(70125).Ay,{PrimitiveTypes:d}=l.Ay,p=class{constructor(){this.keys=new Uint32Array(10),this.values=new Uint32Array(10),this.count=0}clear(){this.count=0}has(e){for(let t=0;t2)for(let o=0;o2){for(let o=0;o{let r=e.cells,i=e.primitiveType,a=e.representation,o=e.cellOffset,s=r.getData(),l=s.length,u=function(e){switch(e){case d.Points:return"points";case d.Lines:return"lines";case d.Triangles:case d.TriangleEdges:return"polys";case d.TriangleStripEdges:case d.TriangleStrips:return"strips";default:return""}}(i),m=e.numberOfPoints,g={provokedPointIds:new Uint8Array(m),extraPoints:0,iboSize:0,flatId:0,iboId:0,cellProvokedMap:new p},v=null;v=a===c.POINTS||i===d.Points?b.anythingToPoints:a===c.WIREFRAME||i===d.Lines?b[`${u}ToWireframe`]:b[`${u}ToSurface`],n=f;let y=o||0;for(let e=0;et.device.hasCachedObject(e),e.getBuffer=e=>e.hash?t.device.getCachedObject(e.hash,n,e):n(e),e.getBufferForPointArray=(t,r)=>{let n=w(t),i={hash:`${t.getMTime()}I${r.getMTime()}${n}`,usage:A.PointArray,format:n,dataArray:t,indexBuffer:r};return e.getBuffer(i)},e.getBufferForCellArray=(t,r,n=0)=>{let i=w(t),a={hash:`cell${t.getMTime()}I${r.getMTime()}O${n}${i}`,usage:A.PointArray,format:i,dataArray:t,indexBuffer:r,cellData:!0,cellOffset:n};return e.getBuffer(a)},e.getFullScreenQuadBuffer=()=>{if(t.fullScreenQuadBuffer)return t.fullScreenQuadBuffer;t.fullScreenQuadBuffer=u.Ay.newInstance(),t.fullScreenQuadBuffer.setDevice(t.device);let e=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0]);return t.fullScreenQuadBuffer.createAndWrite(e,GPUBufferUsage.VERTEX),t.fullScreenQuadBuffer.setStrideInBytes(12),t.fullScreenQuadBuffer.setArrayInformation([{offset:0,format:"float32x3"}]),t.fullScreenQuadBuffer}}var E={newInstance:(0,i.UI)(_),extend:_,...{},...l.Ay}},44293:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>y});var n=r(17042),i=r(72188),a=r(59780),o=r(55973),s={extraPipelineSettings:null,handle:null,layouts:null,renderEncoder:null,shaderDescriptions:null,vertexState:null,topology:null,pipelineDescription:null},l={newInstance:(0,n.UI)(function(e,t,r={}){Object.assign(t,s,r),(0,n.WL)(e,t),t.layouts=[],t.shaderDescriptions=[],(0,n.Jt)(e,t,["handle","pipelineDescription"]),(0,n.V0)(e,t,["device","extraPipelineSettings","renderEncoder","topology","vertexState"]),t.classHierarchy.push("vtkWebGPUPipeline"),e.getShaderDescriptions=()=>t.shaderDescriptions,e.applyPipelineSettings=(e,t)=>t?{...e,...t,primitive:{...e.primitive,...t.primitive},depthStencil:{...e.depthStencil,...t.depthStencil},fragment:{...e.fragment,...t.fragment}}:e,e.initialize=(r,n)=>{t.pipelineDescription=e.applyPipelineSettings(t.renderEncoder.getPipelineSettings(),t.extraPipelineSettings),t.pipelineDescription.primitive.topology=t.topology,t.pipelineDescription.vertex=t.vertexState,t.pipelineDescription.label=n;let i=[];for(let e=0;e{for(let r=0;r{e&&t.layouts.push({layout:e.getBindGroupLayout(t.device),label:e.getLabel()})},e.getBindGroupLayout=e=>t.layouts[e].layout,e.getBindGroupLayoutIndex=e=>{for(let r=0;r{t.bindBuffers(e)}},"vtkWebGPUPipeline")},u={type:null,hash:null,code:null,outputNames:null,outputTypes:null},c={newInstance:n.Ay.newInstance(function(e,t,r={}){Object.assign(t,u,r),t.outputNames=[],t.outputTypes=[],t.outputInterpolations=[],t.builtinOutputNames=[],t.builtinOutputTypes=[],t.builtinInputNames=[],t.builtinInputTypes=[],n.Ay.obj(e,t),n.Ay.setGet(e,t,["type","hash","code"]),n.Ay.getArray(e,t,["outputTypes","outputNames","outputInterpolations"]),t.classHierarchy.push("vtkWebGPUShaderDescription"),e.hasOutput=e=>t.outputNames.includes(e),e.addOutput=(e,r,n)=>{t.outputTypes.push(e),t.outputNames.push(r),t.outputInterpolations.push(n)},e.addBuiltinOutput=(e,r)=>{t.builtinOutputTypes.push(e),t.builtinOutputNames.push(r)},e.addBuiltinInput=(e,r)=>{t.builtinInputTypes.push(e),t.builtinInputNames.push(r)},e.replaceShaderCode=(e,r)=>{let n=[],i=[];if(r&&n.push(r.getShaderCode()),e||t.builtinInputNames.length){let r=[];if(r.push(`struct ${t.type}Input +{`),e){let t=e.getOutputNamesByReference(),n=e.getOutputTypesByReference(),i=e.getOutputInterpolationsByReference();for(let e=0;e1&&(r.push("};"),i=r,n[n.length-1]+=",",n.push(`input: ${t.type}Input`))}if(n.length&&(t.code=a.Ay.substitute(t.code,"//VTK::IOStructs::Input",n).result),t.outputNames.length+t.builtinOutputNames.length||t.code.includes("//VTK::IOStructs::Output")){let e=[`struct ${t.type}Output +{`];for(let r=0;r ${t.type}Output`]).result}t.code=a.Ay.substitute(t.code,"//VTK::IOStructs::Dec",i).result}},"vtkWebGPUShaderDescription")},d=r(53038),p={inputs:null,bindingDescriptions:!1,attributeDescriptions:null,indexBuffer:null},m={newInstance:(0,n.UI)(function(e,t,r={}){Object.assign(t,p,r),(0,n.WL)(e,t),t.bindingDescriptions=[],t.attributeDescriptions=[],t.inputs=[],(0,n.V0)(e,t,["created","device","handle","indexBuffer"]),t.classHierarchy.push("vtkWebGPUVertexInput"),e.addBuffer=(e,r,n="vertex")=>{let i=r;Array.isArray(i)||(i=[i]);for(let r=0;re.names[0]t.names[0]))},e.removeBufferIfPresent=e=>{for(let r=0;r{for(let r=0;r{for(let r=0;r{for(let r=0;r{let e="",r=0;for(let n=0;n0&&(e+=",\n"),e=`${e} @location(${r}) ${t.inputs[n].names[i]} : ${o}`,r++}return e},e.getVertexInputInformation=()=>{let e={};if(t.inputs.length){let r=[],n=0;for(let e=0;e{for(let r=0;r{},e.releaseGraphicsResources=()=>{t.created&&(t.inputs=[],t.bindingDescriptions=[],t.attributeDescriptions=[])}},"vtkWebGPUVertexInput")},h=` +//VTK::Renderer::Dec + +//VTK::Color::Dec + +//VTK::Normal::Dec + +//VTK::TCoord::Dec + +//VTK::Select::Dec + +//VTK::Mapper::Dec + +//VTK::IOStructs::Dec + +@vertex +fn main( +//VTK::IOStructs::Input +) +//VTK::IOStructs::Output +{ + var output : vertexOutput; + + // var vertex: vec4 = vertexBC; + + //VTK::Color::Impl + + //VTK::Normal::Impl + + //VTK::TCoord::Impl + + //VTK::Select::Impl + + //VTK::Position::Impl + + return output; +} +`,f=` +//VTK::Renderer::Dec + +//VTK::Color::Dec + +//VTK::Normal::Dec + +//VTK::TCoord::Dec + +//VTK::Select::Dec + +//VTK::RenderEncoder::Dec + +//VTK::Mapper::Dec + +//VTK::IOStructs::Dec + +@fragment +fn main( +//VTK::IOStructs::Input +) +//VTK::IOStructs::Output +{ + var output : fragmentOutput; + + //VTK::Color::Impl + + //VTK::Normal::Impl + + //VTK::Light::Impl + + //VTK::TCoord::Impl + + //VTK::Select::Impl + + // var computedColor:vec4 = vec4(1.0,0.5,0.5,1.0); + + //VTK::RenderEncoder::Impl + return output; +} +`,g={additionalBindables:void 0,bindGroup:null,device:null,fragmentShaderTemplate:null,numberOfInstances:1,numberOfVertices:0,pipelineHash:null,shaderReplacements:null,SSBO:null,textureViews:null,topology:"triangle-list",UBO:null,vertexShaderTemplate:null,WebGPURenderer:null};function v(e,t,r={}){Object.assign(t,g,r),i.A.extend(e,t,r),t.textureViews=[],t.vertexInput=m.newInstance(),t.bindGroup=o.Ay.newInstance({label:"mapperBG"}),t.additionalBindables=[],t.fragmentShaderTemplate=t.fragmentShaderTemplate||f,t.vertexShaderTemplate=t.vertexShaderTemplate||h,t.shaderReplacements=new Map,n.Ay.get(e,t,["pipeline","vertexInput"]),n.Ay.setGet(e,t,["additionalBindables","device","fragmentShaderTemplate","interpolate","numberOfInstances","numberOfVertices","pipelineHash","shaderReplacements","SSBO","textureViews","topology","UBO","vertexShaderTemplate","WebGPURenderer"]),t.classHierarchy.push("vtkWebGPUSimpleMapper"),e.generateShaderDescriptions=(r,n,i)=>{let a=c.newInstance({type:"vertex",hash:r,code:t.vertexShaderTemplate}),o=c.newInstance({type:"fragment",hash:r,code:t.fragmentShaderTemplate}),s=n.getShaderDescriptions();s.push(a),s.push(o);let l=t.vertexShaderTemplate+t.fragmentShaderTemplate,u=RegExp("//VTK::[^:]*::","g"),d=l.match(u).filter((e,t,r)=>r.indexOf(e)===t).map(e=>`replaceShader${e.substring(7,e.length-2)}`);for(let e=0;e{let n=t.getShaderDescription("vertex");n.replaceShaderCode(null,r),t.getShaderDescription("fragment").replaceShaderCode(n)},e.replaceShaderRenderEncoder=(e,r,n)=>{t.renderEncoder.replaceShaderCode(r)},t.shaderReplacements.set("replaceShaderRenderEncoder",e.replaceShaderRenderEncoder),e.replaceShaderRenderer=(e,r,n)=>{if(!t.WebGPURenderer)return;let i=t.WebGPURenderer.getBindGroup().getShaderCode(r),o=r.getShaderDescription("vertex"),s=o.getCode();s=a.Ay.substitute(s,"//VTK::Renderer::Dec",[i]).result,o.setCode(s);let l=r.getShaderDescription("fragment");s=l.getCode(),s=a.Ay.substitute(s,"//VTK::Renderer::Dec",[i]).result,l.setCode(s)},t.shaderReplacements.set("replaceShaderRenderer",e.replaceShaderRenderer),e.replaceShaderMapper=(e,r,n)=>{let i=t.bindGroup.getShaderCode(r),o=r.getShaderDescription("vertex"),s=o.getCode();s=a.Ay.substitute(s,"//VTK::Mapper::Dec",[i]).result,o.setCode(s);let l=r.getShaderDescription("fragment");l.addBuiltinInput("bool","@builtin(front_facing) frontFacing"),s=l.getCode(),s=a.Ay.substitute(s,"//VTK::Mapper::Dec",[i]).result,l.setCode(s)},t.shaderReplacements.set("replaceShaderMapper",e.replaceShaderMapper),e.replaceShaderPosition=(e,t,r)=>{let n=t.getShaderDescription("vertex");n.addBuiltinOutput("vec4","@builtin(position) Position");let i=n.getCode();i=a.Ay.substitute(i,"//VTK::Position::Impl",[" output.Position = rendererUBO.SCPCMatrix*vertexBC;"]).result,n.setCode(i)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,t,r)=>{t.getShaderDescription("vertex").addOutput("vec2","tcoordVS")},t.shaderReplacements.set("replaceShaderTCoord",e.replaceShaderTCoord),e.addTextureView=e=>{t.textureViews.includes(e)||t.textureViews.push(e)},e.prepareToDraw=r=>{t.renderEncoder=r,e.updateInput(),e.updateBuffers(),e.updateBindings(),e.updatePipeline()},e.updateInput=()=>{},e.updateBuffers=()=>{},e.updateBindings=()=>{t.bindGroup.setBindables(e.getBindables())},e.computePipelineHash=()=>{},e.getPipelineSettings=()=>null,e.registerDrawCallback=r=>{r.registerDrawCallback(t.pipeline,e.draw)},e.prepareAndDraw=r=>{e.prepareToDraw(r),r.setPipeline(t.pipeline),e.draw(r)},e.draw=e=>{if(0===t.numberOfVertices||0===t.numberOfInstances)return;let r=e.getBoundPipeline();e.activateBindGroup(t.bindGroup),t.WebGPURenderer&&t.WebGPURenderer.bindUBO(e),r.bindVertexInput(e,t.vertexInput);let n=t.vertexInput.getIndexBuffer();n?e.drawIndexed(n.getIndexCount(),t.numberOfInstances,0,0,0):e.draw(t.numberOfVertices,t.numberOfInstances,0,0)},e.getBindables=()=>{let e=[...t.additionalBindables];t.UBO&&e.push(t.UBO),t.SSBO&&e.push(t.SSBO);for(let r=0;r{e.computePipelineHash(),t.pipeline=t.device.getPipeline(t.pipelineHash),t.pipeline||(t.pipeline=l.newInstance(),t.pipeline.setDevice(t.device),t.WebGPURenderer&&t.pipeline.addBindGroupLayout(t.WebGPURenderer.getBindGroup()),t.pipeline.addBindGroupLayout(t.bindGroup),e.generateShaderDescriptions(t.pipelineHash,t.pipeline,t.vertexInput),t.pipeline.setExtraPipelineSettings(e.getPipelineSettings()),t.pipeline.setTopology(t.topology),t.pipeline.setRenderEncoder(t.renderEncoder),t.pipeline.setVertexState(t.vertexInput.getVertexInputInformation()),t.device.createPipeline(t.pipelineHash,t.pipeline))},e.releaseGraphicsResources=()=>{t.vertexInput?.releaseGraphicsResources?.(),t.bindGroup?.releaseGraphicsResources?.(),t.UBO?.releaseGraphicsResources?.(),t.SSBO?.releaseGraphicsResources?.(),t.pipeline=null,t.renderEncoder=null,t.textureViews.length=0}}var y={newInstance:n.Ay.newInstance(v,"vtkWebGPUSimpleMapper"),extend:v}},44862:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DocumentTypeImpl=void 0;let n=r(5309),i=r(92787),a=r(48040);class o extends i.NodeImpl{_nodeType=n.NodeType.DocumentType;_name="";_publicId="";_systemId="";constructor(e,t,r){super(),this._name=e,this._publicId=t,this._systemId=r}get name(){return this._name}get publicId(){return this._publicId}get systemId(){return this._systemId}before(){throw Error("Mixin: ChildNode not implemented.")}after(){throw Error("Mixin: ChildNode not implemented.")}replaceWith(){throw Error("Mixin: ChildNode not implemented.")}remove(){throw Error("Mixin: ChildNode not implemented.")}static _create(e,t,r="",n=""){let i=new o(t,r,n);return i._nodeDocument=e,i}}t.DocumentTypeImpl=o,(0,a.idl_defineConst)(o.prototype,"_nodeType",n.NodeType.DocumentType)},44970:(e,t,r)=>{"use strict";r.d(t,{r:()=>o,Y:()=>s});var n=r(77280);let i={rotation:!0,zoom:!0};function a(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function o(e){let{viewport:t}=e,r=e.viewState??t.getViewState?.();if(!r)return;let n={...r,centerIndex:r.centerIndex?[r.centerIndex[0],r.centerIndex[1]]:void 0,resolution:"number"==typeof r.resolution?Math.max(r.resolution,1e-6):void 0,rotation:r.rotation??0,zoom:Math.max(r.zoom??1,.001)},i=e.resolvedView??t.getResolvedView?.(),a=e.canvasWidth??i?.state?.canvasWidth??t.element?.clientWidth??1,o=e.canvasHeight??i?.state?.canvasHeight??t.element?.clientHeight??1,s=[a/2,o/2],l=i?.canvasToWorld(s),u=i?.toICamera(),c=i?.state?.view,d=Math.max(c?.getZoom?.()??n.zoom??1,.001),p=c?.getRotation?.()??n.rotation??0,m=e.frameOfReferenceUID??i?.getFrameOfReferenceUID()??t.getFrameOfReferenceUID?.();return{kind:"wsi",adapterId:"wsi",canvasHeight:o,canvasWidth:a,dataId:e.dataId,frameOfReferenceUID:m,presentation:{position:{kind:"anchor",worldPoint:l,canvasPoint:[s[0],s[1]]},rotation:p,scale:function(e){let{canvasHeight:t,rendererCamera:r,zoom:n}=e;return"number"==typeof r?.parallelScale?{kind:"physical",mmPerCanvasPixel:r.parallelScale/Math.max(t,1)}:{kind:"fit",value:n}}({canvasHeight:o,rendererCamera:u,zoom:d}),zoom:d},rendererCamera:u,resolvedView:i,spaces:{canvas:!!i,image:!0,renderer:!!u,world:!!i},transforms:i?{canvasToWorld:e=>i.canvasToWorld(e),worldToCanvas:e=>i.worldToCanvas(e)}:void 0,viewState:n,viewportType:t.type}}let s={id:"wsi",viewportTypes:[n.NV.WHOLE_SLIDE_NEXT],getSnapshot:e=>o(e),getPresentation:(e,t)=>(function(e,t){let r={},n=t??i;return n.zoom&&(r.zoom=e.presentation.zoom),n.rotation&&(r.rotation=e.presentation.rotation),r})(e,t),withPresentation:(e,t,r)=>(function(e,t,r={}){let n=a(t,"zoom"),i=a(t,"rotation"),o=Math.max(t.zoom??e.presentation.zoom??e.viewState.zoom??1,.001),s={...e.viewState,centerIndex:e.viewState.centerIndex?[e.viewState.centerIndex[0],e.viewState.centerIndex[1]]:void 0};return n&&(e.resolvedView?s={...e.resolvedView.withZoom(o,r.anchorCanvas).state.viewState}:s.zoom=o),i&&(s.rotation=t.rotation??0),s})(e,t,r)}},45079:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(31677);function i(e){return(0,n.A)(e)>=0?1:-1}},45359:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XMLSerializer=void 0;var n=r(75584);Object.defineProperty(t,"XMLSerializer",{enumerable:!0,get:function(){return n.XMLSerializerImpl}})},45826:(e,t,r)=>{"use strict";r.d(t,{Jq:()=>h,Sw:()=>y,rd:()=>v,u8:()=>m});var n=r(70192),i=r(50923),a=r(73971),o=r(20552),s=r(48937),l=r(11663),u=r(11212);let{transformWorldToIndex:c,getNormalizedAspectRatio:d}=n.BF,p={[s.A.Initialize]:e=>{let{points:t,viewport:r,segmentationImageData:n}=e;if(!t)return;let a=i.vt();t.length>=2?(i.WQ(a,t[0],t[1]),i.hs(a,a,.5)):i.C(a,t[0]),e.centerWorld=a,e.centerIJK=c(n,a);let o=(0,u.l)(t.slice(0,2),n,r),s=t.map(e=>r.worldToCanvas(e)),p=(0,l.C$)(s).map(e=>r.canvasToWorld(e)),m=d(r.getAspectRatio()),h=t.length>=2?i.Io(t[0],t[1])/2/m[1]:0,f=t.length>=2?i.Io(t[2],t[3])/2/m[0]:0,g=e.strokePointsWorld&&e.strokePointsWorld.length>0?e.strokePointsWorld:[e.centerWorld],v=o.boundsIJK,y=e.centerIJK,b=g.reduce((e,t)=>{if(!t)return e;let r=c(n,t),i=[r[0]-y[0],r[1]-y[1],r[2]-y[2]],a=[[v[0][0]+i[0],v[0][1]+i[0]],[v[1][0]+i[1],v[1][1]+i[1]],[v[2][0]+i[2],v[2][1]+i[2]]];return e?[[Math.min(e[0][0],a[0][0]),Math.max(e[0][1],a[0][1])],[Math.min(e[1][0],a[1][0]),Math.max(e[1][1],a[1][1])],[Math.min(e[2][0],a[2][0]),Math.max(e[2][1],a[2][1])]]:a},null)??o.boundsIJK;if(n){let t=n.getDimensions();e.isInObjectBoundsIJK=[[Math.max(0,Math.min(b[0][0],t[0]-1)),Math.max(0,Math.min(b[0][1],t[0]-1))],[Math.max(0,Math.min(b[1][0],t[1]-1)),Math.max(0,Math.min(b[1][1],t[1]-1))],[Math.max(0,Math.min(b[2][0],t[2]-1)),Math.max(0,Math.min(b[2][1],t[2]-1))]]}else e.isInObjectBoundsIJK=b;e.isInObject=(0,l.mu)(p,{strokePointsWorld:e.strokePointsWorld,segmentationImageData:n,xRadius:f,yRadius:h,aspectRatio:m})}},m=new a.A("Sphere",o.A.regionFill,o.A.setValue,p,o.A.determineSegmentIndex,o.A.preview,o.A.labelmapStatistics,o.A.ensureSegmentationVolumeFor3DManipulation),h=m.strategyFunction,f=new a.A("SphereThreshold",...m.compositions,o.A.dynamicThreshold,o.A.threshold,o.A.ensureSegmentationVolumeFor3DManipulation,o.A.ensureImageVolumeFor3DManipulation),g=new a.A("SphereThreshold",...m.compositions,o.A.dynamicThreshold,o.A.threshold,o.A.islandRemoval,o.A.ensureSegmentationVolumeFor3DManipulation,o.A.ensureImageVolumeFor3DManipulation),v=f.strategyFunction,y=g.strategyFunction},46023:(e,t,r)=>{"use strict";function n(e){return new TextDecoder("latin1").decode(e)}r.d(t,{A:()=>i});var i={arrayBufferToString:n,extractBinary:function(e,t,r=null){let i=n(e),a=t.exec(i);if(!a)return{text:i};let o=a.index+a[0].length,s=i.substring(0,o),l=r?r.exec(i):null;return l?{text:s+i.substr(l.index),binaryBuffer:e.slice(o,l.index)}:{text:s,binaryBuffer:e.slice(o)}}}},46283:(e,t,r)=>{"use strict";r.d(t,{q:()=>a});var n=r(24433),i=r(6297);class a{async load(e){let t=this.getDataSet(e);if(!t)throw Error(`[WSIViewport] No registered WSI dataset metadata for ${e}`);!1!==t.options.miniNavigationOverlay&&(0,n.addWSIMiniNavigationOverlayCss)();let r=await (0,n.loadWSIData)({imageIds:t.imageIds,client:t.options.webClient});return{id:e,type:"wsi",imageIds:t.imageIds,client:t.options.webClient,volumeImages:r.volumeImages,metadataDicomweb:r.metadataDicomweb,metadata:r.metadata,frameOfReferenceUID:r.frameOfReferenceUID,imageURISet:r.imageURISet}}getDataSet(e){let t=(0,i.Pv)(e);if(t)return t}}},46702:(e,t,r)=>{"use strict";r.d(t,{Q:()=>i});var n=r(43385);function i(e){let t=(0,n.T)(e);if(t){let e=Object.keys(t.segments).find(e=>t.segments[e].active);return e?Number(e):void 0}}},46732:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(68266),i=r(41104);function a(e,t=!1){let r=e.canvas.width,o=e.canvas.height,{canvas:s}=e,{clientWidth:l,clientHeight:u}=s;if((s.width!==l||s.height!==u)&&(s.width=l,s.height=u),void 0!==e.image)if(t||function(e,t,r){let n=e.viewport.scale,a=(0,i.A)(e.image,e.viewport.rotation),o=Math.round(a.width*n),s=Math.round(a.height*n),l=e.viewport.translation.x,u=e.viewport.translation.y;return o===t&&s<=r||o<=t&&s===r&&0===l&&0===u}(e,r,o)){let{image:t}=e;e.viewport.scale=(0,n.A)(e.canvas,t,e.viewport.rotation).scaleFactor,e.viewport.translation.x=0,e.viewport.translation.y=0}else{let t=e.viewport.scale,n=e.canvas.width,i=Math.sqrt(n/r*(e.canvas.height/o));e.viewport.scale=i*t}}},46883:(e,t,r)=>{"use strict";r.d(t,{A:()=>v});var n=r(73904),i=r(33845),a=r(79159),o=r(83101);let{pointsAreWithinCloseContourProximity:s}=i.XL;function l(e,t){let r={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id,annotationUID:t.annotationUID},{lineWidth:n,lineDash:i,color:a,fillColor:o,fillOpacity:s}=this.getAnnotationStyle({annotation:t,styleSpecifier:r}),{closed:l}=t.data.contour;return{color:a,width:n,lineDash:i,fillColor:o,fillOpacity:this.configuration?.fillOpacity!==void 0?this.configuration.fillOpacity:s,closePath:l}}function u(e,t,r){var n,i;e?.viewport?.getImageData()&&(r.data.contour.closed?this.renderClosedContour(e,t,r):r.data.isOpenUShapeContour?("lineSegment"!==r.data.isOpenUShapeContour&&(n=e,(i=r).data.openUShapeContourVectorToPeak||(i.data.openUShapeContourVectorToPeak=(0,a.J1)(n,i))),this.renderOpenUShapedContour(e,t,r)):this.renderOpenContour(e,t,r))}function c(e,t,r){if(r.parentAnnotationUID)return;let{viewport:i}=e,a=this._getRenderingOptions(e,r),s=[r.data.contour.polyline.map(e=>i.worldToCanvas(e)),...(0,o.A)(r,i)];(0,n.kd)(t,r.annotationUID,"1",s,a)}function d(e,t,r){let{viewport:i}=e,a=this._getRenderingOptions(e,r),o=r.data.contour.polyline.map(e=>i.worldToCanvas(e));(0,n.VV)(t,r.annotationUID,"1",o,a);let s=r.data.handles.activeHandleIndex;if(this.configuration.alwaysRenderOpenContourHandles?.enabled===!0){let e=this.configuration.alwaysRenderOpenContourHandles.radius,i=[o[0],o[o.length-1]];0===s?i.shift():1===s&&i.pop(),(0,n.qX)(t,r.annotationUID,"0",i,{color:a.color,handleRadius:e})}if(null!==s){let e=0===s?0:o.length-1,i=o[e];(0,n.qX)(t,r.annotationUID,"1",[i],{color:a.color})}}function p(e,t,r){let{viewport:i}=e,{openUShapeContourVectorToPeak:a}=r.data,{polyline:o}=r.data.contour;this.renderOpenContour(e,t,r);let s="lineSegment"===r.data.isOpenUShapeContour;if(!s&&!a)return;let l=i.worldToCanvas(o[0]),u=i.worldToCanvas(o[o.length-1]),c=this._getRenderingOptions(e,r);if((0,n.VV)(t,r.annotationUID,"first-to-last",[l,u],{color:c.color,width:c.width,closePath:!1,lineDash:"2,2"}),!s){let e=[i.worldToCanvas(a[0]),i.worldToCanvas(a[1])];(0,n.VV)(t,r.annotationUID,"midpoint-to-open-contour",[e[0],e[1]],{color:c.color,width:c.width,closePath:!1,lineDash:"2,2"})}if(c.fillOpacity>0){let e=o.map(e=>i.worldToCanvas(e));(0,n.kd)(t,r.annotationUID,"u-shape-fill",[[...e,l]],{color:c.fillColor||c.color,fillColor:c.fillColor||c.color,fillOpacity:c.fillOpacity,closePath:!0,width:0})}}function m(e,t,r){let i=this._getRenderingOptions(e,r),{allowOpenContours:a}=this.configuration,{canvasPoints:o}=this.drawData;if(i.closePath=!1,(0,n.VV)(t,r.annotationUID,"1",o,i),a){let e=o[0],a=o[o.length-1];s(e,a,this.configuration.closeContourProximity)?(0,n.VV)(t,r.annotationUID,"2",[a,e],i):(0,n.qX)(t,r.annotationUID,"0",[e],{color:i.color,handleRadius:2})}}function h(e,t,r){let{viewport:i}=e,{fusedCanvasPoints:a}=this.editData;if(void 0===a)return void this.renderClosedContour(e,t,r);let s=[a,...(0,o.A)(r,i)],l=this._getRenderingOptions(e,r);r.parentAnnotationUID&&l.fillOpacity&&(l.fillOpacity=0),(0,n.kd)(t,r.annotationUID,"preview-1",s,l)}function f(e,t,r){let{fusedCanvasPoints:i}=this.editData;if(void 0===i)return void this.renderOpenContour(e,t,r);let a=this._getRenderingOptions(e,r);(0,n.VV)(t,r.annotationUID,"preview-1",i,a)}function g(e,t,r){if(r.parentAnnotationUID)return;let{viewport:i}=e,a=this._getRenderingOptions(e,r),s=r.data.contour.polyline.map(e=>i.worldToCanvas(e)),l=(0,o.A)(r,i),u=s[0],c=[];for(let e=0;e<100;e++){let t=e/100*2*Math.PI,r=u[0]+6*Math.cos(t),n=u[1]+6*Math.sin(t);c.push([r,n])}let d=[[u[0]-12,u[1]],[u[0]+12,u[1]],[u[0],u[1]-12],[u[0],u[1]+12]];(0,n.kd)(t,r.annotationUID,"1-crosshair_v",[d[0],d[1]],a),(0,n.kd)(t,r.annotationUID,"1-crosshair_h",[d[2],d[3]],a);let p=[c,...l];(0,n.kd)(t,r.annotationUID,"1",p,a)}let v=function(e){e.renderContour=u.bind(e),e.renderClosedContour=c.bind(e),e.renderOpenContour=d.bind(e),e.renderPointContourWithMarker=g.bind(e),e.renderOpenUShapedContour=p.bind(e),e.renderContourBeingDrawn=m.bind(e),e.renderClosedContourBeingEdited=h.bind(e),e.renderOpenContourBeingEdited=f.bind(e),e._getRenderingOptions=l.bind(e)}},46947:(e,t,r)=>{"use strict";r.d(t,{Fp:()=>I,IQ:()=>f,c4:()=>y,ev:()=>g,kl:()=>b,rp:()=>v});var n=r(87352),i=r(54261),a=r(56109),o=r(77280),s=r(62455),l=r(97748),u=r(23703),c=r(55291),d=r(35972),p=r(48320),m=r(60251),h=r(42422);function f(e){let{dimensions:t,direction:r,numberOfComponents:a,origin:o,pixelArray:s,spacing:l}=e,u=!ArrayBuffer.isView(s)||s instanceof DataView?Array.from(s):s,c=!ArrayBuffer.isView(u)||u instanceof DataView?void 0:n.Ay.getDataType(u),d=n.Ay.newInstance({...c?{dataType:c}:{},name:"Pixels",numberOfComponents:a,values:u}),p=i.Ay.newInstance();return p.setDimensions(t),p.setSpacing(l),p.setDirection(new Float32Array(Array.from(r))),p.setOrigin(o),p.getPointData().setScalars(d),p}function g(e){let{dimensions:t,direction:r,numberOfComponents:n,origin:i,spacing:a}=(0,d.T)(e),o=e.voxelManager.getScalarData().slice(),s=f({dimensions:t,direction:Array.from(r),numberOfComponents:n,origin:i,pixelArray:o,spacing:a});return(0,h.J)(s,e),s}function v(e,t){let{direction:r,origin:n,spacing:i}=(0,d.T)(t);e.setOrigin(n),e.setDirection(new Float32Array(Array.from(r))),e.setSpacing(i)}function y(e){return(0,c.A)(e)?{lower:0,upper:5}:(0,u.A)(e.windowWidth,e.windowCenter,e.voiLUTFunction)}function b(e){let{actor:t,defaultVOIRange:r,defaultVOILUTFunction:n,props:i}=e,a=t.getProperty(),o=i?.voiRange??r;if(i?.visible!==void 0&&t.setVisibility(i.visible),i?.opacity!==void 0&&a.setOpacity(i.opacity),i?.interpolationType!==void 0&&a.setInterpolationType(i.interpolationType),!o)return;let s=I({colormap:i?.colormap,invert:i?.invert,voiRange:o,voiLUTFunction:i?.voiLUTFunction??n});a.setUseLookupTableScalarRange(!0),a.setRGBTransferFunction(0,s)}function I(e){let{colormap:t,invert:r,voiRange:n,voiLUTFunction:i}=e,u=t?.name!==void 0?function(e,t){let r=e.name,n=r?(0,m.resolveColormap)(r):void 0;if(!n)throw Error(`Colormap ${r} not found`);let i=a.Ay.newInstance();return i.applyColorMap(n),i.setMappingRange(t.lower,t.upper),i}(t,n):i===o.yX.SAMPLED_SIGMOID?(0,l.A)(n):(0,s.A)(n);return r&&(0,p.A)(u),u}},47165:(e,t,r)=>{"use strict";var n=r(15376).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.forgivingBase64Encode=function(e){return n.from(e).toString("base64")},t.forgivingBase64Decode=function(e){return""===e?"":((e=e.replace(i.ASCIIWhiteSpace,"")).length%4==0&&(e.endsWith("==")?e=e.substr(0,e.length-2):e.endsWith("=")&&(e=e.substr(0,e.length-1))),e.length%4!=1&&/[0-9A-Za-z+/]/.test(e))?n.from(e,"base64").toString("utf8"):null};let i=r(72632)},47224:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=new Float32Array(1),i=new Int32Array(n.buffer),a={fromHalf:function(e){let t=(32768&e)>>15,r=(31744&e)>>10,n=1023&e;return 0===r?(t?-1:1)*6103515625e-14*(n/1024):31===r?n?NaN:1/0*(t?-1:1):(t?-1:1)*2**(r-15)*(1+n/1024)},toHalf:function(e){n[0]=e;let t=i[0],r=t>>16&32768,a=t>>12&2047,o=t>>23&255;return o<103?r:o>142?(r|=31744,r|=+(255!==o)&&8388607&t):o<113?(a|=2048,r|=(a>>114-o)+(a>>113-o&1)):(r|=o-112<<10|a>>1,r+=1&a)}}},47241:(e,t,r)=>{"use strict";r.d(t,{A:()=>c});var n=r(50923),i=r(39216),a=r(77280),o=r(82332),s=r(74798),l=r(79267);let u=o.coreLog.getLogger("utilities","getClosestImageId");function c(e,t,r,o){let c,d,{direction:p,spacing:m,imageIds:h}=e,{ignoreSpacing:f=!1}=o||{};if(!h?.length)return;let g=p.slice(6,9);if(Math.abs(n.Om(g,r))<1-l.p8)return;f||(c=(0,s.A)({direction:p,spacing:m},r)/2);let v=1/0;for(let e=0;e{"use strict";r.d(t,{A:()=>s});var n=r(99572),i=r(76722);function a(e,t){let r=[0,0],n=Number.MAX_SAFE_INTEGER;return e.forEach(function(e){let i=function(e,t){let[r,n]=e,[i,a]=t;return Math.sqrt(Math.pow(r-i,2)+Math.pow(n-a,2))}(t,e);i0?a(n,o):o,c=a(function(e){let{x:t,y:r,height:n,width:i}=e,a=i/2,o=n/2;return[[t+a,r],[t,r+o],[t+a,r+n],[t+i,r+o]]}(s),u),d=Object.assign({color:"rgb(255, 255, 0)",lineWidth:"1",lineDash:"2,3"},l);(0,i.A)(e,t,`link-${r}`,u,c,d)},s=function(e,t,r,i,a,s,l,u={}){let c=Object.assign({handleRadius:"6",centering:{x:!1,y:!0}},u),d=(0,n.A)(e,t,r,i,a,c);return o(e,t,r,s,a,d,c),d}},47518:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(78321),t),i(r(94554),t),i(r(65299),t),i(r(39246),t),i(r(73951),t),i(r(17344),t),i(r(72444),t),i(r(11455),t),i(r(93696),t),i(r(83011),t),i(r(94579),t),i(r(88924),t),i(r(78742),t),i(r(38020),t),i(r(43174),t),i(r(26447),t),i(r(80085),t),i(r(67638),t),i(r(48023),t),i(r(61416),t),i(r(81257),t),i(r(10871),t),i(r(84494),t),i(r(17329),t),i(r(29963),t),i(r(86409),t),i(r(48040),t),i(r(54572),t)},47535:(e,t,r)=>{"use strict";var n=r(17042),i=r(99298),a={ENDIANNESS:function(){let e=new ArrayBuffer(4),t=new Uint8Array(e),r=new Uint32Array(e);return(t[0]=161,t[1]=178,t[2]=195,t[3]=212,0xd4c3b2a1===r[0])?"LittleEndian":0xa1b2c3d4===r[0]?"BigEndian":null}(),swapBytes:function(e,t){if(t<2)return;let r=new Int8Array(e),n=r.length,i=[];for(let e=0;e(s("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead."),Promise.reject(Error("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead."))),c=0;function d(e,t,r={}){let n=new XMLHttpRequest;return n.open(e,t,!0),r.headers&&Object.entries(r.headers).forEach(([e,t])=>n.setRequestHeader(e,t)),r.progressCallback&&n.addEventListener("progress",r.progressCallback),n}var p={fetchArray:function(e,t,r,o={}){return o&&o.compression?u():r.ref&&!r.ref.pending?new Promise((u,p)=>{let m=d("GET",[t,r.ref.basepath,r.ref.id].join("/"),o);m.onreadystatechange=t=>{1===m.readyState&&(r.ref.pending=!0,1==++c&&e?.invokeBusy&&e.invokeBusy(!0)),4===m.readyState&&(r.ref.pending=!1,200===m.status||0===m.status?(r.buffer=m.response,"JSON"===r.ref.encode?r.values=JSON.parse(r.buffer):(a.ENDIANNESS!==r.ref.encode&&a.ENDIANNESS&&(l(`Swap bytes of ${r.name}`),a.swapBytes(r.buffer,i.uP[r.dataType])),r.values=n.Ay.newTypedArray(r.dataType,r.buffer)),r.values.length!==r.size&&s(`Error in FetchArray: ${r.name}, does not have the proper array size. Got ${r.values.length}, instead of ${r.size}`),delete r.ref,0==--c&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),u(r)):p({xhr:m,e:t}))},m.responseType="string"!==r.dataType?"arraybuffer":"text",m.send()}):Promise.resolve(r)},fetchJSON:function(e,t,r={}){return r&&r.compression?u():new Promise((n,i)=>{let a=d("GET",t,r);a.onreadystatechange=t=>{1===a.readyState&&1==++c&&e?.invokeBusy&&e.invokeBusy(!0),4===a.readyState&&(0==--c&&e?.invokeBusy&&e.invokeBusy(!1),200===a.status||0===a.status?n(JSON.parse(a.responseText)):i({xhr:a,e:t}))},a.responseType="text",a.send()})},fetchText:function(e,t,r={}){return r&&r.compression?u():new Promise((n,i)=>{let a=d("GET",t,r);a.onreadystatechange=t=>{1===a.readyState&&1==++c&&e?.invokeBusy&&e.invokeBusy(!0),4===a.readyState&&(0==--c&&e?.invokeBusy&&e.invokeBusy(!1),200===a.status||0===a.status?n(a.responseText):i({xhr:a,e:t}))},a.responseType="text",a.send()})},fetchBinary:function(e,t={}){return new Promise((r,n)=>{let i=d("GET",e,t);i.onreadystatechange=e=>{4===i.readyState&&(200===i.status||0===i.status?r(i.response):n({xhr:i,e}))},i.responseType="arraybuffer",i.send()})},fetchImage:function(e,t,r={}){return new Promise((e,n)=>{let i=new Image;r.crossOrigin&&(i.crossOrigin=r.crossOrigin),i.onload=()=>e(i),i.onerror=n,i.src=t})}};(0,o.zy)("http")||(0,o.uE)("http",e=>p)},47596:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>a,JV:()=>i,Sd:()=>n});var n={Verts:0,Lines:1,Triangles:2,Strips:3,LinesFromStrips:4,LinesFromTriangles:5,Points:6,UniformArray:7,PointArray:8,NormalsFromPoints:9,Texture:10,RawVertex:11,Storage:12,Index:13},i={Start:0,Points:0,Lines:1,Triangles:2,TriangleStrips:3,TriangleEdges:4,TriangleStripEdges:5,End:6},a={BufferUsage:n,PrimitiveTypes:i}},47776:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(5663),i=r(85156);let a=function(e){let t=e.getCamera(),{spacingInNormalDirection:r,imageVolume:a}=(0,i.A)(e,t);if(!a)return;let{viewPlaneNormal:o,focalPoint:s}=t,l=e.getActors().find(e=>e.referencedId===a.volumeId||e.uid===a.volumeId);l||console.warn("No actor found for with actorUID of",a.volumeId);let u=l.actor,{min:c,max:d,current:p}=(0,n.A)(u,o,s),m=Math.round((d-c)/r)+1,h=(p-c)/(d-c)*m;return(h=Math.floor(h))>m-1?h=m-1:h<0&&(h=0),{numberOfSlices:m,imageIndex:h}}},47817:(e,t,r)=>{"use strict";t.vt=void 0;var n=r(68497);Object.defineProperty(t,"vt",{enumerable:!0,get:function(){return n.create}})},47858:(e,t,r)=>{"use strict";var n=r(17042),i=r(11701),a=r(72188),o=r(55973),s=r(40577),l=r(55540),u=r(74978),c=r(72867),d=r(85250),p=` +//VTK::Renderer::Dec + +//VTK::Mapper::Dec + +//VTK::TCoord::Dec + +//VTK::RenderEncoder::Dec + +//VTK::IOStructs::Dec + +@fragment +fn main( +//VTK::IOStructs::Input +) +//VTK::IOStructs::Output +{ + var output: fragmentOutput; + + var computedColor: vec4 = mapperUBO.BackgroundColor; + + //VTK::RenderEncoder::Impl + return output; +} +`,m=` +//VTK::Renderer::Dec + +//VTK::Mapper::Dec + +//VTK::TCoord::Dec + +//VTK::RenderEncoder::Dec + +//VTK::IOStructs::Dec + +@fragment +fn main( +//VTK::IOStructs::Input +) +//VTK::IOStructs::Output +{ + var output: fragmentOutput; + + let t = clamp(input.tcoordVS.y, 0.0, 1.0); + var computedColor: vec4 = mix(mapperUBO.BackgroundColor2, mapperUBO.BackgroundColor, t); + + //VTK::RenderEncoder::Impl + return output; +} +`,h=` +//VTK::Renderer::Dec + +//VTK::Mapper::Dec + +//VTK::TCoord::Dec + +//VTK::RenderEncoder::Dec + +//VTK::IOStructs::Dec + +@fragment +fn main( +//VTK::IOStructs::Input +) +//VTK::IOStructs::Output +{ + var output: fragmentOutput; + + var computedColor: vec4 = textureSampleLevel(BackgroundTexture, BackgroundTextureSampler, input.tcoordVS, 0.0); + + //VTK::RenderEncoder::Impl + return output; +} +`,f=` +fn vecToRectCoord(dir: vec3) -> vec2 { + var tau: f32 = 6.28318530718; + var pi: f32 = 3.14159265359; + var out: vec2 = vec2(0.0); + + out.x = atan2(dir.z, dir.x) / tau; + out.x += 0.5; + + var phix: f32 = length(vec2(dir.x, dir.z)); + out.y = atan2(dir.y, phix) / pi + 0.5; + + return out; +} + +//VTK::Renderer::Dec + +//VTK::Mapper::Dec + +//VTK::TCoord::Dec + +//VTK::RenderEncoder::Dec + +//VTK::IOStructs::Dec + +@fragment +fn main( +//VTK::IOStructs::Input +) +//VTK::IOStructs::Output +{ + var output: fragmentOutput; + + var tcoord: vec4 = vec4(input.vertexVC.xy, -1, 1); + var V: vec4 = normalize(mapperUBO.FSQMatrix * tcoord); + var background = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, vecToRectCoord(V.xyz), 0.0); + var computedColor: vec4 = vec4(background.rgb, 1.0); + + //VTK::RenderEncoder::Impl + return output; +} +`,g=new Float64Array(16),v=new Float64Array(16),y={quad:null,UBO:null,webgpuCamera:null},b={newInstance:n.Ay.newInstance(function(e,t,r={}){Object.assign(t,y,r),n.Ay.obj(e,t),t.classHierarchy.push("vtkWebGPUBackground"),e.getMode=e=>{if(e.getTexturedBackground?.()&&e.getBackgroundTexture?.().getImageLoaded?.())return{mode:"texture",texture:e.getBackgroundTexture(),textureName:"BackgroundTexture",pipelineHash:"backgroundTexture"};if(e.getUseEnvironmentTextureAsBackground?.()&&e.getEnvironmentTexture?.().getImageLoaded?.())return{mode:"environment",texture:e.getEnvironmentTexture(),textureName:"EnvironmentTexture",pipelineHash:"backgroundEnvironment"};let t=e.getGradientBackground?.(),r=e.getBackgroundByReference?.()??[0,0,0],n=e.getBackground2ByReference?.()??[0,0,0];return t&&!(0,i.ML)(r,n)?{mode:"gradient",texture:null,textureName:null,pipelineHash:"backgroundGradient"}:{mode:"solid",texture:null,textureName:null,pipelineHash:"backgroundSolid"}},e.ensureQuad=e=>{t.quad||(t.quad=c.Ay.newInstance(),t.quad.setDevice(e),t.UBO=s.Ay.newInstance({label:"mapperUBO"}),t.UBO.addEntry("FSQMatrix","mat4x4"),t.UBO.addEntry("BackgroundColor","vec4"),t.UBO.addEntry("BackgroundColor2","vec4"),t.quad.setUBO(t.UBO))},e.getFragmentTemplate=e=>{switch(e){case"gradient":return m;case"texture":return h;case"environment":return f;default:return p}},e.updateTexture=(e,r,n)=>{if(!r||!n)return void t.quad.setTextureViews([]);let i=e.getTextureManager().getTextureForVTKTexture(r,n);if(!i.getReady())return void t.quad.setTextureViews([]);let a=i.createView(n),o=r.getInterpolate?.()?"linear":"nearest",s={minFilter:o,magFilter:o};"EnvironmentTexture"===n&&(s={addressModeU:"repeat",addressModeV:"clamp-to-edge",addressModeW:"repeat",minFilter:o,magFilter:o,mipmapFilter:"linear"}),a.addSampler(e,s),t.quad.setTextureViews([a])},e.updateUBO=(e,r,n)=>{let i=n.getBackgroundByReference?.()??[0,0,0],a=n.getBackground2ByReference?.()??[0,0,0];t.UBO.setArray("BackgroundColor",[i[0],i[1],i[2],1]),t.UBO.setArray("BackgroundColor2",[a[0],a[1],a[2],1]);let o=t.webgpuCamera.getKeyMatrices(r);d.transpose(v,o.normalMatrix),d.mul(g,o.scvc,o.pcsc),d.mul(g,v,g),t.UBO.setArray("FSQMatrix",g),t.UBO.sendIfNeeded(e)},e.render=(r,n)=>{let i=n.getRenderable(),a=n.getParent().getDevice();e.ensureQuad(a),t.webgpuCamera=n.getViewNodeFor(i.getActiveCamera(),t.webgpuCamera);let{mode:o,texture:s,textureName:l,pipelineHash:u}=e.getMode(i);t.quad.setPipelineHash(u),t.quad.setFragmentShaderTemplate(e.getFragmentTemplate(o)),e.updateTexture(a,s,l),e.updateUBO(a,n,i),t.quad.prepareAndDraw(r)}},"vtkWebGPUBackground")},I=r(50923),{vtkDebugMacro:x}=n.o$,C={bindGroup:null,selector:null,renderEncoder:null,recenterThreshold:20,suppressClear:!1,stabilizedCenter:[0,0,0]},A=(0,n.UI)(function(e,t,r={}){Object.assign(t,C,r),a.A.extend(e,t,r),t.UBO=s.Ay.newInstance({label:"rendererUBO"}),t.UBO.addEntry("WCVCMatrix","mat4x4"),t.UBO.addEntry("SCPCMatrix","mat4x4"),t.UBO.addEntry("PCSCMatrix","mat4x4"),t.UBO.addEntry("SCVCMatrix","mat4x4"),t.UBO.addEntry("VCPCMatrix","mat4x4"),t.UBO.addEntry("WCVCNormals","mat4x4"),t.UBO.addEntry("viewportSize","vec2"),t.UBO.addEntry("LightCount","i32"),t.UBO.addEntry("MaxEnvironmentMipLevel","f32"),t.UBO.addEntry("BackgroundDiffuseStrength","f32"),t.UBO.addEntry("BackgroundSpecularStrength","f32"),t.UBO.addEntry("cameraParallel","u32"),t.SSBO=l.Ay.newInstance({label:"rendererLightSSBO"}),t.lightTimeString="",t.bindGroup=o.Ay.newInstance({label:"rendererBG"}),t.bindGroup.setBindables([t.UBO,t.SSBO]),t.background=b.newInstance(),t.tmpMat4=d.identity(new Float64Array(16)),t.stabilizedTime={},(0,n.WL)(t.stabilizedTime,{mtime:0}),(0,n.Jt)(e,t,["bindGroup","stabilizedTime"]),(0,n._e)(e,t,["stabilizedCenter"]),(0,n.V0)(e,t,["renderEncoder","selector","suppressClear","UBO"]),t.classHierarchy.push("vtkWebGPURenderer"),e.buildPass=r=>{r&&t.renderable&&(t.camera=t.renderable.getActiveCamera(),e.updateLights(),e.prepareNodes(),e.addMissingNode(t.camera),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes(),t.webgpuCamera=e.getViewNodeFor(t.camera,t.webgpuCamera),e.updateStabilizedMatrix())},e.updateStabilizedMatrix=()=>{let e=t.camera.getClippingRange(),r=t.camera.getPositionByReference(),n=t.camera.getDirectionOfProjectionByReference(),i=[],a=[];I.hs(a,n,.5*(e[0]+e[1])),I.WQ(i,r,a),I.jb(a,i,t.stabilizedCenter),I.Il(a)/(e[1]-e[0])>t.recenterThreshold&&(t.stabilizedCenter=i,t.stabilizedTime.modified())},e.updateLights=()=>{let e=0,r=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(x("No lights are on, creating one."),t.renderable.createLight()),e},e.updateUBO=()=>{let r=t.UBO.getSendTime();if(t._parent.getMTime()>r||e.getMTime()>r||t.camera.getMTime()>r||t.renderable.getMTime()>r){let r=t.webgpuCamera.getKeyMatrices(e);t.UBO.setArray("WCVCMatrix",r.wcvc),t.UBO.setArray("SCPCMatrix",r.scpc),t.UBO.setArray("PCSCMatrix",r.pcsc),t.UBO.setArray("SCVCMatrix",r.scvc),t.UBO.setArray("VCPCMatrix",r.vcpc),t.UBO.setArray("WCVCNormals",r.normalMatrix),t.UBO.setValue("LightCount",t.renderable.getLights().length),t.UBO.setValue("MaxEnvironmentMipLevel",t.renderable.getEnvironmentTexture()?.getMipLevel()),t.UBO.setValue("BackgroundDiffuseStrength",t.renderable.getEnvironmentTextureDiffuseStrength()),t.UBO.setValue("BackgroundSpecularStrength",t.renderable.getEnvironmentTextureSpecularStrength());let n=e.getYInvertedTiledSizeAndOrigin();t.UBO.setArray("viewportSize",[n.usize,n.vsize]),t.UBO.setValue("cameraParallel",t.camera.getParallelProjection());let i=t._parent.getDevice();t.UBO.sendIfNeeded(i)}},e.updateSSBO=()=>{let r=t.renderable.getLights(),n=t.webgpuCamera.getKeyMatrices(e),a=`${t.renderable.getMTime()}`;for(let e=0;e=90?0:2:1,l[u+1]=Math.cos((0,i.el)(r[t].getConeAngle())),l[u+2]=Math.cos((0,i.el)(r[t].getConeAngle()+r[t].getConeFalloff())),l[u+3]=0}t.SSBO.clearData(),t.SSBO.setNumberOfInstances(r.length),t.SSBO.addEntry("LightPos","vec4"),t.SSBO.addEntry("LightDir","vec4"),t.SSBO.addEntry("LightColor","vec4"),t.SSBO.addEntry("LightData","vec4"),t.SSBO.setAllInstancesFromArray("LightPos",e),t.SSBO.setAllInstancesFromArray("LightDir",a),t.SSBO.setAllInstancesFromArray("LightColor",s),t.SSBO.setAllInstancesFromArray("LightData",l);let u=t._parent.getDevice();t.SSBO.send(u)}t.lightTimeString=a},e.scissorAndViewport=t=>{let r=e.getYInvertedTiledSizeAndOrigin();t.getHandle().setViewport(r.lowerLeftU,r.lowerLeftV,r.usize,r.vsize,0,1),t.getHandle().setScissorRect(r.lowerLeftU,r.lowerLeftV,r.usize,r.vsize)},e.bindUBO=e=>{e.activateBindGroup(t.bindGroup)},e.opaquePass=r=>{r?(t.renderEncoder.begin(t._parent.getCommandEncoder()),e.updateUBO(),e.updateSSBO()):(e.scissorAndViewport(t.renderEncoder),e.clear(),t.renderEncoder.end())},e.zBufferPass=r=>{r?(t.renderEncoder.begin(t._parent.getCommandEncoder()),e.updateUBO(),e.updateSSBO()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.clear=()=>{t.renderable.getTransparent()||t.suppressClear||t.background.render(t.renderEncoder,e)},e.translucentPass=r=>{r?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.volumeDepthRangePass=r=>{r?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.getAspectRatio=()=>{let e=t._parent.getSizeByReference(),r=t.renderable.getViewportByReference();return e[0]*(r[2]-r[0])/((r[3]-r[1])*e[1])},e.convertToOpenGLDepth=e=>t.webgpuCamera.convertToOpenGLDepth(e),e.getYInvertedTiledSizeAndOrigin=()=>{let r=e.getTiledSizeAndOrigin();return r.lowerLeftV=t._parent.getSizeByReference()[1]-r.vsize-r.lowerLeftV,r},e.getTiledSizeAndOrigin=()=>{let e=t.renderable.getViewportByReference(),r=e[0]-0,n=e[1]-0,i=t._parent.normalizedDisplayToDisplay(r,n),a=Math.round(i[0]),o=Math.round(i[1]),s=e[2]-0,l=e[3]-0,u=t._parent.normalizedDisplayToDisplay(s,l),c=Math.round(u[0])-a,d=Math.round(u[1])-o;return c<0&&(c=0),d<0&&(d=0),{usize:c,vsize:d,lowerLeftU:a,lowerLeftV:o}},e.getPropFromID=e=>{for(let r=0;rt.stabilizedTime.getMTime(),e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources(),t.clearFSQ?.releaseGraphicsResources?.(),t.clearFSQ=null,t.bindGroup.releaseGraphicsResources?.(),t.UBO.releaseGraphicsResources?.(),t.SSBO.releaseGraphicsResources?.(),t.renderEncoder=null,t.backgroundTexLoaded=!1}},"vtkWebGPURenderer");(0,u.c9)("vtkRenderer",A)},48023:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parentNode_convertNodesIntoANode=function(e,t){let r=null;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.idl_defineConst=function(e,t,r){Object.defineProperty(e,t,{writable:!1,enumerable:!0,configurable:!1,value:r})}},48185:(e,t,r)=>{"use strict";r.d(t,{A:()=>c});var n=r(39311),i=r(11701),a=r(85250),o=r(97633),s=r(50923),l=e=>e,u=class{constructor(e=!1){this.matrix=a.identity(new Float64Array(16)),this.tmp=new Float64Array(3),this.angleConv=e?o.DF:l}rotateFromDirections(e,t){let r=new Float64Array(3),n=new Float64Array(3),i=new Float64Array(16);s.hZ(r,e[0],e[1],e[2]),s.hZ(n,t[0],t[1],t[2]),s.S8(r,r),s.S8(n,n);let o=s.Om(r,n);return o>=1||(s.$A(this.tmp,r,n),1e-6>s.Bw(this.tmp)&&(s.$A(this.tmp,[1,0,0],e),1e-6>s.Bw(this.tmp)&&s.$A(this.tmp,[0,1,0],e)),a.fromRotation(i,Math.acos(o),this.tmp),a.multiply(this.matrix,this.matrix,i)),this}rotate(e,t){return s.hZ(this.tmp,...t),s.S8(this.tmp,this.tmp),a.rotate(this.matrix,this.matrix,this.angleConv(e),this.tmp),this}rotateX(e){return a.rotateX(this.matrix,this.matrix,this.angleConv(e)),this}rotateY(e){return a.rotateY(this.matrix,this.matrix,this.angleConv(e)),this}rotateZ(e){return a.rotateZ(this.matrix,this.matrix,this.angleConv(e)),this}translate(e,t,r){return s.hZ(this.tmp,e,t,r),a.translate(this.matrix,this.matrix,this.tmp),this}scale(e,t,r){return s.hZ(this.tmp,e,t,r),a.scale(this.matrix,this.matrix,this.tmp),this}multiply(e){return a.multiply(this.matrix,this.matrix,e),this}multiply3x3(e){return a.multiply(this.matrix,this.matrix,[e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1]),this}invert(){return a.invert(this.matrix,this.matrix),this}identity(){return a.identity(this.matrix),this}apply(e,t=0,r=-1){if((0,i.nY)(n.zK,this.matrix))return this;let a=-1===r?e.length:t+3*r;for(let r=t;r{"use strict";r.d(t,{Ay:()=>o.A,Jj:()=>a.J,LG:()=>s,qn:()=>i.q,v9:()=>a.v});var n=r(44970),i=r(46283),a=r(54878),o=r(81681);let s={adapter:n.Y,getSnapshot:n.r}},48320:(e,t,r)=>{"use strict";function n(e){if(!e)return;let t=e.getSize();for(let r=0;rn})},48548:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(57752);function i(e){return(0,n.A)(e)}},48629:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventImpl=void 0;let n=r(5309),i=r(47518),a=r(48040);class o{static NONE=0;static CAPTURING_PHASE=1;static AT_TARGET=2;static BUBBLING_PHASE=3;NONE=0;CAPTURING_PHASE=1;AT_TARGET=2;BUBBLING_PHASE=3;_target=null;_relatedTarget=null;_touchTargetList=[];_path=[];_currentTarget=null;_eventPhase=n.EventPhase.None;_stopPropagationFlag=!1;_stopImmediatePropagationFlag=!1;_canceledFlag=!1;_inPassiveListenerFlag=!1;_composedFlag=!1;_initializedFlag=!1;_dispatchFlag=!1;_isTrusted=!1;_type;_bubbles=!1;_cancelable=!1;_timeStamp;constructor(e,t){this._type=e,t&&(this._bubbles=t.bubbles||!1,this._cancelable=t.cancelable||!1,this._composedFlag=t.composed||!1),this._initializedFlag=!0,this._timeStamp=new Date().getTime()}get type(){return this._type}get target(){return this._target}get srcElement(){return this._target}get currentTarget(){return this._currentTarget}composedPath(){let e=[],t=this._path;if(0===t.length)return e;let r=this._currentTarget;if(null===r)throw Error("Event currentTarget is null.");e.push(r);let n=0,i=0,a=t.length-1;for(;a>=0;){if(t[a].rootOfClosedTree&&i++,t[a].invocationTarget===r){n=a;break}t[a].slotInClosedTree&&i--,a--}let o=i,s=i;for(a=n-1;a>=0;)t[a].rootOfClosedTree&&o++,o<=s&&e.unshift(t[a].invocationTarget),t[a].slotInClosedTree&&--o{"use strict";var n;r.d(t,{A:()=>i}),function(e){e.CalculateCursorGeometry="calculateCursorGeometry",e.RenderCursor="renderCursor",e.OnInteractionStart="onInteractionStart",e.OnInteractionEnd="onInteractionEnd",e.Preview="preview",e.RejectPreview="rejectPreview",e.AcceptPreview="acceptPreview",e.Fill="fill",e.Interpolate="interpolate",e.StrategyFunction="strategyFunction",e.CreateIsInThreshold="createIsInThreshold",e.Initialize="initialize",e.INTERNAL_setValue="setValue",e.AddPreview="addPreview",e.ComputeInnerCircleRadius="computeInnerCircleRadius",e.GetStatistics="getStatistics",e.EnsureImageVolumeFor3DManipulation="ensureImageVolumeFor3DManipulation",e.EnsureSegmentationVolumeFor3DManipulation="ensureSegmentationVolumeFor3DManipulation"}(n||(n={}));let i=n},48975:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(70192),i=r(36898),a=r(65488);function o(e,t,r=!0){let s=(0,n.kJ)(e),{renderingEngine:l,FrameOfReferenceUID:u}=s,c=l.getViewports();c=function(e,t){let r=e.length,n=[];for(let i=0;ie.id)}},49151:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(27321),i=r(65704),a=r(68759);function o(e,t,r,o,s){let l=o.length&&o[0].length&&Array.isArray(o[0][0])?o:[o],{color:u="rgb(0, 255, 0)",width:c=10,fillColor:d="none",fillOpacity:p=0,strokeOpacity:m=1,lineWidth:h,lineDash:f,lineCap:g,lineJoin:v,closePath:y=!1}=s,b=(0,n.A)(t,"path",r),I=e.getSvgNode(b),x="";for(let e=0,t=l.length;e{"use strict";var n;r.d(t,{A:()=>i}),function(e){e.Interaction="Interaction",e.HandlesUpdated="HandlesUpdated",e.StatsUpdated="StatsUpdated",e.InitialSetup="InitialSetup",e.Completed="Completed",e.InterpolationUpdated="InterpolationUpdated",e.History="History",e.MetadataReferenceModified="MetadataReferenceModified",e.LabelChange="LabelChange"}(n||(n={}));let i=n},49185:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var n=r(70192);let{isEqual:i}=n.BF,a={toIJK:e=>e,fromIJK:e=>e,type:"acquistion"},o={toIJK:([e,t,r])=>[r,e,t],fromIJK:([e,t,r])=>[t,r,e],type:"jk"},s={toIJK:([e,t,r])=>[e,r,t],fromIJK:([e,t,r])=>[e,r,t],type:"ik"};function l(e,t){if(!(e instanceof n.ei))return{...a,boundsIJKPrime:t};let{viewPlaneNormal:r}=e.getCamera(),l=i(Math.abs(r[0]),1)&&o||i(Math.abs(r[1]),1)&&s||i(Math.abs(r[2]),1)&&a;return l?{...l,boundsIJKPrime:l.fromIJK(t)}:{toIJK:null,boundsIJKPrime:null,fromIJK:null,error:`Only mappings orthogonal to acquisition plane are permitted, but requested ${r}`}}},50026:(e,t,r)=>{"use strict";let n=r(26735),i=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],a=["scalar","sequence","mapping"];e.exports=function(e,t){if(Object.keys(t=t||{}).forEach(function(t){if(-1===i.indexOf(t))throw new n('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){let t={};return null!==e&&Object.keys(e).forEach(function(r){e[r].forEach(function(e){t[String(e)]=r})}),t}(t.styleAliases||null),-1===a.indexOf(this.kind))throw new n('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}},50121:(e,t,r)=>{"use strict";function n(e,t,r){let n=e.length===t*r*4,i=e.length===t*r*3;if(!n&&!i)return e;{let i=new Float32Array(t*r),a=0,o=0,s=n?4:3;for(let n=0;nn})},50138:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DOMTokenListImpl=void 0;let n=r(60957),i=r(32008),a=r(57226),o=r(47518);class s{_element;_attribute;_tokenSet;constructor(e,t){this._element=e,this._attribute=t,this._tokenSet=new Set;let r=t._localName,i=(0,o.element_getAnAttributeValue)(e,r),a=this;this._element._attributeChangeSteps.push(function(e,t,r,n,i){t===a._attribute._localName&&null===i&&(n?a._tokenSet=(0,o.orderedSet_parse)(n):a._tokenSet.clear())}),n.dom.features.steps&&(0,o.dom_runAttributeChangeSteps)(e,r,i,i,null)}get length(){return this._tokenSet.size}item(e){let t=0;for(let r of this._tokenSet){if(t===e)return r;t++}return null}contains(e){return this._tokenSet.has(e)}add(...e){for(let t of e)if(""===t)throw new i.SyntaxError("Cannot add an empty token.");else if(a.codePoint.ASCIIWhiteSpace.test(t))throw new i.InvalidCharacterError("Token cannot contain whitespace.");else this._tokenSet.add(t);(0,o.tokenList_updateSteps)(this)}remove(...e){for(let t of e)if(""===t)throw new i.SyntaxError("Cannot remove an empty token.");else if(a.codePoint.ASCIIWhiteSpace.test(t))throw new i.InvalidCharacterError("Token cannot contain whitespace.");else this._tokenSet.delete(t);(0,o.tokenList_updateSteps)(this)}toggle(e,t){if(""===e)throw new i.SyntaxError("Cannot toggle an empty token.");if(a.codePoint.ASCIIWhiteSpace.test(e))throw new i.InvalidCharacterError("Token cannot contain whitespace.");return this._tokenSet.has(e)?void 0!==t&&!1!==t||(this._tokenSet.delete(e),(0,o.tokenList_updateSteps)(this),!1):(void 0===t||!0===t)&&(this._tokenSet.add(e),(0,o.tokenList_updateSteps)(this),!0)}replace(e,t){if(""===e||""===t)throw new i.SyntaxError("Cannot replace an empty token.");if(a.codePoint.ASCIIWhiteSpace.test(e)||a.codePoint.ASCIIWhiteSpace.test(t))throw new i.InvalidCharacterError("Token cannot contain whitespace.");return!!this._tokenSet.has(e)&&(a.set.replace(this._tokenSet,e,t),(0,o.tokenList_updateSteps)(this),!0)}supports(e){return(0,o.tokenList_validationSteps)(this,e)}get value(){return(0,o.tokenList_serializeSteps)(this)}set value(e){(0,o.element_setAnAttributeValue)(this._element,this._attribute._localName,e)}[Symbol.iterator](){let e=this._tokenSet[Symbol.iterator]();return{next:()=>e.next()}}static _create(e,t){return new s(e,t)}}t.DOMTokenListImpl=s},50695:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(16376),i=r(32488);let a=e=>{let t=function(e){let t=(0,n.qO)(),r=[];return t.forEach(t=>{let n=(0,i.A)(e);n.length&&r.push({renderingEngine:t,viewportIds:n.map(e=>e.id)})}),r}(e);t?.length&&t.forEach(({renderingEngine:e,viewportIds:t})=>{e.hasBeenDestroyed||e.renderViewports(t)})}},50699:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(92049);let i=function(e){let{imageIdGroups:t,splittingTag:r}=(0,n.Ay)(e);return{isDynamicVolume:t.length>1,timePoints:t,splittingTag:r}}},50869:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(1953),i=r(57752),a=r(19157);function o(e,t,r,o,s){if(t.volumeId)throw Error("Unsupported volume rendering for CPU");let l=(0,n.A)(e,t,r),u={canvas:e,viewport:l,image:t,renderingTools:{}};return u.transform=(0,i.A)(u),new Promise((e,t)=>{(0,a.A)(u,!0),e(null)})}},50987:(e,t,r)=>{"use strict";function n(e){return i(e,"vtkVolume")||i(e,"vtkImageSlice")}function i(e,t){let r="isA"in e?e:e.actor;return!!r&&!!r.isA(t)}r.d(t,{N:()=>i,e:()=>n})},51555:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>o});var n=r(17042),i={device:null,handle:null,label:null,options:null};function a(e,t,r={}){Object.assign(t,i,r),n.Ay.obj(e,t),t.options={},t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,sampler:{}},t.bindGroupTime={},n.Ay.obj(t.bindGroupTime,{mtime:0}),n.Ay.get(e,t,["bindGroupTime","handle","options"]),n.Ay.setGet(e,t,["bindGroupLayoutEntry","device","label"]),t.classHierarchy.push("vtkWebGPUSampler"),e.create=(e,r={})=>{t.device=e,t.options.addressModeU=r.addressModeU?r.addressModeU:"clamp-to-edge",t.options.addressModeV=r.addressModeV?r.addressModeV:"clamp-to-edge",t.options.addressModeW=r.addressModeW?r.addressModeW:"clamp-to-edge",t.options.magFilter=r.magFilter?r.magFilter:"nearest",t.options.minFilter=r.minFilter?r.minFilter:"nearest",t.options.mipmapFilter=r.mipmapFilter?r.mipmapFilter:"nearest",t.options.label=t.label,t.handle=t.device.getHandle().createSampler(t.options),t.bindGroupTime.modified()},e.getShaderCode=(e,r)=>`@binding(${e}) @group(${r}) var ${t.label}: sampler;`,e.getBindGroupEntry=()=>({resource:t.handle})}var o={newInstance:n.Ay.newInstance(a),extend:a}},51680:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>u});var n=r(17042),i=r(87352),a=r(19047),{vtkErrorMacro:o}=n.o$,s={cutFunction:null,cutScalars:null,cutValue:0};function l(e,t,r={}){Object.assign(t,s,r),(0,n.WL)(e,t),(0,n.e5)(e,t,1,1),(0,n.V0)(e,t,["cutFunction","cutValue"]);t.classHierarchy.push("vtkCutter");let u={...e};e.getMTime=()=>{let e=u.getMTime();return t.cutFunction?e=Math.max(e,t.cutFunction.getMTime()):e},e.requestData=(e,r)=>{let s=e[0];if(!s)return void o("Invalid or missing input");if(!t.cutFunction)return void o("Missing cut function");let l=r[0]?.initialize()||a.Ay.newInstance();!function(e,r){let a=e.getPoints(),o=a.getData(),s=e.getPointData(),l=a.getNumberOfPoints(),u=[],c=[],d=[],p={},m=s.getNumberOfArrays();for(let e=0;e0,n=!0;for(let t=1;t0!==e){n=!1;break}if(n)continue;let i=[];for(let e=0;e0;if(b[n]>0===a)continue;let l=e,u=n,c=b[u]-b[l];c<=0&&(l=n,u=e,c*=-1);let d=0;0!==c&&(d=(t.cutValue-b[l])/c);let p=r.cell[l],h=r.cell[u];v[0]=o[3*p],v[1]=o[3*p+1],v[2]=o[3*p+2],y[0]=o[3*h],y[1]=o[3*h+1],y[2]=o[3*h+2];let f=[v[0]+d*(y[0]-v[0]),v[1]+d*(y[1]-v[1]),v[2]+d*(y[2]-v[2])],g={};for(let e=0;e{p[e].push(...t.intersectedArrays[e])}),i[e].newPointID=u.length/3-1,g.push(i[e]))}let a=i.length;2===a?c.push(a,i[0].newPointID,i[1].newPointID):a>2&&(d.push(a),i.forEach(e=>{d.push(e.newPointID)}))}r.getPoints().setData((0,n.W2)(a.getDataType(),u),3);let I=r.getPointData();for(let e=0;e{"use strict";r(33845)},51740:(e,t,r)=>{"use strict";var n;r(97442),r(63306),r(70192),r(93022),r(74065),r(4546),r(43385),r(5801),r(76818),r(38031),r(44120),r(2997),r(96310),r(68566),function(e){e[e.Union=0]="Union",e[e.Subtract=1]="Subtract",e[e.Intersect=2]="Intersect",e[e.XOR=3]="XOR",e[e.Copy=4]="Copy",e[e.Delete=5]="Delete"}(n||(n={}))},51889:(e,t,r)=>{"use strict";r(70192),r(43385),r(2911)},52046:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>d});var n=r(17042),i=r(72188),a=r(56929),o=r(85250),s=r(37843),l={};function u(e,t,r={}){Object.assign(t,l,r),i.A.extend(e,t,r),t.keyMatrixTime={},(0,n.WL)(t.keyMatrixTime,{mtime:0}),t.normalMatrix=new Float64Array(9),t.MCWCMatrix=new Float64Array(16),(0,n.V0)(e,t,["context"]),t.classHierarchy.push("vtkOpenGLVolume"),e.buildPass=r=>{t.renderable&&t.renderable.getVisibility()&&r&&(t._openGLRenderWindow=e.getLastAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.queryPass=(e,r)=>{e&&t.renderable&&t.renderable.getVisibility()&&r.incrementVolumeCount()},e.traverseVolumePass=r=>{!t.renderable||!t.renderable.getNestedVisibility()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(r,!0),t.children[0].traverse(r),e.apply(r,!1))},e.volumePass=e=>{t.renderable&&t.renderable.getVisibility()&&t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),o.copy(t.MCWCMatrix,t.renderable.getMatrix()),o.transpose(t.MCWCMatrix,t.MCWCMatrix),t.renderable.getIsIdentity()?s.identity(t.normalMatrix):(s.fromMat4(t.normalMatrix,t.MCWCMatrix),s.invert(t.normalMatrix,t.normalMatrix),s.transpose(t.normalMatrix,t.normalMatrix)),t.keyMatrixTime.modified()),{mcwc:t.MCWCMatrix,normalMatrix:t.normalMatrix})}var c=(0,n.UI)(u,"vtkOpenGLVolume"),d={newInstance:c,extend:u};(0,a.c9)("vtkVolume",c)},52210:(e,t,r)=>{"use strict";r(49007),r(38433)},52219:(e,t,r)=>{"use strict";r.d(t,{A:()=>c});var n=r(18533),i=r(20549),a=r(44151),o=r(69228),s=r(77280),l=r(10807),u=r(42215);let c=async function e(t,r,c,d=!1){let{volumeId:p,callback:m,blendMode:h}=t,f=await (0,i.loadVolume)(p);if(!f)throw Error(`imageVolume with id: ${f.volumeId} does not exist`);let{imageData:g,vtkOpenGLTexture:v}=f,y=(0,a.A)(g,v);h&&y.setBlendMode(h);let b=n.Ay.newInstance();b.setMapper(y);let{numberOfComponents:I}=g.get("numberOfComponents"),x=b.getProperty();return x.set({viewportId:c},!0),(0,u.D0)().rendering.preferSizeOverAccuracy&&x.setPreferSizeOverAccuracy(!0),3===I&&b.getProperty().setIndependentComponents(!1),await (0,l.A)(b,f),m&&m({volumeActor:b,volumeId:p}),d||function(e,t,r,n){let i=r.getProperty().getRGBTransferFunction(0).getRange(),a={viewportId:t,range:{lower:i[0],upper:i[1]},volumeId:n};(0,o.A)(e,s.sV.VOI_MODIFIED,a)}(r,c,b,p),b}},52575:(e,t,r)=>{"use strict";r.d(t,{R:()=>a});var n=r(41831),i=r(3793);class a{constructor(e){this.numRequests={[n.A.Interaction]:0,[n.A.Thumbnail]:0,[n.A.Prefetch]:0,[n.A.Compute]:0},this.id=e||(0,i.A)(),this.requestPool={[n.A.Interaction]:{0:[]},[n.A.Thumbnail]:{0:[]},[n.A.Prefetch]:{0:[]},[n.A.Compute]:{0:[]}},this.grabDelay=5,this.awake=!1,this.numRequests={[n.A.Interaction]:0,[n.A.Thumbnail]:0,[n.A.Prefetch]:0,[n.A.Compute]:0},this.maxNumRequests={[n.A.Interaction]:6,[n.A.Thumbnail]:6,[n.A.Prefetch]:5,[n.A.Compute]:1e3}}setMaxSimultaneousRequests(e,t){this.maxNumRequests[e]=t}getMaxSimultaneousRequests(e){return this.maxNumRequests[e]}destroy(){this.timeoutHandle&&window.clearTimeout(this.timeoutHandle)}addRequest(e,t,r,n=0){void 0===this.requestPool[t][n]&&(this.requestPool[t][n]=[]),this.requestPool[t][n].push({requestFn:e,type:t,additionalDetails:r}),this.startGrabbing()}filterRequests(e){Object.keys(this.requestPool).forEach(t=>{let r=this.requestPool[t];Object.keys(r).forEach(t=>{r[t]=r[t].filter(t=>e(t))})})}clearRequestStack(e){if(!this.requestPool[e])throw Error(`No category for the type ${e} found`);this.requestPool[e]={0:[]}}sendRequests(e){let t=this.maxNumRequests[e]-this.numRequests[e],r=0;for(let n=0;n{this.numRequests[e]--,this.startAgain()}):(this.numRequests[e]--,r++)}}return r&&this.startAgain(),!0}getNextRequest(e){for(let t of this.getSortedPriorityGroups(e))if(this.requestPool[e][t].length)return this.requestPool[e][t].shift();return null}startGrabbing(){let e=this.sendRequests(n.A.Interaction),t=this.sendRequests(n.A.Thumbnail),r=this.sendRequests(n.A.Prefetch),i=this.sendRequests(n.A.Compute);e||t||r||i||(this.awake=!1)}startAgain(){this.awake&&(void 0!==this.grabDelay?this.timeoutHandle||(this.timeoutHandle=window.setTimeout(()=>{this.timeoutHandle=null,this.startGrabbing()},this.grabDelay)):this.startGrabbing())}getSortedPriorityGroups(e){return Object.keys(this.requestPool[e]).map(Number).filter(t=>this.requestPool[e][t].length).sort((e,t)=>e-t)}getRequestPool(){return this.requestPool}}},52971:(e,t,r)=>{"use strict";function n(e){let{direction:t}=e;return{viewPlaneNormal:t.slice(6,9).map(e=>-e),viewUp:t.slice(3,6).map(e=>-e)}}r.d(t,{A:()=>n})},52985:function(e,t,r){var n;!function(e,i,a){function o(e){var t=this;t.next=function(){var e,r,n=t.x,i=t.i;return e=n[i],e^=e>>>7,r=e^e<<24^((e=n[i+1&7])^e>>>10)^((e=n[i+3&7])^e>>>3)^((e=n[i+4&7])^e<<7),e=n[i+7&7],e^=e<<13,r^=e^e<<9,n[i]=r,t.i=i+1&7,r};var r,n=e,i=[];if(n===(0|n))i[0]=n;else for(r=0,n=""+n;r0;--r)t.next()}function s(e,t){return t.x=e.x.slice(),t.i=e.i,t}function l(e,t){null==e&&(e=+new Date);var r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/0x100000000};return i.double=function(){do var e=((r.next()>>>11)+(r.next()>>>0)/0x100000000)/2097152;while(0===e);return e},i.int32=r.next,i.quick=i,n&&(n.x&&s(n,r),i.state=function(){return s(r,{})}),i}i&&i.exports?i.exports=l:r.amdD&&r.amdO?void 0===(n=(function(){return l}).call(t,r,t,i))||(i.exports=n):this.xorshift7=l}(0,e=r.nmd(e),r.amdD)},53013:e=>{"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(i=n;0!=i--;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(a=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,a[i]))return!1;for(i=n;0!=i--;){var n,i,a,o=a[i];if(!e(t[o],r[o]))return!1}return!0}return t!=t&&r!=r}},53014:(e,t,r)=>{"use strict";function n(e,t){for(let r=0;r<6;r++)e.addEntry(`${t}${r}`,"vec4")}function i({countName:e,planePrefix:t,positionName:r,returnValue:n="discard"}){let i=[];for(let a=0;a<6;a++)i.push(` if (${e} > ${a}u && dot(${t}${a}, ${r}) < 0.0) { ${n}; }`);return i}function a(e,t,r){let n=e.getClippingPlanes().length;for(let i=0;in,JE:()=>i,Z6:()=>a})},53038:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(17042),i={r8unorm:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"float"},r8snorm:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"float"},r8uint:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},r8sint:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"sint"},r16uint:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"uint"},r16sint:{numComponents:1,nativeType:Int16Array,stride:2,elementSize:2,sampleType:"sint"},r16float:{numComponents:1,nativeType:Float32Array,stride:2,elementSize:2,sampleType:"float"},rg8unorm:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"float"},rg8snorm:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"float"},rg8uint:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"uint"},rg8sint:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"sint"},r32uint:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:4,sampleType:"uint"},r32sint:{numComponents:1,nativeType:Int32Array,stride:4,elementSize:4,sampleType:"sint"},r32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"unfilterable-float"},rg16uint:{numComponents:2,nativeType:Uint16Array,stride:4,elementSize:2,sampleType:"uint"},rg16sint:{numComponents:2,nativeType:Int16Array,stride:4,elementSize:2,sampleType:"sint"},rg16float:{numComponents:2,nativeType:Float32Array,stride:4,elementSize:2,sampleType:"float"},rgba8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"rgba8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgba8snorm:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"float"},rgba8uint:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"uint"},rgba8sint:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"sint"},bgra8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"bgra8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgb9e5ufloat:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rgb10a2unorm:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rg11b10ufloat:{numComponents:4,nativeType:Float32Array,stride:4,sampleType:"float"},rg32uint:{numComponents:2,nativeType:Uint32Array,stride:8,elementSize:4,sampleType:"uint"},rg32sint:{numComponents:2,nativeType:Int32Array,stride:8,elementSize:4,sampleType:"sint"},rg32float:{numComponents:2,nativeType:Float32Array,stride:8,elementSize:4,sampleType:"unfilterable-float"},rgba16uint:{numComponents:4,nativeType:Uint16Array,stride:8,elementSize:2,sampleType:"uint"},rgba16sint:{numComponents:4,nativeType:Int16Array,stride:8,elementSize:2,sampleType:"sint"},rgba16float:{numComponents:4,nativeType:Float32Array,stride:8,elementSize:2,sampleType:"float"},rgba32uint:{numComponents:4,nativeType:Uint32Array,stride:16,elementSize:4,sampleType:"uint"},rgba32sint:{numComponents:4,nativeType:Int32Array,stride:16,elementSize:4,sampleType:"sint"},rgba32float:{numComponents:4,nativeType:Float32Array,stride:16,elementSize:4,sampleType:"unfilterable-float"},stencil8:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},depth16unorm:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"depth"},depth24plus:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:3,sampleType:"depth"},"depth24plus-stencil8":{numComponents:2,nativeType:Uint32Array,stride:4,sampleType:"mixed"},depth32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"depth"}},a={getDetailsFromTextureFormat:function(e){return!e||e.length<6?0:e in i==!0?i[e]:((0,n.Bl)(`unknown format ${e}`),null)},getByteStrideFromBufferFormat:function(e){if(!e||e.length<5)return 0;let t=1;"x"===e[e.length-2]&&(t=Number(e[e.length-1]));let r=1===t?e.length-1:e.length-3,i=Number(e[r]);return Number.isNaN(i)?((0,n.Bl)(`unknown format ${e}`),0):t*(5-i/2)},getNumberOfComponentsFromBufferFormat:function(e){if(!e||e.length<5)return 0;let t=1;return"x"===e[e.length-2]&&(t=Number(e[e.length-1])),t},getNativeTypeFromBufferFormat:function(e){let t;if(!e||e.length<5)return 0;if("f"===e[0])t="Float";else if("s"===e[0])t="Int";else{if("u"!==e[0])return void(0,n.Bl)(`unknown format ${e}`);t="Uint"}let r=e.split("x")[0],i=Number(r[r.length-1]);return Number.isNaN(i)?void(0,n.Bl)(`unknown format ${e}`):(t+=8*(5-i/2),t+="Array")},getShaderTypeFromBufferFormat:function(e){let t;if("f"===e[0]||"n"===e[1])t="f32";else if("s"===e[0]&&"i"===e[1])t="i32";else{if("u"!==e[0]||"i"!==e[1])return void(0,n.Bl)(`unknown format ${e}`);t="u32"}let r=1;return("x"===e[e.length-2]&&(r=Number(e[e.length-1])),4===r)?`vec4<${t}>`:3===r?`vec3<${t}>`:2===r?`vec2<${t}>`:t},getByteStrideFromShaderFormat:function(e){if(!e)return 0;let t=1;return"vec"===e.substring(0,3)?t=Number(e[3]):"mat"===e.substring(0,3)&&(t=e[3]*e[5]),4*t},getNativeTypeFromShaderFormat:function(e){if(e){if(e.includes("f32"))return"Float32Array";if(e.includes("i32"))return"Int32Array";if(e.includes("u32"))return"Uint32Array";(0,n.Bl)(`unknown format ${e}`)}}}},53163:(e,t,r)=>{"use strict";r.d(t,{v:()=>n});var n={MAX:0,MIN:1,AVERAGE:2}},53188:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>o});var n=r(17042),i={};function a(e,t,r={}){Object.assign(t,i,r),n.Ay.obj(e,t),n.Ay.setGet(e,t,["transform"]),t.classHierarchy.push("vtkImplicitFunction"),e.functionValue=r=>{if(!t.transform)return e.evaluateFunction(r);let n=[];return t.transform.transformPoint(r,n),e.evaluateFunction(n)},e.evaluateFunction=e=>{n.Ay.vtkErrorMacro("not implemented")}}var o={newInstance:n.Ay.newInstance(a,"vtkImplicitFunction"),extend:a}},53562:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.YAMLReader=t.JSONReader=t.ObjectReader=t.XMLReader=void 0;var n=r(93836);Object.defineProperty(t,"XMLReader",{enumerable:!0,get:function(){return n.XMLReader}});var i=r(23246);Object.defineProperty(t,"ObjectReader",{enumerable:!0,get:function(){return i.ObjectReader}});var a=r(79239);Object.defineProperty(t,"JSONReader",{enumerable:!0,get:function(){return a.JSONReader}});var o=r(65974);Object.defineProperty(t,"YAMLReader",{enumerable:!0,get:function(){return o.YAMLReader}})},53686:(e,t,r)=>{"use strict";r.d(t,{A:()=>x});var n=r(70192),i=r(91336),a=r(77680),o=r(59998),s=r(10353),l=r(93022),u=r(34699),c=r(17964),d=r(78378),p=r(73904),m=r(84305),h=r(49159),f=r(12577),g=r(98723),v=r(54715),y=r(41918);let{DefaultHistoryMemo:b}=n.BF.HistoryMemo;class I extends a.A{static createAnnotationForViewport(e,...t){let r=e.getViewReference();return delete r.volumeId,this.createAnnotation({metadata:r},...t)}static createAndAddAnnotation(e,...t){let r=this.createAnnotationForViewport(e,...t);(0,l.addAnnotation)(r,e.element),(0,u.triggerAnnotationModified)(r,e.element)}constructor(e,t){super(e,t),this._activateModify=e=>{c.wk.isInteractingWithTool=!0,e.addEventListener(d.sV.MOUSE_UP,this._endCallback),e.addEventListener(d.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(d.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(d.sV.TOUCH_END,this._endCallback),e.addEventListener(d.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(d.sV.TOUCH_TAP,this._endCallback)},this._deactivateModify=e=>{c.wk.isInteractingWithTool=!1,e.removeEventListener(d.sV.MOUSE_UP,this._endCallback),e.removeEventListener(d.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(d.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(d.sV.TOUCH_END,this._endCallback),e.removeEventListener(d.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(d.sV.TOUCH_TAP,this._endCallback)},this.mouseMoveCallback=(e,t)=>{if(!t)return!1;let{element:r,currentPoints:n}=e.detail,i=n.canvas,a=!1;for(let e of t){if((0,o.Gh)(e.annotationUID)||!(0,s.YY)(e.annotationUID))continue;let{data:t}=e,n=t.handles?t.handles.activeHandleIndex:void 0,l=this._imagePointNearToolOrHandle(r,e,i,6),u=l&&!e.highlighted,c=!l&&e.highlighted;u||c?(e.highlighted=!e.highlighted,a=!0):t.handles&&t.handles.activeHandleIndex!==n&&(a=!0)}return a},this.isSuvScaled=I.isSuvScaled,e.configuration?.getTextLines&&(this.configuration.getTextLines=e.configuration.getTextLines),e.configuration?.statsCalculator&&(this.configuration.statsCalculator=e.configuration.statsCalculator)}getHandleNearImagePoint(e,t,r,a){let{viewport:o}=(0,n.kJ)(e),{data:s}=t,{isCanvasAnnotation:l}=s,{points:u,textBox:c}=s.handles;if(c){let{worldBoundingBox:e}=c;if(e){let t={topLeft:o.worldToCanvas(e.topLeft),topRight:o.worldToCanvas(e.topRight),bottomLeft:o.worldToCanvas(e.bottomLeft),bottomRight:o.worldToCanvas(e.bottomRight)};if(r[0]>=t.topLeft[0]&&r[0]<=t.bottomRight[0]&&r[1]>=t.topLeft[1]&&r[1]<=t.bottomRight[1])return s.handles.activeHandleIndex=null,c}}for(let e=0;ethis.getStyle(e,r,t),{annotationUID:i}=t,a=(0,s.YY)(i),l=(0,o.Gh)(i),u=n("lineWidth"),c=n("lineDash"),d=n("angleArcLineDash"),p=n("color"),m=n("markerSize");return{visibility:a,locked:l,color:p,lineWidth:u,lineDash:c,lineOpacity:1,fillColor:p,fillOpacity:0,shadow:n("shadow"),textbox:this.getLinkedTextBoxStyle(r,t),markerSize:m,angleArcLineDash:d}}_imagePointNearToolOrHandle(e,t,r,n){if(this.getHandleNearImagePoint(e,t,r,n)||this.isPointNearTool(e,t,r,n,"mouse"))return!0}static createAnnotationState(e,t){let{data:r,annotationUID:n}=e;return{annotationUID:n,data:(0,v.W)(r),deleting:t}}static createAnnotationMemo(e,t,r){if(!t)return;let{newAnnotation:i,deleting:a=!i&&void 0}=r||{},{annotationUID:o}=t,s=I.createAnnotationState(t,a),c={restoreMemo:()=>{let r=I.createAnnotationState(t,a),{viewport:i}=(0,n.kJ)(e)||{};if(i?.setViewReference(t.metadata),!0===s.deleting){if(s.deleting=!1,Object.assign(t.data,s.data),t.data.contour){let e=t.data;e.contour.polyline=s.data.contour.pointsManager.points,delete s.data.contour.pointsManager,e.segmentation&&(0,g.V0)(t)}s.data=r.data,(0,l.addAnnotation)(t,e),(0,f.L6)(t.annotationUID,!0),i?.render();return}if(!1===s.deleting){s.deleting=!0,s.data=r.data,(0,f.L6)(t.annotationUID),(0,l.removeAnnotation)(t.annotationUID),i?.render();return}let c=(0,l.getAnnotation)(o);if(!c)return void console.warn("No current annotation");Object.assign(c.data,s.data),c.data.contour&&(c.data.contour.polyline=s.data.contour.pointsManager.points),s.data=r.data,c.invalidated=!0,e&&(0,u.triggerAnnotationModified)(c,e,h.A.History)},id:o,operationType:"annotation"};return b.push(c),c}createMemo(e,t,r){this.memo||=I.createAnnotationMemo(e,t,r)}startGroupRecording(){b.startGroupRecording()}endGroupRecording(){b.endGroupRecording()}static hydrateBase(e,t,r,i={}){let a;if(!t)return null;let{viewport:o}=t,s=o.getFrameOfReferenceUID(),l=(0,y.A)(o),u=i.viewplaneNormal??l.viewPlaneNormal,c=i.viewUp??l.viewUp,d=i.toolInstance||new e,p=u,m=c;if(i.referencedImageId)a=i.referencedImageId,p=void 0,m=void 0;else if(o instanceof n.hS){let e=n.BF.getClosestStackImageIndexForPoint(r[0],o);void 0!==e&&(a=o.getImageIds()[e])}else if(o instanceof n.ei)a=d.getReferencedImageId(o,r[0],u,c);else if(n.BF.isGenericViewport(o))a=o.getViewReference?.({points:[r[0]]})?.referencedImageId;else throw Error("Unsupported viewport type");return{FrameOfReferenceUID:s,referencedImageId:a,viewPlaneNormal:p,viewUp:m,instance:d,viewport:o}}}I.toolName="AnnotationTool";let x=I},53695:(e,t,r)=>{"use strict";r.d(t,{I:()=>o,Y:()=>s});var n=r(22783),i=r(50923);function a(e,t,r){let a=r.getCurrentImage(),o=a.getExtent(),s=[o[0],o[2],o[4]],{ijkMode:l}=r.getClosestIJKAxis(),u=r.isA("vtkImageArrayMapper")?r.getSubSlice():r.getSlice();l!==r.getSlicingMode()&&(u=r.getSliceAtPosition(u)),s[l]+=u;let c=[0,0,0];a.indexToWorld(s,c),s[l]+=1;let d=[0,0,0];a.indexToWorld(s,d),d[0]-=c[0],d[1]-=c[1],d[2]-=c[2],i.S8(d,d);let p=n.Ay.intersectWithLine(e,t,c,d);if(p.intersection){let e=p.x,t=[0,0,0];return a.worldToIndex(e,t),{t:p.t,absoluteIJK:t}}return null}function o(e,t,r){let n=a(e,t,r);if(n){let e=r.getCurrentImage().getExtent(),t=[Math.round(n.absoluteIJK[0]),Math.round(n.absoluteIJK[1]),Math.round(n.absoluteIJK[2])];return t[0]e[1]||t[1]e[3]||t[2]e[5]?null:{t:n.t,ijk:t}}return null}function s(e,t,r){let n=a(e,t,r);if(n){let e=r.getCurrentImage().getExtent(),t=n.absoluteIJK,i=[Math.floor(t[0]),Math.floor(t[1]),Math.floor(t[2])];if(i[0]e[1]-1||i[1]e[3]-1||i[2](e[5]?e[5]-1:e[5]))return null;let a=[t[0]-i[0],t[1]-i[1],t[2]-i[2]];return{t:n.t,ijk:i,pCoords:a}}return null}},53725:(e,t,r)=>{"use strict";r.d(t,{A:()=>u});var n=r(76879),i=r(17774),a=r(69228),o=r(73502),s=r(31906);class l{constructor(e){this.viewportStatus=i.A.NO_DATA,this.bindings=new Map,this.dataPresentation=new Map,this.isDestroyed=!1,this._debug={renderModes:{}},this.id=e.id,this.element=e.element}async setDisplaySets(...e){for(let[t,{displaySetId:r,options:n}]of(this.removeAllData(),e.entries())){if(!n)throw Error(`[${this.type}] setDisplaySets requires per-entry options when the viewport family does not override it.`);await this.addDisplaySet(r,{...n,role:n.role??(0===t?"source":"overlay")})}}async addDisplaySet(e,t){if(this.isDestroyed)throw Error("Viewport has been destroyed");let r=await this.dataProvider.load(e,t);await this.addLoadedData(e,r,t)}getDisplaySets(){return Array.from(this.bindings.entries()).map(([e,t])=>({displaySetId:e,options:{role:t.role}}))}removeData(e){let t=this.bindings.get(e);t&&(t.removeData(),this.bindings.delete(e),this.dataPresentation.delete(e),delete this._debug.renderModes[e],this.isDestroyed||this.render())}setDisplaySetPresentation(e,t){if("string"==typeof e)return void this.mergeDataPresentation(e,t??{});let r=this.getCurrentBinding()?.data.id;r&&this.mergeDataPresentation(r,e)}getDisplaySetPresentation(e){return this.getDataPresentationState(e)}getCurrentMode(){return this.getSourceBinding()?"unknown":"empty"}getViewReference(e={}){return{FrameOfReferenceUID:this.getFrameOfReferenceUID(),dataId:this.getCurrentBinding()?.data.id}}getViewReferenceId(e={}){return`frameOfReference:${this.getFrameOfReferenceUID()}`}setViewReference(e){}isReferenceViewable(e,t={}){return(0,s.o)(e,this.getReferenceViewContexts(e),t)}getFrameOfReferenceUID(){return this.getResolvedView()?.getFrameOfReferenceUID()??`${this.type}-viewport-${this.id}`}getRenderingEngine(){return o.A.get(this.renderingEngineId)}canvasToWorld(e){let t=this.getResolvedView();if(!t)throw Error(`[${this.type}] Cannot convert canvas to world for viewport ${this.id} because no data is mounted.`);return t.canvasToWorld(e)}worldToCanvas(e){let t=this.getResolvedView();if(!t)throw Error(`[${this.type}] Cannot convert world to canvas for viewport ${this.id} because no data is mounted.`);return t.worldToCanvas(e)}getAspectRatio(){return[1,1]}setViewState(e){if(this.isDestroyed)return;let t=this.getCameraForEvent(),r={...this.viewState,...e};this.viewState=this.normalizeViewState(r),this.modified(t)}getViewState(){return this.viewState}updateViewState(e){let t="function"==typeof e?e(this.getViewState()):e;t&&this.setViewState(t)}removeWidgets(){}destroy(){if(!this.isDestroyed){for(let e of(this.isDestroyed=!0,this.destroyBindings(),this.onDestroy(),this.bindings.clear(),this.dataPresentation.clear(),Object.keys(this._debug.renderModes)))delete this._debug.renderModes[e];this.element.removeAttribute("data-viewport-uid"),this.element.removeAttribute("data-rendering-engine-uid")}}dispose(){this.destroy()}setRendered(){this.viewportStatus!==i.A.NO_DATA&&this.viewportStatus!==i.A.LOADING&&(this.viewportStatus=i.A.RENDERED)}setNeedsRender(){this.viewportStatus=i.A.NEEDS_RENDER}updateRenderingPipeline(){}resize(){this.isDestroyed||(this.resizeBindings(),this.modified())}resetViewState(e){return!1}resizeForRenderingEngine({keepCamera:e=!0}={}){!this.isDestroyed&&(this.resize(),e||this.resetViewState())}async addLoadedData(e,t,r,n){if(this.isDestroyed)throw Error("Viewport has been destroyed");if(n?.())return!1;let a=this.renderPathResolver.resolve(this.type,t,r),o=a.createRenderPath(),s=a.selectContext?.(this.renderContext)??this.renderContext,l=await o.addData(s,t,r);if(n?.())return l.removeData(),!1;if(this.isDestroyed)throw l.removeData(),Error("Viewport has been destroyed");let u=this.bindings.get(e);u&&u.removeData();let c=r.role??"overlay";if("source"===c)for(let[t,r]of this.bindings.entries())t!==e&&(r.role="overlay");this.bindings.set(e,{data:t,role:c,...l});let d=this.bindings.get(e);if(!d)throw Error(`Failed to bind rendering for ${e}`);let p=this.dataPresentation.get(e);return void 0!==p&&d.updateDataPresentation(p),d.applyViewState(this.viewState),this._debug.renderModes[e]=l.rendering.renderMode,this.viewportStatus=i.A.PRE_RENDER,this.render(),!0}removeAllData(){for(let e of Array.from(this.bindings.keys()))this.removeData(e)}setDataPresentationState(e,t){if(this.isDestroyed)return;this.dataPresentation.set(e,t);let r=this.bindings.get(e);r&&(r.updateDataPresentation(t),this.render())}getDataPresentationState(e){return this.dataPresentation.get(e)}setDefaultDataPresentation(e,t){let r={...t,...this.getDataPresentationState(e)||{}};return this.setDataPresentationState(e,r),r}mergeDataPresentation(e,t){let r={...this.getDataPresentationState(e)||{},...t};return this.setDataPresentationState(e,r),this.bindings.has(e)&&this.notifyDataPresentationModified(e,t),r}notifyDataPresentationModified(e,t){}normalizeViewState(e){return e}modified(e){!this.isDestroyed&&(this.forEachBinding(e=>{e.applyViewState(this.viewState)}),this.render(),e&&this.triggerCameraModifiedEvent(e))}getCameraForEvent(){return this.getResolvedView()?.toICamera()??this.getViewState()}triggerCameraModifiedEvent(e){let t={previousCamera:e,camera:this.getCameraForEvent(),element:this.element,viewportId:this.id,renderingEngineId:this.renderingEngineId};(0,a.A)(this.element,n.A.CAMERA_MODIFIED,t)}triggerCameraResetEvent(){let e={element:this.element,viewportId:this.id,camera:this.getCameraForEvent(),renderingEngineId:this.renderingEngineId};(0,a.A)(this.element,n.A.CAMERA_RESET,e)}getBinding(e){return this.bindings.get(e)}getDisplaySetRenderMode(e){return this.getBinding(e)?.rendering.renderMode}getDisplaySetRole(e){return this.getBinding(e)?.role}getFirstBinding(){return this.bindings.values().next().value}getSourceBinding(){for(let e of this.bindings.values())if("source"===e.role)return e;return this.getFirstBinding()}getCurrentBinding(){return this.getFirstBinding()}forEachBinding(e){for(let t of this.bindings.values())e(t)}getReferenceViewContexts(e){let t=[],r=this.getResolvedView(),n=r?.toICamera();for(let[e,i]of this.bindings.entries())t.push({dataId:e,dataIds:[i.data.id],frameOfReferenceUID:i.getFrameOfReferenceUID()??r?.getFrameOfReferenceUID()??this.getFrameOfReferenceUID(),cameraFocalPoint:n?.focalPoint,viewPlaneNormal:n?.viewPlaneNormal});return t.length||t.push({frameOfReferenceUID:this.getFrameOfReferenceUID(),cameraFocalPoint:n?.focalPoint,viewPlaneNormal:n?.viewPlaneNormal}),t}renderBindings(){if(this.isDestroyed)return!1;let e=!1;return this.forEachBinding(t=>{t.render?.(),e=e||!!t.render}),e}resizeBindings(){this.isDestroyed||this.forEachBinding(e=>{e.resize?.()})}destroyBindings(){for(let e of Array.from(this.bindings.keys()))this.removeData(e)}onDestroy(){}}let u=l},53772:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(50923);function i(e){let t=function(e){let t=n.vt(),r=e[0];for(let n=0,i=e.length;n{"use strict";r(42306),r(60212),r(40155)},54223:(e,t,r)=>{"use strict";var n=r(52575),i=r(41831);let a=new n.R("imageRetrievalPool");a.setMaxSimultaneousRequests(i.A.Interaction,200),a.setMaxSimultaneousRequests(i.A.Thumbnail,200),a.setMaxSimultaneousRequests(i.A.Prefetch,200),a.grabDelay=0},54261:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>v});var n=r(17042),i=r(11701),a=r(58804),o=r(21122),s={UNCHANGED:0,SINGLE_POINT:1,X_LINE:2,Y_LINE:3,Z_LINE:4,XY_PLANE:5,YZ_PLANE:6,XZ_PLANE:7,XYZ_GRID:8,EMPTY:9},l={StructuredType:s},{StructuredType:u}=l,c={getDataDescriptionFromExtent:function(e){let t=0;for(let r=0;r<3;++r)e[2*r]e[1]||e[2]>e[3]||e[4]>e[5]?u.EMPTY:3===t?u.XYZ_GRID:2===t?e[0]===e[1]?u.YZ_PLANE:e[2]===e[3]?u.XZ_PLANE:u.XY_PLANE:1===t?e[0]{if(t.deleted)return h("instance deleted - cannot call any method"),!1;let n=1===r.length?r[0]:r;if(6!==n.length)return!1;let i=t.extent.some((e,t)=>e!==n[t]);return i&&(t.extent=n.slice(),t.dataDescription=c.getDataDescriptionFromExtent(t.extent),e.modified()),i},e.setDimensions=(...r)=>{let n,i,a;if(t.deleted)return void h("instance deleted - cannot call any method");if(1===r.length){let e=r[0];n=e[0],i=e[1],a=e[2]}else{if(3!==r.length)return void h("Bad dimension specification");n=r[0],i=r[1],a=r[2]}e.setExtent(0,n-1,0,i-1,0,a-1)},e.getDimensions=()=>[t.extent[1]-t.extent[0]+1,t.extent[3]-t.extent[2]+1,t.extent[5]-t.extent[4]+1],e.getNumberOfCells=()=>{let t=e.getDimensions(),r=1;for(let e=0;e<3;e++){if(0===t[e])return 0;t[e]>1&&(r*=t[e]-1)}return r},e.getNumberOfPoints=()=>{let t=e.getDimensions();return t[0]*t[1]*t[2]},e.getPoint=r=>{let n=e.getDimensions();if(0===n[0]||0===n[1]||0===n[2])return h("Requesting a point from an empty image."),null;let i=new Float64Array(3);switch(t.dataDescription){case s.EMPTY:return null;case s.SINGLE_POINT:break;case s.X_LINE:i[0]=r;break;case s.Y_LINE:i[1]=r;break;case s.Z_LINE:i[2]=r;break;case s.XY_PLANE:i[0]=r%n[0],i[1]=r/n[0];break;case s.YZ_PLANE:i[1]=r%n[1],i[2]=r/n[1];break;case s.XZ_PLANE:i[0]=r%n[0],i[2]=r/n[0];break;case s.XYZ_GRID:i[0]=r%n[0],i[1]=r/n[0]%n[1],i[2]=r/(n[0]*n[1]);break;default:h("Invalid dataDescription")}let a=[0,0,0];return e.indexToWorld(i,a),a},e.getBounds=()=>e.extentToBounds(e.getSpatialExtent()),e.extentToBounds=e=>a.Ay.transformBounds(e,t.indexToWorld),e.getSpatialExtent=()=>a.Ay.inflate([...t.extent],.5),e.computeTransforms=()=>{d.fromTranslation(t.indexToWorld,t.origin),t.indexToWorld[0]=t.direction[0],t.indexToWorld[1]=t.direction[1],t.indexToWorld[2]=t.direction[2],t.indexToWorld[4]=t.direction[3],t.indexToWorld[5]=t.direction[4],t.indexToWorld[6]=t.direction[5],t.indexToWorld[8]=t.direction[6],t.indexToWorld[9]=t.direction[7],t.indexToWorld[10]=t.direction[8],d.scale(t.indexToWorld,t.indexToWorld,t.spacing),d.invert(t.worldToIndex,t.indexToWorld)},e.indexToWorld=(e,r=[])=>(p.Z0(r,e,t.indexToWorld),r),e.indexToWorldVec3=e.indexToWorld,e.worldToIndex=(e,r=[])=>(p.Z0(r,e,t.worldToIndex),r),e.worldToIndexVec3=e.worldToIndex,e.indexToWorldBounds=(e,r=[])=>a.Ay.transformBounds(e,t.indexToWorld,r),e.worldToIndexBounds=(e,r=[])=>a.Ay.transformBounds(e,t.worldToIndex,r),t._onOriginChanged=e.computeTransforms,t._onDirectionChanged=e.computeTransforms,t._onSpacingChanged=e.computeTransforms,e.computeTransforms(),e.getCenter=()=>a.Ay.getCenter(e.getBounds()),e.computeHistogram=(t,r=null)=>{let n=[0,0,0,0,0,0];e.worldToIndexBounds(t,n);let o=[0,0,0],s=[0,0,0];a.Ay.computeCornerPoints(n,o,s),(0,i.Md)(o,o),(0,i.Md)(s,s);let l=e.getDimensions();(0,i.LQ)(o,[0,0,0],[l[0]-1,l[1]-1,l[2]-1],o),(0,i.LQ)(s,[0,0,0],[l[0]-1,l[1]-1,l[2]-1],s);let u=l[0],c=l[0]*l[1],d=e.getPointData().getScalars().getData(),p=-1/0,m=1/0,h=0,f=0,g=0;for(let e=o[2];e<=s[2];e++)for(let t=o[1];t<=s[1];t++){let i=o[0]+t*u+e*c;for(let a=o[0];a<=s[0];a++){if(!r||r([a,t,e],n)){let e=d[i];e>p&&(p=e),e0?f/g:0,y=g?Math.abs(h/g-v*v):0;return{minimum:m,maximum:p,average:v,variance:y,sigma:Math.sqrt(y),count:g}},e.computeIncrements=(e,t=1)=>{let r=[],n=t;for(let t=0;t<3;++t)r[t]=n,n*=e[2*t+1]-e[2*t]+1;return r},e.computeOffsetIndex=([t,r,n])=>{let i=e.getExtent(),a=e.getPointData().getScalars().getNumberOfComponents(),o=e.computeIncrements(i,a);return Math.floor((Math.round(t)-i[0])*o[0]+(Math.round(r)-i[2])*o[1]+(Math.round(n)-i[4])*o[2])},e.getOffsetIndexFromWorld=t=>{let r=e.getExtent(),n=e.worldToIndex(t);for(let e=0;e<3;++e)if(n[e]r[2*e+1])return h(`GetScalarPointer: Pixel ${n} is not in memory. Current extent = ${r}`),NaN;return e.computeOffsetIndex(n)},e.getScalarValueFromWorld=(t,r=0)=>{let n=e.getPointData().getScalars().getNumberOfComponents();if(r<0||r>=n)return h(`GetScalarPointer: Scalar Component ${r} is not within bounds. Current Scalar numberOfComponents: ${n}`),NaN;let i=e.getOffsetIndexFromWorld(t);return Number.isNaN(i)?i:e.getPointData().getScalars().getComponent(i,r)};let l=e.initialize;e.initialize=()=>(e.set({direction:m.identity(t.direction),spacing:[1,1,1],origin:[0,0,0],extent:[0,-1,0,-1,0,-1],dataDescription:s.EMPTY}),l())}var v={newInstance:n.Ay.newInstance(g,"vtkImageData"),extend:g}},54268:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>c});var n=r(69228),i=r(62553),a=r(3922),o=r(76879),s=r(77280),l=r(28712);class u{constructor(){this._imageCache=new Map,this._volumeCache=new Map,this._imageIdsToVolumeIdCache=new Map,this._referencedImageIdToImageIdCache=new Map,this._geometryCache=new Map,this._imageCacheSize=0,this._maxCacheSize=0xc0000000,this._geometryCacheSize=0,this.setMaxCacheSize=e=>{if(!e||"number"!=typeof e)throw Error(`New max cacheSize ${this._maxCacheSize} should be defined and should be a number.`);this._maxCacheSize=e},this.isCacheable=e=>{let t=this.getBytesAvailable();return t+Array.from(this._imageCache.values()).reduce((e,t)=>t.sharedCacheKey?e:e+t.sizeInBytes,0)>=e},this.getMaxCacheSize=()=>this._maxCacheSize,this.getCacheSize=()=>this._imageCacheSize,this._decacheImage=(e,t=!1)=>{let r=this._imageCache.get(e);if(!r)return;if(r.sharedCacheKey&&!t)throw Error("Cannot decache an image with a shared cache key. You need to manually decache the volume first.");let{imageLoadObject:n}=r;r.image?.referencedImageId&&this._referencedImageIdToImageIdCache.delete(r.image.referencedImageId),n?.cancelFn&&n.cancelFn(),n?.decache&&n.decache(),this._imageCache.delete(e)},this._decacheVolume=e=>{let t=this._volumeCache.get(e);if(!t)return;let{volumeLoadObject:r,volume:n}=t;n&&(n.cancelLoading&&n.cancelLoading(),n.imageData&&n.imageData.delete(),r.cancelFn&&r.cancelFn(),n.imageIds&&n.imageIds.forEach(t=>{let r=this._imageCache.get(t);r&&r.sharedCacheKey===e&&(r.sharedCacheKey=void 0)}),this._volumeCache.delete(e))},this.purgeCache=()=>{let e=this._imageCache.keys();for(this.purgeVolumeCache();;){let{value:t,done:r}=e.next();if(r)break;this.removeImageLoadObject(t,{force:!0}),(0,n.A)(a.A,o.A.IMAGE_CACHE_IMAGE_REMOVED,{imageId:t})}},this.purgeVolumeCache=()=>{let e=this._volumeCache.keys();for(;;){let{value:t,done:r}=e.next();if(r)break;this.removeVolumeLoadObject(t),(0,n.A)(a.A,o.A.VOLUME_CACHE_VOLUME_REMOVED,{volumeId:t})}},this.getVolumeLoadObject=e=>{if(void 0===e)throw Error("getVolumeLoadObject: volumeId must not be undefined");let t=this._volumeCache.get(e);if(t)return t.timeStamp=Date.now(),t.volumeLoadObject},this.putGeometryLoadObject=(e,t)=>{if(void 0===e)throw Error("putGeometryLoadObject: geometryId must not be undefined");if(void 0===t.promise)throw Error("putGeometryLoadObject: geometryLoadObject.promise must not be undefined");if(this._geometryCache.has(e))throw Error("putGeometryLoadObject: geometryId already present in geometryCache");if(t.cancelFn&&"function"!=typeof t.cancelFn)throw Error("putGeometryLoadObject: geometryLoadObject.cancel must be a function");let r={loaded:!1,geometryId:e,geometryLoadObject:t,timeStamp:Date.now(),sizeInBytes:0};return this._geometryCache.set(e,r),t.promise.then(t=>{try{this._putGeometryCommon(e,t,r)}catch(t){throw console.debug(`Error in _putGeometryCommon for geometry ${e}:`,t),t}}).catch(t=>{throw console.debug(`Error caching geometry ${e}:`,t),this._geometryCache.delete(e),t})},this.getGeometry=e=>{if(void 0===e)throw Error("getGeometry: geometryId must not be undefined");let t=this._geometryCache.get(e);if(t)return t.timeStamp=Date.now(),t.geometry},this.removeGeometryLoadObject=e=>{if(void 0===e)throw Error("removeGeometryLoadObject: geometryId must not be undefined");let t=this._geometryCache.get(e);if(!t)throw Error("removeGeometryLoadObject: geometryId was not present in geometryCache");this.decrementGeometryCacheSize(t.sizeInBytes),(0,n.A)(a.A,o.A.GEOMETRY_CACHE_GEOMETRY_REMOVED,{geometry:t,geometryId:e}),this._decacheGeometry(e)},this._decacheGeometry=e=>{let t=this._geometryCache.get(e);if(!t)return;let{geometryLoadObject:r}=t;r.cancelFn&&r.cancelFn(),r.decache&&r.decache(),this._geometryCache.delete(e)},this.incrementGeometryCacheSize=e=>{this._geometryCacheSize+=e},this.decrementGeometryCacheSize=e=>{this._geometryCacheSize-=e},this.getImageByReferencedImageId=e=>{let t=this._referencedImageIdToImageIdCache.get(e);if(t)return this._imageCache.get(t)?.image},this.getImage=(e,t=s.FU.FAR_REPLICATE)=>{if(void 0===e)throw Error("getImage: imageId must not be undefined");let r=this._imageCache.get(e);if(r&&(r.timeStamp=Date.now(),!(r.image?.imageQualityStatus{if(void 0===e)throw Error("getVolume: volumeId must not be undefined");let r=this._volumeCache.get(e);return r?(r.timeStamp=Date.now(),r.volume):t?[...this._volumeCache.values()].find(t=>t.volumeId.includes(e))?.volume:void 0},this.getVolumes=()=>Array.from(this._volumeCache.values()).map(e=>e.volume),this.filterVolumesByReferenceId=e=>this.getVolumes().filter(t=>t.referencedVolumeId===e),this.removeImageLoadObject=(e,{force:t=!1}={})=>{if(void 0===e)throw Error("removeImageLoadObject: imageId must not be undefined");let r=this._imageCache.get(e);if(!r)throw Error("removeImageLoadObject: imageId was not present in imageCache");this._decacheImage(e,t),this.incrementImageCacheSize(-r.sizeInBytes),(0,n.A)(a.A,o.A.IMAGE_CACHE_IMAGE_REMOVED,{image:r,imageId:e})},this.removeVolumeLoadObject=e=>{if(void 0===e)throw Error("removeVolumeLoadObject: volumeId must not be undefined");let t=this._volumeCache.get(e);if(!t)throw Error("removeVolumeLoadObject: volumeId was not present in volumeCache");(0,n.A)(a.A,o.A.VOLUME_CACHE_VOLUME_REMOVED,{volume:t,volumeId:e}),this._decacheVolume(e)},this.incrementImageCacheSize=e=>{this._imageCacheSize+=e},this.decrementImageCacheSize=e=>{this._imageCacheSize-=e},this.getGeometryLoadObject=e=>{if(void 0===e)throw Error("getGeometryLoadObject: geometryId must not be undefined");let t=this._geometryCache.get(e);if(t)return t.timeStamp=Date.now(),t.geometryLoadObject}}generateVolumeId(e){let t=e.map(i.A).sort(),r=0x811c9dc5;for(let e of t){let t=(0,l.A)(e);for(let e=0;e>>0).toString(36)}`}getImageIdsForVolumeId(e){return Array.from(this._imageIdsToVolumeIdCache.entries()).filter(([t,r])=>r===e).map(([e])=>e)}getBytesAvailable(){return this.getMaxCacheSize()-this.getCacheSize()}decacheIfNecessaryUntilBytesAvailable(e,t){let r=this.getBytesAvailable();if(r>=e)return r;let i=Array.from(this._imageCache.values()).filter(e=>!e.sharedCacheKey);i.sort(function(e,t){return e.timeStamp>t.timeStamp?1:e.timeStampe.imageId),l=s;for(let i of(t&&(l=s.filter(e=>!t.includes(e))),l))if(this.removeImageLoadObject(i),(0,n.A)(a.A,o.A.IMAGE_CACHE_IMAGE_REMOVED,{imageId:i}),(r=this.getBytesAvailable())>=e)return r;for(let t of s)if(this.removeImageLoadObject(t),(0,n.A)(a.A,o.A.IMAGE_CACHE_IMAGE_REMOVED,{imageId:t}),(r=this.getBytesAvailable())>=e)return r}_putImageCommon(e,t,r){if(!this._imageCache.has(e))return void console.warn("The image was purged from the cache before it completed loading.");if(!t)return void console.warn("Image is undefined");if(void 0===t.sizeInBytes||Number.isNaN(t.sizeInBytes))throw Error("_putImageCommon: image.sizeInBytes must not be undefined");if(void 0===t.sizeInBytes.toFixed)throw Error("_putImageCommon: image.sizeInBytes is not a number");if(!this.isCacheable(t.sizeInBytes))throw Error(o.A.CACHE_SIZE_EXCEEDED);this.decacheIfNecessaryUntilBytesAvailable(t.sizeInBytes),r.loaded=!0,r.image=t,r.sizeInBytes=t.sizeInBytes,this.incrementImageCacheSize(r.sizeInBytes),t.referencedImageId&&this._referencedImageIdToImageIdCache.set(t.referencedImageId,e),(0,n.A)(a.A,o.A.IMAGE_CACHE_IMAGE_ADDED,{image:r}),r.sharedCacheKey=t.sharedCacheKey}async putImageLoadObject(e,t){if(void 0===e)throw console.error("putImageLoadObject: imageId must not be undefined"),Error("putImageLoadObject: imageId must not be undefined");if(void 0===t.promise)throw console.error("putImageLoadObject: imageLoadObject.promise must not be undefined"),Error("putImageLoadObject: imageLoadObject.promise must not be undefined");let r=this._imageCache.get(e);if(r?.imageLoadObject)throw console.warn(`putImageLoadObject: imageId ${e} already in cache`),Error("putImageLoadObject: imageId already in cache");if(t.cancelFn&&"function"!=typeof t.cancelFn)throw console.error("putImageLoadObject: imageLoadObject.cancel must be a function"),Error("putImageLoadObject: imageLoadObject.cancel must be a function");let n={...r,loaded:!1,imageId:e,sharedCacheKey:void 0,imageLoadObject:t,timeStamp:Date.now(),sizeInBytes:0};return this._imageCache.set(e,n),t.promise.then(t=>{try{this._putImageCommon(e,t,n)}catch(t){throw console.debug(`Error in _putImageCommon for image ${e}:`,t),t}}).catch(t=>{throw console.debug(`Error caching image ${e}:`,t),this._imageCache.delete(e),t})}putImageSync(e,t){if(void 0===e)throw Error("putImageSync: imageId must not be undefined");if(this._imageCache.has(e))throw Error("putImageSync: imageId already in cache");let r={loaded:!1,imageId:e,sharedCacheKey:void 0,imageLoadObject:{promise:Promise.resolve(t)},timeStamp:Date.now(),sizeInBytes:0};this._imageCache.set(e,r);try{this._putImageCommon(e,t,r)}catch(t){throw this._imageCache.delete(e),t}}getImageLoadObject(e){if(void 0===e)throw Error("getImageLoadObject: imageId must not be undefined");let t=this._imageCache.get(e);if(t)return t.timeStamp=Date.now(),t.imageLoadObject}isLoaded(e){let t=this._imageCache.get(e);return!!t&&t.loaded}getVolumeContainingImageId(e){let t=Array.from(this._volumeCache.keys()),r=(0,i.A)(e);for(let e of t){let t=this._volumeCache.get(e);if(!t)return;let{volume:n}=t;if(!n.imageIds.length)return;let i=n.getImageURIIndex(r);if(i>-1)return{volume:n,imageIdIndex:i}}}getCachedImageBasedOnImageURI(e){let t=(0,i.A)(e),r=Array.from(this._imageCache.keys()).find(e=>(0,i.A)(e)===t);if(r)return this._imageCache.get(r)}_putVolumeCommon(e,t,r){if(!this._volumeCache.get(e))return void console.warn("The volume was purged from the cache before it completed loading.");r.loaded=!0,r.volume=t,t.imageIds?.forEach(t=>{let r=this._imageCache.get(t);r&&(r.sharedCacheKey=e)}),(0,n.A)(a.A,o.A.VOLUME_CACHE_VOLUME_ADDED,{volume:r})}putVolumeSync(e,t){if(void 0===e)throw Error("putVolumeSync: volumeId must not be undefined");if(this._volumeCache.has(e))throw Error("putVolumeSync: volumeId already in cache");let r={loaded:!1,volumeId:e,volumeLoadObject:{promise:Promise.resolve(t)},timeStamp:Date.now(),sizeInBytes:0};this._volumeCache.set(e,r);try{this._putVolumeCommon(e,t,r)}catch(t){throw this._volumeCache.delete(e),t}}async putVolumeLoadObject(e,t){if(void 0===e)throw Error("putVolumeLoadObject: volumeId must not be undefined");if(void 0===t.promise)throw Error("putVolumeLoadObject: volumeLoadObject.promise must not be undefined");if(this._volumeCache.has(e))throw Error(`putVolumeLoadObject: volumeId:${e} already in cache`);if(t.cancelFn&&"function"!=typeof t.cancelFn)throw Error("putVolumeLoadObject: volumeLoadObject.cancel must be a function");let r={loaded:!1,volumeId:e,volumeLoadObject:t,timeStamp:Date.now(),sizeInBytes:0};return this._volumeCache.set(e,r),t.promise.then(t=>{try{this._putVolumeCommon(e,t,r)}catch(t){throw console.error(`Error in _putVolumeCommon for volume ${e}:`,t),this._volumeCache.delete(e),t}}).catch(t=>{throw this._volumeCache.delete(e),t})}_putGeometryCommon(e,t,r){if(!this._geometryCache.get(e))return void console.warn("The geometry was purged from the cache before it completed loading.");if(!t)return void console.warn("Geometry is undefined");if(void 0===t.sizeInBytes||Number.isNaN(t.sizeInBytes))throw Error("_putGeometryCommon: geometry.sizeInBytes must not be undefined");if(void 0===t.sizeInBytes.toFixed)throw Error("_putGeometryCommon: geometry.sizeInBytes is not a number");if(!this.isCacheable(t.sizeInBytes))throw Error(o.A.CACHE_SIZE_EXCEEDED);this.decacheIfNecessaryUntilBytesAvailable(t.sizeInBytes),r.loaded=!0,r.geometry=t,r.sizeInBytes=t.sizeInBytes,this.incrementGeometryCacheSize(r.sizeInBytes),(0,n.A)(a.A,o.A.GEOMETRY_CACHE_GEOMETRY_ADDED,{geometry:r})}putGeometrySync(e,t){if(void 0===e)throw Error("putGeometrySync: geometryId must not be undefined");if(this._geometryCache.has(e))throw Error("putGeometrySync: geometryId already in cache");let r={loaded:!1,geometryId:e,geometryLoadObject:{promise:Promise.resolve(t)},timeStamp:Date.now(),sizeInBytes:0};this._geometryCache.set(e,r);try{this._putGeometryCommon(e,t,r)}catch(t){throw this._geometryCache.delete(e),t}}setPartialImage(e,t,r=!1){let n=this._imageCache.get(e);if(!n){t&&this._imageCache.set(e,{image:t,imageId:e,loaded:!1,timeStamp:Date.now(),sizeInBytes:0});return}n.loaded?(n.loaded=!1,n.imageLoadObject=null,this.incrementImageCacheSize(-n.sizeInBytes),n.sizeInBytes=0):r&&(n.imageLoadObject=null),n.image=t||n.image}getImageQuality(e){let t=this._imageCache.get(e)?.image;return t?t.imageQualityStatus||s.FU.FULL_RESOLUTION:void 0}}let c=new u},54562:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(19431);function i(e,t=.1){let r=e.length;if(r<3)return e;let a=t*t,o=[[0,r-1]],s=Array(r).fill(!1),l=2;for(s[0]=!0,s[r-1]=!0;o.length;){let[t,r]=o.pop();if(r-t==1)continue;let i=e[t],u=e[r],c=-1/0,d=-1;for(let a=t+1;ac&&(c=r,d=a)}c{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.xml_isName=function(e){for(let t=0;t=97)||!(r<=122))&&(!(r>=65)||!(r<=90))&&58!==r&&95!==r&&(!(r>=192)||!(r<=214))&&(!(r>=216)||!(r<=246))&&(!(r>=248)||!(r<=767))&&(!(r>=880)||!(r<=893))&&(!(r>=895)||!(r<=8191))&&(!(r>=8204)||!(r<=8205))&&(!(r>=8304)||!(r<=8591))&&(!(r>=11264)||!(r<=12271))&&(!(r>=12289)||!(r<=55295))&&(!(r>=63744)||!(r<=64975))&&(!(r>=65008)||!(r<=65533))){if(0===t||45!==r&&46!==r&&(!(r>=48)||!(r<=57))&&183!==r&&(!(r>=768)||!(r<=879))&&(!(r>=8255)||!(r<=8256))){if(r>=55296&&r<=56319&&t=56320&&n<=57343&&(r=(r-55296)*1024+n-56320+65536,t++,r>=65536&&r<=983039))continue}return!1}}}return!0},t.xml_isQName=function(e){let t=!1;for(let r=0;r=97)||!(n<=122))&&(!(n>=65)||!(n<=90))&&95!==n&&(!(n>=192)||!(n<=214))&&(!(n>=216)||!(n<=246))&&(!(n>=248)||!(n<=767))&&(!(n>=880)||!(n<=893))&&(!(n>=895)||!(n<=8191))&&(!(n>=8204)||!(n<=8205))&&(!(n>=8304)||!(n<=8591))&&(!(n>=11264)||!(n<=12271))&&(!(n>=12289)||!(n<=55295))&&(!(n>=63744)||!(n<=64975))&&(!(n>=65008)||!(n<=65533))){if(0!==r&&(45===n||46===n||n>=48&&n<=57||183===n||n>=768&&n<=879||n>=8255&&n<=8256))continue;if(0!==r&&58===n){if(t||r===e.length-1)return!1;t=!0;continue}if(n>=55296&&n<=56319&&r=56320&&t<=57343&&(n=(n-55296)*1024+t-56320+65536,r++,n>=65536&&n<=983039))continue}return!1}}return!0},t.xml_isLegalChar=function(e){for(let t=0;t=32)||!(r<=55295))&&(!(r>=57344)||!(r<=65533))){if(r>=55296&&r<=56319&&t=56320&&n<=57343&&(r=(r-55296)*1024+n-56320+65536,t++,r>=65536&&r<=1114111))continue}return!1}}return!0},t.xml_isPubidChar=function(e){for(let t=0;t=97)||!(r<=122))&&(!(r>=65)||!(r<=90))&&(!(r>=39)||!(r<=59))&&32!==r&&13!==r&&10!==r&&(!(r>=35)||!(r<=37))&&33!==r&&61!==r&&63!==r&&64!==r&&95!==r)return!1}return!0}},54620:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CustomEventImpl=void 0;let n=r(48629),i=r(47518);class a extends n.EventImpl{_detail=null;constructor(e,t){super(e,t),this._detail=t&&t.detail||null}get detail(){return this._detail}initCustomEvent(e,t=!1,r=!1,n=null){this._dispatchFlag||((0,i.event_initialize)(this,e,t,r),this._detail=n)}}t.CustomEventImpl=a},54731:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>c});var n=r(17042),i=r(58804),a=r(10355),o=r(7033),{BlendMode:s}=r(23985).A,l=["getAnisotropy","getComputeNormalFromOpacity","getFilterMode","getFilterModeAsString","getGlobalIlluminationReach","getIpScalarRange","getIpScalarRangeByReference","getLAOKernelRadius","getLAOKernelSize","getLocalAmbientOcclusion","getPreferSizeOverAccuracy","getVolumetricScatteringBlending","setAnisotropy","setAverageIPScalarRange","setComputeNormalFromOpacity","setFilterMode","setFilterModeToNormalized","setFilterModeToOff","setFilterModeToRaw","setGlobalIlluminationReach","setIpScalarRange","setIpScalarRangeFrom","setLAOKernelRadius","setLAOKernelSize","setLocalAmbientOcclusion","setPreferSizeOverAccuracy","setVolumetricScatteringBlending"];function u(e,t,r={}){Object.assign(t,{bounds:[...i.Ay.INIT_BOUNDS],sampleDistance:1,imageSampleDistance:1,maximumSamplesPerRay:1e3,autoAdjustSampleDistances:!0,initialInteractionScale:1,interactionSampleDistanceFactor:1,blendMode:s.COMPOSITE_BLEND,volumeShadowSamplingDistFactor:5,colorTextureWidth:1024,opacityTextureWidth:1024,labelOutlineTextureWidth:1024,...r}),o.A.extend(e,t,r),n.Ay.setGet(e,t,["sampleDistance","imageSampleDistance","maximumSamplesPerRay","autoAdjustSampleDistances","initialInteractionScale","interactionSampleDistanceFactor","blendMode","volumeShadowSamplingDistFactor","colorTextureWidth","opacityTextureWidth","labelOutlineTextureWidth"]),n.Ay.event(e,t,"lightingActivated");t.classHierarchy.push("vtkVolumeMapper");let a={...e};e.computeBounds=()=>{let r=e.getInputData();if(!r)return void i.Ay.reset(t.bounds);t.static||e.update(),i.Ay.setBounds(t.bounds,r.getBounds())},e.setBlendModeToComposite=()=>{e.setBlendMode(s.COMPOSITE_BLEND)},e.setBlendModeToMaximumIntensity=()=>{e.setBlendMode(s.MAXIMUM_INTENSITY_BLEND)},e.setBlendModeToMinimumIntensity=()=>{e.setBlendMode(s.MINIMUM_INTENSITY_BLEND)},e.setBlendModeToAverageIntensity=()=>{e.setBlendMode(s.AVERAGE_INTENSITY_BLEND)},e.setBlendModeToAdditiveIntensity=()=>{e.setBlendMode(s.ADDITIVE_INTENSITY_BLEND)},e.setBlendModeToRadonTransform=()=>{e.setBlendMode(s.RADON_TRANSFORM_BLEND)},e.getBlendModeAsString=()=>n.Ay.enumToString(s,t.blendMode),e.setVolumeShadowSamplingDistFactor=e=>a.setVolumeShadowSamplingDistFactor(e>=1?e:1),l.forEach(t=>{e[t]=()=>{throw Error(`The method "volumeMapper.${t}()" doesn't exist anymore. It is a rendering property that has been moved to the volume property. Replace your code with: +volumeActor.getProperty().${t}() +`)}})}var c={newInstance:n.Ay.newInstance(u,"vtkVolumeMapper"),extend:u,...{createRadonTransferFunction:function(e,t,r,n,i){let o=null;return i?(o=i).removeAllPoints():o=a.Ay.newInstance(),o.addPointLong(-1024,0,1,1),o.addPoint(e,t),o.addPoint(r,n),o}}}},54763:(e,t,r)=>{"use strict";r.d(t,{c:()=>a});var n=r(39935),i=r(6297);class a{async load(e){let t=(0,i._d)(e),{waveform:r}=await (0,n.loadECGWaveform)(t);return{id:e,type:"ecg",...r}}}},54878:(e,t,r)=>{"use strict";r.d(t,{v:()=>c,J:()=>d});var n=r(7286),i=r(77280),a=r(69228),o=r(24433);let s="postrender";class l{async addData(e,t,r){let n=await (0,o.getDicomMicroscopyViewer)(),l=document.createElement("div");l.setAttribute("class","DicomMicroscopyViewer"),l.style.background="black",l.style.width="100%",l.style.height="100%",l.style.position="absolute",l.style.left="0",l.style.top="0",e.element.appendChild(l);let u=new n.viewer.VolumeImageViewer({client:t.client,metadata:t.volumeImages,controls:["overview","position"],retrieveRendered:!1,bindings:{}});u.render({container:l}),u.deactivateDragPanInteraction();let c=u.getMap(),d=()=>{(0,a.A)(e.element,i.sV.IMAGE_RENDERED,{element:e.element,viewportId:e.viewportId,renderingEngineId:e.renderingEngineId,rendering:{dataId:t.id,renderMode:"wsi2d"}})};c.on(s,d),Object.assign(l.style,{"--ol-partial-background-color":"rgba(127, 127, 127, 0.7)","--ol-foreground-color":"#000000","--ol-subtle-foreground-color":"#000","--ol-subtle-background-color":"rgba(78, 78, 78, 0.5)",background:"none"});let p={renderMode:"wsi2d",microscopyElement:l,viewer:u,map:c,transformUtils:n.utils,postrenderHandler:d};return{rendering:p,updateDataPresentation:e=>{this.updateDataPresentation(p,e)},applyViewState:e=>{this.applyViewState(p,e)},getFrameOfReferenceUID:()=>this.getFrameOfReferenceUID(t),render:()=>{c.render?.()},resize:()=>{c.updateSize?.(),c.render?.()},removeData:()=>{this.removeData(p)}}}updateDataPresentation(e,t){let{microscopyElement:r}=e;r.style.display=t?.visible===!1?"none":"",r.style.opacity=String(t?.opacity??1)}applyViewState(e,t){let{map:r}=e,n=r?.getView?.();n&&("number"==typeof t.resolution&&n.setResolution?.(t.resolution),"number"==typeof t.zoom&&n.setZoom(t.zoom),t.centerIndex&&n.setCenter(t.centerIndex),"number"==typeof t.rotation&&n.setRotation(t.rotation))}getFrameOfReferenceUID(e){return e.frameOfReferenceUID??void 0}removeData(e){let{map:t,microscopyElement:r,viewer:n,postrenderHandler:i}=e;t?.un?.(s,i),n?.cleanup?.(),r.remove()}}class u{constructor(){this.id="wsi:dicom-microscopy-viewer",this.type=i.NV.WHOLE_SLIDE_NEXT}matches(e,t){return"wsi"===e.type&&"wsi2d"===t.renderMode}createRenderPath(){return new l}}function c(){return[new u]}function d(e=c()){return new n.r(e)}},54914:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>d});var n=r(17042),i=r(11701),a=r(58804),o=r(34967),s=r(49963),l=r(85250),u={bounds:[...a.Ay.INIT_BOUNDS],origin:[0,0,0],position:[0,0,0],orientation:[0,0,0],rotation:null,scale:[1,1,1],properties:[],userMatrix:null,userMatrixMTime:null,cachedProp3D:null,isIdentity:!0,matrixMTime:null};function c(e,t,r={}){Object.assign(t,u,r),o.Ay.extend(e,t,r),t.matrixMTime={},n.Ay.obj(t.matrixMTime),n.Ay.get(e,t,["isIdentity"]),n.Ay.getArray(e,t,["orientation"]),n.Ay.setGetArray(e,t,["origin","position","scale"],3),n.Ay.setGet(e,t,["properties"]),n.Ay.getArray(e,t,["bounds"],6),t.matrix=l.identity(new Float64Array(16)),t.rotation=l.identity(new Float64Array(16)),t.userMatrix=l.identity(new Float64Array(16)),t.transform=null;t.classHierarchy.push("vtkProp3D"),e.addPosition=r=>{t.position=t.position.map((e,t)=>e+r[t]),e.modified()},e.getOrientationWXYZ=()=>{let e=s.vt();l.getRotation(e,t.rotation);let r=new Float64Array(3);return[(0,i.WK)(s.Xd(r,e)),r[0],r[1],r[2]]},e.getOrientationQuaternion=(e=[])=>l.getRotation(e,t.rotation),e.rotateX=r=>{0!==r&&(l.rotateX(t.rotation,t.rotation,(0,i.el)(r)),e.modified())},e.rotateY=r=>{0!==r&&(l.rotateY(t.rotation,t.rotation,(0,i.el)(r)),e.modified())},e.rotateZ=r=>{0!==r&&(l.rotateZ(t.rotation,t.rotation,(0,i.el)(r)),e.modified())},e.rotateWXYZ=(r,n,a,o)=>{if(0===r||0===n&&0===a&&0===o)return;let u=(0,i.el)(r),c=s.vt();s.x8(c,[n,a,o],u);let d=new Float64Array(16);l.fromQuat(d,c),l.multiply(t.rotation,t.rotation,d),e.modified()},e.rotateQuaternion=r=>{if(Math.abs(r[3])>=.999999)return;let n=l.fromQuat(new Float64Array(16),r);l.multiply(t.rotation,t.rotation,n),e.modified()},e.setOrientation=(r,n,i)=>(r!==t.orientation[0]||n!==t.orientation[1]||i!==t.orientation[2])&&(t.orientation=[r,n,i],l.identity(t.rotation),e.rotateZ(i),e.rotateX(r),e.rotateY(n),e.modified(),!0),e.setOrientationFromQuaternion=r=>{let n=l.create();return l.fromQuat(n,r),!(0,i.nY)(n,t.rotation)&&(t.rotation=n,e.modified(),!0)},e.setUserMatrix=r=>!(0,i.nY)(t.userMatrix,r)&&(l.copy(t.userMatrix,r),e.modified(),!0),e.getMatrix=()=>(e.computeMatrix(),t.matrix),e.computeMatrix=()=>{if(e.getMTime()>t.matrixMTime.getMTime()){l.identity(t.matrix),t.userMatrix&&l.multiply(t.matrix,t.matrix,t.userMatrix),l.translate(t.matrix,t.matrix,t.origin),l.translate(t.matrix,t.matrix,t.position),l.multiply(t.matrix,t.matrix,t.rotation),l.scale(t.matrix,t.matrix,t.scale),l.translate(t.matrix,t.matrix,[-t.origin[0],-t.origin[1],-t.origin[2]]),l.transpose(t.matrix,t.matrix),t.isIdentity=!0;for(let e=0;e<4;++e)for(let r=0;r<4;++r)+(e===r)!==t.matrix[e+4*r]&&(t.isIdentity=!1);t.matrixMTime.modified()}},e.computeBounds=()=>{if(null===t.mapper)return void a.Ay.reset(t.bounds);let r=t.mapper.getBounds();if(!r||6!==r.length||!a.Ay.isValid(r)){t.mapperBounds=r,a.Ay.reset(t.bounds),t.boundsMTime.modified();return}if(!t.mapperBounds||!r.every((e,n)=>r[n]===t.mapperBounds[n])||e.getMTime()>t.boundsMTime.getMTime()){n.Ay.vtkDebugMacro("Recomputing bounds..."),t.mapperBounds=r,e.computeMatrix();let i=new Float64Array(16);l.transpose(i,t.matrix),a.Ay.transformBounds(r,i,t.bounds),t.boundsMTime.modified()}};let d=e.getBounds;e.getBounds=()=>(e.computeBounds(),d());let p=e.getBoundsByReference;e.getBoundsByReference=()=>(e.computeBounds(),p()),e.getCenter=()=>a.Ay.getCenter(e.getBoundsByReference()),e.getLength=()=>a.Ay.getLength(e.getBoundsByReference()),e.getXRange=()=>a.Ay.getXRange(e.getBoundsByReference()),e.getYRange=()=>a.Ay.getYRange(e.getBoundsByReference()),e.getZRange=()=>a.Ay.getZRange(e.getBoundsByReference()),e.getUserMatrix=()=>t.userMatrix,e.onModified(function(){e.computeMatrix()}),e.getProperty=(r=0)=>(null==t.properties[r]&&(t.properties[r]=e.makeProperty?.()),t.properties[r]),e.getProperties=()=>(0===t.properties.length&&(t.properties[0]=e.makeProperty?.()),t.properties),e.setProperty=(e,r)=>{let[n,i]=Number.isInteger(e)?[e,r]:[0,e];return t.properties[n]!==i&&(t.properties[n]=i,!0)},e.getMTime=()=>{let e=t.mtime;return t.properties.forEach(t=>{if(null!==t){let r=t.getMTime();e=r>e?r:e}}),e}}var d={newInstance:n.Ay.newInstance(c,"vtkProp3D"),extend:c}},55146:(e,t,r)=>{"use strict";r.r(t),r.d(t,{distanceToPoint:()=>n.A,distanceToPointSquared:()=>i.A,mirror:()=>a});var n=r(20644),i=r(27501);function a(e,t){let[r,n]=e,[i,a]=t;return[2*i-r,2*a-n]}},55158:(e,t,r)=>{"use strict";r(70192);var n=r(90174);r(78378),r(760),r(23537),r(5800);let{Labelmap:i}=n.A},55285:function(e,t,r){var n;!function(e,i,a){function o(e){var t=this,r="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:r+=e;for(var n=0;n>>0)/0x100000000};return i.double=function(){do var e=((r.next()>>>11)+(r.next()>>>0)/0x100000000)/2097152;while(0===e);return e},i.int32=r.next,i.quick=i,n&&("object"==typeof n&&s(n,r),i.state=function(){return s(r,{})}),i}i&&i.exports?i.exports=l:r.amdD&&r.amdO?void 0===(n=(function(){return l}).call(t,r,t,i))||(i.exports=n):this.xor128=l}(0,e=r.nmd(e),r.amdD)},55291:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=e=>!!(e.preScale?.scaled&&e.preScale?.scalingParameters?.suvbw)},55540:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>u});var n=r(17042),i=r(53038),{BufferUsage:a}=r(44238).Ay,{vtkErrorMacro:o}=n.Ay,s={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,numberOfInstances:1};function l(e,t,r={}){Object.assign(t,s,r),n.Ay.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t._sendTime={},n.Ay.obj(t._sendTime,{mtime:0}),t.bindGroupTime={},n.Ay.obj(t.bindGroupTime,{mtime:0}),t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"read-only-storage"}},n.Ay.get(e,t,["bindGroupTime"]),n.Ay.setGet(e,t,["device","bindGroupLayoutEntry","label","numberOfInstances","sizeInBytes"]);function u(r){if(t._buffer)return;e.createView("Float32Array");let n={nativeArray:t.Float32Array,usage:a.Storage,label:t.label};t._buffer=r.getBufferManager().getBuffer(n),t.bindGroupTime.modified()}t.classHierarchy.push("vtkWebGPUStorageBuffer"),e.addEntry=(e,r)=>{if(t._bufferEntryNames.has(e))return void o(`entry named ${e} already exists`);t._bufferEntryNames.set(e,t.bufferEntries.length);let n=i.A.getByteStrideFromShaderFormat(r);t.bufferEntries.push({name:e,type:r,sizeInBytes:n,offset:t.sizeInBytes,nativeType:i.A.getNativeTypeFromShaderFormat(r)}),t.sizeInBytes+=n},e.send=e=>{if(t.device=e,!t._buffer){u(e),t._sendTime.modified();return}e.getHandle().queue.writeBuffer(t._buffer.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes*t.numberOfInstances),t._sendTime.modified()},e.createView=e=>{e in t==!1&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes*t.numberOfInstances)),t[e]=n.Ay.newTypedArray(e,t.arrayBuffer))},e.setValue=(r,n,i)=>{let a=t._bufferEntryNames.get(r);if(void 0===a)return void o(`entry named ${r} not found in UBO`);let s=t.bufferEntries[a];e.createView(s.nativeType);let l=t[s.nativeType];l[(s.offset+n*t.sizeInBytes)/l.BYTES_PER_ELEMENT]=i},e.setArray=(r,n,i)=>{let a=t._bufferEntryNames.get(r);if(void 0===a)return void o(`entry named ${r} not found in UBO`);let s=t.bufferEntries[a];e.createView(s.nativeType);let l=t[s.nativeType],u=(s.offset+n*t.sizeInBytes)/l.BYTES_PER_ELEMENT;for(let e=0;e{let i=t._bufferEntryNames.get(r);if(void 0===i)return void o(`entry named ${r} not found in UBO`);let a=t.bufferEntries[i];e.createView(a.nativeType);let s=t[a.nativeType],l=n.length/t.numberOfInstances;for(let e=0;e{let i=t._bufferEntryNames.get(r);if(void 0===i)return void o(`entry named ${r} not found in UBO`);let a=t.bufferEntries[i];e.createView(a.nativeType);let s=t[a.nativeType],l=n.length/t.numberOfInstances;for(let e=0;e{let i=t._bufferEntryNames.get(r);if(void 0===i)return void o(`entry named ${r} not found in UBO`);let a=t.bufferEntries[i];e.createView(a.nativeType);let s=t[a.nativeType];for(let e=0;et._sendTime.getMTime(),e.getShaderCode=(e,r)=>{let n=[`struct ${t.label}StructEntry +{`];for(let e=0;e, +}; +@binding(${e}) @group(${r}) var ${t.label}: ${t.label}Struct; +`),n.join("\n")},e.getBindGroupEntry=()=>(!t._buffer&&t.device&&u(t.device),{resource:{buffer:t._buffer.getHandle()}}),e.clearData=()=>{t.numberOfInstances=0,t.sizeInBytes=0,t.bufferEntries=[],t._bufferEntryNames=new Map,t._buffer=null,delete t.arrayBuffer,delete t.Float32Array},e.releaseGraphicsResources=()=>{t._buffer=null,t.bindGroupTime.modified()}}var u={newInstance:n.Ay.newInstance(l,"vtkWebGPUStorageBuffer"),extend:l}},55580:(e,t,r)=>{"use strict";r.d(t,{A:()=>S,G:()=>T});var n=r(48185),i=r(11701),a=r(22783),o=r(50923),s=r(91336),l=r(76879),u=r(17774),c=r(56872),d=r(73502),p=r(50987),m=r(69228),h=r(23668),f=r(88824),g=r(18695),v=r(79267),y=r(77280),b=r(21483),I=r(73265),x=r(37995),C=r(42215);class A{constructor(e){this.insetImageMultiplier=(0,C.D0)().rendering?.useLegacyCameraFOV?1.1:1,this.flipHorizontal=!1,this.flipVertical=!1,this.viewportStatus=u.A.NO_DATA,this._displaySets=[],this._suppressCameraModifiedEvents=!1,this.hasPixelSpacing=!0,this.getProperties=()=>({}),this.setRotation=e=>{},this.viewportWidgets=new Map,this.addWidget=(e,t)=>{this.viewportWidgets.set(e,t)},this.getWidget=e=>this.viewportWidgets.get(e),this.getWidgets=()=>Array.from(this.viewportWidgets.values()),this.getRenderPasses=()=>null,this.removeWidgets=()=>{this.getWidgets().forEach(e=>{if(e.getEnabled()&&e.setEnabled(!1),e.getActor&&e.getRenderer){let t=e.getActor(),r=e.getRenderer();r&&t&&r.removeActor(t)}})},this.id=e.id,this.renderingEngineId=e.renderingEngineId,this.type=e.type,this.element=e.element,this.canvas=e.canvas,this.sx=e.sx,this.sy=e.sy,this.sWidth=e.sWidth,this.sHeight=e.sHeight,this._actors=new Map,this.element.setAttribute("data-viewport-uid",this.id),this.element.setAttribute("data-rendering-engine-uid",this.renderingEngineId),this.defaultOptions=(0,b.G)(e.defaultOptions),this.suppressEvents=!!e.defaultOptions.suppressEvents&&e.defaultOptions.suppressEvents,this.options=(0,b.G)(e.defaultOptions),this.isDisabled=!1}static get useCustomRenderingPipeline(){return!1}getUseCustomRenderingPipeline(){return this.constructor.useCustomRenderingPipeline}resizeForRenderingEngine({keepCamera:e=!0}={}){"function"==typeof this.resize&&this.resize();let t=e?this.getCamera():void 0;this.resetCamera(),t&&this.setCamera(t)}isOrientationChangeable(){return!1}dispose(){}destroy(){this.dispose()}setRendered(){this.viewportStatus!==u.A.NO_DATA&&this.viewportStatus!==u.A.LOADING&&(this.viewportStatus=u.A.RENDERED)}setNeedsRender(){this.viewportStatus=u.A.NEEDS_RENDER}setColorTransform(e,t){if(!e&&!t)return;let r=t||[255,255,255],n=Math.max(...r),i=r.map(e=>n/e),{lower:a=0,upper:o=255}=e||{},s=(o-a+1)/255,l=a/255;return`url('data:image/svg+xml,\ + \ + \ + \ + \ + #colour')`}getRenderingEngine(){return d.A.get(this.renderingEngineId)}getRenderer(){let e=this.getRenderingEngine();if(!e||e.hasBeenDestroyed)throw Error("Rendering engine has been destroyed");return e.offscreenMultiRenderWindow?.getRenderer(this.id)}render(){this.getRenderingEngine().renderViewport(this.id)}setOptions(e,t=!1){this.options=(0,b.G)(e),this.options?.displayArea&&this.setDisplayArea(this.options?.displayArea),t&&this.render()}reset(e=!1){this.options=(0,b.G)(this.defaultOptions),e&&this.render()}getSliceViewInfo(){throw Error("Method not implemented.")}flip({flipHorizontal:e,flipVertical:t}){let r=this.getDefaultImageData();if(!r)return;let n=this.getCamera(),{viewPlaneNormal:i,viewUp:a,focalPoint:s,position:l}=n,u=o.$A(o.vt(),i,a),c=o.C(o.vt(),a),d=o.ze(o.vt(),i),p=o.Io(l,s),m=T(r.getDimensions(),r.getDirection(),i),h=[m[0],m[1],m[2]],f=r.indexToWorld(h,o.vt()),g=this._getFocalPointForResetCamera(f,n,{resetPan:!0,resetToCenter:!1}),v=o.Re(o.vt(),s,g),y=o.Bw(v),b=e=>{let t=o.hs(o.vt(),e,2*o.Om(v,e));return o.Re(t,t,v),o.S8(t,t),t};if(e){let e=b(c),t=o.Ln(o.vt(),g,e,y),r=o.Ln(o.vt(),t,d,p);this.setCamera({viewPlaneNormal:d,position:r,focalPoint:t}),this.flipHorizontal=!this.flipHorizontal}if(t){c=o.ze(c,a);let e=b(u),t=o.Ln(o.vt(),g,e,y),r=o.Ln(o.vt(),t,d,p);this.setCamera({focalPoint:t,viewPlaneNormal:d,viewUp:c,position:r}),this.flipVertical=!this.flipVertical}this.render()}getDefaultImageData(){let e=this.getDefaultActor();if(e&&(0,p.e)(e))return e.actor.getMapper().getInputData()}getDefaultActor(){return this.getActors()[0]}getActors(){return Array.from(this._actors.values())}getActorUIDs(){return Array.from(this._actors.keys())}getActor(e){return this._actors.get(e)}getImageActor(e){let t=this.getActors(),r=t[0];return(e&&(r=t.find(t=>t.referencedId===e)),r&&(0,p.e)(r))?r.actor:null}getActorUIDByIndex(e){let t=this.getActors()[e];if(t)return t.uid}getActorByIndex(e){return this.getActors()[e]}setActors(e){let t=this.getActors();this.removeAllActors(),this.addActors(e,{resetCamera:!0}),(0,m.A)(this.element,l.A.ACTORS_CHANGED,{viewportId:this.id,removedActors:t,addedActors:e,currentActors:e})}_removeActor(e){let t=this.getActor(e);return t?(this.getRenderer().removeActor(t.actor),this._actors.delete(e),t):void console.warn(`Actor ${e} does not exist in ${this.id}, can't remove`)}removeActors(e){let t=[];e.forEach(e=>{let r=this._removeActor(e);r&&t.push(r)});let r=this.getActors();(0,m.A)(this.element,l.A.ACTORS_CHANGED,{viewportId:this.id,removedActors:t,addedActors:[],currentActors:r})}addActors(e,t={}){let{resetCamera:r=!1}=t,n=this.getRenderingEngine();if(!n||n.hasBeenDestroyed)return void console.warn("Viewport::addActors::Rendering engine has not been initialized or has been destroyed");if(e.forEach(e=>{this.addActor(e)}),r)this.resetCamera();else{let e=this.getViewPresentation(),t=this.getViewReference();this.resetCamera(),this.setViewReference(t),this.setViewPresentation(e)}(0,m.A)(this.element,l.A.ACTORS_CHANGED,{viewportId:this.id,removedActors:[],addedActors:e,currentActors:this.getActors()})}addActor(e){let{uid:t,actor:r}=e,n=this.getRenderingEngine();if(!n||n.hasBeenDestroyed)return void console.warn(`Cannot add actor UID of ${t} Rendering Engine has been destroyed`);if(!t||!r)throw Error("Actors should have uid and vtk Actor properties");if(this.getActor(t))return void console.warn(`Actor ${t} already exists for this viewport`);let i=this.getRenderer();i?.addActor(r),this._actors.set(t,Object.assign({},e)),this.updateCameraClippingPlanesAndRange(),(0,m.A)(this.element,l.A.ACTORS_CHANGED,{viewportId:this.id,removedActors:[],addedActors:[e],currentActors:this.getActors()})}removeAllActors(){let e=this.getActors();this.getRenderer()?.removeAllViewProps(),this._actors=new Map,(0,m.A)(this.element,l.A.ACTORS_CHANGED,{viewportId:this.id,removedActors:e,addedActors:[],currentActors:[]})}resetCameraNoEvent(){let e=this._suppressCameraModifiedEvents;this._suppressCameraModifiedEvents=!0,this.resetCamera(),this._suppressCameraModifiedEvents=e}setCameraNoEvent(e){let t=this._suppressCameraModifiedEvents;this._suppressCameraModifiedEvents=!0,this.setCamera(e),this._suppressCameraModifiedEvents=t}_getViewImageDataIntersections(e,t,r){let n=r[0],i=r[1],a=r[2],o=n*t[0]+i*t[1]+a*t[2],s=e.getBounds(),l=this._getEdges(s),u=[];for(let e of l){let[[t,r,l],[c,d,p]]=e;if(n*(c-t)+i*(d-r)+a*(p-l)==0)continue;let m=h.linePlaneIntersection([t,r,l],[c,d,p],[n,i,a,o]);this._isInBounds(m,s)&&u.push(m)}return u}setInterpolationType(e,t){}setDisplayArea(e,t=!1){if(!e)return;let{storeAsInitialCamera:r,type:n}=e;r&&(this.options.displayArea=e);let{_suppressCameraModifiedEvents:i}=this;if(this._suppressCameraModifiedEvents=!0,this.setCamera(this.fitToCanvasCamera),"SCALE"===n?this.setDisplayAreaScale(e):(this.setInterpolationType(this.getProperties()?.interpolationType??y.VO.LINEAR),this.setDisplayAreaFit(e)),r&&(this.initialCamera=this.getCamera()),this._suppressCameraModifiedEvents=i,!t&&!i){let t={viewportId:this.id,displayArea:e,storeAsInitialCamera:r};(0,m.A)(this.element,l.A.DISPLAY_AREA_MODIFIED,t),this.setCamera(this.getCamera())}}setDisplayAreaScale(e){let{scale:t=1}=e,r=this.canvas,n=r.height,i=r.width;if(n<8||i<8)return;let a=this.getDefaultImageData().getSpacing()[1];this.setInterpolationType(y.VO.NEAREST),this.setCamera({parallelScale:n*a/(2*t)}),delete e.imageArea,this.setDisplayAreaFit(e);let{focalPoint:s,position:l,viewUp:u,viewPlaneNormal:c}=this.getCamera(),d=o.vt();if(r.height%2&&o.Ln(d,d,u,.5*t*a),r.width%2){let e=o.$A(o.vt(),u,c);o.Ln(d,d,e,.5*t*a)}(d[0]||d[1]||d[2])&&this.setCamera({focalPoint:o.WQ(o.vt(),s,d),position:o.WQ(o.vt(),l,d)})}setDisplayAreaFit(e){let{imageArea:t,imageCanvasPoint:r}=e,n=window?.devicePixelRatio||1,i=this.getDefaultImageData();if(!i)return;let a=this.sWidth/n,o=this.sHeight/n,l=i.getDimensions(),u=this.worldToCanvas(i.indexToWorld([0,0,0])),c=this.worldToCanvas(i.indexToWorld([l[0],l[1],l[2]])),[d,p]=[Math.abs(c[0]-u[0]),Math.abs(c[1]-u[1])],m=this.getZoom()/this.insetImageMultiplier;if(t){let[e,r]=t,n=Math.max(Math.abs(d/a),Math.abs(p/o)),i=Math.abs(e*d/a),s=Math.abs(r*p/o),l=this.getZoom();m=(i>s?n/i:n/s)*l/this.getZoom(this.fitToCanvasCamera),this.setZoom(this.insetImageMultiplier*m,!1)}if(r){let{imagePoint:e,canvasPoint:t=e||[.5,.5]}=r,[n,i]=t,[l,u]=e||t,c=m,h=this.insetImageMultiplier*c*d*(.5-l),f=[h+a*(n-.5),this.insetImageMultiplier*c*p*(.5-u)+o*(i-.5)];s.WQ(f,f,this.getPan()),this.setPan(f,!1)}}getDisplayArea(){return this.options?.displayArea}resetCamera(e){let t,{resetPan:r=!0,resetZoom:n=!0,resetToCenter:a=!0,storeAsInitialCamera:o=!0,resetAspectRatio:s=!0}=e||{},l=this.getRenderer();this.setCameraNoEvent({flipHorizontal:!1,flipVertical:!1});let u=this.getCamera(),d=this.getDefaultActor();t=d&&(0,p.e)(d)?d.actor.getMapper().getInputData().getBounds():l.computeVisiblePropBounds();let m=[0,0,0],h=this.getDefaultImageData(),f=this.getVtkActiveCamera(),g=f.getViewPlaneNormal(),y=f.getViewUp();if(m[0]=(t[0]+t[1])/2,m[1]=(t[2]+t[3])/2,m[2]=(t[4]+t[5])/2,h){let e=T(h.getDimensions(),h.getDirection(),g),t=[e[0],e[1],e[2]];h.indexToWorld(t,m)}let{widthWorld:b,heightWorld:I}=h?(0,x.H)(h,g,y):this._getWorldDistanceViewUpAndViewRight(t,y,g),C=[this.sWidth,this.sHeight],S=b/I/(C[0]/C[1]),w=S<1?this.insetImageMultiplier*I/2:this.insetImageMultiplier*I*S/2,O=A.boundsRadius(t)*(this.type===c.A.VOLUME_3D?10:1),P=this.insetImageMultiplier*O,_=Math.abs(i.Ay.dot(y,g))>.999?[-y[2],y[0],y[1]]:y,E=this._getFocalPointForResetCamera(m,u,{resetPan:r,resetToCenter:a}),D=[E[0]+P*g[0],E[1]+P*g[1],E[2]+P*g[2]];l.resetCameraClippingRange(t);let R=[-v.Cf.MAXIMUM_RAY_DISTANCE,v.Cf.MAXIMUM_RAY_DISTANCE];f.setPhysicalScale(O),f.setPhysicalTranslation(-E[0],-E[1],-E[2]);let M=s?this.options?.aspectRatio||[1,1]:this.getAspectRatio();this.setCamera({parallelScale:n?w:u.parallelScale,focalPoint:E,position:D,viewAngle:90,viewUp:_,clippingRange:R,aspectRatio:M,isFitViewportAfterStretch:!1});let N=this.getCamera();return this.setFitToCanvasCamera(this.getCamera()),o&&this.setInitialCamera(N),n&&this.setZoom(1,o),l.invokeEvent({type:"ResetCameraEvent",renderer:l}),this.triggerCameraModifiedEventIfNecessary(u,N),h&&this.options.displayArea&&n&&r&&a&&this.setDisplayArea(this.options.displayArea),!0}setInitialCamera(e){this.initialCamera=e}setFitToCanvasCamera(e){this.fitToCanvasCamera=e}getPan(e=this.initialCamera){if(!e)return[0,0];let t=this.getVtkActiveCamera().getFocalPoint(),r=this.canvasToWorld([0,0]),n=this.worldToCanvas(o.Re([0,0,0],e.focalPoint,r)),i=this.worldToCanvas(o.Re([0,0,0],t,r));return s.Re([0,0],n,i)}getCurrentImageIdIndex(){throw Error("Not implemented")}getSliceIndex(){throw Error("Not implemented")}getImageData(){throw Error("Not implemented")}getViewReferenceId(e){return null}setPan(e,t=!1){let r=this.getCamera(),{focalPoint:n,position:i}=r,a=this.canvasToWorld([0,0]),l=s.Re([0,0],e,this.getPan());if(1>Math.abs(l[0])&&1>Math.abs(l[1])&&!t)return;let u=o.Re(o.vt(),this.canvasToWorld(l),a),c=o.Re(o.vt(),n,u),d=o.Re(o.vt(),i,u);this.setCamera({...r,focalPoint:c,position:d},t)}getZoom(e=this.initialCamera){if(!e)return 1;let t=this.getVtkActiveCamera(),{parallelScale:r}=e;return r/t.getParallelScale()}setZoom(e,t=!1){let r=this.getCamera(),{parallelScale:n}=this.initialCamera,i=n/e;(r.parallelScale!==i||t)&&this.setCamera({...r,parallelScale:i},t)}getAspectRatio(){let{aspectRatio:e}=this.getCamera();return e??this.options?.aspectRatio??[1,1]}setAspectRatio(e,t=!0,r=!1){let n=this.getCamera();r&&(this.options.aspectRatio=e),this.setCamera({...n,aspectRatio:e,isFitViewportAfterStretch:t},r)}_getFocalPointForViewPlaneReset(e){let{focalPoint:t,viewPlaneNormal:r}=this.getCamera(),n=this._getViewImageDataIntersections(e,t,r),i=0,a=0,o=0;return n.forEach(([e,t,r])=>{i+=e,a+=t,o+=r}),[i/n.length,a/n.length,o/n.length]}getCanvas(){return this.canvas}getVtkActiveCamera(){let e=this.getRenderer();return e?e.getActiveCamera():(console.warn("No renderer found for the viewport"),null)}getCameraNoRotation(){let e=this.getVtkActiveCamera(),t=(e,t)=>e.some(e=>isNaN(e))?t:e,r=t([...e.getViewUp()],[0,1,0]),n=t([...e.getViewPlaneNormal()],[0,0,-1]);return{viewUp:r,viewPlaneNormal:n,position:t([...e.getPosition()],[0,0,1]),focalPoint:t([...e.getFocalPoint()],[0,0,0]),parallelProjection:e.getParallelProjection(),parallelScale:e.getParallelScale(),viewAngle:e.getViewAngle(),flipHorizontal:this.flipHorizontal,flipVertical:this.flipVertical,aspectRatio:e.getAspectRatio()}}getCamera(){return{...this.getCameraNoRotation(),rotation:this.getRotation()}}setAspectRatioForVTKCamera(e,t=!0){let r=this.getVtkActiveCamera();if(!t)return void r.setAspectRatio(e);let n=r.getAspectRatio()||[1,1];if(n[0]===e[0]&&n[1]===e[1])return;let i=(([e,t])=>e/t)(n),a=(([e,t])=>e/t)(e);r.setAspectRatio(e);let o=this.getDefaultImageData();if(!o)return;let s=e=>{let{widthWorld:t,heightWorld:n}=(0,x.H)(o,r.getViewPlaneNormal(),r.getViewUp()),i=this.sWidth/this.sHeight,a=t*e,s=a/n>i?a/(2*i):n/2;return e<1&&(s/=e),s},l=s(a)/s(i);r.setParallelScale(r.getParallelScale()*l),this.initialCamera?.parallelScale&&(this.initialCamera={...this.initialCamera,parallelScale:this.initialCamera.parallelScale*l}),this.fitToCanvasCamera?.parallelScale&&(this.fitToCanvasCamera={...this.fitToCanvasCamera,parallelScale:this.fitToCanvasCamera.parallelScale*l})}setCamera(e,t=!1){let r=this.getVtkActiveCamera(),n=this.getCamera(),a=Object.assign({},n,e),{viewUp:o,viewPlaneNormal:s,position:l,focalPoint:u,parallelScale:d,viewAngle:m,flipHorizontal:h,flipVertical:g,clippingRange:v,aspectRatio:y,isFitViewportAfterStretch:b}=e;if(void 0!==h){let e=h&&!this.flipHorizontal||!h&&this.flipHorizontal;e&&this.flip({flipHorizontal:e})}if(void 0!==g){let e=g&&!this.flipVertical||!g&&this.flipVertical;e&&this.flip({flipVertical:e})}void 0!==o&&r.setViewUp(o),void 0!==s&&r.setDirectionOfProjection(-s[0],-s[1],-s[2]),void 0!==l&&r.setPosition(...l),void 0!==u&&r.setFocalPoint(...u),void 0!==d&&r.setParallelScale(d),void 0!==m&&r.setViewAngle(m),void 0!==v&&r.setClippingRange(v),y&&this.setAspectRatioForVTKCamera(y,b);let I=n.focalPoint,x=n.viewUp;if(I&&u||x&&o){let e=r.getViewPlaneNormal(),t=r.getViewUp(),n=!1,s=!1;if(u){let t=[u[0]-I[0],u[1]-I[1],u[2]-I[2]];n=Math.abs(i.Ay.dot(t,e))>0}if(o&&(s=!(0,f.Ay)(t,x)),n||s){let e=this.getDefaultActor();if(!e?.actor)return;(0,p.N)(e,"vtkActor")||this.updateClippingPlanesForActors(a),((0,p.N)(e,"vtkImageSlice")||this.type===c.A.VOLUME_3D)&&this.getRenderer().resetCameraClippingRange()}}t&&this.setInitialCamera(a),this.triggerCameraModifiedEventIfNecessary(n,this.getCamera())}triggerCameraModifiedEventIfNecessary(e,t){if(!this._suppressCameraModifiedEvents&&!this.suppressEvents){let r={previousCamera:e,camera:t,element:this.element,viewportId:this.id,renderingEngineId:this.renderingEngineId};(0,m.A)(this.element,l.A.CAMERA_MODIFIED,r)}}updateCameraClippingPlanesAndRange(){let e=this.getCamera();this.updateClippingPlanesForActors(e),this.getRenderer().resetCameraClippingRange()}async updateClippingPlanesForActors(e){this.getActors().map(t=>{if(!t.actor)return;let r=t.actor.getMapper(),n=t?.clippingFilter?t?.clippingFilter.getClippingPlanes():r.getClippingPlanes();0===n.length&&t?.clippingFilter&&(n=[a.Ay.newInstance(),a.Ay.newInstance()]);let i=v.Cf.MINIMUM_SLAB_THICKNESS;t.slabThickness&&(i=t.slabThickness);let{viewPlaneNormal:o,focalPoint:s}=e;this.setOrientationOfClippingPlanes(n,i,o,s),(0,m.A)(this.element,l.A.CLIPPING_PLANES_UPDATED,{actorEntry:t,focalPoint:s,vtkPlanes:n,viewport:this})})}setOrientationOfClippingPlanes(e,t,r,n){if(e.length<2)return;let a=[r[0],r[1],r[2]];i.Ay.multiplyScalar(a,t),e[0].setNormal(r);let o=[0,0,0];i.Ay.subtract(n,a,o),e[0].setOrigin(o),e[1].setNormal(-r[0],-r[1],-r[2]);let s=[0,0,0];i.Ay.add(n,a,s),e[1].setOrigin(s)}getClippingPlanesForActor(e){if(e||(e=this.getDefaultActor()),!e.actor)throw Error("Invalid actor entry: Actor is undefined");let t=e.actor.getMapper(),r=e?.clippingFilter?e?.clippingFilter.getClippingPlanes():t.getClippingPlanes();return 0===r.length&&e?.clippingFilter&&(r=[a.Ay.newInstance(),a.Ay.newInstance()]),r}_getWorldDistanceViewUpAndViewRight(e,t,r){let i=this._getCorners(e),a=this._getCorners(e),s=o.$A(o.vt(),t,r),l=n.A.buildFromDegree().identity().rotateFromDirections(t,[1,0,0]);i.forEach(e=>l.apply(e));let u=1/0,c=-1/0;for(let e=0;e<8;e++){let t=i[e][0];t>c&&(c=t),tl.apply(e));let d=1/0,p=-1/0;for(let e=0;e<8;e++){let t=a[e][0];t>p&&(p=t),t=0&&this.setRotation(a)}_getCorners(e){return[[e[0],e[2],e[4]],[e[0],e[2],e[5]],[e[0],e[3],e[4]],[e[0],e[3],e[5]],[e[1],e[2],e[4]],[e[1],e[2],e[5]],[e[1],e[3],e[4]],[e[1],e[3],e[5]]]}_getFocalPointForResetCamera(e,t,{resetPan:r=!0,resetToCenter:n=!0}){if(n&&r)return e;if(n&&!r)return(0,g.A)(t.focalPoint)?e:t.focalPoint;if(!n&&r){let r=t.focalPoint,n=t.viewPlaneNormal,i=o.Re(o.vt(),e,r),a=o.Om(i,n),s=o.Ln(o.vt(),e,n,-1*a);return[s[0],s[1],s[2]]}if(!r&&!n)return(0,g.A)(t.focalPoint)?e:t.focalPoint}_isInBounds(e,t){let[r,n,i,a,o,s]=t,[l,u,c]=e;return!(ln)&&!(ua)&&!(cs)}_getEdges(e){let[t,r,n,i,a,o,s,l]=this._getCorners(e);return[[t,r],[t,a],[t,n],[r,i],[r,o],[n,i],[n,s],[i,l],[a,s],[a,o],[o,l],[s,l]]}static boundsRadius(e){let t=(e[1]-e[0])**2;return .5*Math.sqrt(t+(e[3]-e[2])**2+(e[5]-e[4])**2||1)}setDataList(e){throw Error("Unsupported operation setDataList")}setDisplaySets(...e){this._displaySets=e}async mountDisplaySets(e,t){let[r]=e;if(!r?.displaySetId)throw Error(`${this.constructor.name}: setDisplaySets requires a displaySetId`);await t(r),this._displaySets=[r]}getDisplaySets(){return this._displaySets}clearDisplaySets(){this._displaySets=[]}}function T(e,t,r){let n=[[t[0],t[1],t[2]],[t[3],t[4],t[5]],[t[6],t[7],t[8]]],i=[r[0],r[1],r[2]],a=0,s=-1;for(let e=0;e<3;e++){let t=Math.abs(o.Om(n[e],i));t>s&&(s=t,a=e)}let l=.001>Math.abs(s-1);return e.map((e,t)=>t===a&&l?Math.floor(e/2):(e-1)/2)}A.CameraViewPresentation={rotation:!0,pan:!0,zoom:!0,aspectRatio:!0,displayArea:!0},A.TransferViewPresentation={windowLevel:!0,paletteLut:!0};let S=A},55839:e=>{"use strict";function t(e){return null==e}e.exports.isNothing=t,e.exports.isObject=function(e){return"object"==typeof e&&null!==e},e.exports.toArray=function(e){return Array.isArray(e)?e:t(e)?[]:[e]},e.exports.repeat=function(e,t){let r="";for(let n=0;n{"use strict";r.d(t,{Ay:()=>s});var n=r(17042),{vtkErrorMacro:i}=n.Ay,a={device:null,handle:null,bindGroupDevice:null,label:null};function o(e,t,r={}){Object.assign(t,a,r),n.Ay.obj(e,t),t.bindables=[],t.bindGroupTime={},n.Ay.obj(t.bindGroupTime,{mtime:0}),n.Ay.get(e,t,["bindGroupTime","handle","sizeInBytes","usage"]),n.Ay.setGet(e,t,["label","device","arrayInformation"]),t.classHierarchy.push("vtkWebGPUBindGroup"),e.setBindables=r=>{if(t.bindables.length===r.length){let e=!0;for(let n=0;n{let r=[];for(let n=0;n{let n=t.bindGroupDevice!==r;for(let e=0;ei?r:i}if(!n&&i{let r=[],n=e.getBindGroupLayoutIndex(t.label);if(n<0)return i(`vtkWebGPUBindGroup: bind group layout ${t.label} was not found in pipeline`),"";for(let e=0;e{t.bindGroup=null,t.bindGroupDevice=null,t.bindGroupTime.modified(),e.modified()}}var s={newInstance:n.Ay.newInstance(o),extend:o}},56099:(e,t,r)=>{"use strict";r.d(t,{g:()=>i});let{p8:n}=r(70192).Jj;function i(e,t){return function(e,t,r=!1){let i=1/0,a=r?-1/0:0,o=1/0,s=r?-1/0:0,l=1/0,u=r?-1/0:0,c=e[0]?.length===3;for(let t=0;t{"use strict";r.d(t,{Ay:()=>y});var n=r(17042),i=r(11701),a=r(64541),o={ColorSpace:{RGB:0,HSV:1,LAB:2,DIVERGING:3},Scale:{LINEAR:0,LOG10:1}},{ColorSpace:s,Scale:l}=o,{ScalarMappingTarget:u}=a.Ay,{vtkDebugMacro:c,vtkErrorMacro:d,vtkWarningMacro:p}=n.Ay;function m(e,t){let r=e[0],n=e[1],i=e[2],a=Math.sqrt(r*r+n*n+i*i),o=a>.001?Math.acos(r/a):0,s=o>.001?Math.atan2(i,n):0;t[0]=a,t[1]=o,t[2]=s}function h(e,t){if(e[0]>=t-.1)return e[2];let r=e[1]*Math.sqrt(t*t-e[0]*e[0])/(e[0]*Math.sin(e[1]));return e[2]>-.3*Math.PI?e[2]+r:e[2]-r}function f(e,t,r,n){let a=[],o=[];(0,i.Nc)(t,a),(0,i.Nc)(r,o);let s=[],l=[];m(a,s),m(o,l);let u=e;if(s[1]>.05&&l[1]>.05&&function(e,t){let r=e-t;for(r<0&&(r=-r);r>=2*Math.PI;)r-=2*Math.PI;return r>Math.PI&&(r=2*Math.PI-r),r}(s[2],l[2])>.33*Math.PI){let t=Math.max(s[0],l[0]);t=Math.max(88,t),e<.5?(l[0]=t,l[1]=0,l[2]=0,u*=2):(s[0]=t,s[1]=0,s[2]=0,u=2*u-1)}s[1]<.05&&l[1]>.05?s[2]=h(l,s[0]):l[1]<.05&&s[1]>.05&&(l[2]=h(s,l[0]));let c=[];c[0]=(1-u)*s[0]+u*l[0],c[1]=(1-u)*s[1]+u*l[1],c[2]=(1-u)*s[2]+u*l[2];let d=[],p=c[0],f=c[1],g=c[2];d[0]=p*Math.cos(f),d[1]=p*Math.sin(f)*Math.cos(g),d[2]=p*Math.sin(f)*Math.sin(g),(0,i.BE)(d,n)}var g={clamping:!0,colorSpace:s.RGB,hSVWrap:!0,scale:l.LINEAR,nanColor:null,belowRangeColor:null,aboveRangeColor:null,useAboveRangeColor:!1,useBelowRangeColor:!1,allowDuplicateScalars:!1,table:null,tableSize:0,buildTime:null,nodes:null,discretize:!1,numberOfValues:256};function v(e,t,r={}){Object.assign(t,g,r),a.Ay.extend(e,t,r),t.table=[],t.nodes=[],t.nanColor=[.5,0,0,1],t.belowRangeColor=[0,0,0,1],t.aboveRangeColor=[1,1,1,1],t.buildTime={},n.Ay.obj(t.buildTime),n.Ay.get(e,t,["buildTime","mappingRange"]),n.Ay.setGet(e,t,["useAboveRangeColor","useBelowRangeColor","discretize","numberOfValues",{type:"enum",name:"colorSpace",enum:s},{type:"enum",name:"scale",enum:l}]),n.Ay.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),n.Ay.getArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"]),t.classHierarchy.push("vtkColorTransferFunction"),e.getSize=()=>t.nodes.length,e.addRGBPoint=(t,r,n,i)=>e.addRGBPointLong(t,r,n,i,.5,0),e.addRGBPointLong=(r,n,i,a,o=.5,s=0)=>{if(o<0||o>1)return d("Midpoint outside range [0.0, 1.0]"),-1;if(s<0||s>1)return d("Sharpness outside range [0.0, 1.0]"),-1;t.allowDuplicateScalars||e.removePoint(r),t.nodes.push({x:r,r:n,g:i,b:a,midpoint:o,sharpness:s}),e.sortAndUpdateRange();let l=0;for(;le.addHSVPointLong(t,r,n,i,.5,0),e.addHSVPointLong=(t,r,n,a,o=.5,s=0)=>{let l=[];return(0,i.hT)([r,n,a],l),e.addRGBPoint(t,l[0],l[1],l[2],o,s)},e.setNodes=r=>{if(t.nodes!==r){let n=JSON.stringify(t.nodes);t.nodes=r;let i=JSON.stringify(t.nodes);if(e.sortAndUpdateRange()||n!==i)return e.modified(),!0}return!1},e.sortAndUpdateRange=()=>{let r=JSON.stringify(t.nodes);t.nodes.sort((e,t)=>e.x-t.x);let n=JSON.stringify(t.nodes),i=e.updateRange();return i||r===n?i:(e.modified(),!0)},e.updateRange=()=>{let r=[2];r[0]=t.mappingRange[0],r[1]=t.mappingRange[1];let n=t.nodes.length;return n?(t.mappingRange[0]=t.nodes[0].x,t.mappingRange[1]=t.nodes[n-1].x):(t.mappingRange[0]=0,t.mappingRange[1]=0),(r[0]!==t.mappingRange[0]||r[1]!==t.mappingRange[1])&&(e.modified(),!0)},e.removePoint=r=>{let n=0;for(;n=t.nodes.length)return -1;let a=!1;return t.nodes.splice(n,1),(0===n||n===t.nodes.length)&&(a=e.updateRange()),a||e.modified(),i},e.movePoint=(r,n)=>{if(r!==n){e.removePoint(n);for(let i=0;i{t.nodes=[],e.sortAndUpdateRange()},e.addRGBSegment=(r,n,i,a,o,s,l,u)=>{e.sortAndUpdateRange();for(let e=0;e=r&&t.nodes[e].x<=o?t.nodes.splice(e,1):e++;e.addRGBPointLong(r,n,i,a,.5,0),e.addRGBPointLong(o,s,l,u,.5,0),e.modified()},e.addHSVSegment=(t,r,n,a,o,s,l,u)=>{let c=[],d=[];(0,i.hT)([r,n,a],c),(0,i.hT)([s,l,u],d),e.addRGBSegment(t,c[0],c[1],c[2],o,d[0],d[1],d[2])},e.mapValue=t=>{let r=[];return e.getColor(t,r),[Math.floor(255*r[0]+.5),Math.floor(255*r[1]+.5),Math.floor(255*r[2]+.5),255]},e.getColor=(r,n)=>{if(t.indexedLookup){let t=e.getSize(),i=e.getAnnotatedValueIndexInternal(r);if(i<0||0===t){let t=e.getNanColorByReference();n[0]=t[0],n[1]=t[1],n[2]=t[2]}else{let r=[];e.getNodeValue(i%t,r),n[0]=r[1],n[1]=r[2],n[2]=r[3]}return}e.getTable(r,r,1,n)},e.getRedValue=t=>{let r=[];return e.getColor(t,r),r[0]},e.getGreenValue=t=>{let r=[];return e.getColor(t,r),r[1]},e.getBlueValue=t=>{let r=[];return e.getColor(t,r),r[2]},e.logScaleEnabled=()=>t.scale===l.LOG10,e.usingLogScale=()=>e.logScaleEnabled()&&t.mappingRange[0]>0,e.getTable=(r,n,a,o)=>{let l=e.usingLogScale(),u=l?Math.log10(Number(r)):Number(r),c=l?Math.log10(Number(n)):Number(n);if((0,i.M8)(u)||(0,i.M8)(c)){for(let e=0;e1?u+r/(a-1)*(c-u):.5*(u+c),t.discretize){let e=w;if(y>=e[0]&&y<=e[1]){let r=t.numberOfValues,n=e[1]-e[0];if(r<=1)y=e[0]+n/2;else{let t=(0,i.RI)(r*((y-e[0])/n));y=e[0]+t/(r-1)*n}}}for(;pt.nodes[p].x;)++p.99999&&(A=.99999));if(y>w[1])o[n]=0,o[n+1]=0,o[n+2]=0,t.clamping&&(e.getUseAboveRangeColor()?(o[n]=t.aboveRangeColor[0],o[n+1]=t.aboveRangeColor[1],o[n+2]=t.aboveRangeColor[2]):(o[n]=h,o[n+1]=g,o[n+2]=v));else if(y0&&(o[n]=t.nodes[0].r,o[n+1]=t.nodes[0].g,o[n+2]=t.nodes[0].b));else if(0===p&&(1e-6>Math.abs(y-u)||t.discretize))m>0?(o[n]=t.nodes[0].r,o[n+1]=t.nodes[0].g,o[n+2]=t.nodes[0].b):(o[n]=0,o[n+1]=0,o[n+2]=0);else{let e,r=0;if(r=(r=(y-b)/(I-b)).99)if(r<.5){o[n]=x[0],o[n+1]=x[1],o[n+2]=x[2];continue}else{o[n]=C[0],o[n+1]=C[1],o[n+2]=C[2];continue}if(T<.01){if(t.colorSpace===s.RGB)o[n]=(1-r)*x[0]+r*C[0],o[n+1]=(1-r)*x[1]+r*C[1],o[n+2]=(1-r)*x[2]+r*C[2];else if(t.colorSpace===s.HSV){let e=[],a=[];(0,i.bi)(x,e),(0,i.bi)(C,a),t.hSVWrap&&(e[0]-a[0]>.5||a[0]-e[0]>.5)&&(e[0]>a[0]?e[0]-=1:a[0]-=1);let s=[];s[0]=(1-r)*e[0]+r*a[0],s[0]<0&&(s[0]+=1),s[1]=(1-r)*e[1]+r*a[1],s[2]=(1-r)*e[2]+r*a[2],(0,i.hT)(s,S),o[n]=S[0],o[n+1]=S[1],o[n+2]=S[2]}else if(t.colorSpace===s.LAB){let e=[],t=[];(0,i.Nc)(x,e),(0,i.Nc)(C,t);let a=[];a[0]=(1-r)*e[0]+r*t[0],a[1]=(1-r)*e[1]+r*t[1],a[2]=(1-r)*e[2]+r*t[2],(0,i.BE)(a,S),o[n]=S[0],o[n+1]=S[1],o[n+2]=S[2]}else t.colorSpace===s.DIVERGING?(f(r,x,C,S),o[n]=S[0],o[n+1]=S[1],o[n+2]=S[2]):d("ColorSpace set to invalid value.",t.colorSpace);continue}r<.5?r=.5*(2*r)**(1+10*T):r>.5&&(r=1-.5*((1-r)*2)**(1+10*T));let a=r*r,l=a*r,u=2*l-3*a+1,c=-2*l+3*a,p=l-2*a+r,m=l-a;if(t.colorSpace===s.RGB)for(let t=0;t<3;t++)e=(1-T)*(C[t]-x[t]),o[n+t]=u*x[t]+c*C[t]+p*e+m*e;else if(t.colorSpace===s.HSV){let r=[],a=[];(0,i.bi)(x,r),(0,i.bi)(C,a),t.hSVWrap&&(r[0]-a[0]>.5||a[0]-r[0]>.5)&&(r[0]>a[0]?r[0]-=1:a[0]-=1);let s=[];for(let t=0;t<3;t++)e=(1-T)*(a[t]-r[t]),s[t]=u*r[t]+c*a[t]+p*e+m*e,0===t&&s[t]<0&&(s[t]+=1);(0,i.hT)(s,S),o[n]=S[0],o[n+1]=S[1],o[n+2]=S[2]}else if(t.colorSpace===s.LAB){let t=[],r=[];(0,i.Nc)(x,t),(0,i.Nc)(C,r);let a=[];for(let n=0;n<3;n++)e=(1-T)*(r[n]-t[n]),a[n]=u*t[n]+c*r[n]+p*e+m*e;(0,i.BE)(a,S),o[n]=S[0],o[n+1]=S[1],o[n+2]=S[2]}else t.colorSpace===s.DIVERGING?(f(r,x,C,S),o[n]=S[0],o[n+1]=S[1],o[n+2]=S[2]):d("ColorSpace set to invalid value.");for(let e=0;e<3;e++)o[n+e]=o[n+e]<0?0:o[n+e],o[n+e]=o[n+e]>1?1:o[n+e]}}},e.getUint8Table=(r,n,i,a=!1)=>{if(e.getMTime()<=t.buildTime&&t.tableSize===i&&t.tableWithAlpha!==a)return t.table;if(0===t.nodes.length)return d("Attempting to lookup a value with no points in the function"),t.table;let o=a?4:3;(t.tableSize!==i||t.tableWithAlpha!==a)&&(t.table=new Uint8Array(i*o),t.tableSize=i,t.tableWithAlpha=a);let s=[];e.getTable(r,n,i,s);for(let e=0;e{e.removeAllPoints();let n=r.getNumberOfComponents();for(let e=0;e{let o=0;e.removeAllPoints(),i>1&&(o=(n-r)/(i-1));for(let e=0;ee<0||e>=t.nodes.length?(d("Index out of range!"),-1):(r[0]=t.nodes[e].x,r[1]=t.nodes[e].r,r[2]=t.nodes[e].g,r[3]=t.nodes[e].b,r[4]=t.nodes[e].midpoint,r[5]=t.nodes[e].sharpness,1),e.setNodeValue=(r,n)=>{if(r<0||r>=t.nodes.length)return d("Index out of range!"),-1;let i=t.nodes[r].x;return t.nodes[r].x=n[0],t.nodes[r].r=n[1],t.nodes[r].g=n[2],t.nodes[r].b=n[3],t.nodes[r].midpoint=n[4],t.nodes[r].sharpness=n[5],i!==n[0]?e.sortAndUpdateRange():e.modified(),1},e.getNumberOfAvailableColors=()=>t.indexedLookup&&e.getSize()?e.getSize():t.tableSize?t.tableSize:Math.max(4094,t.nodes?.length??0),e.getIndexedColor=(t,r)=>{let n=e.getSize();if(n>0&&t>=0){let i=[];e.getNodeValue(t%n,i);for(let e=0;e<3;++e)r[e]=i[e+1];r[3]=1;return}let i=e.getNanColorByReference();r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=1},e.fillFromDataPointer=(t,r)=>{if(!(t<=0)&&r){e.removeAllPoints();for(let n=0;n{let i=[r,n],a=[r,n],o=e.getRange(),s=e.logScaleEnabled();if(o[1]===i[1]&&o[0]===i[0])return;if(i[1]===i[0])return void d("attempt to set zero width color range");s&&(i[0]<=0?console.warn("attempt to set log scale color range with non-positive minimum"):(a[0]=Math.log10(i[0]),a[1]=Math.log10(i[1])));let l=(a[1]-a[0])/(o[1]-o[0]),u=a[0]-o[0]*l;for(let e=0;e{let n=e.getRange(),i=[];n[0]r[1]?e.getColor(r[1],i):e.getColor(n[1],i),e.addRGBPoint(r[1],i[0],i[1],i[2]),e.sortAndUpdateRange();for(let e=0;e=r[0]&&t.nodes[e].x<=r[1]?t.nodes.splice(e,1):++e;return 1},e.estimateMinNumberOfSamples=(t,r)=>Math.ceil((r-t)/e.findMinimumXDistance()),e.findMinimumXDistance=()=>{if(t.nodes.length<2)return -1;let e=Number.MAX_VALUE;for(let r=0;r{if(0===e.getSize())return void c("Transfer Function Has No Points!");t.indexedLookup?e.mapDataIndexed(r,n,i,a):e.mapData(r,n,i,a)},e.mapData=(t,r,n,i)=>{if(0===e.getSize())return void p("Transfer Function Has No Points!");let a=Math.floor(255*e.getAlpha()+.5),o=t.getNumberOfTuples(),s=t.getNumberOfComponents(),l=r.getData(),c=t.getData(),d=[];if(n===u.RGBA)for(let t=0;t{let n=JSON.stringify(t.colorSpace);r.ColorSpace&&(t.colorSpace=s[r.ColorSpace.toUpperCase()],void 0===t.colorSpace&&(d(`ColorSpace ${r.ColorSpace} not supported, using RGB instead`),t.colorSpace=s.RGB));let i=n!==JSON.stringify(t.colorSpace),a=i||JSON.stringify(t.nanColor);if(r.NanColor)for(t.nanColor=[].concat(r.NanColor);t.nanColor.length<4;)t.nanColor.push(1);let o=(i=i||a!==JSON.stringify(t.nanColor))||JSON.stringify(t.nodes);if(r.RGBPoints){let e=r.RGBPoints.length;t.nodes=[];for(let n=0;n{"use strict";r.d(t,{Cc:()=>i,VD:()=>a,lJ:()=>o});var n=r(31320);let{Cc:i,VD:a,lJ:o}=n.BF;n.BF.Cc},56478:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(2523),i=r(35088);let a=function(e){let t=(0,i.Ay)(e);if(!t)return;let{viewport:r}=t;if(!(r instanceof n.A))throw Error(`An image can only be fetched for a stack viewport and not for a viewport of type: ${r.type}`);return r.getCornerstoneImage()}},56673:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.length=function(e){return e.length},t.byteLowercase=function(e){for(let t=0;t=65&&r<=90&&(e[t]=r+32)}},t.byteUppercase=function(e){for(let t=0;t=97&&r<=122&&(e[t]=r-32)}},t.byteCaseInsensitiveMatch=function(e,t){if(e.length!==t.length)return!1;for(let r=0;r=65&&n<=90&&(n+=32),i>=65&&i<=90&&(i+=32),n!==i)return!1}return!0},t.startsWith=function(e,t){let r=0;for(;;){if(r>=e.length)return!1;if(r>=t.length)return!0;if(e[r]!==t[r])return!1;r++}},t.byteLessThan=function(e,t){let r=0;for(;;){if(r>=e.length)return!1;if(r>=t.length)return!0;let n=e[r],i=t[r];if(ni)return!1;r++}},t.isomorphicDecode=function(e){return String.fromCodePoint(...e)}},56872:(e,t,r)=>{"use strict";var n;r.d(t,{A:()=>i}),function(e){e.STACK="stack",e.ORTHOGRAPHIC="orthographic",e.PERSPECTIVE="perspective",e.VOLUME_3D="volume3d",e.VOLUME_3D_NEXT="volume3dNext",e.PLANAR_NEXT="planarNext",e.VIDEO="video",e.VIDEO_NEXT="videoNext",e.WHOLE_SLIDE="wholeSlide",e.WHOLE_SLIDE_NEXT="wholeSlideNext",e.ECG="ecg",e.ECG_NEXT="ecgNext"}(n||(n={}));let i=n},56929:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>u,c9:()=>o});var n=r(17042),i=r(81522),a=Object.create(null);function o(e,t){a[e]=t}var s={};function l(e,t,r={}){Object.assign(t,s,r),t.overrides=a,i.Ay.extend(e,t,r),t.classHierarchy.push("vtkOpenGLViewNodeFactory")}var u={newInstance:n.Ay.newInstance(l,"vtkOpenGLViewNodeFactory"),extend:l}},56971:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>o});var n=r(17042),i={contentType:-1,fieldType:-1,properties:null,selectionList:[]};function a(e,t,r={}){Object.assign(t,i,r),n.Ay.obj(e,t),t.properties={},n.Ay.setGet(e,t,["contentType","fieldType","properties","selectionList"]),t.classHierarchy.push("vtkSelectionNode"),e.getBounds=()=>t.points.getBounds()}var o={newInstance:n.Ay.newInstance(a,"vtkSelectionNode"),extend:a,...{SelectionContent:{GLOBALIDS:0,PEDIGREEIDS:1,VALUES:2,INDICES:3,FRUSTUM:4,LOCATIONS:5,THRESHOLDS:6,BLOCKS:7,QUERY:8},SelectionField:{CELL:0,POINT:1,FIELD:2,VERTEX:3,EDGE:4,ROW:5}}}},57186:(e,t,r)=>{"use strict";r(70192),r(56099)},57226:function(e,t,r){"use strict";var n,i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(n=function(e){return(n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t})(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),o=0;o{"use strict";r.d(t,{Ay:()=>l,XK:()=>n});var n={Off:0,PolygonOffset:1},i=n.PolygonOffset,a=n.Off,o=["VTK_RESOLVE_OFF","VTK_RESOLVE_POLYGON_OFFSET"];function s(e=0){let t=a===e;return a=e,t}var l={Resolve:n,getResolveCoincidentTopologyAsString:function(){return o[a]},getResolveCoincidentTopologyPolygonOffsetFaces:function(){return i},getResolveCoincidentTopology:function(){return a},setResolveCoincidentTopology:s,setResolveCoincidentTopologyPolygonOffsetFaces:function(e){let t=i===e;return i=e,t},setResolveCoincidentTopologyToDefault:function(){return s(n.Off)},setResolveCoincidentTopologyToOff:function(){return s(n.Off)},setResolveCoincidentTopologyToPolygonOffset:function(){return s(n.PolygonOffset)}}},57752:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(92336);function i(e,t){let r=new n.d,i=e.viewport.aspectRatio;if(!e.viewport.displayedArea)return r;r.translate(e.canvas.width/2,e.canvas.height/2);let a=e.viewport.rotation;0!==a&&r.rotate(a*Math.PI/180);let[o,s,l]=function(e){if(Array.isArray(e))return[e[0]??1,e[1]??1,!0];let t=e??1;return[t,t,!1]}(e.viewport.scale),u=o,c=s,d=e.viewport.displayedArea.brhc.x-(e.viewport.displayedArea.tlhc.x-1),p=e.viewport.displayedArea.brhc.y-(e.viewport.displayedArea.tlhc.y-1);if(l);else if("NONE"===e.viewport.displayedArea.presentationSizeMode)e.image.rowPixelSpacing{"use strict";r.d(t,{Ay:()=>l});var n=r(17042),i=r(47596),a=["getMappedRange","mapAsync","unmap"],o={device:null,handle:null,sizeInBytes:0,strideInBytes:0,arrayInformation:null,usage:null,label:null,sourceTime:null};function s(e,t,r={}){Object.assign(t,o,r),n.Ay.obj(e,t),n.Ay.get(e,t,["handle","sizeInBytes","usage"]),n.Ay.setGet(e,t,["strideInBytes","device","arrayInformation","label","sourceTime"]);t.classHierarchy.push("vtkWebGPUBuffer"),e.create=(e,r)=>{t.handle=t.device.getHandle().createBuffer({size:e,usage:r,label:t.label}),t.sizeInBytes=e,t.usage=r},e.write=e=>{!function(e,t,r,n){let i=n.byteLength,a=e.createBuffer({size:i,usage:GPUBufferUsage.COPY_SRC,mappedAtCreation:!0});new Uint8Array(a.getMappedRange(0,i)).set(new Uint8Array(n)),a.unmap();let o=e.createCommandEncoder();o.copyBufferToBuffer(a,0,t,0,i);let s=o.finish();e.queue.submit([s]),a.destroy()}(t.device.getHandle(),t.handle,0,e.buffer)},e.createAndWrite=(e,r)=>{let n=4*Math.ceil(e.byteLength/4);t.handle=t.device.getHandle().createBuffer({size:n,usage:r,mappedAtCreation:!0,label:t.label}),t.sizeInBytes=n,t.usage=r,new Uint8Array(t.handle.getMappedRange()).set(new Uint8Array(e.buffer)),t.handle.unmap()};for(let r=0;rt.handle[a[r]](...e)}var l={newInstance:n.Ay.newInstance(s),extend:s,...i.Ay}},57956:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>s});var n=r(17042),i=r(82382),a={size:0,maxId:-1,extend:1e3};function o(e,t,r={}){Object.assign(t,a,r),n.Ay.obj(e,t),n.Ay.get(e,t,["size","maxId","extend"]),n.Ay.getArray(e,t,["typeArray","locationArray"]),t.classHierarchy.push("vtkCellTypes"),e.allocate=(e=512,r=1e3)=>{t.size=e>0?e:1,t.extend=r>0?r:1,t.maxId=-1,t.typeArray=new Uint8Array(e),t.locationArray=new Uint32Array(e)},e.insertCell=(e,r,n)=>{t.typeArray[e]=r,t.locationArray[e]=n,e>t.maxId&&(t.maxId=e)},e.insertNextCell=(r,n)=>(e.insertCell(++t.maxId,r,n),t.maxId),e.setCellTypes=(e,r,n)=>{t.size=e,t.typeArray=r,t.locationArray=n,t.maxId=e-1},e.getCellLocation=e=>t.locationArray[e],e.deleteCell=e=>{t.typeArray[e]=i.vZ.VTK_EMPTY_CELL},e.getNumberOfTypes=()=>t.maxId+1,e.isType=t=>{let r=e.getNumberOfTypes();for(let n=0;ne.insertNextCell(t,-1),e.getCellType=e=>t.typeArray[e],e.reset=()=>{t.maxId=-1},e.deepCopy=r=>{e.allocate(r.getSize(),r.getExtend()),t.typeArray.set(r.getTypeArray()),t.locationArray.set(r.getLocationArray()),t.maxId=r.getMaxId()}}var s={newInstance:n.Ay.newInstance(o,"vtkCellTypes"),extend:o,...{getClassNameFromTypeId:function(e){return e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.enqueue=function(e,t){e.push(t)},t.dequeue=function(e){return e.shift()||null}},58011:(e,t,r)=>{"use strict";e.exports=new(r(50026))("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;let t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},58373:(e,t,r)=>{"use strict";r.d(t,{Bc:()=>i,Qu:()=>d});class n{constructor(){this.NumberOfColors=256,this.Ramp="linear",this.TableRange=[0,255],this.HueRange=[0,.66667],this.SaturationRange=[1,1],this.ValueRange=[1,1],this.AlphaRange=[1,1],this.NaNColor=[128,0,0,255],this.BelowRangeColor=[0,0,0,255],this.UseBelowRangeColor=!0,this.AboveRangeColor=[255,255,255,255],this.UseAboveRangeColor=!0,this.InputRange=[0,255],this.Table=[]}setNumberOfTableValues(e){this.NumberOfColors=e}setRamp(e){this.Ramp=e}setTableRange(e,t){this.TableRange[0]=e,this.TableRange[1]=t}setHueRange(e,t){this.HueRange[0]=e,this.HueRange[1]=t}setSaturationRange(e,t){this.SaturationRange[0]=e,this.SaturationRange[1]=t}setValueRange(e,t){this.ValueRange[0]=e,this.ValueRange[1]=t}setRange(e,t){this.InputRange[0]=e,this.InputRange[1]=t}setAlphaRange(e,t){this.AlphaRange[0]=e,this.AlphaRange[1]=t}getColor(e){return this.mapValue(e)}build(e){let t,r,n,i;if(this.Table.length>1&&!e)return;this.Table=[];let a=this.NumberOfColors-1;a?(t=(this.HueRange[1]-this.HueRange[0])/a,r=(this.SaturationRange[1]-this.SaturationRange[0])/a,n=(this.ValueRange[1]-this.ValueRange[0])/a,i=(this.AlphaRange[1]-this.AlphaRange[0])/a):t=r=n=i=0;for(let e=0;e<=a;e++){let a=this.HueRange[0]+e*t,o=this.SaturationRange[0]+e*r,s=this.ValueRange[0]+e*n,l=this.AlphaRange[0]+e*i,u=function(e,t,r){if(e>1)throw Error("HSVToRGB expects hue < 1");let n=[];if(0===t)return n[0]=r,n[1]=r,n[2]=r,n;let i=Math.floor(6*e),a=6*e-i,o=r*(1-t),s=r*(1-t*a),l=r*(1-t*(1-a));switch(i){case 0:case 6:n[0]=r,n[1]=l,n[2]=o;break;case 1:n[0]=s,n[1]=r,n[2]=o;break;case 2:n[0]=o,n[1]=r,n[2]=l;break;case 3:n[0]=o,n[1]=s,n[2]=r;break;case 4:n[0]=l,n[1]=o,n[2]=r;break;case 5:n[0]=r,n[1]=o,n[2]=s}return n}(a,o,s),c=[0,0,0,0];switch(this.Ramp){case"scurve":c[0]=Math.floor(127.5*(1+Math.cos((1-u[0])*Math.PI))),c[1]=Math.floor(127.5*(1+Math.cos((1-u[1])*Math.PI))),c[2]=Math.floor(127.5*(1+Math.cos((1-u[2])*Math.PI))),c[3]=Math.floor(255*l);break;case"linear":c[0]=Math.floor(255*u[0]+.5),c[1]=Math.floor(255*u[1]+.5),c[2]=Math.floor(255*u[2]+.5),c[3]=Math.floor(255*l+.5);break;case"sqrt":c[0]=Math.floor(255*Math.sqrt(u[0])+.5),c[1]=Math.floor(255*Math.sqrt(u[1])+.5),c[2]=Math.floor(255*Math.sqrt(u[2])+.5),c[3]=Math.floor(255*Math.sqrt(l)+.5);break;default:throw Error(`Invalid Ramp value (${this.Ramp})`)}this.Table.push(c)}this.buildSpecialColors()}buildSpecialColors(){let e=this.NumberOfColors,t=e+0,r=e+1;this.UseBelowRangeColor||0===e?this.Table[t]=this.BelowRangeColor:this.Table[t]=this.Table[0],this.UseAboveRangeColor||0===e?this.Table[r]=this.AboveRangeColor:this.Table[r]=this.Table[e-1],this.Table[e+2]=this.NaNColor}mapValue(e){let t=this.getIndex(e);if(t<0)return this.NaNColor;if(0===t){if(this.UseBelowRangeColor&&ethis.TableRange[1])return this.AboveRangeColor;return this.Table[t]}getIndex(e){let t={Range:[],MaxIndex:this.NumberOfColors-1,Shift:-this.TableRange[0],Scale:1};if(this.TableRange[1]<=this.TableRange[0]?t.Scale=Number.MAX_VALUE:t.Scale=t.MaxIndex/(this.TableRange[1]-this.TableRange[0]),t.Range[0]=this.TableRange[0],t.Range[1]=this.TableRange[1],isNaN(e))return -1;let r=Math.floor(et.Range[1]?t.MaxIndex+1+1.5:(e+t.Shift)*t.Scale);return r===this.NumberOfColors+0?r=0:r===this.NumberOfColors+1&&(r=this.NumberOfColors-1),r}setTableValue(e,t,r,n,i){let a;if("number"==typeof t&&void 0!==r&&void 0!==n&&void 0!==i)a=[t,r,n,i];else if(Array.isArray(t))a=t;else throw Error("Invalid arguments for setTableValue");if(e<0)throw Error(`Can't set the table value for negative index (${e})`);if(e>=this.NumberOfColors)throw Error(`Index ${e} is greater than the number of colors ${this.NumberOfColors}`);this.Table[e]=a,(0===e||e===this.NumberOfColors-1)&&this.buildSpecialColors()}}let i=n;var a=r(14645),o=r(56109),s=r(60251);let l=[0,0,0,0],u=new Set(["gray","grey","grayscale","greyscale"]);function c(e,t,r){let n,i=[],a=[],o=[],s=[];for(n=0,r=null===r?1:r;n0;)i.push(e),e+=n;return i[i.length-1]=1,i}(0,1,e);for(n=0;n{let a=[];return r.getColor(n+t/256*(i-n),a),[Math.round(255*a[0]),Math.round(255*a[1]),Math.round(255*a[2]),255]});return{colors:a,name:e.Name||t,numColors:a.length}}(c,d))),"string"==typeof e?void 0:e,r?.voiRange)}let h=function(e){let t=e.trim().toLowerCase();return Object.keys(a.A).find(e=>{let r=a.A[e];return e.toLowerCase()===t||r.name?.trim().toLowerCase()===t})}(n);return m(h?p(h):void 0,"string"==typeof e?void 0:e,r?.voiRange)}function p(e,t){let r=a.A[e];return r||(r=a.A[e]=t||{name:"",colors:[]}),!r.colors&&r.segmentedData&&(r.colors=function(e,t,r){let n,i=[];r=null===r?1:r;let a=c(t=null===t?256:t,e.red,r),o=c(t,e.green,r),s=c(t,e.blue,r);for(n=0;ne,getColorSchemeName:()=>r.name,setColorSchemeName(e){r.name=e},getNumberOfColors:()=>r.colors.length,setNumberOfColors(e){for(;r.colors.lengthe>=0&&e{var o,s;let l=1===n?0:(o=a,Math.min((s=n)-1,Math.floor(o/256*s))),u=e.getColor(l),c=function(e,t,r){if(void 0!==r&&e0?(e-n.value)/t:0;return h(n.opacity+(i.opacity-n.opacity)*r)}}return h(t[t.length-1].opacity)}(r.lower+(r.upper-r.lower)*(a/256),t?.opacity,t?.threshold);return[u[0],u[1],u[2],Math.round(u[3]/255*c*255)]})}(e,t,r);return p([e.getId(),`lower:${f(r.lower)}`,`upper:${f(r.upper)}`,`opacity:${void 0===(n=t?.opacity)?"none":"number"==typeof n?String(f(n)):n.map(({opacity:e,value:t})=>`${f(t)}-${f(e)}`).join(",")}`,`threshold:${f(t?.threshold)}`].join(":"),{colors:i,name:e.getColorSchemeName(),numColors:i.length})}function h(e){return Math.max(0,Math.min(1,e))}function f(e){return void 0===e?"none":String(Math.round(1e3*e)/1e3)}},58764:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RangeImpl=void 0;let n=r(60957),i=r(5309),a=r(31846),o=r(32008),s=r(47518),l=r(48040),u=r(79663);class c extends a.AbstractRangeImpl{static START_TO_START=0;static START_TO_END=1;static END_TO_END=2;static END_TO_START=3;START_TO_START=0;START_TO_END=1;END_TO_END=2;END_TO_START=3;_start;_end;constructor(){super();let e=n.dom.window._associatedDocument;this._start=[e,0],this._end=[e,0],n.dom.rangeList.add(this)}get commonAncestorContainer(){let e=this._start[0];for(;!(0,s.tree_isAncestorOf)(this._end[0],e,!0);){if(null===e._parent)throw Error("Parent node is null.");e=e._parent}return e}setStart(e,t){(0,s.range_setTheStart)(this,e,t)}setEnd(e,t){(0,s.range_setTheEnd)(this,e,t)}setStartBefore(e){let t=e._parent;if(null===t)throw new o.InvalidNodeTypeError;(0,s.range_setTheStart)(this,t,(0,s.tree_index)(e))}setStartAfter(e){let t=e._parent;if(null===t)throw new o.InvalidNodeTypeError;(0,s.range_setTheStart)(this,t,(0,s.tree_index)(e)+1)}setEndBefore(e){let t=e._parent;if(null===t)throw new o.InvalidNodeTypeError;(0,s.range_setTheEnd)(this,t,(0,s.tree_index)(e))}setEndAfter(e){let t=e._parent;if(null===t)throw new o.InvalidNodeTypeError;(0,s.range_setTheEnd)(this,t,(0,s.tree_index)(e)+1)}collapse(e){e?this._end=this._start:this._start=this._end}selectNode(e){(0,s.range_select)(e,this)}selectNodeContents(e){if(u.Guard.isDocumentTypeNode(e))throw new o.InvalidNodeTypeError;let t=(0,s.tree_nodeLength)(e);this._start=[e,0],this._end=[e,t]}compareBoundaryPoints(e,t){let r,n;if(e!==i.HowToCompare.StartToStart&&e!==i.HowToCompare.StartToEnd&&e!==i.HowToCompare.EndToEnd&&e!==i.HowToCompare.EndToStart)throw new o.NotSupportedError;if((0,s.range_root)(this)!==(0,s.range_root)(t))throw new o.WrongDocumentError;switch(e){case i.HowToCompare.StartToStart:r=this._start,n=t._start;break;case i.HowToCompare.StartToEnd:r=this._end,n=t._start;break;case i.HowToCompare.EndToEnd:r=this._end,n=t._end;break;case i.HowToCompare.EndToStart:r=this._start,n=t._end;break;default:throw new o.NotSupportedError}let a=(0,s.boundaryPoint_position)(r,n);return a===i.BoundaryPosition.Before?-1:+(a===i.BoundaryPosition.After)}deleteContents(){let e,t;if((0,s.range_collapsed)(this))return;let r=this._startNode,n=this._startOffset,i=this._endNode,a=this._endOffset;if(r===i&&u.Guard.isCharacterDataNode(r))return void(0,s.characterData_replaceData)(r,n,a-n,"");let o=[];for(let e of(0,s.range_getContainedNodes)(this)){let t=e._parent;null!==t&&(0,s.range_isContained)(t,this)||o.push(e)}if((0,s.tree_isAncestorOf)(i,r,!0))e=r,t=n;else{let n=r;for(;null!==n._parent&&!(0,s.tree_isAncestorOf)(i,n._parent,!0);)n=n._parent;if(null===n._parent)throw Error("Parent node is null.");e=n._parent,t=(0,s.tree_index)(n)+1}for(let e of(u.Guard.isCharacterDataNode(r)&&(0,s.characterData_replaceData)(r,n,(0,s.tree_nodeLength)(r)-n,""),o))e._parent&&(0,s.mutation_remove)(e,e._parent);u.Guard.isCharacterDataNode(i)&&(0,s.characterData_replaceData)(i,0,a,""),this._start=[e,t],this._end=[e,t]}extractContents(){return(0,s.range_extract)(this)}cloneContents(){return(0,s.range_cloneTheContents)(this)}insertNode(e){return(0,s.range_insert)(e,this)}surroundContents(e){for(let e of(0,s.range_getPartiallyContainedNodes)(this))if(!u.Guard.isTextNode(e))throw new o.InvalidStateError;if(u.Guard.isDocumentNode(e)||u.Guard.isDocumentTypeNode(e)||u.Guard.isDocumentFragmentNode(e))throw new o.InvalidNodeTypeError;let t=(0,s.range_extract)(this);0!==e._children.size&&(0,s.mutation_replaceAll)(null,e),(0,s.range_insert)(e,this),(0,s.mutation_append)(t,e),(0,s.range_select)(e,this)}cloneRange(){return(0,s.create_range)(this._start,this._end)}detach(){n.dom.rangeList.delete(this)}isPointInRange(e,t){if((0,s.tree_rootNode)(e)!==(0,s.range_root)(this))return!1;if(u.Guard.isDocumentTypeNode(e))throw new o.InvalidNodeTypeError;if(t>(0,s.tree_nodeLength)(e))throw new o.IndexSizeError;let r=[e,t];return(0,s.boundaryPoint_position)(r,this._start)!==i.BoundaryPosition.Before&&(0,s.boundaryPoint_position)(r,this._end)!==i.BoundaryPosition.After}comparePoint(e,t){if((0,s.tree_rootNode)(e)!==(0,s.range_root)(this))throw new o.WrongDocumentError;if(u.Guard.isDocumentTypeNode(e))throw new o.InvalidNodeTypeError;if(t>(0,s.tree_nodeLength)(e))throw new o.IndexSizeError;let r=[e,t];return(0,s.boundaryPoint_position)(r,this._start)===i.BoundaryPosition.Before?-1:+((0,s.boundaryPoint_position)(r,this._end)===i.BoundaryPosition.After)}intersectsNode(e){if((0,s.tree_rootNode)(e)!==(0,s.range_root)(this))return!1;let t=e._parent;if(null===t)return!0;let r=(0,s.tree_index)(e);return(0,s.boundaryPoint_position)([t,r],this._end)===i.BoundaryPosition.Before&&(0,s.boundaryPoint_position)([t,r+1],this._start)===i.BoundaryPosition.After}toString(){let e="";if(this._startNode===this._endNode&&u.Guard.isTextNode(this._startNode))return this._startNode._data.substring(this._startOffset,this._endOffset);for(let t of(u.Guard.isTextNode(this._startNode)&&(e+=this._startNode._data.substring(this._startOffset)),(0,s.range_getContainedNodes)(this)))u.Guard.isTextNode(t)&&(e+=t._data);return u.Guard.isTextNode(this._endNode)&&(e+=this._endNode._data.substring(0,this._endOffset)),e}static _create(e,t){let r=new c;return e&&(r._start=e),t&&(r._end=t),r}}t.RangeImpl=c,(0,l.idl_defineConst)(c.prototype,"START_TO_START",0),(0,l.idl_defineConst)(c.prototype,"START_TO_END",1),(0,l.idl_defineConst)(c.prototype,"END_TO_END",2),(0,l.idl_defineConst)(c.prototype,"END_TO_START",3)},58804:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>j});var n=r(11701),i=r(22783),a=r(50923),o=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];function s(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]}function l(e){return e?.length>=6&&e[0]<=e[1]&&e[2]<=e[3]&&e[4]<=e[5]}function u(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function c(e){return u(e,o)}function d(e,t,r,n){let[i,a,o,s,l,u]=e;return"number"==typeof t?(e[0]=it?a:t,e[2]=or?s:r,e[4]=ln?u:n):(e[0]=it[0]?a:t[0],e[2]=ot[1]?s:t[1],e[4]=lt[2]?u:t[2]),e}function p(e,t){if(0===t.length)return e;if(Array.isArray(t[0]))for(let r=0;ra?t:a,e[2]=r,e[3]=r>s?r:s,e[4]=n,e[5]=n>u?n:u,i!==t||o!==r||l!==n}function f(e,t,r,n){let[i,a,o,s,l,u]=e;return e[0]=tn&&(n=i,r=a),t[a]=+(i>0);if(r<0)return g(e,.5);for(let r=0;r<3;++r)if(!t[r]){let t=.005*n;e[2*r]-=t,e[2*r+1]+=t}return e}(e):(e[0]-=t,e[1]+=t,e[2]-=t,e[3]+=t,e[4]-=t,e[5]+=t,e)}function v(e,t,r,n){return!!l(e)&&(t>=0?(e[0]*=t,e[1]*=t):(e[0]=t*e[1],e[1]=t*e[0]),r>=0?(e[2]*=r,e[3]*=r):(e[2]=r*e[3],e[3]=r*e[2]),n>=0?(e[4]*=n,e[5]*=n):(e[4]=n*e[5],e[5]=n*e[4]),!0)}function y(e){return[.5*(e[0]+e[1]),.5*(e[2]+e[3]),.5*(e[4]+e[5])]}function b(e,t){return e[2*t+1]-e[2*t]}function I(e){return[b(e,0),b(e,1),b(e,2)]}function x(e){return e.slice(0,2)}function C(e){return e.slice(2,4)}function A(e){return e.slice(4,6)}function T(e){let t=I(e);return t[0]>t[1]?t[0]>t[2]?t[0]:t[2]:t[1]>t[2]?t[1]:t[2]}function S(e){if(l(e)){let t=I(e);return t[0]*t[0]+t[1]*t[1]+t[2]*t[2]}return null}function w(e){let t=S(e);return null!==t?Math.sqrt(t):null}function O(e){return[e[0],e[2],e[4]]}function P(e){return[e[1],e[3],e[5]]}function _(e,t){return e<=0&&t>=0||e>=0&&t<=0}function E(e,t){return t[0]=[e[0],e[2],e[4]],t[1]=[e[0],e[2],e[5]],t[2]=[e[0],e[3],e[4]],t[3]=[e[0],e[3],e[5]],t[4]=[e[1],e[2],e[4]],t[5]=[e[1],e[2],e[5]],t[6]=[e[1],e[3],e[4]],t[7]=[e[1],e[3],e[5]],t}function D(e,t,r){return t[0]=e[0],t[1]=e[2],t[2]=e[4],r[0]=e[1],r[1]=e[3],r[2]=e[5],t}function R(e,t,r=[]){let n=E(e,[]);for(let e=0;ee[2*r+1]?(o[r]=0,u[r]=e[2*r+1],a=!1):o[r]=2;if(a)return n[0]=t[0],n[1]=t[1],n[2]=t[2],i[0]=0,1;for(let e=0;e<3;e++)2!==o[e]&&0!==r[e]?l[e]=(u[e]-t[e])/r[e]:l[e]=-1;for(let e=0;e<3;e++)l[s]1||l[s]<0)return 0;i[0]=l[s];for(let i=0;i<3;i++)if(s!==i){if(n[i]=t[i]+l[s]*r[i],n[i]e[2*i+1])return 0}else n[i]=u[i];return 1}function L(e,t,r){let n=[],a=0,o=1,s=1;for(let l=4;l<=5;++l){n[2]=e[l];for(let l=2;l<=3;++l){n[1]=e[l];for(let l=0;l<=1;++l)if(n[0]=e[l],a=i.Ay.evaluate(r,t,n),s&&(o=a>=0?1:-1,s=0),0===a||o>0&&a<0||o<0&&a>0)return 1}}return 0}function B(e,t){let r;if(!(l(e)&&l(t)))return!1;let n=[0,0,0,0,0,0];for(let i=0;i<3;i++)if(r=!1,t[2*i]>=e[2*i]&&t[2*i]<=e[2*i+1]?(r=!0,n[2*i]=t[2*i]):e[2*i]>=t[2*i]&&e[2*i]<=t[2*i+1]&&(r=!0,n[2*i]=e[2*i]),t[2*i+1]>=e[2*i]&&t[2*i+1]<=e[2*i+1]?(r=!0,n[2*i+1]=t[2*i+1]):e[2*i+1]>=t[2*i]&&e[2*i+1]<=t[2*i+1]&&(r=!0,n[2*i+1]=e[2*i+1]),!r)return!1;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],!0}function F(e,t){if(!(l(e)&&l(t)))return!1;for(let r=0;r<3;r++){if((!(t[2*r]>=e[2*r])||!(t[2*r]<=e[2*r+1]))&&(!(e[2*r]>=t[2*r])||!(e[2*r]<=t[2*r+1]))&&(!(t[2*r+1]>=e[2*r])||!(t[2*r+1]<=e[2*r+1]))){if(!(e[2*r+1]>=t[2*r])||!(e[2*r+1]<=t[2*r+1]))return!1}}return!0}function U(e,t,r,n){return!(te[1])&&!(re[3])&&!(ne[5])}function k(e,t,r){let n=[[0,1,2,3,4,5,6,7],[0,1,4,5,2,3,6,7],[0,2,4,6,1,3,5,7]],a=[0,0,0,0,0,0,0,0],o=0;for(let n=0;n<2;n++)for(let s=2;s<4;s++)for(let l=4;l<6;l++){let u=[e[n],e[s],e[l]];a[o++]=i.Ay.evaluate(r,t,u)}let s=2;for(;s--&&!(_(a[n[s][0]],a[n[s][4]])&&_(a[n[s][1]],a[n[s][5]])&&_(a[n[s][2]],a[n[s][6]])&&_(a[n[s][3]],a[n[s][7]])););if(s<0)return!1;let l=Math.sign(r[s]),u=Math.abs((e[2*s+1]-e[2*s])*r[s]),c=+(l>0);for(let e=0;e<4;e++){if(0===u)continue;let t=Math.abs(a[n[s][e]])/u;l>0&&tc&&(c=t)}let d=(1-c)*e[2*s]+c*e[2*s+1];return l>0?e[2*s]=d:e[2*s+1]=d,!0}function G(e,t){for(let e=0;e<3;++e)t[e]=t[e]<1?1:t[e];let r=t[0]*t[1]*t[2];for(;r>e;){for(let e=0;e<3;++e)t[e]=t[e]>1?t[e]-1:1;r=t[0]*t[1]*t[2]}}function W(e,t,r,n=[]){t=t<=0?1:t;let i=0,a=[0,0,0],o=-1,s=0,l=I(e),u=l[0]+l[1]+l[2],c=.001/3*u;for(let e=0;e<3;++e)l[e]>s&&(o=e,s=l[e]),l[e]>c?(a[e]=1,i++):a[e]=0;let d=O(e),p=P(e);if(i<1)return r[0]=1,r[1]=1,r[2]=1,n[0]=d[0]-.5,n[1]=p[0]+.5,n[2]=d[1]-.5,n[3]=p[1]+.5,n[4]=d[2]-.5,n[5]=p[2]+.5,1;let m=t;m/=a[0]?l[0]/u:1,m/=a[1]?l[1]/u:1,m/=a[2]?l[2]/u:1,m**=1/i;for(let e=0;e<3;++e)r[e]=a[e]?Math.floor(m*l[e]/u):1,r[e]=r[e]<1?1:r[e];G(t,r);let h=.5*l[o]/r[o];for(let e=0;e<3;++e)a[e]?(n[2*e]=d[e],n[2*e+1]=p[e]):(n[2*e]=d[e]-h,n[2*e+1]=p[e]+h);return r[0]*r[1]*r[2]}function z(e,t){if(e[0]>=t[0]&&e[0]<=t[1]&&e[1]>=t[2]&&e[1]<=t[3]&&e[2]>=t[4]&&e[2]<=t[5])return 0;let r=[0,0,0];return e[0]t[1]&&(r[0]=e[0]-t[1]),e[1]t[3]&&(r[1]=e[1]-t[3]),e[2]t[5]&&(r[2]=e[2]-t[5]),(0,n.Om)(r,r)}var H=class{constructor(e){this.bounds=e,this.bounds||(this.bounds=new Float64Array(o))}getBounds(){return this.bounds}equals(e){return s(this.bounds,e)}isValid(){return l(this.bounds)}setBounds(e){return u(this.bounds,e)}reset(){return c(this.bounds)}addPoint(...e){return d(this.bounds,...e)}addPoints(e){return p(this.bounds,e)}addBounds(e,t,r,n,i,a){return m(this.bounds,e,t,r,n,i,a)}setMinPoint(e,t,r){return h(this.bounds,e,t,r)}setMaxPoint(e,t,r){return f(this.bounds,e,t,r)}inflate(e){return g(this.bounds,e)}scale(e,t,r){return v(this.bounds,e,t,r)}getCenter(){return y(this.bounds)}getLength(e){return b(this.bounds,e)}getLengths(){return I(this.bounds)}getMaxLength(){return T(this.bounds)}getDiagonalLength(){return w(this.bounds)}getDiagonalLength2(){return S(this.bounds)}getMinPoint(){return O(this.bounds)}getMaxPoint(){return P(this.bounds)}getXRange(){return x(this.bounds)}getYRange(){return C(this.bounds)}getZRange(){return A(this.bounds)}getCorners(e){return E(this.bounds,e)}computeCornerPoints(e,t){return D(this.bounds,e,t)}computeLocalBounds(e,t,r){return N(this.bounds,e,t,r)}transformBounds(e,t=[]){return R(this.bounds,e,t)}computeScale3(e){return M(this.bounds,e)}cutWithPlane(e,t){return k(this.bounds,e,t)}intersectBox(e,t,r,n){return V(this.bounds,e,t,r,n)}intersectPlane(e,t){return L(this.bounds,e,t)}intersect(e){return B(this.bounds,e)}intersects(e){return F(this.bounds,e)}containsPoint(e,t,r){return U(this.bounds,e,t,r)}contains(e){return F(this.bounds,e)}computeDivisions(e,t,r=[]){return W(this.bounds,e,t,r)}distance2ToBounds(e){return z(e,this.bounds)}},j={newInstance:function(e){return new H(e&&e.bounds)},equals:s,isValid:l,setBounds:u,reset:c,addPoint:d,addPoints:p,addBounds:m,setMinPoint:h,setMaxPoint:f,inflate:g,scale:v,scaleAboutCenter:function(e,t,r,n){if(!l(e))return!1;let i=y(e);return e[0]-=i[0],e[1]-=i[0],e[2]-=i[1],e[3]-=i[1],e[4]-=i[2],e[5]-=i[2],v(e,t,r,n),e[0]+=i[0],e[1]+=i[0],e[2]+=i[1],e[3]+=i[1],e[4]+=i[2],e[5]+=i[2],!0},getCenter:y,getLength:b,getLengths:I,getMaxLength:T,getDiagonalLength:w,getDiagonalLength2:S,getMinPoint:O,getMaxPoint:P,getXRange:x,getYRange:C,getZRange:A,getCorners:E,computeCornerPoints:D,computeLocalBounds:N,transformBounds:R,computeScale3:M,cutWithPlane:k,intersectBox:V,intersectPlane:L,intersect:B,intersects:F,containsPoint:U,contains:function(e,t){return!!F(e,t)&&!!U(e,...O(t))&&!!U(e,...P(t))},computeDivisions:W,clampDivisions:G,distance2ToBounds:z,INIT_BOUNDS:o}},58851:(e,t,r)=>{"use strict";r.d(t,{A:()=>g});var n=r(77280),i=r(6297),a=r(92336),o=r(69228),s=r(55580),l=r(31608),u=r(63247),c=r(54268),d=r(3793),p=r(850),m=r(39262),h=r(98197);class f extends s.A{constructor(e){super({...e,canvas:e.canvas||(0,l.oI)(e.element)}),this.videoWidth=0,this.videoHeight=0,this.loop=!0,this.mute=!0,this.isPlaying=!1,this.scrollSpeed=1,this.playbackRate=1,this.frameRange=[0,0],this.fps=30,this.videoCamera={panWorld:[0,0],parallelScale:1},this.voiRange={lower:0,upper:255},this.getProperties=()=>({loop:this.videoElement.loop,muted:this.videoElement.muted,playbackRate:this.playbackRate,scrollSpeed:this.scrollSpeed,voiRange:{...this.voiRange}}),this.getMiddleSliceData=()=>{throw Error("Method not implemented.")},this.useCustomRenderingPipeline=!0,this.resetCamera=()=>(this.refreshRenderValues(),this.canvasContext.fillRect(0,0,this.canvas.width,this.canvas.height),this.isPlaying||this.renderFrame(),!0),this.getNumberOfSlices=()=>{let e=Math.round(this.videoElement.duration*this.fps/this.scrollSpeed);return isNaN(e)?this.numberOfFrames:e},this.getFrameOfReferenceUID=()=>this.videoElement.src,this.resize=()=>{let e=this.canvas,{clientWidth:t,clientHeight:r}=e;(e.width!==t||e.height!==r)&&(e.width=t,e.height=r),this.refreshRenderValues(),this.isPlaying||this.renderFrame()},this.canvasToWorld=(e,t=[0,0,0])=>{let r=this.videoCamera.panWorld,n=this.getWorldToCanvasRatio(),i=[r[0]*n,r[1]*n],a=[e[0]-i[0],e[1]-i[1]];return t.splice(0,2,a[0]/n,a[1]/n),t},this.worldToCanvas=e=>{let t=this.videoCamera.panWorld,r=this.getWorldToCanvasRatio();return[(e[0]+t[0])*r,(e[1]+t[1])*r]},this.getRotation=()=>0,this.canvasToIndex=e=>{let t=this.getTransform();return t.invert(),t.transformPoint(e.map(e=>e*devicePixelRatio))},this.indexToCanvas=e=>this.getTransform().transformPoint(e).map(e=>e/devicePixelRatio),this.customRenderViewportToCanvas=()=>{this.renderFrame()},this.renderFrame=()=>{let e=window.devicePixelRatio||1,t=this.getTransform().getMatrix(),r=this.canvasContext;for(let n of(r.resetTransform(),r.clearRect(0,0,this.canvas.width,this.canvas.height),r.transform(t[0]/e,t[1]/e,t[2]/e,t[3]/e,t[4]/e,t[5]/e),r.drawImage(this.videoElement,0,0,this.videoWidth,this.videoHeight),this.getActors()))n.actor.render(this,this.canvasContext);this.canvasContext.resetTransform(),this.setRendered(),(0,o.A)(this.element,n.sV.STACK_NEW_IMAGE,{element:this.element,viewportId:this.id,viewport:this,renderingEngineId:this.renderingEngineId,time:this.videoElement.currentTime,duration:this.videoElement.duration}),(0,o.A)(this.element,n.sV.IMAGE_RENDERED,{element:this.element,viewportId:this.id,viewport:this,imageIndex:this.getCurrentImageIdIndex(),numberOfSlices:this.numberOfFrames,renderingEngineId:this.renderingEngineId,time:this.videoElement.currentTime,duration:this.videoElement.duration}),this.initialRender?.();let i=this.getFrameNumber();this.isPlaying&&(ithis.frameRange[1]&&(this.loop?this.setFrameNumber(this.frameRange[0]):this.pause()))},this.renderWhilstPlaying=()=>{this.renderFrame(),this.isPlaying&&requestAnimationFrame(this.renderWhilstPlaying)},this.canvasContext=this.canvas.getContext("2d"),this.renderingEngineId=e.renderingEngineId,this.element.setAttribute("data-viewport-uid",this.id),this.element.setAttribute("data-rendering-engine-uid",this.renderingEngineId),this.videoElement=document.createElement("video"),this.videoElement.muted=this.mute,this.videoElement.loop=this.loop,this.videoElement.autoplay=!0,this.videoElement.crossOrigin="anonymous",this.addEventListeners(),this.resize()}static get useCustomRenderingPipeline(){return!0}addEventListeners(){this.canvas.addEventListener(n.sV.ELEMENT_DISABLED,this.elementDisabledHandler)}removeEventListeners(){this.canvas.removeEventListener(n.sV.ELEMENT_DISABLED,this.elementDisabledHandler)}elementDisabledHandler(){this.removeEventListeners(),this.videoElement.remove()}getImageDataMetadata(e){let t="string"==typeof e?e:e.imageId,r=(0,h.getVideoImageDataMetadata)(t);return this.hasPixelSpacing=r.hasPixelSpacing,r}setDataIds(e,t){this.setVideo(e[0],(t.viewReference?.sliceIndex||0)+1)}setDataList(e){if(e.length)return this.setVideo(e[0].dataId)}async setDisplaySets(...e){await this.mountDisplaySets(e,async e=>{let t=(0,i._d)(e.displaySetId),{frameNumber:r,viewReference:n}=e.options??{},a=r??("number"==typeof n?.sliceIndex?n.sliceIndex+1:void 0);await this.setVideo(t,a)})}setVideo(e,t){this.clearDisplaySets(),this.imageId=Array.isArray(e)?e[0]:e;let r=(0,h.loadVideoStreamMetadata)(e);return this.modality=r.modality,this.metadata=r.metadata,this.numberOfFrames=r.numberOfFrames,this.setVideoURL(r.renderedUrl).then(()=>{let e=(0,h.normalizeVideoPlaybackInfo)({durationSeconds:this.videoElement.duration,cineRate:r.cineRate,numberOfFrames:r.numberOfFrames});return this.fps=e.fps,this.numberOfFrames=e.numberOfFrames,this.setFrameRange(e.frameRange),this.initialRender=()=>{this.initialRender=null,this.pause(),this.setFrameNumber(t||1)},new Promise(e=>{window.setTimeout(()=>{this.setFrameNumber(t||1),e(this)},25)})})}async setVideoURL(e){return new Promise(t=>{this.videoElement.src=e,this.videoElement.preload="auto";let r=()=>{this.videoWidth=this.videoElement.videoWidth,this.videoHeight=this.videoElement.videoHeight,this.videoElement.removeEventListener("loadedmetadata",r),this.refreshRenderValues(),t(!0)};this.videoElement.addEventListener("loadedmetadata",r)})}getImageIds(){let e=Array(this.numberOfFrames),t=this.imageId.replace(/[0-9]+$/,"");for(let r=0;r{r(),t.removeEventListener("seeked",i)};t.addEventListener("seeked",i)}async start(){let e=this.videoElement,t=this.renderFrame;if(e.currentTime=0,e.paused){let r=()=>{t(),e.removeEventListener("seeked",r)};e.addEventListener("seeked",r)}}async end(){let e=this.videoElement,t=this.renderFrame;if(e.currentTime=e.duration,e.paused){let r=()=>{t(),e.removeEventListener("seeked",r)};e.addEventListener("seeked",r)}}async setTime(e){let t=this.videoElement,r=this.renderFrame;if(t.currentTime=e,t.paused){let e=()=>{r(),t.removeEventListener("seeked",e)};t.addEventListener("seeked",e)}}getSliceViewInfo(){throw Error("Method not implemented.")}async setFrameNumber(e){this.setTime((e-1)/this.fps)}setFrameRange(e){if(!e){this.frameRange=[1,this.numberOfFrames];return}2===e.length&&e[0]!==e[1]&&(this.frameRange=[e[0],e[1]])}getSliceIndexForImage(e){if(e){if("string"==typeof e)return p.A.imageIdToFrameStart(e);if(e.referencedImageId)return p.A.imageIdToFrameStart(e.referencedImageId)}}getFrameRange(){return this.frameRange}setProperties(e){void 0!==e.loop&&(this.videoElement.loop=e.loop),void 0!==e.muted&&(this.videoElement.muted=e.muted),void 0!==e.playbackRate&&this.setPlaybackRate(e.playbackRate),void 0!==e.scrollSpeed&&this.setScrollSpeed(e.scrollSpeed),e.voiRange&&this.setVOI(e.voiRange)}setPlaybackRate(e=1){if(this.playbackRate=e,e<.0625)return void this.pause();this.videoElement&&(this.videoElement.playbackRate=e,this.play())}setScrollSpeed(e=1,t=n.QO.s.FRAME){this.scrollSpeed=t===n.QO.s.SECOND?e*this.fps:e}resetProperties(){this.setProperties({loop:!1,muted:!0,voiRange:{lower:0,upper:255}})}getScalarData(){if(this.scalarData?.frameNumber===this.getFrameNumber())return this.scalarData;if(!this.videoElement||!this.videoElement.videoWidth||!this.videoElement.videoHeight){console.debug("Video not ready yet, returning empty scalar data");let e=new Uint8ClampedArray;return e.getRange=()=>[0,255],e.frameNumber=-1,e}let e=document.createElement("canvas");e.width=this.videoElement.videoWidth,e.height=this.videoElement.videoHeight;let t=e.getContext("2d");t.drawImage(this.videoElement,0,0);let r=t.getImageData(0,0,e.width,e.height).data;return r.getRange=()=>[0,255],r.frameNumber=this.getFrameNumber(),this.scalarData=r,r}getImageData(){let{metadata:e}=this,t=e.spacing,r={getDirection:()=>e.direction,getDimensions:()=>e.dimensions,getRange:()=>[0,255],getScalarData:()=>this.getScalarData(),getSpacing:()=>e.spacing,worldToIndex:e=>{let t=this.worldToCanvas(e),r=this.canvasToIndex(t);return[r[0],r[1],0]},indexToWorld:(e,t)=>{let r=this.indexToCanvas([e[0],e[1]]);return this.canvasToWorld(r,t)}},n={dimensions:e.dimensions,spacing:t,origin:e.origin,direction:e.direction,metadata:{Modality:this.modality,FrameOfReferenceUID:e.FrameOfReferenceUID},getScalarData:()=>this.getScalarData(),scalarData:this.getScalarData(),imageData:r,voxelManager:{forEach:(e,t)=>(0,m.ii)(t.imageData,{pointInShapeFn:t.isInObject??(()=>!0),callback:e,boundsIJK:t.boundsIJK,returnPoints:t.returnPoints??!1})},hasPixelSpacing:this.hasPixelSpacing,calibration:this.calibration,preScale:{scaled:!1}};return Object.defineProperty(r,"scalarData",{get:()=>this.getScalarData(),enumerable:!0}),n}hasImageURI(e){let t=e.match(f.frameRangeExtractor),r=t?e.substring(0,t.index):e;return this.imageId.includes(r)}setVOI(e){this.voiRange=e;let t=this.setColorTransform(e,this.averageWhite);this.canvas.style.filter=t}setWindowLevel(e=256,t=128){let r=t-e/2,n=t+e/2-1;this.setVOI({lower:r,upper:n}),this.setColorTransform({lower:r,upper:n},this.averageWhite)}setAverageWhite(e){this.averageWhite=e,this.setColorTransform(this.voiRange,e)}setCamera(e){let{parallelScale:t,focalPoint:r}=e;if(t&&(this.videoCamera.parallelScale=this.element.clientHeight/2/t),void 0!==r){let e=this.worldToCanvas(r),t=[this.element.clientWidth/2,this.element.clientHeight/2],n=[(e[0]-t[0])/this.videoCamera.parallelScale,(e[1]-t[1])/this.videoCamera.parallelScale];this.videoCamera.panWorld=[this.videoCamera.panWorld[0]-n[0],this.videoCamera.panWorld[1]-n[1]]}this.canvasContext.fillStyle="rgba(0,0,0,1)",this.canvasContext.fillRect(0,0,this.canvas.width,this.canvas.height),this.isPlaying||this.renderFrame()}getCurrentImageId(e=this.getCurrentImageIdIndex()){return this.imageId?.replace("/frames/1",`/frames/${e+1}`)}getViewReferenceId(e={}){let{sliceIndex:t}=e;if(void 0===t)return`videoId:${this.getCurrentImageId()}`;if(Array.isArray(t))return`videoId:${this.imageId.substring(0,this.imageId.length-1)}${t[0]+1}-${t[1]+1}`;let r=this.imageId.replace("/frames/1",`/frames/${1+t}`);return`videoId:${r}`}isReferenceViewable(e,t={}){let{imageURI:r}=t,{referencedImageId:n,sliceIndex:i,multiSliceReference:a}=e;if(!super.isReferenceViewable(e))return!1;let o=this.getCurrentImageId();if(!r){let e=o.indexOf(":");r=o.substring(e+1,o.length-1)}if(t.withNavigation)return!0;let s=this.getSliceIndex();if(a){let e=p.A.imageIdToFrameEnd(a.referencedImageId);return s>=i&&s<=e}if(void 0!==i)return s===i;if(!n)return!1;let l=n.match(f.frameRangeExtractor);if(!l||!l[2])return!0;let u=l[2].split("-").map(e=>Number(e)),c=s+1;return u[0]<=c&&c<=(u[1]??u[0])}setViewReference(e){"number"==typeof e.sliceIndex?this.setFrameNumber(e.sliceIndex+1):Array.isArray(e.sliceIndex)&&this.setFrameRange(e.sliceIndex)}getViewReference(e){let t=e?.sliceIndex??(this.isPlaying?this.frameRange[0]:this.getCurrentImageIdIndex()),r=e?.rangeEndSliceIndex??(this.isPlaying?this.frameRange[1]-1:void 0),n=r>t?{sliceIndex:r,referencedImageId:this.getCurrentImageId(r)}:void 0;return{...super.getViewReference(e),referencedImageId:this.getViewReferenceId(e),sliceIndex:t,multiSliceReference:n}}getFrameNumber(){return 1+this.getCurrentImageIdIndex()}getCurrentImageIdIndex(){return Math.round(this.videoElement.currentTime*this.fps)}getSliceIndex(){return this.getCurrentImageIdIndex()/this.scrollSpeed}getCamera(){let{parallelScale:e}=this.videoCamera,t=[this.element.clientWidth/2,this.element.clientHeight/2];return{parallelProjection:!0,focalPoint:this.canvasToWorld(t),position:[0,0,0],viewUp:[0,-1,0],parallelScale:this.element.clientHeight/2/e,viewPlaneNormal:[0,0,1]}}getFrameRate(){return this.fps}getPan(){let e=this.videoCamera.panWorld;return[e[0],e[1]]}refreshRenderValues(){let e=this.canvas.offsetWidth/this.videoWidth;this.videoHeight*e>this.canvas.height&&(e=this.canvas.offsetHeight/this.videoHeight);let t=Math.floor(this.videoWidth*e),r=Math.floor(this.videoHeight*e),n=(this.canvas.offsetWidth-t)/2,i=(this.canvas.offsetHeight-r)/2,a=n/e,o=i/e;this.videoCamera.panWorld=[a,o],this.videoCamera.parallelScale=e}getWorldToCanvasRatio(){return this.videoCamera.parallelScale}getCanvasToWorldRatio(){return 1/this.videoCamera.parallelScale}getTransform(){let e=this.videoCamera.panWorld,t=window.devicePixelRatio||1,r=this.getWorldToCanvasRatio(),n=this.getCanvasToWorldRatio(),i=[this.canvas.offsetWidth/2,this.canvas.offsetHeight/2],o=[i[0]*n,i[1]*n],s=new a.d;return s.scale(t,t),s.translate(i[0],i[1]),s.scale(r,r),s.translate(e[0],e[1]),s.translate(-o[0],-o[1]),s}updateCameraClippingPlanesAndRange(){}addImages(e){let t=this.getActors();e.forEach(e=>{let{imageId:r,...n}=e,i=c.Ay.getImage(r),a=this.createActorMapper(i),o=e.actorUID??(0,d.A)();a&&(t.push({uid:o,actor:a,referencedId:r,...n}),e.callback&&e.callback({imageActor:a,imageId:r}))}),this.setActors(t)}createActorMapper(e){return new u.A(this,e)}}f.frameRangeExtractor=/(\/frames\/|[&?]frameNumber=)([^/&?]*)/i;let g=f},58956:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(70192),i=r(48937),a=r(5800);let o={[i.A.EnsureSegmentationVolumeFor3DManipulation]:e=>{let{operationData:t,viewport:r}=e,{segmentationId:i,imageIds:o}=t,s=r?r.getImageIds():o.map(e=>n.PP.getImage(e).referencedImageId);if(!n.BF.isValidVolume(s))throw Error("Volume is not reconstructable for sphere manipulation");let l=(0,a.A)(i);l&&(t.segmentationVoxelManager=l.voxelManager,t.segmentationImageData=l.imageData)}}},59052:(e,t,r)=>{"use strict";let n=r(50026),i=Object.prototype.toString;e.exports=new n("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;let t=Array(e.length);for(let r=0,n=e.length;r{"use strict";r.d(t,{A:()=>function e(t,r,i={closed:void 0}){if(t.length<3)return!1;let a=t.length,o=0,{closed:s,holes:l}=i;if(l?.length){for(let t of l)if(e(t,r))return!1}let u=!(void 0===s?(0,n.A)(t):s),c=t.length-(u?1:2);for(let e=0;e<=c;e++){let n=t[e],i=t[e===a-1?0:e+1],s=n[0]>=i[0]?n[0]:i[0],l=n[1]>=i[1]?n[1]:i[1],u=n[1]<=i[1]?n[1]:i[1];if(r[0]<=s&&r[1]>=u&&r[1]{"use strict";r.d(t,{Dh:()=>i.D,I8:()=>c,KR:()=>s,Mx:()=>l,fi:()=>u,gn:()=>d,nM:()=>i.n});var n=r(50923),i=r(75972);r(35972);var a=r(9638);function o(e){let t=n.S8(n.vt(),e.viewUp),r=n.S8(n.vt(),e.viewPlaneNormal),i=n.$A(n.vt(),t,r);return n.Bw(i)||(i=n.fA(1,0,0)),{right:n.S8(n.vt(),i),viewPlaneNormal:r,viewUp:t}}function s(e){let{camera:t,canvasWidth:r,canvasHeight:i,canvasPos:s}=e,l=Math.max(r,1),u=Math.max(i,1),{right:c,viewUp:d}=o(t),p=2*Math.max(t.parallelScale,.001),m=l/u*p*(1/(0,a.OB)(t.presentationScale)),h=(s[0]/l-.5)*m,f=(.5-s[1]/u)*p,g=[...t.focalPoint];return n.Ln(g,g,c,h),n.Ln(g,g,d,f),g}function l(e){let{camera:t,canvasWidth:r,canvasHeight:i,worldPos:s}=e,l=Math.max(r,1),u=Math.max(i,1),{right:c,viewUp:d}=o(t),p=2*Math.max(t.parallelScale,.001),m=l/u*p*(1/(0,a.OB)(t.presentationScale)),h=n.Re(n.vt(),s,t.focalPoint);return[(n.Om(h,c)/m+.5)*l,(.5-n.Om(h,d)/p)*u]}function u(e){let t="undefined"==typeof window?1:window.devicePixelRatio||1;return{canvasWidth:e.width/t,canvasHeight:e.height/t}}function c(e){let{canvasHeight:t,canvasWidth:r,columnPixelSpacing:n,columns:i,rowPixelSpacing:a,rows:o}=e;return .5*Math.max(Math.max(o,1)*(a||1),Math.max(i,1)*(n||1)/(Math.max(r,1)/Math.max(t,1)))}function d(e){let{dimensions:t,direction:r,spacing:i,viewPlaneNormal:a,viewUp:o}=e,s=Array.from(r),l=s.slice(0,3),u=s.slice(3,6),c=s.slice(6,9),d=n.S8(n.vt(),o),m=n.S8(n.vt(),a),h=n.S8(n.vt(),n.$A(n.vt(),d,m)),f=[l,u,c],g=p(h,f),v=p(n.ze(n.vt(),d),f);if(void 0!==g&&void 0!==v&&g!==v)return{columns:t[g],rows:t[v],columnPixelSpacing:i[g],rowPixelSpacing:i[v]}}function p(e,t){let r=t.map(t=>Math.abs(n.Om(e,t))),i=Math.max(...r);if(!(i<.995))return r.indexOf(i)}},59187:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(29470);let i=function(e,t,r,i,a={}){i.forEach((i,o)=>{(0,n.A)(e,t,r,i,a,o)})}},59244:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XMLSerializer=t.DOMParser=t.DOMImplementation=void 0,r(95663).dom.setFeatures(!0);var n=r(95663);Object.defineProperty(t,"DOMImplementation",{enumerable:!0,get:function(){return n.DOMImplementation}});var i=r(77912);Object.defineProperty(t,"DOMParser",{enumerable:!0,get:function(){return i.DOMParser}});var a=r(45359);Object.defineProperty(t,"XMLSerializer",{enumerable:!0,get:function(){return a.XMLSerializer}})},59351:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(91336);let i=(e,t,r)=>n.xg(e,t){"use strict";r.d(t,{A:()=>i});var n=r(63001);class i extends n.A{constructor(e,t){e.imageIds||(e.imageIds=t.imageIds),super(e,t),this.getImageIdsToLoad=()=>{let{imageIds:e}=this;return this.numFrames=e.length,e}}getScalarData(){return this.voxelManager.getScalarData()}getImageLoadRequests(e){let{imageIds:t}=this;return this.getImageIdsRequests(t,e)}}},59698:(e,t,r)=>{"use strict";r.d(t,{_t:()=>o,iJ:()=>a,ty:()=>s});var n=r(85250),i=r(50923);function a(e=0){return(e%360+360)%360}function o(e){let{rotation:t=0,viewPlaneNormal:r,viewUp:o}=e,s=a(t);if(0===s)return[...o];let l=n.fromRotation(n.create(),s*Math.PI/180,r);return i.Z0(i.vt(),o,l)}function s(e){let{flipHorizontal:t,flipVertical:r,viewPlaneNormal:n,viewUp:a}=e;return{viewPlaneNormal:!!t!=!!r?i.ze(i.vt(),n):[...n],viewUp:r?i.ze(i.vt(),a):[...a]}}},59780:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>u});var n=r(17042),i={device:null,handle:null};function a(e,t,r={}){Object.assign(t,i,r),n.Ay.obj(e,t),n.Ay.get(e,t,["lastCameraMTime"]),n.Ay.setGet(e,t,["device","handle"]),t.classHierarchy.push("vtkWebGPUShaderModule"),e.initialize=(e,r)=>{t.device=e,t.handle=t.device.getHandle().createShaderModule({code:r.getCode()})}}var o={newInstance:n.Ay.newInstance(a,"vtkWebGPUShaderModule"),extend:a},s={shaderModules:null,device:null,window:null};function l(e,t,r={}){Object.assign(t,s,r),t._shaderModules=new Map,n.Ay.obj(e,t),n.Ay.setGet(e,t,["device","window"]),t.classHierarchy.push("vtkWebGPUShaderCache"),e.getShaderModule=e=>{let r=e.getType(),n=e.getHash(),i=t._shaderModules.keys();for(let e=0;e{"use strict";var n;r.d(t,{A:()=>i,f:()=>i}),function(e){e[e.None=0]="None",e[e.Capture=1]="Capture",e[e.Bubble=2]="Bubble"}(n||(n={}));class i{constructor(e){this._eventListeners=new Map,this._children=new Map,this._target=e}get isEmpty(){return 0===this._eventListeners.size&&0===this._children.size}addEventListener(e,t,r){let n=e.indexOf(".");if(-1!==n){let a=e.substring(0,n),o=this._children.get(a);o||(o=new i(this._target),this._children.set(a,o)),e=e.substring(n+1),o.addEventListener(e,t,r)}else this._addEventListener(e,t,r)}removeEventListener(e,t,r){let n=e.indexOf(".");if(-1!==n){let i=e.substring(0,n),a=this._children.get(i);if(!a)return;e=e.substring(n+1),a.removeEventListener(e,t,r),a.isEmpty&&this._children.delete(i)}else this._removeEventListener(e,t,r)}reset(){Array.from(this._children.entries()).forEach(([e,t])=>{if(t.reset(),t.isEmpty)this._children.delete(e);else throw Error("Child is not empty and cannot be removed")}),this._unregisterAllEvents()}_addEventListener(e,t,r){let i=this._eventListeners.get(e);i||(i=new Map,this._eventListeners.set(e,i));let a=r?.capture?n.Capture:n.Bubble,o=i.get(t)??n.None;if(o&a)return void console.warn("A listener is already registered for this phase");i.set(t,o|a),this._target.addEventListener(e,t,r)}_removeEventListener(e,t,r){let i=r?.capture?n.Capture:n.Bubble,a=this._eventListeners.get(e);a&&((t?[t]:Array.from(a.keys())).forEach(t=>{let o=a.get(t)??n.None;if(!(o&i))return;this._target.removeEventListener(e,t,r);let s=o^i;s===n.None?a.delete(t):a.set(t,s)}),a.size||this._eventListeners.delete(e))}_unregisterAllListeners(e,t){Array.from(t.entries()).forEach(([t,r])=>{let i=n.Capture;for(let a=i;r;a<<=1){if(!(r&a))continue;let i=a===n.Capture;this.removeEventListener(e,t,{capture:i}),r^=a}})}_unregisterAllEvents(){Array.from(this._eventListeners.entries()).forEach(([e,t])=>{this._unregisterAllListeners(e,t)})}}},59998:(e,t,r)=>{"use strict";r.d(t,{Gh:()=>l,Un:()=>s,v_:()=>u});var n=r(70192),i=r(78378),a=r(93022);let o=new Set;function s(e,t=!0){var r,l;let u=Object.freeze({added:[],removed:[],locked:[]});e&&(t?function(e,t,r){if(!t.has(e)){t.add(e),r.added.push(e);let n=(0,a.getAnnotation)(e);n&&(n.isLocked=!0)}}(e,o,u):function(e,t,r){if(t.delete(e)){r.removed.push(e);let t=(0,a.getAnnotation)(e);t&&(t.isLocked=!1)}}(e,o,u)),r=u,l=o,(r.added.length>0||r.removed.length>0)&&(l.forEach(e=>void r.locked.push(e)),(0,n.Hl)(n.tX,i.sV.ANNOTATION_LOCK_CHANGE,r))}function l(e){return o.has(e)}function u(e){let t=l(e);return s(e,t),t}},60247:function(e,t,r){var n;!function(e,i,a){function o(e){var t=this;t.next=function(){var e,r,n=t.w,i=t.X,a=t.i;return t.w=n=n+0x61c88647|0,r=i[a+34&127],e=i[a=a+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,r=i[a]=r^e,t.i=a,r+(n^n>>>16)|0},!function(e,t){var r,n,i,a,o,s=[],l=128;for(t===(0|t)?(n=t,t=null):(t+="\0",n=0,l=Math.max(l,t.length)),i=0,a=-32;a>>15,n^=n<<4,n^=n>>>13,a>=0&&(o=o+0x61c88647|0,i=0==(r=s[127&a]^=n+o)?i+1:0);for(i>=128&&(s[127&(t&&t.length||0)]=-1),i=127,a=512;a>0;--a)n=s[i+34&127],r=s[i=i+1&127],n^=n<<13,r^=r<<17,n^=n>>>15,r^=r>>>12,s[i]=n^r;e.w=o,e.X=s,e.i=i}(t,e)}function s(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function l(e,t){null==e&&(e=+new Date);var r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/0x100000000};return i.double=function(){do var e=((r.next()>>>11)+(r.next()>>>0)/0x100000000)/2097152;while(0===e);return e},i.int32=r.next,i.quick=i,n&&(n.X&&s(n,r),i.state=function(){return s(r,{})}),i}i&&i.exports?i.exports=l:r.amdD&&r.amdO?void 0===(n=(function(){return l}).call(t,r,t,i))||(i.exports=n):this.xor4096=l}(0,e=r.nmd(e),r.amdD)},60251:(e,t,r)=>{"use strict";r.r(t),r.d(t,{findMatchingColormap:()=>b,getColormap:()=>g,getColormapNames:()=>v,getMaxOpacity:()=>P,getOpacityState:()=>T,getThresholdValue:()=>O,registerColormap:()=>f,resolveColormap:()=>y,setColorMapTransferFunctionForVolumeActor:()=>I,updateOpacity:()=>x,updateOpacityMapping:()=>A,updateThreshold:()=>C});var n=JSON.parse('[{"Name":"KAAMS","IndexedColors":[1.00,1.00,1.00,1.00,0.00,0.00,0.00,1.00,0.00,0.00,0.00,1.00,1.00,1.00,0.00,1.00,0.00,1.00,0.00,1.00,1.00,0.63,0.63,1.00,0.67,0.50,0.33,1.00,0.50,0.75,0.53,0.35,0.70,1.00,0.75,0.50],"Annotations":[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11]},{"ColorSpace":"Diverging","Name":"Cool to Warm","NanColor":[1,1,0],"RGBPoints":[0,0.23137254902,0.298039215686,0.752941176471,0.5,0.865,0.865,0.865,1,0.705882352941,0.0156862745098,0.149019607843]},{"ColorSpace":"Lab","Creator":"Francesca Samsel","Name":"Cool to Warm (Extended)","NanColor":[0.25,0,0],"RGBPoints":[0,0,0,0.34902,0.03125,0.039216,0.062745,0.380392,0.0625,0.062745,0.117647,0.411765,0.09375,0.090196,0.184314,0.45098,0.125,0.12549,0.262745,0.501961,0.15625,0.160784,0.337255,0.541176,0.1875,0.2,0.396078,0.568627,0.21875,0.239216,0.454902,0.6,0.25,0.286275,0.5215689999999999,0.65098,0.28125,0.337255,0.592157,0.7019609999999999,0.3125,0.388235,0.654902,0.74902,0.34375,0.466667,0.737255,0.819608,0.375,0.572549,0.819608,0.878431,0.40625,0.654902,0.866667,0.9098039999999999,0.4375,0.752941,0.917647,0.941176,0.46875,0.823529,0.956863,0.968627,0.5,0.988235,0.960784,0.901961,0.5,0.941176,0.984314,0.988235,0.52,0.988235,0.945098,0.85098,0.54,0.980392,0.898039,0.784314,0.5625,0.968627,0.835294,0.698039,0.59375,0.94902,0.733333,0.588235,0.625,0.929412,0.65098,0.509804,0.65625,0.9098039999999999,0.564706,0.435294,0.6875,0.878431,0.458824,0.352941,0.71875,0.839216,0.388235,0.286275,0.75,0.760784,0.294118,0.211765,0.78125,0.7019609999999999,0.211765,0.168627,0.8125,0.65098,0.156863,0.129412,0.84375,0.6,0.09411799999999999,0.09411799999999999,0.875,0.54902,0.066667,0.098039,0.90625,0.501961,0.05098,0.12549,0.9375,0.45098,0.054902,0.172549,0.96875,0.4,0.054902,0.192157,1,0.34902,0.070588,0.211765]},{"ColorSpace":"Diverging","Name":"Warm to Cool","NanColor":[1,1,0],"RGBPoints":[0,0.705882352941,0.0156862745098,0.149019607843,0.5,0.865,0.865,0.865,1,0.23137254902,0.298039215686,0.752941176471]},{"ColorSpace":"Lab","Creator":"Francesca Samsel","Name":"Warm to Cool (Extended)","NanColor":[0.250004,0,0],"RGBPoints":[0,0.34902,0,0.129412,0.025,0.4,0.00392157,0.101961,0.05,0.470588,0.0156863,0.0901961,0.075,0.54902,0.027451,0.0705882,0.1,0.619608,0.0627451,0.0431373,0.125,0.690196,0.12549,0.0627451,0.15,0.7411759999999999,0.184314,0.0745098,0.175,0.788235,0.266667,0.0941176,0.2,0.811765,0.345098,0.113725,0.225,0.831373,0.411765,0.133333,0.25,0.85098,0.47451,0.145098,0.275,0.870588,0.54902,0.156863,0.3,0.878431,0.619608,0.168627,0.325,0.890196,0.658824,0.196078,0.35,0.9098039999999999,0.717647,0.235294,0.375,0.929412,0.776471,0.278431,0.395522,0.94902,0.823529,0.321569,0.418905,0.968627,0.87451,0.407843,0.444278,0.980392,0.917647,0.509804,0.470149,0.988235,0.956863,0.643137,0.483582,0.992157,0.964706,0.7137250000000001,0.499,0.988235,0.980392,0.870588,0.5,1,1,1,0.501,0.913725,0.988235,0.9372549999999999,0.516418,0.827451,0.980392,0.886275,0.531343,0.764706,0.980392,0.866667,0.546766,0.658824,0.980392,0.843137,0.564179,0.572549,0.964706,0.835294,0.587562,0.423529,0.941176,0.87451,0.60597,0.262745,0.901961,0.862745,0.629851,0.0705882,0.8549020000000001,0.870588,0.651741,0.0509804,0.8,0.85098,0.681592,0.0235294,0.709804,0.831373,0.712935,0.0313725,0.615686,0.811765,0.75,0.0313725,0.537255,0.788235,0.775,0.0392157,0.466667,0.7686269999999999,0.8,0.0509804,0.396078,0.7411759999999999,0.825,0.054902,0.317647,0.709804,0.85,0.054902,0.243137,0.678431,0.875,0.0431373,0.164706,0.639216,0.9,0.0313725,0.09803920000000001,0.6,0.925,0.0392157,0.0392157,0.5607839999999999,0.95,0.105882,0.0509804,0.509804,0.975,0.113725,0.0235294,0.45098,1,0.12549,0,0.380392]},{"ColorSpace":"RGB","Name":"Rainbow Desaturated","NanColor":[1,1,0],"RGBPoints":[0,0.278431372549,0.278431372549,0.858823529412,0.143,0,0,0.360784313725,0.285,0,1,1,0.429,0,0.501960784314,0,0.571,1,1,0,0.714,1,0.380392156863,0,0.857,0.419607843137,0,0,1,0.8784313725489999,0.301960784314,0.301960784314]},{"ColorSpace":"RGB","Name":"Cold and Hot","NanColor":[1,1,0],"RGBPoints":[0,0,1,1,0.45,0,0,1,0.5,0,0,0.501960784314,0.55,1,0,0,1,1,1,0]},{"ColorSpace":"RGB","Name":"Black-Body Radiation","NanColor":[0,0.498039215686,1],"RGBPoints":[0,0,0,0,0.4,0.901960784314,0,0,0.8,0.901960784314,0.901960784314,0,1,1,1,1]},{"ColorSpace":"RGB","Name":"X Ray","NanColor":[1,0,0],"RGBPoints":[0,1,1,1,1,0,0,0]},{"ColorSpace":"RGB","Name":"Grayscale","NanColor":[1,0,0],"RGBPoints":[0,0,0,0,1,1,1,1]},{"ColorSpace":"RGB","Name":"Grayscale-DICOM-sigmoid","Notes":"This is a 16 point sample of a sigmoid grayscale colormap described in the DICOM standard. See equation C.11-1 in section C.11.2","NanColor":[1,0,0],"BelowRangeColor":[0,0,0],"AboveRangeColor":[1,1,1],"RGBPoints":[-1,0.01798620996209156,0.01798620996209156,0.01798620996209156,-0.8666666666666667,0.030275691986950463,0.030275691986950463,0.030275691986950463,-0.7333333333333334,0.05053016223541345,0.05053016223541345,0.05053016223541345,-0.6,0.08317269649392238,0.08317269649392238,0.08317269649392238,-0.4666666666666667,0.13392788832407365,0.13392788832407365,0.13392788832407365,-0.33333333333333337,0.2086085273260449,0.2086085273260449,0.2086085273260449,-0.19999999999999996,0.31002551887238755,0.31002551887238755,0.31002551887238755,-0.06666666666666665,0.4337256058045608,0.4337256058045608,0.4337256058045608,0.06666666666666665,0.5662743941954392,0.5662743941954392,0.5662743941954392,0.19999999999999996,0.6899744811276125,0.6899744811276125,0.6899744811276125,0.33333333333333326,0.791391472673955,0.791391472673955,0.791391472673955,0.46666666666666656,0.8660721116759263,0.8660721116759263,0.8660721116759263,0.6000000000000001,0.9168273035060777,0.9168273035060777,0.9168273035060777,0.7333333333333334,0.9494698377645865,0.9494698377645865,0.9494698377645865,0.8666666666666667,0.9697243080130495,0.9697243080130495,0.9697243080130495,1,0.9820137900379085,0.9820137900379085,0.9820137900379085]},{"ColorSpace":"RGB","Name":"Inverted-Grayscale","NanColor":[1,0,0],"RGBPoints":[0,1,1,1,1,0,0,0]},{"ColorSpace":"RGB","Name":"Inverted-Grayscale-DICOM-sigmoid","Notes":"This is a 16 point sample of a sigmoid inverted-grayscale colormap described in the DICOM standard. See equation C.11-1 in section C.11.2","BelowRangeColor":[1,1,1],"AboveRangeColor":[0,0,0],"NanColor":[1,0,0],"RGBPoints":[-1,0.9820137900379085,0.9820137900379085,0.9820137900379085,-0.8666666666666667,0.9697243080130495,0.9697243080130495,0.9697243080130495,-0.7333333333333334,0.9494698377645866,0.9494698377645866,0.9494698377645866,-0.6,0.9168273035060777,0.9168273035060777,0.9168273035060777,-0.4666666666666667,0.8660721116759263,0.8660721116759263,0.8660721116759263,-0.33333333333333337,0.791391472673955,0.791391472673955,0.791391472673955,-0.19999999999999996,0.6899744811276125,0.6899744811276125,0.6899744811276125,-0.06666666666666665,0.5662743941954391,0.5662743941954391,0.5662743941954391,0.06666666666666665,0.43372560580456077,0.43372560580456077,0.43372560580456077,0.19999999999999996,0.3100255188723875,0.3100255188723875,0.3100255188723875,0.33333333333333326,0.20860852732604496,0.20860852732604496,0.20860852732604496,0.46666666666666656,0.13392788832407365,0.13392788832407365,0.13392788832407365,0.6000000000000001,0.08317269649392234,0.08317269649392234,0.08317269649392234,0.7333333333333334,0.05053016223541351,0.05053016223541351,0.05053016223541351,0.8666666666666667,0.03027569198695046,0.03027569198695046,0.03027569198695046,1,0.01798620996209155,0.01798620996209155,0.01798620996209155]},{"ColorSpace":"RGB","Name":"BkRd","NanColor":[0,1,1],"RGBPoints":[0,0,0,0,1,1,0,0]},{"ColorSpace":"RGB","Name":"BkGn","NanColor":[1,0,1],"RGBPoints":[0,0,0,0,1,0,1,0]},{"ColorSpace":"RGB","Name":"BkBu","NanColor":[1,1,0],"RGBPoints":[0,0,0,0,1,0,0,1]},{"ColorSpace":"RGB","Name":"BkMa","NanColor":[0,1,0],"RGBPoints":[0,0,0,0,1,1,0,1]},{"ColorSpace":"RGB","Name":"BkCy","NanColor":[0,1,1],"RGBPoints":[0,0,0,0,1,0,1,1]},{"ColorSpace":"RGB","Name":"Black, Blue and White","NanColor":[1,1,0],"RGBPoints":[0,0,0,0,0.333,0,0,0.501960784314,0.666,0,0.501960784314,1,1,1,1,1]},{"ColorSpace":"RGB","Name":"Black, Orange and White","NanColor":[1,1,0],"RGBPoints":[0,0,0,0,0.333,0.501960784314,0,0,0.666,1,0.501960784314,0,1,1,1,1]},{"ColorSpace":"Lab","Creator":"Francesca Samsel","Name":"Linear YGB 1211g","NanColor":[0.25,0,0],"RGBPoints":[0,1,0.988235,0.968627,0.02,1,0.952941,0.878431,0.05,0.968627,0.905882,0.776471,0.1,0.94902,0.898039,0.6470590000000001,0.15,0.901961,0.878431,0.556863,0.2,0.847059,0.858824,0.482353,0.25,0.690196,0.819608,0.435294,0.3,0.513725,0.7686269999999999,0.384314,0.35,0.337255,0.721569,0.337255,0.4,0.278431,0.658824,0.392157,0.45,0.231373,0.639216,0.435294,0.5,0.203922,0.6,0.486275,0.55,0.172549,0.568627,0.537255,0.6,0.141176,0.517647,0.54902,0.65,0.133333,0.458824,0.541176,0.7,0.12549,0.396078,0.529412,0.75,0.117647,0.321569,0.5215689999999999,0.8,0.121569,0.258824,0.509804,0.85,0.133333,0.227451,0.501961,0.9,0.145098,0.192157,0.490196,0.95,0.188235,0.164706,0.470588,1,0.258824,0.196078,0.439216]},{"ColorSpace":"CIELAB","Creator":"Francesca Samsel","Name":"Linear Green (Gr4L)","NanColor":[0.25,0,0],"RGBPoints":[0,0.054901999999999999,0.109804,0.121569,0.050000000000000003,0.074510000000000007,0.17254900000000001,0.180392,0.10000000000000001,0.086275000000000004,0.231373,0.219608,0.14999999999999999,0.094117999999999993,0.27843099999999998,0.25097999999999998,0.20000000000000001,0.109804,0.34902,0.27843099999999998,0.25,0.11372500000000001,0.40000000000000002,0.27843099999999998,0.29999999999999999,0.117647,0.45097999999999999,0.270588,0.34999999999999998,0.117647,0.49019600000000002,0.24313699999999999,0.40000000000000002,0.11372500000000001,0.52156899999999995,0.20392199999999999,0.45000000000000001,0.109804,0.54901999999999995,0.15294099999999999,0.5,0.082352999999999996,0.58823499999999995,0.082352999999999996,0.55000000000000004,0.109804,0.63137299999999996,0.050979999999999998,0.59999999999999998,0.21176500000000001,0.67843100000000001,0.082352999999999996,0.65000000000000002,0.31764700000000001,0.72156900000000002,0.11372500000000001,0.69999999999999996,0.43137300000000001,0.76078400000000002,0.16078400000000001,0.75,0.556863,0.80000000000000004,0.23921600000000001,0.80000000000000004,0.66666700000000001,0.83921599999999996,0.29411799999999999,0.84999999999999998,0.78431399999999996,0.87843099999999996,0.39607799999999999,0.90000000000000002,0.88627500000000003,0.92156899999999997,0.53333299999999995,0.94999999999999996,0.96078399999999997,0.94901999999999997,0.67058799999999996,1,1,0.98431400000000002,0.90196100000000001]},{"ColorSpace":"Lab","Creator":"Francesca Samsel","Name":"Linear Blue (8_31f)","NanColor":[0.25,0,0],"RGBPoints":[0,0.960784,1,0.980392,0.05,0.815686,0.960784,0.913725,0.1,0.670588,0.929412,0.870588,0.15,0.556863,0.901961,0.843137,0.2,0.478431,0.870588,0.823529,0.25,0.439216,0.831373,0.803922,0.3,0.4,0.8,0.788235,0.35,0.376471,0.7686269999999999,0.7686269999999999,0.4,0.34902,0.709804,0.7294119999999999,0.45,0.32549,0.654902,0.690196,0.5,0.301961,0.607843,0.658824,0.55,0.247059,0.545098,0.619608,0.6,0.239216,0.494118,0.580392,0.65,0.227451,0.439216,0.541176,0.7,0.227451,0.403922,0.5215689999999999,0.75,0.231373,0.368627,0.501961,0.8,0.227451,0.321569,0.470588,0.85,0.219608,0.282353,0.439216,0.9,0.192157,0.235294,0.4,0.95,0.160784,0.184314,0.34902,1,0.133333,0.12549,0.301961]},{"ColorSpace":"HSV","Name":"Blue to Red Rainbow","NanColor":[0.498039215686,0.498039215686,0.498039215686],"RGBPoints":[0,0,0,1,1,1,0,0]},{"ColorSpace":"HSV","Name":"Red to Blue Rainbow","NanColor":[0.498039215686,0.498039215686,0.498039215686],"RGBPoints":[0,1,0,0,1,0,0,1]},{"ColorSpace":"RGB","Name":"Rainbow Blended White","NanColor":[1,1,0],"RGBPoints":[0,1,1,1,0.17,0,0,1,0.34,0,1,1,0.5,0,1,0,0.67,1,1,0,0.84,1,0,0,1,0.8784313725489999,0,1]},{"ColorSpace":"RGB","Name":"Rainbow Blended Grey","NanColor":[1,1,0],"RGBPoints":[0,0.317647058824,0.341176470588,0.43137254902,0.17,0,0,1,0.34,0,1,1,0.5,0,1,0,0.67,1,1,0,0.84,1,0,0,1,0.8784313725489999,0,1]},{"ColorSpace":"RGB","Name":"Rainbow Blended Black","NanColor":[1,1,0],"RGBPoints":[0,0,0,0,0.17,0,0,1,0.34,0,1,1,0.5,0,1,0,0.67,1,1,0,0.84,1,0,0,1,0.8784313725489999,0,1]},{"ColorSpace":"RGB","Name":"Blue to Yellow","NanColor":[1,0,0],"RGBPoints":[0,0.0392156862745,0.0392156862745,0.949019607843,1,0.949019607843,0.949019607843,0.0392156862745]},{"ColorSpace":"HSV","Name":"blot","RGBPoints":[0,0,0,1,0.166,0,0,1,0.167,1,0,1,0.332,1,0,1,0.333,0,1,1,0.5,0,1,1,0.501,0,1,0,0.666,0,1,0,0.667,1,1,0,0.832,1,1,0,0.833,1,0,0,1,1,0,0]},{"ColorSpace":"Lab","Name":"CIELab Blue to Red","NanColor":[1,1,0],"RGBPoints":[0,0,0.6,0.749019607843,1,0.76862745098,0.466666666667,0.341176470588]},{"ColorSpace":"RGB","Name":"jet","RGBPoints":[-1,0,0,0.5625,-0.777778,0,0,1,-0.269841,0,1,1,-0.015873,0.5,1,0.5,0.238095,1,1,0,0.746032,1,0,0,1,0.5,0,0]},{"ColorSpace":"RGB","Name":"rainbow","RGBPoints":[-1,0,0,1,-0.5,0,1,1,0,0,1,0,0.5,1,1,0,1,1,0,0]},{"ColorSpace":"Lab","Name":"erdc_rainbow_bright","RGBPoints":[-1,0.32549,0.14902,0.960784,-0.866221,0.297047,0.375586,0.963836,-0.732441,0.180302,0.536818,0.964627,-0.598662,0.1302,0.649207,0.929647,-0.464883,0.0445143,0.749654,0.855998,-0.331104,0.0271325,0.830713,0.721527,-0.197324,0.259504,0.8661450000000001,0.543555,-0.0635452,0.428364,0.890725,0.329819,0.07023409999999999,0.568503,0.898508,0.187623,0.204013,0.738259,0.890317,0.0825461,0.337793,0.84546,0.86136,0.0147555,0.471572,0.912191,0.808018,0,0.605351,0.962848,0.710445,0,0.73913,0.9994690000000001,0.600258,0.0176284,0.87291,0.994156,0.445975,0.193912,1,0.980407,0.247105,0.262699]},{"ColorSpace":"Lab","Name":"erdc_rainbow_dark","RGBPoints":[-1,0,0,0.423499,-0.866221,0,0.119346,0.529237,-0.732441,0,0.238691,0.634976,-0.598662,0,0.346852,0.68788,-0.464883,0,0.45022,0.718141,-0.331104,0,0.553554,0.664839,-0.197324,0,0.651082,0.519303,-0.0635452,0.115841,0.72479,0.352857,0.07023409999999999,0.326771,0.781195,0.140187,0.204013,0.522765,0.798524,0.0284624,0.337793,0.703162,0.788685,0.00885756,0.471572,0.845118,0.7511330000000001,0,0.605351,0.955734,0.690825,0,0.73913,0.995402,0.567916,0.0618524,0.87291,0.987712,0.403398,0.164851,1,0.980407,0.247105,0.262699]},{"ColorSpace":"Lab","Name":"nic_CubicL","RGBPoints":[-1,0.479965,0.0118108,0.5306999999999999,-0.87451,0.522213,0.0551282,0.706919,-0.74902,0.50839,0.237278,0.867764,-0.623529,0.451617,0.373834,0.987255,-0.498039,0.39365,0.497255,0.97506,-0.372549,0.328631,0.599639,0.8918430000000001,-0.247059,0.250043,0.690286,0.7785530000000001,-0.121569,0.249656,0.7649049999999999,0.645857,0.00392157,0.297954,0.821466,0.50449,0.129412,0.337509,0.872595,0.358447,0.254902,0.430011,0.913789,0.297079,0.380392,0.587191,0.931381,0.333353,0.5058820000000001,0.7279369999999999,0.93591,0.353742,0.631373,0.826403,0.921081,0.365066,0.756863,0.893201,0.846317,0.372662,0.8823530000000001,0.965347,0.7388400000000001,0.378506,1,0.983235,0.597451,0.366856]},{"ColorSpace":"Lab","Name":"nic_CubicYF","RGBPoints":[-1,0.5151,0.0482,0.6697,-0.87451,0.520711,0.168955,0.800574,-0.74902,0.493694,0.278596,0.911824,-0.623529,0.440026,0.369475,0.984978,-0.498039,0.398932,0.457593,0.987053,-0.372549,0.350651,0.540644,0.929608,-0.247059,0.298827,0.615625,0.857729,-0.121569,0.239928,0.685061,0.769531,0.00392157,0.228832,0.739349,0.673287,0.129412,0.263297,0.78608,0.5699880000000001,0.254902,0.298107,0.828337,0.460214,0.380392,0.33092,0.864071,0.352674,0.5058820000000001,0.38306,0.898169,0.287309,0.631373,0.49023,0.917481,0.307961,0.756863,0.6237200000000001,0.926026,0.332309,0.8823530000000001,0.717458,0.92527,0.342476,1,0.8,0.9255,0.3529]},{"ColorSpace":"Lab","Name":"gist_earth","RGBPoints":[-1,0,0,0,-0.87451,0.239216,0.027451,0.415686,-0.74902,0.0901961,0.254902,0.556863,-0.623529,0.0941176,0.352941,0.54902,-0.498039,0.105882,0.435294,0.5333329999999999,-0.372549,0.12549,0.52549,0.501961,-0.247059,0.156863,0.596078,0.443137,-0.121569,0.196078,0.65098,0.380392,0.00392157,0.282353,0.717647,0.301961,0.129412,0.466667,0.772549,0.27451,0.254902,0.678431,0.784314,0.309804,0.380392,0.901961,0.756863,0.376471,0.5058820000000001,0.992157,0.705882,0.5215689999999999,0.631373,1,0.721569,0.7019609999999999,0.756863,1,0.784314,0.784314,0.8823530000000001,1,0.866667,0.866667,1,1,1,1]},{"ColorSpace":"Lab","Name":"2hot","RGBPoints":[-1,0.0416667,0,0,-0.873016,0.208333,0,0,-0.746032,0.375,0,0,-0.619048,0.541667,0,0,-0.492063,0.708333,0,0,-0.365079,0.854137,0,0,-0.238095,0.937488,0.039062,0,-0.111111,1,0.208333,0,0.015873,1,0.375,0,0.142857,1,0.541667,0,0.269841,1,0.708333,0,0.396825,1,0.858805,0.03125,0.52381,1,0.947392,0.15625,0.650794,1,1,0.3125,0.777778,1,1,0.5625,0.904762,1,1,0.8125,1,1,1,1]},{"ColorSpace":"Lab","Name":"erdc_red2yellow_BW","RGBPoints":[-1,7.54296e-07,0,1.09827e-05,-0.87451,0.18285,0.0264094,0,-0.74902,0.3066,0,0,-0.623529,0.422841,0,0,-0.498039,0.522945,0,0,-0.372549,0.605721,0,0,-0.247059,0.672502,0.14168,0,-0.121569,0.728167,0.244025,0,0.00392157,0.781215,0.333454,0,0.129412,0.825,0.423586,0,0.254902,0.855893,0.5167929999999999,0,0.380392,0.880491,0.608846,0,0.5058820000000001,0.910305,0.695505,0,0.631373,0.94109,0.779067,0.223528,0.756863,0.967873,0.858572,0.473521,0.8823530000000001,0.986815,0.933211,0.751583,1,1,1,0.999997]},{"ColorSpace":"Lab","Name":"erdc_marine2gold_BW","RGBPoints":[-1,1.11641e-07,0,1.62551e-06,-0.87451,0.0413146,0.0619808,0.209857,-0.74902,0.0185557,0.101341,0.350684,-0.623529,0.00486405,0.149847,0.461054,-0.498039,0.0836345,0.210845,0.517906,-0.372549,0.173222,0.276134,0.541793,-0.247059,0.259857,0.343877,0.535869,-0.121569,0.362299,0.408124,0.504293,0.00392157,0.468266,0.468276,0.468257,0.129412,0.582781,0.527545,0.374914,0.254902,0.691591,0.585251,0.274266,0.380392,0.784454,0.645091,0.247332,0.5058820000000001,0.862299,0.710383,0.27518,0.631373,0.920863,0.782923,0.351563,0.756863,0.955792,0.859699,0.533541,0.8823530000000001,0.976162,0.93433,0.780671,1,1,1,0.999983]},{"ColorSpace":"Lab","Name":"erdc_blue2gold_BW","RGBPoints":[-1,0,0,0,-0.87451,0.07427350000000001,0.0440331,0.230013,-0.74902,0.125276,0.0258685,0.415826,-0.623529,0.143879,0.0163031,0.591346,-0.498039,0.212261,0.06278549999999999,0.7052389999999999,-0.372549,0.306048,0.141178,0.763636,-0.247059,0.391537,0.232286,0.773263,-0.121569,0.461734,0.336633,0.708321,0.00392157,0.54209,0.427581,0.5900069999999999,0.129412,0.61704,0.508623,0.460978,0.254902,0.702703,0.579586,0.309117,0.380392,0.790336,0.644811,0.170397,0.5058820000000001,0.870173,0.7107329999999999,0.117134,0.631373,0.9365599999999999,0.781991,0.157144,0.756863,0.965672,0.8620679999999999,0.409836,0.8823530000000001,0.985751,0.936296,0.714162,1,1,1,0.999999]},{"ColorSpace":"Lab","Name":"erdc_sapphire2gold_BW","RGBPoints":[-1,0.107704,0.107708,0.107694,-0.87451,0.1851,0.112354,0.308554,-0.74902,0.236782,0.114233,0.48788,-0.623529,0.28296,0.126187,0.639464,-0.498039,0.344787,0.171643,0.739713,-0.372549,0.413325,0.242371,0.76913,-0.247059,0.481863,0.3131,0.719841,-0.121569,0.5504019999999999,0.383829,0.612222,0.00392157,0.61894,0.454558,0.51126,0.129412,0.687478,0.5252869999999999,0.39993,0.254902,0.7560170000000001,0.596016,0.289923,0.380392,0.824555,0.666745,0.255498,0.5058820000000001,0.892979,0.736822,0.27696,0.631373,0.938851,0.804966,0.351734,0.756863,0.966491,0.874853,0.53572,0.8823530000000001,0.982105,0.94153,0.782579,1,1,1,0.999986]},{"ColorSpace":"Lab","Name":"erdc_red2purple_BW","RGBPoints":[-1,0,0,0,-0.87451,0.167793,0.0166271,0.0431278,-0.74902,0.262608,0.0107595,0.0791181,-0.623529,0.351902,0.0101858,0.100926,-0.498039,0.441257,0.0160835,0.131919,-0.372549,0.5221,0.0555972,0.195625,-0.247059,0.593852,0.104294,0.310234,-0.121569,0.654628,0.158115,0.448486,0.00392157,0.707443,0.220914,0.570253,0.129412,0.7495039999999999,0.293268,0.67897,0.254902,0.781587,0.370517,0.779269,0.380392,0.809951,0.451099,0.855831,0.5058820000000001,0.84424,0.531462,0.900451,0.631373,0.865174,0.620901,0.91606,0.756863,0.875041,0.714054,0.910284,0.8823530000000001,0.880764,0.80554,0.896276,1,0.887572,0.887591,0.887556]},{"ColorSpace":"Lab","Name":"erdc_purple2pink_BW","RGBPoints":[-1,0,0,0,-0.87451,0.117562,0.0291202,0.175876,-0.74902,0.178368,0.0458476,0.285454,-0.623529,0.237731,0.0680173,0.387717,-0.498039,0.300877,0.09562909999999999,0.484802,-0.372549,0.370929,0.136858,0.554985,-0.247059,0.449033,0.189273,0.58863,-0.121569,0.529971,0.245796,0.598587,0.00392157,0.609914,0.300643,0.610244,0.129412,0.697079,0.351286,0.616371,0.254902,0.7858579999999999,0.401991,0.617376,0.380392,0.862517,0.45745,0.64463,0.5058820000000001,0.91359,0.525462,0.705336,0.631373,0.9325830000000001,0.61064,0.767412,0.756863,0.922478,0.706966,0.817522,0.8823530000000001,0.901302,0.803071,0.856311,1,0.887571,0.887591,0.887549]},{"ColorSpace":"Lab","Name":"erdc_pbj_lin","RGBPoints":[-1,0,0,0,-0.87451,0.091821,0.0611476,0.10617,-0.74902,0.160311,0.0900022,0.192713,-0.623529,0.22484,0.12126,0.272128,-0.498039,0.291263,0.157469,0.340828,-0.372549,0.360015,0.200388,0.388903,-0.247059,0.437497,0.250058,0.387201,-0.121569,0.512636,0.304969,0.355955,0.00392157,0.582603,0.360874,0.33488,0.129412,0.655126,0.416374,0.306351,0.254902,0.725889,0.473329,0.279051,0.380392,0.778125,0.537928,0.302697,0.5058820000000001,0.815894,0.606931,0.382431,0.631373,0.839159,0.679308,0.497608,0.756863,0.854748,0.7516659999999999,0.631792,0.8823530000000001,0.869483,0.822508,0.7685920000000001,1,0.887572,0.887589,0.887565]},{"ColorSpace":"Lab","Name":"erdc_blue2green_muted","RGBPoints":[-1,0.107704,0.107708,0.107695,-0.87451,0.141522,0.13066,0.270741,-0.74902,0.180123,0.146119,0.42308,-0.623529,0.210161,0.169674,0.551795,-0.498039,0.239701,0.212939,0.634969,-0.372549,0.253916,0.282947,0.653641,-0.247059,0.242791,0.366933,0.608521,-0.121569,0.226302,0.446776,0.52693,0.00392157,0.236237,0.514689,0.458798,0.129412,0.274641,0.577589,0.376069,0.254902,0.349625,0.633993,0.288131,0.380392,0.4437,0.683677,0.260497,0.5058820000000001,0.536247,0.731214,0.285424,0.631373,0.628472,0.777128,0.349151,0.756863,0.718259,0.819287,0.496825,0.8823530000000001,0.804768,0.856164,0.703299,1,0.887571,0.887591,0.887548]},{"ColorSpace":"Lab","Name":"erdc_blue2green_BW","RGBPoints":[-1,3.63578e-07,0,5.29374e-06,-0.87451,0.0539915,0.0577948,0.212806,-0.74902,0.0620393,0.07589419999999999,0.388959,-0.623529,0.0697499,0.102032,0.54177,-0.498039,0.113295,0.156156,0.64334,-0.372549,0.152047,0.243196,0.670283,-0.247059,0.158096,0.344084,0.622864,-0.121569,0.151142,0.43922,0.532767,0.00392157,0.17155,0.5215880000000001,0.457719,0.129412,0.225861,0.599141,0.363997,0.254902,0.32328,0.6700700000000001,0.259083,0.380392,0.442344,0.733697,0.223754,0.5058820000000001,0.558409,0.794941,0.257411,0.631373,0.673875,0.854344,0.340822,0.756863,0.7872440000000001,0.909326,0.524717,0.8823530000000001,0.896483,0.958063,0.775914,1,1,1,0.999982]},{"ColorSpace":"Lab","Name":"GREEN-WHITE_LINEAR","RGBPoints":[-1,0,0,0,-0.87451,0,0.062745,0,-0.74902,0,0.12549,0,-0.623529,0,0.188235,0,-0.498039,0,0.25098,0,-0.372549,0,0.313725,0,-0.247059,0,0.376471,0,-0.121569,0.09411799999999999,0.439216,0,0.00392157,0.196078,0.501961,0,0.129412,0.294118,0.564706,0,0.254902,0.396078,0.627451,0,0.380392,0.498039,0.690196,0,0.5058820000000001,0.6,0.752941,0.145098,0.631373,0.7019609999999999,0.815686,0.364706,0.756863,0.8,0.878431,0.580392,0.8823530000000001,0.901961,0.941176,0.796078,1,1,1,1]},{"ColorSpace":"Lab","Name":"erdc_green2yellow_BW","RGBPoints":[-1,0,0,0,-0.87451,0,0.105542,0.0603919,-0.74902,0,0.159454,0.104148,-0.623529,0,0.219502,0.15542,-0.498039,0,0.282276,0.203811,-0.372549,0,0.346331,0.235652,-0.247059,0,0.411765,0.235428,-0.121569,0,0.477177,0.217977,0.00392157,0.0593644,0.541635,0.21361,0.129412,0.233081,0.604722,0.210591,0.254902,0.369803,0.664942,0.226536,0.380392,0.498446,0.722367,0.288237,0.5058820000000001,0.601929,0.7822440000000001,0.380815,0.631373,0.703207,0.840497,0.512134,0.756863,0.803186,0.896433,0.674462,0.8823530000000001,0.903834,0.9502660000000001,0.846715,1,1,1,0.999981]},{"ColorSpace":"Lab","Name":"blue2cyan","RGBPoints":[-1,0,0,0,-0.87451,0,0.152941,0.364706,-0.74902,0,0.254902,0.470588,-0.623529,0,0.34902,0.572549,-0.498039,0,0.443137,0.670588,-0.372549,0,0.537255,0.772549,-0.247059,0,0.627451,0.870588,-0.121569,0,0.717647,0.964706,0.00392157,0.0784314,0.772549,1,0.129412,0.207843,0.858824,1,0.254902,0.32549,0.941176,1,0.380392,0.45098,1,1,0.5058820000000001,0.5607839999999999,1,1,0.631373,0.662745,1,1,0.756863,0.760784,1,1,0.8823530000000001,0.870588,1,1,1,1,1,1]},{"ColorSpace":"Lab","Name":"erdc_blue2cyan_BW","RGBPoints":[-1,4.05298e-07,0,5.9012e-06,-0.87451,0.0207526,0.0740933,0.18093,-0.74902,0,0.121033,0.30343,-0.623529,0,0.166892,0.416095,-0.498039,0,0.216768,0.524796,-0.372549,0.0164769,0.275471,0.608585,-0.247059,0.0544527,0.344824,0.659267,-0.121569,0.0880643,0.419118,0.688675,0.00392157,0.127938,0.492556,0.720256,0.129412,0.149476,0.5669459999999999,0.756918,0.254902,0.188961,0.641333,0.792122,0.380392,0.245482,0.715336,0.827609,0.5058820000000001,0.329216,0.786235,0.874761,0.631373,0.453558,0.852803,0.918466,0.756863,0.626281,0.910493,0.954,0.8823530000000001,0.82257,0.958709,0.980146,1,1,1,0.999989]},{"ColorSpace":"Lab","Name":"erdc_blue_BW","RGBPoints":[-1,0,0,0,-0.87451,0.0425591,0.0763529,0.150682,-0.74902,0.0569472,0.119154,0.275403,-0.623529,0.0635978,0.164772,0.395427,-0.498039,0.07743419999999999,0.213851,0.510014,-0.372549,0.106815,0.267034,0.615102,-0.247059,0.122093,0.324649,0.720068,-0.121569,0.160851,0.387068,0.806956,0.00392157,0.213754,0.453516,0.878012,0.129412,0.26722,0.524656,0.932436,0.254902,0.326844,0.599279,0.968038,0.380392,0.403403,0.674712,0.984784,0.5058820000000001,0.499703,0.745519,1,0.631373,0.615055,0.813983,1,0.756863,0.74405,0.879228,1,0.8823530000000001,0.8779090000000001,0.941913,1,1,1,1,0.999996]},{"ColorSpace":"Lab","Name":"BLUE-WHITE","RGBPoints":[-1,0,0,0,-0.87451,0,0,0.082353,-0.74902,0,0,0.168627,-0.623529,0,0,0.254902,-0.498039,0,0,0.337255,-0.372549,0,0,0.423529,-0.247059,0,0,0.509804,-0.121569,0,0.101961,0.592157,0.00392157,0,0.203922,0.678431,0.129412,0,0.301961,0.764706,0.254902,0,0.403922,0.85098,0.380392,0,0.5058820000000001,0.933333,0.5058820000000001,0,0.603922,1,0.631373,0.254902,0.705882,1,0.756863,0.509804,0.807843,1,0.8823530000000001,0.764706,0.905882,1,1,1,1,1]},{"ColorSpace":"Lab","Name":"erdc_purple_BW","RGBPoints":[-1,4.264e-08,0,6.20844e-07,-0.87451,0.100579,0.0593111,0.145666,-0.74902,0.167794,0.0889224,0.254953,-0.623529,0.231446,0.123339,0.360511,-0.498039,0.296699,0.163027,0.461278,-0.372549,0.363211,0.209286,0.55306,-0.247059,0.431136,0.260776,0.637195,-0.121569,0.498202,0.320012,0.705799,0.00392157,0.567456,0.380459,0.778091,0.129412,0.629381,0.445284,0.8448,0.254902,0.688373,0.517374,0.895694,0.380392,0.74891,0.590906,0.93976,0.5058820000000001,0.805017,0.667956,0.977626,0.631373,0.8509139999999999,0.752618,0.9923959999999999,0.756863,0.89724,0.838454,0.994093,0.8823530000000001,0.948461,0.922603,0.994449,1,1,1,0.9999670000000001]},{"ColorSpace":"Lab","Name":"erdc_magenta_BW","RGBPoints":[-1,0,0,2.54023e-05,-0.87451,0.128696,0.0456782,0.11635,-0.74902,0.228133,0.0476299,0.201452,-0.623529,0.327273,0.0374065,0.282107,-0.498039,0.420953,0.0408166,0.35709,-0.372549,0.511562,0.06422029999999999,0.430511,-0.247059,0.599552,0.102686,0.504257,-0.121569,0.684646,0.150536,0.579429,0.00392157,0.765817,0.205978,0.656062,0.129412,0.839176,0.27229,0.731807,0.254902,0.89536,0.357594,0.797309,0.380392,0.930238,0.457825,0.846984,0.5058820000000001,0.945921,0.564536,0.880571,0.631373,0.948995,0.670753,0.9022790000000001,0.756863,0.947124,0.772819,0.918171,0.8823530000000001,0.947265,0.869424,0.934352,1,0.954719,0.95475,0.954726]},{"ColorSpace":"Lab","Name":"magenta","RGBPoints":[-1,0,0,0,-0.87451,0.364706,0,0.152941,-0.74902,0.470588,0,0.254902,-0.623529,0.572549,0,0.34902,-0.498039,0.670588,0,0.443137,-0.372549,0.772549,0,0.537255,-0.247059,0.870588,0,0.627451,-0.121569,0.964706,0,0.717647,0.00392157,1,0.0784314,0.772549,0.129412,1,0.207843,0.858824,0.254902,1,0.32549,0.941176,0.380392,1,0.45098,1,0.5058820000000001,1,0.5607839999999999,1,0.631373,1,0.662745,1,0.756863,1,0.760784,1,0.8823530000000001,1,0.870588,1,1,1,1,1]},{"ColorSpace":"Lab","Name":"RED-PURPLE","RGBPoints":[-1,0,0,0,-0.87451,0.188235,0,0.007842999999999999,-0.74902,0.345098,0,0.035294,-0.623529,0.439216,0,0.098039,-0.498039,0.5333329999999999,0,0.152941,-0.372549,0.627451,0.015686,0.211765,-0.247059,0.721569,0.031373,0.266667,-0.121569,0.8,0.047059,0.329412,0.00392157,0.862745,0.047059,0.403922,0.129412,0.941176,0.062745,0.466667,0.254902,0.988235,0.078431,0.54902,0.380392,0.988235,0.141176,0.643137,0.5058820000000001,0.988235,0.25098,0.7294119999999999,0.631373,0.988235,0.376471,0.811765,0.756863,0.988235,0.54902,0.886275,0.8823530000000001,0.988235,0.752941,0.952941,1,0.996078,0.996078,0.996078]},{"ColorSpace":"Lab","Name":"erdc_red_BW","RGBPoints":[-1,0,0,0,-0.87451,0.147204,0.0480135,0.0401815,-0.74902,0.253411,0.0617478,0.0301333,-0.623529,0.356059,0.07463309999999999,0.0446897,-0.498039,0.457731,0.09349349999999999,0.0636931,-0.372549,0.557199,0.122714,0.0860013,-0.247059,0.665179,0.144238,0.105585,-0.121569,0.763833,0.187056,0.138326,0.00392157,0.847035,0.254558,0.189407,0.129412,0.905663,0.345937,0.258215,0.254902,0.941431,0.447111,0.346277,0.380392,0.962608,0.5469270000000001,0.457571,0.5058820000000001,0.987833,0.637276,0.569944,0.631373,0.994202,0.732176,0.687958,0.756863,0.993304,0.826268,0.800567,0.8823530000000001,0.994413,0.917205,0.906393,1,1,1,0.999979]},{"ColorSpace":"Lab","Name":"RED_TEMPERATURE","RGBPoints":[-1,0,0,0,-0.87451,0.090196,0,0,-0.74902,0.180392,0,0,-0.623529,0.270588,0,0,-0.498039,0.360784,0,0,-0.372549,0.45098,0,0,-0.247059,0.545098,0,0,-0.121569,0.635294,0,0,0.00392157,0.72549,0.058824,0,0.129412,0.815686,0.176471,0,0.254902,0.905882,0.294118,0,0.380392,1,0.411765,0,0.5058820000000001,1,0.5333329999999999,0.027451,0.631373,1,0.65098,0.27451,0.756863,1,0.7686269999999999,0.5215689999999999,0.8823530000000001,1,0.886275,0.7686269999999999,1,1,1,1]},{"ColorSpace":"Lab","Name":"erdc_orange_BW","RGBPoints":[-1,0,0,2.53806e-05,-0.87451,0.135871,0.0593824,0,-0.74902,0.224328,0.0907216,0,-0.623529,0.318083,0.119647,0,-0.498039,0.414443,0.150246,0,-0.372549,0.511077,0.184884,0,-0.247059,0.605501,0.226033,0,-0.121569,0.6952739999999999,0.275491,0,0.00392157,0.777826,0.334445,0,0.129412,0.851498,0.402441,0,0.254902,0.915899,0.47759,0.000602975,0.380392,0.971984,0.557882,0.0361443,0.5058820000000001,1,0.6412870000000001,0.135967,0.631373,1,0.725198,0.27997,0.756863,1,0.808205,0.438135,0.8823530000000001,1,0.89306,0.587036,1,1,0.977928,0.721599]},{"ColorSpace":"Lab","Name":"heated_object","RGBPoints":[-1,0,0,0,-0.87451,0.34902,0.0862745,0,-0.74902,0.45098,0.172549,0,-0.623529,0.52549,0.231373,0,-0.498039,0.580392,0.278431,0,-0.372549,0.623529,0.313725,0,-0.247059,0.670588,0.352941,0,-0.121569,0.717647,0.392157,0,0.00392157,0.772549,0.439216,0,0.129412,0.839216,0.494118,0,0.254902,0.901961,0.541176,0,0.380392,0.968627,0.6,0,0.5058820000000001,1,0.658824,0,0.631373,1,0.721569,0,0.756863,1,0.827451,0.298039,0.8823530000000001,1,0.976471,0.72549,1,1,1,1]},{"ColorSpace":"Lab","Name":"erdc_gold_BW","RGBPoints":[-1,0,0,1.90933e-05,-0.87451,0.128363,0.0636265,0,-0.74902,0.193795,0.111057,0,-0.623529,0.25976,0.15987,0,-0.498039,0.328546,0.210589,0,-0.372549,0.399726,0.26332,0,-0.247059,0.472969,0.318261,0,-0.121569,0.546245,0.375827,0,0.00392157,0.6174500000000001,0.436719,0,0.129412,0.685545,0.501113,0,0.254902,0.749578,0.5687990000000001,0,0.380392,0.80962,0.6394,0,0.5058820000000001,0.865572,0.712699,0.10257,0.631373,0.917709,0.787569,0.233665,0.756863,0.9669140000000001,0.863138,0.369608,0.8823530000000001,1,0.939405,0.496104,1,0.999225,1,0.612275]},{"ColorSpace":"Lab","Name":"erdc_brown_BW","RGBPoints":[-1,3.3216e-07,0,4.83629e-06,-0.87451,0.14693,0.0518172,0,-0.74902,0.225806,0.08149960000000001,0,-0.623529,0.301681,0.111452,0,-0.498039,0.370487,0.150664,0,-0.372549,0.43108,0.199477,0,-0.247059,0.4849,0.255107,0,-0.121569,0.536798,0.313486,0,0.00392157,0.5928600000000001,0.371167,0,0.129412,0.653119,0.428135,0,0.254902,0.714589,0.485917,0.0379541,0.380392,0.774667,0.54565,0.116634,0.5058820000000001,0.831222,0.608047,0.183895,0.631373,0.880305,0.674199,0.260298,0.756863,0.922314,0.742472,0.367086,0.8823530000000001,0.959408,0.811222,0.497258,1,0.993548,0.875183,0.622093]},{"ColorSpace":"Lab","Name":"copper_Matlab","RGBPoints":[-1,0,0,0,-0.87451,0.0784314,0.0501961,0.0313725,-0.74902,0.156863,0.100392,0.0627451,-0.623529,0.235294,0.150588,0.0941176,-0.498039,0.313725,0.200784,0.12549,-0.372549,0.392157,0.25098,0.156863,-0.247059,0.470588,0.301176,0.188235,-0.121569,0.54902,0.351373,0.219608,0.00392157,0.627451,0.401569,0.25098,0.129412,0.705882,0.451765,0.282353,0.254902,0.784314,0.501961,0.313725,0.380392,0.862745,0.552157,0.345098,0.5058820000000001,0.941176,0.602353,0.376471,0.631373,1,0.652549,0.407843,0.756863,1,0.702745,0.439216,0.8823530000000001,1,0.752941,0.470588,1,1,0.8,0.5]},{"ColorSpace":"Lab","Name":"pink_Matlab","RGBPoints":[-1,0,0,0,-0.87451,0.312416,0.204524,0.204524,-0.74902,0.441822,0.289241,0.289241,-0.623529,0.54112,0.354246,0.354246,-0.498039,0.624831,0.409048,0.409048,-0.372549,0.698582,0.45733,0.45733,-0.247059,0.764404,0.502282,0.500979,-0.121569,0.791292,0.591516,0.54112,0.00392157,0.8172970000000001,0.66895,0.578481,0.129412,0.842499,0.738308,0.613572,0.254902,0.866968,0.801687,0.6467619999999999,0.380392,0.8907659999999999,0.86041,0.678329,0.5058820000000001,0.913944,0.913944,0.7112540000000001,0.631373,0.936549,0.936549,0.79459,0.756863,0.9586209999999999,0.9586209999999999,0.8699789999999999,0.8823530000000001,0.980196,0.980196,0.9393359999999999,1,1,1,1]},{"ColorSpace":"Lab","Name":"bone_Matlab","RGBPoints":[-1,0,0,0,-0.87451,0.054902,0.054902,0.075817,-0.74902,0.109804,0.109804,0.151634,-0.623529,0.164706,0.164706,0.227451,-0.498039,0.219608,0.219608,0.303268,-0.372549,0.27451,0.27451,0.379085,-0.247059,0.329412,0.329902,0.454412,-0.121569,0.384314,0.405719,0.509314,0.00392157,0.439216,0.481536,0.5642160000000001,0.129412,0.494118,0.557353,0.6191179999999999,0.254902,0.54902,0.63317,0.67402,0.380392,0.603922,0.708987,0.728922,0.5058820000000001,0.660294,0.783824,0.783824,0.631373,0.746569,0.8387250000000001,0.8387250000000001,0.756863,0.832843,0.8936269999999999,0.8936269999999999,0.8823530000000001,0.919118,0.948529,0.948529,1,1,1,1]},{"ColorSpace":"Lab","Name":"gray_Matlab","RGBPoints":[-1,0,0,0,-0.87451,0.0627451,0.0627451,0.0627451,-0.74902,0.12549,0.12549,0.12549,-0.623529,0.188235,0.188235,0.188235,-0.498039,0.25098,0.25098,0.25098,-0.372549,0.313725,0.313725,0.313725,-0.247059,0.376471,0.376471,0.376471,-0.121569,0.439216,0.439216,0.439216,0.00392157,0.501961,0.501961,0.501961,0.129412,0.564706,0.564706,0.564706,0.254902,0.627451,0.627451,0.627451,0.380392,0.690196,0.690196,0.690196,0.5058820000000001,0.752941,0.752941,0.752941,0.631373,0.815686,0.815686,0.815686,0.756863,0.878431,0.878431,0.878431,0.8823530000000001,0.941176,0.941176,0.941176,1,1,1,1]},{"ColorSpace":"Lab","Name":"Purples","RGBPoints":[-1,0.247059,0,0.490196,-0.87451,0.288397,0.07677,0.525629,-0.74902,0.32975,0.153587,0.561092,-0.623529,0.373057,0.236263,0.600461,-0.498039,0.416363,0.319,0.639923,-0.372549,0.459669,0.405613,0.685198,-0.247059,0.503345,0.491534,0.730058,-0.121569,0.562399,0.54862,0.757616,0.00392157,0.621453,0.606075,0.785544,0.129412,0.680508,0.674971,0.824914,0.254902,0.7395620000000001,0.743406,0.863899,0.380392,0.798616,0.800492,0.8934260000000001,0.5058820000000001,0.85684,0.8566550000000001,0.9224909999999999,0.631373,0.898178,0.894056,0.942176,0.756863,0.938654,0.9309190000000001,0.961646,0.8823530000000001,0.964245,0.9584780000000001,0.977393,1,0.988235,0.984314,0.992157]},{"ColorSpace":"Lab","Name":"Blues","RGBPoints":[-1,0.031373,0.188235,0.419608,-0.87451,0.031373,0.253195,0.516063,-0.74902,0.031757,0.318139,0.6121490000000001,-0.623529,0.080969,0.38113,0.661361,-0.498039,0.130427,0.444152,0.710327,-0.372549,0.195386,0.509112,0.743791,-0.247059,0.260715,0.573841,0.777209,-0.121569,0.341423,0.628958,0.808704,0.00392157,0.422745,0.684075,0.839892,0.129412,0.523137,0.739193,0.861546,0.254902,0.622684,0.7934639999999999,0.883429,0.380392,0.701423,0.826928,0.910988,0.5058820000000001,0.778685,0.8603,0.937993,0.631373,0.825928,0.891795,0.9537409999999999,0.756863,0.8732799999999999,0.923291,0.969489,0.8823530000000001,0.9224909999999999,0.9547870000000001,0.985236,1,0.968627,0.984314,1]},{"ColorSpace":"Lab","Name":"Greens","RGBPoints":[-1,0,0.266667,0.105882,-0.87451,0,0.347374,0.139346,-0.74902,0.000538,0.427912,0.172933,-0.623529,0.069435,0.486967,0.222145,-0.498039,0.138178,0.546082,0.271326,-0.372549,0.197232,0.609073,0.31857,-0.247059,0.257255,0.671742,0.365859,-0.121569,0.357647,0.720953,0.415071,0.00392157,0.45767,0.769919,0.465021,0.129412,0.546251,0.811257,0.537855,0.254902,0.6342950000000001,0.8522110000000001,0.610688,0.380392,0.709097,0.883706,0.683522,0.5058820000000001,0.78316,0.914833,0.755894,0.631373,0.842215,0.938454,0.818885,0.756863,0.899977,0.961538,0.880692,0.8823530000000001,0.935409,0.975317,0.92203,1,0.968627,0.988235,0.960784]},{"ColorSpace":"Lab","Name":"PuBu","RGBPoints":[-1,0.301961,0,0.294118,-0.87451,0.404321,0.029527,0.390573,-0.74902,0.5059900000000001,0.059592,0.486782,-0.623529,0.519769,0.158016,0.551742,-0.498039,0.533456,0.256194,0.616301,-0.372549,0.54133,0.33887,0.655671,-0.247059,0.54902,0.421592,0.695087,-0.121569,0.54902,0.506236,0.736424,0.00392157,0.550127,0.590573,0.777701,0.129412,0.5855590000000001,0.665375,0.81707,0.254902,0.6221449999999999,0.739023,0.8558249999999999,0.380392,0.687105,0.7842980000000001,0.8794459999999999,0.5058820000000001,0.752065,0.829758,0.903253,0.631373,0.817024,0.87897,0.9308110000000001,0.756863,0.880907,0.927213,0.957832,0.8823530000000001,0.9261819999999999,0.958708,0.975548,1,0.968627,0.988235,0.992157]},{"ColorSpace":"Lab","Name":"BuPu","RGBPoints":[-1,0.007842999999999999,0.219608,0.345098,-0.87451,0.01178,0.286536,0.449427,-0.74902,0.015702,0.35328,0.5534790000000001,-0.623529,0.01767,0.396586,0.622376,-0.498039,0.021115,0.4402,0.690688,-0.372549,0.11757,0.5031910000000001,0.722184,-0.247059,0.214625,0.565859,0.753633,-0.121569,0.336671,0.615071,0.78316,0.00392157,0.457978,0.663975,0.812503,0.129412,0.556401,0.703345,0.836125,0.254902,0.65421,0.742714,0.859669,0.380392,0.736886,0.782084,0.881323,0.5058820000000001,0.8182700000000001,0.821638,0.903068,0.631373,0.873387,0.864944,0.92669,0.756863,0.927536,0.907605,0.9499880000000001,0.8823530000000001,0.964937,0.9391,0.967705,1,1,0.968627,0.984314]},{"ColorSpace":"Lab","Name":"BuGn","RGBPoints":[-1,0.031373,0.25098,0.5058820000000001,-0.87451,0.031373,0.329719,0.590527,-0.74902,0.031911,0.408397,0.674787,-0.623529,0.100807,0.479262,0.710219,-0.498039,0.169704,0.550219,0.745744,-0.372549,0.238601,0.62699,0.7870819999999999,-0.247059,0.307958,0.703114,0.826759,-0.121569,0.39654,0.7523260000000001,0.7972320000000001,0.00392157,0.485121,0.801046,0.767705,0.129412,0.573702,0.83451,0.738178,0.254902,0.661592,0.867743,0.7110340000000001,0.380392,0.732457,0.895302,0.74253,0.5058820000000001,0.801845,0.922307,0.774579,0.631373,0.841215,0.938055,0.817885,0.756863,0.880907,0.95391,0.861084,0.8823530000000001,0.9261819999999999,0.971626,0.9024219999999999,1,0.968627,0.988235,0.941176]},{"ColorSpace":"Lab","Name":"GnBu","RGBPoints":[-1,0,0.266667,0.105882,-0.87451,0,0.347374,0.139346,-0.74902,0.000538,0.427912,0.172933,-0.623529,0.069435,0.486967,0.222145,-0.498039,0.138178,0.546175,0.272095,-0.372549,0.197232,0.615071,0.368551,-0.247059,0.256609,0.683276,0.464867,-0.121569,0.329443,0.722645,0.555417,0.00392157,0.403137,0.762138,0.645413,0.129412,0.503529,0.805444,0.718247,0.254902,0.603922,0.848597,0.790465,0.380392,0.704314,0.887966,0.8475510000000001,0.5058820000000001,0.802307,0.9263209999999999,0.903714,0.631373,0.851519,0.944037,0.941115,0.756863,0.899977,0.961538,0.976901,0.8823530000000001,0.935409,0.975317,0.984775,1,0.968627,0.988235,0.992157]},{"ColorSpace":"Lab","Name":"GnBuPu","RGBPoints":[-1,0.003922,0.27451,0.211765,-0.87451,0.003922,0.349312,0.280661,-0.74902,0.003937,0.423852,0.349773,-0.623529,0.005905,0.46519,0.446228,-0.498039,0.009443,0.506344,0.542837,-0.372549,0.111803,0.535871,0.649135,-0.247059,0.214025,0.565859,0.753633,-0.121569,0.310481,0.615071,0.78316,0.00392157,0.407797,0.663975,0.812503,0.129412,0.531811,0.703345,0.836125,0.254902,0.65421,0.742714,0.859669,0.380392,0.736886,0.782084,0.881323,0.5058820000000001,0.8182700000000001,0.821176,0.902884,0.631373,0.873387,0.854641,0.9225680000000001,0.756863,0.927536,0.888535,0.942361,0.8823530000000001,0.964937,0.9298729999999999,0.964014,1,1,0.968627,0.984314]},{"ColorSpace":"Lab","Name":"BuGnYl","RGBPoints":[-1,0.031373,0.113725,0.345098,-0.87451,0.08845799999999999,0.159,0.463206,-0.74902,0.145052,0.204567,0.5807,-0.623529,0.139146,0.287243,0.620069,-0.498039,0.13318,0.370196,0.659562,-0.372549,0.123337,0.470588,0.706805,-0.247059,0.115386,0.570335,0.753126,-0.121569,0.186251,0.643168,0.761,0.00392157,0.258716,0.71514,0.768074,0.129412,0.380761,0.760415,0.750358,0.254902,0.503576,0.806075,0.732795,0.380392,0.645306,0.861192,0.719016,0.5058820000000001,0.783899,0.91511,0.705606,0.631373,0.858701,0.9446369999999999,0.6997,0.756863,0.931349,0.973303,0.698424,0.8823530000000001,0.966782,0.987082,0.777163,1,1,1,0.85098]},{"ColorSpace":"Lab","Name":"PuRd","RGBPoints":[-1,0.286275,0,0.415686,-0.87451,0.38273,0.001968,0.441276,-0.74902,0.479231,0.003922,0.466774,-0.623529,0.581592,0.003922,0.480554,-0.498039,0.683799,0.00549,0.494887,-0.372549,0.776317,0.105882,0.544098,-0.247059,0.867866,0.206321,0.592618,-0.121569,0.9190469999999999,0.308681,0.612303,0.00392157,0.968812,0.411226,0.632603,0.129412,0.9747169999999999,0.519493,0.671972,0.254902,0.980546,0.626451,0.71065,0.380392,0.984483,0.701253,0.732303,0.5058820000000001,0.988328,0.77504,0.755617,0.631373,0.990296,0.828189,0.812703,0.756863,0.992372,0.880907,0.869035,0.8823530000000001,0.996309,0.9261819999999999,0.912341,1,1,0.968627,0.952941]},{"ColorSpace":"Lab","Name":"RdPu","RGBPoints":[-1,0.403922,0,0.121569,-0.87451,0.500377,0,0.192434,-0.74902,0.596909,0.000277,0.263037,-0.623529,0.703206,0.035709,0.300438,-0.498039,0.808612,0.071296,0.338854,-0.372549,0.857824,0.116571,0.441215,-0.247059,0.905513,0.163552,0.54293,-0.121569,0.889765,0.281661,0.6177319999999999,0.00392157,0.873156,0.39897,0.691611,0.129412,0.82985,0.491488,0.736886,0.254902,0.789081,0.583237,0.781853,0.380392,0.810734,0.656071,0.819254,0.5058820000000001,0.833126,0.729181,0.85684,0.631373,0.8705270000000001,0.80792,0.898178,0.756863,0.907605,0.884398,0.938331,0.8823530000000001,0.9391,0.921799,0.958016,1,0.968627,0.956863,0.976471]},{"ColorSpace":"Lab","Name":"Oranges","RGBPoints":[-1,0.498039,0.152941,0.015686,-0.87451,0.57481,0.182468,0.013718,-0.74902,0.651765,0.212042,0.011734,-0.623529,0.752157,0.247474,0.007797,-0.498039,0.851719,0.283368,0.004475,-0.372549,0.898962,0.348328,0.039908,-0.247059,0.945652,0.413426,0.076401,-0.121569,0.9692730000000001,0.484291,0.157109,0.00392157,0.992157,0.554971,0.238185,0.129412,0.992157,0.619931,0.330704,0.254902,0.992157,0.684967,0.423837,0.380392,0.992157,0.751895,0.532103,0.5058820000000001,0.992249,0.817716,0.639354,0.631373,0.994218,0.861023,0.725967,0.756863,0.996186,0.903576,0.810965,0.8823530000000001,0.998155,0.933103,0.868051,1,1,0.960784,0.921569]},{"ColorSpace":"Lab","Name":"Reds","RGBPoints":[-1,0.403922,0,0.05098,-0.87451,0.525967,0.029527,0.066728,-0.74902,0.647643,0.058962,0.08247599999999999,-0.623529,0.722445,0.076678,0.09822400000000001,-0.498039,0.797186,0.095194,0.114187,-0.372549,0.868051,0.164091,0.143714,-0.247059,0.937809,0.233541,0.173933,-0.121569,0.96143,0.326059,0.232987,0.00392157,0.984375,0.418147,0.292657,0.129412,0.986344,0.496886,0.371396,0.254902,0.988235,0.575702,0.450673,0.380392,0.988235,0.656409,0.543191,0.5058820000000001,0.98842,0.736747,0.635894,0.631373,0.992357,0.809581,0.732349,0.756863,0.996186,0.880692,0.826759,0.8823530000000001,0.998155,0.92203,0.885813,1,1,0.960784,0.941176]},{"ColorSpace":"Lab","Name":"RdOr","RGBPoints":[-1,0.498039,0,0,-0.87451,0.6004,0,0,-0.74902,0.702514,0.000738,0.000477,-0.623529,0.773379,0.095225,0.061499,-0.498039,0.843875,0.189865,0.12283,-0.372549,0.891119,0.294195,0.203537,-0.247059,0.937855,0.397924,0.283137,-0.121569,0.963445,0.476663,0.316601,0.00392157,0.988297,0.555771,0.351665,0.129412,0.990265,0.646321,0.436309,0.254902,0.992157,0.735256,0.5196460000000001,0.380392,0.992157,0.7844680000000001,0.570827,0.5058820000000001,0.992249,0.833218,0.623483,0.631373,0.994218,0.872587,0.706159,0.756863,0.996186,0.911419,0.788189,0.8823530000000001,0.998155,0.9409459999999999,0.859054,1,1,0.968627,0.92549]},{"ColorSpace":"Lab","Name":"BrOrYl","RGBPoints":[-1,0.4,0.145098,0.023529,-0.87451,0.5003919999999999,0.174625,0.019592,-0.74902,0.600784,0.204291,0.015656,-0.623529,0.701176,0.251534,0.011719,-0.498039,0.800984,0.299146,0.008397,-0.372549,0.863975,0.370012,0.043829,-0.247059,0.9263209999999999,0.441107,0.0794,-0.121569,0.961753,0.521815,0.120738,0.00392157,0.996078,0.602645,0.163122,0.129412,0.996078,0.68729,0.237924,0.254902,0.996078,0.771011,0.314879,0.380392,0.996078,0.8320340000000001,0.444798,0.5058820000000001,0.996171,0.892042,0.572595,0.631373,0.998139,0.931411,0.65724,0.756863,1,0.969489,0.741669,0.8823530000000001,1,0.985236,0.822376,1,1,1,0.898039]},{"ColorSpace":"Lab","Name":"RdOrYl","RGBPoints":[-1,0.501961,0,0.14902,-0.87451,0.622038,0,0.14902,-0.74902,0.741761,0.0004,0.148866,-0.623529,0.816563,0.05158,0.129181,-0.498039,0.890965,0.10356,0.110235,-0.372549,0.940177,0.205921,0.137793,-0.247059,0.988281,0.308789,0.165536,-0.121569,0.99025,0.432803,0.200969,0.00392157,0.992218,0.555217,0.236278,0.129412,0.994187,0.628051,0.267774,0.254902,0.996078,0.701038,0.301269,0.380392,0.996078,0.777809,0.383945,0.5058820000000001,0.996171,0.852826,0.466621,0.631373,0.998139,0.892195,0.549296,0.756863,1,0.931349,0.632188,0.8823530000000001,1,0.966782,0.7188,1,1,1,0.8]},{"ColorSpace":"Lab","Name":"CIELab_blue2red","RGBPoints":[-1,0,0.6,0.74902,1,0.76863,0.46667,0.34118]},{"ColorSpace":"Lab","Name":"blue2yellow","RGBPoints":[-1,0,0,1,0,0.5,0.5,0.5,1,1,1,0]},{"ColorSpace":"Lab","Name":"erdc_blue2gold","RGBPoints":[-1,0.175119,0.0438468,1,-0.874016,0.22383,0.159771,0.94557,-0.748031,0.27254,0.233611,0.891216,-0.622047,0.321251,0.296526,0.836857,-0.496063,0.369962,0.354296,0.782359,-0.370079,0.418672,0.409139,0.72754,-0.244094,0.467383,0.462152,0.672148,-0.11811,0.51609,0.51396,0.615825,0.007874020000000001,0.572863,0.55452,0.559172,0.133858,0.630269,0.593822,0.517729,0.259843,0.689588,0.624668,0.47446,0.385827,0.745394,0.6561129999999999,0.428638,0.511811,0.798624,0.688104,0.379105,0.637795,0.849926,0.720593,0.323834,0.76378,0.899765,0.753543,0.258657,0.889764,0.948487,0.78692,0.171778,1,0.990413,0.816451,0.00729848]},{"ColorSpace":"Lab","Name":"erdc_blue2yellow","RGBPoints":[-1,0.08301219999999999,0,0.495617,-0.87451,0.141973,0.0551288,0.57363,-0.74902,0.193048,0.110258,0.604561,-0.623529,0.234231,0.165386,0.57643,-0.498039,0.275413,0.220515,0.548299,-0.372549,0.316596,0.275644,0.520169,-0.247059,0.357778,0.330773,0.492038,-0.121569,0.398961,0.385901,0.463908,0.00392157,0.449929,0.438487,0.426815,0.129412,0.511572,0.488299,0.379944,0.254902,0.581222,0.53603,0.325741,0.380392,0.650871,0.583761,0.271538,0.5058820000000001,0.720521,0.631493,0.217335,0.631373,0.79017,0.679224,0.163132,0.756863,0.85982,0.726955,0.108929,0.8823530000000001,0.910254,0.774159,0.14112,1,0.927513,0.81759,0.306289]},{"ColorSpace":"Lab","Name":"erdc_cyan2orange","RGBPoints":[-1,0.0471513,0.213874,0.414329,-0.87451,0.06747019999999999,0.256648,0.439027,-0.74902,0.0959957,0.299331,0.462089,-0.623529,0.132428,0.341872,0.483212,-0.498039,0.188743,0.38277,0.500597,-0.372549,0.268511,0.420229,0.5121790000000001,-0.247059,0.352945,0.455602,0.519101,-0.121569,0.43893,0.489368,0.5215379999999999,0.00392157,0.522445,0.522495,0.522436,0.129412,0.600089,0.555682,0.53205,0.254902,0.67988,0.587981,0.5391629999999999,0.380392,0.761011,0.619586,0.544439,0.5058820000000001,0.84278,0.650741,0.548567,0.631373,0.910713,0.687347,0.557822,0.756863,0.952232,0.734972,0.577775,0.8823530000000001,0.975642,0.7898579999999999,0.604868,1,0.990752,0.843643,0.632857]},{"ColorSpace":"Lab","Name":"erdc_purple2green","RGBPoints":[-1,0.235006,0.0483128,0.530899,-0.87451,0.302968,0.108419,0.552391,-0.74902,0.360241,0.166059,0.569502,-0.623529,0.406746,0.226782,0.579373,-0.498039,0.444073,0.28964,0.582094,-0.372549,0.473648,0.353774,0.577947,-0.247059,0.497636,0.418154,0.5679110000000001,-0.121569,0.519086,0.481741,0.553968,0.00392157,0.542884,0.542914,0.542875,0.129412,0.566303,0.603989,0.5274990000000001,0.254902,0.595218,0.662965,0.516857,0.380392,0.628641,0.720701,0.510673,0.5058820000000001,0.665373,0.777849,0.508165,0.631373,0.704182,0.834921,0.5083029999999999,0.756863,0.743846,0.892328,0.5099900000000001,0.8823530000000001,0.783158,0.950422,0.512181,1,0.818617,1,0.513888]},{"ColorSpace":"Lab","Name":"erdc_purple2green_dark","RGBPoints":[-1,0.107656,0,0.428682,-0.87451,0.1924,0,0.449799,-0.74902,0.255118,0.0648939,0.466726,-0.623529,0.304256,0.133066,0.476703,-0.498039,0.343202,0.19716,0.479793,-0.372549,0.373876,0.260353,0.476241,-0.247059,0.398497,0.322872,0.466953,-0.121569,0.420016,0.384252,0.453785,0.00392157,0.44319,0.443216,0.443186,0.129412,0.465553,0.502139,0.428233,0.254902,0.492959,0.559151,0.417591,0.380392,0.524654,0.615092,0.411016,0.5058820000000001,0.55959,0.670583,0.40779,0.631373,0.596614,0.726102,0.406948,0.756863,0.634544,0.7820319999999999,0.407439,0.8823530000000001,0.672183,0.838703,0.408237,1,0.706131,0.892759,0.408452]},{"ColorSpace":"Lab","Name":"coolwarm","RGBPoints":[-1,0.229806,0.298718,0.753683,-0.875,0.303869,0.406535,0.844959,-0.75,0.383013,0.509419,0.917388,-0.625,0.466667,0.604563,0.968155,-0.5,0.552953,0.688929,0.995376,-0.375,0.639176,0.7596000000000001,0.998151,-0.25,0.722193,0.813953,0.976575,-0.125,0.798692,0.849786,0.931689,0,0.865395,0.86541,0.8653960000000001,0.125,0.9241279999999999,0.827385,0.774508,0.25,0.958853,0.769768,0.6780080000000001,0.375,0.969954,0.694267,0.579375,0.5,0.958003,0.602842,0.481776,0.625,0.923945,0.497309,0.38797,0.75,0.869187,0.378313,0.300267,0.875,0.795632,0.241284,0.220526,1,0.705673,0.0155562,0.150233]},{"ColorSpace":"Lab","Name":"BuRd","RGBPoints":[-1,0.019608,0.188235,0.380392,-0.87451,0.088504,0.321107,0.564937,-0.74902,0.163399,0.444983,0.697501,-0.623529,0.247059,0.555709,0.754095,-0.498039,0.420684,0.676432,0.818685,-0.372549,0.606459,0.7897729999999999,0.880277,-0.247059,0.761476,0.868512,0.924567,-0.121569,0.878047,0.925721,0.951942,0.00392157,0.969089,0.9664740000000001,0.964937,0.129412,0.9838519999999999,0.897578,0.846828,0.254902,0.982468,0.800692,0.706113,0.380392,0.960323,0.66782,0.536332,0.5058820000000001,0.894579,0.503806,0.399769,0.631373,0.81707,0.33218,0.281046,0.756863,0.7284890000000001,0.155017,0.197386,0.8823530000000001,0.576932,0.055363,0.14925,1,0.403922,0,0.121569]},{"ColorSpace":"Lab","Name":"Spectral_lowBlue","RGBPoints":[-1,0.368627,0.309804,0.635294,-0.87451,0.260361,0.450058,0.70173,-0.74902,0.248058,0.591311,0.717186,-0.623529,0.376009,0.734025,0.6581320000000001,-0.498039,0.537947,0.814764,0.64506,-0.372549,0.702345,0.879585,0.636678,-0.247059,0.8475200000000001,0.938639,0.607151,-0.121569,0.940408,0.976163,0.6560550000000001,0.00392157,0.999923,0.9976159999999999,0.745021,0.129412,0.997463,0.921338,0.61707,0.254902,0.9950020000000001,0.824606,0.499885,0.380392,0.992541,0.701576,0.39654,0.5058820000000001,0.973472,0.547405,0.318108,0.631373,0.937793,0.398539,0.270127,0.756863,0.861515,0.282891,0.299654,0.8823530000000001,0.746482,0.144637,0.288812,1,0.619608,0.003922,0.258824]},{"ColorSpace":"Lab","Name":"GnRP","RGBPoints":[-1,0,0.266667,0.105882,-0.87451,0.066436,0.394617,0.174779,-0.74902,0.168858,0.524567,0.25767,-0.623529,0.323875,0.657439,0.361015,-0.498039,0.504883,0.7723179999999999,0.506344,-0.372549,0.678431,0.870127,0.654902,-0.247059,0.803922,0.921799,0.780392,-0.121569,0.897116,0.951942,0.882814,0.00392157,0.967397,0.965936,0.9674739999999999,0.129412,0.928028,0.879815,0.930565,0.254902,0.866052,0.7807770000000001,0.882891,0.380392,0.77501,0.665129,0.821376,0.5058820000000001,0.675663,0.5370239999999999,0.737024,0.631373,0.57847,0.396155,0.6459819999999999,0.756863,0.492349,0.223914,0.547559,0.8823530000000001,0.375548,0.096886,0.423299,1,0.25098,0,0.294118]},{"ColorSpace":"Lab","Name":"GYPi","RGBPoints":[-1,0.152941,0.392157,0.098039,-0.87451,0.246444,0.505344,0.117724,-0.74902,0.351942,0.614533,0.161399,-0.623529,0.474971,0.717878,0.240138,-0.498039,0.611995,0.811226,0.392849,-0.372549,0.746328,0.893118,0.565321,-0.247059,0.8595159999999999,0.94233,0.747405,-0.121569,0.928105,0.9638600000000001,0.875663,0.00392157,0.969089,0.966859,0.968012,0.129412,0.9838519999999999,0.910265,0.9483279999999999,0.254902,0.979239,0.833218,0.914648,0.380392,0.949712,0.729873,0.862976,0.5058820000000001,0.905652,0.5829299999999999,0.763552,0.631373,0.85521,0.410073,0.652211,0.756863,0.793695,0.183699,0.5316419999999999,0.8823530000000001,0.683737,0.063899,0.420761,1,0.556863,0.003922,0.321569]},{"ColorSpace":"Lab","Name":"GnYlRd","RGBPoints":[-1,0,0.407843,0.215686,-0.87451,0.063975,0.525952,0.277201,-0.74902,0.177932,0.633064,0.332718,-0.623529,0.364937,0.724106,0.379469,-0.498039,0.5279509999999999,0.7971549999999999,0.40223,-0.372549,0.678431,0.862822,0.433449,-0.247059,0.803922,0.916955,0.514648,-0.121569,0.909419,0.961861,0.625067,0.00392157,0.999923,0.9976159999999999,0.745021,0.129412,0.997463,0.921338,0.61707,0.254902,0.9950020000000001,0.824606,0.499885,0.380392,0.992541,0.701576,0.39654,0.5058820000000001,0.973472,0.547405,0.318108,0.631373,0.9390230000000001,0.389927,0.245521,0.756863,0.867666,0.239831,0.176624,0.8823530000000001,0.762399,0.110727,0.151326,1,0.6470590000000001,0,0.14902]},{"ColorSpace":"Lab","Name":"GBBr","RGBPoints":[-1,0,0.235294,0.188235,-0.87451,0.002461,0.338639,0.301423,-0.74902,0.055902,0.448981,0.417609,-0.623529,0.183852,0.56955,0.538178,-0.498039,0.357785,0.700115,0.6607460000000001,-0.372549,0.540177,0.819531,0.77624,-0.247059,0.714879,0.890888,0.864821,-0.121569,0.8511339999999999,0.934564,0.922645,0.00392157,0.960861,0.959785,0.95694,0.129412,0.963322,0.927797,0.83391,0.254902,0.9399459999999999,0.868897,0.68935,0.380392,0.8833530000000001,0.775394,0.517109,0.5058820000000001,0.808074,0.6258359999999999,0.324106,0.631373,0.717647,0.476355,0.15494,0.756863,0.592157,0.358247,0.06882000000000001,0.8823530000000001,0.458593,0.26436,0.031142,1,0.329412,0.188235,0.019608]},{"ColorSpace":"Lab","Name":"PuOr","RGBPoints":[-1,0.498039,0.231373,0.031373,-0.87451,0.62599,0.30273,0.026451,-0.74902,0.746943,0.387082,0.037524,-0.623529,0.85767,0.490427,0.07197199999999999,-0.498039,0.936409,0.617762,0.236371,-0.372549,0.992695,0.743099,0.43291,-0.247059,0.995156,0.841523,0.63714,-0.121569,0.985313,0.913802,0.813687,0.00392157,0.966244,0.966398,0.967705,0.129412,0.889965,0.8950399999999999,0.938178,0.254902,0.806151,0.804306,0.894656,0.380392,0.712649,0.688658,0.833141,0.5058820000000001,0.594233,0.554325,0.744637,0.631373,0.474894,0.404229,0.6523640000000001,0.756863,0.366628,0.217224,0.563783,0.8823530000000001,0.266436,0.089965,0.434833,1,0.176471,0,0.294118]},{"ColorSpace":"Lab","Name":"PRGn","RGBPoints":[-1,0.25098,0,0.294118,-0.87451,0.383852,0.103345,0.431911,-0.74902,0.497732,0.234679,0.55371,-0.623529,0.583852,0.40692,0.652134,-0.498039,0.681968,0.545175,0.742561,-0.372549,0.7806999999999999,0.672357,0.825221,-0.247059,0.871742,0.788005,0.886736,-0.121569,0.930488,0.885198,0.932872,0.00392157,0.966321,0.968089,0.965859,0.129412,0.892503,0.950865,0.877278,0.254902,0.796078,0.91857,0.772549,0.380392,0.670588,0.866897,0.6470590000000001,0.5058820000000001,0.493195,0.765398,0.496655,0.631373,0.314187,0.649135,0.354556,0.756863,0.15917,0.516263,0.251211,0.8823530000000001,0.062284,0.386621,0.170473,1,0,0.266667,0.105882]},{"ColorSpace":"Lab","Name":"PiYG","RGBPoints":[-1,0.556863,0.003922,0.321569,-0.87451,0.692195,0.067897,0.427374,-0.74902,0.797539,0.197847,0.539177,-0.623529,0.859054,0.424221,0.6597460000000001,-0.498039,0.908574,0.592618,0.770319,-0.372549,0.951557,0.736332,0.866205,-0.247059,0.981084,0.839677,0.917878,-0.121569,0.98293,0.913802,0.949558,0.00392157,0.96732,0.9684739999999999,0.965629,0.129412,0.92549,0.963552,0.8696660000000001,0.254902,0.852441,0.939254,0.736025,0.380392,0.739254,0.890042,0.553941,0.5058820000000001,0.60323,0.805536,0.382238,0.631373,0.467282,0.711419,0.235217,0.756863,0.344252,0.608074,0.156478,0.8823530000000001,0.2406,0.49827,0.116494,1,0.152941,0.392157,0.098039]},{"ColorSpace":"Lab","Name":"OrPu","RGBPoints":[-1,0.176471,0,0.294118,-0.87451,0.272434,0.09596300000000001,0.444214,-0.74902,0.373395,0.228912,0.56932,-0.623529,0.481661,0.415917,0.657901,-0.498039,0.601922,0.562937,0.750481,-0.372549,0.718493,0.695886,0.836986,-0.247059,0.811995,0.811534,0.898501,-0.121569,0.894733,0.8995,0.9400230000000001,0.00392157,0.969166,0.966859,0.963629,0.129412,0.98639,0.910265,0.803691,0.254902,0.9950020000000001,0.835371,0.624375,0.380392,0.992541,0.736947,0.420146,0.5058820000000001,0.931949,0.6094580000000001,0.224221,0.631373,0.85075,0.483968,0.06981900000000001,0.756863,0.740023,0.380623,0.035371,0.8823530000000001,0.617993,0.29827,0.026759,1,0.498039,0.231373,0.031373]},{"ColorSpace":"Lab","Name":"BrBG","RGBPoints":[-1,0.329412,0.188235,0.019608,-0.87451,0.467205,0.269435,0.031911,-0.74902,0.6,0.365629,0.074202,-0.623529,0.72549,0.483737,0.160323,-0.498039,0.812995,0.635832,0.336409,-0.372549,0.88689,0.781238,0.527874,-0.247059,0.943483,0.87474,0.700115,-0.121569,0.963168,0.929796,0.841599,0.00392157,0.957247,0.959938,0.959554,0.129412,0.84406,0.932872,0.920185,0.254902,0.70396,0.886428,0.859285,0.380392,0.529258,0.815071,0.7707039999999999,0.5058820000000001,0.346251,0.691811,0.653057,0.631373,0.175855,0.562015,0.5306419999999999,0.756863,0.047905,0.441446,0.410073,0.8823530000000001,0.002307,0.33218,0.294348,1,0,0.235294,0.188235]},{"ColorSpace":"Lab","Name":"GyRd","RGBPoints":[-1,0.101961,0.101961,0.101961,-0.87451,0.227451,0.227451,0.227451,-0.74902,0.359939,0.359939,0.359939,-0.623529,0.502653,0.502653,0.502653,-0.498039,0.631373,0.631373,0.631373,-0.372549,0.749865,0.749865,0.749865,-0.247059,0.843368,0.843368,0.843368,-0.121569,0.926105,0.926105,0.926105,0.00392157,0.999846,0.997232,0.995694,0.129412,0.9949249999999999,0.908651,0.857901,0.254902,0.982468,0.800692,0.706113,0.380392,0.960323,0.66782,0.536332,0.5058820000000001,0.894579,0.503806,0.399769,0.631373,0.81707,0.33218,0.281046,0.756863,0.7284890000000001,0.155017,0.197386,0.8823530000000001,0.576932,0.055363,0.14925,1,0.403922,0,0.121569]},{"ColorSpace":"Lab","Name":"erdc_divHi_purpleGreen","RGBPoints":[-1,0.297553,0,0.489074,-0.87451,0.40259,0.151146,0.567754,-0.74902,0.516038,0.284843,0.658231,-0.623529,0.629783,0.423646,0.750938,-0.498039,0.735198,0.563697,0.835956,-0.372549,0.82408,0.695541,0.903582,-0.247059,0.889091,0.807454,0.944862,-0.121569,0.92334,0.886917,0.951839,0.00392157,0.921045,0.921084,0.921003,0.129412,0.877324,0.907455,0.845381,0.254902,0.7976490000000001,0.8497130000000001,0.734695,0.380392,0.691646,0.75964,0.600532,0.5058820000000001,0.568981,0.649159,0.453807,0.631373,0.438945,0.529756,0.304259,0.756863,0.30973,0.412001,0.158303,0.8823530000000001,0.187078,0.305111,0.00251458,1,0.101655,0.220836,0]},{"ColorSpace":"Lab","Name":"erdc_divHi_purpleGreen_dim","RGBPoints":[-1,0.404088,0.131038,0.592767,-0.87451,0.486469,0.230957,0.651243,-0.74902,0.575165,0.339335,0.717723,-0.623529,0.662741,0.454332,0.784263,-0.498039,0.742071,0.570213,0.8429179999999999,-0.372549,0.806935,0.678992,0.886227,-0.247059,0.8522189999999999,0.771315,0.90763,-0.121569,0.873345,0.837327,0.901572,0.00392157,0.866783,0.86682,0.866745,0.129412,0.82839,0.858225,0.796812,0.254902,0.762578,0.814287,0.700202,0.380392,0.6764289999999999,0.744229,0.585735,0.5058820000000001,0.577033,0.65732,0.461526,0.631373,0.47128,0.562476,0.33476,0.756863,0.365461,0.467957,0.21076,0.8823530000000001,0.264758,0.381138,0.0878313,1,0.182591,0.312249,0]},{"ColorSpace":"Lab","Name":"erdc_divLow_icePeach","RGBPoints":[-1,0.480048,0.817441,0.9980560000000001,-0.87451,0.425898,0.726921,0.8831870000000001,-0.74902,0.366682,0.629445,0.7619359999999999,-0.623529,0.308756,0.531002,0.640217,-0.498039,0.258021,0.43705,0.523433,-0.372549,0.219244,0.352381,0.416348,-0.247059,0.195127,0.281032,0.322979,-0.121569,0.186286,0.22627,0.246525,0.00392157,0.192352,0.19236,0.192364,0.129412,0.255927,0.214469,0.191756,0.254902,0.340459,0.254426,0.206666,0.380392,0.444655,0.309315,0.234029,0.5058820000000001,0.565353,0.376004,0.270969,0.631373,0.697917,0.450748,0.314293,0.756863,0.836657,0.529064,0.360227,0.8823530000000001,0.972695,0.614884,0.413123,1,1,0.705904,0.472699]},{"ColorSpace":"Lab","Name":"erdc_divLow_purpleGreen","RGBPoints":[-1,0.9560340000000001,0.6664870000000001,0.952663,-0.87451,0.874457,0.572698,0.936352,-0.74902,0.7534650000000001,0.488253,0.909063,-0.623529,0.63309,0.413507,0.763833,-0.498039,0.514491,0.345878,0.620015,-0.372549,0.405008,0.288141,0.484376,-0.247059,0.311388,0.241986,0.363556,-0.121569,0.238722,0.209044,0.263449,0.00392157,0.192352,0.192366,0.192362,0.129412,0.200379,0.233201,0.168618,0.254902,0.230151,0.291737,0.165227,0.380392,0.279481,0.366076,0.178607,0.5058820000000001,0.344927,0.453267,0.205703,0.631373,0.421554,0.549449,0.242643,0.756863,0.5033339999999999,0.649999,0.284377,0.8823530000000001,0.583497,0.749672,0.324969,1,0.650705,0.837228,0.356264]},{"ColorSpace":"Lab","Name":"Haze_green","RGBPoints":[-1,1,0.835294,0.886275,-0.87451,0.9372549999999999,0.756863,0.870443,-0.74902,0.875817,0.666376,0.857807,-0.623529,0.778359,0.5830070000000001,0.808134,-0.498039,0.676253,0.494118,0.745098,-0.372549,0.561365,0.390123,0.682353,-0.247059,0.438344,0.262745,0.621496,-0.121569,0.321133,0.141031,0.558751,0.00392157,0.203922,0.0217865,0.495861,0.129412,0.265505,0.129412,0.433261,0.254902,0.311692,0.255338,0.37008,0.380392,0.356282,0.377342,0.310821,0.5058820000000001,0.39971,0.488889,0.258243,0.631373,0.442556,0.604357,0.205519,0.756863,0.48671,0.71968,0.152941,0.8823530000000001,0.529847,0.830356,0.100944,1,0.572549,0.933333,0.054902]},{"ColorSpace":"Lab","Name":"Haze_lime","RGBPoints":[-1,0.704034,0.784196,1,-0.87451,0.633111,0.691418,0.956078,-0.74902,0.564021,0.600606,0.912157,-0.623529,0.496827,0.51189,0.868235,-0.498039,0.43157,0.425416,0.824314,-0.372549,0.368248,0.341347,0.780392,-0.247059,0.306767,0.259855,0.736471,-0.121569,0.246862,0.181069,0.692549,0.00392157,0.191619,0.109542,0.648627,0.129412,0.257404,0.194031,0.604706,0.254902,0.321794,0.278775,0.5607839999999999,0.380392,0.387909,0.364617,0.516863,0.5058820000000001,0.456569,0.451881,0.472941,0.631373,0.527424,0.5407729999999999,0.42902,0.756863,0.599759,0.631427,0.385098,0.8823530000000001,0.673065,0.723898,0.341176,1,0.7427510000000001,0.812252,0.3]},{"ColorSpace":"RGB","Name":"Haze","RGBPoints":[-1,1,0.835294,0.996078,-0.00392157,0.023529,0.141176,0.498039,0.00392157,0.015686,0.137255,0.494118,1,0.984314,0.764706,0]},{"ColorSpace":"Lab","Name":"Haze_cyan","RGBPoints":[-1,0.956863,1,0.835294,-0.87451,0.933188,0.921714,0.760784,-0.74902,0.870588,0.803486,0.671605,-0.623529,0.807843,0.684096,0.583297,-0.498039,0.745098,0.569208,0.494118,-0.372549,0.682353,0.437763,0.390123,-0.247059,0.621496,0.288163,0.262745,-0.121569,0.558751,0.144517,0.141031,0.00392157,0.495861,0.0217865,0.0413943,0.129412,0.433261,0.137255,0.129412,0.254902,0.37008,0.263181,0.255338,0.380392,0.306318,0.381845,0.372694,0.5058820000000001,0.243137,0.5039940000000001,0.494263,0.631373,0.180392,0.629484,0.619753,0.756863,0.117647,0.754975,0.747131,0.8823530000000001,0.054902,0.876398,0.866812,1,0,0.988235,0.976471]},{"ColorSpace":"Lab","Name":"nic_Edge","RGBPoints":[-1,0.191208,0.191208,0.191208,-0.87451,0.239484,0.00545035,0.614821,-0.74902,0.220593,0.0617459,0.863547,-0.623529,0.17509,0.278988,0.97794,-0.498039,0.143526,0.5760690000000001,0.998553,-0.372549,0.166456,0.871883,0.96594,-0.247059,0.376202,0.993555,0.981833,-0.121569,0.681996,0.991297,0.999239,0.00392157,0.954172,0.952734,0.94374,0.129412,0.999735,0.9930099999999999,0.662896,0.254902,0.979399,0.991466,0.357973,0.380392,0.968771,0.854967,0.162659,0.5058820000000001,0.999245,0.556697,0.144323,0.631373,0.973959,0.26223,0.177946,0.756863,0.8523579999999999,0.0526707,0.222974,0.8823530000000001,0.593889,0.00912724,0.238855,1,0.191208,0.191208,0.191208]},{"ColorSpace":"Lab","Name":"erdc_iceFire_H","RGBPoints":[-1,4.05432e-07,0,5.90122e-06,-0.87451,0,0.120401,0.302675,-0.74902,0,0.216583,0.524574,-0.623529,0.0552475,0.345025,0.6595,-0.498039,0.128047,0.492588,0.720288,-0.372549,0.188955,0.641309,0.792092,-0.247059,0.327673,0.784935,0.873434,-0.121569,0.60824,0.892164,0.935547,0.00392157,0.881371,0.912178,0.818099,0.129412,0.951407,0.8356209999999999,0.449279,0.254902,0.904481,0.690489,0,0.380392,0.85407,0.510864,0,0.5058820000000001,0.777093,0.33018,0.00088199,0.631373,0.672862,0.139087,0.00269398,0.756863,0.508815,0,0,0.8823530000000001,0.299417,0.000366289,0.000547829,1,0.0157519,0.00332021,4.55569e-08]},{"ColorSpace":"Lab","Name":"erdc_iceFire_L","RGBPoints":[-1,0.870485,0.913768,0.832905,-0.87451,0.586919,0.887865,0.934003,-0.74902,0.31583,0.776442,0.867858,-0.623529,0.18302,0.632034,0.787722,-0.498039,0.117909,0.484134,0.713825,-0.372549,0.0507239,0.335979,0.654741,-0.247059,0,0.209874,0.511832,-0.121569,0,0.114689,0.28935,0.00392157,0.0157519,0.00332021,4.55569e-08,0.129412,0.312914,0,0,0.254902,0.520865,0,0,0.380392,0.680105,0.15255,0.0025996,0.5058820000000001,0.7851089999999999,0.339479,0.000797922,0.631373,0.8573539999999999,0.522494,0,0.756863,0.910974,0.699774,0,0.8823530000000001,0.951921,0.842817,0.478545,1,0.881371,0.912178,0.818099]},{"ColorSpace":"RGB","Name":"hsv","RGBPoints":[-1,1,0,0,-0.666666,1,0,1,-0.333333,0,0,1,0,0,1,1,0.33333,0,1,0,0.66666,1,1,0,1,1,0,0]},{"ColorSpace":"Lab","Name":"hue_L60","RGBPoints":[-1,0.964784,0.400592,0.349549,-0.87451,0.964915,0.372498,0.5378500000000001,-0.74902,0.892353,0.401039,0.759569,-0.623529,0.7926299999999999,0.446956,0.903017,-0.498039,0.682208,0.49954,0.966673,-0.372549,0.56392,0.553082,0.968836,-0.247059,0.442031,0.606396,0.901601,-0.121569,0.305499,0.65701,0.765784,0.00392157,0.197251,0.687914,0.620914,0.129412,0.193882,0.701887,0.472654,0.254902,0.249866,0.7061229999999999,0.320005,0.380392,0.35132,0.697417,0.202919,0.5058820000000001,0.498097,0.669467,0.125232,0.631373,0.637477,0.626239,0.107431,0.756863,0.762115,0.56872,0.155812,0.8823530000000001,0.8894339999999999,0.481116,0.240445,1,0.964784,0.400592,0.349549]},{"IndexedColors":[0,0,0,0.8941176470588236,0.1019607843137255,0.1098039215686274,0.2156862745098039,0.4941176470588236,0.7215686274509804,0.3019607843137255,0.6862745098039216,0.2901960784313726,0.596078431372549,0.3058823529411765,0.6392156862745098,1,0.4980392156862745,0,0.6509803921568628,0.3372549019607843,0.1568627450980392],"Name":"Spectrum","NanColor":[0.6509803921568628,0.3372549019607843,0.1568627450980392]},{"IndexedColors":[0.4745098039215686,0.09019607843137255,0.09019607843137255,0.7098039215686275,0.00392156862745098,0.00392156862745098,0.9372549019607843,0.2784313725490196,0.09803921568627451,0.9764705882352941,0.5137254901960784,0.1411764705882353,1,0.7058823529411765,0,1,0.8980392156862745,0.02352941176470588],"Name":"Warm","NanColor":[1,0.8980392156862745,0.02352941176470588]},{"IndexedColors":[0.4588235294117647,0.6941176470588235,0.00392156862745098,0.3450980392156863,0.5019607843137255,0.1607843137254902,0.3137254901960784,0.8431372549019608,0.7490196078431373,0.1098039215686274,0.5843137254901961,0.803921568627451,0.2313725490196079,0.407843137254902,0.6705882352941176,0.6039215686274509,0.407843137254902,1,0.3725490196078431,0.2,0.5019607843137255],"Name":"Cool","NanColor":[0.3725490196078431,0.2,0.5019607843137255]},{"IndexedColors":[0.2313725490196079,0.407843137254902,0.6705882352941176,0.1098039215686274,0.5843137254901961,0.803921568627451,0.3058823529411765,0.8509803921568627,0.9176470588235294,0.4509803921568628,0.6039215686274509,0.8352941176470589,0.2588235294117647,0.2392156862745098,0.6627450980392157,0.3137254901960784,0.3294117647058823,0.5294117647058824,0.06274509803921569,0.1647058823529412,0.3215686274509804],"Name":"Blues","NanColor":[0.06274509803921569,0.1647058823529412,0.3215686274509804]},{"IndexedColors":[0.1098039215686274,0.5843137254901961,0.803921568627451,0.2313725490196079,0.407843137254902,0.6705882352941176,0.4,0.2431372549019608,0.7176470588235294,0.6352941176470588,0.3294117647058823,0.8117647058823529,0.8705882352941177,0.3803921568627451,0.807843137254902,0.8627450980392157,0.3803921568627451,0.5843137254901961,0.2392156862745098,0.06274509803921569,0.3215686274509804],"Name":"Wild Flower","NanColor":[0.2392156862745098,0.06274509803921569,0.3215686274509804]},{"IndexedColors":[0.396078431372549,0.4862745098039216,0.2156862745098039,0.4588235294117647,0.6941176470588235,0.00392156862745098,0.6980392156862745,0.7294117647058823,0.1882352941176471,1,0.8980392156862745,0.02352941176470588,1,0.7058823529411765,0,0.9764705882352941,0.5137254901960784,0.1411764705882353],"Name":"Citrus","NanColor":[0.9764705882352941,0.5137254901960784,0.1411764705882353]},{"IndexedColors":[0.4980392156862745,0.2313725490196079,0.03137254901960784,0.7019607843137254,0.3450980392156863,0.02352941176470588,0.8784313725490196,0.5098039215686274,0.07843137254901961,0.9921568627450981,0.7215686274509804,0.3882352941176471,0.996078431372549,0.8784313725490196,0.7137254901960784,0.9686274509803922,0.9686274509803922,0.9686274509803922,0.8470588235294118,0.8549019607843137,0.9215686274509803,0.6980392156862745,0.6705882352941176,0.8235294117647058,0.5019607843137255,0.4509803921568628,0.6745098039215687,0.3294117647058823,0.1529411764705882,0.5333333333333333,0.1764705882352941,0,0.2941176470588235],"Name":"Brewer Diverging Purple-Orange (11)","NanColor":[0.1764705882352941,0,0.2941176470588235]},{"IndexedColors":[0.4980392156862745,0.2313725490196079,0.03137254901960784,0.7019607843137254,0.3450980392156863,0.02352941176470588,0.8784313725490196,0.5098039215686274,0.07843137254901961,0.9921568627450981,0.7215686274509804,0.3882352941176471,0.996078431372549,0.8784313725490196,0.7137254901960784,0.8470588235294118,0.8549019607843137,0.9215686274509803,0.6980392156862745,0.6705882352941176,0.8235294117647058,0.5019607843137255,0.4509803921568628,0.6745098039215687,0.3294117647058823,0.1529411764705882,0.5333333333333333,0.1764705882352941,0,0.2941176470588235],"Name":"Brewer Diverging Purple-Orange (10)","NanColor":[0.1764705882352941,0,0.2941176470588235]},{"IndexedColors":[0.7019607843137254,0.3450980392156863,0.02352941176470588,0.8784313725490196,0.5098039215686274,0.07843137254901961,0.9921568627450981,0.7215686274509804,0.3882352941176471,0.996078431372549,0.8784313725490196,0.7137254901960784,0.9686274509803922,0.9686274509803922,0.9686274509803922,0.8470588235294118,0.8549019607843137,0.9215686274509803,0.6980392156862745,0.6705882352941176,0.8235294117647058,0.5019607843137255,0.4509803921568628,0.6745098039215687,0.3294117647058823,0.1529411764705882,0.5333333333333333],"Name":"Brewer Diverging Purple-Orange (9)","NanColor":[0.3294117647058823,0.1529411764705882,0.5333333333333333]},{"IndexedColors":[0.7019607843137254,0.3450980392156863,0.02352941176470588,0.8784313725490196,0.5098039215686274,0.07843137254901961,0.9921568627450981,0.7215686274509804,0.3882352941176471,0.996078431372549,0.8784313725490196,0.7137254901960784,0.8470588235294118,0.8549019607843137,0.9215686274509803,0.6980392156862745,0.6705882352941176,0.8235294117647058,0.5019607843137255,0.4509803921568628,0.6745098039215687,0.3294117647058823,0.1529411764705882,0.5333333333333333],"Name":"Brewer Diverging Purple-Orange (8)","NanColor":[0.3294117647058823,0.1529411764705882,0.5333333333333333]},{"IndexedColors":[0.7019607843137254,0.3450980392156863,0.02352941176470588,0.9450980392156862,0.6392156862745098,0.2509803921568627,0.996078431372549,0.8784313725490196,0.7137254901960784,0.9686274509803922,0.9686274509803922,0.9686274509803922,0.8470588235294118,0.8549019607843137,0.9215686274509803,0.6,0.5568627450980392,0.7647058823529411,0.3294117647058823,0.1529411764705882,0.5333333333333333],"Name":"Brewer Diverging Purple-Orange (7)","NanColor":[0.3294117647058823,0.1529411764705882,0.5333333333333333]},{"IndexedColors":[0.7019607843137254,0.3450980392156863,0.02352941176470588,0.9450980392156862,0.6392156862745098,0.2509803921568627,0.996078431372549,0.8784313725490196,0.7137254901960784,0.8470588235294118,0.8549019607843137,0.9215686274509803,0.6,0.5568627450980392,0.7647058823529411,0.3294117647058823,0.1529411764705882,0.5333333333333333],"Name":"Brewer Diverging Purple-Orange (6)","NanColor":[0.3294117647058823,0.1529411764705882,0.5333333333333333]},{"IndexedColors":[0.9019607843137255,0.3803921568627451,0.00392156862745098,0.9921568627450981,0.7215686274509804,0.3882352941176471,0.9686274509803922,0.9686274509803922,0.9686274509803922,0.6980392156862745,0.6705882352941176,0.8235294117647058,0.3686274509803922,0.2352941176470588,0.6],"Name":"Brewer Diverging Purple-Orange (5)","NanColor":[0.3686274509803922,0.2352941176470588,0.6]},{"IndexedColors":[0.9019607843137255,0.3803921568627451,0.00392156862745098,0.9921568627450981,0.7215686274509804,0.3882352941176471,0.6980392156862745,0.6705882352941176,0.8235294117647058,0.3686274509803922,0.2352941176470588,0.6],"Name":"Brewer Diverging Purple-Orange (4)","NanColor":[0.3686274509803922,0.2352941176470588,0.6]},{"IndexedColors":[0.9450980392156862,0.6392156862745098,0.2509803921568627,0.9686274509803922,0.9686274509803922,0.9686274509803922,0.6,0.5568627450980392,0.7647058823529411],"Name":"Brewer Diverging Purple-Orange (3)","NanColor":[0.6,0.5568627450980392,0.7647058823529411]},{"IndexedColors":[0.6196078431372549,0.00392156862745098,0.2588235294117647,0.8352941176470589,0.2431372549019608,0.3098039215686275,0.9568627450980393,0.4274509803921568,0.2627450980392157,0.9921568627450981,0.6823529411764706,0.3803921568627451,0.996078431372549,0.8784313725490196,0.5450980392156862,1,1,0.7490196078431373,0.9019607843137255,0.9607843137254902,0.596078431372549,0.6705882352941176,0.8666666666666667,0.6431372549019608,0.4,0.7607843137254902,0.6470588235294118,0.196078431372549,0.5333333333333333,0.7411764705882353,0.3686274509803922,0.3098039215686275,0.6352941176470588],"Name":"Brewer Diverging Spectral (11)","NanColor":[0.3686274509803922,0.3098039215686275,0.6352941176470588]},{"IndexedColors":[0.6196078431372549,0.00392156862745098,0.2588235294117647,0.8352941176470589,0.2431372549019608,0.3098039215686275,0.9568627450980393,0.4274509803921568,0.2627450980392157,0.9921568627450981,0.6823529411764706,0.3803921568627451,0.996078431372549,0.8784313725490196,0.5450980392156862,0.9019607843137255,0.9607843137254902,0.596078431372549,0.6705882352941176,0.8666666666666667,0.6431372549019608,0.4,0.7607843137254902,0.6470588235294118,0.196078431372549,0.5333333333333333,0.7411764705882353,0.3686274509803922,0.3098039215686275,0.6352941176470588],"Name":"Brewer Diverging Spectral (10)","NanColor":[0.3686274509803922,0.3098039215686275,0.6352941176470588]},{"IndexedColors":[0.8352941176470589,0.2431372549019608,0.3098039215686275,0.9568627450980393,0.4274509803921568,0.2627450980392157,0.9921568627450981,0.6823529411764706,0.3803921568627451,0.996078431372549,0.8784313725490196,0.5450980392156862,1,1,0.7490196078431373,0.9019607843137255,0.9607843137254902,0.596078431372549,0.6705882352941176,0.8666666666666667,0.6431372549019608,0.4,0.7607843137254902,0.6470588235294118,0.196078431372549,0.5333333333333333,0.7411764705882353],"Name":"Brewer Diverging Spectral (9)","NanColor":[0.196078431372549,0.5333333333333333,0.7411764705882353]},{"IndexedColors":[0.8352941176470589,0.2431372549019608,0.3098039215686275,0.9568627450980393,0.4274509803921568,0.2627450980392157,0.9921568627450981,0.6823529411764706,0.3803921568627451,0.996078431372549,0.8784313725490196,0.5450980392156862,0.9019607843137255,0.9607843137254902,0.596078431372549,0.6705882352941176,0.8666666666666667,0.6431372549019608,0.4,0.7607843137254902,0.6470588235294118,0.196078431372549,0.5333333333333333,0.7411764705882353],"Name":"Brewer Diverging Spectral (8)","NanColor":[0.196078431372549,0.5333333333333333,0.7411764705882353]},{"IndexedColors":[0.8352941176470589,0.2431372549019608,0.3098039215686275,0.9882352941176471,0.5529411764705883,0.3490196078431372,0.996078431372549,0.8784313725490196,0.5450980392156862,1,1,0.7490196078431373,0.9019607843137255,0.9607843137254902,0.596078431372549,0.6,0.8352941176470589,0.5803921568627451,0.196078431372549,0.5333333333333333,0.7411764705882353],"Name":"Brewer Diverging Spectral (7)","NanColor":[0.196078431372549,0.5333333333333333,0.7411764705882353]},{"IndexedColors":[0.8352941176470589,0.2431372549019608,0.3098039215686275,0.9882352941176471,0.5529411764705883,0.3490196078431372,0.996078431372549,0.8784313725490196,0.5450980392156862,0.9019607843137255,0.9607843137254902,0.596078431372549,0.6,0.8352941176470589,0.5803921568627451,0.196078431372549,0.5333333333333333,0.7411764705882353],"Name":"Brewer Diverging Spectral (6)","NanColor":[0.196078431372549,0.5333333333333333,0.7411764705882353]},{"IndexedColors":[0.8431372549019608,0.09803921568627451,0.1098039215686274,0.9921568627450981,0.6823529411764706,0.3803921568627451,1,1,0.7490196078431373,0.6705882352941176,0.8666666666666667,0.6431372549019608,0.1686274509803922,0.5137254901960784,0.7294117647058823],"Name":"Brewer Diverging Spectral (5)","NanColor":[0.1686274509803922,0.5137254901960784,0.7294117647058823]},{"IndexedColors":[0.8431372549019608,0.09803921568627451,0.1098039215686274,0.9921568627450981,0.6823529411764706,0.3803921568627451,0.6705882352941176,0.8666666666666667,0.6431372549019608,0.1686274509803922,0.5137254901960784,0.7294117647058823],"Name":"Brewer Diverging Spectral (4)","NanColor":[0.1686274509803922,0.5137254901960784,0.7294117647058823]},{"IndexedColors":[0.9882352941176471,0.5529411764705883,0.3490196078431372,1,1,0.7490196078431373,0.6,0.8352941176470589,0.5803921568627451],"Name":"Brewer Diverging Spectral (3)","NanColor":[0.6,0.8352941176470589,0.5803921568627451]},{"IndexedColors":[0.3294117647058823,0.1882352941176471,0.0196078431372549,0.5490196078431373,0.3176470588235294,0.0392156862745098,0.7490196078431373,0.5058823529411764,0.1764705882352941,0.8745098039215686,0.7607843137254902,0.4901960784313725,0.9647058823529412,0.9098039215686274,0.7647058823529411,0.9607843137254902,0.9607843137254902,0.9607843137254902,0.7803921568627451,0.9176470588235294,0.8980392156862745,0.5019607843137255,0.803921568627451,0.7568627450980392,0.207843137254902,0.592156862745098,0.5607843137254902,0.00392156862745098,0.4,0.3686274509803922,0,0.2352941176470588,0.1882352941176471],"Name":"Brewer Diverging Brown-Blue-Green (11)","NanColor":[0,0.2352941176470588,0.1882352941176471]},{"IndexedColors":[0.3294117647058823,0.1882352941176471,0.0196078431372549,0.5490196078431373,0.3176470588235294,0.0392156862745098,0.7490196078431373,0.5058823529411764,0.1764705882352941,0.8745098039215686,0.7607843137254902,0.4901960784313725,0.9647058823529412,0.9098039215686274,0.7647058823529411,0.7803921568627451,0.9176470588235294,0.8980392156862745,0.5019607843137255,0.803921568627451,0.7568627450980392,0.207843137254902,0.592156862745098,0.5607843137254902,0.00392156862745098,0.4,0.3686274509803922,0,0.2352941176470588,0.1882352941176471],"Name":"Brewer Diverging Brown-Blue-Green (10)","NanColor":[0,0.2352941176470588,0.1882352941176471]},{"IndexedColors":[0.5490196078431373,0.3176470588235294,0.0392156862745098,0.7490196078431373,0.5058823529411764,0.1764705882352941,0.8745098039215686,0.7607843137254902,0.4901960784313725,0.9647058823529412,0.9098039215686274,0.7647058823529411,0.9607843137254902,0.9607843137254902,0.9607843137254902,0.7803921568627451,0.9176470588235294,0.8980392156862745,0.5019607843137255,0.803921568627451,0.7568627450980392,0.207843137254902,0.592156862745098,0.5607843137254902,0.00392156862745098,0.4,0.3686274509803922],"Name":"Brewer Diverging Brown-Blue-Green (9)","NanColor":[0.00392156862745098,0.4,0.3686274509803922]},{"IndexedColors":[0.5490196078431373,0.3176470588235294,0.0392156862745098,0.7490196078431373,0.5058823529411764,0.1764705882352941,0.8745098039215686,0.7607843137254902,0.4901960784313725,0.9647058823529412,0.9098039215686274,0.7647058823529411,0.7803921568627451,0.9176470588235294,0.8980392156862745,0.5019607843137255,0.803921568627451,0.7568627450980392,0.207843137254902,0.592156862745098,0.5607843137254902,0.00392156862745098,0.4,0.3686274509803922],"Name":"Brewer Diverging Brown-Blue-Green (8)","NanColor":[0.00392156862745098,0.4,0.3686274509803922]},{"IndexedColors":[0.5490196078431373,0.3176470588235294,0.0392156862745098,0.8470588235294118,0.7019607843137254,0.396078431372549,0.9647058823529412,0.9098039215686274,0.7647058823529411,0.9607843137254902,0.9607843137254902,0.9607843137254902,0.7803921568627451,0.9176470588235294,0.8980392156862745,0.3529411764705883,0.7058823529411765,0.6745098039215687,0.00392156862745098,0.4,0.3686274509803922],"Name":"Brewer Diverging Brown-Blue-Green (7)","NanColor":[0.00392156862745098,0.4,0.3686274509803922]},{"IndexedColors":[0.5490196078431373,0.3176470588235294,0.0392156862745098,0.8470588235294118,0.7019607843137254,0.396078431372549,0.9647058823529412,0.9098039215686274,0.7647058823529411,0.7803921568627451,0.9176470588235294,0.8980392156862745,0.3529411764705883,0.7058823529411765,0.6745098039215687,0.00392156862745098,0.4,0.3686274509803922],"Name":"Brewer Diverging Brown-Blue-Green (6)","NanColor":[0.00392156862745098,0.4,0.3686274509803922]},{"IndexedColors":[0.6509803921568628,0.3803921568627451,0.1019607843137255,0.8745098039215686,0.7607843137254902,0.4901960784313725,0.9607843137254902,0.9607843137254902,0.9607843137254902,0.5019607843137255,0.803921568627451,0.7568627450980392,0.00392156862745098,0.5215686274509804,0.4431372549019608],"Name":"Brewer Diverging Brown-Blue-Green (5)","NanColor":[0.00392156862745098,0.5215686274509804,0.4431372549019608]},{"IndexedColors":[0.6509803921568628,0.3803921568627451,0.1019607843137255,0.8745098039215686,0.7607843137254902,0.4901960784313725,0.5019607843137255,0.803921568627451,0.7568627450980392,0.00392156862745098,0.5215686274509804,0.4431372549019608],"Name":"Brewer Diverging Brown-Blue-Green (4)","NanColor":[0.00392156862745098,0.5215686274509804,0.4431372549019608]},{"IndexedColors":[0.8470588235294118,0.7019607843137254,0.396078431372549,0.9607843137254902,0.9607843137254902,0.9607843137254902,0.3529411764705883,0.7058823529411765,0.6745098039215687],"Name":"Brewer Diverging Brown-Blue-Green (3)","NanColor":[0.3529411764705883,0.7058823529411765,0.6745098039215687]},{"IndexedColors":[0.9686274509803922,0.9882352941176471,0.9921568627450981,0.8980392156862745,0.9607843137254902,0.9764705882352941,0.8,0.9254901960784314,0.9019607843137255,0.6,0.8470588235294118,0.788235294117647,0.4,0.7607843137254902,0.6431372549019608,0.2549019607843137,0.6823529411764706,0.4627450980392157,0.1372549019607843,0.5450980392156862,0.2705882352941176,0,0.4274509803921568,0.1725490196078431,0,0.2666666666666667,0.1058823529411765],"Name":"Brewer Sequential Blue-Green (9)","NanColor":[0,0.2666666666666667,0.1058823529411765]},{"IndexedColors":[0.9686274509803922,0.9882352941176471,0.9921568627450981,0.8980392156862745,0.9607843137254902,0.9764705882352941,0.8,0.9254901960784314,0.9019607843137255,0.6,0.8470588235294118,0.788235294117647,0.4,0.7607843137254902,0.6431372549019608,0.2549019607843137,0.6823529411764706,0.4627450980392157,0.1372549019607843,0.5450980392156862,0.2705882352941176,0,0.3450980392156863,0.1411764705882353],"Name":"Brewer Sequential Blue-Green (8)","NanColor":[0,0.3450980392156863,0.1411764705882353]},{"IndexedColors":[0.9294117647058824,0.9725490196078431,0.984313725490196,0.8,0.9254901960784314,0.9019607843137255,0.8,0.9254901960784314,0.9019607843137255,0.4,0.7607843137254902,0.6431372549019608,0.2549019607843137,0.6823529411764706,0.4627450980392157,0.1372549019607843,0.5450980392156862,0.2705882352941176,0,0.3450980392156863,0.1411764705882353],"Name":"Brewer Sequential Blue-Green (7)","NanColor":[0,0.3450980392156863,0.1411764705882353]},{"IndexedColors":[0.9294117647058824,0.9725490196078431,0.984313725490196,0.8,0.9254901960784314,0.9019607843137255,0.6,0.8470588235294118,0.788235294117647,0.4,0.7607843137254902,0.6431372549019608,0.1725490196078431,0.6352941176470588,0.3725490196078431,0,0.4274509803921568,0.1725490196078431],"Name":"Brewer Sequential Blue-Green (6)","NanColor":[0,0.4274509803921568,0.1725490196078431]},{"IndexedColors":[0.9294117647058824,0.9725490196078431,0.984313725490196,0.6980392156862745,0.8862745098039215,0.8862745098039215,0.4,0.7607843137254902,0.6431372549019608,0.1725490196078431,0.6352941176470588,0.3725490196078431,0,0.4274509803921568,0.1725490196078431],"Name":"Brewer Sequential Blue-Green (5)","NanColor":[0,0.4274509803921568,0.1725490196078431]},{"IndexedColors":[0.9294117647058824,0.9725490196078431,0.984313725490196,0.6980392156862745,0.8862745098039215,0.8862745098039215,0.4,0.7607843137254902,0.6431372549019608,0.1372549019607843,0.5450980392156862,0.2705882352941176],"Name":"Brewer Sequential Blue-Green (4)","NanColor":[0.1372549019607843,0.5450980392156862,0.2705882352941176]},{"IndexedColors":[0.8980392156862745,0.9607843137254902,0.9764705882352941,0.6,0.8470588235294118,0.788235294117647,0.1725490196078431,0.6352941176470588,0.3725490196078431],"Name":"Brewer Sequential Blue-Green (3)","NanColor":[0.1725490196078431,0.6352941176470588,0.3725490196078431]},{"IndexedColors":[1,1,0.8980392156862745,1,0.9686274509803922,0.7372549019607844,0.996078431372549,0.8901960784313725,0.5686274509803921,0.996078431372549,0.7686274509803922,0.3098039215686275,0.996078431372549,0.6,0.1607843137254902,0.9254901960784314,0.4392156862745098,0.07843137254901961,0.8,0.2980392156862745,0.007843137254901961,0.6,0.203921568627451,0.01568627450980392,0.4,0.1450980392156863,0.02352941176470588],"Name":"Brewer Sequential Yellow-Orange-Brown (9)","NanColor":[0.4,0.1450980392156863,0.02352941176470588]},{"IndexedColors":[1,1,0.8980392156862745,1,0.9686274509803922,0.7372549019607844,0.996078431372549,0.8901960784313725,0.5686274509803921,0.996078431372549,0.7686274509803922,0.3098039215686275,0.996078431372549,0.6,0.1607843137254902,0.9254901960784314,0.4392156862745098,0.07843137254901961,0.8,0.2980392156862745,0.007843137254901961,0.5490196078431373,0.1764705882352941,0.01568627450980392],"Name":"Brewer Sequential Yellow-Orange-Brown (8)","NanColor":[0.5490196078431373,0.1764705882352941,0.01568627450980392]},{"IndexedColors":[1,1,0.8313725490196079,0.996078431372549,0.8901960784313725,0.5686274509803921,0.996078431372549,0.7686274509803922,0.3098039215686275,0.996078431372549,0.6,0.1607843137254902,0.9254901960784314,0.4392156862745098,0.07843137254901961,0.8,0.2980392156862745,0.007843137254901961,0.5490196078431373,0.1764705882352941,0.01568627450980392],"Name":"Brewer Sequential Yellow-Orange-Brown (7)","NanColor":[0.5490196078431373,0.1764705882352941,0.01568627450980392]},{"IndexedColors":[1,1,0.8313725490196079,0.996078431372549,0.8901960784313725,0.5686274509803921,0.996078431372549,0.7686274509803922,0.3098039215686275,0.996078431372549,0.6,0.1607843137254902,0.8509803921568627,0.3725490196078431,0.05490196078431372,0.6,0.203921568627451,0.01568627450980392],"Name":"Brewer Sequential Yellow-Orange-Brown (6)","NanColor":[0.6,0.203921568627451,0.01568627450980392]},{"IndexedColors":[1,1,0.8313725490196079,0.996078431372549,0.8509803921568627,0.5568627450980392,0.996078431372549,0.6,0.1607843137254902,0.8509803921568627,0.3725490196078431,0.05490196078431372,0.6,0.203921568627451,0.01568627450980392],"Name":"Brewer Sequential Yellow-Orange-Brown (5)","NanColor":[0.6,0.203921568627451,0.01568627450980392]},{"IndexedColors":[1,1,0.8313725490196079,0.996078431372549,0.8509803921568627,0.5568627450980392,0.996078431372549,0.6,0.1607843137254902,0.8,0.2980392156862745,0.007843137254901961],"Name":"Brewer Sequential Yellow-Orange-Brown (4)","NanColor":[0.8,0.2980392156862745,0.007843137254901961]},{"IndexedColors":[1,0.9686274509803922,0.7372549019607844,0.996078431372549,0.7686274509803922,0.3098039215686275,0.8509803921568627,0.3725490196078431,0.05490196078431372],"Name":"Brewer Sequential Yellow-Orange-Brown (3)","NanColor":[0.8509803921568627,0.3725490196078431,0.05490196078431372]},{"IndexedColors":[0.9686274509803922,0.9882352941176471,0.9921568627450981,0.8784313725490196,0.9254901960784314,0.9568627450980393,0.7490196078431373,0.8274509803921568,0.9019607843137255,0.6196078431372549,0.7372549019607844,0.8549019607843137,0.5490196078431373,0.5882352941176471,0.7764705882352941,0.5490196078431373,0.4196078431372549,0.6941176470588235,0.5333333333333333,0.2549019607843137,0.615686274509804,0.5058823529411764,0.05882352941176471,0.4862745098039216,0.3019607843137255,0,0.2941176470588235],"Name":"Brewer Sequential Blue-Purple (9)","NanColor":[0.3019607843137255,0,0.2941176470588235]},{"IndexedColors":[0.9686274509803922,0.9882352941176471,0.9921568627450981,0.8784313725490196,0.9254901960784314,0.9568627450980393,0.7490196078431373,0.8274509803921568,0.9019607843137255,0.6196078431372549,0.7372549019607844,0.8549019607843137,0.5490196078431373,0.5882352941176471,0.7764705882352941,0.5490196078431373,0.4196078431372549,0.6941176470588235,0.5333333333333333,0.2549019607843137,0.615686274509804,0.4313725490196079,0.00392156862745098,0.4196078431372549],"Name":"Brewer Sequential Blue-Purple (8)","NanColor":[0.4313725490196079,0.00392156862745098,0.4196078431372549]},{"IndexedColors":[0.9294117647058824,0.9725490196078431,0.984313725490196,0.7490196078431373,0.8274509803921568,0.9019607843137255,0.6196078431372549,0.7372549019607844,0.8549019607843137,0.5490196078431373,0.5882352941176471,0.7764705882352941,0.5490196078431373,0.4196078431372549,0.6941176470588235,0.5333333333333333,0.2549019607843137,0.615686274509804,0.4313725490196079,0.00392156862745098,0.4196078431372549],"Name":"Brewer Sequential Blue-Purple (7)","NanColor":[0.4313725490196079,0.00392156862745098,0.4196078431372549]},{"IndexedColors":[0.9294117647058824,0.9725490196078431,0.984313725490196,0.7490196078431373,0.8274509803921568,0.9019607843137255,0.6196078431372549,0.7372549019607844,0.8549019607843137,0.5490196078431373,0.5882352941176471,0.7764705882352941,0.5333333333333333,0.3372549019607843,0.6549019607843137,0.5058823529411764,0.05882352941176471,0.4862745098039216],"Name":"Brewer Sequential Blue-Purple (6)","NanColor":[0.5058823529411764,0.05882352941176471,0.4862745098039216]},{"IndexedColors":[0.9294117647058824,0.9725490196078431,0.984313725490196,0.7019607843137254,0.803921568627451,0.8901960784313725,0.5490196078431373,0.5882352941176471,0.7764705882352941,0.5333333333333333,0.3372549019607843,0.6549019607843137,0.5058823529411764,0.05882352941176471,0.4862745098039216],"Name":"Brewer Sequential Blue-Purple (5)","NanColor":[0.5058823529411764,0.05882352941176471,0.4862745098039216]},{"IndexedColors":[0.9294117647058824,0.9725490196078431,0.984313725490196,0.7019607843137254,0.803921568627451,0.8901960784313725,0.5490196078431373,0.5882352941176471,0.7764705882352941,0.5333333333333333,0.2549019607843137,0.615686274509804],"Name":"Brewer Sequential Blue-Purple (4)","NanColor":[0.5333333333333333,0.2549019607843137,0.615686274509804]},{"IndexedColors":[0.8784313725490196,0.9254901960784314,0.9568627450980393,0.6196078431372549,0.7372549019607844,0.8549019607843137,0.5333333333333333,0.3372549019607843,0.6549019607843137],"Name":"Brewer Sequential Blue-Purple (3)","NanColor":[0.5333333333333333,0.3372549019607843,0.6549019607843137]},{"IndexedColors":[0.4980392156862745,0.788235294117647,0.4980392156862745,0.7450980392156863,0.6823529411764706,0.8313725490196079,0.9921568627450981,0.7529411764705882,0.5254901960784314,1,1,0.6,0.2196078431372549,0.4235294117647059,0.6901960784313725,0.9411764705882353,0.007843137254901961,0.4980392156862745,0.7490196078431373,0.3568627450980392,0.09019607843137255,0.4,0.4,0.4],"Name":"Brewer Qualitative Accent","NanColor":[0.4,0.4,0.4]},{"IndexedColors":[0.1058823529411765,0.6196078431372549,0.4666666666666667,0.8509803921568627,0.3725490196078431,0.007843137254901961,0.4588235294117647,0.4392156862745098,0.7019607843137254,0.9058823529411765,0.1607843137254902,0.5411764705882353,0.4,0.6509803921568628,0.1176470588235294,0.9019607843137255,0.6705882352941176,0.007843137254901961,0.6509803921568628,0.4627450980392157,0.1137254901960784,0.4,0.4,0.4],"Name":"Brewer Qualitative Dark2","NanColor":[0.4,0.4,0.4]},{"IndexedColors":[0.4,0.7607843137254902,0.6470588235294118,0.9882352941176471,0.5529411764705883,0.3843137254901961,0.5529411764705883,0.6274509803921569,0.796078431372549,0.9058823529411765,0.5411764705882353,0.7647058823529411,0.6509803921568628,0.8470588235294118,0.3294117647058823,1,0.8509803921568627,0.1843137254901961,0.8980392156862745,0.7686274509803922,0.5803921568627451,0.7019607843137254,0.7019607843137254,0.7019607843137254],"Name":"Brewer Qualitative Set2","NanColor":[0.7019607843137254,0.7019607843137254,0.7019607843137254]},{"IndexedColors":[0.7019607843137254,0.8862745098039215,0.803921568627451,0.9921568627450981,0.803921568627451,0.6745098039215687,0.796078431372549,0.8352941176470589,0.9098039215686274,0.9568627450980393,0.792156862745098,0.8941176470588236,0.9019607843137255,0.9607843137254902,0.788235294117647,1,0.9490196078431372,0.6823529411764706,0.9450980392156862,0.8862745098039215,0.8,0.8,0.8,0.8],"Name":"Brewer Qualitative Pastel2","NanColor":[0.8,0.8,0.8]},{"IndexedColors":[0.984313725490196,0.7058823529411765,0.6823529411764706,0.7019607843137254,0.803921568627451,0.8901960784313725,0.8,0.9215686274509803,0.7725490196078432,0.8705882352941177,0.796078431372549,0.8941176470588236,0.996078431372549,0.8509803921568627,0.6509803921568628,1,1,0.8,0.8980392156862745,0.8470588235294118,0.7411764705882353,0.9921568627450981,0.8549019607843137,0.9254901960784314,0.9490196078431372,0.9490196078431372,0.9490196078431372],"Name":"Brewer Qualitative Pastel1","NanColor":[0.9490196078431372,0.9490196078431372,0.9490196078431372]},{"IndexedColors":[0.8941176470588236,0.1019607843137255,0.1098039215686274,0.2156862745098039,0.4941176470588236,0.7215686274509804,0.3019607843137255,0.6862745098039216,0.2901960784313726,0.596078431372549,0.3058823529411765,0.6392156862745098,1,0.4980392156862745,0,1,1,0.2,0.6509803921568628,0.3372549019607843,0.1568627450980392,0.9686274509803922,0.5058823529411764,0.7490196078431373,0.6,0.6,0.6],"Name":"Brewer Qualitative Set1","NanColor":[0.6,0.6,0.6]},{"IndexedColors":[0.6509803921568628,0.807843137254902,0.8901960784313725,0.1215686274509804,0.4705882352941176,0.7058823529411765,0.6980392156862745,0.8745098039215686,0.5411764705882353,0.2,0.6274509803921569,0.1725490196078431,0.984313725490196,0.6039215686274509,0.6,0.8901960784313725,0.1019607843137255,0.1098039215686274,0.9921568627450981,0.7490196078431373,0.4352941176470588,1,0.4980392156862745,0,0.792156862745098,0.6980392156862745,0.8392156862745098,0.4156862745098039,0.2392156862745098,0.6039215686274509,1,1,0.6],"Name":"Brewer Qualitative Paired","NanColor":[1,1,0.6]},{"IndexedColors":[0.5529411764705883,0.8274509803921568,0.7803921568627451,1,1,0.7019607843137254,0.7450980392156863,0.7294117647058823,0.8549019607843137,0.984313725490196,0.5019607843137255,0.4470588235294118,0.5019607843137255,0.6941176470588235,0.8274509803921568,0.9921568627450981,0.7058823529411765,0.3843137254901961,0.7019607843137254,0.8705882352941177,0.4117647058823529,0.9882352941176471,0.803921568627451,0.8980392156862745,0.8509803921568627,0.8509803921568627,0.8509803921568627,0.7372549019607844,0.5019607843137255,0.7411764705882353,0.8,0.9215686274509803,0.7725490196078432,1,0.9294117647058824,0.4352941176470588],"Name":"Brewer Qualitative Set3","NanColor":[1,0.9294117647058824,0.4352941176470588]},{"IndexedColors":[1,0,0,1,0.862745,0,0,0.695201,0],"Name":"Traffic Lights","NanColor":[0.803922,0,0.803922]},{"IndexedColors":[0.908659,0.604013,0.581857,1,0.862745,0,0,0.695201,0],"Name":"Traffic Lights For Deuteranopes","NanColor":[0.803922,0,0.803922]},{"IndexedColors":[0.4196078431372549,0,0.07058823529411765,0.9019607843137255,0.9411764705882353,0.0196078431372549,0.01568627450980392,0.6196078431372549,0.007843137254901961],"Name":"Traffic Lights For Deuteranopes 2","NanColor":[0.803922,0,0.803922]},{"ColorSpace":"Lab","Creator":"Francesca Samsel","Name":"Muted Blue-Green","NanColor":[0.25,0,0],"RGBPoints":[0,0.109804,0.27451,0.301961,0.02,0.129412,0.309804,0.341176,0.05,0.14902,0.341176,0.380392,0.1,0.188235,0.403922,0.458824,0.15,0.227451,0.447059,0.5215689999999999,0.2,0.290196,0.494118,0.588235,0.25,0.368627,0.552941,0.670588,0.3,0.458824,0.619608,0.74902,0.35,0.588235,0.7137250000000001,0.85098,0.4,0.72549,0.815686,0.941176,0.45,0.831373,0.8823530000000001,0.980392,0.475,0.9098039999999999,0.933333,1,0.5,0.980392,0.984314,1,0.5,0.996078,1,0.94902,0.5,1,1,0.980392,0.5,0.980392,0.984314,1,0.525,0.972549,0.988235,0.890196,0.55,0.917647,0.960784,0.835294,0.6,0.835294,0.921569,0.772549,0.65,0.7686269999999999,0.901961,0.737255,0.7,0.670588,0.831373,0.654902,0.75,0.576471,0.760784,0.584314,0.8,0.498039,0.678431,0.5215689999999999,0.85,0.392157,0.5607839999999999,0.427451,0.9,0.294118,0.45098,0.333333,0.95,0.211765,0.34902,0.254902,1,0.152941,0.278431,0.196078]},{"ColorSpace":"Lab","Creator":"Francesca Samsel","Name":"Green-Blue Asymmetric Divergent (62Blbc)","NanColor":[0.25,0,0],"RGBPoints":[0,0.121569,0.2,0.145098,0.05,0.196078,0.301961,0.223529,0.1,0.258824,0.4,0.278431,0.2,0.341176,0.54902,0.341176,0.25,0.419608,0.619608,0.376471,0.3,0.545098,0.7019609999999999,0.392157,0.35,0.643137,0.780392,0.403922,0.4,0.7294119999999999,0.819608,0.45098,0.45,0.811765,0.870588,0.5215689999999999,0.5,0.898039,0.9098039999999999,0.564706,0.55,0.941176,0.92549,0.686275,0.6,0.960784,0.94902,0.776471,0.64,1,1,1,0.65,0.890196,0.988235,0.972549,0.7,0.721569,0.894118,0.901961,0.75,0.631373,0.823529,0.839216,0.8,0.517647,0.662745,0.7019609999999999,0.85,0.384314,0.494118,0.54902,0.9,0.298039,0.360784,0.45098,0.95,0.223529,0.25098,0.34902,0.99,0.156863,0.172549,0.25098,1,0.137255,0.137255,0.188235]},{"ColorSpace":"Lab","Creator":"Francesca Samsel","Name":"Asymmtrical Earth Tones (6_21b)","NanColor":[0.25,0,0],"RGBPoints":[0,0.141176,0.14902,0.2,0.05,0.215686,0.258824,0.321569,0.1,0.243137,0.368627,0.380392,0.15,0.27451,0.439216,0.4,0.2,0.32549,0.501961,0.384314,0.25,0.403922,0.6,0.419608,0.3,0.486275,0.7019609999999999,0.454902,0.35,0.556863,0.74902,0.494118,0.4,0.670588,0.8,0.545098,0.5,0.8549020000000001,0.901961,0.631373,0.55,0.92549,0.941176,0.694118,0.6,0.960784,0.94902,0.776471,0.65,0.988235,0.968627,0.9098039999999999,0.7,0.839216,0.815686,0.772549,0.75,0.7019609999999999,0.662745,0.615686,0.8,0.6,0.529412,0.478431,0.85,0.501961,0.403922,0.360784,0.9,0.439216,0.313725,0.290196,1,0.301961,0.164706,0.176471]},{"ColorSpace":"Lab","Creator":"Francesca Samsel","Name":"Yellow 15","NanColor":[0.25,0,0],"RGBPoints":[0,1,1,0.988235,0.002,1,1,0.988235,0.05,0.984314,0.988235,0.843137,0.1,0.988235,0.988235,0.7411759999999999,0.15,0.980392,0.968627,0.654902,0.2,0.980392,0.945098,0.576471,0.25,0.968627,0.905882,0.486275,0.3,0.968627,0.862745,0.388235,0.35,0.960784,0.803922,0.286275,0.4,0.94902,0.7411759999999999,0.219608,0.45,0.941176,0.678431,0.14902,0.5,0.929412,0.607843,0.09411799999999999,0.55,0.921569,0.545098,0.054902,0.6,0.9098039999999999,0.486275,0.035294,0.65,0.890196,0.411765,0.019608,0.7,0.8,0.305882,0,0.75,0.760784,0.239216,0,0.8,0.678431,0.180392,0.011765,0.85,0.6,0.121569,0.023529,0.9,0.501961,0.054902,0.031373,0.95,0.4,0.039216,0.058824,1,0.301961,0.047059,0.090196]},{"ColorSpace":"Diverging","Name":"Magma (matplotlib)","NanColor":[0,1,0],"Source":"https://github.com/BIDS/colormap/blob/master/colormaps.py","License":"CC0","Creator":"Nathaniel J. Smith & Stefan van der Walt","RGBPoints":[0.000000,0.001462,0.000466,0.013866,0.003922,0.002258,0.001295,0.018331,0.007843,0.003279,0.002305,0.023708,0.011765,0.004512,0.003490,0.029965,0.015686,0.005950,0.004843,0.037130,0.019608,0.007588,0.006356,0.044973,0.023529,0.009426,0.008022,0.052844,0.027451,0.011465,0.009828,0.060750,0.031373,0.013708,0.011771,0.068667,0.035294,0.016156,0.013840,0.076603,0.039216,0.018815,0.016026,0.084584,0.043137,0.021692,0.018320,0.092610,0.047059,0.024792,0.020715,0.100676,0.050980,0.028123,0.023201,0.108787,0.054902,0.031696,0.025765,0.116965,0.058824,0.035520,0.028397,0.125209,0.062745,0.039608,0.031090,0.133515,0.066667,0.043830,0.033830,0.141886,0.070588,0.048062,0.036607,0.150327,0.074510,0.052320,0.039407,0.158841,0.078431,0.056615,0.042160,0.167446,0.082353,0.060949,0.044794,0.176129,0.086275,0.065330,0.047318,0.184892,0.090196,0.069764,0.049726,0.193735,0.094118,0.074257,0.052017,0.202660,0.098039,0.078815,0.054184,0.211667,0.101961,0.083446,0.056225,0.220755,0.105882,0.088155,0.058133,0.229922,0.109804,0.092949,0.059904,0.239164,0.113725,0.097833,0.061531,0.248477,0.117647,0.102815,0.063010,0.257854,0.121569,0.107899,0.064335,0.267289,0.125490,0.113094,0.065492,0.276784,0.129412,0.118405,0.066479,0.286321,0.133333,0.123833,0.067295,0.295879,0.137255,0.129380,0.067935,0.305443,0.141176,0.135053,0.068391,0.315000,0.145098,0.140858,0.068654,0.324538,0.149020,0.146785,0.068738,0.334011,0.152941,0.152839,0.068637,0.343404,0.156863,0.159018,0.068354,0.352688,0.160784,0.165308,0.067911,0.361816,0.164706,0.171713,0.067305,0.370771,0.168627,0.178212,0.066576,0.379497,0.172549,0.184801,0.065732,0.387973,0.176471,0.191460,0.064818,0.396152,0.180392,0.198177,0.063862,0.404009,0.184314,0.204935,0.062907,0.411514,0.188235,0.211718,0.061992,0.418647,0.192157,0.218512,0.061158,0.425392,0.196078,0.225302,0.060445,0.431742,0.200000,0.232077,0.059889,0.437695,0.203922,0.238826,0.059517,0.443256,0.207843,0.245543,0.059352,0.448436,0.211765,0.252220,0.059415,0.453248,0.215686,0.258857,0.059706,0.457710,0.219608,0.265447,0.060237,0.461840,0.223529,0.271994,0.060994,0.465660,0.227451,0.278493,0.061978,0.469190,0.231373,0.284951,0.063168,0.472451,0.235294,0.291366,0.064553,0.475462,0.239216,0.297740,0.066117,0.478243,0.243137,0.304081,0.067835,0.480812,0.247059,0.310382,0.069702,0.483186,0.250980,0.316654,0.071690,0.485380,0.254902,0.322899,0.073782,0.487408,0.258824,0.329114,0.075972,0.489287,0.262745,0.335308,0.078236,0.491024,0.266667,0.341482,0.080564,0.492631,0.270588,0.347636,0.082946,0.494121,0.274510,0.353773,0.085373,0.495501,0.278431,0.359898,0.087831,0.496778,0.282353,0.366012,0.090314,0.497960,0.286275,0.372116,0.092816,0.499053,0.290196,0.378211,0.095332,0.500067,0.294118,0.384299,0.097855,0.501002,0.298039,0.390384,0.100379,0.501864,0.301961,0.396467,0.102902,0.502658,0.305882,0.402548,0.105420,0.503386,0.309804,0.408629,0.107930,0.504052,0.313725,0.414709,0.110431,0.504662,0.317647,0.420791,0.112920,0.505215,0.321569,0.426877,0.115395,0.505714,0.325490,0.432967,0.117855,0.506160,0.329412,0.439062,0.120298,0.506555,0.333333,0.445163,0.122724,0.506901,0.337255,0.451271,0.125132,0.507198,0.341176,0.457386,0.127522,0.507448,0.345098,0.463508,0.129893,0.507652,0.349020,0.469640,0.132245,0.507809,0.352941,0.475780,0.134577,0.507921,0.356863,0.481929,0.136891,0.507989,0.360784,0.488088,0.139186,0.508011,0.364706,0.494258,0.141462,0.507988,0.368627,0.500438,0.143719,0.507920,0.372549,0.506629,0.145958,0.507806,0.376471,0.512831,0.148179,0.507648,0.380392,0.519045,0.150383,0.507443,0.384314,0.525270,0.152569,0.507192,0.388235,0.531507,0.154739,0.506895,0.392157,0.537755,0.156894,0.506551,0.396078,0.544015,0.159033,0.506159,0.400000,0.550287,0.161158,0.505719,0.403922,0.556571,0.163269,0.505230,0.407843,0.562866,0.165368,0.504692,0.411765,0.569172,0.167454,0.504105,0.415686,0.575490,0.169530,0.503466,0.419608,0.581819,0.171596,0.502777,0.423529,0.588158,0.173652,0.502035,0.427451,0.594508,0.175701,0.501241,0.431373,0.600868,0.177743,0.500394,0.435294,0.607238,0.179779,0.499492,0.439216,0.613617,0.181811,0.498536,0.443137,0.620005,0.183840,0.497524,0.447059,0.626401,0.185867,0.496456,0.450980,0.632805,0.187893,0.495332,0.454902,0.639216,0.189921,0.494150,0.458824,0.645633,0.191952,0.492910,0.462745,0.652056,0.193986,0.491611,0.466667,0.658483,0.196027,0.490253,0.470588,0.664915,0.198075,0.488836,0.474510,0.671349,0.200133,0.487358,0.478431,0.677786,0.202203,0.485819,0.482353,0.684224,0.204286,0.484219,0.486275,0.690661,0.206384,0.482558,0.490196,0.697098,0.208501,0.480835,0.494118,0.703532,0.210638,0.479049,0.498039,0.709962,0.212797,0.477201,0.501961,0.716387,0.214982,0.475290,0.505882,0.722805,0.217194,0.473316,0.509804,0.729216,0.219437,0.471279,0.513725,0.735616,0.221713,0.469180,0.517647,0.742004,0.224025,0.467018,0.521569,0.748378,0.226377,0.464794,0.525490,0.754737,0.228772,0.462509,0.529412,0.761077,0.231214,0.460162,0.533333,0.767398,0.233705,0.457755,0.537255,0.773695,0.236249,0.455289,0.541176,0.779968,0.238851,0.452765,0.545098,0.786212,0.241514,0.450184,0.549020,0.792427,0.244242,0.447543,0.552941,0.798608,0.247040,0.444848,0.556863,0.804752,0.249911,0.442102,0.560784,0.810855,0.252861,0.439305,0.564706,0.816914,0.255895,0.436461,0.568627,0.822926,0.259016,0.433573,0.572549,0.828886,0.262229,0.430644,0.576471,0.834791,0.265540,0.427671,0.580392,0.840636,0.268953,0.424666,0.584314,0.846416,0.272473,0.421631,0.588235,0.852126,0.276106,0.418573,0.592157,0.857763,0.279857,0.415496,0.596078,0.863320,0.283729,0.412403,0.600000,0.868793,0.287728,0.409303,0.603922,0.874176,0.291859,0.406205,0.607843,0.879464,0.296125,0.403118,0.611765,0.884651,0.300530,0.400047,0.615686,0.889731,0.305079,0.397002,0.619608,0.894700,0.309773,0.393995,0.623529,0.899552,0.314616,0.391037,0.627451,0.904281,0.319610,0.388137,0.631373,0.908884,0.324755,0.385308,0.635294,0.913354,0.330052,0.382563,0.639216,0.917689,0.335500,0.379915,0.643137,0.921884,0.341098,0.377376,0.647059,0.925937,0.346844,0.374959,0.650980,0.929845,0.352734,0.372677,0.654902,0.933606,0.358764,0.370541,0.658824,0.937221,0.364929,0.368567,0.662745,0.940687,0.371224,0.366762,0.666667,0.944006,0.377643,0.365136,0.670588,0.947180,0.384178,0.363701,0.674510,0.950210,0.390820,0.362468,0.678431,0.953099,0.397563,0.361438,0.682353,0.955849,0.404400,0.360619,0.686275,0.958464,0.411324,0.360014,0.690196,0.960949,0.418323,0.359630,0.694118,0.963310,0.425390,0.359469,0.698039,0.965549,0.432519,0.359529,0.701961,0.967671,0.439703,0.359810,0.705882,0.969680,0.446936,0.360311,0.709804,0.971582,0.454210,0.361030,0.713725,0.973381,0.461520,0.361965,0.717647,0.975082,0.468861,0.363111,0.721569,0.976690,0.476226,0.364466,0.725490,0.978210,0.483612,0.366025,0.729412,0.979645,0.491014,0.367783,0.733333,0.981000,0.498428,0.369734,0.737255,0.982279,0.505851,0.371874,0.741176,0.983485,0.513280,0.374198,0.745098,0.984622,0.520713,0.376698,0.749020,0.985693,0.528148,0.379371,0.752941,0.986700,0.535582,0.382210,0.756863,0.987646,0.543015,0.385210,0.760784,0.988533,0.550446,0.388365,0.764706,0.989363,0.557873,0.391671,0.768627,0.990138,0.565296,0.395122,0.772549,0.990871,0.572706,0.398714,0.776471,0.991558,0.580107,0.402441,0.780392,0.992196,0.587502,0.406299,0.784314,0.992785,0.594891,0.410283,0.788235,0.993326,0.602275,0.414390,0.792157,0.993834,0.609644,0.418613,0.796078,0.994309,0.616999,0.422950,0.800000,0.994738,0.624350,0.427397,0.803922,0.995122,0.631696,0.431951,0.807843,0.995480,0.639027,0.436607,0.811765,0.995810,0.646344,0.441361,0.815686,0.996096,0.653659,0.446213,0.819608,0.996341,0.660969,0.451160,0.823529,0.996580,0.668256,0.456192,0.827451,0.996775,0.675541,0.461314,0.831373,0.996925,0.682828,0.466526,0.835294,0.997077,0.690088,0.471811,0.839216,0.997186,0.697349,0.477182,0.843137,0.997254,0.704611,0.482635,0.847059,0.997325,0.711848,0.488154,0.850980,0.997351,0.719089,0.493755,0.854902,0.997351,0.726324,0.499428,0.858824,0.997341,0.733545,0.505167,0.862745,0.997285,0.740772,0.510983,0.866667,0.997228,0.747981,0.516859,0.870588,0.997138,0.755190,0.522806,0.874510,0.997019,0.762398,0.528821,0.878431,0.996898,0.769591,0.534892,0.882353,0.996727,0.776795,0.541039,0.886275,0.996571,0.783977,0.547233,0.890196,0.996369,0.791167,0.553499,0.894118,0.996162,0.798348,0.559820,0.898039,0.995932,0.805527,0.566202,0.901961,0.995680,0.812706,0.572645,0.905882,0.995424,0.819875,0.579140,0.909804,0.995131,0.827052,0.585701,0.913725,0.994851,0.834213,0.592307,0.917647,0.994524,0.841387,0.598983,0.921569,0.994222,0.848540,0.605696,0.925490,0.993866,0.855711,0.612482,0.929412,0.993545,0.862859,0.619299,0.933333,0.993170,0.870024,0.626189,0.937255,0.992831,0.877168,0.633109,0.941176,0.992440,0.884330,0.640099,0.945098,0.992089,0.891470,0.647116,0.949020,0.991688,0.898627,0.654202,0.952941,0.991332,0.905763,0.661309,0.956863,0.990930,0.912915,0.668481,0.960784,0.990570,0.920049,0.675675,0.964706,0.990175,0.927196,0.682926,0.968627,0.989815,0.934329,0.690198,0.972549,0.989434,0.941470,0.697519,0.976471,0.989077,0.948604,0.704863,0.980392,0.988717,0.955742,0.712242,0.984314,0.988367,0.962878,0.719649,0.988235,0.988033,0.970012,0.727077,0.992157,0.987691,0.977154,0.734536,0.996078,0.987387,0.984288,0.742002,1.000000,0.987053,0.991438,0.749504]},{"ColorSpace":"Diverging","Name":"Inferno (matplotlib)","NanColor":[0,1,0],"Source":"https://github.com/BIDS/colormap/blob/master/colormaps.py","License":"CC0","Creator":"Nathaniel J. Smith & Stefan van der Walt","RGBPoints":[0.000000,0.001462,0.000466,0.013866,0.003922,0.002267,0.001270,0.018570,0.007843,0.003299,0.002249,0.024239,0.011765,0.004547,0.003392,0.030909,0.015686,0.006006,0.004692,0.038558,0.019608,0.007676,0.006136,0.046836,0.023529,0.009561,0.007713,0.055143,0.027451,0.011663,0.009417,0.063460,0.031373,0.013995,0.011225,0.071862,0.035294,0.016561,0.013136,0.080282,0.039216,0.019373,0.015133,0.088767,0.043137,0.022447,0.017199,0.097327,0.047059,0.025793,0.019331,0.105930,0.050980,0.029432,0.021503,0.114621,0.054902,0.033385,0.023702,0.123397,0.058824,0.037668,0.025921,0.132232,0.062745,0.042253,0.028139,0.141141,0.066667,0.046915,0.030324,0.150164,0.070588,0.051644,0.032474,0.159254,0.074510,0.056449,0.034569,0.168414,0.078431,0.061340,0.036590,0.177642,0.082353,0.066331,0.038504,0.186962,0.086275,0.071429,0.040294,0.196354,0.090196,0.076637,0.041905,0.205799,0.094118,0.081962,0.043328,0.215289,0.098039,0.087411,0.044556,0.224813,0.101961,0.092990,0.045583,0.234358,0.105882,0.098702,0.046402,0.243904,0.109804,0.104551,0.047008,0.253430,0.113725,0.110536,0.047399,0.262912,0.117647,0.116656,0.047574,0.272321,0.121569,0.122908,0.047536,0.281624,0.125490,0.129285,0.047293,0.290788,0.129412,0.135778,0.046856,0.299776,0.133333,0.142378,0.046242,0.308553,0.137255,0.149073,0.045468,0.317085,0.141176,0.155850,0.044559,0.325338,0.145098,0.162689,0.043554,0.333277,0.149020,0.169575,0.042489,0.340874,0.152941,0.176493,0.041402,0.348111,0.156863,0.183429,0.040329,0.354971,0.160784,0.190367,0.039309,0.361447,0.164706,0.197297,0.038400,0.367535,0.168627,0.204209,0.037632,0.373238,0.172549,0.211095,0.037030,0.378563,0.176471,0.217949,0.036615,0.383522,0.180392,0.224763,0.036405,0.388129,0.184314,0.231538,0.036405,0.392400,0.188235,0.238273,0.036621,0.396353,0.192157,0.244967,0.037055,0.400007,0.196078,0.251620,0.037705,0.403378,0.200000,0.258234,0.038571,0.406485,0.203922,0.264810,0.039647,0.409345,0.207843,0.271347,0.040922,0.411976,0.211765,0.277850,0.042353,0.414392,0.215686,0.284321,0.043933,0.416608,0.219608,0.290763,0.045644,0.418637,0.223529,0.297178,0.047470,0.420491,0.227451,0.303568,0.049396,0.422182,0.231373,0.309935,0.051407,0.423721,0.235294,0.316282,0.053490,0.425116,0.239216,0.322610,0.055634,0.426377,0.243137,0.328921,0.057827,0.427511,0.247059,0.335217,0.060060,0.428524,0.250980,0.341500,0.062325,0.429425,0.254902,0.347771,0.064616,0.430217,0.258824,0.354032,0.066925,0.430906,0.262745,0.360284,0.069247,0.431497,0.266667,0.366529,0.071579,0.431994,0.270588,0.372768,0.073915,0.432400,0.274510,0.379001,0.076253,0.432719,0.278431,0.385228,0.078591,0.432955,0.282353,0.391453,0.080927,0.433109,0.286275,0.397674,0.083257,0.433183,0.290196,0.403894,0.085580,0.433179,0.294118,0.410113,0.087896,0.433098,0.298039,0.416331,0.090203,0.432943,0.301961,0.422549,0.092501,0.432714,0.305882,0.428768,0.094790,0.432412,0.309804,0.434987,0.097069,0.432039,0.313725,0.441207,0.099338,0.431594,0.317647,0.447428,0.101597,0.431080,0.321569,0.453651,0.103848,0.430498,0.325490,0.459875,0.106089,0.429846,0.329412,0.466100,0.108322,0.429125,0.333333,0.472328,0.110547,0.428334,0.337255,0.478558,0.112764,0.427475,0.341176,0.484789,0.114974,0.426548,0.345098,0.491022,0.117179,0.425552,0.349020,0.497257,0.119379,0.424488,0.352941,0.503493,0.121575,0.423356,0.356863,0.509730,0.123769,0.422156,0.360784,0.515967,0.125960,0.420887,0.364706,0.522206,0.128150,0.419549,0.368627,0.528444,0.130341,0.418142,0.372549,0.534683,0.132534,0.416667,0.376471,0.540920,0.134729,0.415123,0.380392,0.547157,0.136929,0.413511,0.384314,0.553392,0.139134,0.411829,0.388235,0.559624,0.141346,0.410078,0.392157,0.565854,0.143567,0.408258,0.396078,0.572081,0.145797,0.406369,0.400000,0.578304,0.148039,0.404411,0.403922,0.584521,0.150294,0.402385,0.407843,0.590734,0.152563,0.400290,0.411765,0.596940,0.154848,0.398125,0.415686,0.603139,0.157151,0.395891,0.419608,0.609330,0.159474,0.393589,0.423529,0.615513,0.161817,0.391219,0.427451,0.621685,0.164184,0.388781,0.431373,0.627847,0.166575,0.386276,0.435294,0.633998,0.168992,0.383704,0.439216,0.640135,0.171438,0.381065,0.443137,0.646260,0.173914,0.378359,0.447059,0.652369,0.176421,0.375586,0.450980,0.658463,0.178962,0.372748,0.454902,0.664540,0.181539,0.369846,0.458824,0.670599,0.184153,0.366879,0.462745,0.676638,0.186807,0.363849,0.466667,0.682656,0.189501,0.360757,0.470588,0.688653,0.192239,0.357603,0.474510,0.694627,0.195021,0.354388,0.478431,0.700576,0.197851,0.351113,0.482353,0.706500,0.200728,0.347777,0.486275,0.712396,0.203656,0.344383,0.490196,0.718264,0.206636,0.340931,0.494118,0.724103,0.209670,0.337424,0.498039,0.729909,0.212759,0.333861,0.501961,0.735683,0.215906,0.330245,0.505882,0.741423,0.219112,0.326576,0.509804,0.747127,0.222378,0.322856,0.513725,0.752794,0.225706,0.319085,0.517647,0.758422,0.229097,0.315266,0.521569,0.764010,0.232554,0.311399,0.525490,0.769556,0.236077,0.307485,0.529412,0.775059,0.239667,0.303526,0.533333,0.780517,0.243327,0.299523,0.537255,0.785929,0.247056,0.295477,0.541176,0.791293,0.250856,0.291390,0.545098,0.796607,0.254728,0.287264,0.549020,0.801871,0.258674,0.283099,0.552941,0.807082,0.262692,0.278898,0.556863,0.812239,0.266786,0.274661,0.560784,0.817341,0.270954,0.270390,0.564706,0.822386,0.275197,0.266085,0.568627,0.827372,0.279517,0.261750,0.572549,0.832299,0.283913,0.257383,0.576471,0.837165,0.288385,0.252988,0.580392,0.841969,0.292933,0.248564,0.584314,0.846709,0.297559,0.244113,0.588235,0.851384,0.302260,0.239636,0.592157,0.855992,0.307038,0.235133,0.596078,0.860533,0.311892,0.230606,0.600000,0.865006,0.316822,0.226055,0.603922,0.869409,0.321827,0.221482,0.607843,0.873741,0.326906,0.216886,0.611765,0.878001,0.332060,0.212268,0.615686,0.882188,0.337287,0.207628,0.619608,0.886302,0.342586,0.202968,0.623529,0.890341,0.347957,0.198286,0.627451,0.894305,0.353399,0.193584,0.631373,0.898192,0.358911,0.188860,0.635294,0.902003,0.364492,0.184116,0.639216,0.905735,0.370140,0.179350,0.643137,0.909390,0.375856,0.174563,0.647059,0.912966,0.381636,0.169755,0.650980,0.916462,0.387481,0.164924,0.654902,0.919879,0.393389,0.160070,0.658824,0.923215,0.399359,0.155193,0.662745,0.926470,0.405389,0.150292,0.666667,0.929644,0.411479,0.145367,0.670588,0.932737,0.417627,0.140417,0.674510,0.935747,0.423831,0.135440,0.678431,0.938675,0.430091,0.130438,0.682353,0.941521,0.436405,0.125409,0.686275,0.944285,0.442772,0.120354,0.690196,0.946965,0.449191,0.115272,0.694118,0.949562,0.455660,0.110164,0.698039,0.952075,0.462178,0.105031,0.701961,0.954506,0.468744,0.099874,0.705882,0.956852,0.475356,0.094695,0.709804,0.959114,0.482014,0.089499,0.713725,0.961293,0.488716,0.084289,0.717647,0.963387,0.495462,0.079073,0.721569,0.965397,0.502249,0.073859,0.725490,0.967322,0.509078,0.068659,0.729412,0.969163,0.515946,0.063488,0.733333,0.970919,0.522853,0.058367,0.737255,0.972590,0.529798,0.053324,0.741176,0.974176,0.536780,0.048392,0.745098,0.975677,0.543798,0.043618,0.749020,0.977092,0.550850,0.039050,0.752941,0.978422,0.557937,0.034931,0.756863,0.979666,0.565057,0.031409,0.760784,0.980824,0.572209,0.028508,0.764706,0.981895,0.579392,0.026250,0.768627,0.982881,0.586606,0.024661,0.772549,0.983779,0.593849,0.023770,0.776471,0.984591,0.601122,0.023606,0.780392,0.985315,0.608422,0.024202,0.784314,0.985952,0.615750,0.025592,0.788235,0.986502,0.623105,0.027814,0.792157,0.986964,0.630485,0.030908,0.796078,0.987337,0.637890,0.034916,0.800000,0.987622,0.645320,0.039886,0.803922,0.987819,0.652773,0.045581,0.807843,0.987926,0.660250,0.051750,0.811765,0.987945,0.667748,0.058329,0.815686,0.987874,0.675267,0.065257,0.819608,0.987714,0.682807,0.072489,0.823529,0.987464,0.690366,0.079990,0.827451,0.987124,0.697944,0.087731,0.831373,0.986694,0.705540,0.095694,0.835294,0.986175,0.713153,0.103863,0.839216,0.985566,0.720782,0.112229,0.843137,0.984865,0.728427,0.120785,0.847059,0.984075,0.736087,0.129527,0.850980,0.983196,0.743758,0.138453,0.854902,0.982228,0.751442,0.147565,0.858824,0.981173,0.759135,0.156863,0.862745,0.980032,0.766837,0.166353,0.866667,0.978806,0.774545,0.176037,0.870588,0.977497,0.782258,0.185923,0.874510,0.976108,0.789974,0.196018,0.878431,0.974638,0.797692,0.206332,0.882353,0.973088,0.805409,0.216877,0.886275,0.971468,0.813122,0.227658,0.890196,0.969783,0.820825,0.238686,0.894118,0.968041,0.828515,0.249972,0.898039,0.966243,0.836191,0.261534,0.901961,0.964394,0.843848,0.273391,0.905882,0.962517,0.851476,0.285546,0.909804,0.960626,0.859069,0.298010,0.913725,0.958720,0.866624,0.310820,0.917647,0.956834,0.874129,0.323974,0.921569,0.954997,0.881569,0.337475,0.925490,0.953215,0.888942,0.351369,0.929412,0.951546,0.896226,0.365627,0.933333,0.950018,0.903409,0.380271,0.937255,0.948683,0.910473,0.395289,0.941176,0.947594,0.917399,0.410665,0.945098,0.946809,0.924168,0.426373,0.949020,0.946392,0.930761,0.442367,0.952941,0.946403,0.937159,0.458592,0.956863,0.946903,0.943348,0.474970,0.960784,0.947937,0.949318,0.491426,0.964706,0.949545,0.955063,0.507860,0.968627,0.951740,0.960587,0.524203,0.972549,0.954529,0.965896,0.540361,0.976471,0.957896,0.971003,0.556275,0.980392,0.961812,0.975924,0.571925,0.984314,0.966249,0.980678,0.587206,0.988235,0.971162,0.985282,0.602154,0.992157,0.976511,0.989753,0.616760,0.996078,0.982257,0.994109,0.631017,1.000000,0.988362,0.998364,0.644924]},{"ColorSpace":"Diverging","Name":"Plasma (matplotlib)","NanColor":[0,1,0],"Source":"https://github.com/BIDS/colormap/blob/master/colormaps.py","License":"CC0","Creator":"Nathaniel J. Smith & Stefan van der Walt","RGBPoints":[0.000000,0.050383,0.029803,0.527975,0.003922,0.063536,0.028426,0.533124,0.007843,0.075353,0.027206,0.538007,0.011765,0.086222,0.026125,0.542658,0.015686,0.096379,0.025165,0.547103,0.019608,0.105980,0.024309,0.551368,0.023529,0.115124,0.023556,0.555468,0.027451,0.123903,0.022878,0.559423,0.031373,0.132381,0.022258,0.563250,0.035294,0.140603,0.021687,0.566959,0.039216,0.148607,0.021154,0.570562,0.043137,0.156421,0.020651,0.574065,0.047059,0.164070,0.020171,0.577478,0.050980,0.171574,0.019706,0.580806,0.054902,0.178950,0.019252,0.584054,0.058824,0.186213,0.018803,0.587228,0.062745,0.193374,0.018354,0.590330,0.066667,0.200445,0.017902,0.593364,0.070588,0.207435,0.017442,0.596333,0.074510,0.214350,0.016973,0.599239,0.078431,0.221197,0.016497,0.602083,0.082353,0.227983,0.016007,0.604867,0.086275,0.234715,0.015502,0.607592,0.090196,0.241396,0.014979,0.610259,0.094118,0.248032,0.014439,0.612868,0.098039,0.254627,0.013882,0.615419,0.101961,0.261183,0.013308,0.617911,0.105882,0.267703,0.012716,0.620346,0.109804,0.274191,0.012109,0.622722,0.113725,0.280648,0.011488,0.625038,0.117647,0.287076,0.010855,0.627295,0.121569,0.293478,0.010213,0.629490,0.125490,0.299855,0.009561,0.631624,0.129412,0.306210,0.008902,0.633694,0.133333,0.312543,0.008239,0.635700,0.137255,0.318856,0.007576,0.637640,0.141176,0.325150,0.006915,0.639512,0.145098,0.331426,0.006261,0.641316,0.149020,0.337683,0.005618,0.643049,0.152941,0.343925,0.004991,0.644710,0.156863,0.350150,0.004382,0.646298,0.160784,0.356359,0.003798,0.647810,0.164706,0.362553,0.003243,0.649245,0.168627,0.368733,0.002724,0.650601,0.172549,0.374897,0.002245,0.651876,0.176471,0.381047,0.001814,0.653068,0.180392,0.387183,0.001434,0.654177,0.184314,0.393304,0.001114,0.655199,0.188235,0.399411,0.000859,0.656133,0.192157,0.405503,0.000678,0.656977,0.196078,0.411580,0.000577,0.657730,0.200000,0.417642,0.000564,0.658390,0.203922,0.423689,0.000646,0.658956,0.207843,0.429719,0.000831,0.659425,0.211765,0.435734,0.001127,0.659797,0.215686,0.441732,0.001540,0.660069,0.219608,0.447714,0.002080,0.660240,0.223529,0.453677,0.002755,0.660310,0.227451,0.459623,0.003574,0.660277,0.231373,0.465550,0.004545,0.660139,0.235294,0.471457,0.005678,0.659897,0.239216,0.477344,0.006980,0.659549,0.243137,0.483210,0.008460,0.659095,0.247059,0.489055,0.010127,0.658534,0.250980,0.494877,0.011990,0.657865,0.254902,0.500678,0.014055,0.657088,0.258824,0.506454,0.016333,0.656202,0.262745,0.512206,0.018833,0.655209,0.266667,0.517933,0.021563,0.654109,0.270588,0.523633,0.024532,0.652901,0.274510,0.529306,0.027747,0.651586,0.278431,0.534952,0.031217,0.650165,0.282353,0.540570,0.034950,0.648640,0.286275,0.546157,0.038954,0.647010,0.290196,0.551715,0.043136,0.645277,0.294118,0.557243,0.047331,0.643443,0.298039,0.562738,0.051545,0.641509,0.301961,0.568201,0.055778,0.639477,0.305882,0.573632,0.060028,0.637349,0.309804,0.579029,0.064296,0.635126,0.313725,0.584391,0.068579,0.632812,0.317647,0.589719,0.072878,0.630408,0.321569,0.595011,0.077190,0.627917,0.325490,0.600266,0.081516,0.625342,0.329412,0.605485,0.085854,0.622686,0.333333,0.610667,0.090204,0.619951,0.337255,0.615812,0.094564,0.617140,0.341176,0.620919,0.098934,0.614257,0.345098,0.625987,0.103312,0.611305,0.349020,0.631017,0.107699,0.608287,0.352941,0.636008,0.112092,0.605205,0.356863,0.640959,0.116492,0.602065,0.360784,0.645872,0.120898,0.598867,0.364706,0.650746,0.125309,0.595617,0.368627,0.655580,0.129725,0.592317,0.372549,0.660374,0.134144,0.588971,0.376471,0.665129,0.138566,0.585582,0.380392,0.669845,0.142992,0.582154,0.384314,0.674522,0.147419,0.578688,0.388235,0.679160,0.151848,0.575189,0.392157,0.683758,0.156278,0.571660,0.396078,0.688318,0.160709,0.568103,0.400000,0.692840,0.165141,0.564522,0.403922,0.697324,0.169573,0.560919,0.407843,0.701769,0.174005,0.557296,0.411765,0.706178,0.178437,0.553657,0.415686,0.710549,0.182868,0.550004,0.419608,0.714883,0.187299,0.546338,0.423529,0.719181,0.191729,0.542663,0.427451,0.723444,0.196158,0.538981,0.431373,0.727670,0.200586,0.535293,0.435294,0.731862,0.205013,0.531601,0.439216,0.736019,0.209439,0.527908,0.443137,0.740143,0.213864,0.524216,0.447059,0.744232,0.218288,0.520524,0.450980,0.748289,0.222711,0.516834,0.454902,0.752312,0.227133,0.513149,0.458824,0.756304,0.231555,0.509468,0.462745,0.760264,0.235976,0.505794,0.466667,0.764193,0.240396,0.502126,0.470588,0.768090,0.244817,0.498465,0.474510,0.771958,0.249237,0.494813,0.478431,0.775796,0.253658,0.491171,0.482353,0.779604,0.258078,0.487539,0.486275,0.783383,0.262500,0.483918,0.490196,0.787133,0.266922,0.480307,0.494118,0.790855,0.271345,0.476706,0.498039,0.794549,0.275770,0.473117,0.501961,0.798216,0.280197,0.469538,0.505882,0.801855,0.284626,0.465971,0.509804,0.805467,0.289057,0.462415,0.513725,0.809052,0.293491,0.458870,0.517647,0.812612,0.297928,0.455338,0.521569,0.816144,0.302368,0.451816,0.525490,0.819651,0.306812,0.448306,0.529412,0.823132,0.311261,0.444806,0.533333,0.826588,0.315714,0.441316,0.537255,0.830018,0.320172,0.437836,0.541176,0.833422,0.324635,0.434366,0.545098,0.836801,0.329105,0.430905,0.549020,0.840155,0.333580,0.427455,0.552941,0.843484,0.338062,0.424013,0.556863,0.846788,0.342551,0.420579,0.560784,0.850066,0.347048,0.417153,0.564706,0.853319,0.351553,0.413734,0.568627,0.856547,0.356066,0.410322,0.572549,0.859750,0.360588,0.406917,0.576471,0.862927,0.365119,0.403519,0.580392,0.866078,0.369660,0.400126,0.584314,0.869203,0.374212,0.396738,0.588235,0.872303,0.378774,0.393355,0.592157,0.875376,0.383347,0.389976,0.596078,0.878423,0.387932,0.386600,0.600000,0.881443,0.392529,0.383229,0.603922,0.884436,0.397139,0.379860,0.607843,0.887402,0.401762,0.376494,0.611765,0.890340,0.406398,0.373130,0.615686,0.893250,0.411048,0.369768,0.619608,0.896131,0.415712,0.366407,0.623529,0.898984,0.420392,0.363047,0.627451,0.901807,0.425087,0.359688,0.631373,0.904601,0.429797,0.356329,0.635294,0.907365,0.434524,0.352970,0.639216,0.910098,0.439268,0.349610,0.643137,0.912800,0.444029,0.346251,0.647059,0.915471,0.448807,0.342890,0.650980,0.918109,0.453603,0.339529,0.654902,0.920714,0.458417,0.336166,0.658824,0.923287,0.463251,0.332801,0.662745,0.925825,0.468103,0.329435,0.666667,0.928329,0.472975,0.326067,0.670588,0.930798,0.477867,0.322697,0.674510,0.933232,0.482780,0.319325,0.678431,0.935630,0.487712,0.315952,0.682353,0.937990,0.492667,0.312575,0.686275,0.940313,0.497642,0.309197,0.690196,0.942598,0.502639,0.305816,0.694118,0.944844,0.507658,0.302433,0.698039,0.947051,0.512699,0.299049,0.701961,0.949217,0.517763,0.295662,0.705882,0.951344,0.522850,0.292275,0.709804,0.953428,0.527960,0.288883,0.713725,0.955470,0.533093,0.285490,0.717647,0.957469,0.538250,0.282096,0.721569,0.959424,0.543431,0.278701,0.725490,0.961336,0.548636,0.275305,0.729412,0.963203,0.553865,0.271909,0.733333,0.965024,0.559118,0.268513,0.737255,0.966798,0.564396,0.265118,0.741176,0.968526,0.569700,0.261721,0.745098,0.970205,0.575028,0.258325,0.749020,0.971835,0.580382,0.254931,0.752941,0.973416,0.585761,0.251540,0.756863,0.974947,0.591165,0.248151,0.760784,0.976428,0.596595,0.244767,0.764706,0.977856,0.602051,0.241387,0.768627,0.979233,0.607532,0.238013,0.772549,0.980556,0.613039,0.234646,0.776471,0.981826,0.618572,0.231287,0.780392,0.983041,0.624131,0.227937,0.784314,0.984199,0.629718,0.224595,0.788235,0.985301,0.635330,0.221265,0.792157,0.986345,0.640969,0.217948,0.796078,0.987332,0.646633,0.214648,0.800000,0.988260,0.652325,0.211364,0.803922,0.989128,0.658043,0.208100,0.807843,0.989935,0.663787,0.204859,0.811765,0.990681,0.669558,0.201642,0.815686,0.991365,0.675355,0.198453,0.819608,0.991985,0.681179,0.195295,0.823529,0.992541,0.687030,0.192170,0.827451,0.993032,0.692907,0.189084,0.831373,0.993456,0.698810,0.186041,0.835294,0.993814,0.704741,0.183043,0.839216,0.994103,0.710698,0.180097,0.843137,0.994324,0.716681,0.177208,0.847059,0.994474,0.722691,0.174381,0.850980,0.994553,0.728728,0.171622,0.854902,0.994561,0.734791,0.168938,0.858824,0.994495,0.740880,0.166335,0.862745,0.994355,0.746995,0.163821,0.866667,0.994141,0.753137,0.161404,0.870588,0.993851,0.759304,0.159092,0.874510,0.993482,0.765499,0.156891,0.878431,0.993033,0.771720,0.154808,0.882353,0.992505,0.777967,0.152855,0.886275,0.991897,0.784239,0.151042,0.890196,0.991209,0.790537,0.149377,0.894118,0.990439,0.796859,0.147870,0.898039,0.989587,0.803205,0.146529,0.901961,0.988648,0.809579,0.145357,0.905882,0.987621,0.815978,0.144363,0.909804,0.986509,0.822401,0.143557,0.913725,0.985314,0.828846,0.142945,0.917647,0.984031,0.835315,0.142528,0.921569,0.982653,0.841812,0.142303,0.925490,0.981190,0.848329,0.142279,0.929412,0.979644,0.854866,0.142453,0.933333,0.977995,0.861432,0.142808,0.937255,0.976265,0.868016,0.143351,0.941176,0.974443,0.874622,0.144061,0.945098,0.972530,0.881250,0.144923,0.949020,0.970533,0.887896,0.145919,0.952941,0.968443,0.894564,0.147014,0.956863,0.966271,0.901249,0.148180,0.960784,0.964021,0.907950,0.149370,0.964706,0.961681,0.914672,0.150520,0.968627,0.959276,0.921407,0.151566,0.972549,0.956808,0.928152,0.152409,0.976471,0.954287,0.934908,0.152921,0.980392,0.951726,0.941671,0.152925,0.984314,0.949151,0.948435,0.152178,0.988235,0.946602,0.955190,0.150328,0.992157,0.944152,0.961916,0.146861,0.996078,0.941896,0.968590,0.140956,1.000000,0.940015,0.975158,0.131326]},{"ColorSpace":"Diverging","Name":"Viridis (matplotlib)","NanColor":[1,0,0],"Source":"https://github.com/BIDS/colormap/blob/master/colormaps.py","License":"CC0","Creator":"Eric Firing","RGBPoints":[0.000000,0.267004,0.004874,0.329415,0.003922,0.268510,0.009605,0.335427,0.007843,0.269944,0.014625,0.341379,0.011765,0.271305,0.019942,0.347269,0.015686,0.272594,0.025563,0.353093,0.019608,0.273809,0.031497,0.358853,0.023529,0.274952,0.037752,0.364543,0.027451,0.276022,0.044167,0.370164,0.031373,0.277018,0.050344,0.375715,0.035294,0.277941,0.056324,0.381191,0.039216,0.278791,0.062145,0.386592,0.043137,0.279566,0.067836,0.391917,0.047059,0.280267,0.073417,0.397163,0.050980,0.280894,0.078907,0.402329,0.054902,0.281446,0.084320,0.407414,0.058824,0.281924,0.089666,0.412415,0.062745,0.282327,0.094955,0.417331,0.066667,0.282656,0.100196,0.422160,0.070588,0.282910,0.105393,0.426902,0.074510,0.283091,0.110553,0.431554,0.078431,0.283197,0.115680,0.436115,0.082353,0.283229,0.120777,0.440584,0.086275,0.283187,0.125848,0.444960,0.090196,0.283072,0.130895,0.449241,0.094118,0.282884,0.135920,0.453427,0.098039,0.282623,0.140926,0.457517,0.101961,0.282290,0.145912,0.461510,0.105882,0.281887,0.150881,0.465405,0.109804,0.281412,0.155834,0.469201,0.113725,0.280868,0.160771,0.472899,0.117647,0.280255,0.165693,0.476498,0.121569,0.279574,0.170599,0.479997,0.125490,0.278826,0.175490,0.483397,0.129412,0.278012,0.180367,0.486697,0.133333,0.277134,0.185228,0.489898,0.137255,0.276194,0.190074,0.493001,0.141176,0.275191,0.194905,0.496005,0.145098,0.274128,0.199721,0.498911,0.149020,0.273006,0.204520,0.501721,0.152941,0.271828,0.209303,0.504434,0.156863,0.270595,0.214069,0.507052,0.160784,0.269308,0.218818,0.509577,0.164706,0.267968,0.223549,0.512008,0.168627,0.266580,0.228262,0.514349,0.172549,0.265145,0.232956,0.516599,0.176471,0.263663,0.237631,0.518762,0.180392,0.262138,0.242286,0.520837,0.184314,0.260571,0.246922,0.522828,0.188235,0.258965,0.251537,0.524736,0.192157,0.257322,0.256130,0.526563,0.196078,0.255645,0.260703,0.528312,0.200000,0.253935,0.265254,0.529983,0.203922,0.252194,0.269783,0.531579,0.207843,0.250425,0.274290,0.533103,0.211765,0.248629,0.278775,0.534556,0.215686,0.246811,0.283237,0.535941,0.219608,0.244972,0.287675,0.537260,0.223529,0.243113,0.292092,0.538516,0.227451,0.241237,0.296485,0.539709,0.231373,0.239346,0.300855,0.540844,0.235294,0.237441,0.305202,0.541921,0.239216,0.235526,0.309527,0.542944,0.243137,0.233603,0.313828,0.543914,0.247059,0.231674,0.318106,0.544834,0.250980,0.229739,0.322361,0.545706,0.254902,0.227802,0.326594,0.546532,0.258824,0.225863,0.330805,0.547314,0.262745,0.223925,0.334994,0.548053,0.266667,0.221989,0.339161,0.548752,0.270588,0.220057,0.343307,0.549413,0.274510,0.218130,0.347432,0.550038,0.278431,0.216210,0.351535,0.550627,0.282353,0.214298,0.355619,0.551184,0.286275,0.212395,0.359683,0.551710,0.290196,0.210503,0.363727,0.552206,0.294118,0.208623,0.367752,0.552675,0.298039,0.206756,0.371758,0.553117,0.301961,0.204903,0.375746,0.553533,0.305882,0.203063,0.379716,0.553925,0.309804,0.201239,0.383670,0.554294,0.313725,0.199430,0.387607,0.554642,0.317647,0.197636,0.391528,0.554969,0.321569,0.195860,0.395433,0.555276,0.325490,0.194100,0.399323,0.555565,0.329412,0.192357,0.403199,0.555836,0.333333,0.190631,0.407061,0.556089,0.337255,0.188923,0.410910,0.556326,0.341176,0.187231,0.414746,0.556547,0.345098,0.185556,0.418570,0.556753,0.349020,0.183898,0.422383,0.556944,0.352941,0.182256,0.426184,0.557120,0.356863,0.180629,0.429975,0.557282,0.360784,0.179019,0.433756,0.557430,0.364706,0.177423,0.437527,0.557565,0.368627,0.175841,0.441290,0.557685,0.372549,0.174274,0.445044,0.557792,0.376471,0.172719,0.448791,0.557885,0.380392,0.171176,0.452530,0.557965,0.384314,0.169646,0.456262,0.558030,0.388235,0.168126,0.459988,0.558082,0.392157,0.166617,0.463708,0.558119,0.396078,0.165117,0.467423,0.558141,0.400000,0.163625,0.471133,0.558148,0.403922,0.162142,0.474838,0.558140,0.407843,0.160665,0.478540,0.558115,0.411765,0.159194,0.482237,0.558073,0.415686,0.157729,0.485932,0.558013,0.419608,0.156270,0.489624,0.557936,0.423529,0.154815,0.493313,0.557840,0.427451,0.153364,0.497000,0.557724,0.431373,0.151918,0.500685,0.557587,0.435294,0.150476,0.504369,0.557430,0.439216,0.149039,0.508051,0.557250,0.443137,0.147607,0.511733,0.557049,0.447059,0.146180,0.515413,0.556823,0.450980,0.144759,0.519093,0.556572,0.454902,0.143343,0.522773,0.556295,0.458824,0.141935,0.526453,0.555991,0.462745,0.140536,0.530132,0.555659,0.466667,0.139147,0.533812,0.555298,0.470588,0.137770,0.537492,0.554906,0.474510,0.136408,0.541173,0.554483,0.478431,0.135066,0.544853,0.554029,0.482353,0.133743,0.548535,0.553541,0.486275,0.132444,0.552216,0.553018,0.490196,0.131172,0.555899,0.552459,0.494118,0.129933,0.559582,0.551864,0.498039,0.128729,0.563265,0.551229,0.501961,0.127568,0.566949,0.550556,0.505882,0.126453,0.570633,0.549841,0.509804,0.125394,0.574318,0.549086,0.513725,0.124395,0.578002,0.548287,0.517647,0.123463,0.581687,0.547445,0.521569,0.122606,0.585371,0.546557,0.525490,0.121831,0.589055,0.545623,0.529412,0.121148,0.592739,0.544641,0.533333,0.120565,0.596422,0.543611,0.537255,0.120092,0.600104,0.542530,0.541176,0.119738,0.603785,0.541400,0.545098,0.119512,0.607464,0.540218,0.549020,0.119423,0.611141,0.538982,0.552941,0.119483,0.614817,0.537692,0.556863,0.119699,0.618490,0.536347,0.560784,0.120081,0.622161,0.534946,0.564706,0.120638,0.625828,0.533488,0.568627,0.121380,0.629492,0.531973,0.572549,0.122312,0.633153,0.530398,0.576471,0.123444,0.636809,0.528763,0.580392,0.124780,0.640461,0.527068,0.584314,0.126326,0.644107,0.525311,0.588235,0.128087,0.647749,0.523491,0.592157,0.130067,0.651384,0.521608,0.596078,0.132268,0.655014,0.519661,0.600000,0.134692,0.658636,0.517649,0.603922,0.137339,0.662252,0.515571,0.607843,0.140210,0.665859,0.513427,0.611765,0.143303,0.669459,0.511215,0.615686,0.146616,0.673050,0.508936,0.619608,0.150148,0.676631,0.506589,0.623529,0.153894,0.680203,0.504172,0.627451,0.157851,0.683765,0.501686,0.631373,0.162016,0.687316,0.499129,0.635294,0.166383,0.690856,0.496502,0.639216,0.170948,0.694384,0.493803,0.643137,0.175707,0.697900,0.491033,0.647059,0.180653,0.701402,0.488189,0.650980,0.185783,0.704891,0.485273,0.654902,0.191090,0.708366,0.482284,0.658824,0.196571,0.711827,0.479221,0.662745,0.202219,0.715272,0.476084,0.666667,0.208030,0.718701,0.472873,0.670588,0.214000,0.722114,0.469588,0.674510,0.220124,0.725509,0.466226,0.678431,0.226397,0.728888,0.462789,0.682353,0.232815,0.732247,0.459277,0.686275,0.239374,0.735588,0.455688,0.690196,0.246070,0.738910,0.452024,0.694118,0.252899,0.742211,0.448284,0.698039,0.259857,0.745492,0.444467,0.701961,0.266941,0.748751,0.440573,0.705882,0.274149,0.751988,0.436601,0.709804,0.281477,0.755203,0.432552,0.713725,0.288921,0.758394,0.428426,0.717647,0.296479,0.761561,0.424223,0.721569,0.304148,0.764704,0.419943,0.725490,0.311925,0.767822,0.415586,0.729412,0.319809,0.770914,0.411152,0.733333,0.327796,0.773980,0.406640,0.737255,0.335885,0.777018,0.402049,0.741176,0.344074,0.780029,0.397381,0.745098,0.352360,0.783011,0.392636,0.749020,0.360741,0.785964,0.387814,0.752941,0.369214,0.788888,0.382914,0.756863,0.377779,0.791781,0.377939,0.760784,0.386433,0.794644,0.372886,0.764706,0.395174,0.797475,0.367757,0.768627,0.404001,0.800275,0.362552,0.772549,0.412913,0.803041,0.357269,0.776471,0.421908,0.805774,0.351910,0.780392,0.430983,0.808473,0.346476,0.784314,0.440137,0.811138,0.340967,0.788235,0.449368,0.813768,0.335384,0.792157,0.458674,0.816363,0.329727,0.796078,0.468053,0.818921,0.323998,0.800000,0.477504,0.821444,0.318195,0.803922,0.487026,0.823929,0.312321,0.807843,0.496615,0.826376,0.306377,0.811765,0.506271,0.828786,0.300362,0.815686,0.515992,0.831158,0.294279,0.819608,0.525776,0.833491,0.288127,0.823529,0.535621,0.835785,0.281908,0.827451,0.545524,0.838039,0.275626,0.831373,0.555484,0.840254,0.269281,0.835294,0.565498,0.842430,0.262877,0.839216,0.575563,0.844566,0.256415,0.843137,0.585678,0.846661,0.249897,0.847059,0.595839,0.848717,0.243329,0.850980,0.606045,0.850733,0.236712,0.854902,0.616293,0.852709,0.230052,0.858824,0.626579,0.854645,0.223353,0.862745,0.636902,0.856542,0.216620,0.866667,0.647257,0.858400,0.209861,0.870588,0.657642,0.860219,0.203082,0.874510,0.668054,0.861999,0.196293,0.878431,0.678489,0.863742,0.189503,0.882353,0.688944,0.865448,0.182725,0.886275,0.699415,0.867117,0.175971,0.890196,0.709898,0.868751,0.169257,0.894118,0.720391,0.870350,0.162603,0.898039,0.730889,0.871916,0.156029,0.901961,0.741388,0.873449,0.149561,0.905882,0.751884,0.874951,0.143228,0.909804,0.762373,0.876424,0.137064,0.913725,0.772852,0.877868,0.131109,0.917647,0.783315,0.879285,0.125405,0.921569,0.793760,0.880678,0.120005,0.925490,0.804182,0.882046,0.114965,0.929412,0.814576,0.883393,0.110347,0.933333,0.824940,0.884720,0.106217,0.937255,0.835270,0.886029,0.102646,0.941176,0.845561,0.887322,0.099702,0.945098,0.855810,0.888601,0.097452,0.949020,0.866013,0.889868,0.095953,0.952941,0.876168,0.891125,0.095250,0.956863,0.886271,0.892374,0.095374,0.960784,0.896320,0.893616,0.096335,0.964706,0.906311,0.894855,0.098125,0.968627,0.916242,0.896091,0.100717,0.972549,0.926106,0.897330,0.104071,0.976471,0.935904,0.898570,0.108131,0.980392,0.945636,0.899815,0.112838,0.984314,0.955300,0.901065,0.118128,0.988235,0.964894,0.902323,0.123941,0.992157,0.974417,0.903590,0.130215,0.996078,0.983868,0.904867,0.136897,1.000000,0.993248,0.906157,0.143936]},{"ShowIndexedColorActiveValues":1,"IndexedColors":[0.07,0.50,0.70,1.00,1.00,1.00,0.85,1.00,1.00,0.80,0.50,1.00,0.76,1.00,0.00,1.00,0.71,0.71,0.50,0.50,0.50,0.05,0.05,1.00,1.00,0.05,0.05,0.70,1.00,1.00,0.70,0.89,0.96,0.67,0.36,0.95,0.54,1.00,0.00,0.75,0.65,0.65,0.50,0.60,0.60,1.00,0.50,0.00,1.00,1.00,0.19,0.12,0.94,0.12,0.50,0.82,0.89,0.56,0.25,0.83,0.24,1.00,0.00,0.90,0.90,0.90,0.75,0.76,0.78,0.65,0.65,0.67,0.54,0.60,0.78,0.61,0.48,0.78,0.50,0.48,0.78,0.44,0.48,0.78,0.36,0.48,0.76,1.00,0.48,0.38,0.49,0.50,0.69,0.76,0.56,0.56,0.40,0.56,0.56,0.74,0.50,0.89,1.00,0.63,0.00,0.65,0.16,0.16,0.36,0.72,0.82,0.44,0.18,0.69,0.00,1.00,0.00,0.58,1.00,1.00,0.58,0.88,0.88,0.45,0.76,0.79,0.33,0.71,0.71,0.23,0.62,0.62,0.14,0.56,0.56,0.04,0.49,0.55,0.00,0.41,0.52,0.88,0.88,1.00,1.00,0.85,0.56,0.65,0.46,0.45,0.40,0.50,0.50,0.62,0.39,0.71,0.83,0.48,0.00,0.58,0.00,0.58,0.26,0.62,0.69,0.34,0.09,0.56,0.00,0.79,0.00,0.44,0.83,1.00,1.00,1.00,0.78,0.85,1.00,0.78,0.78,1.00,0.78,0.64,1.00,0.78,0.56,1.00,0.78,0.38,1.00,0.78,0.27,1.00,0.78,0.19,1.00,0.78,0.12,1.00,0.78,0.00,1.00,0.61,0.00,0.90,0.46,0.00,0.83,0.32,0.00,0.75,0.22,0.00,0.67,0.14,0.30,0.76,1.00,0.30,0.65,1.00,0.13,0.58,0.84,0.15,0.49,0.67,0.15,0.40,0.59,0.09,0.33,0.53,0.96,0.93,0.82,0.80,0.82,0.12,0.71,0.71,0.76,0.65,0.33,0.30,0.34,0.35,0.38,0.62,0.31,0.71,0.67,0.36,0.00,0.46,0.31,0.27,0.26,0.51,0.59,0.26,0.00,0.40,0.00,0.49,0.00,0.44,0.67,0.98,0.00,0.73,1.00,0.00,0.63,1.00,0.00,0.56,1.00,0.00,0.50,1.00,0.00,0.42,1.00,0.33,0.36,0.95,0.47,0.36,0.89,0.54,0.31,0.89,0.63,0.21,0.83,0.70,0.12,0.83,0.70,0.12,0.73,0.70,0.05,0.65,0.74,0.05,0.53,0.78,0.00,0.40,0.80,0.00,0.35,0.82,0.00,0.31,0.85,0.00,0.27,0.88,0.00,0.22,0.90,0.00,0.18,0.91,0.00,0.15,0.92,0.00,0.14,0.93,0.00,0.13,0.94,0.00,0.12,0.95,0.00,0.11,0.96,0.00,0.10,0.97,0.00,0.09,0.98,0.00,0.08,0.99,0.00,0.07,1.00,0.00,0.06],"Annotations":[0,"Xx",1,"H",2,"He",3,"Li",4,"Be",5,"B",6,"C",7,"N",8,"O",9,"F",10,"Ne",11,"Na",12,"Mg",13,"Al",14,"Si",15,"P",16,"S",17,"Cl",18,"Ar",19,"K",20,"Ca",21,"Sc",22,"Ti",23,"V",24,"Cr",25,"Mn",26,"Fe",27,"Co",28,"Ni",29,"Cu",30,"Zn",31,"Ga",32,"Ge",33,"As",34,"Se",35,"Br",36,"Kr",37,"Rb",38,"Sr",39,"Y",40,"Zr",41,"Nb",42,"Mo",43,"Tc",44,"Ru",45,"Rh",46,"Pd",47,"Ag",48,"Cd",49,"In",50,"Sn",51,"Sb",52,"Te",53,"I",54,"Xe",55,"Cs",56,"Ba",57,"La",58,"Ce",59,"Pr",60,"Nd",61,"Pm",62,"Sm",63,"Eu",64,"Gd",65,"Tb",66,"Dy",67,"Ho",68,"Er",69,"Tm",70,"Yb",71,"Lu",72,"Hf",73,"Ta",74,"W",75,"Re",76,"Os",77,"Ir",78,"Pt",79,"Au",80,"Hg",81,"Tl",82,"Pb",83,"Bi",84,"Po",85,"At",86,"Rn",87,"Fr",88,"Ra",89,"Ac",90,"Th",91,"Pa",92,"U",93,"Np",94,"Pu",95,"Am",96,"Cm",97,"Bk",98,"Cf",99,"Es",100,"Fm",101,"Md",102,"No",103,"Lr",104,"Rf",105,"Db",106,"Sg",107,"Bh",108,"Hs",109,"Mt",110,"Ds",111,"Rg",112,"Cn",113,"Uut",114,"Uuq",115,"Uup",116,"Uuh",117,"Uus",118,"Uuo"],"Name":"BlueObeliskElements"}]'),i=Object.create(null);n.filter(e=>e.RGBPoints).filter(e=>"CIELAB"!==e.ColorSpace).forEach(e=>{i[e.Name]=e});var a=Object.keys(i);a.sort();var o={getPresetByName:function(e){return i[e]},rgbPresetNames:a},s=r(56109),l=r(10355),u=r(88824),c=r(50987);let d=new WeakMap;function p(e){let t=d.get(e);return t||{overall:P(e),threshold:O(e)}}let m=new Map;function h(e){return e?.trim().toLowerCase()}function f(e){e.name=e.name||e.Name,m.set(e.name,e)}function g(e){return m.get(e)}function v(){return Array.from(m.keys())}function y(e){if(e?.trim())return function(e){let t=g(e);if(t)return t;let r=h(e);if(r){for(let[e,t]of m.entries())if(h(e)===r||h(t.Name)===r)return t}}(e)||function(e){let t=o.getPresetByName(e);if(t)return t;let r=h(e);if(!r)return;let n=o.rgbPresetNames.find(e=>h(e)===r);return n?o.getPresetByName(n):void 0}(e)}function b(e,t){let r=o.rgbPresetNames.map(e=>o.getPresetByName(e)),n=v().map(e=>g(e)),i=r.concat(n).find(t=>{let{RGBPoints:r}=t;if(r.length!==e.length)return!1;for(let t=0;t0&&{opacity:a},...!1}}function I(e){let{volumeActor:t,preset:r,opacity:n=.9,threshold:i=null,colorRange:a=[0,5]}=e;t.getMapper().setSampleDistance(1);let l=s.Ay.newInstance(),u=r||o.getPresetByName("hsv");l.applyColorMap(u),l.setMappingRange(a[0],a[1]),t.getProperty().setRGBTransferFunction(0,l),w(t,n,i)}function x(e,t){let r=p(e);S(e,{...r,overall:t})}function C(e,t){let r=p(e);S(e,{...r,threshold:t})}function A(e,t,r){let n=p(e);S(e,{...n,mapping:t,...void 0!==r&&{overall:r}})}function T(e){let t=d.get(e);return t?{opacity:t.overall,opacityMapping:t.mapping,threshold:t.threshold??null}:{opacity:P(e),opacityMapping:void 0,threshold:O(e)}}function S(e,t){let r=t.overall??1,n=t.threshold??null,i=t.mapping;if(d.set(e,{overall:r,mapping:i,threshold:n}),i?.length){let t=l.Ay.newInstance(),a=[...i].sort((e,t)=>e.value-t.value);if(null!==n){let e=Math.abs(a[a.length-1].value-a[0].value)||1;t.addPoint(a[0].value,0),t.addPoint(n-.001*e,0),a.forEach(({value:e,opacity:i})=>{e>=n&&t.addPoint(e,i*r)})}else a.forEach(({value:e,opacity:n})=>{t.addPoint(e,n*r)});e.getProperty().setScalarOpacity(0,t);return}w(e,r,n)}function w(e,t,r){let n=e.getMapper().getInputData().get("voxelManager");if(!n?.voxelManager)throw Error("No voxel manager was found for the volume actor, or you cannot yet update opacity with a threshold using stacked images");let i=n.voxelManager.getRange(),a=l.Ay.newInstance();if(null!==r){let e=.001*Math.abs(i[1]-i[0]),n=Math.max(i[0],Math.min(i[1],r));a.addPoint(i[0],0),a.addPoint(n-e,0),a.addPoint(n,t),a.addPoint(i[1],t)}else a.addPoint(i[0],t),a.addPoint(i[1],t);e.getProperty().setScalarOpacity(0,a)}function O(e){let t=e.getProperty().getScalarOpacity(0);if(!t)return null;let r=t.getDataPointer();if(!r||r.length<=4)return null;for(let e=0;e0)return n}return null}function P(e){let t=e.getProperty().getScalarOpacity(0);if(!t)return 1;let r=t.getDataPointer();if(!r||0===r.length)return 1;let n=0;for(let e=1;en&&(n=r[e]);return n}},60434:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MutationObserverImpl=void 0;let n=r(60957),i=r(79663),a=r(57226);class o{_callback;_nodeList=[];_recordQueue=[];constructor(e){this._callback=e;let t=n.dom.window;a.set.append(t._mutationObservers,this)}observe(e,t){if((void 0!==(t=t||{childList:!1,subtree:!1}).attributeOldValue||void 0!==t.attributeFilter)&&void 0===t.attributes&&(t.attributes=!0),void 0!==t.characterDataOldValue&&void 0===t.characterData&&(t.characterData=!0),!t.childList&&!t.attributes&&!t.characterData||t.attributeOldValue&&!t.attributes||void 0!==t.attributeFilter&&!t.attributes||t.characterDataOldValue&&!t.characterData)throw TypeError();let r=!1,n=t;for(let t of e._registeredObserverList)if(t.observer===this){for(let e of(r=!0,this._nodeList))a.list.remove(e._registeredObserverList,e=>i.Guard.isTransientRegisteredObserver(e)&&e.source===t);t.options=n}r||(e._registeredObserverList.push({observer:this,options:t}),this._nodeList.push(e))}disconnect(){for(let e of this._nodeList)a.list.remove(e._registeredObserverList,e=>e.observer===this);this._recordQueue=[]}takeRecords(){let e=this._recordQueue;return this._recordQueue=[],e}}t.MutationObserverImpl=o},60609:(e,t,r)=>{"use strict";r.d(t,{e:()=>s});var n=r(622),i=r(11877),a=r(35088),o=r(2523);async function s(e,t={}){var r,l,u,c;let{imageIndex:d,debounceLoading:p,volumeId:m}=t,h=(0,a.Ay)(e);if(!h)throw Error("Element has been disabled");let{viewport:f}=h,{imageIndex:g,numberOfSlices:v}=(r=f,l=p,r instanceof o.A?{numberOfSlices:r.getImageIds().length,imageIndex:l?r.getTargetImageIdIndex():r.getCurrentImageIdIndex()}:{numberOfSlices:r.getNumberOfSlices(),imageIndex:r.getSliceIndex()}),y=(u=v,c=d,(0,n.Ay)(c,0,u-1));(0,i.A)(f,{delta:y-g,debounceLoading:p,volumeId:m})}},60721:(e,t,r)=>{"use strict";r.d(t,{c:()=>l});var n=r(59998),i=r(10353),a=r(36427),o=r(93022);let s=a.H;function l(){(0,o.setAnnotationManager)(s)}s.setPreprocessingFn(e=>{let t=(e=(e=>(e.data||(e.data={}),e.data.cachedStats||(e.data.cachedStats={}),e))(e=(e=>(e.data||(e.data={}),e.data.handles||(e.data.handles={}),e.data.handles.textBox||(e.data.handles.textBox={}),e))(e))).annotationUID,r=(0,n.v_)(t);e.isLocked=r;let a=(0,i.he)(t);return e.isVisible=a,e}),(0,o.setAnnotationManager)(s)},60780:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProcessingInstructionImpl=void 0;let n=r(5309),i=r(4530),a=r(48040);class o extends i.CharacterDataImpl{_nodeType=n.NodeType.ProcessingInstruction;_target;constructor(e,t){super(t),this._target=e}get target(){return this._target}static _create(e,t,r){let n=new o(t,r);return n._nodeDocument=e,n}}t.ProcessingInstructionImpl=o,(0,a.idl_defineConst)(o.prototype,"_nodeType",n.NodeType.ProcessingInstruction)},60957:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dom=void 0;let n=r(16950),i=r(73951);class a{static _instance;_features={mutationObservers:!0,customElements:!0,slots:!0,steps:!0};_window=null;_compareCache;_rangeList;constructor(){this._compareCache=new n.CompareCache,this._rangeList=new n.FixedSizeSet}setFeatures(e){if(void 0===e&&(e=!0),(0,n.isObject)(e))for(let t in e)this._features[t]=e[t]||!1;else for(let t in this._features)this._features[t]=e}get features(){return this._features}get window(){return null===this._window&&(this._window=(0,i.create_window)()),this._window}get compareCache(){return this._compareCache}get rangeList(){return this._rangeList}static get instance(){return a._instance||(a._instance=new a),a._instance}}t.dom=a.instance},61052:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>A});var n,i=r(17042),a=r(11701),o=r(87352),s=r(47224),l=r(5889),u=r(72188),c=r(56929),d=r(53013),{Wrap:p,Filter:m}=l.Ay,{VtkDataTypes:h}=o.Ay,{vtkDebugMacro:f,vtkErrorMacro:g,vtkWarningMacro:v,requiredParam:y}=i.o$,{toHalf:b}=s.A,I={_openGLRenderWindow:null,_forceInternalFormat:!1,_prevTexParams:null,context:null,handle:0,sendParametersTime:null,textureBuildTime:null,numberOfDimensions:0,target:0,format:0,openGLDataType:0,components:0,width:0,height:0,depth:0,autoParameters:!0,wrapS:p.CLAMP_TO_EDGE,wrapT:p.CLAMP_TO_EDGE,wrapR:p.CLAMP_TO_EDGE,minificationFilter:m.NEAREST,magnificationFilter:m.NEAREST,minLOD:-1e3,maxLOD:1e3,baseLevel:0,maxLevel:1e3,generateMipmap:!1,oglNorm16Ext:null,allocatedGPUMemoryInBytes:0,enableUseHalfFloat:!0,canUseHalfFloat:!1};function x(e,t,r={}){Object.assign(t,I,r),u.A.extend(e,t,r),t.sendParametersTime={},(0,i.WL)(t.sendParametersTime,{mtime:0}),t.textureBuildTime={},(0,i.WL)(t.textureBuildTime,{mtime:0}),(0,i.Ak)(e,t,["format","openGLDataType"]),(0,i.V0)(e,t,["keyMatrixTime","minificationFilter","magnificationFilter","wrapS","wrapT","wrapR","generateMipmap","oglNorm16Ext"]),(0,i.Jt)(e,t,["width","height","volumeInfo","components","handle","target","allocatedGPUMemoryInBytes"]),(0,i.Vy)(e,t,["openGLRenderWindow"]),function(e,t){function r(){return{internalFormat:t.internalFormat,format:t.format,openGLDataType:t.openGLDataType,width:t.width,height:t.height}}t.classHierarchy.push("vtkOpenGLTexture"),e.render=(r=null)=>{if(r?t._openGLRenderWindow=r:(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getLastAncestorOfType("vtkOpenGLRenderWindow")),t.context=t._openGLRenderWindow.getContext(),t.renderable.getInterpolate()?(t.generateMipmap?e.setMinificationFilter(m.LINEAR_MIPMAP_LINEAR):e.setMinificationFilter(m.LINEAR),e.setMagnificationFilter(m.LINEAR)):(e.setMinificationFilter(m.NEAREST),e.setMagnificationFilter(m.NEAREST)),t.renderable.getRepeat()&&(e.setWrapR(p.REPEAT),e.setWrapS(p.REPEAT),e.setWrapT(p.REPEAT)),t.renderable.getInputData()&&t.renderable.setImage(null),!t.handle||t.renderable.getMTime()>t.textureBuildTime.getMTime()){if(null!==t.renderable.getImageBitmap()&&(t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(m.LINEAR_MIPMAP_LINEAR)),t.renderable.getImageBitmap()&&t.renderable.getImageLoaded()&&(e.create2DFromImageBitmap(t.renderable.getImageBitmap()),e.activate(),e.sendParameters(),t.textureBuildTime.modified())),null!==t.renderable.getImage()&&(t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(m.LINEAR_MIPMAP_LINEAR)),t.renderable.getImage()&&t.renderable.getImageLoaded()&&(e.create2DFromImage(t.renderable.getImage()),e.activate(),e.sendParameters(),t.textureBuildTime.modified())),null!==t.renderable.getCanvas()){t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(m.LINEAR_MIPMAP_LINEAR));let r=t.renderable.getCanvas();e.create2DFromRaw({width:r.width,height:r.height,numComps:4,dataType:h.UNSIGNED_CHAR,data:r,flip:!0}),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}if(null!==t.renderable.getJsImageData()){let r=t.renderable.getJsImageData();t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(m.LINEAR_MIPMAP_LINEAR)),e.create2DFromRaw({width:r.width,height:r.height,numComps:4,dataType:h.UNSIGNED_CHAR,data:r.data,flip:!0}),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}let r=t.renderable.getInputData(0);if(r&&r.getPointData().getScalars()){let n=r.getExtent(),i=r.getPointData().getScalars(),a=[];for(let e=0;e{if(t.minificationFilter!==m.LINEAR&&t.magnificationFilter!==m.LINEAR||(void 0===n&&(n=function(){try{let e=new Int16Array([0,32767]),t=document.createElement("canvas");t.width=4,t.height=4;let r=t.getContext("webgl2");if(!r)return!1;let n=r.getExtension("EXT_texture_norm16");if(!n)return!1;let i=`#version 300 es + void main() { + gl_PointSize = 4.0; + gl_Position = vec4(0, 0, 0, 1); + } + `,a=`#version 300 es + precision highp float; + precision highp int; + precision highp sampler2D; + + uniform sampler2D u_image; + + out vec4 color; + + void main() { + vec4 intColor = texture(u_image, gl_PointCoord.xy); + color = vec4(vec3(intColor.rrr), 1); + } + `,o=r.createShader(r.VERTEX_SHADER);if(r.shaderSource(o,i),r.compileShader(o),!r.getShaderParameter(o,r.COMPILE_STATUS))return!1;let s=r.createShader(r.FRAGMENT_SHADER);if(r.shaderSource(s,a),r.compileShader(s),!r.getShaderParameter(s,r.COMPILE_STATUS))return!1;let l=r.createProgram();if(r.attachShader(l,o),r.attachShader(l,s),r.linkProgram(l),!r.getProgramParameter(l,r.LINK_STATUS))return!1;let u=r.createTexture();r.bindTexture(r.TEXTURE_2D,u),r.texImage2D(r.TEXTURE_2D,0,n.R16_SNORM_EXT,2,1,0,r.RED,r.SHORT,e),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.useProgram(l),r.drawArrays(r.POINTS,0,1);let c=new Uint8Array(4);r.readPixels(1,1,1,1,r.RGBA,r.UNSIGNED_BYTE,c);let[d,p,m]=c,h=r.getExtension("WEBGL_lose_context");return h&&h.loseContext(),d===p&&p===m&&0!==d}catch(e){return!1}}()),n))return t.oglNorm16Ext};function u(e){let[t,r,n,i,a,o]=e;return[r-t+1,i-n+1,o-a+1]}function c(e){let[t,r,n]=u(e);return t*r*n}function I(e,r,n=null){let i=new(n||e.constructor)(r.reduce((e,t)=>e+c(t),0)),a=[t.width,t.height,t.depth],o=0;return r.forEach(t=>{!function(e,t,r,n,i){let[a,o,s,l,u,c]=r,[d,p]=t,m=d*p,h=i;for(let t=u;t<=c;t++){let r=t*m;for(let t=s;t<=l;t++){let i=r+t*d;for(let t=i+a,r=i+o;t<=r;t++,h++)n[h]=e[t]}}}(e,a,t,i,o),o+=c(t)}),i}function x(e){if(t._openGLRenderWindow.getWebgl2())return e;let r=[],n=t.width,i=t.height,o=t.components;if(e&&(!(0,a.r6)(n)||!(0,a.r6)(i))){let l=t.context.getExtension("OES_texture_half_float"),u=(0,a.tP)(n),c=(0,a.tP)(i),d=u*c*t.components;for(let a=0;a=i&&(d=i-1);let g=l-c,v=1-g;c=c*n*o,d=d*n*o;for(let t=0;t=n&&(m=n-1);let y=l-u;u*=o,m*=o;for(let t=0;t2048||i<-2048||i>2048)return!1}return!0}(n,i)||a,s=!1;if(t._openGLRenderWindow.getWebgl2())s=t.openGLDataType===t.context.FLOAT&&null===t.context.getExtension("OES_texture_float_linear")&&o||t.openGLDataType===t.context.HALF_FLOAT;else{let e=t.context.getExtension("OES_texture_half_float");s=e&&t.openGLDataType===e.HALF_FLOAT_OES}t.canUseHalfFloat=s&&o}(a,u.offset,u.scale,n),e.useHalfFloat()||e.getOpenGLDataType(a,!0),{numComps:i,dataType:a,data:o,scaleOffsets:u}}e.destroyTexture=()=>{e.deactivate(),t.context&&t.handle&&t.context.deleteTexture(t.handle),t._prevTexParams=null,t.handle=0,t.numberOfDimensions=0,t.target=0,t.components=0,t.width=0,t.height=0,t.depth=0,e.resetFormatAndType()},e.createTexture=()=>{!t.handle&&(t.handle=t.context.createTexture(),t.target&&(t.context.bindTexture(t.target,t.handle),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.bindTexture(t.target,null)))},e.getTextureUnit=()=>t._openGLRenderWindow?t._openGLRenderWindow.getTextureUnitForTexture(e):-1,e.activate=()=>{t._openGLRenderWindow.activateTexture(e),e.bind()},e.deactivate=()=>{t._openGLRenderWindow&&t._openGLRenderWindow.deactivateTexture(e)},e.releaseGraphicsResources=r=>{r&&t.handle&&(r.activateTexture(e),r.deactivateTexture(e),t.context.deleteTexture(t.handle),t._prevTexParams=null,t.handle=0,t.numberOfDimensions=0,t.target=0,t.internalFormat=0,t.format=0,t.openGLDataType=0,t.components=0,t.width=0,t.height=0,t.depth=0,t.allocatedGPUMemoryInBytes=0),t.shaderProgram&&(t.shaderProgram.releaseGraphicsResources(r),t.shaderProgram=null)},e.bind=()=>{t.context.bindTexture(t.target,t.handle),t.autoParameters&&e.getMTime()>t.sendParametersTime.getMTime()&&e.sendParameters()},e.isBound=()=>{let e=!1;if(t.context&&t.handle){let r=0;t.target===t.context.TEXTURE_2D?r=t.context.TEXTURE_BINDING_2D:v("impossible case"),e=t.context.getIntegerv(r)===t.handle}return e},e.sendParameters=()=>{t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t._openGLRenderWindow.getWebgl2()&&(t.context.texParameteri(t.target,t.context.TEXTURE_BASE_LEVEL,t.baseLevel),t.context.texParameteri(t.target,t.context.TEXTURE_MAX_LEVEL,t.maxLevel)),t.sendParametersTime.modified()},e.getInternalFormat=(r,n)=>(t._forceInternalFormat||(t.internalFormat=e.getDefaultInternalFormat(r,n)),t.internalFormat||f(`Unable to find suitable internal format for T=${r} NC= ${n}`),[t.context.R32F,t.context.RG32F,t.context.RGB32F,t.context.RGBA32F].includes(t.internalFormat)&&!t.context.getExtension("OES_texture_float_linear")&&v("Failed to load OES_texture_float_linear. Texture filtering is not available for *32F internal formats."),t.internalFormat),e.getDefaultInternalFormat=(r,n)=>{let i=0;return(i=t._openGLRenderWindow.getDefaultTextureInternalFormat(r,n,l(),e.useHalfFloat()))||i||(f("Unsupported internal texture type!"),f(`Unable to find suitable internal format for T=${r} NC= ${n}`)),i},e.useHalfFloat=()=>t.enableUseHalfFloat&&t.canUseHalfFloat,e.setInternalFormat=r=>{t._forceInternalFormat=!0,r!==t.internalFormat&&(t.internalFormat=r,e.modified())},e.getFormat=(r,n)=>(t.format=e.getDefaultFormat(r,n),t.format),e.getDefaultFormat=(e,r)=>{if(t._openGLRenderWindow.getWebgl2())switch(r){case 1:return t.context.RED;case 2:return t.context.RG;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}switch(r){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}},e.resetFormatAndType=()=>{t._prevTexParams=null,t.format=0,t.internalFormat=0,t._forceInternalFormat=!1,t.openGLDataType=0},e.getDefaultDataType=r=>{let n=e.useHalfFloat();if(t._openGLRenderWindow.getWebgl2())switch(r){case h.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case l()&&!n&&h.SHORT:return t.context.SHORT;case l()&&!n&&h.UNSIGNED_SHORT:return t.context.UNSIGNED_SHORT;case n&&h.SHORT:case n&&h.UNSIGNED_SHORT:return t.context.HALF_FLOAT;case h.FLOAT:case h.VOID:default:return t.context.FLOAT}switch(r){case h.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case h.FLOAT:case h.VOID:default:if(t.context.getExtension("OES_texture_float")&&t.context.getExtension("OES_texture_float_linear"))return t.context.FLOAT;{let e=t.context.getExtension("OES_texture_half_float");if(e&&t.context.getExtension("OES_texture_half_float_linear"))return e.HALF_FLOAT_OES}return t.context.UNSIGNED_BYTE}},e.getOpenGLDataType=(r,n=!1)=>((!t.openGLDataType||n)&&(t.openGLDataType=e.getDefaultDataType(r)),t.openGLDataType),e.getShiftAndScale=()=>{let e=0,r=1;switch(t.openGLDataType){case t.context.BYTE:e=(r=127.5)-128;break;case t.context.UNSIGNED_BYTE:r=255,e=0;break;case t.context.SHORT:e=(r=32767.5)-32768;break;case t.context.UNSIGNED_SHORT:r=65536,e=0;break;case t.context.INT:e=(r=2147483647.5)-0x80000000;break;case t.context.UNSIGNED_INT:r=0xffffffff,e=0;case t.context.FLOAT:}return{shift:e,scale:r}},e.getOpenGLFilterMode=e=>{switch(e){case m.NEAREST:return t.context.NEAREST;case m.LINEAR:return t.context.LINEAR;case m.NEAREST_MIPMAP_NEAREST:return t.context.NEAREST_MIPMAP_NEAREST;case m.NEAREST_MIPMAP_LINEAR:return t.context.NEAREST_MIPMAP_LINEAR;case m.LINEAR_MIPMAP_NEAREST:return t.context.LINEAR_MIPMAP_NEAREST;case m.LINEAR_MIPMAP_LINEAR:return t.context.LINEAR_MIPMAP_LINEAR;default:return t.context.NEAREST}},e.getOpenGLWrapMode=e=>{switch(e){case p.CLAMP_TO_EDGE:return t.context.CLAMP_TO_EDGE;case p.REPEAT:return t.context.REPEAT;case p.MIRRORED_REPEAT:return t.context.MIRRORED_REPEAT;default:return t.context.CLAMP_TO_EDGE}},e.updateArrayDataTypeForGL=(e,r,n=!1,i=[])=>{let a=[],o=t.width*t.height*t.components;n&&(o*=t.depth);let s=!!i.length;if(e!==h.FLOAT&&t.openGLDataType===t.context.FLOAT)for(let e=0;eo?r[e].subarray(0,o):r[e];a.push(new Float32Array(t))}else a.push(null);if(e!==h.UNSIGNED_CHAR&&t.openGLDataType===t.context.UNSIGNED_BYTE)for(let e=0;eo?r[e].subarray(0,o):r[e];a.push(new Uint8Array(t))}else a.push(null);let l=!1;if(t._openGLRenderWindow.getWebgl2())l=t.openGLDataType===t.context.HALF_FLOAT;else{let e=t.context.getExtension("OES_texture_half_float");l=e&&t.openGLDataType===e.HALF_FLOAT_OES}if(l)for(let e=0;e{if(e.getOpenGLDataType(a,!0),e.getInternalFormat(a,i),e.getFormat(a,i),!t.internalFormat||!t.format||!t.openGLDataType)return g("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=i,t.width=r,t.height=n,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();let u=x(e.updateArrayDataTypeForGL(a,[o]));return t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,s),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),C(a)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=u[0]&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,u[0])):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,u[0]),t.generateMipmap&&t.context.generateMipmap(t.target),s&&t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,!1),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*i*t._openGLRenderWindow.getDefaultTextureByteSize(a,l(),e.useHalfFloat()),e.deactivate(),!0},e.createCubeFromRaw=({width:r=y("width"),height:n=y("height"),numComps:a=y("numComps"),dataType:o=y("dataType"),data:s=y("data")}={})=>{if(e.getOpenGLDataType(o),e.getInternalFormat(o,a),e.getFormat(o,a),!t.internalFormat||!t.format||!t.openGLDataType)return g("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_CUBE_MAP,t.components=a,t.width=r,t.height=n,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),t.maxLevel=s.length/6-1,e.createTexture(),e.bind();let u=x(e.updateArrayDataTypeForGL(o,s)),c=[],d=t.width,p=t.height;for(let e=0;e=1&&i>=1;){let a=null;r<=t.maxLevel&&(a=c[6*r+e]),C(o)?null!=a&&t.context.texSubImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,r,0,0,n,i,t.format,t.openGLDataType,a):t.context.texImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,r,t.internalFormat,n,i,0,t.format,t.openGLDataType,a),r++,n/=2,i/=2}}return t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*a*t._openGLRenderWindow.getDefaultTextureByteSize(o,l(),e.useHalfFloat()),e.deactivate(),!0},e.createDepthFromRaw=({width:r=y("width"),height:n=y("height"),dataType:i=y("dataType"),data:a=y("data")}={})=>(e.getOpenGLDataType(i),t.format=t.context.DEPTH_COMPONENT,t._openGLRenderWindow.getWebgl2()?i===h.FLOAT?t.internalFormat=t.context.DEPTH_COMPONENT32F:t.internalFormat=t.context.DEPTH_COMPONENT16:t.internalFormat=t.context.DEPTH_COMPONENT,t.internalFormat&&t.format&&t.openGLDataType)?(t.target=t.context.TEXTURE_2D,t.components=1,t.width=r,t.height=n,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),C(i)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=a&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,a)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,a),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(i,l(),e.useHalfFloat()),e.deactivate(),!0):(g("Failed to determine texture parameters."),!1),e.create2DFromImage=r=>{if(e.getOpenGLDataType(h.UNSIGNED_CHAR),e.getInternalFormat(h.UNSIGNED_CHAR,4),e.getFormat(h.UNSIGNED_CHAR,4),!t.internalFormat||!t.format||!t.openGLDataType)return g("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=4,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();let n=!t._openGLRenderWindow.getWebgl2()&&(!(0,a.r6)(r.width)||!(0,a.r6)(r.height)),i=r,o=r.width,s=r.height,u=!0,c=window.chrome;if(n||c){let e=new OffscreenCanvas((0,a.tP)(r.width),(0,a.tP)(r.height));o=e.width,s=e.height;let t=e.getContext("2d");t.translate(0,e.height),t.scale(1,-1),t.drawImage(r,0,0,r.width,r.height,0,0,e.width,e.height),i=e,u=!1}return t.width=o,t.height=s,t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,u),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),C(h.UNSIGNED_CHAR)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,i)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,i),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(h.UNSIGNED_CHAR,l(),e.useHalfFloat()),e.deactivate(),!0},e.create2DFromImageBitmap=r=>(e.getOpenGLDataType(h.UNSIGNED_CHAR),e.getInternalFormat(h.UNSIGNED_CHAR,4),e.getFormat(h.UNSIGNED_CHAR,4),t.internalFormat&&t.format&&t.openGLDataType)?(t.target=t.context.TEXTURE_2D,t.components=4,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),t.width=r.width,t.height=r.height,C(h.UNSIGNED_CHAR)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,r)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,r),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(h.UNSIGNED_CHAR,l(),e.useHalfFloat()),e.deactivate(),!0):(g("Failed to determine texture parameters."),!1),e.create2DFilterableFromRaw=({width:t=y("width"),height:r=y("height"),numComps:n=y("numComps"),dataType:i=y("dataType"),data:a=y("data"),preferSizeOverAccuracy:s=!1,ranges:l}={})=>e.create2DFilterableFromDataArray({width:t,height:r,dataArray:o.Ay.newInstance({numberOfComponents:n,dataType:i,values:a,ranges:l}),preferSizeOverAccuracy:s}),e.create2DFilterableFromDataArray=({width:t=y("width"),height:r=y("height"),dataArray:n=y("dataArray"),preferSizeOverAccuracy:i=!1}={})=>{let{numComps:a,dataType:o,data:s}=A(n,i);e.create2DFromRaw({width:t,height:r,numComps:a,dataType:o,data:s})},e.updateVolumeInfoForGL=(r,n)=>{let i=!1,a=e.useHalfFloat();t.volumeInfo?.scale&&t.volumeInfo?.offset||(t.volumeInfo={scale:Array(n),offset:Array(n)});for(let e=0;e{let f=s,v=p;if(!e.updateVolumeInfoForGL(f,o)&&v){let e=n*i*a,r=structuredClone(t.volumeInfo),s=new Float32Array(e*o);t.volumeInfo.offset=r.offset,t.volumeInfo.scale=r.scale;let l=0,u=r.scale.map(e=>1/e);for(let t=0;t0,I=!b||!d(t._prevTexParams,r()),A=[v],T=x(e.updateArrayDataTypeForGL(f,A,!0,I?[]:m));if(t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),I)C(f)?(t.context.texStorage3D(t.target,1,t.internalFormat,t.width,t.height,t.depth),null!=T[0]&&t.context.texSubImage3D(t.target,0,0,0,0,t.width,t.height,t.depth,t.format,t.openGLDataType,T[0])):t.context.texImage3D(t.target,0,t.internalFormat,t.width,t.height,t.depth,0,t.format,t.openGLDataType,T[0]),t._prevTexParams=r();else if(b){let e=T[0],r=0;for(let n=0;ne.create3DFilterableFromDataArray({width:t,height:r,depth:n,dataArray:o.Ay.newInstance({numberOfComponents:i,dataType:a,values:s,ranges:u}),preferSizeOverAccuracy:l,updatedExtents:c}),e.create3DFilterableFromDataArray=({width:r=y("width"),height:n=y("height"),depth:i=y("depth"),dataArray:o=y("dataArray"),preferSizeOverAccuracy:s=!1,updatedExtents:l=[]}={})=>{let u,{numComps:c,dataType:d,data:p,scaleOffsets:m}=A(o,s),f=[],v=[];for(let e=0;e{e[t]=r},T=h.UNSIGNED_CHAR;if(d===h.UNSIGNED_CHAR)for(let e=0;e{e[t]=(r-n)/i}):(T=h.UNSIGNED_CHAR,x=(e,t,r,n,i)=>{e[t]=255*(r-n)/i});if(e.getOpenGLDataType(T),e.getInternalFormat(T,c),e.getFormat(T,c),!t.internalFormat||!t.format||!t.openGLDataType)return g("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=c,t.depth=1,t.numberOfDimensions=2;let S=t.context.getParameter(t.context.MAX_TEXTURE_SIZE);S>4096&&(T===h.FLOAT||c>=3)&&(S=4096);let w=1,O=1;b>S*S&&(O=w=Math.ceil(Math.sqrt(b/(S*S))));let P=Math.sqrt(b)/w,_=Math.floor((P=(0,a.tP)(P))*w/r),E=Math.ceil(i/_),D=(0,a.tP)(n*E/O);t.width=P,t.height=D,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.volumeInfo.xreps=_,t.volumeInfo.yreps=E,t.volumeInfo.xstride=w,t.volumeInfo.ystride=O,t.volumeInfo.offset=I.offset,t.volumeInfo.scale=I.scale;let R=P*D*c;u=T===h.FLOAT?new Float32Array(R):new Uint8Array(R);let M=0,N=Math.floor(r/w),V=Math.floor(n/O);for(let e=0;e{t._openGLRenderWindow!==r&&(e.releaseGraphicsResources(),t._openGLRenderWindow=r,t.context=null,r&&(t.context=t._openGLRenderWindow.getContext()))},e.getMaximumTextureSize=e=>e&&e.isCurrent()?e.getIntegerv(e.MAX_TEXTURE_SIZE):-1,e.enableUseHalfFloat=e=>{t.enableUseHalfFloat=e}}(e,t)}var C=(0,i.UI)(x,"vtkOpenGLTexture"),A={newInstance:C,extend:x,...l.Ay};(0,c.c9)("vtkTexture",C)},61101:(e,t,r)=>{"use strict";r.d(t,{S:()=>g});var n,i,a,o=r(27501),s=r(63701),l=r(59061),u=r(96674),c=r(41105),d=r(31167),p=r(50923),m=r(97633),h=r(68742);function f(e){for(let t=0,r=e.length;t{let r=e[0],n=t[e[0]],i=t[e[1]],a=(0,h.A)(m,v,n,i),s=o.A(m,a);return{sourceLineSegmentId:r,coordinate:a,targetStartPointDistSquared:s}});y.sort((e,t)=>e.targetStartPointDistSquared-t.targetStartPointDistSquared),y.forEach(e=>{let{sourceLineSegmentId:t,coordinate:o}=e,s={type:n.Intersection,coordinates:o,position:i.Edge,direction:d,visited:!1,next:null},l={...s,direction:a.Unknown,cloned:!0};d===a.Entering?s.next=l:l.next=s;let u=c.get(t);u||(u=[],c.set(t,u)),r.push(s),u.push(l),d*=-1})}for(let e=0,r=t.length;e({intersectionPoint:e,lineSegStartDistSquared:o.A(i,e.coordinates)})).sort((e,t)=>e.lineSegStartDistSquared-t.lineSegStartDistSquared).map(({intersectionPoint:e})=>e).forEach(e=>u.push(e))}return f(r),f(u),{targetPolylinePoints:r,sourcePolylinePoints:u}}(e,t),b=function(e){for(let t=0,r=e.length;t=A&&console.warn("Maximum iterations reached in mergePolylines, possible infinite loop detected"),I}!function(e){e[e.Vertex=0]="Vertex",e[e.Intersection=1]="Intersection"}(n||(n={})),function(e){e[e.Outside=-1]="Outside",e[e.Edge=0]="Edge",e[e.Inside=1]="Inside"}(i||(i={})),function(e){e[e.Exiting=-1]="Exiting",e[e.Unknown=0]="Unknown",e[e.Entering=1]="Entering"}(a||(a={}))},61190:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(91336),i=r(59061),a=r(31677),o=r(7399);function s(e,t){if(e.length<3||t.length<3)return[];let r=t.slice(),s=(0,a.A)(e),l=(0,a.A)(r);if(Math.abs(s)(0,i.A)(u,e))?[[...e.map(e=>[...e])]]:(0,i.A)(e,r[0])&&r.every(t=>(0,i.A)(e,t))?[[...r.map(e=>[...e])]]:[];let d=(e,t,r)=>{let n=[],i=0;for(let a=0;a(0===t?e.seg1Idx:e.seg2Idx)===a).sort((e,r)=>(0===t?e.alpha1:e.alpha2)-(0===t?r.alpha1:r.alpha2)))){if(n.length>0&&(0,o.Sk)(n[n.length-1].coordinates,e.coord)){let r=n[n.length-1];r.isIntersection||(r.isIntersection=!0,r.intersectionInfo=e,r.alpha=0===t?e.alpha1:e.alpha2,r.type=o.n7.Intersection);continue}n.push({id:`${t}_i${i++}`,coordinates:[...e.coord],type:o.n7.Intersection,originalPolyIndex:t,next:null,prev:null,isIntersection:!0,visited:!1,processedInPath:!1,alpha:0===t?e.alpha1:e.alpha2,intersectionInfo:e,intersectionDir:o.lG.Unknown})}}let a=[];if(n.length>0){a.push(n[0]);for(let e=1;e1&&(0,o.Sk)(a[0].coordinates,a[a.length-1].coordinates)){let e=a[0],t=a.pop();t.isIntersection&&!e.isIntersection&&t.intersectionInfo&&(e.isIntersection=!0,e.intersectionInfo=t.intersectionInfo,e.alpha=t.alpha,e.type=o.n7.Intersection)}if(a.length>0)for(let e=0;e{if(e.isIntersection&&e.intersectionInfo){let t=e.intersectionInfo,r=m.find(r=>r.isIntersection&&r.intersectionInfo&&(0,o.Sk)(r.coordinates,e.coordinates)&&r.intersectionInfo.seg1Idx===t.seg1Idx&&r.intersectionInfo.seg2Idx===t.seg2Idx);if(r){e.partnerNode=r,r.partnerNode=e;let t=n.Re(n.vt(),e.coordinates,e.prev.coordinates),a=n.Re(n.vt(),r.next.coordinates,r.coordinates),s=t[0]*a[1]-t[1]*a[0];if(s>o.p8)e.intersectionDir=o.lG.Entering,r.intersectionDir=o.lG.Exiting;else if(s<-o.p8)e.intersectionDir=o.lG.Exiting,r.intersectionDir=o.lG.Entering;else{let t=[(e.prev.coordinates[0]+e.coordinates[0])/2,(e.prev.coordinates[1]+e.coordinates[1])/2];(0,i.A)(u,t)?(e.intersectionDir=o.lG.Exiting,r.intersectionDir=o.lG.Entering):(e.intersectionDir=o.lG.Entering,r.intersectionDir=o.lG.Exiting)}}else e.isIntersection=!1,e.intersectionInfo=void 0}});let h=[];for(let e of p){if(!e.isIntersection||e.visited||e.intersectionDir!==o.lG.Entering)continue;let t=[],r=e,n=!0,i=0,l=(p.length+m.length)*2;p.forEach(e=>e.processedInPath=!1),m.forEach(e=>e.processedInPath=!1);do{if(i++>l){console.warn("Intersection: Max iterations in path tracing.",e.id,r.id),t=[];break}if(r.processedInPath&&r!==e){console.warn("Intersection: Path processing loop detected, discarding path segment.",e.id,r.id),t=[];break}r.processedInPath=!0,r.visited=!0,0!==t.length&&(0,o.Sk)(t[t.length-1],r.coordinates)||t.push([...r.coordinates]);r.isIntersection&&r.partnerNode&&(n?(r=r.partnerNode,n=!1):(r=r.partnerNode,n=!0)),r=r.next}while(r!==e||n&&0!==r.originalPolyIndex||!n&&1!==r.originalPolyIndex);if(i>l||0===t.length||t.length>0&&(0,o.Sk)(t[0],t[t.length-1])&&t.pop(),t.length>=3){let e=(0,a.A)(t);s>0&&e<0?t.reverse():s<0&&e>0&&t.reverse(),h.push(t.map(e=>[...e]))}}return h}},61267:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SlotableImpl=void 0;let n=r(47518);class i{__name;__assignedSlot;get _name(){return this.__name||""}set _name(e){this.__name=e}get _assignedSlot(){return this.__assignedSlot||null}set _assignedSlot(e){this.__assignedSlot=e}get assignedSlot(){return(0,n.shadowTree_findASlot)(this,!0)}}t.SlotableImpl=i},61273:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MutationRecordImpl=void 0;class r{_type;_target;_addedNodes;_removedNodes;_previousSibling;_nextSibling;_attributeName;_attributeNamespace;_oldValue;constructor(e,t,r,n,i,a,o,s,l){this._type=e,this._target=t,this._addedNodes=r,this._removedNodes=n,this._previousSibling=i,this._nextSibling=a,this._attributeName=o,this._attributeNamespace=s,this._oldValue=l}get type(){return this._type}get target(){return this._target}get addedNodes(){return this._addedNodes}get removedNodes(){return this._removedNodes}get previousSibling(){return this._previousSibling}get nextSibling(){return this._nextSibling}get attributeName(){return this._attributeName}get attributeNamespace(){return this._attributeNamespace}get oldValue(){return this._oldValue}static _create(e,t,n,i,a,o,s,l,u){return new r(e,t,n,i,a,o,s,l,u)}}t.MutationRecordImpl=r},61310:(e,t,r)=>{"use strict";r.d(t,{j:()=>u,h:()=>c});var n=r(7286),i=r(56872),a=r(98197),o=r(20556);class s{async addData(e,t,r){let n=document.createElement("video");n.src=t.renderedUrl,n.preload="auto",n.crossOrigin="anonymous",n.playsInline=!0,n.style.position="absolute",n.style.left="0",n.style.top="0",n.style.transformOrigin="top left",n.style.objectFit="fill",await new Promise(t=>{let r=()=>{n.removeEventListener("loadedmetadata",r),t()};n.addEventListener("loadedmetadata",r),e.element.appendChild(n)});let i=(0,a.normalizeVideoPlaybackInfo)({durationSeconds:n.duration,cineRate:t.fps,numberOfFrames:t.numberOfFrames}),o={...t,durationSeconds:n.duration,fps:i.fps,numberOfFrames:i.numberOfFrames,frameRange:i.frameRange};Object.assign(t,o);let s={renderMode:"video2d",element:n};return{rendering:s,updateDataPresentation:e=>{this.updateDataPresentation(s,e)},applyViewState:e=>{this.applyViewState(s,e,t)},getFrameOfReferenceUID:()=>this.getFrameOfReferenceUID(s),removeData:()=>{this.removeData(s)}}}updateDataPresentation(e,t){let{element:r}=e;r.style.display=t?.visible===!1?"none":"",r.style.opacity=String(t?.opacity??1),r.loop=t?.loop??!0,r.muted=t?.muted??!0,r.playbackRate=t?.playbackRate??1,r.style.objectFit=t?.objectFit??"contain"}applyViewState(e,t,r){let{element:n}=e,i=t.rotation??0,a=this.getCanvasMapping(n,t);e.currentCamera=t,a&&(n.style.width=`${a.width}px`,n.style.height=`${a.height}px`,n.style.left=`${a.left}px`,n.style.top=`${a.top}px`),n.style.transform=`rotate(${i}deg)`,"number"==typeof t.currentTimeSeconds&&Math.abs(n.currentTime-t.currentTimeSeconds)>.5/Math.max(1,r.fps)&&(n.currentTime=t.currentTimeSeconds)}canvasToWorld(e,t){let r=this.getCanvasMapping(e.element,e.currentCamera);return r?[(t[0]-r.left)/r.worldToCanvasRatio,(t[1]-r.top)/r.worldToCanvasRatio,0]:[0,0,0]}worldToCanvas(e,t){let r=this.getCanvasMapping(e.element,e.currentCamera);return r?[r.left+t[0]*r.worldToCanvasRatio,r.top+t[1]*r.worldToCanvasRatio]:[0,0]}getCanvasMapping(e,t){let r=e.parentElement;return(0,o.ak)({containerWidth:r?.clientWidth??0,containerHeight:r?.clientHeight??0,intrinsicWidth:e.videoWidth||r?.clientWidth||0,intrinsicHeight:e.videoHeight||r?.clientHeight||0,objectFit:e.style.objectFit,camera:t})}getFrameOfReferenceUID(e){let{element:t}=e;return t.currentSrc||t.src}removeData(e){let{element:t}=e;t.pause(),t.remove()}}class l{constructor(){this.id="video:html-element",this.type=i.A.VIDEO_NEXT}matches(e,t){return"video"===e.type&&"video2d"===t.renderMode}createRenderPath(){return new s}}function u(){return[new l]}function c(e=u()){return new n.r(e)}},61416:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.range_collapsed=m,t.range_root=h,t.range_isContained=f,t.range_isPartiallyContained=g,t.range_setTheStart=function(e,t,r){if(a.Guard.isDocumentTypeNode(t))throw new i.InvalidNodeTypeError;if(r>(0,s.tree_nodeLength)(t))throw new i.IndexSizeError;let o=[t,r];(h(e)!==(0,s.tree_rootNode)(t)||(0,l.boundaryPoint_position)(o,e._end)===n.BoundaryPosition.After)&&(e._end=o),e._start=o},t.range_setTheEnd=function(e,t,r){if(a.Guard.isDocumentTypeNode(t))throw new i.InvalidNodeTypeError;if(r>(0,s.tree_nodeLength)(t))throw new i.IndexSizeError;let o=[t,r];(h(e)!==(0,s.tree_rootNode)(t)||(0,l.boundaryPoint_position)(o,e._start)===n.BoundaryPosition.Before)&&(e._start=o),e._end=o},t.range_select=function(e,t){let r=e._parent;if(null===r)throw new i.InvalidNodeTypeError;let n=(0,s.tree_index)(e);t._start=[r,n],t._end=[r,n+1]},t.range_extract=v,t.range_cloneTheContents=function e(t){let r=(0,o.create_documentFragment)(t._startNode._nodeDocument);if(m(t))return r;let n=t._startNode,l=t._startOffset,p=t._endNode,h=t._endOffset;if(n===p&&a.Guard.isCharacterDataNode(n)){let e=(0,c.node_clone)(n);e._data=(0,u.characterData_substringData)(n,l,h-l),(0,d.mutation_append)(e,r)}let y=n;for(;!(0,s.tree_isAncestorOf)(p,y,!0);){if(null===y._parent)throw Error("Parent node is null.");y=y._parent}let b=null;if(!(0,s.tree_isAncestorOf)(p,n,!0)){for(let e of y._children)if(g(e,t)){b=e;break}}let I=null;if(!(0,s.tree_isAncestorOf)(n,p,!0)){let e=[...y._children];for(let r=e.length-1;r>0;r--){let n=e[r];if(g(n,t)){I=n;break}}}let x=[];for(let e of y._children)if(f(e,t)){if(a.Guard.isDocumentTypeNode(e))throw new i.HierarchyRequestError;x.push(e)}if(a.Guard.isCharacterDataNode(b)){let e=(0,c.node_clone)(n);e._data=(0,u.characterData_substringData)(n,l,(0,s.tree_nodeLength)(n)-l),(0,d.mutation_append)(e,r)}else if(null!==b){let t=(0,c.node_clone)(b);(0,d.mutation_append)(t,r);let i=e((0,o.create_range)([n,l],[b,(0,s.tree_nodeLength)(b)]));(0,d.mutation_append)(i,t)}for(let e of x){let t=(0,c.node_clone)(e);(0,d.mutation_append)(t,r)}if(a.Guard.isCharacterDataNode(I)){let e=(0,c.node_clone)(p);e._data=(0,u.characterData_substringData)(p,0,h),(0,d.mutation_append)(e,r)}else if(null!==I){let e=(0,c.node_clone)(I);r.append(e);let t=v((0,o.create_range)([I,0],[p,h]));(0,d.mutation_append)(t,e)}return r},t.range_insert=function(e,t){let r;if(a.Guard.isProcessingInstructionNode(t._startNode)||a.Guard.isCommentNode(t._startNode)||a.Guard.isTextNode(t._startNode)&&null===t._startNode._parent||t._startNode===e)throw new i.HierarchyRequestError;let n=null;if(a.Guard.isTextNode(t._startNode))n=t._startNode;else{let e=0;for(let r of t._startNode._children){if(e===t._startOffset){n=r;break}e++}}if(null===n)r=t._startNode;else{if(null===n._parent)throw Error("Parent node is null.");r=n._parent}(0,d.mutation_ensurePreInsertionValidity)(e,r,n),a.Guard.isTextNode(t._startNode)&&(n=(0,p.text_split)(t._startNode,t._startOffset)),e===n&&(n=e._nextSibling),null!==e._parent&&(0,d.mutation_remove)(e,e._parent);let o=null===n?(0,s.tree_nodeLength)(r):(0,s.tree_index)(n);a.Guard.isDocumentFragmentNode(e)?o+=(0,s.tree_nodeLength)(e):o++,(0,d.mutation_preInsert)(e,r,n),m(t)&&(t._end=[r,o])},t.range_getContainedNodes=function(e){return{[Symbol.iterator]:()=>{let t=e.commonAncestorContainer,r=(0,s.tree_getFirstDescendantNode)(t);return{next:()=>{for(;r&&!f(r,e);)r=(0,s.tree_getNextDescendantNode)(t,r);if(null===r)return{done:!0,value:null};{let e={done:!1,value:r};return r=(0,s.tree_getNextDescendantNode)(t,r),e}}}}}},t.range_getPartiallyContainedNodes=function(e){return{[Symbol.iterator]:()=>{let t=e.commonAncestorContainer,r=(0,s.tree_getFirstDescendantNode)(t);return{next:()=>{for(;r&&!g(r,e);)r=(0,s.tree_getNextDescendantNode)(t,r);if(null===r)return{done:!0,value:null};{let e={done:!1,value:r};return r=(0,s.tree_getNextDescendantNode)(t,r),e}}}}}};let n=r(5309),i=r(32008),a=r(79663),o=r(73951),s=r(29963),l=r(65299),u=r(39246),c=r(26447),d=r(78742),p=r(84494);function m(e){return e._startNode===e._endNode&&e._startOffset===e._endOffset}function h(e){return(0,s.tree_rootNode)(e._startNode)}function f(e,t){return(0,s.tree_rootNode)(e)===h(t)&&(0,l.boundaryPoint_position)([e,0],t._start)===n.BoundaryPosition.After&&(0,l.boundaryPoint_position)([e,(0,s.tree_nodeLength)(e)],t._end)===n.BoundaryPosition.Before}function g(e,t){let r=(0,s.tree_isAncestorOf)(t._startNode,e,!0),n=(0,s.tree_isAncestorOf)(t._endNode,e,!0);return r&&!n||!r&&n}function v(e){let t,r,n=(0,o.create_documentFragment)(e._startNode._nodeDocument);if(m(e))return n;let l=e._startNode,p=e._startOffset,h=e._endNode,y=e._endOffset;if(l===h&&a.Guard.isCharacterDataNode(l)){let e=(0,c.node_clone)(l);return e._data=(0,u.characterData_substringData)(l,p,y-p),(0,d.mutation_append)(e,n),(0,u.characterData_replaceData)(l,p,y-p,""),n}let b=l;for(;!(0,s.tree_isAncestorOf)(h,b,!0);){if(null===b._parent)throw Error("Parent node is null.");b=b._parent}let I=null;if(!(0,s.tree_isAncestorOf)(h,l,!0)){for(let t of b._children)if(g(t,e)){I=t;break}}let x=null;if(!(0,s.tree_isAncestorOf)(l,h,!0)){let t=[...b._children];for(let r=t.length-1;r>0;r--){let n=t[r];if(g(n,e)){x=n;break}}}let C=[];for(let t of b._children)if(f(t,e)){if(a.Guard.isDocumentTypeNode(t))throw new i.HierarchyRequestError;C.push(t)}if((0,s.tree_isAncestorOf)(h,l,!0))t=l,r=p;else{let e=l;for(;null!==e._parent&&!(0,s.tree_isAncestorOf)(h,e._parent);)e=e._parent;if(null===e._parent)throw Error("Parent node is null.");t=e._parent,r=1+(0,s.tree_index)(e)}if(a.Guard.isCharacterDataNode(I)){let e=(0,c.node_clone)(l);e._data=(0,u.characterData_substringData)(l,p,(0,s.tree_nodeLength)(l)-p),(0,d.mutation_append)(e,n),(0,u.characterData_replaceData)(l,p,(0,s.tree_nodeLength)(l)-p,"")}else if(null!==I){let e=(0,c.node_clone)(I);(0,d.mutation_append)(e,n);let t=v((0,o.create_range)([l,p],[I,(0,s.tree_nodeLength)(I)]));(0,d.mutation_append)(t,e)}for(let e of C)(0,d.mutation_append)(e,n);if(a.Guard.isCharacterDataNode(x)){let e=(0,c.node_clone)(h);e._data=(0,u.characterData_substringData)(h,0,y),(0,d.mutation_append)(e,n),(0,u.characterData_replaceData)(h,0,y,"")}else if(null!==x){let e=(0,c.node_clone)(x);(0,d.mutation_append)(e,n);let t=v((0,o.create_range)([x,0],[h,y]));(0,d.mutation_append)(t,e)}return e._start=[t,r],e._end=[t,r],n}},62004:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>o.A,JG:()=>i.J,L0:()=>s,Xy:()=>i.X,cs:()=>a.c});var n=r(74832),i=r(22233),a=r(54763),o=r(21569);let s={adapter:n.c,getSnapshot:n.P}},62069:(e,t,r)=>{"use strict";let n=r(26735),i=r(50026);function a(e,t){let r=[];return e[t].forEach(function(e){let t=r.length;r.forEach(function(r,n){r.tag===e.tag&&r.kind===e.kind&&r.multi===e.multi&&(t=n)}),r[t]=e}),r}function o(e){return this.extend(e)}o.prototype.extend=function(e){let t=[],r=[];if(e instanceof i)r.push(e);else if(Array.isArray(e))r=r.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(r=r.concat(e.explicit));else throw new n("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.forEach(function(e){if(!(e instanceof i))throw new n("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new n("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new n("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(e){if(!(e instanceof i))throw new n("Specified list of YAML types (or a single Type object) contains a non-Type object.")});let s=Object.create(o.prototype);return s.implicit=(this.implicit||[]).concat(t),s.explicit=(this.explicit||[]).concat(r),s.compiledImplicit=a(s,"implicit"),s.compiledExplicit=a(s,"explicit"),s.compiledTypeMap=function(){let e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function t(t){t.multi?(e.multi[t.kind].push(t),e.multi.fallback.push(t)):e[t.kind][t.tag]=e.fallback[t.tag]=t}for(let e=0,r=arguments.length;e{"use strict";r.d(t,{A:()=>i});var n=r(78378);let i=e=>e.shiftKey?e.ctrlKey?n.qv.ShiftCtrl:e.altKey?n.qv.ShiftAlt:e.metaKey?n.qv.ShiftMeta:n.qv.Shift:e.ctrlKey?e.altKey?n.qv.CtrlAlt:e.metaKey?n.qv.CtrlMeta:n.qv.Ctrl:e.altKey?e.metaKey&&n.qv.AltMeta||n.qv.Alt:e.metaKey?n.qv.Meta:void 0},62207:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var n=r(70192),i=r(78378);function a(e){return[e[0],e[1],e[2]]}function o(e,t){return .001>Math.abs(e[0]-t[0])&&.001>Math.abs(e[1]-t[1])&&.001>Math.abs(e[2]-t[2])}class s{constructor(){this.strokePointsWorld=[],this.previewPoints=[],this.pendingPreviewCleanup=null}reset(){this.strokePointsWorld=[],this.previewPoints=[]}clearPendingCleanup(){this.pendingPreviewCleanup&&(n.tX.removeEventListener(i.sV.SEGMENTATION_RENDERED,this.pendingPreviewCleanup.listener),this.pendingPreviewCleanup=null)}appendStrokePoint(e){this.strokePointsWorld=function(e=[],t){return!t||e.length&&o(e[e.length-1],t)?e:[...e,a(t)]}(this.strokePointsWorld,e)}getStrokePointsWorld(){return this.strokePointsWorld}capturePreviewCircle(e){if(!e)return;let t=e.brushCursor?.data?.editPoints;this.previewPoints=function(e=[],t=[]){if(!t.length)return e;let r=t.map(e=>a(e));if(!e.length)return r;let n=e.slice(-r.length);return n.length===r.length&&n.every((e,t)=>o(e,r[t]))?e:[...e,...r]}(this.previewPoints,t),e.brushCursor.data.handles.points=this.previewPoints}scheduleCleanup({element:e,centerCanvas:t,viewportId:r,segmentationId:a,refreshCursor:o}){this.clearPendingCleanup();let s=n=>{let i=n.detail;i.viewportId===r&&i.segmentationId===a&&(this.clearPendingCleanup(),this.reset(),o(e,t))};this.pendingPreviewCleanup={viewportId:r,segmentationId:a,listener:s},n.tX.addEventListener(i.sV.SEGMENTATION_RENDERED,s)}}let l=s},62269:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>l});var n=r(17042),i=r(62807),{ObjectType:a}=i.A,o={objectType:a.ARRAY_BUFFER,context:null,allocatedGPUMemoryInBytes:0};function s(e,t,r={}){Object.assign(t,o,r),n.Ay.obj(e,t),n.Ay.get(e,t,["_openGLRenderWindow","allocatedGPUMemoryInBytes"]),n.Ay.moveToProtected(e,t,["openGLRenderWindow"]),function(e,t){function r(e){switch(e){case a.ELEMENT_ARRAY_BUFFER:return t.context.ELEMENT_ARRAY_BUFFER;case a.TEXTURE_BUFFER:if("TEXTURE_BUFFER"in t.context)return t.context.TEXTURE_BUFFER;case a.ARRAY_BUFFER:default:return t.context.ARRAY_BUFFER}}t.classHierarchy.push("vtkOpenGLBufferObject");let n=null,i=null,o=!0,s="";e.getType=()=>n,e.setType=e=>{n=e},e.getHandle=()=>i,e.isReady=()=>!1===o,e.generateBuffer=e=>{let a=r(e);return null===i&&(i=t.context.createBuffer(),n=e),r(n)===a},e.upload=(a,l)=>e.generateBuffer(l)?(t.context.bindBuffer(r(n),i),t.context.bufferData(r(n),a,t.context.STATIC_DRAW),t.allocatedGPUMemoryInBytes=a.length*a.BYTES_PER_ELEMENT,o=!1,!0):(s="Trying to upload array buffer to incompatible buffer.",!1),e.bind=()=>!!i&&(t.context.bindBuffer(r(n),i),!0),e.release=()=>!!i&&(t.context.bindBuffer(r(n),null),!0),e.releaseGraphicsResources=()=>{null!==i&&(t.context.bindBuffer(r(n),null),t.context.deleteBuffer(i),i=null,t.allocatedGPUMemoryInBytes=0)},e.setOpenGLRenderWindow=r=>{t._openGLRenderWindow!==r&&(e.releaseGraphicsResources(),t._openGLRenderWindow=r,t.context=null,r&&(t.context=t._openGLRenderWindow.getContext()))},e.getError=()=>s}(e,t)}var l={newInstance:n.Ay.newInstance(s),extend:s,...{},...i.A}},62347:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>u});var n=r(17042),i=r(72188),a=r(56929),o={context:null,activeTextures:null};function s(e,t,r={}){Object.assign(t,o,r),i.A.extend(e,t,r),(0,n.V0)(e,t,["context"]),(0,n.Jt)(e,t,["activeTextures"]),t.classHierarchy.push("vtkOpenGLActor2D"),e.buildPass=r=>{if(r&&t.renderable){t._openGLRenderWindow=e.getLastAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNodes(t.renderable.getTextures()),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes(),t.ogltextures=null,t.activeTextures=null;for(let e=0;e{e&&t.renderable&&t.renderable.getVisibility()&&r.incrementOverlayActorCount()},e.traverseOpaquePass=r=>{!(!t.oglmapper||!t.renderable||!t.renderable.getNestedVisibility()||!t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable())&&(e.apply(r,!0),t.oglmapper.traverse(r),e.apply(r,!1))},e.traverseTranslucentPass=r=>{!t.oglmapper||!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(r,!0),t.oglmapper.traverse(r),e.apply(r,!1))},e.traverseOverlayPass=r=>{!t.oglmapper||!t.renderable||!t.renderable.getNestedVisibility()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable||(e.apply(r,!0),t.oglmapper.traverse(r),e.apply(r,!1))},e.activateTextures=()=>{if(t.ogltextures){t.activeTextures=[];for(let e=0;e{if(r)t.context.depthMask(!0),e.activateTextures();else{if(t.activeTextures)for(let e=0;e{if(r)t.context.depthMask(!1),e.activateTextures();else{if(t.activeTextures)for(let e=0;e{if(r)t.context.depthMask(!0),e.activateTextures();else{if(t.activeTextures)for(let e=0;e{"use strict";r.d(t,{A:()=>i});var n=r(56109);function i(e){let t=n.Ay.newInstance(),r=0,i=1024;return void 0!==e.lower&&void 0!==e.upper&&(r=e.lower,i=e.upper),t.addRGBPoint(r,0,0,0),t.addRGBPoint(i,1,1,1),t}},62521:e=>{!function(){"use strict";var t={815:function(e){e.exports=function(e,r,n,i){r=r||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var o=/\+/g;e=e.split(r);var s=1e3;i&&"number"==typeof i.maxKeys&&(s=i.maxKeys);var l=e.length;s>0&&l>s&&(l=s);for(var u=0;u=0?(c=h.substr(0,f),d=h.substr(f+1)):(c=h,d=""),p=decodeURIComponent(c),m=decodeURIComponent(d),Object.prototype.hasOwnProperty.call(a,p))?t(a[p])?a[p].push(m):a[p]=[a[p],m]:a[p]=m}return a};var t=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},577:function(e){var t=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,a,o,s){return(a=a||"&",o=o||"=",null===e&&(e=void 0),"object"==typeof e)?n(i(e),function(i){var s=encodeURIComponent(t(i))+o;return r(e[i])?n(e[i],function(e){return s+encodeURIComponent(t(e))}).join(a):s+encodeURIComponent(t(e[i]))}).join(a):s?encodeURIComponent(t(s))+o+encodeURIComponent(t(e)):""};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function n(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n{"use strict";r.d(t,{A:()=>n});let n=r(31320).BF.YF},62685:(e,t,r)=>{"use strict";r.d(t,{A:()=>A});var n=r(50923),i=r(85250),a=r(22783),o=r(54268),s=r(79267),l=r(77280),u=r(50987),c=r(47241),d=r(69228),p=r(21601),m=r(10807),h=r(47776),f=r(39083),g=r(24887),v=r(92449),y=r(79657),b=r(5663),I=r(74798),x=r(92154);class C extends p.A{constructor(e){super(e),this._useAcquisitionPlaneForViewPlane=!1,this.getNumberOfSlices=()=>{let{numberOfSlices:e}=(0,h.A)(this)||{};return e},this.resetCameraForResize=()=>this.resetCamera({resetPan:!0,resetZoom:!0,resetToCenter:!0,resetRotation:!1,suppressEvents:!0}),this.getCurrentImageIdIndex=(e=this.getVolumeId(),t=!0)=>{if(!e)return 0;let{currentStepIndex:r}=(0,v.A)(this,e,t);return r},this.getSliceIndex=()=>{let{imageIndex:e}=(0,h.A)(this)||{};return e},this.getCurrentImageId=()=>{let e=this.getDefaultActor();if(!e||!(0,u.N)(e,"vtkVolume"))return;let t=o.Ay.getVolume(this.getVolumeId());if(!t)return;let{viewPlaneNormal:r,focalPoint:n}=this.getCamera();return(0,c.A)(t,n,r)},this.getSlicePlaneCoordinates=()=>{let e=this.getDefaultActor();if(!e?.actor)return console.warn("No image data found for calculating vtkPlanes."),[];let t=this.getVolumeId(),r=o.Ay.getVolume(t),{focalPoint:n,position:i,viewPlaneNormal:a}=this.getCamera(),{currentSliceIndex:s,sliceRange:l,spacingInNormalDirection:u}=function(e){let{actor:t,camera:r,imageVolume:n}=e,{focalPoint:i,viewPlaneNormal:a}=r,o=(0,b.A)(t,a,i),s=(0,I.A)(n,a),l=Math.round((o.max-o.min)/s),u=o.max-o.min;return l<=0||0===u?{currentSliceIndex:0,sliceRange:o,spacingInNormalDirection:s}:{currentSliceIndex:Math.round((o.current-o.min)/u*l),sliceRange:o,spacingInNormalDirection:s}}({actor:e.actor,camera:{focalPoint:n,position:i,viewPlaneNormal:a},imageVolume:r}),c=Math.round((l.current-l.min)/u),d=Math.round((l.max-l.current)/u),p=[];for(let e=-c;e<=d;e++){let{newFocalPoint:t}=function(e){let{camera:t,delta:r,sliceRange:n,spacingInNormalDirection:i}=e;return(0,x.A)(t.focalPoint,t.position,n,t.viewPlaneNormal,i,r)}({camera:{focalPoint:n,position:i,viewPlaneNormal:a},delta:e,sliceRange:l,spacingInNormalDirection:u});p.push({sliceIndex:s+e,point:t})}return p};let{orientation:t}=this.options;if(t&&t!==l.KY.ACQUISITION)return void this.applyViewOrientation(t);this._useAcquisitionPlaneForViewPlane=!0}async setVolumes(e,t=!1,r=!1){let n=e[0].volumeId,i=o.Ay.getVolume(n);if(!i)throw Error(`imageVolume with id: ${n} does not exist`);return this._useAcquisitionPlaneForViewPlane?(this._setViewPlaneToAcquisitionPlane(i),this._useAcquisitionPlaneForViewPlane=!1):this.options.orientation&&"string"==typeof this.options.orientation&&this.options.orientation.includes("_reformat")&&this._setViewPlaneToReformatOrientation(this.options.orientation,i),super.setVolumes(e,t,r)}async addVolumes(e,t=!1,r=!1){let n=o.Ay.getVolume(e[0].volumeId);if(!n)throw Error(`imageVolume with id: ${n.volumeId} does not exist`);return this._useAcquisitionPlaneForViewPlane?(this._setViewPlaneToAcquisitionPlane(n),this._useAcquisitionPlaneForViewPlane=!1):this.options.orientation&&"string"==typeof this.options.orientation&&this.options.orientation.includes("_reformat")&&this._setViewPlaneToReformatOrientation(this.options.orientation,n),super.addVolumes(e,t,r)}jumpToWorld(e){let t=e,r=this.getImageData();if(r?.imageData){let n=r.imageData.getBounds();t=[Math.max(n[0],Math.min(n[1],e[0])),Math.max(n[2],Math.min(n[3],e[1])),Math.max(n[4],Math.min(n[5],e[2]))]}let{focalPoint:i}=this.getCamera(),a=[0,0,0];n.jb(a,t,i);let o=this.getCamera(),s=o.viewPlaneNormal,l=n.Om(a,s),u=n.fA(s[0],s[1],s[2]);if(n.hs(u,u,l),Math.abs(u[0])>.001||Math.abs(u[1])>.001||Math.abs(u[2])>.001){let e=[0,0,0],t=[0,0,0];n.WQ(e,o.focalPoint,u),n.WQ(t,o.position,u),this.setCamera({focalPoint:e,position:t}),this.render()}return!0}setOrientation(e,t=!0,r=!1){let n,i;if("string"==typeof e){if(e===l.KY.ACQUISITION)({viewPlaneNormal:n,viewUp:i}=super._getAcquisitionPlaneOrientation());else if(e===l.KY.REFORMAT)({viewPlaneNormal:n,viewUp:i}=(0,y.S8)(this,{useViewportNormal:!0}));else if(e===l.KY.AXIAL_REFORMAT||e===l.KY.SAGITTAL_REFORMAT||e===l.KY.CORONAL_REFORMAT){let t;t=e===l.KY.AXIAL_REFORMAT?l.KY.AXIAL:e===l.KY.SAGITTAL_REFORMAT?l.KY.SAGITTAL:l.KY.CORONAL,{viewPlaneNormal:n,viewUp:i}=(0,y.S8)(this,{useViewportNormal:!0,orientation:t})}else if(s.T0[e])({viewPlaneNormal:n,viewUp:i}=s.T0[e]);else throw Error(`Invalid orientation: ${e}. Use Enums.OrientationAxis instead.`);this.setCamera({viewPlaneNormal:n,viewUp:i}),this.viewportProperties.orientation=e,this.resetCamera({suppressEvents:!0})}else({viewPlaneNormal:n,viewUp:i}=e),this.applyViewOrientation(e,!0,r);t&&this.render()}setCameraClippingRange(){let e=this.getVtkActiveCamera();if(!e)return void console.warn("No active camera found");e.getParallelProjection()?e.setClippingRange(-s.Cf.MAXIMUM_RAY_DISTANCE,s.Cf.MAXIMUM_RAY_DISTANCE):e.setClippingRange(s.Cf.MINIMUM_SLAB_THICKNESS,s.Cf.MAXIMUM_RAY_DISTANCE)}_setViewPlaneToReformatOrientation(e,t){let r,n;if(t){let{direction:i}=t;({viewPlaneNormal:r,viewUp:n}=(0,y.jq)(i.slice(0,3),i.slice(3,6),i.slice(6,9),e))}else({viewPlaneNormal:r,viewUp:n}=this._getAcquisitionPlaneOrientation());this.setCamera({viewPlaneNormal:r,viewUp:n}),this.initialViewUp=n,this.resetCamera()}_setViewPlaneToAcquisitionPlane(e){let t,r;if(e){let{direction:n}=e;t=n.slice(6,9).map(e=>-e),r=n.slice(3,6).map(e=>-e)}else({viewPlaneNormal:t,viewUp:r}=this._getAcquisitionPlaneOrientation());this.setCamera({viewPlaneNormal:t,viewUp:r}),this.initialViewUp=r,this.resetCamera()}getBlendMode(e){let t=this.getActors(),r=e?.length>0?t.find(t=>e.includes(t.uid)):t[0];return r?.blendMode||r?.actor.getMapper().getBlendMode()}setBlendMode(e,t=[],r=!1){let n=this.getActors();t?.length>0&&(n=n.filter(e=>t.includes(e.uid))),n.forEach(t=>{let{actor:r}=t,n=r.getMapper();n.setBlendMode?.(e),t.blendMode=e}),r&&this.render()}resetCamera(e){let{resetPan:t=!0,resetZoom:r=!0,resetRotation:n=!0,resetToCenter:i=!0,suppressEvents:o=!1,resetOrientation:u=!0,resetAspectRatio:c=!0}=e||{},{orientation:p}=this.viewportProperties;p&&u&&this.applyViewOrientation(p,!1),super.resetCamera({resetPan:t,resetZoom:r,resetToCenter:i,resetAspectRatio:c});let m=this.getVtkActiveCamera(),h=m.getViewPlaneNormal(),f=m.getFocalPoint();if(this.getActors().forEach(e=>{if(!e.actor)return;let t=e.actor.getMapper();if(0===t.getClippingPlanes().length&&!e?.clippingFilter){let r=a.Ay.newInstance(),n=a.Ay.newInstance(),i=[r,n],o=s.Cf.MINIMUM_SLAB_THICKNESS;e.slabThickness&&(o=e.slabThickness),this.setOrientationOfClippingPlanes(i,o,h,f),t.addClippingPlane(r),t.addClippingPlane(n)}}),n&&void 0!==s.T0[this.viewportProperties.orientation]){let e=s.T0[this.viewportProperties.orientation];this.setCameraNoEvent({viewUp:e.viewUp,viewPlaneNormal:e.viewPlaneNormal})}if(!o){let e={viewportId:this.id,camera:this.getCamera(),renderingEngineId:this.renderingEngineId,element:this.element};(0,d.A)(this.element,l.sV.CAMERA_RESET,e)}return!0}setSlabThickness(e,t=[]){e<.1&&(e=s.Cf.MINIMUM_SLAB_THICKNESS);let r=this.getActors();t?.length>0&&(r=r.filter(e=>t.includes(e.uid))),r.forEach(t=>{(0,u.N)(t,"vtkVolume")&&(t.slabThickness=e)});let n=this.getCamera();this.updateClippingPlanesForActors(n),this.triggerCameraModifiedEventIfNecessary(n,n),this.viewportProperties.slabThickness=e}resetSlabThickness(){this.getActors().forEach(e=>{(0,u.N)(e,"vtkVolume")&&(e.slabThickness=s.Cf.MINIMUM_SLAB_THICKNESS)});let e=this.getCamera();this.updateClippingPlanesForActors(e),this.triggerCameraModifiedEventIfNecessary(e,e),this.viewportProperties.slabThickness=void 0}isInAcquisitionPlane(){let e=this.getImageData();if(!e)return!1;let{direction:t}=e,{viewPlaneNormal:r}=this.getCamera(),i=[t[6],t[7],t[8]];return Math.abs(n.Om(r,i))>.99}getSliceViewInfo(){let{width:e,height:t}=this.getCanvas(),r=(0,f.e)(this,[0,0]),a=(0,f.e)(this,[e-1,0]),o=(0,f.e)(this,[0,t-1]),l=n.jb(n.vt(),a,r),u=n.jb(n.vt(),o,r),c=n.$A(n.vt(),l,u);n.S8(l,l),n.S8(u,u),n.S8(c,c);let{dimensions:d}=this.getImageData(),[p,m,h]=d,v=[[0,0,0],[p-1,0,0],[0,m-1,0],[p-1,m-1,0],[0,0,h-1],[p-1,0,h-1],[0,m-1,h-1],[p-1,m-1,h-1]].map(e=>(function(e,t){let{imageData:r}=e.getImageData(),n=(0,g.A)(r,t);return e.worldToCanvas(n)})(this,e)).reduce((e,t)=>(e.minX=Math.min(e.minX,t[0]),e.minY=Math.min(e.minY,t[1]),e.maxX=Math.max(e.maxX,t[0]),e.maxY=Math.max(e.maxY,t[1]),e),{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}),y=(0,f.e)(this,[v.minX,v.minY]),b=i.fromValues(l[0],l[1],l[2],0,u[0],u[1],u[2],0,c[0],c[1],c[2],0,y[0],y[1],y[2],1),I=(0,f.e)(this,[v.maxX,v.maxY]),x=n.jb(n.vt(),I,y),C=i.invert(i.create(),b),{viewPlaneNormal:A}=this.getCamera();if(A.filter(e=>Math.abs(e)>s.p8).length>1)throw Error("getSliceInfo is not supported for oblique views");let T=A.findIndex(e=>Math.abs(e)>1-s.p8);if(-1===T)throw Error("Unable to determine slice axis");let S=n.Om(l,x)+1,w=n.Om(u,x)+1;return{sliceIndex:this.getSliceIndex(),width:S,height:w,slicePlane:T,sliceToIndexMatrix:b,indexToSliceMatrix:C}}getCurrentSlicePixelData(){let{voxelManager:e}=this.getImageData();return e.getSliceData(this.getSliceViewInfo())}getViewReference(e={}){let t=super.getViewReference(e);if(!t?.volumeId)return t;let r=o.Ay.getVolume(t.volumeId);return t.referencedImageId=(0,c.A)(r,t.cameraFocalPoint,t.viewPlaneNormal),t}resetProperties(e){this._resetProperties(e)}_resetProperties(e){let t=e?this.getActor(e):this.getDefaultActor();if(!t)throw Error(`No actor found for the given volumeId: ${e}`);t.slabThickness&&(t.slabThickness=s.Cf.MINIMUM_SLAB_THICKNESS,this.viewportProperties.slabThickness=void 0,this.updateClippingPlanesForActors(this.getCamera())),e||=this.getVolumeId();let r=o.Ay.getVolume(e);if(!r)throw Error(`imageVolume with id: ${e} does not exist in cache`);(0,m.A)(t.actor,r),this._restoreVolumeRenderingDefaults(t,e);let n={...super.getVOIModifiedEventDetail(e)};this.resetCamera({resetPan:!0,resetZoom:!0,resetToCenter:!0,resetCameraRotation:!0,resetAspectRatio:!0}),(0,d.A)(this.element,l.sV.VOI_MODIFIED,n)}getSlicesClippingPlanes(){let e=this.getSlicePlaneCoordinates(),{viewPlaneNormal:t}=this.getCamera(),r=s.Cf.MINIMUM_SLAB_THICKNESS;return e.map(({point:e,sliceIndex:n})=>{let i=[a.Ay.newInstance(),a.Ay.newInstance()];return this.setOrientationOfClippingPlanes(i,r,t,e),{sliceIndex:n,planes:i.map(e=>({normal:e.getNormal(),origin:e.getOrigin()}))}})}}let A=C},62705:(e,t,r)=>{"use strict";r.d(t,{n:()=>u,q:()=>c});var n=r(77280),i=r(20556);let a={rotation:!0,zoom:!0,pan:!0};function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}let s="video";function l(e){return[e[0],e[1]]}function u(e){let{viewport:t}=e,r=(0,i.l3)(e.viewState??t.getViewState?.()??{}),n=e.resolvedView??t.getResolvedView?.(),a=e.canvasWidth??n?.state?.containerWidth??t.element?.clientWidth??1,o=e.canvasHeight??n?.state?.containerHeight??t.element?.clientHeight??1,u=[a/2,o/2],c=function(e,t,r){if(e){let r=e.canvasToWorld(t);return[r[0],r[1]]}return r.anchorWorld?l(r.anchorWorld):[0,0]}(n,u,r),d=n?.zoom??Math.max(r.scale??1,.001),p=n?.pan??[0,0],m=n?.toICamera(),h=e.frameOfReferenceUID??n?.getFrameOfReferenceUID()??t.getFrameOfReferenceUID?.();return{kind:s,adapterId:s,canvasHeight:o,canvasWidth:a,dataId:e.dataId,frameOfReferenceUID:h,presentation:{pan:l(p),position:{kind:"mediaPoint",mediaPoint:c,canvasPoint:u},rawPan:l(p),rotation:n?.rotation??r.rotation??0,scale:n?{kind:"nativePixel",pixelsPerCanvasPixel:function(e){let t=e.canvasToWorld([0,0]);return Math.abs(e.canvasToWorld([1,0])[0]-t[0])||1}(n)}:{kind:"fit",value:d},zoom:d},rendererCamera:m,resolvedView:n,spaces:{canvas:!0,image:!1,renderer:!!m,world:!!n},transforms:n?{canvasToWorld:e=>n.canvasToWorld(e),worldToCanvas:e=>n.worldToCanvas(e)}:void 0,viewState:r,viewportType:t.type}}let c={id:s,viewportTypes:[n.NV.VIDEO_NEXT],getSnapshot:e=>u(e),getPresentation:(e,t)=>(function(e,t){let r={},n=t??a,i=e.presentation.zoom??1;if(n.rotation&&(r.rotation=e.presentation.rotation??0),n.zoom&&(r.zoom=i),n.pan){let t=e.presentation.rawPan;r.pan=[t[0]/i,t[1]/i]}return r})(e,t),withPresentation:(e,t,r)=>(function(e,t,r={}){let n=e.viewState??{},a=o(t,"zoom"),s=o(t,"pan"),l=o(t,"rotation"),u=Math.max(t.zoom??e.presentation.zoom??n.scale??1,.001),c=e.resolvedView,d=(0,i.l3)({...n,...l?{rotation:t.rotation??0}:{}});if(a&&(c?(c=c.withZoom(u,r.anchorCanvas),d=(0,i.l3)({...c.state?.viewState,...l?{rotation:t.rotation??0}:{}})):d=(0,i.l3)({...d,scale:u,scaleMode:"fit"})),s&&t.pan){let e=[t.pan[0]*u,t.pan[1]*u];c&&(d=(0,i.l3)({...c.withPan(e).state?.viewState,...l?{rotation:t.rotation??0}:{}}))}return d})(e,t,r)}},62750:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NamedNodeMapImpl=void 0;let n=r(32008),i=r(47518);class a extends Array{_element;constructor(e){super(),this._element=e,Object.setPrototypeOf(this,a.prototype)}_asArray(){return this}item(e){return this[e]||null}getNamedItem(e){return(0,i.element_getAnAttributeByName)(e,this._element)}getNamedItemNS(e,t){return(0,i.element_getAnAttributeByNamespaceAndLocalName)(e||"",t,this._element)}setNamedItem(e){return(0,i.element_setAnAttribute)(e,this._element)}setNamedItemNS(e){return(0,i.element_setAnAttribute)(e,this._element)}removeNamedItem(e){let t=(0,i.element_removeAnAttributeByName)(e,this._element);if(null===t)throw new n.NotFoundError;return t}removeNamedItemNS(e,t){let r=(0,i.element_removeAnAttributeByNamespaceAndLocalName)(e||"",t,this._element);if(null===r)throw new n.NotFoundError;return r}static _create(e){return new a(e)}}t.NamedNodeMapImpl=a},62775:(e,t,r)=>{"use strict";r.d(t,{Q:()=>a,p:()=>s});var n=r(33845),i=r(4235);function a(e,t){return!t?.autoGenerated&&(e?.smoothing?.smoothOnAdd===!0||e?.smoothing?.smoothOnEdit===!0)}function o(e,t,r,n){let[,i,a]=e,[,o,s]=t,l=a.length,u=s.length,c=e[0],d=t[0];if(!a[c]||!s[d]||!a[i]||!s[o])return[void 0,void 0];for(;c!==i&&d!==o;){if(r(s[d],a[c]))return[c,d];c=(c+l+n)%l,d=(d+u+n)%u}return[void 0,void 0]}function s(e,t,r){let{interpolation:a,smoothing:s}=e;if(a){let{knotsRatioPercentageOnAdd:e,knotsRatioPercentageOnEdit:a,smoothOnAdd:l=!1,smoothOnEdit:u=!1}=s;if(r?u:l){let[s,l]=r?function(e,t){var r,i,a,s;let[l,u]=function(e,t){for(let a=0;a!1==.001>n.zx.distanceToPoint(e,t),[d,p]=o([(l+(r=e.length)+1)%r,l,e],[(u+(i=t.length)+1)%i,u,t],c,1),[m]=o([(d+(a=e.length)+-1)%a,d,e],[(p+(s=t.length)+-1)%s,p,t],c,-1);return[d,m]}(t,r):[0,t.length-1];return t[s]&&t[l]?(0,i.A)(t,s,l,r?a:e):t}}return t}},62807:(e,t,r)=>{"use strict";r.d(t,{A:()=>i,a:()=>n});var n={ARRAY_BUFFER:0,ELEMENT_ARRAY_BUFFER:1,TEXTURE_BUFFER:2},i={ObjectType:n}},62821:(e,t,r)=>{"use strict";let n;Object.defineProperty(t,"__esModule",{value:!0}),t.setValidationErrorCallback=function(e){n=e},t.newURL=g,t.isSpecialScheme=v,t.isSpecial=y,t.defaultPort=b,t.includesCredentials=I,t.cannotHaveAUsernamePasswordPort=function(e){return null===e.host||""===e.host||e._cannotBeABaseURLFlag||"file"===e.scheme},t.urlSerializer=x,t.hostSerializer=C,t.iPv4Serializer=A,t.iPv6Serializer=T,t.urlParser=function(e,t,r){let n=S(e,t,r);if(null===n)return null;if("blob"!==n.scheme)return n;let i=function(e){return null}(n);return null!==i?n._blobURLEntry=i:n._blobURLEntry=null,n},t.basicURLParser=S,t.setTheUsername=function(e,t){let r="";for(let e of t)r+=G(e,p);e.username=r},t.setThePassword=function(e,t){let r="";for(let e of t)r+=G(e,p);e.password=r},t.isSingleDotPathSegment=w,t.isDoubleDotPathSegment=O,t.shorten=P,t.isNormalizedWindowsDriveLetter=_,t.isWindowsDriveLetter=E,t.startsWithAWindowsDriveLetter=D,t.hostParser=R,t.iPv4NumberParser=M,t.iPv4Parser=N,t.iPv6Parser=V,t.opaqueHostParser=L,t.resolveABlobURL=B,t.percentEncode=F,t.percentDecode=U,t.stringPercentDecode=k,t.utf8PercentEncode=G,t.hostEquals=function(e,t){return e===t},t.urlEquals=function(e,t,r=!1){return x(e,r)===x(t,r)},t.urlEncodedStringParser=function(e){return W((0,i.utf8Encode)(e))},t.urlEncodedParser=W,t.urlEncodedByteSerializer=z,t.urlEncodedSerializer=function(e,t){if("UTF-8"!==(void 0===t||"replacement"===t||"UTF-16BE"===t||"UTF-16LE"===t?"UTF-8":t).toUpperCase())throw Error("Only UTF-8 encoding is supported.");let r="";for(let t of e){let e=z((0,i.utf8Encode)(t[0])),n=t[1];n=z((0,i.utf8Encode)(n)),""!==r&&(r+="&"),r+=e+"="+n}return r},t.origin=function e(t){switch(t.scheme){case"blob":t._blobURLEntry;let r=S(t.path[0]);if(null===r)return a.OpaqueOrigin;return e(r);case"ftp":case"http":case"https":case"ws":case"wss":return[t.scheme,null===t.host?"":t.host,t.port,null];default:return a.OpaqueOrigin}},t.domainToASCII=H,t.domainToUnicode=function(e,t=!1){let r=(0,s.domainToUnicode)(e);return""===r&&f("Invalid domain name."),r},t.asciiSerializationOfAnOrigin=function(e){if(""===e[0]&&""===e[1]&&null===e[2]&&null===e[3])return"null";let t=e[0]+"://"+C(e[1]);return null!==e[2]&&(t+=":"+e[2].toString()),t};let i=r(16950),a=r(66791),o=r(57226),s=r(92313),l={ftp:21,file:null,http:80,https:443,ws:80,wss:443},u=/[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,c=/[ "<>`]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,d=/[ "<>`#?{}]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,p=/[ "<>`#?{}/:;=@\[\]\\\^\|]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,m=/[0-9A-Za-z!\$&-\/:;=\?@_~\xA0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB40-\uDB7E\uDB80-\uDBBE\uDBC0-\uDBFE][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDC00-\uDFFD]/,h=/[\0\t\f\r #%/:?@\[\\\]]/;function f(e){void 0!==n&&n.call(null,"Validation Error: "+e)}function g(){return{scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,_cannotBeABaseURLFlag:!1,_blobURLEntry:null}}function v(e){return e in l}function y(e){return v(e.scheme)}function b(e){return l[e]||null}function I(e){return""!==e.username||""!==e.password}function x(e,t=!1){let r=e.scheme+":";if(null!==e.host?(r+="//",I(e)&&(r+=e.username,""!==e.password&&(r+=":"+e.password),r+="@"),r+=C(e.host),null!==e.port&&(r+=":"+e.port)):null===e.host&&"file"===e.scheme&&(r+="//"),e._cannotBeABaseURLFlag)r+=e.path[0];else for(let t of e.path)r+="/"+t;return null!==e.query&&(r+="?"+e.query),t||null===e.fragment||(r+="#"+e.fragment),r}function C(e){return(0,i.isNumber)(e)?A(e):(0,i.isArray)(e)?"["+T(e)+"]":e}function A(e){let t="",r=e;for(let e=1;e<=4;e++)t=(r%256).toString()+t,4!==e&&(t="."+t),r=Math.floor(r/256);return t}function T(e){let t="",r=null,n=-1,i=0,a=0;for(let t=0;t<8;t++)if(0===e[t]){i=1;for(let r=t+1;r<8&&0===e[r];r++)i++;i>a&&(a=i,n=t)}a>1&&(r=n);let o=!1;for(let n=0;n<8;n++)if(!o||0!==e[n]){if(o&&(o=!1),r===n){t+=0===n?"::":":",o=!0;continue}t+=e[n].toString(16),7!==n&&(t+=":")}return t}function S(e,t,r,n,s){if(void 0===n){n=g();let t=/^[\u0000-\u001F\u0020]+/,r=/[\u0000-\u001F\u0020]+$/;(t.test(e)||r.test(e))&&f("Input string contains leading or trailing control characters or space."),e=(e=e.replace(t,"")).replace(r,"")}let l=/[\u0009\u000A\u000D]/g;l.test(e)&&f("Input string contains tab or newline characters."),e=e.replace(l,"");let h=void 0===s?a.ParserState.SchemeStart:s;void 0===t&&(t=null);let x=void 0===r||"replacement"===r||"UTF-16BE"===r||"UTF-16LE"===r?"UTF-8":r,C="",A=!1,T=!1,S=!1,M=new i.StringWalker(e);for(;;){switch(h){case a.ParserState.SchemeStart:if(o.codePoint.ASCIIAlpha.test(M.c()))C+=M.c().toLowerCase(),h=a.ParserState.Scheme;else{if(void 0!==s)return f("Invalid scheme start character."),null;h=a.ParserState.NoScheme,M.pointer--}break;case a.ParserState.Scheme:if(o.codePoint.ASCIIAlphanumeric.test(M.c())||"+"===M.c()||"-"===M.c()||"."===M.c())C+=M.c().toLowerCase();else if(":"===M.c()){if(void 0!==s&&(v(n.scheme)&&!v(C)||!v(n.scheme)&&v(C)||(I(n)||null!==n.port)&&"file"===C||"file"===n.scheme&&(""===n.host||null===n.host)))return n;if(n.scheme=C,void 0!==s)return n.port===b(n.scheme)&&(n.port=null),n;C="","file"===n.scheme?(M.remaining().startsWith("//")||f("Invalid file URL scheme, '//' expected."),h=a.ParserState.File):y(n)&&null!==t&&t.scheme===n.scheme?h=a.ParserState.SpecialRelativeOrAuthority:y(n)?h=a.ParserState.SpecialAuthoritySlashes:M.remaining().startsWith("/")?(h=a.ParserState.PathOrAuthority,M.pointer++):(n._cannotBeABaseURLFlag=!0,n.path.push(""),h=a.ParserState.CannotBeABaseURLPath)}else{if(void 0!==s)return f("Invalid input string."),null;C="",h=a.ParserState.NoScheme,M.pointer=0;continue}break;case a.ParserState.NoScheme:if(null===t||t._cannotBeABaseURLFlag&&"#"!==M.c())return f("Invalid input string."),null;t._cannotBeABaseURLFlag&&"#"===M.c()?(n.scheme=t.scheme,n.path=o.list.clone(t.path),n.query=t.query,n.fragment="",n._cannotBeABaseURLFlag=!0,h=a.ParserState.Fragment):(h="file"!==t.scheme?a.ParserState.Relative:a.ParserState.File,M.pointer--);break;case a.ParserState.SpecialRelativeOrAuthority:"/"===M.c()&&M.remaining().startsWith("/")?(h=a.ParserState.SpecialAuthorityIgnoreSlashes,M.pointer++):(f("Invalid input string."),h=a.ParserState.Relative,M.pointer--);break;case a.ParserState.PathOrAuthority:"/"===M.c()?h=a.ParserState.Authority:(h=a.ParserState.Path,M.pointer--);break;case a.ParserState.Relative:if(null===t)throw Error("Invalid parser state. Base URL is null.");switch(n.scheme=t.scheme,M.c()){case"":n.username=t.username,n.password=t.password,n.host=t.host,n.port=t.port,n.path=o.list.clone(t.path),n.query=t.query;break;case"/":h=a.ParserState.RelativeSlash;break;case"?":n.username=t.username,n.password=t.password,n.host=t.host,n.port=t.port,n.path=o.list.clone(t.path),n.query="",h=a.ParserState.Query;break;case"#":n.username=t.username,n.password=t.password,n.host=t.host,n.port=t.port,n.path=o.list.clone(t.path),n.query=t.query,n.fragment="",h=a.ParserState.Fragment;break;default:y(n)&&"\\"===M.c()?(f("Invalid input string."),h=a.ParserState.RelativeSlash):(n.username=t.username,n.password=t.password,n.host=t.host,n.port=t.port,n.path=o.list.clone(t.path),0!==n.path.length&&n.path.splice(n.path.length-1,1),h=a.ParserState.Path,M.pointer--)}break;case a.ParserState.RelativeSlash:if(y(n)&&("/"===M.c()||"\\"===M.c()))"\\"===M.c()&&f("Invalid input string."),h=a.ParserState.SpecialAuthorityIgnoreSlashes;else if("/"===M.c())h=a.ParserState.Authority;else{if(null===t)throw Error("Invalid parser state. Base URL is null.");n.username=t.username,n.password=t.password,n.host=t.host,n.port=t.port,h=a.ParserState.Path,M.pointer--}break;case a.ParserState.SpecialAuthoritySlashes:"/"===M.c()&&M.remaining().startsWith("/")?(h=a.ParserState.SpecialAuthorityIgnoreSlashes,M.pointer++):(f("Expected '//'."),h=a.ParserState.SpecialAuthorityIgnoreSlashes,M.pointer--);break;case a.ParserState.SpecialAuthorityIgnoreSlashes:"/"!==M.c()&&"\\"!==M.c()?(h=a.ParserState.Authority,M.pointer--):f("Unexpected '/' or '\\'.");break;case a.ParserState.Authority:if("@"===M.c()){for(let e of(f("Unexpected '@'."),A&&(C="%40"+C),A=!0,C)){if(":"===e&&!S){S=!0;continue}let t=G(e,p);S?n.password+=t:n.username+=t}C=""}else if(""===M.c()||"/"===M.c()||"?"===M.c()||"#"===M.c()||y(n)&&"\\"===M.c()){if(A&&""===C)return f("Invalid input string."),null;M.pointer-=C.length+1,C="",h=a.ParserState.Host}else C+=M.c();break;case a.ParserState.Host:case a.ParserState.Hostname:if(void 0!==s&&"file"===n.scheme)M.pointer--,h=a.ParserState.FileHost;else if(":"!==M.c()||T)if(""===M.c()||"/"===M.c()||"?"===M.c()||"#"===M.c()||y(n)&&"\\"===M.c()){if(M.pointer--,y(n)&&""===C)return f("Invalid input string."),null;if(void 0!==s&&""===C&&(I(n)||null!==n.port))return f("Invalid input string."),n;let e=R(C,!y(n));if(null===e)return null;if(n.host=e,C="",h=a.ParserState.PathStart,void 0!==s)return n}else"["===M.c()&&(T=!0),"]"===M.c()&&(T=!1),C+=M.c();else{if(""===C)return f("Invalid input string."),null;let e=R(C,!y(n));if(null===e)return null;if(n.host=e,C="",h=a.ParserState.Port,s===a.ParserState.Hostname)return n}break;case a.ParserState.Port:if(o.codePoint.ASCIIDigit.test(M.c()))C+=M.c();else{if(!(""===M.c()||"/"===M.c()||"?"===M.c()||"#"===M.c()||y(n)&&"\\"===M.c())&&!s)return f("Invalid input string."),null;if(""!==C&&""!==C){let e=parseInt(C,10);if(e>65535)return f("Invalid port number."),null;n.port=e===b(n.scheme)?null:e,C=""}if(void 0!==s)return n;h=a.ParserState.PathStart,M.pointer--}break;case a.ParserState.File:if(n.scheme="file","/"===M.c()||"\\"===M.c())"\\"===M.c()&&f("Invalid input string."),h=a.ParserState.FileSlash;else if(null!==t&&"file"===t.scheme)switch(M.c()){case"":n.host=t.host,n.path=o.list.clone(t.path),n.query=t.query;break;case"?":n.host=t.host,n.path=o.list.clone(t.path),n.query="",h=a.ParserState.Query;break;case"#":n.host=t.host,n.path=o.list.clone(t.path),n.query=t.query,n.fragment="",h=a.ParserState.Fragment;break;default:D(M.substring())?f("Unexpected windows drive letter in input string."):(n.host=t.host,n.path=o.list.clone(t.path),P(n)),h=a.ParserState.Path,M.pointer--}else h=a.ParserState.Path,M.pointer--;break;case a.ParserState.FileSlash:"/"===M.c()||"\\"===M.c()?("\\"===M.c()&&f("Invalid input string."),h=a.ParserState.FileHost):(null===t||"file"!==t.scheme||D(M.substring())||(_(t.path[0])?n.path.push(t.path[0]):n.host=t.host),h=a.ParserState.Path,M.pointer--);break;case a.ParserState.FileHost:if(""===M.c()||"/"===M.c()||"\\"===M.c()||"?"===M.c()||"#"===M.c())if(M.pointer--,void 0===s&&E(C))f("Unexpected windows drive letter in input string."),h=a.ParserState.Path;else if(""===C){if(n.host="",void 0!==s)return n;h=a.ParserState.PathStart}else{let e=R(C,!y(n));if(null===e)return null;if("localhost"===e&&(e=""),n.host=e,void 0!==s)return n;C="",h=a.ParserState.PathStart}else C+=M.c();break;case a.ParserState.PathStart:y(n)?("\\"===M.c()&&f("Invalid input string."),h=a.ParserState.Path,"/"!==M.c()&&"\\"!==M.c()&&M.pointer--):void 0===s&&"?"===M.c()?(n.query="",h=a.ParserState.Query):void 0===s&&"#"===M.c()?(n.fragment="",h=a.ParserState.Fragment):""!==M.c()&&(h=a.ParserState.Path,"/"!==M.c()&&M.pointer--);break;case a.ParserState.Path:if(""===M.c()||"/"===M.c()||y(n)&&"\\"===M.c()||void 0===s&&("?"===M.c()||"#"===M.c())){if(y(n)&&"\\"===M.c()&&f("Invalid input string."),O(C))P(n),"/"===M.c()||y(n)&&"\\"===M.c()||n.path.push("");else if(w(C)&&"/"!==M.c()&&!(y(n)&&"\\"===M.c()))n.path.push("");else if(!w(C)){if("file"===n.scheme&&0===n.path.length&&E(C)){null!==n.host&&""!==n.host&&(f("Invalid input string."),n.host="");let e=Array.from(C);C=e.slice(0,1)+":"+e.slice(2)}n.path.push(C)}if(C="","file"===n.scheme&&(""===M.c()||"?"===M.c()||"#"===M.c()))for(;n.path.length>1&&""===n.path[0];)f("Invalid input string."),n.path.splice(0,1);"?"===M.c()&&(n.query="",h=a.ParserState.Query),"#"===M.c()&&(n.fragment="",h=a.ParserState.Fragment)}else m.test(M.c())||"%"===M.c()||f("Character is not a URL code point or a percent encoded character."),"%"!==M.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(M.remaining())||f("Percent encoded character must be followed by two hex digits."),C+=G(M.c(),d);break;case a.ParserState.CannotBeABaseURLPath:"?"===M.c()?(n.query="",h=a.ParserState.Query):"#"===M.c()?(n.fragment="",h=a.ParserState.Fragment):(""===M.c()||m.test(M.c())||"%"===M.c()||f("Character is not a URL code point or a percent encoded character."),"%"!==M.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(M.remaining())||f("Percent encoded character must be followed by two hex digits."),""!==M.c()&&(n.path[0]+=G(M.c(),u)));break;case a.ParserState.Query:if("UTF-8"===x||y(n)&&"ws"!==n.scheme&&"wss"!==n.scheme||(x="UTF-8"),void 0===s&&"#"===M.c())n.fragment="",h=a.ParserState.Fragment;else if(""!==M.c()){if(m.test(M.c())||"%"===M.c()||f("Character is not a URL code point or a percent encoded character."),"%"!==M.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(M.remaining())||f("Percent encoded character must be followed by two hex digits."),"UTF-8"!==x.toUpperCase())throw Error("Only UTF-8 encoding is supported.");let e=(0,i.utf8Encode)(M.c());if(e.length>=3&&38===e[0]&&35===e[1]&&59===e[e.length-1])e=e.subarray(2,e.length-1),n.query+="%26%23"+o.byteSequence.isomorphicDecode(e)+"%3B";else for(let t of e)t<33||t>126||34===t||35===t||60===t||62===t||39===t&&y(n)?n.query+=F(t):n.query+=String.fromCharCode(t)}break;case a.ParserState.Fragment:""===M.c()||("\0"===M.c()?f("NULL character in input string."):(m.test(M.c())||"%"===M.c()||f("Unexpected character in fragment string."),"%"!==M.c()||/^[A-Za-z0-9][A-Za-z0-9]/.test(M.remaining())||f("Unexpected character in fragment string."),n.fragment+=G(M.c(),c)))}if(M.eof)break;M.pointer++}return n}function w(e){return"."===e||"%2e"===e.toLowerCase()}function O(e){let t=e.toLowerCase();return".."===t||".%2e"===t||"%2e."===t||"%2e%2e"===t}function P(e){let t=e.path;0!==t.length&&("file"===e.scheme&&1===t.length&&_(t[0])||e.path.splice(e.path.length-1,1))}function _(e){return e.length>=2&&o.codePoint.ASCIIAlpha.test(e[0])&&":"===e[1]}function E(e){return e.length>=2&&o.codePoint.ASCIIAlpha.test(e[0])&&(":"===e[1]||"|"===e[1])}function D(e){return e.length>=2&&E(e)&&(2===e.length||"/"===e[2]||"\\"===e[2]||"?"===e[2]||"#"===e[2])}function R(e,t=!1){if(e.startsWith("["))return e.endsWith("]")?V(e.substring(1,e.length-1)):(f("Expected ']' after '['."),null);if(t)return L(e);let r=H((0,i.utf8Decode)(k(e)));if(null===r||h.test(r))return f("Invalid domain."),null;let n=N(r);return null===n||(0,i.isNumber)(n)?n:r}function M(e,t={value:!1}){let r=10;return(e.startsWith("0x")||e.startsWith("0X")?(t.value=!0,e=e.substr(2),r=16):e.length>=2&&"0"===e[0]&&(t.value=!0,e=e.substr(1),r=8),""===e)?0:(10===r?/^[0-9]+$/:16===r?/^[0-9A-Fa-f]+$/:/^[0-7]+$/).test(e)?parseInt(e,r):null}function N(e){let t={value:!1},r=e.split(".");if(""===r[r.length-1]&&(t.value=!0,r.length>1&&r.pop()),r.length>4)return e;let n=[];for(let i of r){if(""===i)return e;let r=M(i,t);if(null===r)return e;n.push(r)}t.value&&f("Invalid IP v4 address.");for(let e=0;e255&&(f("Invalid IP v4 address."),e=Math.pow(256,5-n.length))return f("Invalid IP v4 address."),null;let i=n[n.length-1];n.pop();let a=0;for(let e of n)i+=e*Math.pow(256,3-a),a++;return i}function V(e){let t=[0,0,0,0,0,0,0,0],r=0,n=null,a=new i.StringWalker(e);if(":"===a.c()){if(!a.remaining().startsWith(":"))return f("Invalid IP v6 address."),null;a.pointer+=2,r+=1,n=r}for(;""!==a.c();){if(8===r)return f("Invalid IP v6 address."),null;if(":"===a.c()){if(null!==n)return f("Invalid IP v6 address."),null;a.pointer++,n=++r;continue}let e=0,i=0;for(;i<4&&o.codePoint.ASCIIHexDigit.test(a.c());)e=16*e+parseInt(a.c(),16),a.pointer++,i++;if("."===a.c()){if(0===i||(a.pointer-=i,r>6))return f("Invalid IP v6 address."),null;let e=0;for(;""!==a.c();){let n=null;if(e>0)if("."!==a.c()||!(e<4))return f("Invalid IP v6 address."),null;else a.pointer++;if(!o.codePoint.ASCIIDigit.test(a.c()))return f("Invalid IP v6 address."),null;for(;o.codePoint.ASCIIDigit.test(a.c());){let e=parseInt(a.c(),10);if(null===n)n=e;else{if(0===n)return f("Invalid IP v6 address."),null;n=10*n+e}if(n>255)return f("Invalid IP v6 address."),null;a.pointer++}if(null===n)return f("Invalid IP v6 address."),null;t[r]=256*t[r]+n,(2==++e||4===e)&&r++}if(4!==e)return f("Invalid IP v6 address."),null;break}if(":"===a.c()){if(a.pointer++,""===a.c())return f("Invalid IP v6 address."),null}else if(""!==a.c())return f("Invalid IP v6 address."),null;t[r]=e,r++}if(null!==n){let e=r-n;for(r=7;0!==r&&e>0;)[t[r],t[n+e-1]]=[t[n+e-1],t[r]],r--,e--}else if(null===n&&8!==r)return f("Invalid IP v6 address."),null;return t}function L(e){if(/[\x00\t\f\r #/:?@\[\\\]]/.test(e))return f("Invalid host string."),null;let t="";for(let r of e)t+=G(r,u);return t}function B(e){return null}function F(e){return"%"+("00"+e.toString(16).toUpperCase()).slice(-2)}function U(e){let t=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,r=new Uint8Array(e.length),n=0;for(let a=0;a=e.length-2)r[n]=o,n++;else if(37!==o||t(e[a+1])&&t(e[a+2])){let t=parseInt((0,i.utf8Decode)(Uint8Array.of(e[a+1],e[a+2])),16);r[n]=t,n++,a+=2}else r[n]=o,n++}return r.subarray(0,n)}function k(e){return U((0,i.utf8Encode)(e))}function G(e,t){if(!t.test(e))return e;let r=(0,i.utf8Encode)(e),n="";for(let e of r)n+=F(e);return n}function W(e){let t=[],r=[];for(let n of e)38===n?(t.push(Uint8Array.from(r)),r=[]):r.push(n);0!==r.length&&t.push(Uint8Array.from(r));let n=[];for(let e of t){if(0===e.length)continue;let t=e.indexOf(61),r=-1!==t?e.slice(0,t):e,a=-1!==t?e.slice(t+1):new Uint8Array;for(let e=0;e=48&&r<=57||r>=65&&r<=90||95===r||r>=97&&r<=122?t+=String.fromCodePoint(r):t+=F(r);return t}function H(e,t=!1){let r=(0,s.domainToASCII)(e);return""===r?(f("Invalid domain name."),null):r}},62901:(e,t,r)=>{"use strict";r.d(t,{A:()=>P});var n=r(50923),i=r(91336),a=r(70192),o=r(17964),s=r(78378),l=r(4101),u=r(33845),c=r(62775),d=r(60212),p=r(74065),m=r(79159),h=r(34699);let{addCanvasPointsToArray:f,getSubPixelSpacingAndXYDirections:g}=u.XL;function v(e,t,r){this.isEditingOpen=!0;let{currentPoints:n,element:i}=e.detail,u=n.canvas,{viewport:c}=(0,a.kJ)(i);this.doneEditMemo();let d=t.data.contour.polyline.map(c.worldToCanvas),{spacing:p,xDir:m,yDir:h}=g(c,this.configuration.subPixelResolution);this.editData={prevCanvasPoints:d,editCanvasPoints:[u],startCrossingIndex:void 0,editIndex:0},this.commonData={annotation:t,viewportIdsToRender:r,spacing:p,xDir:m,yDir:h,movingTextBox:!1},o.wk.isInteractingWithTool=!0,i.addEventListener(s.sV.MOUSE_UP,this.mouseUpOpenContourEditCallback),i.addEventListener(s.sV.MOUSE_DRAG,this.mouseDragOpenContourEditCallback),i.addEventListener(s.sV.MOUSE_CLICK,this.mouseUpOpenContourEditCallback),i.addEventListener(s.sV.TOUCH_END,this.mouseUpOpenContourEditCallback),i.addEventListener(s.sV.TOUCH_DRAG,this.mouseDragOpenContourEditCallback),i.addEventListener(s.sV.TOUCH_TAP,this.mouseUpOpenContourEditCallback),(0,l.lY)(i)}function y(e){o.wk.isInteractingWithTool=!1,e.removeEventListener(s.sV.MOUSE_UP,this.mouseUpOpenContourEditCallback),e.removeEventListener(s.sV.MOUSE_DRAG,this.mouseDragOpenContourEditCallback),e.removeEventListener(s.sV.MOUSE_CLICK,this.mouseUpOpenContourEditCallback),e.removeEventListener(s.sV.TOUCH_END,this.mouseUpOpenContourEditCallback),e.removeEventListener(s.sV.TOUCH_DRAG,this.mouseDragOpenContourEditCallback),e.removeEventListener(s.sV.TOUCH_TAP,this.mouseUpOpenContourEditCallback),(0,l.Q_)(e)}function b(e){let{currentPoints:t,element:r}=e.detail,i=t.world,o=t.canvas,{viewport:s}=(0,a.kJ)(r),{viewportIdsToRender:l,xDir:u,yDir:c,spacing:p}=this.commonData,{editIndex:m,editCanvasPoints:h,startCrossingIndex:g}=this.editData,v=h[h.length-1],y=s.canvasToWorld(v),b=n.vt();this.createMemo(r,this.commonData.annotation),n.Re(b,i,y);let I=Math.abs(n.Om(b,u)),x=Math.abs(n.Om(b,c));if(I<=p[0]&&x<=p[1])return;void 0!==g&&this.checkAndRemoveCrossesOnEditLine(e);let C=f(r,h,o,this.commonData);this.editData.editIndex=m+C,void 0===g&&h.length>1&&this.checkForFirstCrossing(e,!1),this.editData.snapIndex=this.findSnapIndex(),this.editData.fusedCanvasPoints=this.fuseEditPointsWithOpenContour(e),void 0!==g&&this.checkForSecondCrossing(e,!1)?(this.removePointsAfterSecondCrossing(!1),this.finishEditOpenOnSecondCrossing(e)):this.checkIfShouldOverwriteAnEnd(e)&&this.openContourEditOverwriteEnd(e),(0,d.A)(l)}function I(e){let{element:t}=e.detail,{viewport:r}=(0,a.kJ)(t),{annotation:n,viewportIdsToRender:i}=this.commonData,o=this.fuseEditPointsForOpenContourEndEdit();(0,p.A)(n,{points:o,closed:!1},r);let s=n.data.contour.polyline;n.data.handles.points=[s[0],s[s.length-1]],n.data.handles.activeHandleIndex=1,(0,h.triggerAnnotationModified)(n,t),this.isEditingOpen=!1,this.editData=void 0,this.commonData=void 0,this.doneEditMemo(),this.deactivateOpenContourEdit(t),this.activateOpenContourEndEdit(e,n,i,null)}function x(e){let{currentPoints:t,lastPoints:r}=e.detail,n=t.canvas,a=r.canvas,{snapIndex:o,prevCanvasPoints:s,startCrossingIndex:l}=this.editData;if(void 0===l||void 0===o)return!1;if(-1===o)return!0;if(0!==o&&o!==s.length-1)return!1;let u=s[o],c=i.vt(),d=i.vt();i.hZ(c,n[0]-a[0],n[1]-a[1]),i.hZ(d,n[0]-u[0],n[1]-u[1]);let p=i.Om(c,d);return Math.acos(p/(Math.sqrt(c[0]*c[0]+c[1]*c[1])*Math.sqrt(d[0]*d[0]+d[1]*d[1])))=n;e--){let r=t[e];a.push([r[0],r[1]])}else for(let e=0;e=0;e--){let t=r[e];a.push([t[0],t[1]])}return a}function A(e){let t,r,{prevCanvasPoints:n,editCanvasPoints:a,startCrossingIndex:o,snapIndex:s}=this.editData;if(void 0===o||void 0===s)return;let{element:l}=e.detail,u=[...a];f(l,u,n[s],this.commonData),u.length>a.length&&u.pop(),o>s?(t=s,r=o):(t=o,r=s);let c=i.Io(n[t],u[0]),d=i.Io(n[t],u[u.length-1]),p=i.Io(n[r],u[0]),m=i.Io(n[r],u[u.length-1]),h=[];for(let e=0;e=0;e--){let t=u[e];h.push([t[0],t[1]])}for(let e=r;e{"use strict";r.d(t,{A:()=>y});var n=r(39216),i=r(77280),a=r(3922),o=r(92391),s=r(77757),l=r(16841),u=r(64375),c=r(50695),d=r(69228),p=r(94302),m=r(44191),h=r(42215),f=r(97938);let g=i.Yw.Prefetch;class v extends p.A{constructor(e,t){super(e),this.framesLoaded=0,this.framesProcessed=0,this.framesUpdated=0,this.autoRenderOnLoad=!0,this.cachedFrames=[],this.reRenderTarget=0,this.reRenderFraction=2,this.imagesLoader=this,this.cancelLoading=()=>{let{loadStatus:e}=this;if(!e||!e.loading)return;e.loading=!1,e.cancelled=!0,this.clearLoadCallbacks();let t=({additionalDetails:e})=>e.volumeId!==this.volumeId;o.A.filterRequests(t)},this.loadStatus=t.loadStatus}invalidateVolume(e){let{vtkOpenGLTexture:t}=this,{numFrames:r}=this;for(let e=0;ethis.reRenderTarget||r===n)&&(this.reRenderTarget+=s,(0,c.A)(o)),r===n&&(l.callbacks.forEach(t=>t(e)),(0,d.A)(a.A,i.sV.IMAGE_VOLUME_LOADING_COMPLETED,{FrameOfReferenceUID:p,volumeId:o}))}updateTextureAndTriggerEvents(e,t,r=i.FU.FULL_RESOLUTION){let n=this.imageIdIndexToFrameIndex(e),{cachedFrames:o,numFrames:s,totalNumFrames:l}=this,{FrameOfReferenceUID:u}=this.metadata;if(o[n]>r||o[n]===i.FU.FULL_RESOLUTION)return;let c=r===i.FU.FULL_RESOLUTION;o[e]=r,this.framesUpdated++,c&&(this.framesLoaded++,this.framesProcessed++);let p={FrameOfReferenceUID:u,volumeId:this.volumeId,numberOfFrames:s,framesProcessed:this.framesProcessed};(0,d.A)(a.A,i.sV.IMAGE_VOLUME_MODIFIED,p),c&&this.framesProcessed===this.totalNumFrames&&(this.loadStatus.loaded=!0,this.loadStatus.loading=!1),this.callLoadStatusCallback({success:!0,imageIdIndex:e,imageId:t,framesLoaded:this.framesLoaded,framesProcessed:this.framesProcessed,framesUpdated:this.framesUpdated,numFrames:s,totalNumFrames:l,complete:c,imageQualityStatus:r}),this.vtkOpenGLTexture.setUpdatedFrame(n),this.loadStatus.loaded&&(this.loadStatus.callbacks=[])}successCallback(e,t){let r=this.getImageIdIndex(e),{imageQualityStatus:n}=t;if(this.loadStatus.cancelled)return void console.warn("volume load cancelled, returning for imageIdIndex: ",r);this.updateTextureAndTriggerEvents(r,e,n),this.isDynamicVolume()&&this.checkDimensionGroupCompletion(r)}errorCallback(e,t,r){if(!t)return;let{totalNumFrames:n,numFrames:o}=this,s=this.getImageIdIndex(e);this.framesProcessed++,this.framesProcessed===n&&(this.loadStatus.loaded=!0,this.loadStatus.loading=!1),this.callLoadStatusCallback({success:!1,imageId:e,imageIdIndex:s,error:r,framesLoaded:this.framesLoaded,framesProcessed:this.framesProcessed,framesUpdated:this.framesUpdated,numFrames:o,totalNumFrames:n}),this.loadStatus.loaded&&(this.loadStatus.callbacks=[]),(0,d.A)(a.A,i.sV.IMAGE_LOAD_ERROR,{error:r,imageIdIndex:s,imageId:e})}load(e){let{imageIds:t,loadStatus:r,numFrames:a}=this,{transferSyntaxUID:o}=n.get(i.nb.TRANSFER_SYNTAX,t[0])||{},s=n.get(l.A.IMAGE_RETRIEVE_CONFIGURATION,this.volumeId,o,"volume");if(this.imagesLoader=this.isDynamicVolume()?this:s?(s.create||m.Ay.createProgressive)(s):this,!0===r.loading)return;let{loaded:u}=this.loadStatus,c=t.length;if(u){e&&e({success:!0,framesLoaded:c,framesProcessed:c,numFrames:a,totalNumFrames:c});return}e&&this.loadStatus.callbacks.push(e),this._prefetchImageIds()}getLoaderImageOptions(e){let{transferSyntaxUID:t}=n.get(i.nb.TRANSFER_SYNTAX,e)||{},r=this.dimensions[1],a=this.dimensions[0],o=this.getImageIdIndex(e),s=n.get(i.nb.MODALITY_LUT,e)||{},l=n.get(i.nb.GENERAL_SERIES,e)||{},c={rescaleSlope:s.rescaleSlope,rescaleIntercept:s.rescaleIntercept,modality:l.modality},d=c.modality;if("PT"===d||"RTDOSE"===d){let t=n.get(i.nb.SCALING,e);t&&(this._addScalingToVolume(t),Object.assign(c,t))}let p=(0,u.a)(c),m=(0,h.lk)();if(this.isPreScaled=!0,c&&void 0!==c.rescaleSlope&&void 0!==c.rescaleIntercept){let{rescaleSlope:e,rescaleIntercept:t}=c;this.isPreScaled="number"==typeof e&&"number"==typeof t}return!m&&p&&(this.isPreScaled=!1),{targetBuffer:{type:this.dataType,rows:r,columns:a},allowFloatRendering:m,preScale:{enabled:this.isPreScaled,scalingParameters:c},transferPixelData:!0,requestType:g,transferSyntaxUID:t,additionalDetails:{imageId:e,imageIdIndex:o,volumeId:this.volumeId},retrieveOptions:void 0}}callLoadImage(e,t,r){let{cachedFrames:n}=this;if(n[t]===i.FU.FULL_RESOLUTION)return;let o=r=>{let{image:n}=r.detail;n.imageId===e&&(this.vtkOpenGLTexture.setUpdatedFrame(t),a.A.removeEventListener(i.sV.IMAGE_CACHE_IMAGE_ADDED,o))};return a.A.addEventListener(i.sV.IMAGE_CACHE_IMAGE_ADDED,o),s.A.as((0,f.loadAndCacheImage)(e,r)).forEach(t=>{this.successCallback(e,t)},this.errorCallback.bind(this,t,e))}getImageIdsRequests(e,t){return this.totalNumFrames=this.imageIds.length,this.autoRenderOnLoad&&(this.reRenderFraction=.02*this.totalNumFrames,this.reRenderTarget=this.reRenderFraction),e.map(e=>{let r=this.getImageIdIndex(e),i=this.getLoaderImageOptions(e),{retrieveOptions:a={}}=n.get(l.A.IMAGE_RETRIEVE_CONFIGURATION,e,"volume")||{};return i.retrieveOptions={...i.retrieveOptions,...a.default||Object.values(a)?.[0]||{}},{callLoadImage:this.callLoadImage.bind(this),imageId:e,imageIdIndex:r,options:i,priority:t,requestType:g,additionalDetails:{volumeId:this.volumeId}}})}getImageLoadRequests(e){throw Error("Abstract method")}getImageIdsToLoad(){throw Error("Abstract method")}loadImages(){return this.loadStatus.loading=!0,this.getImageLoadRequests(5).reverse().forEach(e=>{if(!e)return;let{callLoadImage:t,imageId:r,imageIdIndex:n,options:i,priority:a,requestType:s,additionalDetails:l}=e;o.A.addRequest(t.bind(this,r,n,i),s,l,a)}),Promise.resolve(!0)}_prefetchImageIds(){this.loadStatus.loading=!0;let e=[...this.getImageIdsToLoad()];return this.totalNumFrames=this.imageIds.length,this.autoRenderOnLoad&&(this.reRenderFraction=.02*this.totalNumFrames,this.reRenderTarget=this.reRenderFraction),this.imagesLoader.loadImages(e,this).catch(e=>{console.debug("progressive loading failed to complete",e)})}_addScalingToVolume(e){if(this.scaling)return;let{suvbw:t,suvlbm:r,suvbsa:n}=e,i={};r&&(i.suvbwToSuvlbm=r/t),n&&(i.suvbwToSuvbsa=n/t),t&&(i.suvbw=t),this.scaling={PT:i}}checkDimensionGroupCompletion(e){}}let y=v},63247:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});class n{constructor(e){this.opacity=.4,this.outlineOpacity=.4,this.transferFunction=[],this.colorCache=new Map,this.actor=e}setRGBTransferFunction(e,t){this.transferFunction[e]=t,this.invalidateColorCache()}getRGBTransferFunction(e=0){return this.transferFunction[e]}setScalarOpacity(e,t){if(t?.getValue){this.scalarOpacityFunction=t,this.invalidateColorCache();return}if(e?.getValue){this.scalarOpacityFunction=e,this.invalidateColorCache();return}"number"==typeof e&&(this.opacity=e,this.invalidateColorCache())}getScalarOpacity(){return this.scalarOpacityFunction}getOpacity(){return this.opacity}setInterpolationTypeToNearest(){}setUseLabelOutline(){}setLabelOutlineOpacity(e){this.outlineOpacity=e}setLabelOutlineThickness(){}modified(){this.invalidateColorCache()}getColorBytes(e,t,r=0){let n=this.colorCache.get(e);if(!n){let t=this.transferFunction[0];if(t){let r=Math.min(Math.max(this.scalarOpacityFunction?.getValue?this.scalarOpacityFunction.getValue(e):this.opacity,0),1);n=[Math.round(255*Math.min(Math.max(t.getRedValue(e),0),1)),Math.round(255*Math.min(Math.max(t.getGreenValue(e),0),1)),Math.round(255*Math.min(Math.max(t.getBlueValue(e),0),1)),Math.round(255*r)]}else n=[0,0,0,0];this.colorCache.set(e,n)}return t&&(t[r]=n[0],t[r+1]=n[1],t[r+2]=n[2],t[r+3]=n[3]),n}getColor(e){let[t,r,n,i]=this.getColorBytes(e);return[t/255,r/255,n/255,i/255]}invalidateColorCache(){this.colorCache.clear(),this.actor.modified()}}class i{constructor(e){this.actor=e}getInputData(){return this.actor.getImage()}modified(){this.actor.modified()}}class a{constructor(e,t){this.canvasProperties=new n(this),this.visibility=!1,this.mapper=new i(this),this.rasterDirty=!0,this.hasCachedRaster=!1,this.className="CanvasActor",this.derivedImage=t,this.viewport=e}renderRLE(e,t,r){let{width:n,height:i}=this.image,{canvas:a}=this;if(a&&a.width===n&&a.height===i||(this.canvas=a=new window.OffscreenCanvas(n,i),this.cachedImageData=void 0,this.rasterDirty=!0),!this.rasterDirty){this.hasCachedRaster&&t.drawImage(a,0,0);return}let o=a.getContext("2d"),s=this.cachedImageData;s||(s=o.createImageData(n,i),this.cachedImageData=s);let{data:l}=s;l.fill(0);let{map:u}=r,c=!1;for(let e=0;ee.imageData.worldToIndex(t),indexToWorld:(t,r)=>e.imageData.indexToWorld(t,r),getDimensions:()=>e.dimensions,getScalarData:()=>this.derivedImage?.getPixelData(),getDirection:()=>e.direction,getSpacing:()=>e.spacing,setOrigin:()=>null,setDerivedImage:e=>{this.derivedImage=e,this.image=null,this.modified()},modified:()=>null}),this.image}}},63467:(e,t,r)=>{"use strict";r.d(t,{IQ:()=>o,Y1:()=>s,tF:()=>l});var n=r(36505),i=r(79267),a=r(33011);function o(e){switch(e){case a.A.MAXIMUM_INTENSITY_BLEND:return n.m.MAX;case a.A.MINIMUM_INTENSITY_BLEND:return n.m.MIN;case a.A.AVERAGE_INTENSITY_BLEND:case a.A.COMPOSITE:return n.m.MEAN;case a.A.LABELMAP_EDGE_PROJECTION_BLEND:return n.m.MAX;default:return}}function s(e){switch(e){case n.m.MAX:return a.A.MAXIMUM_INTENSITY_BLEND;case n.m.MIN:return a.A.MINIMUM_INTENSITY_BLEND;case n.m.MEAN:return a.A.AVERAGE_INTENSITY_BLEND;default:return a.A.COMPOSITE}}function l(e){return"number"!=typeof e||e<=0?0:Math.max(e,i.Cf.MINIMUM_SLAB_THICKNESS)}},63518:(e,t,r)=>{"use strict";e.exports=new(r(50026))("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;let t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"})},63701:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(95525);function i(e,t,r,a=!0){let o=[],s=e.length,l=s-(a?1:2);for(let i=0;i<=l;i++){let a=e[i],l=i===s-1?0:i+1,u=e[l];(0,n.A)(t,r,a,u)&&o.push([i,l])}return o}},64079:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>M});var n=r(17042),i=r(99298),a=r(87352),o=r(19047),s=r(87592),l=r(51680),u=r(21626),c=r(27255),d=r(69927),p=r(57236);r(10463);var m=r(35666),h=r(5889),f=r(72188),g=r(56929),v=r(61052),y=r(9731),b=r(86077),I=r(89988),x=r(67931),C=r(38460),A=r(72663),T=r(38008),S=r(21241),w=r(85250),{vtkErrorMacro:O}=n.o$,P=e=>e.split("\n").map(e=>e.trim()).filter(Boolean);function _(e,t,r){return t.identity(r),e.reduce((e,r,n)=>0===n?r?t.copy(e,r):t.identity(e):r?t.multiply(e,e,r):e,r)}var E={VBOBuildTime:{},VBOBuildString:null,haveSeenDepthRequest:!1,lastHaveSeenDepthRequest:!1,lastIndependentComponents:!1,lastUseLabelOutline:!1,lastNumValidInputs:0,lastNumberOfComponents:0,lastMultiTexturePerVolumeEnabled:!1,lastSlabThickness:0,lastSlabTrapezoidIntegration:0,lastSlabType:-1,scalarTextures:[],_scalarTexturesCore:[],colorTexture:null,_colorTextureCore:null,pwfTexture:null,_pwfTextureCore:null,labelOutlineProperties:[],labelOutlineThicknessTexture:null,_labelOutlineThicknessHash:null,labelOutlineOpacityTexture:null,_labelOutlineOpacityHash:null,_externalOpenGLTexture:!1,resliceGeom:null,resliceGeomUpdateString:null,tris:null};function D(e,t,r={}){Object.assign(t,E,r),f.A.extend(e,t,r),I.A.implementReplaceShaderCoincidentOffset(e,t,r),I.A.implementBuildShadersWithReplacements(e,t,r),t.tris=b.Ay.newInstance(),t.scalarTextures=[],t.colorTexture=null,t.pwfTexture=null,t.VBOBuildTime={},(0,n.WL)(t.VBOBuildTime),t.tmpMat4=w.identity(new Float64Array(16)),t._tmpTexelSize=[0,0,0],t.outlineFilter=c.Ay.newInstance(),t.outlineFilter.setGenerateFaces(!0),t.outlineFilter.setGenerateLines(!1),t.cubePolyData=o.Ay.newInstance(),t.cutter=l.Ay.newInstance(),t.lineToSurfaceFilter=u.Ay.newInstance(),t.transform=s.Ay.newInstance(),(0,n.Jt)(e,t,["scalarTextures"]);t.classHierarchy.push("vtkOpenGLImageResliceMapper");let g=new Map;function R(t,r,n){r!==n&&(!function(t,r){if(!r)return;let n=(g.get(r)??0)-1;n<=0?(t.unregisterGraphicsResourceUser(r,e),g.delete(r)):g.set(r,n)}(t,r),function(t,r){if(!r)return;let n=g.get(r)??0;g.set(r,n+1),n<=0&&t.registerGraphicsResourceUser(r,e)}(t,n))}function M(t){[...g.keys()].forEach(r=>t.unregisterGraphicsResourceUser(r,e))}function N(e,r,n,i,a){let{hash:o}=(0,C.oG)(e.map(e=>({property:e})),e=>e);o!==t[i]&&(t[i]=o,t[a]&&t[a].releaseGraphicsResources(),t[a]=function(e,r,n){let{width:i,height:a}=(0,C.oG)(e.map(e=>({property:e})),e=>e),o=t.renderable.getLabelOutlineTextureWidth();o<=0&&(o=Math.max(i,t.context.getParameter(t.context.MAX_TEXTURE_SIZE)));let s=new r(o*a);(0,C.X1)(s,e,o);let l=v.Ay.newInstance({resizable:!1});return l.setOpenGLRenderWindow(t._openGLRenderWindow),l.resetFormatAndType(),l.setMinificationFilter(h.dJ.NEAREST),l.setMagnificationFilter(h.dJ.NEAREST),l.create2DFromRaw({width:o,height:a,numComps:1,dataType:n,data:s}),l}(e,r,n))}e.buildPass=r=>{if(r){t.currentRenderPass=null,t._openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");let r=t._openGLRenderer.getRenderable();t._openGLCamera=t._openGLRenderer.getViewNodeFor(r.getActiveCamera(),t.openGLCamera);let n=t._openGLRenderWindow;t._openGLRenderWindow=t._openGLRenderer.getLastAncestorOfType("vtkOpenGLRenderWindow"),n&&!n.isDeleted()&&n!==t._openGLRenderWindow&&M(n),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow)}},e.translucentPass=(r,n)=>{r&&(t.currentRenderPass=n,e.render())},e.zBufferPass=r=>{r&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,r)=>t.renderable.getResolveCoincidentTopology()==p.XK.PolygonOffset?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{let r=t._openGLImageSlice.getRenderable(),n=t._openGLRenderer.getRenderable();e.renderPiece(n,r)},e.renderPiece=(r,n)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update();let i=t.renderable.getNumberOfInputPorts();t.currentValidInputs=[];for(let e=0;e1,t.numberOfComponents=t.multiTexturePerVolumeEnabled?a:o.getNumberOfComponents(),e.updateResliceGeometry(),e.renderPieceStart(r,n),e.renderPieceDraw(r,n),e.renderPieceFinish(r,n),e.invokeEvent({type:"EndEvent"})},e.renderPieceStart=(r,n)=>{e.updateBufferObjects(r,n);let i=n.getProperties();t.currentValidInputs.forEach(({inputIndex:e},r)=>{let n=i[e],a=t.scalarTextures[r];n&&a&&(n.getInterpolationType()===m.V.NEAREST?(a.setMinificationFilter(h.dJ.NEAREST),a.setMagnificationFilter(h.dJ.NEAREST)):(a.setMinificationFilter(h.dJ.LINEAR),a.setMagnificationFilter(h.dJ.LINEAR)))}),i[t.currentValidInputs[0].inputIndex]?.getInterpolationType()===m.V.NEAREST?(t.colorTexture.setMinificationFilter(h.dJ.NEAREST),t.colorTexture.setMagnificationFilter(h.dJ.NEAREST),t.pwfTexture.setMinificationFilter(h.dJ.NEAREST),t.pwfTexture.setMagnificationFilter(h.dJ.NEAREST)):(t.colorTexture.setMinificationFilter(h.dJ.LINEAR),t.colorTexture.setMagnificationFilter(h.dJ.LINEAR),t.pwfTexture.setMinificationFilter(h.dJ.LINEAR),t.pwfTexture.setMagnificationFilter(h.dJ.LINEAR)),t.lastBoundBO=null},e.renderPieceDraw=(r,n)=>{let i=t.context,a=t.labelOutlineProperties.length>0,o=[...t.scalarTextures,t.colorTexture,t.pwfTexture];a&&(o.push(t.labelOutlineThicknessTexture),o.push(t.labelOutlineOpacityTexture)),o.forEach(e=>e.activate()),e.updateShaders(t.tris,r,n),i.drawArrays(i.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),o.forEach(e=>e.deactivate())},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,r)=>{e.getNeedToRebuildBufferObjects(t,r)&&e.buildBufferObjects(t,r)},e.getNeedToRebuildBufferObjects=(r,n)=>{let i=n.getProperty(t.currentValidInputs[0].inputIndex),a=t.labelOutlineProperties.length>0;return t.VBOBuildTime.getMTime()t.VBOBuildTime.getMTime()!!e?.getHandle())||!t.colorTexture?.getHandle()||!t.pwfTexture?.getHandle()||a&&(!t.labelOutlineThicknessTexture?.getHandle()||!t.labelOutlineOpacityTexture?.getHandle())},e.buildBufferObjects=(r,n)=>{let o=n.getProperties();t.currentValidInputs.forEach(({imageData:e,inputIndex:r},n)=>{let i=e.getPointData().getScalars(),a=t._openGLRenderWindow.getGraphicsResourceForObject(i),s=(0,x.eS)(e,i),l=!a?.oglObject?.getHandle()||a?.hash!==s,u=o[r],c=u?.getUpdatedExtents()??[],d=!!c.length;if(l&&!d){let r=v.Ay.newInstance();r.setOpenGLRenderWindow(t._openGLRenderWindow);let a=e.getDimensions();r.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),r.resetFormatAndType(),r.create3DFilterableFromDataArray({width:a[0],height:a[1],depth:a[2],dataArray:i}),t._openGLRenderWindow.setGraphicsResourceForObject(i,r,s),t.scalarTextures[n]=r}else t.scalarTextures[n]=a.oglObject;if(d){u.setUpdatedExtents([]);let r=e.getDimensions();t.scalarTextures[n].create3DFilterableFromDataArray({width:r[0],height:r[1],depth:r[2],dataArray:i,updatedExtents:c})}R(t._openGLRenderWindow,t._scalarTexturesCore[n],i),t._scalarTexturesCore[n]=i});let s=o[t.currentValidInputs[0].inputIndex];if(!s)return void O("Missing property for first input");let l=s.getIndependentComponents(),u=l?t.numberOfComponents:1,c=l?2*u:1,p=[];for(let e=0;e0&&(e.updateLabelOutlineThicknessTexture(t.labelOutlineProperties),e.updateLabelOutlineOpacityTexture(t.labelOutlineProperties));let C=`${t.resliceGeom.getMTime()}A${t.renderable.getSlabThickness()}`;if(!t.tris.getCABO().getElementCount()||t.VBOBuildString!==C){let e=a.Ay.newInstance({numberOfComponents:3,values:t.resliceGeom.getPoints().getData()});e.setName("points");let r=a.Ay.newInstance({numberOfComponents:1,values:t.resliceGeom.getPolys().getData()}),n={points:e,cellOffset:0};if(t.renderable.getSlabThickness()>0){let e=t.resliceGeom.getPointData().getNormals();e?n.normals=e:O("Slab mode requested without normals")}t.tris.getCABO().createVBO(r,"polys",d.YL.SURFACE,n)}t.VBOBuildString=C,t.VBOBuildTime.modified()},e.updateShaders=(r,n,i)=>{if(t.lastBoundBO=r,e.getNeedToRebuildShaders(r,n,i)){let a={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(a,n,i);let o=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);o!==r.getProgram()&&(r.setProgram(o),r.getVAO().releaseGraphicsResources()),r.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(r.getProgram());r.getVAO().bind(),e.setMapperShaderParameters(r,n,i),e.setCameraShaderParameters(r,n,i),e.setPropertyShaderParameters(r,n,i)},e.setMapperShaderParameters=(r,n,i)=>{let a=r.getProgram(),o=t.currentValidInputs[0].imageData;if(r.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>r.getAttributeUpdateTime().getMTime()||r.getShaderSourceTime().getMTime()>r.getAttributeUpdateTime().getMTime())){t.scalarTextures.forEach((e,t)=>{a.setUniformi(`volumeTexture[${t}]`,e.getTextureUnit())}),a.isAttributeUsed("vertexWC")&&!r.getVAO().addAttributeArray(a,r.getCABO(),"vertexWC",r.getCABO().getVertexOffset(),r.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)&&O("Error setting vertexWC in shader VAO."),a.isAttributeUsed("normalWC")&&!r.getVAO().addAttributeArray(a,r.getCABO(),"normalWC",r.getCABO().getNormalOffset(),r.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)&&O("Error setting normalWC in shader VAO."),a.isUniformUsed("slabThickness")&&a.setUniformf("slabThickness",t.renderable.getSlabThickness()),a.isUniformUsed("spacing")&&a.setUniform3fv("spacing",o.getSpacing()),a.isUniformUsed("slabType")&&a.setUniformi("slabType",t.renderable.getSlabType()),a.isUniformUsed("slabTrapezoid")&&a.setUniformi("slabTrapezoid",t.renderable.getSlabTrapezoidIntegration());let e=r.getCABO().getCoordShiftAndScaleEnabled()?r.getCABO().getInverseShiftAndScaleMatrix():null;for(let r=0;r{let i=t._openGLCamera.getKeyMatrices(r),a=t._openGLImageSlice.getKeyMatrices(),o=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,s=e.getProgram();s.isUniformUsed("MCPCMatrix")&&(w.identity(t.tmpMat4),s.setUniformMatrix("MCPCMatrix",_([i.wcpc,a.mcwc,o],w,t.tmpMat4))),s.isUniformUsed("MCVCMatrix")&&(w.identity(t.tmpMat4),s.setUniformMatrix("MCVCMatrix",_([i.wcvc,a.mcwc,o],w,t.tmpMat4)))},e.setPropertyShaderParameters=(e,r,n)=>{let i=e.getProgram(),a=n.getProperty(t.currentValidInputs[0].inputIndex),o=t.multiTexturePerVolumeEnabled?1:a.getOpacity();i.setUniformf("opacity",o);let s=t.numberOfComponents,l=a.getIndependentComponents(),u=t.multiTexturePerVolumeEnabled,c=n.getProperties();if(l)for(let e=0;e0){let e=t.labelOutlineThicknessTexture.getTextureUnit();i.setUniformi("labelOutlineThicknessTexture",e);let r=t.labelOutlineOpacityTexture.getTextureUnit();i.setUniformi("labelOutlineOpacityTexture",r);let n=t.renderable.getLabelOutlineTextureWidth();n<=0&&(n=t.context.getParameter(t.context.MAX_TEXTURE_SIZE)),i.setUniformf("labelOutlineTextureWidth",n),i.setUniformf("numLabelmaps",t.labelOutlineProperties.length);let{tangent1:a,tangent2:o}=(0,T.s)(t.renderable.getSlicePlane());for(let e=0;e{let i=n.getProperty(t.currentValidInputs[0].inputIndex).getIndependentComponents(),a=t.labelOutlineProperties.length>0,o=t.renderable.getSlabThickness(),s=t.renderable.getSlabType(),l=t.renderable.getSlabTrapezoidIntegration(),u=!1;(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(u=!0);let c=t.currentValidInputs?.length??0;return(!!u||t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||t.lastNumberOfComponents!==t.numberOfComponents||t.lastMultiTexturePerVolumeEnabled!==t.multiTexturePerVolumeEnabled||e.getProgram()?.getHandle()===0||t.lastIndependentComponents!==i||t.lastUseLabelOutline!==a||t.lastNumValidInputs!==c||t.lastSlabThickness!==o||t.lastSlabType!==s||t.lastSlabTrapezoidIntegration!==l)&&(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastNumberOfComponents=t.numberOfComponents,t.lastMultiTexturePerVolumeEnabled=t.multiTexturePerVolumeEnabled,t.lastIndependentComponents=i,t.lastUseLabelOutline=a,t.lastNumValidInputs=c,t.lastSlabThickness=o,t.lastSlabType=s,t.lastSlabTrapezoidIntegration=l,!0)},e.getShaderTemplate=(e,t,r)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\n// all variables that represent positions or directions have a suffix\n// indicating the coordinate system they are in. The possible values are\n// MC - Model coordinates\n// WC - World coordinates\n// VC - View coordinates\n// DC - Display coordinates\n// TC - Texture coordinates\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvoid main()\n{\n //VTK::PositionVC::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Picking::Impl\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the gpu image mapper fragment shader\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n //VTK::TCoord::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n",e.Geometry=""},e.replaceShaderValues=(r,n,i)=>{if(e.replaceShaderTCoord(r,n,i),e.replaceShaderPositionVC(r,n,i),t.haveSeenDepthRequest){let e=r.Fragment;e=y.A.substitute(e,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,r.Fragment=e=y.A.substitute(e,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result}e.replaceShaderCoincidentOffset(r,n,i)},e.replaceShaderTCoord=(e,r,n)=>{let i=e.Vertex,a=e.Geometry,o=e.Fragment,s=t.labelOutlineProperties.length>0,l=t.renderable.getSlabThickness();i=y.A.substitute(i,"//VTK::TCoord::Dec",[]).result,i=y.A.substitute(i,"//VTK::TCoord::Impl",[]).result;let u=t.numberOfComponents,c=n.getProperty(t.currentValidInputs[0].inputIndex).getIndependentComponents(),d=t.scalarTextures.length,p=[`uniform highp sampler3D volumeTexture[${d}];`,"uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;"];for(let e=0;e0&&(p=(p=p.concat(["uniform vec3 spacing;","uniform float slabThickness;","uniform int slabType;","uniform int slabTrapezoid;","uniform vec3 vboScaling;"])).concat(["vec4 compositeValue(vec4 currVal, vec4 valToComp, int trapezoid)","{"," vec4 retVal = vec4(1.0);"," if (slabType == 0) // min"," {"," retVal = min(currVal, valToComp);"," }"," else if (slabType == 1) // max"," {"," retVal = max(currVal, valToComp);"," }"," else if (slabType == 3) // sum"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," else // mean"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," return retVal;","}"]),s&&!c&&1===u&&(p=(p=p.concat(["uniform mat4 MCVCMatrix;"])).concat(["// Returns a bitmask of the labels (1..31) present along the slab","// centered at startTC. Marches in texture space and exits as soon as","// the ray leaves the unit cube, so only the in-volume portion of the","// slab is sampled regardless of how large the slab thickness is.","int labelSlabMask(vec3 startTC, vec3 stepTC, float halfSlab, float stepLen)","{"," int mask = 0;"," vec3 tc = startTC;"," float dist = 0.0;"," for (int i = 0; i < 4096; ++i)"," {"," if (dist > halfSlab) { break; }"," if (any(greaterThan(tc, vec3(1.0))) || any(lessThan(tc, vec3(0.0)))) { break; }"," int label = int(texture(volumeTexture[0], tc).r * 255.0 + 0.5);"," if (label > 0 && label < 32) { mask |= (1 << label); }"," tc += stepTC;"," dist += stepLen;"," }"," tc = startTC - stepTC;"," dist = stepLen;"," for (int i = 0; i < 4096; ++i)"," {"," if (dist > halfSlab) { break; }"," if (any(greaterThan(tc, vec3(1.0))) || any(lessThan(tc, vec3(0.0)))) { break; }"," int label = int(texture(volumeTexture[0], tc).r * 255.0 + 0.5);"," if (label > 0 && label < 32) { mask |= (1 << label); }"," tc -= stepTC;"," dist += stepLen;"," }"," return mask;","}","","// Number of stepTC-sized steps from p that stay inside the unit cube","float labelSlabBoxSteps(vec3 p, vec3 stepTC)","{"," vec3 limit = vec3(65536.0);"," if (stepTC.x > 1e-8) { limit.x = (1.0 - p.x) / stepTC.x; }"," else if (stepTC.x < -1e-8) { limit.x = -p.x / stepTC.x; }"," if (stepTC.y > 1e-8) { limit.y = (1.0 - p.y) / stepTC.y; }"," else if (stepTC.y < -1e-8) { limit.y = -p.y / stepTC.y; }"," if (stepTC.z > 1e-8) { limit.z = (1.0 - p.z) / stepTC.z; }"," else if (stepTC.z < -1e-8) { limit.z = -p.z / stepTC.z; }"," return min(limit.x, min(limit.y, limit.z));","}","","// First label of labelMask found when marching the slab from its","// viewer-side end toward the back, so overlapping labels resolve in","// depth order; returns 0 when none of the mask labels is found","int labelSlabFrontLabel(vec3 startTC, vec3 towardCameraTC, float halfSlab, float stepLen, int labelMask)","{"," float slabSteps = halfSlab / stepLen;"," float nFront = min(slabSteps, labelSlabBoxSteps(startTC, towardCameraTC));"," float nBack = min(slabSteps, labelSlabBoxSteps(startTC, -towardCameraTC));"," vec3 tc = startTC + towardCameraTC * nFront;"," int totalSteps = int(nFront + nBack) + 1;"," for (int i = 0; i < 8192; ++i)"," {"," if (i >= totalSteps) { break; }"," int label = int(texture(volumeTexture[0], tc).r * 255.0 + 0.5);"," if (label > 0 && label < 32 && (labelMask & (1 << label)) != 0) { return label; }"," tc -= towardCameraTC;"," }"," return 0;","}"]))),o=y.A.substitute(o,"//VTK::TCoord::Dec",p).result;let m=["vec3 fragWorldPos = vertexWCVSOutput.xyz;","vec3 fragTexCoord = (WCTCMatrix0 * vec4(fragWorldPos, 1.0)).xyz;","if (any(greaterThan(fragTexCoord, vec3(1.0))) || any(lessThan(fragTexCoord, vec3(0.0))))","{"," // set the background color and exit"," gl_FragData[0] = backgroundColor;"," return;","}","vec4 tvalue = rawSampleTexture(fragWorldPos);"];if(l>0&&(m=m.concat(["// Get the first and last samples","int numSlices = 1;","float scaling = min(min(spacing.x, spacing.y), spacing.z) * 0.5;","vec3 slabNormal = normalize(normalWCVSOutput);","vec3 normalxspacing = scaling * slabNormal;","float distTraveled = length(normalxspacing);","int trapezoid = 0;","// Each march direction leaves the volume for good once it exits the","// unit cube (the sample positions are monotonic along a line and the","// cube is convex), so the loop can stop as soon as both directions","// have exited. Slab thicknesses larger than the volume then only cost","// the in-volume portion of the march.","bool negExited = false;","bool posExited = false;","while (distTraveled < slabThickness * 0.5)","{"," distTraveled += length(normalxspacing);"," float fnumSlices = float(numSlices);"," bool atSlabBoundary = false;"," if (distTraveled > slabThickness * 0.5)"," {"," // Before stepping outside the slab, sample at the boundaries"," normalxspacing = slabNormal * slabThickness * 0.5 / fnumSlices;"," trapezoid = slabTrapezoid;"," atSlabBoundary = true;"," }"," vec3 worldPosNeg = vertexWCVSOutput.xyz - fnumSlices * normalxspacing * vboScaling;"," vec3 fragTCoordNeg = (WCTCMatrix0 * vec4(worldPosNeg, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = rawSampleTexture(worldPosNeg);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }"," else if (!atSlabBoundary)"," {"," negExited = true;"," }"," vec3 worldPosPos = vertexWCVSOutput.xyz + fnumSlices * normalxspacing * vboScaling;"," vec3 fragTCoordPos = (WCTCMatrix0 * vec4(worldPosPos, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordPos, vec3(1.0))) && !any(lessThan(fragTCoordPos, vec3(0.0))))"," {"," vec4 newVal = rawSampleTexture(worldPosPos);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }"," else if (!atSlabBoundary)"," {"," posExited = true;"," }"," if (negExited && posExited) { break; }","}","// Finally, if slab type is *mean*, divide the sum by the numSlices","if (slabType == 2)","{"," tvalue = tvalue / float(numSlices);","}"])),c){let e=["r","g","b","a"];for(let t=0;tn.getProperty(t.currentValidInputs[e].inputIndex)?.getUseLabelOutline()):[];m=r.length>0?m.concat(function(e,t){let r=["r","g","b","a"],n=Array.from({length:t},(e,t)=>t).filter(t=>!e.includes(t)),i=e.map(e=>`vec3 labelTexCoord${e} = (WCTCMatrix${e} * vec4(fragWorldPos, 1.0)).xyz;`).join("\n "),a=0===e.length?"":`float neighborLabel = ${e.map((e,t)=>0===t?`(labelInputIdx == ${t}) ? texture(volumeTexture[${e}], neighborTexCoord).r`:` : (labelInputIdx == ${t}) ? texture(volumeTexture[${e}], neighborTexCoord).r`).join("")} : 0.0;`,o=[...n,...e].map(t=>{let n=e.includes(t),i=e.indexOf(t);return n?` + // Process input ${t} as labelmap + { + float labelValue = tvalue.${r[t]}; + int segmentIndex = int(labelValue * 255.0); + + if (segmentIndex > 0) { + float textureCoordinate = float(segmentIndex - 1) / labelOutlineTextureWidth; + float labelmapRow = (float(${i}) + 0.5) / numLabelmaps; + float thicknessValue = texture2D(labelOutlineThicknessTexture, vec2(textureCoordinate, labelmapRow)).r; + float labelOutlineOpacityValue = texture2D(labelOutlineOpacityTexture, vec2(textureCoordinate, labelmapRow)).r; + int actualThickness = int(thicknessValue * 255.0); + + vec3 currentLabelTC = labelTexCoord${t}; + vec3 currentTexelSize = texelSize${t}; + vec3 currentTangent1 = outlineTangent1_${t}; + vec3 currentTangent2 = outlineTangent2_${t}; + + bool pixelOnBorder = false; + int labelInputIdx = ${i}; + for (int i = -actualThickness; i <= actualThickness; i++) { + for (int j = -actualThickness; j <= actualThickness; j++) { + if (i == 0 && j == 0) continue; + vec3 neighborTexCoord = currentLabelTC + float(i) * currentTangent1 * currentTexelSize + float(j) * currentTangent2 * currentTexelSize; + if (any(greaterThan(neighborTexCoord, vec3(1.0))) || any(lessThan(neighborTexCoord, vec3(0.0)))) { + pixelOnBorder = true; + break; + } + ${a} + if (neighborLabel != labelValue) { + pixelOnBorder = true; + break; + } + } + if (pixelOnBorder) break; + } + + if (pixelOnBorder) { + convergentColor.rgb = mix(convergentColor.rgb, tcolor${t}.rgb, labelOutlineOpacityValue); + convergentColor.a = max(convergentColor.a, labelOutlineOpacityValue); + } else if (compWeight${t} > 0.0) { + float fillAlpha = compWeight${t} * opacity; + convergentColor.rgb = mix(convergentColor.rgb, tcolor${t}.rgb, fillAlpha); + convergentColor.a = max(convergentColor.a, fillAlpha); + } + } + }`:` + // Process input ${t} as background image + { + float bgAlpha = compWeight${t} * opacity; + convergentColor.rgb = mix(convergentColor.rgb, tcolor${t}.rgb, bgAlpha); + convergentColor.a = max(convergentColor.a, bgAlpha); + }`}).join("\n ");return P(` + // Multi-texture mode: ${e.length>0?`labelmaps at input${e.length>1?"s":""} ${e.join(", ")}`:"no labelmaps"}, ${n.length>0?`background at input${n.length>1?"s":""} ${n.join(", ")}`:"no background"} + vec4 convergentColor = vec4(0.0, 0.0, 0.0, 0.0); + + // Compute labelmap texture coordinates + ${i} + + // Process each input in order + ${o} + + gl_FragData[0] = convergentColor; + `)}(r,u)):m.concat((e=>{if(1===e)return["gl_FragData[0] = vec4(tcolor0.rgb, compWeight0 * opacity);"];let t=Array.from({length:e},(e,t)=>t),r=t.map(e=>`compWeight${e}`).join(" + "),n=t.map(e=>`(tcolor${e}.rgb * (compWeight${e} / weightSum))`).join(" + ");return[`float weightSum = ${r};`,`gl_FragData[0] = vec4(vec3(${n}), opacity);`]})(u))}else switch(u){case 1:m=s&&l>0?m.concat(P(` + // Slab-projected label outline for single component + vec4 slabOutlineResult = vec4(0.0, 0.0, 0.0, 0.0); + // For MAX slabs, a composited value of 0 means no label anywhere + // along the slab, so the expensive mask marches can be skipped. + if (slabType != 1 || tvalue.r >= 0.5 / 255.0) { + vec3 outlineStepTC = (WCTCMatrix0 * vec4(scaling * slabNormal * vboScaling, 0.0)).xyz; + float halfSlab = slabThickness * 0.5; + int centerMask = labelSlabMask(fragTexCoord, outlineStepTC, halfSlab, scaling); + + if (centerMask != 0) { + // A label is on its projected edge when present here but missing in + // some neighbor probed at that label's own outline thickness. Labels + // sharing a thickness reuse the same neighbor masks, so the common + // case still costs four neighbor marches. + float labelmapRow = 0.5 / numLabelmaps; + int edgeLabels = 0; + int prevThickness = -1; + int neighborMask = 0; + for (int s = 1; s < 32; ++s) { + if ((centerMask & (1 << s)) == 0) { continue; } + float thicknessCoordinate = (float(s) - 1.0) / labelOutlineTextureWidth; + int segmentThickness = max(1, int(texture2D(labelOutlineThicknessTexture, vec2(thicknessCoordinate, labelmapRow)).r * 255.0)); + if (segmentThickness != prevThickness) { + vec3 outlineOffset1 = outlineTangent1_0 * texelSize0 * float(segmentThickness); + vec3 outlineOffset2 = outlineTangent2_0 * texelSize0 * float(segmentThickness); + neighborMask = + labelSlabMask(fragTexCoord + outlineOffset1, outlineStepTC, halfSlab, scaling) & + labelSlabMask(fragTexCoord - outlineOffset1, outlineStepTC, halfSlab, scaling) & + labelSlabMask(fragTexCoord + outlineOffset2, outlineStepTC, halfSlab, scaling) & + labelSlabMask(fragTexCoord - outlineOffset2, outlineStepTC, halfSlab, scaling); + prevThickness = segmentThickness; + } + if ((neighborMask & (1 << s)) == 0) { edgeLabels |= (1 << s); } + } + + // When several edge labels compete for this fragment, the one nearest + // the viewer along the slab wins. The camera looks down -z in view + // coordinates, so the slab normal points toward the viewer when its + // view-space z component is positive. + float slabNormalTowardCamera = (MCVCMatrix * vec4(slabNormal, 0.0)).z; + vec3 towardCameraTC = slabNormalTowardCamera > 0.0 ? outlineStepTC : -outlineStepTC; + + if (edgeLabels != 0) { + int edgeLabel = labelSlabFrontLabel(fragTexCoord, towardCameraTC, halfSlab, scaling, edgeLabels); + if (edgeLabel == 0) { + // numeric fallback: smallest edge label + for (int s = 1; s < 32; ++s) { + if ((edgeLabels & (1 << s)) != 0) { edgeLabel = s; break; } + } + } + float labelValue = float(edgeLabel) / 255.0; + vec3 edgeColor = texture2D(colorTexture1, vec2(labelValue * cscale0 + cshift0, 0.5)).rgb; + float opacityCoordinate = (float(edgeLabel) - 1.0) / labelOutlineTextureWidth; + float edgeOpacity = texture2D(labelOutlineOpacityTexture, vec2(opacityCoordinate, labelmapRow)).r; + slabOutlineResult = vec4(edgeColor, edgeOpacity); + } else { + // Interior of the projected labels: regular fill through the + // transfer functions using the label nearest the viewer + int fillLabel = labelSlabFrontLabel(fragTexCoord, towardCameraTC, halfSlab, scaling, centerMask); + float fillValue = fillLabel != 0 ? float(fillLabel) / 255.0 : tvalue.r; + vec3 fillColor = texture2D(colorTexture1, vec2(fillValue * cscale0 + cshift0, 0.5)).rgb; + float fillOpacity = texture2D(pwfTexture1, vec2(fillValue * pwfscale0 + pwfshift0, 0.5)).r; + slabOutlineResult = vec4(fillColor, fillOpacity * opacity); + } + } + } + gl_FragData[0] = slabOutlineResult; + `)):s?m.concat([...P(` + // Label outline mode for single component + float centerValue = tvalue.r; + int segmentIndex = int(centerValue * 255.0); + + // Skip background (segment 0) + if (segmentIndex == 0) { + gl_FragData[0] = vec4(0.0, 0.0, 0.0, 0.0); + return; + } + + // Get outline parameters for this segment (row 0 for single labelmap) + float textureCoordinate = float(segmentIndex - 1) / labelOutlineTextureWidth; + float labelmapRow = 0.5 / numLabelmaps; + float thicknessValue = texture2D(labelOutlineThicknessTexture, vec2(textureCoordinate, labelmapRow)).r; + float outlineOpacity = texture2D(labelOutlineOpacityTexture, vec2(textureCoordinate, labelmapRow)).r; + int actualThickness = int(thicknessValue * 255.0); + + // Get color for this segment + vec3 tColor = texture2D(colorTexture1, vec2(centerValue * cscale0 + cshift0, 0.5)).rgb; + float scalarOpacity = texture2D(pwfTexture1, vec2(centerValue * pwfscale0 + pwfshift0, 0.5)).r; + float opacityToUse = scalarOpacity * opacity; + + // Check neighbors for border detection + bool pixelOnBorder = false; + for (int i = -actualThickness; i <= actualThickness; i++) { + for (int j = -actualThickness; j <= actualThickness; j++) { + if (i == 0 && j == 0) { + continue; + } + // Sample neighbor using tangent vectors in texture space + vec3 neighborTexCoord = fragTexCoord + float(i) * outlineTangent1_0 * texelSize0 + float(j) * outlineTangent2_0 * texelSize0; + + // Skip if outside texture bounds + if (any(greaterThan(neighborTexCoord, vec3(1.0))) || any(lessThan(neighborTexCoord, vec3(0.0)))) { + pixelOnBorder = true; + break; + } + + float neighborValue = texture(volumeTexture[0], neighborTexCoord).r; + if (neighborValue != centerValue) { + pixelOnBorder = true; + break; + } + } + if (pixelOnBorder) { + break; + } + } + + if (pixelOnBorder) { + gl_FragData[0] = vec4(tColor, outlineOpacity); + } else { + gl_FragData[0] = vec4(tColor, opacityToUse); + } + `)]):m.concat(["// Dependent components","float intensity = tvalue.r;","vec3 tcolor = texture2D(colorTexture1, vec2(intensity * cscale0 + cshift0, 0.5)).rgb;","float scalarOpacity = texture2D(pwfTexture1, vec2(intensity * pwfscale0 + pwfshift0, 0.5)).r;","gl_FragData[0] = vec4(tcolor, scalarOpacity * opacity);"]);break;case 2:m=m.concat(["float intensity = tvalue.r*cscale0 + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(intensity, 0.5)).rgb, pwfscale0*tvalue.g + pwfshift0);"]);break;case 3:m=m.concat(["vec4 tcolor = cscale0*tvalue + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, opacity);"]);break;default:m=m.concat(["vec4 tcolor = cscale0*tvalue + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, tcolor.a);"])}o=y.A.substitute(o,"//VTK::TCoord::Impl",m).result,e.Vertex=i,e.Fragment=o,e.Geometry=a},e.replaceShaderPositionVC=(r,n,i)=>{let a=r.Vertex,o=r.Geometry,s=r.Fragment,l=t.renderable.getSlabThickness(),u=["attribute vec4 vertexWC;","varying vec4 vertexWCVSOutput;"];u=u.concat([`//${e.getMTime()}${t.resliceGeomUpdateString}`]),l>0&&(u=u.concat(["attribute vec3 normalWC;","varying vec3 normalWCVSOutput;"])),a=y.A.substitute(a,"//VTK::PositionVC::Dec",u).result;let c=["gl_Position = MCPCMatrix * vertexWC;","vertexWCVSOutput = vertexWC;"];l>0&&(c=c.concat(["normalWCVSOutput = normalWC;"])),a=y.A.substitute(a,"//VTK::PositionVC::Impl",c).result,a=y.A.substitute(a,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result;let d=["varying vec4 vertexWCVSOutput;"];l>0&&(d=d.concat(["varying vec3 normalWCVSOutput;"])),s=y.A.substitute(s,"//VTK::PositionVC::Dec",d).result,r.Vertex=a,r.Geometry=o,r.Fragment=s},e.updateResliceGeometry=()=>{let e=t.currentValidInputs[0].imageData,{resGeomString:r,slicePD:n,slicePlane:i,orthoSlicing:s,orthoAxis:l}=(0,S.A5)(t.renderable,e);if(!t.resliceGeom||t.resliceGeomUpdateString!==r){if(n)t.resliceGeom||(t.resliceGeom=o.Ay.newInstance()),t.resliceGeom.getPoints().setData(n.getPoints().getData(),3),t.resliceGeom.getPolys().setData(n.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(n.getPointData().getNormals());else if(i)if(t.resliceGeom||(t.resliceGeom=o.Ay.newInstance()),s){let{points:r,polys:n,normalsData:o}=(0,S.GP)(e,i,l,t.transform);t.resliceGeom.getPoints().setData(r,3),t.resliceGeom.getPolys().setData(n,1);let s=a.Ay.newInstance({numberOfComponents:3,values:o,name:"Normals"});t.resliceGeom.getPointData().setNormals(s)}else{let{points:r,polys:n,normalsData:o}=(0,S.jr)(e,i,t.outlineFilter,t.cutter,t.lineToSurfaceFilter);t.resliceGeom.getPoints().setData(r,3),t.resliceGeom.getPolys().setData(n,1);let s=a.Ay.newInstance({numberOfComponents:3,values:o,name:"Normals"});t.resliceGeom.getPointData().setNormals(s)}else O("Something went wrong.","A default slice plane should have been created in the beginning of","updateResliceGeometry.");t.resliceGeomUpdateString=r,t.resliceGeom?.modified()}},e.updateLabelOutlineThicknessTexture=e=>{N(e.map(({property:e})=>e.getLabelOutlineThicknessByReference()),Uint8Array,i.JA.UNSIGNED_CHAR,"_labelOutlineThicknessHash","labelOutlineThicknessTexture")},e.updateLabelOutlineOpacityTexture=e=>{N(e.map(({property:e})=>{let t=e.getLabelOutlineOpacity();return"number"==typeof t&&(t=[t]),t}),Float32Array,i.JA.FLOAT,"_labelOutlineOpacityHash","labelOutlineOpacityTexture")},e.setScalarTextures=e=>{t.scalarTextures=[...e],t._externalOpenGLTexture=!0},e.delete=(0,n.cy)(()=>{t._openGLRenderWindow&&M(t._openGLRenderWindow),t.labelOutlineThicknessTexture&&(t.labelOutlineThicknessTexture.releaseGraphicsResources(),t.labelOutlineThicknessTexture=null),t.labelOutlineOpacityTexture&&(t.labelOutlineOpacityTexture.releaseGraphicsResources(),t.labelOutlineOpacityTexture=null)},e.delete)}var R=(0,n.UI)(D,"vtkOpenGLImageResliceMapper"),M={newInstance:R,extend:D};(0,g.c9)("vtkImageResliceMapper",R)},64125:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>C});var n=r(17042),i=r(21122),a=r(56971),o=r(67127),s=r(28193),l=r(73543),{PassTypes:u}=o.A,{SelectionContent:c,SelectionField:d}=a.Ay,{FieldAssociations:p}=i.Ay,{vtkErrorMacro:m,vtkDebugMacro:h}=n.Ay;function f(e){return`${e.propID} ${e.compositeID}`}function g(e,t,r,n){return r?r[(t*(n[2]-n[0]+1)+e)*4+3]:0}function v(e,t,r,n,i=null){if(!r)return 0;let a=(t*(n[2]-n[0]+1)+e)*4,o=r[a],s=r[a+1];return(256*r[a+2]+s)*256+o}function y(e,t){let r=t;return r<<=24,r|=e}function b(e,t,r,n,i){let o=[],s=0;return t.forEach((t,l)=>{let u=a.Ay.newInstance();switch(u.setContentType(c.INDICES),e){case p.FIELD_ASSOCIATION_CELLS:u.setFieldType(d.CELL);break;case p.FIELD_ASSOCIATION_POINTS:u.setFieldType(d.POINT);break;default:m("Unknown field association")}u.getProperties().propID=t.info.propID,u.getProperties().prop=t.info.prop,u.getProperties().compositeID=t.info.compositeID,u.getProperties().attributeID=t.info.attributeID,u.getProperties().pixelCount=t.pixelCount,r&&(u.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],u.getProperties().worldPosition=i.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,n)),u.setSelectionList(t.attributeIDs),o[s]=u,s++}),o}var I={area:void 0,currentPass:-1,propColorValue:null,props:null,maximumPointId:0,maximumCellId:0,idOffset:1};function x(e,t,r={}){Object.assign(t,I,r),s.Ay.extend(e,t,r),t.propColorValue=[0,0,0],t.props=[],t.area||(t.area=[0,0,0,0]),n.Ay.setGetArray(e,t,["area"],4),n.Ay.setGet(e,t,["_renderer","currentPass","_openGLRenderWindow","maximumPointId","maximumCellId"]),n.Ay.setGetArray(e,t,["propColorValue"],3),n.Ay.moveToProtected(e,t,["renderer","openGLRenderWindow"]),n.Ay.event(e,t,"event");t.classHierarchy.push("vtkOpenGLHardwareSelector"),e.releasePixBuffers=()=>{t.rawPixBuffer=[],t.pixBuffer=[],t.zBuffer=null},e.beginSelection=()=>{t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer,t._openGLRenderer),t.maxAttributeId=0;let r=t._openGLRenderWindow.getSize();if(t.framebuffer){t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers();let e=t.framebuffer.getSize();e&&e[0]===r[0]&&e[1]===r[1]?t.framebuffer.bind():(t.framebuffer.create(r[0],r[1]),t.framebuffer.populateFramebuffer())}else t.framebuffer=l.Ay.newInstance(),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.create(r[0],r[1]),t.framebuffer.populateFramebuffer();if(t._openGLRenderer.clear(),t._openGLRenderer.setSelector(e),t.hitProps={},t.propPixels={},t.props=[],e.releasePixBuffers(),t.fieldAssociation===p.FIELD_ASSOCIATION_POINTS){let e=t._openGLRenderWindow.getContext(),r=e.isEnabled(e.BLEND);e.disable(e.BLEND),t._openGLRenderWindow.traverseAllPasses(),r&&e.enable(e.BLEND)}},e.endSelection=()=>{t.hitProps={},t._openGLRenderer.setSelector(null),t.framebuffer.restorePreviousBindingsAndBuffers()},e.preCapturePass=()=>{let e=t._openGLRenderWindow.getContext();t.originalBlending=e.isEnabled(e.BLEND),e.disable(e.BLEND)},e.postCapturePass=()=>{let e=t._openGLRenderWindow.getContext();t.originalBlending&&e.enable(e.BLEND)},e.select=()=>{let r=null;return e.captureBuffers()&&(r=e.generateSelection(t.area[0],t.area[1],t.area[2],t.area[3]),e.releasePixBuffers()),r},e.getSourceDataAsync=async(r,n,i,a,o)=>{if(t._renderer=r,void 0===n){let r=t._openGLRenderWindow.getSize();e.setArea(0,0,r[0]-1,r[1]-1)}else e.setArea(n,i,a,o);if(!e.captureBuffers())return!1;let s={area:[...t.area],pixBuffer:[...t.pixBuffer],captureZValues:t.captureZValues,zBuffer:t.zBuffer,props:[...t.props],fieldAssociation:t.fieldAssociation,renderer:r,openGLRenderWindow:t._openGLRenderWindow};return s.generateSelection=(...e)=>(function(e,t,r,n,i){let a=Math.floor(t),o=Math.floor(r),s=Math.floor(n),l=Math.floor(i),c=new Map,d=[0,0];for(let t=o;t<=l;t++)for(let r=a;r<=s;r++){let n=function e(t,r,n,i){let a=n<0?0:n;if(0===a){if(i[0]=r[0],i[1]=r[1],r[0]t.area[2]||r[1]t.area[3])return null;let e=[r[0]-t.area[0],r[1]-t.area[1]],n=v(e[0],e[1],t.pixBuffer[u.ACTOR_PASS],t.area,"getPixelInformationWithData1");if(n<=0||n-1>=t.props.length)return null;let a={};a.valid=!0,a.propID=n-1,a.prop=t.props[a.propID];let o=v(e[0],e[1],t.pixBuffer[u.COMPOSITE_INDEX_PASS],t.area,"getPixelInformationWithData2");if((o<0||o>0xffffff)&&(o=0),a.compositeID=o-1,t.captureZValues){let n=(e[1]*(t.area[2]-t.area[0]+1)+e[0])*4;a.zValue=(256*t.zBuffer[n]+t.zBuffer[n+1])/65535,a.displayPosition=r}return t.pixBuffer[u.ID_LOW24]&&0===g(e[0],e[1],t.pixBuffer[u.ID_LOW24],t.area)||(a.attributeID=y(v(e[0],e[1],t.pixBuffer[u.ID_LOW24],t.area,"getPixelInformationWithData3"),v(e[0],e[1],t.pixBuffer[u.ID_HIGH24],t.area,"getPixelInformationWithData4"),0)),a}let o=[r[0],r[1]],s=[0,0],l=e(t,r,0,i);if(l&&l.valid)return l;for(let r=1;rr?o[1]-r:0;n<=o[1]+r;++n)if(s[1]=n,o[0]>=r&&(s[0]=o[0]-r,(l=e(t,s,0,i))&&l.valid)||(s[0]=o[0]+r,(l=e(t,s,0,i))&&l.valid))return l;for(let n=o[0]>=r?o[0]-(r-1):0;n<=o[0]+(r-1);++n)if(s[0]=n,o[1]>=r&&(s[1]=o[1]-r,(l=e(t,s,0,i))&&l.valid)||(s[1]=o[1]+r,(l=e(t,s,0,i))&&l.valid))return l}return i[0]=r[0],i[1]=r[1],null}(e,[r,t],0,d);if(n&&n.valid){let t=f(n);if(c.has(t)){let r=c.get(t);r.pixelCount++,e.captureZValues&&n.zValue{if(!t._renderer||!t._openGLRenderWindow)return m("Renderer and view must be set before calling Select."),!1;t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer,t._openGLRenderer),t._openGLRenderWindow.getRenderable().preRender(),e.invokeEvent({type:"StartEvent"}),t.originalBackground=t._renderer.getBackgroundByReference(),t._renderer.setBackground(0,0,0,0);let r=t._openGLRenderWindow.getRenderPasses();e.beginSelection();let n=[];for(t.currentPass=u.MIN_KNOWN_PASS;t.currentPass<=u.MAX_KNOWN_PASS;t.currentPass++)e.passRequired(t.currentPass)&&(e.preCapturePass(t.currentPass),t.captureZValues&&t.currentPass===u.ACTOR_PASS&&"function"==typeof r[0].requestDepth&&"function"==typeof r[0].getFramebuffer&&r[0].requestDepth(),t._openGLRenderWindow.traverseAllPasses(),e.postCapturePass(t.currentPass),e.savePixelBuffer(t.currentPass),n.push(t.currentPass));return n.forEach(r=>{t.currentPass=r,e.processPixelBuffers()}),t.currentPass=u.MAX_KNOWN_PASS,e.endSelection(),t._renderer.setBackground(t.originalBackground),e.invokeEvent({type:"EndEvent"}),!0},e.processPixelBuffers=()=>{t.props.forEach((r,n)=>{e.isPropHit(n)&&r.processSelectorPixelBuffers(e,t.propPixels[n])})},e.passRequired=e=>{if(e===u.ID_HIGH24){if(t.fieldAssociation===p.FIELD_ASSOCIATION_POINTS)return t.maximumPointId>0xffffff;if(t.fieldAssociation===p.FIELD_ASSOCIATION_CELLS)return t.maximumCellId>0xffffff}return!0},e.savePixelBuffer=r=>{if(t.pixBuffer[r]=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),!t.rawPixBuffer[r]){let e=(t.area[2]-t.area[0]+1)*(t.area[3]-t.area[1]+1)*4;t.rawPixBuffer[r]=new Uint8Array(e),t.rawPixBuffer[r].set(t.pixBuffer[r])}if(r===u.ACTOR_PASS){if(t.captureZValues){let e=t._openGLRenderWindow.getRenderPasses();if("function"==typeof e[0].requestDepth&&"function"==typeof e[0].getFramebuffer){let r=e[0].getFramebuffer();r.saveCurrentBindingsAndBuffers(),r.bind(),t.zBuffer=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),r.restorePreviousBindingsAndBuffers()}}e.buildPropHitList(t.rawPixBuffer[r])}},e.buildPropHitList=e=>{let r=0;for(let n=0;n<=t.area[3]-t.area[1];n++)for(let i=0;i<=t.area[2]-t.area[0];i++){let a=v(i,n,e,t.area,"buildPropHitList");a>0&&(--a in t.hitProps||(t.hitProps[a]=!0,t.propPixels[a]=[]),t.propPixels[a].push(4*r)),++r}},e.renderProp=r=>{t.currentPass===u.ACTOR_PASS&&(e.setPropColorValueFromInt(t.props.length+1),t.props.push(r))},e.renderCompositeIndex=r=>{t.currentPass===u.COMPOSITE_INDEX_PASS&&e.setPropColorValueFromInt(r+1)},e.renderAttributeId=e=>{e<0||(t.maxAttributeId=e>t.maxAttributeId?e:t.maxAttributeId)},e.passTypeToString=e=>n.Ay.enumToString(u,e),e.isPropHit=e=>!!t.hitProps[e],e.setPropColorValueFromInt=e=>{t.propColorValue[0]=e%256/255,t.propColorValue[1]=Math.floor(e/256)%256/255,t.propColorValue[2]=Math.floor(e/65536)%256/255},e.getPixelInformation=(r,n,i)=>{let a=n<0?0:n;if(h("getPixelInformation called",a),0===a){if(i[0]=r[0],i[1]=r[1],r[0]t.area[2]||r[1]t.area[3])return null;h(r),h(t.area);let e=[r[0]-t.area[0],r[1]-t.area[1]];h("adjusted displayPosition",e);let n=v(e[0],e[1],t.pixBuffer[u.ACTOR_PASS],t.area,"getPixelInformation");if(h("actorid",n),n<=0||n-1>=t.props.length)return null;let a={};a.valid=!0,a.propID=n-1,a.prop=t.props[a.propID];let o=v(e[0],e[1],t.pixBuffer[u.COMPOSITE_INDEX_PASS],t.area,"getPixelInformation2");if((o<0||o>0xffffff)&&(o=0),a.compositeID=o-1,t.captureZValues){let n=(e[1]*(t.area[2]-t.area[0]+1)+e[0])*4;a.zValue=(256*t.zBuffer[n]+t.zBuffer[n+1])/65535,a.displayPosition=r}return t.pixBuffer[u.ID_LOW24]&&0===g(e[0],e[1],t.pixBuffer[u.ID_LOW24],t.area)||(a.attributeID=y(v(e[0],e[1],t.pixBuffer[u.ID_LOW24],t.area,"getPixelInformation3"),v(e[0],e[1],t.pixBuffer[u.ID_HIGH24],t.area,"getPixelInformation4"))),a}let o=[r[0],r[1]],s=[0,0],l=e.getPixelInformation(r,0,i);if(l&&l.valid)return l;for(let t=1;tt?o[1]-t:0;r<=o[1]+t;++r)if(s[1]=r,o[0]>=t&&(s[0]=o[0]-t,(l=e.getPixelInformation(s,0,i))&&l.valid)||(s[0]=o[0]+t,(l=e.getPixelInformation(s,0,i))&&l.valid))return l;for(let r=o[0]>=t?o[0]-(t-1):0;r<=o[0]+(t-1);++r)if(s[0]=r,o[1]>=t&&(s[1]=o[1]-t,(l=e.getPixelInformation(s,0,i))&&l.valid)||(s[1]=o[1]+t,(l=e.getPixelInformation(s,0,i))&&l.valid))return l}return i[0]=r[0],i[1]=r[1],null},e.generateSelection=(r,n,i,a)=>{let o=Math.floor(r),s=Math.floor(n),l=Math.floor(i),u=Math.floor(a),c=new Map,d=[0,0];for(let r=s;r<=u;r++)for(let n=o;n<=l;n++){let i=[n,r],a=e.getPixelInformation(i,0,d);if(a&&a.valid){let e=f(a);if(c.has(e)){let r=c.get(e);r.pixelCount++,t.captureZValues&&a.zValuet.rawPixBuffer[e],e.getPixelBuffer=e=>t.pixBuffer[e],e.attach=(e,r)=>{t._openGLRenderWindow=e,t._renderer=r};let i=e.setArea;e.setArea=(...e)=>!!i(...e)&&(t.area[0]=Math.floor(t.area[0]),t.area[1]=Math.floor(t.area[1]),t.area[2]=Math.floor(t.area[2]),t.area[3]=Math.floor(t.area[3]),!0)}var C={newInstance:n.Ay.newInstance(x,"vtkOpenGLHardwareSelector"),extend:x,...o.A}},64375:(e,t,r)=>{"use strict";r.d(t,{a:()=>n});let n=e=>Object.values(e).some(e=>"number"==typeof e&&!Number.isInteger(e))},64541:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>v});var n=r(17042),i=r(87352),a=r(36119),o=r(72571),{ScalarMappingTarget:s,Scale:l,VectorMode:u}=a.Ay,{VtkDataTypes:c}=i.Ay,{ColorMode:d}=o.Ay,{vtkErrorMacro:p}=n.Ay;function m(e){return e}function h(e){return Math.floor(255*e+.5)}var f={alpha:1,vectorComponent:0,vectorSize:-1,vectorMode:u.COMPONENT,mappingRange:null,annotationArray:null,annotatedValueMap:null,indexedLookup:!1,scale:l.LINEAR};function g(e,t,r={}){Object.assign(t,f,r),n.Ay.obj(e,t),t.mappingRange=[0,255],t.annotationArray=[],t.annotatedValueMap=[],n.Ay.setGet(e,t,["vectorSize","vectorComponent","vectorMode","alpha","indexedLookup"]),n.Ay.setArray(e,t,["mappingRange"],2),n.Ay.getArray(e,t,["mappingRange"]),t.classHierarchy.push("vtkScalarsToColors"),e.setVectorModeToMagnitude=()=>e.setVectorMode(u.MAGNITUDE),e.setVectorModeToComponent=()=>e.setVectorMode(u.COMPONENT),e.setVectorModeToRGBColors=()=>e.setVectorMode(u.RGBCOLORS),e.build=()=>{},e.isOpaque=()=>!0,e.setAnnotations=(r,n)=>{if((!r||n)&&(r||!n)){if(r&&n&&r.length!==n.length)return void p("Values and annotations do not have the same number of tuples so ignoring");if(t.annotationArray=[],n&&r){let e=n.length;for(let i=0;i{let i=e.checkForAnnotatedValue(r),a=!1;return i>=0?t.annotationArray[i].annotation!==n&&(t.annotationArray[i].annotation=n,a=!0):(t.annotationArray.push({value:r,annotation:n}),i=t.annotationArray.length-1,a=!0),a&&(e.updateAnnotatedValueMap(),e.modified()),i},e.getNumberOfAnnotatedValues=()=>t.annotationArray.length,e.getAnnotatedValue=e=>e<0||e>=t.annotationArray.length?null:t.annotationArray[e].value,e.getAnnotation=e=>void 0===t.annotationArray[e]?null:t.annotationArray[e].annotation,e.getAnnotatedValueIndex=r=>t.annotationArray.length?e.checkForAnnotatedValue(r):-1,e.removeAnnotation=r=>{let n=e.checkForAnnotatedValue(r),i=n>=0;return i&&(t.annotationArray.splice(n,1),e.updateAnnotatedValueMap(),e.modified()),i},e.resetAnnotations=()=>{t.annotationArray=[],t.annotatedValueMap=[],e.modified()},e.getAnnotationColor=(r,n)=>{if(t.indexedLookup){let t=e.getAnnotatedValueIndex(r);e.getIndexedColor(t,n)}else e.getColor(parseFloat(r),n),n[3]=1},e.checkForAnnotatedValue=t=>e.getAnnotatedValueIndexInternal(t),e.getAnnotatedValueIndexInternal=e=>{if(void 0!==t.annotatedValueMap[e]){let r=t.annotationArray.length;return t.annotatedValueMap[e]%r}return -1},e.getIndexedColor=(e,t)=>{t[0]=0,t[1]=0,t[2]=0,t[3]=0},e.updateAnnotatedValueMap=()=>{t.annotatedValueMap=[];let e=t.annotationArray.length;for(let r=0;r{let o=t.getNumberOfComponents(),l=null;if(r===d.DEFAULT&&(t.getDataType()===c.UNSIGNED_CHAR||t.getDataType()===c.UNSIGNED_CHAR_CLAMPED)||r===d.DIRECT_SCALARS&&t)l=e.convertToRGBA(t,o,t.getNumberOfTuples());else{let r={type:"vtkDataArray",name:"temp",numberOfComponents:4,dataType:c.UNSIGNED_CHAR},u=n.Ay.newTypedArray(r.dataType,4*t.getNumberOfTuples());r.values=u,r.size=u.length,l=i.Ay.newInstance(r);let d=a;d<0&&o>1?e.mapVectorsThroughTable(t,l,s.RGBA,-1,-1):(d<0&&(d=0),d>=o&&(d=o-1),e.mapScalarsThroughTable(t,l,s.RGBA,d))}return l},e.mapVectorsToMagnitude=(e,t,r)=>{let n=e.getNumberOfTuples(),i=e.getNumberOfComponents(),a=t.getData(),o=e.getData();for(let e=0;e{let s=e.getVectorMode(),l=o,c=a,d=t.getNumberOfComponents();s===u.COMPONENT?(-1===c&&(c=e.getVectorComponent()),c<0&&(c=0),c>=d&&(c=d-1)):(-1===l&&(l=e.getVectorSize()),l<=0?(c=0,l=d):(c<0&&(c=0),c>=d&&(c=d-1),c+l>d&&(l=d-c)),s===u.MAGNITUDE&&(1===d||1===l)&&(s=u.COMPONENT));let p=0;switch(c>0&&(p=c),s){case u.COMPONENT:e.mapScalarsThroughTable(t,r,n,p);break;case u.RGBCOLORS:break;case u.MAGNITUDE:default:{let a=i.Ay.newInstance({numberOfComponents:1,values:new Float32Array(t.getNumberOfTuples())});e.mapVectorsToMagnitude(t,a,l),e.mapScalarsThroughTable(a,r,n,0)}}},e.luminanceToRGBA=(e,t,r,n)=>{let i=n(r),a=t.getData(),o=e.getData(),s=a.length,l=0;for(let e=0;e{let i=t.getData(),a=e.getData(),o=i.length,s=0;for(let e=0;e{let i=h(r),a=t.getData(),o=e.getData(),s=a.length,l=0;for(let e=0;e{let i=t.getData(),a=e.getData(),o=i.length,s=0;for(let e=0;e{let{alpha:o}=t;if(4===n&&o>=1&&r.getDataType()===c.UNSIGNED_CHAR)return r;let s=i.Ay.newInstance({numberOfComponents:4,empty:!0,size:4*a,dataType:c.UNSIGNED_CHAR});if(a<=0)return s;o=(o=o>0?o:0)<1?o:1;let l=m;switch((r.getDataType()===c.FLOAT||r.getDataType()===c.DOUBLE)&&(l=h),n){case 1:e.luminanceToRGBA(s,r,o,l);break;case 2:e.luminanceAlphaToRGBA(s,r,l);break;case 3:e.rGBToRGBA(s,r,o,l);break;case 4:e.rGBAToRGBA(s,r,o,l);break;default:return p("Cannot convert colors"),null}return s},e.usingLogScale=()=>!1,e.getNumberOfAvailableColors=()=>0x1000000,e.setRange=(t,r)=>e.setMappingRange(t,r),e.getRange=()=>e.getMappingRange(),e.areScalarsOpaque=(r,n,i)=>{if(!r)return e.isOpaque();let a=r.getNumberOfComponents();return(n!==d.DEFAULT||r.getDataType()!==c.UNSIGNED_CHAR)&&n!==d.DIRECT_SCALARS||(3===a||1===a?t.alpha>=1:255===r.getRange(a-1)[0])}}var v={newInstance:n.Ay.newInstance(g,"vtkScalarsToColors"),extend:g,...a.Ay}},64552:(e,t,r)=>{"use strict";function n(e){if(e.length<3)return e.slice();let t=e.map(e=>[e[0],e[1]]).sort((e,t)=>e[0]===t[0]?e[1]-t[1]:e[0]-t[0]);function r(e,t,r){return(t[0]-e[0])*(r[1]-e[1])-(t[1]-e[1])*(r[0]-e[0])}let n=[];for(let e of t){for(;n.length>=2&&0>=r(n[n.length-2],n[n.length-1],e);)n.pop();n.push(e)}let i=[];for(let e=t.length-1;e>=0;e--){let n=t[e];for(;i.length>=2&&0>=r(i[i.length-2],i[i.length-1],n);)i.pop();i.push(n)}return n.pop(),i.pop(),n.concat(i)}r.d(t,{A:()=>n})},64777:(e,t,r)=>{"use strict";function n(e,t){return e.minX<=t.maxX&&e.maxX>=t.minX&&e.minY<=t.maxY&&e.maxY>=t.minY}r.d(t,{A:()=>n})},64966:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.append=function(e,t){e.add(t)},t.extend=function(e,t){t.forEach(e.add,e)},t.prepend=function(e,t){let r=new Set(e);e.clear(),e.add(t),r.forEach(e.add,e)},t.replace=function(e,t,r){let i=new Set;for(let a of e)(0,n.isFunction)(t)?t.call(null,a)?i.add(r):i.add(a):a===t?i.add(r):i.add(a);e.clear(),i.forEach(e.add,e)},t.insert=function(e,t,r){let n=new Set,i=0;for(let a of e)i===r&&n.add(t),n.add(a),i++;e.clear(),n.forEach(e.add,e)},t.remove=function(e,t){if((0,n.isFunction)(t)){let r=[];for(let n of e)t.call(null,n)&&r.push(n);for(let t of r)e.delete(t)}else e.delete(t)},t.empty=function(e){e.clear()},t.contains=function(e,t){if(!(0,n.isFunction)(t))return e.has(t);for(let r of e)if(t.call(null,r))return!0;return!1},t.size=function(e,t){if(void 0===t)return e.size;{let r=0;for(let n of e)t.call(null,n)&&r++;return r}},t.isEmpty=function(e){return 0===e.size},t.forEach=function*(e,t){if(void 0===t)yield*e;else for(let r of e)t.call(null,r)&&(yield r)},t.clone=function(e){return new Set(e)},t.sortInAscendingOrder=function(e,t){let r=Array(...e);return r.sort((e,r)=>t.call(null,e,r)?-1:1),new Set(r)},t.sortInDescendingOrder=function(e,t){let r=Array(...e);return r.sort((e,r)=>t.call(null,e,r)?1:-1),new Set(r)},t.isSubsetOf=i,t.isSupersetOf=function(e,t){return i(t,e)},t.intersection=function(e,t){let r=new Set;for(let n of e)t.has(n)&&r.add(n);return r},t.union=function(e,t){let r=new Set(e);return t.forEach(r.add,r),r},t.range=function(e,t){let r=new Set;for(let n=e;n<=t;n++)r.add(n);return r};let n=r(16950);function i(e,t){for(let r of e)if(!t.has(r))return!1;return!0}},65020:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>d});var n=r(17042),i=r(47224),a=r(78543),o=r(53038),s=r(43561),{vtkErrorMacro:l}=n.Ay,u={device:null,dimension:"2d",handle:null,buffer:null,ready:!1,label:null};function c(e,t,r={}){Object.assign(t,u,r),n.Ay.obj(e,t),n.Ay.get(e,t,["dimension","handle","ready","width","height","depth","format","usage"]),n.Ay.setGet(e,t,["device","label"]);t.classHierarchy.push("vtkWebGPUTexture");let d=(e,r,a,s)=>{let u=o.A.getDetailsFromTextureFormat(t.format),c=r*u.numComponents,d=c*a*s,p=2===u.elementSize&&"float"===u.sampleType;if(!e?.length&&d>0)return l("Texture upload failed: missing nativeArray data."),null;if(e.lengthd?e.subarray(0,d):e,h=m.BYTES_PER_ELEMENT||u.elementSize,f=256*Math.floor((r*u.stride+255)/256),g=((e,t)=>{if(2===e.elementSize&&"float"===e.sampleType)return"Uint16Array";if("sint"===e.sampleType){if(1===e.elementSize)return"Int8Array";if(2===e.elementSize)return"Int16Array";if(4===e.elementSize)return"Int32Array"}else if("unfilterable-float"===e.sampleType){if(4===e.elementSize)return"Float32Array"}else{if(1===e.elementSize)return"Uint8Array";if(2===e.elementSize)return"Uint16Array";if(4===e.elementSize)return"Uint32Array"}return t})(u,m.constructor.name),v=f/(p?2:n.Ay.newTypedArray(g,0).BYTES_PER_ELEMENT);if(!(p||m.constructor.name!==g||c*h!==f))return{data:m,bytesPerRow:f};let y=a*s,b=n.Ay.newTypedArray(g,v*y);if(p)for(let e=0;e{t.device=e,t.width=r.width,t.height=r.height,t.depth=r.depth?r.depth:1,r.dimension?t.dimension=r.dimension:t.dimension=1===t.depth?"2d":"3d",t.format=r.format?r.format:"rgba8unorm",t.mipLevel=r.mipLevel?r.mipLevel:0,t.usage=r.usage?r.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label,dimension:t.dimension,mipLevelCount:t.mipLevel+1})},e.assignFromHandle=(e,r,n)=>{t.device=e,t.handle=r,t.width=n.width,t.height=n.height,t.depth=n.depth?n.depth:1,n.dimension?t.dimension=n.dimension:t.dimension=1===t.depth?"2d":"3d",t.format=n.format?n.format:"rgba8unorm",t.usage=n.usage?n.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST},e.writeImageData=e=>{let r=[],n=r=>{let n=e.originZ??0,i=e.depth??1;t.device.getHandle().queue.copyExternalImageToTexture({source:r,flipY:e.flip},{texture:t.handle,premultipliedAlpha:!0,mipLevel:0,origin:{x:0,y:0,z:n}},[r.width,r.height,i]),"2d"===t.dimension&&1===i&&t.mipLevel>0&&a.Ay.generateMipmaps(t.device.getHandle(),t.handle,t.mipLevel+1),t.ready=!0};if(e.canvas)return void n(e.canvas);if(e.imageBitmap){e.width=e.imageBitmap.width,e.height=e.imageBitmap.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,n(e.imageBitmap);return}if(e.jsImageData){e.width=e.jsImageData.width,e.height=e.jsImageData.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,n(e.jsImageData);return}if(e.image){e.width=e.image.width,e.height=e.image.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,n(e.image);return}e.nativeArray&&(r=e.nativeArray);let i=e.width??t.width,o=e.height??t.height,s=e.depth??1,l=d(r,i,o,s);if(!l)return;let u=l.data;t.device.getHandle().queue.writeTexture({texture:t.handle,mipLevel:0,origin:{x:0,y:0,z:e.originZ??0}},u,{offset:0,bytesPerRow:l.bytesPerRow,rowsPerImage:o},{width:i,height:o,depthOrArrayLayers:s}),"2d"===t.dimension&&1===s&&t.mipLevel>0&&a.Ay.generateMipmaps(t.device.getHandle(),t.handle,t.mipLevel+1),t.ready=!0},e.writeSubImageData=r=>{let n=r.x??0,i=r.y??0,o=r.z??0,s=r.width??t.width-n,u=r.height??t.height-i,c=r.depth??t.depth-o,p=r.nativeArray||[];if(n<0||i<0||o<0||s<=0||u<=0||c<=0?(l(`Texture upload failed: invalid write region origin=(${n}, ${i}, ${o}) size=(${s}, ${u}, ${c}).`),!0):(n+s>t.width||i+u>t.height||o+c>t.depth)&&(l(`Texture upload failed: write region origin=(${n}, ${i}, ${o}) size=(${s}, ${u}, ${c}) exceeds texture extent=(${t.width}, ${t.height}, ${t.depth}).`),!0))return;let m=d(p,s,u,c);m&&(t.device.getHandle().queue.writeTexture({texture:t.handle,mipLevel:0,origin:{x:n,y:i,z:o}},m.data,{offset:0,bytesPerRow:m.bytesPerRow,rowsPerImage:u},{width:s,height:u,depthOrArrayLayers:c}),3!==e.getDimensionality()&&t.mipLevel>0&&a.Ay.generateMipmaps(t.device.getHandle(),t.handle,t.mipLevel+1),t.ready=!0)},e.getScale=()=>{let e=o.A.getDetailsFromTextureFormat(t.format);return 2===e.elementSize&&"float"===e.sampleType?1:255},e.getNumberOfComponents=()=>o.A.getDetailsFromTextureFormat(t.format).numComponents,e.getDimensionality=()=>{let e=0;return t.width>1&&e++,t.height>1&&e++,t.depth>1&&e++,e},e.resizeToMatch=e=>{(e.getWidth()!==t.width||e.getHeight()!==t.height||e.getDepth()!==t.depth)&&(t.width=e.getWidth(),t.height=e.getHeight(),t.depth=e.getDepth(),t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],dimension:t.dimension,format:t.format,usage:t.usage,label:t.label}))},e.resize=(e,r,n=1)=>{(e!==t.width||r!==t.height||n!==t.depth)&&(t.width=e,t.height=r,t.depth=n,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],dimension:t.dimension,format:t.format,usage:t.usage,label:t.label}))},e.createView=(r,n={})=>{n.dimension||("3d"===t.dimension?n.dimension="3d":1===t.depth?n.dimension="2d":n.dimension="2d-array");let i=s.Ay.newInstance({label:r});return i.create(e,n),i}}var d={newInstance:n.Ay.newInstance(c),extend:c}},65110:(e,t,r)=>{"use strict";r.r(t),r.d(t,{toLowHighRange:()=>a,toWindowLevel:()=>i});var n=r(5541);function i(e,t){return{windowWidth:Math.abs(t-e)+1,windowCenter:(e+t+1)/2}}function a(e,t,r=n.A.LINEAR){if(r===n.A.LINEAR||r===n.A.SAMPLED_SIGMOID)return{lower:t-.5-(e-1)/2,upper:t-.5+(e-1)/2};if(r===n.A.LINEAR_EXACT)return{lower:t-e/2,upper:t+e/2};throw Error("Invalid VOI LUT function")}},65114:(e,t,r)=>{"use strict";r(70192)},65240:e=>{!function(){"use strict";var t={864:function(e){var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise(function(r,n){var i,a,o;function s(r){e.removeListener(t,l),n(r)}function l(){"function"==typeof e.removeListener&&e.removeListener("error",s),r([].slice.call(arguments))}f(e,t,l,{once:!0}),"error"!==t&&(i=e,a=s,o={once:!0},"function"==typeof i.on&&f(i,"error",a,o))})},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function s(e){if("function"!=typeof e)throw TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){if(s(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),o=a[t]),void 0===o)o=a[t]=r,++e._eventsCount;else if("function"==typeof o?o=a[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(i=l(e))>0&&o.length>i&&!o.warned){o.warned=!0;var i,a,o,u=Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,console&&console.warn&&console.warn(u)}return e}function c(){if(!this.fired)return(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0==arguments.length)?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=c.bind(n);return i.listener=r,n.wrapFn=i,i}function p(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=Array(e.length),r=0;r0&&(o=t[0]),o instanceof Error)throw o;var o,s=Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var l=a[e];if(void 0===l)return!1;if("function"==typeof l)n(l,this,t);else for(var u=l.length,c=h(l,u),r=0;r=0;a--)if(r[a]===t||r[a].listener===t){o=r[a].listener,i=a;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}}},r={};function n(e){var i=r[e];if(void 0!==i)return i.exports;var a=r[e]={exports:{}},o=!0;try{t[e](a,a.exports,n),o=!1}finally{o&&delete r[e]}return a.exports}n.ab="//",e.exports=n(864)}()},65299:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boundaryPoint_position=function e(t,r){let a=t[0],o=t[1],s=r[0],l=r[1];if(console.assert((0,i.tree_rootNode)(a)===(0,i.tree_rootNode)(s),"Boundary points must share the same root node."),a===s)if(o===l)return n.BoundaryPosition.Equal;else if(o{"use strict";r.d(t,{A:()=>a});var n=r(50923),i=r(41918);let a=function(e,t,r=.999){let a=(0,i.A)(t).viewPlaneNormal;return a?e.filter(e=>{let t=(0,i.A)(e);return!!t.viewPlaneNormal&&Math.abs(n.Om(t.viewPlaneNormal,a))>r}):[]}},65693:(e,t,r)=>{"use strict";var n;r.d(t,{s:()=>n}),function(e){e.FRAME="f",e.SECOND="s"}(n||(n={}))},65704:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=function(e,t){Object.keys(e).forEach(r=>{let n=e[r];void 0!==n&&""!==n&&t.setAttribute(r,n)})}},65974:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.YAMLReader=void 0;let n=r(23246),i=r(9128),a=r(1222);class o extends i.BaseReader{_parse(e,t){let r=(0,a.load)(t);if(void 0===r)throw Error("Unable to parse YAML document.");return new n.ObjectReader(this._builderOptions).parse(e,r)}}t.YAMLReader=o},66368:(e,t,r)=>{"use strict";r.d(t,{x:()=>i});var n=r(88824);let i=e=>{let[t,r]=e;if((0,n.Ay)(t,r))return[1,1];let i=Math.min(t,r);return[Math.round(t/i*1e10)/1e10,Math.round(r/i*1e10)/1e10]}},66384:(e,t,r)=>{"use strict";function n(e,t){return"function"==typeof e?.[t]}function i(e){return n(e,"getCurrentImageId")&&n(e,"getCurrentImageIdIndex")&&n(e,"getImageIds")&&n(e,"hasImageURI")}function a(e){return i(e)&&n(e,"setStack")}function o(e){return i(e)&&n(e,"calibrateSpacing")}function s(e){return n(e,"addVolumes")&&n(e,"setVolumes")}function l(e){return n(e,"hasVolumeId")}function u(e){return n(e,"hasVolumeURI")}function c(e){return l(e)&&n(e,"getActors")}function d(e){return n(e,"setDisplaySets")&&n(e,"setDisplaySetPresentation")&&n(e,"setViewState")}function p(e){return d(e)&&n(e,"getSourceDataId")&&n(e,"getDefaultVOIRange")}function m(e){return n(e,"getCurrentMode")?e.getCurrentMode():void 0}function h(e){let t=m(e);return"volume"===t||"volume3d"===t}function f(e){return"stack"===m(e)}r.d(t,{$O:()=>c,NL:()=>f,T:()=>a,Tf:()=>p,Uv:()=>l,Xu:()=>o,hz:()=>i,nH:()=>m,oX:()=>d,rw:()=>s,vP:()=>u,zb:()=>h})},66644:(e,t,r)=>{"use strict";function n(e,t,r){let n=e[0]<=t[0]?e[0]:t[0],i=e[0]>=t[0]?e[0]:t[0],a=e[1]<=t[1]?e[1]:t[1],o=e[1]>=t[1]?e[1]:t[1];if(!(r[0]>=n-.01&&r[0]<=i+.01&&r[1]>=a-.01&&r[1]<=o+.01))return!1;let s=(t[1]-e[1])*(r[0]-t[0])-(t[0]-e[0])*(r[1]-t[1]);return(s>=0?s:-s)<=.01}r.d(t,{A:()=>n})},66692:(e,t,r)=>{"use strict";var n;r.d(t,{A:()=>i}),function(e){e[e.NEAREST=0]="NEAREST",e[e.LINEAR=1]="LINEAR",e[e.FAST_LINEAR=2]="FAST_LINEAR"}(n||(n={}));let i=n},66791:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.OpaqueOrigin=t.ParserState=void 0,function(e){e[e.SchemeStart=0]="SchemeStart",e[e.Scheme=1]="Scheme",e[e.NoScheme=2]="NoScheme",e[e.SpecialRelativeOrAuthority=3]="SpecialRelativeOrAuthority",e[e.PathOrAuthority=4]="PathOrAuthority",e[e.Relative=5]="Relative",e[e.RelativeSlash=6]="RelativeSlash",e[e.SpecialAuthoritySlashes=7]="SpecialAuthoritySlashes",e[e.SpecialAuthorityIgnoreSlashes=8]="SpecialAuthorityIgnoreSlashes",e[e.Authority=9]="Authority",e[e.Host=10]="Host",e[e.Hostname=11]="Hostname",e[e.Port=12]="Port",e[e.File=13]="File",e[e.FileSlash=14]="FileSlash",e[e.FileHost=15]="FileHost",e[e.PathStart=16]="PathStart",e[e.Path=17]="Path",e[e.CannotBeABaseURLPath=18]="CannotBeABaseURLPath",e[e.Query=19]="Query",e[e.Fragment=20]="Fragment"}(r||(t.ParserState=r={})),t.OpaqueOrigin=["","",null,null]},66831:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>g});var n=r(17042),i=r(11701),a=r(22783),o=r(40815),s=r(95917);function l(e,t,r,n){let i=r[0]-t[0],a=r[1]-t[1],o=r[2]-t[2],s=e[0]-t[0],l=e[1]-t[1],u=e[2]-t[2];n[0]=a*u-o*l,n[1]=o*s-i*u,n[2]=i*l-a*s}function u(e,t,r,n){l(e,t,r,n);let i=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);0!==i&&(n[0]/=i,n[1]/=i,n[2]/=i)}function c(e){e[0]=-1,e[1]=1,e[2]=0,e[3]=-1,e[4]=0,e[5]=1}var d=[[0,1],[1,2],[2,0]],p=[1,2,4],m=[[-1,-1,-1,-1,-1,-1,-1],[0,2,100,-1,-1,-1,-1],[1,0,101,-1,-1,-1,-1],[1,2,100,1,100,101,-1],[2,1,102,-1,-1,-1,-1],[0,1,102,102,100,0,-1],[0,101,2,2,101,102,-1],[100,101,102,-1,-1,-1,-1]],h={};function f(e,t,r={}){Object.assign(t,h,r),o.Ay.extend(e,t,r),t.classHierarchy.push("vtkTriangle"),e.getCellDimension=()=>2,e.intersectWithLine=(r,n,o,l,c)=>{let d={subId:0,t:Number.MAX_VALUE,intersect:0,betweenPoints:!1};c[2]=0;let p=o*o,m=[],h=[],f=[];t.points.getPoint(0,m),t.points.getPoint(1,h),t.points.getPoint(2,f);let g=[];if(u(m,h,f,g),0!==g[0]||0!==g[1]||0!==g[2]){let t=a.Ay.intersectWithLine(r,n,m,g);if(d.betweenPoints=t.betweenPoints,d.t=t.t,l[0]=t.x[0],l[1]=t.x[1],l[2]=t.x[2],!t.intersection)return c[0]=0,c[1]=0,d.intersect=0,d;let i=e.evaluatePosition(l,[],c,[]);if(i.evaluation>=0)return i.dist2<=p?d.intersect=1:d.intersect=i.evaluation,d}let v=(0,i.fm)(m,h),y=(0,i.fm)(h,f),b=(0,i.fm)(f,m);t.line||(t.line=s.Ay.newInstance()),v>y&&v>b?(t.line.getPoints().setPoint(0,m),t.line.getPoints().setPoint(1,h)):y>b&&y>v?(t.line.getPoints().setPoint(0,h),t.line.getPoints().setPoint(1,f)):(t.line.getPoints().setPoint(0,f),t.line.getPoints().setPoint(1,m));let I=t.line.intersectWithLine(r,n,o,l,c);if(d.betweenPoints=I.betweenPoints,d.t=I.t,I.intersect){let e=[],t=[],r=[];for(let n=0;n<3;n++)e[n]=m[n]-f[n],t[n]=h[n]-f[n],r[n]=l[n]-f[n];return c[0]=(0,i.Om)(r,e)/b,c[1]=(0,i.Om)(r,t)/y,d.intersect=1,d}return c[0]=0,c[1]=0,d.intersect=0,d},e.evaluatePosition=(e,r,n,o)=>{let u,c,d,p,m,h,f={subId:0,dist2:0,evaluation:-1},g=[],v=[],y=[],b=[],I=[],x=[],C=[],A=0,T=0,S=[],w=[],O=[],P=[],_=[];f.subId=0,n[2]=0,t.points.getPoint(1,g),t.points.getPoint(2,v),t.points.getPoint(0,y),l(g,v,y,b),a.Ay.generalizedProjectPoint(e,g,b,_);let E=0;for(u=0;u<3;u++)(d=b[u]<0?-b[u]:b[u])>E&&(E=d,T=u);for(c=0,u=0;u<3;u++)u!==T&&(S[c++]=u);for(u=0;u<2;u++)I[u]=_[S[u]]-y[S[u]],x[u]=g[S[u]]-y[S[u]],C[u]=v[S[u]]-y[S[u]];if(0===(A=(0,i.m6)(x,C)))return n[0]=0,n[1]=0,f.evaluation=-1,f;if(n[0]=(0,i.m6)(I,C)/A,n[1]=(0,i.m6)(x,I)/A,o[0]=1-(n[0]+n[1]),o[1]=n[0],o[2]=n[1],o[0]>=0&&o[0]<=1&&o[1]>=0&&o[1]<=1&&o[2]>=0&&o[2]<=1)r&&(f.dist2=(0,i.fm)(_,e),r[0]=_[0],r[1]=_[1],r[2]=_[2]),f.evaluation=1;else{let t;if(r)if(o[1]<0&&o[2]<0)for(p=(0,i.fm)(e,y),m=s.Ay.distanceToLine(e,g,y,t,O),h=s.Ay.distanceToLine(e,y,v,t,P),p{let i=[],a=[],o=[];t.points.getPoint(0,i),t.points.getPoint(1,a),t.points.getPoint(2,o);let s=1-e[0]-e[1];for(let t=0;t<3;t++)r[t]=i[t]*s+a[t]*e[0]+o[t]*e[1];n[0]=s,n[1]=e[0],n[2]=e[1]},e.getParametricDistance=e=>{let t,r=0,n=[];n[0]=e[0],n[1]=e[1],n[2]=1-e[0]-e[1];for(let e=0;e<3;e++)(t=n[e]<0?-n[e]:n[e]>1?n[e]-1:0)>r&&(r=t);return r},e.derivatives=(e,r,a,o,s)=>{let l=t.points.getPoint(0),d=t.points.getPoint(1),p=t.points.getPoint(2),m=[],h=[],f=[],g=[];u(l,d,p,m),(0,i.Re)(d,l,h),(0,i.Re)(p,l,g),(0,i.$A)(m,h,f);let v=(0,i.S8)(h);if(v<=0||0>=(0,i.S8)(f)){for(let e=0;e{let i=r[0]-r[1],a=.5*(1-r[0])-r[1],o=2*r[0]+r[1]-1;return i>=0&&a>=0?(n[0]=t.pointsIds[0],n[1]=t.pointsIds[1]):a<0&&o>=0?(n[0]=t.pointsIds[1],n[1]=t.pointsIds[2]):(n[0]=t.pointsIds[2],n[1]=t.pointsIds[0]),!(r[0]<0)&&!(r[1]<0)&&!(r[0]>1)&&!(r[1]>1)&&!(1-r[0]-r[1]<0)},e.clip=(e,r,n,i,a,o,s,l,u,c)=>{let h=0;for(let t=0;t<3;t++){let n=r.getComponent(t,0);(c&&n<=e||!c&&n>e)&&(h+=p[t])}let f=m[h],g=[0,0,0],v=[0,0,0],y=[0,0,0],b=[0,0,0];for(let c=0;f[c]>-1;c+=3){b[0]=0,b[1]=0,b[2]=0;for(let i=0;i<3;i++){let s=f[c+i];if(s>=100){let e=s-100;t.points.getPoint(e,g);let{inserted:r,id:l}=n.insertUniquePoint(g);b[i]=l,r&&o.passData(a,t.pointsIds[e],l)}else{let l=d[s],u=l[0],c=l[1],p=r.getComponent(l[1],0)-r.getComponent(l[0],0);p<=0&&(u=l[1],c=l[0],p=-p);let m=0===p?0:(e-r.getComponent(u,0))/p;t.points.getPoint(u,v),t.points.getPoint(c,y);for(let e=0;e<3;e++)g[e]=v[e]+m*(y[e]-v[e]);let{inserted:h,id:f}=n.insertUniquePoint(g);b[i]=f,h&&o.interpolateData(a,t.pointsIds[u],t.pointsIds[c],f,m)}}if(b[0]!==b[1]&&b[0]!==b[2]&&b[1]!==b[2]){let e=i.insertNextCell(b);u.passData(s,l,e)}}}}var g={newInstance:n.Ay.newInstance(f,"vtkTriangle"),extend:f,...{computeNormalDirection:l,computeNormal:u,interpolationDerivs:c,intersectWithTriangle:function(e,t,r,n,o,s,l=1e-6){let c,d,p=!1,m=[],h=[],f=[],g=[],v=[];u(e,t,r,g),u(n,o,s,v);let y=-(0,i.Om)(g,e),b=-(0,i.Om)(v,n),I=[(0,i.Om)(v,e)+b,(0,i.Om)(v,t)+b,(0,i.Om)(v,r)+b];if(I[0]*I[1]>l&&I[0]*I[2]>l)return{intersect:!1,coplanar:p,pt1:m,pt2:h,surfaceId:f};let x=[(0,i.Om)(g,n)+y,(0,i.Om)(g,o)+y,(0,i.Om)(g,s)+y];if(x[0]*x[1]>l&&x[0]*x[2]>l)return{intersect:!1,coplanar:p,pt1:m,pt2:h,surfaceId:f};if(1e-9>Math.abs(g[0]-v[0])&&1e-9>Math.abs(g[1]-v[1])&&1e-9>Math.abs(g[2]-v[2])&&1e-9>Math.abs(y-b))return{intersect:!1,coplanar:p=!0,pt1:m,pt2:h,surfaceId:f};let C=[e,t,r],A=[n,o,s],T=(0,i.Om)(g,v),S=(y-b*T)/(T*T-1),w=(b-y*T)/(T*T-1),O=[S*g[0]+w*v[0],S*g[1]+w*v[1],S*g[2]+w*v[2]],P=(0,i.$A)(g,v,[]);(0,i.S8)(P);let _=0,E=0,D=[],R=[],M=50,N=50;for(let t=0;t<3;t++){let r=t,o=(t+1)%3,s=a.Ay.intersectWithLine(C[r],C[o],n,v);s.intersection&&s.t>0-l&&s.t<1+l&&(s.t<1+l&&s.t>1-l&&(M=_),D[_++]=(0,i.Om)(s.x,P)-(0,i.Om)(O,P));let u=a.Ay.intersectWithLine(A[r],A[o],e,g);u.intersection&&u.t>0-l&&u.t<1+l&&(u.t<1+l&&u.t>1-l&&(N=E),R[E++]=(0,i.Om)(u.x,P)-(0,i.Om)(O,P))}if(_>2){_--;let e=D[2];D[2]=D[M],D[M]=e}if(E>2){E--;let e=R[2];R[2]=R[N],R[N]=e}if(2!==_||2!==E||Number.isNaN(D[0])||Number.isNaN(D[1])||Number.isNaN(R[0])||Number.isNaN(R[1]))return{intersect:!1,coplanar:p,pt1:m,pt2:h,surfaceId:f};if(D[0]>D[1]){let e=D[1];D[1]=D[0],D[0]=e}if(R[0]>R[1]){let e=R[1];R[1]=R[0],R[0]=e}return D[1]{"use strict";r.d(t,{Ay:()=>s});var n=r(17042),{InterpolationType:i}=r(35666).A,{vtkErrorMacro:a}=n.Ay;function o(e,t,r={}){if(Object.assign(t,{independentComponents:!1,interpolationType:i.LINEAR,colorWindow:255,colorLevel:127.5,ambient:1,diffuse:0,opacity:1,useLookupTableScalarRange:!1,useLabelOutline:!1,labelOutlineThickness:[1],labelOutlineOpacity:1,updatedExtents:[],...r}),n.Ay.obj(e,t),!t.componentData){t.componentData=[];for(let e=0;e<4;e++)t.componentData.push({rGBTransferFunction:null,piecewiseFunction:null,componentWeight:1})}n.Ay.setGet(e,t,["independentComponents","interpolationType","colorWindow","colorLevel","ambient","diffuse","opacity","useLookupTableScalarRange","useLabelOutline","labelOutlineOpacity","updatedExtents"]),n.Ay.setGetArray(e,t,["labelOutlineThickness"]),t.classHierarchy.push("vtkImageProperty"),e.getMTime=()=>{let e,r=t.mtime;for(let n=0;n<4;n++)t.componentData[n].rGBTransferFunction&&(r=r>(e=t.componentData[n].rGBTransferFunction.getMTime())?r:e),t.componentData[n].piecewiseFunction&&(r=r>(e=t.componentData[n].piecewiseFunction.getMTime())?r:e);return r},e.setRGBTransferFunction=(r=0,n=null)=>{let i=r,a=n;return Number.isInteger(r)||(a=r,i=0),t.componentData[i].rGBTransferFunction!==a&&(t.componentData[i].rGBTransferFunction=a,e.modified(),!0)},e.getRGBTransferFunction=(e=0)=>t.componentData[e].rGBTransferFunction,e.setPiecewiseFunction=(r=0,n=null)=>{let i=r,a=n;return Number.isInteger(r)||(a=r,i=0),t.componentData[i].piecewiseFunction!==a&&(t.componentData[i].piecewiseFunction=a,e.modified(),!0)},e.getPiecewiseFunction=(e=0)=>t.componentData[e].piecewiseFunction,e.setScalarOpacity=(t=0,r=null)=>{let n=t,i=r;return Number.isInteger(t)||(i=t,n=0),e.setPiecewiseFunction(n,i)},e.getScalarOpacity=(t=0)=>e.getPiecewiseFunction(t),e.setComponentWeight=(r=0,n=1)=>{if(r<0||r>=4)return a("Invalid index"),!1;let i=Math.min(1,Math.max(0,n));return t.componentData[r].componentWeight!==i&&(t.componentData[r].componentWeight=i,e.modified(),!0)},e.getComponentWeight=(e=0)=>e<0||e>=4?(a("Invalid index"),0):t.componentData[e].componentWeight,e.setInterpolationTypeToNearest=()=>e.setInterpolationType(i.NEAREST),e.setInterpolationTypeToLinear=()=>e.setInterpolationType(i.LINEAR),e.getInterpolationTypeAsString=()=>n.Ay.enumToString(i,t.interpolationType)}var s={newInstance:n.Ay.newInstance(o,"vtkImageProperty"),extend:o}},67127:(e,t,r)=>{"use strict";r.d(t,{A:()=>i,T:()=>n});var n={MIN_KNOWN_PASS:0,ACTOR_PASS:0,COMPOSITE_INDEX_PASS:1,ID_LOW24:2,ID_HIGH24:3,MAX_KNOWN_PASS:3},i={PassTypes:n}},67633:(e,t,r)=>{"use strict";e.exports=new(r(50026))("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})},67638:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.orderedSet_parse=i,t.orderedSet_serialize=a,t.orderedSet_sanitize=function(e){return a(i(e))},t.orderedSet_contains=function(e,t,r){for(let n of t){let t=!1;for(let i of e)if(r){if(i===n){t=!0;break}}else if(i.toUpperCase()===n.toUpperCase()){t=!0;break}if(!t)return!1}return!0};let n=r(57226);function i(e){return new Set(n.string.splitAStringOnASCIIWhitespace(e))}function a(e){return[...e].join(" ")}},67931:(e,t,r)=>{"use strict";function n(e,t,r){return e.length>0?`${e.map(e=>e?.getMTime()??"x").join("/")}-${t}-${r}`:"0"}function i(e,t){return`${t.getMTime()}`}r.d(t,{eS:()=>i,tG:()=>n})},68002:(e,t,r)=>{"use strict";r(49007),r(38433)},68107:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.builder=function(e,t){let r=c(u(e)?e:n.DefaultBuilderOptions),s=a.Guard.isNode(e)||(0,i.isArray)(e)?e:t;if(void 0===s)throw Error("Invalid arguments.");if((0,i.isArray)(s)){let e=[];for(let t=0;t{var n=r(35508),i=r(55285),a=r(33235),o=r(52985),s=r(60247),l=r(13905),u=r(95277);u.alea=n,u.xor128=i,u.xorwow=a,u.xorshift7=o,u.xor4096=s,u.tychei=l,e.exports=u},68266:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(71002),i=r(41104);function a(e,t,r=null){(0,n.C)(e,"getImageScale: parameter canvas must not be undefined"),(0,n.C)(t,"getImageScale: parameter image must not be undefined");let o=(0,i.A)(t,r),s=t.rowPixelSpacing||1,l=t.columnPixelSpacing||1,u=1,c=1;s{"use strict";r.d(t,{A:()=>d});var n=r(79267),i=r(77280),a=r(54268),o=r(10807),s=r(69228),l=r(50987),u=r(21601);class c extends u.A{constructor(e){super(e),this.setSampleDistanceMultiplier=e=>{this.getActors().forEach(t=>{if((0,l.N)(t,"vtkVolume")){let r=t.actor.getMapper();if(r&&r.getInputData){let t=r.getInputData();if(t){let n=t.getSpacing(),i=(n[0]+n[1]+n[2])/6*(e||1);void 0!==i&&r.setSampleDistance&&(r.getSampleDistance(),r.setSampleDistance(i))}}}}),this.render()},this.getNumberOfSlices=()=>1,this.getRotation=()=>0,this.getCurrentImageIdIndex=()=>0,this.getCurrentImageId=()=>null,this.resetCameraForResize=()=>this.resetCamera({resetPan:!0,resetZoom:!0,resetToCenter:!0});let{parallelProjection:t,orientation:r}=this.options,n=this.getVtkActiveCamera();null!=t&&n.setParallelProjection(t),r&&r!==i.KY.ACQUISITION&&this.applyViewOrientation(r)}isInAcquisitionPlane(){return!1}resetCamera({resetPan:e=!0,resetZoom:t=!0,resetToCenter:r=!0}={}){super.resetCamera({resetPan:e,resetZoom:t,resetToCenter:r});let i=this.getVtkActiveCamera();return i.getParallelProjection()?i.setClippingRange(-n.Cf.MAXIMUM_RAY_DISTANCE,n.Cf.MAXIMUM_RAY_DISTANCE):i.setClippingRange(n.Cf.MINIMUM_SLAB_THICKNESS,n.Cf.MAXIMUM_RAY_DISTANCE),this.getRenderer().resetCameraClippingRange(),!0}setSlabThickness(e,t){return null}setBlendMode(e,t,r){return null}resetProperties(e){let t=e?this.getActor(e):this.getDefaultActor();if(!t)throw Error(`No actor found for the given volumeId: ${e}`);t.slabThickness&&(t.slabThickness=n.Cf.MINIMUM_SLAB_THICKNESS,this.viewportProperties.slabThickness=void 0,this.updateClippingPlanesForActors(this.getCamera())),e||=this.getVolumeId();let r=a.Ay.getVolume(e);if(!r)throw Error(`imageVolume with id: ${e} does not exist in cache`);(0,o.A)(t.actor,r),this._restoreVolumeRenderingDefaults(t,e),this.setCamera(this.initialCamera),(0,s.A)(this.element,i.sV.VOI_MODIFIED,super.getVOIModifiedEventDetail(e))}getSliceIndex(){return null}setCamera(e){super.setCamera(e),this.getRenderer().resetCameraClippingRange(),this.render()}setCameraClippingRange(){let e=this.getVtkActiveCamera();e.getParallelProjection()?e.setClippingRange(-n.Cf.MAXIMUM_RAY_DISTANCE,n.Cf.MAXIMUM_RAY_DISTANCE):e.setClippingRange(n.Cf.MINIMUM_SLAB_THICKNESS,n.Cf.MAXIMUM_RAY_DISTANCE)}resetSlabThickness(){return null}}let d=c},68456:(e,t,r)=>{"use strict";r.d(t,{id:()=>I,vu:()=>S,IY:()=>b,P8:()=>T,xH:()=>C,Dn:()=>A,LK:()=>w});var n=r(50923),i=r(77280),a=r(35972),o=r(37995),s=r(74798),l=r(55580),u=r(59085),c=r(79267),d=r(52971),p=r(33308);function m(e){let{viewPlaneNormal:t,viewUp:r}=(0,d.A)(e);return{viewPlaneNormal:t,viewUp:r}}function h(e){let{imageVolume:t,orientation:r}=e;if(!r)return;if(r===i.KY.ACQUISITION)return m(t);if((0,p.V7)(r))return{viewPlaneNormal:[...r.viewPlaneNormal],viewUp:[...r.viewUp||m(t).viewUp]};let n=c.T0[r];if(n)return{viewPlaneNormal:[...n.viewPlaneNormal],viewUp:[...n.viewUp]}}var f=r(88249);function g(){return{fitParallelScale:1,sliceWidthWorld:2,sliceHeightWorld:2}}function v(e){return 1e-6>Math.abs(Math.abs(e)-1)}function y(e,t){return v(e[t])||v(e[t+1])||v(e[t+2])}function b(e){let{image:t}=e,{dimensions:r,spacing:i}=(0,a.T)(t);return function(e){let{canvasHeight:t,canvasWidth:r,columnOffset:i,columnsForFit:o,image:s,rowOffset:l,rowsForFit:c}=e,{direction:d,origin:p}=(0,a.T)(s),m=d.slice(0,3),h=d.slice(3,6),f=d.slice(6,9).map(e=>-e),g=h.map(e=>-e),v=[...p],y=Math.max(o,1)*(s.columnPixelSpacing||1),b=Math.max(c,1)*(s.rowPixelSpacing||1);return n.Ln(v,v,m,l),n.Ln(v,v,h,i),{sliceCenterWorld:v,viewPlaneNormal:n.o8(f),viewUp:g,fitParallelScale:(0,u.I8)({canvasHeight:t,canvasWidth:r,columnPixelSpacing:s.columnPixelSpacing||1,columns:o,rowPixelSpacing:s.rowPixelSpacing||1,rows:c}),sliceWidthWorld:y,sliceHeightWorld:b,cameraDistance:1}}({...e,rowOffset:(r[0]-1)/2*i[0],columnOffset:(r[1]-1)/2*i[1],rowsForFit:Math.max(t.rows,1),columnsForFit:Math.max(t.columns,1)})}function I(e){return b(e)}function x(e){var t;let r=e.imageData;if(!r)return[];if(y(t=r.getDirection(),0)&&y(t,3)&&y(t,6)){let e=r.extentToBounds(r.getExtent());return[[e[0],e[2],e[4]],[e[0],e[2],e[5]],[e[0],e[3],e[4]],[e[0],e[3],e[5]],[e[1],e[2],e[4]],[e[1],e[2],e[5]],[e[1],e[3],e[4]],[e[1],e[3],e[5]]]}let[n,i,a]=r.getDimensions();return[[0,0,0],[n-1,0,0],[0,i-1,0],[n-1,i-1,0],[0,0,a-1],[n-1,0,a-1],[0,i-1,a-1],[n-1,i-1,a-1]].map(e=>r.indexToWorld(e))}function C(e,t){let r=e?.imageData;if(!r)return;let n=r.getDimensions(),i=e.flatImageIdIndexToImageIdIndex,a=Math.min(Math.max(0,"function"==typeof i?i.call(e,Math.max(0,t)):t),n[2]-1);return r.indexToWorld([(n[0]-1)/2,(n[1]-1)/2,a])}function A(e){let{viewState:t,fallbackImageIdIndex:r}=e,n=t?.slice;if(n?.kind!=="volumePoint"){if(n?.kind==="stackIndex")return n.imageIdIndex;if(t?.orientation===i.KY.ACQUISITION)return r}}function T(e){let{imageVolume:t,orientation:r}=e,i=h({imageVolume:t,orientation:r}),a=i?function(e){let{imageVolume:t,viewPlaneNormal:r,viewUp:n,canvasWidth:i,canvasHeight:a}=e,s=(0,u.gn)({dimensions:t.dimensions,direction:t.direction,spacing:t.spacing,viewPlaneNormal:r,viewUp:n});if(s){let e=Math.max(s.columns,1),t=Math.max(s.rows,1),r=e*s.columnPixelSpacing,n=t*s.rowPixelSpacing;return{fitParallelScale:(0,u.I8)({canvasHeight:(0,f.g)(a),canvasWidth:(0,f.g)(i),columnPixelSpacing:s.columnPixelSpacing,columns:e,rowPixelSpacing:s.rowPixelSpacing,rows:t}),sliceWidthWorld:r,sliceHeightWorld:n}}let l=t.imageData;if(l){let{widthWorld:e,heightWorld:t}=(0,o.H)(l,r,n);if(e>0&&t>0)return{fitParallelScale:function(e){let{canvasHeight:t,canvasWidth:r,heightWorld:n,widthWorld:i}=e,a=(0,f.g)(r),o=(0,f.g)(t),s=Math.max(n,1e-6),l=Math.max(i,1e-6)/s/(a/o);return l<1?s/2:s*l/2}({canvasHeight:a,canvasWidth:i,widthWorld:e,heightWorld:t}),sliceWidthWorld:e,sliceHeightWorld:t}}return g()}({...e,viewPlaneNormal:i.viewPlaneNormal,viewUp:i.viewUp}):g();return function(e){let{center:t,fitParallelScale:r,imageIdIndex:i,imageVolume:a,orientation:o,sliceHeightWorld:l,sliceWidthWorld:u,viewState:c}=e,d=h({imageVolume:a,orientation:o});if(!d)return{sliceBasis:{sliceCenterWorld:[0,0,0],viewPlaneNormal:[0,0,1],viewUp:[0,-1,0],fitParallelScale:1,sliceWidthWorld:2,sliceHeightWorld:2,cameraDistance:1},currentImageIdIndex:0,maxImageIdIndex:0};let p=(0,f.v)(d.viewPlaneNormal),m=(0,f.v)(d.viewUp),{max:g,maxImageIdIndex:v,min:y,spacingInNormalDirection:b}=function(e){let{imageVolume:t,viewPlaneNormal:r}=e,i=x(t),a=Math.max((0,s.A)(t,r),1e-6);if(!i.length)return{min:0,max:0,spacingInNormalDirection:a,maxImageIdIndex:0};let o=i.map(e=>n.Om(e,r)),l=Math.min(...o),u=Math.max(...o),c=Math.max(0,Math.round((u-l)/a));return{min:l,max:u,spacingInNormalDirection:a,maxImageIdIndex:c}}({imageVolume:a,viewPlaneNormal:p}),I=n.Om(t,p),C=c?.slice?.kind==="volumePoint"?c.slice.sliceWorldPoint:void 0,A=Math.min(g,Math.max(y,C?n.Om(C,p):I)),T=function(e){let{centerProjection:t,imageIdIndex:r,max:n,maxImageIdIndex:i,min:a}=e;if("number"!=typeof r){let{centerProjection:e,min:r,max:o,maxImageIdIndex:s}={centerProjection:t,min:a,max:n,maxImageIdIndex:i},l=o-r;return l>0&&0!==s?Math.round((e-r)/l*s):0}return Math.min(Math.max(0,r),i)}({imageIdIndex:i,centerProjection:A,min:y,max:g,maxImageIdIndex:v}),S="number"==typeof i?Math.min(g,y+T*b):A;return{sliceBasis:{sliceCenterWorld:n.Ln(n.vt(),t,p,S-I),viewPlaneNormal:p,viewUp:m,fitParallelScale:r,sliceWidthWorld:u,sliceHeightWorld:l,cameraDistance:Math.max(g-y,b,1)},currentImageIdIndex:T,maxImageIdIndex:v}}({...e,center:function(e,t){let r=e.imageData;if(r){let e=r.getDimensions(),n=t?(0,l.G)(e,r.getDirection(),t):e.map(e=>(e-1)/2);return r.indexToWorld(n)}let i=x(e);if(!i.length)return[0,0,0];let a=n.vt();for(let e of i)n.WQ(a,a,e);return n.hs(a,a,1/i.length)}(t,i?.viewPlaneNormal),...a})}function S(e){return T(e)}function w(e=i.VO.LINEAR){return e===i.VO.NEAREST}},68470:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Cast=void 0;let n=r(32090);class i{static asNode(e){if(n.Guard.isNode(e))return e;throw Error("Invalid object. Node expected.")}}t.Cast=i},68497:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fragmentCB=t.createCB=t.convert=t.fragment=t.create=t.builder=t.XMLBuilderCBImpl=t.XMLBuilderImpl=void 0;var n=r(70337);Object.defineProperty(t,"XMLBuilderImpl",{enumerable:!0,get:function(){return n.XMLBuilderImpl}});var i=r(33620);Object.defineProperty(t,"XMLBuilderCBImpl",{enumerable:!0,get:function(){return i.XMLBuilderCBImpl}});var a=r(68107);Object.defineProperty(t,"builder",{enumerable:!0,get:function(){return a.builder}}),Object.defineProperty(t,"create",{enumerable:!0,get:function(){return a.create}}),Object.defineProperty(t,"fragment",{enumerable:!0,get:function(){return a.fragment}}),Object.defineProperty(t,"convert",{enumerable:!0,get:function(){return a.convert}});var o=r(35154);Object.defineProperty(t,"createCB",{enumerable:!0,get:function(){return o.createCB}}),Object.defineProperty(t,"fragmentCB",{enumerable:!0,get:function(){return o.fragmentCB}})},68566:(e,t,r)=>{"use strict";r(4453),r(42018)},68742:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(66644);function i(e,t,r,i){let a=[t[0]-e[0],t[1]-e[1]],o=[i[0]-r[0],i[1]-r[1]],s=o[1]*a[0]-o[0]*a[1];if((s>=0?s:-s)<.01){let a=[e[0]t[0]?e[0]:t[0],e[1]t[1]?e[1]:t[1]],o=[r[0]i[0]?r[0]:i[0],r[1]i[1]?r[1]:i[1]];if(!(a[0]<=o[1]&&a[1]>=o[0]&&a[2]<=o[3]&&a[3]>=o[2])||!(n.A(e,t,r)||n.A(e,t,i)||n.A(r,i,e)))return;return[((a[0]>o[0]?a[0]:o[0])+(a[1]o[2]?a[2]:o[2])+(a[3]{"use strict";r.d(t,{A:()=>n});let n=function(e,t){Object.keys(e).forEach(r=>{let n=t.getAttribute(r),i=e[r];void 0===i||""===i?t.removeAttribute(r):n!==i&&t.setAttribute(r,i)})}},68764:(e,t,r)=>{"use strict";r.d(t,{h:()=>i});var n=r(74086);function i(e,t,r,i){let a=function(e,t,r){let n=[`${e}`];return t&&n.push(`${n[0]}${t}`),r&&n.push(`${n[n.length-1]}${r}`),n}(e,r,i);for(let e=a.length-1;e>=0;--e){let r=n.A.getStyleProperty(a[e],t);if(void 0!==r)return r}}},68916:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>o});var n=r(17042),i={delegates:[],currentOperation:null,preDelegateOperations:[],postDelegateOperations:[],currentParent:null};function a(e,t,r={}){Object.assign(t,i,r),n.Ay.obj(e,t),n.Ay.get(e,t,["currentOperation"]),n.Ay.setGet(e,t,["delegates","_currentParent","preDelegateOperations","postDelegateOperations"]),n.Ay.moveToProtected(e,t,["currentParent"]),t.classHierarchy.push("vtkRenderPass"),e.getOperation=()=>t.currentOperation,e.setCurrentOperation=e=>{t.currentOperation=e,t.currentTraverseOperation=`traverse${n.Ay.capitalize(t.currentOperation)}`},e.getTraverseOperation=()=>t.currentTraverseOperation,e.traverse=(r,n=null)=>{t.deleted||(t._currentParent=n,t.preDelegateOperations.forEach(t=>{e.setCurrentOperation(t),r.traverse(e)}),t.delegates.forEach(t=>{t.traverse(r,e)}),t.postDelegateOperations.forEach(t=>{e.setCurrentOperation(t),r.traverse(e)}))}}var o={newInstance:n.Ay.newInstance(a,"vtkRenderPass"),extend:a}},68937:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeFilterImpl=void 0;let n=r(5309),i=r(48040);class a{static FILTER_ACCEPT=1;static FILTER_REJECT=2;static FILTER_SKIP=3;static SHOW_ALL=0xffffffff;static SHOW_ELEMENT=1;static SHOW_ATTRIBUTE=2;static SHOW_TEXT=4;static SHOW_CDATA_SECTION=8;static SHOW_ENTITY_REFERENCE=16;static SHOW_ENTITY=32;static SHOW_PROCESSING_INSTRUCTION=64;static SHOW_COMMENT=128;static SHOW_DOCUMENT=256;static SHOW_DOCUMENT_TYPE=512;static SHOW_DOCUMENT_FRAGMENT=1024;static SHOW_NOTATION=2048;FILTER_ACCEPT=1;FILTER_REJECT=2;FILTER_SKIP=3;SHOW_ALL=0xffffffff;SHOW_ELEMENT=1;SHOW_ATTRIBUTE=2;SHOW_TEXT=4;SHOW_CDATA_SECTION=8;SHOW_ENTITY_REFERENCE=16;SHOW_ENTITY=32;SHOW_PROCESSING_INSTRUCTION=64;SHOW_COMMENT=128;SHOW_DOCUMENT=256;SHOW_DOCUMENT_TYPE=512;SHOW_DOCUMENT_FRAGMENT=1024;SHOW_NOTATION=2048;constructor(){}acceptNode(e){return n.FilterResult.Accept}static _create(){return new a}}t.NodeFilterImpl=a,(0,i.idl_defineConst)(a.prototype,"FILTER_ACCEPT",1),(0,i.idl_defineConst)(a.prototype,"FILTER_REJECT",2),(0,i.idl_defineConst)(a.prototype,"FILTER_SKIP",3),(0,i.idl_defineConst)(a.prototype,"SHOW_ALL",0xffffffff),(0,i.idl_defineConst)(a.prototype,"SHOW_ELEMENT",1),(0,i.idl_defineConst)(a.prototype,"SHOW_ATTRIBUTE",2),(0,i.idl_defineConst)(a.prototype,"SHOW_TEXT",4),(0,i.idl_defineConst)(a.prototype,"SHOW_CDATA_SECTION",8),(0,i.idl_defineConst)(a.prototype,"SHOW_ENTITY_REFERENCE",16),(0,i.idl_defineConst)(a.prototype,"SHOW_ENTITY",32),(0,i.idl_defineConst)(a.prototype,"SHOW_PROCESSING_INSTRUCTION",64),(0,i.idl_defineConst)(a.prototype,"SHOW_COMMENT",128),(0,i.idl_defineConst)(a.prototype,"SHOW_DOCUMENT",256),(0,i.idl_defineConst)(a.prototype,"SHOW_DOCUMENT_TYPE",512),(0,i.idl_defineConst)(a.prototype,"SHOW_DOCUMENT_FRAGMENT",1024),(0,i.idl_defineConst)(a.prototype,"SHOW_NOTATION",2048)},69228:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(3922);function i(e=n.A,t,r=null){if(!t)throw Error("Event type was not defined");let a=new CustomEvent(t,{detail:r,cancelable:!0});return e?.dispatchEvent(a)}},69287:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CDATASectionImpl=void 0;let n=r(30696),i=r(5309),a=r(48040);class o extends n.TextImpl{_nodeType=i.NodeType.CData;constructor(e){super(e)}static _create(e,t=""){let r=new o(t);return r._nodeDocument=e,r}}t.CDATASectionImpl=o,(0,a.idl_defineConst)(o.prototype,"_nodeType",i.NodeType.CData)},69340:(e,t,r)=>{"use strict";r.d(t,{N:()=>i,j:()=>a});var n=r(70192);function i(e,t){return a(n.wx.get("generalSeriesModule",e).modality,e,t)}function a(e,t,r){return"CT"===e?"HU":"PT"===e?function(e,t){if(!t.isPreScaled)return"raw";if(t.isSuvScaled)return"SUV";let r=n.wx.get("generalSeriesModule",e);if(r?.modality==="PT"){let t=n.wx.get("petSeriesModule",e);return t?.units||"unitless"}return"unknown"}(t,r):""}},69435:(e,t,r)=>{"use strict";r.d(t,{P:()=>i});var n=r(32207);function i(e){return Object.entries(n._6.getState().viewportSegRepresentations).filter(([,t])=>t.some(t=>t.segmentationId===e)).map(([e])=>e)}},69548:(e,t,r)=>{"use strict";r.d(t,{Gx:()=>i,l$:()=>a});var n=r(17964);function i(e){let t=e.toolName;if(!t)throw Error(`No Tool Found for the ToolClass ${e.name}`);n.wk.tools[t]||(n.wk.tools[t]={toolClass:e})}function a(e){return!!(e&&n.wk.tools[e])}},69927:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>a,YL:()=>i});var n={FLAT:0,GOURAUD:1,PHONG:2},i={POINTS:0,WIREFRAME:1,SURFACE:2},a={Shading:n,Representation:i,Interpolation:n}},69955:(e,t,r)=>{"use strict";var n,i,a,o,s=r(61052);r(98629),r(62347),r(29103);var l=r(17042),u=r(11701),c=r(87352),d=r(58804),p=r(19047),m=r(89473),h=r(12412),f=r(78543),g=r(50923),v=r(85250);let y=Math.sqrt(50),b=Math.sqrt(10),I=Math.sqrt(2);function x(e,t,r){let n,i,a,o=(t-e)/Math.max(0,r),s=Math.floor(Math.log10(o)),l=o/Math.pow(10,s),u=l>=y?10:l>=b?5:l>=I?2:1;return(s<0?(n=Math.round(e*(a=Math.pow(10,-s)/u)),i=Math.round(t*a),n/at&&--i,a=-a):(n=Math.round(e/(a=Math.pow(10,s)*u)),i=Math.round(t/a),n*at&&--i),it?1:e>=t?0:NaN}function T(e,t){return null==e||null==t?NaN:te?1:t>=e?0:NaN}function S(e){let t,r,n;function i(e,n,a=0,o=e.length){if(a>>1;0>r(e[t],n)?a=t+1:o=t}while(aA(e(t),r),n=(t,r)=>e(t)-r):(t=e===A||e===T?e:w,r=e,n=e),{left:i,center:function(e,t,r=0,a=e.length){let o=i(e,t,r,a-1);return o>r&&n(e[o-1],t)>-n(e[o],t)?o-1:o},right:function(e,n,i=0,a=e.length){if(i>>1;0>=r(e[t],n)?i=t+1:a=t}while(i>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===r?K(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===r?K(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=L.exec(e))?new X(t[1],t[2],t[3],1):(t=B.exec(e))?new X(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=F.exec(e))?K(t[1],t[2],t[3],t[4]):(t=U.exec(e))?K(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=k.exec(e))?et(t[1],t[2]/100,t[3]/100,1):(t=G.exec(e))?et(t[1],t[2]/100,t[3]/100,t[4]):W.hasOwnProperty(e)?$(W[e]):"transparent"===e?new X(NaN,NaN,NaN,0):null}function $(e){return new X(e>>16&255,e>>8&255,255&e,1)}function K(e,t,r,n){return n<=0&&(e=t=r=NaN),new X(e,t,r,n)}function q(e,t,r,n){var i;return 1==arguments.length?((i=e)instanceof D||(i=j(i)),i)?new X((i=i.rgb()).r,i.g,i.b,i.opacity):new X:new X(e,t,r,null==n?1:n)}function X(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function Y(){return`#${ee(this.r)}${ee(this.g)}${ee(this.b)}`}function Z(){let e=J(this.opacity);return`${1===e?"rgb(":"rgba("}${Q(this.r)}, ${Q(this.g)}, ${Q(this.b)}${1===e?")":`, ${e})`}`}function J(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Q(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ee(e){return((e=Q(e))<16?"0":"")+e.toString(16)}function et(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new en(e,t,r,n)}function er(e){if(e instanceof en)return new en(e.h,e.s,e.l,e.opacity);if(e instanceof D||(e=j(e)),!e)return new en;if(e instanceof en)return e;var t=(e=e.rgb()).r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,s=a-i,l=(a+i)/2;return s?(o=t===a?(r-n)/s+(r0&&l<1?0:o,new en(o,s,l,e.opacity)}function en(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}function ei(e){return(e=(e||0)%360)<0?e+360:e}function ea(e){return Math.max(0,Math.min(1,e||0))}function eo(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}_(D,j,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:z,formatHex:z,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return er(this).formatHsl()},formatRgb:H,toString:H}),_(X,q,E(D,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new X(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new X(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new X(Q(this.r),Q(this.g),Q(this.b),J(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Y,formatHex:Y,formatHex8:function(){return`#${ee(this.r)}${ee(this.g)}${ee(this.b)}${ee((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:Z,toString:Z})),_(en,function(e,t,r,n){return 1==arguments.length?er(e):new en(e,t,r,null==n?1:n)},E(D,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new en(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new en(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new X(eo(e>=240?e-240:e+120,i,n),eo(e,i,n),eo(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new en(ei(this.h),ea(this.s),ea(this.l),J(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=J(this.opacity);return`${1===e?"hsl(":"hsla("}${ei(this.h)}, ${100*ea(this.s)}%, ${100*ea(this.l)}%${1===e?")":`, ${e})`}`}}));var es=r(5721);let el=e=>()=>e;function eu(e,t){var r=t-e;return r?function(t){return e+t*r}:el(isNaN(e)?t:e)}let ec=function e(t){var r,n=1==(r=+t)?eu:function(e,t){var n,i,a;return t-e?(n=e,i=t,n=Math.pow(n,a=r),i=Math.pow(i,a)-n,a=1/a,function(e){return Math.pow(n+e*i,a)}):el(isNaN(e)?t:e)};function i(e,t){var r=n((e=q(e)).r,(t=q(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=eu(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return i.gamma=e,i}(1);function ed(e){return function(t){var r,n,i=t.length,a=Array(i),o=Array(i),s=Array(i);for(r=0;r=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function eT(e){var t;if(!(t=eA.exec(e)))throw Error("invalid format: "+e);return new eS({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function eS(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function ew(e,t){if(!isFinite(e)||0===e)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function eO(e){return(e=ew(Math.abs(e)))?e[1]:NaN}function eP(e,t){var r=ew(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+Array(i-n.length+2).join("0")}eT.prototype=eS.prototype,eS.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};let e_={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>eP(100*e,t),r:eP,s:function(e,t){var r=ew(e,t);if(!r)return n=void 0,e.toPrecision(t);var i=r[0],a=r[1],o=a-(n=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,s=i.length;return o===s?i:o>s?i+Array(o-s+1).join("0"):o>0?i.slice(0,o)+"."+i.slice(o):"0."+Array(1-o).join("0")+ew(e,Math.max(0,t+o-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function eE(e){return e}var eD=Array.prototype.map,eR=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"];function eM(){var e,t=(function(){var e,t,r,n,i,a,o=ev,s=ev,l=function e(t,r){var n,i,a=typeof r;return null==r||"boolean"===a?el(r):("number"===a?ep:"string"===a?(i=j(r))?(r=i,ec):function(e,t){var r,n,i,a,o,s=em.lastIndex=eh.lastIndex=0,l=-1,u=[],c=[];for(e+="",t+="";(i=em.exec(e))&&(a=eh.exec(t));)(o=a.index)>s&&(o=t.slice(s,o),u[l]?u[l]+=o:u[++l]=o),(i=i[0])===(a=a[0])?u[l]?u[l]+=a:u[++l]=a:(u[++l]=null,c.push({i:l,x:ep(i,a)})),s=eh.lastIndex;return st&&(r=e,e=t,t=r),u=function(r){return Math.max(e,Math.min(t,r))}),n=l>2?ex:eI,i=a=null,d}function d(t){return null==t||isNaN(t*=1)?r:(i||(i=n(o.map(e),s,l)))(e(u(t)))}return d.invert=function(r){return u(t((a||(a=n(s,o.map(e),ep)))(r)))},d.domain=function(e){return arguments.length?(o=Array.from(e,eg),c()):o.slice()},d.range=function(e){return arguments.length?(s=Array.from(e),c()):s.slice()},d.rangeRound=function(e){return s=Array.from(e),l=ef,c()},d.clamp=function(e){return arguments.length?(u=!!e||ey,c()):u!==ey},d.interpolate=function(e){return arguments.length?(l=e,c()):l},d.unknown=function(e){return arguments.length?(r=e,d):r},function(r,n){return e=r,t=n,c()}})()(ey,ey);return t.copy=function(){return eM().domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())},eC.apply(t,arguments),e=t.domain,t.ticks=function(t){var r=e();return function(e,t,r){if(t*=1,e*=1,!((r*=1)>0))return[];if(e===t)return[e];let n=t=i))return[];let s=a-i+1,l=Array(s);if(n)if(o<0)for(let e=0;e0;){if((i=C(l,u,r))===n)return a[o]=l,a[s]=u,e(a);if(i>0)l=Math.floor(l/i)*i,u=Math.ceil(u/i)*i;else if(i<0)l=Math.ceil(l*i)/i,u=Math.floor(u*i)/i;else break;n=i}return t},t}a=(i=function(e){var t,r,i,a=void 0===e.grouping||void 0===e.thousands?eE:(t=eD.call(e.grouping,Number),r=e.thousands+"",function(e,n){for(var i=e.length,a=[],o=0,s=t[0],l=0;i>0&&s>0&&(l+s+1>n&&(s=Math.max(1,n-l)),a.push(e.substring(i-=s,i+s)),!((l+=s+1)>n));)s=t[o=(o+1)%t.length];return a.reverse().join(r)}),o=void 0===e.currency?"":e.currency[0]+"",s=void 0===e.currency?"":e.currency[1]+"",l=void 0===e.decimal?".":e.decimal+"",u=void 0===e.numerals?eE:(i=eD.call(e.numerals,String),function(e){return e.replace(/[0-9]/g,function(e){return i[+e]})}),c=void 0===e.percent?"%":e.percent+"",d=void 0===e.minus?"−":e.minus+"",p=void 0===e.nan?"NaN":e.nan+"";function m(e,t){var r=(e=eT(e)).fill,i=e.align,m=e.sign,h=e.symbol,f=e.zero,g=e.width,v=e.comma,y=e.precision,b=e.trim,I=e.type;"n"===I?(v=!0,I="g"):e_[I]||(void 0===y&&(y=12),b=!0,I="g"),(f||"0"===r&&"="===i)&&(f=!0,r="0",i="=");var x=(t&&void 0!==t.prefix?t.prefix:"")+("$"===h?o:"#"===h&&/[boxX]/.test(I)?"0"+I.toLowerCase():""),C=("$"===h?s:/[%p]/.test(I)?c:"")+(t&&void 0!==t.suffix?t.suffix:""),A=e_[I],T=/[defgprs%]/.test(I);function S(e){var t,o,s,c=x,h=C;if("c"===I)h=A(e)+h,e="";else{var S=(e*=1)<0||1/e<0;if(e=isNaN(e)?p:A(Math.abs(e),y),b&&(e=function(e){e:for(var t,r=e.length,n=1,i=-1;n0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),S&&0==+e&&"+"!==m&&(S=!1),c=(S?"("===m?m:d:"-"===m||"("===m?"":m)+c,h=("s"!==I||isNaN(e)||void 0===n?"":eR[8+n/3])+h+(S&&"("===m?")":""),T){for(t=-1,o=e.length;++t(s=e.charCodeAt(t))||s>57){h=(46===s?l+e.slice(t+1):e.slice(t))+h,e=e.slice(0,t);break}}}v&&!f&&(e=a(e,1/0));var w=c.length+e.length+h.length,O=w>1)+c+e+h+O.slice(w);break;default:e=O+c+e+h}return u(e)}return y=void 0===y?6:/[gprs]/.test(I)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y)),S.toString=function(){return e+""},S}return{format:m,formatPrefix:function(e,t){var r=3*Math.max(-8,Math.min(8,Math.floor(eO(t)/3))),n=Math.pow(10,-r),i=m(((e=eT(e)).type="f",e),{suffix:eR[8+r/3]});return function(e){return i(n*e)}}}}({thousands:",",grouping:[3],currency:["$",""]})).format,o=i.formatPrefix;var eN=[[-1,0,0],[1,0,0],[0,-1,0],[0,1,0],[0,0,-1],[0,0,1]],eV=[[8,7,11,3],[9,1,10,5],[4,9,0,8],[2,11,6,10],[0,3,2,1],[4,5,6,7]],eL=[[0,1],[1,3],[2,3],[0,2],[4,5],[5,7],[6,7],[4,6],[0,4],[1,5],[3,7],[2,6]],eB=[0,1,0,1,0,1,0,1,2,2,2,2],eF=[[1,2],[1,2],[0,2],[0,2],[0,1],[0,1]],eU=new Float64Array(3),ek=new Float64Array(3),eG=new Float64Array(3),eW=new Float64Array(3),ez=new Float64Array(3),eH=new Float64Array(3),ej=new Float64Array(16);function e$(e,t){e.strokeStyle=t.strokeColor,e.lineWidth=t.strokeSize,e.fillStyle=t.fontColor,e.font=`${t.fontStyle} ${t.fontSize}px ${t.fontFamily}`}function eK(e){let t=[],r=[];for(let n=0;n<3;n++){let i=eM().domain([e[2*n],e[2*n+1]]);t[n]=i.ticks(5);let a=i.tickFormat(5);r[n]=t[n].map(a)}return{ticks:t,tickStrings:r}}var eq=l.Ay.newInstance((e,t,r={renderable:null})=>{Object.assign(t,{},r),l.Ay.obj(e,t),t.tmPolyData=p.Ay.newInstance(),t.tmMapper=h.Ay.newInstance(),t.tmMapper.setInputData(t.tmPolyData),t.tmActor=m.Ay.newInstance({parentProp:e}),t.tmActor.setMapper(t.tmMapper),l.Ay.setGet(e,t,["renderable"]),l.Ay.get(e,t,["lastSize","lastAspectRatio","axisTextStyle","tickTextStyle","tmActor","ticks"]),t.forceUpdate=!1,t.lastRedrawTime={},l.Ay.obj(t.lastRedrawTime,{mtime:0}),t.lastRebuildTime={},l.Ay.obj(t.lastRebuildTime,{mtime:0}),t.lastSize=[-1,-1],t.lastTickBounds=[],function(e,t){t.classHierarchy.push("vtkCubeAxesActorHelper"),e.setRenderable=r=>{t.renderable!==r&&(t.renderable=r,t.tmActor.addTexture(t.renderable.getTmTexture()),t.tmActor.setProperty(r.getProperty()),t.tmActor.setParentProp(r),e.modified())},e.createPolyDataForOneLabel=(e,r,n,i,a,o,s)=>{let l=t.renderable.get_tmAtlas().get(e);if(!l)return;let u=t.renderable.getTextPolyData().getPoints().getData(),c=t.lastSize;eU[0]=u[3*r],eU[1]=u[3*r+1],eU[2]=u[3*r+2],g.Z0(eG,eU,n),eG[0]+=.1,g.Z0(ek,eG,i),g.Re(ez,ek,eU),eG[0]-=.1,eG[1]+=.1,g.Z0(ek,eG,i),g.Re(eH,ek,eU);for(let e=0;e<3;e++)ez[e]/=.05*c[0],eH[e]/=.05*c[1];let d=s.ptIdx,p=s.cellIdx;eU[0]=u[3*r],eU[1]=u[3*r+1],eU[2]=u[3*r+2],a[0]<-.5?g.hs(eG,ez,a[0]*o-l.width):a[0]>.5?g.hs(eG,ez,a[0]*o):g.hs(eG,ez,a[0]*o-l.width/2),g.WQ(eU,eU,eG),g.hs(eG,eH,a[1]*o-l.height/2),g.WQ(eU,eU,eG),s.points[3*d]=eU[0],s.points[3*d+1]=eU[1],s.points[3*d+2]=eU[2],s.tcoords[2*d]=l.tcoords[0],s.tcoords[2*d+1]=l.tcoords[1],d++,g.hs(eG,ez,l.width),g.WQ(eU,eU,eG),s.points[3*d]=eU[0],s.points[3*d+1]=eU[1],s.points[3*d+2]=eU[2],s.tcoords[2*d]=l.tcoords[2],s.tcoords[2*d+1]=l.tcoords[3],d++,g.hs(eG,eH,l.height),g.WQ(eU,eU,eG),s.points[3*d]=eU[0],s.points[3*d+1]=eU[1],s.points[3*d+2]=eU[2],s.tcoords[2*d]=l.tcoords[4],s.tcoords[2*d+1]=l.tcoords[5],d++,g.hs(eG,ez,l.width),g.Re(eU,eU,eG),s.points[3*d]=eU[0],s.points[3*d+1]=eU[1],s.points[3*d+2]=eU[2],s.tcoords[2*d]=l.tcoords[6],s.tcoords[2*d+1]=l.tcoords[7],d++,s.polys[4*p]=3,s.polys[4*p+1]=d-4,s.polys[4*p+2]=d-3,s.polys[4*p+3]=d-2,p++,s.polys[4*p]=3,s.polys[4*p+1]=d-4,s.polys[4*p+2]=d-2,s.polys[4*p+3]=d-1,s.ptIdx+=4,s.cellIdx+=2},e.updateTexturePolyData=()=>{let r=t.camera.getCompositeProjectionMatrix(t.lastAspectRatio,-1,1);v.transpose(r,r);let n=t.renderable.getTextValues().length,i=4*n,a=new Float64Array(3*i),o=new Uint16Array(2*n*4),s=new Float32Array(2*i);v.invert(ej,r);let l={ptIdx:0,cellIdx:0,polys:o,points:a,tcoords:s},d=0,p=0,m=0,h=t.renderable.getTextPolyData().getPoints().getData(),f=t.renderable.getTextValues();for(;d{(t.lastSize[0]!==r[0]||t.lastSize[1]!==r[1])&&(t.lastSize[0]=r[0],t.lastSize[1]=r[1],t.lastAspectRatio=r[0]/r[1],t.forceUpdate=!0),t.camera=n,e.updateTexturePolyData()}}(e,t)},"vtkCubeAxesActorHelper");l.Ay.newInstance(function(e,t,r={}){m.Ay.extend(e,t,{boundsScaleFactor:1.3,camera:null,dataBounds:[...d.Ay.INIT_BOUNDS],faceVisibilityAngle:8,gridLines:!0,axisLabels:null,axisTitlePixelOffset:35,tickLabelPixelOffset:12,generateTicks:eK,...r,axisTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:18,fontFamily:"serif",...r?.axisTextStyle},tickTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:14,fontFamily:"serif",...r?.tickTextStyle}}),t.lastFacesToDraw=[!1,!1,!1,!1,!1,!1],t.axisLabels=["X-Axis","Y-Axis","Z-Axis"],t.tickCounts=[],t.textValues=[],t.lastTickBounds=[],t.tmCanvas=document.createElement("canvas"),t.tmContext=t.tmCanvas.getContext("2d"),t._tmAtlas=new Map,t.tmTexture=f.Ay.newInstance({resizable:!0}),t.tmTexture.setInterpolate(!1),e.getProperty().setDiffuse(0),e.getProperty().setAmbient(1),t.gridMapper=h.Ay.newInstance(),t.polyData=p.Ay.newInstance(),t.gridMapper.setInputData(t.polyData),t.gridActor=m.Ay.newInstance(),t.gridActor.setMapper(t.gridMapper),t.gridActor.setProperty(e.getProperty()),t.gridActor.setParentProp(e),t.textPolyData=p.Ay.newInstance(),l.Ay.setGet(e,t,["axisTitlePixelOffset","boundsScaleFactor","faceVisibilityAngle","gridLines","tickLabelPixelOffset","generateTicks"]),l.Ay.setGetArray(e,t,["dataBounds"],6),l.Ay.setGetArray(e,t,["axisLabels"],3),l.Ay.get(e,t,["axisTextStyle","tickTextStyle","camera","tmTexture","textValues","textPolyData","tickCounts","gridActor"]),t.classHierarchy.push("vtkCubeAxesActor"),e.setCamera=r=>{t.camera!==r&&(t.cameraModifiedSub&&(t.cameraModifiedSub.unsubscribe(),t.cameraModifiedSub=null),t.camera=r,r&&(t.cameraModifiedSub=r.onModified(e.update)),e.update(),e.modified())},e.computeFacesToDraw=()=>{let e=t.camera.getViewMatrix();v.transpose(e,e);let r=!1,n=d.Ay.getDiagonalLength(t.dataBounds),i=Math.sin(t.faceVisibilityAngle*Math.PI/180);for(let a=0;a<6;a++){let o=!1,s=Math.floor(a/2),l=(s+1)%3,u=(s+2)%3;t.dataBounds[2*l]!==t.dataBounds[2*l+1]&&t.dataBounds[2*u]!==t.dataBounds[2*u+1]&&(eU[s]=t.dataBounds[a]-.1*n*eN[a][s],eU[l]=.5*(t.dataBounds[2*l]+t.dataBounds[2*l+1]),eU[u]=.5*(t.dataBounds[2*u]+t.dataBounds[2*u+1]),g.Z0(eG,eU,e),eU[s]=t.dataBounds[a],g.Z0(eW,eU,e),g.Re(eG,eW,eG),g.S8(eG,eG),o=eG[2]>i,t.camera.getParallelProjection()||(g.S8(eW,eW),o=g.Om(eW,eG)>i)),o!==t.lastFacesToDraw[a]&&(t.lastFacesToDraw[a]=o,r=!0)}return r},e.updatePolyData=(e,r,n)=>{let i,a=0;i=8;let o=0;for(let e=0;e<12;e++)r[e]>0&&o++;if(a+=o,t.gridLines)for(let t=0;t<6;t++)e[t]&&(i+=2*n[eF[t][0]].length+2*n[eF[t][1]].length,a+=n[eF[t][0]].length+n[eF[t][1]].length);let s=new Float64Array(3*i),l=new Uint32Array(3*a),u=0,c=0;for(let e=0;e<2;e++)for(let r=0;r<2;r++)for(let n=0;n<2;n++)s[3*u]=t.dataBounds[n],s[3*u+1]=t.dataBounds[2+r],s[3*u+2]=t.dataBounds[4+e],u++;for(let e=0;e<12;e++)r[e]>0&&(l[3*c]=2,l[3*c+1]=eL[e][0],l[3*c+2]=eL[e][1],c++);if(t.gridLines){for(let r=0;r<6;r++)if(e[r]){let e=Math.floor(r/2),i=n[eF[r][0]];for(let n=0;n{let a=0;for(let e=0;e<12;e++)1===r[e]&&(a+=2,a+=n[eB[e]].length);let o=t.polyData.getPoints().getData(),s=new Float64Array(3*a),l=0,u=0,c=0;for(let a=0;a<6;a++)if(e[a])for(let e=0;e<4;e++){let d=eV[a][e];if(1===r[d]){let e=eB[d],r=3*eL[d][0],p=3*eL[d][1];s[3*l]=.5*(o[r]+o[p]),s[3*l+1]=.5*(o[r+1]+o[p+1]),s[3*l+2]=.5*(o[r+2]+o[p+2]);let m=Math.floor(a/2);s[3*++l+m]=t.dataBounds[a],s[3*l+eF[a][0]]=.5*(t.dataBounds[2*eF[a][0]]+t.dataBounds[2*eF[a][0]+1]),s[3*l+eF[a][1]]=.5*(t.dataBounds[2*eF[a][1]]+t.dataBounds[2*eF[a][1]+1]),l++,t.textValues[u]=t.axisLabels[e],u++;let h=(e+1)%3,f=(e+2)%3,g=n[e],v=i[e];t.tickCounts[c]=g.length;for(let n=0;n{if(!t.camera)return;let r=e.computeFacesToDraw(),n=t.lastFacesToDraw,i=!1;for(let e=0;e<6;e++)t.dataBounds[e]!==t.lastTickBounds[e]&&(i=!0,t.lastTickBounds[e]=t.dataBounds[e]);if(r||i||t.forceUpdate){let r=Array(12).fill(0);for(let e=0;e<6;e++)if(n[e])for(let t=0;t<4;t++)r[eV[e][t]]++;let a=t.generateTicks(t.dataBounds);e.updatePolyData(n,r,a.ticks),e.updateTextData(n,r,a.ticks,a.tickStrings),(i||t.forceUpdate)&&e.updateTextureAtlas(a.tickStrings)}t.forceUpdate=!1},e.updateTextureAtlas=e=>{t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left",t._tmAtlas.clear();let r=0,n=1;for(let i=0;i<3;i++){if(!t._tmAtlas.has(t.axisLabels[i])){e$(t.tmContext,t.axisTextStyle);let e=t.tmContext.measureText(t.axisLabels[i]),a={height:e.actualBoundingBoxAscent+2,startingHeight:n,width:e.width+2,textStyle:t.axisTextStyle};t._tmAtlas.set(t.axisLabels[i],a),n+=a.height,r{e.tcoords=[0,(n-e.startingHeight-e.height)/n,e.width/r,(n-e.startingHeight-e.height)/n,e.width/r,(n-e.startingHeight)/n,0,(n-e.startingHeight)/n]}),t.tmCanvas.width=r,t.tmCanvas.height=n,t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left",t.tmContext.clearRect(0,0,r,n),t._tmAtlas.forEach((e,r)=>{e$(t.tmContext,e.textStyle),t.tmContext.fillText(r,1,e.startingHeight+e.height-1)}),t.tmTexture.setCanvas(t.tmCanvas),t.tmTexture.modified()},e.onModified(()=>{t.forceUpdate=!0,e.update()}),e.setTickTextStyle=r=>{t.tickTextStyle={...t.tickTextStyle,...r},e.modified()},e.setAxisTextStyle=r=>{t.axisTextStyle={...t.axisTextStyle,...r},e.modified()},e.get_tmAtlas=()=>t._tmAtlas,e.computeBounds=()=>{e.update(),d.Ay.setBounds(t.bounds,t.gridActor.getBounds()),d.Ay.scaleAboutCenter(t.bounds,t.boundsScaleFactor,t.boundsScaleFactor,t.boundsScaleFactor)};let n=e.setProperty;e.setProperty=e=>{let r=n(e);return t.gridActor.setProperty(e),r}},"vtkCubeAxesActor");var eX={newCubeAxesActorHelper:eq},eY=r(72188),eZ=r(56929),eJ={},eQ=(0,l.UI)(function(e,t,r={}){Object.assign(t,eJ,r),eY.A.extend(e,t,r),t.CubeAxesActorHelper=eX.newCubeAxesActorHelper(),t.classHierarchy.push("vtkOpenGLCubeAxesActor"),e.buildPass=r=>{r&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.CubeAxesActorHelper.getRenderable()||t.CubeAxesActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.CubeAxesActorHelper.getTmActor()),e.addMissingNode(t.renderable.getGridActor()),e.removeUnusedNodes())},e.opaquePass=(e,r)=>{if(e){let e=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,r=t._openGLRenderer.getTiledSizeAndOrigin();t.CubeAxesActorHelper.updateAPISpecificData([r.usize,r.vsize],e,t._openGLRenderWindow.getRenderable())}}},"vtkOpenGLCubeAxesActor");(0,eZ.c9)("vtkCubeAxesActor",eQ);var e0=r(31727),e1=r(39311),e2=r(9731),{vtkErrorMacro:e5}=l.Ay,e3={tmpVec3A:null,tmpVec3B:null},e9=l.Ay.newInstance(function(e,t,r={}){Object.assign(t,e3,r),e0.Ay.extend(e,t,r),t.tmpVec3A=[0,0,0],t.tmpVec3B=[0,0,0];t.classHierarchy.push("vtkOpenGLCutterMapper");let n={...e};e.replaceShaderClip=(e,r,n)=>{let i=e.Vertex,a=e.Fragment,o=t.renderable.getSupportedImplicitFunctionName();if(!o)return void e5("No cut function set.");if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();i=e2.A.substitute(i,"//VTK::Clip::Dec",["uniform int numClipPlanes;",`uniform vec4 clipPlanes[${e}];`,`varying float clipDistancesVSOutput[${e}];`,"//VTK::Clip::Dec"]).result,i=e2.A.substitute(i,"//VTK::Clip::Impl",[`for (int planeNum = 0; planeNum < ${e}; planeNum++)`," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }","//VTK::Clip::Impl"]).result,a=e2.A.substitute(a,"//VTK::Clip::Dec",["uniform int numClipPlanes;",`varying float clipDistancesVSOutput[${e}];`,"//VTK::Clip::Dec"]).result,a=e2.A.substitute(a,"//VTK::Clip::Impl",[`for (int planeNum = 0; planeNum < ${e}; planeNum++)`," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }","//VTK::Clip::Impl"]).result}let s=[],l=[];switch(o){case"vtkPlane":s=["uniform vec3 cutPlaneOrigin;","uniform vec3 cutPlaneNormal;","uniform float cutValue;"],l=["cutDistanceVSOutput = dot(cutPlaneNormal, cutFunctionPoint - cutPlaneOrigin) - cutValue;"];break;case"vtkSphere":s=["uniform vec3 cutSphereCenter;","uniform vec3 cutSphereRadius;","uniform int cutSphereUsesAxisRadii;"],l=["vec3 cutSphereDelta = cutFunctionPoint - cutSphereCenter;","if (cutSphereUsesAxisRadii == 1) {"," vec3 cutSphereNormalizedDelta = cutSphereDelta / cutSphereRadius;"," cutDistanceVSOutput = dot(cutSphereNormalizedDelta, cutSphereNormalizedDelta) - 1.0;","} else {"," cutDistanceVSOutput = dot(cutSphereDelta, cutSphereDelta) - cutSphereRadius.x * cutSphereRadius.x;","}"];break;case"vtkBox":s=["uniform vec3 cutBoxMinPoint;","uniform vec3 cutBoxMaxPoint;"],l=["float cutBoxMinDistance = -1.0e20;","float cutBoxDistance = 0.0;","bool cutBoxInside = true;","bool cutBoxIsDegenerate = false;","for (int i = 0; i < 3; ++i) {"," float cutBoxLength = cutBoxMaxPoint[i] - cutBoxMinPoint[i];"," float cutBoxDist = 0.0;"," if (cutBoxLength != 0.0) {"," float cutBoxT = (cutFunctionPoint[i] - cutBoxMinPoint[i]) / cutBoxLength;"," if (cutBoxT < 0.0) {"," cutBoxInside = false;"," cutBoxDist = cutBoxMinPoint[i] - cutFunctionPoint[i];"," } else if (cutBoxT > 1.0) {"," cutBoxInside = false;"," cutBoxDist = cutFunctionPoint[i] - cutBoxMaxPoint[i];"," } else if (cutBoxT <= 0.5) {"," cutBoxDist = cutBoxMinPoint[i] - cutFunctionPoint[i];"," cutBoxMinDistance = max(cutBoxMinDistance, cutBoxDist);"," } else {"," cutBoxDist = cutFunctionPoint[i] - cutBoxMaxPoint[i];"," cutBoxMinDistance = max(cutBoxMinDistance, cutBoxDist);"," }"," } else {"," // Degenerate axis: box has zero thickness along this dimension"," cutBoxIsDegenerate = true;"," cutBoxDist = abs(cutFunctionPoint[i] - cutBoxMinPoint[i]);"," if (cutBoxDist > 0.0) {"," cutBoxInside = false;"," }"," }"," if (cutBoxDist > 0.0) {"," cutBoxDistance += cutBoxDist * cutBoxDist;"," }","}","// Guard against degenerate boxes (zero size on one or more axes)","if (cutBoxIsDegenerate && cutBoxInside) {"," cutDistanceVSOutput = 0.0;","} else if (cutBoxInside) {"," cutDistanceVSOutput = cutBoxMinDistance;","} else {"," cutDistanceVSOutput = sqrt(cutBoxDistance);","}"];break;case"vtkCylinder":s=["uniform vec3 cutCylinderCenter;","uniform vec3 cutCylinderAxis;","uniform float cutCylinderRadius;"],l=["vec3 cutCylinderDelta = cutFunctionPoint - cutCylinderCenter;","float cutCylinderAxisLengthSq = dot(cutCylinderAxis, cutCylinderAxis);","float cutCylinderProjection = dot(cutCylinderAxis, cutCylinderDelta);","cutDistanceVSOutput = cutCylinderAxisLengthSq > 0.0 ? dot(cutCylinderDelta, cutCylinderDelta) - cutCylinderProjection * cutCylinderProjection / cutCylinderAxisLengthSq - cutCylinderRadius * cutCylinderRadius : dot(cutCylinderDelta, cutCylinderDelta) - cutCylinderRadius * cutCylinderRadius;"];break;case"vtkCone":s=["uniform float cutConeTanThetaSquared;"],l=["cutDistanceVSOutput = cutFunctionPoint.y * cutFunctionPoint.y + cutFunctionPoint.z * cutFunctionPoint.z - cutFunctionPoint.x * cutFunctionPoint.x * cutConeTanThetaSquared;"];break;default:e5("No cut function set.")}i=e2.A.substitute(i,"//VTK::Clip::Dec",["uniform mat4 cutFunctionMatrix;","varying float cutDistanceVSOutput;",...s]).result,i=e2.A.substitute(i,"//VTK::Clip::Impl",["vec3 cutFunctionPoint = (cutFunctionMatrix * vertexMC).xyz;",...l]).result,a=e2.A.substitute(a,"//VTK::Clip::Dec",["varying float cutDistanceVSOutput;","uniform float cutWidth;"]).result,a=e2.A.substitute(a,"//VTK::Clip::Impl",["if (abs(cutDistanceVSOutput) > max(fwidth(cutDistanceVSOutput) * cutWidth, 1e-6)) discard;"]).result,e.Vertex=i,e.Fragment=a},e.replaceShaderValues=(e,r,i)=>{n.replaceShaderValues(e,r,i),t.renderable.getSupportedImplicitFunctionName()&&(e.Fragment=e2.A.substitute(e.Fragment,"//VTK::UniformFlow::Impl",[" float cutterDistanceDx = dFdx(cutDistanceVSOutput);"," float cutterDistanceDy = dFdy(cutDistanceVSOutput);"," float cutterDistanceGradient = length(vec2(cutterDistanceDx, cutterDistanceDy));"," if (cutterDistanceGradient <= 0.0 && abs(cutDistanceVSOutput) > 1e-6) discard;"]).result)},e.setMapperShaderParameters=(e,r,i)=>{n.setMapperShaderParameters(e,r,i);let a=t.renderable.getCutFunction(),o=t.renderable.getSupportedImplicitFunctionName();if(!a||!o)return;let s=e.getCABO().getCoordShiftAndScaleEnabled(),l=s?e.getCABO().getInverseShiftAndScaleMatrix():null;s&&!l&&e5("Failed to retrieve inverse shift and scale matrix for cut function");let c=a.getTransform?.(),d=c?.getMatrix?Array.from(c.getMatrix()):e1.zK,p=l?v.multiply(t.tmpMat4,d,l):d,m=e.getProgram();switch(m.isUniformUsed("cutFunctionMatrix")&&m.setUniformMatrix("cutFunctionMatrix",p),o){case"vtkPlane":m.isUniformUsed("cutPlaneOrigin")&&m.setUniform3fArray("cutPlaneOrigin",a.getOrigin()),m.isUniformUsed("cutPlaneNormal")&&m.setUniform3fArray("cutPlaneNormal",a.getNormal()),m.isUniformUsed("cutValue")&&m.setUniformf("cutValue",t.renderable.getCutValue());break;case"vtkSphere":{let e=a.getRadius();if(m.isUniformUsed("cutSphereCenter")&&m.setUniform3fArray("cutSphereCenter",a.getCenter()),m.isUniformUsed("cutSphereRadius")){let r=t.tmpVec3A;Array.isArray(e)?(r[0]=e[0],r[1]=e[1],r[2]=e[2]):(r[0]=e,r[1]=e,r[2]=e),m.setUniform3fArray("cutSphereRadius",r)}m.isUniformUsed("cutSphereUsesAxisRadii")&&m.setUniformi("cutSphereUsesAxisRadii",+!!Array.isArray(e));break}case"vtkBox":{let e=a.getBounds();if(m.isUniformUsed("cutBoxMinPoint")){let r=t.tmpVec3A;r[0]=e[0],r[1]=e[2],r[2]=e[4],m.setUniform3fArray("cutBoxMinPoint",r)}if(m.isUniformUsed("cutBoxMaxPoint")){let r=t.tmpVec3B;r[0]=e[1],r[1]=e[3],r[2]=e[5],m.setUniform3fArray("cutBoxMaxPoint",r)}break}case"vtkCylinder":m.isUniformUsed("cutCylinderCenter")&&m.setUniform3fArray("cutCylinderCenter",a.getCenter()),m.isUniformUsed("cutCylinderAxis")&&m.setUniform3fArray("cutCylinderAxis",a.getAxis()),m.isUniformUsed("cutCylinderRadius")&&m.setUniformf("cutCylinderRadius",a.getRadius());break;case"vtkCone":if(m.isUniformUsed("cutConeTanThetaSquared")){let e=Math.tan(u.Ay.radiansFromDegrees(a.getAngle()));m.setUniformf("cutConeTanThetaSquared",e*e)}break;default:e5("No cut function set.")}m.isUniformUsed("cutWidth")&&m.setUniformf("cutWidth",t.renderable.getCutWidth())}},"vtkOpenGLCutterMapper");(0,eZ.c9)("vtkCutterMapper",e9),r(88296);var e4=r(30536),e8={BACKGROUND:0,FOREGROUND:1},e6={DisplayLocation:e8},e7=r(86077),te=r(89988),{primTypes:tt}=e7.Ay,{Filter:tr,Wrap:tn}=s.Ay,{vtkErrorMacro:ti}=l.o$,ta={type:"StartEvent"},to={type:"EndEvent"},ts={context:null,VBOBuildTime:0,VBOBuildString:null,primitives:null,primTypes:null,shaderRebuildString:null},tl=(0,l.UI)(function(e,t,r={}){Object.assign(t,ts,r),eY.A.extend(e,t,r),te.A.implementReplaceShaderCoincidentOffset(e,t,r),te.A.implementBuildShadersWithReplacements(e,t,r),t.primitives=[],t.primTypes=tt,t.tmpMat4=v.identity(new Float64Array(16));for(let e=tt.Start;e{r&&(t.openGLActor2D=e.getFirstAncestorOfType("vtkOpenGLActor2D"),t._openGLRenderer=t.openGLActor2D.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getLastAncestorOfType("vtkOpenGLRenderWindow"),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera(),t.openGLCamera))},e.overlayPass=t=>{t&&e.render()},e.getShaderTemplate=(e,t,r)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyData2DVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\n// all variables that represent positions or directions have a suffix\n// indicating the coordinate system they are in. The possible values are\n// MC - Model Coordinates\n// WC - WC world coordinates\n// VC - View Coordinates\n// DC - Display Coordinates\n\nin vec4 vertexWC;\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// material property values\n//VTK::Color::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\nuniform mat4 WCVCMatrix; // World to view matrix\n\nvoid main()\n{\n // Apple Bug\n //VTK::PrimID::Impl\n\n gl_Position = WCVCMatrix*vertexWC;\n\n //VTK::TCoord::Impl\n\n //VTK::Color::Impl\n\n //VTK::PositionVC::Impl\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyData2DFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nuniform int PrimitiveIDOffset;\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// Scalar coloring\n//VTK::Color::Dec\n\n// Depth Peeling\n//VTK::DepthPeeling::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\nvoid main()\n{\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Color::Impl\n //VTK::TCoord::Impl\n\n //VTK::DepthPeeling::Impl\n //VTK::Picking::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n}\n",e.Geometry=""},e.render=()=>{let r=t._openGLRenderWindow.getContext();if(t.context!==r){t.context=r;for(let e=tt.Start;e{if(e.invokeEvent(ta),t.renderable.getStatic()||t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent(to),!t.currentInput)return void ti("No input!");if(!t.currentInput.getPoints||!t.currentInput.getPoints().getNumberOfValues())return;let i=t.context,a=n.getProperty();a.getBackfaceCulling()||a.getFrontfaceCulling()?(t._openGLRenderWindow.enableCullFace(),a.getBackfaceCulling()&&a.getFrontfaceCulling()?t._openGLRenderWindow.setCullFaceMode(i.FRONT_AND_BACK):a.getBackfaceCulling()?t._openGLRenderWindow.setCullFaceMode(i.BACK):t._openGLRenderWindow.setCullFaceMode(i.FRONT)):t._openGLRenderWindow.disableCullFace(),e.renderPieceStart(r,n),e.renderPieceDraw(r,n),e.renderPieceFinish(r,n)},e.renderPieceStart=(r,n)=>{t.primitiveIDOffset=0,t._openGLRenderer.getSelector()&&(t._openGLRenderer.getSelector().getCurrentPass(),t._openGLRenderer.getSelector().renderProp(n)),t.renderable.getColorTextureMap()&&t.internalColorTexture.activate(),e.updateBufferObjects(r,n),t.lastBoundBO=null},e.getNeedToRebuildShaders=(e,r,n)=>!!(e.getShaderSourceTime().getMTime(){e.getNeedToRebuildBufferObjects(t,r)&&e.buildBufferObjects(t,r)},e.getNeedToRebuildBufferObjects=(r,n)=>{let i=t.VBOBuildTime.getMTime();return!!(i{let n=t.currentInput;if(null===n)return;t.renderable.mapScalars(n,r.getProperty().getOpacity());let i=t.renderable.getColorMapColors(),a=r.getProperty().getRepresentation(),o=n.getPointData().getTCoords();t.openGLActor2D.getActiveTextures()||(o=null);let l=!1;if(t.renderable.getColorCoordinates()){o=t.renderable.getColorCoordinates(),l=t.renderable.getAreScalarsMappedFromCells(),t.internalColorTexture||(t.internalColorTexture=s.Ay.newInstance({resizable:!0}));let e=t.internalColorTexture;e.setMinificationFilter(tr.NEAREST),e.setMagnificationFilter(tr.NEAREST),e.setWrapS(tn.CLAMP_TO_EDGE),e.setWrapT(tn.CLAMP_TO_EDGE),e.setOpenGLRenderWindow(t._openGLRenderWindow);let r=t.renderable.getColorTextureMap(),n=r.getExtent(),i=r.getPointData().getScalars();e.create2DFromRaw({width:n[1]-n[0]+1,height:n[3]-n[2]+1,numComps:i.getNumberOfComponents(),dataType:i.getDataType(),data:i.getData()}),e.activate(),e.sendParameters(),e.deactivate()}let u=t.renderable.getTransformCoordinate(),c=e.getRenderWindow().getViews()[0].getViewportSize(e),d=`${n.getMTime()}A${a}B${n.getMTime()}C${i?i.getMTime():1}D${o?o.getMTime():1}E${u?e.getMTime():1}F${c}`;if(t.VBOBuildString!==d){let r=n.getPoints();if(u){let t=e4.Ay.newInstance(),n=r.getNumberOfPoints();t.setNumberOfPoints(n);let i=[];for(let a=0;an.getPointData().getArrayByName(e))};s.cellOffset+=t.primitives[tt.Points].getCABO().createVBO(n.getVerts(),"verts",a,s),s.cellOffset+=t.primitives[tt.Lines].getCABO().createVBO(n.getLines(),"lines",a,s),s.cellOffset+=t.primitives[tt.Tris].getCABO().createVBO(n.getPolys(),"polys",a,s),s.cellOffset+=t.primitives[tt.TriStrips].getCABO().createVBO(n.getStrips(),"strips",a,s),t.VBOBuildTime.modified(),t.VBOBuildString=d}},e.renderPieceDraw=(r,n)=>{let i=n.getProperty().getRepresentation();t.context.depthMask(!0);for(let a=tt.Start;a{t.lastBoundBO&&t.lastBoundBO.getVAO().release(),t.renderable.getColorTextureMap()&&t.internalColorTexture.deactivate()},e.replaceShaderValues=(t,r,n)=>{e.replaceShaderColor(t,r,n),e.replaceShaderTCoord(t,r,n),e.replaceShaderPicking(t,r,n),e.replaceShaderPositionVC(t,r,n)},e.replaceShaderColor=(e,r,n)=>{let i=e.Vertex,a=e.Geometry,o=e.Fragment,s=["uniform vec3 diffuseColorUniform;","uniform float opacityUniform;"],l=["vec3 diffuseColor = diffuseColorUniform;","float opacity = opacityUniform;"];0!==t.lastBoundBO.getCABO().getColorComponents()?(s=s.concat(["varying vec4 vertexColorVSOutput;"]),i=e2.A.substitute(i,"//VTK::Color::Dec",["attribute vec4 scalarColor;","varying vec4 vertexColorVSOutput;"]).result,i=e2.A.substitute(i,"//VTK::Color::Impl",["vertexColorVSOutput = scalarColor;"]).result,a=e2.A.substitute(a,"//VTK::Color::Dec",["in vec4 vertexColorVSOutput[];","out vec4 vertexColorGSOutput;"]).result,a=e2.A.substitute(a,"//VTK::Color::Impl",["vertexColorGSOutput = vertexColorVSOutput[i];"]).result,o=e2.A.substitute(o,"//VTK::Color::Impl",l.concat([" diffuseColor = vertexColorVSOutput.rgb;"," opacity = opacity*vertexColorVSOutput.a;"])).result):t.renderable.getAreScalarsMappedFromCells()&&(l=l.concat([" vec4 texColor = texture2D(texture1, tcoordVCVSOutput.st);"," diffuseColor = texColor.rgb;"," opacity = opacity*texColor.a;"])),l=l.concat(["gl_FragData[0] = vec4(diffuseColor, opacity);"]),o=e2.A.substitute(o,"//VTK::Color::Dec",s).result,o=e2.A.substitute(o,"//VTK::Color::Impl",l).result,e.Vertex=i,e.Geometry=a,e.Fragment=o},e.replaceShaderTCoord=(e,r,n)=>{if(t.lastBoundBO.getCABO().getTCoordOffset()){let r=e.Vertex,n=e.Geometry,i=e.Fragment,a=t.lastBoundBO.getCABO().getTCoordComponents();1===a?(r=e2.A.substitute(r,"//VTK::TCoord::Dec",["in float tcoordMC;","out float tcoordVCVSOutput;"]).result,r=e2.A.substitute(r,"//VTK::TCoord::Impl",["tcoordVCVSOutput = tcoordMC;"]).result,n=e2.A.substitute(n,"//VTK::TCoord::Dec",["in float tcoordVCVSOutput[];\n","out float tcoordVCGSOutput;"]).result,n=e2.A.substitute(n,["//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];"]).result,i=e2.A.substitute(i,"//VTK::TCoord::Dec",["in float tcoordVCVSOutput;","uniform sampler2D texture1;"]).result,i=e2.A.substitute(i,"//VTK::TCoord::Impl",["gl_FragData[0] = gl_FragData[0]*texture2D(texture1, vec2(tcoordVCVSOutput,0));"]).result):2===a&&(r=e2.A.substitute(r,"//VTK::TCoord::Dec",["in vec2 tcoordMC;","out vec2 tcoordVCVSOutput;"]).result,r=e2.A.substitute(r,"//VTK::TCoord::Impl",["tcoordVCVSOutput = tcoordMC;"]).result,n=e2.A.substitute(n,"//VTK::TCoord::Dec",["in vec2 tcoordVCVSOutput[];\n","out vec2 tcoordVCGSOutput;"]).result,n=e2.A.substitute(n,"//VTK::TCoord::Impl",["tcoordVCGSOutput = tcoordVCVSOutput[i];"]).result,i=e2.A.substitute(i,"//VTK::TCoord::Dec",["in vec2 tcoordVCVSOutput;","uniform sampler2D texture1;"]).result,i=e2.A.substitute(i,"//VTK::TCoord::Impl",["gl_FragData[0] = gl_FragData[0]*texture2D(texture1, tcoordVCVSOutput.st);"]).result),t.renderable.getAreScalarsMappedFromCells()&&(n=e2.A.substitute(n,"//VTK::PrimID::Impl",["gl_PrimitiveID = gl_PrimitiveIDIn;"]).result),e.Vertex=r,e.Geometry=n,e.Fragment=i}},e.replaceShaderPicking=(e,t,r)=>{let n=e.Fragment;n=e2.A.substitute(n,"//VTK::Picking::Dec",["uniform vec3 mapperIndex;","uniform int picking;"]).result,e.Fragment=n=e2.A.substitute(n,"//VTK::Picking::Impl"," gl_FragData[0] = picking != 0 ? vec4(mapperIndex,1.0) : gl_FragData[0];").result},e.replaceShaderPositionVC=(e,r,n)=>{t.lastBoundBO.replaceShaderPositionVC(e,r,n)},e.invokeShaderCallbacks=(e,r,n)=>{let i=t.renderable.getViewSpecificProperties().ShadersCallbacks;i&&i.forEach(t=>{t.callback(t.userData,e,r,n)})},e.setMapperShaderParameters=(e,r,n)=>{if(e.getProgram().isUniformUsed("PrimitiveIDOffset")&&e.getProgram().setUniformi("PrimitiveIDOffset",t.primitiveIDOffset),e.getProgram().isAttributeUsed("vertexWC")&&!e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"vertexWC",e.getCABO().getVertexOffset(),e.getCABO().getStride(),t.context.FLOAT,3,!1)&&ti("Error setting vertexWC in shader VAO."),e.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime())){t.renderable.getCustomShaderAttributes().forEach((r,n)=>{e.getProgram().isAttributeUsed(`${r}MC`)&&!e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),`${r}MC`,e.getCABO().getCustomData()[n].offset,e.getCABO().getStride(),t.context.FLOAT,e.getCABO().getCustomData()[n].components,!1)&&ti(`Error setting ${r}MC in shader VAO.`)}),e.getProgram().isAttributeUsed("tcoordMC")&&e.getCABO().getTCoordOffset()?e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"tcoordMC",e.getCABO().getTCoordOffset(),e.getCABO().getStride(),t.context.FLOAT,e.getCABO().getTCoordComponents(),!1)||ti("Error setting tcoordMC in shader VAO."):e.getVAO().removeAttributeArray("tcoordMC"),e.getProgram().isAttributeUsed("scalarColor")&&e.getCABO().getColorComponents()?e.getVAO().addAttributeArray(e.getProgram(),e.getCABO().getColorBO(),"scalarColor",e.getCABO().getColorOffset(),e.getCABO().getColorBOStride(),t.context.UNSIGNED_BYTE,4,!0)||ti("Error setting scalarColor in shader VAO."):e.getVAO().removeAttributeArray("scalarColor"),t.internalColorTexture&&e.getProgram().isUniformUsed("texture1")&&t.internalColorTexture.getTextureUnit()>-1&&e.getProgram().setUniformi("texture1",t.internalColorTexture.getTextureUnit());let i=t.openGLActor2D.getActiveTextures();if(i)for(let t=0;t{let i=t.renderable.getColorMapColors();if(!i||0===i.getNumberOfComponents()){let t=e.getProgram(),r=n.getProperty(),i=r.getOpacity();t.setUniformf("opacityUniform",i);let a=r.getColor();t.setUniform3fArray("diffuseColorUniform",a)}},e.setLightingShaderParameters=(e,t,r)=>{},e.setCameraShaderParameters=(e,r,n)=>{var i,a;let o=e.getProgram(),s=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,l=r.getRenderWindow().getViews()[0].getViewportSize(r),c=r.getViewport(),d=n.getActualPositionCoordinate().getComputedDoubleViewportValue(r),p=[0,0,1,1];if(p[0]=c[0]>=0?c[0]:0,p[1]=c[1]>=0?c[1]:0,p[2]=c[2]<=1?c[2]:1,p[3]=c[3]<=1?c[3]:1,p[0]>=p[2]||p[1]>=p[3])return;l[0]=(0,u.LI)(l[0]*(p[2]-p[0])/(c[2]-c[0])),l[1]=(0,u.LI)(l[1]*(p[3]-p[1])/(c[3]-c[1]));let m=t._openGLRenderer.getParent().getSize(),h=(0,u.LI)(d[0]-(p[0]-c[0])*m[0]),f=(0,u.LI)(d[1]-(p[1]-c[1])*m[1]),g=-h,y=-h+l[0],b=-f,I=-f+l[1];g===y&&(y=g+1),b===I&&(I=b+1);let x=v.identity(new Float64Array(16));x[0]=2/(y-g),x[5]=2/(I-b),x[3]=-1*(y+g)/(y-g),x[7]=-1*(I+b)/(I-b),x[10]=0,x[11]=n.getProperty().getDisplayLocation()===e8.FOREGROUND?-1:1,x[15]=1,v.transpose(x,x),o.setUniformMatrix("WCVCMatrix",(i=[x,s],a=t.tmpMat4,v.identity(a),i.reduce((e,t,r)=>0===r?t?v.copy(e,t):v.identity(e):t?v.multiply(e,e,t):e,a)))},e.getAllocatedGPUMemoryInBytes=()=>{let e=0;return t.primitives.forEach(t=>{e+=t.getAllocatedGPUMemoryInBytes()}),e}},"vtkOpenGLPolyDataMapper2D");(0,eZ.c9)("vtkMapper2D",tl),r(80039);var tu=r(64541),tc={Orientation:{HORIZONTAL:"horizontal",VERTICAL:"vertical",AUTO:"auto"}},{VectorMode:td}=tu.Ay,{Orientation:tp}=tc;function tm(e,t,r){e.strokeStyle=t.strokeColor,e.lineWidth=t.strokeSize,e.fillStyle=t.fontColor;let n=t.fontSize??r;e.font=`${t.fontStyle} ${n}px ${t.fontFamily}`}function th(e,t){return e=>{let r=e.getLastSize(),n=(r[0]/700)**.8,i=(r[1]/700)**.8,a=Math.min(n,i),o=e.getAxisTextStyle(),s=e.getTickTextStyle();Object.assign(o,t.axisTextStyle),Object.assign(s,t.tickTextStyle),void 0===o.fontSize&&(o.fontSize=Math.max(24*a,12)),void 0===s.fontSize&&(e.getLastAspectRatio()>1?s.fontSize=Math.max(20*a,10):s.fontSize=Math.max(16*a,10));let l=e.updateTextureAtlas();e.setTopTitle(!1);let u=e.getBoxSizeByReference();if(t.orientation===tp.VERTICAL||t.orientation!==tp.HORIZONTAL&&e.getLastAspectRatio()>1)e.setTickLabelPixelOffset(.3*s.fontSize),l.titleWidth<=l.tickWidth+e.getTickLabelPixelOffset()+.8*s.fontSize?(e.setTopTitle(!0),e.setAxisTitlePixelOffset(.2*s.fontSize),u[0]=2*(l.tickWidth+e.getTickLabelPixelOffset()+.8*s.fontSize)/r[0],e.setBoxPosition([.98-u[0],-.92])):(e.setAxisTitlePixelOffset(.2*s.fontSize),u[0]=2*(l.titleHeight+e.getAxisTitlePixelOffset()+l.tickWidth+e.getTickLabelPixelOffset()+.8*s.fontSize)/r[0],e.setBoxPosition([.99-u[0],-.92])),u[1]=Math.max(1.2,Math.min(1.84/i,1.84));else{e.setAxisTitlePixelOffset(1.2*s.fontSize),e.setTickLabelPixelOffset(.1*s.fontSize);let t=2*(.8*s.fontSize+l.titleHeight+e.getAxisTitlePixelOffset())/r[1],n=2*l.tickWidth/r[0];u[0]=Math.min(1.9,Math.max(1.4,1.4*n*(e.getTicks().length+3))),u[1]=t,e.setBoxPosition([-.5*u[0],-.97])}e.recomputeBarSegments(l)}}function tf(e,t){return e=>{let t=e.getLastTickBounds(),r=eM().domain([t[0],t[1]]),n=r.ticks(5),i=r.tickFormat(5);e.setTicks(n),e.setTickStrings(n.map(i))}}var tg=l.Ay.newInstance((e,t,r={renderable:null})=>{Object.assign(t,{},r),l.Ay.obj(e,t),l.Ay.setGet(e,t,["axisTitlePixelOffset","tickLabelPixelOffset","renderable","topTitle","ticks","tickStrings","tickPositions"]),l.Ay.get(e,t,["lastSize","lastAspectRatio","lastTickBounds","axisTextStyle","tickTextStyle","barActor","tmActor"]),l.Ay.getArray(e,t,["boxPosition","boxSize"]),l.Ay.setArray(e,t,["boxPosition","boxSize"],2),t.forceUpdate=!1,t.lastRebuildTime={},l.Ay.obj(t.lastRebuildTime,{mtime:0}),t.lastSize=[-1,-1],t.tmCanvas=document.createElement("canvas"),t.tmContext=t.tmCanvas.getContext("2d"),t._tmAtlas=new Map,t.barMapper=h.Ay.newInstance(),t.barMapper.setInterpolateScalarsBeforeMapping(!0),t.barMapper.setUseLookupTableScalarRange(!0),t.polyData=p.Ay.newInstance(),t.barMapper.setInputData(t.polyData),t.barActor=m.Ay.newInstance(),t.barActor.setMapper(t.barMapper),t.tmPolyData=p.Ay.newInstance(),t.tmMapper=h.Ay.newInstance(),t.tmMapper.setInputData(t.tmPolyData),t.tmTexture=f.Ay.newInstance({resizable:!0}),t.tmTexture.setInterpolate(!1),t.tmActor=m.Ay.newInstance({parentProp:e}),t.tmActor.setMapper(t.tmMapper),t.tmActor.addTexture(t.tmTexture),t.barPosition=[0,0],t.barSize=[0,0],t.boxPosition=[.88,-.92],t.boxSize=[.1,1.1],t.lastTickBounds=[],function(e,t){t.classHierarchy.push("vtkScalarBarActorHelper"),e.setRenderable=r=>{t.renderable!==r&&(t.renderable=r,t.barActor.setProperty(r.getProperty()),t.barActor.setParentProp(r),t.barActor.setCoordinateSystemToDisplay(),t.tmActor.setProperty(r.getProperty()),t.tmActor.setParentProp(r),t.tmActor.setCoordinateSystemToDisplay(),t.generateTicks=r.generateTicks,t.axisTextStyle={...r.getAxisTextStyle()},t.tickTextStyle={...r.getTickTextStyle()},e.modified())},e.updateAPISpecificData=(r,n,i)=>{(t.lastSize[0]!==r[0]||t.lastSize[1]!==r[1])&&(t.lastSize[0]=r[0],t.lastSize[1]=r[1],t.lastAspectRatio=r[0]/r[1],t.forceUpdate=!0);let a=t.renderable.getScalarsToColors();if(a&&t.renderable.getVisibility()&&(t.barMapper.setLookupTable(a),t.camera=n,t.renderWindow=i,t.forceUpdate||Math.max(a.getMTime(),e.getMTime(),t.renderable.getMTime())>t.lastRebuildTime.getMTime())){if(t.lastTickBounds=[...a.getMappingRange()],t.renderable.getGenerateTicks()(e),t.renderable.getAutomated())t.renderable.getAutoLayout()(e);else{t.axisTextStyle={...t.renderable.getAxisTextStyle()},t.tickTextStyle={...t.renderable.getTickTextStyle()},t.barPosition=[...t.renderable.getBarPosition()],t.barSize=[...t.renderable.getBarSize()],t.boxPosition=[...t.renderable.getBoxPosition()],t.boxSize=[...t.renderable.getBoxSize()],t.axisTitlePixelOffset=t.renderable.getAxisTitlePixelOffset(),t.tickLabelPixelOffset=t.renderable.getTickLabelPixelOffset();let r=e.updateTextureAtlas();e.recomputeBarSegments(r)}e.updatePolyDataForLabels(),e.updatePolyDataForBarSegments(),t.lastRebuildTime.modified(),t.forceUpdate=!1}},e.updateTextureAtlas=()=>{t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left";let r={},n=new Map,i=0,a=1;tm(t.tmContext,t.axisTextStyle,18);let o=t.tmContext.measureText(t.renderable.getAxisLabel()),s={height:o.actualBoundingBoxAscent+2,startingHeight:a,width:o.width+2,textStyle:t.axisTextStyle};n.set(t.renderable.getAxisLabel(),s),a+=s.height,i=s.width,r.titleWidth=s.width,r.titleHeight=s.height,r.tickWidth=0,r.tickHeight=0,tm(t.tmContext,t.tickTextStyle,14);let l=[...e.getTickStrings(),"NaN","Below","Above"];for(let e=0;e{e.tcoords=[0,(a-e.startingHeight-e.height)/a,e.width/i,(a-e.startingHeight-e.height)/a,e.width/i,(a-e.startingHeight)/a,0,(a-e.startingHeight)/a]}),t.tmCanvas.width=i,t.tmCanvas.height=a,t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left",t.tmContext.clearRect(0,0,i,a),n.forEach((e,r)=>{let n=e.textStyle===t.axisTextStyle?18:14;tm(t.tmContext,e.textStyle,n),t.tmContext.fillText(r,1,e.startingHeight+e.height-1)}),t.tmTexture.setCanvas(t.tmCanvas),t.tmTexture.modified(),t._tmAtlas=n,r},e.computeBarSize=e=>{t.vertical=t.boxSize[1]>t.boxSize[0];let r=2*e.tickHeight/t.lastSize[1],n=[1,1];if(t.vertical){let i=2*(e.tickWidth+t.tickLabelPixelOffset)/t.lastSize[0];if(t.topTitle){let r=2*(e.titleHeight+t.axisTitlePixelOffset)/t.lastSize[1];t.barSize[0]=t.boxSize[0]-i,t.barSize[1]=t.boxSize[1]-r}else{let r=2*(e.titleHeight+t.axisTitlePixelOffset)/t.lastSize[0];t.barSize[0]=t.boxSize[0]-r-i,t.barSize[1]=t.boxSize[1]}t.barPosition[0]=t.boxPosition[0]+i,t.barPosition[1]=t.boxPosition[1],n[1]=r}else{let r=(2*e.tickWidth-8)/t.lastSize[0],i=2*(e.titleHeight+t.axisTitlePixelOffset)/t.lastSize[1];t.barSize[0]=t.boxSize[0],t.barPosition[0]=t.boxPosition[0],t.barSize[1]=t.boxSize[1]-i,t.barPosition[1]=t.boxPosition[1],n[0]=r}return n},e.recomputeBarSegments=r=>{let n=e.computeBarSize(r);t.barSegments=[];let i=[0,0],a=+!!t.vertical,o=t.vertical?.01:.02;function s(e,r){t.barSegments.push({corners:[[...i],[i[0]+n[0],i[1]],[i[0]+n[0],i[1]+n[1]],[i[0],i[1]+n[1]]],scalars:r,title:e}),i[a]+=n[a]+o}t.renderable.getDrawNanAnnotation()&&t.renderable.getScalarsToColors().getNanColor()&&s("NaN",[NaN,NaN,NaN,NaN]),t.renderable.getDrawBelowRangeSwatch()&&t.renderable.getScalarsToColors().getUseBelowRangeColor?.()&&s("Below",[-.1,-.1,-.1,-.1]);let l=t.renderable.getScalarsToColors().getUseAboveRangeColor?.();i[a]+=o;let u=n[a];n[a]=l?1-2*o-n[a]-i[a]:1-o-i[a],s("ticks",t.vertical?[0,0,.995,.995]:[0,.995,.995,0]),t.renderable.getDrawAboveRangeSwatch()&&l&&(n[a]=u,i[a]+=o,s("Above",[1.1,1.1,1.1,1.1]))};let r=new Float64Array(3);e.createPolyDataForOneLabel=(e,n,i,a,o,s)=>{let l=t._tmAtlas.get(e);if(!l)return;let u=s.ptIdx,c=s.cellIdx;r[0]=(.5*n[0]+.5)*t.lastSize[0],r[1]=(.5*n[1]+.5)*t.lastSize[1],r[2]=n[2],r[0]+=o[0],r[1]+=o[1];let d=[],p="vertical"===a?[1,0]:[0,1];"vertical"===a?(d[0]=l.width,d[1]=-l.height,"middle"===i[0]?r[1]-=l.width/2:"right"===i[0]&&(r[1]-=l.width),"middle"===i[1]?r[0]+=l.height/2:"top"===i[1]&&(r[0]+=l.height)):(d[0]=l.width,d[1]=l.height,"middle"===i[0]?r[0]-=l.width/2:"right"===i[0]&&(r[0]-=l.width),"middle"===i[1]?r[1]-=l.height/2:"top"===i[1]&&(r[1]-=l.height)),s.points[3*u]=r[0],s.points[3*u+1]=r[1],s.points[3*u+2]=r[2],s.tcoords[2*u]=l.tcoords[0],s.tcoords[2*u+1]=l.tcoords[1],u++,r[p[0]]+=d[0],s.points[3*u]=r[0],s.points[3*u+1]=r[1],s.points[3*u+2]=r[2],s.tcoords[2*u]=l.tcoords[2],s.tcoords[2*u+1]=l.tcoords[3],u++,r[p[1]]+=d[1],s.points[3*u]=r[0],s.points[3*u+1]=r[1],s.points[3*u+2]=r[2],s.tcoords[2*u]=l.tcoords[4],s.tcoords[2*u+1]=l.tcoords[5],u++,r[p[0]]-=d[0],s.points[3*u]=r[0],s.points[3*u+1]=r[1],s.points[3*u+2]=r[2],s.tcoords[2*u]=l.tcoords[6],s.tcoords[2*u+1]=l.tcoords[7],u++,s.polys[4*c]=3,s.polys[4*c+1]=u-4,s.polys[4*c+2]=u-3,s.polys[4*c+3]=u-2,c++,s.polys[4*c]=3,s.polys[4*c+1]=u-4,s.polys[4*c+2]=u-2,s.polys[4*c+3]=u-1,s.ptIdx+=4,s.cellIdx+=2};let n=new Float64Array(3);e.updatePolyDataForLabels=()=>{let r=e.getTickStrings().length+t.barSegments.length,i=4*r,a=new Float64Array(3*i),o=new Uint16Array(2*r*4),s=new Float32Array(2*i),l={ptIdx:0,cellIdx:0,polys:o,points:a,tcoords:s},u=+!t.vertical,d=+!!t.vertical;n[2]=-.99;let p=t.vertical?["right","middle"]:["middle","bottom"],m=[0,1],h=[0,0];t.vertical?(h[0]=-t.tickLabelPixelOffset,t.topTitle?(n[0]=t.boxPosition[0]+.5*t.boxSize[0],n[1]=t.barPosition[1]+t.barSize[1],e.createPolyDataForOneLabel(t.renderable.getAxisLabel(),n,["middle","bottom"],"horizontal",[0,t.axisTitlePixelOffset],l)):(n[0]=t.barPosition[0]+t.barSize[0],n[1]=t.barPosition[1]+.5*t.barSize[1],e.createPolyDataForOneLabel(t.renderable.getAxisLabel(),n,["middle","top"],"vertical",[t.axisTitlePixelOffset,0],l)),m=[-1,0]):(h[1]=t.tickLabelPixelOffset,n[0]=t.barPosition[0]+.5*t.barSize[0],n[1]=t.barPosition[1]+t.barSize[1],e.createPolyDataForOneLabel(t.renderable.getAxisLabel(),n,["middle","bottom"],"horizontal",[0,t.axisTitlePixelOffset],l)),n[u]=t.barPosition[u]+(.5*m[u]+.5)*t.barSize[u],n[d]=t.barPosition[d]+.5*t.barSize[d];let f=null;for(let r=0;r{let e=t.renderable.getScalarsToColors(),r=0;t.renderable.getDrawNanAnnotation()&&e.getNanColor()&&(r+=1),t.renderable.getDrawBelowRangeSwatch()&&e.getUseBelowRangeColor?.()&&(r+=1),t.renderable.getDrawAboveRangeSwatch()&&e.getUseAboveRangeColor?.()&&(r+=1);let i=4*(1+r),a=1;e.getVectorMode()===td.COMPONENT&&(a=e.getVectorComponent()+1);let o=new Float64Array(3*i),s=new Uint16Array(5*i),l=new Float32Array(i*a),u=0,d=0;for(let e=0;e{t.tickTextStyle={...t.tickTextStyle,...r},e.modified()},e.setAxisTextStyle=r=>{t.axisTextStyle={...t.axisTextStyle,...r},e.modified()},e.setOrientationToHorizontal=()=>e.setOrientation(tp.HORIZONTAL),e.setOrientationToVertical=()=>e.setOrientation(tp.VERTICAL),e.resetAutoLayoutToDefault=()=>{e.setAutoLayout(th(e,t))},e.resetGenerateTicksToDefault=()=>{e.setGenerateTicks(tf(e,t))}}var ty={newInstance:l.Ay.newInstance(tv,"vtkScalarBarActor"),extend:tv,newScalarBarActorHelper:tg,...tc},tb={},tI=(0,l.UI)(function(e,t,r={}){Object.assign(t,tb,r),eY.A.extend(e,t,r),t.scalarBarActorHelper=ty.newScalarBarActorHelper(),t.classHierarchy.push("vtkOpenGLScalarBarActor"),e.buildPass=r=>{r&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.scalarBarActorHelper.getRenderable()||t.scalarBarActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.scalarBarActorHelper.getBarActor()),e.addMissingNode(t.scalarBarActorHelper.getTmActor()),e.removeUnusedNodes())},e.opaquePass=(e,r)=>{if(e){let e=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,r=t._openGLRenderer.getTiledSizeAndOrigin();t.scalarBarActorHelper.updateAPISpecificData([r.usize,r.vsize],e,t._openGLRenderWindow.getRenderable())}}},"vtkOpenGLScalarBarActor");(0,eZ.c9)("vtkScalarBarActor",tI),r(40534);var tx=r(65020),tC=r(34967),tA=r(74978),{CoordinateSystem:tT}=tC.Ay,tS={keyMatricesTime:null,keyMatrices:null,propID:void 0,bufferShift:void 0},tw=l.Ay.newInstance(function(e,t,r={}){Object.assign(t,tS,r),eY.A.extend(e,t,r),t.keyMatricesTime={},l.Ay.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},l.Ay.get(e,t,["propID","keyMatricesTime"]),t.bufferShift=[0,0,0,0],t.classHierarchy.push("vtkWebGPUActor"),e.buildPass=r=>{r&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.traverseZBufferPass=r=>{!t.renderable||!t.renderable.getNestedVisibility()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(r,!0),t.children[0]&&t.children[0].traverse(r),e.apply(r,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=r=>{!t.renderable||!t.renderable.getNestedVisibility()||!t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(r,!0),t.children[0]&&t.children[0].traverse(r),e.apply(r,!1))},e.traverseTranslucentPass=r=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(r,!0),t.children[0]&&t.children[0].traverse(r),e.apply(r,!1))},e.queryPass=(e,r)=>{e&&t.renderable&&t.renderable.getVisibility()&&(t.renderable.getIsOpaque()?r.incrementOpaqueActorCount():r.incrementTranslucentActorCount())},e.getBufferShift=r=>(e.getKeyMatrices(r),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();let r=t.renderable.getMatrix();t.bufferShift[0]=r[3],t.bufferShift[1]=r[7],t.bufferShift[2]=r[11];let n=e.getStabilizedCenterByReference();t.renderable.getCoordinateSystem()===tT.WORLD&&(t.bufferShift[0]-=n[0],t.bufferShift[1]-=n[1],t.bufferShift[2]-=n[2]),v.transpose(t.keyMatrices.bcwc,r),t.renderable.getIsIdentity()?v.identity(t.keyMatrices.normalMatrix):(v.copy(t.keyMatrices.normalMatrix,t.keyMatrices.bcwc),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,v.invert(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),v.transpose(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),v.translate(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),t.renderable.getCoordinateSystem()===tT.WORLD?v.translate(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-n[0],-n[1],-n[2]]):v.copy(t.keyMatrices.bcsc,t.keyMatrices.bcwc),t.keyMatricesTime.modified()}return t.keyMatrices}});(0,tA.c9)("vtkActor",tw);var{CoordinateSystem:tO}=tC.Ay,tP={keyMatricesTime:null,keyMatrices:null,propID:void 0,bufferShift:void 0},t_=l.Ay.newInstance(function(e,t,r={}){Object.assign(t,tP,r),eY.A.extend(e,t,r),t.keyMatricesTime={},l.Ay.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},l.Ay.get(e,t,["propID","keyMatricesTime"]),t.bufferShift=[0,0,0,0],t.classHierarchy.push("vtkWebGPUActor2D"),e.buildPass=r=>{r&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.traverseOpaquePass=r=>{!t.renderable||!t.renderable.getNestedVisibility()||!t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(r,!0),t.children[0]&&t.children[0].traverse(r),e.apply(r,!1))},e.traverseTranslucentPass=r=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(r,!0),t.children[0]&&t.children[0].traverse(r),e.apply(r,!1))},e.queryPass=(e,r)=>{e&&t.renderable&&t.renderable.getVisibility()&&(t.renderable.getIsOpaque()?r.incrementOpaqueActorCount():r.incrementTranslucentActorCount())},e.getBufferShift=r=>(e.getKeyMatrices(r),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.bufferShift[0]=0,t.bufferShift[1]=0,t.bufferShift[2]=0;let r=e.getStabilizedCenterByReference();t.renderable.getCoordinateSystem()===tO.WORLD&&(t.bufferShift[0]-=r[0],t.bufferShift[1]-=r[1],t.bufferShift[2]-=r[2]),v.identity(t.keyMatrices.bcwc),v.identity(t.keyMatrices.normalMatrix),v.translate(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),t.renderable.getCoordinateSystem()===tO.WORLD?v.translate(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]):v.copy(t.keyMatrices.bcsc,t.keyMatrices.bcwc),t.keyMatricesTime.modified()}return t.keyMatrices}});(0,tA.c9)("vtkActor2D",t_),r(79026);var tE={},tD=(0,l.UI)(function(e,t,r={}){Object.assign(t,tE,r),eY.A.extend(e,t,r),t.CubeAxesActorHelper=eX.newCubeAxesActorHelper(),t.classHierarchy.push("vtkWebGPUCubeAxesActor"),e.buildPass=r=>{r&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.CubeAxesActorHelper.getRenderable()||t.CubeAxesActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.CubeAxesActorHelper.getTmActor()),e.addMissingNode(t.renderable.getGridActor()),e.removeUnusedNodes())},e.opaquePass=(e,r)=>{if(e){let e=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,r=t.WebGPURenderer.getTiledSizeAndOrigin();t.CubeAxesActorHelper.updateAPISpecificData([r.usize,r.vsize],e,t.WebGPURenderWindow.getRenderable())}}},"vtkWebGPUCubeAxesActor");(0,tA.c9)("vtkCubeAxesActor",tD);var tR=r(44238),tM=r(21122),tN=r(70125),tV=r(10463),tL=r(69927),{DisplayLocation:tB}=e6,tF={color:[1,1,1],opacity:1,pointSize:1,lineWidth:1,representation:tL.YL.SURFACE,displayLocation:tB.FOREGROUND,backfaceCulling:!0,frontfaceCulling:!1};function tU(e,t,r={}){Object.assign(t,tF,r),l.Ay.obj(e,t),l.Ay.setGet(e,t,["opacity","lineWidth","pointSize","displayLocation","representation","backfaceCulling","frontfaceCulling"]),l.Ay.setGetArray(e,t,["color"],3),t.classHierarchy.push("vtkProperty2D"),e.setDisplayLocationToBackground=()=>e.setDisplayLocation(tB.BACKGROUND),e.setDisplayLocationToForeground=()=>e.setDisplayLocation(tB.FOREGROUND),e.setRepresentationToWireframe=()=>e.setRepresentation(tL.YL.WIREFRAME),e.setRepresentationToSurface=()=>e.setRepresentation(tL.YL.SURFACE),e.setRepresentationToPoints=()=>e.setRepresentation(tL.YL.POINTS),e.getRepresentationAsString=()=>l.Ay.enumToString(tL.YL,t.representation)}var tk={newInstance:l.Ay.newInstance(tU,"vtkProperty2D"),extend:tU,...e6},tG=r(59780),tW=r(53038),tz=r(44293),tH=r(40577),tj=r(53014),t$=r(37843),{Resolve:tK}=tV.Ay,{FieldAssociations:tq}=tM.Ay,{BufferUsage:tX,PrimitiveTypes:tY}=tR.Ay,{Representation:tZ}=tN.Ay,{ScalarMode:tJ}=h.Ay,{CoordinateSystem:tQ}=tC.Ay,{DisplayLocation:t0}=tk,t1=` +//VTK::Renderer::Dec + +//VTK::Color::Dec + +//VTK::Normal::Dec + +//VTK::TCoord::Dec + +//VTK::Select::Dec + +//VTK::Mapper::Dec + +//VTK::IOStructs::Dec + +@vertex +fn main( +//VTK::IOStructs::Input +) +//VTK::IOStructs::Output +{ + var output : vertexOutput; + + var vertex: vec4 = vertexBC; + + //VTK::Color::Impl + + //VTK::Normal::Impl + + //VTK::TCoord::Impl + + //VTK::Select::Impl + + //VTK::Position::Impl + + return output; +} +`,t2=` +struct PBRData { + diffuse: vec3, + specular: vec3, +} + +struct Material { + ior: f32, + roughness: f32, + metallic: f32, + base: vec3, +}; + +struct DirectionalLight { + direction: vec3, + color: vec3, +}; + +struct PointLight { + position: vec3, + color: vec3, +}; + +struct SpotLight { + position: vec3, + direction: vec3, + cones: vec2, + color: vec3, +}; + +const pi: f32 = 3.14159265359; + +// Dot product with the max already in it +fn mdot(a: vec3, b: vec3) -> f32 { + return max(0.0, dot(a, b)); +} +// Dot product with a max in it that does not allow for negative values +// Physically based rendering is accurate as long as normals are accurate, +// however this is pretty often not the case. In order to prevent negative +// values from ruining light calculations and creating zones of zero light, +// this remapping is used, which smoothly clamps the dot product between +// zero and one while still maintaining a good amount of accuracy. +fn cdot(a: vec3, b: vec3) -> f32 { + var d: f32 = max(0.0, dot(a, b)); + d = pow((d + 1.0) / 2.0, 2.6); + return d; +} + +// Lambertian diffuse model +fn lambertDiffuse(base: vec3, N: vec3, L: vec3) -> vec3 { + var NdotL: f32 = mdot(N, L); + NdotL = pow(NdotL, 1.5); + return (base/pi)*NdotL; +} + +// Yasuhiro Fujii improvement on the Oren-Nayar model +// https://mimosa-pudica.net/improved-oren-nayar.html +// p is surface color, o is roughness +fn fujiiOrenNayar(p: vec3, o: f32, N: vec3, L: vec3, V: vec3) -> vec3 { + var invpi: f32 = 0.31830988618; // 1/pi + + var o2 = o*o; + var NdotL: f32 = mdot(N, L); + NdotL = pow(NdotL, 1.5); // Less physically accurate, but hides the "seams" between lights better + + var NdotV: f32 = mdot(N, V); + var LdotV: f32 = mdot(L, V); + + var s: f32 = LdotV - NdotL*NdotV; + var t: f32 = mix(1.0, max(NdotL, NdotV), step(0.0, s)); // Mix with step is the equivalent of an if statement + var A: vec3 = 0.5*(o2 / (o2 + 0.33)) + 0.17*p*(o2 / (o2 + 0.13)); + A = invpi*(1 - A); + var B: f32 = 0.45*(o2 / (o2 + 0.09)); + B = invpi*B; + + return p*NdotL*(A + B*(s/t)); +} + +// Fresnel portion of BRDF (IOR only, simplified) +fn schlickFresnelIOR(V: vec3, N: vec3, ior: f32, k: f32) -> f32 { + var NdotV: f32 = mdot(V, N); + var F0: f32 = (pow((ior - 1.0), 2.0) + k*k) / (pow((ior + 1.0), 2.0) + k*k); // This takes into account the roughness, which the other one does not + return F0 + (1.0 - F0) * pow((1.0-NdotV), 5.0); +} + +// Fresnel portion of BRDF (Color ior, better) +fn schlickFresnelRGB(V: vec3, N: vec3, F0: vec3) -> vec3 { + var NdotV: f32 = mdot(V, N); + return F0 + (1.0 - F0) * pow((1-NdotV), 5.0); +} + +// Normal portion of BRDF +// https://learnopengl.com/PBR/Theory +// Trowbridge-Reitz GGX functions: normal, halfway, roughness^2 +fn trGGX(N: vec3, H: vec3, a: f32) -> f32 { + var a2: f32 = a*a; + var NdotH = mdot(N, H); + var NdotH2 = NdotH*NdotH; + + var denom: f32 = NdotH2 * (a2 - 1.0) + 1.0; + + return a2 / max((pi*denom*denom), 0.000001); +} + +// A VERY bad approximation of anisotropy. Real anisotropic calculations require tangent and bitangent +fn anisotrophicTrGGX(N: vec3, H: vec3, O: vec3, s: f32, a: f32) -> f32 { + var Op: vec3 = (rendererUBO.WCVCNormals * vec4(normalize(O) * s, 0.)).xyz; + + var ggx1: f32 = trGGX(N + Op*s, H, a); + var ggx2: f32 = trGGX(N - Op*s, H, a); + return (0.5 * ggx1 + 0.5 * ggx2); +} + +// Geometry portion of BRDF +fn schlickGGX(N: vec3, X: vec3, k: f32) -> f32 { + var NdotX = cdot(N, X); + return NdotX / max(0.000001, (NdotX*(1.0-k) + k)); +} + +fn smithSurfaceRoughness(N: vec3, V: vec3, L: vec3, k: f32) -> f32 { + var ggx1: f32 = min(1.0, schlickGGX(N, V, k)); + var ggx2: f32 = min(1.0, schlickGGX(N, L, k)); + return ggx1*ggx2; +} + +// BRDF Combination +fn cookTorrance(D: f32, F: f32, G: f32, N: vec3, V: vec3, L: vec3) -> f32 { + var num: f32 = D*F*G; + var denom: f32 = 4*cdot(V, N)*cdot(L, N); + + return num / max(denom, 0.000001); +} + +// Different lighting calculations for different light sources +fn calcDirectionalLight(N: vec3, V: vec3, mat: Material, light: DirectionalLight) -> PBRData { + var L: vec3 = normalize(light.direction); // Light Vector + var H: vec3 = normalize(L + V); // Halfway Vector + + var alpha = mat.roughness * mat.roughness; + var k: f32 = alpha * alpha / 2.0; + + var D: f32 = trGGX(N, H, alpha); // Distribution + // var F: f32 = schlickFresnelIOR(V, N, ior, k); // Fresnel + var G: f32 = smithSurfaceRoughness(N, V, L, k); // Geometry + + var brdf: f32 = cookTorrance(D, 1.0, G, N, V, L); // Fresnel term is replaced with 1 because it is added later + var incoming: vec3 = light.color; + var angle: f32 = mdot(L, N); + angle = pow(angle, 1.5); + + var specular: vec3 = brdf * incoming * angle; + // Oren-Nayar gives a clay-like effect when fully rough which some people may not want, so it might be better to give a separate + // control property for the diffuse vs specular roughness + var diffuse: vec3 = incoming * fujiiOrenNayar(mat.base, mat.roughness, N, L, V); + // Stores the specular and diffuse separately to allow for finer post processing + var out = PBRData(diffuse, specular); + + return out; // Returns angle along with color of light so the final color can be multiplied by angle as well (creates black areas) +} + +fn calcPointLight(N: vec3, V: vec3, fragPos: vec3, mat: Material, light: PointLight) -> PBRData { + var L: vec3 = normalize(light.position - fragPos); + var H: vec3 = normalize(L + V); + var dist = distance(light.position, fragPos); + + var alpha = mat.roughness * mat.roughness; + var k: f32 = alpha * alpha / 2.0; + + var D: f32 = trGGX(N, H, alpha); // Distribution + var F: f32 = schlickFresnelIOR(V, N, mat.ior, k); // Fresnel + var G: f32 = smithSurfaceRoughness(N, V, L, k); // Geometry + + var brdf: f32 = cookTorrance(D, 1.0, G, N, V, L); + var incoming: vec3 = light.color * (1.0 / (dist * dist)); + var angle: f32 = mdot(L, N); + angle = pow(angle, 1.5); // Smoothing factor makes it less accurate, but reduces ugly "seams" between light sources + + var specular: vec3 = brdf * incoming * angle; + var diffuse: vec3 = incoming * fujiiOrenNayar(mat.base, mat.roughness, N, L, V); + // Stores the specular and diffuse separately to allow for finer post processing + // Could also be done (propably more properly) with a struct + var out = PBRData(diffuse, specular); + + return out; // Returns angle along with color of light so the final color can be multiplied by angle as well (creates black areas) +} + +// For a reason unknown to me, spheres dont seem to behave propperly with head-on spot lights +fn calcSpotLight(N: vec3, V: vec3, fragPos: vec3, mat: Material, light: SpotLight) -> PBRData { + var L: vec3 = normalize(light.position - fragPos); + var H: vec3 = normalize(L + V); // Halfway Vector + var dist = distance(light.position, fragPos); + + var alpha = mat.roughness * mat.roughness; + var k: f32 = alpha * alpha / 2.0; // could also be pow(alpha + 1.0, 2) / 8 + + var D: f32 = trGGX(N, H, alpha); // Distribution + // var F: f32 = schlickFresnelIOR(V, N, ior, k); // Fresnel + var G: f32 = smithSurfaceRoughness(N, V, L, k); // Geometry + + var brdf: f32 = cookTorrance(D, 1.0, G, N, V, L); + + var theta: f32 = mdot(normalize(light.direction), L); + var epsilon: f32 = light.cones.x - light.cones.y; + var intensity: f32 = (theta - light.cones.y) / epsilon; + intensity = clamp(intensity, 0.0, 1.0); + intensity /= dist * dist; + + var incoming: vec3 = light.color * intensity; + + var angle: f32 = mdot(L, N); + angle = pow(angle, 1.5); // Smoothing factor makes it less accurate, but reduces ugly "seams" between light sources + + var specular: vec3 = brdf * incoming * angle; + var diffuse: vec3 = incoming * fujiiOrenNayar(mat.base, mat.roughness, N, L, V); + + // Stores the specular and diffuse separately to allow for finer post processing + // Could also be done (propably more properly) with a struct + var out = PBRData(diffuse, specular); + + return out; // Returns angle along with color of light so the final color can be multiplied by angle as well (creates black areas) +} + +// Environment mapping stuff +// Takes in a vector and converts it to an equivalent coordinate in a rectilinear texture. Should be replaced with cubemaps at some point +fn vecToRectCoord(dir: vec3) -> vec2 { + var tau: f32 = 6.28318530718; + var out: vec2 = vec2(0.0); + + out.x = atan2(dir.z, dir.x) / tau; + out.x += 0.5; + + var phix: f32 = length(vec2(dir.x, dir.z)); + out.y = atan2(dir.y, phix) / pi + 0.5; + + return out; +} + +//VTK::Renderer::Dec + +//VTK::Color::Dec + +//VTK::TCoord::Dec + +// optional surface normal declaration +//VTK::Normal::Dec + +//VTK::Select::Dec + +//VTK::RenderEncoder::Dec + +//VTK::Mapper::Dec + +//VTK::IOStructs::Dec + +@fragment +fn main( +//VTK::IOStructs::Input +) +//VTK::IOStructs::Output +{ + var output : fragmentOutput; + + // Temporary ambient, diffuse, and opacity + var ambientColor: vec4 = mapperUBO.AmbientColor; + var diffuseColor: vec4 = mapperUBO.DiffuseColor; + var ambientIntensity: f32 = mapperUBO.AmbientIntensity; + var diffuseIntensity: f32 = mapperUBO.DiffuseIntensity; + var specularColor: vec4 = mapperUBO.SpecularColor; + var specularIntensity: f32 = mapperUBO.SpecularIntensity; + var opacity: f32 = mapperUBO.Opacity; + var ior: f32 = mapperUBO.BaseIOR; + var normalStrengthUniform: f32 = mapperUBO.NormalStrength; + var roughnessUniform: f32 = mapperUBO.Roughness; + var metallicUniform: f32 = mapperUBO.Metallic; + var emissionUniform: f32 = mapperUBO.Emission; + + if (!input.frontFacing) { + ambientColor = mapperUBO.AmbientColorBF; + diffuseColor = mapperUBO.DiffuseColorBF; + ambientIntensity = mapperUBO.AmbientIntensityBF; + diffuseIntensity = mapperUBO.DiffuseIntensityBF; + specularColor = mapperUBO.SpecularColorBF; + specularIntensity = mapperUBO.SpecularIntensityBF; + opacity = mapperUBO.OpacityBF; + ior = mapperUBO.BaseIORBF; + normalStrengthUniform = mapperUBO.NormalStrengthBF; + roughnessUniform = mapperUBO.RoughnessBF; + metallicUniform = mapperUBO.MetallicBF; + emissionUniform = mapperUBO.EmissionBF; + } + + // This should be declared somewhere else + var _diffuseMap: vec4 = vec4(1.0); + var _roughnessMap: vec4 = vec4(1.0); + var _metallicMap: vec4 = vec4(1.0); + var _normalMap: vec4 = vec4(0.0, 0.0, 1.0, 0.0); // normal map was setting off the normal vector detection in fragment + var _ambientOcclusionMap: vec4 = vec4(1.); + var _emissionMap: vec4 = vec4(0.); + + //VTK::Color::Impl + + //VTK::TCoord::Impl + + //VTK::Normal::Impl + + var computedColor: vec4 = vec4(diffuseColor.rgb, 1.0); + + //VTK::Light::Impl + + //VTK::Select::Impl + + // Use texture alpha for transparency + computedColor.a = opacity * _diffuseMap.a; + if (computedColor.a == 0.0) { discard; }; + + //VTK::Position::Impl + + //VTK::RenderEncoder::Impl + + return output; +} +`,t5=new Float64Array(16);function t3(e){return e.indexOf("edge")>=0}var t9={depthOnlyPass:!1,selectionPass:!1,is2D:!1,cellArray:null,currentInput:null,cellOffset:0,primitiveType:0,colorTexture:null,renderEncoder:null,textures:null};function t4(e,t,r={}){Object.assign(t,t9,r),tz.Ay.extend(e,t,r),t.fragmentShaderTemplate=t2,t.vertexShaderTemplate=t1,t._tmpMat3=t$.identity(new Float64Array(9)),t.UBO=tH.Ay.newInstance({label:"mapperUBO"}),t.UBO.addEntry("BCWCMatrix","mat4x4"),t.UBO.addEntry("BCSCMatrix","mat4x4"),t.UBO.addEntry("MCWCNormals","mat4x4"),t.UBO.addEntry("AmbientColor","vec4"),t.UBO.addEntry("AmbientColorBF","vec4"),t.UBO.addEntry("DiffuseColor","vec4"),t.UBO.addEntry("DiffuseColorBF","vec4"),t.UBO.addEntry("EdgeColor","vec4"),t.UBO.addEntry("SpecularColor","vec4"),t.UBO.addEntry("SpecularColorBF","vec4"),t.UBO.addEntry("AmbientIntensity","f32"),t.UBO.addEntry("AmbientIntensityBF","f32"),t.UBO.addEntry("DiffuseIntensity","f32"),t.UBO.addEntry("DiffuseIntensityBF","f32"),t.UBO.addEntry("Roughness","f32"),t.UBO.addEntry("RoughnessBF","f32"),t.UBO.addEntry("Metallic","f32"),t.UBO.addEntry("MetallicBF","f32"),t.UBO.addEntry("Ambient","f32"),t.UBO.addEntry("Normal","f32"),t.UBO.addEntry("Emission","f32"),t.UBO.addEntry("EmissionBF","f32"),t.UBO.addEntry("NormalStrength","f32"),t.UBO.addEntry("NormalStrengthBF","f32"),t.UBO.addEntry("BaseIOR","f32"),t.UBO.addEntry("BaseIORBF","f32"),t.UBO.addEntry("SpecularIntensity","f32"),t.UBO.addEntry("SpecularIntensityBF","f32"),t.UBO.addEntry("LineWidth","f32"),t.UBO.addEntry("Opacity","f32"),t.UBO.addEntry("OpacityBF","f32"),t.UBO.addEntry("ZValue","f32"),t.UBO.addEntry("CoincidentFactor","f32"),t.UBO.addEntry("CoincidentOffset","f32"),t.UBO.addEntry("PropID","u32"),t.UBO.addEntry("ClipNear","f32"),t.UBO.addEntry("ClipFar","f32"),t.UBO.addEntry("Time","u32"),(0,tj.G_)(t.UBO,"ClipPlane"),t.UBO.addEntry("NumClipPlanes","u32"),(0,l.V0)(e,t,["cellArray","currentInput","cellOffset","is2D","primitiveType","renderEncoder"]),t.textures=[],t.clipPlanes=Array.from({length:6},()=>[0,0,0,0]),t.classHierarchy.push("vtkWebGPUCellArrayMapper"),e.buildPass=r=>{r&&(t.is2D?(t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor2D"),t.forceZValue=!0):(t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor"),t.forceZValue=!1),t.coordinateSystem=t.WebGPUActor.getRenderable().getCoordinateSystem(),t.useRendererMatrix=t.coordinateSystem!==tQ.DISPLAY,t.WebGPURenderer=t.WebGPUActor.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice())},e.isEdgePrimitive=()=>t.primitiveType===tY.TriangleEdges||t.primitiveType===tY.TriangleStripEdges,e.shouldSkipPass=()=>e.isEdgePrimitive()&&(t.depthOnlyPass||t.selectionPass),e.renderForPass=(r,n=!1)=>{if(t.depthOnlyPass=n,t.selectionPass=r?.getPipelineHash?.()==="sel",e.shouldSkipPass()){t.depthOnlyPass=!1,t.selectionPass=!1;return}e.prepareToDraw(r),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw),t.depthOnlyPass=!1,t.selectionPass=!1},e.translucentPass=r=>{r&&e.renderForPass(t.WebGPURenderer.getRenderEncoder())},e.opaquePass=r=>{r&&e.renderForPass(t.WebGPURenderer.getRenderEncoder())},e.zBufferPass=r=>{r&&e.renderForPass(t.WebGPURenderer.getRenderEncoder(),!0)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.updateUBO=()=>{let r=t.WebGPUActor.getRenderable(),n=r.getProperty(),i=t.renderable.getClippingPlanesMTime(),a=r.getBackfaceProperty?.()??n,o=t.WebGPURenderer?.getSelector?.(),s=t.UBO.getSendTime();if(!o&&e.getMTime()<=s&&n.getMTime()<=s&&a.getMTime()<=s&&t.renderable.getMTime()<=s&&i<=s)return;let l=t.WebGPUActor.getKeyMatrices(t.WebGPURenderer);if(t.UBO.setArray("BCWCMatrix",l.bcwc),t.UBO.setArray("BCSCMatrix",l.bcsc),t.UBO.setArray("MCWCNormals",l.normalMatrix),t.is2D){let e=n.getDisplayLocation?.()??t0.BACKGROUND;t.UBO.setValue("ZValue",+(e===t0.FOREGROUND));let r=n.getColorByReference();t.UBO.setValue("AmbientIntensity",1),t.UBO.setArray("AmbientColor",[...r,1]),t.UBO.setArray("DiffuseColor",[...r,1]),t.UBO.setValue("DiffuseIntensity",0),t.UBO.setArray("SpecularColor",[1,1,1,1]),t.UBO.setValue("SpecularIntensity",0),t.UBO.setValue("Roughness",1),t.UBO.setValue("BaseIOR",1.45),t.UBO.setValue("Metallic",0),t.UBO.setValue("Emission",1),t.UBO.setValue("NormalStrength",1),t.UBO.setValue("AmbientIntensityBF",1),t.UBO.setArray("AmbientColorBF",[...r,1]),t.UBO.setValue("DiffuseIntensityBF",0),t.UBO.setArray("DiffuseColorBF",[...r,1]),t.UBO.setArray("SpecularColorBF",[1,1,1,1]),t.UBO.setValue("SpecularIntensityBF",0),t.UBO.setValue("RoughnessBF",1),t.UBO.setValue("BaseIORBF",1.45),t.UBO.setValue("MetallicBF",0),t.UBO.setValue("EmissionBF",1),t.UBO.setValue("NormalStrengthBF",1),t.UBO.setValue("OpacityBF",n.getOpacity())}else t.UBO.setValue("AmbientIntensity",n.getAmbient()),t.UBO.setArray("AmbientColor",[...n.getAmbientColorByReference(),1]),t.UBO.setValue("DiffuseIntensity",n.getDiffuse()),t.UBO.setArray("DiffuseColor",[...n.getDiffuseColorByReference(),1]),t.UBO.setValue("Roughness",n.getRoughness()),t.UBO.setValue("BaseIOR",n.getBaseIOR()),t.UBO.setValue("Metallic",n.getMetallic()),t.UBO.setValue("NormalStrength",n.getNormalStrength()),t.UBO.setValue("Emission",n.getEmission()),t.UBO.setValue("SpecularIntensity",n.getSpecular()),t.UBO.setArray("SpecularColor",[...n.getSpecularColorByReference(),1]),t.UBO.setValue("AmbientIntensityBF",a.getAmbient()),t.UBO.setArray("AmbientColorBF",[...a.getAmbientColorByReference(),1]),t.UBO.setValue("DiffuseIntensityBF",a.getDiffuse()),t.UBO.setArray("DiffuseColorBF",[...a.getDiffuseColorByReference(),1]),t.UBO.setValue("RoughnessBF",a.getRoughness()),t.UBO.setValue("BaseIORBF",a.getBaseIOR()),t.UBO.setValue("MetallicBF",a.getMetallic()),t.UBO.setValue("EmissionBF",a.getEmission()),t.UBO.setValue("NormalStrengthBF",a.getNormalStrength()),t.UBO.setValue("SpecularIntensityBF",a.getSpecular()),t.UBO.setArray("SpecularColorBF",[...a.getSpecularColorByReference(),1]),t.UBO.setValue("OpacityBF",a.getOpacity());let u=n.getEdgeColorByReference?.();u&&t.UBO.setArray("EdgeColor",[...u,1]),t.UBO.setValue("LineWidth",n.getLineWidth());let c=t.primitiveType===tY.TriangleEdges||t.primitiveType===tY.TriangleStripEdges||n.getRepresentation()===tZ.WIREFRAME;t.UBO.setValue("Opacity",c?n.getEdgeOpacity():n.getOpacity());let d=t.WebGPUActor.getPropID();t.UBO.setValue("PropID",o?.getPropIDForSelection?o.getPropIDForSelection(d,r)+1:d);let p=e.getCoincidentParameters();if(t.UBO.setValue("CoincidentFactor",p.factor),t.UBO.setValue("CoincidentOffset",p.offset),t.UBO.setValue("NumClipPlanes",0),!t.is2D&&t.useRendererMatrix){let e=t.WebGPURenderer.getStabilizedCenterByReference();v.fromTranslation(t5,[-e[0],-e[1],-e[2]]);let r=(0,tj.Z6)(t.renderable,t5,t.clipPlanes);if(t.UBO.setValue("NumClipPlanes",r),r>0)for(let e=0;e{let e=t.WebGPUActor.getRenderable(),r=e.getProperty().getRepresentation();return!(1>=e.getProperty().getLineWidth())&&t.primitiveType!==tY.Verts&&(t.primitiveType!==tY.Triangles&&t.primitiveType!==tY.TriangleStrips||r===tZ.WIREFRAME)},e.getCullMode=()=>{let e=t.WebGPUActor.getRenderable().getProperty();return e.getFrontfaceCulling()?"front":e.getBackfaceCulling()?"back":"none"},e.getPipelineSettings=()=>({primitive:{cullMode:e.getCullMode()},...t.depthOnlyPass?{fragment:{targets:[{format:"rgba16float",writeMask:0}]}}:{}}),e.getCoincidentParameters=()=>{let e={factor:0,offset:0},r=t.WebGPUActor?.getRenderable()?.getProperty?.();if(!r)return e;if(t.renderable.getResolveCoincidentTopology()==tK.PolygonOffset||r.getEdgeVisibility()&&r.getRepresentation()===tZ.SURFACE){let n=t.primitiveType;n===tY.Verts||r.getRepresentation()===tZ.POINTS?e=t.renderable.getCoincidentTopologyPointOffsetParameter():n===tY.Lines||r.getRepresentation()===tZ.WIREFRAME?e=t.renderable.getCoincidentTopologyLineOffsetParameters():(n===tY.Triangles||n===tY.TriangleStrips)&&(e=t.renderable.getCoincidentTopologyPolygonOffsetParameters()),(n===tY.TriangleEdges||n===tY.TriangleStripEdges)&&(e=t.renderable.getCoincidentTopologyPolygonOffsetParameters(),e.factor/=2,e.offset/=2)}let n=t.WebGPURenderer?.getSelector?.();return n&&n.getFieldAssociation()===tq.FIELD_ASSOCIATION_POINTS&&(e.offset-=2),e},e.replaceShaderPosition=(r,n,i)=>{let a=n.getShaderDescription("vertex");a.addBuiltinOutput("vec4","@builtin(position) Position"),a.hasOutput("vertexVC")||a.addOutput("vec4","vertexVC"),a.hasOutput("vertexSC")||a.addOutput("vec4","vertexSC");let o=a.getCode();t.useRendererMatrix?(o=tG.Ay.substitute(o,"//VTK::Position::Impl",[" output.vertexSC = mapperUBO.BCSCMatrix * vec4(vertexBC.xyz, 1.0);"," var pCoord: vec4 = rendererUBO.SCPCMatrix*mapperUBO.BCSCMatrix*vertexBC;"," output.vertexVC = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4(vertexBC.xyz, 1.0);","//VTK::Position::Impl"]).result,t.forceZValue&&(o=tG.Ay.substitute(o,"//VTK::Position::Impl",["pCoord = vec4(pCoord.xyz/pCoord.w, 1.0);","pCoord.z = mapperUBO.ZValue;","//VTK::Position::Impl"]).result)):(o=tG.Ay.substitute(o,"//VTK::Position::Impl",[" var pCoord: vec4 = mapperUBO.BCSCMatrix*vertexBC;"," pCoord.x = 2.0* pCoord.x / rendererUBO.viewportSize.x - 1.0;"," pCoord.y = 2.0* pCoord.y / rendererUBO.viewportSize.y - 1.0;"," pCoord.z = 0.5 - 0.5 * pCoord.z;","//VTK::Position::Impl"]).result,t.forceZValue&&(o=tG.Ay.substitute(o,"//VTK::Position::Impl",[" pCoord.z = mapperUBO.ZValue;","//VTK::Position::Impl"]).result)),e.haveWideLines()&&(a.addBuiltinInput("u32","@builtin(instance_index) instanceIndex"),o=tG.Ay.substitute(o,"//VTK::Position::Impl",[" var tmpPos: vec4 = pCoord;"," var numSteps: f32 = ceil(mapperUBO.LineWidth - 1.0);"," var offset: f32 = (mapperUBO.LineWidth - 1.0) * (f32(input.instanceIndex / 2u) - numSteps/2.0) / numSteps;"," var tmpPos2: vec3 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * (f32(input.instanceIndex) % 2.0) * offset / rendererUBO.viewportSize.x;"," tmpPos2.y = tmpPos2.y + 2.0 * (f32(input.instanceIndex + 1u) % 2.0) * offset / rendererUBO.viewportSize.y;"," tmpPos2.z = min(1.0, tmpPos2.z + 0.00001);"," pCoord = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);","//VTK::Position::Impl"]).result),o=tG.Ay.substitute(o,"//VTK::Position::Impl",[" pCoord.z = clamp(pCoord.z - 0.000016 * mapperUBO.CoincidentOffset * pCoord.w, 0.0, pCoord.w);"," output.Position = pCoord;"]).result,a.setCode(o);let s=n.getShaderDescription("fragment");o=s.getCode();let l=(0,tj.JE)({countName:"mapperUBO.NumClipPlanes",planePrefix:"mapperUBO.ClipPlane",positionName:"input.vertexSC"});o=tG.Ay.substitute(o,"//VTK::Position::Impl",[...l,"//VTK::Position::Impl"]).result,s.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderCoincidentOffset=(e,t,r)=>{let n=t.getShaderDescription("fragment");if(!n)return;n.addBuiltinInput("vec4","@builtin(position) fragPos"),n.addBuiltinOutput("f32","@builtin(frag_depth) fragDepth");let i=n.getCode();i=tG.Ay.substitute(i,"//VTK::Position::Impl",[" var coincidentDepth: f32 = input.fragPos.z;"," if (mapperUBO.CoincidentFactor != 0.0) {"," let cscale = length(vec2(dpdx(input.fragPos.z), dpdy(input.fragPos.z)));"," coincidentDepth = coincidentDepth - mapperUBO.CoincidentFactor * cscale;"," }"," output.fragDepth = clamp(coincidentDepth, 0.0, 1.0);"]).result,n.setCode(i)},t.shaderReplacements.set("replaceShaderCoincidentOffset",e.replaceShaderCoincidentOffset),e.replaceShaderNormal=(e,r,n)=>{let i=n.getBuffer("normalMC"),a=t.WebGPUActor.getRenderable();if(i){let e=r.getShaderDescription("vertex");e.hasOutput("normalVC")||e.addOutput("vec3","normalVC",i.getArrayInformation()[0].interpolation),e.hasOutput("tangentVC")||e.addOutput("vec3","tangentVC",i.getArrayInformation()[0].interpolation),e.hasOutput("bitangentVC")||e.addOutput("vec3","bitangentVC",i.getArrayInformation()[0].interpolation);let t=e.getCode();t=tG.Ay.substitute(t,"//VTK::Normal::Impl",[" output.normalVC = normalize((rendererUBO.WCVCNormals * mapperUBO.MCWCNormals * normalMC).xyz);"," var c1: vec3 = cross(output.normalVC, vec3(0, 0, 1));"," var c2: vec3 = cross(output.normalVC, vec3(0, 1, 0));"," var tangent: vec3 = mix(c1, c2, distance(c1, c2));"," output.tangentVC = normalize(tangent);"," output.bitangentVC = normalize(cross(output.normalVC, tangent));"]).result,e.setCode(t);let n=r.getShaderDescription("fragment");t=n.getCode(),t=a.getProperty().getNormalTexture()?tG.Ay.substitute(t,"//VTK::Normal::Impl",[" var normal: vec3 = input.normalVC;"," if (!input.frontFacing) { normal = -normal; }"," var tangent: vec3 = input.tangentVC;"," var bitangent: vec3 = input.bitangentVC;"," var TCVCMatrix: mat3x3 = mat3x3("," tangent.x, bitangent.x, normal.x,"," tangent.y, bitangent.y, normal.y,"," tangent.z, bitangent.z, normal.z,"," );"," var mappedNormal: vec3 = TCVCMatrix * (_normalMap.xyz * 2 - 1);"," normal = mix(normal, mappedNormal, normalStrengthUniform);"," normal = normalize(normal);"]).result:tG.Ay.substitute(t,"//VTK::Normal::Impl",[" var normal: vec3 = input.normalVC;"," if (!input.frontFacing) { normal = -normal; }"," normal = normalize(normal);"]).result,n.setCode(t)}},t.shaderReplacements.set("replaceShaderNormal",e.replaceShaderNormal),e.replaceShaderLight=(e,r,n)=>{if(e.includes("sel"))return;let i=r.getShaderDescription("vertex");i.hasOutput("vertexVC")||i.addOutput("vec4","vertexVC");let a=t.WebGPURenderer.getRenderable(),o=r.getShaderDescription("fragment"),s=o.getCode();if(!s.includes("var normal:")||!t.useRendererMatrix||t3(e)||t.is2D||e.includes("sel"))s=tG.Ay.substitute(s,"//VTK::Light::Impl",[" let diffuse = diffuseColor.rgb;"," let specular = specularColor.rgb * specularColor.a;"," computedColor = vec4(diffuse * _diffuseMap.rgb, opacity);"]).result,o.setCode(s);else{let e=[" let fragPos = vec3(input.vertexVC.xyz);"," let V = mix(normalize(-fragPos), vec3(0, 0, 1), f32(rendererUBO.cameraParallel)); // View Vector"," let baseColor = _diffuseMap.rgb * diffuseColor.rgb;"," let roughness = max(0.000001, roughnessUniform * _roughnessMap.r);"," let metallic = metallicUniform * _metallicMap.r;"," let alpha = roughness * roughness;"," let k = alpha * alpha / 2.0;"," var diffuse = vec3(0.);"," var specular = vec3(0.);"," let emission = _emissionMap.rgb * emissionUniform;",""," // Material struct"," let mat = Material(ior, roughness, metallic, baseColor);",""," {"," var i = 0;"," loop {"," if (!(i < rendererUBO.LightCount)) { break; }"," switch (i32(rendererLightSSBO.values[i].LightData.x)) {"," // Point Light"," case 0 {"," let color = rendererLightSSBO.values[i].LightColor.rgb * rendererLightSSBO.values[i].LightColor.w;"," let pos = (rendererLightSSBO.values[i].LightPos).xyz;"," let pointLight = PointLight(pos, color);"," let result = calcPointLight(normal, V, fragPos, mat, pointLight);"," diffuse += max(vec3(0), result.diffuse);"," specular += max(vec3(0), result.specular);"," }"," // Directional light"," case 1 {"," let dir = normalize((rendererUBO.WCVCNormals * vec4(normalize(rendererLightSSBO.values[i].LightDir.xyz), 0.)).xyz);"," let color = rendererLightSSBO.values[i].LightColor.rgb * rendererLightSSBO.values[i].LightColor.w;"," let dirLight = DirectionalLight(dir, color);"," let result = calcDirectionalLight(normal, V, mat, dirLight); // diffuseColor.rgb needs to be fixed with a more dynamic diffuse color"," diffuse += max(vec3(0), result.diffuse);"," specular += max(vec3(0), result.specular);"," }"," // Spot Light"," case 2 {"," let color = rendererLightSSBO.values[i].LightColor.rgb * rendererLightSSBO.values[i].LightColor.w;"," let pos = (rendererLightSSBO.values[i].LightPos).xyz;"," let dir = normalize((rendererUBO.WCVCNormals * vec4(normalize(rendererLightSSBO.values[i].LightDir.xyz), 0.)).xyz);"," let cones = vec2(rendererLightSSBO.values[i].LightData.y, rendererLightSSBO.values[i].LightData.z);"," let spotLight = SpotLight(pos, dir, cones, color);"," let result = calcSpotLight(normal, V, fragPos, mat, spotLight);"," diffuse += max(vec3(0), result.diffuse);"," specular += max(vec3(0), result.specular);"," }"," default { continue; }"," }"," continuing { i++; }"," }"," }"," let fresnel = min(1.0, schlickFresnelIOR(V, normal, ior, k)); // Fresnel"," // This could be controlled with its own variable (that isnt base color) for better artistic control"," let fresnelMetallic = schlickFresnelRGB(V, normal, baseColor); // Fresnel for metal, takes color into account"," let kS = min(vec3(1.0), mix(vec3(fresnel), fresnelMetallic, metallic));"," let kD = (1.0 - kS) * (1.0 - metallic);"," let specularMaterial = specularColor.rgb * specularColor.a;"," let PBR = diffuseIntensity * kD * diffuse + kS * specularIntensity * specular * specularMaterial;"," computedColor = vec4(PBR + emission, opacity);"];a.getEnvironmentTexture()?.getImageLoaded()&&e.push(" // To get diffuse IBL, the texture is sampled with normals in worldspace"," let diffuseIBLCoords = (transpose(rendererUBO.WCVCNormals) * vec4(normal, 1.)).xyz;"," let diffuseCoords = vecToRectCoord(diffuseIBLCoords);"," // To get specular IBL, the texture is sampled as the worldspace reflection between the normal and view vectors"," // Reflections are first calculated in viewspace, then converted to worldspace to sample the environment"," let VreflN = normalize(reflect(-V, normal));"," let reflectionIBLCoords = (transpose(rendererUBO.WCVCNormals) * vec4(VreflN, 1.)).xyz;"," let specularCoords = vecToRectCoord(reflectionIBLCoords);"," let diffuseIBL = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, diffuseCoords, rendererUBO.MaxEnvironmentMipLevel);"," let level = roughness * rendererUBO.MaxEnvironmentMipLevel;"," let specularIBL = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, specularCoords, level);"," let specularIBLContribution = specularIBL.rgb * rendererUBO.BackgroundSpecularStrength;"," computedColor += vec4(specularIBLContribution * kS, 0);"," let diffuseIBLContribution = diffuseIBL.rgb * rendererUBO.BackgroundDiffuseStrength;"," computedColor += vec4(diffuseIBLContribution * baseColor * _ambientOcclusionMap.rgb * kD, 0);"),s=tG.Ay.substitute(s,"//VTK::Light::Impl",e).result,o.setCode(s)}},t.shaderReplacements.set("replaceShaderLight",e.replaceShaderLight),e.replaceShaderColor=(e,r,n)=>{if(t3(e)){let e=r.getShaderDescription("fragment"),t=e.getCode();t=tG.Ay.substitute(t,"//VTK::Color::Impl",["ambientColor = mapperUBO.EdgeColor;","diffuseColor = mapperUBO.EdgeColor;"]).result,e.setCode(t);return}if((t.renderable.getAreScalarsMappedFromCells()||t.renderable.getInterpolateScalarsBeforeMapping?.())&&t.renderable.getColorCoordinates()&&n.hasAttribute("tcoord")&&t.colorTexture){let e=r.getShaderDescription("fragment"),t=e.getCode();t=tG.Ay.substitute(t,"//VTK::Color::Impl",["var texColor = textureSample(DiffuseTexture, DiffuseTextureSampler, input.tcoordVS);","diffuseColor = vec4(texColor.rgb, 1.0);","ambientColor = vec4(texColor.rgb, 1.0);","opacity = opacity * texColor.a;"]).result,e.setCode(t);return}let i=n.getBuffer("colorVI");if(!i)return;let a=r.getShaderDescription("vertex");a.addOutput("vec4","color",i.getArrayInformation()[0].interpolation);let o=a.getCode();o=tG.Ay.substitute(o,"//VTK::Color::Impl",[" output.color = colorVI;"]).result,a.setCode(o);let s=r.getShaderDescription("fragment");o=s.getCode(),o=tG.Ay.substitute(o,"//VTK::Color::Impl",["ambientColor = input.color;","diffuseColor = input.color;","opacity = opacity * input.color.a;"]).result,s.setCode(o)},t.shaderReplacements.set("replaceShaderColor",e.replaceShaderColor),e.replaceShaderTCoord=(e,r,n)=>{if(!n.hasAttribute("tcoord"))return;let i=r.getShaderDescription("vertex"),a=n.getBuffer("tcoord").getArrayInformation()[0],o=tW.A.getNumberOfComponentsFromBufferFormat(a.format),s=a.interpolation,l=i.getCode();i.addOutput(`vec${o}`,"tcoordVS",s),l=tG.Ay.substitute(l,"//VTK::TCoord::Impl",[" output.tcoordVS = tcoord;"]).result,i.setCode(l);let u=r.getShaderDescription("fragment");l=u.getCode();let c=t.WebGPUActor.getRenderable(),d=c.getProperty(),p=e=>!!e&&e.getDimensionality()===o,m=[],h=d.getDiffuseTexture?.();(h?.getImageLoaded()||c.getTextures()[0]||t.colorTexture)&&(p(h)||p(c.getTextures()[0])||p(t.colorTexture))&&m.push("_diffuseMap = textureSample(DiffuseTexture, DiffuseTextureSampler, input.tcoordVS);");let f=d.getORMTexture?.(),g=d.getRMTexture?.(),v=d.getRoughnessTexture?.(),y=d.getMetallicTexture?.(),b=d.getAmbientOcclusionTexture?.(),I=d.getEmissionTexture?.(),x=d.getNormalTexture?.();f?.getImageLoaded()?p(f)&&m.push("let ormSample = textureSample(ORMTexture, ORMTextureSampler, input.tcoordVS);","_ambientOcclusionMap = ormSample.rrra;","_roughnessMap = ormSample.ggga;","_metallicMap = ormSample.bbba;"):g?.getImageLoaded()?p(g)&&m.push("let rmSample = textureSample(RMTexture, RMTextureSampler, input.tcoordVS);","_roughnessMap = rmSample.ggga;","_metallicMap = rmSample.bbba;"):(v?.getImageLoaded()&&p(v)&&m.push("_roughnessMap = textureSample(RoughnessTexture, RoughnessTextureSampler, input.tcoordVS).ggga;"),y?.getImageLoaded()&&p(y)&&m.push("_metallicMap = textureSample(MetallicTexture, MetallicTextureSampler, input.tcoordVS).bbba;"),b?.getImageLoaded()&&p(b)&&m.push("_ambientOcclusionMap = textureSample(AmbientOcclusionTexture, AmbientOcclusionTextureSampler, input.tcoordVS).rrra;")),I?.getImageLoaded()&&p(I)&&m.push("_emissionMap = textureSample(EmissionTexture, EmissionTextureSampler, input.tcoordVS);"),x?.getImageLoaded()&&p(x)&&m.push("_normalMap = textureSample(NormalTexture, NormalTextureSampler, input.tcoordVS);"),l=tG.Ay.substitute(l,"//VTK::TCoord::Impl",m).result,u.setCode(l)},t.shaderReplacements.set("replaceShaderTCoord",e.replaceShaderTCoord),e.replaceShaderSelect=(e,t,r)=>{if(e.includes("sel")){let e=r.getBuffer("selectId");if(e){let r=t.getShaderDescription("vertex");r.addOutput("u32","attributeID",e.getArrayInformation()[0].interpolation),r.addOutput("u32","compositeID",e.getArrayInformation()[0].interpolation);let n=r.getCode();n=tG.Ay.substitute(n,"//VTK::Select::Impl",[" output.compositeID = 1u;"," output.attributeID = selectId + 1u;"]).result,r.setCode(n)}let n=t.getShaderDescription("fragment"),i=n.getCode(),a=e?[" var compositeID: u32 = input.compositeID;"," var attributeID: u32 = input.attributeID;"]:[" var compositeID: u32 = 0u;"," var attributeID: u32 = 0u;"];i=tG.Ay.substitute(i,"//VTK::Select::Impl",a).result,n.setCode(i)}},t.shaderReplacements.set("replaceShaderSelect",e.replaceShaderSelect),e.getUsage=(e,t)=>e===tZ.POINTS||t===tY.Points?tX.Verts:t===tY.Lines?tX.Lines:e===tZ.WIREFRAME?t===tY.Triangles?tX.LinesFromTriangles:tX.LinesFromStrips:t===tY.Triangles?tX.Triangles:t===tY.TriangleStrips?tX.Strips:t===tY.TriangleEdges?tX.LinesFromTriangles:tX.LinesFromStrips,e.getHashFromUsage=e=>`pt${e}`,e.getTopologyFromUsage=e=>{switch(e){case tX.Triangles:return"triangle-list";case tX.Verts:return"point-list";case tX.Lines:default:return"line-list"}},e.buildVertexInput=()=>{let r=t.currentInput,n=t.cellArray,i=t.primitiveType,a=t.WebGPUActor.getRenderable().getProperty().getRepresentation(),o=t.WebGPURenderWindow.getDevice(),s=!1;i===tY.TriangleEdges&&(s=!0,a=tZ.WIREFRAME);let l=t.vertexInput,u=r.getPoints(),c=null;if(n?(c=o.getBufferManager().getBuffer({hash:`R${a}P${i}O${t.cellOffset}${n.getMTime()}`,usage:tX.Index,cells:n,numberOfPoints:u.getNumberOfPoints(),primitiveType:i,representation:a,cellOffset:t.cellOffset}),l.setIndexBuffer(c)):l.setIndexBuffer(null),u){let e=t.WebGPUActor.getBufferShift(t.WebGPURenderer);l.addBuffer(o.getBufferManager().getBuffer({hash:`${u.getMTime()}I${c?.getMTime?.()??0}${e.join()}float32x4`,usage:tX.PointArray,format:"float32x4",dataArray:u,indexBuffer:c,shift:e,packExtra:!0}),["vertexBC"])}else l.removeBufferIfPresent("vertexBC");let d=e.getUsage(a,i);t._usesCellNormals=!1;let p=a===tZ.WIREFRAME&&(i===tY.Triangles||i===tY.TriangleStrips);if(!t.is2D&&(d===tX.Triangles||d===tX.Strips||p)){let e=r.getPointData().getNormals(),a={format:"snorm8x4",indexBuffer:c,packExtra:!0,shift:0,scale:127};e?(a.hash=`${e.getMTime()}I${c.getMTime()}snorm8x4`,a.dataArray=e,a.usage=tX.PointArray,l.addBuffer(o.getBufferManager().getBuffer(a),["normalMC"])):i===tY.Triangles?(t._usesCellNormals=!0,a.hash=`PFN${u.getMTime()}I${c.getMTime()}snorm8x4`,a.dataArray=u,a.cells=n,a.usage=tX.NormalsFromPoints,a.cellOffset=t.cellOffset,l.addBuffer(o.getBufferManager().getBuffer(a),["normalMC"])):l.removeBufferIfPresent("normalMC")}else l.removeBufferIfPresent("normalMC");let m=!1;if(t.renderable.getScalarVisibility()){let e=t.renderable.getColorMapColors();if(e&&!s){let n=t.renderable.getScalarMode(),i=(n===tJ.USE_CELL_DATA||n===tJ.USE_CELL_FIELD_DATA||n===tJ.USE_FIELD_DATA||!r.getPointData().getScalars())&&n!==tJ.USE_POINT_FIELD_DATA&&e;l.addBuffer(o.getBufferManager().getBuffer({usage:tX.PointArray,format:"unorm8x4",hash:`${i}${e.getMTime()}I${c.getMTime()}O${t.cellOffset}unorm8x4`,dataArray:e,indexBuffer:c,cellData:i,cellOffset:t.cellOffset}),["colorVI"]),m=!0}}m||l.removeBufferIfPresent("colorVI");let h=null,f=!1;(t.renderable.getAreScalarsMappedFromCells()||t.renderable.getInterpolateScalarsBeforeMapping?.())&&t.renderable.getColorCoordinates()?(h=t.renderable.getColorCoordinates(),f=t.renderable.getAreScalarsMappedFromCells()):h=r.getPointData().getTCoords(),h&&!s?l.addBuffer(f?o.getBufferManager().getBufferForCellArray(h,l.getIndexBuffer(),t.cellOffset):o.getBufferManager().getBufferForPointArray(h,l.getIndexBuffer()),["tcoord"]):l.removeBufferIfPresent("tcoord");let g=t.WebGPURenderer?.getSelector?.();if(g&&!s&&c){let e=null;g.getFieldAssociation()===tq.FIELD_ASSOCIATION_POINTS?e=c.getFlatIdToPointId():g.getFieldAssociation()===tq.FIELD_ASSOCIATION_CELLS&&(e=c.getFlatIdToCellId()),e?l.addBuffer(o.getBufferManager().getBuffer({hash:`sel${g.getFieldAssociation()}I${c.getMTime()}`,usage:tX.RawVertex,format:"uint32",interpolation:"flat",nativeArray:e instanceof Uint32Array?e:Uint32Array.from(e)}),["selectId"]):l.removeBufferIfPresent("selectId")}else l.removeBufferIfPresent("selectId")},e.updateTextures=()=>{let e=[],r=[],n=t.renderable.getColorTextureMap?.();n&&!t.colorTexture&&(t.colorTexture=f.Ay.newInstance({label:"polyDataColor"})),n&&(t.colorTexture.setInputData(n),r.push(["DiffuseTexture",t.colorTexture]));let i=t.WebGPUActor.getRenderable(),a=t.WebGPURenderer.getRenderable();[["DiffuseTexture",i.getProperty().getDiffuseTexture?.()],["DiffuseTexture",i.getTextures()[0]],["DiffuseTexture",t.colorTexture],["ORMTexture",i.getProperty().getORMTexture?.()],["RMTexture",i.getProperty().getRMTexture?.()],["RoughnessTexture",i.getProperty().getRoughnessTexture?.()],["MetallicTexture",i.getProperty().getMetallicTexture?.()],["NormalTexture",i.getProperty().getNormalTexture?.()],["AmbientOcclusionTexture",i.getProperty().getAmbientOcclusionTexture?.()],["EmissionTexture",i.getProperty().getEmissionTexture?.()],["EnvironmentTexture",a.getEnvironmentTexture?.()]].forEach(([e,t])=>{t&&((t.getInputData()||t.getJsImageData()||t.getCanvas()||t.getImageBitmap())&&r.push([e,t]),t.getImage()&&t.getImageLoaded()&&r.push([e,t]))}),r.forEach(([r,n])=>{let i=t.device.getTextureManager().getTextureForVTKTexture(n,r);if(!i.getReady())return;let a=!1;for(let r=0;r=0;r--)e[r]||(t.textures.splice(r,1),t.textureViews.splice(r,1))},e.computePipelineHash=()=>{let r=`pd${t.useRendererMatrix?"r":""}${t.forceZValue?"z":""}`;if(t.depthOnlyPass&&(r+="d"),t.selectionPass&&(r+="s"),t.primitiveType===tY.TriangleEdges||t.primitiveType===tY.TriangleStripEdges)r+="edge";else{if(t.vertexInput.hasAttribute("normalMC")&&(r+="n"),t.vertexInput.hasAttribute("colorVI")&&(r+="c"),t.vertexInput.hasAttribute("tcoord")){let e=t.vertexInput.getBuffer("tcoord"),n=tW.A.getNumberOfComponentsFromBufferFormat(e.getArrayInformation()[0].format);r+=`t${n}`}t.textures.length&&(r+=`tx${t.textures.length}`)}t._usesCellNormals&&(r+="cn"),t.SSBO&&(r+="ssbo"),r+=e.getHashFromUsage(t.usage),r+=`cm${e.getCullMode()}`,r+=t.renderEncoder.getPipelineHash(),t.pipelineHash=r},e.updateBuffers=()=>{t.primitiveType!==tY.TriangleEdges&&t.primitiveType!==tY.TriangleStripEdges&&e.updateTextures();let r=t.WebGPUActor.getRenderable(),n=r.getProperty().getRepresentation();t.usage=e.getUsage(n,t.primitiveType),e.buildVertexInput();let i=t.vertexInput.getBuffer("vertexBC");if(e.setNumberOfVertices(i.getSizeInBytes()/i.getStrideInBytes()),e.setTopology(e.getTopologyFromUsage(t.usage)),e.updateUBO(),e.haveWideLines()){let t=r.getProperty();e.setNumberOfInstances(Math.ceil(2*t.getLineWidth()))}else e.setNumberOfInstances(1)}}var t8={newInstance:(0,l.UI)(t4,"vtkWebGPUCellArrayMapper"),extend:t4},{PrimitiveTypes:t6}=tR.Ay,t7={primitives:null};function re(e,t,r={}){Object.assign(t,t7,r),eY.A.extend(e,t,r),t.primitives=[],t.classHierarchy.push("vtkWebGPUPolyDataMapper"),e.createCellArrayMapper=()=>t8.newInstance(),e.buildPass=r=>{if(r){t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor"),t.renderable.getStatic()||t.renderable.update();let r=t.renderable.getInputData();t.renderable.mapScalars(r,1),e.updateCellArrayMappers(r)}},e.updateCellArrayMappers=r=>{if(!r)return void(0,l.Bl)("No input!");let n=[r.getVerts(),r.getLines(),r.getPolys(),r.getStrips()],i=[],a=0;for(let o=t6.Points;o<=t6.TriangleStrips;o++)if(n[o].getNumberOfValues()>0){t.primitives[o]||(t.primitives[o]=e.createCellArrayMapper());let s=t.primitives[o];s.setCellArray(n[o]),s.setCurrentInput(r),s.setCellOffset(a),s.setPrimitiveType(o),s.setRenderable(t.renderable),a+=n[o].getNumberOfCells(),i.push(s)}else t.primitives[o]=null;if(t.WebGPUActor.getRenderable().getProperty().getEdgeVisibility()){if(n[t6.Triangles].getNumberOfValues()>0){let a=t6.TriangleEdges;t.primitives[a]||(t.primitives[a]=e.createCellArrayMapper());let o=t.primitives[a];o.setCellArray(n[t6.Triangles]),o.setCurrentInput(r),o.setCellOffset(t.primitives[t6.Triangles].getCellOffset()),o.setPrimitiveType(a),o.setRenderable(t.renderable),i.push(o)}else t.primitives[t6.TriangleEdges]=null;if(n[t6.TriangleStrips].getNumberOfValues()>0){let a=t6.TriangleStripEdges;t.primitives[a]||(t.primitives[a]=e.createCellArrayMapper());let o=t.primitives[a];o.setCellArray(n[t6.TriangleStrips]),o.setCurrentInput(r),o.setCellOffset(t.primitives[t6.TriangleStrips].getCellOffset()),o.setPrimitiveType(a),o.setRenderable(t.renderable),i.push(o)}else t.primitives[t6.TriangleStripEdges]=null}e.prepareNodes(),e.addMissingChildren(i),e.removeUnusedNodes()}}var rt=(0,l.UI)(re,"vtkWebGPUPolyDataMapper"),rr={extend:re};function rn(e,t,r=0){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=r,e}function ri(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=0,e}(0,tA.c9)("vtkMapper",rt);var{vtkErrorMacro:ra}=l.Ay,ro=l.Ay.newInstance(function(e,t,r={}){t8.extend(e,t,r),t.UBO.addEntry("CutPlaneOrigin","vec4"),t.UBO.addEntry("CutPlaneNormal","vec4"),t.UBO.addEntry("CutSphereCenter","vec4"),t.UBO.addEntry("CutSphereRadius","vec4"),t.UBO.addEntry("CutBoxMinPoint","vec4"),t.UBO.addEntry("CutBoxMaxPoint","vec4"),t.UBO.addEntry("CutCylinderCenter","vec4"),t.UBO.addEntry("CutCylinderAxis","vec4"),t.UBO.addEntry("CutConeApex","vec4"),t.UBO.addEntry("CutConeAxis","vec4"),t.UBO.addEntry("CutValue","f32"),t.UBO.addEntry("CutWidth","f32"),t.UBO.addEntry("CutCylinderRadius","f32"),t.UBO.addEntry("CutConeTanThetaSquared","f32"),t.UBO.addEntry("CutSphereUsesAxisRadii","u32"),t.cutPlaneOrigin=[0,0,0,0],t.cutPlaneNormal=[0,0,0,0],t.cutSphereCenter=[0,0,0,0],t.cutSphereRadius=[0,0,0,0],t.cutBoxMinPoint=[0,0,0,0],t.cutBoxMaxPoint=[0,0,0,0],t.cutCylinderCenter=[0,0,0,0],t.cutCylinderAxis=[0,0,0,0],t.cutConeApex=[0,0,0],t.cutConeAxis=[1,0,0],t.cutConeAxisPoint=[1,0,0],t.cutConeApex4=[0,0,0,0],t.cutConeAxis4=[1,0,0,0];t.classHierarchy.push("vtkWebGPUCutterCellArrayMapper"),e.replaceShaderPosition=(r,n,i)=>{let a=t.renderable.getSupportedImplicitFunctionName();if(!a)return void ra("No cut function set.");let o=n.getShaderDescription("vertex");o.addBuiltinOutput("vec4","@builtin(position) Position"),o.hasOutput("vertexVC")||o.addOutput("vec4","vertexVC"),o.addOutput("f32","cutDistanceVS");let s=[];s=t.useRendererMatrix?[" var pCoord: vec4 = rendererUBO.SCPCMatrix*mapperUBO.BCSCMatrix*vertexBC;"," output.vertexVC = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4(vertexBC.xyz, 1.0);"]:[" var pCoord: vec4 = mapperUBO.BCSCMatrix*vertexBC;"," pCoord.x = 2.0* pCoord.x / rendererUBO.viewportSize.x - 1.0;"," pCoord.y = 2.0* pCoord.y / rendererUBO.viewportSize.y - 1.0;"," pCoord.z = 0.5 - 0.5 * pCoord.z;"," output.vertexVC = vec4(0.0);"];let l=[" output.cutDistanceVS = 1.0;"];switch(a){case"vtkPlane":l=[" output.cutDistanceVS = dot(mapperUBO.CutPlaneNormal.xyz, vertexBC.xyz - mapperUBO.CutPlaneOrigin.xyz) - mapperUBO.CutValue;"];break;case"vtkSphere":l=[" let cutSphereDelta: vec3 = vertexBC.xyz - mapperUBO.CutSphereCenter.xyz;"," if (mapperUBO.CutSphereUsesAxisRadii == 1u) {"," let cutSphereNormalizedDelta: vec3 = cutSphereDelta / mapperUBO.CutSphereRadius.xyz;"," output.cutDistanceVS = dot(cutSphereNormalizedDelta, cutSphereNormalizedDelta) - 1.0;"," } else {"," output.cutDistanceVS = dot(cutSphereDelta, cutSphereDelta) - mapperUBO.CutSphereRadius.x * mapperUBO.CutSphereRadius.x;"," }"];break;case"vtkBox":l=[" var cutBoxMinDistance: f32 = -1.0e20;"," var cutBoxDistance: f32 = 0.0;"," var cutBoxInside: bool = true;"," var cutBoxIsDegenerate: bool = false;"," for (var i: i32 = 0; i < 3; i++) {"," let cutBoxLength: f32 = mapperUBO.CutBoxMaxPoint[i] - mapperUBO.CutBoxMinPoint[i];"," var cutBoxDist: f32 = 0.0;"," if (cutBoxLength != 0.0) {"," let cutBoxT: f32 = (vertexBC[i] - mapperUBO.CutBoxMinPoint[i]) / cutBoxLength;"," if (cutBoxT < 0.0) {"," cutBoxInside = false;"," cutBoxDist = mapperUBO.CutBoxMinPoint[i] - vertexBC[i];"," } else if (cutBoxT > 1.0) {"," cutBoxInside = false;"," cutBoxDist = vertexBC[i] - mapperUBO.CutBoxMaxPoint[i];"," } else if (cutBoxT <= 0.5) {"," cutBoxDist = mapperUBO.CutBoxMinPoint[i] - vertexBC[i];"," cutBoxMinDistance = max(cutBoxMinDistance, cutBoxDist);"," } else {"," cutBoxDist = vertexBC[i] - mapperUBO.CutBoxMaxPoint[i];"," cutBoxMinDistance = max(cutBoxMinDistance, cutBoxDist);"," }"," } else {"," // Degenerate axis: box has zero thickness along this dimension"," cutBoxIsDegenerate = true;"," cutBoxDist = abs(vertexBC[i] - mapperUBO.CutBoxMinPoint[i]);"," if (cutBoxDist > 0.0) {"," cutBoxInside = false;"," }"," }"," if (cutBoxDist > 0.0) {"," cutBoxDistance += cutBoxDist * cutBoxDist;"," }"," }"," // Guard against degenerate boxes (zero size on one or more axes)"," let cutDistanceIfInside = select(cutBoxMinDistance, 0.0, cutBoxIsDegenerate);"," output.cutDistanceVS = select(sqrt(cutBoxDistance), cutDistanceIfInside, cutBoxInside);"];break;case"vtkCylinder":l=[" let cutCylinderDelta: vec3 = vertexBC.xyz - mapperUBO.CutCylinderCenter.xyz;"," let cutCylinderAxisLengthSq: f32 = dot(mapperUBO.CutCylinderAxis.xyz, mapperUBO.CutCylinderAxis.xyz);"," let cutCylinderProjection: f32 = dot(mapperUBO.CutCylinderAxis.xyz, cutCylinderDelta);"," let cutCylinderDistWithAxis: f32 = dot(cutCylinderDelta, cutCylinderDelta) - cutCylinderProjection * cutCylinderProjection / cutCylinderAxisLengthSq - mapperUBO.CutCylinderRadius * mapperUBO.CutCylinderRadius;"," let cutCylinderDistWithoutAxis: f32 = dot(cutCylinderDelta, cutCylinderDelta) - mapperUBO.CutCylinderRadius * mapperUBO.CutCylinderRadius;"," output.cutDistanceVS = select(cutCylinderDistWithoutAxis, cutCylinderDistWithAxis, cutCylinderAxisLengthSq > 0.0);"];break;case"vtkCone":l=[" let cutConeDelta: vec3 = vertexBC.xyz - mapperUBO.CutConeApex.xyz;"," let cutConeAxial: f32 = dot(mapperUBO.CutConeAxis.xyz, cutConeDelta);"," let cutConeRadial2: f32 = dot(cutConeDelta, cutConeDelta) - cutConeAxial * cutConeAxial;"," output.cutDistanceVS = cutConeRadial2 - cutConeAxial * cutConeAxial * mapperUBO.CutConeTanThetaSquared;"];break;default:ra("No cut function set.")}let u=o.getCode();u=tG.Ay.substitute(u,"//VTK::Position::Impl",[...s,...l,"//VTK::Position::Impl"]).result,t.forceZValue&&(u=tG.Ay.substitute(u,"//VTK::Position::Impl",[t.useRendererMatrix?"pCoord = vec4(pCoord.xyz/pCoord.w, 1.0);":" pCoord = vec4(pCoord.xyz/pCoord.w, 1.0);"," pCoord.z = mapperUBO.ZValue;","//VTK::Position::Impl"]).result),e.haveWideLines()&&(o.addBuiltinInput("u32","@builtin(instance_index) instanceIndex"),u=tG.Ay.substitute(u,"//VTK::Position::Impl",[" var tmpPos: vec4 = pCoord;"," var numSteps: f32 = max(1.0, ceil(mapperUBO.LineWidth - 1.0));"," var offset: f32 = (mapperUBO.LineWidth - 1.0) * (f32(input.instanceIndex / 2u) - numSteps/2.0) / numSteps;"," var tmpPos2: vec3 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * (f32(input.instanceIndex) % 2.0) * offset / rendererUBO.viewportSize.x;"," tmpPos2.y = tmpPos2.y + 2.0 * (f32(input.instanceIndex + 1u) % 2.0) * offset / rendererUBO.viewportSize.y;"," tmpPos2.z = min(1.0, tmpPos2.z + 0.00001);"," pCoord = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);","//VTK::Position::Impl"]).result),u=tG.Ay.substitute(u,"//VTK::Position::Impl",[" output.Position = pCoord;"]).result,o.setCode(u);let c=n.getShaderDescription("fragment");u=c.getCode(),u=tG.Ay.substitute(u,"//VTK::Position::Impl",[" if (abs(input.cutDistanceVS) > max(fwidth(input.cutDistanceVS) * mapperUBO.CutWidth, 1.0e-6)) { discard; }","//VTK::Position::Impl"]).result,u=tG.Ay.substitute(u,"//VTK::RenderEncoder::Impl",[" let cutterDistanceDx: f32 = dpdx(input.cutDistanceVS);"," let cutterDistanceDy: f32 = dpdy(input.cutDistanceVS);"," let cutterDistanceGradient: f32 = length(vec2(cutterDistanceDx, cutterDistanceDy));"," if (cutterDistanceGradient <= 0.0 && abs(input.cutDistanceVS) > 1.0e-6) { discard; }","//VTK::RenderEncoder::Impl"]).result,c.setCode(u)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition);let n=e.computePipelineHash;e.computePipelineHash=()=>{n();let e=t.renderable.getSupportedImplicitFunctionName()||"none";t.pipelineHash+=`cf${e}Params`};let i=e.updateUBO;e.updateUBO=()=>{i();let e=t.renderable,r=e.getCutFunction(),n=e.getSupportedImplicitFunctionName();if(!n||!r)return;let a=t.WebGPUActor.getBufferShift(t.WebGPURenderer);switch(t.UBO.setValue("CutWidth",Math.max(e.getCutWidth(),0)),n){case"vtkPlane":t.UBO.setArray("CutPlaneOrigin",ri(t.cutPlaneOrigin,r.getOrigin(),a)),t.UBO.setArray("CutPlaneNormal",rn(t.cutPlaneNormal,r.getNormal())),t.UBO.setValue("CutValue",e.getCutValue());break;case"vtkSphere":{let e=r.getRadius(),n=Array.isArray(e);t.UBO.setArray("CutSphereCenter",ri(t.cutSphereCenter,r.getCenter(),a)),n?(t.cutSphereRadius[0]=e[0],t.cutSphereRadius[1]=e[1],t.cutSphereRadius[2]=e[2]):(t.cutSphereRadius[0]=e,t.cutSphereRadius[1]=e,t.cutSphereRadius[2]=e),t.cutSphereRadius[3]=0,t.UBO.setArray("CutSphereRadius",t.cutSphereRadius),t.UBO.setValue("CutSphereUsesAxisRadii",+!!n);break}case"vtkBox":{var o,s;let e=r.getBounds();t.UBO.setArray("CutBoxMinPoint",(o=t.cutBoxMinPoint,o[0]=e[0]+a[0],o[1]=e[2]+a[1],o[2]=e[4]+a[2],o[3]=0,o)),t.UBO.setArray("CutBoxMaxPoint",(s=t.cutBoxMaxPoint,s[0]=e[1]+a[0],s[1]=e[3]+a[1],s[2]=e[5]+a[2],s[3]=0,s));break}case"vtkCylinder":t.UBO.setArray("CutCylinderCenter",ri(t.cutCylinderCenter,r.getCenter(),a)),t.UBO.setArray("CutCylinderAxis",rn(t.cutCylinderAxis,r.getAxis())),t.UBO.setValue("CutCylinderRadius",r.getRadius());break;case"vtkCone":{let e=t.cutConeApex,n=t.cutConeAxis,i=t.cutConeAxisPoint,o=r.getTransform?.()?.getInverse?.();e[0]=0,e[1]=0,e[2]=0,n[0]=1,n[1]=0,n[2]=0,i[0]=1,i[1]=0,i[2]=0,o?.transformPoint?(o.transformPoint(e,e),o.transformPoint(i,i),u.Ay.subtract(i,e,n),u.Ay.norm(n)>0&&u.Ay.normalize(n)):r.getTransform?.()&&ra("Failed to retrieve inverse transform for cone cut function"),t.UBO.setArray("CutConeApex",ri(t.cutConeApex4,e,a)),t.UBO.setArray("CutConeAxis",rn(t.cutConeAxis4,n));let s=Math.tan(u.Ay.radiansFromDegrees(r.getAngle()));t.UBO.setValue("CutConeTanThetaSquared",s*s)}}t.UBO.sendIfNeeded(t.WebGPURenderWindow.getDevice())}},"vtkWebGPUCutterCellArrayMapper"),rs=l.Ay.newInstance(function(e,t,r={}){rr.extend(e,t,r),t.classHierarchy.push("vtkWebGPUCutterMapper"),e.createCellArrayMapper=()=>ro()},"vtkWebGPUCutterMapper");(0,tA.c9)("vtkCutterMapper",rs),r(94065);var{PrimitiveTypes:rl}=tR.Ay,ru=(0,l.UI)(function(e,t,r={}){Object.assign(t,{primitives:[],...r}),eY.A.extend(e,t,r),t.primitives=[],t.classHierarchy.push("vtkWebGPUPolyDataMapper2D"),e.createCellArrayMapper=()=>t8.newInstance(),e.buildPass=r=>{if(r){t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor2D"),t.renderable.getStatic()||t.renderable.update();let r=t.renderable.getInputData();t.renderable.mapScalars(r,1),e.updateCellArrayMappers(r)}},e.updateCellArrayMappers=r=>{let n=[r.getVerts(),r.getLines(),r.getPolys(),r.getStrips()],i=[],a=0;for(let o=rl.Points;o<=rl.Triangles;o++)if(n[o].getNumberOfValues()>0){t.primitives[o]||(t.primitives[o]=e.createCellArrayMapper());let s=t.primitives[o];s.setCellArray(n[o]),s.setCurrentInput(r),s.setCellOffset(a),s.setPrimitiveType(o),s.setRenderable(t.renderable),s.setIs2D(!0),a+=n[o].getNumberOfCells(),i.push(s)}else t.primitives[o]=null;e.prepareNodes(),e.addMissingChildren(i),e.removeUnusedNodes()}},"vtkWebGPUPolyDataMapper2D");(0,tA.c9)("vtkMapper2D",ru),r(47858);var rc={},rd=(0,l.UI)(function(e,t,r={}){Object.assign(t,rc,r),eY.A.extend(e,t,r),t.scalarBarActorHelper=ty.newScalarBarActorHelper(),t.classHierarchy.push("vtkWebGPUScalarBarActor"),e.buildPass=r=>{r&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.scalarBarActorHelper.getRenderable()||t.scalarBarActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.scalarBarActorHelper.getBarActor()),e.addMissingNode(t.scalarBarActorHelper.getTmActor()),e.removeUnusedNodes())},e.opaquePass=(e,r)=>{if(e){let e=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,r=t.WebGPURenderer.getTiledSizeAndOrigin();t.scalarBarActorHelper.updateAPISpecificData([r.usize,r.vsize],e,t.WebGPURenderWindow.getRenderable())}}},"vtkWebGPUScalarBarActor");(0,tA.c9)("vtkScalarBarActor",rd);var rp=r(72867),{VtkDataTypes:rm}=c.Ay,{vtkErrorMacro:rh}=l.Ay,rf=` +//VTK::Renderer::Dec + +//VTK::Mapper::Dec + +//VTK::TCoord::Dec + +//VTK::RenderEncoder::Dec + +//VTK::IOStructs::Dec + +@fragment +fn main( +//VTK::IOStructs::Input +) +//VTK::IOStructs::Output +{ + var output: fragmentOutput; + + var computedColor: vec4 = textureSampleLevel(sbtexture, sbtextureSampler, input.tcoordVS, 0.0); + + //VTK::RenderEncoder::Impl + return output; +} +`,rg=` +fn remapCubeCoord(dir: vec3) -> vec3 { + var tc = normalize(dir); + if (abs(tc.z) < max(abs(tc.x), abs(tc.y))) { + tc = vec3(1.0, 1.0, -1.0) * tc; + } else { + tc = vec3(-1.0, 1.0, 1.0) * tc; + } + return tc; +} + +//VTK::Renderer::Dec + +//VTK::Mapper::Dec + +//VTK::TCoord::Dec + +//VTK::RenderEncoder::Dec + +//VTK::IOStructs::Dec + +@fragment +fn main( +//VTK::IOStructs::Input +) +//VTK::IOStructs::Output +{ + var output: fragmentOutput; + + let clipPos = vec4(input.vertexVC.xy, 1.0, 1.0); + let worldPos = mapperUBO.IMCPCMatrix * clipPos; + let direction = remapCubeCoord(worldPos.xyz / worldPos.w - mapperUBO.CameraPosition.xyz); + var computedColor: vec4 = textureSampleLevel(sbtexture, sbtextureSampler, direction, 0.0); + + //VTK::RenderEncoder::Impl + return output; +} +`,rv=new Float64Array(16),ry={backgroundInterpolate:null,backgroundTextureView:null,backgroundWebGPUTexture:null,boxInterpolate:null,boxTextureView:null,boxWebGPUTexture:null,lastFormat:null,quad:null,UBO:null,webgpuCamera:null,WebGPURenderer:null,WebGPURenderWindow:null},rb=l.Ay.newInstance(function(e,t,r={}){Object.assign(t,ry,r),eY.A.extend(e,t,r);function n(e,r,n,i){let a=r.getInterpolate?.()?"linear":"nearest";if("background"===i){if(t.backgroundTextureView&&t.backgroundWebGPUTexture===n&&t.backgroundInterpolate===a)return t.backgroundTextureView;let r=n.createView("sbtexture");return r.addSampler(e,{minFilter:a,magFilter:a}),t.backgroundWebGPUTexture=n,t.backgroundInterpolate=a,t.backgroundTextureView=r,r}if(t.boxTextureView&&t.boxWebGPUTexture===n&&t.boxInterpolate===a)return t.boxTextureView;let o=n.createView("sbtexture",{dimension:"cube"});return o.addSampler(e,{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",minFilter:a,magFilter:a}),t.boxWebGPUTexture=n,t.boxInterpolate=a,t.boxTextureView=o,o}t.classHierarchy.push("vtkWebGPUSkybox"),e.buildPass=r=>{if(r&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer?.getFirstAncestorOfType("vtkWebGPURenderWindow"),t.WebGPURenderer)){let e=t.WebGPURenderer.getRenderable();t.webgpuCamera=t.WebGPURenderer.getViewNodeFor(e.getActiveCamera(),t.webgpuCamera)}},e.queryPass=(e,r)=>{e&&t.renderable&&t.renderable.getVisibility()&&r.incrementOpaqueActorCount()},e.ensureQuad=e=>{t.quad||(t.quad=rp.Ay.newInstance(),t.quad.setDevice(e),t.quad.setWebGPURenderer(t.WebGPURenderer),t.UBO=tH.Ay.newInstance({label:"mapperUBO"}),t.UBO.addEntry("IMCPCMatrix","mat4x4"),t.UBO.addEntry("CameraPosition","vec4"),t.quad.setUBO(t.UBO),t.quad.getShaderReplacements().set("replaceShaderPosition",(e,t)=>{let r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position"),r.hasOutput("vertexVC")||r.addOutput("vec4","vertexVC"),r.hasOutput("tcoordVS")||r.addOutput("vec2","tcoordVS");let n=r.getCode();n=tG.Ay.substitute(n,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, vertexBC.y * 0.5 + 0.5);","output.Position = vec4(vertexBC.x, vertexBC.y, 1.0, 1.0);","output.vertexVC = vec4(vertexBC.x, vertexBC.y, 1.0, 1.0);"]).result,r.setCode(n)}))},e.getTexture=()=>t.renderable.getTextures?.()?.[0]??null,e.getCubeTextureHash=e=>{let t=`${e.getMTime()}-skybox-cube`;for(let r=0;r<6;r++){let n=e.getInputData(r);if(!n)return null;t+=`-${n.getMTime()}`;let i=n.getPointData().getScalars();i&&(t+=`-${i.getMTime()}`)}return t},e.getCubeTexture=(t,r)=>{let n=e.getCubeTextureHash(r);return n?t.getCachedObject(n,()=>{let e=r.getInputData(0),n=e.getPointData().getScalars(),i=e.getDimensions(),a=tx.Ay.newInstance({label:"sbtexture"});a.create(t,{width:i[0],height:i[1],depth:6,dimension:"2d",format:function(e){let t=e.getNumberOfComponents(),r="rgba";switch(1===t?r="r":2===t&&(r="rg"),e.getDataType()){case rm.UNSIGNED_CHAR:return`${r}8unorm`;case rm.FLOAT:case rm.UNSIGNED_INT:case rm.INT:case rm.DOUBLE:case rm.UNSIGNED_SHORT:case rm.SHORT:default:return`${r}16float`}}(n)});for(let e=0;e<6;e++){let t=r.getInputData(e),n=t.getDimensions(),i=t.getPointData().getScalars(),o=function(e,t,r,n){let i=l.Ay.newTypedArray(e.constructor.name,e.length),a=t*n;for(let t=0;t{let i=e.getTexture();if(!i)return t.quad.setTextureViews([]),!1;if("background"===t.renderable.getFormat()){let e=r.getTextureManager().getTextureForVTKTexture(i,"sbtexture");if(!e.getReady())return t.quad.setTextureViews([]),!1;let a=n(r,i,e,"background");return t.quad.setTextureViews([a]),!0}if("box"===t.renderable.getFormat()){let a=e.getCubeTexture(r,i);if(!a?.getReady())return t.quad.setTextureViews([]),!1;let o=n(r,i,a,"box");return t.quad.setTextureViews([o]),!0}return rh(`Unsupported vtkSkybox format ${t.renderable.getFormat()}`),t.quad.setTextureViews([]),!1},e.updateUBO=e=>{let r=t.WebGPURenderer.getRenderable().getActiveCamera(),n=t.webgpuCamera.getKeyMatrices(t.WebGPURenderer),i=t.WebGPURenderer.getStabilizedCenterByReference();v.copy(rv,n.pcsc),t.UBO.setArray("IMCPCMatrix",rv),t.UBO.setArray("CameraPosition",[r.getPositionByReference()[0]-i[0],r.getPositionByReference()[1]-i[1],r.getPositionByReference()[2]-i[2],1]),t.UBO.sendIfNeeded(e)},e.releaseGraphicsResources=()=>{t.quad?.releaseGraphicsResources?.(),t.quad=null,t.UBO=null,t.backgroundTextureView=null,t.backgroundWebGPUTexture=null,t.backgroundInterpolate=null,t.boxTextureView=null,t.boxWebGPUTexture=null,t.boxInterpolate=null,t.lastFormat=null,t.webgpuCamera=null,t.WebGPURenderer=null,t.WebGPURenderWindow=null},e.opaquePass=r=>{if(!r||!t.renderable||!t.renderable.getVisibility()||t.WebGPURenderer?.getSelector())return;let n=t.WebGPURenderWindow.getDevice();e.ensureQuad(n),t.quad.setWebGPURenderer(t.WebGPURenderer);let i=t.renderable.getFormat();t.lastFormat!==i&&(t.quad.setPipelineHash(`skybox-${i}`),t.quad.setFragmentShaderTemplate("background"===i?rf:rg),t.lastFormat=i),e.updateTexture(n)&&(e.updateUBO(n),t.quad.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.quad.registerDrawCallback(t.WebGPURenderer.getRenderEncoder()))}},"vtkWebGPUSkybox");(0,tA.c9)("vtkSkybox",rb)},70125:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>c});var n=r(17042),i=r(69927),{Representation:a,Interpolation:o}=i.Ay;function s(e){return()=>n.Ay.vtkErrorMacro(`vtkProperty::${e} - NOT IMPLEMENTED`)}var l={color:[1,1,1],ambientColor:[1,1,1],diffuseColor:[1,1,1],specularColor:[1,1,1],edgeColor:[0,0,0],ambient:0,diffuse:1,metallic:0,roughness:.6,normalStrength:1,emission:1,baseIOR:1.45,specular:0,specularPower:1,opacity:1,edgeOpacity:1,interpolation:o.GOURAUD,representation:a.SURFACE,edgeVisibility:!1,backfaceCulling:!1,frontfaceCulling:!1,pointSize:1,lineWidth:1,lighting:!0,shading:!1,materialName:null,ORMTexture:null,RMTexture:null};function u(e,t,r={}){Object.assign(t,l,r),n.Ay.obj(e,t),n.Ay.setGet(e,t,["lighting","interpolation","ambient","diffuse","metallic","roughness","normalStrength","emission","baseIOR","specular","specularPower","opacity","edgeOpacity","edgeVisibility","lineWidth","pointSize","backfaceCulling","frontfaceCulling","representation","diffuseTexture","metallicTexture","roughnessTexture","normalTexture","ambientOcclusionTexture","emissionTexture","ORMTexture","RMTexture"]),n.Ay.setGetArray(e,t,["ambientColor","specularColor","diffuseColor","edgeColor"],3),t.classHierarchy.push("vtkProperty"),e.setColor=(r,n,i)=>{Array.isArray(r)?(t.color[0]!==r[0]||t.color[1]!==r[1]||t.color[2]!==r[2])&&(t.color[0]=r[0],t.color[1]=r[1],t.color[2]=r[2],e.modified()):(t.color[0]!==r||t.color[1]!==n||t.color[2]!==i)&&(t.color[0]=r,t.color[1]=n,t.color[2]=i,e.modified()),e.setDiffuseColor(t.color),e.setAmbientColor(t.color),e.setSpecularColor(t.color)},e.computeCompositeColor=s("ComputeCompositeColor"),e.getColor=()=>{let e=0;t.ambient+t.diffuse+t.specular>0&&(e=1/(t.ambient+t.diffuse+t.specular));for(let r=0;r<3;r++)t.color[r]=e*(t.ambient*t.ambientColor[r]+t.diffuse*t.diffuseColor[r]+t.specular*t.specularColor[r]);return[].concat(t.color)},e.addShaderVariable=s("AddShaderVariable"),e.setInterpolationToFlat=()=>e.setInterpolation(o.FLAT),e.setInterpolationToGouraud=()=>e.setInterpolation(o.GOURAUD),e.setInterpolationToPhong=()=>e.setInterpolation(o.PHONG),e.getInterpolationAsString=()=>n.Ay.enumToString(o,t.interpolation),e.setRepresentationToWireframe=()=>e.setRepresentation(a.WIREFRAME),e.setRepresentationToSurface=()=>e.setRepresentation(a.SURFACE),e.setRepresentationToPoints=()=>e.setRepresentation(a.POINTS),e.getRepresentationAsString=()=>n.Ay.enumToString(a,t.representation)}var c={newInstance:n.Ay.newInstance(u,"vtkProperty"),extend:u,...i.Ay}},70337:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XMLBuilderImpl=void 0;let n=r(92539),i=r(16950),a=r(72878),o=r(5309),s=r(79663),l=r(47518),u=r(24065),c=r(57226),d=r(53562);class p{_domNode;constructor(e){this._domNode=e}get node(){return this._domNode}get options(){return this._options}set(e){return this._options=(0,i.applyDefaults)((0,i.applyDefaults)(this._options,e,!0),n.DefaultBuilderOptions),this}ele(e,t,r){let n,a,o;if((0,i.isObject)(e))return new d.ObjectReader(this._options).parse(this,e);if((0,i.isString)(e)&&null!==e&&/^\s*this.att(e,t),this),this;if(null!=e&&(e=(0,i.getValue)(e+"")),null!=t&&(t=(0,i.getValue)(t+"")),null!=r&&(r=(0,i.getValue)(r+"")),(null===e||(0,i.isString)(e))&&(0,i.isString)(t)&&(null===r||(0,i.isString)(r)))[n,a,o]=[e,t,r];else if((0,i.isString)(e)&&(null==t||(0,i.isString)(t)))[n,a,o]=[void 0,e,t];else throw Error("Attribute name and value not specified. "+this._debugInfo());if(this._options.keepNullAttributes&&null==o)o="";else if(null==o)return this;if(!s.Guard.isElementNode(this.node))throw Error("An attribute can only be assigned to an element node.");let d=this.node;[n,a]=this._extractNamespace(n,a,!1),a=(0,u.sanitizeInput)(a,this._options.invalidCharReplacement),n=(0,u.sanitizeInput)(n,this._options.invalidCharReplacement),o=(0,u.sanitizeInput)(o,this._options.invalidCharReplacement);let[p,m]=(0,l.namespace_extractQName)(a),[h]=(0,l.namespace_extractQName)(d.prefix?d.prefix+":"+d.localName:d.localName),f=null;return"xmlns"===p?(n=c.namespace.XMLNS,null===d.namespaceURI&&h===m&&(f=o)):null===p&&"xmlns"===m&&null===h&&(n=c.namespace.XMLNS,f=o),null!==f&&(this._updateNamespace(f),d=this.node),void 0!==n?d.setAttributeNS(n,a,o):d.setAttribute(a,o),this}removeAtt(e,t){let r,n;if(!s.Guard.isElementNode(this.node))throw Error("An attribute can only be removed from an element node.");if(e=(0,i.getValue)(e),void 0!==t&&(t=(0,i.getValue)(t)),null!==e&&void 0===t)n=e;else if((null===e||(0,i.isString)(e))&&void 0!==t)r=e,n=t;else throw Error("Attribute namespace must be a string. "+this._debugInfo());return(0,i.isArray)(n)||(0,i.isSet)(n)?(0,i.forEachArray)(n,e=>void 0===r?this.removeAtt(e):this.removeAtt(r,e),this):void 0!==r?(n=(0,u.sanitizeInput)(n,this._options.invalidCharReplacement),r=(0,u.sanitizeInput)(r,this._options.invalidCharReplacement),this.node.removeAttributeNS(r,n)):(n=(0,u.sanitizeInput)(n,this._options.invalidCharReplacement),this.node.removeAttribute(n)),this}txt(e){if(null==e)if(!this._options.keepNullNodes)return this;else e="";let t=this._doc.createTextNode((0,u.sanitizeInput)(e,this._options.invalidCharReplacement));return this.node.appendChild(t),this}com(e){if(null==e)if(!this._options.keepNullNodes)return this;else e="";let t=this._doc.createComment((0,u.sanitizeInput)(e,this._options.invalidCharReplacement));return this.node.appendChild(t),this}dat(e){if(null==e)if(!this._options.keepNullNodes)return this;else e="";let t=this._doc.createCDATASection((0,u.sanitizeInput)(e,this._options.invalidCharReplacement));return this.node.appendChild(t),this}ins(e,t=""){if(null==t)if(!this._options.keepNullNodes)return this;else t="";if((0,i.isArray)(e)||(0,i.isSet)(e))(0,i.forEachArray)(e,e=>{let t=(e+="").indexOf(" "),r=-1===t?e:e.substr(0,t),n=-1===t?"":e.substr(t+1);this.ins(r,n)},this);else if((0,i.isMap)(e)||(0,i.isObject)(e))(0,i.forEachObject)(e,(e,t)=>this.ins(e,t),this);else{let r=this._doc.createProcessingInstruction((0,u.sanitizeInput)(e,this._options.invalidCharReplacement),(0,u.sanitizeInput)(t,this._options.invalidCharReplacement));this.node.appendChild(r)}return this}dec(e){return this._options.version=e.version||"1.0",this._options.encoding=e.encoding,this._options.standalone=e.standalone,this}dtd(e){let t=(0,u.sanitizeInput)(e&&e.name||(this._doc.documentElement?this._doc.documentElement.tagName:"ROOT"),this._options.invalidCharReplacement),r=(0,u.sanitizeInput)(e&&e.pubID||"",this._options.invalidCharReplacement),n=(0,u.sanitizeInput)(e&&e.sysID||"",this._options.invalidCharReplacement);if(null!==this._doc.documentElement&&t!==this._doc.documentElement.tagName)throw Error("DocType name does not match document element name.");let i=this._doc.implementation.createDocumentType(t,r,n);return null!==this._doc.doctype?this._doc.replaceChild(i,this._doc.doctype):this._doc.insertBefore(i,this._doc.documentElement),this}import(e){let t=this._domNode,r=this._doc,n=e.node,i=e=>{if(!e._namespace){let[r]=(0,l.namespace_extractQName)(e.prefix?e.prefix+":"+e.localName:e.localName),n=t.lookupNamespaceURI(r);new p(e)._updateNamespace(n)}};if(s.Guard.isDocumentNode(n)){let e=n.documentElement;if(null===e)throw Error("Imported document has no document element node. "+this._debugInfo());let a=r.importNode(e,!0);t.appendChild(a),i(a)}else if(s.Guard.isDocumentFragmentNode(n))for(let e of n.childNodes){let n=r.importNode(e,!0);t.appendChild(n),s.Guard.isElementNode(n)&&i(n)}else{let e=r.importNode(n,!0);t.appendChild(e),s.Guard.isElementNode(e)&&i(e)}return this}doc(){if(!this._doc._isFragment)return new p(this._doc);{let e=this.node;for(;e&&e.nodeType!==o.NodeType.DocumentFragment;)e=e.parentNode;if(null===e)throw Error("Node has no parent node while searching for document fragment ancestor. "+this._debugInfo());return new p(e)}}root(){let e=this._doc.documentElement;if(!e)throw Error("Document root element is null. "+this._debugInfo());return new p(e)}up(){let e=this._domNode.parentNode;if(!e)throw Error("Parent node is null. "+this._debugInfo());return new p(e)}prev(){let e=this._domNode.previousSibling;if(!e)throw Error("Previous sibling node is null. "+this._debugInfo());return new p(e)}next(){let e=this._domNode.nextSibling;if(!e)throw Error("Next sibling node is null. "+this._debugInfo());return new p(e)}first(){let e=this._domNode.firstChild;if(!e)throw Error("First child node is null. "+this._debugInfo());return new p(e)}last(){let e=this._domNode.lastChild;if(!e)throw Error("Last child node is null. "+this._debugInfo());return new p(e)}each(e,t=!1,r=!1,n){let i=this._getFirstDescendantNode(this._domNode,t,r);for(;i[0];){let t=this._getNextDescendantNode(this._domNode,i[0],r,i[1],i[2]);e.call(n,new p(i[0]),i[1],i[2]),i=t}return this}map(e,t=!1,r=!1,n){let i=[];return this.each((t,r,a)=>i.push(e.call(n,t,r,a)),t,r),i}reduce(e,t,r=!1,n=!1,i){let a=t;return this.each((t,r,n)=>a=e.call(i,a,t,r,n),r,n),a}find(e,t=!1,r=!1,n){let i=this._getFirstDescendantNode(this._domNode,t,r);for(;i[0];){let t=new p(i[0]);if(e.call(n,t,i[1],i[2]))return t;i=this._getNextDescendantNode(this._domNode,i[0],r,i[1],i[2])}}filter(e,t=!1,r=!1,n){let i=[];return this.each((t,r,a)=>{e.call(n,t,r,a)&&i.push(t)},t,r),i}every(e,t=!1,r=!1,n){let i=this._getFirstDescendantNode(this._domNode,t,r);for(;i[0];){let t=new p(i[0]);if(!e.call(n,t,i[1],i[2]))return!1;i=this._getNextDescendantNode(this._domNode,i[0],r,i[1],i[2])}return!0}some(e,t=!1,r=!1,n){let i=this._getFirstDescendantNode(this._domNode,t,r);for(;i[0];){let t=new p(i[0]);if(e.call(n,t,i[1],i[2]))return!0;i=this._getNextDescendantNode(this._domNode,i[0],r,i[1],i[2])}return!1}toArray(e=!1,t=!1){let r=[];return this.each(e=>r.push(e),e,t),r}toString(e){return void 0===(e=e||{}).format&&(e.format="xml"),this._serialize(e)}toObject(e){return void 0===(e=e||{}).format&&(e.format="object"),this._serialize(e)}end(e){return void 0===(e=e||{}).format&&(e.format="xml"),this.doc()._serialize(e)}_getFirstDescendantNode(e,t,r){return t?[this._domNode,0,0]:r?this._getNextDescendantNode(e,e,r,0,0):[this._domNode.firstChild,0,1]}_getNextDescendantNode(e,t,r,n,i){if(r){if(t.firstChild)return[t.firstChild,0,i+1];if(t===e)return[null,-1,-1];if(t.nextSibling)return[t.nextSibling,n+1,i];let r=t.parentNode;for(;r&&r!==e;){if(r.nextSibling)return[r.nextSibling,(0,l.tree_index)(r.nextSibling),i-1];r=r.parentNode,i--}}else if(e===t)return[t.firstChild,0,i+1];else return[t.nextSibling,n+1,i];return[null,-1,-1]}_serialize(e){if("xml"===e.format)return new a.XMLWriter(this._options,e).serialize(this.node);if("map"===e.format)return new a.MapWriter(this._options,e).serialize(this.node);if("object"===e.format)return new a.ObjectWriter(this._options,e).serialize(this.node);if("json"===e.format)return new a.JSONWriter(this._options,e).serialize(this.node);if("yaml"===e.format)return new a.YAMLWriter(this._options,e).serialize(this.node);else throw Error("Invalid writer format: "+e.format+". "+this._debugInfo())}_extractNamespace(e,t,r){let n=t.indexOf("@");if(n>0&&(void 0===e&&(e=t.slice(n+1)),t=t.slice(0,n)),void 0===e)e=r?this._options.defaultNamespace.ele:this._options.defaultNamespace.att;else if(null!==e&&"@"===e[0]){let t=e.slice(1);if(void 0===(e=this._options.namespaceAlias[t]))throw Error("Namespace alias `"+t+"` is not defined. "+this._debugInfo())}return[e,t]}_updateNamespace(e){let t=this._domNode;if(s.Guard.isElementNode(t)&&null!==e&&t.namespaceURI!==e){let[r,n]=(0,l.namespace_extractQName)(t.prefix?t.prefix+":"+t.localName:t.localName),i=(0,l.create_element)(this._doc,n,e,r);for(let e of t.attributes){let r=e.prefix?e.prefix+":"+e.localName:e.localName,[n]=(0,l.namespace_extractQName)(r),a=e.namespaceURI;null===a&&null!==n&&(a=t.lookupNamespaceURI(n)),null===a?i.setAttribute(r,e.value):i.setAttributeNS(a,r,e.value)}let a=t.parentNode;if(null===a)throw Error("Parent node is null."+this._debugInfo());for(let e of(a.replaceChild(i,t),this._domNode=i,t.childNodes)){let t=e.cloneNode(!0);if(i.appendChild(t),s.Guard.isElementNode(t)&&!t._namespace){let[e]=(0,l.namespace_extractQName)(t.prefix?t.prefix+":"+t.localName:t.localName),r=i.lookupNamespaceURI(e);new p(t)._updateNamespace(r)}}}}get _doc(){let e=this.node;if(s.Guard.isDocumentNode(e))return e;{let t=e.ownerDocument;if(!t)throw Error("Owner document is null. "+this._debugInfo());return t}}_debugInfo(e){let t=this.node,r=t.parentNode;e=e||t.nodeName;let n=r?r.nodeName:"";return n?"node: <"+e+">, parent: <"+n+">":"node: <"+e+">"}get _options(){let e=this._doc;if(void 0===e._xmlBuilderOptions)throw Error("Builder options is not set.");return e._xmlBuilderOptions}set _options(e){this._doc._xmlBuilderOptions=e}}t.XMLBuilderImpl=p},70547:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=function(e){let t=typeof e;return null!==e&&("object"===t||"function"===t)}},70639:(e,t,r)=>{"use strict";r.d(t,{A:()=>a,d:()=>i});let n={Auto:"auto",GPU:"gpu",CPU:"cpu"};function i(e,t){if(Object.prototype.hasOwnProperty.call(n,e))throw Error(`Render backend constant "${String(e)}" already exists`);n[e]=t}let a=n},70770:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.YAMLWriter=void 0;let n=r(22706),i=r(16950),a=r(81320);class o extends a.BaseWriter{constructor(e,t){if(super(e),this._writerOptions=(0,i.applyDefaults)(t,{wellFormed:!1,indent:" ",newline:"\n",offset:0,group:!1,verbose:!1}),this._writerOptions.indent.length<2)throw Error("YAML indententation string must be at least two characters long.");if(this._writerOptions.offset<0)throw Error("YAML offset should be zero or a positive number.")}serialize(e){let t=(0,i.applyDefaults)(this._writerOptions,{format:"object",wellFormed:!1}),r=new n.ObjectWriter(this._builderOptions,t).serialize(e),a=this._beginLine(this._writerOptions,0)+"---"+this._endLine(this._writerOptions)+this._convertObject(r,this._writerOptions,0);return a.slice(-this._writerOptions.newline.length)===this._writerOptions.newline&&(a=a.slice(0,-this._writerOptions.newline.length)),a}_convertObject(e,t,r,n=!1){let a="";if((0,i.isArray)(e))for(let n of e)a+=this._beginLine(t,r,!0),(0,i.isObject)(n)?(0,i.isEmpty)(n)?a+='""'+this._endLine(t):a+=this._convertObject(n,t,r,!0):a+=this._val(n)+this._endLine(t);else(0,i.forEachObject)(e,(e,o)=>{n?(a+=this._key(e),n=!1):a+=this._beginLine(t,r)+this._key(e),(0,i.isObject)(o)||(0,i.isArray)(o)?(0,i.isEmpty)(o)?a+=' ""'+this._endLine(t):a+=this._endLine(t)+this._convertObject(o,t,r+1):a+=" "+this._val(o)+this._endLine(t)},this);return a}_beginLine(e,t,r=!1){let n=Array(e.offset+t+1).join(e.indent);return r?n.substr(0,n.length-2)+"-"+n.substr(-1,1):n}_endLine(e){return e.newline}_key(e){return'"'+e+'":'}_val(e){return JSON.stringify(e)}}t.YAMLWriter=o},71002:(e,t,r)=>{"use strict";function n(e,t){if(null==e)throw Error(t)}r.d(t,{C:()=>n})},71283:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(93022);function i(e){return(e.childAnnotationUIDs??[]).map(e=>(0,n.getAnnotation)(e).data.contour.polyline)}},71784:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AttrImpl=void 0;let n=r(5309),i=r(92787),a=r(47518),o=r(48040);class s extends i.NodeImpl{_nodeType=n.NodeType.Attribute;_localName;_namespace=null;_namespacePrefix=null;_element=null;_value="";constructor(e){super(),this._localName=e}specified;get ownerElement(){return this._element}get namespaceURI(){return this._namespace}get prefix(){return this._namespacePrefix}get localName(){return this._localName}get name(){return this._qualifiedName}get value(){return this._value}set value(e){(0,a.attr_setAnExistingAttributeValue)(this,e)}get _qualifiedName(){return null!==this._namespacePrefix?this._namespacePrefix+":"+this._localName:this._localName}static _create(e,t){let r=new s(t);return r._nodeDocument=e,r}}t.AttrImpl=s,(0,o.idl_defineConst)(s.prototype,"_nodeType",n.NodeType.Attribute),(0,o.idl_defineConst)(s.prototype,"specified",!0)},71836:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>s});var n=r(17042),{vtkErrorMacro:i}=n.Ay,a={context:null,numberOfTextureUnits:0,textureUnits:0};function o(e,t,r={}){Object.assign(t,a,r),n.Ay.obj(e,t),t.textureUnits=[],n.Ay.get(e,t,["numberOfTextureUnits"]),n.Ay.setGet(e,t,["context"]),t.classHierarchy.push("vtkOpenGLTextureUnitManager"),e.deleteTable=()=>{for(let e=0;e{if(t.context!==r){if(0!==t.context&&e.deleteTable(),t.context=r,t.context){t.numberOfTextureUnits=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS);for(let e=0;e{for(let r=0;re.isAllocated(r)?-1:(t.textureUnits[r]=!0,r),e.isAllocated=e=>t.textureUnits[e],e.free=e=>{t.textureUnits[e]=!1},e.freeAll=()=>{for(let e=0;e{"use strict";r.d(t,{A:()=>s});var n=r(17042),{vtkErrorMacro:i}=n.Ay,a={renderable:null,myFactory:null,children:[],visited:!1};function o(e,t,r={}){Object.assign(t,a,r),n.Ay.obj(e,t),n.Ay.event(e,t,"event"),t._renderableChildMap=new Map,n.Ay.get(e,t,["visited"]),n.Ay.setGet(e,t,["_parent","renderable","myFactory"]),n.Ay.getArray(e,t,["children"]),n.Ay.moveToProtected(e,t,["parent"]);t.classHierarchy.push("vtkViewNode"),e.build=e=>{},e.render=e=>{},e.traverse=r=>{let n=e[r.getTraverseOperation()];if(n)return void n(r);e.apply(r,!0);for(let e=0;e{let n=e[t.getOperation()];n&&n(r,t)},e.getViewNodeFor=(r,n=null)=>{if(n&&n.renderable===r)return n;if(t.renderable===r)return e;for(let e=0;et._parent?t._parent.isA(e)?t._parent:t._parent.getFirstAncestorOfType(e):null,e.getLastAncestorOfType=e=>{if(!t._parent)return null;let r=t._parent.getLastAncestorOfType(e);return r||(t._parent.isA(e)?t._parent:null)},e.addMissingNode=r=>{if(!r)return;let n=t._renderableChildMap.get(r);if(void 0!==n)return n.setVisited(!0),n;let i=e.createViewNode(r);if(i)return i.setParent(e),i.setVisited(!0),t._renderableChildMap.set(r,i),t.children.push(i),i},e.addMissingNodes=(r,n=!1)=>{let i;if(r&&r.length)for(let a=0;a{if(r&&r.length)for(let n=0;n{let r=t.children.findIndex(t=>t===e);if(r<0)return!1;let n=e.getRenderable();return n&&t._renderableChildMap.delete(n),e.delete(),t.children.splice(r,1),!0},e.prepareNodes=()=>{for(let e=0;e{t.visited=e},e.removeUnusedNodes=()=>{let e=0;for(let r=0;r{if(!t.myFactory)return i("Cannot create view nodes without my own factory"),null;let r=t.myFactory.createNode(e);return r&&r.setRenderable(e),r};let s=e.delete;e.delete=()=>{for(let e=0;e{"use strict";r.d(t,{Ay:()=>s});var n=r(17042),i=r(72188),a={size:void 0,selector:void 0};function o(e,t,r={}){Object.assign(t,a,r),t.size||(t.size=[300,300]),n.Ay.getArray(e,t,["size"],2),n.Ay.get(e,t,["selector"]),i.A.extend(e,t,r),t.classHierarchy.push("vtkRenderWindowViewNode"),e.getViewNodeFactory=()=>null,e.getAspectRatio=()=>t.size[0]/t.size[1],e.getAspectRatioForRenderer=e=>{let r=e.getViewportByReference();return t.size[0]*(r[2]-r[0])/((r[3]-r[1])*t.size[1])},e.isInViewport=(t,r,n)=>{let i=n.getViewportByReference(),a=e.getFramebufferSize();return!!(i[0]*a[0]<=t)&&!!(i[2]*a[0]>=t)&&!!(i[1]*a[1]<=r)&&!!(i[3]*a[1]>=r)},e.getViewportSize=t=>{let r=t.getViewportByReference(),n=e.getFramebufferSize();return[(r[2]-r[0])*n[0],(r[3]-r[1])*n[1]]},e.getViewportCenter=t=>{let r=e.getViewportSize(t);return[.5*r[0],.5*r[1]]},e.displayToNormalizedDisplay=(t,r,n)=>{let i=e.getFramebufferSize();return[t/i[0],r/i[1],n]},e.normalizedDisplayToDisplay=(t,r,n)=>{let i=e.getFramebufferSize();return[t*i[0],r*i[1],n]},e.worldToView=(e,t,r,n)=>n.worldToView(e,t,r),e.viewToWorld=(e,t,r,n)=>n.viewToWorld(e,t,r),e.worldToDisplay=(t,r,n,i)=>{let a=i.worldToView(t,r,n),o=e.getViewportSize(i),s=i.viewToProjection(a[0],a[1],a[2],o[0]/o[1]),l=i.projectionToNormalizedDisplay(s[0],s[1],s[2]);return e.normalizedDisplayToDisplay(l[0],l[1],l[2])},e.displayToWorld=(t,r,n,i)=>{let a=e.displayToNormalizedDisplay(t,r,n),o=i.normalizedDisplayToProjection(a[0],a[1],a[2]),s=e.getViewportSize(i),l=i.projectionToView(o[0],o[1],o[2],s[0]/s[1]);return i.viewToWorld(l[0],l[1],l[2])},e.normalizedDisplayToViewport=(t,r,n,i)=>{let a=i.getViewportByReference();a=e.normalizedDisplayToDisplay(a[0],a[1],0);let o=e.normalizedDisplayToDisplay(t,r,n);return[o[0]-a[0]-.5,o[1]-a[1]-.5,n]},e.viewportToNormalizedViewport=(t,r,n,i)=>{let a=e.getViewportSize(i);return a&&0!==a[0]&&0!==a[1]?[t/(a[0]-1),r/(a[1]-1),n]:[t,r,n]},e.normalizedViewportToViewport=(t,r,n,i)=>{let a=e.getViewportSize(i);return[t*(a[0]-1),r*(a[1]-1),n]},e.displayToLocalDisplay=(t,r,n)=>[t,e.getFramebufferSize()[1]-r-1,n],e.viewportToNormalizedDisplay=(t,r,n,i)=>{let a=i.getViewportByReference(),o=t+(a=e.normalizedDisplayToDisplay(a[0],a[1],0))[0]+.5,s=r+a[1]+.5;return e.displayToNormalizedDisplay(o,s,n)},e.getComputedDevicePixelRatio=()=>t.size[0]/e.getContainerSize()[0],e.getContainerSize=()=>{n.Ay.vtkErrorMacro("not implemented")},e.getPixelData=(e,t,r,i)=>{n.Ay.vtkErrorMacro("not implemented")},e.createSelector=()=>{n.Ay.vtkErrorMacro("not implemented")}}var s={newInstance:n.Ay.newInstance(o,"vtkRenderWindowViewNode"),extend:o}},72444:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.document_elementInterface=function(e,t){return o.ElementImpl},t.document_internalCreateElementNS=function(e,t,r,n){let[i,o,s]=(0,u.namespace_validateAndExtract)(t,r),l=null;return void 0!==n&&(l=(0,a.isString)(n)?n:n.is),(0,d.element_createAnElement)(e,s,i,o,l,!0)},t.document_adopt=function(e,t){if(e._nodeDocument===t&&null===e._parent)return;let r=e._nodeDocument;if(e._parent&&(0,p.mutation_remove)(e,e._parent),t!==r){let a=(0,l.tree_getFirstDescendantNode)(e,!0,!0);for(;null!==a;){if(a._nodeDocument=t,i.Guard.isElementNode(a))for(let e of a._attributeList._asArray())e._nodeDocument=t;n.dom.features.customElements&&i.Guard.isElementNode(a)&&"custom"===a._customElementState&&(0,s.customElement_enqueueACustomElementCallbackReaction)(a,"adoptedCallback",[r,t]),n.dom.features.steps&&(0,c.dom_runAdoptingSteps)(a,r),a=(0,l.tree_getNextDescendantNode)(e,a,!0,!0)}}};let n=r(60957),i=r(79663),a=r(16950),o=r(83553),s=r(17344),l=r(29963),u=r(43174),c=r(11455),d=r(83011),p=r(78742)},72571:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>n});var n={ColorMode:{DEFAULT:0,MAP_SCALARS:1,DIRECT_SCALARS:2},GetArray:{BY_ID:0,BY_NAME:1},ScalarMode:{DEFAULT:0,USE_POINT_DATA:1,USE_CELL_DATA:2,USE_POINT_FIELD_DATA:3,USE_CELL_FIELD_DATA:4,USE_FIELD_DATA:5}}},72632:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ASCIIAlphanumeric=t.ASCIIAlpha=t.ASCIILowerAlpha=t.ASCIIUpperAlpha=t.ASCIIHexDigit=t.ASCIILowerHexDigit=t.ASCIIUpperHexDigit=t.ASCIIDigit=t.Control=t.C0ControlOrSpace=t.C0Control=t.ASCIIWhiteSpace=t.ASCIITabOrNewLine=t.ASCIICodePoint=t.NonCharacter=t.ScalarValue=t.Surrogate=void 0,t.Surrogate=/[\uD800-\uDFFF]/,t.ScalarValue=/[\uD800-\uDFFF]/,t.NonCharacter=/[\uFDD0-\uFDEF\uFFFE\uFFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDFFE\uDFFF]/,t.ASCIICodePoint=/[\u0000-\u007F]/,t.ASCIITabOrNewLine=/[\t\n\r]/,t.ASCIIWhiteSpace=/[\t\n\f\r ]/,t.C0Control=/[\u0000-\u001F]/,t.C0ControlOrSpace=/[\u0000-\u001F ]/,t.Control=/[\u0000-\u001F\u007F-\u009F]/,t.ASCIIDigit=/[0-9]/,t.ASCIIUpperHexDigit=/[0-9A-F]/,t.ASCIILowerHexDigit=/[0-9a-f]/,t.ASCIIHexDigit=/[0-9A-Fa-f]/,t.ASCIIUpperAlpha=/[A-Z]/,t.ASCIILowerAlpha=/[a-z]/,t.ASCIIAlpha=/[A-Za-z]/,t.ASCIIAlphanumeric=/[0-9A-Za-z]/},72661:(e,t,r)=>{"use strict";let n;r.d(t,{Ay:()=>c,Nw:()=>s,oI:()=>u,p8:()=>o,zV:()=>l});let i="viewport-element",a="cornerstone-canvas",o=1e-4;function s(e,t=512,r=512){let i=n?n(t,r):document.createElement("canvas");return e&&(i.style.position="absolute",i.style.width="100%",i.style.height="100%",i.style.imageRendering="pixelated",i.classList.add(a),e.appendChild(i)),i}function l(e,t){if(void 0===t){let t=window.devicePixelRatio||1,r=e.getBoundingClientRect(),n=Math.round(r.width*t),i=Math.round(r.height*t);n>0&&i>0&&(e.width=n,e.height=i,e.style.aspectRatio=`${n} / ${i}`);return}let{width:r,height:n}=t;return!(r<1)&&!(n<1)&&(e.width!==r||e.height!==n)&&(e.width=r,e.height=n,e.style.aspectRatio=`${r} / ${n}`,!0)}function u(e){let t=`canvas.${a}`,r=`div.${i}`,n=e.querySelector(r)||function(e){let t=document.createElement("div");return t.style.position="relative",t.style.width="100%",t.style.height="100%",t.style.overflow="hidden",t.classList.add(i),e.appendChild(t),t}(e),o=n.querySelector(t);if(o)return o;let l=s(n),u=n.getBoundingClientRect(),c=window.devicePixelRatio||1,d=Math.ceil(u.width*c),p=Math.ceil(u.height*c);return d>0&&p>0&&(l.width=d,l.height=p,l.style.aspectRatio=`${d} / ${p}`),l}let c=u},72663:(e,t,r)=>{"use strict";function n({colorWindow:e,colorLevel:t,useLookupTableScalarRange:r,colorRange:n,volumeScale:i=1,volumeOffset:a=0}){let o=e,s=t;return r&&n&&(o=n[1]-n[0],s=.5*(n[1]+n[0])),{colorScale:i/o,colorShift:(a-s)/o+.5}}function i({pwfRange:e,volumeScale:t=1,volumeOffset:r=0}){if(!e)return{opacityScale:1,opacityShift:0};let n=e[1]-e[0];return{opacityScale:t/n,opacityShift:(r-.5*(e[0]+e[1]))/n+.5}}function a({currentValidInputs:e,independentComponents:t,numberOfRows:r,kind:n,getInputProperty:i}){if(!e.length)return"0";let a="color"===n?"getRGBTransferFunction":"getPiecewiseFunction",o=[];for(let n=0;na,pL:()=>n,xO:()=>i})},72795:(e,t,r)=>{"use strict";r.d(t,{i:()=>n});let n=(e,t,r)=>t-r/4*Math.log((1-e)/e)},72867:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>l});var n=r(17042),i=r(59780),a=r(44293),o={};function s(e,t,r={}){Object.assign(t,o,r),a.Ay.extend(e,t,r),t.classHierarchy.push("vtkWebGPUFullScreenQuad"),e.replaceShaderPosition=(e,t,r)=>{let n=t.getShaderDescription("vertex");n.addBuiltinOutput("vec4","@builtin(position) Position"),n.addOutput("vec4","vertexVC");let a=n.getCode();a=i.Ay.substitute(a,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);","output.vertexVC = vec4(vertexBC, 1);"]).result,n.setCode(a)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.updateBuffers=()=>{let e=t.device.getBufferManager().getFullScreenQuadBuffer();t.vertexInput.addBuffer(e,["vertexBC"]),t.numberOfVertices=6}}var l={newInstance:n.Ay.newInstance(s,"vtkWebGPUFullScreenQuad"),extend:s}},72878:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.YAMLWriter=t.JSONWriter=t.ObjectWriter=t.XMLWriter=t.MapWriter=void 0;var n=r(35847);Object.defineProperty(t,"MapWriter",{enumerable:!0,get:function(){return n.MapWriter}});var i=r(11292);Object.defineProperty(t,"XMLWriter",{enumerable:!0,get:function(){return i.XMLWriter}});var a=r(22706);Object.defineProperty(t,"ObjectWriter",{enumerable:!0,get:function(){return a.ObjectWriter}});var o=r(33939);Object.defineProperty(t,"JSONWriter",{enumerable:!0,get:function(){return o.JSONWriter}});var s=r(70770);Object.defineProperty(t,"YAMLWriter",{enumerable:!0,get:function(){return s.YAMLWriter}})},73265:(e,t,r)=>{"use strict";r.d(t,{O:()=>a});var n=r(88824),i=r(50923);function a(e,t){if(!e?.length||!t.FrameOfReferenceUID)return;t.planeRestriction||={FrameOfReferenceUID:t.FrameOfReferenceUID,point:e[0],inPlaneVector1:null,inPlaneVector2:null};let{planeRestriction:r}=t;if(1===e.length)return r.inPlaneVector1=null,r.inPlaneVector2=null,r;let a=i.jb(i.vt(),e[0],e[Math.floor(e.length/2)]);i.S8(a,a),r.inPlaneVector1=a,r.inPlaneVector2=null;let o=e.length;if(o>2)for(let t=Math.floor(o/3);t{"use strict";r.d(t,{A:()=>i});let n={},i={get:e=>n[e],set:e=>{n[e.id]=e},delete:e=>delete n[e],getAll:()=>{let e=Object.keys(n).map(e=>n[e]);return e.sort((e,t)=>"_"===e.id[0]&&"_"!==t.id[0]?1:"_"!==e.id[0]&&"_"===t.id[0]?-1:0),e}}},73543:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>u});var n=r(17042),i=r(99298),a=r(5889),o=r(61052),s={glFramebuffer:null,colorBuffers:null,depthTexture:null,previousDrawBinding:0,previousReadBinding:0,previousDrawBuffer:0,previousReadBuffer:0,previousActiveFramebuffer:null};function l(e,t,r={}){Object.assign(t,s,r),(0,n.WL)(e,t),t.colorBuffers&&(0,n.Bl)("you cannot initialize colorBuffers through the constructor. You should call setColorBuffer() instead."),t.colorBuffers=[],(0,n._e)(e,t,["colorBuffers"]),t.classHierarchy.push("vtkFramebuffer"),e.getBothMode=()=>t.context.FRAMEBUFFER,e.saveCurrentBindingsAndBuffers=t=>{let r=void 0!==t?t:e.getBothMode();e.saveCurrentBindings(r),e.saveCurrentBuffers(r)},e.saveCurrentBindings=e=>{if(!t.context)return void(0,n.Bl)("you must set the OpenGLRenderWindow before calling saveCurrentBindings");t.previousDrawBinding=t.context.getParameter(t.context.FRAMEBUFFER_BINDING),t.previousActiveFramebuffer=t._openGLRenderWindow.getActiveFramebuffer()},e.saveCurrentBuffers=e=>{},e.restorePreviousBindingsAndBuffers=t=>{let r=void 0!==t?t:e.getBothMode();e.restorePreviousBindings(r),e.restorePreviousBuffers(r)},e.restorePreviousBindings=e=>{if(!t.context)return void(0,n.Bl)("you must set the OpenGLRenderWindow before calling restorePreviousBindings");let r=t.context;r.bindFramebuffer(r.FRAMEBUFFER,t.previousDrawBinding),t._openGLRenderWindow.setActiveFramebuffer(t.previousActiveFramebuffer)},e.restorePreviousBuffers=e=>{},e.bind=(r=null)=>{let n=r;null===n&&(n=t.context.FRAMEBUFFER),t.context.bindFramebuffer(n,t.glFramebuffer);for(let e=0;e{if(!t.context)return void(0,n.Bl)("you must set the OpenGLRenderWindow before calling create");t.glFramebuffer=t.context.createFramebuffer(),t.glFramebuffer.width=e,t.glFramebuffer.height=r},e.setColorBuffer=(e,r=0)=>{let i=t.context;if(!i)return void(0,n.Bl)("you must set the OpenGLRenderWindow before calling setColorBuffer");let a=i.COLOR_ATTACHMENT0;if(r>0)if(!t._openGLRenderWindow.getWebgl2())return void(0,n.Bl)("Using multiple framebuffer attachments requires WebGL 2");else a+=r;t.colorBuffers[r]=e,i.framebufferTexture2D(i.FRAMEBUFFER,a,i.TEXTURE_2D,e.getHandle(),0)},e.removeColorBuffer=(e=0)=>{let r=t.context;if(!r)return void(0,n.Bl)("you must set the OpenGLRenderWindow before calling removeColorBuffer");let i=r.COLOR_ATTACHMENT0;if(e>0)if(!t._openGLRenderWindow.getWebgl2())return void(0,n.Bl)("Using multiple framebuffer attachments requires WebGL 2");else i+=e;r.framebufferTexture2D(r.FRAMEBUFFER,i,r.TEXTURE_2D,null,0),t.colorBuffers=t.colorBuffers.splice(e,1)},e.setDepthBuffer=e=>{if(!t.context)return void(0,n.Bl)("you must set the OpenGLRenderWindow before calling setDepthBuffer");if(t._openGLRenderWindow.getWebgl2()){let r=t.context;r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,e.getHandle(),0)}else(0,n.Bl)("Attaching depth buffer textures to fbo requires WebGL 2")},e.removeDepthBuffer=()=>{if(!t.context)return void(0,n.Bl)("you must set the OpenGLRenderWindow before calling removeDepthBuffer");if(t._openGLRenderWindow.getWebgl2()){let e=t.context;e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,null,0)}else(0,n.Bl)("Attaching depth buffer textures to framebuffers requires WebGL 2")},e.getGLFramebuffer=()=>t.glFramebuffer,e.setOpenGLRenderWindow=r=>{t._openGLRenderWindow!==r&&(e.releaseGraphicsResources(),t._openGLRenderWindow=r,t.context=null,r&&(t.context=t._openGLRenderWindow.getContext()))},e.releaseGraphicsResources=()=>{t.glFramebuffer&&t.context.deleteFramebuffer(t.glFramebuffer)},e.getSize=()=>null==t.glFramebuffer?null:[t.glFramebuffer.width,t.glFramebuffer.height],e.populateFramebuffer=()=>{if(!t.context)return void(0,n.Bl)("you must set the OpenGLRenderWindow before calling populateFrameBuffer");e.bind();let r=t.context,s=o.Ay.newInstance();s.setOpenGLRenderWindow(t._openGLRenderWindow),s.setMinificationFilter(a.dJ.LINEAR),s.setMagnificationFilter(a.dJ.LINEAR),s.create2DFromRaw({width:t.glFramebuffer.width,height:t.glFramebuffer.height,numComps:4,dataType:i.JA.UNSIGNED_CHAR,data:null}),e.setColorBuffer(s),t.depthTexture=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,t.depthTexture),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_COMPONENT16,t.glFramebuffer.width,t.glFramebuffer.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,t.depthTexture)},e.getColorTexture=()=>t.colorBuffers[0]}var u={newInstance:(0,n.UI)(l,"vtkFramebuffer"),extend:l}},73588:(e,t,r)=>{"use strict";function n(e){let{imageData:t,dimensions:r}=e.getImageData()||{};if(!t||!r)return[];let{canvas:n}=e,a=window.devicePixelRatio,o=[n.width/a,0],s=[n.width/a,n.height/a],l=[0,n.height/a],u=e.canvasToWorld([0,0]),c=e.canvasToWorld(o),d=e.canvasToWorld(s),p=e.canvasToWorld(l),m=t.worldToIndex(u),h=t.worldToIndex(c),f=t.worldToIndex(d),g=t.worldToIndex(p);return function({dimensions:e,imageData:t,topLeftImage:r,topRightImage:n,bottomRightImage:a,bottomLeftImage:o,topLeftWorld:s,topRightWorld:l,bottomRightWorld:u,bottomLeftWorld:c}){let d=i(r,e)?s:t.indexToWorld([0,0,0]),p=i(n,e)?l:t.indexToWorld([e[0]-1,0,0]),m=i(a,e)?u:t.indexToWorld([e[0]-1,e[1]-1,0]);return[d,p,i(o,e)?c:t.indexToWorld([0,e[1]-1,0]),m]}({dimensions:r,imageData:t,topLeftImage:m,topRightImage:h,bottomRightImage:f,bottomLeftImage:g,topLeftWorld:u,topRightWorld:c,bottomRightWorld:d,bottomLeftWorld:p})}function i(e,t){return e[0]>0||e[0]0||e[1]0||e[2]n})},73589:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});class n{constructor(e){this.state=Object.freeze(e)}toICamera(){return this.cachedICamera||=this.buildICamera(),this.cachedICamera}}let i=n},73951:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.create_domImplementation=function(e){return n.DOMImplementationImpl._create(e)},t.create_window=function(){return i.WindowImpl._create()},t.create_xmlDocument=function(){return new a.XMLDocumentImpl},t.create_document=function(){return new o.DocumentImpl},t.create_abortController=function(){return new s.AbortControllerImpl},t.create_abortSignal=function(){return l.AbortSignalImpl._create()},t.create_documentType=function(e,t,r,n){return u.DocumentTypeImpl._create(e,t,r,n)},t.create_element=function(e,t,r,n){return c.ElementImpl._create(e,t,r,n)},t.create_htmlElement=function(e,t,r,n){return c.ElementImpl._create(e,t,r,n)},t.create_htmlUnknownElement=function(e,t,r,n){return c.ElementImpl._create(e,t,r,n)},t.create_documentFragment=function(e){return d.DocumentFragmentImpl._create(e)},t.create_shadowRoot=function(e,t){return p.ShadowRootImpl._create(e,t)},t.create_attr=function(e,t){return m.AttrImpl._create(e,t)},t.create_text=function(e,t){return h.TextImpl._create(e,t)},t.create_cdataSection=function(e,t){return f.CDATASectionImpl._create(e,t)},t.create_comment=function(e,t){return g.CommentImpl._create(e,t)},t.create_processingInstruction=function(e,t,r){return v.ProcessingInstructionImpl._create(e,t,r)},t.create_htmlCollection=function(e,t=()=>!0){return y.HTMLCollectionImpl._create(e,t)},t.create_nodeList=function(e){return b.NodeListImpl._create(e)},t.create_nodeListStatic=function(e,t){return I.NodeListStaticImpl._create(e,t)},t.create_namedNodeMap=function(e){return x.NamedNodeMapImpl._create(e)},t.create_range=function(e,t){return C.RangeImpl._create(e,t)},t.create_nodeIterator=function(e,t,r){return A.NodeIteratorImpl._create(e,t,r)},t.create_treeWalker=function(e,t){return T.TreeWalkerImpl._create(e,t)},t.create_nodeFilter=function(){return S.NodeFilterImpl._create()},t.create_mutationRecord=function(e,t,r,n,i,a,o,s,l){return w.MutationRecordImpl._create(e,t,r,n,i,a,o,s,l)},t.create_domTokenList=function(e,t){return O.DOMTokenListImpl._create(e,t)};let n=r(76763),i=r(12323),a=r(99445),o=r(81294),s=r(13123),l=r(83567),u=r(44862),c=r(83553),d=r(43918),p=r(11623),m=r(71784),h=r(30696),f=r(69287),g=r(14171),v=r(60780),y=r(11526),b=r(19275),I=r(74709),x=r(62750),C=r(58764),A=r(22477),T=r(84745),S=r(68937),w=r(61273),O=r(50138)},73971:(e,t,r)=>{"use strict";r.d(t,{A:()=>h});var n=r(49007),i=r(20552),a=r(88129),o=r(78378),s=r(6001),l=r(43385),u=r(66442),c=r(87195),d=r(51200),p=r(75246);class m{constructor(e,...t){this._initialize=[],this._fill=[],this._onInteractionStart=[],this.fill=(e,t)=>{let r=this.initialize(e,t,o.Yh.Fill);if(!r)return;let i=!(0,p.v)(r.viewport)||!r.previewOnHover,a=r.segmentationVoxelManager,m=r.segmentationImageData;if(i&&function(e){let t=(0,l.T)(e.segmentationId);if(!t)return;e.overwriteSegmentIndices=function(e){let{segmentationId:t,segmentIndex:r,segmentsLocked:n,viewport:i}=e,a=(0,l.T)(t);if(!a||0===r)return[];let s=(0,c.zj)().segmentation?.overwriteMode??"all";if("none"===s)return[];let u=Object.keys(a.segments).map(Number).filter(e=>e!==r&&!n.includes(e));if("all"===s)return u;let p=(0,d.Ut)(i.id,{segmentationId:t,type:o.D_.Labelmap});return p?.visible?u.filter(e=>p.segments[e]?.visible!==!1):[]}(e);let r=(0,u.Qk)(t,{segmentIndex:e.segmentIndex,overwriteSegmentIndices:e.overwriteSegmentIndices,segmentationVoxelManager:e.segmentationVoxelManager,segmentationImageData:e.segmentationImageData,isInObject:e.isInObject,isInObjectBoundsIJK:e.isInObjectBoundsIJK});if(e.labelmapEditTransaction=r,e.labelValue=r.labelValue,e.labelmapId=r.labelmapId,e.crossLayerEraseBindings=r.crossLayerEraseBindings,r.movedSegment&&r.activeLayer){let t=(0,u.VQ)(r.activeLayer,{viewport:e.viewport,imageId:e.imageId,sourceLayer:r.sourceLayer});t.imageId&&(e.imageId=t.imageId),t.imageData&&(e.segmentationImageData=t.imageData),t.voxelManager&&(e.segmentationVoxelManager=t.voxelManager)}}(r),r.memo?.segmentationVoxelManager!==r.segmentationVoxelManager){let e=r.memo;r.memo=r.createMemo(r.segmentationId,r.segmentationVoxelManager),e&&e!==r.memo&&e.commitMemo?.()&&(r.memo.priorSteps||=[]).push((0,s.hO)(e))}let h=r.labelmapEditTransaction?.moveStep;if(h&&r.memo){let{segmentationId:e}=r;(r.memo.priorSteps||=[]).push({undo:()=>{h.undo(),(0,n.triggerSegmentationDataModified)(e)},redo:()=>{h.redo(),(0,n.triggerSegmentationDataModified)(e)}})}(r.segmentationVoxelManager!==a||r.segmentationImageData!==m)&&this._initialize.forEach(e=>e(r)),this._fill.forEach(e=>e(r));let{segmentationVoxelManager:f,segmentIndex:g}=r,v=function(e){let t=(0,l.T)(e.segmentationId);if(!t)return[];let{memo:r}=e;return(0,u.Ry)(t,e.labelmapEditTransaction,{viewport:e.viewport,referenceImageData:e.segmentationImageData,isInObject:e.isInObject,isInObjectBoundsIJK:e.isInObjectBoundsIJK,imageId:e.imageId,crossLayerEraseCallback:r?({voxelManager:t,labelValue:i,indices:a})=>{(r.postSteps||=[]).push({undo:()=>{for(let e of a)t.setAtIndex(e,i);(0,n.triggerSegmentationDataModified)(e.segmentationId)},redo:()=>{for(let e of a)t.setAtIndex(e,0);(0,n.triggerSegmentationDataModified)(e.segmentationId)}})}:void 0})}(r),y=new Set([...f.getArrayOfModifiedSlices()??[],...v]);return(0,n.triggerSegmentationDataModified)(r.segmentationId,Array.from(y),g),r},this.onInteractionStart=(e,t)=>{let r=this.initialize(e,t);r&&this._onInteractionStart.forEach(e=>e.call(this,r))},this.addPreview=(e,t)=>{let r=this.initialize(e,t,o.Yh.AddPreview);if(r)return r},this.configurationName=e;let r=t.find(e=>e.hasOwnProperty(o.Yh.CalculateCursorGeometry)),a=t.find(e=>e.hasOwnProperty(o.Yh.RenderCursor));for(let e of(r||t.push({[o.Yh.CalculateCursorGeometry]:i.A.circularCursor.calculateCursorGeometry}),a||t.push({[o.Yh.RenderCursor]:i.A.circularCursor.renderCursor}),this.compositions=t,t.forEach(e=>{let t="function"==typeof e?e():e;if(t)for(let e in t){if(!m.childFunctions[e])throw Error(`Didn't find ${e} as a brush strategy`);m.childFunctions[e](this,t[e])}}),this.strategyFunction=(e,t)=>this.fill(e,t),Object.keys(m.childFunctions)))this.strategyFunction[e]=this[e]}initialize(e,t,r){let{viewport:n}=e,i=(0,a.S)({operationData:t,viewport:n,strategy:this});if(!i||!i.imageVoxelManager||!i.segmentationVoxelManager||!i.segmentationImageData)return null;let{imageVoxelManager:o,segmentationVoxelManager:s,segmentationImageData:l}=i,u=t.createMemo(t.segmentationId,s),c={operationName:r,...t,segmentIndex:t.segmentIndex,enabledElement:e,imageVoxelManager:o,segmentationVoxelManager:s,segmentationImageData:l,viewport:n,centerWorld:null,isInObject:null,isInObjectBoundsIJK:null,brushStrategy:this,memo:u};return this._initialize.forEach(e=>e(c)),c}}m.COMPOSITIONS=i.A,m.childFunctions={[o.Yh.OnInteractionStart]:f(o.Yh.OnInteractionStart,o.Yh.Initialize),[o.Yh.OnInteractionEnd]:f(o.Yh.OnInteractionEnd,o.Yh.Initialize),[o.Yh.Fill]:f(o.Yh.Fill),[o.Yh.Initialize]:f(o.Yh.Initialize),[o.Yh.CreateIsInThreshold]:g(o.Yh.CreateIsInThreshold),[o.Yh.Interpolate]:f(o.Yh.Interpolate,o.Yh.Initialize),[o.Yh.AcceptPreview]:f(o.Yh.AcceptPreview,o.Yh.Initialize),[o.Yh.RejectPreview]:f(o.Yh.RejectPreview,o.Yh.Initialize),[o.Yh.INTERNAL_setValue]:g(o.Yh.INTERNAL_setValue),[o.Yh.Preview]:g(o.Yh.Preview,!1),[o.Yh.ComputeInnerCircleRadius]:f(o.Yh.ComputeInnerCircleRadius),[o.Yh.EnsureSegmentationVolumeFor3DManipulation]:f(o.Yh.EnsureSegmentationVolumeFor3DManipulation),[o.Yh.EnsureImageVolumeFor3DManipulation]:f(o.Yh.EnsureImageVolumeFor3DManipulation),[o.Yh.AddPreview]:f(o.Yh.AddPreview),[o.Yh.GetStatistics]:g(o.Yh.GetStatistics),[o.Yh.CalculateCursorGeometry]:g(o.Yh.CalculateCursorGeometry,!0),[o.Yh.RenderCursor]:g(o.Yh.RenderCursor,!0),compositions:null};let h=m;function f(e,t){let r=`_${e}`;return(n,i)=>{n[r]||=[],n[r].push(i),n[e]||=t?(i,a,...o)=>{let s,l=n[t](i,a,e);return n[r].forEach(e=>{let t=e.call(n,l,...o);s||=t}),s}:(e,...t)=>{n[r].forEach(r=>r.call(n,e,...t))}}}function g(e,t=!0){return(r,n)=>{if(r[e])throw Error(`The singleton method ${e} already exists`);r[e]=t?n:(e,t,...i)=>(t.enabledElement=e,n.call(r,t,...i))}}},74065:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(70192),i=r(33845),a=r(93022);function o(e,t,r,o){let{canvasToWorld:s,worldToCanvas:l}=r,{data:u}=e,{targetWindingDirection:c}=t,{points:d}=t,p=i.XL.getWindingDirection(d);o?.decimate?.enabled&&(d=i.XL.decimate(t.points,o?.decimate?.epsilon));let{closed:m}=t,h=d.length,f=Array(h);i.XL.getWindingDirection(d);let g=(0,a.getParentAnnotation)(e);if(void 0===m){let e=!1;if(d.length>3){let t=i.zx.distanceToPointSquared(d[0],d[h-1]);e=n.BF.isEqual(0,t)}m=e}if(o?.updateWindingDirection!==!1){let e=g?-1*g.data.contour.windingDirection:c;void 0===e&&(e=p),e!==p&&d.reverse();let t=(u.handles?.points??[]).map(l);t.length>2&&i.XL.getWindingDirection(t)!==e&&u.handles.points.reverse(),p=e}for(let e=0;e{"use strict";r.d(t,{A:()=>i});class n{constructor(){this._initializeConfig({color:"rgb(255, 255, 0)",colorHighlighted:"rgb(0, 255, 0)",colorSelected:"rgb(0, 220, 0)",colorLocked:"rgb(209, 193, 90)",lineWidth:"1",lineDash:"",shadow:!0,textBoxVisibility:!0,textBoxFontFamily:"Helvetica Neue, Helvetica, Arial, sans-serif",textBoxFontSize:"14px",textBoxColor:"rgb(255, 255, 0)",textBoxColorHighlighted:"rgb(0, 255, 0)",textBoxColorSelected:"rgb(0, 255, 0)",textBoxColorLocked:"rgb(209, 193, 90)",textBoxBackground:"",textBoxLinkLineWidth:"1",textBoxLinkLineDash:"2,3",textBoxShadow:!0,markerSize:"10",angleArcLineDash:""})}getAnnotationToolStyles(e){return this.config.annotations&&this.config.annotations[e]}getViewportToolStyles(e){return this.config.viewports&&this.config.viewports[e]}getToolGroupToolStyles(e){return this.config.toolGroups&&this.config.toolGroups[e]}getDefaultToolStyles(){return this.config.default}setAnnotationStyles(e,t){let r=this.config.annotations;r||(this.config={...this.config,annotations:{}},r=this.config.annotations),r[e]=t}setViewportToolStyles(e,t){let r=this.config.viewports;r||(this.config={...this.config,viewports:{}},r=this.config.viewports),r[e]=t}setToolGroupToolStyles(e,t){let r=this.config.toolGroups;r||(this.config={...this.config,toolGroups:{}},r=this.config.toolGroups),r[e]=t}setDefaultToolStyles(e){this.config.default=e}getStyleProperty(e,t){let{annotationUID:r,viewportId:n,toolGroupId:i,toolName:a}=t;return this._getToolStyle(e,r,n,i,a)}_getToolStyle(e,t,r,n,i){if(t){let r=this.getAnnotationToolStyles(t);if(r&&void 0!==r[e])return r[e]}if(r){let t=this.getViewportToolStyles(r);if(t){if(t[i]&&void 0!==t[i][e])return t[i][e];if(t.global&&void 0!==t.global[e])return t.global[e]}}if(n){let t=this.getToolGroupToolStyles(n);if(t){if(t[i]&&void 0!==t[i][e])return t[i][e];if(t.global&&void 0!==t.global[e])return t.global[e]}}let a=this.getDefaultToolStyles();return a[i]&&void 0!==a[i][e]?a[i][e]:a.global&&void 0!==a.global[e]?a.global[e]:void 0}_initializeConfig(e){let t={};for(let r in e)t[r]=e[r];this.config={default:{global:t}}}}let i=new n},74092:(e,t,r)=>{"use strict";function n(e){let t=e.getSize(),r=[];for(let n=0;n{e.addRGBPoint(...t)}))}r.r(t),r.d(t,{getTransferFunctionNodes:()=>n,setTransferFunctionNodes:()=>i})},74709:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeListStaticImpl=void 0;let n=r(60957),i=r(16950);class a{_live=!1;_root;_filter;_items=[];_length=0;constructor(e){return this._root=e,this._items=[],this._filter=function(e){return!0},new Proxy(this,this)}get length(){return this._items.length}item(e){return e<0||e>this.length-1?null:this._items[e]}keys(){return{[Symbol.iterator]:(function(){let e=0;return{next:(function(){return e===this.length?{done:!0,value:null}:{done:!1,value:e++}}).bind(this)}}).bind(this)}}values(){return{[Symbol.iterator]:(function(){let e=this[Symbol.iterator]();return{next:()=>e.next()}}).bind(this)}}entries(){return{[Symbol.iterator]:(function(){let e=this[Symbol.iterator](),t=0;return{next(){let r=e.next();return r.done?{done:!0,value:null}:{done:!1,value:[t++,r.value]}}}}).bind(this)}}[Symbol.iterator](){let e=this._items[Symbol.iterator]();return{next:()=>e.next()}}forEach(e,t){void 0===t&&(t=n.dom.window);let r=0;for(let n of this._items)e.call(t,n,r++,this)}get(e,t,r){if(!(0,i.isString)(t))return Reflect.get(e,t,r);let n=Number(t);return isNaN(n)?Reflect.get(e,t,r):e._items[n]||void 0}set(e,t,r,n){if(!(0,i.isString)(t))return Reflect.set(e,t,r,n);let a=Number(t);return isNaN(a)?Reflect.set(e,t,r,n):a>=0&&a{"use strict";r.d(t,{A:()=>i});var n=r(50923);function i(e,t){let{direction:r,spacing:i}=e,a=r.slice(0,3),o=r.slice(3,6),s=r.slice(6,9),l=[n.Om(a,t),n.Om(o,t),n.Om(s,t)],u=n.vt();return n.hZ(u,l[0]*i[0],l[1]*i[1],l[2]*i[2]),n.Bw(u)}},74832:(e,t,r)=>{"use strict";r.d(t,{c:()=>l,P:()=>s});var n=r(77280),i=r(12668);let a={zoom:!0,pan:!0};function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function s(e){let{viewport:t}=e,r=e.viewState??t.getViewState?.();if(!r)return;let n=(0,i.$3)(r),a=e.resolvedView??t.getResolvedView?.(),o=e.canvasWidth??a?.state?.canvas?.clientWidth??t.canvas?.clientWidth??t.element?.clientWidth??1,s=e.canvasHeight??a?.state?.canvas?.clientHeight??t.canvas?.clientHeight??t.element?.clientHeight??1,l=[o/2,s/2],u=a?.canvasToWorld(l),c=a?.zoom??Math.max(n.scale??1,.001),d=a?.pan??[0,0],p=a?.toICamera(),m=e.frameOfReferenceUID??a?.getFrameOfReferenceUID()??t.getFrameOfReferenceUID?.();return{kind:"ecg",adapterId:"ecg",canvasHeight:s,canvasWidth:o,dataId:e.dataId,frameOfReferenceUID:m,presentation:{pan:[d[0],d[1]],position:function(e,t){if(e)return{kind:"signalPoint",sampleIndex:e[0],value:e[1],channelIndex:e[2],canvasPoint:t}}(u,l),rawPan:[d[0],d[1]],scale:function(e,t){if(!e)return{kind:"fit",value:t};let r=e.canvasToWorld([0,0]),n=e.canvasToWorld([1,0]),i=e.canvasToWorld([0,1]);return{kind:"signal",samplesPerCanvasPixel:Math.abs(n[0]-r[0])||0,valueUnitsPerCanvasPixel:Math.abs(i[1]-r[1])||0}}(a,c),zoom:c},rendererCamera:p,resolvedView:a,spaces:{canvas:!0,image:!1,renderer:!!p,world:!!a},transforms:a?{canvasToWorld:e=>a.canvasToWorld(e),worldToCanvas:e=>a.worldToCanvas(e)}:void 0,viewState:n,viewportType:t.type}}let l={id:"ecg",viewportTypes:[n.NV.ECG_NEXT],getSnapshot:e=>s(e),getPresentation:(e,t)=>(function(e,t){let r={},n=t??a,i=e.presentation.zoom??1;if(n.zoom&&(r.zoom=i),n.pan){let t=e.presentation.rawPan;r.pan=[t[0]/i,t[1]/i]}return r})(e,t),withPresentation:(e,t,r)=>(function(e,t,r={}){let n=e.viewState,a=o(t,"zoom"),s=o(t,"pan"),l=Math.max(t.zoom??e.presentation.zoom??n.scale??1,.001),u=e.resolvedView,c=(0,i.$3)(n);if(a&&(u?(u=u.withZoom(l,r.anchorCanvas),c=(0,i.$3)(u.state.viewState)):c=(0,i.$3)({...c,scale:l,scaleMode:"fit"})),s&&t.pan){let e=[t.pan[0]*l,t.pan[1]*l];u&&(c=(0,i.$3)(u.withPan(e).state.viewState))}return c})(e,t,r)}},74840:(e,t,r)=>{"use strict";r.d(t,{s:()=>i});var n=r(51200);function i(e,t){let r=(0,n.Ut)(e,t);return r?Object.entries(r.segments).reduce((e,[t,r])=>(r.visible||e.add(Number(t)),e),new Set):new Set}},74842:(e,t,r)=>{"use strict";function n(e,t){return!(e[0]<0)&&!(e[0]>=t[0])&&!(e[1]<0)&&!(e[1]>=t[1])&&!(e[2]<0)&&!(e[2]>=t[2])}r.d(t,{A:()=>n})},74885:(e,t,r)=>{"use strict";r.d(t,{e:()=>Y});var n=r(89473),i=r(12412),a=r(17042),o=r(87352),s=r(19047),l=r(37216);r(47535);var u=r(46023),c={ASCII:"ascii",BINARY_LITTLE_ENDIAN:"binary_little_endian"},d={diffuse_red:"red",diffuse_green:"green",diffuse_blue:"blue"},p={patternHeader:/ply([\s\S]*)end_header\r?\n/,patternBody:/end_header\s([\s\S]*)$/};function m(e){let t,r,n,i="",a=0,o=p.patternHeader.exec(e);null!==o&&(i=o[1],a=o[0].length);let s={comments:[],elements:[],headerLength:a},l=i.split("\n");for(let e=0;e"vertex"===e.name),a=t.find(e=>"face"===e.name),l=0,u=0;i&&(l=i.count),a&&(u=a.count);let c=new Float32Array(3*l),d=new Uint8Array(3*l),p=new Float32Array(2*l),m=new Float32Array(3*l),h=e.colors.length>0,f=e.uvs.length>0,g=e.normals.length>0,v=e.faceVertexUvs.length>0,y=new Map,b=l;for(let t=0;t0){let t=0,i=0;if(n){let n=[],a=[],o=[],s=[];for(let l=0;lr||Math.abs(v[1]-f[1])>r){let u=`${f[0]},${f[1]}`,p=-1;if(y.has(u)){let e=y.get(u);for(let t=0,n=e.length;t0){let e=l+n.length/3,t=new Float32Array(3*e),r=new Float32Array(2*e),i=h?new Uint8Array(3*e):null,u=g?new Float32Array(3*e):null;t.set(c),r.set(p),h&&i&&i.set(d),g&&u&&u.set(m),t.set(n,3*l),r.set(s,2*l),h&&i&&i.set(a,3*l),g&&u&&u.set(o,3*l),c=t,p=r,h&&(d=i),g&&(m=u)}}else for(let r=0;r0)I.getPolys().setData(Uint32Array.from(e.indices));else{let e=new Uint32Array(2*l);for(let t=0;t0&&(e.indices.push(t.length),t.forEach((t,r)=>{e.indices.push(t)})),e.faceVertexUvs.push(n)}}function v(e,t,r,n){let i;switch(r){case"int8":case"char":i=[e.getInt8(t),1];break;case"uint8":case"uchar":i=[e.getUint8(t),1];break;case"int16":case"short":i=[e.getInt16(t,n),2];break;case"uint16":case"ushort":i=[e.getUint16(t,n),2];break;case"int32":case"int":i=[e.getInt32(t,n),4];break;case"uint32":case"uint":i=[e.getUint32(t,n),4];break;case"float32":case"float":i=[e.getFloat32(t,n),4];break;case"float64":case"double":i=[e.getFloat64(t,n),8];break;default:console.log("Unsupported type")}return i}var y={faceTextureTolerance:1e-6,duplicatePointsForFaceTexture:!0},b={newInstance:a.Ay.newInstance(function(e,t,r={}){Object.assign(t,y,r),a.Ay.obj(e,t),a.Ay.get(e,t,["url","baseURL","duplicatePointsForFaceTexture","faceTextureTolerance"]),a.Ay.setGet(e,t,["dataAccessHelper"]),a.Ay.algo(e,t,0,1),t.classHierarchy.push("vtkPLYReader"),t.dataAccessHelper||(t.dataAccessHelper=l.Ay.get("http")),e.setUrl=(r,n={binary:!0})=>{t.url=r;let i=r.split("/");return i.pop(),t.baseURL=i.join("/"),t.compression=n.compression,e.loadData({progressCallback:n.progressCallback,binary:!!n.binary})},e.loadData=(r={})=>(function(r,n={}){let{compression:i,progressCallback:a}=t;return n.binary?t.dataAccessHelper.fetchBinary(r,{compression:i,progressCallback:a}):t.dataAccessHelper.fetchText(e,r,{compression:i,progressCallback:a})})(t.url,r).then(e.parse),e.parse=t=>{"string"==typeof t?e.parseAsText(t):e.parseAsArrayBuffer(t)},e.parseAsArrayBuffer=r=>{let n;if(!r||r===t.parseData)return;e.modified();let i=r;r instanceof ArrayBuffer&&(i=u.A.arrayBufferToString(r));let a=m(i);if(a.format===c.ASCII)return void e.parseAsText(i);t.parseData=r;let o={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[]},s=a.format===c.BINARY_LITTLE_ENDIAN,l=new DataView(r instanceof ArrayBuffer?r:r.buffer,a.headerLength),d=0;for(let e=0;e{if(!r||r===t.parseData)return;e.modified(),t.parseData=r;let n=r;r instanceof ArrayBuffer&&(n=u.A.arrayBufferToString(r));let i=m(n);if(i.format!==c.ASCII)return void e.parseAsArrayBuffer(r);let a={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[]},o=p.patternBody.exec(n),s="";null!==o&&(s=o[1]);let l=s.split("\n"),d=0,v=0;for(let e=0;e=i.elements[d].count&&(d++,v=0);let e=function(e,t){let r=t.split(/\s+/),n={};for(let t=0;t{e.parse(t.parseData)},t.compression||(t.compression=null),t.progressCallback||(t.progressCallback=null)},"vtkPLYReader")},I=r(48185),x=r(30536),C=r(11701),A=r(73416),T=r(58804),S={dataSet:null,maxLevel:8,level:8,automatic:!1,tolerance:0,useExistingSearchStructure:!1},w={extend:function(e,t,r={}){Object.assign(t,S,r),a.Ay.obj(e,t),a.Ay.get(e,t,["level"]),a.Ay.setGet(e,t,["dataSet","maxLevel","automatic","tolerance","useExistingSearchStructure"]),t.classHierarchy.push("vtkLocator")}},O={extend:function(e,t,r={}){w.extend(e,t,{bounds:null,numberOfBuckets:0,...r}),a.Ay.obj(e,t),a.Ay.get(e,t,["numberOfBuckets"]),a.Ay.setGetArray(e,t,["bounds"],6),t.classHierarchy.push("vtkAbstractPointLocator")}},{vtkErrorMacro:P}=a.Ay;function _(e,t,r={}){O.extend(e,t,{divisions:[50,50,50],numberOfPointsPerBucket:3,bounds:[0,0,0,0,0,0],tolerance:.001,automatic:!0,...r}),a.Ay.setGet(e,t,["numberOfPointsPerBucket","points"]),a.Ay.setGetArray(e,t,["divisions"],3),C.Ay.uninitializeBounds(t.bounds),t.points=t.points||x.Ay.newInstance(),t.hashTable=new Map,t.H=[0,0,0],t.insertionPointId=0,t.insertionTol2=1e-4,t.insertionLevel=0;function n(e,t,r){let n=[];if(0===r)return n.push([...e]),n;let i=[],a=[];for(let n=0;n<3;n++){let o=e[n]-r,s=e[n]+r;i[n]=o>0?o:0,a[n]=s{let r=Math.floor((e[0]-t.BX)*t.FX),n=Math.floor((e[1]-t.BY)*t.FY),i=Math.floor((e[2]-t.BZ)*t.FZ),a=[];return a[0]=Math.max(0,Math.min(r,t.XD-1)),a[1]=Math.max(0,Math.min(n,t.YD-1)),a[2]=Math.max(0,Math.min(i,t.ZD-1)),a},e.getBucketIndex=t=>i(e.getBucketIndices(t)),e.buildLocator=()=>{t.level=1;let r=t.dataSet.getBounds(),n=t.dataSet.getNumberOfPoints(),i=Math.ceil(n/t.numberOfPointsPerBucket),a=[0,0,0],o=T.Ay.newInstance();if(o.setBounds(r),t.automatic)o.computeDivisions(i,a,t.bounds);else{t.bounds=o.inflate();for(let e=0;e<3;e++)a[e]=Math.max(1,t.divisions[e])}t.divisions=a,t.numberOfBuckets=i=a[0]*a[1]*a[2];for(let e=0;e<3;++e)t.H[e]=(t.bounds[2*e+1]-t.bounds[2*e])/a[e];t.hashTable.clear(),e.computePerformanceFactors();for(let r=0;r{t.points=null,e.freeSearchStructure()},e.initPointInsertion=(r,n,i=0)=>{if(null==r)return P("A valid vtkPoints object is required for point insertion"),!1;if(!n||6!==n.length)return P("A valid bounds array of length 6 is required"),!1;if(!r)return P("A valid vtkPoints is required for point insertion"),!1;e.freeSearchStructure(),t.insertionPointId=0,t.points=r,t.points.setNumberOfComponents(3),t.points.initialize();let a=0,o=[0,0,0],s=T.Ay.newInstance();if(s.setBounds(n),t.automatic&&i>0)a=Math.ceil(i/t.numberOfPointsPerBucket),s.computeDivisions(a,o,t.bounds);else{t.bounds=s.inflate();for(let e=0;e<3;e++)o[e]=Math.max(1,t.divisions[e])}t.divisions=o,t.numberOfBuckets=a=o[0]*o[1]*o[2];for(let e=0;e<3;++e)t.H[e]=(t.bounds[2*e+1]-t.bounds[2*e])/o[e];t.insertionTol2=t.tolerance*t.tolerance;let l=0,u=Number.MAX_VALUE;for(let e=0;e<3;e++)u=t.H[e]t.divisions[e]?l:t.divisions[e];return t.insertionLevel=Math.ceil(t.tolerance/u),t.insertionLevel=t.insertionLevel>l?l:t.insertionLevel,e.computePerformanceFactors(),!0},e.insertPoint=(r,n)=>{let i=e.getBucketIndex(n);return t.hashTable.has(i)||t.hashTable.set(i,[]),t.hashTable.get(i).push(r),t.points.insertPoint(r,n),{inserted:!0,id:r}},e.insertNextPoint=r=>{let n=e.getBucketIndex(r);return t.hashTable.has(n)||t.hashTable.set(n,[]),t.hashTable.get(n).push(t.insertionPointId),t.points.insertPoint(t.insertionPointId,r),{inserted:!0,id:t.insertionPointId++}},e.insertUniquePoint=t=>{let r=e.isInsertedPoint(t);return r>-1?{inserted:!1,id:r}:e.insertNextPoint(t)},e.isInsertedPoint=r=>{let a=e.getBucketIndices(r),o=t.insertionLevel??1,s=t.divisions;for(let e=0;e<=o;e++){let o=n(a,s,e);for(let e=0;e{e.buildLocator();let a=e.getBucketIndices(r),o=t.divisions,s=Number.MAX_VALUE,l=-1,u=Math.max(...o);for(let e=0;e{let o,s;e.buildLocator();let l=-1,u=r*r,c=1.01*u,d=-1,p=e.getBucketIndices(n),m=i(p),h=t.hashTable.get(m);if(h)for(let e=0;ee&&(o=e,s=e*e)}let f=[0,0,0];for(let e=0;e<3;e++)f[e]=Math.floor(o/t.H[e]),f[e]>t.divisions[e]/2&&(f[e]=Math.floor(t.divisions[e]/2));let g=Math.max(...f);0===g&&(g=1);for(let r=g;r>=1;r--){let a=o,u=function(t,r,n,i){let a=[],o=[t[0],t[0],t[1],t[1],t[2],t[2]],s=T.Ay.newInstance();s.setBounds(o),s.inflate(n);let l=[r[0],r[0],r[1],r[1],r[2],r[2]],u=T.Ay.newInstance();u.setBounds(l),u.inflate(i);let c=e.getBucketIndices([s.getBounds()[0],s.getBounds()[2],s.getBounds()[4]]),d=e.getBucketIndices([s.getBounds()[1],s.getBounds()[3],s.getBounds()[5]]);for(let e=c[0];e<=d[0];e++)for(let t=c[1];t<=d[1];t++)for(let r=c[2];r<=d[2];r++)u.containsPoint(e,t,r)||a.push([e,t,r]);return a}(n,p,o/r,r);for(let e=0;e2&&(r=Math.floor(o/a*r)+1)<2&&(r=2)}return -1!==l&&c<=r*r?d=c:l=-1,{id:l,dist2:d}},e.findClosestInsertedPoint=r=>{for(let e=0;e<3;e++)if(r[e]t.bounds[2*e+1])return -1;let i=e.getBucketIndices(r),a=t.divisions,o=-1,s=Number.MAX_VALUE,l=0,u=Math.max(a[0],a[1],a[2]),c=t.points;for(;-1===o&&ln[e]?n[e]+1:n[e],s=t.bounds[2*e]+o*t.H[e]-r[e];a+=s*s}if(a{e.buildLocator();let n=e.getBucketIndex(r),i=t.hashTable.get(n);return i||[]},e.freeSearchStructure=()=>{t.hashTable.clear(),t.points=x.Ay.newInstance(),t.divisions=[50,50,50],C.Ay.uninitializeBounds(t.bounds)},e.computePerformanceFactors=()=>{t.HX=t.H[0],t.HY=t.H[1],t.HZ=t.H[2],t.FX=1/t.H[0],t.FY=1/t.H[1],t.FZ=1/t.H[2],t.BX=t.bounds[0],t.BY=t.bounds[2],t.BZ=t.bounds[4],t.XD=t.divisions[0],t.YD=t.divisions[1],t.ZD=t.divisions[2],t.sliceSize=t.divisions[0]*t.divisions[1]},e.generateRepresentation=e=>{if(!t.hashTable||0===t.hashTable.size)return void P("Can't build representation, no data provided!");let r=[];function n(e,n,i,a,o,s){let l=t.bounds[0]+n*t.HX,u=t.bounds[2]+i*t.HY,c=t.bounds[4]+a*t.HZ,d=l+t.HX,p=u+t.HY,m=c+t.HZ;0===e?(r[0]=[l,u,c],r[1]=[l,p,c],r[2]=[l,p,m],r[3]=[l,u,m]):1===e?(r[0]=[l,u,c],r[1]=[d,u,c],r[2]=[d,u,m],r[3]=[l,u,m]):2===e&&(r[0]=[l,u,c],r[1]=[d,u,c],r[2]=[d,p,c],r[3]=[l,p,c]);let h=r.map(e=>o.insertNextPoint(...e));s.insertNextCell([h[0],h[1],h[2],h[3]])}r.length=4;let i=x.Ay.newInstance();i.allocate(5e3);let a=A.Ay.newInstance();a.allocate(2048);let o=t.divisions,s=o[0]*o[1];for(let e=0;e=o[0]||r<0||r>=o[1]||n<0||n>=o[2])return!1;let i=e+r*o[0]+n*s;return t.hashTable.has(i)}(d,p,m);d<0||p<0||m<0?c&&n(u,l,r,e,i,a):(h&&!c||!h&&c)&&n(u,l,r,e,i,a)}l+1>=o[0]&&c&&n(0,l+1,r,e,i,a),r+1>=o[1]&&c&&n(1,l,r+1,e,i,a),e+1>=o[2]&&c&&n(2,l,r,e+1,i,a)}e.setPoints(i),e.setPolys(a)}}a.Ay.newInstance(_,"vtkPointLocator");var E={extend:_},{vtkErrorMacro:D}=a.Ay;function R(e,t,r){let n=t.getData();for(let t=0;t{let n=e.getBucketIndex(r),i=t.hashTable.get(n);return i?R(i,t.points,r):-1},e.insertUniquePoint=r=>{if(!r||3!==r.length)return D("Point must be a Vector3."),{inserted:!1,id:-1};let n=e.getBucketIndex(r),i=t.hashTable.get(n);if(void 0!==i){let e=R(i,t.points,r);if(-1!==e)return{inserted:!1,id:e}}else i=[],t.hashTable.set(n,i);return i.push(t.insertionPointId),t.points.insertNextPoint(...r),{inserted:!0,id:t.insertionPointId++}}},"vtkMergePoints")},{vtkErrorMacro:N,vtkWarningMacro:V}=a.Ay;function L(e,t){for(let r=0;r=0&&u.setTolerance(10**-e),u.initPointInsertion(l,r.getBounds(),Math.floor(n.length/3/2));let c=[],d=[];for(let e=0,t=0;e{t.url=r;let i=r.split("/");return i.pop(),t.baseURL=i.join("/"),e.loadData(n)},e.loadData=(r={})=>(function(r,n={}){let i=void 0!==n.compression?n.compression:t.compression,a=void 0!==n.progressCallback?n.progressCallback:t.progressCallback;return n.binary?t.dataAccessHelper.fetchBinary(r,{compression:i,progressCallback:a}):t.dataAccessHelper.fetchText(e,r,{compression:i,progressCallback:a})})(t.url,r).then(e.parse),e.parse=t=>{"string"==typeof t?e.parseAsText(t):e.parseAsArrayBuffer(t)},e.parseAsArrayBuffer=r=>{if(!r||r===t.parseData)return;e.modified(),t.parseData=r;if(84+50*new DataView(r,0,84).getUint32(80,!0)!==r.byteLength)return void e.parseAsText(u.A.arrayBufferToString(r));let i=r.slice(0,80),a=function(e){let t=e.split(" ").filter(e=>e.indexOf("=")>-1),r={};for(let e=0;e=0&&n(t.removeDuplicateVertices)},e.parseAsText=r=>{if(!r||r===t.parseData)return;e.modified(),t.parseData=r;let i=r.split("\n"),a=1,l=[],u=[],c=[];for(;-1!==a;)a=function(e,t,r,n,i){let a=e[t];if(void 0===a)return -1;if(-1!==a.indexOf("endfacet")||-1===a.indexOf("facet"))return t+1;let o=0,s=2,l=r.length/3;for(L(a.split(/[ \t]+/).filter(e=>e).slice(-3).map(Number),i);-1!==e[t+s].indexOf("vertex");)L(e[t+s].split(/[ \t]+/).filter(e=>e).slice(-3).map(Number),r),o++,s++;n.push(o);for(let e=0;e=0&&n(t.removeDuplicateVertices)},e.requestData=(r,n)=>{e.parse(t.parseData)},t.compression||(t.compression=null),t.progressCallback||(t.progressCallback=null)},"vtkSTLReader")},U=r(35656),k={};function G(e,t,r,n,i){for(let a=0;ae.length>0&&"\r"!==e),n=r.length;e.push(n);for(let t=0;tNumber(e)),r=t[0]-1;r=r<0?r+1+k.v.length/3:r;let n=t[1]?t[1]-1:r;n=n<0?n+1+k.vt.length/2:n;let i=t[2]?t[2]-1:r;return[r,n,i=i<0?i+1+k.vn.length/3:i]}(r[t]))}}var z={numberOfOutputs:1,requestCount:0,splitMode:null,trackDuplicates:!1};function H(e,t,r={}){Object.assign(t,z,r),a.Ay.obj(e,t),a.Ay.get(e,t,["url","baseURL"]),a.Ay.setGet(e,t,["dataAccessHelper","splitMode","trackDuplicates"]),a.Ay.algo(e,t,0,1),a.Ay.event(e,t,"busy"),t.classHierarchy.push("vtkOBJReader"),t.dataAccessHelper||(t.dataAccessHelper=l.Ay.get("http")),e.setUrl=(r,n={})=>{if(-1!==r.indexOf(".obj")||n.fullpath){t.url=r;let e=r.split("/");e.pop(),t.baseURL=e.join("/")}else t.baseURL=r,t.url=`${r}/index.obj`;return e.loadData(n)},e.loadData=(r={})=>(function(r,n={}){return t.dataAccessHelper.fetchText(e,r,n)})(t.url,r).then(t=>!e.isDeleted()&&e.parseAsText(t)),e.parseAsText=r=>!r||(r!==t.parseData&&e.modified(),t.parseData=r,t.numberOfOutputs=0,k.splitOn=t.splitMode,k.pieces=[],k.v=[],k.vt=[],k.vn=[],k.f=[[]],k.size=0,r.split("\n").forEach(W),!function(e){let t=!!k.vt.length,r=!!k.vn.length;if(e.splitMode){e.numberOfOutputs=k.size;for(let n=0;n1?u+r:t;for(let a=1;a{e.parseAsText(t.parseData)},e.isBusy=()=>!!t.requestCount,e.getNumberOfOutputPorts=()=>t.numberOfOutputs}var j={newInstance:a.Ay.newInstance(H,"vtkOBJReader"),extend:H,...{getPointDuplicateIds:function(e,t){let r=[],n=e.getPointData().getArrayByName("Duplicates");if(null==n)return r;let i=n.getData(),a=Math.min(t,i[t]);r.push(a);let o=i[a];if(o!==a)for(;o{if(!n)return null;let i=new Float32Array(n.length),a=new Float32Array(3*e),o=0,s=0,l=r.length,u=[0,0,0],c=[0,0,0];for(let e=0;e{if(!e.getNumberOfInputPorts())return;let i=r[0];if(!i)return;let a=n[0]?.initialize()||s.Ay.newInstance();a.setPoints(i.getPoints()),a.setVerts(i.getVerts()),a.setLines(i.getLines()),a.setPolys(i.getPolys()),a.setStrips(i.getStrips()),a.getPointData().passData(i.getPointData()),a.getCellData().passData(i.getCellData()),a.getFieldData().passData(i.getFieldData());let[l,u]=e.vtkPolyDataNormalsExecute(i.getNumberOfPolys(),i.getPolys().getData(),i.getPoints().getData());if(t.computePointNormals){let e=o.Ay.newInstance({numberOfComponents:3,name:"Normals",values:u});a.getPointData().setNormals(e)}if(t.computeCellNormals){let e=o.Ay.newInstance({numberOfComponents:3,name:"Normals",values:l});a.getCellData().setNormals(e)}n[0]=a}},"vtkPolyDataNormals")},X=r(77280);class Y{constructor(e){this._color=[255,255,255],this._actors=[],this.id=e.id,this._color=e.color??this._color,this._format=e.format;let t=new TextDecoder,r=q.newInstance(),a=e=>{let t=n.Ay.newInstance();t.setMapper(e);let r=$.Ay.newInstance();return r.setColor(this._color[0]/255,this._color[1]/255,this._color[2]/255),t.setProperty(r),t};if(this._format===X.WA.PLY){let t=i.Ay.newInstance(),r=b.newInstance();r.parseAsArrayBuffer(e.arrayBuffer),t.setInputConnection(r.getOutputPort()),this._actors.push(a(t))}else if(this._format===X.WA.STL){let t=i.Ay.newInstance(),n=F.newInstance();n.parseAsArrayBuffer(e.arrayBuffer),r.setInputConnection(n.getOutputPort()),t.setInputConnection(r.getOutputPort()),this._actors.push(a(t))}else if(this._format===X.WA.OBJ){let r=j.newInstance({splitMode:e.materialUrl?"usemtl":null});r.parseAsText(t.decode(e.arrayBuffer));let n=r.getNumberOfOutputPorts();for(let e=0;e{"use strict";r.d(t,{v:()=>o});var n=r(70192),i=r(87195);let a=new Set([n.T7.CPU_IMAGE,n.T7.CPU_VOLUME]);function o(e){return(0,i.zj)().segmentation?.overwriteMode!==void 0||function(e){if(!e)return(0,n.LH)();if(!0===e.useCPURendering||e._cpuFallbackEnabledElement)return!0;let t=function(e){try{return e.getDefaultActor?.()}catch{return}}(e),r=t?.actorMapper?.renderMode;return!!(r&&a.has(r))||"CanvasActor"===("function"==typeof t?.actor?.getClassName?t.actor.getClassName():void 0)||(0,n.LH)()}(e)}},75405:(e,t,r)=>{"use strict";r(70192)},75584:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XMLSerializerImpl=void 0;let n=r(5309),i=r(94489),a=r(30118),o=r(32008),s=r(57226),l=r(47518);class u{static _VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]);serializeToString(e){return this._xmlSerialization(e,!1)}_xmlSerialization(e,t){if(void 0===e._nodeDocument||e._nodeDocument._hasNamespaces){let r=new a.NamespacePrefixMap;r.set("xml",s.namespace.XML);try{return this._serializeNodeNS(e,null,r,{value:1},t)}catch{throw new o.InvalidStateError}}try{return this._serializeNode(e,t)}catch{throw new o.InvalidStateError}}_serializeNodeNS(e,t,r,i,a){switch(e.nodeType){case n.NodeType.Element:return this._serializeElementNS(e,t,r,i,a);case n.NodeType.Document:return this._serializeDocumentNS(e,t,r,i,a);case n.NodeType.Comment:return this._serializeComment(e,a);case n.NodeType.Text:return this._serializeText(e,a);case n.NodeType.DocumentFragment:return this._serializeDocumentFragmentNS(e,t,r,i,a);case n.NodeType.DocumentType:return this._serializeDocumentType(e,a);case n.NodeType.ProcessingInstruction:return this._serializeProcessingInstruction(e,a);case n.NodeType.CData:return this._serializeCData(e,a);default:throw Error(`Unknown node type: ${e.nodeType}`)}}_serializeNode(e,t){switch(e.nodeType){case n.NodeType.Element:return this._serializeElement(e,t);case n.NodeType.Document:return this._serializeDocument(e,t);case n.NodeType.Comment:return this._serializeComment(e,t);case n.NodeType.Text:return this._serializeText(e,t);case n.NodeType.DocumentFragment:return this._serializeDocumentFragment(e,t);case n.NodeType.DocumentType:return this._serializeDocumentType(e,t);case n.NodeType.ProcessingInstruction:return this._serializeProcessingInstruction(e,t);case n.NodeType.CData:return this._serializeCData(e,t);default:throw Error(`Unknown node type: ${e.nodeType}`)}}_serializeElementNS(e,t,r,n,i){if(i&&(-1!==e.localName.indexOf(":")||!(0,l.xml_isName)(e.localName)))throw Error("Node local name contains invalid characters (well-formed required).");let a="<",o="",c=!1,d=!1,p=r.copy(),m={},h=this._recordNamespaceInformation(e,p,m),f=t,g=e.namespaceURI;if(f===g)null!==h&&(d=!0),a+=o=g===s.namespace.XML?"xml:"+e.localName:e.localName;else{let t=e.prefix,r=null;if((null!==t||g!==h)&&(r=p.get(t,g)),"xmlns"===t){if(i)throw Error("An element cannot have the 'xmlns' prefix (well-formed required).");r=t}null!==r?(o=r+":"+e.localName,null!==h&&h!==s.namespace.XML&&(f=h||null),a+=o):null!==t?(t in m&&(t=this._generatePrefix(g,p,n)),p.set(t,g),o+=t+":"+e.localName,a+=o,a+=" xmlns:"+t+'="'+this._serializeAttributeValue(g,i)+'"',null!==h&&(f=h||null)):null===h||null!==h&&h!==g?(d=!0,o+=e.localName,f=g,a+=o,a+=' xmlns="'+this._serializeAttributeValue(g,i)+'"'):(o+=e.localName,f=g,a+=o)}a+=this._serializeAttributesNS(e,p,n,m,d,i);let v=g===s.namespace.HTML;if(v&&0===e.childNodes.length&&u._VoidElementNames.has(e.localName)?(a+=" /",c=!0):v||0!==e.childNodes.length||(a+="/",c=!0),a+=">",c)return a;if(v&&"template"===e.localName);else for(let t of e._children||e.childNodes)a+=this._serializeNodeNS(t,f,p,n,i);return a+("")}_serializeDocumentNS(e,t,r,n,i){if(i&&null===e.documentElement)throw Error("Missing document element (well-formed required).");let a="";for(let o of e._children||e.childNodes)a+=this._serializeNodeNS(o,t,r,n,i);return a}_serializeComment(e,t){if(t&&(!(0,l.xml_isLegalChar)(e.data)||-1!==e.data.indexOf("--")||e.data.endsWith("-")))throw Error("Comment data contains invalid characters (well-formed required).");return"\x3c!--"+e.data+"--\x3e"}_serializeText(e,t){if(t&&!(0,l.xml_isLegalChar)(e.data))throw Error("Text data contains invalid characters (well-formed required).");let r="";for(let t=0;t"===n?r+=">":r+=n}return r}_serializeDocumentFragmentNS(e,t,r,n,i){let a="";for(let o of e._children||e.childNodes)a+=this._serializeNodeNS(o,t,r,n,i);return a}_serializeDocumentType(e,t){if(t&&!(0,l.xml_isPubidChar)(e.publicId))throw Error("DocType public identifier does not match PubidChar construct (well-formed required).");if(t&&(!(0,l.xml_isLegalChar)(e.systemId)||-1!==e.systemId.indexOf('"')&&-1!==e.systemId.indexOf("'")))throw Error("DocType system identifier contains invalid characters (well-formed required).");return e.publicId&&e.systemId?"':e.publicId?"':e.systemId?"':""}_serializeProcessingInstruction(e,t){if(t&&(-1!==e.target.indexOf(":")||/^xml$/i.test(e.target)))throw Error("Processing instruction target contains invalid characters (well-formed required).");if(t&&(!(0,l.xml_isLegalChar)(e.data)||-1!==e.data.indexOf("?>")))throw Error("Processing instruction data contains invalid characters (well-formed required).");return""}_serializeCData(e,t){if(t&&-1!==e.data.indexOf("]]>"))throw Error("CDATA contains invalid characters (well-formed required).");return""}_serializeAttributesNS(e,t,r,n,a,o){let u="",c=o?new i.LocalNameSet:void 0;for(let i of e.attributes){if(!a&&!o&&null===i.namespaceURI){u+=" "+i.localName+'="'+this._serializeAttributeValue(i.value,o)+'"';continue}if(o&&c&&c.has(i.namespaceURI,i.localName))throw Error("Element contains duplicate attributes (well-formed required).");o&&c&&c.set(i.namespaceURI,i.localName);let e=i.namespaceURI,d=null;if(null!==e)if(d=t.get(i.prefix,e),e===s.namespace.XMLNS){if(i.value===s.namespace.XML||null===i.prefix&&a||null!==i.prefix&&(!(i.localName in n)||n[i.localName]!==i.value)&&t.has(i.localName,i.value))continue;if(o&&i.value===s.namespace.XMLNS)throw Error("XMLNS namespace is reserved (well-formed required).");if(o&&""===i.value)throw Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");"xmlns"===i.prefix&&(d="xmlns")}else null===d&&(u+=" xmlns:"+(d=null!==i.prefix&&(!t.hasPrefix(i.prefix)||t.has(i.prefix,e))?i.prefix:this._generatePrefix(e,t,r))+'="'+this._serializeAttributeValue(e,o)+'"');if(u+=" ",null!==d&&(u+=d+":"),o&&(-1!==i.localName.indexOf(":")||!(0,l.xml_isName)(i.localName)||"xmlns"===i.localName&&null===e))throw Error("Attribute local name contains invalid characters (well-formed required).");u+=i.localName+'="'+this._serializeAttributeValue(i.value,o)+'"'}return u}_recordNamespaceInformation(e,t,r){let n=null;for(let i of e.attributes){let e=i.namespaceURI,a=i.prefix;if(e===s.namespace.XMLNS)if(null===a){n=i.value;continue}else{let e=i.localName,n=i.value;if(n===s.namespace.XML||(""===n&&(n=null),t.has(e,n)))continue;t.set(e,n),r[e]=n||""}}return n}_generatePrefix(e,t,r){let n="ns"+r.value;return r.value++,t.set(n,e),n}_serializeAttributeValue(e,t){if(t&&null!==e&&!(0,l.xml_isLegalChar)(e))throw Error("Invalid characters in attribute value.");if(null===e)return"";let r="";for(let t=0;t"===n?r+=">":r+=n}return r}_serializeElement(e,t){if(t&&(-1!==e.localName.indexOf(":")||!(0,l.xml_isName)(e.localName)))throw Error("Node local name contains invalid characters (well-formed required).");let r=!1,n=e.localName,i="<"+n;if(i+=this._serializeAttributes(e,t),0===e._children.size&&(i+="/",r=!0),i+=">",r)return i;for(let r of e._children)i+=this._serializeNode(r,t);return i+("")}_serializeDocument(e,t){if(t&&null===e.documentElement)throw Error("Missing document element (well-formed required).");let r="";for(let n of e._children)r+=this._serializeNode(n,t);return r}_serializeDocumentFragment(e,t){let r="";for(let n of e._children)r+=this._serializeNode(n,t);return r}_serializeAttributes(e,t){let r="",n=t?{}:void 0;for(let i of e.attributes){if(t&&n&&i.localName in n)throw Error("Element contains duplicate attributes (well-formed required).");if(t&&n&&(n[i.localName]=!0),t&&(-1!==i.localName.indexOf(":")||!(0,l.xml_isName)(i.localName)))throw Error("Attribute local name contains invalid characters (well-formed required).");r+=" "+i.localName+'="'+this._serializeAttributeValue(i.value,t)+'"'}return r}}t.XMLSerializerImpl=u},75972:(e,t,r)=>{"use strict";function n(e){let{canvas:t,renderer:r,canvasPos:n}=e,i=a(r.getActiveCamera()),o=window.devicePixelRatio||1,{width:s,height:l}=t,u=[n[0]*o,n[1]*o],[c,d,p,m]=r.getViewport(),h=[c+u[0]/s*(p-c),d+(1-u[1]/l)*(m-d),0],f=r.normalizedDisplayToProjection(h[0],h[1],h[2]),g=r.projectionToView(f[0],f[1],f[2],s/l),v=r.viewToWorld(g[0],g[1],g[2]);return i(),[v[0],v[1],v[2]]}function i(e){let{canvas:t,renderer:r,worldPos:n}=e,i=a(r.getActiveCamera()),o=window.devicePixelRatio||1,{width:s,height:l}=t,u=r.worldToView(n[0],n[1],n[2]),c=r.viewToProjection(u[0],u[1],u[2],s/l),d=r.projectionToNormalizedDisplay(c[0],c[1],c[2]),[p,m,h,f]=r.getViewport(),g=(d[0]-p)/(h-p)*s,v=(1-(d[1]-m)/(f-m))*l;return i(),[g/o,v/o]}function a(e){if(e.setIsPerformingCoordinateTransformation)return e.setIsPerformingCoordinateTransformation(!0),()=>{e.setIsPerformingCoordinateTransformation?.(!1)};let t=e.getClippingRange(),r=e.getDistance();return e.setClippingRange(r,r+.1),()=>{e.setClippingRange(t[0],t[1])}}r.d(t,{D:()=>n,n:()=>i})},76348:(e,t,r)=>{"use strict";r.d(t,{hH:()=>d,hI:()=>c,iV:()=>u,lW:()=>p});var n=r(50923),i=r(91336),a=r(85250);r(22783),r(79267);var o=r(59698),s=r(88249);r(43505);var l=r(9638);function u(e){let{sliceBasis:t,camera:r,canvasHeight:a,canvasWidth:u}=e,c=(0,l.aD)(r?.scale),d=(0,o.iJ)(r?.rotation??0),p=i.o8(r?.anchorCanvas??[.5,.5]),m=(0,s.g)(u),h=(0,s.g)(a),f=(0,s.v)(t.viewPlaneNormal,[0,0,1]),g=(0,s.v)((0,o._t)({rotation:d,viewPlaneNormal:f,viewUp:t.viewUp}),[0,-1,0]),{viewPlaneNormal:v,viewUp:y}=(0,o.ty)({flipHorizontal:r?.flipHorizontal,flipVertical:r?.flipVertical,viewPlaneNormal:f,viewUp:g}),b=n.$A(n.vt(),y,v);b=n.Bw(b)?n.S8(n.vt(),b):[1,0,0];let I=r?.anchorWorld?function(e,t,r){let i=(0,s.v)(r,[0,0,1]),a=n.Re(n.vt(),e,t),o=n.Om(a,i);return n.Ln(n.vt(),e,i,-o)}(r.anchorWorld,t.sliceCenterWorld,f):t.sliceCenterWorld,[x,C]=c,A=2*(t.fitParallelScale/C),T=function(e){let{canvasHeight:t,canvasWidth:r,camera:n,scale:i,sliceBasis:a}=e,o=n?.displayArea;if(!o)return;let u=(0,s.g)(r),c=(0,s.g)(t),[d,p]=function(e){let{canvasHeight:t,canvasWidth:r,sliceBasis:n}=e,i=(0,s.g)(r),a=(0,s.g)(t),o=2*Math.max(n.fitParallelScale,.001);return[Math.max(n.sliceWidthWorld,.001)/Math.max(i/a*o,.001)*i,Math.max(n.sliceHeightWorld,.001)/Math.max(o,.001)*a]}({canvasHeight:t,canvasWidth:r,sliceBasis:a}),m=[...i];if("SCALE"===o.type&&void 0!==o.scale)m=(0,l.aD)(o.scale);else if(o.imageArea){let[e,t]=o.imageArea,r=u/Math.max(Math.max(Math.abs(e),.001)*d,.001),a=c/Math.max(Math.max(Math.abs(t),.001)*p,.001),s=(0,l.dq)(o.scaleMode??n?.scaleMode);if("absolute"===s)m=[r*i[0],a*i[1]];else{let e="fitWidth"===s?r:"fitHeight"===s?a:Math.min(r,a);m=[e*i[0],e*i[1]]}}let h=[0,0];if(o.imageCanvasPoint){let{imagePoint:e,canvasPoint:t=e||[.5,.5]}=o.imageCanvasPoint,[r,n]=t,[i,a]=e||t;h=[m[0]*d*(.5-i)+u*(r-.5),m[1]*p*(.5-a)+c*(n-.5)]}return{pan:h,scale:m,zoom:m[1]}}({sliceBasis:t,camera:r,canvasWidth:u,canvasHeight:a,scale:c}),S=n.Re(n.vt(),t.sliceCenterWorld,I),w=[n.Om(S,b)*m/(C/x*(m/h*A)),-n.Om(S,y)*h/A],O=[(p[0]-.5)*m,(p[1]-.5)*h];return{pan:T?.pan??[w[0]+O[0],w[1]+O[1]],flipHorizontal:r?.flipHorizontal===!0,flipVertical:r?.flipVertical===!0,scale:T?.scale??c,zoom:T?.zoom??c[1],rotation:d}}function c(e){let{sliceBasis:t,camera:r,canvasHeight:i,canvasWidth:a}=e,c=u({sliceBasis:t,camera:r,canvasWidth:a,canvasHeight:i}),{deltaWorld:d,parallelScale:p,presentationScale:m,viewPlaneNormal:h,viewUp:f}=function(e){let{sliceBasis:t,canvasWidth:r,canvasHeight:i,flipHorizontal:a,flipVertical:u,pan:c=[0,0],rotation:d,scale:p=[1,1]}=e,m=(0,s.v)(t.viewPlaneNormal),h=(0,s.v)((0,o._t)({rotation:d,viewPlaneNormal:m,viewUp:t.viewUp})),{viewPlaneNormal:f,viewUp:g}=(0,o.ty)({flipHorizontal:a,flipVertical:u,viewPlaneNormal:m,viewUp:h}),v=n.$A(n.vt(),g,f);0===n.Bw(v)&&(v=n.fA(1,0,0)),v=n.S8(n.vt(),v);let[y,b]=(0,l.aD)(p),[I,x]=c,C=t.fitParallelScale/b,A=(0,s.g)(r),T=(0,s.g)(i),S=2*C,w=n.vt();return n.Ln(w,w,v,b/y*(A/T*S)*I/A),n.Ln(w,w,g,-x*S/T),{deltaWorld:w,parallelScale:C,presentationScale:[y,b],viewPlaneNormal:f,viewUp:g}}({sliceBasis:t,canvasWidth:a,canvasHeight:i,flipHorizontal:c.flipHorizontal,flipVertical:c.flipVertical,pan:c.pan,rotation:c.rotation,scale:c.scale}),g=n.Re(n.vt(),t.sliceCenterWorld,d);return{focalPoint:g,parallelProjection:!0,parallelScale:p,presentationScale:m,scale:c.scale,scaleMode:(0,l.dq)(r?.scaleMode),position:n.Ln(n.vt(),g,h,t.cameraDistance),flipHorizontal:c.flipHorizontal,flipVertical:c.flipVertical,viewPlaneNormal:h,viewUp:f}}function d(e){let{renderer:t,activeSourceICamera:r}=e;if(!r?.focalPoint||!r.position||!r.viewPlaneNormal||!r.viewUp||"number"!=typeof r.parallelScale)return;let n=t.getActiveCamera();return n.setParallelProjection(!0),n.setDirectionOfProjection(-r.viewPlaneNormal[0],-r.viewPlaneNormal[1],-r.viewPlaneNormal[2]),n.setParallelScale(r.parallelScale),n.setFocalPoint(...r.focalPoint),n.setPosition(...r.position),n.setViewUp(...r.viewUp),r}function p(e){let{actor:t,activeSourceICamera:r}=e;t?.setUserMatrix?.(function(e){let t=a.create();if(!e?.focalPoint||!e.viewPlaneNormal||!e.viewUp)return t;let[r,i]=(0,l.aD)(e.presentationScale),o=Math.max(r/i,l.XL);if(1e-6>Math.abs(o-1))return t;let u=function(e){let t=(0,s.v)(e.viewUp,[0,-1,0]),r=(0,s.v)(e.viewPlaneNormal,[0,0,1]),i=n.$A(n.vt(),t,r);return 1e-6>n.Bw(i)?[1,0,0]:n.S8(n.vt(),i)}(e),c=o-1,[d,p,m]=u,h=[1+c*d*d,c*d*p,c*d*m,c*p*d,1+c*p*p,c*p*m,c*m*d,c*m*p,1+c*m*m],[f,g,v]=e.focalPoint,y=[h[0]*f+h[3]*g+h[6]*v,h[1]*f+h[4]*g+h[7]*v,h[2]*f+h[5]*g+h[8]*v];return t[0]=h[0],t[1]=h[1],t[2]=h[2],t[4]=h[3],t[5]=h[4],t[6]=h[5],t[8]=h[6],t[9]=h[7],t[10]=h[8],t[12]=f-y[0],t[13]=g-y[1],t[14]=v-y[2],t}(r))}},76399:(e,t,r)=>{"use strict";r.d(t,{_:()=>l,x:()=>s});var n=r(18236),i=r(65509),a=r(4849);function o(e,t,r){if(null==r)return void delete e[t];e[t]=r}function s(e){let t=(0,n.uk)(e);if(!t)return;let r=(0,n.gV)(e)[0]??1,i=t.primaryLabelmapId??t.segmentBindings[r]?.labelmapId??Object.keys(t.labelmaps)[0],a=t.labelmaps[i];a&&(o(t,"volumeId",a.volumeId),o(t,"referencedVolumeId",a.referencedVolumeId),o(t,"imageIds",a.imageIds),o(t,"referencedImageIds",a.referencedImageIds))}function l(e){let t=new Map;return(0,i.m)(e).forEach(e=>{(0,a.Zd)(e,(e,r)=>{let n=t.get(e)??[];n.includes(r)||n.push(r),t.set(e,n)})}),t}},76722:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(27321),i=r(65704),a=r(68759);function o(e,t,r,s,l,u={},c=""){if(isNaN(s[0])||isNaN(s[1])||isNaN(l[0])||isNaN(l[1]))return;let{color:d="rgb(0, 255, 0)",width:p=10,lineWidth:m,lineDash:h,markerStartId:f=null,markerEndId:g=null,shadow:v=!1,strokeOpacity:y=1,textBoxLinkLineColor:b}=u,I=(0,n.A)(t,"line",r),x=e.getSvgNode(I),C=e.svgLayerElement.id,A=v?`url(#shadow-${C});`:"",T={x1:`${s[0]}`,y1:`${s[1]}`,x2:`${l[0]}`,y2:`${l[1]}`,stroke:b||d,filter:A,"stroke-width":m||p,"stroke-dasharray":h,"marker-start":f?`url(#${f})`:"","marker-end":g?`url(#${g})`:"","stroke-opacity":y};if(x)(0,a.A)(T,x),e.setNodeTouched(I);else{let t=document.createElementNS("http://www.w3.org/2000/svg","line");""!==c&&t.setAttribute("data-id",c),(0,i.A)(T,t),e.appendNode(t,I)}}},76763:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DOMImplementationImpl=void 0;let n=r(60957),i=r(57226),a=r(47518),o=r(48040);class s{_ID="@oozcitak/dom";_associatedDocument;constructor(e){this._associatedDocument=e||n.dom.window.document}createDocumentType(e,t,r){return(0,a.namespace_validate)(e),(0,a.create_documentType)(this._associatedDocument,e,t,r)}createDocument(e,t,r=null){let n=(0,a.create_xmlDocument)(),o=null;return t&&(o=(0,a.document_internalCreateElementNS)(n,e,t)),r&&n.appendChild(r),o&&n.appendChild(o),n._origin=this._associatedDocument._origin,e===i.namespace.HTML?n._contentType="application/xhtml+xml":e===i.namespace.SVG?n._contentType="image/svg+xml":n._contentType="application/xml",n}createHTMLDocument(e){let t=(0,a.create_document)();t._type="html",t._contentType="text/html",t.appendChild((0,a.create_documentType)(t,"html","",""));let r=(0,a.element_createAnElement)(t,"html",i.namespace.HTML);t.appendChild(r);let n=(0,a.element_createAnElement)(t,"head",i.namespace.HTML);if(r.appendChild(n),void 0!==e){let r=(0,a.element_createAnElement)(t,"title",i.namespace.HTML);n.appendChild(r);let o=(0,a.create_text)(t,e);r.appendChild(o)}let o=(0,a.element_createAnElement)(t,"body",i.namespace.HTML);return r.appendChild(o),t._origin=this._associatedDocument._origin,t}hasFeature(){return!0}static _create(e){return new s(e)}}t.DOMImplementationImpl=s,(0,o.idl_defineConst)(s.prototype,"_ID","@oozcitak/dom")},76818:(e,t,r)=>{"use strict";r.d(t,{M:()=>i});var n=r(43385);function i(e){if(!e.data.segmentation)throw Error("removeContourSegmentationAnnotation: annotation does not have a segmentation data");let{segmentationId:t,segmentIndex:r}=e.data.segmentation,i=(0,n.T)(t),{annotationUIDsMap:a}=i?.representationData.Contour||{},o=a?.get(r);o&&(o.delete(e.annotationUID),o.size||a.delete(r))}},76879:(e,t,r)=>{"use strict";var n;r.d(t,{A:()=>i}),function(e){e.ERROR_EVENT="CORNERSTONE_ERROR",e.CACHE_SIZE_EXCEEDED="CACHE_SIZE_EXCEEDED",e.IMAGE_LOAD_ERROR="IMAGE_LOAD_ERROR",e.CAMERA_MODIFIED="CORNERSTONE_CAMERA_MODIFIED",e.CAMERA_RESET="CORNERSTONE_CAMERA_RESET",e.VOI_MODIFIED="CORNERSTONE_VOI_MODIFIED",e.PRESET_MODIFIED="CORNERSTONE_VIEWPORT_RENDERING_PRESET_MODIFIED",e.DISPLAY_AREA_MODIFIED="CORNERSTONE_DISPLAY_AREA_MODIFIED",e.ELEMENT_DISABLED="CORNERSTONE_ELEMENT_DISABLED",e.ELEMENT_ENABLED="CORNERSTONE_ELEMENT_ENABLED",e.IMAGE_RENDERED="CORNERSTONE_IMAGE_RENDERED",e.IMAGE_VOLUME_MODIFIED="CORNERSTONE_IMAGE_VOLUME_MODIFIED",e.IMAGE_VOLUME_LOADING_COMPLETED="CORNERSTONE_IMAGE_VOLUME_LOADING_COMPLETED",e.IMAGE_LOADED="CORNERSTONE_IMAGE_LOADED",e.IMAGE_RETRIEVAL_STAGE="CORNERSTONE_IMAGE_RETRIEVAL_STAGE",e.IMAGE_LOAD_FAILED="CORNERSTONE_IMAGE_LOAD_FAILED",e.VOLUME_VIEWPORT_NEW_VOLUME="CORNERSTONE_VOLUME_VIEWPORT_NEW_VOLUME",e.VOLUME_LOADED="CORNERSTONE_VOLUME_LOADED",e.VOLUME_LOADED_FAILED="CORNERSTONE_VOLUME_LOADED_FAILED",e.IMAGE_CACHE_IMAGE_ADDED="CORNERSTONE_IMAGE_CACHE_IMAGE_ADDED",e.IMAGE_CACHE_IMAGE_REMOVED="CORNERSTONE_IMAGE_CACHE_IMAGE_REMOVED",e.VOLUME_CACHE_VOLUME_ADDED="CORNERSTONE_VOLUME_CACHE_VOLUME_ADDED",e.VOLUME_CACHE_VOLUME_REMOVED="CORNERSTONE_VOLUME_CACHE_VOLUME_REMOVED",e.STACK_NEW_IMAGE="CORNERSTONE_STACK_NEW_IMAGE",e.VOLUME_NEW_IMAGE="CORNERSTONE_VOLUME_NEW_IMAGE",e.PRE_STACK_NEW_IMAGE="CORNERSTONE_PRE_STACK_NEW_IMAGE",e.IMAGE_SPACING_CALIBRATED="CORNERSTONE_IMAGE_SPACING_CALIBRATED",e.VIEWPORT_NEW_IMAGE_SET="CORNERSTONE_VIEWPORT_NEW_IMAGE_SET",e.STACK_VIEWPORT_SCROLL="CORNERSTONE_STACK_VIEWPORT_SCROLL",e.STACK_SCROLL_OUT_OF_BOUNDS="STACK_SCROLL_OUT_OF_BOUNDS",e.GEOMETRY_CACHE_GEOMETRY_ADDED="CORNERSTONE_GEOMETRY_CACHE_GEOMETRY_ADDED",e.GEOMETRY_CACHE_GEOMETRY_REMOVED="CORNERSTONE_GEOMETRY_CACHE_GEOMETRY_REMOVED",e.VOLUME_VIEWPORT_SCROLL_OUT_OF_BOUNDS="VOLUME_VIEWPORT_SCROLL_OUT_OF_BOUNDS",e.VOLUME_VIEWPORT_SCROLL="VOLUME_VIEWPORT_SCROLL",e.CLIPPING_PLANES_UPDATED="CORNERSTONE_CLIPPING_PLANES_UPDATED",e.WEB_WORKER_PROGRESS="CORNERSTONE_WEB_WORKER_PROGRESS",e.COLORMAP_MODIFIED="CORNERSTONE_COLORMAP_MODIFIED",e.DYNAMIC_VOLUME_DIMENSION_GROUP_CHANGED="DYNAMIC_VOLUME_DIMENSION_GROUP_CHANGED",e.DYNAMIC_VOLUME_TIME_POINT_INDEX_CHANGED="DYNAMIC_VOLUME_TIME_POINT_INDEX_CHANGED",e.DYNAMIC_VOLUME_DIMENSION_GROUP_LOADED="DYNAMIC_VOLUME_DIMENSION_GROUP_LOADED",e.DYNAMIC_VOLUME_TIME_POINT_LOADED="DYNAMIC_VOLUME_TIME_POINT_LOADED",e.GEOMETRY_LOADED="GEOMETRY_LOADED",e.GEOMETRY_LOAD_PROGRESS="GEOMETRY_LOAD_PROGRESS",e.GEOMETRY_LOADED_FAILED="GEOMETRY_LOADED_FAILED",e.ACTORS_CHANGED="CORNERSTONE_ACTORS_CHANGED",e.RENDER_BACKEND_CHANGED="CORNERSTONE_RENDER_BACKEND_CHANGED",e.WEBGL_CONTEXT_LOST="CORNERSTONE_WEBGL_CONTEXT_LOST",e.WEBGL_CONTEXT_RESTORED="CORNERSTONE_WEBGL_CONTEXT_RESTORED",e.RENDER_PATH_ERROR="CORNERSTONE_RENDER_PATH_ERROR",e.RENDERING_PIPELINE_CHANGED="CORNERSTONE_RENDERING_PIPELINE_CHANGED"}(n||(n={}));let i=n},77047:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(10458);function i(e,t){if(4!==e.length||2!==t.length)throw Error("rectangle:[left, top, width, height] or point: [x,y] not defined correctly");let[r,i,a,o]=e,s=655535,l={top:[[r,i],[r+a,i]],right:[[r+a,i],[r+a,i+o]],bottom:[[r+a,i+o],[r,i+o]],left:[[r,i+o],[r,i]]};return Object.keys(l).forEach(e=>{let[r,i]=l[e],a=n.A(r,i,t);a{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XMLCBWriter=void 0;let n=r(39409);class i extends n.BaseCBWriter{_lineLength=0;constructor(e){super(e)}frontMatter(){return""}declaration(e,t,r){let n=this._beginLine()+""}docType(e,t,r){let n=this._beginLine();return t&&r?n+="':t?n+="':r?n+="':n+="",n}comment(e){return this._beginLine()+"\x3c!--"+e+"--\x3e"}text(e){return e}instruction(e,t){return t?this._beginLine()+"":this._beginLine()+""}cdata(e){return this._beginLine()+""}openTagBegin(e){return this._lineLength+=1+e.length,this._beginLine()+"<"+e}openTagEnd(e,t,r){return r?" />":t?this._writerOptions.allowEmptyTags?">":this._writerOptions.spaceBeforeSlash?" />":"/>":">"}closeTag(e,t){return(t?"":this._beginLine())+""}attribute(e,t){let r=e+'="'+t+'"';return this._writerOptions.prettyPrint&&this._writerOptions.width>0&&this._lineLength+1+r.length>this._writerOptions.width?(r=this._beginLine()+this._indent(1)+r,this._lineLength=r.length,r):(this._lineLength+=1+r.length," "+r)}beginElement(e){}endElement(e){}_beginLine(){if(!this._writerOptions.prettyPrint)return"";{let e=(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level);return this._lineLength=e.length,e}}_indent(e){return e<=0?"":this._writerOptions.indent.repeat(e)}}t.XMLCBWriter=i},77680:(e,t,r)=>{"use strict";r.d(t,{A:()=>p});var n=r(70192),i=r(16410),a=r(93022),o=r(83409),s=r(81480),l=r(41918),u=r(68764),c=r(37298);class d extends i.A{constructor(){super(...arguments),this.onImageSpacingCalibrated=e=>{let{element:t,imageId:r}=e.detail,i=n.BF.imageIdToURI(r),s=(0,a.getAnnotationManager)();s.getFramesOfReference().forEach(e=>{let r=s.getAnnotations(e)[this.getToolName()];r&&r.length&&(r.forEach(e=>{e.metadata?.referencedImageId&&n.BF.imageIdToURI(e.metadata.referencedImageId)===i&&(e.invalidated=!0,e.data.cachedStats={})}),(0,o.A)(t))})}}filterInteractableAnnotationsForElement(e,t){if(!t?.length)return[];let{viewport:r}=(0,n.kJ)(e);return(0,s.A)(r,t)}static createAnnotation(...e){let t={annotationUID:null,highlighted:!0,invalidated:!0,isLocked:!1,isVisible:!0,metadata:{toolName:this.toolName},data:{handles:{points:[],activeHandleIndex:null,textBox:{hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}}},cachedStats:{},label:""}};for(let r of e)t=n.BF.deepMerge(t,r);return t}createAnnotation(e,t,...r){let{currentPoints:i,element:a}=e.detail,{world:o}=i,{viewport:s}=(0,n.kJ)(a),u=s.getViewReference({points:[o]}),{viewPlaneNormal:c,viewUp:p,position:m}=(0,l.A)(s,u),h=u.referencedImageId||(c?this.getReferencedImageId(s,o,c,p):void 0);return d.createAnnotation({metadata:{toolName:this.getToolName(),...u,...h?{referencedImageId:h}:{},...p?{viewUp:p}:{},...m?{cameraPosition:m}:{}},data:{handles:{points:t||[]}}},...r)}getReferencedImageId(e,t,r,i){let a=this.getTargetId(e),o=a.split(/^[a-zA-Z]+:/)[1];if(e instanceof n.ei){let e=n.BF.getVolumeId(a),i=n.PP.getVolume(e);o=n.BF.getClosestImageId(i,t,r)}return o}getStyle(e,t,r){return(0,u.h)(e,t,(0,c.Gu)(r),this.mode)}}d.toolName="AnnotationDisplayTool";let p=d},77757:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});class n{constructor(e){this.name=e||"unknown"}static as(e){if(e.iterator)return e.iterator;let t=new n("as iterator");return e.then(e=>{try{t.add(e,!0)}catch(e){t.reject(e)}},e=>{t.reject(e)}),t}add(e,t=!1){this.nextValue=e,this.done||=t,this.waiting&&(this.waiting.resolve(e),this.waiting=void 0)}resolve(){this.done=!0,this.waiting&&(this.waiting.resolve(this.nextValue),this.waiting=void 0)}reject(e){this.rejectReason=e,this.waiting?.reject(e)}getRecent(){if(this.rejectReason)throw this.rejectReason;return this.nextValue}async *[Symbol.asyncIterator](){for(;!this.done;){if(this.rejectReason)throw this.rejectReason;if(void 0!==this.nextValue&&(yield this.nextValue,this.done))break;this.waiting||(this.waiting={},this.waiting.promise=new Promise((e,t)=>{this.waiting.resolve=e,this.waiting.reject=t})),await this.waiting.promise}yield this.nextValue}async forEach(e,t){let r=0;try{for await(let n of this){let{done:i}=this;try{await e(n,i,r),r++}catch(e){if(!i){console.warn("Caught exception in intermediate value",e);continue}if(t)t(e,i);else throw e}}}catch(e){if(t)t(e,!0);else throw e}}generate(e,t){return e(this,this.reject.bind(this)).then(()=>{this.done||this.resolve()},e=>{this.reject(e),t?t(e):console.warn("Couldn't process because",e)})}async nextPromise(){for await(let e of this)if(e)return e;return this.nextValue}async donePromise(){for await(let e of this);return this.nextValue}getNextPromise(){let e=this.nextPromise();return e.iterator=this,e}getDonePromise(){let e=this.donePromise();return e.iterator=this,e}}},77849:(e,t,r)=>{"use strict";function n(e,t,r=1e-5){return Math.abs(e[0]+t[0])n})},77912:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DOMParser=void 0;var n=r(37209);Object.defineProperty(t,"DOMParser",{enumerable:!0,get:function(){return n.DOMParserImpl}})},78180:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isASCIIByte=function(e){return e>=0&&e<=127}},78321:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.abort_add=function(e,t){t._abortedFlag||t._abortAlgorithms.add(e)},t.abort_remove=function(e,t){t._abortAlgorithms.delete(e)},t.abort_signalAbort=function(e){if(!e._abortedFlag){for(let t of(e._abortedFlag=!0,e._abortAlgorithms))t.call(e);e._abortAlgorithms.clear(),(0,n.event_fireAnEvent)("abort",e)}};let n=r(94579)},78378:(e,t,r)=>{"use strict";r.d(t,{dt:()=>l,wi:()=>p.A,sV:()=>u.A,qv:()=>o.q,Jf:()=>a,iP:()=>o.i,D_:()=>c.A,Yh:()=>d.A,r$:()=>s.A,Y3:()=>m});var n,i,a,o=r(94070),s=r(40812);!function(e){e.Default="",e.Highlighted="Highlighted",e.Selected="Selected",e.Locked="Locked",e.AutoGenerated="AutoGenerated"}(n||(n={}));let l=n;var u=r(31895),c=r(90174);r(44489);var d=r(48937),p=r(49159);!function(e){e.POLYSEG_CONTOUR_TO_LABELMAP="Converting Contour to Labelmap",e.POLYSEG_SURFACE_TO_LABELMAP="Converting Surfaces to Labelmap",e.POLYSEG_CONTOUR_TO_SURFACE="Converting Contour to Surface",e.POLYSEG_LABELMAP_TO_SURFACE="Converting Labelmap to Surface",e.SURFACE_CLIPPING="Clipping Surfaces",e.COMPUTE_STATISTICS="Computing Statistics",e.INTERPOLATE_LABELMAP="Interpolating Labelmap",e.COMPUTE_LARGEST_BIDIRECTIONAL="Computing Largest Bidirectional",e.GENERATE_CONTOUR_SETS="Generating Contour Sets"}(i||(i={}));let m=i;!function(e){e.Linear="Linear",e.Area="Area",e.Volume="Volume",e.Pixel="Pixel"}(a||(a={}))},78543:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>o});var n=r(17042),i={image:null,canvas:null,jsImageData:null,imageBitmap:null,imageLoaded:!1,repeat:!1,interpolate:!1,edgeClamp:!1,mipLevel:0,resizable:!1};function a(e,t,r={}){Object.assign(t,i,r),n.Ay.obj(e,t),n.Ay.algo(e,t,6,0),n.Ay.get(e,t,["canvas","image","jsImageData","imageBitmap","imageLoaded","resizable"]),n.Ay.setGet(e,t,["repeat","edgeClamp","interpolate","mipLevel"]),t.classHierarchy.push("vtkTexture"),e.imageLoaded=()=>{t.image.removeEventListener("load",e.imageLoaded),t.imageLoaded=!0,e.modified()},e.setJsImageData=r=>{t.jsImageData!==r&&(null!==r&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.canvas=null,t.imageBitmap=null),t.jsImageData=r,t.imageLoaded=!0,e.modified())},e.setImageBitmap=r=>{t.imageBitmap!==r&&(null!==r&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.canvas=null,t.jsImageData=null),t.imageBitmap=r,t.imageLoaded=!0,e.modified())},e.setCanvas=r=>{t.canvas!==r&&(null!==r&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.imageBitmap=null,t.jsImageData=null),t.canvas=r,e.modified())},e.setImage=r=>{t.image!==r&&(null!==r&&(e.setInputData(null),e.setInputConnection(null),t.canvas=null,t.jsImageData=null,t.imageBitmap=null),t.image=r,t.imageLoaded=!1,r.complete?e.imageLoaded():r.addEventListener("load",e.imageLoaded),e.modified())},e.getDimensionality=()=>{let r=0,n=0,i=1;if(e.getInputData()){let t=e.getInputData();r=t.getDimensions()[0],n=t.getDimensions()[1],i=t.getDimensions()[2]}return t.jsImageData&&(r=t.jsImageData.width,n=t.jsImageData.height),t.canvas&&(r=t.canvas.width,n=t.canvas.height),t.image&&(r=t.image.width,n=t.image.height),t.imageBitmap&&(r=t.imageBitmap.width,n=t.imageBitmap.height),(r>1)+(n>1)+(i>1)},e.getInputAsJsImageData=()=>{if(!t.imageLoaded||e.getInputData())return null;if(t.jsImageData)return t.jsImageData;if(t.imageBitmap)return t.imageBitmap;if(t.canvas)return t.canvas.getContext("2d").getImageData(0,0,t.canvas.width,t.canvas.height);if(t.image){let e=t.image.width,r=t.image.height,n=new OffscreenCanvas(e,r).getContext("2d");return n.translate(0,r),n.scale(1,-1),n.drawImage(t.image,0,0,e,r),n.getImageData(0,0,e,r)}return null}}var o={newInstance:n.Ay.newInstance(a,"vtkTexture"),extend:a,generateMipmaps:(e,t,r)=>{let n=e.createShaderModule({code:` + @group(0) @binding(0) var inputTexture: texture_2d; + @group(0) @binding(1) var outputTexture: texture_storage_2d; + + @compute @workgroup_size(8, 8) + fn main(@builtin(global_invocation_id) global_id: vec3) { + let texelCoord = vec2(global_id.xy); + let outputSize = textureDimensions(outputTexture); + + if (texelCoord.x >= i32(outputSize.x) || texelCoord.y >= i32(outputSize.y)) { + return; + } + + let inputSize = textureDimensions(inputTexture); + let scale = vec2(inputSize) / vec2(outputSize); + + // Compute the floating-point source coordinate + let srcCoord = (vec2(texelCoord) + 0.5) * scale - 0.5; + + // Get integer coordinates for the four surrounding texels + let x0 = i32(floor(srcCoord.x)); + let x1 = min(x0 + 1, i32(inputSize.x) - 1); + let y0 = i32(floor(srcCoord.y)); + let y1 = min(y0 + 1, i32(inputSize.y) - 1); + + // Compute the weights + let wx = srcCoord.x - f32(x0); + let wy = srcCoord.y - f32(y0); + + // Fetch the four texels + let c00 = textureLoad(inputTexture, vec2(x0, y0), 0); + let c10 = textureLoad(inputTexture, vec2(x1, y0), 0); + let c01 = textureLoad(inputTexture, vec2(x0, y1), 0); + let c11 = textureLoad(inputTexture, vec2(x1, y1), 0); + + // Bilinear interpolation + let color = mix( + mix(c00, c10, wx), + mix(c01, c11, wx), + wy + ); + + textureStore(outputTexture, texelCoord, color); + } + `}),i=e.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,texture:{sampleType:"float"}},{binding:1,visibility:GPUShaderStage.COMPUTE,storageTexture:{format:"rgba8unorm",access:"write-only"}},{binding:2,visibility:GPUShaderStage.COMPUTE,sampler:{type:"filtering"}}]}),a=e.createPipelineLayout({bindGroupLayouts:[i]}),o=e.createComputePipeline({label:"ComputeMipmapPipeline",layout:a,compute:{module:n,entryPoint:"main"}}),s=e.createSampler({magFilter:"linear",minFilter:"linear"});for(let n=1;n>n),d=Math.max(1,t.height>>n),p=Math.ceil(c/8),m=Math.ceil(d/8);u.dispatchWorkgroups(p,m),u.end(),e.queue.submit([l.finish()])}}}},78742:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mutation_ensurePreInsertionValidity=g,t.mutation_preInsert=v,t.mutation_insert=y,t.mutation_append=function(e,t){return v(e,t,null)},t.mutation_replace=function(e,t,r){if(r._nodeType!==a.NodeType.Document&&r._nodeType!==a.NodeType.DocumentFragment&&r._nodeType!==a.NodeType.Element)throw new i.HierarchyRequestError(`Only document, document fragment and element nodes can contain child nodes. Parent node is ${r.nodeName}.`);if((0,c.tree_isHostIncludingAncestorOf)(r,t,!0))throw new i.HierarchyRequestError(`The node to be inserted cannot be an ancestor of parent node. Node is ${t.nodeName}, parent node is ${r.nodeName}.`);if(e._parent!==r)throw new i.NotFoundError(`The reference child node cannot be found under parent node. Child node is ${e.nodeName}, parent node is ${r.nodeName}.`);if(t._nodeType!==a.NodeType.DocumentFragment&&t._nodeType!==a.NodeType.DocumentType&&t._nodeType!==a.NodeType.Element&&t._nodeType!==a.NodeType.Text&&t._nodeType!==a.NodeType.ProcessingInstruction&&t._nodeType!==a.NodeType.CData&&t._nodeType!==a.NodeType.Comment)throw new i.HierarchyRequestError(`Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is ${t.nodeName}.`);if(t._nodeType===a.NodeType.Text&&r._nodeType===a.NodeType.Document)throw new i.HierarchyRequestError(`Cannot insert a text node as a child of a document node. Node is ${t.nodeName}.`);if(t._nodeType===a.NodeType.DocumentType&&r._nodeType!==a.NodeType.Document)throw new i.HierarchyRequestError(`A document type node can only be inserted under a document node. Parent node is ${r.nodeName}.`);if(r._nodeType===a.NodeType.Document){if(t._nodeType===a.NodeType.DocumentFragment){let n=0;for(let e of t._children)if(e._nodeType===a.NodeType.Element)n++;else if(e._nodeType===a.NodeType.Text)throw new i.HierarchyRequestError(`Cannot insert text a node as a child of a document node. Node is ${e.nodeName}.`);if(n>1)throw new i.HierarchyRequestError(`A document node can only have one document element node. Document fragment to be inserted has ${n} element nodes.`);if(1===n){for(let t of r._children)if(t._nodeType===a.NodeType.Element&&t!==e)throw new i.HierarchyRequestError("The document node already has a document element node.");let t=e._nextSibling;for(;t;){if(t._nodeType===a.NodeType.DocumentType)throw new i.HierarchyRequestError("Cannot insert an element node before a document type node.");t=t._nextSibling}}}else if(t._nodeType===a.NodeType.Element){for(let n of r._children)if(n._nodeType===a.NodeType.Element&&n!==e)throw new i.HierarchyRequestError(`Document already has a document element node. Node is ${t.nodeName}.`);let n=e._nextSibling;for(;n;){if(n._nodeType===a.NodeType.DocumentType)throw new i.HierarchyRequestError(`Cannot insert an element node before a document type node. Node is ${t.nodeName}.`);n=n._nextSibling}}else if(t._nodeType===a.NodeType.DocumentType){for(let n of r._children)if(n._nodeType===a.NodeType.DocumentType&&n!==e)throw new i.HierarchyRequestError(`Document already has a document type node. Node is ${t.nodeName}.`);let n=e._previousSibling;for(;n;){if(n._nodeType===a.NodeType.Element)throw new i.HierarchyRequestError(`Cannot insert a document type node before an element node. Node is ${t.nodeName}.`);n=n._previousSibling}}}let o=e._nextSibling;o===t&&(o=t._nextSibling);let s=e._previousSibling;(0,f.document_adopt)(t,r._nodeDocument);let l=[];null!==e._parent&&(l.push(e),b(e,e._parent,!0));let u=[];return t._nodeType===a.NodeType.DocumentFragment?u=Array.from(t._children):u.push(t),y(t,r,o,!0),n.dom.features.mutationObservers&&(0,m.observer_queueTreeMutationRecord)(r,u,l,s,o),e},t.mutation_replaceAll=function(e,t){null!==e&&(0,f.document_adopt)(e,t._nodeDocument);let r=Array.from(t._children),i=[];for(let n of(e&&e._nodeType===a.NodeType.DocumentFragment?i=Array.from(e._children):null!==e&&i.push(e),r))b(n,t,!0);null!==e&&y(e,t,null,!0),n.dom.features.mutationObservers&&(0,m.observer_queueTreeMutationRecord)(t,i,r,null,null)},t.mutation_preRemove=function(e,t){if(e._parent!==t)throw new i.NotFoundError(`The child node cannot be found under parent node. Child node is ${e.nodeName}, parent node is ${t.nodeName}.`);return b(e,t),e},t.mutation_remove=b;let n=r(60957),i=r(32008),a=r(5309),o=r(79663),s=r(16950),l=r(57226),u=r(17344),c=r(29963),d=r(80085),p=r(10871),m=r(38020),h=r(11455),f=r(72444);function g(e,t,r){let n=t._nodeType,o=e._nodeType,s=r?r._nodeType:null;if(n!==a.NodeType.Document&&n!==a.NodeType.DocumentFragment&&n!==a.NodeType.Element)throw new i.HierarchyRequestError(`Only document, document fragment and element nodes can contain child nodes. Parent node is ${t.nodeName}.`);if((0,c.tree_isHostIncludingAncestorOf)(t,e,!0))throw new i.HierarchyRequestError(`The node to be inserted cannot be an inclusive ancestor of parent node. Node is ${e.nodeName}, parent node is ${t.nodeName}.`);if(null!==r&&r._parent!==t)throw new i.NotFoundError(`The reference child node cannot be found under parent node. Child node is ${r.nodeName}, parent node is ${t.nodeName}.`);if(o!==a.NodeType.DocumentFragment&&o!==a.NodeType.DocumentType&&o!==a.NodeType.Element&&o!==a.NodeType.Text&&o!==a.NodeType.ProcessingInstruction&&o!==a.NodeType.CData&&o!==a.NodeType.Comment)throw new i.HierarchyRequestError(`Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is ${e.nodeName}.`);if(o===a.NodeType.Text&&n===a.NodeType.Document)throw new i.HierarchyRequestError(`Cannot insert a text node as a child of a document node. Node is ${e.nodeName}.`);if(o===a.NodeType.DocumentType&&n!==a.NodeType.Document)throw new i.HierarchyRequestError(`A document type node can only be inserted under a document node. Parent node is ${t.nodeName}.`);if(n===a.NodeType.Document){if(o===a.NodeType.DocumentFragment){let n=0;for(let t of e._children)if(t._nodeType===a.NodeType.Element)n++;else if(t._nodeType===a.NodeType.Text)throw new i.HierarchyRequestError(`Cannot insert text a node as a child of a document node. Node is ${t.nodeName}.`);if(n>1)throw new i.HierarchyRequestError(`A document node can only have one document element node. Document fragment to be inserted has ${n} element nodes.`);if(1===n){for(let e of t._children)if(e._nodeType===a.NodeType.Element)throw new i.HierarchyRequestError("The document node already has a document element node.");if(r){if(s===a.NodeType.DocumentType)throw new i.HierarchyRequestError("Cannot insert an element node before a document type node.");let e=r._nextSibling;for(;e;){if(e._nodeType===a.NodeType.DocumentType)throw new i.HierarchyRequestError("Cannot insert an element node before a document type node.");e=e._nextSibling}}}}else if(o===a.NodeType.Element){for(let r of t._children)if(r._nodeType===a.NodeType.Element)throw new i.HierarchyRequestError(`Document already has a document element node. Node is ${e.nodeName}.`);if(r){if(s===a.NodeType.DocumentType)throw new i.HierarchyRequestError(`Cannot insert an element node before a document type node. Node is ${e.nodeName}.`);let t=r._nextSibling;for(;t;){if(t._nodeType===a.NodeType.DocumentType)throw new i.HierarchyRequestError(`Cannot insert an element node before a document type node. Node is ${e.nodeName}.`);t=t._nextSibling}}}else if(o===a.NodeType.DocumentType){for(let r of t._children)if(r._nodeType===a.NodeType.DocumentType)throw new i.HierarchyRequestError(`Document already has a document type node. Node is ${e.nodeName}.`);if(r){let t=r._previousSibling;for(;t;){if(t._nodeType===a.NodeType.Element)throw new i.HierarchyRequestError(`Cannot insert a document type node before an element node. Node is ${e.nodeName}.`);t=t._previousSibling}}else{let r=t._firstChild;for(;r;){if(r._nodeType===a.NodeType.Element)throw new i.HierarchyRequestError(`Cannot insert a document type node before an element node. Node is ${e.nodeName}.`);r=r._nextSibling}}}}}function v(e,t,r){g(e,t,r);let n=r;return n===e&&(n=e._nextSibling),(0,f.document_adopt)(e,t._nodeDocument),y(e,t,n),e}function y(e,t,r,i){if(null===r&&e._nodeType!==a.NodeType.DocumentFragment)return void function(e,t,r){let i=t._lastChild;if(o.Guard.isElementNode(e)&&(o.Guard.isDocumentNode(t)&&(t._documentElement=e),e._nodeDocument._hasNamespaces||null===e._namespace&&null===e._namespacePrefix||(e._nodeDocument._hasNamespaces=!0)),e._parent=t,t._children.add(e),null===t._firstChild)e._previousSibling=null,e._nextSibling=null,t._firstChild=e,t._lastChild=e;else{let r=t._lastChild;e._previousSibling=r,e._nextSibling=null,r&&(r._nextSibling=e),r||(t._firstChild=e),t._lastChild=e}n.dom.features.slots&&null!==t._shadowRoot&&o.Guard.isSlotable(e)&&(0,p.shadowTree_assignASlot)(e),n.dom.features.steps&&o.Guard.isTextNode(e)&&(0,h.dom_runChildTextContentChangeSteps)(t),n.dom.features.slots&&o.Guard.isShadowRoot((0,c.tree_rootNode)(t))&&o.Guard.isSlot(t)&&(0,s.isEmpty)(t._assignedNodes)&&(0,p.shadowTree_signalASlotChange)(t),n.dom.features.slots&&(0,p.shadowTree_assignSlotablesForATree)((0,c.tree_rootNode)(e)),n.dom.features.steps&&(0,h.dom_runInsertionSteps)(e),n.dom.features.customElements&&o.Guard.isElementNode(e)&&(0,p.shadowTree_isConnected)(e)&&(o.Guard.isCustomElementNode(e)?(0,u.customElement_enqueueACustomElementCallbackReaction)(e,"connectedCallback",[]):(0,u.customElement_tryToUpgrade)(e)),n.dom.features.mutationObservers&&!r&&(0,m.observer_queueTreeMutationRecord)(t,[e],[],i,null)}(e,t,i);let d=e._nodeType===a.NodeType.DocumentFragment?e._children.size:1;if(null!==r&&0!==n.dom.rangeList.size){let e=(0,c.tree_index)(r);for(let r of n.dom.rangeList)r._start[0]===t&&r._start[1]>e&&(r._start[1]+=d),r._end[0]===t&&r._end[1]>e&&(r._end[1]+=d)}let f=e._nodeType===a.NodeType.DocumentFragment?Array(...e._children):[e];if(e._nodeType===a.NodeType.DocumentFragment)for(;e._firstChild;)b(e._firstChild,e,!0);n.dom.features.mutationObservers&&e._nodeType===a.NodeType.DocumentFragment&&(0,m.observer_queueTreeMutationRecord)(e,[],f,null,null);let g=r?r._previousSibling:t._lastChild,v=null===r?-1:(0,c.tree_index)(r);for(let e=0;er&&i._start[1]--,i._end[0]===t&&i._end[1]>r&&i._end[1]--;for(let e of n.dom.rangeList)e._start[0]===t&&e._start[1]>r&&(e._start[1]-=1),e._end[0]===t&&e._end[1]>r&&(e._end[1]-=1)}if(n.dom.features.steps)for(let t of(0,d.nodeIterator_iteratorList)())t._root._nodeDocument===e._nodeDocument&&(0,h.dom_runNodeIteratorPreRemovingSteps)(t,e);let i=e._previousSibling,a=e._nextSibling;o.Guard.isDocumentNode(t)&&o.Guard.isElementNode(e)&&(t._documentElement=null),e._parent=null,t._children.delete(e);let l=e._previousSibling,f=e._nextSibling;e._previousSibling=null,e._nextSibling=null,l&&(l._nextSibling=f),f&&(f._previousSibling=l),l||(t._firstChild=f),f||(t._lastChild=l),n.dom.features.slots&&o.Guard.isSlotable(e)&&null!==e._assignedSlot&&(0,p.shadowTree_isAssigned)(e)&&(0,p.shadowTree_assignSlotables)(e._assignedSlot),n.dom.features.slots&&o.Guard.isShadowRoot((0,c.tree_rootNode)(t))&&o.Guard.isSlot(t)&&(0,s.isEmpty)(t._assignedNodes)&&(0,p.shadowTree_signalASlotChange)(t),n.dom.features.slots&&null!==(0,c.tree_getFirstDescendantNode)(e,!0,!1,e=>o.Guard.isSlot(e))&&((0,p.shadowTree_assignSlotablesForATree)((0,c.tree_rootNode)(t)),(0,p.shadowTree_assignSlotablesForATree)(e)),n.dom.features.steps&&(0,h.dom_runRemovingSteps)(e,t),n.dom.features.customElements&&o.Guard.isCustomElementNode(e)&&(0,u.customElement_enqueueACustomElementCallbackReaction)(e,"disconnectedCallback",[]);let g=(0,c.tree_getFirstDescendantNode)(e,!1,!0);for(;null!==g;)n.dom.features.steps&&(0,h.dom_runRemovingSteps)(g,e),n.dom.features.customElements&&o.Guard.isCustomElementNode(g)&&(0,u.customElement_enqueueACustomElementCallbackReaction)(g,"disconnectedCallback",[]),g=(0,c.tree_getNextDescendantNode)(e,g,!1,!0);if(n.dom.features.mutationObservers){let r=(0,c.tree_getFirstAncestorNode)(t,!0);for(;null!==r;){for(let t of r._registeredObserverList)t.options.subtree&&e._registeredObserverList.push({observer:t.observer,options:t.options,source:t});r=(0,c.tree_getNextAncestorNode)(t,r,!0)}}n.dom.features.mutationObservers&&!r&&(0,m.observer_queueTreeMutationRecord)(t,[],[e],i,a),n.dom.features.steps&&o.Guard.isTextNode(e)&&(0,h.dom_runChildTextContentChangeSteps)(t)}},78744:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>s});var n=r(17042),i=r(62807),a={forceEmulation:!1,handleVAO:0,handleProgram:0,supported:!0,buffers:null,context:null};function o(e,t,r={}){Object.assign(t,a,r),t.buffers=[],n.Ay.obj(e,t),n.Ay.get(e,t,["supported"]),n.Ay.setGet(e,t,["forceEmulation"]),t.classHierarchy.push("vtkOpenGLVertexArrayObject"),e.exposedMethod=()=>{},e.initialize=()=>{t.instancingExtension=null,t._openGLRenderWindow.getWebgl2()||(t.instancingExtension=t.context.getExtension("ANGLE_instanced_arrays")),!t.forceEmulation&&t._openGLRenderWindow&&t._openGLRenderWindow.getWebgl2()?(t.extension=null,t.supported=!0,t.handleVAO=t.context.createVertexArray()):(t.extension=t.context.getExtension("OES_vertex_array_object"),!t.forceEmulation&&t.extension?(t.supported=!0,t.handleVAO=t.extension.createVertexArrayOES()):t.supported=!1)},e.isReady=()=>0!==t.handleVAO||!1===t.supported,e.bind=()=>{if(e.isReady()||e.initialize(),e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(t.handleVAO):t.context.bindVertexArray(t.handleVAO);else if(e.isReady()){let e=t.context;for(let r=0;r0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(i.index+r,1):e.vertexAttribDivisor(i.index+r,1))}}}},e.release=()=>{if(e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(null):t.context.bindVertexArray(null);else if(e.isReady()){let e=t.context;for(let r=0;r0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(i.index+r,0):e.vertexAttribDivisor(i.index+r,0)),e.disableVertexAttribArray(i.index+r)}}}},e.shaderProgramChanged=()=>{e.release(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.handleProgram=0},e.releaseGraphicsResources=()=>{e.shaderProgramChanged(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.supported=!0,t.handleProgram=0},e.addAttributeArray=(t,r,n,i,a,o,s,l)=>e.addAttributeArrayWithDivisor(t,r,n,i,a,o,s,l,0,!1),e.addAttributeArrayWithDivisor=(r,n,a,o,s,l,u,c,d,p)=>{if(!r||!r.isBound()||0===n.getHandle()||n.getType()!==i.a.ARRAY_BUFFER||(0===t.handleProgram&&(t.handleProgram=r.getHandle()),e.isReady()||e.initialize(),!e.isReady()||t.handleProgram!==r.getHandle()))return!1;let m=t.context,h={};if(h.name=a,h.index=m.getAttribLocation(t.handleProgram,a),h.offset=o,h.stride=s,h.type=l,h.size=u,h.normalize=c,h.isMatrix=p,h.divisor=d,-1===h.Index)return!1;if(n.bind(),m.enableVertexAttribArray(h.index),m.vertexAttribPointer(h.index,h.size,h.type,h.normalize,h.stride,h.offset),d>0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(h.index,1):m.vertexAttribDivisor(h.index,1)),h.buffer=n.getHandle(),!t.supported){let e=!1;for(let r=0;r{let d=e.addAttributeArrayWithDivisor(r,n,i,a,o,s,l,u,c,!0);if(!d)return d;let p=t.context,m=p.getAttribLocation(t.handleProgram,i);for(let e=1;e0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(m+e,1):p.vertexAttribDivisor(m+e,1));return!0},e.removeAttributeArray=r=>{if(!e.isReady()||0===t.handleProgram)return!1;if(!t.supported)for(let e=0;e{t._openGLRenderWindow!==r&&(e.releaseGraphicsResources(),t._openGLRenderWindow=r,t.context=null,r&&(t.context=t._openGLRenderWindow.getContext()))}}var s={newInstance:n.Ay.newInstance(o,"vtkOpenGLVertexArrayObject"),extend:o}},78985:(e,t,r)=>{"use strict";r.d(t,{A:()=>w});var n=r(50923),i=r(91336),a=r(70192),o=r(17964),s=r(78378),l=r(4101),u=r(33845),c=r(4546),d=r(62775),p=r(60212),m=r(74065),h=r(34699);let{getSubPixelSpacingAndXYDirections:f,addCanvasPointsToArray:g,getArea:v}=u.XL;function y(e,t,r){this.isEditingClosed=!0;let{currentPoints:n,element:i}=e.detail,u=n.canvas,c=(0,a.kJ)(i);if(!c)return;let{viewport:d}=c,p=t.data.contour.polyline.map(d.worldToCanvas),{spacing:m,xDir:h,yDir:g}=f(d,this.configuration.subPixelResolution);this.editData={prevCanvasPoints:p,editCanvasPoints:[u],startCrossingIndex:void 0,editIndex:0,annotation:t},this.commonData={annotation:t,viewportIdsToRender:r,spacing:m,xDir:h,yDir:g,movingTextBox:!1},o.wk.isInteractingWithTool=!0,i.addEventListener(s.sV.MOUSE_UP,this.mouseUpClosedContourEditCallback),i.addEventListener(s.sV.MOUSE_DRAG,this.mouseDragClosedContourEditCallback),i.addEventListener(s.sV.MOUSE_CLICK,this.mouseUpClosedContourEditCallback),i.addEventListener(s.sV.TOUCH_END,this.mouseUpClosedContourEditCallback),i.addEventListener(s.sV.TOUCH_DRAG,this.mouseDragClosedContourEditCallback),i.addEventListener(s.sV.TOUCH_TAP,this.mouseUpClosedContourEditCallback),(0,l.lY)(i)}function b(e){o.wk.isInteractingWithTool=!1,e.removeEventListener(s.sV.MOUSE_UP,this.mouseUpClosedContourEditCallback),e.removeEventListener(s.sV.MOUSE_DRAG,this.mouseDragClosedContourEditCallback),e.removeEventListener(s.sV.MOUSE_CLICK,this.mouseUpClosedContourEditCallback),e.removeEventListener(s.sV.TOUCH_END,this.mouseUpClosedContourEditCallback),e.removeEventListener(s.sV.TOUCH_DRAG,this.mouseDragClosedContourEditCallback),e.removeEventListener(s.sV.TOUCH_TAP,this.mouseUpClosedContourEditCallback),(0,l.Q_)(e)}function I(e){let{currentPoints:t,element:r}=e.detail,i=t.world,o=t.canvas,{viewport:s}=(0,a.kJ)(r),{viewportIdsToRender:l,xDir:u,yDir:c,spacing:d}=this.commonData,{editIndex:m,editCanvasPoints:h,startCrossingIndex:f,annotation:v}=this.editData;this.createMemo(r,v);let y=h[h.length-1],b=s.canvasToWorld(y),I=n.vt();n.Re(I,i,b);let x=Math.abs(n.Om(I,u)),C=Math.abs(n.Om(I,c));if(x<=d[0]&&C<=d[1])return;void 0!==f&&this.checkAndRemoveCrossesOnEditLine(e);let A=g(r,h,o,this.commonData);if(this.editData.editIndex=m+A,void 0===f&&h.length>1&&this.checkForFirstCrossing(e,!0),this.editData.snapIndex=this.findSnapIndex(),-1===this.editData.snapIndex)return void this.finishEditAndStartNewEdit(e);this.editData.fusedCanvasPoints=this.fuseEditPointsWithClosedContour(e),void 0!==f&&this.checkForSecondCrossing(e,!0)&&(this.removePointsAfterSecondCrossing(!0),this.finishEditAndStartNewEdit(e)),(0,p.A)(l)}function x(e){let{element:t}=e.detail,{viewport:r,renderingEngine:n}=(0,a.kJ)(t),{annotation:i,viewportIdsToRender:o}=this.commonData,{fusedCanvasPoints:s,editCanvasPoints:l}=this.editData;(0,m.A)(i,{points:s,closed:!0,targetWindingDirection:c.W.Clockwise},r),i.autoGenerated&&(i.autoGenerated=!1),(0,h.triggerAnnotationModified)(i,t);let u=l.pop();this.editData={prevCanvasPoints:s,editCanvasPoints:[u],startCrossingIndex:void 0,editIndex:0,snapIndex:void 0,annotation:i},(0,p.A)(o)}function C(e){let t,r,{prevCanvasPoints:n,editCanvasPoints:a,startCrossingIndex:o,snapIndex:s}=this.editData;if(void 0===o||void 0===s)return;let{element:l}=e.detail,u=[...a];g(l,u,n[s],this.commonData),u.length>a.length&&u.pop(),o>s?(t=s,r=o):(t=o,r=s);let c=i.Io(n[t],u[0]),d=i.Io(n[t],u[u.length-1]),p=i.Io(n[r],u[0]),m=i.Io(n[r],u[u.length-1]),h=[];for(let e=0;e=0;e--){let t=u[e];h.push([t[0],t[1]])}for(let e=r;e=0;e--){let t=u[e];b.push([t[0],t[1]])}return v(h)>v(b)?h:b}function A(e){let{element:t}=e.detail;this.completeClosedContourEdit(t)}function T(e){let{viewport:t}=(0,a.kJ)(e),{annotation:r,viewportIdsToRender:n}=this.commonData;this.doneEditMemo();let{fusedCanvasPoints:i,prevCanvasPoints:o}=this.editData;if(i){let n=(0,d.Q)(this.configuration,r)?(0,d.p)(this.configuration,i,o):i,a=this.configuration?.decimate||{};(0,m.A)(r,{points:n,closed:!0,targetWindingDirection:c.W.Clockwise},t,{decimate:{enabled:!!a.enabled,epsilon:a.epsilon}}),r.autoGenerated&&(r.autoGenerated=!1),(0,h.triggerAnnotationModified)(r,e)}this.isEditingClosed=!1,this.editData=void 0,this.commonData=void 0,(0,p.A)(n),this.deactivateClosedContourEdit(e)}function S(e){this.completeClosedContourEdit(e)}let w=function(e){e.activateClosedContourEdit=y.bind(e),e.deactivateClosedContourEdit=b.bind(e),e.mouseDragClosedContourEditCallback=I.bind(e),e.mouseUpClosedContourEditCallback=A.bind(e),e.finishEditAndStartNewEdit=x.bind(e),e.fuseEditPointsWithClosedContour=C.bind(e),e.cancelClosedContourEdit=S.bind(e),e.completeClosedContourEdit=T.bind(e)}},79026:(e,t,r)=>{"use strict";var n=r(17042),i=r(72188),a=r(74978),o=r(85250),s={keyMatrixTime:null,keyMatrices:null},l=n.Ay.newInstance(function(e,t,r={}){Object.assign(t,s,r),i.A.extend(e,t,r),t.keyMatrixTime={},n.Ay.obj(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(16),vcpc:new Float64Array(16),pcsc:new Float64Array(16),wcvc:new Float64Array(16),scpc:new Float64Array(16),scvc:new Float64Array(16)},n.Ay.setGet(e,t,["keyMatrixTime"]),t.classHierarchy.push("vtkWebGPUCamera"),e.getProjectionMatrix=(e,r,n,i)=>{if(o.identity(e),t.renderable.getParallelProjection()){let a=t.renderable.getParallelScale(),o=a*r,s=(i[0]-1)*o,l=(i[0]+1)*o,u=(i[1]-1)*a,c=(i[1]+1)*a,d=1/(l-s),p=1/(c-u);e[0]=2*d,e[5]=2*p,e[10]=1/(n[1]-n[0]),e[12]=(l+s)*d,e[13]=(c+u)*p,e[14]=n[1]/(n[1]-n[0])}else{let a,o,s=Math.tan(Math.PI*t.renderable.getViewAngle()/360);!0===t.renderable.getUseHorizontalViewAngle()?(a=n[0]*s,o=n[0]*s/r):(a=n[0]*s*r,o=n[0]*s);let l=(i[0]-1)*a,u=(i[0]+1)*a,c=(i[1]-1)*o,d=(i[1]+1)*o;e[0]=2*n[0]/(u-l),e[5]=2*n[0]/(d-c),e[12]=(l+u)/(u-l),e[13]=(c+d)/(d-c),e[10]=0,e[14]=n[0],e[11]=-1,e[15]=0}},e.convertToOpenGLDepth=e=>{if(t.renderable.getParallelProjection())return 1-e;let r=t.renderable.getClippingRangeByReference(),n=-r[0]/e;return .5*(n=(r[0]+r[1])/(r[1]-r[0])+2*r[0]*r[1]/(n*(r[1]-r[0])))+.5},e.getKeyMatrices=r=>{let n=r.getRenderable();if(Math.max(r.getParent().getMTime(),e.getMTime(),n.getMTime(),t.renderable.getMTime(),r.getStabilizedTime())>t.keyMatrixTime.getMTime()){let n=t.renderable.getViewMatrix();o.copy(t.keyMatrices.normalMatrix,n),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,o.invert(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),o.transpose(t.keyMatrices.wcvc,n);let i=r.getStabilizedCenterByReference();o.translate(t.keyMatrices.scvc,t.keyMatrices.wcvc,i);let a=r.getAspectRatio(),s=t.renderable.getClippingRangeByReference();e.getProjectionMatrix(t.keyMatrices.vcpc,a,s,t.renderable.getWindowCenterByReference()),o.multiply(t.keyMatrices.scpc,t.keyMatrices.vcpc,t.keyMatrices.scvc),o.invert(t.keyMatrices.pcsc,t.keyMatrices.scpc),t.keyMatrixTime.modified()}return t.keyMatrices}});(0,a.c9)("vtkCamera",l)},79159:(e,t,r)=>{"use strict";r.d(t,{J1:()=>a,aV:()=>i});var n=r(91336);function i(e,t,r){return"orthogonalT"===r?function(e,t){let r=e[0],i=e[e.length-1],a=n.jb(n.vt(),i,r);n.S8(a,a);let o=[a[0],a[1]],s=[(r[0]+i[0])/2,(r[1]+i[1])/2],l=n.vt(),u=null,c=null,d=null;for(let t of e){n.jb(l,t,s);let e=n.Om(o,l);if(null!==u&&u*e<0){let r=Math.abs(u)/(Math.abs(u)+Math.abs(e));d=[c[0]+r*(t[0]-c[0]),c[1]+r*(t[1]-c[1])];break}if(1e-10>Math.abs(e)){d=t;break}u=e,c=t}return d?[d,s].map(t.canvasToWorld):(console.warn("No orthogonal intersection found for open U-shaped contour"),null)}(e,t):"lineSegment"===r?null:r?function(e,t){let r=e[0],i=e[e.length-1],a=n.vt();n.hZ(a,i[0]-r[0],i[1]-r[1]),n.S8(a,a);let o=n.vt(),s=n.vt();n.hZ(o,-a[1],a[0]),n.hZ(s,a[1],-a[0]);let l=[(r[0]+i[0])/2,(r[1]+i[1])/2],u={dist:0,index:null};for(let t=0;tu.dist&&(u.dist=i,u.index=t)}return[e[u.index],l].map(t.canvasToWorld)}(e,t):null}function a(e,t){let{viewport:r}=e;return i(t.data.contour.polyline.map(r.worldToCanvas),r,t.data.isOpenUShapeContour)}},79239:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JSONReader=void 0;let n=r(23246),i=r(9128);class a extends i.BaseReader{_parse(e,t){return new n.ObjectReader(this._builderOptions).parse(e,JSON.parse(t))}}t.JSONReader=a},79267:(e,t,r)=>{"use strict";r.d(t,{p8:()=>i,T0:()=>a.A,Cf:()=>n.A,E3:()=>o}),r(14645);var n=r(34693);let i=.001;var a=r(99963);let o=[{name:"CT-AAA",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"12 -3024 0 143.556 0 166.222 0.686275 214.389 0.696078 419.736 0.833333 3071 0.803922",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"24 -3024 0 0 0 143.556 0.615686 0.356863 0.184314 166.222 0.882353 0.603922 0.290196 214.389 1 1 1 419.736 1 0.937033 0.954531 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-AAA2",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"16 -3024 0 129.542 0 145.244 0.166667 157.02 0.5 169.918 0.627451 395.575 0.8125 1578.73 0.8125 3071 0.8125",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"32 -3024 0 0 0 129.542 0.54902 0.25098 0.14902 145.244 0.6 0.627451 0.843137 157.02 0.890196 0.47451 0.6 169.918 0.992157 0.870588 0.392157 395.575 1 0.886275 0.658824 1578.73 1 0.829256 0.957922 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Bone",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"8 -3024 0 -16.4458 0 641.385 0.715686 3071 0.705882",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"16 -3024 0 0 0 -16.4458 0.729412 0.254902 0.301961 641.385 0.905882 0.815686 0.552941 3071 1 1 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Bones",gradientOpacity:"4 0 1 985.12 1",specularPower:"1",scalarOpacity:"8 -1000 0 152.19 0 278.93 0.190476 952 0.2",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"20 -1000 0.3 0.3 1 -488 0.3 1 0.3 463.28 1 0 0 659.15 1 0.912535 0.0374849 953 1 0.3 0.3",diffuse:"1",interpolation:"1"},{name:"CT-Cardiac",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"12 -3024 0 -77.6875 0 94.9518 0.285714 179.052 0.553571 260.439 0.848214 3071 0.875",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"24 -3024 0 0 0 -77.6875 0.54902 0.25098 0.14902 94.9518 0.882353 0.603922 0.290196 179.052 1 0.937033 0.954531 260.439 0.615686 0 0 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Cardiac2",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"12 -3024 0 42.8964 0 163.488 0.428571 277.642 0.776786 1587 0.754902 3071 0.754902",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"24 -3024 0 0 0 42.8964 0.54902 0.25098 0.14902 163.488 0.917647 0.639216 0.0588235 277.642 1 0.878431 0.623529 1587 1 1 1 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Cardiac3",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"14 -3024 0 -86.9767 0 45.3791 0.169643 139.919 0.589286 347.907 0.607143 1224.16 0.607143 3071 0.616071",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"28 -3024 0 0 0 -86.9767 0 0.25098 1 45.3791 1 0 0 139.919 1 0.894893 0.894893 347.907 1 1 0.25098 1224.16 1 1 1 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Chest-Contrast-Enhanced",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"10 -3024 0 67.0106 0 251.105 0.446429 439.291 0.625 3071 0.616071",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"20 -3024 0 0 0 67.0106 0.54902 0.25098 0.14902 251.105 0.882353 0.603922 0.290196 439.291 1 0.937033 0.954531 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Chest-Vessels",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"10 -3024 0 -1278.35 0 22.8277 0.428571 439.291 0.625 3071 0.616071",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"20 -3024 0 0 0 -1278.35 0.54902 0.25098 0.14902 22.8277 0.882353 0.603922 0.290196 439.291 1 0.937033 0.954531 3071 0.827451 0.658824 1",diffuse:"1",interpolation:"1"},{name:"CT-Coronary-Arteries",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"12 -2048 0 136.47 0 159.215 0.258929 318.43 0.571429 478.693 0.776786 3661 1",specular:"0",shade:"0",ambient:"0.2",colorTransfer:"24 -2048 0 0 0 136.47 0 0 0 159.215 0.159804 0.159804 0.159804 318.43 0.764706 0.764706 0.764706 478.693 1 1 1 3661 1 1 1",diffuse:"1",interpolation:"1"},{name:"CT-Coronary-Arteries-2",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"14 -2048 0 142.677 0 145.016 0.116071 192.174 0.5625 217.24 0.776786 384.347 0.830357 3661 0.830357",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"28 -2048 0 0 0 142.677 0 0 0 145.016 0.615686 0 0.0156863 192.174 0.909804 0.454902 0 217.24 0.972549 0.807843 0.611765 384.347 0.909804 0.909804 1 3661 1 1 1",diffuse:"1",interpolation:"1"},{name:"CT-Coronary-Arteries-3",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"14 -2048 0 128.643 0 129.982 0.0982143 173.636 0.669643 255.884 0.857143 584.878 0.866071 3661 1",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"28 -2048 0 0 0 128.643 0 0 0 129.982 0.615686 0 0.0156863 173.636 0.909804 0.454902 0 255.884 0.886275 0.886275 0.886275 584.878 0.968627 0.968627 0.968627 3661 1 1 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Cropped-Volume-Bone",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"10 -2048 0 -451 0 -450 1 1050 1 3661 1",specular:"0",shade:"0",ambient:"0.2",colorTransfer:"20 -2048 0 0 0 -451 0 0 0 -450 0.0556356 0.0556356 0.0556356 1050 1 1 1 3661 1 1 1",diffuse:"1",interpolation:"1"},{name:"CT-Fat",gradientOpacity:"6 0 1 985.12 1 988 1",specularPower:"1",scalarOpacity:"14 -1000 0 -100 0 -99 0.15 -60 0.15 -59 0 101.2 0 952 0",specular:"0",shade:"0",ambient:"0.2",colorTransfer:"36 -1000 0.3 0.3 1 -497.5 0.3 1 0.3 -99 0 0 1 -76.946 0 1 0 -65.481 0.835431 0.888889 0.0165387 83.89 1 0 0 463.28 1 0 0 659.15 1 0.912535 0.0374849 2952 1 0.300267 0.299886",diffuse:"1",interpolation:"1"},{name:"CT-Liver-Vasculature",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"14 -2048 0 149.113 0 157.884 0.482143 339.96 0.660714 388.526 0.830357 1197.95 0.839286 3661 0.848214",specular:"0",shade:"0",ambient:"0.2",colorTransfer:"28 -2048 0 0 0 149.113 0 0 0 157.884 0.501961 0.25098 0 339.96 0.695386 0.59603 0.36886 388.526 0.854902 0.85098 0.827451 1197.95 1 1 1 3661 1 1 1",diffuse:"1",interpolation:"1"},{name:"CT-Lung",gradientOpacity:"6 0 1 985.12 1 988 1",specularPower:"1",scalarOpacity:"12 -1000 0 -600 0 -599 0.15 -400 0.15 -399 0 2952 0",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"24 -1000 0.3 0.3 1 -600 0 0 1 -530 0.134704 0.781726 0.0724558 -460 0.929244 1 0.109473 -400 0.888889 0.254949 0.0240258 2952 1 0.3 0.3",diffuse:"1",interpolation:"1"},{name:"CT-MIP",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"8 -3024 0 -637.62 0 700 1 3071 1",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"16 -3024 0 0 0 -637.62 1 1 1 700 1 1 1 3071 1 1 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Muscle",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"10 -3024 0 -155.407 0 217.641 0.676471 419.736 0.833333 3071 0.803922",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"20 -3024 0 0 0 -155.407 0.54902 0.25098 0.14902 217.641 0.882353 0.603922 0.290196 419.736 1 0.937033 0.954531 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Pulmonary-Arteries",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"14 -2048 0 -568.625 0 -364.081 0.0714286 -244.813 0.401786 18.2775 0.607143 447.798 0.830357 3592.73 0.839286",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"28 -2048 0 0 0 -568.625 0 0 0 -364.081 0.396078 0.301961 0.180392 -244.813 0.611765 0.352941 0.0705882 18.2775 0.843137 0.0156863 0.156863 447.798 0.752941 0.752941 0.752941 3592.73 1 1 1",diffuse:"1",interpolation:"1"},{name:"CT-Soft-Tissue",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"10 -2048 0 -167.01 0 -160 1 240 1 3661 1",specular:"0",shade:"0",ambient:"0.2",colorTransfer:"20 -2048 0 0 0 -167.01 0 0 0 -160 0.0556356 0.0556356 0.0556356 240 1 1 1 3661 1 1 1",diffuse:"1",interpolation:"1"},{name:"CT-Air",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"8 -3024 0.705882 -900.0 0.715686 -500.0 0 3071 0",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"16 -3024 1 1 1 -900.0 0.2 1.0 1.0 -500.0 0.3 0.3 1.0 3071 0 0 0 ",diffuse:"0.9",interpolation:"1"},{name:"MR-Angio",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"12 -2048 0 151.354 0 158.279 0.4375 190.112 0.580357 200.873 0.732143 3661 0.741071",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"24 -2048 0 0 0 151.354 0 0 0 158.279 0.74902 0.376471 0 190.112 1 0.866667 0.733333 200.873 0.937255 0.937255 0.937255 3661 1 1 1",diffuse:"1",interpolation:"1"},{name:"MR-Default",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"12 0 0 20 0 40 0.15 120 0.3 220 0.375 1024 0.5",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"24 0 0 0 0 20 0.168627 0 0 40 0.403922 0.145098 0.0784314 120 0.780392 0.607843 0.380392 220 0.847059 0.835294 0.788235 1024 1 1 1",diffuse:"1",interpolation:"1"},{name:"MR-MIP",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"8 0 0 98.3725 0 416.637 1 2800 1",specular:"0",shade:"0",ambient:"0.2",colorTransfer:"16 0 1 1 1 98.3725 1 1 1 416.637 1 1 1 2800 1 1 1",diffuse:"1",interpolation:"1"},{name:"MR-T2-Brain",gradientOpacity:"4 0 1 160.25 1",specularPower:"40",scalarOpacity:"10 0 0 36.05 0 218.302 0.171429 412.406 1 641 1",specular:"0.5",shade:"1",ambient:"0.3",colorTransfer:"16 0 0 0 0 98.7223 0.956863 0.839216 0.192157 412.406 0 0.592157 0.807843 641 1 1 1",diffuse:"0.6",interpolation:"1"},{name:"DTI-FA-Brain",gradientOpacity:"4 0 1 0.9950 1",specularPower:"40",scalarOpacity:"16 0 0 0 0 0.3501 0.0158 0.49379 0.7619 0.6419 1 0.9920 1 0.9950 0 0.9950 0",specular:"0.5",shade:"1",ambient:"0.3",colorTransfer:"28 0 1 0 0 0 1 0 0 0.24974 0.4941 1 0 0.49949 0 0.9882 1 0.7492 0.51764 0 1 0.9950 1 0 0 0.9950 1 0 0",diffuse:"0.9",interpolation:"1"}]},79541:(e,t,r)=>{"use strict";r.d(t,{Y:()=>l});let n={renderOutline:!0,outlineWidthAutoGenerated:3,outlineWidth:1,outlineWidthInactive:1,outlineOpacity:1,outlineOpacityInactive:.85,outlineDash:void 0,outlineDashInactive:void 0,outlineDashAutoGenerated:"5,3",activeSegmentOutlineWidthDelta:0,renderFill:!0,fillAlpha:.5,fillAlphaInactive:.3,fillAlphaAutoGenerated:.3},i={renderOutline:!0,renderOutlineInactive:!0,outlineWidth:3,outlineWidthInactive:2,activeSegmentOutlineWidthDelta:0,renderFill:!0,renderFillInactive:!0,fillAlpha:.5,fillAlphaInactive:.4,outlineOpacity:1,outlineOpacityInactive:.85};var a=r(78378),o=r(70192);class s{constructor(){this.config={global:{},segmentations:{},viewportsStyle:{}}}setStyle(e,t,r=!0){let n,{viewportId:i,segmentationId:a,type:o,segmentIndex:s}=e,l=this.getStyle(e),u=r?{...l,...t}:t;if(n=(i||a)&&r?this.copyActiveToInactiveIfNotProvided(u,o):u,!o)throw Error("Type is required to set a style");if(i){this.config.viewportsStyle[i]||(this.config.viewportsStyle[i]={renderInactiveSegmentations:!1,representations:{}});let e=this.config.viewportsStyle[i].representations;if(a){e[a]||(e[a]={}),e[a][o]||(e[a][o]={});let t=e[a][o];void 0!==s?(t.perSegment||(t.perSegment={}),t.perSegment[s]=n):t.allSegments=n}else{let t="__allSegmentations__";e[t]||(e[t]={}),e[t][o]||(e[t][o]={}),e[t][o].allSegments=n}}else if(a){this.config.segmentations[a]||(this.config.segmentations[a]={}),this.config.segmentations[a][o]||(this.config.segmentations[a][o]={});let e=this.config.segmentations[a][o];void 0!==s?(e.perSegment||(e.perSegment={}),e.perSegment[s]=n):e.allSegments=n}else this.config.global[o]=n}copyActiveToInactiveIfNotProvided(e,t){let r={...e};return t===a.D_.Labelmap?(r.renderOutlineInactive??=r.renderOutline,r.outlineWidthInactive??=r.outlineWidth,r.renderFillInactive??=r.renderFill,r.fillAlphaInactive??=r.fillAlpha,r.outlineOpacityInactive??=r.outlineOpacity):t===a.D_.Contour&&(r.outlineWidthInactive??=r.outlineWidth,r.outlineOpacityInactive??=r.outlineOpacity,r.outlineDashInactive??=r.outlineDash,r.renderOutlineInactive??=r.renderOutline,r.renderFillInactive??=r.renderFill,r.fillAlphaInactive??=r.fillAlpha),r}getStyle(e){let{viewportId:t,segmentationId:r,type:n,segmentIndex:i}=e,a=this.getDefaultStyle(n);if(this.config.global[n]&&(a={...a,...this.config.global[n]}),this.config.segmentations[r]?.[n]&&(a={...a,...this.config.segmentations[r][n].allSegments},void 0!==i&&this.config.segmentations[r][n].perSegment?.[i]&&(a={...a,...this.config.segmentations[r][n].perSegment[i]})),t&&this.config.viewportsStyle[t]){this.config.viewportsStyle[t].renderInactiveSegmentations;let e="__allSegmentations__";this.config.viewportsStyle[t].representations[e]?.[n]&&(a={...a,...this.config.viewportsStyle[t].representations[e][n].allSegments}),r&&this.config.viewportsStyle[t].representations[r]?.[n]&&(a={...a,...this.config.viewportsStyle[t].representations[r][n].allSegments},void 0!==i&&this.config.viewportsStyle[t].representations[r][n].perSegment?.[i]&&(a={...a,...this.config.viewportsStyle[t].representations[r][n].perSegment[i]}))}return a}getRenderInactiveSegmentations(e){return this.config.viewportsStyle[e]?.renderInactiveSegmentations}setRenderInactiveSegmentations(e,t){this.config.viewportsStyle[e]||(this.config.viewportsStyle[e]={renderInactiveSegmentations:!1,representations:{}}),this.config.viewportsStyle[e].renderInactiveSegmentations=t}getDefaultStyle(e){switch(e){case a.D_.Labelmap:return i;case a.D_.Contour:return n;case a.D_.Surface:return{};default:throw Error(`Unknown representation type: ${e}`)}}clearSegmentationStyle(e){this.config.segmentations[e]&&delete this.config.segmentations[e]}clearAllSegmentationStyles(){this.config.segmentations={}}clearViewportStyle(e){this.config.viewportsStyle[e]&&delete this.config.viewportsStyle[e]}clearAllViewportStyles(){for(let e in this.config.viewportsStyle){let t=this.config.viewportsStyle[e].renderInactiveSegmentations;this.config.viewportsStyle[e]={renderInactiveSegmentations:t,representations:{}}}}resetToGlobalStyle(){this.clearAllSegmentationStyles(),this.clearAllViewportStyles()}hasCustomStyle(e){let{type:t}=e,r=this.getStyle(e),n=this.getDefaultStyle(t);return!o.BF.deepEqual(r,n)}}let l=new s},79657:(e,t,r)=>{"use strict";r.d(t,{S8:()=>c,jq:()=>u,sB:()=>d});var n=r(39216),i=r(79267),a=r(77280),o=r(50923);let{T0:s}=i,{KY:l}=a;function u(e,t,r,n){let i;switch(n){case l.AXIAL:case l.AXIAL_REFORMAT:i=s.axial;break;case l.SAGITTAL:case l.SAGITTAL_REFORMAT:i=s.sagittal;break;case l.CORONAL:case l.CORONAL_REFORMAT:i=s.coronal;break;case l.REFORMAT:switch(d(r)){case l.AXIAL:i=s.axial;break;case l.SAGITTAL:i=s.sagittal;break;case l.CORONAL:i=s.coronal;break;default:i=s.axial}break;default:i=s.axial}let a=o.S8(o.vt(),e),u=[a,o.S8(o.vt(),t),o.S8(o.vt(),r)],c=[o.fA(i.viewRight[0],i.viewRight[1],i.viewRight[2]),o.fA(i.viewUp[0],i.viewUp[1],i.viewUp[2]),o.fA(i.viewPlaneNormal[0],i.viewPlaneNormal[1],i.viewPlaneNormal[2])],p=new Set,m=e=>{let t=0,r=-2,n=!1;u.forEach((i,a)=>{if(p.has(a))return;let s=o.Om(e,i),l=Math.abs(s);l>r&&(r=l,t=a,n=s<0)}),p.add(t);let i=o.o8(u[t]);return n&&o.ze(i,i),i},h=m(c[0]),f=m(c[1]),g=m(c[2]);return{viewPlaneNormal:[g[0],g[1],g[2]],viewUp:[f[0],f[1],f[2]],viewRight:[h[0],h[1],h[2]]}}function c(e,t){if(!e.getActors()?.length)return;e.type!==a.NV.ORTHOGRAPHIC&&console.warn("Viewport should be a volume viewport");let r=e.getCurrentImageId();if(r||(r=e.getImageIds()?.[0]),!r)return;let{imageOrientationPatient:i}=n.get(a.nb.IMAGE_PLANE,r),s=o.fA(i[0],i[1],i[2]),c=o.fA(i[3],i[4],i[5]),p=o.$A(o.vt(),s,c),{orientation:m}=t||{},{useViewportNormal:h}=t||{},f=p;return h&&(f=e.getCamera().viewPlaneNormal),m&&m!==l.REFORMAT||(m=d(f)),u(s,c,p,m)}function d(e){let t=o.S8(o.vt(),e),r=o.fA(s.axial.viewPlaneNormal[0],s.axial.viewPlaneNormal[1],s.axial.viewPlaneNormal[2]),n=o.fA(s.sagittal.viewPlaneNormal[0],s.sagittal.viewPlaneNormal[1],s.sagittal.viewPlaneNormal[2]),i=o.fA(s.coronal.viewPlaneNormal[0],s.coronal.viewPlaneNormal[1],s.coronal.viewPlaneNormal[2]),a=Math.abs(o.Om(t,r)),u=Math.abs(o.Om(t,n)),c=Math.abs(o.Om(t,i));return a>=u&&a>=c?l.AXIAL:u>=c?l.SAGITTAL:l.CORONAL}},79663:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EmptySet=t.Guard=t.Cast=void 0;var n=r(68470);Object.defineProperty(t,"Cast",{enumerable:!0,get:function(){return n.Cast}});var i=r(32090);Object.defineProperty(t,"Guard",{enumerable:!0,get:function(){return i.Guard}});var a=r(7506);Object.defineProperty(t,"EmptySet",{enumerable:!0,get:function(){return a.EmptySet}})},79923:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=e=>{let t="volumeId:",r=e.includes(t)?e.substring(t.length):e,n=r.indexOf("sliceIndex=");return -1===n?r:r.substring(0,n-1)}},80039:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>c});var n=r(17042),i=r(72188),a=r(56929),{vtkDebugMacro:o}=n.o$,s={context:null,_openGLRenderWindow:null,selector:null};function l(e,t,r={}){Object.assign(t,s,r),i.A.extend(e,t,r),(0,n.Jt)(e,t,["shaderCache"]),(0,n.V0)(e,t,["selector"]),(0,n.Vy)(e,t,["openGLRenderWindow"]),t.classHierarchy.push("vtkOpenGLRenderer"),e.buildPass=r=>{r&&t.renderable&&(e.updateLights(),e.prepareNodes(),e.addMissingNode(t.renderable.getActiveCamera()),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps(),!0),e.removeUnusedNodes())},e.updateLights=()=>{let e=0,r=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(o("No lights are on, creating one."),t.renderable.createLight()),e},e.zBufferPass=r=>{if(r){let r=0,n=t.context;t.renderable.getTransparent()||(t.context.clearColor(1,0,0,1),r|=n.COLOR_BUFFER_BIT),t.renderable.getPreserveDepthBuffer()||(n.clearDepth(1),r|=n.DEPTH_BUFFER_BIT,t.context.depthMask(!0));let i=e.getTiledSizeAndOrigin();n.enable(n.SCISSOR_TEST),n.scissor(i.lowerLeftU,i.lowerLeftV,i.usize,i.vsize),n.viewport(i.lowerLeftU,i.lowerLeftV,i.usize,i.vsize),n.colorMask(!0,!0,!0,!0),r&&n.clear(r),n.enable(n.DEPTH_TEST)}},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.cameraPass=t=>{t&&e.clear()},e.getAspectRatio=()=>{let e=t._parent.getSizeByReference(),r=t.renderable.getViewportByReference();return e[0]*(r[2]-r[0])/((r[3]-r[1])*e[1])},e.getTiledSizeAndOrigin=()=>{let e=t.renderable.getViewportByReference(),r=e[0]-0,n=e[1]-0,i=t._parent.normalizedDisplayToDisplay(r,n),a=Math.round(i[0]),o=Math.round(i[1]),s=e[2]-0,l=e[3]-0,u=t._parent.normalizedDisplayToDisplay(s,l),c=Math.round(u[0])-a,d=Math.round(u[1])-o;return c<0&&(c=0),d<0&&(d=0),{usize:c,vsize:d,lowerLeftU:a,lowerLeftV:o}},e.clear=()=>{let r=0,n=t.context;if(!t.renderable.getTransparent()){let e=t.renderable.getBackgroundByReference();n.clearColor(e[0],e[1],e[2],e[3]),r|=n.COLOR_BUFFER_BIT}t.renderable.getPreserveDepthBuffer()||(n.clearDepth(1),r|=n.DEPTH_BUFFER_BIT,n.depthMask(!0)),n.colorMask(!0,!0,!0,!0);let i=e.getTiledSizeAndOrigin();n.enable(n.SCISSOR_TEST),n.scissor(i.lowerLeftU,i.lowerLeftV,i.usize,i.vsize),n.viewport(i.lowerLeftU,i.lowerLeftV,i.usize,i.vsize),r&&n.clear(r),n.enable(n.DEPTH_TEST)},e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources(),t.renderable&&t.renderable.getViewProps().forEach(e=>{e.modified()})},e.setOpenGLRenderWindow=r=>{t._openGLRenderWindow!==r&&(e.releaseGraphicsResources(),t._openGLRenderWindow=r,t.context=null,r&&(t.context=t._openGLRenderWindow.getContext()))}}var u=(0,n.UI)(l,"vtkOpenGLRenderer"),c={newInstance:u,extend:l};(0,a.c9)("vtkRenderer",u)},80069:(e,t,r)=>{"use strict";r.d(t,{b:()=>h,y:()=>f});var n=r(17042),i=r(87352),a=r(69927),o=r(73543),s=r(68916),l=r(78744),u=r(86077),{vtkErrorMacro:c}=n.Ay,d={framebuffer:null,convolutionShader:null,tris:null,kernel:[0,0,0,0,1,0,0,0,0],oldKernelDimension:3,kernelDimension:3},p={newInstance:n.Ay.newInstance(function(e,t,r={}){Object.assign(t,d,r),s.Ay.extend(e,t,r),t.VBOBuildTime={},n.Ay.obj(t.VBOBuildTime,{mtime:0}),t.tris=u.Ay.newInstance(),n.Ay.setGet(e,t,["kernel","kernelDimension"]),n.Ay.get(e,t,["framebuffer"]),t.classHierarchy.push("vtkConvolution2DPass"),e.computeKernelWeight=function(e){let t=e.reduce((e,t)=>e+t,0);return t<=0?1:t},e.traverse=(r,n=null)=>{if(t.deleted)return;if(t.kernelDimension%2!=1)return void c("Invalid kernel dimension! Kernel dimension must be odd (e.g. 3, 5, 7, ...).");let i=t.kernelDimension*t.kernelDimension;if(null===t.kernel&&(t.kernel=new Float32Array(i),t.kernel[Math.floor(i/2)]=1),t.kernel.length!==i)return void c(`The given kernel is invalid. 2D convolution kernels have to be 1D arrays with ${i} components representing the ${t.kernelDimension}x${t.kernelDimension} kernel in row-major form.`);null===t.framebuffer&&(t.framebuffer=o.Ay.newInstance());let a=r.getSize(),s=r.getContext();if(null===s)return void t.delegates.forEach(t=>{t.traverse(r,e)});t.VBOBuildTime.getMTime(){t.traverse(r,e)}),t.framebuffer.restorePreviousBindingsAndBuffers(),null!==t.convolutionShader&&t.oldKernelDimension!==t.kernelDimension&&(t.convolutionShader=null,t.oldKernelDimension=t.kernelDimension),null===t.convolutionShader){t.convolutionShader=r.getShaderCache().readyShaderProgramArray("//VTK::System::Dec\nattribute vec4 vertexDC;\nattribute vec2 tcoordTC;\nvarying vec2 tcoord;\nvoid main() { tcoord = tcoordTC; gl_Position = vertexDC; }",e.getFragmentShaderCode(t.kernelDimension),"");let n=t.convolutionShader;t.copyVAO=l.Ay.newInstance(),t.copyVAO.setOpenGLRenderWindow(r),t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(n,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),s.FLOAT,3,s.FALSE)||c("Error setting vertexDC in copy shader VAO."),t.copyVAO.addAttributeArray(n,t.tris.getCABO(),"tcoordTC",t.tris.getCABO().getTCoordOffset(),t.tris.getCABO().getStride(),s.FLOAT,2,s.FALSE)||c("Error setting vertexDC in copy shader VAO.")}else r.getShaderCache().readyShaderProgram(t.convolutionShader);s.viewport(0,0,a[0],a[1]),s.scissor(0,0,a[0],a[1]);let d=t.framebuffer.getColorTexture();d.activate(),t.convolutionShader.setUniformi("u_image",d.getTextureUnit()),t.convolutionShader.setUniform2f("u_textureSize",d.getWidth(),d.getHeight()),t.convolutionShader.setUniformfv("u_kernel",t.kernel),t.convolutionShader.setUniformf("u_kernelWeight",e.computeKernelWeight(t.kernel)),s.drawArrays(s.TRIANGLES,0,t.tris.getCABO().getElementCount()),d.deactivate()},e.getFragmentShaderCode=e=>{let t=e*e,r=`//VTK::System::Dec +//VTK::Output::Dec +uniform sampler2D u_image; +uniform vec2 u_textureSize; +uniform float u_kernel[${t}]; +uniform float u_kernelWeight; +varying vec2 tcoord; +void main(){ + vec2 onePixel = vec2(1.0, 1.0) / u_textureSize; + vec4 colorSum = +`,n=Math.floor(e/2),i=0;for(let e=-n;e<=n;++e)for(let a=-n;a<=n;++a)r+=` texture2D(u_image, tcoord + onePixel * vec2(${a}, ${e})) * u_kernel[${i}]`,++i!==t&&(r+=" +\n");return r+";\n gl_FragData[0] = vec4((colorSum / u_kernelWeight).rgb, texture2D(u_image, tcoord).a);\n}"},e.buildVertexBuffer=()=>{let e=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1]),r=new Float32Array([0,0,1,0,0,1,1,1]),n=new Uint16Array([4,0,1,3,2]),o=i.Ay.newInstance({numberOfComponents:3,values:e});o.setName("points");let s=i.Ay.newInstance({numberOfComponents:2,values:r});s.setName("tcoords");let l=i.Ay.newInstance({numberOfComponents:1,values:n});t.tris.getCABO().createVBO(l,"polys",a.YL.SURFACE,{points:o,tcoords:s,cellOffset:0}),t.VBOBuildTime.modified()}},"vtkConvolution2DPass")},m=r(34839);function h(e){let t=m.Ay.newInstance();if(e>0){let r=p.newInstance();r.setDelegates([t]);let n=Math.max(0,e);r.setKernelDimension(3),r.setKernel([-n,-n,-n,-n,1+8*n,-n,-n,-n,-n]),t=r}return t}function f(e){let t=m.Ay.newInstance();if(e>0){let r=p.newInstance();r.setDelegates([t]);let n=Math.min(e,1e3),i=function(e,t){let r=[],n=7,i=0;for(let t=0;te/i)}(15,5),a=Math.floor(112.5),o=Array(225).fill(0);o[a]=1;let s=Math.min(n/10,1),l=i.map((e,t)=>(1-s)*o[t]+s*e);r.setKernelDimension(15),r.setKernel(l),t=r}return t}},80085:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nodeIterator_traverse=function(e,t){let r=e._reference,n=e._pointerBeforeReference;for(;;){if(t)if(n)n=!1;else{let t=(0,o.tree_getFollowingNode)(e._root,r);if(!t)return null;r=t}else if(n){let t=(0,o.tree_getPrecedingNode)(e.root,r);if(!t)return null;r=t}else n=!0;if((0,a.traversal_filter)(e,r)===i.FilterResult.Accept)break}return e._reference=r,e._pointerBeforeReference=n,r},t.nodeIterator_iteratorList=function(){return n.dom.window._iteratorList};let n=r(60957),i=r(5309),a=r(17329),o=r(29963)},80187:e=>{e.exports=function(e){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function r(e,t){var r=e[0],n=e[1],i=e[2],a=e[3];r+=(n&i|~n&a)+t[0]-0x28955b88|0,a+=((r=(r<<7|r>>>25)+n|0)&n|~r&i)+t[1]-0x173848aa|0,i+=((a=(a<<12|a>>>20)+r|0)&r|~a&n)+t[2]+0x242070db|0,n+=((i=(i<<17|i>>>15)+a|0)&a|~i&r)+t[3]-0x3e423112|0,r+=((n=(n<<22|n>>>10)+i|0)&i|~n&a)+t[4]-0xa83f051|0,a+=((r=(r<<7|r>>>25)+n|0)&n|~r&i)+t[5]+0x4787c62a|0,i+=((a=(a<<12|a>>>20)+r|0)&r|~a&n)+t[6]-0x57cfb9ed|0,n+=((i=(i<<17|i>>>15)+a|0)&a|~i&r)+t[7]-0x2b96aff|0,r+=((n=(n<<22|n>>>10)+i|0)&i|~n&a)+t[8]+0x698098d8|0,a+=((r=(r<<7|r>>>25)+n|0)&n|~r&i)+t[9]-0x74bb0851|0,i+=((a=(a<<12|a>>>20)+r|0)&r|~a&n)+t[10]-42063|0,n+=((i=(i<<17|i>>>15)+a|0)&a|~i&r)+t[11]-0x76a32842|0,r+=((n=(n<<22|n>>>10)+i|0)&i|~n&a)+t[12]+0x6b901122|0,a+=((r=(r<<7|r>>>25)+n|0)&n|~r&i)+t[13]-0x2678e6d|0,i+=((a=(a<<12|a>>>20)+r|0)&r|~a&n)+t[14]-0x5986bc72|0,n+=((i=(i<<17|i>>>15)+a|0)&a|~i&r)+t[15]+0x49b40821|0,r+=((n=(n<<22|n>>>10)+i|0)&a|i&~a)+t[1]-0x9e1da9e|0,a+=((r=(r<<5|r>>>27)+n|0)&i|n&~i)+t[6]-0x3fbf4cc0|0,i+=((a=(a<<9|a>>>23)+r|0)&n|r&~n)+t[11]+0x265e5a51|0,n+=((i=(i<<14|i>>>18)+a|0)&r|a&~r)+t[0]-0x16493856|0,r+=((n=(n<<20|n>>>12)+i|0)&a|i&~a)+t[5]-0x29d0efa3|0,a+=((r=(r<<5|r>>>27)+n|0)&i|n&~i)+t[10]+0x2441453|0,i+=((a=(a<<9|a>>>23)+r|0)&n|r&~n)+t[15]-0x275e197f|0,n+=((i=(i<<14|i>>>18)+a|0)&r|a&~r)+t[4]-0x182c0438|0,r+=((n=(n<<20|n>>>12)+i|0)&a|i&~a)+t[9]+0x21e1cde6|0,a+=((r=(r<<5|r>>>27)+n|0)&i|n&~i)+t[14]-0x3cc8f82a|0,i+=((a=(a<<9|a>>>23)+r|0)&n|r&~n)+t[3]-0xb2af279|0,n+=((i=(i<<14|i>>>18)+a|0)&r|a&~r)+t[8]+0x455a14ed|0,r+=((n=(n<<20|n>>>12)+i|0)&a|i&~a)+t[13]-0x561c16fb|0,a+=((r=(r<<5|r>>>27)+n|0)&i|n&~i)+t[2]-0x3105c08|0,i+=((a=(a<<9|a>>>23)+r|0)&n|r&~n)+t[7]+0x676f02d9|0,n+=((i=(i<<14|i>>>18)+a|0)&r|a&~r)+t[12]-0x72d5b376|0,r+=((n=(n<<20|n>>>12)+i|0)^i^a)+t[5]-378558|0,a+=((r=(r<<4|r>>>28)+n|0)^n^i)+t[8]-0x788e097f|0,i+=((a=(a<<11|a>>>21)+r|0)^r^n)+t[11]+0x6d9d6122|0,n+=((i=(i<<16|i>>>16)+a|0)^a^r)+t[14]-0x21ac7f4|0,r+=((n=(n<<23|n>>>9)+i|0)^i^a)+t[1]-0x5b4115bc|0,a+=((r=(r<<4|r>>>28)+n|0)^n^i)+t[4]+0x4bdecfa9|0,i+=((a=(a<<11|a>>>21)+r|0)^r^n)+t[7]-0x944b4a0|0,n+=((i=(i<<16|i>>>16)+a|0)^a^r)+t[10]-0x41404390|0,r+=((n=(n<<23|n>>>9)+i|0)^i^a)+t[13]+0x289b7ec6|0,a+=((r=(r<<4|r>>>28)+n|0)^n^i)+t[0]-0x155ed806|0,i+=((a=(a<<11|a>>>21)+r|0)^r^n)+t[3]-0x2b10cf7b|0,n+=((i=(i<<16|i>>>16)+a|0)^a^r)+t[6]+0x4881d05|0,r+=((n=(n<<23|n>>>9)+i|0)^i^a)+t[9]-0x262b2fc7|0,a+=((r=(r<<4|r>>>28)+n|0)^n^i)+t[12]-0x1924661b|0,i+=((a=(a<<11|a>>>21)+r|0)^r^n)+t[15]+0x1fa27cf8|0,n+=((i=(i<<16|i>>>16)+a|0)^a^r)+t[2]-0x3b53a99b|0,n=(n<<23|n>>>9)+i|0,r+=(i^(n|~a))+t[0]-0xbd6ddbc|0,r=(r<<6|r>>>26)+n|0,a+=(n^(r|~i))+t[7]+0x432aff97|0,a=(a<<10|a>>>22)+r|0,i+=(r^(a|~n))+t[14]-0x546bdc59|0,i=(i<<15|i>>>17)+a|0,n+=(a^(i|~r))+t[5]-0x36c5fc7|0,n=(n<<21|n>>>11)+i|0,r+=(i^(n|~a))+t[12]+0x655b59c3|0,r=(r<<6|r>>>26)+n|0,a+=(n^(r|~i))+t[3]-0x70f3336e|0,a=(a<<10|a>>>22)+r|0,i+=(r^(a|~n))+t[10]-1051523|0,i=(i<<15|i>>>17)+a|0,n+=(a^(i|~r))+t[1]-0x7a7ba22f|0,n=(n<<21|n>>>11)+i|0,r+=(i^(n|~a))+t[8]+0x6fa87e4f|0,r=(r<<6|r>>>26)+n|0,a+=(n^(r|~i))+t[15]-0x1d31920|0,a=(a<<10|a>>>22)+r|0,i+=(r^(a|~n))+t[6]-0x5cfebcec|0,i=(i<<15|i>>>17)+a|0,n+=(a^(i|~r))+t[13]+0x4e0811a1|0,n=(n<<21|n>>>11)+i|0,r+=(i^(n|~a))+t[4]-0x8ac817e|0,r=(r<<6|r>>>26)+n|0,a+=(n^(r|~i))+t[11]-0x42c50dcb|0,a=(a<<10|a>>>22)+r|0,i+=(r^(a|~n))+t[2]+0x2ad7d2bb|0,i=(i<<15|i>>>17)+a|0,n+=(a^(i|~r))+t[9]-0x14792c6f|0,n=(n<<21|n>>>11)+i|0,e[0]=r+e[0]|0,e[1]=n+e[1]|0,e[2]=i+e[2]|0,e[3]=a+e[3]|0}function n(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return r}function i(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return r}function a(e){var t,i,a,o,s,l,u=e.length,c=[0x67452301,-0x10325477,-0x67452302,0x10325476];for(t=64;t<=u;t+=64)r(c,n(e.substring(t-64,t)));for(i=(e=e.substring(t-64)).length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(a[t>>2]|=128<<(t%4<<3),t>55)for(r(c,a),t=0;t<16;t+=1)a[t]=0;return s=parseInt((o=(o=8*u).toString(16).match(/(.*?)(.{0,8})$/))[2],16),l=parseInt(o[1],16)||0,a[14]=s,a[15]=l,r(c,a),c}function o(e){var r;for(r=0;r>8*r+4&15]+t[e>>8*r&15];return n}(e[r]);return e.join("")}function s(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function l(e){var t,r=[],n=e.length;for(t=0;tu)?new ArrayBuffer(0):(a=new Uint8Array(i=new ArrayBuffer(n=u-l)),o=new Uint8Array(this,l,n),a.set(o),i)}}(),u.prototype.append=function(e){return this.appendBinary(s(e)),this},u.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,i=this._buff.length;for(t=64;t<=i;t+=64)r(this._hash,n(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},u.prototype.end=function(e){var t,r,n=this._buff,i=n.length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=n.charCodeAt(t)<<(t%4<<3);return this._finish(a,i),r=o(this._hash),e&&(r=l(r)),this.reset(),r},u.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[0x67452301,-0x10325477,-0x67452302,0x10325476],this},u.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},u.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},u.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},u.prototype._finish=function(e,t){var n,i,a,o=t;if(e[o>>2]|=128<<(o%4<<3),o>55)for(r(this._hash,e),o=0;o<16;o+=1)e[o]=0;i=parseInt((n=(n=8*this._length).toString(16).match(/(.*?)(.{0,8})$/))[2],16),a=parseInt(n[1],16)||0,e[14]=i,e[15]=a,r(this._hash,e)},u.hash=function(e,t){return u.hashBinary(s(e),t)},u.hashBinary=function(e,t){var r=o(a(e));return t?l(r):r},u.ArrayBuffer=function(){this.reset()},u.ArrayBuffer.prototype.append=function(e){var t,n,a,o=(t=this._buff.buffer,(n=new Uint8Array(t.byteLength+e.byteLength)).set(new Uint8Array(t)),n.set(new Uint8Array(e),t.byteLength),n),s=o.length;for(this._length+=e.byteLength,a=64;a<=s;a+=64)r(this._hash,i(o.subarray(a-64,a)));return this._buff=new Uint8Array(a-64>2]|=n[t]<<(t%4<<3);return this._finish(a,i),r=o(this._hash),e&&(r=l(r)),this.reset(),r},u.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[0x67452301,-0x10325477,-0x67452302,0x10325476],this},u.ArrayBuffer.prototype.getState=function(){var e,t=u.prototype.getState.call(this);return e=t.buff,t.buff=String.fromCharCode.apply(null,new Uint8Array(e)),t},u.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var r,n=e.length,i=new ArrayBuffer(n),a=new Uint8Array(i);for(r=0;r>2]|=e[t]<<(t%4<<3);if(a[t>>2]|=128<<(t%4<<3),t>55)for(r(c,a),t=0;t<16;t+=1)a[t]=0;return s=parseInt((o=(o=8*u).toString(16).match(/(.*?)(.{0,8})$/))[2],16),l=parseInt(o[1],16)||0,a[14]=s,a[15]=l,r(c,a),c}(new Uint8Array(e)));return t?l(n):n},u}()},80405:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>o.A,QJ:()=>i.Q,hW:()=>a.h,jY:()=>a.j,vL:()=>s});var n=r(62705),i=r(19667),a=r(61310),o=r(15344);let s={adapter:n.q,getSnapshot:n.n}},80455:(e,t,r)=>{"use strict";r(36908),r(42905),r(10598),r(52210),r(57186)},80486:(e,t,r)=>{"use strict";function n(e,t,r=0){let i=[];for(let n=r;nn})},80777:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(50923),i=r(22911);function a(e,t){let{viewUp:r,viewPlaneNormal:a}=t,o=(0,i.p)(e,[0,0,0]),s=n.ze(n.vt(),r),l=n.ze(n.vt(),a),u=n.$A(n.vt(),s,l),c=n.jb(n.vt(),(0,i.p)(e,s),o),d=n.jb(n.vt(),(0,i.p)(e,l),o);return n.S8(c,c),n.S8(d,d),{worldVecRowDir:u,worldVecColDir:s,worldVecSliceDir:l,ijkVecRowDir:n.$A(n.vt(),c,d),ijkVecColDir:c,ijkVecSliceDir:d}}},81038:(e,t,r)=>{"use strict";r.d(t,{A:()=>h});var n=r(70192),i=r(23537),a=r(69340),o=r(15695),s=r(78378),l=r(760);let u=Math.pow(3e3/(4*Math.PI),1/3);async function c({operationData:e,indices:t,unit:r,mode:a}){let l=(0,i.o9)(e);if(!l)return;let{segmentationVoxelManager:u,imageVoxelManager:c,segmentationImageData:d,imageData:m}=l;if(!u||!d)return;let h=d.getSpacing(),{boundsIJK:f}=u;if(!f)return o.Ay.getStatistics({spacing:h});let g={scalarData:u.getCompleteScalarDataArray(),dimensions:d.getDimensions(),spacing:d.getSpacing(),origin:d.getOrigin(),direction:d.getDirection()},v={scalarData:c.getCompleteScalarDataArray(),dimensions:m.getDimensions(),spacing:m.getSpacing(),origin:m.getOrigin(),direction:m.getDirection()};if(!v.scalarData?.length)return;let y=await (0,n.G_)().executeTask("compute","calculateSegmentsStatisticsVolume",{segmentationInfo:g,imageInfo:v,indices:t,unit:r,mode:a});if((0,i.sg)(s.Y3.COMPUTE_STATISTICS,100),"collective"===a)return p({stats:y,unit:r,spacing:h,segmentationImageData:d,imageVoxelManager:c});{let e={};return Object.entries(y).forEach(([t,n])=>{e[t]=p({stats:n,unit:r,spacing:h,segmentationImageData:d,imageVoxelManager:c})}),e}}let d=(e,t)=>{if(!e.array)return;let r=e.array.findIndex(e=>e.name===t.name);-1!==r?e.array[r]=t:e.array.push(t)},p=({stats:e,unit:t,spacing:r,segmentationImageData:i,imageVoxelManager:a})=>{if(e.mean.unit=t,e.max.unit=t,e.min.unit=t,"SUV"!==t)return e;let s=r.map(e=>Math.max(1,Math.round(1.1*u/e)));for(let l of e.maxIJKs){let u=function(e,t,r,i,a){let{pointIJK:s,pointLPS:l}=e;if(!s)return;let u=s.map((e,r)=>[e-t[r],e+t[r]]);return o.Ay.statsInit({storePointData:!1}),n.BF.pointInShapeCallback(r,{pointInShapeFn:(e,r)=>{let n=(r[0]-s[0])/t[0],i=(r[1]-s[1])/t[1],a=(r[2]-s[2])/t[2];return n*n+i*i+a*a<=1},callback:({pointIJK:e,pointLPS:t})=>{let r=i.getAtIJKPoint(e);void 0!==r&&o.Ay.statsCallback({value:r,pointLPS:t,pointIJK:e})},boundsIJK:u}),o.Ay.getStatistics({spacing:a})}(l,s,i,a,r);if(!u)continue;let{mean:c}=u;(!e.peakValue||e.peakValue.value<=c.value)&&(e.peakValue={name:"peakValue",label:"Peak Value",value:c.value,unit:t},e.peakPoint={name:"peakLPS",label:"Peak SUV Point",value:l.pointLPS?[...l.pointLPS]:null,unit:null},d(e,e.peakValue),d(e,e.peakPoint))}if(e.volume&&e.mean){let r=e.volume.value,n=e.mean.value;e.lesionGlycolysis={name:"lesionGlycolysis",label:"Lesion Glycolysis",value:r*n,unit:`${e.volume.unit}\xb7${t}`},d(e,e.lesionGlycolysis)}return e};async function m({segImageIds:e,indices:t,unit:r,mode:a}){(0,i.sg)(s.Y3.COMPUTE_STATISTICS,0);let{segmentationInfo:o,imageInfo:l}=(0,i.Dn)(e),u=await (0,n.G_)().executeTask("compute","calculateSegmentsStatisticsStack",{segmentationInfo:o,imageInfo:l,indices:t,mode:a});(0,i.sg)(s.Y3.COMPUTE_STATISTICS,100);let c=o[0].spacing,d=o[0],m=l[0].voxelManager;if("collective"===a)return p({stats:u,unit:r,spacing:c,segmentationImageData:d,imageVoxelManager:m});{let e={};return Object.entries(u).forEach(([t,n])=>{e[t]=p({stats:n,unit:r,spacing:c,segmentationImageData:d,imageVoxelManager:m})}),e}}let h=async function e({segmentationId:e,segmentIndices:t,mode:r="collective"}){(0,l.D)(),(0,i.sg)(s.Y3.COMPUTE_STATISTICS,0);let n=(0,i.yR)(e,t);if(!n)return;let{operationData:o,segVolumeId:u,segImageIds:d,reconstructableVolume:p,indices:h}=n,{refImageId:f,modalityUnitOptions:g}=(0,i.FI)(u,d),v=(0,a.N)(f,g);return p?await c({operationData:o,indices:h,unit:v,mode:r}):await m({segImageIds:d,indices:h,unit:v,mode:r})}},81257:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.selectors_scopeMatchASelectorsString=function(e,t){throw new n.NotSupportedError};let n=r(32008)},81294:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DocumentImpl=void 0;let n=r(60957),i=r(5309),a=r(32008),o=r(92787),s=r(79663),l=r(16950),u=r(57226),c=r(62821),d=r(47518),p=r(48040);class m extends o.NodeImpl{_nodeType=i.NodeType.Document;_children=new Set;_encoding={name:"UTF-8",labels:["unicode-1-1-utf-8","utf-8","utf8"]};_contentType="application/xml";_URL={scheme:"about",username:"",password:"",host:null,port:null,path:["blank"],query:null,fragment:null,_cannotBeABaseURLFlag:!0,_blobURLEntry:null};_origin=null;_type="xml";_mode="no-quirks";_implementation;_documentElement=null;_hasNamespaces=!1;_nodeDocumentOverwrite=null;get _nodeDocument(){return this._nodeDocumentOverwrite||this}set _nodeDocument(e){this._nodeDocumentOverwrite=e}constructor(){super()}get implementation(){return this._implementation||(this._implementation=(0,d.create_domImplementation)(this))}get URL(){return(0,c.urlSerializer)(this._URL)}get documentURI(){return this.URL}get origin(){return"null"}get compatMode(){return"quirks"===this._mode?"BackCompat":"CSS1Compat"}get characterSet(){return this._encoding.name}get charset(){return this._encoding.name}get inputEncoding(){return this._encoding.name}get contentType(){return this._contentType}get doctype(){for(let e of this._children)if(s.Guard.isDocumentTypeNode(e))return e;return null}get documentElement(){return this._documentElement}getElementsByTagName(e){return(0,d.node_listOfElementsWithQualifiedName)(e,this)}getElementsByTagNameNS(e,t){return(0,d.node_listOfElementsWithNamespace)(e,t,this)}getElementsByClassName(e){return(0,d.node_listOfElementsWithClassNames)(e,this)}createElement(e,t){if(!(0,d.xml_isName)(e))throw new a.InvalidCharacterError;"html"===this._type&&(e=e.toLowerCase());let r=null;void 0!==t&&(r=(0,l.isString)(t)?t:t.is);let n="html"===this._type||"application/xhtml+xml"===this._contentType?u.namespace.HTML:null;return(0,d.element_createAnElement)(this,e,n,null,r,!0)}createElementNS(e,t,r){return(0,d.document_internalCreateElementNS)(this,e,t,r)}createDocumentFragment(){return(0,d.create_documentFragment)(this)}createTextNode(e){return(0,d.create_text)(this,e)}createCDATASection(e){if("html"===this._type)throw new a.NotSupportedError;if(-1!==e.indexOf("]]>"))throw new a.InvalidCharacterError;return(0,d.create_cdataSection)(this,e)}createComment(e){return(0,d.create_comment)(this,e)}createProcessingInstruction(e,t){if(!(0,d.xml_isName)(e)||-1!==t.indexOf("?>"))throw new a.InvalidCharacterError;return(0,d.create_processingInstruction)(this,e,t)}importNode(e,t=!1){if(s.Guard.isDocumentNode(e)||s.Guard.isShadowRoot(e))throw new a.NotSupportedError;return(0,d.node_clone)(e,this,t)}adoptNode(e){if(s.Guard.isDocumentNode(e))throw new a.NotSupportedError;if(s.Guard.isShadowRoot(e))throw new a.HierarchyRequestError;return(0,d.document_adopt)(e,this),e}createAttribute(e){if(!(0,d.xml_isName)(e))throw new a.InvalidCharacterError;return"html"===this._type&&(e=e.toLowerCase()),(0,d.create_attr)(this,e)}createAttributeNS(e,t){let[r,n,i]=(0,d.namespace_validateAndExtract)(e,t),a=(0,d.create_attr)(this,i);return a._namespace=r,a._namespacePrefix=n,a}createEvent(e){return(0,d.event_createLegacyEvent)(e)}createRange(){let e=(0,d.create_range)();return e._start=[this,0],e._end=[this,0],e}createNodeIterator(e,t=i.WhatToShow.All,r=null){let n=(0,d.create_nodeIterator)(e,e,!0);return n._whatToShow=t,n._iteratorCollection=(0,d.create_nodeList)(e),(0,l.isFunction)(r)?(n._filter=(0,d.create_nodeFilter)(),n._filter.acceptNode=r):n._filter=r,n}createTreeWalker(e,t=i.WhatToShow.All,r=null){let n=(0,d.create_treeWalker)(e,e);return n._whatToShow=t,(0,l.isFunction)(r)?(n._filter=(0,d.create_nodeFilter)(),n._filter.acceptNode=r):n._filter=r,n}_getTheParent(e){return"load"===e._type?null:n.dom.window}getElementById(e){throw Error("Mixin: NonElementParentNode not implemented.")}get children(){throw Error("Mixin: ParentNode not implemented.")}get firstElementChild(){throw Error("Mixin: ParentNode not implemented.")}get lastElementChild(){throw Error("Mixin: ParentNode not implemented.")}get childElementCount(){throw Error("Mixin: ParentNode not implemented.")}prepend(){throw Error("Mixin: ParentNode not implemented.")}append(){throw Error("Mixin: ParentNode not implemented.")}querySelector(e){throw Error("Mixin: ParentNode not implemented.")}querySelectorAll(e){throw Error("Mixin: ParentNode not implemented.")}}t.DocumentImpl=m,(0,p.idl_defineConst)(m.prototype,"_nodeType",i.NodeType.Document)},81320:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseWriter=void 0;let n=r(5309),i=r(94489),a=r(30118),o=r(57226),s=r(47518),l=r(86636);class u{static _VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]);_builderOptions;_writerOptions;constructor(e){this._builderOptions=e}declaration(e,t,r){}docType(e,t,r){}comment(e){}text(e){}instruction(e,t){}cdata(e){}openTagBegin(e){}openTagEnd(e,t,r){}closeTag(e){}attributes(e){for(let t of e)this.attribute(null===t[1]?t[2]:t[1]+":"+t[2],t[3])}attribute(e,t){}beginElement(e){}endElement(e){}level=0;currentNode;serializeNode(e,t){let r=void 0!==e._nodeDocument&&e._nodeDocument._hasNamespaces;if(this.level=0,this.currentNode=e,r){let r=new a.NamespacePrefixMap;r.set("xml",o.namespace.XML),this._serializeNodeNS(e,null,r,{value:1},t)}else this._serializeNode(e,t)}_serializeNodeNS(e,t,r,i,a){switch(this.currentNode=e,e.nodeType){case n.NodeType.Element:this._serializeElementNS(e,t,r,i,a);break;case n.NodeType.Document:this._serializeDocumentNS(e,t,r,i,a);break;case n.NodeType.Comment:this._serializeComment(e,a);break;case n.NodeType.Text:this._serializeText(e,a);break;case n.NodeType.DocumentFragment:this._serializeDocumentFragmentNS(e,t,r,i,a);break;case n.NodeType.DocumentType:this._serializeDocumentType(e,a);break;case n.NodeType.ProcessingInstruction:this._serializeProcessingInstruction(e,a);break;case n.NodeType.CData:this._serializeCData(e,a);break;default:throw Error(`Unknown node type: ${e.nodeType}`)}}_serializeNode(e,t){switch(this.currentNode=e,e.nodeType){case n.NodeType.Element:this._serializeElement(e,t);break;case n.NodeType.Document:this._serializeDocument(e,t);break;case n.NodeType.Comment:this._serializeComment(e,t);break;case n.NodeType.Text:this._serializeText(e,t);break;case n.NodeType.DocumentFragment:this._serializeDocumentFragment(e,t);break;case n.NodeType.DocumentType:this._serializeDocumentType(e,t);break;case n.NodeType.ProcessingInstruction:this._serializeProcessingInstruction(e,t);break;case n.NodeType.CData:this._serializeCData(e,t);break;default:throw Error(`Unknown node type: ${e.nodeType}`)}}_serializeElementNS(e,t,r,n,i){let a=[];if(i&&(-1!==e.localName.indexOf(":")||!(0,s.xml_isName)(e.localName)))throw Error("Node local name contains invalid characters (well-formed required).");let l="",c=!1,d=!1,p=r.copy(),m={},h=this._recordNamespaceInformation(e,p,m),f=t,g=e.namespaceURI;if(f===g)null!==h&&(d=!0),l=g===o.namespace.XML?"xml:"+e.localName:e.localName,this.beginElement(l),this.openTagBegin(l);else{let t=e.prefix,r=null;if((null!==t||g!==h)&&(r=p.get(t,g)),"xmlns"===t){if(i)throw Error("An element cannot have the 'xmlns' prefix (well-formed required).");r=t}null!==r?(l=r+":"+e.localName,null!==h&&h!==o.namespace.XML&&(f=h||null),this.beginElement(l),this.openTagBegin(l)):null!==t?(t in m&&(t=this._generatePrefix(g,p,n)),p.set(t,g),l+=t+":"+e.localName,this.beginElement(l),this.openTagBegin(l),a.push([null,"xmlns",t,this._serializeAttributeValue(g,i)]),null!==h&&(f=h||null)):null===h||null!==h&&h!==g?(d=!0,l+=e.localName,f=g,this.beginElement(l),this.openTagBegin(l),a.push([null,null,"xmlns",this._serializeAttributeValue(g,i)])):(l+=e.localName,f=g,this.beginElement(l),this.openTagBegin(l))}a.push(...this._serializeAttributesNS(e,p,n,m,d,i)),this.attributes(a);let v=g===o.namespace.HTML;if(v&&0===e.childNodes.length&&u._VoidElementNames.has(e.localName)?(this.openTagEnd(l,!0,!0),this.endElement(l),c=!0):v||0!==e.childNodes.length?this.openTagEnd(l,!1,!1):(this.openTagEnd(l,!0,!1),this.endElement(l),c=!0),!c){if(v&&"template"===e.localName);else for(let t of e.childNodes)this.level++,this._serializeNodeNS(t,f,p,n,i),this.level--;this.closeTag(l),this.endElement(l)}}_serializeElement(e,t){if(t&&(-1!==e.localName.indexOf(":")||!(0,s.xml_isName)(e.localName)))throw Error("Node local name contains invalid characters (well-formed required).");let r=!1,n=e.localName;this.beginElement(n),this.openTagBegin(n);let i=this._serializeAttributes(e,t);if(this.attributes(i),e.hasChildNodes()?this.openTagEnd(n,!1,!1):(this.openTagEnd(n,!0,!1),this.endElement(n),r=!0),!r){for(let r of e._children)this.level++,this._serializeNode(r,t),this.level--;this.closeTag(n),this.endElement(n)}}_serializeDocumentNS(e,t,r,n,i){if(i&&null===e.documentElement)throw Error("Missing document element (well-formed required).");for(let a of e.childNodes)this._serializeNodeNS(a,t,r,n,i)}_serializeDocument(e,t){if(t&&null===e.documentElement)throw Error("Missing document element (well-formed required).");for(let r of e._children)this._serializeNode(r,t)}_serializeComment(e,t){if(t&&(!(0,s.xml_isLegalChar)(e.data)||-1!==e.data.indexOf("--")||e.data.endsWith("-")))throw Error("Comment data contains invalid characters (well-formed required).");this.comment(e.data)}_serializeText(e,t){if(t&&!(0,s.xml_isLegalChar)(e.data))throw Error("Text data contains invalid characters (well-formed required).");let r=e.data.replace(l.nonEntityAmpersandRegex,"&").replace(//g,">");this.text(r)}_serializeDocumentFragmentNS(e,t,r,n,i){for(let a of e.childNodes)this._serializeNodeNS(a,t,r,n,i)}_serializeDocumentFragment(e,t){for(let r of e._children)this._serializeNode(r,t)}_serializeDocumentType(e,t){if(t&&!(0,s.xml_isPubidChar)(e.publicId))throw Error("DocType public identifier does not match PubidChar construct (well-formed required).");if(t&&(!(0,s.xml_isLegalChar)(e.systemId)||-1!==e.systemId.indexOf('"')&&-1!==e.systemId.indexOf("'")))throw Error("DocType system identifier contains invalid characters (well-formed required).");this.docType(e.name,e.publicId,e.systemId)}_serializeProcessingInstruction(e,t){if(t&&(-1!==e.target.indexOf(":")||/^xml$/i.test(e.target)))throw Error("Processing instruction target contains invalid characters (well-formed required).");if(t&&(!(0,s.xml_isLegalChar)(e.data)||-1!==e.data.indexOf("?>")))throw Error("Processing instruction data contains invalid characters (well-formed required).");this.instruction(e.target,e.data)}_serializeCData(e,t){if(t&&-1!==e.data.indexOf("]]>"))throw Error("CDATA contains invalid characters (well-formed required).");this.cdata(e.data)}_serializeAttributesNS(e,t,r,n,a,l){let u=[],c=l?new i.LocalNameSet:void 0;for(let i of e.attributes){if(!l&&!a&&null===i.namespaceURI){u.push([null,null,i.localName,this._serializeAttributeValue(i.value,l)]);continue}if(l&&c&&c.has(i.namespaceURI,i.localName))throw Error("Element contains duplicate attributes (well-formed required).");l&&c&&c.set(i.namespaceURI,i.localName);let e=i.namespaceURI,d=null;if(null!==e)if(d=t.get(i.prefix,e),e===o.namespace.XMLNS){if(i.value===o.namespace.XML||null===i.prefix&&a||null!==i.prefix&&(!(i.localName in n)||n[i.localName]!==i.value)&&t.has(i.localName,i.value))continue;if(l&&i.value===o.namespace.XMLNS)throw Error("XMLNS namespace is reserved (well-formed required).");if(l&&""===i.value)throw Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");"xmlns"===i.prefix&&(d="xmlns")}else null===d&&(d=null!==i.prefix&&(!t.hasPrefix(i.prefix)||t.has(i.prefix,e))?i.prefix:this._generatePrefix(e,t,r),u.push([null,"xmlns",d,this._serializeAttributeValue(e,l)]));if(l&&(-1!==i.localName.indexOf(":")||!(0,s.xml_isName)(i.localName)||"xmlns"===i.localName&&null===e))throw Error("Attribute local name contains invalid characters (well-formed required).");u.push([e,d,i.localName,this._serializeAttributeValue(i.value,l)])}return u}_serializeAttributes(e,t){let r=[],n=t?{}:void 0;for(let i of e.attributes){if(!t){r.push([null,null,i.localName,this._serializeAttributeValue(i.value,t)]);continue}if(t&&n&&i.localName in n)throw Error("Element contains duplicate attributes (well-formed required).");if(t&&n&&(n[i.localName]=!0),t&&(-1!==i.localName.indexOf(":")||!(0,s.xml_isName)(i.localName)))throw Error("Attribute local name contains invalid characters (well-formed required).");r.push([null,null,i.localName,this._serializeAttributeValue(i.value,t)])}return r}_recordNamespaceInformation(e,t,r){let n=null;for(let i of e.attributes){let e=i.namespaceURI,a=i.prefix;if(e===o.namespace.XMLNS)if(null===a){n=i.value;continue}else{let e=i.localName,n=i.value;if(n===o.namespace.XML||(""===n&&(n=null),t.has(e,n)))continue;t.set(e,n),r[e]=n||""}}return n}_generatePrefix(e,t,r){let n="ns"+r.value.toString();return r.value++,t.set(n,e),n}_serializeAttributeValue(e,t){if(t&&null!==e&&!(0,s.xml_isLegalChar)(e))throw Error("Invalid characters in attribute value.");return null===e?"":e.replace(l.nonEntityAmpersandRegex,"&").replace(//g,">").replace(/"/g,""")}}t.BaseWriter=u},81480:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(70192),i=r(43806),a=r(41918);function o(e,t,r={}){let s=e instanceof n.PX,l="volume"===n.BF.getViewportContentMode(e);if(s||l){let r=s?e.getCamera():(0,a.A)(e),{spacingInNormalDirection:o}=n.BF.getTargetVolumeAndSpacingInNormalDir(e,r);return(0,i.A)(t,r,o)}if(e instanceof n.hS){let t=e.getCurrentImageId();if(!t)return[];let n=t.indexOf(":");r.imageURI=t.substring(n+1)}return t.filter(t=>!!t.isVisible&&(!!t.data.isCanvasAnnotation||e.isReferenceViewable(t.metadata,r)))}},81522:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>s});var n=r(17042),{vtkWarningMacro:i}=n.Ay,a={};function o(e,t,r={}){Object.assign(t,a,r),n.Ay.obj(e,t),t.overrides||(t.overrides={}),t.classHierarchy.push("vtkViewNodeFactory"),e.createNode=r=>{if(r.isDeleted())return null;let n=function(e){let t=[],r=0,n=e.getClassName(r++);for(;n;)t.push(n),n=e.getClassName(r++);return t}(r),a=0,o=n[a++],s=!1,l=Object.keys(t.overrides);for(;o&&!s;)-1!==l.indexOf(o)?s=!0:o=r.getClassName(a++);if(!s)return n.includes("vtkAbstractWidget")||n.includes("vtkWidgetRepresentation")||i(function(e,t){let r=t.join(" → ");return`No ${e} implementation found for ${t[0]}. +Class hierarchy: ${r}. +A rendering Profile is likely missing for ${t[0]}. +Try importing '@kitware/vtk.js/Rendering/Profiles/All' or 'vtk.js/Sources/Rendering/Profiles/All', +or import the specific rendering profile needed by this renderable if known. +See https://kitware.github.io/vtk-js/docs/concepts_profile.html for details.`}(e.getClassName(),n)),null;let u=t.overrides[o]();return u.setMyFactory(e),u}}var s={newInstance:n.Ay.newInstance(o,"vtkViewNodeFactory"),extend:o}},81681:(e,t,r)=>{"use strict";r.d(t,{A:()=>c});var n=r(77280),i=r(53725),a=r(46283),o=r(54878),s=r(91832),l=r(73589);class u extends l.A{canvasToWorld(e){let t=(0,s.E5)({canvasHeight:this.state.canvasHeight,canvasPos:e,canvasWidth:this.state.canvasWidth,view:this.state.view});return(0,s.O9)(this.state.metadata,t)}worldToCanvas(e){return(0,s.Ox)({canvasHeight:this.state.canvasHeight,canvasWidth:this.state.canvasWidth,indexPos:(0,s.GD)(this.state.metadata,e),view:this.state.view})}getFrameOfReferenceUID(){return this.state.frameOfReferenceUID||void 0}withZoom(e,t){let r=Math.max(e,.001),n=this.getResolutionForZoom(r);if(!t)return this.cloneWithViewState({...this.state.viewState,resolution:n,zoom:r});let i=this.canvasToIndex(t);return this.cloneWithViewState({...this.state.viewState,centerIndex:this.getCenterIndexForCanvasPoint({canvasPoint:t,indexPoint:i,resolution:n}),resolution:n,zoom:r})}buildICamera(){let e=this.canvasToWorld([this.state.canvasWidth/2,this.state.canvasHeight/2]),t=this.state.metadata?.spacing?.[0]||1,r=this.getResolution();return{parallelProjection:!0,focalPoint:e,position:e,viewUp:[0,-1,0],parallelScale:this.state.canvasHeight*r*t,viewPlaneNormal:[0,0,1],rotation:this.state.view.getRotation?.()||this.state.viewState.rotation||0}}canvasToIndex(e){let t=(0,s.E5)({canvasHeight:this.state.canvasHeight,canvasPos:e,canvasWidth:this.state.canvasWidth,view:this.state.view});return[t[0],t[1]]}getResolution(){return this.state.view.getResolution?.()||this.state.viewState.resolution||1}getResolutionForZoom(e){let t=this.state.view.getZoom?.()||this.state.viewState.zoom||1;return this.state.view.getResolutionForZoom?.(e)??this.getResolution()/Math.pow(2,e-t)}getCenterIndexForCanvasPoint(e){let{canvasPoint:t,indexPoint:r,resolution:n}=e,i="undefined"==typeof window?1:window.devicePixelRatio||1,a=Math.max(this.state.canvasWidth,1)/2,o=Math.max(this.state.canvasHeight,1)/2,s=t[0]*i-a,l=t[1]*i-o,u=this.state.view.getRotation?.()||this.state.viewState.rotation||0,c=Math.cos(u),d=Math.sin(u);return[r[0]-(c*s+d*l)*n,r[1]+(-d*s+c*l)*n]}cloneWithViewState(e){return new u({...this.state,viewState:e})}}class c extends i.A{static get useCustomRenderingPipeline(){return!0}getUseCustomRenderingPipeline(){return!0}constructor(e){super(e),this.type=n.NV.WHOLE_SLIDE_NEXT,this.modality="SM",this.renderingEngineId=e.renderingEngineId,this.element.style.position=this.element.style.position||"relative",this.element.style.overflow="hidden",this.element.style.background=this.element.style.background||"#000",this.dataProvider=e.dataProvider||new a.q,this.renderPathResolver=e.renderPathResolver||(0,o.J)(),this.renderContext={viewportId:this.id,renderingEngineId:this.renderingEngineId,type:"wsi",element:this.element},this.viewState={zoom:1,rotation:0},this.element.setAttribute("data-viewport-uid",this.id),this.element.setAttribute("data-rendering-engine-uid",this.renderingEngineId)}normalizeViewState(e){return{...e,zoom:Math.max(e.zoom??1,.001),centerIndex:e.centerIndex?[e.centerIndex[0],e.centerIndex[1]]:e.centerIndex,resolution:"number"==typeof e.resolution?Math.max(e.resolution,1e-6):e.resolution,rotation:e.rotation??0}}async setDisplaySets(...e){for(let[t,{displaySetId:r}]of(this.removeAllData(),e.entries()))await this.addDisplaySet(r,{renderMode:"wsi2d",role:0===t?"source":"overlay"}),this.setDefaultDataPresentation(r,{visible:!0,opacity:1}),this.activeDataId=r;this.syncCameraFromView(),this.applyVOIToRendering()}setDisplaySetPresentation(e,t){if("string"==typeof e){super.setDisplaySetPresentation(e,t??{}),e===this.getActiveDataId()&&this.applyVOIToRendering();return}super.setDisplaySetPresentation(e),this.getActiveDataId()&&this.applyVOIToRendering()}computeTransforms(){return(0,s.Ug)(this.getWSIData()?.metadata)}getImageData(){let e=this.getWSIData();return(0,s.jl)({metadata:e?.metadata,modality:this.modality,frameOfReferenceUID:e?.frameOfReferenceUID})}hasImageURI(e){return!!e&&(this.getWSIData()?.imageURISet.has(e)||!1)}setViewState(e){if(this.syncCameraFromView(),!this.getView())return void super.setViewState(e);let t={};"number"==typeof e.zoom&&(t.zoom=Math.max(e.zoom,.001)),e.centerIndex&&(t.centerIndex=[e.centerIndex[0],e.centerIndex[1]]),"number"==typeof e.rotation&&(t.rotation=e.rotation),"number"==typeof e.resolution&&(t.resolution=Math.max(e.resolution,1e-6)),super.setViewState(t)}getResolvedView(){let e=this.getView(),t=this.getWSIData();if(e&&t)return new u({viewState:this.viewState,canvasHeight:this.element.clientHeight,canvasWidth:this.element.clientWidth,frameOfReferenceUID:t.frameOfReferenceUID,metadata:t.metadata,view:e})}getCurrentImageId(){return this.getWSIData()?.imageIds[0]}getViewReference(e={}){let t=this.getCurrentBinding()?.data.id;return{FrameOfReferenceUID:this.getFrameOfReferenceUID(),dataId:t,referencedImageId:this.getCurrentImageId(),sliceIndex:0}}setViewReference(e){}getFrameNumber(){return 1}async setFrameNumber(e){}resetViewState(){return!0}getNumberOfSlices(){return 1}resize(){this.isDestroyed||(this.resizeBindings(),this.render())}worldToIndexWSI(e){let t=this.getWSIRendering(),r=t?.viewer.getAffine(),n=t?.transformUtils;if(!n||!r)throw Error(`[WSIViewport] Cannot convert world to index for viewport ${this.id} because the WSI transform runtime is not ready.`);let i=n.applyInverseTransform({coordinate:[e[0],e[1]],affine:r});return[i[0],i[1]]}indexToWorldWSI(e){let t=this.getWSIRendering(),r=t?.viewer.getAffine(),n=t?.transformUtils;if(!n||!r)throw Error(`[WSIViewport] Cannot convert index to world for viewport ${this.id} because the WSI transform runtime is not ready.`);let i=n.applyTransform({coordinate:[e[0],e[1]],affine:r});return[i[0],i[1],0]}worldToIndex(e){return(0,s.GD)(this.getWSIData()?.metadata,e)}indexToWorld(e){return(0,s.O9)(this.getWSIData()?.metadata,e)}scroll(e){let t=this.getView()?.getResolution?.()??this.viewState.resolution??1;this.setViewState({resolution:Math.max(t*(1+.1*e),1e-6)})}getRotation(){return 0}getSliceIndex(){return 0}getView(){let e=this.getWSIRendering(),t=e?.map.getView();if(!t||"undefined"==typeof window)return t;let r=window;return r.map=e?.map,r.viewer=e?.viewer,r.view=t,r.wsi=this,t}getZoom(){return Math.max(this.getView()?.getZoom?.()??this.viewState.zoom??1,.001)}setZoom(e,t){let r=this.getResolvedView();if(r)return void this.applyResolvedViewState(r.withZoom(e,t).state.viewState);this.setViewState({zoom:Math.max(e,.001)})}getImageIds(){let e=this.getCurrentImageId();return e?[e]:[]}getViewReferenceId(e={}){return`imageId:${this.getCurrentImageId()}`}getCurrentImageIdIndex(){return 0}applyResolvedViewState(e){this.setViewState(e)}render(){this.isDestroyed||this.renderBindings()}destroy(){if(this.isDestroyed)return;let e=this.getWSIRendering(),t=e?.map,r=e?.viewer,n=t?.getView?.();super.destroy(),this.clearGlobalDebugRefs({map:t,viewer:r,view:n})}onDestroy(){this.activeDataId=void 0}customRenderViewportToCanvas(){this.render()}setRendered(){}removeData(e){super.removeData(e),this.activeDataId===e&&(this.activeDataId=this.bindings.keys().next().value,this.applyVOIToRendering())}getCurrentBinding(){return(this.activeDataId?this.getBinding(this.activeDataId):void 0)??this.getFirstBinding()}getActiveDataId(){return this.activeDataId}getReferenceViewContexts(){let e=this.getCurrentBinding(),t=this.getWSIData();return e&&t?[{dataId:e.data.id,dataIds:[e.data.id],frameOfReferenceUID:t.frameOfReferenceUID??void 0,imageIds:t.imageIds,imageURIs:Array.from(t.imageURISet),allowAnyImageReference:!0,currentImageIdIndex:0}]:super.getReferenceViewContexts()}applyVOIToRendering(){let e=this.getActiveDataId(),t=e?this.getDisplaySetPresentation(e):void 0,r=(0,s.nB)(t?.voiRange||{lower:0,upper:255},t?.averageWhite),n=this.getMap()?.getViewport();n&&n.querySelectorAll(".ol-layers canvas").forEach(e=>{e.style.filter=r||""})}syncCameraFromView(){let e=this.getView();if(!e)return;let t=e.getCenter();this.viewState=this.normalizeViewState({...this.viewState,zoom:e.getZoom(),rotation:e.getRotation(),resolution:e.getResolution(),centerIndex:t?[t[0],t[1]]:void 0})}getMap(){return this.getWSIRendering()?.map}getWSIData(){var e;let t=this.getCurrentBinding();if(t&&"object"==typeof(e=t.data)&&null!==e&&"wsi"===e.type&&Array.isArray(e.imageIds)&&"object"==typeof e.client&&null!==e.client&&"object"==typeof e.metadata&&null!==e.metadata&&void 0!==e.frameOfReferenceUID&&e.imageURISet instanceof Set)return t.data}getWSIRendering(){let e=this.getCurrentBinding();if(e&&"wsi2d"===e.rendering.renderMode)return e.rendering}clearGlobalDebugRefs(e){if("undefined"==typeof window)return;let t=window;t.wsi===this&&(e.map&&t.map===e.map&&delete t.map,e.viewer&&t.viewer===e.viewer&&delete t.viewer,e.view&&t.view===e.view&&delete t.view,delete t.wsi)}}},82039:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(62685),i=r(54268);let a=function(e){return e instanceof n.A?i.Ay.getVolume(e.getVolumeId()).imageIds:e.getImageIds?e.getImageIds():void 0}},82147:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=function(e,t){if(t-e<=1){let r=Math.round((e+t)/2);return[r,r]}return[Math.floor(e),Math.ceil(t)]}},82243:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(70192),i=r(29010);class a extends i.A{constructor(e,t,r,n,i){super(n||a.getUniqueInstanceName("image-cursor"),i),this.url=e,this.x=Number(t)||0,this.y=Number(r)||0}getStyleProperty(){let{url:e,x:t,y:r}=this,n=`url('${e}')`;return t>=0&&r>=0&&(t>0||r>0)&&(n+=` ${t} ${r}`),this.addFallbackStyleProperty(n)}static getUniqueInstanceName(e){return`${e}-${n.BF.getRuntimeId(a)}`}}},82280:(e,t,r)=>{"use strict";r.d(t,{n4:()=>x,Ph:()=>S,WC:()=>T,Et:()=>function e(t){return Array.isArray(t)?e(t[0]):isFinite(t)&&!isNaN(t)},m9:()=>n,IQ:()=>v});var n={};r.r(n),r.d(n,{RZ:()=>c,uu:()=>s,gE:()=>a,HL:()=>m,UX:()=>d,tZ:()=>g,pp:()=>f,U5:()=>h,_E:()=>u,Rm:()=>i.Rm,Um:()=>o,UA:()=>l,bM:()=>p});var i=r(66122);let a=f("cs3d"),o=a.getLogger("metadata"),s=a.getLogger("core"),l=a.getLogger("tools"),u=a.getLogger("dicomImageLoader"),c=a.getLogger("ai"),d=a.getLogger("examples"),p=a.getLogger("worker"),m=i.Rm.getLogger("consistency.dicom"),h=i.Rm.getLogger("consistency.image");function f(e){let t=i.Rm.getLogger(e);return t.getLogger=(...t)=>f(`${e}.${t.join(".")}`),t}function g(...e){return f(e.join("."))}function v(e){if(void 0!==e){if("string"==typeof e||"number"==typeof e||e instanceof String||e instanceof Number){let t=Number(e);return Number.isFinite(t)?t:void 0}return Array.from(e,e=>{let t=Number(e);return Number.isFinite(t)?t:void 0})}}function y(e,t,r){return Math.abs(e-t)<=r}function b(e){return"number"==typeof e}function I(e){return e&&"object"==typeof e&&"length"in e&&"number"==typeof e.length&&e.length>0&&"number"==typeof e[0]}function x(e,t,r=1e-5){return typeof e==typeof t&&null!==e&&null!==t&&(b(e)&&b(t)?y(e,t,r):!!(I(e)&&I(t))&&function(e,t,r=1e-5){if(e.length!==t.length)return!1;for(let n=0;n"number"==typeof e?-e:e?.map?e.map(C):!e,A=e=>"number"==typeof e?Math.abs(e):e?.map?e.map(A):e,T=(e,t,r)=>x(e,C(t),r),S=(e,t,r)=>x(A(e),A(t),r)},82382:(e,t,r)=>{"use strict";r.d(t,{vZ:()=>n,wV:()=>i});var n={VTK_EMPTY_CELL:0,VTK_VERTEX:1,VTK_POLY_VERTEX:2,VTK_LINE:3,VTK_POLY_LINE:4,VTK_TRIANGLE:5,VTK_TRIANGLE_STRIP:6,VTK_POLYGON:7,VTK_PIXEL:8,VTK_QUAD:9,VTK_TETRA:10,VTK_VOXEL:11,VTK_HEXAHEDRON:12,VTK_WEDGE:13,VTK_PYRAMID:14,VTK_PENTAGONAL_PRISM:15,VTK_HEXAGONAL_PRISM:16,VTK_QUADRATIC_EDGE:21,VTK_QUADRATIC_TRIANGLE:22,VTK_QUADRATIC_QUAD:23,VTK_QUADRATIC_POLYGON:36,VTK_QUADRATIC_TETRA:24,VTK_QUADRATIC_HEXAHEDRON:25,VTK_QUADRATIC_WEDGE:26,VTK_QUADRATIC_PYRAMID:27,VTK_BIQUADRATIC_QUAD:28,VTK_TRIQUADRATIC_HEXAHEDRON:29,VTK_QUADRATIC_LINEAR_QUAD:30,VTK_QUADRATIC_LINEAR_WEDGE:31,VTK_BIQUADRATIC_QUADRATIC_WEDGE:32,VTK_BIQUADRATIC_QUADRATIC_HEXAHEDRON:33,VTK_BIQUADRATIC_TRIANGLE:34,VTK_CUBIC_LINE:35,VTK_CONVEX_POINT_SET:41,VTK_POLYHEDRON:42,VTK_PARAMETRIC_CURVE:51,VTK_PARAMETRIC_SURFACE:52,VTK_PARAMETRIC_TRI_SURFACE:53,VTK_PARAMETRIC_QUAD_SURFACE:54,VTK_PARAMETRIC_TETRA_REGION:55,VTK_PARAMETRIC_HEX_REGION:56,VTK_HIGHER_ORDER_EDGE:60,VTK_HIGHER_ORDER_TRIANGLE:61,VTK_HIGHER_ORDER_QUAD:62,VTK_HIGHER_ORDER_POLYGON:63,VTK_HIGHER_ORDER_TETRAHEDRON:64,VTK_HIGHER_ORDER_WEDGE:65,VTK_HIGHER_ORDER_PYRAMID:66,VTK_HIGHER_ORDER_HEXAHEDRON:67,VTK_LAGRANGE_CURVE:68,VTK_LAGRANGE_TRIANGLE:69,VTK_LAGRANGE_QUADRILATERAL:70,VTK_LAGRANGE_TETRAHEDRON:71,VTK_LAGRANGE_HEXAHEDRON:72,VTK_LAGRANGE_WEDGE:73,VTK_LAGRANGE_PYRAMID:74,VTK_NUMBER_OF_CELL_TYPES:75},i=["vtkEmptyCell","vtkVertex","vtkPolyVertex","vtkLine","vtkPolyLine","vtkTriangle","vtkTriangleStrip","vtkPolygon","vtkPixel","vtkQuad","vtkTetra","vtkVoxel","vtkHexahedron","vtkWedge","vtkPyramid","vtkPentagonalPrism","vtkHexagonalPrism","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkQuadraticEdge","vtkQuadraticTriangle","vtkQuadraticQuad","vtkQuadraticTetra","vtkQuadraticHexahedron","vtkQuadraticWedge","vtkQuadraticPyramid","vtkBiQuadraticQuad","vtkTriQuadraticHexahedron","vtkQuadraticLinearQuad","vtkQuadraticLinearWedge","vtkBiQuadraticQuadraticWedge","vtkBiQuadraticQuadraticHexahedron","vtkBiQuadraticTriangle","vtkCubicLine","vtkQuadraticPolygon","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkConvexPointSet","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkParametricCurve","vtkParametricSurface","vtkParametricTriSurface","vtkParametricQuadSurface","vtkParametricTetraRegion","vtkParametricHexRegion","UnknownClass","UnknownClass","UnknownClass","vtkHigherOrderEdge","vtkHigherOrderTriangle","vtkHigherOrderQuad","vtkHigherOrderPolygon","vtkHigherOrderTetrahedron","vtkHigherOrderWedge","vtkHigherOrderPyramid","vtkHigherOrderHexahedron"]},82866:(e,t,r)=>{"use strict";var n;r.d(t,{A:()=>i}),function(e){e[e.FAR_REPLICATE=1]="FAR_REPLICATE",e[e.ADJACENT_REPLICATE=3]="ADJACENT_REPLICATE",e[e.SUBRESOLUTION=6]="SUBRESOLUTION",e[e.LOSSY=7]="LOSSY",e[e.FULL_RESOLUTION=8]="FULL_RESOLUTION"}(n||(n={}));let i=n},82875:(e,t,r)=>{"use strict";r.d(t,{A:()=>d});var n=r(70192),i=r(91792),a=r(18236),o=r(65509),s=r(40454),l=r(76399),u=r(4849);class c{constructor(e){this.stackLabelmapImageIdReferenceMap=new Map,this.labelmapImageIdReferenceMap=new Map,this.keysBySegmentationId=new Map,this.completedScanResultsBySegmentationId=new Map,this.getSegmentation=e}reset(){this.stackLabelmapImageIdReferenceMap.clear(),this.labelmapImageIdReferenceMap.clear(),this.keysBySegmentationId.clear(),this.completedScanResultsBySegmentationId.clear()}removeSegmentation(e){this.stackLabelmapImageIdReferenceMap.delete(e),this.completedScanResultsBySegmentationId.delete(e);let t=this.keysBySegmentationId.get(e);if(t){for(let e of t)this.labelmapImageIdReferenceMap.delete(e);this.keysBySegmentationId.delete(e)}}setLabelmapImageIds(e,t,r){this.labelmapImageIdReferenceMap.set(t,r);let n=this.keysBySegmentationId.get(e);n||(n=new Set,this.keysBySegmentationId.set(e,n)),n.add(t)}getLabelmapImageIds(e){let t,r=e.Labelmap;if(r){if(r?.labelmaps)return Array.from(new Set(Object.values(r.labelmaps).flatMap(e=>e.imageIds?.length?e.imageIds:e.volumeId?n.PP.getVolume(e.volumeId)?.imageIds:[]).filter(Boolean)));if(r.imageIds)t=r.imageIds;else if(r.volumeId){let e=r.volumeId;t=n.PP.getVolume(e).imageIds}return t}}getLabelmapImageIdsForImageId(e,t){let r=this.getSegmentation(t);if(r?.representationData?.Labelmap)return(0,a.uk)(r),(0,l._)(r).get(e)}updateLabelmapSegmentationImageReferences(e,t){let r=this.getSegmentation(t);if(!r)return;this.stackLabelmapImageIdReferenceMap.has(t)||this.stackLabelmapImageIdReferenceMap.set(t,new Map);let{representationData:i}=r;if(!i.Labelmap)return;let a=this.getLabelmapImageIds(i),o=(0,n.yj)(e);if(!o||!a?.length)return;let s=o.viewport,l=this.generateScanKey("current",s,a);if(l&&this.hasCompletedScan(t,l))return this.getCompletedScanResult(t,l);let u=this.updateLabelmapSegmentationReferences(t,s,a);return l&&this.markCompletedScan(t,l,u),u}generateScanKey(e,t,r){let n="function"==typeof t.getCurrentImageId?t.getCurrentImageId():void 0;if(n)return`${e}|${t.id}|${n}|${r.length}|${r[0]}|${r[r.length-1]}`}hasCompletedScan(e,t){return!!this.completedScanResultsBySegmentationId.get(e)?.has(t)}getCompletedScanResult(e,t){return this.completedScanResultsBySegmentationId.get(e)?.get(t)}markCompletedScan(e,t,r){let n=this.completedScanResultsBySegmentationId.get(e);n||(n=new Map,this.completedScanResultsBySegmentationId.set(e,n)),n.set(t,r)}getCurrentLabelmapImageIdsForViewport(e,t){let r=(0,n.yj)(e);if(!r)return;let{viewport:l}=r;if("image"!==(0,i.A)(l)||"function"!=typeof l.getCurrentImageId)return;let c=l.getCurrentImageId(),d=this.getSegmentation(t);if(!d)return;(0,a.uk)(d);let p=l.getImageIds().indexOf(c),m=[];(0,o.m)(d).forEach(e=>{let t=(0,u.s_)(e,c);return t.length?void m.push(...t):-1!==p&&e.imageIds?.[p]?void m.push(e.imageIds[p]):void e.imageIds?.some(e=>{let t=l.isReferenceViewable({referencedImageId:e},{asOverlay:!0});return t&&m.push(e),!!t})});let h=Array.from(new Set(m)),f=this.generateMapKey({segmentationId:t,referenceImageId:c});this.setLabelmapImageIds(t,f,h),this.stackLabelmapImageIdReferenceMap.has(t)||this.stackLabelmapImageIdReferenceMap.set(t,new Map);let g=Object.keys(d.segments).find(e=>d.segments[e].active),v=g?(0,s.r)(d,Number(g))?.imageIds?.[p]:void 0;return this.stackLabelmapImageIdReferenceMap.get(t).set(c,v??h[0]),h}getCurrentLabelmapImageIdForViewport(e,t){let r=(0,n.yj)(e);if(!r)return;let{viewport:a}=r;if("image"!==(0,i.A)(a)||"function"!=typeof a.getCurrentImageId)return;let o=a.getCurrentImageId(),l=this.getCurrentLabelmapImageIdsForViewport(e,t);if(!l?.length)return;let u=this.getSegmentation(t),c=a.getImageIds().indexOf(o),d=u?Object.keys(u.segments).find(e=>u.segments[e].active):void 0;return(u&&d?(0,s.r)(u,Number(d))?.imageIds?.[c]:void 0)??l[0]}getStackSegmentationImageIdsForViewport(e,t){let r=this.getSegmentation(t);if(!r)return[];this.updateAllLabelmapSegmentationImageReferences(e,t);let i=(0,n.yj)(e),a=i?.viewport.getImageIds?.()??[],o=(0,l._)(r);return a.flatMap(e=>o.get(e)??[])}updateLabelmapSegmentationReferences(e,t,r,n){let i=t.getCurrentImageId(),a=!1;for(let n of r)t.isReferenceViewable({referencedImageId:n},{asOverlay:!0})&&(a=!0,this.stackLabelmapImageIdReferenceMap.get(e).set(i,n),this.updateLabelmapImageIdReferenceMap({segmentationId:e,referenceImageId:i,labelmapImageId:n}));return n?.(t,e,r),a?this.stackLabelmapImageIdReferenceMap.get(e).get(i):void 0}updateAllLabelmapSegmentationImageReferences(e,t){let r=this.getSegmentation(t);if(!r)return;this.stackLabelmapImageIdReferenceMap.has(t)||this.stackLabelmapImageIdReferenceMap.set(t,new Map);let{representationData:i}=r;if(!i.Labelmap)return;let a=this.getLabelmapImageIds(i),o=(0,n.yj)(e);if(!o||!a?.length)return;let s=o.viewport,l=this.generateScanKey("all",s,a);l&&this.hasCompletedScan(t,l)||(l&&this.markCompletedScan(t,l),this.updateLabelmapSegmentationReferences(t,s,a,(e,t,r)=>{e.getImageIds().forEach((n,i)=>{for(let a of r)e.isReferenceViewable({referencedImageId:a,sliceIndex:i},{asOverlay:!0,withNavigation:!0})&&(this.stackLabelmapImageIdReferenceMap.get(t).set(n,a),this.updateLabelmapImageIdReferenceMap({segmentationId:t,referenceImageId:n,labelmapImageId:a}))})}))}updateLabelmapImageIdReferenceMap({segmentationId:e,referenceImageId:t,labelmapImageId:r}){let n=this.generateMapKey({segmentationId:e,referenceImageId:t});if(!this.labelmapImageIdReferenceMap.has(n))return void this.setLabelmapImageIds(e,n,[r]);let i=Array.from(new Set([...this.labelmapImageIdReferenceMap.get(n)??[],r]));this.setLabelmapImageIds(e,n,i)}generateMapKey({segmentationId:e,referenceImageId:t}){return`${e}-${t}`}}let d=c},83011:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.element_has=function(e,t){return -1!==t._attributeList._asArray().indexOf(e)},t.element_change=m,t.element_append=h,t.element_remove=f,t.element_replace=g,t.element_getAnAttributeByName=v,t.element_getAnAttributeByNamespaceAndLocalName=y,t.element_getAnAttributeValue=function(e,t,r=""){let n=y(r,t,e);return null===n?"":n._value},t.element_setAnAttribute=function(e,t){if(null!==e._element&&e._element!==t)throw new o.InUseAttributeError(`This attribute already exists in the document: ${e._qualifiedName} as a child of ${e._element._qualifiedName}.`);let r=y(e._namespace||"",e._localName,t);return r===e?e:(null!==r?g(r,e,t):h(e,t),r)},t.element_setAnAttributeValue=function(e,t,r,n=null,i=null){let a=y(i||"",t,e);if(null===a){let a=(0,s.create_attr)(e._nodeDocument,t);a._namespace=i,a._namespacePrefix=n,a._value=r,h(a,e);return}m(a,e,r)},t.element_removeAnAttributeByName=function(e,t){let r=v(e,t);return null!==r&&f(r,t),r},t.element_removeAnAttributeByNamespaceAndLocalName=function(e,t,r){let n=y(e,t,r);return null!==n&&f(n,r),n},t.element_createAnElement=function(e,t,r,a=null,u=null,c=!1){let d=null;if(!n.dom.features.customElements)return(d=(0,s.create_element)(e,t,r,a))._customElementState="uncustomized",d._customElementDefinition=null,d._is=u,d;let m=(0,l.customElement_lookUpACustomElementDefinition)(e,r,t,u);if(null!==m&&m.name!==m.localName)(d=new((0,p.document_elementInterface)(t,i.namespace.HTML)))._localName=t,d._namespace=i.namespace.HTML,d._namespacePrefix=a,d._customElementState="undefined",d._customElementDefinition=null,d._is=u,d._nodeDocument=e,c?(0,l.customElement_upgrade)(m,d):(0,l.customElement_enqueueACustomElementUpgradeReaction)(d,m);else if(null!==m)if(c)try{let r=new m.constructor;if(console.assert(void 0!==r._customElementState),console.assert(void 0!==r._customElementDefinition),console.assert(r._namespace===i.namespace.HTML),0!==r._attributeList.length)throw new o.NotSupportedError("Custom element already has attributes.");if(0!==r._children.size)throw new o.NotSupportedError("Custom element already has child nodes.");if(null!==r._parent)throw new o.NotSupportedError("Custom element already has a parent node.");if(r._nodeDocument!==e)throw new o.NotSupportedError("Custom element is already in a document.");if(r._localName!==t)throw new o.NotSupportedError("Custom element has a different local name.");r._namespacePrefix=a,r._is=null}catch(r){(d=(0,s.create_htmlUnknownElement)(e,t,i.namespace.HTML,a))._customElementState="failed",d._customElementDefinition=null,d._is=null}else(d=(0,s.create_htmlElement)(e,t,i.namespace.HTML,a))._customElementState="undefined",d._customElementDefinition=null,d._is=null,(0,l.customElement_enqueueACustomElementUpgradeReaction)(d,m);else(d=new((0,p.document_elementInterface)(t,r)))._localName=t,d._namespace=r,d._namespacePrefix=a,d._customElementState="uncustomized",d._customElementDefinition=null,d._is=u,d._nodeDocument=e,r===i.namespace.HTML&&(null!==u||(0,l.customElement_isValidCustomElementName)(t))&&(d._customElementState="undefined");if(null===d)throw Error("Unable to create element.");return d},t.element_insertAdjacent=function(e,t,r){switch(t.toLowerCase()){case"beforebegin":if(null===e._parent)return null;return(0,d.mutation_preInsert)(r,e._parent,e);case"afterbegin":return(0,d.mutation_preInsert)(r,e,e._firstChild);case"beforeend":return(0,d.mutation_preInsert)(r,e,null);case"afterend":if(null===e._parent)return null;return(0,d.mutation_preInsert)(r,e._parent,e._nextSibling);default:throw new o.SyntaxError('Invalid \'where\' argument. "beforebegin", "afterbegin", "beforeend" or "afterend" expected')}};let n=r(60957),i=r(57226),a=r(79663),o=r(32008),s=r(73951),l=r(17344),u=r(38020),c=r(11455),d=r(78742),p=r(72444);function m(e,t,r){n.dom.features.mutationObservers&&(0,u.observer_queueAttributeMutationRecord)(t,e._localName,e._namespace,e._value),n.dom.features.customElements&&a.Guard.isCustomElementNode(t)&&(0,l.customElement_enqueueACustomElementCallbackReaction)(t,"attributeChangedCallback",[e._localName,e._value,r,e._namespace]),n.dom.features.steps&&(0,c.dom_runAttributeChangeSteps)(t,e._localName,e._value,r,e._namespace),e._value=r}function h(e,t){n.dom.features.mutationObservers&&(0,u.observer_queueAttributeMutationRecord)(t,e._localName,e._namespace,null),n.dom.features.customElements&&a.Guard.isCustomElementNode(t)&&(0,l.customElement_enqueueACustomElementCallbackReaction)(t,"attributeChangedCallback",[e._localName,null,e._value,e._namespace]),n.dom.features.steps&&(0,c.dom_runAttributeChangeSteps)(t,e._localName,null,e._value,e._namespace),t._attributeList._asArray().push(e),e._element=t,t._nodeDocument._hasNamespaces||null===e._namespace&&null===e._namespacePrefix&&"xmlns"!==e._localName||(t._nodeDocument._hasNamespaces=!0)}function f(e,t){n.dom.features.mutationObservers&&(0,u.observer_queueAttributeMutationRecord)(t,e._localName,e._namespace,e._value),n.dom.features.customElements&&a.Guard.isCustomElementNode(t)&&(0,l.customElement_enqueueACustomElementCallbackReaction)(t,"attributeChangedCallback",[e._localName,e._value,null,e._namespace]),n.dom.features.steps&&(0,c.dom_runAttributeChangeSteps)(t,e._localName,e._value,null,e._namespace);let r=t._attributeList._asArray().indexOf(e);t._attributeList._asArray().splice(r,1),e._element=null}function g(e,t,r){n.dom.features.mutationObservers&&(0,u.observer_queueAttributeMutationRecord)(r,e._localName,e._namespace,e._value),n.dom.features.customElements&&a.Guard.isCustomElementNode(r)&&(0,l.customElement_enqueueACustomElementCallbackReaction)(r,"attributeChangedCallback",[e._localName,e._value,t._value,e._namespace]),n.dom.features.steps&&(0,c.dom_runAttributeChangeSteps)(r,e._localName,e._value,t._value,e._namespace);let i=r._attributeList._asArray().indexOf(e);-1!==i&&(r._attributeList._asArray()[i]=t),e._element=null,t._element=r,r._nodeDocument._hasNamespaces||null===t._namespace&&null===t._namespacePrefix&&"xmlns"!==t._localName||(r._nodeDocument._hasNamespaces=!0)}function v(e,t){return t._namespace===i.namespace.HTML&&"html"===t._nodeDocument._type&&(e=e.toLowerCase()),t._attributeList._asArray().find(t=>t._qualifiedName===e)||null}function y(e,t,r){let n=e||null;return r._attributeList._asArray().find(e=>e._namespace===n&&e._localName===t)||null}},83048:(e,t,r)=>{"use strict";r.d(t,{OA:()=>n.O});var n=r(88243)},83101:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(71283);function i(e,t){let r=(0,n.A)(e),i=[];return r.forEach(e=>{let r=e.length,n=Array(r);for(let i=0;i{"use strict";r.d(t,{b:()=>i});var n=r(70192);function i(e){let t,r=n.PP.getVolume(e);if(!r)return null;let i=r.referencedVolumeId;if(i)t=n.PP.getVolume(i);else{let e=r.imageIds,i=e?.[0];if(!i)return null;let a=n.PP.getImage(i);if(!a)return null;let o=a.referencedImageId,s=o?n.PP.getVolumeContainingImageId(o):void 0;s?.volume||(s=n.PP.getVolumeContainingImageId(a.imageId)),t=s?.volume}return t}},83409:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(99537);let i=function(e){n.o.renderViewport(e)}},83553:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ElementImpl=void 0;let n=r(5309),i=r(92787),a=r(32008),o=r(57226),s=r(47518),l=r(48040);class u extends i.NodeImpl{_nodeType=n.NodeType.Element;_children=new Set;_namespace=null;_namespacePrefix=null;_localName="";_customElementState="undefined";_customElementDefinition=null;_is=null;_shadowRoot=null;_attributeList=(0,s.create_namedNodeMap)(this);_uniqueIdentifier;_attributeChangeSteps=[];_name="";_assignedSlot=null;constructor(){super()}get namespaceURI(){return this._namespace}get prefix(){return this._namespacePrefix}get localName(){return this._localName}get tagName(){return this._htmlUppercasedQualifiedName}get id(){return(0,s.element_getAnAttributeValue)(this,"id")}set id(e){(0,s.element_setAnAttributeValue)(this,"id",e)}get className(){return(0,s.element_getAnAttributeValue)(this,"class")}set className(e){(0,s.element_setAnAttributeValue)(this,"class",e)}get classList(){let e=(0,s.element_getAnAttributeByName)("class",this);return null===e&&(e=(0,s.create_attr)(this._nodeDocument,"class")),(0,s.create_domTokenList)(this,e)}get slot(){return(0,s.element_getAnAttributeValue)(this,"slot")}set slot(e){(0,s.element_setAnAttributeValue)(this,"slot",e)}hasAttributes(){return 0!==this._attributeList.length}get attributes(){return this._attributeList}getAttributeNames(){let e=[];for(let t of this._attributeList)e.push(t._qualifiedName);return e}getAttribute(e){let t=(0,s.element_getAnAttributeByName)(e,this);return t?t._value:null}getAttributeNS(e,t){let r=(0,s.element_getAnAttributeByNamespaceAndLocalName)(e,t,this);return r?r._value:null}setAttribute(e,t){if(!(0,s.xml_isName)(e))throw new a.InvalidCharacterError;this._namespace===o.namespace.HTML&&"html"===this._nodeDocument._type&&(e=e.toLowerCase());let r=null;for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AbortSignalImpl=void 0;let n=r(34976),i=r(47518);class a extends n.EventTargetImpl{_abortedFlag=!1;_abortAlgorithms=new Set;constructor(){super()}get aborted(){return this._abortedFlag}get onabort(){return(0,i.event_getterEventHandlerIDLAttribute)(this,"onabort")}set onabort(e){(0,i.event_setterEventHandlerIDLAttribute)(this,"onabort",e)}static _create(){return new a}}t.AbortSignalImpl=a},83734:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>p});var n=r(17042),i=r(87352),a=r(73416),o=r(48185),s=r(19047),l=[2,0,1,2,2,3,2,4,5,2,6,7,2,0,2,2,1,3,2,4,6,2,5,7,2,0,4,2,1,5,2,2,6,2,3,7],u=[4,0,1,3,2,4,4,6,7,5,4,8,10,11,9,4,12,13,15,14,4,16,18,19,17,4,20,21,23,22],c={xLength:1,yLength:1,zLength:1,pointType:"Float64Array",generate3DTextureCoordinates:!1,generateFaces:!0,generateLines:!1};function d(e,t,r={}){Object.assign(t,c,r),n.Ay.obj(e,t),n.Ay.setGet(e,t,["xLength","yLength","zLength","generate3DTextureCoordinates","generateFaces","generateLines"]),n.Ay.setGetArray(e,t,["center","rotations"],3),n.Ay.setGetArray(e,t,["matrix"],16),t._polys=a.Ay.newInstance({values:Uint16Array.from(u)}),t._lineCells=a.Ay.newInstance({values:Uint16Array.from(l)}),n.Ay.moveToProtected(e,t,["polys","lineCells"]),n.Ay.algo(e,t,0,1),t.classHierarchy.push("vtkCubeSource"),e.requestData=(e,r)=>{let a=r[0]?.initialize()||s.Ay.newInstance();r[0]=a;let l=n.Ay.newTypedArray(t.pointType,72);a.getPoints().setData(l,3);let u=n.Ay.newTypedArray(t.pointType,72),c=i.Ay.newInstance({name:"Normals",values:u,numberOfComponents:3});a.getPointData().setNormals(c);let d=2;!0===t.generate3DTextureCoordinates&&(d=3);let p=n.Ay.newTypedArray(t.pointType,24*d),m=i.Ay.newInstance({name:"TextureCoordinates",values:p,numberOfComponents:d});a.getPointData().setTCoords(m);let h=[0,0,0],f=[0,0,0],g=[0,0],v=0;h[0]=-t.xLength/2,f[0]=-1,f[1]=0,f[2]=0;for(let e=0;e<2;e++){h[1]=-t.yLength/2;for(let r=0;r<2;r++){g[1]=h[1]+.5,h[2]=-t.zLength/2;for(let n=0;n<2;n++)g[0]=(h[2]+.5)*(1-2*e),l[3*v]=h[0],l[3*v+1]=h[1],l[3*v+2]=h[2],u[3*v]=f[0],u[3*v+1]=f[1],u[3*v+2]=f[2],2===d?(p[v*d]=g[0],p[v*d+1]=g[1]):(p[v*d]=2*e-1,p[v*d+1]=2*r-1,p[v*d+2]=2*n-1),v++,h[2]+=t.zLength;h[1]+=t.yLength}h[0]+=t.xLength,f[0]+=2}h[1]=-t.yLength/2,f[1]=-1,f[0]=0,f[2]=0;for(let e=0;e<2;e++){h[0]=-t.xLength/2;for(let r=0;r<2;r++){g[0]=(h[0]+.5)*(2*e-1),h[2]=-t.zLength/2;for(let n=0;n<2;n++)g[1]=-((h[2]+.5)*1),l[3*v]=h[0],l[3*v+1]=h[1],l[3*v+2]=h[2],u[3*v]=f[0],u[3*v+1]=f[1],u[3*v+2]=f[2],2===d?(p[v*d]=g[0],p[v*d+1]=g[1]):(p[v*d]=2*r-1,p[v*d+1]=2*e-1,p[v*d+2]=2*n-1),v++,h[2]+=t.zLength;h[0]+=t.xLength}h[1]+=t.yLength,f[1]+=2}h[2]=-t.zLength/2,f[2]=-1,f[0]=0,f[1]=0;for(let e=0;e<2;e++){h[1]=-t.yLength/2;for(let r=0;r<2;r++){g[1]=h[1]+.5,h[0]=-t.xLength/2;for(let n=0;n<2;n++)g[0]=(h[0]+.5)*(2*e-1),l[3*v]=h[0],l[3*v+1]=h[1],l[3*v+2]=h[2],u[3*v]=f[0],u[3*v+1]=f[1],u[3*v+2]=f[2],2===d?(p[v*d]=g[0],p[v*d+1]=g[1]):(p[v*d]=2*n-1,p[v*d+1]=2*r-1,p[v*d+2]=2*e-1),v++,h[0]+=t.xLength;h[1]+=t.yLength}h[2]+=t.zLength,f[2]+=2}if(t.rotations&&o.A.buildFromDegree().rotateX(t.rotations[0]).rotateY(t.rotations[1]).rotateZ(t.rotations[2]).apply(l).apply(u),t.center&&o.A.buildFromRadian().translate(...t.center).apply(l),t.matrix){o.A.buildFromRadian().setMatrix(t.matrix).apply(l);let e=[t.matrix[0],t.matrix[1],t.matrix[2],0,t.matrix[4],t.matrix[5],t.matrix[6],0,t.matrix[8],t.matrix[9],t.matrix[10],0,0,0,0,1];o.A.buildFromRadian().setMatrix(e).apply(u)}t.generateFaces?a.getPolys().deepCopy(t._polys):a.getPolys().initialize(),t.generateLines?(a.getLines().deepCopy(t._lineCells),a.getPointData().setNormals(null)):a.getLines().initialize(),a.modified()},e.setBounds=(...t)=>{let r=[];if(Array.isArray(t[0]))r=t[0];else for(let e=0;e{"use strict";r.d(t,{A:()=>a});var n=r(16376),i=r(66384);let a=function(e,t){let r;r=t?[(0,n.lD)(t)]:(0,n.qO)();let a=[];return r.forEach(t=>{let r=e.getActors();for(let e of t.getViewports().filter(i.$O)){let t=e.getActors();t.length===r.length&&r.every(({uid:e})=>t.find(t=>e===t.uid))&&a.push(e)}}),a}},84468:(e,t,r)=>{"use strict";r.d(t,{Y:()=>i});var n=r(50923);let i=(e,t,r,i,a,o,s,l)=>{let u=[n.fA(r,i,a),n.fA(o,i,a),n.fA(r,s,a),n.fA(o,s,a),n.fA(r,i,l),n.fA(o,i,l),n.fA(r,s,l),n.fA(o,s,l)],c=n.fA(t[0],t[1],t[2]),d=n.fA(e[0],e[1],e[2]),p=-n.Om(c,d),m=null;for(let e of u){let t=n.Om(c,e)+p;if(null===m)m=Math.sign(t);else if(Math.sign(t)!==m)return!0}return!1}},84494:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.text_contiguousTextNodes=function(e,t=!1){return{[Symbol.iterator](){let r=e;for(;r&&i.Guard.isTextNode(r._previousSibling);)r=r._previousSibling;return{next(){if(r&&!t&&r===e&&(r=i.Guard.isTextNode(r._nextSibling)?r._nextSibling:null),null===r)return{done:!0,value:null};{let e={done:!1,value:r};return r=i.Guard.isTextNode(r._nextSibling)?r._nextSibling:null,e}}}}}},t.text_contiguousExclusiveTextNodes=function(e,t=!1){return{[Symbol.iterator](){let r=e;for(;r&&i.Guard.isExclusiveTextNode(r._previousSibling);)r=r._previousSibling;return{next(){if(r&&!t&&r===e&&(r=i.Guard.isExclusiveTextNode(r._nextSibling)?r._nextSibling:null),null===r)return{done:!0,value:null};{let e={done:!1,value:r};return r=i.Guard.isExclusiveTextNode(r._nextSibling)?r._nextSibling:null,e}}}}}},t.text_descendantTextContent=function(e){let t="",r=(0,s.tree_getFirstDescendantNode)(e,!1,!1,e=>i.Guard.isTextNode(e));for(;null!==r;)t+=r._data,r=(0,s.tree_getNextDescendantNode)(e,r,!1,!1,e=>i.Guard.isTextNode(e));return t},t.text_split=function(e,t){let r=e._data.length;if(t>r)throw new a.IndexSizeError;let i=r-t,c=(0,l.characterData_substringData)(e,t,i),d=(0,o.create_text)(e._nodeDocument,c),p=e._parent;if(null!==p)for(let r of((0,u.mutation_insert)(d,p,e._nextSibling),n.dom.rangeList)){r._start[0]===e&&r._start[1]>t&&(r._start[0]=d,r._start[1]-=t),r._end[0]===e&&r._end[1]>t&&(r._end[0]=d,r._end[1]-=t);let n=(0,s.tree_index)(e);r._start[0]===p&&r._start[1]===n+1&&r._start[1]++,r._end[0]===p&&r._end[1]===n+1&&r._end[1]++}return(0,l.characterData_replaceData)(e,t,i,""),d};let n=r(60957),i=r(79663),a=r(32008),o=r(73951),s=r(29963),l=r(39246),u=r(78742)},84745:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TreeWalkerImpl=void 0;let n=r(5309),i=r(38485),a=r(47518);class o extends i.TraverserImpl{_current;constructor(e,t){super(e),this._current=t}get currentNode(){return this._current}set currentNode(e){this._current=e}parentNode(){let e=this._current;for(;null!==e&&e!==this._root;)if(null!==(e=e._parent)&&(0,a.traversal_filter)(this,e)===n.FilterResult.Accept)return this._current=e,e;return null}firstChild(){return(0,a.treeWalker_traverseChildren)(this,!0)}lastChild(){return(0,a.treeWalker_traverseChildren)(this,!1)}nextSibling(){return(0,a.treeWalker_traverseSiblings)(this,!0)}previousNode(){let e=this._current;for(;e!==this._root;){let t=e._previousSibling;for(;t;){e=t;let r=(0,a.traversal_filter)(this,e);for(;r!==n.FilterResult.Reject&&e._lastChild;)e=e._lastChild,r=(0,a.traversal_filter)(this,e);if(r===n.FilterResult.Accept)return this._current=e,e;t=e._previousSibling}if(e===this._root||null===e._parent)break;if(e=e._parent,(0,a.traversal_filter)(this,e)===n.FilterResult.Accept)return this._current=e,e}return null}previousSibling(){return(0,a.treeWalker_traverseSiblings)(this,!1)}nextNode(){let e=this._current,t=n.FilterResult.Accept;for(;;){for(;t!==n.FilterResult.Reject&&e._firstChild;)if(e=e._firstChild,(t=(0,a.traversal_filter)(this,e))===n.FilterResult.Accept)return this._current=e,e;let r=null,i=e;for(;null!==i;){if(i===this._root)return null;if(null!==(r=i._nextSibling)){e=r;break}i=i._parent}if((t=(0,a.traversal_filter)(this,e))===n.FilterResult.Accept)return this._current=e,e}}static _create(e,t){return new o(e,t)}}t.TreeWalkerImpl=o},85050:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(94066);function i(e,t,r,a,o,s={},l=""){let u=[a[0],a[1]],c=[o[0],a[1]],d=[a[0],o[1]],p=[o[0],o[1]];(0,n.A)(e,t,r,[u,c,d,p],s,l)}},85156:(e,t,r)=>{"use strict";r.d(t,{A:()=>c});var n=r(54268),i=r(79267),a=r(74798),o=r(20549),s=r(79923);let l=1+i.p8,u=e=>!!(0,o.getVolumeLoaderSchemes)().find(t=>((e,t)=>t===e.substring(0,Math.min(e.length,t.length)))(e.volumeId,t));function c(e,t,r,i=!1){let{viewPlaneNormal:a}=t,o=e.getActors();if(!o.length)return{spacingInNormalDirection:null,imageVolume:null,actorUID:null};let p=o.map(e=>{let t=e.referencedId??e.uid;return n.Ay.getVolume(t)}).filter(e=>!!e);if(r){let t=(0,s.A)(r),n=p.findIndex(e=>t.includes(e.volumeId)),l=p[n],{uid:u}=o[n],c=d(l,a,e,i);return{imageVolume:l,spacingInNormalDirection:c,actorUID:u}}if(!p.length)return{spacingInNormalDirection:null,imageVolume:null,actorUID:null};let m={spacingInNormalDirection:1/0,imageVolume:null,actorUID:null},h=p.find(u);for(let t=0;t{"use strict";r.d(t,{HT:()=>f,Ql:()=>h,IQ:()=>p,p:()=>m,ZD:()=>b});var n=r(77280),i=r(76348),a=r(9638),o=r(98115);function s(e,t,r){let n=e.anchorCanvas??[.5,.5],i=e.anchorWorld??[0,0,0],[o,s]=(0,a.aD)(e.scale);return[(0-i[0])*o+(n[0]-.5)*t,(0-i[1])*s+(n[1]-.5)*r]}let l="planar";var u=r(59698);function c(e){return[e[0],e[1]]}function d(e){return[e[0],e[1],e[2]]}function p(e){let{viewport:t}=e,r=(0,o.Kh)(e.viewState??t.getViewState?.()??{}),n=e.resolvedView??(e.viewState&&e.resolveViewState?e.resolveViewState(r):t.getResolvedView?.({frameOfReferenceUID:e.frameOfReferenceUID,sliceIndex:e.sliceIndex})),i=e.canvasWidth??n?.state.canvasWidth??t.element?.clientWidth??1,p=e.canvasHeight??n?.state.canvasHeight??t.element?.clientHeight??1,m=e.displayArea??t.getDisplayArea?.()??r.displayArea,h=n?.scale??(0,a.Yl)(r.scale),f=n?.zoom??(0,a.Ws)(r.scale),g=n?.pan??s(r,i,p),v=n?.toICamera(),y=e.frameOfReferenceUID??n?.getFrameOfReferenceUID()??t.getFrameOfReferenceUID?.();return{kind:l,adapterId:l,canvasHeight:p,canvasWidth:i,dataId:e.dataId,displayArea:(0,o.z$)(m),frameOfReferenceUID:y,presentation:{displayArea:(0,o.z$)(m),flipHorizontal:!0===r.flipHorizontal,flipVertical:!0===r.flipVertical,pan:c(g),position:r.anchorWorld?{kind:"anchor",worldPoint:d(r.anchorWorld),canvasPoint:c(r.anchorCanvas??[.5,.5])}:v?.focalPoint?{kind:"focalPoint",worldPoint:d(v.focalPoint)}:{kind:"anchor",canvasPoint:c(r.anchorCanvas??[.5,.5])},rawPan:c(g),rotation:n?.rotation??(0,u.iJ)(r.rotation),scale:function(e){let{displayArea:t,scaleMode:r,zoom:n}=e;return t?{kind:"displayArea",value:n,area:t}:"fitWidth"===r?{kind:"fitWidth",value:n}:"fitHeight"===r?{kind:"fitHeight",value:n}:{kind:"fit",value:n}}({displayArea:m,scaleMode:r.scaleMode,zoom:f}),scaleVector:c(h),zoom:f},rendererCamera:v,resolveViewState:e.resolveViewState,resolvedView:n,spaces:{canvas:!0,image:!0,renderer:!!v,world:!!n},transforms:n?{canvasToWorld:e=>n.canvasToWorld(e),worldToCanvas:e=>n.worldToCanvas(e)}:void 0,viewState:r,viewportType:t.type}}function m(e){return e.presentation.zoom??1}function h(e){return c(e.presentation.scaleVector)}function f(e){return c(e.presentation.rawPan)}let g={rotation:!0,displayArea:!0,zoom:!0,scale:!0,pan:!0,flipHorizontal:!0,flipVertical:!0};function v(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function y(e,t){return t?{...e,displayArea:void 0}:e}let b={id:l,viewportTypes:[n.NV.PLANAR_NEXT],getSnapshot:e=>p(e),getPresentation:(e,t)=>(function(e,t){let r={},n=t??g;if(n.rotation&&(r.rotation=e.presentation.rotation),n.displayArea&&(r.displayArea=(0,o.z$)(e.displayArea)),n.zoom&&(r.zoom=m(e)),n.scale&&(r.scale=h(e)),n.pan){let t=h(e),n=f(e);r.pan=[n[0]/t[0],n[1]/t[1]]}return n.flipHorizontal&&(r.flipHorizontal=e.presentation.flipHorizontal??!1),n.flipVertical&&(r.flipVertical=e.presentation.flipVertical??!1),r})(e,t),withPresentation:(e,t,r)=>(function(e,t){let{pan:r,rotation:n=e.presentation.rotation,flipHorizontal:i=e.viewState?.flipHorizontal??!1,flipVertical:l=e.viewState?.flipVertical??!1}=t,u=e.viewState??{},c=v(t,"zoom"),d=v(t,"scale"),p=v(t,"displayArea"),m=d?(0,a.aD)(t.scale):(0,a.aD)(t.zoom??e.presentation.scaleVector),h={flipHorizontal:i,flipVertical:l,rotation:n};if(p){let e=(0,o.z$)(t.displayArea);h.anchorCanvas=[.5,.5],h.anchorWorld=void 0,h.displayArea=e,h.scale=c||d?m:[1,1],h.scaleMode=e?.scaleMode??"fit"}else(c||d||!u.displayArea)&&(h.scale=m,h.scaleMode="fit");if(r){let n=[r[0]*m[0],r[1]*m[1]],i=(0,o.Kh)({...u,...h}),a=e.resolveViewState?.(i)??(i===e.viewState?e.resolvedView:void 0);return y(a?.withPan(n).state.viewState??function(e,t,r,n){let i=s(e,r,n),[a,l]=e.anchorCanvas??[.5,.5],u=t[0]-i[0],c=t[1]-i[1];return(0,o.Kh)({...e,anchorCanvas:[a+u/Math.max(r,1),l+c/Math.max(n,1)],displayArea:void 0})}(i,n,e.canvasWidth,e.canvasHeight),p&&void 0===t.displayArea)}return y((0,o.Kh)({...u,...h}),p&&void 0===t.displayArea)})(e,t),applyToRenderer:(e,t)=>{(function(e){return!!(e&&"object"==typeof e&&"getActiveCamera"in e&&"function"==typeof e.getActiveCamera)})(t)&&(0,i.hH)({activeSourceICamera:e.rendererCamera,renderer:t})}}},85461:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(39216),i=r(21483);let a={},o={add:(e,t)=>{o.addRaw(e,{...t,metadata:(0,i.G)(t.metadata)})},addRaw:(e,t)=>{let r=t.type;a[e]||(a[e]={}),a[e][r]=t.metadata},get:(e,t)=>a[t]?.[e],clear:()=>{a={}}};(0,n.addProvider)(o.get);let s=o},85643:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>c});var n=r(17042),i=r(13827),a=r(11480),o=r(66368),s=r(85250);let l={aspectRatio:[1,1]};function u(e,t,r={}){Object.assign(t,l,r),i.Ay.extend(e,t,r),n.Ay.setGet(e,t,["aspectRatio"]);t.classHierarchy.push("extendedVtkCamera");let c=e.getProjectionMatrix;e.getProjectionMatrix=(e,r,n)=>{let i=c(e,r,n),[l,u]=(0,o.x)(t.aspectRatio);if(1!==l||1!==u){let e=(0,a.L)([l,u]);s.multiply(i,e,i)}return i},e.getAspectRatio=()=>t.aspectRatio,e.setAspectRatio=e=>{t.aspectRatio=e}}let c={newInstance:n.Ay.newInstance(u,"extendedVtkCamera"),extend:u}},85759:(e,t,r)=>{"use strict";function n(e,t,r){return Math.max(t,Math.min(r,e))}r.d(t,{A:()=>n,q:()=>n})},85840:(e,t,r)=>{"use strict";r.d(t,{I:()=>i});var n=r(32207);function i(e,t){return n._6.getSegmentationRepresentationVisibility(e,t)}},86077:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>v,_V:()=>h});var n=r(17042),i=r(69927),a=r(62807),o=r(62269),s=r(95398),l=r(50923),{vtkErrorMacro:u}=n.Ay,c={elementCount:0,stride:0,colorBOStride:0,vertexOffset:0,normalOffset:0,tCoordOffset:0,tCoordComponents:0,colorOffset:0,colorComponents:0,tcoordBO:null,customData:[],coordShift:null,coordScale:null,coordShiftAndScaleEnabled:!1,inverseShiftAndScaleMatrix:null},d={newInstance:n.Ay.newInstance(function(e,t,r={}){Object.assign(t,c,r),o.Ay.extend(e,t,r),n.Ay.setGet(e,t,["colorBO","elementCount","stride","colorBOStride","vertexOffset","normalOffset","tCoordOffset","tCoordComponents","colorOffset","colorComponents","customData"]),n.Ay.get(e,t,["coordShift","coordScale","coordShiftAndScaleEnabled","inverseShiftAndScaleMatrix"]),t.classHierarchy.push("vtkOpenGLCellArrayBufferObject"),e.setType(a.a.ARRAY_BUFFER),e.createVBO=(r,n,l,u,c=null)=>{let d;if(!r.getData()||!r.getData().length)return t.elementCount=0,0;t.blockSize=3,t.vertexOffset=0,t.normalOffset=0,t.tCoordOffset=0,t.tCoordComponents=0,t.colorComponents=0,t.colorOffset=0,t.customData=[];let p=u.points.getData(),m=null,h=null,f=null,g=u.colors?u.colors.getNumberOfComponents():0,v=u.tcoords?u.tcoords.getNumberOfComponents():0;u.normals&&(t.normalOffset=4*t.blockSize,t.blockSize+=3,m=u.normals.getData()),u.customAttributes&&u.customAttributes.forEach(e=>{e&&(t.customData.push({data:e.getData(),offset:4*t.blockSize,components:e.getNumberOfComponents(),name:e.getName()}),t.blockSize+=e.getNumberOfComponents())}),u.tcoords&&(t.tCoordOffset=4*t.blockSize,t.tCoordComponents=v,t.blockSize+=v,h=u.tcoords.getData()),u.colors?(t.colorComponents=u.colors.getNumberOfComponents(),t.colorOffset=0,f=u.colors.getData(),t.colorBO||(t.colorBO=o.Ay.newInstance()),t.colorBO.setOpenGLRenderWindow(t._openGLRenderWindow)):t.colorBO=null,t.stride=4*t.blockSize;let y=0,b=0,I=0,x=0,C=0,A=0,T={anythingToPoints(e,t,r,n){for(let i=0;i2)for(let i=0;i2){for(let i=0;ie,linesToWireframe:(e,t)=>e>1?(e-1)*2:0,polysToWireframe:(e,t)=>e>2?2*e:0,stripsToWireframe:(e,t)=>e>2?4*e-6:0,polysToSurface:(e,t)=>e>2?(e-2)*3:0,stripsToSurface:(e,t,r)=>e>2?(e-2)*3:0},w=null,O=null;l===i.YL.POINTS||"verts"===n?(w=T.anythingToPoints,O=S.anythingToPoints):l===i.YL.WIREFRAME||"lines"===n?(w=T[`${n}ToWireframe`],O=S[`${n}ToWireframe`]):(w=T[`${n}ToSurface`],O=S[`${n}ToSurface`]);let P=r.getData(),_=P.length,E=0;for(let e=0;e<_;)E+=O(P[e],P),e+=P[e]+1;let D=null,R=new Float32Array(E*t.blockSize);f&&(D=new Uint8Array(4*E));let M=0,N=0,{useShiftAndScale:V,coordShift:L,coordScale:B}=(0,s.Yx)(u.points);if(V?e.setCoordShiftAndScale(L,B):!0===t.coordShiftAndScaleEnabled&&e.setCoordShiftAndScale(null,null),c)if(c.points||c.cells){let e=new Int32Array(E+c.points.length);e.set(c.points),c.points=e;let t=new Int32Array(E+c.cells.length);t.set(c.cells),c.cells=t}else c.points=new Int32Array(E),c.cells=new Int32Array(E);let F=u.vertexOffset;d=function(e,r){if(c&&(c.points[F]=e,c.cells[F]=A+u.cellOffset),++F,y=3*e,t.coordShiftAndScaleEnabled?(R[M++]=(p[y++]-t.coordShift[0])*t.coordScale[0],R[M++]=(p[y++]-t.coordShift[1])*t.coordScale[1],R[M++]=(p[y++]-t.coordShift[2])*t.coordScale[2]):(R[M++]=p[y++],R[M++]=p[y++],R[M++]=p[y++]),null!==m&&(b=u.haveCellNormals?(A+u.cellOffset)*3:3*e,R[M++]=m[b++],R[M++]=m[b++],R[M++]=m[b++]),t.customData.forEach(t=>{C=e*t.components;for(let e=0;e{var n,i;return null!==e&&(e.constructor!==Float64Array||3!==e.length)?void u("Wrong type for coordShift, expected vec3 or null"):null!==r&&(r.constructor!==Float64Array||3!==r.length)?void u("Wrong type for coordScale, expected vec3 or null"):void(null!==t.coordShift&&null!==e&&l.aI(e,t.coordShift)||(t.coordShift=e),null!==t.coordScale&&null!==r&&l.aI(r,t.coordScale)||(t.coordScale=r),n=t.coordShift,i=t.coordScale,t.coordShiftAndScaleEnabled=null!==n&&null!==i&&!(l.t2(n,[0,0,0])&&l.t2(i,[1,1,1])),t.coordShiftAndScaleEnabled?t.inverseShiftAndScaleMatrix=(0,s.cW)(t.coordShift,t.coordScale):t.inverseShiftAndScaleMatrix=null)}})},p=r(9731),m=r(78744),h={Start:0,Points:0,Lines:1,Tris:2,TriStrips:3,TrisEdges:4,TriStripsEdges:5,End:6},f={context:null,program:null,shaderSourceTime:null,VAO:null,attributeUpdateTime:null,CABO:null,primitiveType:0,pointPicking:!1};function g(e,t,r={}){Object.assign(t,f,r),n.Ay.obj(e,t),t.shaderSourceTime={},n.Ay.obj(t.shaderSourceTime),t.attributeUpdateTime={},n.Ay.obj(t.attributeUpdateTime),n.Ay.setGet(e,t,["program","shaderSourceTime","VAO","attributeUpdateTime","CABO","primitiveType","pointPicking"]),t.program=p.A.newInstance(),t.VAO=m.Ay.newInstance(),t.CABO=d.newInstance(),t.classHierarchy.push("vtkOpenGLHelper"),e.setOpenGLRenderWindow=e=>{t.context=e.getContext(),t.program.setContext(t.context),t.VAO.setOpenGLRenderWindow(e),t.CABO.setOpenGLRenderWindow(e)},e.releaseGraphicsResources=e=>{t.VAO.releaseGraphicsResources(),t.CABO.releaseGraphicsResources(),t.CABO.setElementCount(0)},e.drawArrays=(r,n,i,a)=>{if(t.CABO.getElementCount()){let o=e.getOpenGLMode(i),s=e.haveWideLines(r,n),l=t.context,u=l.getParameter(l.DEPTH_WRITEMASK);t.pointPicking&&l.depthMask(!1),o===l.LINES&&s?(e.updateShaders(r,n,a),l.drawArraysInstanced(o,0,t.CABO.getElementCount(),2*Math.ceil(n.getProperty().getLineWidth()))):(l.lineWidth(n.getProperty().getLineWidth()),e.updateShaders(r,n,a),l.drawArrays(o,0,t.CABO.getElementCount()),l.lineWidth(1));let c=+(o===l.POINTS)||(o===l.LINES?2:3);return t.pointPicking&&l.depthMask(u),t.CABO.getElementCount()/c}return 0},e.getOpenGLMode=e=>{if(t.pointPicking)return t.context.POINTS;let r=t.primitiveType;return e===i.YL.POINTS||r===h.Points?t.context.POINTS:e===i.YL.WIREFRAME||r===h.Lines||r===h.TrisEdges||r===h.TriStripsEdges?t.context.LINES:t.context.TRIANGLES},e.haveWideLines=(e,r)=>!!(r.getProperty().getLineWidth()>1)&&!(t.CABO.getOpenGLRenderWindow()&&t.CABO.getOpenGLRenderWindow().getHardwareMaximumLineWidth()>=r.getProperty().getLineWidth()),e.getNeedToRebuildShaders=(t,r,n)=>!!(n.getNeedToRebuildShaders(e,t,r)||0===e.getProgram()||e.getShaderSourceTime().getMTime(){if(e.getNeedToRebuildShaders(r,n,i)){let a={Vertex:null,Fragment:null,Geometry:null};i.buildShaders(a,r,n);let o=t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);o!==e.getProgram()&&(e.setProgram(o),e.getVAO().releaseGraphicsResources()),e.getShaderSourceTime().modified()}else t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgram(e.getProgram());e.getVAO().bind(),i.setMapperShaderParameters(e,r,n),i.setPropertyShaderParameters(e,r,n),i.setCameraShaderParameters(e,r,n),i.setLightingShaderParameters(e,r,n),i.invokeShaderCallbacks(e,r,n)},e.setMapperShaderParameters=(r,n,a)=>{if(e.haveWideLines(r,n)){e.getProgram().setUniform2f("viewportSize",a.usize,a.vsize);let t=parseFloat(n.getProperty().getLineWidth());e.getProgram().setUniformf("lineWidthStepSize",t/Math.ceil(t)),e.getProgram().setUniformf("halfLineWidth",t/2)}t.primitiveType===h.Points||n.getProperty().getRepresentation()===i.YL.POINTS?e.getProgram().setUniformf("pointSize",n.getProperty().getPointSize()):t.pointPicking&&e.getProgram().setUniformf("pointSize",e.getPointPickingPrimitiveSize())},e.replaceShaderPositionVC=(r,n,i)=>{let a=r.Vertex;a=p.A.substitute(a,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform float pointSize;"]).result,a=p.A.substitute(a,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," gl_PointSize = pointSize;"],!1).result,e.getOpenGLMode(i.getProperty().getRepresentation())===t.context.LINES&&e.haveWideLines(n,i)&&(a=p.A.substitute(a,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform vec2 viewportSize;","uniform float lineWidthStepSize;","uniform float halfLineWidth;"]).result,a=p.A.substitute(a,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," if (halfLineWidth > 0.0)"," {"," float offset = float(gl_InstanceID / 2) * lineWidthStepSize - halfLineWidth;"," vec4 tmpPos = gl_Position;"," vec3 tmpPos2 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * mod(float(gl_InstanceID), 2.0) * offset / viewportSize[0];"," tmpPos2.y = tmpPos2.y + 2.0 * mod(float(gl_InstanceID + 1), 2.0) * offset / viewportSize[1];"," gl_Position = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);"," }"]).result),r.Vertex=a},e.getPointPickingPrimitiveSize=()=>t.primitiveType===h.Points?2:t.primitiveType===h.Lines?4:6,e.getAllocatedGPUMemoryInBytes=()=>e.getCABO().getAllocatedGPUMemoryInBytes()}var v={newInstance:n.Ay.newInstance(g),extend:g,primTypes:h}},86409:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.treeWalker_traverseChildren=function(e,t){let r=t?e._current._firstChild:e._current._lastChild;for(;null!==r;){let a=(0,i.traversal_filter)(e,r);if(a===n.FilterResult.Accept)return e._current=r,r;if(a===n.FilterResult.Skip){let e=t?r._firstChild:r._lastChild;if(null!==e){r=e;continue}}for(;null!==r;){let n=t?r._nextSibling:r._previousSibling;if(null!==n){r=n;break}let i=r._parent;if(null===i||i===e._root||i===e._current)return null;r=i}}return null},t.treeWalker_traverseSiblings=function(e,t){let r=e._current;if(r===e._root)return null;for(;;){let a=t?r._nextSibling:r._previousSibling;for(;null!==a;){r=a;let o=(0,i.traversal_filter)(e,r);if(o===n.FilterResult.Accept)return e._current=r,r;a=t?r._firstChild:r._lastChild,(o===n.FilterResult.Reject||null===a)&&(a=t?r._nextSibling:r._previousSibling)}if(null===(r=r._parent)||r===e._root||(0,i.traversal_filter)(e,r)===n.FilterResult.Accept)return null}};let n=r(5309),i=r(17329)},86636:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nonEntityAmpersandRegex=void 0,t.nonEntityAmpersandRegex=/&(?![A-Za-z]+;|#\d+;)/g},87352:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>g});var n=r(17042),i=r(99298),a=r(11701),{vtkErrorMacro:o}=n.o$,{DefaultDataType:s}=i.Ay,l=1e-6;function u(e,t,r){let n,i,a=e.length,o=Number.MAX_VALUE,s=-Number.MAX_VALUE;for(i=t;is&&(s=n);return{min:o,max:s}}function c(e,t=0,r=1){if(t<0&&r>1){let t=e.length/r,n=new Float64Array(t);for(let i=0,a=0;i 0, values");if(t.values?Array.isArray(t.values)&&(t.values=(0,n.W2)(t.dataType,t.values)):t.values=(0,n.OE)(t.dataType,t.size),t.values&&(t.size=t.size??t.values.length,t.dataType=p(t.values)),(0,n.WL)(e,t),(0,n.Ak)(e,t,["name","numberOfComponents"]),t.size%t.numberOfComponents!=0)throw RangeError("model.size is not a multiple of model.numberOfComponents");function i(r){if(r<0)return!1;let i=e.getNumberOfComponents(),a=t.values.length/(i>0?i:1);if(r===a)return!0;if(r>a){let e=t.values;return t.values=(0,n.OE)(t.dataType,(r+a)*i),t.values.set(e),!0}return t.size>r*i&&(t.size=r*i,e.dataChange()),!0}t.classHierarchy.push("vtkDataArray"),e.dataChange=()=>{t.ranges=null,e.modified()},e.allocate=t=>{i(e.getNumberOfTuples()+t)},e.resize=r=>{i(r);let n=r*e.getNumberOfComponents();return t.size!==n&&(t.size=n,e.dataChange(),!0)},e.initialize=()=>(e.resize(0),e),e.getElementComponentSize=()=>t.values.BYTES_PER_ELEMENT,e.getComponent=(e,r=0)=>t.values[e*t.numberOfComponents+r],e.setComponent=(r,n,i)=>{i!==t.values[r*t.numberOfComponents+n]&&(t.values[r*t.numberOfComponents+n]=i,e.dataChange())},e.getValue=r=>{let n=r/t.numberOfComponents,i=r%t.numberOfComponents;return e.getComponent(n,i)},e.setValue=(r,n)=>{let i=r/t.numberOfComponents,a=r%t.numberOfComponents;e.setComponent(i,a,n)},e.getData=()=>t.size===t.values.length?t.values:t.values.subarray(0,t.size),e.getRange=(r=-1)=>{let n=r;n<0&&(n=1===t.numberOfComponents?0:t.numberOfComponents);let i=null;return t.ranges||(t.ranges=d(t.ranges,t.numberOfComponents)),(i=t.ranges[n])||(i=c(e.getData(),r,t.numberOfComponents),t.ranges[n]=i),t.rangeTuple[0]=i.min,t.rangeTuple[1]=i.max,t.rangeTuple},e.setRange=(e,r)=>{t.ranges||(t.ranges=d(t.ranges,t.numberOfComponents));let n={min:e.min,max:e.max};return t.ranges[r]=n,t.rangeTuple[0]=n.min,t.rangeTuple[1]=n.max,t.rangeTuple},e.getRanges=(r=!0)=>{if(!r)return structuredClone(t.ranges);let n=[];for(let r=0;r1){let[t,r]=e.getRange(-1);n.push({min:t,max:r})}return n},e.setTuple=(e,r)=>{let n=e*t.numberOfComponents;for(let e=0;e{let n=e*t.numberOfComponents,i=Math.min(r.length,t.size-n);for(let e=0;e(t.size<=r*t.numberOfComponents&&(t.size=(r+1)*t.numberOfComponents,i(r+1)),e.setTuple(r,n),r),e.insertTuples=(r,n)=>{let a=r+n.length/t.numberOfComponents;return t.size{let n=t.size/t.numberOfComponents;return e.insertTuple(n,r)},e.insertNextTuples=r=>{let n=t.size/t.numberOfComponents;return e.insertTuples(n,r)},e.findTuple=(e,r=l)=>{for(let n=0;nr){i=!1;break}if(i)return n/t.numberOfComponents}return -1},e.getTuple=(e,r=[])=>{let n=t.numberOfComponents||1,i=e*n;switch(n){case 4:r[3]=t.values[i+3];case 3:r[2]=t.values[i+2];case 2:r[1]=t.values[i+1];case 1:r[0]=t.values[i];break;default:for(let e=n-1;e>=0;--e)r[e]=t.values[i+e]}return r},e.getTuples=(r,n)=>{let i=(r??0)*t.numberOfComponents,a=(n??e.getNumberOfTuples())*t.numberOfComponents,o=e.getData().subarray(i,a);return o.length>0?o:null},e.getTupleLocation=(e=1)=>e*t.numberOfComponents,e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.size,e.getNumberOfTuples=()=>t.size/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>f({empty:!0,name:t.name,dataType:t.dataType,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||(e.modified(),t.name=`vtkDataArray${e.getMTime()}`),t.name),e.setData=(r,n)=>{t.values=r,t.size=r.length,t.dataType=p(r),n&&(t.numberOfComponents=n),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.dataChange()},e.getState=({preserveTypedArrays:r=!1}={})=>{if(t.deleted)return null;let n={...t,vtkClass:e.getClassName()};r||(n.values=Array.from(n.values)),delete n.buffer,Object.keys(n).forEach(e=>{n[e]||delete n[e]});let i={};return Object.keys(n).sort().forEach(e=>{i[e]=n[e]}),i.mtime&&delete i.mtime,i},e.deepCopy=r=>{let n=e.getDataType(),i=t.values;e.shallowCopy(r),t.ranges=structuredClone(r.getRanges()),i?.length>=r.getNumberOfValues()&&n===r.getDataType()?(i.set(r.getData()),t.values=i,e.dataChange()):e.setData(r.getData().slice())},e.interpolateTuple=(r,n,i,a,s,l)=>{let u=t.numberOfComponents||1;(u!==n.getNumberOfComponents()||u!==a.getNumberOfComponents())&&o("numberOfComponents must match");let c=n.getTuple(i),d=a.getTuple(s),p=[];switch(p.length=u,u){case 4:p[3]=c[3]+(d[3]-c[3])*l;case 3:p[2]=c[2]+(d[2]-c[2])*l;case 2:p[1]=c[1]+(d[1]-c[1])*l;case 1:p[0]=c[0]+(d[0]-c[0])*l;break;default:for(let e=0;ei&&(e=i),t({min:e,max:t,count:r,sum:n,mean:n/r}),getRange:()=>({min:e,max:t})}},fastComputeRange:u,getDataType:p,getMaxNorm:function(e){let t=e.getNumberOfComponents(),r=0,n=Array(t);for(let i=0;ir&&(r=o)}return r},...i.Ay}},87431:(e,t,r)=>{"use strict";e.exports=r(34533).extend({implicit:[r(42109),r(67633)],explicit:[r(21598),r(2666),r(59052),r(44165)]})},87592:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>h});var n,i=r(17042),a=r(39311),o=r(11701),s=r(50923),l=r(85250),u=r(49963),c=r(37843),{vtkWarningMacro:d}=i.Ay,p={preMultiplyFlag:!1,matrix:[...a.zK]};function m(e,t,r={}){Object.assign(t,p,r),i.Ay.obj(e,t),i.Ay.setGet(e,t,["preMultiplyFlag"]),i.Ay.setGetArray(e,t,["matrix"],16),t.classHierarchy.push("vtkAbstractTransform","vtkHomogeneousTransform","vtkTransform"),e.transformPoint=(e,r)=>(s.Z0(r,e,t.matrix),r),e.transformPoints=(e,r)=>{let n=new Float64Array(3),i=new Float64Array(3);for(let a=0;a{e.setPreMultiplyFlag(!0)},e.postMultiply=()=>{e.setPreMultiplyFlag(!1)},e.transformMatrix=(e,r)=>(t.preMultiplyFlag?l.multiply(r,t.matrix,e):l.multiply(r,e,t.matrix),r),e.transformMatrices=(e,r)=>{let n=new Float64Array(16),i=new Float64Array(16),a=t.preMultiplyFlag?()=>l.multiply(i,t.matrix,n):()=>l.multiply(i,n,t.matrix);for(let t=0;tn({matrix:o.Ay.invertMatrix(Array.from(t.matrix),[],4),preMultiplyFlag:t.preMultiplyFlag}),e.translate=(r,n,i)=>{if(0===r&&0===n&&0===i)return;let a=l.create();l.fromTranslation(a,[r,n,i]),t.preMultiplyFlag?l.multiply(t.matrix,t.matrix,a):l.multiply(t.matrix,a,t.matrix),e.modified()},e.rotateWXYZ=(r,n,i,a)=>{if(0===n&&0===i&&0===a)return void d("No rotation applied, axis is zero vector.");if(0===r)return;let s=o.Ay.radiansFromDegrees(r),c=u.vt();u.x8(c,[n,i,a],s);let p=new Float64Array(16);l.fromQuat(p,c),t.preMultiplyFlag?l.multiply(t.matrix,t.matrix,p):l.multiply(t.matrix,p,t.matrix),e.modified()},e.rotateX=t=>{e.rotateWXYZ(t,1,0,0)},e.rotateY=t=>{e.rotateWXYZ(t,0,1,0)},e.rotateZ=t=>{e.rotateWXYZ(t,0,0,1)},e.scale=(r,n,i)=>{if(1===r&&1===n&&1===i)return;let a=l.create();l.fromScaling(a,[r,n,i]),t.preMultiplyFlag?l.multiply(t.matrix,t.matrix,a):l.multiply(t.matrix,a,t.matrix),e.modified()},e.transformNormal=(r,n=[])=>{let i=c.fromMat4(c.create(),t.matrix),a=c.create();c.invert(a,i);let s=c.create();return c.transpose(s,a),e.transformVector(r,n,s),o.Ay.normalize(n),n},e.transformNormals=(r,n)=>{let i=r.getData(),a=n.getData(),s=[0,0,0],l=c.fromMat4(c.create(),t.matrix),u=c.create();c.invert(u,l);let d=c.create();c.transpose(d,u);for(let t=0;t{let i=n||c.fromMat4(c.create(),t.matrix);return s.ei(r,e,i),r},e.transformVectors=(t,r)=>{let n=t.getData(),i=r.getData(),a=[0,0,0];for(let t=0;t{let c=t.getNumberOfPoints(),d=l?.length??0,p=new Float64Array(3),m=new Float64Array(3),h=new Float64Array(3),f=new Float64Array(3),g=!1,v=!1,y=!1,b=[];for(let I=0;Iu[e].modified())}}var h={newInstance:n=i.Ay.newInstance(m,"vtkTransform"),extend:m}},87600:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>p});var n=r(17042),i=r(11701),a=r(30536),o=r(40815),s=r(82382),l=r(66831);function u(){return{intersected:!1,subId:-1,x:[0,0,0],pCoords:[0,0,0],t:-1}}var c={};function d(e,t,r={}){Object.assign(t,c,r),o.Ay.extend(e,t,r),t.classHierarchy.push("vtkQuad"),e.getCellDimension=()=>2,e.getCellType=()=>s.vZ.VTK_QUAD,e.getNumberOfEdges=()=>4,e.getNumberOfFaces=()=>0,e.intersectWithLine=(e,r,n,o,s)=>{let c,d,p,m,h,f={subId:0,t:Number.MAX_VALUE,intersect:0,betweenPoints:!1},g=t.points.getPoint(0,[]),v=t.points.getPoint(1,[]),y=t.points.getPoint(2,[]),b=t.points.getPoint(3,[]),I=(0,i.fm)(g,y),x=(0,i.fm)(v,b);if(I===x){let e,r=0,n=0;for(let i=0;i<4;i++)(e=t.pointsIds[i])>r&&(r=e,n=i);c=+(0!==n&&2!==n)}else c=I{let r=1-e[0],n=1-e[1];t[0]=r*n,t[1]=e[0]*n,t[2]=e[0]*e[1],t[3]=r*e[1]},e.evaluateLocation=(r,n,i)=>{let a=[];e.interpolationFunctions(r,i),n[0]=0,n[1]=0,n[2]=0;for(let e=0;e<4;e++){t.points.getPoint(e,a);for(let t=0;t<3;t++)n[t]+=a[t]*i[e]}}}var p={newInstance:n.Ay.newInstance(d,"vtkQuad"),extend:d}},87635:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(70547);let i=function(e,t,r){let i,a,o,s,l,u,c=0,d=!1,p=!1,m=!0,h=!t&&0!==t&&"function"==typeof window.requestAnimationFrame;if("function"!=typeof e)throw TypeError("Expected a function");function f(t){let r=i,n=a;return i=a=void 0,c=t,s=e.apply(n,r)}function g(e,t){return h?window.requestAnimationFrame(e):setTimeout(e,t)}function v(e){let r=e-u,n=e-c;return void 0===u||r>=t||r<0||p&&n>=o}function y(){let e=Date.now();if(v(e))return b(e);l=g(y,function(e){let r=e-u,n=e-c,i=t-r;return p?Math.min(i,o-n):i}(e))}function b(e){return(l=void 0,m&&i)?f(e):(i=a=void 0,s)}function I(...e){let r=Date.now(),n=v(r);if(i=e,a=this,u=r,n){if(void 0===l){var o;return c=o=u,l=g(y,t),d?f(o):s}if(p)return l=g(y,t),f(u)}return void 0===l&&(l=g(y,t)),s}return t=Number(t)||0,(0,n.A)(r)&&(d=!!r.leading,o=(p="maxWait"in r)?Math.max(Number(r.maxWait)||0,t):o,m="trailing"in r?!!r.trailing:m),I.cancel=function(){void 0!==l&&function(e){if(h)return window.cancelAnimationFrame(e);clearTimeout(e)}(l),c=0,i=u=a=l=void 0},I.flush=function(){return void 0===l?s:b(Date.now())},I.pending=function(){return void 0!==l},I}},88129:(e,t,r)=>{"use strict";r.d(t,{S:()=>s});var n=r(70192),i=r(12722),a=r(5205),o=r(83143);function s({operationData:e,viewport:t,strategy:r}){return e?"volumeId"in e&&null!=e.volumeId||"referencedVolumeId"in e&&null!=e.referencedVolumeId?function({operationData:e}){let{volumeId:t}=e;if(!t){let e=new CustomEvent(n.fX.sV.ERROR_EVENT,{detail:{type:"Segmentation",message:"No volume id found for the segmentation"},cancelable:!0});return n.tX.dispatchEvent(e),null}let r=n.PP.getVolume(t),i=(0,o.b)(t);if(!r||!i)return null;let{imageData:a}=r,{voxelManager:s}=r,{voxelManager:l,imageData:u}=i;return{segmentationImageData:a,segmentationVoxelManager:s,segmentationScalarData:null,imageScalarData:null,imageVoxelManager:l,imageData:u}}({operationData:e}):function({operationData:e,viewport:t,strategy:r}){let o,s,l,u,c,d,{segmentationId:p}=e;if(r.ensureSegmentationVolumeFor3DManipulation)r.ensureSegmentationVolumeFor3DManipulation({operationData:e,viewport:t}),s=e.segmentationVoxelManager,o=e.segmentationImageData,l=null;else{let r=(0,i.getCurrentLabelmapImageIdForViewport)(t.id,p);if(!r)return null;let u=(0,a.wV)(t.id,p,r);if(!u)return null;let c=n.PP.getImage(r);o=u.actor.getMapper().getInputData(),s=c.voxelManager;let d=e.imageId,m=n.PP.getImage(d);if(!m)return null;l=m.getPixelData?.()}if(r.ensureImageVolumeFor3DManipulation)r.ensureImageVolumeFor3DManipulation({operationData:e,viewport:t}),c=e.imageVoxelManager,u=e.imageScalarData,d=e.imageData;else{let e=t.getCurrentImageId();if(!e)return null;let r=n.PP.getImage(e);d=r?null:t.getImageData(),u=r?.getPixelData()||d.getScalarData(),c=r?.voxelManager}return{segmentationImageData:o,segmentationScalarData:l,imageScalarData:u,segmentationVoxelManager:s,imageVoxelManager:c,imageData:d}}({operationData:e,viewport:t,strategy:r}):null}},88243:(e,t,r)=>{"use strict";r.d(t,{O:()=>c,B:()=>d});var n=r(70192);class i{}class a{constructor(e){this.storePointData=e.storePointData}getStatistics(){console.debug("InstanceCalculator getStatistics called")}}let{PointsManager:o}=n.BF;function s(e){return{max:[-1/0],min:[1/0],sum:[0],count:0,maxIJK:null,maxLPS:null,minIJK:null,minLPS:null,runMean:[0],m2:[0],m3:[0],m4:[0],allValues:[[]],pointsInShape:e?o.create3(1024):null,sumLPS:[0,0,0]}}function l(e,t,r=null,n=null){Array.isArray(t)&&t.length>1&&1===e.max.length&&(e.max.push(e.max[0],e.max[0]),e.min.push(e.min[0],e.min[0]),e.sum.push(e.sum[0],e.sum[0]),e.runMean.push(0,0),e.m2.push(e.m2[0],e.m2[0]),e.m3.push(e.m3[0],e.m3[0]),e.m4.push(e.m4[0],e.m4[0]),e.allValues.push([],[])),e?.pointsInShape&&r&&e.pointsInShape.push(r);let i=Array.isArray(t)?t:[t];e.count+=1,r&&(e.sumLPS[0]+=r[0],e.sumLPS[1]+=r[1],e.sumLPS[2]+=r[2]),e.max.forEach((t,a)=>{let o=i[a];e.allValues[a].push(o);let s=e.count,l=o-e.runMean[a],u=l/s,c=l*u*(s-1);e.sum[a]+=o,e.runMean[a]+=u,e.m4[a]+=c*u*u*(s*s-3*s+3)+6*u*u*e.m2[a]-4*u*e.m3[a],e.m3[a]+=c*u*(s-2)-3*u*e.m2[a],e.m2[a]+=c,oe.max[a]&&(e.max[a]=o,0===a&&(e.maxIJK=n?[...n]:null,e.maxLPS=r?[...r]:null))})}function u(e,t){let r=e.sum.map(t=>t/e.count),n=e.m2.map(t=>Math.sqrt(t/e.count)),i=e.sumLPS.map(t=>t/e.count),a=e.m3.map((t,r)=>{let n=e.m2[r]/e.count;return 0===n?0:t/(e.count*Math.pow(n,1.5))}),o=e.m4.map((t,r)=>{let n=e.m2[r]/e.count;return 0===n?0:t/(e.count*n*n)-3}),l=e.allValues.map(e=>(function(e){if(0===e.length)return 0;let t=[...e].sort((e,t)=>e-t),r=Math.floor(t.length/2);return t.length%2==0?(t[r-1]+t[r])/2:t[r]})(e)),u={max:{name:"max",label:"Max Pixel",value:1===e.max.length?e.max[0]:e.max,unit:t,pointIJK:e.maxIJK?[...e.maxIJK]:null,pointLPS:e.maxLPS?[...e.maxLPS]:null},min:{name:"min",label:"Min Pixel",value:1===e.min.length?e.min[0]:e.min,unit:t,pointIJK:e.minIJK?[...e.minIJK]:null,pointLPS:e.minLPS?[...e.minLPS]:null},mean:{name:"mean",label:"Mean Pixel",value:1===r.length?r[0]:r,unit:t},stdDev:{name:"stdDev",label:"Standard Deviation",value:1===n.length?n[0]:n,unit:t},count:{name:"count",label:"Voxel Count",value:e.count,unit:null},median:{name:"median",label:"Median",value:1===l.length?l[0]:l,unit:t},skewness:{name:"skewness",label:"Skewness",value:1===a.length?a[0]:a,unit:null},kurtosis:{name:"kurtosis",label:"Kurtosis",value:1===o.length?o[0]:o,unit:null},maxLPS:{name:"maxLPS",label:"Max LPS",value:e.maxLPS?Array.from(e.maxLPS):null,unit:null},minLPS:{name:"minLPS",label:"Min LPS",value:e.minLPS?Array.from(e.minLPS):null,unit:null},pointsInShape:e.pointsInShape,center:{name:"center",label:"Center",value:i?[...i]:null,unit:null},array:[]};u.array.push(u.min,u.max,u.mean,u.stdDev,u.median,u.skewness,u.kurtosis,u.count,u.maxLPS,u.minLPS),u.center.value&&u.array.push(u.center);let c=s(null!==e.pointsInShape);return e.max=c.max,e.min=c.min,e.sum=c.sum,e.count=c.count,e.maxIJK=c.maxIJK,e.maxLPS=c.maxLPS,e.minIJK=c.minIJK,e.minLPS=c.minLPS,e.runMean=c.runMean,e.m2=c.m2,e.m3=c.m3,e.m4=c.m4,e.allValues=c.allValues,e.pointsInShape=c.pointsInShape,e.sumLPS=c.sumLPS,u}class c extends i{static statsInit(e){e.storePointData||(this.state.pointsInShape=null),this.state=s(e.storePointData)}}c.state=s(!0),c.statsCallback=({value:e,pointLPS:t=null,pointIJK:r=null})=>{l(c.state,e,t,r)},c.getStatistics=e=>u(c.state,e?.unit);class d extends a{constructor(e){super(e),this.state=s(e.storePointData)}statsInit(e){this.state=s(e.storePointData)}statsCallback(e){l(this.state,e.value,e.pointLPS,e.pointIJK)}getStatistics(e){return u(this.state,e?.unit)}}},88249:(e,t,r)=>{"use strict";r.d(t,{g:()=>i,v:()=>a});var n=r(50923);function i(e){return Math.max(e||0,1)}function a(e,t){let r=n.S8(n.vt(),e);return!t||Number.isFinite(r[0])&&Number.isFinite(r[1])&&Number.isFinite(r[2])&&0!==n.Bw(r)?r:n.o8(t)}},88296:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>c});var n=r(17042),i=r(72188),a=r(56929),{vtkDebugMacro:o}=n.o$,s={};function l(e,t,r={}){Object.assign(t,s,r),i.A.extend(e,t,r),t.classHierarchy.push("vtkOpenGLPixelSpaceCallbackMapper"),e.opaquePass=(r,n)=>{t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getLastAncestorOfType("vtkOpenGLRenderWindow");let i=t._openGLRenderer.getAspectRatio(),a=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,s=t._openGLRenderer.getTiledSizeAndOrigin(),l=null;if(t.renderable.getUseZValues()){let e=n.getZBufferTexture(),r=Math.floor(e.getWidth()),i=Math.floor(e.getHeight()),a=t._openGLRenderWindow.getContext();e.bind();let s=n.getFramebuffer();s?s.saveCurrentBindingsAndBuffers():o("No framebuffer to save/restore");let u=a.createFramebuffer();a.bindFramebuffer(a.FRAMEBUFFER,u),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e.getHandle(),0),a.checkFramebufferStatus(a.FRAMEBUFFER)===a.FRAMEBUFFER_COMPLETE&&(l=new Uint8Array(r*i*4),a.viewport(0,0,r,i),a.readPixels(0,0,r,i,a.RGBA,a.UNSIGNED_BYTE,l)),s&&s.restorePreviousBindingsAndBuffers(),a.deleteFramebuffer(u)}t.renderable.invokeCallback(t.renderable.getInputData(),a,i,s,l)},e.queryPass=(e,r)=>{e&&t.renderable.getUseZValues()&&r.requestDepth()}}var u=(0,n.UI)(l,"vtkOpenGLPixelSpaceCallbackMapper"),c={newInstance:u,extend:l};(0,a.c9)("vtkPixelSpaceCallbackMapper",u)},88710:(e,t,r)=>{"use strict";r.d(t,{u:()=>c});var n=r(78378),i=r(19921),a=r(41067),o=r(46702),s=r(85840),l=r(74840),u=r(79541);function c({segmentationId:e,segmentIndex:t,viewportId:r,autoGenerated:c=!1}){let d,p=(0,i.getSegmentIndexColor)(r,e,t),m=(0,s.I)(r,{segmentationId:e,type:n.D_.Contour}),h=(0,a.T)(r),f=h?.segmentationId===e,g=u.Y.getRenderInactiveSegmentations(r),v=u.Y.getStyle({viewportId:r,segmentationId:e,type:n.D_.Contour,segmentIndex:t}),y=1,b=1,I=0,x=v.renderFill??!0,C=v.renderOutline??!0;c?(y=v.outlineWidthAutoGenerated??y,d=v.outlineDashAutoGenerated??d,b=v.outlineOpacity??b,I=v.fillAlphaAutoGenerated??I):f?(y=v.outlineWidth??y,d=v.outlineDash??d,b=v.outlineOpacity??b,I=v.fillAlpha??I):(y=v.outlineWidthInactive??y,d=v.outlineDashInactive??d,b=v.outlineOpacityInactive??b,I=v.fillAlphaInactive??I,x=v.renderFillInactive??x,C=v.renderOutlineInactive??C),(0,o.Q)(e)===t&&(y+=v.activeSegmentOutlineWidthDelta),y=C?y:0,I=x?I:0;let A=`rgba(${p[0]}, ${p[1]}, ${p[2]}, ${b})`,T=`rgb(${p[0]}, ${p[1]}, ${p[2]})`,S=!(0,l.s)(r,{segmentationId:e,type:n.D_.Contour}).has(t);return{color:A,fillColor:T,lineWidth:y,fillOpacity:I,lineDash:d,textbox:{color:A},visibility:f?m&&S:g}}},88822:(e,t,r)=>{"use strict";e.exports=new(r(50026))("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})},88824:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>i,Et:()=>n.Et,Ph:()=>n.Ph,WC:()=>n.WC,n4:()=>n.n4});var n=r(82280);let i=n.n4},88838:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(17042),i=r(11701),a=r(7033),o={slice:0,customDisplayExtent:[0,0,0,0,0,0],useCustomExtents:!1,backgroundColor:[0,0,0,1],colorTextureWidth:1024,opacityTextureWidth:1024,labelOutlineTextureWidth:1024},s={extend:function(e,t,r={}){Object.assign(t,o,r),a.A.extend(e,t,r),n.Ay.setGet(e,t,["slice","useCustomExtents","colorTextureWidth","opacityTextureWidth","labelOutlineTextureWidth"]),n.Ay.setGetArray(e,t,["customDisplayExtent"],6),n.Ay.setGetArray(e,t,["backgroundColor"],4),t.classHierarchy.push("vtkAbstractImageMapper"),e.getIsOpaque=()=>!0,e.getCurrentImage=()=>null,e.getBoundsForSlice=()=>(n.Ay.vtkErrorMacro("vtkAbstractImageMapper.getBoundsForSlice - NOT IMPLEMENTED"),(0,i.Z6)())}}},88856:(e,t,r)=>{"use strict";r.d(t,{V:()=>o});var n=r(3922),i=r(77280),a=r(69228);function o(e,t,r=0){let s=e.getOpenGLRenderWindow?.()?.getCanvas?.();s&&(s.addEventListener("webglcontextlost",()=>{console.warn(`CornerstoneRender: WebGL context lost (renderingEngine=${t}, context=${r})`),(0,a.A)(n.A,i.sV.WEBGL_CONTEXT_LOST,{renderingEngineId:t,contextIndex:r})}),s.addEventListener("webglcontextrestored",()=>{(0,a.A)(n.A,i.sV.WEBGL_CONTEXT_RESTORED,{renderingEngineId:t,contextIndex:r})}))}},88864:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Lazy=void 0;class r{_initialized=!1;_initFunc;_value;constructor(e){this._value=void 0,this._initFunc=e}get value(){return this._initialized||(this._value=this._initFunc(),this._initialized=!0),this._value}}t.Lazy=r},88924:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.eventTarget_flatten=i,t.eventTarget_flattenMore=function(e){let t=i(e),r=!1,a=!1;return(0,n.isBoolean)(e)||(r=e.once||!1,a=e.passive||!1),[t,a,r]},t.eventTarget_addEventListener=function(e,t){if(null!==t.callback){for(let r=0;r{"use strict";r.d(t,{q:()=>c});var n=r(77280),i=r(74885),a=r(17042),o=r(37216);r(47535);var s=r(78543),l={numberOfOutputs:1,requestCount:0,materials:{},interpolateTextures:!0},u={newInstance:(0,a.UI)(function(e,t,r={}){Object.assign(t,l,r),(0,a.WL)(e,t),(0,a.Jt)(e,t,["url","baseURL"]),(0,a.V0)(e,t,["dataAccessHelper","interpolateTextures","splitGroup"]),(0,a.f0)(e,t,"busy");function n(){t.requestCount--,0===t.requestCount&&e.invokeBusy(!1)}function i(e){if("#"===e[0]||0===e.length)return;let r=e.split(/[ \t]+/).map(e=>e.trim()).filter(e=>e.length);if("newmtl"===r[0])r.shift(),t.currentMaterial=r.join(" ").trim();else if(t.currentMaterial){if(r.length<2)return;if(t.materials[t.currentMaterial]||(t.materials[t.currentMaterial]={}),t.materials[t.currentMaterial][r[0]]=r.slice(1),"map_Kd"===r[0]){let e=new Image;e.onload=()=>setTimeout(n,0),e.src=[t.baseURL,r[1]].join("/"),t.materials[t.currentMaterial].image=e,t.requestCount++}}}t.classHierarchy.push("vtkMTLReader"),t.dataAccessHelper||(t.dataAccessHelper=o.Ay.get("http")),e.setUrl=(r,n={})=>{if(-1!==r.indexOf(".mtl")||n.fullpath){t.url=r;let e=r.split("/");e.pop(),t.baseURL=e.join("/")}else t.baseURL=r,t.url=`${r}/index.mtl`;return e.loadData(n)},e.loadData=r=>new Promise((n,i)=>{var a;(a=t.url,t.dataAccessHelper.fetchText(e,a,r)).then(t=>{e.parseAsText(t),n()},e=>{i()})}),e.parseAsText=r=>{e.modified(),t.materials={},r.split("\n").forEach(i)},e.isBusy=()=>!!t.requestCount,e.getMaterialNames=()=>Object.keys(t.materials),e.getMaterial=e=>t.materials[e],e.listImages=()=>Object.keys(t.materials).map(e=>t.materials[e].map_Kd).filter(e=>!!e).map(e=>e[0].trim()),e.setImageSrc=(e,r)=>new Promise((n,i)=>{let a=Object.keys(t.materials).find(r=>t.materials[r].map_Kd&&t.materials[r].map_Kd[0].trim()===e.trim()),o=t.materials[a];o&&o.image?(o.image.src=r,o.image.onload=()=>setTimeout(n,0)):n()}),e.applyMaterialToActor=(e,r)=>{let n=t.materials[e];if(n&&r){let e=[1,1,1],i={ambientColor:n.Ka?n.Ka.map(e=>Number(e)):e,specularColor:n.Ks?n.Ks.map(e=>Number(e)):e,diffuseColor:n.Kd?n.Kd.map(e=>Number(e)):e,opacity:n.d?Number(n.d):1,specularPower:n.Ns?Number(n.Ns):1},a=Number(n.illum||2);if(["ambient","diffuse","specular"].forEach((e,t)=>{i[e]=+(t<=a)}),n.image){let e=s.Ay.newInstance({interpolate:t.interpolateTextures});e.setImage(n.image),r.addTexture(e)}r.getProperty().set(i)}}},"vtkMTLReader")};function c(e,t){if(!t.id)throw Error("Mesh must have an id");if(!t.arrayBuffer)throw Error("Mesh must have an arrayBuffer");if(!(t.format in n.WA))throw Error(`Mesh format must be one of the following: ${Object.values(n.WA).join(", ")}`);let r=new i.e({...t}),a={id:e,type:n.dC.MESH,data:r,sizeInBytes:r.sizeInBytes};switch(t.format){case n.WA.PLY:if(t.materialUrl){let e=new Image;return new Promise((n,i)=>{e.onload=()=>{try{let t=s.Ay.newInstance();t.setInterpolate(!0),t.setImage(e),r.defaultActor.addTexture(t),n(a)}catch(e){i(e)}},e.onerror=e=>i(e),e.src=t.materialUrl})}return Promise.resolve(a);case n.WA.OBJ:if(t.materialUrl){let e=u.newInstance();return e.setUrl(t.materialUrl).then(()=>{for(let t=0;t{throw Error(`Failed to load material: ${e}`)})}return Promise.resolve(a);case n.WA.STL:case n.WA.VTP:return Promise.resolve(a);default:return Promise.reject(Error(`Unsupported format: ${t.format}`))}}},89473:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>l});var n=r(17042),i=r(54914),a=r(70125),o={mapper:null,backfaceProperty:null,forceOpaque:!1,forceTranslucent:!1};function s(e,t,r={}){Object.assign(t,o,r),i.Ay.extend(e,t,r),t.boundsMTime={},n.Ay.obj(t.boundsMTime),n.Ay.setGet(e,t,["backfaceProperty","forceOpaque","forceTranslucent","mapper"]);t.classHierarchy.push("vtkActor");let l={...e};e.getActors=()=>[e],e.getIsOpaque=()=>{if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.properties[0]||e.getProperty();let r=t.properties[0].getOpacity()>=1;return(r=r&&(!t.texture||!t.texture.isTranslucent()))&&(!t.mapper||t.mapper.getIsOpaque())},e.hasTranslucentPolygonalGeometry=()=>null!==t.mapper&&(t.properties[0]||e.getProperty(),!e.getIsOpaque()),e.makeProperty=a.Ay.newInstance,e.getMTime=()=>{let e=l.getMTime();if(null!==t.backfaceProperty){let r=t.backfaceProperty.getMTime();e=r>e?r:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let r=t.mapper.getMTime();e=r>e?r:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),e=(r=t.mapper.getInput().getMTime())>e?r:e)}return e},e.getSupportsSelection=()=>!!t.mapper&&t.mapper.getSupportsSelection(),e.processSelectorPixelBuffers=(e,r)=>{t.mapper&&t.mapper.processSelectorPixelBuffers&&t.mapper.processSelectorPixelBuffers(e,r)}}var l={newInstance:n.Ay.newInstance(s,"vtkActor"),extend:s}},89566:(e,t,r)=>{"use strict";var n;r.d(t,{A:()=>i}),function(e){e.Tiled="tiled",e.ContextPool="contextPool"}(n||(n={}));let i=n},89937:(e,t,r)=>{"use strict";r.d(t,{A:()=>a,C:()=>i});var n=r(79267);function i(e){return Math.round(e/n.p8)*n.p8}let a=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)}},89988:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(9731),i={implementReplaceShaderCoincidentOffset:function(e,t,r={}){e.replaceShaderCoincidentOffset=(r,i,a)=>{let o=e.getCoincidentParameters(i,a);if(o&&(0!==o.factor||0!==o.offset)){let e=r.Fragment;e=n.A.substitute(e,"//VTK::Coincident::Dec",["uniform float cfactor;","uniform float coffset;"]).result,t.context.getExtension("EXT_frag_depth")&&(0!==o.factor?(e=n.A.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=n.A.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=n.A.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + 0.000016*coffset;").result),t._openGLRenderWindow.getWebgl2()&&(0!==o.factor?(e=n.A.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=n.A.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=n.A.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + 0.000016*coffset;").result),r.Fragment=e}}},implementBuildShadersWithReplacements:function(e,t,r={}){e.applyShaderReplacements=(e,t,r)=>{let i=null;if(t&&(i=t.ShaderReplacements),i)for(let t=0;t{e.getReplacedShaderTemplate(r,n,i),t.lastRenderPassShaderReplacement=t.currentRenderPass?t.currentRenderPass.getShaderReplacement():null,t.lastRenderPassShaderReplacement&&t.lastRenderPassShaderReplacement(r);let a=t.renderable.getViewSpecificProperties().OpenGL;e.applyShaderReplacements(r,a,!0),e.replaceShaderValues(r,n,i),e.applyShaderReplacements(r,a)},e.getReplacedShaderTemplate=(r,n,i)=>{let a=t.renderable.getViewSpecificProperties().OpenGL;e.getShaderTemplate(r,n,i);let o=r.Vertex;if(a){let e=a.VertexShaderCode;void 0!==e&&""!==e&&(o=e)}r.Vertex=o;let s=r.Fragment;if(a){let e=a.FragmentShaderCode;void 0!==e&&""!==e&&(s=e)}r.Fragment=s;let l=r.Geometry;if(a){let e=a.GeometryShaderCode;void 0!==e&&(l=e)}r.Geometry=l}}}},90140:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(79267);function i(e,t){return!(e[0]<-n.p8||e[0]>=t[0]+n.p8||e[1]<-n.p8||e[1]>=t[1]+n.p8||e[2]<-n.p8)&&!(e[2]>=t[2]+n.p8)}},90174:(e,t,r)=>{"use strict";var n;r.d(t,{A:()=>i}),function(e){e.Labelmap="Labelmap",e.Contour="Contour",e.Surface="Surface"}(n||(n={}));let i=n},91180:(e,t,r)=>{"use strict";e.exports=r(14099).extend({implicit:[r(63518),r(58011),r(27492),r(14291)]})},91401:(e,t,r)=>{"use strict";r.d(t,{A:()=>V});var n,i=r(70192),a=r(36908),o=r(93022);let s="PlanarFreehandContourSegmentationTool";function l(e,t=[]){let{viewport:r,sliceData:n,annotation:i}=e,a=new Map,{toolName:u,originalToolName:c}=i.metadata,d=c||u,p=((0,o.getAnnotations)(d,r.element)||[]).filter(e=>!e.metadata.originalToolName||e.metadata.originalToolName===d);if(d!==s){let e=(0,o.getAnnotations)(s,r.element);e?.length&&e.forEach(e=>{let{metadata:t}=e;t.originalToolName===d&&t.originalToolName!==t.toolName&&p.push(e)})}if(!p?.length)return a;for(let e=0;et.metadata.sliceIndex===e);if(!r?.length)continue;let n=r.filter(e=>t.every(t=>{let r=t.parentKey?t.parentKey(e):e,n=r?.[t.key];return Array.isArray(n)?n.every((e,r)=>e===t.value[r]):n===t.value}));n.length&&a.set(e,n)}return a}var u=r(50923);function c(e,t,r){let n=i.BF.deepMerge({data:{},metadata:{}},r);return Object.assign(n,{highlighted:!1,invalidated:!0,autoGenerated:!0,annotationUID:void 0,cachedStats:{},childAnnotationUIDs:[],parentAnnotationUID:void 0}),Object.assign(n.data,{handles:{points:t.points||t||[],interpolationSources:t.sources,activeHandleIndex:null,textBox:{hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}}},contour:{...r.data.contour,polyline:e}}),n}let d=function(e,t){let r=l(t,[{key:"interpolationUID",value:t.interpolationUID}]),n=function(e){let t=1/0,r=-1/0,n=!1;for(let[i,a]of e.entries())a.length&&(t=Math.min(i,t),r=Math.max(i,r),n=!0);if(n)return[t,r]}(r);if(!n)return void console.warn("No annotations found to interpolate",r);let i=function(e,t){for(let[r,n]of e)for(let e=0;e=t[0];a--){let e=r.get(a);if(e?.length){if(e[0].autoGenerated)continue;e.length>1&&(i=!1),n.push(a);break}}if(i&&n.length){for(let a=e+1;a<=t[1];a++){let e=r.get(a);if(e?.length){if(e[0].autoGenerated)continue;e.length>1&&(i=!1),n.push(a);break}}if(i&&!(n.length<2))return n}}(e,n,r);(t?.[0]===i||t?.[1]===i)&&function(e,t,r){let[n]=e;t[n]||={pair:e,list:[]},t[n].list.push(r)}(t,a,e)}return{interpolationData:r,interpolationList:a}};var p=r(31895);let{PointsManager:m}=i.BF;function h(e,t,r,n,i){r{try{t&&(r.isInterpolationUpdate=!0,r.autoGenerated=!1),function(e){let{annotation:t}=e;!function(e){let{parentAnnotationUID:t,annotationUID:r}=e;if(!t)return e.interpolationUID;let n=a.wk.getAnnotation(t),{interpolationUID:i}=n,o=n.childAnnotationUIDs.indexOf(r);e.interpolationUID=`${i}-${o}`,e.interpolationUID}(t);let{interpolationData:r,interpolationList:n}=d(t,e)||{};if(!r||!n)return;let o={toolName:t.metadata.toolName,toolType:t.metadata.toolName,viewport:e.viewport};for(let e=0;e.5?I:b,A=function(e,t={}){let{handleCount:r=12,isOpenUShapeContour:n}=t,i=m.create3(r);i.sources=[];let{sources:a}=i,{length:o,sources:s=[]}=e;if(n){let t=e.subselect(r);return t.push(e.getPoint(e.length-1)),t}if(o<15)return e.subselect(r);let l=Math.floor(Math.max(2*o/r,10));s.forEach(()=>a.push(m.create3(r)));let c=function(e,t){let r,{max:n,deviation:i}=function(e){let{length:t}=e,r=0,n=1/0,i=-1/0,a=0;for(let a=0;a2){let e=-1,t=l/3;c.forEach(r=>{let[n,,i]=r,a=Math.ceil((n+i)/2);!(i-e2*t?(h(d,e,n,l,o),e=h(d,n,a,l,o)):e=h(d,e,a,l,o),i-e>t&&(e=h(d,e,i,l,o)))});let r=d[0];f(r+o-e,o)>2*t&&h(d,e,r-t,l,o)}else{let e=Math.floor(o/r);h(d,-1,o-e,e,o)}return d.forEach(t=>{let r=e.getPointArray(t);i.push(r),s.forEach((e,r)=>a[r].push(e.getPoint(t)))}),i}(x,{isOpenUShapeContour:C.data.isOpenUShapeContour});i.has(r)?function(e,t,r,n,i){let a=y(n,r,i),o=c(e.points,t,a);Object.assign(a,{metadata:o.metadata,data:o.data})}(x,A,r,C,s):function(e,t,r,n,i){let o=e.points,{viewport:s}=i,l=c(o,t,n),u=s.getViewReference({sliceIndex:r});if(!u)throw Error(`Can't find slice ${r}`);Object.assign(l.metadata,u),a.wk.addAnnotation(l,s.element),n.onInterpolationComplete?.(l,n);let{parentAnnotationUID:d}=n;if(d){let e=y(a.wk.getAnnotation(d),r,i);(0,g.rK)(s,e,l)}}(x,A,r,C,s)}(d,p,e,t,r,s.x.length>l.x.length,n)})}(n[e].list,n[e].pair,r,o);let{id:s,renderingEngineId:l,element:O}=e.viewport,P={annotation:t,element:O,viewportId:s,renderingEngineId:l};n.length&&((0,i.Hl)(e.viewport.element,p.A.ANNOTATION_INTERPOLATION_PROCESS_COMPLETED,P),(0,i.Hl)(i.tX,p.A.ANNOTATION_INTERPOLATION_PROCESS_COMPLETED,P))}(e)}finally{t&&(r.autoGenerated=!0)}})};function P(e){let{annotation:t}=e,r=l(e,[{key:"interpolationUID",value:e.interpolationUID}]),n=t.metadata.sliceIndex,o=-1,s=e.sliceData.numberOfSlices;for(let[e,t]of r.entries())e!==n&&t.find(e=>!e.autoGenerated)&&(e=s||e===n||t.forEach(e=>{e.autoGenerated&&(a.wk.removeAnnotation(e.annotationUID),u.push(e))});if(u.length){let t={annotations:u,element:e.viewport.element,viewportId:e.viewport.id,renderingEngineId:e.viewport.getRenderingEngine().id};(0,i.Hl)(e.viewport.element,p.A.INTERPOLATED_ANNOTATIONS_REMOVED,t)}if(o>=0&&st!==e))}static acceptAutoGenerated(e,t={}){let{toolNames:r,segmentationId:i,segmentIndex:o,sliceIndex:s}=t;for(let t of r||n.toolNames){let r=a.wk.getAnnotations(t,e);if(r?.length)for(let e of r){let{interpolationUID:t,data:r,autoGenerated:n,metadata:a}=e;t&&(e.interpolationCompleted=!0),n&&(!o||o===r.segmentation.segmentIndex)&&(void 0===s||!a||s===a.sliceIndex)&&(i&&i!==r.segmentation.segmentationId||((0,D.V)(e),e.autoGenerated=!1))}}}}n=N,N.toolNames=[],N.handleAnnotationCompleted=e=>{let t=e.detail.annotation;if(!t?.metadata)return;let{toolName:r,originalToolName:i}=t.metadata;if(!n.toolNames.includes(r)&&!n.toolNames.includes(i))return;let a=(0,E.A)(t);if(!a)return void console.warn("Unable to find viewport for",t);let o=L(a),s={viewport:a,sliceData:o,annotation:t,interpolationUID:t.interpolationUID},u=!!t.interpolationUID;if(t.autoGenerated=!1,u){P(s),O(s);return}let c=function(e,t){let r=l(e,t),n=[];if(!r?.size)return n;for(let e of r.values())e.forEach(e=>{n.push(e)});return n}(s,[{key:"segmentIndex",value:t.data.segmentation.segmentIndex,parentKey:e=>e.data.segmentation},{key:"viewPlaneNormal",value:t.metadata.viewPlaneNormal,parentKey:e=>e.metadata},{key:"viewUp",value:t.metadata.viewUp,parentKey:e=>e.metadata}]),{sliceIndex:d}=t.metadata,p=new Set;c.forEach(e=>{if(e.interpolationCompleted||e.metadata.sliceIndex===d){let{interpolationUID:t}=e;p.add(t)}}),c=c.filter(e=>!p.has(e.interpolationUID)),t.interpolationUID=c[0]?.interpolationUID||R(),s.interpolationUID=t.interpolationUID,O(s)},N.handleAnnotationUpdate=e=>{let t=e.detail.annotation,{changeType:r=_.A.HandlesUpdated}=e.detail;if(!t?.metadata)return;let{toolName:i,originalToolName:a}=t.metadata;if(!n.toolNames.includes(i)&&!n.toolNames.includes(a)||!M.includes(r))return;let o=(0,E.A)(t);if(!o)return void console.warn("Unable to find matching viewport for annotation interpolation",t);t.autoGenerated&&((0,D.V)(t),t.autoGenerated=!1);let s=L(o);O({viewport:o,sliceData:s,annotation:t,interpolationUID:t.interpolationUID,isInterpolationUpdate:r===_.A.InterpolationUpdated})},N.handleAnnotationDelete=e=>{let t=e.detail.annotation;if(!t?.metadata)return;let{toolName:r}=t.metadata;if(!n.toolNames.includes(r)||t.autoGenerated)return;let i=(0,E.A)(t);if(!i)return void console.warn("No viewport, can't delete interpolated results",t);let a=L(i),o={viewport:i,sliceData:a,annotation:t,interpolationUID:t.interpolationUID};t.autoGenerated=!1,P(o)};let V=N;function L(e){return{numberOfSlices:e.getNumberOfSlices(),imageIndex:e.getCurrentImageIdIndex()}}},91711:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(56109),i=r(10355);function a(e,t){let r=t.colorTransfer.split(" ").splice(1).map(parseFloat),{shiftRange:a}=function(e){let t=1/0,r=-1/0;for(let n=0;n[e*n+t[0],r,i,a]);r.removeAllPoints(),i.forEach(([e,t,n,i])=>r.addRGBPoint(e,t,n,i))})(u,a,l),e.getProperty().setRGBTransferFunction(0,l);let c=t.scalarOpacity.split(" ").splice(1).map(parseFloat),d=i.Ay.newInstance(),p=[];for(let e=0;e[e*g+h[0],t]);f.removeAllPoints(),v.forEach(([e,t])=>f.addPoint(e,t));let y=e.getProperty();y.setScalarOpacity(0,d);let[b,I,x,C]=t.gradientOpacity.split(" ").splice(1).map(parseFloat);y.setUseGradientOpacity(0,!0),y.setGradientOpacityMinimumValue(0,b),y.setGradientOpacityMinimumOpacity(0,I),y.setGradientOpacityMaximumValue(0,x),y.setGradientOpacityMaximumOpacity(0,C),"1"===t.interpolation&&y.setInterpolationTypeToFastLinear(),y.setShade("1"===t.shade);let A=parseFloat(t.ambient),T=parseFloat(t.diffuse),S=parseFloat(t.specular),w=parseFloat(t.specularPower);y.setAmbient(A),y.setDiffuse(T),y.setSpecular(S),y.setSpecularPower(w)}},91792:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(70192),i=r(93084);function a(e,t){if((0,i.yc)(t)&&(0,i.QO)(e))return"image";if(e instanceof n.ei)return"volume";if(e instanceof n.hS)return"image";let r="function"==typeof e.getDefaultActor?e.getDefaultActor():void 0,a=r?.actorMapper,o=a?.renderMode;if(o===n.T7.VTK_VOLUME||o===n.T7.VTK_VOLUME_SLICE||o===n.T7.CPU_VOLUME)return"volume";if(o===n.T7.VTK_IMAGE||o===n.T7.CPU_IMAGE)return"image";let s="function"==typeof r?.actor?.getClassName?r.actor.getClassName():void 0;return"vtkVolume"===s?"volume":"vtkImageSlice"===s?"image":"CanvasActor"===s?a?.renderMode===n.T7.CPU_VOLUME?"volume":"image":e.type===n.fX.NV.PLANAR_NEXT&&e.getVolumeId?.()?"volume":"function"==typeof e.getCurrentImageId?"image":"unsupported"}},91832:(e,t,r)=>{"use strict";r.d(t,{E5:()=>d,GD:()=>s,O9:()=>l,Ox:()=>p,Ug:()=>o,jl:()=>u,nB:()=>c});var n=r(85250),i=r(50923),a=r(92336);function o(e){if(!e)return;let t=n.create(),r=n.create();return n.fromTranslation(t,e.origin),t[0]=e.direction[0],t[1]=e.direction[1],t[2]=e.direction[2],t[4]=e.direction[3],t[5]=e.direction[4],t[6]=e.direction[5],t[8]=e.direction[6],t[9]=e.direction[7],t[10]=e.direction[8],n.scale(t,t,e.spacing),n.invert(r,t),{indexToWorld:t,worldToIndexMatrix:r}}function s(e,t){let r=o(e);if(!r)return[0,0,0];let n=i.vt();return i.Z0(n,t,r.worldToIndexMatrix),[n[0],n[1],n[2]]}function l(e,t){let r=o(e);if(!r)return[0,0,0];let n=i.vt();return i.Z0(n,t,r.indexToWorld),[n[0],n[1],n[2]]}function u(e){let{metadata:t,modality:r="SM",frameOfReferenceUID:n}=e;return t?{dimensions:t.dimensions,spacing:t.spacing,numberOfComponents:3,origin:t.origin,direction:t.direction,metadata:{Modality:r,FrameOfReferenceUID:n||""},hasPixelSpacing:t.hasPixelSpacing,preScale:{scaled:!1},scalarData:null,imageData:{getDirection:()=>t.direction,getDimensions:()=>t.dimensions,getRange:()=>[0,255],getScalarData:()=>null,getSpacing:()=>t.spacing,worldToIndex:e=>s(t,e),indexToWorld:e=>l(t,e)}}:null}function c(e,t){if(!e&&!t)return;let r=t||[255,255,255],n=Math.max(...r),i=r.map(e=>n/e),{lower:a=0,upper:o=255}=e||{},s=(o-a+1)/255,l=a/255;return`url('data:image/svg+xml,\ + \ + \ + \ + \ + #colour')`}function d(e){let t=m(e);t.invert();let r=t.transformPoint(e.canvasPos.map(t=>t*(e.devicePixelRatio||window.devicePixelRatio||1)));return[r[0],r[1],0]}function p(e){return m(e).transformPoint([e.indexPos[0],e.indexPos[1]]).map(t=>t/(e.devicePixelRatio||window.devicePixelRatio||1))}function m(e){let t=e.view.getResolution(),r=e.view.getRotation(),n=e.view.getCenter(),i=[Math.max(e.canvasWidth,1)/2,Math.max(e.canvasHeight,1)/2],o=new a.d;return o.translate(i[0],i[1]),o.rotate(r),o.scale(1/t,-1/t),o.translate(-n[0],-n[1]),o}},91912:(e,t,r)=>{"use strict";r(42306),r(60212),r(40155)},91923:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>b});var n=r(17042),i=r(11701),a=r(25881),{Device:o,Input:s}=a.Ay,{vtkWarningMacro:l,vtkErrorMacro:u,normalizeWheel:c,vtkOnceErrorMacro:d}=n.Ay,p={ctrlKey:!1,altKey:!1,shiftKey:!1},m={"xr-standard":[s.Trigger,s.Grip,s.TrackPad,s.Thumbstick,s.A,s.B]},h=["StartAnimation","Animation","EndAnimation","PointerEnter","PointerLeave","MouseEnter","MouseLeave","StartMouseMove","MouseMove","EndMouseMove","LeftButtonPress","LeftButtonRelease","MiddleButtonPress","MiddleButtonRelease","RightButtonPress","RightButtonRelease","KeyPress","KeyDown","KeyUp","StartMouseWheel","MouseWheel","EndMouseWheel","StartPinch","Pinch","EndPinch","StartPan","Pan","EndPan","StartRotate","Rotate","EndRotate","Button3D","Move3D","StartPointerLock","EndPointerLock","StartInteraction","Interaction","EndInteraction","AnimationFrameRateUpdate"];function f(e){e.cancelable&&e.preventDefault()}function g(e){let t=Object.create(null);return e.forEach(({pointerId:e,position:r})=>{t[e]=r}),t}var v={renderWindow:null,interactorStyle:null,picker:null,pickingManager:null,initialized:!1,enabled:!1,enableRender:!0,currentRenderer:null,lightFollowCamera:!0,desiredUpdateRate:30,stillUpdateRate:2,container:null,recognizeGestures:!0,currentGesture:"Start",animationRequest:null,lastFrameTime:.1,recentAnimationFrameRate:10,wheelTimeoutID:0,moveTimeoutID:0,lastGamepadValues:{},preventDefaultOnPointerDown:!1,preventDefaultOnPointerUp:!1,mouseScrollDebounceByPass:!1};function y(e,t,r={}){Object.assign(t,v,r),n.Ay.obj(e,t),t._animationExtendedEnd=0,n.Ay.event(e,t,"RenderEvent"),h.forEach(r=>n.Ay.event(e,t,r)),n.Ay.get(e,t,["initialized","interactorStyle","lastFrameTime","recentAnimationFrameRate","_view"]),n.Ay.setGet(e,t,["container","lightFollowCamera","enabled","enableRender","recognizeGestures","desiredUpdateRate","stillUpdateRate","picker","preventDefaultOnPointerDown","preventDefaultOnPointerUp","mouseScrollDebounceByPass"]),n.Ay.moveToProtected(e,t,["view"]),function(e,t){t.classHierarchy.push("vtkRenderWindowInteractor");let r={...e},n=new Set,a=new Map,v=1,y=0;function b(r,n){t._forcedRenderer||(t.currentRenderer=e.findPokedRenderer(r,n))}e.start=()=>{(t.initialized||(e.initialize(),t.initialized))&&e.startEventLoop()},e.setRenderWindow=e=>{u("you want to call setView(view) instead of setRenderWindow on a vtk.js interactor")},e.setInteractorStyle=r=>{t.interactorStyle!==r&&(null!=t.interactorStyle&&t.interactorStyle.setInteractor(null),t.interactorStyle=r,null!=t.interactorStyle&&t.interactorStyle.getInteractor()!==e&&t.interactorStyle.setInteractor(e))},e.initialize=()=>{t.initialized=!0,e.enable(),e.render()},e.enable=()=>e.setEnabled(!0),e.disable=()=>e.setEnabled(!1),e.startEventLoop=()=>l("empty event loop"),e.getCurrentRenderer=()=>(t.currentRenderer||b(0,0),t.currentRenderer);let I=t._getScreenEventPositionFor||function(e){let r=t._view.getCanvas(),n=r.getBoundingClientRect(),i=r.width/n.width,o=r.height/n.height,s={x:i*(e.clientX-n.left),y:o*(n.height-e.clientY+n.top),z:0,movementX:i*e.movementX,movementY:o*e.movementY};return(a.size<=1||!t.currentRenderer)&&b(s.x,s.y),s};function x(e){return{controlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey}}function C(e){let t=x(e);return{key:e.key,keyCode:e.charCode,...t}}function A(e){return e.pointerType||""}let T=()=>{if(null===t.container)return;let{container:r}=t;r.addEventListener("contextmenu",f),r.addEventListener("wheel",e.handleWheel),r.addEventListener("DOMMouseScroll",e.handleWheel),r.addEventListener("pointerenter",e.handlePointerEnter),r.addEventListener("pointerleave",e.handlePointerLeave),r.addEventListener("pointermove",e.handlePointerMove,{passive:!1}),r.addEventListener("pointerdown",e.handlePointerDown,{passive:!1}),r.addEventListener("pointerup",e.handlePointerUp),r.addEventListener("pointercancel",e.handlePointerCancel),r.addEventListener("keypress",e.handleKeyPress),r.addEventListener("keydown",e.handleKeyDown),document.addEventListener("keyup",e.handleKeyUp),document.addEventListener("pointerlockchange",e.handlePointerLockChange),r.tabIndex=0,r.style.touchAction="none",r.style.userSelect="none",r.style.webkitTapHighlightColor="rgba(0,0,0,0)"};e.bindEvents=e=>{null!==e&&r.setContainer(e)&&T()};let S=()=>{clearTimeout(t.moveTimeoutID),clearTimeout(t.wheelTimeoutID),t.moveTimeoutID=0,t.wheelTimeoutID=0,v=1;let{container:r}=t;r&&(r.removeEventListener("contextmenu",f),r.removeEventListener("wheel",e.handleWheel),r.removeEventListener("DOMMouseScroll",e.handleWheel),r.removeEventListener("pointerenter",e.handlePointerEnter),r.removeEventListener("pointerleave",e.handlePointerLeave),r.removeEventListener("pointermove",e.handlePointerMove,{passive:!1}),r.removeEventListener("pointerdown",e.handlePointerDown,{passive:!1}),r.removeEventListener("pointerup",e.handlePointerUp),r.removeEventListener("pointercancel",e.handlePointerCancel),r.removeEventListener("keypress",e.handleKeyPress),r.removeEventListener("keydown",e.handleKeyDown)),document.removeEventListener("keyup",e.handleKeyUp),document.removeEventListener("pointerlockchange",e.handlePointerLockChange),a.clear(),y=0};function w(t,r,n){(r&~n&1)!=0&&e.leftButtonReleaseEvent(t),(r&~n&4)!=0&&e.middleButtonReleaseEvent(t),(r&~n&2)!=0&&e.rightButtonReleaseEvent(t),(~r&n&1)!=0&&e.leftButtonPressEvent(t),(~r&n&4)!=0&&e.middleButtonPressEvent(t),(~r&n&2)!=0&&e.rightButtonPressEvent(t)}function O(){t._view&&t.enabled&&t.enableRender&&(t.inRender=!0,t._view.traverseAllPasses(),t.inRender=!1),e.invokeRenderEvent()}e.unbindEvents=()=>{S(),r.setContainer(null)},e.handleKeyPress=t=>{let r=C(t);e.keyPressEvent(r)},e.handleKeyDown=t=>{let r=C(t);e.keyDownEvent(r)},e.handleKeyUp=t=>{let r=C(t);e.keyUpEvent(r)},e.handlePointerEnter=t=>{let r={...x(t),position:I(t),deviceType:A(t)};e.pointerEnterEvent(r),"mouse"===r.deviceType&&e.mouseEnterEvent(r)},e.handlePointerLeave=t=>{let r={...x(t),position:I(t),deviceType:A(t)};e.pointerLeaveEvent(r),"mouse"===r.deviceType&&e.mouseLeaveEvent(r)},e.handlePointerDown=r=>{if(!(r.button>2||e.isPointerLocked()))switch(t.preventDefaultOnPointerDown&&f(r),r.target.hasPointerCapture(r.pointerId)&&r.target.releasePointerCapture(r.pointerId),t.container.setPointerCapture(r.pointerId),a.has(r.pointerId)&&l("[RenderWindowInteractor] duplicate pointerId detected"),a.set(r.pointerId,{pointerId:r.pointerId,position:I(r)}),r.pointerType){case"pen":case"touch":e.handleTouchStart(r);break;default:e.handleMouseDown(r),y=r.buttons}},e.handlePointerUp=r=>{if(a.has(r.pointerId))switch(t.preventDefaultOnPointerUp&&f(r),a.delete(r.pointerId),t.container.releasePointerCapture(r.pointerId),r.pointerType){case"pen":case"touch":e.handleTouchEnd(r);break;default:{let t=[1,4,2][r.button]??0;w({...x(r),position:I(r),deviceType:A(r)},y&~t,r.buttons&~t),e.handleMouseUp(r),y=r.buttons}}},e.handlePointerCancel=t=>{if(a.has(t.pointerId))switch(a.delete(t.pointerId),t.pointerType){case"pen":case"touch":e.handleTouchEnd(t);break;default:w({...x(t),position:I(t),deviceType:A(t)},y,0),y=0}},e.handlePointerMove=t=>{switch(a.has(t.pointerId)&&(a.get(t.pointerId).position=I(t)),t.pointerType){case"pen":case"touch":e.handleTouchMove(t);break;default:{let r=t.buttons;r!==y&&(w({...x(t),position:I(t),deviceType:A(t)},y,r),y=r),e.handleMouseMove(t)}}},e.handleMouseDown=t=>{let r={...x(t),position:I(t),deviceType:A(t)};switch(t.button){case 0:e.leftButtonPressEvent(r);break;case 1:e.middleButtonPressEvent(r);break;case 2:e.rightButtonPressEvent(r);break;default:u(`Unknown mouse button pressed: ${t.button}`)}},e.requestPointerLock=()=>{if(t.container)return t.container.requestPointerLock()},e.exitPointerLock=()=>document.exitPointerLock?.(),e.isPointerLocked=()=>!!t.container&&document.pointerLockElement===t.container,e.handlePointerLockChange=()=>{e.isPointerLocked()?e.startPointerLockEvent():e.endPointerLockEvent()},e.requestAnimation=r=>void 0===r?void u("undefined requester, can not start animating"):n.has(r)?void l("requester is already registered for animating"):void(n.add(r),!t.animationRequest&&1===n.size&&!t.xrAnimation&&(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())),e.extendAnimation=r=>{let i=Date.now()+r;t._animationExtendedEnd=Math.max(t._animationExtendedEnd,i),t.animationRequest||0!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())},e.isAnimating=()=>t.xrAnimation||null!==t.animationRequest,e.cancelAnimation=(r,i=!1)=>{if(!n.has(r)){i||l(`${r&&r.getClassName?r.getClassName():r} did not request an animation`);return}n.delete(r),t.animationRequest&&0===n.size&&Date.now()>t._animationExtendedEnd&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null,e.endAnimationEvent(),e.render())},e.switchToXRAnimation=()=>{t.animationRequest&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null),t.xrAnimation=!0},e.returnFromXRAnimation=()=>{t.xrAnimation=!1,0!==n.size&&(t.recentAnimationFrameRate=10,t.animationRequest=requestAnimationFrame(e.handleAnimation))},e.updateXRGamepads=(r,n,i)=>{r.inputSources.forEach(r=>{let a=null==r.gripSpace?null:n.getPose(r.gripSpace,i),l=null==r.gripSpace?null:n.getPose(r.targetRaySpace,i),u=r.gamepad,c=r.handedness;if(u){u.index in t.lastGamepadValues||(t.lastGamepadValues[u.index]={left:{buttons:{}},right:{buttons:{}},none:{buttons:{}}});for(let n=0;n{let n={...x(r),position:I(r),deviceType:A(r)};0===t.moveTimeoutID?e.startMouseMoveEvent(n):(e.mouseMoveEvent(n),clearTimeout(t.moveTimeoutID)),t.moveTimeoutID=setTimeout(()=>{e.endMouseMoveEvent(),t.moveTimeoutID=0},200)},e.handleAnimation=()=>{let r=Date.now();t._animationFrameCount++,r-t._animationStartTime>1e3&&t._animationFrameCount>1&&(t.recentAnimationFrameRate=1e3*(t._animationFrameCount-1)/(r-t._animationStartTime),t.lastFrameTime=1/t.recentAnimationFrameRate,e.animationFrameRateUpdateEvent(),t._animationStartTime=r,t._animationFrameCount=1),e.animationEvent(),O(),n.size>0||Date.now(){f(r);let n={...c(r),...x(r),position:I(r),deviceType:A(r)};0===t.wheelTimeoutID&&(v=Math.abs(n.spinY)>=.3?Math.abs(n.spinY):1),n.spinY/=v,0===t.wheelTimeoutID?(e.startMouseWheelEvent(n),e.mouseWheelEvent(n)):(e.mouseWheelEvent(n),clearTimeout(t.wheelTimeoutID)),t.mouseScrollDebounceByPass?(e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0):t.wheelTimeoutID=setTimeout(()=>{e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0},200)},e.handleMouseUp=t=>{let r={...x(t),position:I(t),deviceType:A(t)};switch(t.button){case 0:e.leftButtonReleaseEvent(r);break;case 1:e.middleButtonReleaseEvent(r);break;case 2:e.rightButtonReleaseEvent(r);break;default:u(`Unknown mouse button released: ${t.button}`)}},e.handleTouchStart=r=>{let n=[...a.values()];if(t.recognizeGestures&&n.length>1){let t=g(a);if(2===n.length){let t={...x(p),position:n[0].position,deviceType:A(r)};e.leftButtonReleaseEvent(t)}e.recognizeGesture("TouchStart",t)}else if(1===n.length){let t={...x(p),position:I(r),deviceType:A(r)};e.leftButtonPressEvent(t)}},e.handleTouchMove=r=>{let n=[...a.values()];if(t.recognizeGestures&&n.length>1){let t=g(a);e.recognizeGesture("TouchMove",t)}else if(1===n.length){let t={...x(p),position:n[0].position,deviceType:A(r)};e.mouseMoveEvent(t)}},e.handleTouchEnd=r=>{let n=[...a.values()];if(t.recognizeGestures)if(0===n.length){let t={...x(p),position:I(r),deviceType:A(r)};e.leftButtonReleaseEvent(t)}else if(1===n.length){let t=g(a);e.recognizeGesture("TouchEnd",t);let i={...x(p),position:n[0].position,deviceType:A(r)};e.leftButtonPressEvent(i)}else{let t=g(a);e.recognizeGesture("TouchMove",t)}else if(1===n.length){let t={...x(p),position:n[0].position,deviceType:A(r)};e.leftButtonReleaseEvent(t)}},e.setView=r=>{t._view!==r&&(t._view=r,t._view.getRenderable().setInteractor(e),e.modified())},e.getFirstRenderer=()=>t._view?.getRenderable()?.getRenderersByReference()?.[0],e.findPokedRenderer=(e=0,r=0)=>{if(!t._view)return null;let n=t._view?.getRenderable()?.getRenderers();if(!n||0===n.length)return null;n.sort((e,t)=>e.getLayer()-t.getLayer());let i=null,a=null,o=null,s=n.length;for(;s--;){let l=n[s];if(t._view.isInViewport(e,r,l)&&l.getInteractive()){o=l;break}null===i&&l.getInteractive()&&(i=l),null===a&&t._view.isInViewport(e,r,l)&&(a=l)}return null===o&&(o=i),null===o&&(o=a),null==o&&(o=n[0]),o},e.render=()=>{e.isAnimating()||t.inRender||O()},h.forEach(r=>{let n=r.charAt(0).toLowerCase()+r.slice(1);e[`${n}Event`]=n=>{if(!t.enabled)return;if(!e.getCurrentRenderer())return void d(` + Can not forward events without a current renderer on the interactor. + `);let i={type:r,pokedRenderer:t.currentRenderer,firstRenderer:e.getFirstRenderer(),...n};e[`invoke${r}`](i)}}),e.recognizeGesture=(r,n)=>{if(Object.keys(n).length>2)return;if(t.startingEventPositions||(t.startingEventPositions={}),"TouchStart"===r){Object.keys(n).forEach(e=>{t.startingEventPositions[e]=n[e]}),t.currentGesture="Start";return}if("TouchEnd"===r){"Pinch"===t.currentGesture&&(e.render(),e.endPinchEvent()),"Rotate"===t.currentGesture&&(e.render(),e.endRotateEvent()),"Pan"===t.currentGesture&&(e.render(),e.endPanEvent()),t.currentGesture="Start",t.startingEventPositions={};return}let a=0,o=[],s=[];Object.keys(n).forEach(e=>{o[a]=n[e],s[a]=t.startingEventPositions[e],a++});let l=Math.sqrt((s[0].x-s[1].x)*(s[0].x-s[1].x)+(s[0].y-s[1].y)*(s[0].y-s[1].y)),u=Math.sqrt((o[0].x-o[1].x)*(o[0].x-o[1].x)+(o[0].y-o[1].y)*(o[0].y-o[1].y)),c=(0,i.WK)(Math.atan2(s[1].y-s[0].y,s[1].x-s[0].x)),d=(0,i.WK)(Math.atan2(o[1].y-o[0].y,o[1].x-o[0].x)),p=d-c;Math.abs((d=d+180>=360?d-180:d+180)-(c=c+180>=360?c-180:c+180))r&&i>a&&i>o?(t.currentGesture="Pinch",e.startPinchEvent({scale:1,touches:n})):a>r&&a>o?(t.currentGesture="Rotate",e.startRotateEvent({rotation:0,touches:n})):o>r&&(t.currentGesture="Pan",e.startPanEvent({translation:[0,0],touches:n}))}else{if("Rotate"===t.currentGesture){let t={rotation:p,touches:n};e.rotateEvent(t)}"Pinch"===t.currentGesture&&e.pinchEvent({scale:u/l,touches:n}),"Pan"===t.currentGesture&&e.panEvent({translation:m,touches:n})}},e.handleVisibilityChange=()=>{t._animationStartTime=Date.now(),t._animationFrameCount=0},e.setCurrentRenderer=e=>{t._forcedRenderer=!!e,t.currentRenderer=e},e.setContainer=e=>{S();let t=r.setContainer(e??null);return t&&T(),t},e.delete=()=>{for(;n.size;)e.cancelAnimation(n.values().next().value);void 0!==document.hidden&&document.removeEventListener("visibilitychange",e.handleVisibilityChange),t.container&&e.setContainer(null),r.delete()},void 0!==document.hidden&&document.addEventListener("visibilitychange",e.handleVisibilityChange,!1)}(e,t)}var b={newInstance:n.Ay.newInstance(y,"vtkRenderWindowInteractor"),extend:y,handledEvents:h,...a.Ay}},92047:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FixedSizeSet=void 0;class r{_limit;_items=new Set;constructor(e=1e3){this._limit=e}add(e){if(this._items.add(e),this._items.size>this._limit){let e=this._items.values().next();e.done||this._items.delete(e.value)}return this}delete(e){return this._items.delete(e)}has(e){return this._items.has(e)}clear(){this._items.clear()}get size(){return this._items.size}forEach(e,t){this._items.forEach(r=>e.call(t,r,r,this))}*keys(){yield*this._items.keys()}*values(){yield*this._items.values()}*entries(){yield*this._items.entries()}*[Symbol.iterator](){yield*this._items}get[Symbol.toStringTag](){return"FixedSizeSet"}}t.FixedSizeSet=r},92049:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>o,FM:()=>i,Hf:()=>a});let{Qy:n,FM:i,Hf:a}=r(31320).BF,o=n},92051:(e,t,r)=>{"use strict";function n(e){let t=e.toString(16);return 1==t.length?"0"+t:t}function i(e,t,r){return"#"+n(e)+n(t)+n(r)}function a(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}r.r(t),r.d(t,{hexToRgb:()=>a,rgbToHex:()=>i})},92154:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(50923);function i(e,t,r,i,a,o){let{min:s,max:l,current:u}=r,c=n.vt();n.jb(c,t,e);let d=Math.round((l-s)/a),p=(u-s)/(l-s)*d,m=Math.round(p),h=[e[0]-i[0]*p*a,e[1]-i[1]*p*a,e[2]-i[2]*p*a];(m+=o)>d?m=d:m<0&&(m=0);let f=m*a,g=[(h=[h[0]+i[0]*f,h[1]+i[1]*f,h[2]+i[2]*f])[0]+c[0],h[1]+c[1],h[2]+c[2]];return{newFocalPoint:h,newPosition:g}}},92313:(e,t,r)=>{!function(){var t={452:function(e){"use strict";e.exports=r(62521)}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var a=n[e]={exports:{}},o=!0;try{t[e](a,a.exports,i),o=!1}finally{o&&delete n[e]}return a.exports}i.ab="//";var a={};!function(){var e,t=(e=i(452))&&"object"==typeof e&&"default"in e?e.default:e,r=/https?|ftp|gopher|file/;function n(e){"string"==typeof e&&(e=v(e));var n,i,a,o,s,l,u,c,d,p=(i=(n=e).auth,a=n.hostname,o=n.protocol||"",s=n.pathname||"",l=n.hash||"",u=n.query||"",c=!1,i=i?encodeURIComponent(i).replace(/%3A/i,":")+"@":"",n.host?c=i+n.host:a&&(c=i+(~a.indexOf(":")?"["+a+"]":a),n.port&&(c+=":"+n.port)),u&&"object"==typeof u&&(u=t.encode(u)),d=n.search||u&&"?"+u||"",o&&":"!==o.substr(-1)&&(o+=":"),n.slashes||(!o||r.test(o))&&!1!==c?(c="//"+(c||""),s&&"/"!==s[0]&&(s="/"+s)):c||(c=""),l&&"#"!==l[0]&&(l="#"+l),d&&"?"!==d[0]&&(d="?"+d),{protocol:o,host:c,pathname:s=s.replace(/[?#]/g,encodeURIComponent),search:d=d.replace("#","%23"),hash:l});return""+p.protocol+p.host+p.pathname+p.search+p.hash}var o="http://",s=o+"w.w",l=/^([a-z0-9.+-]*:\/\/\/)([a-z0-9.+-]:\/*)?/i,u=/https?|ftp|gopher|file/;function c(e,t){var r="string"==typeof e?v(e):e;e="object"==typeof e?n(e):e;var i=v(t),a="";r.protocol&&!r.slashes&&(a=r.protocol,e=e.replace(r.protocol,""),a+="/"===t[0]||"/"===e[0]?"/":""),a&&i.protocol&&(a="",i.slashes||(a=i.protocol,t=t.replace(i.protocol,"")));var c=e.match(l);c&&!i.protocol&&(e=e.substr((a=c[1]+(c[2]||"")).length),/^\/\/[^/]/.test(t)&&(a=a.slice(0,-1)));var d=new URL(e,s+"/"),p=new URL(t,d).toString().replace(s,""),m=i.protocol||r.protocol;return m+=r.slashes||i.slashes?"//":"",!a&&m?p=p.replace(o,m):a&&(p=p.replace(o,"")),u.test(p)||~t.indexOf(".")||"/"===e.slice(-1)||"/"===t.slice(-1)||"/"!==p.slice(-1)||(p=p.slice(0,-1)),a&&(p=a+("/"===p[0]?p.substr(1):p)),p}function d(){}d.prototype.parse=v,d.prototype.format=n,d.prototype.resolve=c,d.prototype.resolveObject=c;var p=/^https?|ftp|gopher|file/,m=/^(.*?)([#?].*)/,h=/^([a-z0-9.+-]*:)(\/{0,3})(.*)/i,f=/^([a-z0-9.+-]*:)?\/\/\/*/i,g=/^([a-z0-9.+-]*:)(\/{0,2})\[(.*)\]$/i;function v(e,r,i){if(void 0===r&&(r=!1),void 0===i&&(i=!1),e&&"object"==typeof e&&e instanceof d)return e;var a=(e=e.trim()).match(m);e=a?a[1].replace(/\\/g,"/")+a[2]:e.replace(/\\/g,"/"),g.test(e)&&"/"!==e.slice(-1)&&(e+="/");var o=!/(^javascript)/.test(e)&&e.match(h),l=f.test(e),u="";o&&(p.test(o[1])||(u=o[1].toLowerCase(),e=""+o[2]+o[3]),o[2]||(l=!1,p.test(o[1])?(u=o[1],e=""+o[3]):e="//"+o[3]),3!==o[2].length&&1!==o[2].length||(u=o[1],e="/"+o[3]));var c,v=(a?a[1]:e).match(/^https?:\/\/[^/]+(:[0-9]+)(?=\/|$)/),y=v&&v[1],b=new d,I="",x="";try{c=new URL(e)}catch(t){I=t,u||i||!/^\/\//.test(e)||/^\/\/.+[@.]/.test(e)||(x="/",e=e.substr(1));try{c=new URL(e,s)}catch(e){return b.protocol=u,b.href=u,b}}b.slashes=l&&!x,b.host="w.w"===c.host?"":c.host,b.hostname="w.w"===c.hostname?"":c.hostname.replace(/(\[|\])/g,""),b.protocol=I?u||null:c.protocol,b.search=c.search.replace(/\\/g,"%5C"),b.hash=c.hash.replace(/\\/g,"%5C");var C=e.split("#");!b.search&&~C[0].indexOf("?")&&(b.search="?"),b.hash||""!==C[1]||(b.hash="#"),b.query=r?t.decode(c.search.substr(1)):b.search.substr(1),b.pathname=x+(o?c.pathname.replace(/['^|`]/g,function(e){return"%"+e.charCodeAt().toString(16).toUpperCase()}).replace(/((?:%[0-9A-F]{2})+)/g,function(e,t){try{return decodeURIComponent(t).split("").map(function(e){var t=e.charCodeAt();return t>256||/^[a-z0-9]$/i.test(e)?e:"%"+t.toString(16).toUpperCase()}).join("")}catch(e){return t}}):c.pathname),"about:"===b.protocol&&"blank"===b.pathname&&(b.protocol="",b.pathname=""),I&&"/"!==e[0]&&(b.pathname=b.pathname.substr(1)),u&&!p.test(u)&&"/"!==e.slice(-1)&&"/"===b.pathname&&(b.pathname=""),b.path=b.pathname+b.search,b.auth=[c.username,c.password].map(decodeURIComponent).filter(Boolean).join(":"),b.port=c.port,y&&!b.host.endsWith(y)&&(b.host+=y,b.port=y.slice(1)),b.href=x?""+b.pathname+b.search+b.hash:n(b);var A=/^(file)/.test(b.href)?["host","hostname"]:[];return Object.keys(b).forEach(function(e){~A.indexOf(e)||(b[e]=b[e]||null)}),b}a.parse=v,a.format=n,a.resolve=c,a.resolveObject=function(e,t){return v(c(e,t))},a.Url=d}(),e.exports=a}()},92336:(e,t,r)=>{"use strict";r.d(t,{d:()=>n});class n{constructor(){this.reset()}getMatrix(){return this.m}reset(){this.m=[1,0,0,1,0,0]}clone(){let e=new n;return e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5],e}multiply(e){let t=this.m[0]*e[0]+this.m[2]*e[1],r=this.m[1]*e[0]+this.m[3]*e[1],n=this.m[0]*e[2]+this.m[2]*e[3],i=this.m[1]*e[2]+this.m[3]*e[3],a=this.m[0]*e[4]+this.m[2]*e[5]+this.m[4],o=this.m[1]*e[4]+this.m[3]*e[5]+this.m[5];this.m[0]=t,this.m[1]=r,this.m[2]=n,this.m[3]=i,this.m[4]=a,this.m[5]=o}invert(){let e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),t=this.m[3]*e,r=-this.m[1]*e,n=-this.m[2]*e,i=this.m[0]*e,a=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),o=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);this.m[0]=t,this.m[1]=r,this.m[2]=n,this.m[3]=i,this.m[4]=a,this.m[5]=o}rotate(e){let t=Math.cos(e),r=Math.sin(e),n=this.m[0]*t+this.m[2]*r,i=this.m[1]*t+this.m[3]*r,a=-(this.m[0]*r)+this.m[2]*t,o=-(this.m[1]*r)+this.m[3]*t;this.m[0]=n,this.m[1]=i,this.m[2]=a,this.m[3]=o}translate(e,t){this.m[4]+=this.m[0]*e+this.m[2]*t,this.m[5]+=this.m[1]*e+this.m[3]*t}scale(e,t){this.m[0]*=e,this.m[1]*=e,this.m[2]*=t,this.m[3]*=t}transformPoint(e){let t=e[0],r=e[1];return[t*this.m[0]+r*this.m[2]+this.m[4],t*this.m[1]+r*this.m[3]+this.m[5]]}}},92391:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(52575),i=r(41831);let a=new n.R("imageLoadPool");a.grabDelay=0,a.setMaxSimultaneousRequests(i.A.Interaction,1e3),a.setMaxSimultaneousRequests(i.A.Thumbnail,1e3),a.setMaxSimultaneousRequests(i.A.Prefetch,1e3);let o=a},92432:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XMLParserImpl=void 0;let n=r(10106),i=r(24992),a=r(57226),o=r(47518),s=r(94489);class l{parse(e){let t=new n.XMLStringLexer(e,{skipWhitespaceOnlyText:!0}),r=(0,o.create_document)(),l=r,u=t.nextToken();for(;u.type!==i.TokenType.EOF;){switch(u.type){case i.TokenType.Declaration:let e=u;if("1.0"!==e.version)throw Error("Invalid xml version: "+e.version);break;case i.TokenType.DocType:let n=u;if(!(0,o.xml_isPubidChar)(n.pubId))throw Error("DocType public identifier does not match PubidChar construct.");if(!(0,o.xml_isLegalChar)(n.sysId)||-1!==n.sysId.indexOf('"')&&-1!==n.sysId.indexOf("'"))throw Error("DocType system identifier contains invalid characters.");l.appendChild(r.implementation.createDocumentType(n.name,n.pubId,n.sysId));break;case i.TokenType.CDATA:let c=u;if(!(0,o.xml_isLegalChar)(c.data)||-1!==c.data.indexOf("]]>"))throw Error("CDATA contains invalid characters.");l.appendChild(r.createCDATASection(c.data));break;case i.TokenType.Comment:let d=u;if(!(0,o.xml_isLegalChar)(d.data)||-1!==d.data.indexOf("--")||d.data.endsWith("-"))throw Error("Comment data contains invalid characters.");l.appendChild(r.createComment(d.data));break;case i.TokenType.PI:let p=u;if(-1!==p.target.indexOf(":")||/^xml$/i.test(p.target))throw Error("Processing instruction target contains invalid characters.");if(!(0,o.xml_isLegalChar)(p.data)||-1!==p.data.indexOf("?>"))throw Error("Processing instruction data contains invalid characters.");l.appendChild(r.createProcessingInstruction(p.target,p.data));break;case i.TokenType.Text:let m=u;if(!(0,o.xml_isLegalChar)(m.data))throw Error("Text data contains invalid characters.");l.appendChild(r.createTextNode(this._decodeText(m.data)));break;case i.TokenType.Element:let h=u,[f,g]=(0,o.namespace_extractQName)(h.name);if(-1!==g.indexOf(":")||!(0,o.xml_isName)(g))throw Error("Node local name contains invalid characters.");if("xmlns"===f)throw Error("An element cannot have the 'xmlns' prefix.");let v=l.lookupNamespaceURI(f),y={};for(let[e,t]of h.attributes)if("xmlns"===e)v=t;else{let[r,n]=(0,o.namespace_extractQName)(e);"xmlns"===r&&(n===f&&(v=t),y[n]=t)}let b=null!==v?r.createElementNS(v,h.name):r.createElement(h.name);l.appendChild(b);let I=new s.LocalNameSet;for(let[e,t]of h.attributes){let[r,n]=(0,o.namespace_extractQName)(e),i=null;if("xmlns"===r||null===r&&"xmlns"===n?i=a.namespace.XMLNS:null!==(i=b.lookupNamespaceURI(r))&&b.isDefaultNamespace(i)?i=null:null===i&&null!==r&&(i=y[r]||null),I.has(i,n))throw Error("Element contains duplicate attributes.");if(I.set(i,n),i===a.namespace.XMLNS&&t===a.namespace.XMLNS)throw Error("XMLNS namespace is reserved.");if(-1!==n.indexOf(":")||!(0,o.xml_isName)(n))throw Error("Attribute local name contains invalid characters.");if("xmlns"===r&&""===t)throw Error("Empty XML namespace is not allowed.");null!==i?b.setAttributeNS(i,e,this._decodeAttributeValue(t)):b.setAttribute(e,this._decodeAttributeValue(t))}h.selfClosing||(l=b);break;case i.TokenType.ClosingTag:if(u.name!==l.nodeName)throw Error("Closing tag name does not match opening tag name.");l._parent&&(l=l._parent)}u=t.nextToken()}return r}_decodeText(e){return null==e?e:e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}_decodeAttributeValue(e){return null==e?e:e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}}t.XMLParserImpl=l},92449:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(94237);let i=function(e,t,r=!1){let{sliceRange:i,spacingInNormalDirection:a,camera:o}=(0,n.A)(e,t,r),{min:s,max:l,current:u}=i,c=l-s,d=0===c?0:Math.round(c/a),p=(0===c?0:(u-s)/c)*d;return{numScrollSteps:d,currentStepIndex:Number.isFinite(p)?Math.round(p):0,sliceRangeInfo:{sliceRange:i,spacingInNormalDirection:a,camera:o}}}},92539:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultXMLBuilderCBOptions=t.XMLBuilderOptionKeys=t.DefaultBuilderOptions=void 0,t.DefaultBuilderOptions={version:"1.0",encoding:void 0,standalone:void 0,keepNullNodes:!1,keepNullAttributes:!1,ignoreConverters:!1,skipWhitespaceOnlyText:!0,convert:{att:"@",ins:"?",text:"#",cdata:"$",comment:"!"},defaultNamespace:{ele:void 0,att:void 0},namespaceAlias:{html:"http://www.w3.org/1999/xhtml",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"},invalidCharReplacement:void 0,parser:void 0},t.XMLBuilderOptionKeys=new Set(Object.keys(t.DefaultBuilderOptions)),t.DefaultXMLBuilderCBOptions={format:"xml",wellFormed:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,width:0,allowEmptyTags:!1,spaceBeforeSlash:!1,keepNullNodes:!1,keepNullAttributes:!1,ignoreConverters:!1,convert:{att:"@",ins:"?",text:"#",cdata:"$",comment:"!"},defaultNamespace:{ele:void 0,att:void 0},namespaceAlias:{html:"http://www.w3.org/1999/xhtml",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"}}},92557:(e,t,r)=>{"use strict";function n(e){let{sliceIndex:t,viewPlaneNormal:r,volumeId:n}=e,i=n.includes("?")?"&":"?",a=r.map(e=>e.toFixed(3));return`volumeId:${n}${i}sliceIndex=${t}&viewPlaneNormal=${a.join(",")}`}r.d(t,{A:()=>n})},92787:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeImpl=void 0;let n=r(60957),i=r(5309),a=r(34976),o=r(79663),s=r(32008),l=r(47518),u=r(62821),c=r(48040);class d extends a.EventTargetImpl{static ELEMENT_NODE=1;static ATTRIBUTE_NODE=2;static TEXT_NODE=3;static CDATA_SECTION_NODE=4;static ENTITY_REFERENCE_NODE=5;static ENTITY_NODE=6;static PROCESSING_INSTRUCTION_NODE=7;static COMMENT_NODE=8;static DOCUMENT_NODE=9;static DOCUMENT_TYPE_NODE=10;static DOCUMENT_FRAGMENT_NODE=11;static NOTATION_NODE=12;static DOCUMENT_POSITION_DISCONNECTED=1;static DOCUMENT_POSITION_PRECEDING=2;static DOCUMENT_POSITION_FOLLOWING=4;static DOCUMENT_POSITION_CONTAINS=8;static DOCUMENT_POSITION_CONTAINED_BY=16;static DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32;ELEMENT_NODE=1;ATTRIBUTE_NODE=2;TEXT_NODE=3;CDATA_SECTION_NODE=4;ENTITY_REFERENCE_NODE=5;ENTITY_NODE=6;PROCESSING_INSTRUCTION_NODE=7;COMMENT_NODE=8;DOCUMENT_NODE=9;DOCUMENT_TYPE_NODE=10;DOCUMENT_FRAGMENT_NODE=11;NOTATION_NODE=12;DOCUMENT_POSITION_DISCONNECTED=1;DOCUMENT_POSITION_PRECEDING=2;DOCUMENT_POSITION_FOLLOWING=4;DOCUMENT_POSITION_CONTAINS=8;DOCUMENT_POSITION_CONTAINED_BY=16;DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32;__childNodes;get _childNodes(){return this.__childNodes||(this.__childNodes=(0,l.create_nodeList)(this))}_nodeDocumentOverride;get _nodeDocument(){return this._nodeDocumentOverride||n.dom.window._associatedDocument}set _nodeDocument(e){this._nodeDocumentOverride=e}__registeredObserverList;get _registeredObserverList(){return this.__registeredObserverList||(this.__registeredObserverList=[])}_parent=null;_children=new o.EmptySet;_firstChild=null;_lastChild=null;_previousSibling=null;_nextSibling=null;constructor(){super()}get nodeType(){return this._nodeType}get nodeName(){if(o.Guard.isElementNode(this))return this._htmlUppercasedQualifiedName;if(o.Guard.isAttrNode(this))return this._qualifiedName;if(o.Guard.isExclusiveTextNode(this))return"#text";if(o.Guard.isCDATASectionNode(this))return"#cdata-section";if(o.Guard.isProcessingInstructionNode(this))return this._target;else if(o.Guard.isCommentNode(this))return"#comment";else if(o.Guard.isDocumentNode(this))return"#document";else if(o.Guard.isDocumentTypeNode(this))return this._name;else if(o.Guard.isDocumentFragmentNode(this))return"#document-fragment";else return""}get baseURI(){return(0,u.urlSerializer)(this._nodeDocument._URL)}get isConnected(){return o.Guard.isElementNode(this)&&(0,l.shadowTree_isConnected)(this)}get ownerDocument(){return this._nodeType===i.NodeType.Document?null:this._nodeDocument}getRootNode(e){return(0,l.tree_rootNode)(this,!!e&&e.composed)}get parentNode(){return this._nodeType===i.NodeType.Attribute?null:this._parent}get parentElement(){return this._parent&&o.Guard.isElementNode(this._parent)?this._parent:null}hasChildNodes(){return null!==this._firstChild}get childNodes(){return this._childNodes}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get previousSibling(){return this._previousSibling}get nextSibling(){return this._nextSibling}get nodeValue(){return o.Guard.isAttrNode(this)?this._value:o.Guard.isCharacterDataNode(this)?this._data:null}set nodeValue(e){null===e&&(e=""),o.Guard.isAttrNode(this)?(0,l.attr_setAnExistingAttributeValue)(this,e):o.Guard.isCharacterDataNode(this)&&(0,l.characterData_replaceData)(this,0,this._data.length,e)}get textContent(){return o.Guard.isDocumentFragmentNode(this)||o.Guard.isElementNode(this)?(0,l.text_descendantTextContent)(this):o.Guard.isAttrNode(this)?this._value:o.Guard.isCharacterDataNode(this)?this._data:null}set textContent(e){null===e&&(e=""),o.Guard.isDocumentFragmentNode(this)||o.Guard.isElementNode(this)?(0,l.node_stringReplaceAll)(e,this):o.Guard.isAttrNode(this)?(0,l.attr_setAnExistingAttributeValue)(this,e):o.Guard.isCharacterDataNode(this)&&(0,l.characterData_replaceData)(this,0,(0,l.tree_nodeLength)(this),e)}normalize(){let e=[],t=(0,l.tree_getFirstDescendantNode)(this,!1,!1,e=>o.Guard.isExclusiveTextNode(e));for(;null!==t;)e.push(t),t=(0,l.tree_getNextDescendantNode)(this,t,!1,!1,e=>o.Guard.isExclusiveTextNode(e));for(let t=0;t{"use strict";r.d(t,{A:()=>v});var n=r(50923),i=r(77280),a=r(73502),o=r(53725),s=r(31906),l=r(6297),u=r(4937),c=r(96277),d=r(75972),p=r(73589);class m extends p.A{canvasToWorld(e){return(0,d.D)({canvas:this.state.canvas,canvasPos:e,renderer:this.state.renderer})}worldToCanvas(e){return(0,d.n)({canvas:this.state.canvas,renderer:this.state.renderer,worldPos:e})}getFrameOfReferenceUID(){return this.state.frameOfReferenceUID}buildICamera(){return{...this.state.camera,clippingRange:this.state.camera.clippingRange?[...this.state.camera.clippingRange]:this.state.camera.clippingRange,focalPoint:this.state.camera.focalPoint?[...this.state.camera.focalPoint]:this.state.camera.focalPoint,position:this.state.camera.position?[...this.state.camera.position]:this.state.camera.position,viewPlaneNormal:this.state.camera.viewPlaneNormal?[...this.state.camera.viewPlaneNormal]:this.state.camera.viewPlaneNormal,viewUp:this.state.camera.viewUp?[...this.state.camera.viewUp]:this.state.camera.viewUp}}}var h=r(31290),f=r(15798);class g extends o.A{static get useCustomRenderingPipeline(){return!1}getUseCustomRenderingPipeline(){return!1}setRendered(){super.setRendered()}constructor(e){super(e),this.type=i.NV.VOLUME_3D_NEXT,this.suppressEvents=!1,this.renderingEngineId=e.renderingEngineId,this.canvas=e.canvas,this.canvas.style.display="",this.sWidth=e.sWidth,this.sHeight=e.sHeight,this.defaultOptions=e.defaultOptions||{},this.element.style.position=this.element.style.position||"relative",this.element.style.overflow="hidden",this.element.style.background=this.element.style.background||"#000",this.dataProvider=e.dataProvider||new u.e,this.renderPathResolver=e.renderPathResolver||(0,c.z)();let t=a.A.get(this.renderingEngineId),r=t?.getRenderer(this.id);if(!r)throw Error("[VolumeViewport3D] No renderer available. Ensure WebGL is supported and the rendering engine has been properly initialized.");r.getActiveCamera().setParallelProjection(this.defaultOptions.parallelProjection??!0),this.renderContext={viewportId:this.id,renderingEngineId:this.renderingEngineId,type:"3d",viewport:{element:this.element,options:{orientation:this.defaultOptions.orientation,parallelProjection:this.defaultOptions.parallelProjection}},display:{requestRender:()=>{this.requestRenderingEngineRender()}},vtk:{canvas:this.canvas,renderer:r}},this.viewState={parallelProjection:this.defaultOptions.parallelProjection??!0},this.element.setAttribute("data-viewport-uid",this.id),this.element.setAttribute("data-rendering-engine-uid",this.renderingEngineId)}async setDisplaySets(...e){for(let[t,{displaySetId:r,options:n={}}]of(this.removeAllData(),e.entries()))await this.addDisplaySet(r,{...n,role:n.role??(0===t?"source":"overlay")})}async addDisplaySet(e,t={}){let r=this.resolveRenderMode(e,t.renderMode);await super.addDisplaySet(e,{renderMode:r,role:t.role}),"vtkVolume3d"===r&&"source"===t.role&&(this.primaryDataId=e),this.setDefaultDataPresentation(e,{visible:!0,opacity:1}),this.viewState=this.getViewState()}getRenderingEngine(){return a.A.get(this.renderingEngineId)}getImageIds(){let e=this.getCurrentBinding();if(!e)return[];let t=this.getVolume3DPayload(e),r=this.getVolume3DRendering(e);return t&&"vtkVolume3d"===t.renderMode&&"vtkVolume3d"===r.renderMode?t.imageIds:[]}getRenderer(){return this.renderContext.vtk.renderer}getCanvas(){return this.canvas}getVtkActiveCamera(){return this.getRenderer().getActiveCamera()}getViewState(){return this.getRuntimeCamera()}setViewState(e){if(this.isDestroyed)return;let t=this.getCameraForEvent();(0,h.A)(this.renderContext,e,{resetClippingRange:!0}),this.viewState=this.getRuntimeCamera(),this.modified(t)}getRuntimeCamera(){let e=this.getRenderer().getActiveCamera();return{clippingRange:e.getClippingRange(),focalPoint:e.getFocalPoint(),parallelProjection:e.getParallelProjection(),parallelScale:e.getParallelScale(),position:e.getPosition(),rotation:0,viewAngle:e.getViewAngle(),viewPlaneNormal:e.getViewPlaneNormal(),viewUp:e.getViewUp()}}getResolvedView(){return new m({camera:this.getViewState(),canvas:this.canvas,frameOfReferenceUID:this.resolveFrameOfReferenceUID(),renderer:this.getRenderer()})}getViewReference(e={}){let t=this.getCurrentBinding(),r=t?this.getVolume3DPayload(t):void 0,i=this.getViewState(),a=this.getFrameOfReferenceUID(),o=i.focalPoint,l=i.viewPlaneNormal,u=i.viewUp,c={FrameOfReferenceUID:a,dataId:t?.data.id,cameraFocalPoint:o,viewPlaneNormal:l,viewUp:u};return r?.renderMode==="vtkVolume3d"&&(c.volumeId=r.volumeId,Object.assign(c,(0,s.k)(r.imageVolume))),o&&l&&u&&(c.planeRestriction={FrameOfReferenceUID:a,point:o,inPlaneVector1:u,inPlaneVector2:n.$A(n.vt(),u,l)}),c}getVolumeId(){let e=this.getCurrentBinding();if(!e)return;let t=this.getVolume3DPayload(e),r=this.getVolume3DRendering(e);if(t&&"vtkVolume3d"===t.renderMode&&"vtkVolume3d"===r.renderMode)return t.volumeId}hasVolumeId(e){return this.getActors().some(t=>t.referencedId===e)}hasVolumeURI(e){return this.getActors().some(t=>String(t.referencedId||"").includes(e))}getImageData(){return this.getCurrentBinding()?.getImageData?.()}getActors(){let e=[];for(let t of this.bindings.values()){let r=this.getVolume3DPayload(t);r&&e.push(...this.getActorEntriesForRendering(this.getVolume3DRendering(t),r))}return e}getDefaultActor(){let e=this.getCurrentBinding();if(!e)return this.getActors()[0];let t=this.getVolume3DPayload(e);if(t)return this.getActorEntriesForRendering(this.getVolume3DRendering(e),t)[0]}resetViewState(e){let{resetPan:t=!0,resetZoom:r=!0,resetToCenter:n=!0}=e||{},i=this.getCameraForEvent(),a=this.getRenderer(),o=a.getActiveCamera(),s=o.getParallelScale(),l=o.getPosition(),u=o.getFocalPoint();return a.resetCamera(),a.resetCameraClippingRange(),r||o.setParallelScale(s),t&&n||(o.setFocalPoint(...u),o.setPosition(...l),a.resetCameraClippingRange()),this.viewState=this.getViewState(),this.render(),this.triggerCameraModifiedEvent(i),this.triggerCameraResetEvent(),!0}resetViewStateForResize(){return this.resetViewState()}resize(){this.isDestroyed||(this.sWidth=this.canvas.width,this.sHeight=this.canvas.height,this.resizeBindings())}render(){!this.isDestroyed&&(this.renderBindings()||this.requestRenderingEngineRender())}onDestroy(){this.primaryDataId=void 0}getProjectionSnapshot(){let e=(0,f.x)({viewport:this,canvasHeight:this.canvas.clientHeight||this.element.clientHeight,canvasWidth:this.canvas.clientWidth||this.element.clientWidth,camera:this.getViewState(),frameOfReferenceUID:this.resolveFrameOfReferenceUID(),resolvedView:this.getResolvedView()});if(!e)throw Error("[VolumeViewport3D] Unable to resolve projection snapshot");return e}getCurrentBinding(){return this.primaryDataId?this.getBinding(this.primaryDataId)??this.getFirstBinding():this.getFirstBinding()}getReferenceViewContexts(){let e=[],t=this.getViewState();for(let[r,n]of this.bindings.entries()){let i=this.getVolume3DPayload(n),a=i?.renderMode==="vtkVolume3d"?i.volumeId:void 0;e.push({dataId:r,dataIds:[n.data.id],frameOfReferenceUID:n.getFrameOfReferenceUID()??this.getFrameOfReferenceUID(),imageIds:i?.renderMode==="vtkVolume3d"?i.imageIds:void 0,volumeId:a,volumeIds:a?[a]:void 0,cameraFocalPoint:t.focalPoint,viewPlaneNormal:t.viewPlaneNormal,...i?.renderMode==="vtkVolume3d"?(0,s.k)(i.imageVolume):{}})}return e.length?e:super.getReferenceViewContexts()}requestRenderingEngineRender(){let e=a.A.get(this.renderingEngineId);e&&e.renderViewport(this.id)}resolveRenderMode(e,t="auto"){if(t&&"auto"!==t)return t;let r=this.getDataSet(e);return r?.imageIds?.length?"vtkVolume3d":"vtkGeometry3d"}getDataSet(e){var t;let r=(0,l.$B)(e);if(t=r,(0,l.T0)(t)&&(void 0===t.geometryId||"string"==typeof t.geometryId)&&(void 0===t.volumeId||"string"==typeof t.volumeId)&&(void 0===t.geometryLoadOptions||"object"==typeof t.geometryLoadOptions&&!Array.isArray(t.geometryLoadOptions)))return r}getVolume3DPayload(e){var t;if("object"==typeof(t=e.data)&&null!==t&&("image"===t.type&&"vtkVolume3d"===t.renderMode||"geometry"===t.type&&"vtkGeometry3d"===t.renderMode))return e.data}resolveFrameOfReferenceUID(){let e=this.getCurrentBinding();if(!e)return;let t=this.getVolume3DPayload(e),r=this.getVolume3DRendering(e);if(t){if("vtkVolume3d"===t.renderMode)return t.imageVolume.metadata?.FrameOfReferenceUID;if("vtkGeometry3d"===r.renderMode)return r.frameOfReferenceUID}}getVolume3DRendering(e){var t;if("vtkVolume3d"!==(t=e.rendering).renderMode&&"vtkGeometry3d"!==t.renderMode)throw Error("[VolumeViewport3D] Binding render mode is not a supported 3D rendering");return e.rendering}getActorEntriesForRendering(e,t){return"vtkVolume3d"===e.renderMode&&"vtkVolume3d"===t.renderMode?[{actor:e.actor,referencedId:t.volumeId,uid:e.actorEntryUID}]:"vtkGeometry3d"===e.renderMode?e.actors:[]}}let v=g},93696:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tokenList_validationSteps=function(e,t){if(!(0,i.dom_hasSupportedTokens)(e._attribute._localName))throw TypeError(`There are no supported tokens defined for attribute name: '${e._attribute._localName}'.`);return(0,i.dom_getSupportedTokens)(e._attribute._localName).has(t.toLowerCase())},t.tokenList_updateSteps=function(e){(e._element.hasAttribute(e._attribute._localName)||0!==e._tokenSet.size)&&(0,a.element_setAnAttributeValue)(e._element,e._attribute._localName,(0,n.orderedSet_serialize)(e._tokenSet))},t.tokenList_serializeSteps=function(e){return(0,a.element_getAnAttributeValue)(e._element,e._attribute._localName)};let n=r(67638),i=r(11455),a=r(83011)},93836:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XMLReader=void 0;let n=r(10106),i=r(24992),a=r(5309),o=r(57226),s=r(47518),l=r(9128);class u extends l.BaseReader{_parse(e,t){let r=new n.XMLStringLexer(t,{skipWhitespaceOnlyText:this._builderOptions.skipWhitespaceOnlyText}),l=e,u=e,c=r.nextToken();for(;c.type!==i.TokenType.EOF;){switch(c.type){case i.TokenType.Declaration:let t=c,n=this.sanitize(t.version);if("1.0"!==n)throw Error("Invalid xml version: "+n);let d={version:n};t.encoding&&(d.encoding=this.sanitize(t.encoding)),t.standalone&&(d.standalone="yes"===this.sanitize(t.standalone)),u.set(d);break;case i.TokenType.DocType:let p=c;u=this.docType(u,this.sanitize(p.name),this.sanitize(p.pubId),this.sanitize(p.sysId))||u;break;case i.TokenType.CDATA:let m=c;u=this.cdata(u,this.sanitize(m.data))||u;break;case i.TokenType.Comment:let h=c;u=this.comment(u,this.sanitize(h.data))||u;break;case i.TokenType.PI:let f=c;u=this.instruction(u,this.sanitize(f.target),this.sanitize(f.data))||u;break;case i.TokenType.Text:if(u.node.nodeType===a.NodeType.Document)break;let g=c;u=this.text(u,this._decodeText(this.sanitize(g.data)))||u;break;case i.TokenType.Element:let v=c,y=this.sanitize(v.name),[b]=(0,s.namespace_extractQName)(y),I=u.node.lookupNamespaceURI(b),x={};for(let[e,t]of v.attributes)if(e=this.sanitize(e),t=this.sanitize(t),"xmlns"===e)I=t;else{let[r,n]=(0,s.namespace_extractQName)(e);"xmlns"===r&&(n===b&&(I=t),x[n]=t)}let C=null!==I?this.element(u,I,y):this.element(u,void 0,y);if(void 0===C)break;for(let[t,r]of(u.node===e.node&&(l=C),v.attributes)){t=this.sanitize(t),r=this.sanitize(r);let[e,n]=(0,s.namespace_extractQName)(t),i=null;"xmlns"===e||null===e&&"xmlns"===n?i=o.namespace.XMLNS:null!==(i=C.node.lookupNamespaceURI(e))&&C.node.isDefaultNamespace(i)?i=null:null===i&&null!==e&&(i=x[e]||null),null!==i?this.attribute(C,i,t,this._decodeAttributeValue(r)):this.attribute(C,void 0,t,this._decodeAttributeValue(r))}v.selfClosing||(u=C);break;case i.TokenType.ClosingTag:u.node.parentNode&&(u=u.up())}c=r.nextToken()}return l}}t.XMLReader=u},94065:(e,t,r)=>{"use strict";var n=r(17042),i=r(72188),a=r(74978),o={},s=n.Ay.newInstance(function(e,t,r={}){Object.assign(t,o,r),i.A.extend(e,t,r),t.classHierarchy.push("vtkWebGPUPixelSpaceCallbackMapper"),e.opaquePass=(r,n)=>{t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent();let i=t.WebGPURenderer.getAspectRatio(),a=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,o=t.WebGPURenderer.getTiledSizeAndOrigin();t.renderable.getUseZValues(),t.renderable.invokeCallback(t.renderable.getInputData(),a,i,o,null)}},"vtkWebGPUPixelSpaceCallbackMapper");(0,a.c9)("vtkPixelSpaceCallbackMapper",s)},94066:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(27321),i=r(68759),a=r(65704);function o(e,t,r,s,l={},u=""){let{color:c,width:d,lineWidth:p,lineDash:m}=Object.assign({color:"rgb(0, 255, 0)",width:"2",lineWidth:void 0,lineDash:void 0},l),h=(0,n.A)(t,"rect",r),f=e.getSvgNode(h),[g,v,y,b]=s,I=Math.hypot(g[0]-v[0],g[1]-v[1]),x=Math.hypot(g[0]-y[0],g[1]-y[1]),C=[(b[0]+g[0])/2,(b[1]+g[1])/2],A=[(y[0]+g[0])/2,(y[1]+g[1])/2],T=180*Math.atan2(C[1]-A[1],C[0]-A[0])/Math.PI,S={x:`${C[0]-I/2}`,y:`${C[1]-x/2}`,width:`${I}`,height:`${x}`,stroke:c,fill:"transparent",transform:`rotate(${T} ${C[0]} ${C[1]})`,"stroke-width":p||d,"stroke-dasharray":m};if(f)(0,i.A)(S,f),e.setNodeTouched(h);else{let t=document.createElementNS("http://www.w3.org/2000/svg","rect");""!==u&&t.setAttribute("data-id",u),(0,a.A)(S,t),e.appendNode(t,h)}}},94237:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(5663),i=r(85156);let a=function(e,t,r=!1){let a=e.getCamera(),{focalPoint:o,viewPlaneNormal:s}=a,{spacingInNormalDirection:l,actorUID:u}=(0,i.A)(e,a,t,r);if(!u)throw Error(`Could not find image volume with id ${t} in the viewport`);let c=e.getActor(u);if(!c)return console.warn("No actor found for with actorUID of",u),null;let d=c.actor;return{sliceRange:(0,n.A)(d,s,o),spacingInNormalDirection:l,camera:a}}},94302:(e,t,r)=>{"use strict";r.d(t,{A:()=>u,Q:()=>l});var n=r(54261),i=r(62553),a=r(36039),o=r(36195),s=r(54268);class l{get numTimePoints(){return"number"==typeof this.numDimensionGroups?this.numDimensionGroups:1}constructor(e){this._imageIdsIndexMap=new Map,this._imageURIsIndexMap=new Map,this.cornerstoneImageMetaData=null,this.isPreScaled=!1,this.numFrames=null;let{imageIds:t,scaling:r,dimensions:i,spacing:s,origin:l,direction:u,dataType:c,volumeId:d,referencedVolumeId:p,metadata:m,referencedImageIds:h,additionalDetails:f,voxelManager:g,numberOfComponents:v}=e;if(!c)throw Error('Data type is required, please provide a data type as string such as "Uint8Array", "Float32Array", etc.');let{imageData:y}=e;this.suppressWarnings=!0,this.imageIds=t,this.volumeId=d,this.metadata=m,this.dimensions=i,this.spacing=s,this.origin=l,this.direction=u,this.dataType=c,this.hasPixelSpacing=Number.isFinite(s[0])&&s[0]>0&&Number.isFinite(s[1])&&s[1]>0,this.vtkOpenGLTexture=o.uT.newInstance(),this.vtkOpenGLTexture.setVolumeId(d),this.voxelManager=g??a.A.createImageVolumeVoxelManager({dimensions:i,imageIds:t,numberOfComponents:v,id:d}),this.numVoxels=this.dimensions[0]*this.dimensions[1]*this.dimensions[2],y||((y=n.Ay.newInstance()).setDimensions(i),y.setSpacing(s),y.setDirection(u),y.setOrigin(l)),y.set({dataType:c,voxelManager:this.voxelManager,id:d,numberOfComponents:v||1},this.suppressWarnings),y.set({hasScalarVolume:!1},this.suppressWarnings),this.imageData=y,this.numFrames=this._getNumFrames(),this._reprocessImageIds(),r&&(this.scaling=r),p&&(this.referencedVolumeId=p),h&&(this.referencedImageIds=h),f&&(this.additionalDetails=f)}get sizeInBytes(){return this.voxelManager.sizeInBytes}get imageIds(){return this._imageIds}set imageIds(e){this._imageIds=e,this._reprocessImageIds()}_reprocessImageIds(){this._imageIdsIndexMap.clear(),this._imageURIsIndexMap.clear(),this._imageIds.forEach((e,t)=>{let r=(0,i.A)(e);this._imageIdsIndexMap.set(e,t),this._imageURIsIndexMap.set(r,t)})}isDynamicVolume(){return!!this.numTimePoints&&this.numTimePoints>1}getImageIdIndex(e){return this._imageIdsIndexMap.get(e)}getImageIdByIndex(e){return this._imageIds[e]}getImageURIIndex(e){return this._imageURIsIndexMap.get(e)}load(e){}destroy(){this.imageData.delete(),this.imageData=null,this.voxelManager.clear(),this.vtkOpenGLTexture.releaseGraphicsResources(),this.vtkOpenGLTexture.delete()}invalidate(){for(let e=0;es.Ay.getImage(e))}}let u=l},94320:(e,t,r)=>{"use strict";r.d(t,{h:()=>s});var n=r(31608),i=r(20549),a=r(77280),o=r(3793);async function s({viewport:e,options:t={}}){let r=e.getRenderingEngine(),s=t.volumeId||`${(0,o.A)()}`;if(0===s.split(":").length){let e=(0,i.getUnknownVolumeLoaderSchema)();s=`${e}:${s}`}let{id:l,element:u}=e,c=t.viewportId||l,d=e.getImageIds(),p=e.getViewPresentation(),m=e.getViewReference();r.enableElement({viewportId:c,type:a.NV.ORTHOGRAPHIC,element:u,defaultOptions:{background:t.background,orientation:t.orientation}}),(await (0,i.createAndCacheVolume)(s,{imageIds:d})).load();let h=r.getViewport(c);await (0,n.A7)(r,[{volumeId:s}],[c]);let f=()=>{h.render(),u.removeEventListener(a.sV.VOLUME_VIEWPORT_NEW_VOLUME,f)};return u.addEventListener(a.sV.VOLUME_VIEWPORT_NEW_VOLUME,f),h.setViewPresentation(p),h.setViewReference(m),h.render(),h}},94489:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LocalNameSet=void 0;class r{_items={};_nullItems={};set(e,t){null===e?this._nullItems[t]=!0:(this._items[e]||(this._items[e]={}),this._items[e][t]=!0)}has(e,t){return null===e?!0===this._nullItems[t]:!!this._items[e]&&!0===this._items[e][t]}}t.LocalNameSet=r},94554:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.attr_setAnExistingAttributeValue=function(e,t){null===e._element?e._value=t:(0,n.element_change)(e,e._element,t)};let n=r(83011)},94579:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.event_setTheCanceledFlag=function(e){e._cancelable&&!e._inPassiveListenerFlag&&(e._canceledFlag=!0)},t.event_initialize=function(e,t,r,n){e._initializedFlag=!0,e._stopPropagationFlag=!1,e._stopImmediatePropagationFlag=!1,e._canceledFlag=!1,e._isTrusted=!1,e._target=null,e._type=t,e._bubbles=r,e._cancelable=n},t.event_createAnEvent=p,t.event_innerEventCreationSteps=m,t.event_dispatch=h,t.event_appendToAnEventPath=f,t.event_invoke=g,t.event_innerInvoke=v,t.event_fireAnEvent=function(e,t,r,n,i){void 0===r&&(r=s.EventImpl);let a=p(r);if(a._type=e,n)for(let e in n)a[e]=n[e];return h(a,t,i)},t.event_createLegacyEvent=function(e){let t=null;switch(e.toLowerCase()){case"beforeunloadevent":case"compositionevent":case"devicemotionevent":case"deviceorientationevent":case"dragevent":case"focusevent":case"hashchangeevent":case"htmlevents":case"keyboardevent":case"messageevent":case"mouseevent":case"mouseevents":case"storageevent":case"svgevents":case"textevent":case"touchevent":case"uievent":break;case"customevent":t=o.CustomEventImpl;break;case"event":case"events":t=s.EventImpl}if(null===t)throw new l.NotSupportedError(`Event constructor not found for interface ${e}.`);let r=new t("");return r._type="",r._timeStamp=new Date().getTime(),r._isTrusted=!1,r._initializedFlag=!1,r},t.event_getterEventHandlerIDLAttribute=function(e,t){let r=function(e,t){return null}(e,t);return null===r?null:function(e,t){return null}(r,t)},t.event_setterEventHandlerIDLAttribute=function(e,t,r){let n=function(e,t){return null}(e,t);if(null!==n)if(null===r);else{let e=n._eventHandlerMap.onabort;void 0!==e&&(e.value=r)}},t.event_determineTheTargetOfAnEventHandler=y,t.event_getTheCurrentValueOfAnEventHandler=b,t.event_activateAnEventHandler=function(e,t){},t.event_deactivateAnEventHandler=function(e,t){};let n=r(60957),i=r(5309),a=r(79663),o=r(54620),s=r(48629),l=r(32008),u=r(29963),c=r(10871),d=r(11455);function p(e,t){void 0===t&&(t=null);let r=m(e,t,new Date,{});return r._isTrusted=!0,r}function m(e,t,r,i){let a=new e("");return a._initializedFlag=!0,a._timeStamp=r.getTime(),Object.assign(a,i),n.dom.features.steps&&(0,d.dom_runEventConstructingSteps)(a),a}function h(e,t,r=!1,n={value:!1}){let o=!1;e._dispatchFlag=!0;let s=t;if(r){let e=t._associatedDocument;a.Guard.isDocumentNode(e)&&(s=e)}let l=null,d=(0,u.tree_retarget)(e._relatedTarget,t);if(t!==d||t===e._relatedTarget){let r=[];for(let n of e._touchTargetList)r.push((0,u.tree_retarget)(n,t));f(e,t,s,d,r,!1);let p=a.Guard.isMouseEvent(e)&&"click"===e._type;p&&void 0!==t._activationBehavior&&(l=t);let m=a.Guard.isSlotable(t)&&(0,c.shadowTree_isAssigned)(t)?t:null,h=!1,v=t._getTheParent(e);for(;null!==v&&a.Guard.isNode(v);){if(null!==m){if(!a.Guard.isSlot(v))throw Error("Parent node of a slotable should be a slot.");m=null;let e=(0,u.tree_rootNode)(v,!0);a.Guard.isShadowRoot(e)&&"closed"===e._mode&&(h=!0)}for(let t of(a.Guard.isSlotable(v)&&(0,c.shadowTree_isAssigned)(v)&&(m=v),d=(0,u.tree_retarget)(e._relatedTarget,v),r=[],e._touchTargetList))r.push((0,u.tree_retarget)(t,v));a.Guard.isWindow(v)||a.Guard.isNode(v)&&a.Guard.isNode(t)&&(0,u.tree_isAncestorOf)((0,u.tree_rootNode)(t,!0),v,!0,!0)?(p&&e._bubbles&&null===l&&v._activationBehavior&&(l=v),f(e,v,null,d,r,h)):v===d?v=null:(t=v,p&&null===l&&t._activationBehavior&&(l=t),f(e,v,t,d,r,h)),null!==v&&(v=v._getTheParent(e)),h=!1}let y=null,b=e._path;for(let e=b.length-1;e>=0;e--){let t=b[e];if(null!==t.shadowAdjustedTarget){y=t;break}}if(null!==y)if(a.Guard.isNode(y.shadowAdjustedTarget)&&a.Guard.isShadowRoot((0,u.tree_rootNode)(y.shadowAdjustedTarget,!0)))o=!0;else if(a.Guard.isNode(y.relatedTarget)&&a.Guard.isShadowRoot((0,u.tree_rootNode)(y.relatedTarget,!0)))o=!0;else for(let e=0;e=0;t--){let r=b[t];null!==r.shadowAdjustedTarget?e._eventPhase=i.EventPhase.AtTarget:e._eventPhase=i.EventPhase.Capturing,g(r,e,"capturing",n)}for(let t=0;t0&&null!==(e=i[a-1]).shadowAdjustedTarget&&(t._target=e.shadowAdjustedTarget)}if(t._relatedTarget=e.relatedTarget,t._touchTargetList=e.touchTargetList,t._stopPropagationFlag)return;t._currentTarget=e.invocationTarget;let o=Array(...t._currentTarget._eventListenerList);if(!v(t,o,r,e,n)&&t._isTrusted){let i=t._type;"animationend"===i?t._type="webkitAnimationEnd":"animationiteration"===i?t._type="webkitAnimationIteration":"animationstart"===i?t._type="webkitAnimationStart":"transitionend"===i&&(t._type="webkitTransitionEnd"),v(t,o,r,e,n),t._type=i}}function v(e,t,r,n,i={value:!1}){let o=!1;for(let s=0;s{"use strict";r.d(t,{A:()=>s});var n=r(50923),i=r(23668),a=r(39216),o=r(77280);function s(e,t){let r=function(e,t){let r=t.getImageIds(),s=t.getCurrentImageIdIndex();if(0===r.length)return null;let l=t=>{let r=function(e){let t=a.get(o.nb.IMAGE_PLANE,e);if(!t||!(t.rowCosines instanceof Array&&3===t.rowCosines.length)||!(t.columnCosines instanceof Array&&3===t.columnCosines.length)||!(t.imagePositionPatient instanceof Array&&3===t.imagePositionPatient.length))return null;let{rowCosines:r,columnCosines:i,imagePositionPatient:s}=t,l=n.hZ(n.vt(),...r),u=n.hZ(n.vt(),...i);return{rowCosines:r,columnCosines:i,imagePositionPatient:s,planeNormal:n.$A(n.vt(),l,u)}}(t);if(!r)return null;let s=i.planeEquation(r.planeNormal,r.imagePositionPatient);return i.planeDistanceToPoint(s,e)},u={distance:l(r[s])??1/0,index:s},c=r.slice(s+1);for(let e=0;e=0;e--){let t=l(d[e]);if(null!==t&&t!==u.distance)if(t{"use strict";var n,i,a,o,s,l,u,c,d,p,m,h,f,g,v,y,b,I,x,C,A,T,S,w,O;r.d(t,{nQ:()=>n,Qw:()=>O,gY:()=>a,nF:()=>k}),function(e){e[e.NoClip=0]="NoClip",e[e.Intersection=1]="Intersection",e[e.Union=2]="Union",e[e.Difference=3]="Difference",e[e.Xor=4]="Xor"}(n||(n={})),function(e){e[e.Subject=0]="Subject",e[e.Clip=1]="Clip"}(i||(i={})),function(e){e[e.EvenOdd=0]="EvenOdd",e[e.NonZero=1]="NonZero",e[e.Positive=2]="Positive",e[e.Negative=3]="Negative"}(a||(a={})),function(e){e[e.IsOn=0]="IsOn",e[e.IsInside=1]="IsInside",e[e.IsOutside=2]="IsOutside"}(o||(o={})),function(e){function t(e,t,r){return(t.x-e.x)*(r.y-t.y)-(t.y-e.y)*(r.x-t.x)}function r(e,t,r){let n=t.x-e.x,i=r.y-t.y,a=t.y-e.y,o=r.x-t.x;if(9e7>Math.abs(n)&&9e7>Math.abs(i)&&9e7>Math.abs(a)&&9e7>Math.abs(o)){let e=n*i,t=a*o;return e>t?1:e0))*(i<0?-1:+(i>0)),l=(a<0?-1:+(a>0))*(o<0?-1:+(o>0));if(s!==l)return s>l?1:-1;if(0===s)return 0;let u=BigInt(n),c=BigInt(i),d=BigInt(a),p=BigInt(o),m=u*c,h=d*p;return m===h?0:m>h?1:-1}function n(e,t,r,n){let i=Math.abs(e),a=Math.abs(t),o=Math.abs(r),s=Math.abs(n);if(i<46341&&a<46341&&o<46341&&s<46341||i<9e7&&a<9e7&&o<9e7&&s<9e7)return e*t==r*n;let l=(e<0?-1:+(e>0))*(t<0?-1:+(t>0));if(l!==(r<0?-1:+(r>0))*(n<0?-1:+(n>0)))return!1;if(0===l)return!0;let u=BigInt(i),c=BigInt(a);return u*c==BigInt(o)*BigInt(s)}function i(e){if(0===e.length)return{left:0,top:0,right:0,bottom:0};let t={left:Number.MAX_SAFE_INTEGER,top:Number.MAX_SAFE_INTEGER,right:Number.MIN_SAFE_INTEGER,bottom:Number.MIN_SAFE_INTEGER};for(let r of e)r.xt.right&&(t.right=r.x),r.yt.bottom&&(t.bottom=r.y);return t.left===Number.MAX_SAFE_INTEGER?{left:0,top:0,right:0,bottom:0}:t}function a(e,t){let n=t.length,i=0;if(n<3)return o.IsOutside;for(;ie.y;)u++;if(u===c)continue;let s=t[u],d=u>0?t[u-1]:t[n-1];if(s.y===e.y){if(s.x===e.x||s.y===d.y&&e.xd.x&&e.x>s.x)l=1-l;else{let t=r(d,s,e);if(0===t)return o.IsOn;t<0===a&&(l=1-l)}a=!a,u++}if(a===s)return 0===l?o.IsOutside:o.IsInside;u===n&&(u=0);let d=0===u?r(t[n-1],t[0],e):r(t[u-1],t[u],e);return 0===d?o.IsOn:(d<0===a&&(l=1-l),0===l?o.IsOutside:o.IsInside)}e.MaxInt64=0x7fffffffffffffffn,e.MaxCoord=Number(e.MaxInt64/4n),e.max_coord=e.MaxCoord,e.min_coord=-e.MaxCoord,e.Invalid64=Number(e.MaxInt64),e.floatingPointTolerance=1e-12,e.defaultMinimumEdgeLength=.1,e.crossProduct=t,e.crossProductSign=r,e.checkPrecision=function(e){if(e<-8||e>8)throw Error("Error: Precision is out of range.")},e.isAlmostZero=function(t){return Math.abs(t)<=e.floatingPointTolerance},e.triSign=function(e){return e<0?-1:+(e>0)},e.multiplyUInt64=function(e,t){let r=BigInt(e)*BigInt(t);return{lo64:Number(0xffffffffffffffffn&r),hi64:Number(r>>64n)}},e.productsAreEqual=n,e.isCollinear=function(e,t,r){let i=t.x-e.x,a=r.y-t.y;return n(i,a,t.y-e.y,r.x-t.x)},e.dotProduct=function(e,t,r){return(t.x-e.x)*(r.x-t.x)+(t.y-e.y)*(r.y-t.y)},e.crossProductD=function(e,t){return e.y*t.x-t.y*e.x},e.dotProductD=function(e,t){return e.x*t.x+e.y*t.y},e.roundToEven=function(e){let t=Math.floor(e);return 1e-10>Math.abs(e-t-.5)?t%2==0?t:t+1:Math.round(e)},e.checkCastInt64=function(t){return t>=e.max_coord||t<=e.min_coord?e.Invalid64:Math.round(t)},e.getLineIntersectPt=function(e,t,r,n){let i,a=t.y-e.y,o=t.x-e.x,s=n.y-r.y,l=n.x-r.x,u=a*l-s*o;if(0===u)return{intersects:!1,point:{x:0,y:0,z:0}};let c=((e.x-r.x)*s-(e.y-r.y)*l)/u;return{intersects:!0,point:i=c<=0?{x:e.x,y:e.y,z:0}:c>=1?{x:t.x,y:t.y,z:0}:{x:Math.trunc(e.x+c*o),y:Math.trunc(e.y+c*a),z:0}}},e.getLineIntersectPtD=function(e,t,r,n){let i=t.y-e.y,a=t.x-e.x,o=n.y-r.y,s=n.x-r.x,l=i*s-o*a;if(0===l)return{success:!1,ip:{x:0,y:0,z:0}};let u=((e.x-r.x)*o-(e.y-r.y)*s)/l;return{success:!0,ip:u<=0?{...e,z:0}:u>=1?{...t,z:0}:{x:e.x+u*a,y:e.y+u*i,z:0}}},e.segsIntersect=function(e,r,n,i,a=!1){if(!a)return t(e,n,i)*t(r,n,i)<0&&t(n,e,r)*t(i,e,r)<0;let o=t(e,n,i),s=t(r,n,i);if(o*s>0)return!1;let l=t(n,e,r),u=t(i,e,r);return!(l*u>0)&&(0!==o||0!==s||0!==l||0!==u)},e.getBounds=i,e.getClosestPtOnSegment=function(e,t,r){if(t.x===r.x&&t.y===r.y)return{x:t.x,y:t.y,z:0};let n=r.x-t.x,i=r.y-t.y,a=((e.x-t.x)*n+(e.y-t.y)*i)/(n*n+i*i),o=a<0?0:a>1?1:a;return{x:Math.round(t.x+o*n),y:Math.round(t.y+o*i),z:0}},e.pointInPolygon=a,e.path2ContainsPath1=function(e,t){let r=o.IsOn;for(let n of e)switch(a(n,t)){case o.IsOutside:if(r===o.IsOutside)return!1;r=o.IsOutside;break;case o.IsInside:if(r===o.IsInside)return!0;r=o.IsInside}let n=i(e);return a({x:Math.round((n.left+n.right)/2),y:Math.round((n.top+n.bottom)/2)},t)!==o.IsOutside}}(s||(s={})),function(e){e.create=function(e=0,t=0,r=0){return{x:Math.round(e),y:Math.round(t),z:r}},e.fromPointD=function(e){return{x:Math.round(e.x),y:Math.round(e.y),z:e.z||0}},e.scale=function(e,t){return{x:Math.round(e.x*t),y:Math.round(e.y*t),z:e.z||0}},e.equals=function(e,t){return e.x===t.x&&e.y===t.y},e.add=function(e,t){return{x:e.x+t.x,y:e.y+t.y,z:0}},e.subtract=function(e,t){return{x:e.x-t.x,y:e.y-t.y,z:0}},e.toString=function(e){return void 0!==e.z&&0!==e.z?`${e.x},${e.y},${e.z} `:`${e.x},${e.y} `}}(l||(l={})),function(e){e.create=function(e=0,t=0,r=0){return{x:e,y:t,z:r}},e.fromPoint64=function(e){return{x:e.x,y:e.y,z:e.z||0}},e.scale=function(e,t){return{x:e.x*t,y:e.y*t,z:e.z||0}},e.equals=function(e,t){return s.isAlmostZero(e.x-t.x)&&s.isAlmostZero(e.y-t.y)},e.negate=function(e){e.x=-e.x,e.y=-e.y},e.toString=function(e,t=2){return void 0!==e.z&&0!==e.z?`${e.x.toFixed(t)},${e.y.toFixed(t)},${e.z}`:`${e.x.toFixed(t)},${e.y.toFixed(t)}`}}(u||(u={})),function(e){e.create=function(e=0,t=0,r=0,n=0){return{left:e,top:t,right:r,bottom:n}},e.createInvalid=function(){return{left:Number.MAX_SAFE_INTEGER,top:Number.MAX_SAFE_INTEGER,right:Number.MIN_SAFE_INTEGER,bottom:Number.MIN_SAFE_INTEGER}},e.width=function(e){return e.right-e.left},e.height=function(e){return e.bottom-e.top},e.isEmpty=function(e){return e.bottom<=e.top||e.right<=e.left},e.isValid=function(e){return e.lefte.left&&t.xe.top&&t.y=e.left&&t.right<=e.right&&t.top>=e.top&&t.bottom<=e.bottom},e.intersects=function(e,t){return Math.max(e.left,t.left)<=Math.min(e.right,t.right)&&Math.max(e.top,t.top)<=Math.min(e.bottom,t.bottom)},e.asPath=function(e){return[{x:e.left,y:e.top,z:0},{x:e.right,y:e.top,z:0},{x:e.right,y:e.bottom,z:0},{x:e.left,y:e.bottom,z:0}]}}(c||(c={})),function(e){e.create=function(e=0,t=0,r=0,n=0){return{left:e,top:t,right:r,bottom:n}},e.createInvalid=function(){return{left:Number.MAX_VALUE,top:Number.MAX_VALUE,right:-Number.MAX_VALUE,bottom:-Number.MAX_VALUE}},e.width=function(e){return e.right-e.left},e.height=function(e){return e.bottom-e.top},e.isEmpty=function(e){return e.bottom<=e.top||e.right<=e.left},e.midPoint=function(e){return{x:(e.left+e.right)/2,y:(e.top+e.bottom)/2}},e.contains=function(e,t){return t.x>e.left&&t.xe.top&&t.y=e.left&&t.right<=e.right&&t.top>=e.top&&t.bottom<=e.bottom},e.intersects=function(e,t){return Math.max(e.left,t.left)p.reverse64(e))},e.reverseD=function(e){return e.map(e=>p.reverseD(e))}}(m||(m={}));let P=c.createInvalid(),_=d.createInvalid();!function(e){e[e.None=0]="None",e[e.OpenStart=1]="OpenStart",e[e.OpenEnd=2]="OpenEnd",e[e.LocalMax=4]="LocalMax",e[e.LocalMin=8]="LocalMin"}(h||(h={}));class E{data=[];push(e){this.data.push(e),this.siftUp(this.data.length-1)}pop(){if(0===this.data.length)return null;let e=this.data[0],t=this.data.pop();return this.data.length>0&&(this.data[0]=t,this.siftDown(0)),e}clear(){this.data.length=0}siftUp(e){for(;e>0;){let t=e-1>>1;if(this.data[t]>=this.data[e])break;[this.data[t],this.data[e]]=[this.data[e],this.data[t]],e=t}}siftDown(e){let t=this.data.length;for(;;){let r=e,n=(e<<1)+1,i=n+1;if(nthis.data[r]&&(r=n),ithis.data[r]&&(r=i),r===e)break;[this.data[e],this.data[r]]=[this.data[r],this.data[e]],e=r}}}class D{pt;next=null;prev=null;flags;constructor(e,t,r){this.pt=e,this.flags=t,this.prev=r}}class R{vertex;polytype;isOpen;constructor(e,t,r=!1){this.vertex=e,this.polytype=t,this.isOpen=r}equals(e){return null!==e&&this.vertex===e.vertex}}class M{static _nextId=1;_debugId;pt;next;prev;outrec;horz;constructor(e,t){this._debugId=M._nextId++,this.pt=e,this.outrec=t,this.next=this,this.prev=this,this.horz=null}}!function(e){e[e.None=0]="None",e[e.Left=1]="Left",e[e.Right=2]="Right"}(f||(f={})),function(e){e[e.Bottom=0]="Bottom",e[e.Middle=1]="Middle",e[e.Top=2]="Top"}(g||(g={}));class N{static _nextId=1;_debugId;idx=0;owner=null;frontEdge=null;backEdge=null;pts=null;polypath=null;bounds={left:0,top:0,right:0,bottom:0};path=[];isOpen=!1;splits=null;recursiveSplit=null;constructor(){this._debugId=N._nextId++}}class V{leftOp;rightOp;leftToRight;constructor(e){this.leftOp=e,this.rightOp=null,this.leftToRight=!0}}class L{op1;op2;constructor(e,t){this.op1=e,this.op2=t}}class B{bot={x:0,y:0,z:0};top={x:0,y:0,z:0};curX=0;dx=0;windDx=0;windCount=0;windCount2=0;outrec=null;prevInAEL=null;nextInAEL=null;prevInSEL=null;nextInSEL=null;jump=null;vertexTop=null;localMin=null;isLeftBound=!1;joinWith=f.None}!function(e){function t(e,t,r,n){if((e.flags&h.LocalMin)!==h.None)return;e.flags|=h.LocalMin;let i=new R(e,t,r);n.push(i)}e.addLocMin=t,e.addPathsToVertexList=function(e,r,n,i,a){for(let o=0,s=e.length;ou.pt.y}let d=s;c=u;let p=u.next;for(;p!==u;)p.pt.y>c.pt.y&&s?(c.flags|=h.LocalMax,s=!1):p.pt.y0&&(r+=this.children[e].toStringInternal(e,t+1));return r}toString(){if(this.level>0)return"";let e=1===this.children.length?"":"s",t=`Polytree with ${this.children.length} polygon${e}. +`;for(let e=0;e0&&(t+=this.children[e].toStringInternal(e,1));return t+"\n"}}class U extends F{scale=1;polygon=null;constructor(e=null){super(e)}get poly(){return this.polygon}addChild(e){let t=new U(this);return t.scale=this.scale,t.polygon=y.scalePathD(e,1/this.scale),this.children.push(t),t}addChildD(e){let t=new U(this);return t.scale=this.scale,t.polygon=e,this.children.push(t),t}child(e){if(e<0||e>=this.children.length)throw Error("Index out of range");return this.children[e]}area(){let e=null===this.polygon?0:y.areaD(this.polygon);for(let t of this.children)e+=t.area();return e}}class k extends U{get scaleValue(){return this.scale}}class G{cliptype=n.NoClip;fillrule=a.EvenOdd;actives=null;sel=null;minimaList=[];intersectList=[];vertexList=[];outrecList=[];scanlineHeap=new E;scanlineSet=new Set;scanlineArr=[];useScanlineArray=!1;horzSegList=[];horzJoinList=[];currentLocMin=0;currentBotY=0;isSortedMinimaList=!1;hasOpenPaths=!1;usingPolytree=!1;succeeded=!1;preserveCollinear=!0;reverseSolution=!1;constructor(){}getZCallback(){}xyEqual(e,t){return e.x===t.x&&e.y===t.y}setZ(e,t,r){let n=this.getZCallback();n&&(G.getPolyType(e)===i.Subject?(this.xyEqual(r,e.bot)?r.z=e.bot.z:this.xyEqual(r,e.top)?r.z=e.top.z:this.xyEqual(r,t.bot)?r.z=t.bot.z:this.xyEqual(r,t.top)?r.z=t.top.z:r.z=0,n(e.bot,e.top,t.bot,t.top,r)):(this.xyEqual(r,t.bot)?r.z=t.bot.z:this.xyEqual(r,t.top)?r.z=t.top.z:this.xyEqual(r,e.bot)?r.z=e.bot.z:this.xyEqual(r,e.top)?r.z=e.top.z:r.z=0,n(t.bot,t.top,e.bot,e.top,r)))}static isOdd(e){return(1&e)!=0}static isHotEdge(e){return null!=e.outrec}static isOpen(e){return e.localMin.isOpen}static isOpenEnd(e){return e.localMin.isOpen&&G.isOpenEndVertex(e.vertexTop)}static isOpenEndVertex(e){return(e.flags&(h.OpenStart|h.OpenEnd))!==h.None}static getPrevHotEdge(e){let t=e.prevInAEL;for(;null!==t&&(G.isOpen(t)||!G.isHotEdge(t));)t=t.prevInAEL;return t}static isFront(e){return e===e.outrec.frontEdge}static getDx(e,t){let r=t.y-e.y;return 0!==r?(t.x-e.x)/r:t.x>e.x?-1/0:1/0}static topX(e,t){return t===e.top.y||e.top.x===e.bot.x?e.top.x:t===e.bot.y?e.bot.x:s.roundToEven(e.bot.x+e.dx*(t-e.bot.y))}static isHorizontal(e){return e.top.y===e.bot.y}static isHeadingRightHorz(e){return e.dx===-1/0}static isHeadingLeftHorz(e){return e.dx===1/0}static swapActives(e,t){return[t,e]}static getPolyType(e){return e.localMin.polytype}static isSamePolyType(e,t){return e.localMin.polytype===t.localMin.polytype}static setDx(e){e.dx=G.getDx(e.bot,e.top)}static nextVertex(e){return e.windDx>0?e.vertexTop.next:e.vertexTop.prev}static prevPrevVertex(e){return e.windDx>0?e.vertexTop.prev.prev:e.vertexTop.next.next}static isMaxima(e){return"flags"in e?(e.flags&h.LocalMax)!==h.None:G.isMaxima(e.vertexTop)}static getMaximaPair(e){let t=e.nextInAEL;for(;null!==t;){if(t.vertexTop===e.vertexTop)return t;t=t.nextInAEL}return null}boundingBoxesOverlap(e,t,r,n){let i=Math.min(e.x,t.x),a=Math.max(e.x,t.x),o=Math.min(e.y,t.y),s=Math.max(e.y,t.y),l=Math.min(r.x,n.x),u=Math.max(r.x,n.x),c=Math.min(r.y,n.y),d=Math.max(r.y,n.y);return!(at.vertex.pt.y-e.vertex.pt.y),this.isSortedMinimaList=!0),this.scanlineHeap.clear(),this.scanlineSet.clear(),this.scanlineArr.length=0,this.useScanlineArray=this.minimaList.length<=16;for(let e=this.minimaList.length-1;e>=0;e--)this.insertScanline(this.minimaList[e].vertex.pt.y);this.currentBotY=0,this.currentLocMin=0,this.actives=null,this.sel=null,this.succeeded=!0}upgradeScanlineStructureFromArray(){let e=this.scanlineArr;for(let t=0,r=e.length;t64&&this.upgradeScanlineStructureFromArray();return}this.scanlineSet.has(e)||(this.scanlineSet.add(e),this.scanlineHeap.push(e))}popScanline(){if(this.useScanlineArray){let e=this.scanlineArr,t=e.length;if(0===t)return{success:!1,y:0};let r=0,n=e[0];for(let i=1;in&&(n=t,r=i)}return e[r]=e[t-1],e.pop(),{success:!0,y:n}}let e=this.scanlineHeap.pop();return null===e?{success:!1,y:0}:(this.scanlineSet.delete(e),{success:!0,y:e})}hasLocMinAtY(e){return this.currentLocMine.right&&(e.right=r.pt.x),r.pt.ye.bottom&&(e.bottom=r.pt.y),r=r.next;while(r!==t)}return c.isEmpty(e)?{left:0,top:0,right:0,bottom:0}:e}executeInternal(e,t){if(e===n.NoClip)return;this.fillrule=t,this.cliptype=e,this.reset();let r=this.popScanline();if(!r.success)return;let i=r.y;for(;this.succeeded;){let e;for(this.insertLocalMinimaIntoAEL(i);null!==(e=this.popHorz());)this.doHorizontal(e);this.horzSegList.length>0&&(this.convertHorzSegsToJoins(),this.horzSegList.length=0),this.currentBotY=i;let t=this.popScanline();if(!t.success)break;for(i=t.y,this.doIntersections(i),this.doTopOfScanbeam(i);null!==(e=this.popHorz());)this.doHorizontal(e)}this.succeeded&&this.processHorzJoins()}insertLocalMinimaIntoAEL(e){for(;this.hasLocMinAtY(e);){let e,t,r,n=this.popLocalMinima();if((n.vertex.flags&h.OpenStart)!==h.None?e=null:((e=new B).bot={x:n.vertex.pt.x,y:n.vertex.pt.y,z:n.vertex.pt.z||0},e.curX=n.vertex.pt.x,e.windDx=-1,e.vertexTop=n.vertex.prev,e.top={x:n.vertex.prev.pt.x,y:n.vertex.prev.pt.y,z:n.vertex.prev.pt.z||0},e.outrec=null,e.localMin=n,G.setDx(e)),(n.vertex.flags&h.OpenEnd)!==h.None?t=null:((t=new B).bot={x:n.vertex.pt.x,y:n.vertex.pt.y,z:n.vertex.pt.z||0},t.curX=n.vertex.pt.x,t.windDx=1,t.vertexTop=n.vertex.next,t.top={x:n.vertex.next.pt.x,y:n.vertex.next.pt.y,z:n.vertex.next.pt.z||0},t.outrec=null,t.localMin=n,G.setDx(t)),null!==e&&null!==t?G.isHorizontal(e)?G.isHeadingRightHorz(e)&&([e,t]=G.swapActives(e,t)):G.isHorizontal(t)?G.isHeadingLeftHorz(t)&&([e,t]=G.swapActives(e,t)):e.dxl||!i&&a.curX=t.x||!i&&G.topX(a,t.y)<=t.x)break}else if(i&&G.topX(a,t.y)>t.x||!i&&G.topX(a,t.y)this.horzSegSort(e,t));for(let t=0;t=r.rightOp.pt.x||e.leftToRight===r.leftToRight||e.rightOp.pt.x<=r.leftOp.pt.x)continue;let t=r.leftOp.pt.y;if(r.leftToRight){for(;r.leftOp.next.pt.y===t&&r.leftOp.next.pt.x<=e.leftOp.pt.x;)r.leftOp=r.leftOp.next;for(;e.leftOp.prev.pt.y===t&&e.leftOp.prev.pt.x<=r.leftOp.pt.x;)e.leftOp=e.leftOp.prev;let n=new L(this.duplicateOp(r.leftOp,!0),this.duplicateOp(e.leftOp,!1));this.horzJoinList.push(n)}else{for(;r.leftOp.prev.pt.y===t&&r.leftOp.prev.pt.x<=e.leftOp.pt.x;)r.leftOp=r.leftOp.prev;for(;e.leftOp.next.pt.y===t&&e.leftOp.next.pt.x<=r.leftOp.pt.x;)e.leftOp=e.leftOp.next;let n=new L(this.duplicateOp(e.leftOp,!0),this.duplicateOp(r.leftOp,!1));this.horzJoinList.push(n)}}}}}updateHorzSegment(e){let t=e.leftOp,r=this.getRealOutRec(t.outrec),n=null!==r.frontEdge,i=t.pt.y,a=t,o=t;if(n){let e=r.pts,t=e.next;for(;a!==t&&a.prev.pt.y===i;)a=a.prev;for(;o!==e&&o.next.pt.y===i;)o=o.next}else{for(;a.prev!==o&&a.prev.pt.y===i;)a=a.prev;for(;o.next!==a&&o.next.pt.y===i;)o=o.next}let s=this.setHorzSegHeadingForward(e,a,o)&&null===e.leftOp.horz;return s?e.leftOp.horz=e:e.rightOp=null,s}setHorzSegHeadingForward(e,t,r){return t.pt.x!==r.pt.x&&(t.pt.xe.y;)r=r.next;if(r===t)break;if(r.pt.y===e.y){if(r.pt.x===e.x||r.pt.y===r.prev.pt.y&&e.x0}processIntersectList(){this.intersectList.sort((e,t)=>e.pt.y!==t.pt.y?e.pt.y>t.pt.y?-1:1:e.pt.x!==t.pt.x?e.pt.xt.edge2.curX));for(let e=0;ethis.currentBotY||i.y100&&a>100?i=n>a?s.getClosestPtOnSegment(i,e.bot,e.top):s.getClosestPtOnSegment(i,t.bot,t.top):n>100?i=s.getClosestPtOnSegment(i,e.bot,e.top):a>100?i=s.getClosestPtOnSegment(i,t.bot,t.top):(i.y0)for(;t.next.pt.y===t.pt.y&&(t.flags&(h.OpenEnd|h.LocalMax))===h.None;)t=t.next;else for(;t.prev.pt.y===t.pt.y&&(t.flags&(h.OpenEnd|h.LocalMax))===h.None;)t=t.prev;return G.isMaxima(t)||(t=null),t}getCurrYMaximaVertex(e){let t=e.vertexTop;if(e.windDx>0)for(;t.next.pt.y===t.pt.y;)t=t.next;else for(;t.prev.pt.y===t.pt.y;)t=t.prev;return G.isMaxima(t)||(t=null),t}resetHorzDirection(e,t){if(e.bot.x===e.top.x){let r=e.curX,n=e.curX,i=e.nextInAEL;for(;null!==i&&i.vertexTop!==t;)i=i.nextInAEL;return{isLeftToRight:null!==i,leftX:r,rightX:n}}return e.curX1?t.windDx*e.windDx<0?e.windCount=t.windCount:e.windCount=t.windCount+e.windDx:e.windCount=G.isOpen(e)?1:e.windDx:t.windDx*e.windDx<0?e.windCount=t.windCount:e.windCount=t.windCount+e.windDx,e.windCount2=t.windCount2,t=t.nextInAEL),this.fillrule===a.EvenOdd)for(;t!==e;)G.getPolyType(t)===r||G.isOpen(t)||(e.windCount2=+(0===e.windCount2)),t=t.nextInAEL;else for(;t!==e;)G.getPolyType(t)===r||G.isOpen(t)||(e.windCount2+=t.windDx),t=t.nextInAEL}isContributingOpen(e){let t,r;switch(this.fillrule){case a.Positive:r=e.windCount>0,t=e.windCount2>0;break;case a.Negative:r=e.windCount<0,t=e.windCount2<0;break;default:r=0!==e.windCount,t=0!==e.windCount2}switch(this.cliptype){case n.Intersection:return t;case n.Union:return!r&&!t;default:return!t}}isContributingClosed(e){switch(this.fillrule){case a.Positive:if(1!==e.windCount)return!1;break;case a.Negative:if(-1!==e.windCount)return!1;break;case a.NonZero:if(1!==Math.abs(e.windCount))return!1}switch(this.cliptype){case n.Intersection:return this.fillrule===a.Positive?e.windCount2>0:this.fillrule===a.Negative?e.windCount2<0:0!==e.windCount2;case n.Union:return this.fillrule===a.Positive?e.windCount2<=0:this.fillrule===a.Negative?e.windCount2>=0:0===e.windCount2;case n.Difference:let t=this.fillrule===a.Positive?e.windCount2<=0:this.fillrule===a.Negative?e.windCount2>=0:0===e.windCount2;return G.getPolyType(e)===i.Subject?t:!t;case n.Xor:return!0;default:return!1}}addLocalMinPoly(e,t,r,n=!1){let i=this.newOutRec();if(e.outrec=i,t.outrec=i,G.isOpen(e))i.owner=null,i.isOpen=!0,e.windDx>0?this.setSides(i,e,t):this.setSides(i,t,e);else{i.isOpen=!1;let r=G.getPrevHotEdge(e);null!==r?(this.usingPolytree&&this.setOwner(i,r.outrec),i.owner=r.outrec,this.outrecIsAscending(r)===n?this.setSides(i,t,e):this.setSides(i,e,t)):(i.owner=null,n?this.setSides(i,e,t):this.setSides(i,t,e))}let a=new M(r,i);return i.pts=a,a}outrecIsAscending(e){return e===e.outrec.frontEdge}newOutRec(){let e=new N;return e.idx=this.outrecList.length,this.outrecList.push(e),e}startOpenPath(e,t){let r=this.newOutRec();r.isOpen=!0,e.windDx>0?(r.frontEdge=e,r.backEdge=null):(r.frontEdge=null,r.backEdge=e),e.outrec=r;let n=new M(t,r);return r.pts=n,n}checkJoinLeft(e,t,r=!1){let n=e.prevInAEL;if(!(null===n||!G.isHotEdge(e)||!G.isHotEdge(n)||G.isHorizontal(e)||G.isHorizontal(n)||G.isOpen(e)||G.isOpen(n))&&(!(t.yt.y)&&!(n.bot.y>t.y))){if(r){if(this.perpendicDistFromLineSqrd(t,n.bot,n.top)>.25)return}else if(e.curX!==n.curX)return;s.isCollinear(e.top,t,n.top)&&(e.outrec.idx===n.outrec.idx?this.addLocalMaxPoly(n,e,t):e.outrec.idxt.y)&&!(n.bot.y>t.y))){if(r){if(this.perpendicDistFromLineSqrd(t,n.bot,n.top)>.25)return}else if(e.curX!==n.curX)return;s.isCollinear(e.top,t,n.top)&&(e.outrec.idx===n.outrec.idx?this.addLocalMaxPoly(e,n,t):e.outrec.idx0?this.setSides(t.outrec,e,t):this.setSides(t.outrec,t,e);return}l=this.startOpenPath(e,r)}this.setZ(e,t,l.pt);return}switch(this.isJoined(e)&&this.split(e,r),this.isJoined(t)&&this.split(t,r),e.localMin.polytype===t.localMin.polytype?this.fillrule===a.EvenOdd?(o=e.windCount,e.windCount=t.windCount,t.windCount=o):(e.windCount+t.windDx===0?e.windCount=-e.windCount:e.windCount+=t.windDx,t.windCount-e.windDx==0?t.windCount=-t.windCount:t.windCount-=e.windDx):(this.fillrule!==a.EvenOdd?e.windCount2+=t.windDx:e.windCount2=+(0===e.windCount2),this.fillrule!==a.EvenOdd?t.windCount2-=e.windDx:t.windCount2=+(0===t.windCount2)),this.fillrule){case a.Positive:o=e.windCount,s=t.windCount;break;case a.Negative:o=-e.windCount,s=-t.windCount;break;default:o=Math.abs(e.windCount),s=Math.abs(t.windCount)}let u=0===o||1===o,c=0===s||1===s;if((G.isHotEdge(e)||u)&&(G.isHotEdge(t)||c))if(G.isHotEdge(e)&&G.isHotEdge(t))if(0!==o&&1!==o||0!==s&&1!==s||e.localMin.polytype!==t.localMin.polytype&&this.cliptype!==n.Xor)(l=this.addLocalMaxPoly(e,t,r))&&this.setZ(e,t,l.pt);else if(G.isFront(e)||e.outrec===t.outrec){(l=this.addLocalMaxPoly(e,t,r))&&this.setZ(e,t,l.pt);let n=this.addLocalMinPoly(e,t,r);this.setZ(e,t,n.pt)}else{l=this.addOutPt(e,r),this.setZ(e,t,l.pt);let n=this.addOutPt(t,r);this.setZ(e,t,n.pt),this.swapOutrecs(e,t)}else if(G.isHotEdge(e))l=this.addOutPt(e,r),this.setZ(e,t,l.pt),this.swapOutrecs(e,t);else if(G.isHotEdge(t))l=this.addOutPt(t,r),this.setZ(e,t,l.pt),this.swapOutrecs(e,t);else{let u,c;switch(this.fillrule){case a.Positive:u=e.windCount2,c=t.windCount2;break;case a.Negative:u=-e.windCount2,c=-t.windCount2;break;default:u=Math.abs(e.windCount2),c=Math.abs(t.windCount2)}if(G.isSamePolyType(e,t)){if(1===o&&1===s){switch(l=null,this.cliptype){case n.Union:if(u>0&&c>0)return;l=this.addLocalMinPoly(e,t,r);break;case n.Difference:(G.getPolyType(e)===i.Clip&&u>0&&c>0||G.getPolyType(e)===i.Subject&&u<=0&&c<=0)&&(l=this.addLocalMinPoly(e,t,r));break;case n.Xor:l=this.addLocalMinPoly(e,t,r);break;default:if(u<=0||c<=0)return;l=this.addLocalMinPoly(e,t,r)}l&&this.setZ(e,t,l.pt)}}else l=this.addLocalMinPoly(e,t,r),this.setZ(e,t,l.pt)}}swapPositionsInAEL(e,t){let r=t.nextInAEL;null!==r&&(r.prevInAEL=e);let n=e.prevInAEL;null!==n&&(n.nextInAEL=t),t.prevInAEL=n,t.nextInAEL=e,e.prevInAEL=t,e.nextInAEL=r,null===t.prevInAEL&&(this.actives=t)}isValidAelOrder(e,t){if(t.curX!==e.curX)return t.curX>e.curX;let r=s.crossProduct(e.top,t.bot,t.top);if(0!==r)return r<0;if(!G.isMaxima(e)&&e.top.y>t.top.y)return 0>=s.crossProduct(t.bot,e.top,G.nextVertex(e).pt);if(!G.isMaxima(t)&&t.top.y>e.top.y)return s.crossProduct(t.bot,t.top,G.nextVertex(t).pt)>=0;let n=t.bot.y,i=t.isLeftBound;return e.bot.y!==n||e.localMin.vertex.pt.y!==n?t.isLeftBound:e.isLeftBound!==i?i:!!s.isCollinear(G.prevPrevVertex(e).pt,e.bot,e.top)||s.crossProduct(G.prevPrevVertex(e).pt,t.bot,G.prevPrevVertex(t).pt)>0===i}isJoined(e){return e.joinWith!==f.None}split(e,t){e.joinWith===f.Right?(e.joinWith=f.None,e.nextInAEL.joinWith=f.None,this.addLocalMinPoly(e,e.nextInAEL,t,!0)):(e.joinWith=f.None,e.prevInAEL.joinWith=f.None,this.addLocalMinPoly(e.prevInAEL,e,t,!0))}setSides(e,t,r){e.frontEdge=t,e.backEdge=r}findEdgeWithMatchingLocMin(e){let t=e.nextInAEL;for(;null!==t;){if(t.localMin?.equals(e.localMin))return t;t=G.isHorizontal(t)||e.bot.x===t.bot.x&&e.bot.y===t.bot.y?t.nextInAEL:null}for(t=e.prevInAEL;null!==t&&!t.localMin?.equals(e.localMin);){if(!G.isHorizontal(t)&&(e.bot.x!==t.bot.x||e.bot.y!==t.bot.y))return null;t=t.prevInAEL}return t}addOutPt(e,t){let r=e.outrec,n=G.isFront(e),i=r.pts,a=i.next;if(n&&t.x===i.pt.x&&t.y===i.pt.y)return i;if(!n&&t.x===a.pt.x&&t.y===a.pt.y)return a;let o=new M(t,r);return a.prev=o,o.prev=i,o.next=a,i.next=o,n&&(r.pts=o),o}addLocalMaxPoly(e,t,r){if(this.isJoined(e)&&this.split(e,r),this.isJoined(t)&&this.split(t,r),G.isFront(e)===G.isFront(t))if(G.isOpenEnd(e))this.swapFrontBackSides(e.outrec);else{if(!G.isOpenEnd(t))return this.succeeded=!1,null;this.swapFrontBackSides(t.outrec)}let n=this.addOutPt(e,r);if(e.outrec===t.outrec){let t=e.outrec;if(t.pts=n,this.usingPolytree){let r=G.getPrevHotEdge(e);null===r?t.owner=null:this.setOwner(t,r.outrec)}this.uncoupleOutRec(e)}else G.isOpen(e)?e.windDx<0?this.joinOutrecPaths(e,t):this.joinOutrecPaths(t,e):e.outrec.idxMath.abs(e.x-t.x)&&2>Math.abs(e.y-t.y)}static isVerySmallTriangle(e){return e.next.next===e.prev&&(G.ptsReallyClose(e.prev.pt,e.next.pt)||G.ptsReallyClose(e.pt,e.next.pt)||G.ptsReallyClose(e.pt,e.prev.pt))}static buildPath(e,t,r,n){let i,a;if(null===e||e.next===e||!r&&e.next===e.prev)return!1;for(n.length=0,t?(i=e.pt,a=e.prev):(i=(e=e.next).pt,a=e.next),n.push(i);a!==e;)(a.pt.x!==i.x||a.pt.y!==i.y)&&(i=a.pt,n.push(i)),a=t?a.prev:a.next;return 3!==n.length||r||!G.isVerySmallTriangle(a)}buildPaths(e,t){e.length=0,t.length=0;let r=0;for(;rs.dotProduct(r.prev.pt,r.pt,r.next.pt))){if(r===e.pts&&(e.pts=r.prev),r=this.disposeOutPt(r),!this.isValidClosedPath(r)){e.pts=null;return}t=r;continue}if(null===r||(r=r.next)===t)break}this.fixSelfIntersects(e)}isValidClosedPath(e){return null!==e&&e.next!==e&&(e.next!==e.prev||!G.isVerySmallTriangle(e))}disposeOutPt(e){let t=e.next===e?null:e.next;return e.prev.next=e.next,e.next.prev=e.prev,t}fixSelfIntersects(e){let t=e.pts;if(t.prev!==t.next.next)for(;;){if(t.next&&t.next.next&&this.boundingBoxesOverlap(t.prev.pt,t.pt,t.next.pt,t.next.next.pt)&&s.segsIntersect(t.prev.pt,t.pt,t.next.pt,t.next.next.pt))if(t.next.next.next&&this.boundingBoxesOverlap(t.prev.pt,t.pt,t.next.next.pt,t.next.next.next.pt)&&s.segsIntersect(t.prev.pt,t.pt,t.next.next.pt,t.next.next.next.pt))(t=this.duplicateOp(t,!1)).pt=t.next.next.next.pt,t=t.next;else{if((t===e.pts||t.next===e.pts)&&(e.pts=e.pts.prev),this.doSplitOp(e,t),null===e.pts)return;if((t=e.pts).prev===t.next.next)break;continue}if((t=t.next)===e.pts)break}}doSplitOp(e,t){let r=t.prev,n=t.next.next;e.pts=r;let i=s.getLineIntersectPt(r.pt,t.pt,t.next.pt,n.pt).point,a=G.areaOutPt(r),o=Math.abs(a);if(o<2){e.pts=null;return}let l=this.areaTriangle(i,t.pt,t.next.pt),u=Math.abs(l);if(i.x===r.pt.x&&i.y===r.pt.y||i.x===n.pt.x&&i.y===n.pt.y)n.prev=r,r.next=n;else{let t=new M(i,e);t.prev=r,t.next=n,n.prev=t,r.next=t}if(!(u>1)||!(u>o)&&l>0!=a>0)return;let c=this.newOutRec();c.owner=e.owner,t.outrec=c,t.next.outrec=c;let d=new M(i,c);d.prev=t.next,d.next=t,c.pts=d,t.prev=d,t.next.next=d,this.usingPolytree&&(this.path1InsidePath2(r,d)?(null===c.splits&&(c.splits=[]),c.splits.push(e.idx)):(null===e.splits&&(e.splits=[]),e.splits.push(c.idx)))}static areaOutPt(e){let t=0,r=e;do t+=(r.prev.pt.y+r.pt.y)*(r.prev.pt.x-r.pt.x),r=r.next;while(r!==e);return .5*t}areaTriangle(e,t,r){return(r.y+e.y)*(r.x-e.x)+(e.y+t.y)*(e.x-t.x)+(t.y+r.y)*(t.x-r.x)}isValidOwner(e,t){for(;null!==t&&t!==e;)t=t.owner;return null===t}containsRect(e,t){return t.left>=e.left&&t.right<=e.right&&t.top>=e.top&&t.bottom<=e.bottom}checkSplitOwner(e,t){for(let r=0;r=0&&e.isNegArea}else this.lowestPathIdx=-1,this.pathsReversed=!1}}class j{static Tolerance=1e-12;static arc_const=.002;groupList=[];pathOut=[];normals=[];solution=[];solutionTree=null;groupDelta=0;delta=0;mitLimSqr=0;stepsPerRad=0;stepSin=0;stepCos=0;joinType=b.Bevel;endType=I.Polygon;arcTolerance=0;mergeGroups=!0;miterLimit=2;preserveCollinear=!1;reverseSolution=!1;zCallback;deltaCallback=null;constructor(e=2,t=0,r=!1,n=!1){this.miterLimit=e,this.arcTolerance=t,this.mergeGroups=!0,this.preserveCollinear=r,this.reverseSolution=n}clear(){this.groupList.length=0}ZCB=(e,t,r,n,i)=>{0!==(e.z||0)&&(e.z===r.z||e.z===n.z)?i.z=e.z:0!==(r.z||0)&&r.z===t.z?i.z=r.z:0!==(t.z||0)&&t.z===n.z?i.z=t.z:this.zCallback&&this.zCallback(e,t,r,n,i)};addPath(e,t,r){if(0===e.length)return;let n=[e];this.addPaths(n,t,r)}addPaths(e,t,r){0!==e.length&&this.groupList.push(new H(e,t,r))}calcSolutionCapacity(){let e=0;for(let t of this.groupList)e+=t.endType===I.Joined?2*t.inPaths.length:t.inPaths.length;return e}checkPathsReversed(){let e=!1;for(let t of this.groupList)if(t.endType===I.Polygon){e=t.pathsReversed;break}return e}executeInternal(e){if(0===this.groupList.length)return;if(.5>Math.abs(e)){for(let e of this.groupList)for(let t of e.inPaths)this.solution.push(t);return}for(let t of(this.delta=e,this.mitLimSqr=this.miterLimit<=1?2:2/j.sqr(this.miterLimit),this.groupList))this.doGroupOffset(t);if(0===this.groupList.length)return;let t=this.checkPathsReversed(),r=t?a.Negative:a.Positive,i=new W;i.preserveCollinear=this.preserveCollinear,i.reverseSolution=this.reverseSolution!==t,i.zCallback=this.ZCB,i.addSubject(this.solution),null!==this.solutionTree?i.execute(n.Union,r,this.solutionTree):i.execute(n.Union,r,this.solution)}execute(e,t){Array.isArray(t)?(t.length=0,this.solution=t):(t.clear(),this.solutionTree=t,this.solution=[]),this.executeInternal(e)}executeWithCallback(e,t){this.deltaCallback=e,this.execute(1,t)}static getUnitNormal(e,t){let r=t.x-e.x,n=t.y-e.y;if(0===r&&0===n)return{x:0,y:0};let i=1/Math.sqrt(r*r+n*n);return{x:n*i,y:-r*i}}static getLowestPathInfo(e){let t=-1,r=!1,n={x:Number.MAX_SAFE_INTEGER,y:Number.MIN_SAFE_INTEGER};for(let i=0;i=n.x))){if(a===Number.MAX_VALUE){if(0===(a=j.area(e[i])))break;r=a<0}t=i,n.x=o.x,n.y=o.y}}return{idx:t,isNegArea:r}}static translatePoint(e,t,r){return{x:e.x+t,y:e.y+r}}static reflectPoint(e,t){return{x:t.x+(t.x-e.x),y:t.y+(t.y-e.y)}}static almostZero(e,t=.001){return Math.abs(e).01?this.arcTolerance:e*j.arc_const)/e);this.stepSin=Math.sin(2*Math.PI/t),this.stepCos=Math.cos(2*Math.PI/t),this.groupDelta<0&&(this.stepSin=-this.stepSin),this.stepsPerRad=t/(2*Math.PI)}let i=e[t],a={x:this.normals[r].x*this.groupDelta,y:this.normals[r].y*this.groupDelta};t===r&&u.negate(a),this.pathOut.push({x:Math.round(i.x+a.x),y:Math.round(i.y+a.y)});let o=Math.ceil(this.stepsPerRad*Math.abs(n));for(let e=1;e1?i=1:i<-1&&(i=-1),null!==this.deltaCallback&&(this.groupDelta=this.deltaCallback(t,this.normals,r,n),e.pathsReversed&&(this.groupDelta=-this.groupDelta)),Math.abs(this.groupDelta)-.999&&i*this.groupDelta<0)this.pathOut.push(this.getPerpendic(t[r],this.normals[n])),this.pathOut.push(t[r]),this.pathOut.push(this.getPerpendic(t[r],this.normals[r]));else if(a>.999&&this.joinType!==b.Round)this.doMiter(t,r,n,a);else switch(this.joinType){case b.Miter:a>this.mitLimSqr-1?this.doMiter(t,r,n,a):this.doSquare(t,r,n);break;case b.Round:this.doRound(t,r,n,Math.atan2(i,a));break;case b.Bevel:this.doBevel(t,r,n);break;default:this.doSquare(t,r,n)}}offsetPolygon(e,t){this.pathOut=[];let r=t.length,n=r-1;for(let i=0;i0;e--)this.normals[e]={x:-this.normals[e-1].x,y:-this.normals[e-1].y};if(this.normals[0]=this.normals[r],null!==this.deltaCallback&&(this.groupDelta=this.deltaCallback(t,this.normals,r,r)),Math.abs(this.groupDelta)0;n--)this.offsetPoint(e,t,n,i),i=n;this.solution.push([...this.pathOut])}doGroupOffset(e){e.endType===I.Polygon?(e.lowestPathIdx<0&&(this.delta=Math.abs(this.delta)),this.groupDelta=e.pathsReversed?-this.delta:this.delta):this.groupDelta=Math.abs(this.delta);let t=Math.abs(this.groupDelta);if(this.joinType=e.joinType,this.endType=e.endType,e.joinType===b.Round||e.endType===I.Round){let e=Math.PI/Math.acos(1-(this.arcTolerance>.01?this.arcTolerance:t*j.arc_const)/t);this.stepSin=Math.sin(2*Math.PI/e),this.stepCos=Math.cos(2*Math.PI/e),this.groupDelta<0&&(this.stepSin=-this.stepSin),this.stepsPerRad=e/(2*Math.PI)}for(let t of e.inPaths){this.pathOut=[];let r=t.length;if(1===r){let r=t[0];if(null!==this.deltaCallback&&(this.groupDelta=this.deltaCallback(t,this.normals,0,0),e.pathsReversed&&(this.groupDelta=-this.groupDelta)),e.endType===I.Round){let e=Math.ceil(2*this.stepsPerRad*Math.PI);this.pathOut=j.ellipse(r,Math.abs(this.groupDelta),Math.abs(this.groupDelta),e)}else{let e=Math.ceil(Math.abs(this.groupDelta)),t={left:r.x-e,top:r.y-e,right:r.x+e,bottom:r.y+e};this.pathOut=[{x:t.left,y:t.top},{x:t.right,y:t.top},{x:t.right,y:t.bottom},{x:t.left,y:t.bottom}]}this.solution.push([...this.pathOut]);continue}switch(2===r&&e.endType===I.Joined&&(this.endType=e.joinType===b.Round?I.Round:I.Square),this.buildNormals(t),this.endType){case I.Polygon:this.offsetPolygon(e,t);break;case I.Joined:this.offsetOpenJoined(e,t);break;default:this.offsetOpenPath(e,t)}}}static stripDuplicates(e,t){let r=e.length,n=[];if(0===r)return n;let i=e[0];n.push(i);for(let t=1;t1)break}return r<=0}static isClockwise(e,t,r,n,i){return K.areOpposites(e,t)?0>s.crossProduct(r,i,n):K.headingClockwise(e,t)}static areOpposites(e,t){return 2===Math.abs(e-t)}static headingClockwise(e,t){return(e+1)%4===t}static getAdjacentLocation(e,t){return(e+(t?1:3))%4}static unlinkOp(e){return e.next===e?null:(e.prev.next=e.next,e.next.prev=e.prev,e.next)}static unlinkOpBack(e){return e.next===e?null:(e.prev.next=e.next,e.next.prev=e.prev,e.prev)}static getEdgesForPt(e,t){let r=0;return e.x===t.left?r=1:e.x===t.right&&(r=4),e.y===t.top?r+=2:e.y===t.bottom&&(r+=8),r}static isHeadingClockwise(e,t,r){switch(r){case 0:return t.ye.x;case 2:return t.y>e.y;default:return t.xr.x}static hasVertOverlap(e,t,r,n){return e.yr.y}static addToEdge(e,t){null===t.edge&&(t.edge=e,e.push(t))}static uncoupleEdge(e){if(null!==e.edge){for(let t=0;t=e.top&&t.y<=e.bottom?{location:x.left,isOnRect:!0}:t.x===e.right&&t.y>=e.top&&t.y<=e.bottom?{location:x.right,isOnRect:!0}:t.y===e.top&&t.x>=e.left&&t.x<=e.right?{location:x.top,isOnRect:!0}:t.y===e.bottom&&t.x>=e.left&&t.x<=e.right?{location:x.bottom,isOnRect:!0}:{location:t.xe.right?x.right:t.ye.bottom?x.bottom:x.inside,isOnRect:!1}}static isHorizontal(e,t){return e.y===t.y}static getSegmentIntersection(e,t,r,n){let i=s.crossProduct(e,r,n),a=s.crossProduct(t,r,n);if(0===i)return 0===a?{intersects:!1,point:e}:l.equals(e,r)||l.equals(e,n)?{intersects:!0,point:e}:K.isHorizontal(r,n)?{intersects:e.x>r.x==e.xr.y==e.yr.x==t.xr.y==t.y0==a>0)return{intersects:!1,point:{x:0,y:0}};let o=s.crossProduct(r,e,t),u=s.crossProduct(n,e,t);return 0===o?l.equals(r,e)||l.equals(r,t)?{intersects:!0,point:r}:K.isHorizontal(e,t)?{intersects:r.x>e.x==r.xe.y==r.ye.x==n.xe.y==n.y0==u>0?{intersects:!1,point:{x:0,y:0}}:s.getLineIntersectPt(e,t,r,n)}static getIntersection(e,t,r,n){let i={x:0,y:0},a=n;switch(n){case x.left:{let n=K.getSegmentIntersection(t,r,e[0],e[3]);if(n.intersects)return{intersects:!0,point:i=n.point,newLocation:a};if(t.yn)break;a=e[i].x>=this.rect.right?x.right:e[i].y<=this.rect.top?x.top:e[i].y>=this.rect.bottom?x.bottom:x.inside;break;case x.top:for(;i<=n&&e[i].y<=this.rect.top;)i++;if(i>n)break;a=e[i].y>=this.rect.bottom?x.bottom:e[i].x<=this.rect.left?x.left:e[i].x>=this.rect.right?x.right:x.inside;break;case x.right:for(;i<=n&&e[i].x>=this.rect.right;)i++;if(i>n)break;a=e[i].x<=this.rect.left?x.left:e[i].y<=this.rect.top?x.top:e[i].y>=this.rect.bottom?x.bottom:x.inside;break;case x.bottom:for(;i<=n&&e[i].y>=this.rect.bottom;)i++;if(i>n)break;a=e[i].y<=this.rect.top?x.top:e[i].x<=this.rect.left?x.left:e[i].x>=this.rect.right?x.right:x.inside;break;case x.inside:for(;i<=n;){if(e[i].xthis.rect.right)a=x.right;else if(e[i].y>this.rect.bottom)a=x.bottom;else if(e[i].y0}executeInternal(e){if(e.length<3||c.isEmpty(this.rect))return;let t=[],r=x.inside,n=r,i=r,a=e.length-1,o=K.getLocation(this.rect,e[a]),s=o.location;if(o.isOnRect){let t=a-1;for(;t>=0;){let r=K.getLocation(this.rect,e[t]);if(!r.isOnRect){i=r.location;break}t--}if(t<0){for(let t of e)this.add(t);return}i===x.inside&&(s=x.inside)}let u=s,d=0;for(;d<=a;){i=s;let o=n,u=this.getNextLocation(e,s,d,a);if(s=u.location,(d=u.index)>a)break;let c=0===d?e[a]:e[d-1];n=s;let p=K.getIntersection(this.rectPath,e[d],c,n);if(!p.intersects){if(o===x.inside){let r=K.isClockwise(i,s,c,e[d],this.mp);do t.push(i),i=K.getAdjacentLocation(i,r);while(i!==s);n=o}else if(i!==x.inside&&i!==s){let t=K.isClockwise(i,s,c,e[d],this.mp);do i=this.addCornerWithDirection(i,t);while(i!==s)}++d;continue}let m=p.point;if(n=p.newLocation,s===x.inside){if(r===x.inside)r=n,t.push(i);else if(i!==n){let t=K.isClockwise(i,n,c,e[d],this.mp);do i=this.addCornerWithDirection(i,t);while(i!==n)}}else if(i!==x.inside){s=i;let a=K.getIntersection(this.rectPath,c,e[d],s).point;if(o!==x.inside&&o!==s&&this.addCorner(o,s),r===x.inside&&(r=s,t.push(i)),s=n,this.add(a),l.equals(m,a)){s=K.getLocation(this.rect,e[d]).location,this.addCorner(n,s),n=s;continue}}else s=n,r===x.inside&&(r=n);this.add(m)}if(r===x.inside){if(u===x.inside||!c.containsRect(this.pathBounds,this.rect)||!K.path1ContainsPath2(e,this.rectPath))return;let r=K.startLocsAreClockwise(t);for(let e=0;e<4;e++){let t=r?e:3-e;this.add(this.rectPath[t]),K.addToEdge(this.edges[2*t],this.results[0])}}else if(s!==x.inside&&(s!==r||t.length>2)){if(t.length>0){for(let e of(i=s,t))i!==e&&(i=this.addCornerWithDirection(i,K.headingClockwise(i,e)),i=e);s=i}s!==r&&this.addCornerWithDirection(s,K.headingClockwise(s,r))}}execute(e){let t=[];if(c.isEmpty(this.rect))return t;for(let r of e)if(!(r.length<3)&&(this.pathBounds=s.getBounds(r),c.intersects(this.rect,this.pathBounds))){if(c.containsRect(this.rect,this.pathBounds)){t.push(r);continue}this.executeInternal(r),this.checkEdges();for(let e=0;e<4;++e)this.tidyEdgePair(e,this.edges[2*e],this.edges[2*e+1]);for(let e of this.results){let r=this.getPath(e);r.length>0&&t.push(r)}this.results.length=0;for(let e=0;e<8;e++)this.edges[e].length=0}return t}checkEdges(){for(let e=0;ec.prev.pt.x,m=d.pt.x>d.prev.pt.x):(p=c.pt.y>c.prev.pt.y,m=d.pt.y>d.prev.pt.y),c.next===c.prev||l.equals(c.pt,c.prev.pt)?m===i?(t[a]=d,r[o++]=null):(r[o]=d,t[a++]=null):d.next===d.prev||l.equals(d.pt,d.prev.pt)?p===i?(t[a]=c,r[o++]=null):(r[o]=c,t[a++]=null):p===m?p===i?(t[a]=c,K.uncoupleEdge(d),K.addToEdge(t,d),r[o++]=null):(t[a++]=null,r[o]=d,K.uncoupleEdge(c),K.addToEdge(r,c),o=0):(p===i?t[a]=c:r[o]=c,m===i?t[a]=d:r[o]=d)}}getPath(e){let t=[];if(null===e||e.prev===e.next)return t;let r=e.next;for(;null!==r&&r!==e;)s.isCollinear(r.prev.pt,r.pt,r.next.pt)?(e=r.prev,r=K.unlinkOp(r)):r=r.next;if(null===r)return[];for(t.push(e.pt),r=e.next;r!==e;)t.push(r.pt),r=r.next;return t}}class q extends K{constructor(e){super(e)}execute(e){let t=[];if(c.isEmpty(this.rect))return t;for(let r of e)if(!(r.length<2)&&(this.pathBounds=s.getBounds(r),c.intersects(this.rect,this.pathBounds))){for(let e of(this.executeInternalLines(r),this.results)){let r=this.getPathLines(e);r.length>0&&t.push(r)}this.results.length=0;for(let e=0;e<8;e++)this.edges[e].length=0}return t}getPathLines(e){let t=[];if(null===e||e===e.next)return t;t.push((e=e.next).pt);let r=e.next;for(;r!==e;)t.push(r.pt),r=r.next;return t}executeInternalLines(e){if(this.results.length=0,e.length<2||c.isEmpty(this.rect))return;let t=x.inside,r=1,n=e.length-1,i=K.getLocation(this.rect,e[0]),a=i.location;if(i.isOnRect){for(;r<=n;){let n=K.getLocation(this.rect,e[r]);if(!n.isOnRect){t=n.location;break}r++}if(r>n){for(let t of e)this.add(t);return}t===x.inside&&(a=x.inside),r=1}for(a===x.inside&&this.add(e[0]);r<=n;){t=a;let i=this.getNextLocation(e,a,r,n);if(a=i.location,(r=i.index)>n)break;let o=e[r-1],s=a,l=K.getIntersection(this.rectPath,e[r],o,s);if(!l.intersects){++r;continue}let u=l.point;if(s=l.newLocation,a===x.inside)this.add(u,!0);else if(t!==x.inside){s=t;let n=K.getIntersection(this.rectPath,o,e[r],s).point;this.add(n,!0),this.add(u)}else this.add(u)}}}!function(e){function t(e,t,r,n){let i=+!n,a=e.length,o=t.length,s=[];for(let n of t){let t=[];if(r)for(let r of e)t.push(l.add(n,r));else for(let r of e)t.push(l.subtract(n,r));s.push(t)}let u=[],c=n?o-1:0,d=a-1;for(let e=i;e=0?u.push(r):u.push([...r].reverse()),d=t}c=e}return u}function r(e,t){let r=[];for(let n of e)r.push({x:s.roundToEven(n.x*t),y:s.roundToEven(n.y*t)});return r}function o(e,t){let r=[];for(let n of e){let e=[];for(let r of n)e.push({x:r.x*t,y:r.y*t});r.push(e)}return r}function u(e,t){let r=[],a=new W;return a.addPaths(e,i.Subject),a.execute(n.Union,t,r),r}e.sum=function(e,r,n){return u(t(e,r,!0,n),a.NonZero)},e.sumD=function(e,n,i,s=2){let l=Math.pow(10,s);return o(u(t(r(e,l),r(n,l),!0,i),a.NonZero),1/l)},e.diff=function(e,r,n){return u(t(e,r,!1,n),a.NonZero)},e.diffD=function(e,n,i,s=2){let l=Math.pow(10,s);return o(u(t(r(e,l),r(n,l),!1,i),a.NonZero),1/l)}}(C||(C={})),function(e){e[e.success=0]="success",e[e.fail=1]="fail",e[e.noPolygons=2]="noPolygons",e[e.pathsIntersect=3]="pathsIntersect"}(A||(A={})),function(e){e[e.loose=0]="loose",e[e.ascend=1]="ascend",e[e.descend=2]="descend"}(T||(T={})),function(e){e[e.none=0]="none",e[e.collinear=1]="collinear",e[e.intersect=2]="intersect"}(S||(S={})),function(e){e[e.neither=0]="neither",e[e.left=1]="left",e[e.right=2]="right"}(w||(w={}));class X{pt;edges=[];innerLM=!1;constructor(e){this.pt=e}}class Y{vL=null;vR=null;vB=null;vT=null;kind=T.loose;triA=null;triB=null;isActive=!1;nextE=null;prevE=null}class Z{edges=[,,,];constructor(e,t,r){this.edges[0]=e,this.edges[1]=t,this.edges[2]=r}}class J{allVertices=[];allEdges=[];allTriangles=[];pendingDelaunayStack=[];horzEdgeStack=[];locMinStack=[];useDelaunay;firstActive=null;lowermostVertex=null;constructor(e=!0){this.useDelaunay=e}addPath(e){let t,r,n=e.length;if(0===n)return;let i=0,a=J.findLocMinIdx(e,n,i);if(!a.found)return;for(i=a.idx,t=J.prev(i,n);e[t].x===e[i].x&&e[t].y===e[i].y;)t=J.prev(t,n);r=J.next(i,n);let o=i;for(;0===s.crossProductSign(e[t],e[o],e[r]);){let i=J.findLocMinIdx(e,n,o);if(!i.found)return;for(o=i.idx,t=J.prev(o,n);e[t].x===e[o].x&&e[t].y===e[o].y;)t=J.prev(t,n);r=J.next(o,n)}let l=this.allVertices.length,u=new X(e[o]);this.allVertices.push(u),J.leftTurning(e[t],e[o],e[r])&&(u.innerLM=!0);let c=u;for(o=r;;){if(this.locMinStack.push(c),(null===this.lowermostVertex||c.pt.y>this.lowermostVertex.pt.y||c.pt.y===this.lowermostVertex.pt.y&&c.pt.x=c.pt.y;){let t=new X(e[o]);for(this.allVertices.push(t),this.createEdge(t,c,T.descend),c=t,o=r,r=J.next(o,n);0===s.crossProductSign(c.pt,e[o],e[r]);)o=r,r=J.next(o,n)}if(o===i)break;J.leftTurning(t.pt,c.pt,e[o])&&(c.innerLM=!0)}this.createEdge(u,c,T.descend);let d=this.allVertices.length-l;if(d<3||3===d&&(1>=J.distSqr(this.allVertices[l].pt,this.allVertices[l+1].pt)||1>=J.distSqr(this.allVertices[l+1].pt,this.allVertices[l+2].pt)||1>=J.distSqr(this.allVertices[l+2].pt,this.allVertices[l].pt)))for(let e=l;e2}cleanUp(){this.allVertices.length=0,this.allEdges.length=0,this.allTriangles.length=0,this.pendingDelaunayStack.length=0,this.horzEdgeStack.length=0,this.locMinStack.length=0,this.firstActive=null,this.lowermostVertex=null}fixupEdgeIntersects(){for(let e=0;e=t.vR.pt.x)break;if(e.vT.pt.yt.vT.pt.y&&J.segsIntersect(e.vL.pt,e.vR.pt,t.vL.pt,t.vR.pt)===S.intersect&&!this.removeIntersection(e,t))return!1}}return!0}mergeDupOrCollinearVertices(){if(this.allVertices.length<2)return;let e=0;for(let t=1;t1)return!1;let o=n.vT;return J.removeEdgeFromVertex(o,n),n.vL===o?n.vL=r:n.vR=r,n.vT=r,r.edges.push(n),r.innerLM=!1,n.vB.innerLM&&0>=J.getLocMinAngle(n.vB)&&(n.vB.innerLM=!1),this.createEdge(r,o,n.kind),!0}createEdge(e,t,r){let n=new Y;return this.allEdges.push(n),e.pt.y===t.pt.y?(n.vB=e,n.vT=t):e.pt.y=t&&n.vB.pt.y>=r&&n.vB!==e&&n.vT!==e&&!J.leftTurning(n.vL.pt,e.pt,n.vR.pt)){let t=J.shortestDistFromSegment(e.pt,n.vL.pt,n.vR.pt);(null===i||ts&&n.vL.pt.xr&&n.vT.pt.yr?n.vT:n.vB).pt.x,l=o.pt.y),n=n.nextE;else for(;null!==n;)n.vR.pt.xt&&n.vB.pt.y>r&&n.vT.pt.yr?n.vT:n.vB).pt.x,l=o.pt.y),n=n.nextE;return this.createEdge(o,e,T.loose)}horizontalBetween(e,t){let r,n,i=e.pt.y;e.pt.x>t.pt.x?(r=t.pt.x,n=e.pt.x):(r=e.pt.x,n=t.pt.x);let a=this.firstActive;for(;null!==a&&(a.vL.pt.y!==i||a.vR.pt.y!==i||!(a.vL.pt.x>=r)||!(a.vR.pt.x<=n)||a.vL.pt.x===r&&a.vL.pt.x===n);)a=a.nextE;return a}doTriangulateLeft(e,t,r){let n=null,i=null,a=e.vB===t?e.vT:e.vB;for(let r of t.edges){if(r===e||!r.isActive)continue;let o=r.vT===t?r.vB:r.vT;if(o===a)continue;let l=s.crossProductSign(a.pt,t.pt,o.pt);if(0===l){if(a.pt.x>t.pt.x==t.pt.x>o.pt.x)continue}else if(l>0||null!==n&&!J.leftTurning(o.pt,t.pt,n.pt))continue;n=o,i=r}if(null===n||n.pt.yt.pt.y&&J.isRightEdge(i))return;let o=J.findLinkingEdge(n,a,n.pt.yt.pt.x==t.pt.x>o.pt.x)continue}else if(l<0||null!==n&&!J.rightTurning(o.pt,t.pt,n.pt))continue;n=o,i=r}if(null===n||n.pt.yt.pt.y&&J.isLeftEdge(i))return;let o=J.findLinkingEdge(n,a,n.pt.y>a.pt.y);if(null===o){if(n.pt.y===a.pt.y&&a.pt.y===r&&null!==this.horizontalBetween(n,a))return;o=this.createEdge(n,a,T.loose)}this.createTriangle(e,o,i),J.edgeCompleted(o)||this.doTriangulateRight(o,n,r)}addEdgeToActives(e){e.isActive||(e.prevE=null,e.nextE=this.firstActive,e.isActive=!0,null!==this.firstActive&&(this.firstActive.prevE=e),this.firstActive=e)}removeEdgeFromActives(e){J.removeEdgeFromVertex(e.vB,e),J.removeEdgeFromVertex(e.vT,e);let t=e.prevE,r=e.nextE;null!==r&&(r.prevE=t),null!==t&&(t.nextE=r),e.isActive=!1,this.firstActive===e&&(this.firstActive=r)}execute(e){let t=[];if(!this.addPaths(e))return{result:A.noPolygons,solution:t};if(this.lowermostVertex.innerLM){for(;this.locMinStack.length>0;){let e=this.locMinStack.pop();e.innerLM=!e.innerLM}for(let e of this.allEdges)e.kind===T.ascend?e.kind=T.descend:e.kind===T.descend&&(e.kind=T.ascend)}else this.locMinStack.length=0;if(this.allEdges.sort((e,t)=>e.vL.pt.xt.vL.pt.x)),!this.fixupEdgeIntersects())return this.cleanUp(),{result:A.pathsIntersect,solution:t};this.allVertices.sort((e,t)=>e.pt.y===t.pt.y?e.pt.xt.pt.x):t.pt.y0;){let e=this.locMinStack.pop(),n=this.createInnerLocMinLooseEdge(e);if(null===n)return this.cleanUp(),{result:A.fail,solution:t};J.isHorizontal(n)?n.vL===n.vB?this.doTriangulateLeft(n,n.vB,r):this.doTriangulateRight(n,n.vB,r):(this.doTriangulateLeft(n,n.vB,r),J.edgeCompleted(n)||this.doTriangulateRight(n,n.vB,r)),this.addEdgeToActives(e.edges[0]),this.addEdgeToActives(e.edges[1])}for(;this.horzEdgeStack.length>0;){let e=this.horzEdgeStack.pop();!J.edgeCompleted(e)&&(e.vB===e.vL?J.isLeftEdge(e)&&this.doTriangulateLeft(e,e.vB,r):J.isRightEdge(e)&&this.doTriangulateRight(e,e.vB,r))}r=e.pt.y}for(let t=e.edges.length-1;t>=0;--t){if(t>=e.edges.length)continue;let r=e.edges[t];!(J.edgeCompleted(r)||J.isLooseEdge(r))&&(e===r.vB?(J.isHorizontal(r)&&this.horzEdgeStack.push(r),e.innerLM||this.addEdgeToActives(r)):J.isHorizontal(r)?this.horzEdgeStack.push(r):J.isLeftEdge(r)?this.doTriangulateLeft(r,r.vB,e.pt.y):this.doTriangulateRight(r,r.vB,e.pt.y))}e.innerLM&&this.locMinStack.push(e)}for(;this.horzEdgeStack.length>0;){let e=this.horzEdgeStack.pop();J.edgeCompleted(e)||e.vB!==e.vL||this.doTriangulateLeft(e,e.vB,r)}if(this.useDelaunay)for(;this.pendingDelaunayStack.length>0;){let e=this.pendingDelaunayStack.pop();this.forceLegal(e)}for(let e of this.allTriangles){let r=J.pathFromTriangle(e),n=s.crossProductSign(r[0],r[1],r[2]);0!==n&&(n<0&&r.reverse(),t.push(r))}return this.cleanUp(),{result:A.success,solution:t}}static isLooseEdge(e){return e.kind===T.loose}static isLeftEdge(e){return e.kind===T.ascend}static isRightEdge(e){return e.kind===T.descend}static isHorizontal(e){return e.vB.pt.y===e.vT.pt.y}static leftTurning(e,t,r){return 0>s.crossProductSign(e,t,r)}static rightTurning(e,t,r){return s.crossProductSign(e,t,r)>0}static edgeCompleted(e){return null!==e.triA&&(null!==e.triB||e.kind!==T.loose)}static edgeContains(e,t){return e.vL===t?w.left:e.vR===t?w.right:w.neither}static getAngle(e,t,r){let n=Number(t.x-e.x),i=Number(t.y-e.y),a=Number(t.x-r.x),o=Number(t.y-r.y);return Math.atan2(n*o-i*a,n*a+i*o)}static getLocMinAngle(e){let t,r;return e.edges[0].kind===T.ascend?(t=0,r=1):(r=0,t=1),J.getAngle(e.edges[r].vT.pt,e.pt,e.edges[t].vT.pt)}static removeEdgeFromVertex(e,t){let r=e.edges.indexOf(t);if(r<0)throw Error("Edge not found in vertex");e.edges.splice(r,1)}static findLocMinIdx(e,t,r){if(t<3)return{found:!1,idx:r};let n=r,i=(r+1)%t;for(;e[i].y<=e[r].y;)if(r=i,i=(i+1)%t,r===n)return{found:!1,idx:r};for(;e[i].y>=e[r].y;)r=i,i=(i+1)%t;return{found:!0,idx:r}}static prev(e,t){return 0===e?t-1:e-1}static next(e,t){return(e+1)%t}static findLinkingEdge(e,t,r){let n=null;for(let i of e.edges)if(i.vL===t||i.vR===t){if(i.kind===T.loose||i.kind===T.ascend===r)return i;n=i}return n}static pathFromTriangle(e){let t=[e.edges[0].vL.pt,e.edges[0].vR.pt],r=e.edges[1];return r.vL.pt.x===t[0].x&&r.vL.pt.y===t[0].y||r.vL.pt.x===t[1].x&&r.vL.pt.y===t[1].y?t.push(r.vR.pt):t.push(r.vL.pt),t}static inCircleTest(e,t,r,n){let i=Number(e.x-n.x),a=Number(e.y-n.y),o=i*i+a*a,s=Number(t.x-n.x),l=Number(t.y-n.y),u=s*s+l*l,c=Number(r.x-n.x),d=Number(r.y-n.y),p=c*c+d*d;return i*(l*p-d*u)-s*(a*p-d*o)+c*(a*u-l*o)}static shortestDistFromSegment(e,t,r){let n=Number(r.x-t.x),i=Number(r.y-t.y),a=Number(e.x-t.x),o=Number(e.y-t.y),s=a*n+o*i,l=n*n+i*i;return s<0?J.distanceSqr(e,t):s>l?J.distanceSqr(e,r):(a*i-n*o)*(a*i-n*o)/l}static segsIntersect(e,t,r,n){let i=Number(t.y-e.y),a=Number(t.x-e.x),o=Number(n.y-r.y),s=Number(n.x-r.x),l=i*s-o*a;if(0===l)return S.collinear;let u=Number(e.x-r.x)*o-Number(e.y-r.y)*s;if(0===u)return S.none;if(u>0){if(l<0||u>=l)return S.none}else if(l>0||u<=l)return S.none;if(0==(u=Number(e.x-r.x)*i-Number(e.y-r.y)*a))return S.none;if(u>0){if(l>0&&ul)return S.intersect;return S.none}static distSqr(e,t){let r=Number(e.x-t.x),n=Number(e.y-t.y);return r*r+n*n}static distanceSqr(e,t){let r=Number(e.x-t.x),n=Number(e.y-t.y);return r*r+n*n}}!function(e){function t(e,t,r,n){let a=[];if(null===t)return a;let o=new W;return o.addPaths(t,i.Subject),null!==r&&o.addPaths(r,i.Clip),o.execute(e,n,a),a}function r(e,t,n,i,a=2){let o=[],s=new z(a);return s.addSubjectPaths(t),null!==n&&s.addClipPaths(n),s.execute(e,i,o),o}function a(e){let t=0,r=e.length;if(r<3)return 0;let n=e[r-1];for(let r of e)t+=(n.y+r.y)*(n.x-r.x),n=r;return .5*t}function o(e){let t=0,r=e.length;if(r<3)return 0;let n=e[r-1];for(let r of e)t+=(n.y+r.y)*(n.x-r.x),n=r;return .5*t}function p(e){let t="";for(let r of e)t+=l.toString(r);return t+"\n"}function m(e,t=2){let r="";for(let n of e)r+=u.toString(n,t);return r+"\n"}function h(e,t,r){let n=[];for(let i of e)n.push({x:i.x+t,y:i.y+r});return n}function f(e,t){return{left:Math.round(e.left*t),top:Math.round(e.top*t),right:Math.round(e.right*t),bottom:Math.round(e.bottom*t)}}function g(e,t){if(s.isAlmostZero(t-1))return e;let r=[];for(let n of e)r.push({x:Math.round(n.x*t),y:Math.round(n.y*t)});return r}function v(e,t){if(s.isAlmostZero(t-1))return e;let r=[];for(let n of e)r.push(u.scale(n,t));return r}function y(e,t){if(s.isAlmostZero(t-1))return e;let r=[];for(let n of e)r.push(v(n,t));return r}function b(e,t){let r=[];for(let n of e)r.push({x:Math.round(n.x*t),y:Math.round(n.y*t)});return r}function I(e,t){let r=[];for(let n of e)r.push(b(n,t));return r}function x(e,t){let r=[];for(let n of e)r.push({x:n.x*t,y:n.y*t});return r}function T(e){let t=[];for(let r of e)t.push(l.fromPointD(r));return t}function S(e){let t=[];for(let r of e)t.push(u.fromPoint64(r));return t}function w(e,t,r){let n=[];for(let i of e)n.push({x:i.x+t,y:i.y+r});return n}function O(e){return[...e].reverse()}function E(e){return[...e].reverse()}e.invalidRect64=P,e.invalidRectD=_,e.intersect=function(e,r,i){return t(n.Intersection,e,r,i)},e.intersectD=function(e,t,i,a=2){return r(n.Intersection,e,t,i,a)},e.union=function(e,r,i){return"number"==typeof r?t(n.Union,e,null,r):t(n.Union,e,r,i)},e.unionD=function(e,t,i,a){return"number"==typeof t?r(n.Union,e,null,t):r(n.Union,e,t,i,a||2)},e.difference=function(e,r,i){return t(n.Difference,e,r,i)},e.differenceD=function(e,t,i,a=2){return r(n.Difference,e,t,i,a)},e.xor=function(e,r,i){return t(n.Xor,e,r,i)},e.xorD=function(e,t,i,a=2){return r(n.Xor,e,t,i,a)},e.booleanOp=t,e.booleanOpWithPolyTree=function(e,t,r,n,a){if(null===t)return;let o=new W;o.addPaths(t,i.Subject),null!==r&&o.addPaths(r,i.Clip),o.execute(e,a,n)},e.booleanOpD=r,e.booleanOpDWithPolyTree=function(e,t,r,n,i,a=2){if(null===t)return;let o=new z(a);o.addSubjectPaths(t),null!==r&&o.addClipPaths(r),o.execute(e,i,n)},e.inflatePaths=function(e,t,r,n,i=2,a=0){let o=new j(i,a);o.addPaths(e,r,n);let s=[];return o.execute(t,s),s},e.inflatePathsD=function(e,t,r,n,i=2,a=2,o=0){s.checkPrecision(a);let l=Math.pow(10,a),u=I(e,l),c=new j(i,l*o);c.addPaths(u,r,n);let d=[];return c.execute(t*l,d),y(d,1/l)},e.rectClip=function e(t,r,n){if("left"in t&&"number"==typeof t.left&&Number.isInteger(t.left))return c.isEmpty(t)?[]:Array.isArray(r[0])?0===r.length?[]:new K(t).execute(r):0===r.length?[]:e(t,[r]);{let i=n||2;if(s.checkPrecision(i),d.isEmpty(t))return[];let a=Math.pow(10,i),o=f(t,a);if(Array.isArray(r[0])){if(0===r.length)return[];let e=I(r,a);return y(new K(o).execute(e),1/a)}return 0===r.length?[]:e(t,[r],i)}},e.rectClipLines=function e(t,r,n){if("left"in t&&"number"==typeof t.left&&Number.isInteger(t.left))return c.isEmpty(t)?[]:Array.isArray(r[0])?0===r.length?[]:new q(t).execute(r):0===r.length?[]:e(t,[r]);{let i=n||2;if(s.checkPrecision(i),d.isEmpty(t))return[];let a=Math.pow(10,i),o=f(t,a);if(Array.isArray(r[0])){if(0===r.length)return[];let e=I(r,a);return y(new q(o).execute(e),1/a)}return 0===r.length?[]:e(t,[r],i)}},e.minkowskiSum=function(e,t,r){return C.sum(e,t,r)},e.minkowskiSumD=function(e,t,r){return C.sumD(e,t,r)},e.minkowskiDiff=function(e,t,r){return C.diff(e,t,r)},e.minkowskiDiffD=function(e,t,r){return C.diffD(e,t,r)},e.area=a,e.areaPaths=function(e){let t=0;for(let r of e)t+=a(r);return t},e.areaD=o,e.areaPathsD=function(e){let t=0;for(let r of e)t+=o(r);return t},e.isPositive=function(e){return a(e)>=0},e.isPositiveD=function(e){return o(e)>=0},e.path64ToString=p,e.paths64ToString=function(e){let t="";for(let r of e)t+=p(r);return t},e.pathDToString=m,e.pathsDToString=function(e,t=2){let r="";for(let n of e)r+=m(n,t);return r},e.offsetPath=h,e.scalePoint64=function(e,t){return{x:Math.round(e.x*t),y:Math.round(e.y*t)}},e.scalePointD=function(e,t){return{x:e.x*t,y:e.y*t}},e.scaleRect=f,e.scalePath=g,e.scalePaths=function(e,t){if(s.isAlmostZero(t-1))return e;let r=[];for(let n of e)r.push(g(n,t));return r},e.scalePathD=v,e.scalePathsD=y,e.scalePath64=b,e.scalePaths64=I,e.scalePathDFromInt=x,e.scalePathsDFromInt=function(e,t){let r=[];for(let n of e)r.push(x(n,t));return r},e.path64FromD=T,e.paths64FromD=function(e){let t=[];for(let r of e)t.push(T(r));return t},e.pathsD=function(e){let t=[];for(let r of e)t.push(S(r));return t},e.pathD=S,e.translatePath=function(e,t,r){let n=[];for(let i of e)n.push({x:i.x+t,y:i.y+r});return n},e.translatePaths=function(e,t,r){let n=[];for(let i of e)n.push(h(i,t,r));return n},e.translatePathD=w,e.translatePathsD=function(e,t,r){let n=[];for(let i of e)n.push(w(i,t,r));return n},e.reversePath=O,e.reversePathD=E,e.reversePaths=function(e){let t=[];for(let r of e)t.push(O(r));return t},e.reversePathsD=function(e){let t=[];for(let r of e)t.push(E(r));return t},e.getBounds=function(e){return s.getBounds(e)},e.getBoundsPaths=function(e){let t=c.createInvalid();for(let r of e)for(let e of r)e.xt.right&&(t.right=e.x),e.yt.bottom&&(t.bottom=e.y);return t.left===Number.MAX_SAFE_INTEGER?{left:0,top:0,right:0,bottom:0}:t},e.getBoundsD=function(e){let t=d.createInvalid();for(let r of e)r.xt.right&&(t.right=r.x),r.yt.bottom&&(t.bottom=r.y);return Math.abs(t.left-Number.MAX_VALUE)t.right&&(t.right=e.x),e.yt.bottom&&(t.bottom=e.y);return Math.abs(t.left-Number.MAX_VALUE)0&&t.push(e.poly);for(let r=0;rr&&l.equals(t[r],t[n]);)a[n--]=!1;for(let e=r+1;er+1&&e(t,r,o,i,a),or&&u.equals(t[r],t[n]);)a[n--]=!1;for(let e=r+1;er+1&&e(t,r,o,i,a),o0&&r[e];)--e;if(!r[e])return e;for(e=t;r[e];)--e;return e}function U(e,t,r=!0){let n=e.length,i=n-1,a=t*t;if(n<4)return e;let o=Array(n).fill(!1),s=Array(n).fill(0),l=0;r?(s[0]=N(e[0],e[i],e[1]),s[i]=N(e[i],e[0],e[i-1])):(s[0]=Number.MAX_VALUE,s[i]=Number.MAX_VALUE);for(let t=1;ta){let e=l;do l=B(l,i,o);while(l!==e&&s[l]>a);if(l===e)break}let n=F(l,i,o),u=B(l,i,o);if(u===n)break;if(s[u]a){let e=l;do l=B(l,i,o);while(l!==e&&s[l]>a);if(l===e)break}let n=F(l,i,o),u=B(l,i,o);if(u===n)break;if(s[u]2&&s.isCollinear(i[i.length-1],i[i.length-2],i[0]);)i.pop();i.length<3&&(i.length=0)}else i.push(e[r-1]);return i}e.makePathD=function(e){let t=Math.floor(e.length/2),r=[];for(let n=0;n0&&r.push(t.poly);for(let n=0;n8?1e8:Math.pow(10,t)),{result:o,solution:s}=new J(r).execute(a);return i=o===A.success?y(s,1/n):[],{result:o,solution:i}}}(O||(O={}));let{intersect:Q,intersectD:ee,union:et,unionD:er,difference:en,differenceD:ei,xor:ea,xorD:eo,booleanOp:es,booleanOpWithPolyTree:el,booleanOpD:eu,booleanOpDWithPolyTree:ec,inflatePaths:ed,inflatePathsD:ep,rectClip:em,rectClipLines:eh,minkowskiSum:ef,minkowskiSumD:eg,minkowskiDiff:ev,minkowskiDiffD:ey,area:eb,areaPaths:eI,areaD:ex,areaPathsD:eC,isPositive:eA,isPositiveD:eT,getBounds:eS,getBoundsPaths:ew,getBoundsD:eO,getBoundsPathsD:eP,makePath:e_,makePathD:eE,scalePath64:eD,scalePaths64:eR,scalePathD:eM,scalePathsD:eN,translatePath:eV,translatePaths:eL,translatePathD:eB,translatePathsD:eF,reversePath:eU,reversePathD:ek,reversePaths:eG,reversePathsD:eW,stripDuplicates:ez,trimCollinear:eH,trimCollinearD:ej,pointInPolygon:e$,pointInPolygonD:eK,ellipse:eq,ellipseD:eX,simplifyPath:eY,simplifyPaths:eZ,simplifyPathD:eJ,simplifyPathsD:eQ,ramerDouglasPeucker:e0,ramerDouglasPeuckerPaths:e1,ramerDouglasPeuckerD:e2,ramerDouglasPeuckerPathsD:e5,triangulate:e3,triangulateD:e9}=O},94952:(e,t,r)=>{"use strict";r(4101),r(29010),r(87086)},95277:function(e,t,r){var n;!function(i,a,o){var s,l=o.pow(256,6),u=o.pow(2,52),c=2*u;function d(e,t,r){var n=[],d=h(function e(t,r){var n,i=[],a=typeof t;if(r&&"object"==a)for(n in t)try{i.push(e(t[n],r-1))}catch(e){}return i.length?i:"string"==a?t:t+"\0"}((t=!0==t?{entropy:!0}:t||{}).entropy?[e,f(a)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(256):(e=new Uint8Array(256),(i.crypto||i.msCrypto).getRandomValues(e)),f(e)}catch(e){var t=i.navigator,r=t&&t.plugins;return[+new Date,i,r,i.screen,f(a)]}}():e,3),n),g=new p(n),v=function(){for(var e=g.g(6),t=l,r=0;e=c;)e/=2,t/=2,r>>>=1;return(e+r)/t};return v.int32=function(){return 0|g.g(4)},v.quick=function(){return g.g(4)/0x100000000},v.double=v,h(f(g.S),a),(t.pass||r||function(e,t,r,n){return(n&&(n.S&&m(n,g),e.state=function(){return m(g,{})}),r)?(o.random=e,t):e})(v,d,"global"in t?t.global:this==o,t.state)}function p(e){var t,r=e.length,n=this,i=0,a=n.i=n.j=0,o=n.S=[];for(r||(e=[r++]);i<256;)o[i]=i++;for(i=0;i<256;i++)o[i]=o[a=255&a+e[i%r]+(t=o[i])],o[a]=t;(n.g=function(e){for(var t,r=0,i=n.i,a=n.j,o=n.S;e--;)t=o[i=255&i+1],r=256*r+o[255&(o[i]=o[a=255&a+t])+(o[a]=t)];return n.i=i,n.j=a,r})(256)}function m(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function h(e,t){for(var r,n=e+"",i=0;i{"use strict";r.d(t,{Yx:()=>o,cW:()=>s});var n=r(50923),i=r(85250),a=r(49963);function o(e){let t=0,r=0;for(let n=0;n<3;++n){let i=e.getRange(n),a=i[1]-i[0];t+=a*a;let o=.5*(i[1]+i[0]);r+=o*o}let n=t>0&&(Math.abs(r)/t>1e6||Math.abs(Math.log10(t))>3||0===t&&r>1e6);if(n){let t=new Float64Array(3),r=new Float64Array(3);for(let n=0;n<3;++n){let i=e.getRange(n),a=i[1]-i[0];t[n]=.5*(i[1]+i[0]),r[n]=a>0?1/a:1}return{useShiftAndScale:n,coordShift:t,coordScale:r}}return{useShiftAndScale:n,coordShift:new Float32Array([0,0,0]),coordScale:new Float32Array([1,1,1])}}function s(e,t){let r=new Float64Array(3);n.DI(r,t);let o=new Float64Array(16);return i.fromRotationTranslationScale(o,a.vt(),e,r),o}},95525:(e,t,r)=>{"use strict";function n(e,t,r,n){let o=!1,s=e[0]t[0]?e[0]:t[0],c=e[1]>t[1]?e[1]:t[1],d=r[0]n[0]?r[0]:n[0],h=r[1]>n[1]?r[1]:n[1];if(s>m||uh||c0?1:2}function a(e,t,r){return!!(t[0]<=Math.max(e[0],r[0])&&t[0]>=Math.min(e[0],r[0])&&t[1]<=Math.max(e[1],r[1])&&t[1]>=Math.min(e[1],r[1]))}r.d(t,{A:()=>n})},95663:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XMLDocument=t.Window=t.TreeWalker=t.Traverser=t.Text=t.StaticRange=t.ShadowRoot=t.Range=t.ProcessingInstruction=t.NodeListStatic=t.NodeList=t.NodeIterator=t.Node=t.NodeFilter=t.NamedNodeMap=t.MutationRecord=t.MutationObserver=t.HTMLCollection=t.EventTarget=t.Event=t.Element=t.DOMTokenList=t.DOMImplementation=t.dom=t.DocumentType=t.Document=t.DocumentFragment=t.CustomEvent=t.Comment=t.CharacterData=t.CDATASection=t.Attr=t.AbstractRange=t.AbortSignal=t.AbortController=void 0;let n=r(16950),i=r(13123);Object.defineProperty(t,"AbortController",{enumerable:!0,get:function(){return i.AbortControllerImpl}});let a=r(83567);Object.defineProperty(t,"AbortSignal",{enumerable:!0,get:function(){return a.AbortSignalImpl}});let o=r(31846);Object.defineProperty(t,"AbstractRange",{enumerable:!0,get:function(){return o.AbstractRangeImpl}});let s=r(71784);Object.defineProperty(t,"Attr",{enumerable:!0,get:function(){return s.AttrImpl}});let l=r(69287);Object.defineProperty(t,"CDATASection",{enumerable:!0,get:function(){return l.CDATASectionImpl}});let u=r(4530);Object.defineProperty(t,"CharacterData",{enumerable:!0,get:function(){return u.CharacterDataImpl}});let c=r(4515),d=r(14171);Object.defineProperty(t,"Comment",{enumerable:!0,get:function(){return d.CommentImpl}});let p=r(54620);Object.defineProperty(t,"CustomEvent",{enumerable:!0,get:function(){return p.CustomEventImpl}});let m=r(43918);Object.defineProperty(t,"DocumentFragment",{enumerable:!0,get:function(){return m.DocumentFragmentImpl}});let h=r(81294);Object.defineProperty(t,"Document",{enumerable:!0,get:function(){return h.DocumentImpl}});let f=r(2127),g=r(44862);Object.defineProperty(t,"DocumentType",{enumerable:!0,get:function(){return g.DocumentTypeImpl}});let v=r(60957);Object.defineProperty(t,"dom",{enumerable:!0,get:function(){return v.dom}});let y=r(76763);Object.defineProperty(t,"DOMImplementation",{enumerable:!0,get:function(){return y.DOMImplementationImpl}});let b=r(50138);Object.defineProperty(t,"DOMTokenList",{enumerable:!0,get:function(){return b.DOMTokenListImpl}});let I=r(83553);Object.defineProperty(t,"Element",{enumerable:!0,get:function(){return I.ElementImpl}});let x=r(48629);Object.defineProperty(t,"Event",{enumerable:!0,get:function(){return x.EventImpl}});let C=r(34976);Object.defineProperty(t,"EventTarget",{enumerable:!0,get:function(){return C.EventTargetImpl}});let A=r(11526);Object.defineProperty(t,"HTMLCollection",{enumerable:!0,get:function(){return A.HTMLCollectionImpl}});let T=r(60434);Object.defineProperty(t,"MutationObserver",{enumerable:!0,get:function(){return T.MutationObserverImpl}});let S=r(61273);Object.defineProperty(t,"MutationRecord",{enumerable:!0,get:function(){return S.MutationRecordImpl}});let w=r(62750);Object.defineProperty(t,"NamedNodeMap",{enumerable:!0,get:function(){return w.NamedNodeMapImpl}});let O=r(68937);Object.defineProperty(t,"NodeFilter",{enumerable:!0,get:function(){return O.NodeFilterImpl}});let P=r(92787);Object.defineProperty(t,"Node",{enumerable:!0,get:function(){return P.NodeImpl}});let _=r(22477);Object.defineProperty(t,"NodeIterator",{enumerable:!0,get:function(){return _.NodeIteratorImpl}});let E=r(19275);Object.defineProperty(t,"NodeList",{enumerable:!0,get:function(){return E.NodeListImpl}});let D=r(74709);Object.defineProperty(t,"NodeListStatic",{enumerable:!0,get:function(){return D.NodeListStaticImpl}});let R=r(5423),M=r(29302),N=r(18579),V=r(60780);Object.defineProperty(t,"ProcessingInstruction",{enumerable:!0,get:function(){return V.ProcessingInstructionImpl}});let L=r(58764);Object.defineProperty(t,"Range",{enumerable:!0,get:function(){return L.RangeImpl}});let B=r(11623);Object.defineProperty(t,"ShadowRoot",{enumerable:!0,get:function(){return B.ShadowRootImpl}});let F=r(61267),U=r(28790);Object.defineProperty(t,"StaticRange",{enumerable:!0,get:function(){return U.StaticRangeImpl}});let k=r(30696);Object.defineProperty(t,"Text",{enumerable:!0,get:function(){return k.TextImpl}});let G=r(38485);Object.defineProperty(t,"Traverser",{enumerable:!0,get:function(){return G.TraverserImpl}});let W=r(84745);Object.defineProperty(t,"TreeWalker",{enumerable:!0,get:function(){return W.TreeWalkerImpl}});let z=r(12323);Object.defineProperty(t,"Window",{enumerable:!0,get:function(){return z.WindowImpl}});let H=r(99445);Object.defineProperty(t,"XMLDocument",{enumerable:!0,get:function(){return H.XMLDocumentImpl}}),(0,n.applyMixin)(I.ElementImpl,c.ChildNodeImpl),(0,n.applyMixin)(u.CharacterDataImpl,c.ChildNodeImpl),(0,n.applyMixin)(g.DocumentTypeImpl,c.ChildNodeImpl),(0,n.applyMixin)(h.DocumentImpl,f.DocumentOrShadowRootImpl),(0,n.applyMixin)(B.ShadowRootImpl,f.DocumentOrShadowRootImpl),(0,n.applyMixin)(I.ElementImpl,R.NonDocumentTypeChildNodeImpl),(0,n.applyMixin)(u.CharacterDataImpl,R.NonDocumentTypeChildNodeImpl),(0,n.applyMixin)(h.DocumentImpl,M.NonElementParentNodeImpl),(0,n.applyMixin)(m.DocumentFragmentImpl,M.NonElementParentNodeImpl),(0,n.applyMixin)(h.DocumentImpl,N.ParentNodeImpl),(0,n.applyMixin)(m.DocumentFragmentImpl,N.ParentNodeImpl),(0,n.applyMixin)(I.ElementImpl,N.ParentNodeImpl),(0,n.applyMixin)(k.TextImpl,F.SlotableImpl),(0,n.applyMixin)(I.ElementImpl,F.SlotableImpl)},95917:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>m});var n=r(17042),i=r(11701),a=r(40815),o=r(30407),s=r(49963),{IntersectionState:l}=o.A;function u(e,t,r,n=null){let a,o={t:5e-324,distance:0},s=[];s[0]=r[0]-t[0],s[1]=r[1]-t[1],s[2]=r[2]-t[2];let l=s[0]*(e[0]-t[0])+s[1]*(e[1]-t[1])+s[2]*(e[2]-t[2]),c=(0,i.Om)(s,s),d=1e-5*l;return 0!==c&&(o.t=l/c),d<0&&(d=-d),-d1?a=r:(a=s,s[0]=t[0]+o.t*s[0],s[1]=t[1]+o.t*s[1],s[2]=t[2]+o.t*s[2]),n&&(n[0]=a[0],n[1]=a[1],n[2]=a[2]),o.distance=(0,i.fm)(a,e),o}function c(e,t,r,n,a,o){let s=[],c=[],d=[];a[0]=0,o[0]=0,(0,i.Re)(t,e,s),(0,i.Re)(n,r,c),(0,i.Re)(r,e,d);let p=[(0,i.Om)(s,s),-(0,i.Om)(s,c),-(0,i.Om)(s,c),(0,i.Om)(c,c)],m=[];if(m[0]=(0,i.Om)(s,d),m[1]=-(0,i.Om)(c,d),0===(0,i.rx)(p,m,2)){let i,s=Number.MAX_VALUE,c=[e,t,r,n],d=[r,r,e,e],p=[n,n,t,t],m=[o[0],o[0],a[0],a[0]],h=[a[0],a[0],o[0],o[0]];for(let e=0;e<4;e++)(i=u(c[e],d[e],p[e])).distance=0&&a[0]<=1&&o[0]>=0&&o[0]<=1)?l.YES_INTERSECTION:l.NO_INTERSECTION}var d={orientations:null};function p(e,t,r={}){Object.assign(t,d,r),a.Ay.extend(e,t,r),n.Ay.setGet(e,t,["orientations"]),t.classHierarchy.push("vtkLine"),e.getCellDimension=()=>1,e.intersectWithLine=(e,r,n,a,o)=>{var s;let d={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null};o[1]=0,o[2]=0;let p=[],m=[],h=[];t.points.getPoint(0,m),t.points.getPoint(1,h);let f=[],g=[],v=c(e,r,m,h,f,g);if(d.t=f[0],d.betweenPoints=(s=d.t)>=0&&s<=1,o[0]=g[0],v===l.YES_INTERSECTION){for(let t=0;t<3;t++)a[t]=m[t]+o[0]*(h[t]-m[t]),p[t]=e[t]+d.t*(r[t]-e[t]);(0,i.fm)(a,p)<=n*n&&(d.intersect=1)}else{let t;if(d.t<0)return(t=u(e,m,h,a)).distance<=n*n&&(d.t=0,d.intersect=1,d.betweenPoints=!0),d;if(d.t>1)return(t=u(r,m,h,a)).distance<=n*n&&(d.t=1,d.intersect=1,d.betweenPoints=!0),d;if(o[0]<0)return o[0]=0,d.t=(t=u(m,e,r,a)).t,t.distance<=n*n&&(d.intersect=1),d;o[0]>1&&(o[0]=1,d.t=(t=u(h,e,r,a)).t,t.distance<=n*n&&(d.intersect=1))}return d},e.evaluateLocation=(e,r,n)=>{let i=[],a=[];t.points.getPoint(0,i),t.points.getPoint(1,a);for(let t=0;t<3;t++)r[t]=i[t]+e[0]*(a[t]-i[t]);n[0]=1-e[0],n[1]=e[0]},e.evaluateOrientation=(e,r,n)=>!!t.orientations&&(s.nu(r,t.orientations[0],t.orientations[1],e[0]),n[0]=1-e[0],n[1]=e[0],!0)}var m={newInstance:n.Ay.newInstance(p,"vtkLine"),extend:p,...{distanceToLine:u,intersection:c},...o.A}},96158:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(91336);let i=(e,t,r,i)=>{let a=[e[0]-t[0],e[1]-t[1]],o=[r[0]-t[0],r[1]-t[1]],s=a[0]*o[0]+a[1]*o[1];if(s<0)return!1;let l=Math.sqrt(o[0]*o[0]+o[1]*o[1]);if(0===l)return!1;let u=s/l,c=[o[0]/l,o[1]/l],d=[c[0]*u,c[1]*u],p=[t[0]+d[0],t[1]+d[1]];return!(n.Io(e,p)>i||n.Io(t,p)>n.Io(t,r))}},96167:(e,t,r)=>{"use strict";var n;r.d(t,{T:()=>n}),function(e){e.VTK_IMAGE="vtkImage",e.VTK_VOLUME="vtkVolume",e.VTK_VOLUME_SLICE="vtkVolumeSlice",e.CPU_IMAGE="cpuImage",e.CPU_VOLUME="cpuVolume"}(n||(n={}))},96277:(e,t,r)=>{"use strict";r.d(t,{D:()=>_,z:()=>E});var n=r(7286);r(69955);var i=r(89473),a=r(12412),o=r(19047),s=r(73416),l=r(77280),u=r(3793),c=r(75972),d=r(31290);class p{async addData(e,t,r){let n=function(e){if(e.type===l.dC.SURFACE){let t=e.data,r=o.Ay.newInstance();r.getPoints().setData(t.points,3),r.setPolys(s.Ay.newInstance({values:Uint32Array.from(t.polys)}));let n=a.Ay.newInstance();n.setInputData(r);let l=i.Ay.newInstance();return l.setMapper(n),l.setVisibility(!1!==t.visible),l.getProperty().setColor(t.color[0]/255,t.color[1]/255,t.color[2]/255),[{actor:l,referencedId:e.id,uid:(0,u.A)()}]}if(e.type===l.dC.MESH)return e.data.actors.map((t,r)=>({actor:t,referencedId:e.id,uid:(0,u.A)()}));throw Error(`[VolumeViewport3D] Geometry type ${e.type} is not supported in 3D Next rendering`)}(t.geometry),c=function(e){let t=e.vtk.renderer;return!!(t.getActors?.().length||t.getVolumes?.().length)}(e);n.forEach(t=>{e.vtk.renderer.addActor(t.actor)}),c||e.vtk.renderer.resetCamera(),e.vtk.renderer.resetCameraClippingRange();let d={renderMode:"vtkGeometry3d",actors:n,frameOfReferenceUID:t.geometry.type===l.dC.SURFACE?t.geometry.data.frameOfReferenceUID:void 0};return{rendering:d,updateDataPresentation:e=>{this.updateDataPresentation(d,e)},applyViewState:t=>{this.applyViewState(e,t)},getFrameOfReferenceUID:()=>this.getFrameOfReferenceUID(d),render:()=>{this.render(e)},resize:()=>{this.resize(e)},removeData:()=>{this.removeData(e,d)}}}updateDataPresentation(e,t){var r,n;r=e,n=t,r.actors.forEach(e=>{let t=e.actor;t.setVisibility(n?.visible!==!1),n?.opacity!==void 0&&t.getProperty().setOpacity(n.opacity),n?.color&&t.getProperty().setColor(n.color[0]/255,n.color[1]/255,n.color[2]/255)})}applyViewState(e,t){(0,d.A)(e,t,{resetClippingRange:!0})}canvasToWorld(e,t){return(0,c.D)({canvas:e.vtk.canvas,renderer:e.vtk.renderer,canvasPos:t})}worldToCanvas(e,t){return(0,c.n)({canvas:e.vtk.canvas,renderer:e.vtk.renderer,worldPos:t})}getFrameOfReferenceUID(e){return e.frameOfReferenceUID}render(e){e.display.requestRender()}resize(e){e.display.requestRender()}removeData(e,t){t.actors.forEach(t=>{e.vtk.renderer.removeActor(t.actor)})}}class m{constructor(){this.id="volume3d:vtk-geometry",this.type=l.NV.VOLUME_3D_NEXT}matches(e,t){return"geometry"===e.type&&"vtkGeometry3d"===t.renderMode}createRenderPath(){return new p}selectContext(e){return e}}r(10054);var h=r(3922),f=r(62455),g=r(48320),v=r(60251),y=r(52219),b=r(11701),I=r(79267),x=r(42215),C=r(37995),A=r(55580),T=r(43505);class S{async addData(e,t,r){let n=e.vtk.renderer.getVolumes().length>0,i=await (0,y.A)({volumeId:t.volumeId},e.viewport.element,e.viewportId,!0),a=i.getMapper();if(e.vtk.renderer.addVolume(i),!n){let r=function(e,t){let r=t.imageData;if(!r)return;let n=e.vtk.renderer.getActiveCamera(),{viewPlaneNormal:i,viewUp:a}=function(e){let{fallbackViewPlaneNormal:t,fallbackViewUp:r,imageVolume:n,orientation:i}=e;if(!i)return{viewPlaneNormal:t,viewUp:r};if("object"==typeof i&&i.viewPlaneNormal)return{viewPlaneNormal:[...i.viewPlaneNormal],viewUp:i.viewUp?[...i.viewUp]:r};if(i===l.KY.ACQUISITION){let{direction:e}=n;return{viewPlaneNormal:e.slice(6,9).map(e=>-e),viewUp:e.slice(3,6).map(e=>-e)}}let a=i===l.KY.AXIAL_REFORMAT?I.T0.axial:i===l.KY.SAGITTAL_REFORMAT?I.T0.sagittal:i===l.KY.CORONAL_REFORMAT?I.T0.coronal:"string"==typeof i?I.T0[i]:void 0;return a?{viewPlaneNormal:[...a.viewPlaneNormal],viewUp:[...a.viewUp]}:{viewPlaneNormal:t,viewUp:r}}({fallbackViewPlaneNormal:n.getViewPlaneNormal(),fallbackViewUp:n.getViewUp(),imageVolume:t,orientation:e.viewport.options.orientation}),o=r.getBounds(),s=[0,0,0],u=r.getDimensions(),c=(0,A.G)(u,r.getDirection(),i);r.indexToWorld(c,s);let{widthWorld:d,heightWorld:p}=(0,C.H)(r,i,a),m=e.vtk.canvas.width||e.viewport.element.clientWidth||1,h=d/p/(m/(e.vtk.canvas.height||e.viewport.element.clientHeight||1)),f=(0,x.D0)().rendering?.useLegacyCameraFOV?1.1:1,g=10*function(e){let t=(e[1]-e[0])**2;return .5*Math.sqrt(t+(e[3]-e[2])**2+(e[5]-e[4])**2||1)}(o),v=f*g,y=Math.abs(b.Ay.dot(a,i))>.999?[-a[2],a[0],a[1]]:a,T=[s[0]+v*i[0],s[1]+v*i[1],s[2]+v*i[2]];return"setPhysicalScale"in n&&(n.setPhysicalScale(g),n.setPhysicalTranslation(-s[0],-s[1],-s[2])),{focalPoint:s,parallelProjection:e.viewport.options.parallelProjection??!0,parallelScale:h<1?f*p/2:f*p*h/2,position:T,viewAngle:90,viewPlaneNormal:i,viewUp:y}}(e,t.imageVolume);r&&O(e,r)}P(e);let o=i.getProperty().getRGBTransferFunction(0).getRange(),s={renderMode:"vtkVolume3d",actorEntryUID:(0,u.A)(),actor:i,defaultVOIRange:o?{lower:o[0],upper:o[1]}:void 0,imageVolume:t.imageVolume,mapper:a,removeStreamingSubscriptions:function(e,t){let r=r=>{let n=r.detail;n?.volumeId===e&&t()};return h.A.addEventListener(l.sV.IMAGE_VOLUME_MODIFIED,r),h.A.addEventListener(l.sV.IMAGE_VOLUME_LOADING_COMPLETED,r),()=>{h.A.removeEventListener(l.sV.IMAGE_VOLUME_MODIFIED,r),h.A.removeEventListener(l.sV.IMAGE_VOLUME_LOADING_COMPLETED,r)}}(t.volumeId,()=>{e.display.requestRender()})};return{rendering:s,updateDataPresentation:e=>{this.updateDataPresentation(s,e)},applyViewState:t=>{this.applyViewState(e,t)},getFrameOfReferenceUID:()=>this.getFrameOfReferenceUID(s),getImageData:()=>this.getImageData(s),render:()=>{this.render(e)},resize:()=>{this.resize(e)},removeData:()=>{this.removeData(e,s)}}}updateDataPresentation(e,t){!function(e,t){let{actor:r,defaultVOIRange:n}=e,i=r.getProperty(),a=t?.voiRange??n;if(r.setVisibility(t?.visible!==!1),t?.opacity!==void 0&&(0,v.updateOpacity)(r,t.opacity),!a)return;let o=(0,f.A)(a);t?.invert&&(0,g.A)(o),i.setRGBTransferFunction(0,o),t?.interpolationType!==void 0&&i.setInterpolationType(t.interpolationType),t?.sampleDistanceMultiplier!==void 0&&function(e,t){let r=e.getInputData?.();if(!r)return;let n=r.getSpacing(),i=(n[0]+n[1]+n[2])/6,a=Number.isFinite(t)?Math.max(t,.001):1;e.setSampleDistance(i*a)}(e.mapper,t.sampleDistanceMultiplier)}(e,t)}applyViewState(e,t){O(e,t)}canvasToWorld(e,t){return(0,c.D)({canvas:e.vtk.canvas,renderer:e.vtk.renderer,canvasPos:t})}worldToCanvas(e,t){return(0,c.n)({canvas:e.vtk.canvas,renderer:e.vtk.renderer,worldPos:t})}getFrameOfReferenceUID(e){return e.imageVolume.metadata?.FrameOfReferenceUID}getImageData(e){var t=e.imageVolume;let r=t.imageData;return r?{dimensions:r.getDimensions(),spacing:r.getSpacing(),origin:r.getOrigin(),direction:r.getDirection(),imageData:r,metadata:{Modality:t.metadata?.Modality,FrameOfReferenceUID:t.metadata?.FrameOfReferenceUID},get scalarData(){return t.voxelManager?.getScalarData()},scaling:t.scaling,hasPixelSpacing:t.hasPixelSpacing,voxelManager:t.voxelManager}:void 0}render(e){e.display.requestRender()}resize(e){e.display.requestRender()}removeData(e,t){let{actor:r,removeStreamingSubscriptions:n}=t;n?.(),e.vtk.renderer.removeVolume(r)}}class w{constructor(){this.id="volume3d:vtk-volume",this.type=l.NV.VOLUME_3D_NEXT}matches(e,t){return"image"===e.type&&"vtkVolume3d"===t.renderMode}createRenderPath(){return new S}selectContext(e){return e}}function O(e,t){(0,d.A)(e,t),t&&void 0===t.clippingRange&&P(e)}function P(e){(0,T.A)(e.vtk.renderer.getActiveCamera())}function _(){return[new w,new m]}function E(e=_()){return new n.r(e)}},96310:(e,t,r)=>{"use strict";r(4453),r(42018)},96313:(e,t,r)=>{"use strict";r(70192),r(23537),r(78378),r(760),r(35558),r(43385),r(5800),r(51889)},96446:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});class n{constructor(e={}){this._dimensions=3,this._length=0,this._byteSize=4,this.growSize=128;let{initialSize:t=1024,dimensions:r=3,growSize:n=128}=e;this.growSize=n,this.array=new ArrayBuffer(t*r*this._byteSize),this.data=new Float32Array(this.array),this._dimensions=r}forEach(e){for(let t=0;t=this._length)return;let t=this._dimensions*e;return this.data.subarray(t,t+this._dimensions)}getPointArray(e){let t=[];if(e<0&&(e+=this._length),e<0||e>=this._length)return;let r=this._dimensions*e;for(let e=0;ee)}toXYZ(){let e={x:[],y:[]};this._dimensions>=3&&(e.z=[]);let{x:t,y:r,z:n}=e;return this.forEach(e=>{t.push(e[0]),r.push(e[1]),n&&n.push(e[2])}),e}static fromXYZ({x:e,y:t,z:r}){let i=n.create3(e.length),a=0;for(let n=0;nr.push(e)),r}static create2(e=128){return new n({initialSize:e,dimensions:2})}}},96674:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(59061);function i(e,t){for(let r=0,i=t.length;r{"use strict";r.d(t,{KP:()=>o,SJ:()=>a});var n=r(39216),i=r(77280);function a(e){let t=n.get(i.nb.IMAGE_PLANE,e);if(void 0!==t.usingDefaultValues||t.columnPixelSpacing&&t.rowPixelSpacing&&t.columnCosines&&t.rowCosines&&t.imagePositionPatient&&t.imageOrientationPatient)return t;let r={...t,usingDefaultValues:!0};return r.columnPixelSpacing||=1,r.rowPixelSpacing||=1,r.columnCosines||=[0,1,0],r.rowCosines||=[1,0,0],r.imagePositionPatient||=[0,0,0],r.imageOrientationPatient||=new Float32Array([1,0,0,0,1,0]),r}function o(e){let t=e.imageId,{pixelRepresentation:r,bitsAllocated:o,bitsStored:s,highBit:l,photometricInterpretation:u,samplesPerPixel:c}=n.get(i.nb.IMAGE_PIXEL,t),{windowWidth:d,windowCenter:p,voiLUTFunction:m}=e,{modality:h}=n.get(i.nb.GENERAL_SERIES,t),f=n.get(i.nb.SCALING,t),g=n.get(i.nb.CALIBRATION,t),v=Object.values(i.yX).includes(m)?m:i.yX.LINEAR;return{calibration:g,scalingFactor:f,voiLUTFunction:v,modality:h,imagePlaneModule:a(t),imagePixelModule:{bitsAllocated:o,bitsStored:s,samplesPerPixel:c,highBit:l,photometricInterpretation:u,pixelRepresentation:r,windowWidth:d,windowCenter:p,modality:h,voiLUTFunction:v}}}},97140:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(50923),i=r(85250),a=r(15005),o=r(39216);let s=function(e,t){let r=e.getSliceIndex(),s=t.getSliceIndex(),l=(0,o.get)("imagePlaneModule",r.toString()),u=(0,o.get)("imagePlaneModule",s.toString());if(!l||!u)return void console.log("Viewport spatial registration requires image plane module");let{imageOrientationPatient:c}=u;if(!l.imageOrientationPatient.every((e,t)=>.05>Math.abs(e-c[t])))return void console.log("Viewport spatial registration only supported for same orientation (hence translation only) for now",l?.imageOrientationPatient,u?.imageOrientationPatient);let d=l.imagePositionPatient,p=u.imagePositionPatient,m=n.Re(n.vt(),d,p),h=i.fromTranslation(i.create(),m);a.A.add([e.id,t.id],h)}},97470:(e,t,r)=>{"use strict";r.d(t,{A:()=>Y});var n=r(77280),i=r(1705),a=r(10115),o=r(50987),s=r(54268),l=r(21483),u=r(62553),c=r(35972),d=r(18025),p=r(69228),m=r(3922),h=r(37190),f=r(73502),g=r(79657),v=r(53725),y=r(6297),b=r(685),I=r(8735),x=r(50923),C=r(42215),A=r(39216),T=r(38744);class S{select(e,t={}){var r;if(!e.imageIds.length)throw Error("[PlanarViewport] Cannot add an empty planar dataset");let i=t.orientation||n.KY.ACQUISITION,a=O(e.imageIds),o=(r=e).volumeId||s.Ay.generateVolumeId(r.imageIds),l=i===n.KY.ACQUISITION||void 0!==a&&i===a,u=_(e,l);if(!l&&!u&&!e.useWorldCoordinateImageData)throw Error("[PlanarViewport] Non-acquisition rendering requires a valid volume dataset");if(u&&!P(e))throw Error("[PlanarViewport] Volume rendering requires a valid volume dataset");return{acquisitionOrientation:a,renderMode:u?this.selectVolumeRenderMode(t):this.selectImageRenderMode(t),volumeId:o}}canRender(e,t={}){if(!e.imageIds.length)return!1;let r=t.orientation||n.KY.ACQUISITION,i=O(e.imageIds),a=r===n.KY.ACQUISITION||void 0!==i&&r===i,o=_(e,a);return(!!a||!!o||!!e.useWorldCoordinateImageData)&&(!o||!!P(e))}selectImageRenderMode(e){return(0,a.pI)(this.resolveBackend(e),"image")}selectVolumeRenderMode(e){return(0,a.pI)(this.resolveBackend(e),"volume")}resolveBackend(e){return(0,C.cz)(e.renderBackend)}}let w=new S;function O(e){let t=e[0];if(!t)return;let r=A.get("imagePlaneModule",t),i=r?.imageOrientationPatient;if(!i||6!==i.length)return;let a=x.fA(i[0],i[1],i[2]),o=x.fA(i[3],i[4],i[5]),s=x.vt();x.$A(s,a,o);let l=(0,g.sB)([s[0],s[1],s[2]]);if(l===n.KY.AXIAL||l===n.KY.CORONAL||l===n.KY.SAGITTAL)return l}function P(e){return!!(e.volumeId&&s.Ay.getVolume(e.volumeId))||(0,T.p)(e.imageIds)}function _(e,t){return!e.useWorldCoordinateImageData&&(!!e.volumeId||!t&&P(e))}var E=r(33308),D=r(59698),R=r(98115),M=r(9638),N=r(85271),V=r(24346),L=r(68456);class B{constructor(e){this.host=e}resolveBindingRole(e){return"source"===e.role?"source":"overlay"}getActiveDataId(){return this.sourceDataId}clearActiveDataId(){this.sourceDataId=void 0}getCurrentBinding(){return this.sourceDataId?this.host.getBinding(this.sourceDataId)??this.host.getFirstBinding():this.host.getFirstBinding()}getFirstBoundDataId(){for(let[e]of this.host.getBindings())return e}hasBinding(e){return!!this.host.getBinding(e)}promoteSourceDataId(e){for(let[t,r]of this.host.getBindings())r.role=t===e?"source":"overlay";this.sourceDataId=e}handleRemovedData(e){this.sourceDataId===e&&(this.sourceDataId=void 0,this.promoteFirstAvailableBindingToSource())}removeBindingsExcept(e){for(let t of Array.from(this.host.getBindings(),([e])=>e))e.has(t)||this.host.removeData(t)}getActorForDataId(e){let t=this.host.getBinding(e);return t?.getActorEntry?.(t.data)}getBindingActor(e){let t=this.host.getBinding(e)?.rendering;return t?.actor??t?.compatibilityActor}getActors(){return[...this.getProjectedActorEntries("source"),...this.getProjectedActorEntries("overlay")]}getDefaultActor(){return this.getProjectedActorEntries("source")[0]??this.getProjectedActorEntries()[0]}getProjectedActorEntries(e){let t=[];for(let[,r]of this.host.getBindings()){if(e&&r.role!==e)continue;let n=r.getActorEntry?.(r.data);n&&t.push(n)}return t}findBindingDataIdByActorEntryUID(e){for(let[t,r]of this.host.getBindings()){let n=r.getActorEntry?.(r.data);if(n?.uid===e)return t}}findDataIdByVolumeId(e){for(let[t,r]of this.host.getBindings())if(r.data?.volumeId===e)return t}getDefaultVOIRange(e){let t=e??this.sourceDataId??this.getCurrentBinding()?.data.id,r=t?this.host.getBinding(t)?.rendering:void 0,n=r?.defaultVOIRange;return n?{...n}:void 0}promoteFirstAvailableBindingToSource(){let e=this.getFirstBoundDataId();e&&this.promoteSourceDataId(e)}}var F=r(47241),U=r(88824),k=r(31906),G=r(92557),W=r(73265);function z(e){var t;let{rendering:r,viewRefSpecifier:n}=e;if(!r)return;let a=(t=e.data,t?.imageVolume?.imageIds||t?.imageIds||[]);if(!a.length)return;if(r.renderMode===i.T.CPU_IMAGE||r.renderMode===i.T.VTK_IMAGE){let t="number"==typeof n?.sliceIndex?Math.min(Math.max(0,n.sliceIndex),a.length-1):e.viewState?.slice?.kind==="stackIndex"?Math.min(Math.max(0,e.viewState.slice.imageIdIndex),a.length-1):H(r);return a[t]}let o=$({viewState:e.viewState,data:e.data,frameOfReferenceUID:e.frameOfReferenceUID,renderContext:e.renderContext,rendering:r,sliceIndex:n?.sliceIndex})?.toICamera();return o?.focalPoint&&o.viewPlaneNormal?(0,F.A)(r.imageVolume,o.focalPoint,o.viewPlaneNormal):a[Math.min(H(r),a.length-1)]}function H(e){return e.currentImageIdIndex}function j(e){if(e)return[e[0],e[1],e[2]]}function $(e){return(0,V.a8)(e)}class K{constructor(e){this.host=e}getVolumeId(e={}){return this.getPlanarReferenceContext(e)?.data.volumeId??this.getCurrentPlanarReferenceContext()?.data.volumeId}getCurrentImageId(e={}){let t=this.getPlanarReferenceContext(e);return z({viewState:this.host.getViewState(),data:t?.data,frameOfReferenceUID:t?.frameOfReferenceUID,rendering:t?.rendering,renderContext:this.host.getRenderContext(),viewRefSpecifier:e})}getViewReference(e={}){let t=this.getPlanarReferenceContext(e);return function(e){let{frameOfReferenceUID:t,rendering:r,viewRefSpecifier:n}=e,{dimensionGroupNumber:a}=(0,k.k)(e.data?.imageVolume),o=n?.sliceIndex??(r?H(r):void 0),s=n?.rangeEndSliceIndex,l=$({...e,sliceIndex:o})?.toICamera(),c=j(l?.focalPoint),d=j(l?.viewPlaneNormal),p=j(l?.viewUp),m=p&&d?j(x.$A(x.vt(),p,d)):void 0,h={FrameOfReferenceUID:t,dataId:e.dataId,dimensionGroupNumber:a,cameraFocalPoint:c,viewPlaneNormal:d,viewUp:p,sliceIndex:o,planeRestriction:d&&p&&c?{FrameOfReferenceUID:t,point:j(n?.points?.[0])||c,inPlaneVector1:p,inPlaneVector2:m}:void 0},f=z(e),g="number"==typeof o&&"number"==typeof s&&s>o?z({...e,viewRefSpecifier:{...n,sliceIndex:s}}):void 0;return r&&(r.renderMode===i.T.CPU_VOLUME||r.renderMode===i.T.VTK_VOLUME_SLICE)&&n?.forFrameOfReference!==!0&&(h.volumeId=e.data?.volumeId),f&&(h.referencedImageId=f,h.referencedImageURI=(0,u.A)(f)),g&&"number"==typeof s&&"number"==typeof o&&s>o&&(h.multiSliceReference={FrameOfReferenceUID:t,referencedImageId:g,referencedImageURI:(0,u.A)(g),sliceIndex:s}),n?.points&&h.planeRestriction&&(0,W.O)(n.points,h),h}({viewState:this.host.getViewState(),dataId:t?.dataId,frameOfReferenceUID:t?.frameOfReferenceUID??this.getFrameOfReferenceUID(),data:t?.data,rendering:t?.rendering,renderContext:this.host.getRenderContext(),viewRefSpecifier:e})}getViewReferenceId(e={}){let t=this.getPlanarReferenceContext(e);return function(e){let{rendering:t,viewRefSpecifier:r}=e;if(!t)return null;if(t.renderMode===i.T.CPU_VOLUME||t.renderMode===i.T.VTK_VOLUME_SLICE){let n=$({...e,sliceIndex:r?.sliceIndex})?.toICamera(),i=r?.sliceIndex??H(t),a=e.data?.volumeId;return a&&n?.viewPlaneNormal?(0,G.A)({sliceIndex:i,viewPlaneNormal:n.viewPlaneNormal,volumeId:a}):null}let n=z(e);return n?`imageId:${n}`:null}({viewState:this.host.getViewState(),frameOfReferenceUID:t?.frameOfReferenceUID,data:t?.data,rendering:t?.rendering,renderContext:this.host.getRenderContext(),viewRefSpecifier:e})}setViewReference(e){if(!e)return;let t=this.resolveViewReferenceContext(e);if(!t)return;let r=this.activatePlanarReferenceContext(t.dataId),n=this.applyViewReferenceToCurrentBinding(e);r&&!n&&this.host.render()}getFrameOfReferenceUID(){let e=this.resolveFrameOfReferenceUID();return this.host.getResolvedView({frameOfReferenceUID:e})?.getFrameOfReferenceUID()??e}resolveFrameOfReferenceUID(){let e=this.host.getCurrentBinding();return e?.getFrameOfReferenceUID()??`${this.host.viewportType}-viewport-${this.host.viewportId}`}isPlaneViewable(e,t){return function(e){let{frameOfReferenceUID:t,options:r,planeRestriction:n}=e;if(n.FrameOfReferenceUID!==t)return!1;let{focalPoint:i,viewPlaneNormal:a}=$(e)?.toICamera()||{};if(!i||!a)return!1;if(r?.withOrientation)return!0;if(n.inPlaneVector1&&!(0,U.Ay)(0,x.Om(a,n.inPlaneVector1))||n.inPlaneVector2&&!(0,U.Ay)(0,x.Om(a,n.inPlaneVector2)))return!1;if(r?.withNavigation)return!0;let{point:o}=n,s=x.jb(x.vt(),o,i);return(0,U.Ay)(0,x.Om(s,a))}({viewState:this.host.getViewState(),frameOfReferenceUID:this.getFrameOfReferenceUID(),options:t,planeRestriction:e,rendering:this.getCurrentPlanarRendering(),renderContext:this.host.getRenderContext()})}getReferenceViewContexts(e){let t=this.getAllPlanarReferenceContexts();return t.length?t.map(e=>this.getGenericViewportReferenceContext(e)):e}getPlanarReferenceContext(e={}){return e.volumeId?this.findPlanarReferenceContextByVolumeId(e.volumeId)??this.getCurrentPlanarReferenceContext():this.getCurrentPlanarReferenceContext()}getCurrentPlanarReferenceContext(){let e=this.host.getActiveDataId();if(e){let t=this.getPlanarReferenceContextByDataId(e);if(t)return t}for(let[e]of this.host.getBindings())return this.getPlanarReferenceContextByDataId(e)}getPlanarReferenceContextByDataId(e){let t=this.host.getBinding(e);if(t)return{dataId:e,data:t.data,frameOfReferenceUID:t.getFrameOfReferenceUID()??`${this.host.viewportType}-viewport-${this.host.viewportId}`,rendering:t.rendering}}getAllPlanarReferenceContexts(){let e=[];for(let[t]of this.host.getBindings()){let r=this.getPlanarReferenceContextByDataId(t);r&&e.push(r)}return e}getGenericViewportReferenceContext(e){let t=(0,V.a8)({viewState:this.host.getViewState(),data:e.data,frameOfReferenceUID:e.frameOfReferenceUID,rendering:e.rendering,renderContext:this.host.getRenderContext()})?.toICamera(),r=e.data.volumeId;return{dataId:e.dataId,dataIds:[e.data.id],frameOfReferenceUID:e.frameOfReferenceUID,imageIds:this.getImageIdsForReferenceContext(e),currentImageIdIndex:e.rendering.currentImageIdIndex,volumeId:r,volumeIds:r?[r]:void 0,cameraFocalPoint:t?.focalPoint,viewPlaneNormal:t?.viewPlaneNormal,...(0,k.k)(e.data.imageVolume)}}findPlanarReferenceContextByVolumeId(e){for(let[t,r]of this.host.getBindings())if(r.data.volumeId===e)return this.getPlanarReferenceContextByDataId(t)}findPlanarReferenceContextByImageReference(e,t){let r=t||(e?(0,u.A)(e):void 0);if(r){for(let e of this.getAllPlanarReferenceContexts())if(this.getImageIdsForReferenceContext(e).some(e=>(0,u.A)(e)===r))return e}}resolveViewReferenceContext(e){if(e.dataId){let t=this.getPlanarReferenceContextByDataId(e.dataId);if(t)return t}if(e.volumeId){let t=this.findPlanarReferenceContextByVolumeId(e.volumeId);if(t)return t}let t=this.findPlanarReferenceContextByImageReference(e.referencedImageId,e.referencedImageURI);if(t)return t;let r=this.getCurrentPlanarReferenceContext();if(!e.FrameOfReferenceUID||r?.frameOfReferenceUID===e.FrameOfReferenceUID)return r}activatePlanarReferenceContext(e){return this.host.getActiveDataId()!==e&&(this.host.promoteSourceDataId(e),this.host.updateBindingsCameraState(),!0)}applyViewReferenceToCurrentBinding(e){let t=this.getCurrentPlanarReferenceContext();if(!t||e.FrameOfReferenceUID&&t.frameOfReferenceUID!==e.FrameOfReferenceUID)return!1;let{rendering:r}=t;return r.renderMode===i.T.CPU_IMAGE||r.renderMode===i.T.VTK_IMAGE?this.applyImageViewReference(t,e):this.applyVolumeViewReference(t,e)}applyImageViewReference(e,t){let r=this.getImageIdsForReferenceContext(e),n=this.findImageIdIndexByReference(r,t.referencedImageId,t.referencedImageURI);return"number"==typeof n?(this.host.setImageIdIndex(n),!0):"number"==typeof t.sliceIndex&&(this.host.setImageIdIndex(t.sliceIndex),!0)}applyVolumeViewReference(e,t){let r=this.normalizeVolumeViewReference(e,t),n=this.host.getResolvedView({frameOfReferenceUID:e.frameOfReferenceUID})?.toICamera();if(!n?.viewPlaneNormal)return!1;let i=n.viewPlaneNormal,a=r.viewPlaneNormal,o=a&&!this.areNormalsEqual(i,a)&&!this.areNormalsOpposite(i,a),s=a??i,l=!o&&this.areNormalsOpposite(i,s),u=this.resolveVolumeReferenceSliceTarget(e,r,s,l),c={};o&&a&&(c.orientation={viewPlaneNormal:[...a],...r.viewUp?{viewUp:[...r.viewUp]}:{}});let d=r.cameraFocalPoint??u?.sliceWorldPoint??("number"==typeof u?.imageIdIndex?this.host.getVolumeSliceWorldPointForImageIdIndex(u.imageIdIndex):void 0);return d&&(c.slice={kind:"volumePoint",sliceWorldPoint:[...d]}),!!Object.keys(c).length&&(this.host.setViewState(c),!0)}normalizeVolumeViewReference(e,t){if(!t.planeRestriction||t.viewPlaneNormal)return t;let r=this.deriveOrientationFromPlaneRestriction(e,t.planeRestriction);return{...t,cameraFocalPoint:t.cameraFocalPoint??t.planeRestriction.point,...r}}deriveOrientationFromPlaneRestriction(e,t){let r,n=this.host.getResolvedView({frameOfReferenceUID:e.frameOfReferenceUID})?.toICamera(),i=n?.viewPlaneNormal,a=n?.viewUp,{inPlaneVector1:o,inPlaneVector2:s}=t,l={};if(i&&this.isPlaneRestrictionCompatibleWithNormal(t,i))return l.viewPlaneNormal=[...i],o?l.viewUp=[...o]:a&&(l.viewUp=[...a]),l;if(o&&s){let e=x.$A(x.vt(),s,o);x.Bw(e)>0&&(x.S8(e,e),r=[...e])}else if(o&&i){let e=x.$A(x.vt(),i,o);x.Bw(e)>0&&(x.S8(e,e),r=[...e])}return r&&(l.viewPlaneNormal=r),o?l.viewUp=[...o]:a&&(l.viewUp=[...a]),l}isPlaneRestrictionCompatibleWithNormal(e,t){return(!e.inPlaneVector1||(0,U.Ay)(0,x.Om(t,e.inPlaneVector1)))&&(!e.inPlaneVector2||(0,U.Ay)(0,x.Om(t,e.inPlaneVector2)))}resolveVolumeReferenceSliceTarget(e,t,r,n){let{rendering:a}=e;if(a.renderMode!==i.T.CPU_VOLUME&&a.renderMode!==i.T.VTK_VOLUME_SLICE)return;let o=this.getImageIdsForReferenceContext(e),s=a.maxImageIdIndex;if("number"==typeof t.sliceIndex&&t.volumeId===e.data.volumeId&&t.viewPlaneNormal)return{imageIdIndex:Math.min(Math.max(0,n?s-t.sliceIndex:t.sliceIndex),s)};let l=this.findImageIdIndexByReference(o,t.referencedImageId,t.referencedImageURI);if("number"==typeof l)return this.toVolumeSliceTarget(a.imageVolume,l);let u=t.cameraFocalPoint??t.planeRestriction?.point;if(u){let e=(0,F.A)(a.imageVolume,u,r),t=this.findImageIdIndexByReference(o,e);return"number"==typeof t?this.toVolumeSliceTarget(a.imageVolume,t):void 0}if("number"==typeof t.sliceIndex)return{imageIdIndex:Math.min(Math.max(0,t.sliceIndex),s)}}toVolumeSliceTarget(e,t){let r=(0,L.xH)(e,t);return r?{sliceWorldPoint:r}:{imageIdIndex:t}}getImageIdsForReferenceContext(e){return e.data.imageVolume?.imageIds||e.data.imageIds}findImageIdIndexByReference(e,t,r){let n=r||(t?(0,u.A)(t):void 0);if(!n)return;let i=e.findIndex(e=>(0,u.A)(e)===n);return i>=0?i:void 0}getCurrentPlanarRendering(){return this.host.getCurrentBinding()?.rendering}areNormalsEqual(e,t){return!!(e&&t&&(0,U.Ay)(e,t))}areNormalsOpposite(e,t){return!!e&&!!t&&(0,U.Ay)(x.ze(x.vt(),e),t)}}class q extends v.A{static get useCustomRenderingPipeline(){return!1}constructor(e){super(e),this.type=n.NV.PLANAR_NEXT,this.suppressEvents=!1,this.resolvedViewCacheRevision=0,this.setDataRequestId=0,this.renderPipelineSwapId=0,this.lastRenderPathErrorByDataId=new Map,this.mountOptionsByDataId=new Map,this.renderingEngineId=e.renderingEngineId,this.canvas=e.canvas,this.sWidth=e.sWidth,this.sHeight=e.sHeight,this.defaultOptions=X(e.defaultOptions||{}),this.options=X(this.defaultOptions),this.canvasToWorld=this.canvasToWorld.bind(this),this.worldToCanvas=this.worldToCanvas.bind(this),this.dataProvider=e.dataProvider||new b.x,this.renderPathResolver=e.renderPathResolver||(0,I.I)(),this.mountedData=new B({getBinding:e=>this.getBinding(e),getFirstBinding:()=>this.getFirstBinding(),getBindings:()=>this.bindings.entries(),removeData:e=>this.removeData(e)}),this.viewReferences=new K({viewportId:this.id,viewportType:this.type,getActiveDataId:()=>this.mountedData.getActiveDataId(),getBinding:e=>this.getBinding(e),getBindings:()=>this.bindings.entries(),getCurrentBinding:()=>this.getCurrentBinding(),getRenderContext:()=>this.renderContext,getResolvedView:e=>this.getResolvedView(e),getViewState:()=>this.viewState,getVolumeSliceWorldPointForImageIdIndex:e=>this.getVolumeSliceWorldPointForImageIdIndex(e),promoteSourceDataId:e=>{this.clearResolvedViewCache(),this.mountedData.promoteSourceDataId(e)},render:()=>this.render(),setImageIdIndex:e=>this.setImageIdIndex(e),setViewState:e=>this.setViewState(e),updateBindingsCameraState:()=>this.updateBindingsCameraState()});let t=f.A.get(this.renderingEngineId),r=t?.getRenderer(this.id);if(!r)throw Error("[PlanarViewport] No renderer available. Ensure WebGL is supported and the rendering engine has been properly initialized.");this.element.style.position=this.element.style.position||"relative",this.element.style.overflow="hidden",this.element.style.background=this.element.style.background||"#000",this.element.style.isolation="isolate";let a=e.canvas,o=this.element.querySelector(".viewport-element"),s=document.createElement("canvas");s.style.display="none",s.style.height="100%",s.style.inset="0",s.style.pointerEvents="none",s.style.position="absolute",s.style.width="100%",s.style.zIndex="0",this.element.appendChild(s),this.cpuCanvas=s,o&&(o.style.position=o.style.position||"relative",o.style.zIndex="1");let l=s.getContext("2d");if(!l)throw Error("[PlanarViewport] Failed to initialize CPU canvas");r.getActiveCamera().setParallelProjection(!0),this.renderContext={viewportId:this.id,renderingEngineId:this.renderingEngineId,type:"planar",viewport:{element:this.element,getActiveDataId:()=>this.mountedData.getActiveDataId(),invalidateResolvedView:()=>this.clearResolvedViewCache(),getViewState:()=>this.getViewState(),isCurrentDataId:e=>this.getCurrentBinding()?.data.id===e,getOverlayActors:()=>this.mountedData.getProjectedActorEntries("overlay")},renderPath:{renderMode:i.T.VTK_IMAGE},view:{},display:{requestRender:()=>{this.requestRenderingEngineRender()},renderNow:()=>{this.render()},setNeedsRender:()=>{this.setNeedsRender()},markRendered:()=>{this.setRendered()},activateRenderMode:e=>{this.renderContext.renderPath.renderMode=e,this.setRenderModeVisibility(e,s,a)}},cpu:{canvas:s,composition:{clearedRenderPassId:-1,renderPassId:0},context:l},vtk:{renderer:r,canvas:a}},this.viewState=(0,R.Kh)({...(0,R.Mn)(),orientation:this.resolveRequestedOrientation()}),this.setRenderModeVisibility(i.T.VTK_IMAGE,s,a),this.element.setAttribute("data-viewport-uid",this.id),this.element.setAttribute("data-rendering-engine-uid",this.renderingEngineId),this.resize()}async setDisplaySets(...e){let t=++this.setDataRequestId,r=()=>t!==this.setDataRequestId;for(let[t,{displaySetId:n,options:i={}}]of(this.clearResolvedViewCache(),this.removeReplaceableData(e),e.entries())){if(r())return;let e=i.role??(0===t?"source":"overlay");await this.addDisplaySetInternal(n,{...i,role:e},r)}}async addDisplaySet(e,t={}){await this.addDisplaySetInternal(e,t),this.clearResolvedViewCache()}async addDisplaySetInternal(e,t={},r){let n=this.mountedData.resolveBindingRole(t),i={...t,role:n},{data:a,resolvedOrientation:o,selectedPath:s}=await this.loadPlanarData(e,i);if(r?.()||("source"===n&&(this.mountedData.promoteSourceDataId(e),this.applyLoadedPlanarViewState(o,a,s)),!await this.addLoadedData(e,a,{renderMode:s.renderMode,role:n},r)))return;this.mountOptionsByDataId.set(e,i),this.clearResolvedViewCache(),this.setDefaultDataPresentation(e,{visible:!0});let l=this.getDisplaySetPresentation(e),u=l?.voiRange??this.getDefaultVOIRange(e);u&&this.notifyDataPresentationModified(e,{voiRange:u}),"source"===n&&this.triggerCameraModifiedEvent(this.getCameraForEvent())}removeData(e){this.clearResolvedViewCache(),this.mountOptionsByDataId.delete(e),this.lastRenderPathErrorByDataId.delete(e),super.removeData(e),this.mountedData.handleRemovedData(e),!this.isDestroyed&&this.getCurrentBinding()&&this.updateBindingsCameraState()}getActors(){return this.mountedData.getActors()}getDefaultActor(){return this.mountedData.getDefaultActor()}getImageActor(e){let t=this.getActors(),r=t[0];return(e&&(r=t.find(t=>t.referencedId===e)??this.mountedData.getActorForDataId(e)),r&&(0,o.e)(r))?r.actor:null}getDefaultImageData(){return this.getImageActor()?.getMapper().getInputData()}renderImageObject(e){let t=`image-object:${this.id}:${(0,u.A)(e.imageId)}`;return this.renderImageObjectDataId&&this.renderImageObjectDataId!==t&&d.A.remove(this.renderImageObjectDataId),this.renderImageObjectDataId=t,d.A.add(t,{image:e,imageIds:[e.imageId],initialImageIdIndex:0,kind:"planar"}),this.setDisplaySets({displaySetId:t,options:{orientation:this.resolveRequestedOrientation()}})}getCanvas(){let e=this.getCurrentPlanarRendering();return"cpu"===(0,a.cg)(e?.renderMode)?this.renderContext.cpu.canvas:this.renderContext.vtk.canvas}async addImages(e){let t=this.getCurrentPlanarRendering(),r=t?.renderMode;if((0,a.Fi)(r)||(0,a.mK)(r)&&"cpu"!==(0,a.cg)(r)){for(let t of e){let e=this.resolveStackInputImage(t);if(!e)continue;let r=this.resolveOverlayReference(t,e),n=this.resolveOverlayDataId(t,e,r);d.A.add(n,{image:e,imageData:t.imageData,imageIds:[t.imageId],initialImageIdIndex:0,kind:"planar",reference:r,useWorldCoordinateImageData:!0===t.useWorldCoordinateImageData}),await this.addDisplaySet(n,{role:"overlay"});let i=this.mountedData.getActorForDataId(n);t.callback&&i&&t.callback({imageActor:i.actor,imageId:t.imageId})}this.render()}}getImageDataMetadata(e){return(0,c.T)(e)}getImageIds(){let e=this.getPlanarData();return e?e.imageVolume?.imageIds||e.imageIds:[]}getVolumeId(e={}){return this.viewReferences.getVolumeId(e)??this.getPlanarData()?.volumeId}getSourceDataId(){return this.mountedData.getActiveDataId()}getCurrentMode(){let e=this.getSourceBinding();if(!e)return"empty";let t=e.rendering.renderMode;return t===i.T.VTK_VOLUME||(0,a.mK)(t)?"volume":(0,a.Fi)(t)?"stack":this.getVolumeId()?"volume":"stack"}notifyDataPresentationModified(e,t){if(this.suppressEvents)return;let r="voiRange"in t||"invert"in t||"voiLUTFunction"in t,i="colormap"in t;if(!r&&!i)return;let a=this.getDisplaySetPresentation(e),o=this.getDataSet(e)?.volumeId??(e===this.getSourceDataId()?this.getVolumeId():void 0);if(r){let e=t.voiRange??a?.voiRange;e&&(0,p.A)(this.element,n.sV.VOI_MODIFIED,{viewportId:this.id,range:e,volumeId:o,VOILUTFunction:t.voiLUTFunction??a?.voiLUTFunction,invert:t.invert??a?.invert,colormap:a?.colormap})}i&&t.colormap&&(0,p.A)(this.element,n.sV.COLORMAP_MODIFIED,{viewportId:this.id,colormap:t.colormap,volumeId:o})}getDefaultVOIRange(e){return this.mountedData.getDefaultVOIRange(e)}getCurrentImageIdIndex(){return this.getActiveImageIdIndex()}getCurrentImageId(e={}){return this.viewReferences.getCurrentImageId(e)}getSliceIndex(){return this.getCurrentImageIdIndex()}getNumberOfSlices(){return this.getImageIds().length?this.getMaxImageIdIndex()+1:0}calibrateSpacing(e){this.render();let t=this.getImageData();(0,p.A)(this.element,n.sV.IMAGE_SPACING_CALIBRATED,{element:this.element,viewportId:this.id,renderingEngineId:this.renderingEngineId,imageId:e,calibration:t?.calibration,imageData:t?.imageData})}normalizeViewState(e){return(0,R.Kh)(e)}setViewState(e){if(this.isDestroyed)return;let t=this.getResolvedCameraForEvent();Object.prototype.hasOwnProperty.call(e,"displayArea")&&(this.options={...this.options,displayArea:(0,R.z$)(e.displayArea)});let r={...this.viewState,...e};this.clearResolvedViewCache(),this.viewState=this.normalizeViewState(r),this.modified(t)}setDisplaySetPresentation(e,t){if(this.clearResolvedViewCache(),"string"==typeof e)return void super.setDisplaySetPresentation(e,t??{});super.setDisplaySetPresentation(e)}setDataPresentationState(e,t){this.clearResolvedViewCache(),super.setDataPresentationState(e,t)}getRotation(){return this.getResolvedView()?.rotation??(0,D.iJ)(this.viewState.rotation)}getAnchorWorld(){let e=this.viewState.anchorWorld;return e?[...e]:void 0}setAnchorWorld(e){this.setViewState({anchorWorld:e?[...e]:void 0})}setOptions(e,t=!1){this.options=X(e),this.options.displayArea&&this.setDisplayArea(this.options.displayArea,this.options.suppressEvents??!1),t&&this.render()}reset(e=!1){this.options=X(this.defaultOptions),e&&this.render()}getDisplayArea(){return(0,R.z$)(this.viewState.displayArea??this.options.displayArea)}setDisplayArea(e,t=!1){let r=(0,R.z$)(e);r&&(this.options={...this.options,displayArea:(0,R.z$)(r)},this.setViewState({anchorCanvas:[.5,.5],anchorWorld:void 0,displayArea:r,scale:[1,1],scaleMode:r.scaleMode??"fit"}),t||this.suppressEvents||(0,p.A)(this.element,n.sV.DISPLAY_AREA_MODIFIED,{viewportId:this.id,displayArea:(0,R.z$)(r),storeAsInitialCamera:r.storeAsInitialCamera}))}getZoom(){return(0,N.p)(this.getProjectionSnapshot())}getScale(){return(0,N.Ql)(this.getProjectionSnapshot())}setZoom(e,t){this.setScale(e,t)}setScale(e,t){let r=this.getResolvedView(),n=(0,M.aD)(e);return r?void this.applyResolvedViewState(r.withScale(n,t).state.viewState):t?void this.setScaleAtCanvasPoint(n,t):void this.setViewState({displayArea:void 0,scale:n,scaleMode:"fit"})}getPan(){return(0,N.HT)(this.getProjectionSnapshot())}setPan(e){let t=this.getResolvedView();if(t)return void this.applyResolvedViewState(t.withPan(e).state.viewState);this.applyResolvedViewState(this.getFallbackViewStateWithPan(this.viewState,e))}setScaleAtCanvasPoint(e,t){let r=this.getResolvedView(),n=(0,M.aD)(e);if(r)return void this.applyResolvedViewState(r.withScale(n,t).state.viewState);let i=this.buildFallbackCanvasToWorld(t),{height:a,width:o}=this.getCurrentCanvasDimensions();this.setViewState({anchorWorld:i,anchorCanvas:[t[0]/Math.max(o,1),t[1]/Math.max(a,1)],displayArea:void 0,scale:n,scaleMode:"fit"})}getViewState(){return(0,R.Kh)(this.viewState)}getResolvedView(e={}){return this.resolveCachedViewState(this.viewState,e)}getRenderingEngine(){return f.A.get(this.renderingEngineId)}getViewReference(e={}){return this.viewReferences.getViewReference(e)}getViewReferenceId(e={}){return this.viewReferences.getViewReferenceId(e)}setViewReference(e){this.viewReferences.setViewReference(e)}getImageData(e){if(e){let t=this.findDataIdByVolumeId(e),r=t?this.getBinding(t):void 0;return r?.getImageData?.()}return this.getCurrentBinding()?.getImageData?.()}canvasToWorld(e){let t=this.getResolvedView();return t?t.canvasToWorld(e):this.buildFallbackCanvasToWorld(e)}worldToCanvas(e){let t=this.getResolvedView();return t?t.worldToCanvas(e):this.buildFallbackWorldToCanvas(e)}getFrameOfReferenceUID(){return this.viewReferences.getFrameOfReferenceUID()}hasImageId(e){return this.getImageIds().includes(e)}hasImageURI(e){return this.getImageIds().some(t=>(0,u.A)(t)===e)}hasVolumeId(e){return void 0!==this.findDataIdByVolumeId(e)}hasVolumeURI(e){return String(this.getVolumeId()||"").includes(e)}isPlaneViewable(e,t){return this.viewReferences.isPlaneViewable(e,t)}isReferenceViewable(e,t={}){return super.isReferenceViewable(e,t)}setImageIdIndex(e){let t=this.getImageIds();if(!t.length)return Promise.reject(Error("[PlanarViewport] Cannot set image index on empty stack"));let r=Math.min(Math.max(0,e),this.getMaxImageIdIndex()),n=t[r]||t[t.length-1],i=this.getCurrentPlanarRendering();if((0,a.mK)(i?.renderMode)){let e=this.getVolumeSliceWorldPointForImageIdIndex(r);return e&&this.setViewState({slice:{kind:"volumePoint",sliceWorldPoint:e}}),Promise.resolve(n)}return this.setViewState({slice:{kind:"stackIndex",imageIdIndex:r}}),Promise.resolve(n)}scroll(e){return this.setImageIdIndex(this.getActiveImageIdIndex()+e)}setOrientation(e){this.setViewState({orientation:this.resolveSetOrientation(e)})}canRenderOrientation(e,t){let r=t??this.getSourceDataId();if(!r)return!1;let n=this.getDataSet(r);return!!n&&w.canRender(n,{orientation:this.resolveSetOrientation(e)})}resetViewState(e){let{resetPan:t=!0,resetZoom:r=!0,resetOrientation:n=!0,resetFlip:i=!0}=e||{},a={rotation:0};return t&&(a.anchorWorld=void 0,a.anchorCanvas=[.5,.5]),r&&(a.scale=[1,1],a.scaleMode="fit"),n&&(a.orientation=this.resolveRequestedOrientation()),i&&(a.flipHorizontal=!1,a.flipVertical=!1),this.setViewState(a),this.triggerCameraResetEvent(),!0}resetViewStateForResize(){return this.resetViewState()}resetDisplaySetPresentation(e){if(this.isDestroyed)return;let t=e??this.getSourceDataId();if(!t)return;this.setDataPresentationState(t,{});let r=this.getDefaultVOIRange(t);r&&this.notifyDataPresentationModified(t,{voiRange:r})}getUseCustomRenderingPipeline(){return!1}setRendered(){super.setRendered()}resize(){if(this.isDestroyed)return;this.clearResolvedViewCache(),this.cachedCanvasDimensions=void 0;let{clientHeight:e,clientWidth:t}=this.element,{canvas:r}=this.renderContext.cpu,n=window.devicePixelRatio||1,i=Math.round(t*n),a=Math.round(e*n);(r.width!==i||r.height!==a)&&(r.width=i,r.height=a),this.resizeBindingsWithActiveFirst()}render(){if(!this.isDestroyed){if(!this.bindings.size){this.viewportStatus=n.Dt.NO_DATA;return}this.setNeedsRender(),this.renderContext.cpu.composition.renderPassId+=1,this.renderBindings()||this.requestRenderingEngineRender()}}onDestroy(){this.clearResolvedViewCache(),this.renderImageObjectDataId&&(d.A.remove(this.renderImageObjectDataId),this.renderImageObjectDataId=void 0),this.cpuCanvas?.remove(),this.cpuCanvas=void 0,this.mountedData.clearActiveDataId(),this.renderContext.view.activeSourceICamera=void 0}modified(e){!this.isDestroyed&&(this.updateBindingsCameraState(),this.render(),e&&this.triggerCameraModifiedEvent(e))}renderBindings(){if(this.isDestroyed)return!1;let e=!1,t=this.getCurrentBinding(),r=(t,r)=>{if(t.render){e=!0;try{t.render(),this.lastRenderPathErrorByDataId.delete(r)}catch(e){this.reportRenderPathError(e,r)}}};for(let[e,n]of this.bindings.entries())n===t&&r(n,e);for(let[e,n]of this.bindings.entries())n!==t&&r(n,e);return e}updateRenderingPipeline(){this.applyRenderingPipelineUpdate()}async applyRenderingPipelineUpdate(){if(this.isDestroyed)return;let e=++this.renderPipelineSwapId,t=()=>e!==this.renderPipelineSwapId||this.isDestroyed,r=!1,i=this.getCurrentBinding(),a=Array.from(this.bindings.entries());for(let[e,n]of[...a.filter(([,e])=>e===i),...a.filter(([,e])=>e!==i)]){if(t())return;if(this.bindings.get(e)!==n)continue;let i=this.mountOptionsByDataId.get(e)??{};try{let{data:a,selectedPath:o}=await this.loadPlanarData(e,{...i,role:n.role});if(t()||this.bindings.get(e)!==n||o.renderMode===n.rendering.renderMode)continue;let s=await this.addLoadedData(e,a,{renderMode:o.renderMode,role:n.role},()=>t()||this.bindings.get(e)!==n);r=r||s}catch(t){this.reportRenderPathError(t,e)}}if(t()||!r)return;let o=this.getCurrentPlanarRendering()?.renderMode;o&&this.renderContext.display.activateRenderMode(o),this.clearResolvedViewCache(),this.updateBindingsCameraState(),this.render(),(0,p.A)(m.A,n.sV.RENDERING_PIPELINE_CHANGED,{renderingEngineId:this.renderingEngineId,viewportId:this.id})}reportRenderPathError(e,t){let r=e instanceof Error?e.message:String(e),i=t??"";this.lastRenderPathErrorByDataId.get(i)!==r&&(this.lastRenderPathErrorByDataId.set(i,r),console.error("[PlanarViewport] Render path error",t??"",e),(0,p.A)(m.A,n.sV.RENDER_PATH_ERROR,{renderingEngineId:this.renderingEngineId,viewportId:this.id,dataId:t,error:e}))}requestRenderingEngineRender(){let e=f.A.get(this.renderingEngineId);e&&e.renderViewport(this.id)}setRenderModeVisibility(e,t,r){let n="cpu"===(0,a.cg)(e),i=this.element.querySelector(".viewport-element");t.style.display=n?"":"none",t.style.pointerEvents=n?"auto":"none",r.style.display=n?"none":"",i&&(i.style.pointerEvents=n?"none":"")}createLegacyCompatibilityHost(){return{getElement:()=>this.element,getViewportId:()=>this.id,getRequestedOrientation:()=>this.resolveRequestedOrientation(),prepareVolumeCompatibilityCamera:()=>{this.viewState=this.normalizeViewState({...this.viewState,orientation:this.resolveRequestedOrientation()})},setDisplaySets:(...e)=>this.setDisplaySets(...e),setImageIdIndex:e=>this.setImageIdIndex(e),getCurrentImageId:()=>this.getCurrentImageId(),render:()=>this.render(),removeBindingsExcept:e=>this.removeBindingsExcept(e),setCameraOrientation:e=>{this.setViewState({orientation:this.resolveSetOrientation(e)})},setDataPresentationState:(e,t)=>{this.setDataPresentationState(e,t)},setDisplaySetPresentation:(e,t)=>{this.setDisplaySetPresentation(e,t)},getDisplaySetPresentation:e=>this.getDisplaySetPresentation(e),getCameraOrientation:()=>this.viewState.orientation,getCurrentPlanarRendering:()=>this.getCurrentPlanarRendering(),getActiveDataId:()=>this.mountedData.getActiveDataId(),getFirstBoundDataId:()=>this.mountedData.getFirstBoundDataId(),findDataIdByVolumeId:e=>this.mountedData.findDataIdByVolumeId(e),getBindingActor:e=>this.mountedData.getBindingActor(e),getDefaultVOIRange:e=>this.getDefaultVOIRange(e),getImageCount:()=>this.getImageIds().length,getMaxImageIdIndex:()=>this.getMaxImageIdIndex()}}updateBindingsCameraState(){let e=this.getCurrentBinding();e?e.applyViewState(this.viewState):this.renderContext.view.activeSourceICamera=void 0,this.forEachBinding(t=>{t!==e&&t.applyViewState(this.viewState)})}resizeBindingsWithActiveFirst(){let e=this.getCurrentBinding();e?.resize?.(),this.forEachBinding(t=>{t!==e&&t.resize?.()})}getActiveImageIdIndex(){let e=this.getCurrentBinding();if("volume"===this.getCurrentMode()){let e=this.getResolvedView()?.state?.currentImageIdIndex;if("number"==typeof e)return e}let t=e?.rendering?.currentImageIdIndex;return"number"==typeof t?t:this.viewState.slice?.kind==="stackIndex"?this.viewState.slice.imageIdIndex:0}getMaxImageIdIndex(){let e=this.getCurrentBinding(),t=e?.rendering?.maxImageIdIndex;return"number"==typeof t?t:Math.max(0,this.getImageIds().length-1)}getVolumeSliceWorldPointForImageIdIndex(e){let t=this.getResolvedView({sliceIndex:e})?.getSliceBasis(),r=t?.sliceCenterWorld;return r?[...r]:void 0}getPlanarData(){return this.getCurrentPlanarData()}getCurrentBinding(){return this.mountedData.getCurrentBinding()}removeReplaceableData(e){let t=this.resolveNextSourceId(e),r=void 0!==t&&t===this.getSourceDataId();for(let e of Array.from(this.bindings.keys()))r&&this.isSegmentationOverlayBinding(e)||this.removeData(e)}resolveNextSourceId(e){let t=e.find(e=>e.options?.role==="source");return t?.displaySetId??e[0]?.displaySetId}isSegmentationOverlayBinding(e){return"overlay"===this.getDisplaySetRole(e)&&this.getDataSet(e)?.reference?.kind==="segmentation"}getDataSet(e){var t;let r=(0,y.$B)(e);if(t=r,(0,y.T0)(t)&&0!==t.imageIds.length&&(void 0===t.initialImageIdIndex||"number"==typeof t.initialImageIdIndex)&&(void 0===t.volumeId||"string"==typeof t.volumeId))return r}async loadPlanarData(e,t){let r=this.getDataSet(e);if(!r)throw Error(`[PlanarViewport] No registered planar dataset metadata for ${e}`);let n=this.resolveRequestedOrientation(t.orientation),i=function(e,t={}){return w.select(e,t)}(r,{orientation:n,renderBackend:t.renderBackend??this.getInheritedOverlayRenderBackend(t.role)});return{data:await this.dataProvider.load(e,{acquisitionOrientation:i.acquisitionOrientation,orientation:n,renderMode:i.renderMode,volumeId:i.volumeId}),selectedPath:i,resolvedOrientation:n}}getInheritedOverlayRenderBackend(e){if("source"!==e)return(0,a.H6)(this.getCurrentPlanarRendering()?.renderMode)}applyLoadedPlanarViewState(e,t,r){var i;let o=(0,a.mK)(r.renderMode),s=(i=r.acquisitionOrientation,!e||e===n.KY.ACQUISITION||i&&e===i?n.KY.ACQUISITION:(0,E.MV)(e)),l=o?this.createInitialVolumeSliceState(t,r.renderMode,s):{kind:"stackIndex",imageIdIndex:t.initialImageIdIndex??0};this.clearResolvedViewCache(),this.viewState=this.normalizeViewState({...this.viewState,slice:l,orientation:s})}createInitialVolumeSliceState(e,t,r){if(!e.imageVolume)return;let{height:i,width:o}=this.getCurrentCanvasDimensions(),s="cpu"===(0,a.cg)(t)?L.vu:L.P8,l=r===n.KY.ACQUISITION?e.initialImageIdIndex:void 0;if("number"==typeof l){let t=(0,L.xH)(e.imageVolume,l);if(t)return{kind:"volumePoint",sliceWorldPoint:t}}let{sliceBasis:u}=s({canvasHeight:i,canvasWidth:o,imageIdIndex:l,imageVolume:e.imageVolume,orientation:r});return{kind:"volumePoint",sliceWorldPoint:[...u.sliceCenterWorld]}}resolveRequestedOrientation(e){return(0,E.MV)((e??this.defaultOptions.orientation)||n.KY.ACQUISITION)||n.KY.ACQUISITION}resolveSetOrientation(e){var t;if("string"!=typeof e)return(0,E.MV)(e)||n.KY.ACQUISITION;if((t=e)!==n.KY.REFORMAT&&t!==n.KY.AXIAL_REFORMAT&&t!==n.KY.CORONAL_REFORMAT&&t!==n.KY.SAGITTAL_REFORMAT)return e;let r=function(e){switch(e){case n.KY.AXIAL_REFORMAT:return n.KY.AXIAL;case n.KY.CORONAL_REFORMAT:return n.KY.CORONAL;case n.KY.SAGITTAL_REFORMAT:return n.KY.SAGITTAL;default:return}}(e),i=(0,g.S8)({getActors:()=>this.getActors(),getCamera:()=>this.getCameraForEvent(),getCurrentImageId:()=>this.getCurrentImageId(),getImageIds:()=>this.getImageIds(),type:n.NV.ORTHOGRAPHIC},{useViewportNormal:!0,...r?{orientation:r}:{}});return i?{viewPlaneNormal:i.viewPlaneNormal,viewUp:i.viewUp}:r||this.viewState.orientation}removeBindingsExcept(e){this.mountedData.removeBindingsExcept(e)}resolveStackInputImage(e){let t=s.Ay.getImage(e.imageId);return t||(e.imageData?function(e,t){let r=t.getDimensions(),i=t.getSpacing(),a=r[0]??1,o=r[1]??1,s=i[0]??1,l=i[1]??1,u=t.getPointData().getScalars(),c=u.getData(),d=c.length?(0,h.A)(c):{min:0,max:1},{min:p,max:m}=Number.isFinite(d.min)&&Number.isFinite(d.max)?d:{min:0,max:1},f=Math.max(m-p,1),g=c.constructor?.name||"Uint8Array";return{imageId:e,minPixelValue:p,maxPixelValue:m,slope:1,intercept:0,windowCenter:p+f/2,windowWidth:f,voiLUTFunction:n.yX.LINEAR,getPixelData:()=>c,getCanvas:()=>{let e=document.createElement("canvas");return e.width=a,e.height=o,e},rows:o,columns:a,height:o,width:a,color:!1,rgba:!1,numberOfComponents:u.getNumberOfComponents?.()??1,columnPixelSpacing:s,rowPixelSpacing:l,invert:!1,photometricInterpretation:"MONOCHROME2",sizeInBytes:c.byteLength??4*c.length,dataType:g}}(e.imageId,e.imageData):void 0)}resolveOverlayReference(e,t){let r=e.reference;return r&&"string"==typeof r.kind?r:{kind:"image",imageId:t.imageId}}resolveOverlayDataId(e,t,r){let n=e.dataId;if("string"==typeof n)return n;if("segmentation"===r.kind&&"string"==typeof r.representationUID)return r.representationUID;let i=t.imageId;return this.mountedData.hasBinding(i)?`overlay:${i}`:i}findBindingDataIdByActorEntryUID(e){return this.mountedData.findBindingDataIdByActorEntryUID(e)}findDataIdByVolumeId(e){return this.mountedData.findDataIdByVolumeId(e)}getCurrentPlanarRendering(){return this.getCurrentBinding()?.rendering}resolveViewState(e,t={}){let r=this.getPlanarData(),n=this.getCurrentPlanarRendering();return(0,V.a8)({viewState:e,data:r,frameOfReferenceUID:t.frameOfReferenceUID??this.resolveFrameOfReferenceUID(),renderContext:this.renderContext,rendering:n,sliceIndex:t.sliceIndex})}getProjectionSnapshot(){let{height:e,width:t}=this.getCurrentCanvasDimensions(),r=(0,N.IQ)({viewport:this,canvasHeight:e,canvasWidth:t,displayArea:this.getDisplayArea(),frameOfReferenceUID:this.resolveFrameOfReferenceUID(),resolvedView:this.getResolvedView(),resolveViewState:e=>this.resolveViewState(e),viewState:this.viewState});if(!r)throw Error("[PlanarViewport] Unable to resolve projection snapshot");return r}getCachedPlanarCanvasDimensions(e){let t=this.cachedCanvasDimensions;if(t)return t;let r=(0,V._D)({renderContext:this.renderContext,rendering:e});return r.canvasHeight>0&&r.canvasWidth>0&&(this.cachedCanvasDimensions=r),r}resolveCachedViewState(e,t={}){if(t.frameOfReferenceUID||"number"==typeof t.sliceIndex)return this.resolveViewState(e,t);let r=this.getPlanarData(),n=this.getCurrentPlanarRendering(),i=this.mountedData.getActiveDataId(),a=this.resolveFrameOfReferenceUID(),o=this.resolvedViewCache;if(!n)return this.resolveViewState(e,t);let{canvasHeight:s,canvasWidth:l}=this.getCachedPlanarCanvasDimensions(n);if(o&&o.activeDataId===i&&o.viewState===e&&o.data===r&&o.rendering===n&&o.frameOfReferenceUID===a&&o.canvasHeight===s&&o.canvasWidth===l&&o.revision===this.resolvedViewCacheRevision)return o.resolvedView;let u=(0,V.a8)({viewState:e,data:r,frameOfReferenceUID:a,renderContext:this.renderContext,rendering:n,canvasDimensions:{canvasHeight:s,canvasWidth:l}});return u&&(this.resolvedViewCache={activeDataId:i,canvasHeight:s,canvasWidth:l,data:r,frameOfReferenceUID:a,rendering:n,resolvedView:u,revision:this.resolvedViewCacheRevision,viewState:e}),u}clearResolvedViewCache(){this.resolvedViewCache=void 0,this.resolvedViewCacheRevision+=1}resolveFrameOfReferenceUID(){return this.viewReferences.resolveFrameOfReferenceUID()}getFallbackPan(e=this.viewState){let t=e.anchorCanvas??[.5,.5],r=e.anchorWorld??[0,0,0],{height:n,width:i}=this.getCurrentCanvasDimensions(),[a,o]=(0,M.aD)(e.scale);return[(0-r[0])*a+(t[0]-.5)*i,(0-r[1])*o+(t[1]-.5)*n]}getFallbackViewStateWithPan(e,t){let r=this.getFallbackPan(e),[n,i]=e.anchorCanvas??[.5,.5],{height:a,width:o}=this.getCurrentCanvasDimensions(),s=t[0]-r[0],l=t[1]-r[1];return this.normalizeViewState({...e,anchorCanvas:[n+s/Math.max(o,1),i+l/Math.max(a,1)],displayArea:void 0})}buildFallbackCanvasToWorld(e){let t=this.viewState.anchorCanvas??[.5,.5],r=this.viewState.anchorWorld??[0,0,0],{height:n,width:i}=this.getCurrentCanvasDimensions(),[a,o]=(0,M.aD)(this.viewState.scale);return[r[0]+(e[0]-t[0]*i)/a,r[1]+(e[1]-t[1]*n)/o,r[2]]}buildFallbackWorldToCanvas(e){let t=this.viewState.anchorCanvas??[.5,.5],r=this.viewState.anchorWorld??[0,0,0],{height:n,width:i}=this.getCurrentCanvasDimensions(),[a,o]=(0,M.aD)(this.viewState.scale);return[(e[0]-r[0])*a+t[0]*i,(e[1]-r[1])*o+t[1]*n]}applyResolvedViewState(e){let t=this.getResolvedCameraForEvent();this.clearResolvedViewCache(),this.viewState=this.normalizeViewState(e),this.modified(t)}getResolvedCameraForEvent(){return this.getResolvedView()?.toICamera()}getCameraForEvent(){let e=this.getResolvedView();return e?e.toICamera():this.getViewState()}getCurrentPresentation(){let e=this.getResolvedView();if(e)return{flipHorizontal:!0===e.state.viewState.flipHorizontal,flipVertical:!0===e.state.viewState.flipVertical,pan:e.pan,rotation:e.rotation,scale:e.scale,zoom:e.zoom}}getCurrentCanvasDimensions(){let e=this.getCurrentPlanarRendering();if(e){let{canvasHeight:t,canvasWidth:r}=this.getCachedPlanarCanvasDimensions(e);return{width:r||this.element.clientWidth,height:t||this.element.clientHeight}}return{width:this.element.clientWidth,height:this.element.clientHeight}}getCurrentPlanarData(){return this.getCurrentBinding()?.data}getReferenceViewContexts(){return this.viewReferences.getReferenceViewContexts(super.getReferenceViewContexts())}}function X(e={}){return(0,l.G)(e)}let Y=q},97633:(e,t,r)=>{"use strict";r.d(t,{DF:()=>o,aI:()=>s,p8:()=>n,tb:()=>i});var n=1e-6,i="undefined"!=typeof Float32Array?Float32Array:Array,a=Math.PI/180;function o(e){return e*a}function s(e,t){return Math.abs(e-t)<=n*Math.max(1,Math.abs(e),Math.abs(t))}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)})},97748:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(56109),i=r(87352),a=r(65110),o=r(72795);function s(e,t=1024){let{windowWidth:r,windowCenter:l}=a.toWindowLevel(e.lower,e.upper),u=Array.from({length:t},(e,r)=>(r+1)/(t+2)).flatMap(e=>[(0,o.i)(e,l,r),e,e,e,.5,0]),c=n.Ay.newInstance();return c.buildFunctionFromArray(i.Ay.newInstance({values:u,numberOfComponents:6})),c}},97938:(e,t,r)=>{"use strict";let n;r.r(t),r.d(t,{cancelLoadAll:()=>P,cancelLoadImage:()=>w,cancelLoadImages:()=>O,createAndCacheDerivedImage:()=>A,createAndCacheDerivedImages:()=>T,createAndCacheDerivedLabelmapImage:()=>M,createAndCacheDerivedLabelmapImages:()=>R,createAndCacheLocalImage:()=>S,loadAndCacheImage:()=>x,loadAndCacheImages:()=>C,loadImage:()=>I,registerImageLoader:()=>_,registerUnknownImageLoader:()=>E,unregisterAllImageLoaders:()=>D});var i=r(54268),a=r(76879),o=r(35752),s=r(77280),l=r(3922),u=r(85461),c=r(6560),d=r(69228),p=r(3793),m=r(36039),h=r(92391),f=r(39216),g=r(42776);let v={};function y(e,t){let r=!t.ignoreCache&&i.Ay.getImageLoadObject(e);if(r)return b(r.promise,e),r;let a=!t.ignoreCache&&i.Ay.getImage(e,t.retrieveOptions?.imageQualityStatus??s.FU.FULL_RESOLUTION);if(a){let t={promise:Promise.resolve(a)};return b(t.promise,e),t}let o=e.split(":")[0],l=v[o]||n;if(!l)throw Error(`loadImageFromImageLoader: No image loader found for scheme '${o}'`);let u=l(e,t);return b(u.promise,e),u}function b(e,t){Promise.resolve(e).then(e=>{(function(e){if(!e.voxelManager){let{width:t,height:r,numberOfComponents:n}=e,i=m.A.createImageVoxelManager({scalarData:e.getPixelData(),width:t,height:r,numberOfComponents:n});e.voxelManager=i,e.getPixelData=()=>i.getScalarData(),delete e.imageFrame.pixelData}})(e),(0,d.A)(l.A,a.A.IMAGE_LOADED,{image:e})}).catch(e=>{(0,d.A)(l.A,a.A.IMAGE_LOAD_FAILED,{imageId:t,error:e})})}function I(e,t={priority:0,requestType:"prefetch"}){if(void 0===e)throw Error("loadImage: parameter imageId must not be undefined");return y(e,t).promise}function x(e,t={priority:0,requestType:"prefetch"}){if(void 0===e)throw Error("loadAndCacheImage: parameter imageId must not be undefined");let r=y(e,t);return i.Ay.getImageLoadObject(e)||i.Ay.putImageLoadObject(e,r),r.promise}function C(e,t={priority:0,requestType:"prefetch"}){if(!e||0===e.length)throw Error("loadAndCacheImages: parameter imageIds must be list of image Ids");return e.map(e=>x(e,t))}function A(e,t={}){if(void 0===e)throw Error("createAndCacheDerivedImage: parameter imageId must not be undefined");void 0===t.imageId&&(t.imageId=`derived:${(0,p.A)()}`);let{imageId:r,skipCreateBuffer:n,onCacheAdd:a,voxelRepresentation:s}=t,l=f.get(o.A.IMAGE_PLANE,e),d=l.rows*l.columns,{TypedArrayConstructor:m}=(0,c.h)(t.targetBuffer?.type,d),h=new m(n?1:d),g=f.get(o.A.IMAGE_PLANE,e);u.A.add(r,{type:o.A.IMAGE_PLANE,metadata:g});let v=f.get(o.A.GENERAL_SERIES,e);u.A.add(r,{type:o.A.GENERAL_SERIES,metadata:v}),u.A.add(r,{type:o.A.GENERAL_IMAGE,metadata:{instanceNumber:t.instanceNumber}});let y=f.get(o.A.IMAGE_PIXEL,e);u.A.add(r,{type:o.A.IMAGE_PIXEL,metadata:{...y,bitsAllocated:8,bitsStored:8,highBit:7,samplesPerPixel:1,pixelRepresentation:0}});let b=S(r,{scalarData:h,onCacheAdd:a,skipCreateBuffer:n,targetBuffer:{type:h.constructor.name},voxelRepresentation:s,dimensions:[l.columns,l.rows],spacing:[l.columnPixelSpacing,l.rowPixelSpacing],origin:l.imagePositionPatient,direction:l.imageOrientationPatient,frameOfReferenceUID:l.frameOfReferenceUID,referencedImageId:e});return b.referencedImageId=e,i.Ay.getImageLoadObject(r)||i.Ay.putImageSync(r,b),b}function T(e,t={}){if(0===e.length)throw Error("createAndCacheDerivedImages: parameter imageIds must be list of image Ids");let r=[];return e.map((e,n)=>{let i={imageId:t?.getDerivedImageId?.(e)||`derived:${(0,p.A)()}`,...t};return r.push(i.imageId),A(e,{...i,instanceNumber:n+1})})}function S(e,t){let r,n,a,s,{scalarData:l,origin:d,direction:p,targetBuffer:h,skipCreateBuffer:f,onCacheAdd:v,frameOfReferenceUID:y,voxelRepresentation:b,referencedImageId:I}=t,x=t.dimensions,C=t.spacing;if(!x||!C)throw Error("createAndCacheLocalImage: dimensions and spacing are required");let A=x[0],T=x[1],S=C[0],w=C[1],O={frameOfReferenceUID:y,rows:T,columns:A,imageOrientationPatient:p??[1,0,0,0,1,0],rowCosines:p?p.slice(0,3):[1,0,0],columnCosines:p?p.slice(3,6):[0,1,0],imagePositionPatient:d??[0,0,0],pixelSpacing:[w,S],rowPixelSpacing:w,columnPixelSpacing:S},P=A*T,_=l.length/P;if(l){if(!(l instanceof Uint8Array||l instanceof Float32Array||l instanceof Uint16Array||l instanceof Int16Array))throw Error("createAndCacheLocalImage: scalarData must be of type Uint8Array, Uint16Array, Int16Array or Float32Array");r=l}else if(!f){let{TypedArrayConstructor:e}=(0,c.h)(h?.type,P);r=new e(P)}if(r instanceof Uint8Array)n=8,a=8,s=7;else if(r instanceof Uint16Array)n=16,a=16,s=15;else if(r instanceof Int16Array)n=16,a=16,s=15;else if(r instanceof Float32Array)n=32,a=32,s=31;else throw Error("Unsupported scalarData type");let E={samplesPerPixel:1,photometricInterpretation:r.length>x[0]*x[1]?"RGB":"MONOCHROME2",rows:T,columns:A,bitsAllocated:n,bitsStored:a,highBit:s},D={imagePlaneModule:O,imagePixelModule:E};[o.A.IMAGE_PLANE,o.A.IMAGE_PIXEL].forEach(t=>{u.A.add(e,{type:t,metadata:D[t]||{}})});let R=b===g.A.RLE&&m.A.createRLEImageVoxelManager({dimensions:x,id:e})||m.A.createImageVoxelManager({height:T,width:A,numberOfComponents:_,scalarData:r,id:e}),M=r[0],N=r[0];for(let e=1;eN&&(N=r[e]);let V={imageId:e,intercept:0,windowCenter:0,windowWidth:0,color:"RGB"===E.photometricInterpretation,numberOfComponents:E.samplesPerPixel,dataType:h?.type,slope:1,minPixelValue:M,maxPixelValue:N,rows:E.rows,columns:E.columns,getCanvas:void 0,height:E.rows,width:E.columns,rgba:void 0,columnPixelSpacing:O.columnPixelSpacing,rowPixelSpacing:O.rowPixelSpacing,FrameOfReferenceUID:O.frameOfReferenceUID,invert:!1,getPixelData:()=>R.getScalarData(),voxelManager:R,sizeInBytes:l.byteLength,referencedImageId:I};return v?.(V),i.Ay.putImageSync(V.imageId,V),V}function w(e){h.A.filterRequests(({additionalDetails:t})=>!t.imageId||t.imageId!==e);let t=i.Ay.getImageLoadObject(e);t&&t.cancelFn()}function O(e){e.forEach(e=>{w(e)})}function P(){let e=h.A.getRequestPool();Object.keys(e).forEach(t=>{let r=e[t];Object.keys(r).forEach(e=>{let t,n=r[e].pop();if(!n)return;let{imageId:a,volumeId:o}=n.additionalDetails;a?t=i.Ay.getImageLoadObject(a):o&&(t=i.Ay.getVolumeLoadObject(o)),t&&t.cancel()}),h.A.clearRequestStack(t)})}function _(e,t){v[e]=t}function E(e){let t=n;return n=e,t}function D(){Object.keys(v).forEach(e=>delete v[e]),n=void 0}function R(e,t={}){return T(e,{...t,targetBuffer:{type:"Uint8Array"}})}function M(e,t={}){return A(e,{...t,targetBuffer:{type:"Uint8Array"}})}},98040:(e,t,r)=>{"use strict";r.d(t,{A:()=>p});var n=r(91336);let{addCanvasPointsToArray:i,getFirstLineSegmentIntersectionIndexes:a}=r(33845).XL;function o(e,t){let{element:r,currentPoints:o,lastPoints:s}=e.detail,l=o.canvas,u=s.canvas,{editCanvasPoints:c,prevCanvasPoints:d}=this.editData,p=a(d,l,u,t);if(p)this.editData.startCrossingIndex=p[0],this.removePointsUpUntilFirstCrossing(t);else if(d.length>=2)if(c.length>this.configuration.checkCanvasEditFallbackProximity){let e=c[0],t=[];for(let r=0;re.distance-t.distance);let r=[t[0],t[1]],i=Math.min(r[0].index,r[1].index);this.editData.startCrossingIndex=i}else{let e=n.vt();n.Re(e,c[1],c[0]),n.S8(e,e);let o=[c[0][0]-6*e[0],c[0][1]-6*e[1]],s=a(d,o,c[0],t);if(s){let e=[o];i(r,e,c[0],this.commonData),c.unshift(...e),this.removePointsUpUntilFirstCrossing(t),this.editData.editIndex=c.length-1,this.editData.startCrossingIndex=s[0]}}}function s(e){let{editCanvasPoints:t,prevCanvasPoints:r}=this.editData,n=0;for(let i=0;i0;n--){let i=[r[n],r[n-1]],o=!!a(t,i[0],i[1],e);if(r.pop(),o)break}}function c(){let{editCanvasPoints:e,prevCanvasPoints:t,startCrossingIndex:r}=this.editData;if(void 0===r)return;let i=e[e.length-1],o=[];for(let e=0;ee.distance-t.distance);let s=e.slice(0,-1);for(let r=0;r{"use strict";r.d(t,{Kh:()=>c,Mn:()=>u,z$:()=>l});var n=r(77280),i=r(21483),a=r(33308),o=r(59698),s=r(9638);function l(e){return(0,i.G)(e)}function u(){return{slice:{kind:"stackIndex",imageIdIndex:0},orientation:n.KY.ACQUISITION,flipHorizontal:!1,flipVertical:!1,anchorCanvas:[.5,.5],scale:[1,1],scaleMode:"fit",rotation:0}}function c(e){return{...e.slice?{slice:function(e){if(e)return"stackIndex"===e.kind?{kind:"stackIndex",imageIdIndex:Math.max(0,Math.round(e.imageIdIndex))}:{kind:"volumePoint",sliceWorldPoint:[...e.sliceWorldPoint]}}(e.slice)}:{},orientation:(0,a.MV)(e.orientation)??n.KY.ACQUISITION,flipHorizontal:!0===e.flipHorizontal,flipVertical:!0===e.flipVertical,anchorCanvas:e.anchorCanvas?[...e.anchorCanvas]:[.5,.5],scale:(0,s.Yl)(e.scale),scaleMode:(0,s.dq)(e.displayArea?.scaleMode??e.scaleMode),rotation:(0,o.iJ)(e.rotation??0),...e.displayArea?{displayArea:l(e.displayArea)}:{},...e.anchorWorld?{anchorWorld:[...e.anchorWorld]}:{}}}},98197:(e,t,r)=>{"use strict";r.r(t),r.d(t,{frameNumberToTimeSeconds:()=>c,getVideoImageDataMetadata:()=>s,loadVideoStreamMetadata:()=>l,normalizeVideoPlaybackInfo:()=>u,timeSecondsToFrameNumber:()=>d});var n=r(50923),i=r(77280),a=r(39216),o=r(17935);function s(e){let t=a.get(i.nb.IMAGE_PLANE,e),r=t.rowCosines,o=t.columnCosines;(t.usingDefaultValues||null==r||null==o)&&(r=[1,0,0],o=[0,1,0]);let s=n.fA(r[0],r[1],r[2]),l=n.fA(o[0],o[1],o[2]),u=n.vt();n.$A(u,s,l);let c=t.rows,d=t.columns,p=t.imagePositionPatient||[0,0,0],m=t.columnPixelSpacing||1,h=t.rowPixelSpacing||1,f=t.columns,g=t.rows;return{bitsAllocated:8,numberOfComponents:3,origin:p,rows:c,columns:d,direction:[...s,...l,...u],dimensions:[f,g,1],spacing:[m,h,1],hasPixelSpacing:!!t.columnPixelSpacing,numVoxels:f*g*1,imagePlaneModule:t}}function l(e){let t=function(e){let t=a.get(i.nb.IMAGE_URL,e);if(t?.rendered)return t.rendered;let r=a.get(i.nb.TRANSFER_SYNTAX,e);if(!(r?.isVideo||(0,o.A)(r?.transferSyntaxUID)))return;let n=e.startsWith("wadors:")?e.substring(7):e;if(n.includes("/frames/"))return n.replace("/frames/","/rendered/").replace(/\/rendered\/\d+($|[?#])/,"/rendered$1")}(e);if(!t)throw Error(`Video Image ID ${e} does not have a rendered video view`);let r=a.get(i.nb.GENERAL_SERIES,e),n=a.get(i.nb.CINE,e)||{},l=a.get(i.nb.INSTANCE,e),u=n.frameTime??n.FrameTime;return{renderedUrl:t,modality:r?.Modality??r?.modality,metadata:s(e),cineRate:n.cineRate??n.recommendedDisplayFrameRate??(u?1e3/Number(u):void 0),numberOfFrames:n.numberOfFrames??l?.NumberOfFrames}}function u(e){let t=Math.max(e.durationSeconds||0,.001),r=e.numberOfFrames,n=e.cineRate;return r&&1!==r||(r=Math.max(1,Math.round(t*(n||30)))),n||(n=Math.max(1,Math.round(r/t))),{fps:n,numberOfFrames:r,frameRange:[1,r]}}function c(e,t){return Math.max(0,e-1)/Math.max(1,t)}function d(e,t){return 1+Math.round(Math.max(0,e)*Math.max(1,t))}},98497:(e,t,r)=>{"use strict";r(59408),r(32876),r(36039)},98629:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>d});var n=r(17042),i=r(72188),a=r(56929),o=r(85250),s=r(37843),l={context:null,keyMatrixTime:null,keyMatrices:null,activeTextures:null};function u(e,t,r={}){Object.assign(t,l,r),i.A.extend(e,t,r),t.keyMatrixTime={},(0,n.WL)(t.keyMatrixTime,{mtime:0}),t.keyMatrices={normalMatrix:s.identity(new Float64Array(9)),mcwc:o.identity(new Float64Array(16))},(0,n.V0)(e,t,["context"]),(0,n.Jt)(e,t,["activeTextures"]),t.classHierarchy.push("vtkOpenGLActor"),e.buildPass=r=>{if(r){t._openGLRenderWindow=e.getLastAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNodes(t.renderable.getTextures()),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes(),t.ogltextures=null,t.activeTextures=null;for(let e=0;e{!t.renderable||!t.renderable.getNestedVisibility()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(r,!0),t.oglmapper.traverse(r),e.apply(r,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=r=>{!t.renderable||!t.renderable.getNestedVisibility()||!t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(r,!0),t.oglmapper.traverse(r),e.apply(r,!1))},e.traverseTranslucentPass=r=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(r,!0),t.oglmapper.traverse(r),e.apply(r,!1))},e.activateTextures=()=>{if(t.ogltextures){t.activeTextures=[];for(let e=0;e{e&&t.renderable&&t.renderable.getVisibility()&&(t.renderable.getIsOpaque()?r.incrementOpaqueActorCount():r.incrementTranslucentActorCount())},e.zBufferPass=(t,r)=>e.opaquePass(t,r),e.opaqueZBufferPass=(t,r)=>e.opaquePass(t,r),e.opaquePass=(r,n)=>{if(r)t.context.depthMask(!0),e.activateTextures();else{if(t.activeTextures)for(let e=0;e{if(r)t.context.depthMask(t._openGLRenderer.getSelector()&&t.renderable.getNestedPickable()),e.activateTextures();else{if(t.activeTextures)for(let e=0;e(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),o.copy(t.keyMatrices.mcwc,t.renderable.getMatrix()),o.transpose(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.renderable.getIsIdentity()?s.identity(t.keyMatrices.normalMatrix):(s.fromMat4(t.keyMatrices.normalMatrix,t.keyMatrices.mcwc),s.invert(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),s.transpose(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),t.keyMatrixTime.modified()),t.keyMatrices)}var c=(0,n.UI)(u),d={newInstance:c,extend:u};(0,a.c9)("vtkActor",c)},99298:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>a,JA:()=>i,uP:()=>n});var n={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},i={VOID:"",CHAR:"Int8Array",SIGNED_CHAR:"Int8Array",UNSIGNED_CHAR:"Uint8Array",UNSIGNED_CHAR_CLAMPED:"Uint8ClampedArray",SHORT:"Int16Array",UNSIGNED_SHORT:"Uint16Array",INT:"Int32Array",UNSIGNED_INT:"Uint32Array",FLOAT:"Float32Array",DOUBLE:"Float64Array"},a={DefaultDataType:i.FLOAT,DataTypeByteSize:n,VtkDataTypes:i}},99376:(e,t,r)=>{"use strict";r.d(t,{BV:()=>l});function n(e,{ext:t,filterType:r,texData:n,internalFormat:i,glDataType:a}){try{let o;if(t&&!(o=e.getExtension(t)))return!1;let s=e.createTexture();e.bindTexture(e.TEXTURE_2D,s),e.texImage2D(e.TEXTURE_2D,0,i(e,o),5,1,0,e.RED,a(e,o),n);let l="LINEAR"===r?e.LINEAR:e.NEAREST;e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,l),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,l),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.POINTS,0,1);let u=new Uint8Array(4);e.readPixels(1,1,1,1,e.RGBA,e.UNSIGNED_BYTE,u);let[c,d,p]=u;return e.deleteTexture(s),c===d&&d===p&&0!==c}catch(e){return!1}}let i="cornerstone3D.renderingCapabilities",a=/swiftshader|llvmpipe|softpipe|software|microsoft basic render/i,o={norm16:!1,norm16Linear:!1,float:!1,floatLinear:!1,halfFloat:!1,halfFloatLinear:!1},s=null;function l(){return s||(s=function({useCache:e=!0}={}){let t=function(){let e={webgl:!1,webgl2:!1,maxTextureSize:0,renderer:""};if("undefined"==typeof document)return e;try{let t=document.createElement("canvas"),r=t.getContext("webgl2"),n=r||t.getContext("webgl")||t.getContext("experimental-webgl");if(!n)return e;e.webgl=!0,e.webgl2=!!r,e.maxTextureSize=Number(n.getParameter(n.MAX_TEXTURE_SIZE))||0;let i=n.getExtension("WEBGL_debug_renderer_info"),a=i?n.getParameter(i.UNMASKED_RENDERER_WEBGL):n.getParameter(n.RENDERER);e.renderer="string"==typeof a?a:"";let o=n.getExtension("WEBGL_lose_context");o&&o.loseContext()}catch{}return e}();if(!t.webgl)return{...t,...o,softwareRasterizer:!1};let r=e?function(e,t){try{let r=window.localStorage?.getItem(i);if(!r)return null;let n=JSON.parse(r);if(n?.probeVersion!==1||n?.renderer!==e||n?.webgl2!==t||"object"!=typeof n?.formats||n?.formats===null)return null;return{...o,...n.formats}}catch{return null}}(t.renderer,t.webgl2):null;if(!r){let e=function(){let e=function(){try{let e=document.createElement("canvas");e.width=4,e.height=4;let t=e.getContext("webgl2");if(!t)return null;let r=`#version 300 es + void main() { + gl_PointSize = 4.0; + gl_Position = vec4(0, 0, 0, 1); + } + `,n=`#version 300 es + precision highp float; + precision highp int; + precision highp sampler2D; + + uniform sampler2D u_image; + + out vec4 color; + + void main() { + vec4 intColor = texture(u_image, gl_PointCoord.xy); + color = vec4(vec3(intColor.rrr), 1); + } + `,i=t.createShader(t.VERTEX_SHADER);if(t.shaderSource(i,r),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS))return null;let a=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(a,n),t.compileShader(a),!t.getShaderParameter(a,t.COMPILE_STATUS))return null;let o=t.createProgram();if(t.attachShader(o,i),t.attachShader(o,a),t.linkProgram(o),!t.getProgramParameter(o,t.LINK_STATUS))return null;return t.useProgram(o),t}catch(e){return null}}();if(!e)return null;let t=new Int16Array([32767,2e3,3e3,4e3,5e3,16784,7e3,8e3,9e3,32767]),r=new Float32Array([.3,.2,.3,.4,.5]),i=new Uint16Array([13517,12902,13517,13926,14336]),a={norm16:n(e,{ext:"EXT_texture_norm16",filterType:"NEAREST",texData:t,internalFormat:(e,t)=>t.R16_SNORM_EXT,glDataType:e=>e.SHORT}),norm16Linear:n(e,{ext:"EXT_texture_norm16",filterType:"LINEAR",texData:t,internalFormat:(e,t)=>t.R16_SNORM_EXT,glDataType:e=>e.SHORT}),float:n(e,{filterType:"NEAREST",texData:r,internalFormat:e=>e.R32F,glDataType:e=>e.FLOAT}),floatLinear:n(e,{ext:"OES_texture_float_linear",filterType:"LINEAR",texData:r,internalFormat:e=>e.R32F,glDataType:e=>e.FLOAT}),halfFloat:n(e,{filterType:"NEAREST",texData:i,internalFormat:e=>e.R16F,glDataType:e=>e.HALF_FLOAT}),halfFloatLinear:n(e,{filterType:"LINEAR",texData:i,internalFormat:e=>e.R16F,glDataType:e=>e.HALF_FLOAT})},o=e.isContextLost(),s=e.getExtension("WEBGL_lose_context");return s&&s.loseContext(),o?null:a}();e&&function(e,t,r){try{window.localStorage?.setItem(i,JSON.stringify({probeVersion:1,renderer:e,webgl2:t,formats:r}))}catch{}}(t.renderer,t.webgl2,e),r=e??{...o}}return{...t,...r,softwareRasterizer:a.test(t.renderer)}}()),s}},99445:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XMLDocumentImpl=void 0;let n=r(81294);class i extends n.DocumentImpl{constructor(){super()}}t.XMLDocumentImpl=i},99537:(e,t,r)=>{"use strict";r.d(t,{o:()=>d});var n=r(70192),i=r(78378),a=r(73904),o=r(31860);let{Active:s,Passive:l,Enabled:u}=i.r$;class c{constructor(){this._needsRender=new Set,this._animationFrameSet=!1,this._animationFrameHandle=null,this._renderFlaggedViewports=()=>{this._throwIfDestroyed();let e=Array.from(this._viewportElements.values());for(let t=0;t{this._needsRender.add(e)}),this._renderFlaggedViewports()}_setViewportsToBeRenderedNextFrame(e){let t=[...this._viewportElements.values()];e.forEach(e=>{-1!==t.indexOf(e)&&this._needsRender.add(e)}),this._render()}_render(){this._needsRender.size>0&&!1===this._animationFrameSet&&(this._animationFrameHandle=window.requestAnimationFrame(this._renderFlaggedViewports),this._animationFrameSet=!0)}_triggerRender(e){let t=(0,n.kJ)(e);if(!t)return;if(!(0,n.lD)(t.renderingEngineId))return void console.warn("rendering Engine has been destroyed");let r=(0,o.A)(e,[s,l,u]),{renderingEngineId:c,viewportId:d}=t,p={element:e,renderingEngineId:c,viewportId:d};(0,a.$2)(e,a=>{let o=!1;r.forEach(e=>{if(e.renderAnnotation){let r=e.renderAnnotation(t,a);o=o||r}}),o&&(0,n.Hl)(e,i.sV.ANNOTATION_RENDERED,{...p})})}_reset(){window.cancelAnimationFrame(this._animationFrameHandle),this._needsRender.clear(),this._animationFrameSet=!1,this._animationFrameHandle=null,this._setAllViewportsToBeRenderedNextFrame()}}let d=new c},99572:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var n=r(27321),i=r(68759),a=r(10999);function o(e){let t=document.createElementNS("http://www.w3.org/2000/svg","tspan");return t.setAttribute("x","0"),t.setAttribute("dy","1.2em"),t.textContent=e,t}function s(e,t){let{color:r,textBoxBorderRadius:n=0,textBoxMargin:a=0}=t,o=e.querySelector("rect.background"),s=e.querySelector("text").getBBox();if(!r)return o&&e.removeChild(o),e.getBBox();o||((o=document.createElementNS("http://www.w3.org/2000/svg","rect")).setAttribute("class","background"),e.insertBefore(o,e.firstChild));let l=e.getBBox(),u={x:`${l.x}`,y:`${l.y}`,width:`${s.width+2*Number(a)}`,height:`${s.height+2*Number(a)}`,fill:r,rx:n,ry:n};return a&&Array.from(e.querySelector("text").querySelectorAll("tspan")).forEach((e,t)=>{0===t&&e.setAttribute("y",a),e.setAttribute("x",a)}),(0,i.A)(u,o),l}let l=function(e,t,r,l,u,c={}){let d=function(e,t,r,a=[""],l,u){let c,{padding:d,color:p,fontFamily:m,fontSize:h,background:f,textBoxBorderRadius:g,textBoxMargin:v}=u,[y,b]=[l[0]+d,l[1]+d],I={color:f,textBoxBorderRadius:g,textBoxMargin:v},x=(0,n.A)(t,"text",r),C=e.getSvgNode(x);if(C){let r=C.querySelector("text"),n=Array.from(r.children);for(let e=0;en.length){for(let e=0;e{"use strict";r.d(t,{A:()=>o});var n=r(70192),i=r(50923),a=r(41918);let o=(e,t)=>{let r,o,s,l=n.BF.isGenericViewport(e);if(e instanceof n.hS||l&&"stack"===n.BF.getViewportContentMode(e)){let t=e.getImageData();if(!t)return;o=t.direction.slice(0,3),s=t.direction.slice(3,6),r=t.spacing}else{let t,n,{direction:u,spacing:c}=e.getImageData(),{viewPlaneNormal:d,viewUp:p}=l?(0,a.A)(e):e.getCamera(),m=u.slice(0,3),h=u.slice(3,6),f=u.slice(6,9),g=i.vt();i.$A(g,p,d);let v=Math.abs(i.Om(g,m)),y=Math.abs(i.Om(g,h)),b=Math.abs(i.Om(g,f));if(.001>Math.abs(1-v))t=c[0],o=m;else if(.001>Math.abs(1-y))t=c[1],o=h;else if(.001>Math.abs(1-b))t=c[2],o=f;else throw Error("No support yet for oblique plane planar contours");let I=Math.abs(i.Om(p,m)),x=Math.abs(i.Om(p,h)),C=Math.abs(i.Om(p,f));if(.001>Math.abs(1-I))n=c[0],s=m;else if(.001>Math.abs(1-x))n=c[1],s=h;else if(.001>Math.abs(1-C))n=c[2],s=f;else throw Error("No support yet for oblique plane planar contours");r=[t,n]}return{spacing:[r[0]/t,r[1]/t],xDir:o,yDir:s}}},99963:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=function e(t){for(let r of Object.getOwnPropertyNames(t)){let n=t[r];n&&"object"==typeof n&&e(n)}return Object.freeze(t)}({axial:{viewPlaneNormal:[0,0,-1],viewUp:[0,-1,0],viewRight:[1,0,0]},sagittal:{viewPlaneNormal:[1,0,0],viewUp:[0,0,1],viewRight:[0,1,0]},coronal:{viewPlaneNormal:[0,-1,0],viewUp:[0,0,1],viewRight:[1,0,0]}})}}]); \ No newline at end of file diff --git a/_next/static/chunks/808.846f0159cc232e21.js b/_next/static/chunks/808.846f0159cc232e21.js new file mode 100644 index 0000000000000000000000000000000000000000..741052b3854ddc9e9a6c695ed732904d7ddb7a3a --- /dev/null +++ b/_next/static/chunks/808.846f0159cc232e21.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[808],{5808:(e,t,n)=>{n.r(t),n.d(t,{SliceSyncToggle:()=>r});var a=n(95155),i=n(12115),l=n(55545),s=n(36178);function r(){let[e,t]=(0,i.useState)(()=>(0,s.BX)());return(0,a.jsxs)("button",{type:"button",onClick:()=>{let n=!e;(0,s.rr)(n),t(n)},title:e?"Panes are linked to the same relative depth through the volume. Alignment is approximate: the studies are not registered to each other.":"Panes scroll independently. They may show different anatomical levels.",className:(0,l.cn)("flex items-center gap-1 rounded px-2 py-0.5 text-[10px] uppercase tracking-wider transition-colors",e?"bg-signal-info/20 text-signal-info":"text-clinical-dim hover:text-clinical-muted"),children:[(0,a.jsx)("span",{className:(0,l.cn)("size-1.5 rounded-full",e?"bg-signal-info":"bg-clinical-500")}),"linked",e&&(0,a.jsx)("span",{className:"normal-case tracking-normal opacity-70",children:"(approx)"})]})}}}]); \ No newline at end of file diff --git a/_next/static/chunks/942.1c41165479333662.js b/_next/static/chunks/942.1c41165479333662.js new file mode 100644 index 0000000000000000000000000000000000000000..fd483ec8cc420e2912e8c697d81cb38931c54548 --- /dev/null +++ b/_next/static/chunks/942.1c41165479333662.js @@ -0,0 +1,2 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[942],{894:(e,t,n)=>{"use strict";n.d(t,{A:()=>D});var r,a=n(85839),i=n(70192),o=n(82006),s=n(11492),l=n(97442),c=n(59998),u=n(10353),d=n(34699),g=n(73904),h=n(17964),m=n(78378),p=n(34470),f=n(41918),v=n(77047),A=n(4101),I=n(60212),S=n(69340),E=n(29544),_=n(46704),M=n(83048),b=n(68764),y=n(17167);let{transformWorldToIndex:T,transformWorldToIndexContinuous:R}=i.BF;class w extends a.EC{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{storePointData:!1,shadow:!0,preventHandleOutsideImage:!1,calculateStats:!0,getTextLines:y.d6,statsCalculator:M.OA,targetsFilter:a.F6.allPixelData}}){super(e,t),this.addNewAnnotation=e=>{let{currentPoints:t,element:n}=e.detail,r=t.world,{viewport:a}=(0,i.kJ)(n);this.isDrawing=!0;let o=this.constructor.createAnnotationForViewport(a,{data:{handles:{points:[[...r],[...r],[...r],[...r]],textBox:{hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}}},cachedStats:{}}});(0,l.lC)(o,n);let s=(0,p.Q0)(n,this.getToolName());return this.editData={annotation:o,viewportIdsToRender:s,handleIndex:3,movingTextBox:!1,newAnnotation:!0,hasMoved:!1},this._activateDraw(n),(0,A.lY)(n),e.preventDefault(),(0,I.A)(s),o},this.isPointNearTool=(e,t,n,r)=>{let{viewport:a}=(0,i.kJ)(e),{data:o}=t,{points:s}=o.handles,l=a.worldToCanvas(s[0]),c=a.worldToCanvas(s[3]),u=this._getRectangleImageCoordinates([l,c]),d=[n[0],n[1]],{left:g,top:h,width:m,height:p}=u;return v.A([g,h,m,p],d)<=r},this.toolSelectedCallback=(e,t)=>{let{element:n}=e.detail;t.highlighted=!0;let r=(0,p.Q0)(n,this.getToolName());this.editData={annotation:t,viewportIdsToRender:r,movingTextBox:!1},this._activateModify(n),(0,A.lY)(n),(0,I.A)(r),e.preventDefault()},this.handleSelectedCallback=(e,t,n)=>{let r,{element:a}=e.detail,{data:i}=t;t.highlighted=!0;let o=!1;n.worldPosition?o=!0:r=i.handles.points.findIndex(e=>e===n);let s=(0,p.Q0)(a,this.getToolName());this.editData={annotation:t,viewportIdsToRender:s,handleIndex:r,movingTextBox:o},this._activateModify(a),(0,A.lY)(a),(0,I.A)(s),e.preventDefault()},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:r,newAnnotation:a,hasMoved:i}=this.editData,{data:o}=n;(!a||i)&&(o.handles.activeHandleIndex=null,this._deactivateModify(t),this._deactivateDraw(t),(0,A.Q_)(t),this.doneEditMemo(),this.editData=null,this.isDrawing=!1,this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,l.O8)(n.annotationUID),(0,I.A)(r),a&&(0,d.triggerAnnotationCompleted)(n))},this._dragCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{annotation:r,viewportIdsToRender:a,handleIndex:o,movingTextBox:s,newAnnotation:l}=this.editData;this.createMemo(n,r,{newAnnotation:l});let{data:c}=r;if(s){let{deltaPoints:e}=t,n=e.world,{textBox:r}=c.handles,{worldPosition:a}=r;a[0]+=n[0],a[1]+=n[1],a[2]+=n[2],r.hasMoved=!0}else if(void 0===o){let{deltaPoints:e}=t,n=e.world,{points:a}=c.handles;a.forEach(e=>{e[0]+=n[0],e[1]+=n[1],e[2]+=n[2]}),r.invalidated=!0}else{let e,a,s,l,u,d,g,h,{currentPoints:m}=t,{worldToCanvas:p,canvasToWorld:f}=(0,i.kJ)(n).viewport,v=m.world,{points:A}=c.handles;switch(A[o]=[...v],o){case 0:case 3:e=p(A[0]),a=[(l=p(A[3]))[0],e[1]],s=[e[0],l[1]],d=f(a),g=f(s),A[1]=d,A[2]=g;break;case 1:case 2:a=p(A[1]),e=[(s=p(A[2]))[0],a[1]],l=[a[0],s[1]],u=f(e),h=f(l),A[0]=u,A[3]=h}r.invalidated=!0}this.editData.hasMoved=!0,(0,i.kJ)(n),(0,I.A)(a),r.invalidated&&(0,d.triggerAnnotationModified)(r,n,m.wi.HandlesUpdated)},this.cancel=e=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateDraw(e),this._deactivateModify(e),(0,A.Q_)(e);let{annotation:t,viewportIdsToRender:n,newAnnotation:r}=this.editData,{data:a}=t;return t.highlighted=!1,a.handles.activeHandleIndex=null,(0,I.A)(n),r&&(0,d.triggerAnnotationCompleted)(t),this.editData=null,t.annotationUID}},this._activateDraw=e=>{h.wk.isInteractingWithTool=!0,e.addEventListener(m.sV.MOUSE_UP,this._endCallback),e.addEventListener(m.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(m.sV.MOUSE_MOVE,this._dragCallback),e.addEventListener(m.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(m.sV.TOUCH_END,this._endCallback),e.addEventListener(m.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(m.sV.TOUCH_TAP,this._endCallback)},this._deactivateDraw=e=>{h.wk.isInteractingWithTool=!1,e.removeEventListener(m.sV.MOUSE_UP,this._endCallback),e.removeEventListener(m.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(m.sV.MOUSE_MOVE,this._dragCallback),e.removeEventListener(m.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(m.sV.TOUCH_END,this._endCallback),e.removeEventListener(m.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(m.sV.TOUCH_TAP,this._endCallback)},this._activateModify=e=>{h.wk.isInteractingWithTool=!0,e.addEventListener(m.sV.MOUSE_UP,this._endCallback),e.addEventListener(m.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(m.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(m.sV.TOUCH_END,this._endCallback),e.addEventListener(m.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(m.sV.TOUCH_TAP,this._endCallback)},this._deactivateModify=e=>{h.wk.isInteractingWithTool=!1,e.removeEventListener(m.sV.MOUSE_UP,this._endCallback),e.removeEventListener(m.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(m.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(m.sV.TOUCH_END,this._endCallback),e.removeEventListener(m.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(m.sV.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(e,t)=>{let n=!1,{viewport:r}=e,{element:a}=r,o=(0,l.Rh)(this.getToolName(),a);if(!o?.length||(o=this.filterInteractableAnnotationsForElement(a,o),!o?.length))return n;let s=r.getRenderingEngine(),d={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let a=0;ar.worldToCanvas(e)),S=this.getMeasurementTargets(r,p);d.annotationUID=m;let{color:_,lineWidth:M,lineDash:y}=this.getAnnotationStyle({annotation:h,styleSpecifier:d}),{viewPlaneNormal:T,viewUp:R}=(0,f.A)(r);if(this.ensureCachedStatsTargets(p,S,e=>null==e.areaUnit))this._calculateCachedStats(h,T,R,e);else if(h.invalidated&&(this._throttledCalculateCachedStats(h,T,R,e),r instanceof i.PX)){let{referencedImageId:e}=h.metadata;for(let t in p.cachedStats)t.startsWith("imageId")&&s.getViewports().filter(E.hz).find(t=>{let n=i.BF.imageIdToURI(e),r=t.hasImageURI(n),a=i.BF.imageIdToURI(t.getCurrentImageId());return r&&a!==n})&&delete p.cachedStats[t]}if(!r.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}if(!(0,u.YY)(m))continue;(0,c.Gh)(m)||this.editData||null==A||(l=[I[A]]);let w=!!(0,b.h)("showHandlesAlways",{});(l||w)&&(0,g.qX)(t,m,"0",w?I:l,{color:_});let D=`${m}-rect`;(0,g.pJ)(t,m,"0",I,{color:_,lineDash:y,lineWidth:M},D),n=!0;let C=this.configuration.getTextLines(p,S);if(C?.length&&!this.renderLinkedTextBoxAnnotation({enabledElement:e,svgDrawingHelper:t,annotation:h,styleSpecifier:d,textLines:C,canvasCoordinates:I}))continue}return n},this._getRectangleImageCoordinates=e=>{let[t,n]=e;return{left:Math.min(t[0],n[0]),top:Math.min(t[1],n[1]),width:Math.abs(t[0]-n[0]),height:Math.abs(t[1]-n[1])}},this._calculateCachedStats=(e,t,n,a)=>{if(!this.configuration.calculateStats)return;let{data:i}=e,{viewport:s}=a,{element:l}=s,c=i.handles.points,{cachedStats:u}=i;if(e.invalidated){let e=this.getMeasurementTargets(s,i);for(let e of Object.keys(u))delete u[e];this.ensureCachedStatsTargets(i,e)}let g=Object.keys(u),h=!1;for(let t=0;tR(l,e)),f=T(l,c[0]),v=T(l,c[3]),A=!this._isInsideVolume(f,v,i);if(h||=A,A)u[n]={Modality:d.Modality};else{let t,i=Math.min(f[0],v[0]),c=Math.max(f[0],v[0]),g=Math.min(f[1],v[1]),h=Math.max(f[1],v[1]),A=[[i,c],[g,h],[Math.min(f[2],v[2]),Math.max(f[2],v[2])]],I=[f,v],E=(0,o.Op)(a,I),M=Math.abs(r.calculateLengthInIndex(E,[p[0],p[1]])*r.calculateLengthInIndex(E,[p[0],p[2]])),{areaUnit:b}=E,y={isPreScaled:(0,_.u)(s,n),isSuvScaled:this.isSuvScaled(s,n,e.metadata.referencedImageId)},T=(0,S.j)(d.Modality,e.metadata.referencedImageId,y);m&&(t=m.forEach(this.configuration.statsCalculator.statsCallback,{boundsIJK:A,imageData:l,returnPoints:this.configuration.storePointData}));let R=this.configuration.statsCalculator.getStatistics();u[n]={Modality:d.Modality,area:M,mean:R.mean?.value,stdDev:R.stdDev?.value,max:R.max?.value,min:R.min?.value,statsArray:R.array,pointsInShape:t,areaUnit:b,modalityUnit:T}}}this.isHandleOutsideImage=h;let p=e.invalidated;return e.invalidated=!1,p&&(0,d.triggerAnnotationModified)(e,l,m.wi.StatsUpdated),u},this._isInsideVolume=(e,t,n)=>i.BF.indexWithinDimensions(e,n)&&i.BF.indexWithinDimensions(t,n),this._throttledCalculateCachedStats=(0,s.A)(this._calculateCachedStats,100,{trailing:!0})}}r=w,w.toolName="RectangleROI",w.hydrate=(e,t,n)=>{let a=(0,i.yj)(e);if(!a)return;let{FrameOfReferenceUID:o,referencedImageId:s,viewPlaneNormal:c,instance:u,viewport:d}=r.hydrateBase(r,a,t,n),{toolInstance:g,...h}=n||{},m={annotationUID:n?.annotationUID||i.BF.uuidv4(),data:{handles:{points:t,activeHandleIndex:null},label:"",cachedStats:{}},highlighted:!1,autoGenerated:!1,invalidated:!1,isLocked:!1,isVisible:!0,metadata:{toolName:u.getToolName(),viewPlaneNormal:c,FrameOfReferenceUID:o,referencedImageId:s,...h}};(0,l.lC)(m,d.element),(0,I.A)([d.id])};let D=w},2468:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(21167);function a(e){let t=(0,r.A)(e);if(t?.length)return t.find(t=>t.getImageIds().some(t=>t===e.metadata.referencedImageId))??t[0]}},3533:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>u});var r=n(17042),a=n(58804),i=n(54914),o=n(66888),s=n(85250),l={mapper:null,forceOpaque:!1,forceTranslucent:!1};function c(e,t,n={}){Object.assign(t,l,n),i.Ay.extend(e,t,n),t.boundsMTime={},r.Ay.obj(t.boundsMTime),r.Ay.setGet(e,t,["mapper","forceOpaque","forceTranslucent"]),t.classHierarchy.push("vtkImageSlice"),e.getActors=()=>e,e.getImages=()=>e,e.getIsOpaque=()=>{if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.properties[0]||e.getProperty();let n=t.properties[0].getOpacity()>=1;return n&&(!t.mapper||t.mapper.getIsOpaque())},e.hasTranslucentPolygonalGeometry=()=>!1,e.makeProperty=o.Ay.newInstance,e.getBoundsForSlice=(n,r)=>{let i=t.mapper.getBoundsForSlice(n,r);if(!a.Ay.isValid(i))return i;e.computeMatrix();let o=new Float64Array(16);return s.transpose(o,t.matrix),a.Ay.transformBounds(i,o)},e.getMinXBound=()=>e.getBoundsByReference()[0],e.getMaxXBound=()=>e.getBoundsByReference()[1],e.getMinYBound=()=>e.getBoundsByReference()[2],e.getMaxYBound=()=>e.getBoundsByReference()[3],e.getMinZBound=()=>e.getBoundsByReference()[4],e.getMaxZBound=()=>e.getBoundsByReference()[5],e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),e=(n=t.mapper.getInput().getMTime())>e?n:e)}return t.properties.forEach(t=>{e=Math.max(e,t.getMTime());let n=t.getRGBTransferFunction();null!==n&&(e=Math.max(e,n.getMTime()))}),e},e.getSupportsSelection=()=>!!t.mapper&&t.mapper.getSupportsSelection()}var u={newInstance:r.Ay.newInstance(c,"vtkImageSlice"),extend:c}},3821:(e,t,n)=>{"use strict";var r=n(81863),a=n(70192),i=n(15695);class o{static statsInit(e){let{storePointData:t,indices:n,mode:r}=e;this.mode=r,this.indices=n,this.calculators.clear(),"individual"===this.mode?n.forEach(e=>{this.calculators.set(e,new i.C3({storePointData:t}))}):this.calculators.set(n,new i.C3({storePointData:t}))}static statsCallback(e){let{segmentIndex:t,...n}=e;if(!t)throw Error("Segment index is required for stats calculation");let r="individual"===this.mode?this.calculators.get(t):this.calculators.get(this.indices);if(!r)throw Error(`No calculator found for segment ${t}`);r.statsCallback(n)}static getStatistics(e){if("individual"===this.mode){let t={};return this.calculators.forEach((n,r)=>{t[r]=n.getStatistics(e)}),t}return this.calculators.get(this.indices).getStatistics(e)}}o.calculators=new Map,o.indices=[],o.mode="collective",n(52210),n(80455),n(35558),n(65114);var s=n(78378),l=n(43385),c=n(51200),u=n(69548),d=n(17964),g=n(49007),h=n(50923),m=n(82006),p=n(33845),f=n(12487),v=n(11492),A=n(34470),I=n(60212),S=n(1571),E=n(98040),_=n(78985),M=n(62901),b=n(25002),y=n(46883),T=n(34699),R=n(42067),w=n(46704),D=n(83048),C=n(1760),x=n(69340),L=n(82147);let{pointCanProjectOnLine:O}=p.XL,{p8:P}=a.Jj,N=1-P;class F extends C.A{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{storePointData:!1,shadow:!0,preventHandleOutsideImage:!1,contourHoleAdditionModifierKey:s.qv.Shift,alwaysRenderOpenContourHandles:{enabled:!1,radius:2},allowOpenContours:!0,closeContourProximity:10,checkCanvasEditFallbackProximity:6,makeClockWise:!0,subPixelResolution:4,smoothing:{smoothOnAdd:!1,smoothOnEdit:!1,knotsRatioPercentageOnAdd:40,knotsRatioPercentageOnEdit:40},interpolation:{enabled:!1,onInterpolationComplete:null},decimate:{enabled:!1,epsilon:.1},displayOnePointAsCrosshairs:!1,calculateStats:!0,getTextLines:V,statsCalculator:D.OA}}){super(e,t),this.isDrawing=!1,this.isEditingClosed=!1,this.isEditingOpen=!1,this.addNewAnnotation=e=>{let{element:t}=e.detail,n=this.createAnnotation(e);this.addAnnotation(n,t);let r=(0,A.Q0)(t,this.getToolName());return this.activateDraw(e,n,r),e.preventDefault(),(0,I.A)(r),n},this.handleSelectedCallback=(e,t,n)=>{let{element:r}=e.detail,a=(0,A.Q0)(r,this.getToolName());this.activateOpenContourEndEdit(e,t,a,n)},this.toolSelectedCallback=(e,t)=>{let{element:n}=e.detail,r=(0,A.Q0)(n,this.getToolName());t.data.contour.closed?this.activateClosedContourEdit(e,t,r):this.activateOpenContourEdit(e,t,r),e.preventDefault()},this.isPointNearTool=(e,t,n,r)=>{let{viewport:i}=(0,a.kJ)(e),{polyline:o}=t.data.contour,s=i.worldToCanvas(o[0]);for(let e=1;e{let t=this.isDrawing,n=this.isEditingOpen,r=this.isEditingClosed;t?this.cancelDrawing(e):n?this.cancelOpenContourEdit(e):r&&this.cancelClosedContourEdit(e)},this._calculateCachedStats=(e,t,n,r)=>{let{data:i}=e,{cachedStats:o}=i,{polyline:l,closed:c}=i.contour,u=Object.keys(o);for(let n=0;nt.worldToCanvas(e)),A={isPreScaled:(0,w.u)(t,r),isSuvScaled:this.isSuvScaled(t,r,e.metadata.referencedImageId)},I=(0,x.j)(g.Modality,e.metadata.referencedImageId,A),S=i.contour.polyline,E=S.length,_=Array(E);for(let e=0;e{let{data:a}=e,i=this.getTargetId(t,a),o={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:n.viewport.id,annotationUID:e.annotationUID},s=this.configuration.getTextLines(a,i);if(!s||0===s.length)return;let l=a.contour.polyline.map(e=>t.worldToCanvas(e));this.renderLinkedTextBoxAnnotation({enabledElement:n,svgDrawingHelper:r,annotation:e,styleSpecifier:o,textLines:s,canvasCoordinates:l})},(0,S.A)(this),(0,E.A)(this),(0,_.A)(this),(0,M.A)(this),(0,b.A)(this),(0,y.A)(this),this._throttledCalculateCachedStats=(0,v.A)(this._calculateCachedStats,100,{trailing:!0})}filterInteractableAnnotationsForElement(e,t){let n;if(!t?.length)return[];let r=super.filterInteractableAnnotationsForElement(e,t);if(!r?.length)return[];let{viewport:i}=(0,a.kJ)(e);if(i instanceof a.PX){let e=i.getCamera(),{spacingInNormalDirection:t}=a.BF.getTargetVolumeAndSpacingInNormalDir(i,e);n=this.filterAnnotationsWithinSlice(r,e,t)}else n=(0,f.k9)(i,t);return n}filterAnnotationsWithinSlice(e,t,n){let{viewPlaneNormal:r}=t,i=e.filter(e=>{let n=e.metadata.viewPlaneNormal;if(!e.metadata.referencedImageId&&!n&&e.metadata.FrameOfReferenceUID){for(let n of e.data.contour.polyline){let e=h.jb(h.vt(),n,t.focalPoint),r=h.Om(e,t.viewPlaneNormal);if(!a.BF.isEqual(r,0))return!1}return e.metadata.viewPlaneNormal=t.viewPlaneNormal,e.metadata.cameraFocalPoint=t.focalPoint,!0}if(!n){let{referencedImageId:t}=e.metadata,{imageOrientationPatient:r}=a.wx.get("imagePlaneModule",t),i=h.fA(r[0],r[1],r[2]),o=h.fA(r[3],r[4],r[5]);n=h.vt(),h.$A(n,i,o),e.metadata.viewPlaneNormal=n}let i=Math.abs(h.Om(r,n))>N;return n&&i});if(!i.length)return[];let o=n/2,{focalPoint:s}=t,l=[];for(let e of i){let t=e.data.contour.polyline[0];if(!e.isVisible)continue;let n=h.vt();h.jb(n,s,t),Math.abs(h.Om(n,r)){e.data.handles.points.length=0}})}getAnnotationStyle(e){return super.getAnnotationStyle(e)}renderAnnotationInstance(e){let{enabledElement:t,targetId:n,svgDrawingHelper:r}=e,a=e.annotation,i=!1,{viewport:o,renderingEngine:s}=t,l=this.isDrawing,c=this.isEditingOpen,u=this.isEditingClosed;if(l||c||u){let e=this.commonData.annotation.annotationUID;if(a.annotationUID===e)if(l)this.renderContourBeingDrawn(t,r,a);else if(u)this.renderClosedContourBeingEdited(t,r,a);else if(c)this.renderOpenContourBeingEdited(t,r,a);else throw Error(`Unknown ${this.getToolName()} annotation rendering state`);else this.configuration.displayOnePointAsCrosshairs&&1===a.data.contour.polyline.length?this.renderPointContourWithMarker(t,r,a):this.renderContour(t,r,a);i=!0}else this.configuration.displayOnePointAsCrosshairs&&1===a.data.contour.polyline.length?this.renderPointContourWithMarker(t,r,a):this.renderContour(t,r,a);if(!this.configuration.calculateStats)return;let{data:d,invalidated:g}=a,h=d?.cachedStats;return(g||!h?.[n])&&this._calculateStatsIfActive(a,n,o,s,t),this._renderStats(a,o,t,r),i}_calculateStatsIfActive(e,t,n,r,a){let i=this.commonData?.annotation.annotationUID;if((e.annotationUID!==i||this.commonData?.movingTextBox)&&!this.commonData?.movingTextBox){let{data:i}=e;i.cachedStats[t]?.unit?e.invalidated&&this._throttledCalculateCachedStats(e,n,r,a):(i.cachedStats[t]={Modality:null,area:null,max:null,mean:null,stdDev:null,areaUnit:null,unit:null},this._calculateCachedStats(e,n,r,a))}}updateClosedCachedStats({viewport:e,points:t,imageData:n,metadata:r,voxelManager:a,cachedStats:i,targetId:o,modalityUnit:l,canvasCoordinates:c,calibratedScale:u,deltaInX:d,deltaInY:g}){let h,{areaUnit:m,unit:f}=u,v=t.map(e=>n.worldToIndex(e)),A=n.getDimensions(),I=Number.MAX_SAFE_INTEGER,S=Number.MIN_SAFE_INTEGER,E=Number.MAX_SAFE_INTEGER,_=Number.MIN_SAFE_INTEGER,M=Number.MAX_SAFE_INTEGER,b=Number.MIN_SAFE_INTEGER;for(let e=0;e{let r=!0,a=e.worldToCanvas(t);a[1]!=N&&(U=0,N=a[1],(V=(0,R.getLineSegmentIntersectionsCoordinates)(c,a,[P[0],a[1]])).sort(function(e,t){return e[0]===t[0]?0:e[0]V[0][0]&&(V.shift(),U++),U%2==0&&(r=!1),r},boundsIJK:x,returnPoints:this.configuration.storePointData}));let k=this.configuration.statsCalculator.getStatistics(),B={name:"area",value:y,unit:m,type:s.Jf.Area},G={name:"perimeter",value:T,unit:f,type:s.Jf.Linear};i[o]={Modality:r.Modality,area:y,perimeter:T,mean:k.mean?.value,max:k.max?.value,min:k.min?.value,stdDev:k.stdDev?.value,statsArray:[B,G,...k.array],pointsInShape:h,areaUnit:m,modalityUnit:l,unit:f}}updateOpenCachedStats({targetId:e,metadata:t,cachedStats:n,modalityUnit:r,calibratedScale:a,imageData:i,points:o}){let{unit:l}=a,c=o.map(e=>i.worldToIndex(e)),u=F.calculateLengthInIndex(a,c),d={name:"length",value:u,unit:l,type:s.Jf.Linear};n[e]={Modality:t.Modality,length:u,modalityUnit:r,unit:l,statArray:[d]}}}function V(e,t){let{area:n,mean:r,stdDev:i,length:o,perimeter:s,max:l,min:c,isEmptyArea:u,unit:d,areaUnit:g,modalityUnit:h}=e.cachedStats[t]||{},m=[];if(a.BF.isNumber(n)){let e=u?"Area: Oblique not supported":`Area: ${a.BF.roundNumber(n)} ${g}`;m.push(e)}return a.BF.isNumber(r)&&m.push(`Mean: ${a.BF.roundNumber(r)} ${h}`),a.BF.isNumber(l)&&m.push(`Max: ${a.BF.roundNumber(l)} ${h}`),a.BF.isNumber(c)&&m.push(`Min: ${a.BF.roundNumber(c)} ${h}`),a.BF.isNumber(i)&&m.push(`Std Dev: ${a.BF.roundNumber(i)} ${h}`),a.BF.isNumber(s)&&m.push(`Perimeter: ${a.BF.roundNumber(s)} ${d}`),a.BF.isNumber(o)&&m.push(`${a.BF.roundNumber(o)} ${d}`),m}F.toolName="PlanarFreehandROI";let U=F;var k=n(20832);class B extends U{constructor(e){super(a.BF.deepMerge({configuration:{calculateStats:!1,allowOpenContours:!1}},e))}isContourSegmentationTool(){return!0}renderAnnotationInstance(e){let t=e.annotation,{invalidated:n}=t,r=super.renderAnnotationInstance(e);if(n){let{segmentationId:e}=t.data.segmentation;(0,g.triggerSegmentationDataModified)(e)}return r}}B.toolName="PlanarFreehandContourSegmentationTool",k.A.register(B);var G=n(42306),H=n(87944),W=n(4055);let X=B.toolName;class j{constructor(){this._needsRender=new Set,this._pendingRenderQueue=[],this._animationFrameSet=!1,this._animationFrameHandle=null,this._getAllViewports=()=>(0,a.qO)().flatMap(e=>e.getViewports()),this._renderFlaggedSegmentations=()=>{if(this._throwIfDestroyed(),Array.from(this._needsRender).forEach(e=>{this._triggerRender(e)}),this._needsRender.clear(),this._animationFrameSet=!1,this._animationFrameHandle=null,this._pendingRenderQueue.length>0){let e=this._pendingRenderQueue.shift();e&&e.length>0&&this._setViewportsToBeRenderedNextFrame(e)}}}renderSegmentationsForViewport(e){let t=e?[e]:this._getViewportIdsForSegmentation();this._setViewportsToBeRenderedNextFrame(t)}renderSegmentation(e){let t=this._getViewportIdsForSegmentation(e);this._setViewportsToBeRenderedNextFrame(t)}_getViewportIdsForSegmentation(e){let t=this._getAllViewports(),n=[];for(let r of t){let t=r.id;if(e){let r=(0,c.r$)(t,{segmentationId:e});r?.length>0&&n.push(t)}else{let e=(0,c.r$)(t);e?.length>0&&n.push(t)}}return n}_throwIfDestroyed(){if(this.hasBeenDestroyed)throw Error("this.destroy() has been manually called to free up memory, can not longer use this instance. Instead make a new one.")}_setViewportsToBeRenderedNextFrame(e){if(this._animationFrameSet)return void this._pendingRenderQueue.push(e);e.forEach(e=>{this._needsRender.add(e)}),this._render()}_render(){this._needsRender.size>0&&!1===this._animationFrameSet&&(this._animationFrameHandle=window.requestAnimationFrame(this._renderFlaggedSegmentations),this._animationFrameSet=!0)}_triggerRender(e){let t=(0,c.r$)(e);if(!t?.length)return;let{viewport:n}=(0,a.yj)(e)||{};n&&Promise.allSettled(t.map(e=>{e.type===s.D_.Contour&&this._addPlanarFreeHandToolIfAbsent(n);let t=(0,W.I)(e.type),r=void 0!==(0,l.T)(e.segmentationId).representationData[e.type];return t?t.render(n,e).then(()=>(r||(0,H.Np)(n,e.segmentationId,e.type),{segmentationId:e.segmentationId,type:e.type})).catch(t=>(console.error(t),{segmentationId:e.segmentationId,type:e.type})):(console.warn(`No display registered for segmentation representation type ${e.type}.`),Promise.resolve({segmentationId:e.segmentationId,type:e.type}))})).then(e=>{let t=e.filter(e=>"fulfilled"===e.status).map(e=>e.value);n.element.addEventListener(a.fX.sV.IMAGE_RENDERED,function e(n){let{element:r,viewportId:i}=n.detail;r.removeEventListener(a.fX.sV.IMAGE_RENDERED,e),t.forEach(e=>{let t={viewportId:i,segmentationId:e.segmentationId,type:e.type};(0,a.Hl)(a.tX,s.sV.SEGMENTATION_RENDERED,{...t})})}),n.render()})}_addPlanarFreeHandToolIfAbsent(e){X in d.wk.tools||(0,u.Gx)(B);let t=(0,G.getToolGroupForViewport)(e.id);t.hasTool(X)||(t.addTool(X),t.setToolPassive(X))}}new j,n(91912),n(54044),n(68002),n(6972),n(12236),n(40155),n(38433),n(12722),n(97442),n(81480),n(97132),n(91792),n(66442),n(5205),n(41918),n(11212);let{transformWorldToIndex:z}=a.BF,{transformWorldToIndex:J}=a.BF;n(6001),n(67358),n(5800),n(2911),n(81038),n(75405),n(11236),n(32207),n(69301),n(69435),n(46702),n(83143),n(51889),n(26361),n(96313);var Y=n(17042),$=class{constructor(e=!1){this.oriented=e,this.edgeMap=new Map}initialize(){this.edgeMap.clear()}computeEdgeKey(e,t){return this.oriented||et.contourValues,e.setContourValues=n=>{t.contourValues=n,e.modified()};let r=[],a=[],i=[],o=K.newInstance();e.getPixelScalars=(e,t,n,i,o,s)=>{let[l,c,u]=e;r[0]=u*t[1]*t[0]+c*t[0]+l,r[1]=r[0]+i[o],r[2]=r[0]+i[s],r[3]=r[2]+i[o];for(let e=0;e<4;++e)a[e]=n[r[e]]},e.getPixelPoints=(e,t,n,r)=>{let a=[...e];r(a,i),a[t]+=1;let o=r(a,[]);i[3]=o[0],i[4]=o[1],i[5]=o[2],a[n]+=1,r(a,o),i[9]=o[0],i[10]=o[1],i[11]=o[2],a[t]-=1,r(a,o),i[6]=o[0],i[7]=o[1],i[8]=o[2]},e.produceLines=(n,s,l,c,u,d,g,h,m,p)=>{let f,v=[1,2,8,4],A=[];e.getPixelScalars(s,l,c,g,h,m);let I=0;for(let e=0;e<4;e++)a[e]>=n&&(I|=v[e]);let S=ee.getCase(I);if(!(S[0]<0)){e.getPixelPoints(s,h,m,p);for(let e=0;S[e]>=0;e+=2){d.push(2);for(let s=0;s<2;s++){let l=ee.getEdge(S[e+s]);if(f=void 0,t.mergePoints&&(f=o.isInsertedEdge(r[l[0]],r[l[1]])?.value),void 0===f){let e=(n-a[l[0]])/(a[l[1]]-a[l[0]]),s=i.slice(3*l[0],(l[0]+1)*3),c=i.slice(3*l[1],(l[1]+1)*3);A[0]=s[0]+e*(c[0]-s[0]),A[1]=s[1]+e*(c[1]-s[1]),A[2]=s[2]+e*(c[2]-s[2]),f=u.length/3,u.push(A[0],A[1],A[2]),t.mergePoints&&o.insertEdge(r[l[0]],r[l[1]],f)}d.push(f)}}}},e.requestData=(n,r)=>{let a,i,s=n[0];if(!s)return void et("Invalid or missing input");if(null==t.slicingMode||t.slicingMode<0||t.slicingMode>2)return void et("Invalid or missing slicing mode");console.time("msquares");let l=s.getDimensions(),c=s.getExtent(),u=s.computeIncrements(c),d=s.getPointData().getScalars().getData(),[g,h]=(a=0,i=1,1===t.slicingMode?(a=0,i=2):0===t.slicingMode&&(a=1,i=2),[a,i]),m=s.indexToWorld,p=[],f=[],v=Math.round(t.slice);v>=l[t.slicingMode]&&(v=0);let A=[0,0,0];A[t.slicingMode]=v;for(let n=0;ned.createScalarVolumeVoxelManager({dimensions:e,scalarData:t}),createDataStructure:e=>{let{scalarData:t,dimensions:n,spacing:r,origin:a,direction:i}=e;return{voxelManager:eg.createVoxelManager(n,t),dimensions:n,spacing:r,origin:a,direction:i,scalarData:t}},createVTKImageData:(e,t,n,r,a)=>{let i=eo.Ay.newInstance();if(i.setDimensions(e),i.setOrigin(t),i.setDirection(n),i.setSpacing(r),!a)return i;let o=ei.Ay.newInstance({name:"Scalars",numberOfComponents:1,values:a});return i.getPointData().setScalars(o),i},processSegmentStatistics:({segVoxelManager:e,imageVoxelManager:t,indices:n,bounds:r,imageData:a})=>{e.forEach(({value:e,pointIJK:r,pointLPS:a,index:i})=>{if(-1===n.indexOf(e))return;let s=t.getAtIndex(i);o.statsCallback({segmentIndex:e,value:s,pointIJK:r,pointLPS:a})},{boundsIJK:r||t.getDefaultBounds(),imageData:a})},performMarchingSquares:(e,t=null,n=null)=>{let r={};null!==t&&(r.slice=t),null!==n&&(r.slicingMode=n);let a=ea.newInstance(r);return a.setInputData(e),a.setContourValues([1]),a.setMergePoints(!1),a.getOutputData()},createContoursFromPolyData:(e,t=null)=>{let n=(0,es.v)(e);return n.points?.length?{contours:(0,el.d1)(n.lines),polyData:n}:null},createSegmentsFromIndices:e=>[null,...e.map(e=>({segmentIndex:e}))],getArgsFromInfo:e=>{let{segmentationInfo:t,imageInfo:n}=e;return{segmentation:t&&eg.createDataStructure(t),image:n&&eg.createDataStructure(n)}},calculateSegmentsStatisticsVolume:e=>{let{mode:t,indices:n,unit:r}=e,{segmentation:a,image:i}=eg.getArgsFromInfo(e),{voxelManager:s,spacing:l}=a,{voxelManager:c}=i,u=eg.createVTKImageData(a.dimensions,a.origin,a.direction,a.spacing);return o.statsInit({storePointData:!1,indices:n,mode:t}),eg.processSegmentStatistics({segVoxelManager:s,imageVoxelManager:c,indices:n,imageData:u}),o.getStatistics({spacing:l,mode:t,unit:r})},computeMetabolicStats({segmentationInfo:e,imageInfo:t}){let{scalarData:n,dimensions:r,spacing:a,origin:i,direction:o}=e,{spacing:s,dimensions:l,direction:c,origin:u,scalarData:d}=t,g=eg.createVoxelManager(e.dimensions,e.scalarData),h=eg.createVoxelManager(l,d),m=0,p=0,f=g.getScalarDataLength();for(let e=0;e0?m/p:0)*p*s[0]*s[1]*s[2]*.001}},calculateSegmentsStatisticsStack:e=>{let{segmentationInfo:t,imageInfo:n,indices:r,mode:a}=e;o.statsInit({storePointData:!0,indices:r,mode:a});for(let e=0;e{let t,{segmentationInfo:n,imageInfo:r,indices:a,mode:i,isStack:o}=e;return o?{segmentation:t}=eg.getArgsFromInfo({segmentationInfo:n[0]}):{segmentation:t}=eg.getArgsFromInfo(e),o?eg.calculateBidirectionalStack({segmentationInfo:n,indices:a,mode:i}):eg.calculateVolumetricBidirectional({segmentation:t,indices:a,mode:i})},findLargestBidirectionalFromContours:(e,t,n)=>{let r;for(let n of e){let e=(0,ec.H)(n,t,r);e&&(r=e)}return r?{segmentIndex:n,majorAxis:r.majorAxis,minorAxis:r.minorAxis,maxMajor:r.maxMajor,maxMinor:r.maxMinor}:null},calculateBidirectionalStack:({segmentationInfo:e,indices:t,mode:n})=>{let r=eg.createSegmentsFromIndices(t),a=[];for(let t=0;t{let{voxelManager:r,dimensions:a,origin:i,direction:o,spacing:s}=e,l=eg.createVTKImageData(a,i,o,s),c=eg.generateContourSetsFromLabelmapVolume({segmentation:e,indices:t,imageData:l,mode:n}),u=[];for(let e=0;e{let{segmentation:t,indices:n}=e,{dimensions:r,scalarData:a,origin:i,direction:o,spacing:s}=t,l=e.imageData;l||(l=eg.createVTKImageData(r,i,o,s));let c=r[2],u=r[0]*r[1],d=eg.createSegmentsFromIndices(n);for(let e=0;e{let a=e*n,i=a+n;for(let e=a;e{"use strict";n.d(t,{I:()=>a});let r=new Map;function a(e){return r.get(e)}},4101:(e,t,n)=>{"use strict";n.d(t,{Q_:()=>o,lY:()=>s});var r=n(29010);let a=Symbol("ElementCursorsMap");function i(e,t){let n=l(e);n[1]=n[0],n[0]=t,e.style.cursor=(t instanceof r.A?t:r.A.getDefinedCursor("auto")).getStyleProperty()}function o(e){i(e,l(e)[1])}function s(e){i(e,r.A.getDefinedCursor("none"))}function l(e){let t=l[a];t instanceof WeakMap||Object.defineProperty(l,a,{value:t=new WeakMap});let n=t.get(e);return n||(n=[null,null],t.set(e,n)),n}},5068:(e,t,n)=>{"use strict";n(43385)},5434:(e,t,n)=>{"use strict";n.d(t,{Bw:()=>d,C:()=>o,Cc:()=>p,Om:()=>m,Re:()=>c,S8:()=>h,WQ:()=>l,Z0:()=>f,aI:()=>A,fA:()=>i,hZ:()=>s,hs:()=>u,m3:()=>g,o8:()=>a,t2:()=>v});var r=n(97633);function a(e){var t=new r.tb(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function i(e,t,n,a){var i=new r.tb(4);return i[0]=e,i[1]=t,i[2]=n,i[3]=a,i}function o(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function s(e,t,n,r,a){return e[0]=t,e[1]=n,e[2]=r,e[3]=a,e}function l(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function c(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}function u(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function d(e){return Math.hypot(e[0],e[1],e[2],e[3])}function g(e){var t=e[0],n=e[1],r=e[2],a=e[3];return t*t+n*n+r*r+a*a}function h(e,t){var n=t[0],r=t[1],a=t[2],i=t[3],o=n*n+r*r+a*a+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=a*o,e[3]=i*o,e}function m(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function p(e,t,n,r){var a=t[0],i=t[1],o=t[2],s=t[3];return e[0]=a+r*(n[0]-a),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=s+r*(n[3]-s),e}function f(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3];return e[0]=n[0]*r+n[4]*a+n[8]*i+n[12]*o,e[1]=n[1]*r+n[5]*a+n[9]*i+n[13]*o,e[2]=n[2]*r+n[6]*a+n[10]*i+n[14]*o,e[3]=n[3]*r+n[7]*a+n[11]*i+n[15]*o,e}function v(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function A(e,t){var n=e[0],a=e[1],i=e[2],o=e[3],s=t[0],l=t[1],c=t[2],u=t[3];return Math.abs(n-s)<=r.p8*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(a-l)<=r.p8*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(i-c)<=r.p8*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(o-u)<=r.p8*Math.max(1,Math.abs(o),Math.abs(u))}!function(){var e;e=new r.tb(4),r.tb!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0)}()},5469:(e,t,n)=>{"use strict";n.d(t,{vl:()=>s});var r=n(32207),a=n(43385),i=n(46702),o=n(66442);function s(e,t){var n,s;let l=(n=e,s=t,r._6.getCurrentLabelmapImageIdsForViewport(n,s));if(!l?.length)return;if(1===l.length)return l[0];let c=(0,a.T)(t),u=(0,i.Q)(t),d=u?(0,o.r)(c,u):void 0;return d?.imageIds?.length?l.find(e=>d.imageIds.includes(e))??l[0]:l[0]}},5966:(e,t,n)=>{"use strict";var r,a=n(50923),i=n(91336),o=n(70192),s=n(82006),l=n(85839),c=n(11492),u=n(93022),d=n(59998),g=n(10353),h=n(34699),m=n(73904),p=n(17964),f=n(78378),v=n(34470),A=n(10458),I=n(16857),S=n(4101),E=n(60212),_=n(68764);class M extends l.EC{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{preventHandleOutsideImage:!1,getTextLines:b}}){super(e,t),this.isPointNearTool=(e,t,n,r)=>{let{viewport:a}=(0,o.kJ)(e),{data:i}=t,{points:s}=i.handles,l=a.worldToCanvas(s[0]),c=a.worldToCanvas(s[1]),u={start:{x:l[0],y:l[1]},end:{x:c[0],y:c[1]}},d=A.A([u.start.x,u.start.y],[u.end.x,u.end.y],[n[0],n[1]]);return d<=r||(l=a.worldToCanvas(s[2]),c=a.worldToCanvas(s[3]),u={start:{x:l[0],y:l[1]},end:{x:c[0],y:c[1]}},(d=A.A([u.start.x,u.start.y],[u.end.x,u.end.y],[n[0],n[1]]))<=r)},this.toolSelectedCallback=(e,t)=>{let{element:n}=e.detail;t.highlighted=!0;let r=(0,v.Q0)(n,this.getToolName());this.editData={annotation:t,viewportIdsToRender:r,movingTextBox:!1},this._activateModify(n);let{renderingEngine:a}=(0,o.kJ)(n);(0,E.A)(r),(0,S.lY)(n),e.preventDefault()},this.handleSelectedCallback=(e,t,n)=>{let r,{element:a}=e.detail,i=t.data;t.highlighted=!0;let s=!1;n.worldPosition?s=!0:r=i.handles.points.findIndex(e=>e===n);let l=(0,v.Q0)(a,this.getToolName());(0,S.lY)(a),this.editData={annotation:t,viewportIdsToRender:l,handleIndex:r,movingTextBox:s},this._activateModify(a);let{renderingEngine:c}=(0,o.kJ)(a);(0,E.A)(l),e.preventDefault()},this._endCallback=e=>{let{element:t}=e.detail,{annotation:n,viewportIdsToRender:r,newAnnotation:s,hasMoved:l}=this.editData,{data:c}=n;if(s&&!l)return;this.doneEditMemo(),c.handles.activeHandleIndex=null,this._deactivateModify(t),this._deactivateDraw(t),(0,S.Q_)(t);let{renderingEngine:d}=(0,o.kJ)(t);if(void 0!==this.editData.handleIndex){let{points:e}=c.handles,t=a.Io(e[0],e[1]);if(a.Io(e[2],e[3])>t){let t,n=[[...e[2]],[...e[3]]],r=[...e[0]],a=[...e[1]],o=i.vt();i.hZ(o,n[1][0]-n[0][0],n[1][1]-n[1][0]);let s=i.vt();i.hZ(s,-o[1],o[0]);let l=i.vt();i.hZ(l,a[0]-r[0],a[1]-r[0]),t=i.Om(l,s)>0?[r,a]:[a,r],c.handles.points=[n[0],n[1],t[0],t[1]]}}this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,u.removeAnnotation)(n.annotationUID),(0,E.A)(r),s&&(0,h.triggerAnnotationCompleted)(n),this.editData=null,this.isDrawing=!1},this._dragDrawCallback=e=>{this.isDrawing=!0;let{currentPoints:t,element:n}=e.detail,{viewport:r}=(0,o.kJ)(n),{worldToCanvas:a}=r,{annotation:s,viewportIdsToRender:l,handleIndex:c,newAnnotation:u}=this.editData;this.createMemo(n,s,{newAnnotation:u});let{data:d}=s,g=t.world;d.handles.points[c]=[...g];let m=d.handles.points.map(a),p={longLineSegment:{start:{x:m[0][0],y:m[0][1]},end:{x:m[1][0],y:m[1][1]}},shortLineSegment:{start:{x:m[2][0],y:m[2][1]},end:{x:m[3][0],y:m[3][1]}}},v=i.Io(m[0],m[1])/3,A=p.longLineSegment.start.x-p.longLineSegment.end.x,I=p.longLineSegment.start.y-p.longLineSegment.end.y,S=Math.sqrt(A*A+I*I),_=A/S,M=I/S,b=(p.longLineSegment.start.x+p.longLineSegment.end.x)/2,y=(p.longLineSegment.start.y+p.longLineSegment.end.y)/2;d.handles.points[2]=r.canvasToWorld([b+v*M,y-v*_]),d.handles.points[3]=r.canvasToWorld([b-v*M,y+v*_]),s.invalidated=!0,(0,E.A)(l),(0,h.triggerAnnotationModified)(s,n,f.wi.HandlesUpdated),this.editData.hasMoved=!0},this._dragModifyCallback=e=>{this.isDrawing=!0;let t=e.detail,{element:n}=t,{annotation:r,viewportIdsToRender:a,handleIndex:i,movingTextBox:o,newAnnotation:s}=this.editData;this.createMemo(n,r,{newAnnotation:s});let{data:l}=r;if(o){let{deltaPoints:e}=t,n=e.world,{textBox:r}=l.handles,{worldPosition:a}=r;a[0]+=n[0],a[1]+=n[1],a[2]+=n[2],r.hasMoved=!0}else if(void 0===i){let{deltaPoints:e}=t,n=e.world;l.handles.points.forEach(e=>{e[0]+=n[0],e[1]+=n[1],e[2]+=n[2]}),r.invalidated=!0}else this._dragModifyHandle(e),r.invalidated=!0;(0,E.A)(a),r.invalidated&&(0,h.triggerAnnotationModified)(r,n,f.wi.HandlesUpdated)},this._dragModifyHandle=e=>{let{currentPoints:t,element:n}=e.detail,{viewport:r}=(0,o.kJ)(n),{annotation:a,handleIndex:s}=this.editData,{data:l}=a,c=t.world,u=[r.worldToCanvas(l.handles.points[0]),r.worldToCanvas(l.handles.points[1]),r.worldToCanvas(l.handles.points[2]),r.worldToCanvas(l.handles.points[3])],d={start:{x:u[0][0],y:u[0][1]},end:{x:u[1][0],y:u[1][1]}},g={start:{x:u[2][0],y:u[2][1]},end:{x:u[3][0],y:u[3][1]}},h=[...c],m=r.worldToCanvas(h);if(0===s||1===s){let e=u[+(0===s)],t=i.hZ(i.vt(),m[0]-e[0],m[1]-e[1]),n=i.hZ(i.vt(),u[s][0]-e[0],u[s][1]-e[1]);i.S8(t,t),i.S8(n,n);let a={start:{x:e[0],y:e[1]},end:{x:m[0],y:m[1]}};if(this._movingLongAxisWouldPutItThroughShortAxis(a,g))return;let o=this._getSignedAngle(n,t),c=u[2][0],d=u[2][1],p=u[3][0],f=u[3][1];c-=e[0],d-=e[1],p-=e[0],f-=e[1];let v=c*Math.cos(o)-d*Math.sin(o),A=c*Math.sin(o)+d*Math.cos(o),I=p*Math.cos(o)-f*Math.sin(o),S=p*Math.sin(o)+f*Math.cos(o);c=v+e[0],d=A+e[1],p=I+e[0],f=S+e[1];let E=r.canvasToWorld([c,d]),_=r.canvasToWorld([p,f]);l.handles.points[s]=h,l.handles.points[2]=E,l.handles.points[3]=_}else{let e=2===s?3:2,t={longLineSegment:{start:d.start,end:d.end},shortLineSegment:{start:g.start,end:g.end}},n=i.Re(i.vt(),[t.longLineSegment.end.x,t.longLineSegment.end.y],[t.longLineSegment.start.x,t.longLineSegment.start.y]),a=i.S8(i.vt(),n),o=i.Re(i.vt(),[m[0],m[1]],[u[s][0],u[s][1]]),c=i.Bw(o),p=Math.cos(this._getSignedAngle(a,o))*c,f=i.Ln(i.vt(),[u[e][0],u[e][1]],a,p);if(this._movingLongAxisWouldPutItThroughShortAxis({start:{x:m[0],y:m[1]},end:{x:f[0],y:f[1]}},{start:{x:t.longLineSegment.start.x,y:t.longLineSegment.start.y},end:{x:t.longLineSegment.end.x,y:t.longLineSegment.end.y}})||!I.A([m[0],m[1]],[f[0],f[1]],[d.start.x,d.start.y],[d.end.x,d.end.y]))return;l.handles.points[e]=r.canvasToWorld(f),l.handles.points[s]=h}},this.cancel=e=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateDraw(e),this._deactivateModify(e),(0,S.Q_)(e);let{annotation:t,viewportIdsToRender:n,newAnnotation:r}=this.editData,{data:a}=t;return t.highlighted=!1,a.handles.activeHandleIndex=null,(0,E.A)(n),r&&(0,h.triggerAnnotationCompleted)(t),this.editData=null,t.annotationUID}},this._activateDraw=e=>{p.wk.isInteractingWithTool=!0,e.addEventListener(f.sV.MOUSE_UP,this._endCallback),e.addEventListener(f.sV.MOUSE_DRAG,this._dragDrawCallback),e.addEventListener(f.sV.MOUSE_MOVE,this._dragDrawCallback),e.addEventListener(f.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(f.sV.TOUCH_TAP,this._endCallback),e.addEventListener(f.sV.TOUCH_END,this._endCallback),e.addEventListener(f.sV.TOUCH_DRAG,this._dragDrawCallback)},this._deactivateDraw=e=>{p.wk.isInteractingWithTool=!1,e.removeEventListener(f.sV.MOUSE_UP,this._endCallback),e.removeEventListener(f.sV.MOUSE_DRAG,this._dragDrawCallback),e.removeEventListener(f.sV.MOUSE_MOVE,this._dragDrawCallback),e.removeEventListener(f.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(f.sV.TOUCH_TAP,this._endCallback),e.removeEventListener(f.sV.TOUCH_END,this._endCallback),e.removeEventListener(f.sV.TOUCH_DRAG,this._dragDrawCallback)},this._activateModify=e=>{p.wk.isInteractingWithTool=!0,e.addEventListener(f.sV.MOUSE_UP,this._endCallback),e.addEventListener(f.sV.MOUSE_DRAG,this._dragModifyCallback),e.addEventListener(f.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(f.sV.TOUCH_END,this._endCallback),e.addEventListener(f.sV.TOUCH_DRAG,this._dragModifyCallback),e.addEventListener(f.sV.TOUCH_TAP,this._endCallback)},this._deactivateModify=e=>{p.wk.isInteractingWithTool=!1,e.removeEventListener(f.sV.MOUSE_UP,this._endCallback),e.removeEventListener(f.sV.MOUSE_DRAG,this._dragModifyCallback),e.removeEventListener(f.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(f.sV.TOUCH_END,this._endCallback),e.removeEventListener(f.sV.TOUCH_DRAG,this._dragModifyCallback),e.removeEventListener(f.sV.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(e,t)=>{let n=!0,{viewport:r}=e,{element:a}=r,i=(0,u.getAnnotations)(this.getToolName(),a);if(!i?.length||(i=this.filterInteractableAnnotationsForElement(a,i),!i?.length))return n;let o=this.getTargetId(r),s=r.getRenderingEngine(),l={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:e.viewport.id};for(let a=0;ar.worldToCanvas(e));l.annotationUID=h;let{color:I,lineWidth:S,lineDash:E,shadow:M}=this.getAnnotationStyle({annotation:u,styleSpecifier:l});if(p.cachedStats[o]&&null!=p.cachedStats[o].unit?u.invalidated&&this._throttledCalculateCachedStats(u,s,e):(p.cachedStats[o]={length:null,width:null,unit:null},this._calculateCachedStats(u,s,e)),!r.getRenderingEngine()){console.warn("Rendering Engine has been destroyed");break}if(!(0,g.YY)(h))continue;(0,d.Gh)(h)||this.editData||null===v||(c=[A[v]]);let b=!!(0,_.h)("showHandlesAlways",{});(c||b)&&(0,m.qX)(t,h,"0",b?A:c,{color:I});let y=`${h}-line-1`,T=`${h}-line-2`;(0,m.V6)(t,h,"0",A[0],A[1],{color:I,lineDash:E,lineWidth:S,shadow:M},y),(0,m.V6)(t,h,"1",A[2],A[3],{color:I,lineDash:E,lineWidth:S,shadow:M},T),n=!0;let R=this.configuration.getTextLines(p,o);if(R&&0!==R.length&&!this.renderLinkedTextBoxAnnotation({enabledElement:e,svgDrawingHelper:t,annotation:u,styleSpecifier:l,textLines:R,canvasCoordinates:A}))continue}return n},this._movingLongAxisWouldPutItThroughShortAxis=(e,t)=>{let n=i.vt();i.hZ(n,t.end.x-t.start.x,t.end.y-t.start.y),i.S8(n,n);let r={start:{x:t.start.x-10*n[0],y:t.start.y-10*n[1]},end:{x:t.end.x+10*n[0],y:t.end.y+10*n[1]}};return!I.A([r.start.x,r.start.y],[r.end.x,r.end.y],[e.start.x,e.start.y],[e.end.x,e.end.y])},this._calculateCachedStats=(e,t,n)=>{let{data:a}=e,{element:i}=n.viewport;a.handles.points[0],a.handles.points[1],a.handles.points[2],a.handles.points[3];let{cachedStats:o}=a,l=Object.keys(o);for(let e=0;ei.worldToIndex(e)),d=u.slice(0,2),g=u.slice(2,4),h=(0,s.Op)(n,u),m=r.calculateLengthInIndex(h,d),p=r.calculateLengthInIndex(h,g),{unit:v}=h,A=m>p?m:p,I=m>p?p:m;this.isHandleOutsideImage=!r.isInsideVolume(c,u),o[t]={length:A,width:I,unit:v,widthUnit:v,statsArray:[{value:A,name:"height",unit:v,type:f.Jf.Linear},{value:I,name:"width",unit:v,type:f.Jf.Linear}]}}let c=e.invalidated;return e.invalidated=!1,c&&(0,h.triggerAnnotationModified)(e,i,f.wi.StatsUpdated),o},this._getSignedAngle=(e,t)=>Math.atan2(e[0]*t[1]-e[1]*t[0],e[0]*t[0]+e[1]*t[1]),this._throttledCalculateCachedStats=(0,c.A)(this._calculateCachedStats,100,{trailing:!0})}addNewAnnotation(e){let{currentPoints:t,element:n}=e.detail,r=t.world;this.isDrawing=!0;let a=this.createAnnotation(e,[[...r],[...r],[...r],[...r]]);(0,u.addAnnotation)(a,n);let i=(0,v.Q0)(n,this.getToolName());return this.editData={annotation:a,viewportIdsToRender:i,handleIndex:1,movingTextBox:!1,newAnnotation:!0,hasMoved:!1},this._activateDraw(n),(0,S.lY)(n),e.preventDefault(),(0,E.A)(i),a}}function b(e,t){let{cachedStats:n,label:r}=e,{length:a,width:i,unit:s}=n[t],l=[];return r&&l.push(r),void 0===a||l.push(`L: ${o.BF.roundNumber(a)} ${s||s}`,`W: ${o.BF.roundNumber(i)} ${s}`),l}r=M,M.toolName="Bidirectional",M.hydrate=(e,t,n)=>{let a=(0,o.yj)(e);if(!a)return;let{FrameOfReferenceUID:i,referencedImageId:s,viewPlaneNormal:l,instance:c,viewport:d}=r.hydrateBase(r,a,t[0],n),[g,h]=t,[m,p]=g,[f,v]=h,{toolInstance:A,...I}=n||{},S={annotationUID:n?.annotationUID||o.BF.uuidv4(),data:{handles:{points:[m,p,f,v],activeHandleIndex:null,textBox:{hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}}},cachedStats:{}},highlighted:!1,autoGenerated:!1,invalidated:!1,isLocked:!1,isVisible:!0,metadata:{toolName:c.getToolName(),viewPlaneNormal:l,FrameOfReferenceUID:i,referencedImageId:s,...I}};return(0,u.addAnnotation)(S,d.element),(0,E.A)([d.id]),S}},8270:(e,t,n)=>{"use strict";var r=n(70192),a=n(91336),i=n(50923),o=n(78378),s=n(45826),l=n(39157),c=n(11663),u=n(14036),d=n(4101),g=n(60212),h=n(88819),m=n(88129),p=n(62207),f=n(75246),v=n(41067);class A extends h.A{constructor(e={},t={supportedInteractionTypes:["Mouse","Touch"],configuration:{strategies:{FILL_INSIDE_CIRCLE:c.kr,ERASE_INSIDE_CIRCLE:u.r,FILL_INSIDE_SPHERE:s.Jq,ERASE_INSIDE_SPHERE:l._,THRESHOLD_INSIDE_CIRCLE:c.q,THRESHOLD_INSIDE_SPHERE:s.rd,THRESHOLD_INSIDE_SPHERE_WITH_ISLAND_REMOVAL:s.Sw},defaultStrategy:"FILL_INSIDE_CIRCLE",activeStrategy:"FILL_INSIDE_CIRCLE",brushSize:25,useCenterSegmentIndex:!1,preview:{enabled:!1,previewColors:{0:[255,255,255,128]},previewTimeMs:250,previewMoveDistance:8,dragMoveDistance:4,dragTimeMs:500},actions:{[o.Yh.AcceptPreview]:{method:o.Yh.AcceptPreview,bindings:[{key:"Enter"}]},[o.Yh.RejectPreview]:{method:o.Yh.RejectPreview,bindings:[{key:"Escape"}]},[o.Yh.Interpolate]:{method:o.Yh.Interpolate,bindings:[{key:"i"}],configuration:{useBallStructuringElement:!0,noUseDistanceTransform:!0,noUseExtrapolation:!0}},interpolateExtrapolation:{method:o.Yh.Interpolate,bindings:[{key:"e"}],configuration:{}}}}}){super(e,t),this._lastDragInfo=null,this._drawStartTimeStamp=0,this._lazyEdit=new p.A,this.onSetToolPassive=e=>{this.disableCursor()},this.onSetToolEnabled=()=>{this.disableCursor()},this.onSetToolDisabled=e=>{this.disableCursor()},this.preMouseDownCallback=e=>{let t=e.detail,{element:n,currentPoints:s}=t,l=(0,r.kJ)(n),{viewport:c}=l;if(!(0,v.T)(c.id)){let e=new CustomEvent(r.fX.sV.ERROR_EVENT,{detail:{type:"Segmentation",message:"No active segmentation detected, create a segmentation representation before using the brush tool"},cancelable:!0});return r.tX.dispatchEvent(e),!1}this._editData=this.createEditData(n),this._previewData.isDrag=!1,this._previewData.timerStart=Date.now(),this._drawStartTimeStamp=t.event?.timeStamp??0;let u=a.o8(s.canvas),h=c.canvasToWorld([u[0],u[1]]);if(this._lastDragInfo={canvas:u,world:i.o8(h)},this._hoverData=this.createHoverData(n,u),!this._hoverData)return this._editData=null,!1;this._calculateCursor(n,u),A.activeCursorTool=this,this._resetLazyEditState(),this._isLazyLabelmapEditingEnabled(this._hoverData.viewport)&&(this._lazyEdit.appendStrokePoint(h),this._captureLazyPreviewCircle()),(0,g.A)(this._hoverData.viewportIdsToRender);let m=this.getOperationData(n);return!!m&&(this._activateDraw(n),(0,d.lY)(n),e.preventDefault(),this.applyActiveStrategyCallback(l,m,o.Yh.OnInteractionStart),!0)},this.mouseMoveCallback=e=>{if(this.isPrimary&&this.mode===o.r$.Active){if(this.updateCursor(e),!this.configuration.preview.enabled)return;let{previewTimeMs:t,previewMoveDistance:n,dragMoveDistance:r}=this.configuration.preview,{currentPoints:i,element:o}=e.detail,{canvas:s}=i,{startPoint:l,timer:c,timerStart:u,isDrag:d}=this._previewData;if(d)return;let g=a.Io(s,l),h=Date.now()-u;if((g>n||h>t&&g>r)&&(c&&(window.clearTimeout(c),this._previewData.timer=null),d||this.rejectPreview(o)),!this._previewData.timer){let e=window.setTimeout(this.previewCallback,250);Object.assign(this._previewData,{timerStart:Date.now(),timer:e,startPoint:s,element:o})}}},this.previewCallback=()=>{if(this._previewData.isDrag){this._previewData.timer=null;return}this._previewData.timer=null;let e=this.getOperationData(this._previewData.element);if(!e)return;let t=(0,r.kJ)(this._previewData.element);if(!t)return;let{viewport:n}=t,a=this.configuration.activeStrategy,i=(0,m.S)({operationData:e,viewport:n,strategy:a});if(!e)return;let s=this.createMemo(e.segmentationId,i.segmentationVoxelManager);this._previewData.preview=this.applyActiveStrategyCallback((0,r.kJ)(this._previewData.element),{...e,...i,memo:s},o.Yh.Preview)},this._dragCallback=e=>{let t=e.detail,{element:n,currentPoints:o}=t,{currentPointsList:s}=t;if(s?.length>1)return void this._cancelTouchDraw(n);let l=(0,r.kJ)(n),{viewport:c}=l;if(this.updateCursor(e),!this._hoverData)return;let{viewportIdsToRender:u}=this._hoverData;(0,g.A)(u);let d=a.Io(o.canvas,this._previewData.startPoint),{dragTimeMs:h,dragMoveDistance:m}=this.configuration.preview;if(!this._previewData.isDrag&&Date.now()-this._previewData.timerStart{let t=e.detail,{element:n}=t;if(t.eventName===o.sV.TOUCH_TAP&&(t.event?.timeStamp??0)i.o8(e)),this.applyActiveStrategy(a,s)):this._previewData.preview||this._previewData.isDrag||this.applyActiveStrategy(a,s),this.doneEditMemo(),this._deactivateDraw(n),(0,d.Q_)(n),this._editData=null,this._lastDragInfo=null,l&&this._previewData.isDrag?(this._scheduleLazyPreviewCleanup(n,e.detail.currentPoints.canvas,a.viewport.id,s.segmentationId,this._isTouchInteraction(e)),(0,g.A)(this._hoverData.viewportIdsToRender)):(this._resetLazyEditState(),this._isTouchInteraction(e)?this._clearCursor(n):this.updateCursor(e)),this.applyActiveStrategyCallback(a,s,o.Yh.OnInteractionEnd),this._previewData.isDrag||this.acceptPreview(n)},this._activateDraw=e=>{e.addEventListener(o.sV.MOUSE_UP,this._endCallback),e.addEventListener(o.sV.MOUSE_DRAG,this._dragCallback),e.addEventListener(o.sV.MOUSE_CLICK,this._endCallback),e.addEventListener(o.sV.TOUCH_END,this._endCallback),e.addEventListener(o.sV.TOUCH_DRAG,this._dragCallback),e.addEventListener(o.sV.TOUCH_TAP,this._endCallback)},this._deactivateDraw=e=>{e.removeEventListener(o.sV.MOUSE_UP,this._endCallback),e.removeEventListener(o.sV.MOUSE_DRAG,this._dragCallback),e.removeEventListener(o.sV.MOUSE_CLICK,this._endCallback),e.removeEventListener(o.sV.TOUCH_END,this._endCallback),e.removeEventListener(o.sV.TOUCH_DRAG,this._dragCallback),e.removeEventListener(o.sV.TOUCH_TAP,this._endCallback)}}disableCursor(){this._clearPendingLazyPreviewCleanup(),this._hoverData=void 0,this._resetLazyEditState(),this.rejectPreview()}_isLazyLabelmapEditingEnabled(e){return(0,f.v)(e??this._hoverData?.viewport)}_resetLazyEditState(){this._lazyEdit.reset()}_clearPendingLazyPreviewCleanup(){this._lazyEdit.clearPendingCleanup()}_refreshCursor(e,t){this._hoverData=this.createHoverData(e,t),this._hoverData&&(this._calculateCursor(e,t),A.activeCursorTool=this,(0,g.A)(this._hoverData.viewportIdsToRender))}_scheduleLazyPreviewCleanup(e,t,n,r,a=!1){this._lazyEdit.scheduleCleanup({element:e,centerCanvas:t,viewportId:n,segmentationId:r,refreshCursor:a?e=>this._clearCursor(e):this._refreshCursor.bind(this)})}_captureLazyPreviewCircle(){this._isLazyLabelmapEditingEnabled()&&this._hoverData&&this._lazyEdit.capturePreviewCircle(this._hoverData)}updateCursor(e){let t=e.detail,{element:n}=t,{currentPoints:r}=t,a=r.canvas;this._refreshCursor(n,a)}_clearCursor(e){let t=this._hoverData?.viewportIdsToRender;if(this._hoverData=void 0,t?.length)return void(0,g.A)(t);let n=(0,r.kJ)(e);n&&(0,g.A)([n.viewport.id])}_cancelTouchDraw(e){let{memo:t}=this;t?.commitMemo?.()&&t.restoreMemo(!0),this.memo=null,this._deactivateDraw(e),(0,d.Q_)(e),this._editData=null,this._lastDragInfo=null,this._previewData.preview=null,this._previewData.isDrag=!1,this._previewData.timer&&(window.clearTimeout(this._previewData.timer),this._previewData.timer=null),this._resetLazyEditState(),this._clearCursor(e)}_calculateCursor(e,t){let n=(0,r.kJ)(e),a=this.getOperationData(e);n&&a&&this.applyActiveStrategyCallback(n,a,o.Yh.CalculateCursorGeometry)}getStatistics(e,t){if(!e)return;let n=(0,r.kJ)(e),a=this.getOperationData(e);if(n&&a)return this.applyActiveStrategyCallback(n,a,o.Yh.GetStatistics,t)}rejectPreview(e=this._previewData.element){if(!e)return;this.doneEditMemo();let t=(0,r.kJ)(e);if(!t)return;let n=this.getOperationData(e);n&&(this.applyActiveStrategyCallback(t,n,o.Yh.RejectPreview),this._previewData.preview=null,this._previewData.isDrag=!1)}acceptPreview(e=this._previewData.element){e&&super.acceptPreview(e)}interpolate(e,t){if(!e)return;let n=(0,r.kJ)(e),a=this.getOperationData(e);n&&a&&(this._previewData.preview=this.applyActiveStrategyCallback(n,a,o.Yh.Interpolate,t.configuration),this._previewData.isDrag=!0)}invalidateBrushCursor(){if(void 0===this._hoverData)return;let{data:e}=this._hoverData.brushCursor,{viewport:t}=this._hoverData;e.invalidated=!0;let{segmentColor:n}=this.getActiveSegmentationData(t)||{};this._hoverData.brushCursor.metadata.segmentColor=n}renderAnnotation(e,t){if(!this._hoverData||A.activeCursorTool!==this)return;let{viewport:n}=e;if(this._hoverData.viewportIdsToRender.includes(n.id)){if(!0===this._hoverData.brushCursor.data.invalidated){let{centerCanvas:e}=this._hoverData,{element:t}=n;this._calculateCursor(t,e)}this.applyActiveStrategyCallback(e,this.getOperationData(n.element),o.Yh.RenderCursor,t)}}}A.toolName="Brush"},9538:(e,t,n)=>{"use strict";function r(e){return function e(t){if(0==t.length)return[];let n=[],r=t.shift();n.push(r.a),n.push(r.b);let a=function e(t,n,r){let a=-1;if(n.forEach((e,n)=>{a>=0||e.a==t.b&&(a=n)}),a>=0){let t=n[a];return(n.splice(a,1),r.push(t.b),r[0]==t.b)?{remainingLines:n,contourPoints:r,type:"CLOSED_PLANAR"}:e(t,n,r)}return{remainingLines:n,contourPoints:r,type:"OPEN_PLANAR"}}(r,t,n);if(0==a.remainingLines.length)return[{type:a.type,contourPoints:a.contourPoints}];{let t=e(a.remainingLines);return t.push({type:a.type,contourPoints:a.contourPoints}),t}}(e)}n.d(t,{d1:()=>r})},10883:(e,t,n)=>{"use strict";n(32207),n(49007),n(93287)},11212:(e,t,n)=>{"use strict";n.d(t,{l:()=>l});var r=n(70192),a=n(50923),i=n(17242),o=n(41918);let{transformWorldToIndex:s}=r.BF;function l(e,t,n){if(!n)throw Error("viewport is required in order to calculate the sphere bounds");let r=(0,o.A)(n);if(!r.viewUp||!r.viewPlaneNormal)throw Error("viewport view plane is required in order to calculate the sphere bounds");let l=a.fA(r.viewUp[0],r.viewUp[1],r.viewUp[2]),c=a.fA(r.viewPlaneNormal[0],r.viewPlaneNormal[1],r.viewPlaneNormal[2]),u=a.vt();a.$A(u,l,c);let d={row:u,normal:c,column:a.ze(a.vt(),l)},[g,h]=e,m=a.fA((g[0]+h[0])/2,(g[1]+h[1])/2,(g[2]+h[2])/2),p=a.Io(g,h)/2,{boundsIJK:f,topLeftWorld:v,bottomRightWorld:A}=function(e,t,n,r,o){let l=e.getDimensions(),{row:c,column:u,normal:d}=t,g=a.vt(),h=a.vt();a.Ln(g,r,d,o),a.Ln(h,r,d,-o),a.Ln(g,g,u,-o),a.Ln(h,h,u,o),a.Ln(g,g,c,-o),a.Ln(h,h,c,o);let m=s(e,g),p=s(e,h),f=n.map(t=>s(e,t));return{boundsIJK:(0,i.gm)([m,p,...f],l),topLeftWorld:g,bottomRightWorld:h}}(t,d,e,m,p);return{boundsIJK:f,centerWorld:m,radiusWorld:p,topLeftWorld:v,bottomRightWorld:A}}},11236:(e,t,n)=>{"use strict";n(70192),n(32207),n(54310)},11420:(e,t,n)=>{"use strict";var r=n(50923),a=n(70192),i=n(17242),o=n(41918),s=n(73971),l=n(78378),c=n(20552);let{transformWorldToIndex:u}=a.BF,d={[l.Yh.Initialize]:e=>{let{points:t,viewport:n,segmentationImageData:s}=e;if(!t)return;let l=r.fA(0,0,0);t.forEach(e=>{r.WQ(l,l,e)}),r.hs(l,l,1/t.length),e.centerWorld=l,e.centerIJK=u(s,l);let{boundsIJK:c,pointInShapeFn:d}=function(e,t,n){let s=t.map(e=>u(n,e));s=s.map(e=>e.map(e=>Math.round(e)));let l=(0,i.gm)(s,n.getDimensions()),[c,d,g,h]=t,m=r.vt(),p=r.vt();r.Re(m,d,c),r.Re(p,h,c);let f=r.Bw(m),v=r.Bw(p);r.S8(m,m),r.S8(p,p);let A=r.vt();r.$A(A,m,p),r.S8(A,A);let I=n.getDirection(),S=n.getSpacing(),{viewPlaneNormal:E}=(0,o.A)(e),_=a.BF.getSpacingInNormalDirection({direction:I,spacing:S},E);return{boundsIJK:l,pointInShapeFn:e=>{let t=r.vt();r.Re(t,e,c);let n=r.Om(t,m),a=r.Om(t,p),i=Math.abs(r.Om(t,A));return n>=-_&&n<=f+_&&a>=-_&&a<=v+_&&i<=_}}}(n,t,s);e.isInObject=d,e.isInObjectBoundsIJK=c}},g=new s.A("Rectangle",c.A.regionFill,c.A.setValue,d,c.A.determineSegmentIndex,c.A.preview,c.A.labelmapStatistics),h=new s.A("RectangleThreshold",c.A.regionFill,c.A.setValue,d,c.A.determineSegmentIndex,c.A.dynamicThreshold,c.A.threshold,c.A.preview,c.A.islandRemoval,c.A.labelmapStatistics);g.strategyFunction,h.strategyFunction},11663:(e,t,n)=>{"use strict";n.d(t,{C$:()=>m,kr:()=>I,mu:()=>f,pB:()=>v,q:()=>S});var r=n(50923),a=n(70192),i=n(17242),o=n(73971),s=n(78378),l=n(20552),c=n(33513);let{transformWorldToIndex:u,transformIndexToWorld:d,isEqual:g,getNormalizedAspectRatio:h}=a.BF;function m(e){let[t,n,r,a]=e,i=[r[0],n[1]],o=[a[0],t[1]];return[i,o,[r[0],t[1]],[a[0],n[1]]]}let p={[s.Yh.Initialize]:e=>{let{points:t,viewport:n,segmentationImageData:a,viewUp:o,viewPlaneNormal:s}=e;if(!t)return;let l=r.vt();t.length>=2?(r.WQ(l,t[0],t[1]),r.hs(l,l,.5)):r.C(l,t[0]),e.centerWorld=l,e.centerIJK=u(a,l);let c=h(n.getAspectRatio()),d=t.length>=2?r.Io(t[0],t[1])/2/c[1]:0,g=t.length>=2?r.Io(t[2],t[3])/2/c[0]:0,p=m(t.map(e=>n.worldToCanvas(e))).map(e=>n.canvasToWorld(e)),v=r.fA(o[0],o[1],o[2]);r.S8(v,v);let A=r.fA(s[0],s[1],s[2]);r.S8(A,A);let I=r.vt();r.$A(I,v,A),r.S8(I,I);let S=(e.strokePointsWorld&&e.strokePointsWorld.length>0?e.strokePointsWorld:[e.centerWorld]).map(e=>r.o8(e)),E=S.flatMap(e=>(function(e,t,n,a,i){let o=r.fA(e[0],e[1],e[2]),s=r.vt();r.Ln(s,o,t,a);let l=r.vt();r.Ln(l,o,t,-a);let c=r.vt();r.Ln(c,o,n,i);let u=r.vt();return r.Ln(u,o,n,-i),[l,s,u,c]})(e,v,I,d,g)).map(e=>u(a,e)),_=(0,i.gm)(E,a.getDimensions());e.strokePointsWorld=S,e.isInObject=f(p,{strokePointsWorld:S,segmentationImageData:a,xRadius:g,yRadius:d,aspectRatio:c}),e.isInObjectBoundsIJK=_}};function f(e=[],t={}){if(!e||4!==e.length)throw Error("createPointInEllipse: cornersInWorld must have 4 points");let[n,a,i,o]=e,s=t.aspectRatio||[1,1],l=r.vt();r.WQ(l,n,a),r.hs(l,l,.5);let u=r.vt();r.Re(u,o,n);let h=r.Bw(u)/2;r.S8(u,u);let m=r.vt();r.Re(m,i,n),r.S8(m,m);let p=h/s[0],v=h/s[1],A=t.xRadius??p,I=t.yRadius??v,S=function(e,t,n){if(!e.length||t<=0||n<=0)return null;let r=t*t,a=n*n,i=e.map(e=>[e[0],e[1],e[2]]),o=[];for(let e=1;e{if(!e)return!1;for(let t of i){let n=e[0]-t[0],i=e[1]-t[1],o=e[2]-t[2];if(n*n/r+i*i/a+o*o<=1)return!0}for(let{start:t,vector:n,lengthSquared:i}of o){if(0===i){let n=e[0]-t[0],i=e[1]-t[1],o=e[2]-t[2];if(n*n/r+i*i/a+o*o<=1)return!0;continue}let o=e[0]-t[0],s=e[1]-t[1],l=e[2]-t[2],c=Math.max(0,Math.min(1,(o*n[0]+s*n[1]+l*n[2])/i)),u=t[0]+n[0]*c,d=t[1]+n[1]*c,g=t[2]+n[2]*c,h=e[0]-u,m=e[1]-d,p=e[2]-g;if(h*h/r+m*m/a+p*p<=1)return!0}return!1}}(t.strokePointsWorld||[],A,I);if(g(p,v)){let e={center:l,radius:p,radius2:p*p};return(n,r)=>{let a=n;return!a&&r&&t.segmentationImageData&&(a=d(t.segmentationImageData,r)),!!a&&(!!S?.(a)||(0,c.A)(e,a))}}return(e,n)=>{let a=e;if(!a&&n&&t.segmentationImageData&&(a=d(t.segmentationImageData,n)),!a)return!1;if(S?.(a))return!0;let i=r.vt();r.Re(i,a,l);let o=r.Om(i,u),s=r.Om(i,m);return o*o/(p*p)+s*s/(v*v)<=1}}let v=new o.A("Circle",l.A.regionFill,l.A.setValue,p,l.A.determineSegmentIndex,l.A.preview,l.A.labelmapStatistics),A=new o.A("CircleThreshold",l.A.regionFill,l.A.setValue,p,l.A.determineSegmentIndex,l.A.dynamicThreshold,l.A.threshold,l.A.preview,l.A.islandRemoval,l.A.labelmapStatistics),I=v.strategyFunction,S=A.strategyFunction},12487:(e,t,n)=>{"use strict";n.d(t,{WA:()=>c.W,k9:()=>i.A});var r=n(43806),a=n(17191),i=n(81480),o=n(13312),s=n(15009),l=n(84468),c=n(5490);r.A,a.A,o.A,i.A,s.R,l.Y,c.W,s.p},12722:(e,t,n)=>{"use strict";n.d(t,{getCurrentLabelmapImageIdForViewport:()=>r.vl}),n(43385),n(91006),n(35172),n(10883),n(93287),n(11236),n(65947),n(54310),n(32207),n(95324),n(69435);var r=n(5469);n(61689),n(51200)},16835:(e,t,n)=>{"use strict";n(5068),n(38031),n(93022),n(43385),n(98723),n(60332),n(83603)},17167:(e,t,n)=>{"use strict";n.d(t,{d6:()=>i});var r=n(70192);let{isEqual:a}=r.BF,i=function(e){return function(t,n){let i=Array.isArray(n)?n:[n],o=i.map(e=>t.cachedStats[e]).filter(t=>e.some(({attribute:e})=>t?.[e]!==void 0&&t?.[e]!==null));if(!o.length)return;let s=[];for(let t of e){var l,c;l=s,(c=function(e,t,n,i,o){let s=[`${n}:`],l=null,c=null;for(let t of e){if(!r.BF.isNumber(t?.[i]))continue;let e=t[i],n=t[o];a(l,e)&&c===n||(s.push(`${r.BF.roundNumber(e)} ${n}`),l=e,c=n)}if(!(s.length<=1))return s.join(" ")}(o,0,t.name,t.attribute,t.unitAttribute))&&l.push(c)}return s}}([{name:"Area",attribute:"area",unitAttribute:"areaUnit"},{name:"Mean",attribute:"mean",unitAttribute:"modalityUnit"},{name:"Max",attribute:"max",unitAttribute:"modalityUnit"},{name:"Min",attribute:"min",unitAttribute:"modalityUnit"},{name:"Std Dev",attribute:"stdDev",unitAttribute:"modalityUnit"}])},19307:(e,t,n)=>{"use strict";var r=n(29010);n(82243),n(87086),n(4101),n(94952),[...n(23278).bp,...r.i]},19921:(e,t,n)=>{"use strict";n.d(t,{getSegmentIndexColor:()=>o,setSegmentIndexColor:()=>s}),n(11236);var r=n(65947),a=n(51200),i=n(49007);function o(e,t,n){let i=(0,a.r$)(e,{segmentationId:t});if(!i||0===i.length)return null;let{colorLUTIndex:o}=i[0],s=(0,r.B)(o),l=s[n];if(!l){if("number"!=typeof n)return console.warn(`Can't create colour for LUT index ${n}`),null;l=s[n]=[0,0,0,0]}return l}function s(e,t,n,r){let a=o(e,t,n);for(let e=0;e{"use strict";n.d(t,{Ay:()=>r});var r={Device:{Unknown:0,LeftController:1,RightController:2},Input:{Unknown:0,Trigger:1,TrackPad:2,Grip:3,Thumbstick:4,A:5,B:6,ApplicationMenu:7},Axis:{Unknown:0,TouchpadX:1,TouchpadY:2,ThumbstickX:3,ThumbstickY:4},MouseButton:{LeftButton:1,MiddleButton:2,RightButton:3}}},28402:(e,t,n)=>{"use strict";n.d(t,{f:()=>s});var r=n(33845),a=n(42018);function i(e,t){let n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function o(e,t){let n=r.XL.getWindingDirection(t)!==r.XL.getWindingDirection(e)?[...t].reverse():t,a=1/0,o=0,s=0;for(let t=0;tt),a=e=>{let t=e;for(;n[t]!==t;)t=n[t];for(;n[e]!==t;){let r=n[e];n[e]=t,e=r}return t},o=(e,t)=>{n[a(e)]=a(t)},s=e.map(e=>r.XL.getAABB(e));for(let n=0;n=i(e[n],t[r]))return!0;return!1}(e[n],e[r])&&o(n,r)}let u=new Map;for(let e=0;ee.outer));return t.length===e.length?e:t.map(t=>{if(1===t.length)return e[t[0]];let n=e[t[0]].outer;for(let r=1;re[t].holes??[]);return r.length?{outer:n,holes:r}:{outer:n}})})(t).reduce((e,t)=>r.XL.getArea(t.outer)>r.XL.getArea(e.outer)?t:e),s=n.outer;for(let e of n.holes??[])s=o(s,e);return s}},31608:(e,t,n)=>{"use strict";n.d(t,{A7:()=>a.A,oI:()=>r.oI}),n(52219),n(44151);var r=n(72661),a=n(31665);n(25102)},31860:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(70192),a=n(42306);function i(e,t){let{renderingEngineId:n,viewportId:i}=(0,r.kJ)(e),o=(0,a.getToolGroupForViewport)(i,n);if(!o)return[];let s=[],l=Object.keys(o.toolOptions);for(let e=0;e{"use strict";n.d(t,{_6:()=>p});var r=n(70192),a=n(78378),i=n(56109),o=n(10355),s=n(91792),l=n(49007),c=n(79541),u=n(5965),d=n(69301);let g={colorLUT:[],segmentations:[],viewportSegRepresentations:{}};class h{constructor(e){e||=r.BF.uuidv4(),this.state=Object.freeze(r.BF.deepClone(g)),this.uid=e,this.labelmapImageReferenceResolver=new d.Lp(this.getSegmentation.bind(this))}getState(){return this.state}updateState(e){let t=r.BF.deepClone(this.state);e(t),this.state=Object.freeze(t)}getColorLUT(e){return this.state.colorLUT[e]}getNextColorLUTIndex(){return this.state.colorLUT.length}resetState(){this.labelmapImageReferenceResolver.reset(),this.state=Object.freeze(r.BF.deepClone(g))}getSegmentation(e){return this.state.segmentations.find(t=>t.segmentationId===e)}updateSegmentation(e,t){this.updateState(n=>{let r=n.segmentations.find(t=>t.segmentationId===e);if(!r)return void console.warn(`Segmentation with id ${e} not found. Update aborted.`);Object.assign(r,t),r.representationData?.Labelmap&&((0,d.uk)(r),(0,d.xS)(r))}),(0,l.triggerSegmentationModified)(e)}addSegmentation(e){if(this.getSegmentation(e.segmentationId))throw Error(`Segmentation with id ${e.segmentationId} already exists`);this.updateState(t=>{let n=r.BF.deepClone(e);n.representationData?.Labelmap&&((0,d.uk)(n),(0,d.xS)(n));let a=n.representationData.Labelmap;if(a?.volumeId&&!("imageIds"in a)){let e=this.getLabelmapImageIds(n.representationData);n.representationData.Labelmap.imageIds=e}t.segmentations.push(n)}),(0,u.R)(e.segmentationId)}removeSegmentation(e){this.labelmapImageReferenceResolver.removeSegmentation(e),this.updateState(t=>{let n=t.segmentations.filter(t=>t.segmentationId!==e);t.segmentations.splice(0,t.segmentations.length,...n)}),(0,l.triggerSegmentationRemoved)(e)}addSegmentationRepresentation(e,t,n,i){if((0,r.yj)(e)){if(this.getSegmentationRepresentations(e,{type:n,segmentationId:t}).length>0){console.debug("A segmentation representation of type",n,"already exists in viewport",e,"for segmentation",t),(0,l.triggerSegmentationRepresentationModified)(e,t,n);return}this.updateState(r=>{r.viewportSegRepresentations[e]||(r.viewportSegRepresentations[e]=[],c.Y.setRenderInactiveSegmentations(e,!0)),n!==a.D_.Labelmap?this.addDefaultSegmentationRepresentation(r,e,t,n,i):this.addLabelmapRepresentation(r,e,t,i)}),(0,l.triggerSegmentationRepresentationModified)(e,t,n)}}addDefaultSegmentationRepresentation(e,t,n,r,a){let i=e.segmentations.find(e=>e.segmentationId===n);if(!i)return;let o={};Object.keys(i.segments).forEach(e=>{o[Number(e)]={visible:!0}}),e.viewportSegRepresentations[t].push({segmentationId:n,type:r,active:!0,visible:!0,colorLUTIndex:a?.colorLUTIndex||0,segments:o,config:{...m(r),...a}}),this._setActiveSegmentation(e,t,n)}addLabelmapRepresentation(e,t,n,i=m(a.D_.Labelmap)){if(!(0,r.yj)(t))return;let o=this.getSegmentation(n);if(!o)return;let{representationData:s}=o;if(!s.Labelmap)return this.addDefaultSegmentationRepresentation(e,t,n,a.D_.Labelmap,i);this.processLabelmapRepresentationAddition(t,n),this.addDefaultSegmentationRepresentation(e,t,n,a.D_.Labelmap,i)}async processLabelmapRepresentationAddition(e,t){let n=(0,r.yj)(e);if(!n)return;let a=this.getSegmentation(t);if(!a)return;let i="volume"===(0,s.A)(n.viewport),{representationData:o}=a,l=!!o.Labelmap.volumeId;i||l||this.updateLabelmapSegmentationImageReferences(e,a.segmentationId)}updateLabelmapSegmentationImageReferences(e,t){return this.labelmapImageReferenceResolver.updateLabelmapSegmentationImageReferences(e,t)}getLabelmapImageIds(e){return this.labelmapImageReferenceResolver.getLabelmapImageIds(e)}getLabelmapImageIdsForImageId(e,t){return this.labelmapImageReferenceResolver.getLabelmapImageIdsForImageId(e,t)}getCurrentLabelmapImageIdsForViewport(e,t){return this.labelmapImageReferenceResolver.getCurrentLabelmapImageIdsForViewport(e,t)}getCurrentLabelmapImageIdForViewport(e,t){return this.labelmapImageReferenceResolver.getCurrentLabelmapImageIdForViewport(e,t)}getStackSegmentationImageIdsForViewport(e,t){return this.labelmapImageReferenceResolver.getStackSegmentationImageIdsForViewport(e,t)}removeSegmentationRepresentationsInternal(e,t){let n=[];return this.updateState(r=>{if(!r.viewportSegRepresentations[e])return;let a=r.viewportSegRepresentations[e],i=!1;if(!t||Object.values(t).every(e=>void 0===e))n.push(...a),delete r.viewportSegRepresentations[e];else{let{segmentationId:o,type:s}=t;r.viewportSegRepresentations[e]=a.filter(e=>{let t=o&&s&&e.segmentationId===o&&e.type===s||o&&!s&&e.segmentationId===o||!o&&s&&e.type===s;return t&&(n.push(e),e.active&&(i=!0)),!t}),0===r.viewportSegRepresentations[e].length?delete r.viewportSegRepresentations[e]:i&&(r.viewportSegRepresentations[e][0].active=!0)}}),n}removeSegmentationRepresentations(e,t){let n=this.removeSegmentationRepresentationsInternal(e,t);n.forEach(t=>{(0,l.triggerSegmentationRepresentationRemoved)(e,t.segmentationId,t.type)});let r=this.getSegmentationRepresentations(e);return r.length>0&&r[0].active&&(0,l.triggerSegmentationRepresentationModified)(e,r[0].segmentationId,r[0].type),n}removeSegmentationRepresentation(e,t,n){let r=this.removeSegmentationRepresentationsInternal(e,t);return n||r.forEach(({segmentationId:t,type:n})=>{(0,l.triggerSegmentationRepresentationRemoved)(e,t,n)}),r}_setActiveSegmentation(e,t,n){let r=e.viewportSegRepresentations[t];r&&r.forEach(e=>{e.active=e.segmentationId===n})}setActiveSegmentation(e,t){this.updateState(n=>{let r=n.viewportSegRepresentations[e];r&&r.forEach(e=>{e.active=e.segmentationId===t})}),(0,l.triggerSegmentationRepresentationModified)(e,t)}getActiveSegmentation(e){if(!this.state.viewportSegRepresentations[e])return;let t=this.state.viewportSegRepresentations[e].find(e=>e.active);if(t)return this.getSegmentation(t.segmentationId)}getSegmentationRepresentations(e,t={}){let n=this.state.viewportSegRepresentations[e];return n?t.type||t.segmentationId?n.filter(e=>{let n=!t.type||e.type===t.type,r=!t.segmentationId||e.segmentationId===t.segmentationId;return n&&r}):n:[]}getSegmentationRepresentation(e,t){return this.getSegmentationRepresentations(e,t)[0]}getSegmentationRepresentationVisibility(e,t){let n=this.getSegmentationRepresentation(e,t);return n?.visible}setSegmentationRepresentationVisibility(e,t,n){this.updateState(r=>{let a=r.viewportSegRepresentations[e]?.filter(e=>e.segmentationId===t.segmentationId&&e.type===t.type);a&&a.forEach(e=>{e.visible=n,Object.values(e.segments).forEach(e=>{e.visible=n})})}),(0,l.triggerSegmentationRepresentationModified)(e,t.segmentationId,t.type)}addColorLUT(e,t){this.updateState(n=>{n.colorLUT[t]&&console.warn("Color LUT table already exists, overwriting"),n.colorLUT[t]=r.BF.deepClone(e)})}removeColorLUT(e){this.updateState(t=>{delete t.colorLUT[e]})}_getStackIdForImageIds(e){return e.map(e=>e.slice(-Math.round(.15*e.length))).join("_")}getAllViewportSegmentationRepresentations(){return Object.entries(this.state.viewportSegRepresentations).map(([e,t])=>({viewportId:e,representations:t}))}getSegmentationRepresentationsBySegmentationId(e){let t=[];return Object.entries(this.state.viewportSegRepresentations).forEach(([n,r])=>{let a=r.filter(t=>t.segmentationId===e);a.length>0&&t.push({viewportId:n,representations:a})}),t}}function m(e){let t=i.Ay.newInstance(),n=o.Ay.newInstance();return(n.addPoint(0,0),e===a.D_.Labelmap)?{cfun:t,ofun:n}:{}}let p=new h("DEFAULT")},33174:(e,t,n)=>{"use strict";n.r(t),n.d(t,{ECGUtilities:()=>eR,FrameRange:()=>eF.A,HistoryMemo:()=>O,PointsManager:()=>Q.A,ProgressiveIterator:()=>el.A,RLEVoxelMap:()=>eA.A,VideoUtilities:()=>ew,VoxelManager:()=>ev.A,WSIUtilities:()=>eD,actorIsA:()=>W.N,applyPreset:()=>q.A,asArray:()=>e7._,autoLoad:()=>ej.A,buildMetadata:()=>ek.KP,calculateNeighborhoodStats:()=>e4.c,calculateRadiographicPixelSpacing:()=>e5.VD,calculateSpacingBetweenImageIds:()=>e2.A,calculateViewportsSpatialRegistration:()=>J.A,calibratedPixelSpacingMetadataProvider:()=>I.A,clamp:()=>S.A,clip:()=>eq.Ay,clonePoint3:()=>m.A,color:()=>eP,colormap:()=>eL,convertColorArrayToRgbString:()=>eE.J,convertStackToVolumeViewport:()=>ep.h,convertToGrayscale:()=>eS.A,convertVolumeToStackViewport:()=>ef.n,createLinearRGBTransferFunction:()=>c.A,createSigmoidRGBTransferFunction:()=>s.A,createSubVolume:()=>eQ.A,decimate:()=>ec.A,deepClone:()=>eY.G,deepEqual:()=>eN.b,deepMerge:()=>Z.A,eventListener:()=>r,fnv1aHash:()=>eV.A,generateFrameImageId:()=>eJ.Hf,generateVolumePropsFromImageIds:()=>em.D,genericMetadataProvider:()=>ei.A,genericViewportDisplaySetMetadataProvider:()=>ed.A,getAcquisitionPlaneOrientation:()=>eZ.A,getBufferConfiguration:()=>eh.h,getClosestImageId:()=>_.A,getClosestStackImageIndexForPoint:()=>j.A,getCubeSizeInView:()=>e9.H,getCurrentVolumeViewportSlice:()=>z.A,getDynamicVolumeInfo:()=>eX.A,getERMF:()=>e5.lJ,getImageDataMetadata:()=>eU.T,getImageLegacy:()=>en.A,getImageSliceDataForVolumeViewport:()=>H.A,getMinMax:()=>h.A,getNormalizedAspectRatio:()=>tt.x,getPixelSpacingInformation:()=>e5.Cc,getRandomSampleFromArray:()=>eM.p,getRuntimeId:()=>f.A,getScalingDescriptor:()=>ti,getScalingParameters:()=>ee.A,getSliceRange:()=>B.A,getSpacingInNormalDirection:()=>M.A,getTargetVolumeAndSpacingInNormalDir:()=>b.A,getVOIRangeFromWindowLevel:()=>v.A,getViewportContentMode:()=>te.nH,getViewportImageCornersInWorld:()=>$.A,getViewportImageIds:()=>e_.A,getViewportModality:()=>ta,getViewportsWithImageURI:()=>X.A,getViewportsWithVolumeId:()=>D.A,getVoiFromSigmoidRGBTransferFunction:()=>l.A,getVolumeActorCorners:()=>y.A,getVolumeDirectionVectors:()=>e0.A,getVolumeId:()=>eb.A,getVolumeSliceRangeInfo:()=>U.A,getVolumeViewReferenceId:()=>e1.A,getVolumeViewportScrollInfo:()=>k.A,getVolumeViewportsContainingSameVolumes:()=>w.A,handleMultiframe4D:()=>eJ.FM,hasFloatScalingParameters:()=>ey.a,hasNaNValues:()=>K.A,hasOwn:()=>p.A,imageIdToURI:()=>A.A,imageRetrieveMetadataProvider:()=>eu.A,imageToWorldCoords:()=>V.A,indexAlmostWithinDimensions:()=>R.A,indexWithinDimensions:()=>T.A,invertRgbTransferFunction:()=>o.A,isEqual:()=>tr.n4,isEqualAbs:()=>tr.Ph,isEqualNegative:()=>tr.WC,isGenericViewport:()=>te.oX,isImageActor:()=>W.e,isNumber:()=>tr.Et,isOpposite:()=>E.A,isPTPrescaledWithSUV:()=>et.A,isValidVolume:()=>eo.p,isVideoTransferSyntax:()=>eg.A,jumpToSlice:()=>e$.e,loadImageToCanvas:()=>L.A,logger:()=>e3,makeVolumeMetadata:()=>ea.A,mapMappedBandToRawRange:()=>e8.j_,mapScalarToViewportVoiIntensity:()=>e8.fT,mapViewportVoiIntensityToScalar:()=>e8.l2,planar:()=>eC,pointInShapeCallback:()=>eT.ii,renderToCanvasCPU:()=>P.A,renderToCanvasGPU:()=>N.A,resolveGenericViewportVolumeId:()=>eH.d,rotateToViewCoordinates:()=>e6.P,roundNumber:()=>eI.A,roundToPrecision:()=>eI.C,scaleArray:()=>ez.A,scaleRgbTransferFunction:()=>u.A,scroll:()=>eK.A,snapFocalPointToSlice:()=>G.A,sortImageIdsAndGetSpacing:()=>er.A,spatialRegistrationMetadataProvider:()=>Y.A,splitImageIdsBy4DTags:()=>eJ.Ay,transferFunctionUtils:()=>eO,transformIndexToWorld:()=>x.A,transformWorldToIndex:()=>C.A,transformWorldToIndexContinuous:()=>C.p,triggerEvent:()=>d.A,updatePlaneRestriction:()=>tn.O,updateVTKImageDataWithCornerstoneImage:()=>es.J,uuidv4:()=>g.A,viewportIsInStackMode:()=>te.NL,viewportIsInVolumeMode:()=>te.zb,viewportSupportsDisplaySetPresentation:()=>te.Tf,viewportSupportsImageSlices:()=>te.hz,viewportSupportsStackCalibration:()=>te.Xu,viewportSupportsStackCompatibility:()=>te.T,viewportSupportsVolumeActors:()=>te.$O,viewportSupportsVolumeCompatibility:()=>te.rw,viewportSupportsVolumeId:()=>te.Uv,viewportSupportsVolumeURI:()=>te.vP,windowLevel:()=>ex,worldToImageCoords:()=>F.A});var r={};n.r(r),n.d(r,{MultiTargetEventListenerManager:()=>i.I,TargetEventListeners:()=>a.f});var a=n(59845),i=n(30600),o=n(48320),s=n(97748),l=n(28478),c=n(62455),u=n(13898),d=n(69228),g=n(3793),h=n(37190),m=n(32166),p=n(30888),f=n(27109),v=n(23703),A=n(62553),I=n(14958),S=n(85759),E=n(77849),_=n(47241),M=n(74798),b=n(85156),y=n(37579),T=n(74842),R=n(90140),w=n(84454),D=n(32488),C=n(22911),x=n(24887),L=n(42028),O=n(5357),P=n(50869),N=n(6913),F=n(26980),V=n(31226),U=n(94237),k=n(92449),B=n(5663),G=n(92154),H=n(47776),W=n(50987),X=n(18110),j=n(94633),z=n(1049),J=n(97140),Y=n(15005),$=n(73588),K=n(18695),q=n(91711),Q=n(96446),Z=n(5454),ee=n(15057),et=n(55291),en=n(56478),er=n(6927),ea=n(6529),ei=n(85461),eo=n(38744),es=n(42422),el=n(77757),ec=n(80486),eu=n(16841),ed=n(18025),eg=n(17935),eh=n(6560),em=n(32876),ep=n(94320),ef=n(35954),ev=n(36039),eA=n(30075),eI=n(89937),eS=n(50121),eE=n(41652),e_=n(82039),eM=n(32854),eb=n(79923),ey=n(64375),eT=n(39262),eR=n(39935),ew=n(98197),eD=n(24433),eC=n(23668),ex=n(65110),eL=n(60251),eO=n(74092),eP=n(92051),eN=n(24106),eF=n(850),eV=n(28712),eU=n(35972),ek=n(96945),eB=n(11601),eG=n(19204),eH=n(12732),eW=n(54268),eX=n(50699),ej=n(50695),ez=n(3075),eJ=n(92049),eY=n(21483),e$=n(60609),eK=n(11877),eq=n(622),eQ=n(19012),eZ=n(52971),e0=n(80777),e1=n(92557),e2=n(35290),e3=n(82332),e4=n(1827),e8=n(7373),e5=n(56381),e9=n(37995),e6=n(11806),e7=n(31913),te=n(66384),tt=n(66368),tn=n(73265),tr=n(88824);let ta=(e,t)=>(0,eB.p)(e,t,eW.Ay.getVolume),ti=(e,t)=>(0,eG.c)(e,t,eW.Ay.getVolume)},33845:(e,t,n)=>{"use strict";n.d(t,{XL:()=>a,zx:()=>r}),n(83048);var r=n(55146),a=n(42067)},34470:(e,t,n)=>{"use strict";n.d(t,{Q0:()=>r.A}),n(36898);var r=n(48975);n(65488)},35172:(e,t,n)=>{"use strict";n(32207),n(49007),n(78378),n(70192),n(66442)},36814:(e,t,n)=>{"use strict";n.d(t,{Q:()=>o});var r=n(70192),a=n(78378),i=n(38433);function o(e,t,n){(0,i.HM)(e),(0,r.Hl)(r.tX,a.sV.SEGMENTATION_DATA_MODIFIED,{segmentationId:e,modifiedSlicesToUse:t,segmentIndex:n})}},38031:(e,t,n)=>{"use strict";n(70192),n(41918),n(69435)},38433:(e,t,n)=>{"use strict";n.d(t,{HM:()=>a}),n(70192),n(56099);let r=new Map,a=e=>{let t=r.get(e);t&&(t.isDirty=!0)}},40155:(e,t,n)=>{"use strict";n(42306),n(8270)},40454:(e,t,n)=>{"use strict";n.d(t,{I3:()=>s,Mx:()=>l,Nf:()=>u,Zs:()=>o,hM:()=>i,r:()=>c});var r=n(18236),a=n(65509);function i(e,t){return(0,r.uk)(e)?.segmentBindings?.[t]}function o(e,t,n){let a=(0,r.uk)(e);if(!a)return;let i=a.segmentBindings[t];if(i){let e=a.labelmaps[i.labelmapId];e?.labelToSegmentIndex&&delete e.labelToSegmentIndex[i.labelValue]}a.segmentBindings[t]=n;let o=a.labelmaps[n.labelmapId];o&&(o.labelToSegmentIndex||={},o.labelToSegmentIndex[n.labelValue]=t)}function s(e,t){let n=(0,r.uk)(e);return n?Object.entries(n.segmentBindings).filter(([,e])=>e.labelmapId===t).map(([e])=>Number(e)).sort((e,t)=>e-t):[]}function l(e,t,n){let r=(0,a.Hs)(e,t);if(r&&null!=n)return r.labelToSegmentIndex?.[n]??n}function c(e,t){let n=i(e,t);if(n)return(0,a.Hs)(e,n.labelmapId)}function u(e,t){return c(e,t)??(0,a.m)(e)[0]}n(76399)},42018:(e,t,n)=>{"use strict";n.d(t,{NE:()=>o});var r,a=n(94648);function i(e){let t=e.length,n=Array(t);for(let r=0;r=3&&l.push(i(t)),e(r,n)}}l.length>0&&(s.holes=l),n.push(s)}}(t,n),n}!function(e){e[e.Union=0]="Union",e[e.Difference=1]="Difference",e[e.Intersection=2]="Intersection",e[e.Xor=3]="Xor"}(r||(r={})),r.Union,a.nQ.Union,r.Difference,a.nQ.Difference,r.Intersection,a.nQ.Intersection,r.Xor,a.nQ.Xor},42067:(e,t,n)=>{"use strict";n.r(t),n.d(t,{addCanvasPointsToArray:()=>M.A,arePolylinesIdentical:()=>w.A,containsPoint:()=>a.A,containsPoints:()=>i.A,convexHull:()=>R.A,decimate:()=>f.A,getAABB:()=>o.A,getArea:()=>s.A,getClosestLineSegmentIntersection:()=>S.A,getFirstLineSegmentIntersectionIndexes:()=>v.A,getLineSegmentIntersectionsCoordinates:()=>I.A,getLineSegmentIntersectionsIndexes:()=>A.A,getNormal2:()=>d.A,getNormal3:()=>u.A,getSignedArea:()=>l.A,getSubPixelSpacingAndXYDirections:()=>E.A,getWindingDirection:()=>c.A,intersectPolyline:()=>p.A,intersectPolylines:()=>h.A,isClosed:()=>r.A,isPointInsidePolyline3D:()=>T,mergePolylines:()=>m.S,pointCanProjectOnLine:()=>b.A,pointsAreWithinCloseContourProximity:()=>_.A,projectTo2D:()=>y.p,subtractPolylines:()=>g.A});var r=n(37972),a=n(59061),i=n(96674),o=n(22958),s=n(32897),l=n(31677),c=n(45079),u=n(53772),d=n(31167),g=n(17673),h=n(61190),m=n(61101),p=n(41105),f=n(54562),v=n(27520),A=n(63701),I=n(12138),S=n(11239),E=n(99717),_=n(59351),M=n(10830),b=n(96158),y=n(23838);function T(e,t,n={}){let{sharedDimensionIndex:r,projectedPolyline:i}=(0,y.p)(t),{holes:o}=n,s=[];if(o)for(let e=0;e{"use strict";n.d(t,{D0:()=>v,Dh:()=>f,G_:()=>A,LH:()=>m,a:()=>I,cz:()=>g,lk:()=>h,up:()=>u,xu:()=>p}),n(16376);var r=n(41532),a=n(99376);n(69228),n(3922);var i=n(77280),o=n(10115);let s={isMobile:!1,rendering:{useCPURendering:!1,preferSizeOverAccuracy:!1,useLegacyCameraFOV:!1,strictZSpacingForVolumeViewport:!0,renderingEngineMode:i.FJ.ContextPool,webGlContextCount:7,planar:{renderBackend:i.YB.Auto,cpuVolume:{useViewportSamplingForLinear:!0,volumeModifiedThrottleMs:5e3}},volumeRendering:{sampleDistanceMultiplier:1}},debug:{statsOverlay:!1},peerImport:e=>null},l={...s,rendering:{...s.rendering}},c=null;function u(){let e=(0,a.BV)();return e.norm16&&e.norm16Linear}let d=new Set;function g(e){let t=e??l.rendering.planar?.renderBackend??i.YB.Auto;if(t!==i.YB.Auto){if((0,o.FF)(t))return t;d.has(t)||(d.add(t),console.warn(`[getEffectiveRenderBackend] Unregistered render backend "${t}"; falling back to 'auto'. Register custom backends with registerRenderBackend().`))}return l.rendering.useCPURendering?i.YB.CPU:i.YB.GPU}function h(){let e=(0,a.BV)();return e.webgl2?e.floatLinear:!(/iPad|iPhone|iPod/.test(navigator.platform)||navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&navigator.platform.includes("MacIntel"))}function m(){return l.rendering.useCPURendering}function p(){return!0===l.rendering.useGenericViewport}function f(){return!1}function v(){return l}function A(){return c||(c=new r.A),c}async function I(e){return l.peerImport(e)}},42279:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r={}},42306:(e,t,n)=>{"use strict";n.d(t,{getToolGroup:()=>i,getToolGroupForViewport:()=>u.A,getToolGroupsWithToolName:()=>g});var r=n(17964),a=n(78378);n(78928),n(70192),n(19307),n(4101);let i=function(e){return r.wk.toolGroups.find(t=>t.id===e)},{Active:o,Passive:s,Enabled:l,Disabled:c}=a.r$;a.iP.Primary;var u=n(73526);let d=[a.r$.Active,a.r$.Passive,a.r$.Enabled],g=function(e){return r.wk.toolGroups.filter(({toolOptions:t})=>{let n=Object.keys(t);for(let r=0;r{"use strict";n.d(t,{A:()=>l});var r=n(50923),a=n(70192);let{isEqual:i}=a.BF,{p8:o}=a.Jj,s=1-o;function l(e,t,n){let{viewPlaneNormal:l}=t,c=e.filter(e=>{let{planeRestriction:n,referencedImageId:o}=e.metadata,{viewPlaneNormal:c}=e.metadata;if(n){let{inPlaneVector1:e,inPlaneVector2:t}=n;return(!e||!!i(0,r.Om(l,e)))&&(!t||!!i(0,r.Om(l,t)))}if(!e.metadata.referencedImageId&&!c&&e.metadata.FrameOfReferenceUID){for(let n of e.data.handles.points){let e=r.jb(r.vt(),n,t.focalPoint);if(!i(r.Om(e,l),0))return!1}return e.metadata.viewPlaneNormal=l,e.metadata.cameraFocalPoint=t.focalPoint,!0}if(!c&&o){let{imageOrientationPatient:t}=a.wx.get("imagePlaneModule",o),n=r.fA(t[0],t[1],t[2]),i=r.fA(t[3],t[4],t[5]);c=r.vt(),r.$A(c,n,i),e.metadata.viewPlaneNormal=c}let u=Math.abs(r.Om(l,c))>s;return c&&u});if(!c.length)return[];let u=n/2+o,{focalPoint:d}=t,g=[];for(let e of c){let{data:t,metadata:n,isVisible:a}=e;if(!a)continue;let i=n.planeRestriction?.point||t.handles?.points?.[0]||t.contour?.polyline[0];if(!i){g.push(e);continue}let o=r.jb(r.vt(),d,i);Math.abs(r.Om(o,l)){"use strict";n.d(t,{A:()=>i});var r=n(36195),a=n(42215);function i(e,t){let n=r.wu.newInstance();n.setInputData(e);let i=e.getSpacing(),o=((0,a.D0)().rendering?.volumeRendering?.sampleDistanceMultiplier||1)*(i[0]+i[1]+i[2])/6;return n.setMaximumSamplesPerRay(4e3),n.setSampleDistance(o),n.setScalarTexture(t),n}n(54731),n(87352)},44489:(e,t,n)=>{"use strict";var r;!function(e){e.UP="UP",e.DOWN="DOWN",e.LEFT="LEFT",e.RIGHT="RIGHT"}(r||(r={}))},46704:(e,t,n)=>{"use strict";n.d(t,{u:()=>a});var r=n(70192);function a(e,t){return!!r.BF.getScalingDescriptor(e,t)?.isPreScaled}},49007:(e,t,n)=>{"use strict";n.d(t,{triggerSegmentationDataModified:()=>r.Q,triggerSegmentationModified:()=>o,triggerSegmentationRemoved:()=>s,triggerSegmentationRepresentationModified:()=>l,triggerSegmentationRepresentationRemoved:()=>c});var r=n(36814),a=n(70192),i=n(78378);function o(e){(0,a.Hl)(a.tX,i.sV.SEGMENTATION_MODIFIED,{segmentationId:e})}function s(e){(0,a.Hl)(a.tX,i.sV.SEGMENTATION_REMOVED,{segmentationId:e})}function l(e,t,n){(0,a.Hl)(a.tX,i.sV.SEGMENTATION_REPRESENTATION_MODIFIED,{segmentationId:t,type:n,viewportId:e})}function c(e,t,n){(0,a.Hl)(a.tX,i.sV.SEGMENTATION_REPRESENTATION_REMOVED,{viewportId:e,segmentationId:t,type:n})}},49963:(e,t,n)=>{"use strict";n.d(t,{Xd:()=>c,Xr:()=>g,fA:()=>h,lw:()=>u,nu:()=>d,vt:()=>s,x8:()=>l});var r=n(97633),a=n(37843),i=n(50923),o=n(5434);function s(){var e=new r.tb(4);return r.tb!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function l(e,t,n){var r=Math.sin(n*=.5);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function c(e,t){var n=2*Math.acos(t[3]),a=Math.sin(n/2);return a>r.p8?(e[0]=t[0]/a,e[1]=t[1]/a,e[2]=t[2]/a):(e[0]=1,e[1]=0,e[2]=0),n}function u(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],s=n[0],l=n[1],c=n[2],u=n[3];return e[0]=r*u+o*s+a*c-i*l,e[1]=a*u+o*l+i*s-r*c,e[2]=i*u+o*c+r*l-a*s,e[3]=o*u-r*s-a*l-i*c,e}function d(e,t,n,a){var i,o,s,l,c,u=t[0],d=t[1],g=t[2],h=t[3],m=n[0],p=n[1],f=n[2],v=n[3];return(o=u*m+d*p+g*f+h*v)<0&&(o=-o,m=-m,p=-p,f=-f,v=-v),1-o>r.p8?(s=Math.sin(i=Math.acos(o)),l=Math.sin((1-a)*i)/s,c=Math.sin(a*i)/s):(l=1-a,c=a),e[0]=l*u+c*m,e[1]=l*d+c*p,e[2]=l*g+c*f,e[3]=l*h+c*v,e}function g(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}o.o8;var h=o.fA;o.C,o.hZ,o.WQ,o.hs,o.Om,o.Cc,o.Bw,o.m3,o.S8,o.t2,o.aI,i.vt(),i.fA(1,0,0),i.fA(0,1,0),s(),s(),a.create()},50923:(e,t,n)=>{"use strict";n.d(t,{$A:()=>S,Bw:()=>o,C:()=>l,DI:()=>v,Il:()=>C,Io:()=>p,Ln:()=>m,Om:()=>I,Re:()=>d,S8:()=>A,WQ:()=>u,Z0:()=>E,aI:()=>T,ei:()=>_,fA:()=>s,g7:()=>M,hZ:()=>c,hs:()=>h,jb:()=>R,lo:()=>D,lw:()=>g,o8:()=>i,t2:()=>y,v_:()=>b,vt:()=>a,xg:()=>w,ze:()=>f});var r=n(97633);function a(){var e=new r.tb(3);return r.tb!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function i(e){var t=new r.tb(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function o(e){return Math.hypot(e[0],e[1],e[2])}function s(e,t,n){var a=new r.tb(3);return a[0]=e,a[1]=t,a[2]=n,a}function l(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function c(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function u(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function d(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function g(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}function h(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function m(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e}function p(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2])}function f(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function v(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function A(e,t){var n=t[0],r=t[1],a=t[2],i=n*n+r*r+a*a;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function I(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function S(e,t,n){var r=t[0],a=t[1],i=t[2],o=n[0],s=n[1],l=n[2];return e[0]=a*l-i*s,e[1]=i*o-r*l,e[2]=r*s-a*o,e}function E(e,t,n){var r=t[0],a=t[1],i=t[2],o=n[3]*r+n[7]*a+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*a+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*a+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*a+n[10]*i+n[14])/o,e}function _(e,t,n){var r=t[0],a=t[1],i=t[2];return e[0]=r*n[0]+a*n[3]+i*n[6],e[1]=r*n[1]+a*n[4]+i*n[7],e[2]=r*n[2]+a*n[5]+i*n[8],e}function M(e,t){var n=e[0],r=e[1],a=e[2],i=t[0],o=t[1],s=t[2],l=Math.sqrt(n*n+r*r+a*a)*Math.sqrt(i*i+o*o+s*s);return Math.acos(Math.min(Math.max(l&&I(e,t)/l,-1),1))}function b(e){return e[0]=0,e[1]=0,e[2]=0,e}function y(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function T(e,t){var n=e[0],a=e[1],i=e[2],o=t[0],s=t[1],l=t[2];return Math.abs(n-o)<=r.p8*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(a-s)<=r.p8*Math.max(1,Math.abs(a),Math.abs(s))&&Math.abs(i-l)<=r.p8*Math.max(1,Math.abs(i),Math.abs(l))}var R=d,w=p,D=function(e,t){var n=t[0]-e[0],r=t[1]-e[1],a=t[2]-e[2];return n*n+r*r+a*a},C=o;a()},51200:(e,t,n)=>{"use strict";n.d(t,{Ut:()=>i,r$:()=>a});var r=n(32207);function a(e,t={}){return r._6.getSegmentationRepresentations(e,t)}function i(e,t){let n=r._6;if(!t.segmentationId||!t.type)throw Error("getSegmentationRepresentation: No segmentationId or type provided, you need to provide at least one of them");let a=n.getSegmentationRepresentations(e,t);return a?.[0]}},53965:e=>{!function(){var t={229:function(e){var t,n,r,a=e.exports={};function i(){throw Error("setTimeout has not been defined")}function o(){throw Error("clearTimeout has not been defined")}try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}var l=[],c=!1,u=-1;function d(){c&&r&&(c=!1,r.length?l=r.concat(l):u=-1,l.length&&g())}function g(){if(!c){var e=s(d);c=!0;for(var t=l.length;t;){for(r=l,l=[];++u1)for(var n=1;n{"use strict";n(32207)},54715:(e,t,n)=>{"use strict";n.d(t,{W:()=>function e(t){return null==t||"object"!=typeof t?t:Array.isArray(t)?t.map(t=>e(t)):function t(n){let r={};for(let[i,o]of Object.entries(n)){if(a.has(i)){let e=a.get(i);e&&(r[i]=e(i,o));continue}null==o||"object"!=typeof o?r[i]=o:Array.isArray(o)?r[i]=o.map(t=>e(t)):r[i]=t(o)}return r}(t)}});let{PointsManager:r}=n(70192).BF,a=new Map([["pointsInVolume",null],["projectionPoints",null],["contour",function(e,t){return null!=t&&"object"==typeof t&&"polyline"in t?{...t,polyline:null,pointsManager:r.create3(t.polyline.length,t.polyline)}:t}],["spline",null]])},55623:(e,t,n)=>{"use strict";n.d(t,{H:()=>i});var r=n(50923),a=n(89819);function i(e,t,n={maxMajor:0,maxMinor:0}){let o,s,{points:l}=e.polyData,{maxMinor:c,maxMajor:u}=n,d=u*u,g=c*c;for(let e=0;e.01)&&t.testCenter(i,o)&&(0,a.pW)(i,o,t)&&(g=c,s=[e,n])}if(s)return g=Math.sqrt(g),{majorAxis:[h,m],minorAxis:[l[s[0]],l[s[1]]],maxMajor:d,maxMinor:g,...e}}},60212:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(70192),a=n(83409);let i=function(e){e.length&&e.forEach(e=>{let t=(0,r.yj)(e);if(!t)return void console.warn(`Viewport not available for ${e}`);let{viewport:n}=t;if(!n)return void console.warn(`Viewport not available for ${e}`);let i=n.element;(0,a.A)(i)})}},60332:(e,t,n)=>{"use strict";n(9538),n(94194),n(38094),n(55158),n(20832),n(71283),n(83101),n(74065),n(13026),n(66703),n(83603)},61034:(e,t,n)=>{"use strict";n.d(t,{fillInsideCircle:()=>r.kr}),n(11420);var r=n(11663)},61689:(e,t,n)=>{"use strict";n(32207)},63306:(e,t,n)=>{"use strict";n.d(t,{rK:()=>u}),n(70192);var r=n(4546);n(33845);var a=n(74065),i=n(93022);n(36965);var o=n(76818);n(34699);var s=n(60212),l=n(34470),c=n(69548);function u(e,t,n){(0,i.addChildAnnotation)(t,n),(0,o.M)(n);let{contour:u}=n.data,d=function(e,t){let n=e.length,r=Array(n);for(let a=0;a{r.add(e.metadata.toolName)}),r.values()))if((0,c.l$)(e)){let t=(0,l.Q0)(n,e);(0,s.A)(t)}}(e,[t,n])}n(42018)},64029:(e,t,n)=>{"use strict";n.d(t,{_:()=>o});var r=n(70192),a=n(83409),i=n(42306);function o(e){e.forEach(e=>{let t=(0,i.getToolGroup)(e);if(!t)return void console.warn(`ToolGroup not available for ${e}`);t.getViewportsInfo().forEach(e=>{let{renderingEngineId:t,viewportId:n}=e,i=(0,r.lD)(t);if(!i)return void console.warn(`RenderingEngine not available for ${t}`);let o=i.getViewport(n);(0,a.A)(o.element)})})}},65509:(e,t,n)=>{"use strict";n.d(t,{$n:()=>c,AD:()=>l,Hs:()=>o,kL:()=>u,m:()=>s});var r=n(70192),a=n(18236),i=n(4849);function o(e,t){return(0,a.uk)(e)?.labelmaps?.[t]}function s(e){let t=(0,a.uk)(e);return t?Object.values(t.labelmaps):[]}function l(e,t){let n=(0,a.uk)(e);n&&(n.labelmaps[t.labelmapId]=t)}function c(e,t){let n=(0,a.uk)(e);if(!n)return;let i=n.labelmaps[t];i?.geometryVolumeId&&r.PP.getVolume(i.geometryVolumeId)&&r.PP.removeVolumeLoadObject(i.geometryVolumeId),delete n.labelmaps[t]}function u(e){let t=function(e){var t;if(e.volumeId||(t=e,!(0,i.dm)(t)))return;let n=e.geometryVolumeId??`${e.labelmapId}-geometry`,a=r.PP.getVolume(n);if(a)return a;let o=new Map;(0,i.Zd)(e,(e,t)=>{let n=o.get(e)??[];n.push(t),o.set(e,n)});let s=Array.from(o.keys());if(!s.length)return;let l=0,c=r.R2.createAndCacheDerivedImages(s,{getDerivedImageId:()=>`${n}-image-${l++}`,targetBuffer:{type:"Uint8Array"}});return c.forEach(e=>{let t=o.get(e.referencedImageId);if(!t?.length)return;let n=e.voxelManager,a=n.getScalarDataLength();t.forEach(e=>{let t=r.PP.getImage(e),i=t?.voxelManager;if(!i)return;let o=Math.min(a,i.getScalarDataLength());for(let e=0;ee.imageId))}(e);if(t)return t;let n=e.volumeId??e.geometryVolumeId;if(n){let e=r.PP.getVolume(n);if(e)return e}let a=e.imageIds??[];if(!a.length)return;let o=e.volumeId??e.geometryVolumeId??`${e.labelmapId}-geometry`;e.volumeId||(e.geometryVolumeId=o);let s=r.PP.getVolume(o);return s||r.UH.createAndCacheVolumeFromImagesSync(o,a)}},65947:(e,t,n)=>{"use strict";n.d(t,{B:()=>a});var r=n(32207);function a(e){return r._6.getColorLUT(e)}},66442:(e,t,n)=>{"use strict";n.d(t,{Mx:()=>r.Mx,Nf:()=>r.Nf,Qk:()=>r.Qk,Ry:()=>r.Ry,VQ:()=>r.VQ,kL:()=>r.kL,r:()=>r.r});var r=n(69301)},66703:(e,t,n)=>{"use strict";let{isEqual:r}=n(70192).BF},67058:(e,t,n)=>{"use strict";n(54268),n(94302),n(74885),n(59408),n(31377)},67358:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var r,a=n(70192),i=n(49185);let{RLEVoxelMap:o,VoxelManager:s}=a.BF;!function(e){e[e.SEGMENT=-1]="SEGMENT",e[e.ISLAND=-2]="ISLAND",e[e.INTERIOR=-3]="INTERIOR",e[e.EXTERIOR=-4]="EXTERIOR",e[e.INTERIOR_SMALL=-5]="INTERIOR_SMALL",e[e.INTERIOR_TEST=-6]="INTERIOR_TEST"}(r||(r={}));class l{constructor(e){this.fillInternalEdge=!1,this.maxInternalRemove=128,this.maxInternalRemove=e?.maxInternalRemove??this.maxInternalRemove,this.fillInternalEdge=e?.fillInternalEdge??this.fillInternalEdge}initialize(e,t,n){let a=!!t.sourceVoxelManager,l=a?t.sourceVoxelManager:t,c=a?t:s.createRLEHistoryVoxelManager(l),{segmentIndex:u=1,previewSegmentIndex:d=1}=n,g=n.points||l.getPoints();if(!g?.length)return;let h=l.getBoundsIJK().map((e,t)=>[Math.min(e[0],...g.map(e=>e[t])),Math.max(e[1],...g.map(e=>e[t]))]);if(h.find(e=>e[0]<0||e[1]>65535))return;let{toIJK:m,fromIJK:p,boundsIJKPrime:f,error:v}=(0,i.A)(e,h);if(v)return void console.warn("Not performing island removal for planes not orthogonal to acquisition plane",v);let[A,I,S]=p(l.dimensions),E=new o(A,I,S);return E.fillFrom((e,t,n)=>{let a=l.toIndex(m([e,t,n])),i=l.getAtIndex(a);if(i===d||i===u)return r.SEGMENT},f),E.normalizer={toIJK:m,fromIJK:p,boundsIJKPrime:f},this.segmentSet=E,this.previewVoxelManager=c,this.segmentIndex=u,this.previewSegmentIndex=d??u,this.selectedPoints=g,!0}floodFillSegmentIsland(){let{selectedPoints:e,segmentSet:t}=this,n=0,{fromIJK:a}=t.normalizer;return e.forEach(e=>{let i=a(e),o=t.toIndex(i),[s,l,c]=i;t.get(o)===r.SEGMENT&&(n+=t.floodFill(s,l,c,r.ISLAND))}),n}removeExternalIslands(){let{previewVoxelManager:e,segmentSet:t}=this,{toIJK:n}=t.normalizer;t.forEach((a,i)=>{let[,o,s]=t.toIJK(a);if(i.value!==r.ISLAND)for(let t=i.start;t{let a;for(let i of[...n])if(i.value===r.ISLAND){if(!a){if(this.fillInternalEdge&&i.start>0)for(let n=0;n{if(n.value!==r.INTERIOR)return;let[,i,o]=e.toIJK(t),s=i>0?e.getRun(i-1,o):null,c=i+12)||g&&h||e.floodFill(n.start,i,o,r.EXTERIOR,{singlePlane:!0})}),e.forEach((t,n)=>{if(n.value!==r.INTERIOR)return;let[,a,i]=e.toIJK(t),o=e.floodFill(n.start,a,i,r.INTERIOR_TEST)>this.maxInternalRemove?r.EXTERIOR:r.INTERIOR_SMALL;e.floodFill(n.start,a,i,o)}),e.forEach((a,i)=>{if(i.value===r.INTERIOR_SMALL)for(let r=i.start;r=e.start&&n=r)return!0;return!1}}},67368:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>y});var r=n(17042),a=n(99298),i=n(628),o=n(56929),s=n(68916),l=n(34839),c=n(64125),u=n(1537),d=n(71836),g=n(72288),h=n(39536),{vtkDebugMacro:m,vtkErrorMacro:p}=r.Ay,f={position:"absolute",top:0,left:0,width:"100%",height:"100%"},v=["activateTexture","deactivateTexture","disableCullFace","enableCullFace","setCullFaceMode","get3DContext","getActiveFramebuffer","getContext","getDefaultTextureByteSize","getDefaultTextureInternalFormat","getDefaultToWebgl2","getGLInformations","getGraphicsMemoryInfo","getGraphicsResourceForObject","getHardwareMaximumLineWidth","getPixelData","getShaderCache","getTextureUnitForTexture","getTextureUnitManager","getWebgl2","makeCurrent","releaseGraphicsResources","registerGraphicsResourceUser","unregisterGraphicsResourceUser","restoreContext","setActiveFramebuffer","setContext","setDefaultToWebgl2","setGraphicsResourceForObject"];function A(e,t,n){let r=e.createFramebuffer(),a=e.createTexture();e.bindTexture(e.TEXTURE_2D,a),e.texImage2D(e.TEXTURE_2D,0,t,2,2,0,t,n,null),e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,a,0);let i=e.checkFramebufferStatus(e.FRAMEBUFFER);return e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null),i===e.FRAMEBUFFER_COMPLETE}var I=0,S=[];function E(e){e.preventDefault()}var _={cullFaceEnabled:!1,cullFaceMode:null,shaderCache:null,initialized:!1,context:null,context2D:null,canvas:null,cursorVisibility:!0,cursor:"pointer",textureUnitManager:null,textureResourceIds:null,containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,webgl2:!1,defaultToWebgl2:!0,activeFramebuffer:null,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1};function M(e,t,n={}){Object.assign(t,_,n),g.Ay.extend(e,t,n),t.canvas||(t.canvas=document.createElement("canvas"),t.canvas.style.width="100%"),t.selector||(t.selector=c.Ay.newInstance(),t.selector.setOpenGLRenderWindow(e)),t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",t._textureResourceIds=new Map,t._graphicsResources=new Map,t._glInformation=null,t.myFactory=o.Ay.newInstance(),t.shaderCache=u.Ay.newInstance(),t.shaderCache.setOpenGLRenderWindow(e),t.renderPasses[0]=l.Ay.newInstance(),r.Ay.get(e,t,["shaderCache","textureUnitManager","webgl2","useBackgroundImage","activeFramebuffer","rootOpenGLRenderWindow"]),r.Ay.setGet(e,t,["initialized","context","context2D","canvas","renderPasses","notifyStartCaptureImage","defaultToWebgl2","cursor","useOffScreen"]),r.Ay.setGetArray(e,t,["size"],2),r.Ay.event(e,t,"imageReady"),r.Ay.event(e,t,"windowResizeEvent"),function(e,t){let n,i;t.classHierarchy.push("vtkOpenGLRenderWindow"),e.getViewNodeFactory=()=>t.myFactory,t.canvas.addEventListener("webglcontextlost",E,!1),t.canvas.addEventListener("webglcontextrestored",e.restoreContext,!1);let o=[0,0];e.onModified(function(){t.renderable&&(t.size[0]!==o[0]||t.size[1]!==o[1])&&(o[0]=t.size[0],o[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1])),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null}),e.buildPass=n=>{n&&t.renderable&&(e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.addMissingNodes(t.renderable.getChildRenderWindowsByReference()),e.removeUnusedNodes(),e.initialize(),t.children.forEach(t=>{t.setOpenGLRenderWindow?.(e)}))},e.initialize=()=>{if(!t.initialized){if(t.rootOpenGLRenderWindow=e.getLastAncestorOfType("vtkOpenGLRenderWindow"),t.rootOpenGLRenderWindow)t.context2D=e.get2DContext();else{t.context=e.get3DContext(),e.resizeFromChildRenderWindows(),t.context&&(I++,S.forEach(e=>e(I))),t.textureUnitManager=d.Ay.newInstance(),t.textureUnitManager.setContext(t.context),t.shaderCache.setContext(t.context);let n=t.context;n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),n.depthFunc(n.LEQUAL),n.enable(n.BLEND)}t.initialized=!0}},e.makeCurrent=()=>{t.context.makeCurrent()},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&p("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){let{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.activeFramebuffer?.getSize()||t.size,e.getPixelData=(e,n,r,a)=>{let i=new Uint8Array((r-e+1)*(a-n+1)*4);return t.context.readPixels(e,n,r-e+1,a-n+1,t.context.RGBA,t.context.UNSIGNED_BYTE,i),i},e.get3DContext=(e={preserveDrawingBuffer:!1,depth:!0,alpha:!0,powerPreference:"high-performance"})=>{let r=null,a="undefined"!=typeof WebGL2RenderingContext;return t.webgl2=!1,t.defaultToWebgl2&&a&&(r=t.canvas.getContext("webgl2",e))&&(t.webgl2=!0,m("using webgl2")),r||(m("using webgl1"),r=t.canvas.getContext("webgl",e)||t.canvas.getContext("experimental-webgl",e)),r||p("no webgl context"),new Proxy(r,(!n&&(n=(0,h.gJ)()),n))},e.get2DContext=(e={})=>t.canvas.getContext("2d",e),e.restoreContext=()=>{let t=s.Ay.newInstance();t.setCurrentOperation("Release"),t.traverse(e,null)},e.activateTexture=n=>{let r=t._textureResourceIds.get(n);if(void 0!==r)return void t.context.activeTexture(t.context.TEXTURE0+r);let a=e.getTextureUnitManager().allocate();if(a<0)return void p("Hardware does not support the number of textures defined.");t._textureResourceIds.set(n,a),t.context.activeTexture(t.context.TEXTURE0+a)},e.deactivateTexture=n=>{let r=t._textureResourceIds.get(n);void 0!==r&&(e.getTextureUnitManager().free(r),t._textureResourceIds.delete(n))},e.getTextureUnitForTexture=e=>{let n=t._textureResourceIds.get(e);return void 0!==n?n:-1},e.getDefaultTextureByteSize=(e,n=null,r=!1)=>{if(t.webgl2)switch(e){case a.JA.CHAR:case a.JA.SIGNED_CHAR:case a.JA.UNSIGNED_CHAR:break;case n:case r:case a.JA.UNSIGNED_SHORT:case a.JA.SHORT:case a.JA.VOID:return 2;default:return 4}return 1},e.getDefaultTextureInternalFormat=(e,n,r=null,i=!1)=>{if(t.webgl2)switch(e){case a.JA.UNSIGNED_CHAR:switch(n){case 1:return t.context.R8;case 2:return t.context.RG8;case 3:return t.context.RGB8;default:return t.context.RGBA8}case r&&!i&&a.JA.UNSIGNED_SHORT:switch(n){case 1:return r.R16_EXT;case 2:return r.RG16_EXT;case 3:return r.RGB16_EXT;default:return r.RGBA16_EXT}case r&&!i&&a.JA.SHORT:switch(n){case 1:return r.R16_SNORM_EXT;case 2:return r.RG16_SNORM_EXT;case 3:return r.RGB16_SNORM_EXT;default:return r.RGBA16_SNORM_EXT}case a.JA.UNSIGNED_SHORT:case a.JA.SHORT:case a.JA.FLOAT:default:switch(n){case 1:return i?t.context.R16F:t.context.R32F;case 2:return i?t.context.RG16F:t.context.RG32F;case 3:return i?t.context.RGB16F:t.context.RGB32F;default:return i?t.context.RGBA16F:t.context.RGBA32F}}switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:return t.context.RGB;default:return t.context.RGBA}},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=(n="image/png",{resetCamera:r=!1,size:a=null,scale:i=1}={})=>{if(t.deleted)return null;t.imageFormat=n;let o=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:a||1!==i?a||t.size.map(e=>e*i):null},new Promise((n,a)=>{let i=e.onImageReady(a=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=o,i.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach(({restoreParamsFn:e,arg:t})=>e(t)),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(a);else{let n=document.createElement("img");if(n.style=f,n.src=a,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t.rootOpenGLRenderWindow?.resizeFromChildRenderWindows(),t._screenshot.size=null,e.modified(),r){let e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map(t=>{let n=t.getActiveCamera(),a=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(a))}}),t._screenshot.cameras.forEach(({resetCameraFn:e,resetCameraArgs:t})=>e(t))}e.traverseAllPasses()}})})},e.getHardwareMaximumLineWidth=()=>{if(null!=i)return i;let t=e.get3DContext(),n=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE);return i=n[1],n[1]},e.getGLInformations=()=>{if(t._glInformation)return t._glInformation;let n=e.get3DContext(),r=n.getExtension("OES_texture_float"),a=n.getExtension("OES_texture_half_float"),i=n.getExtension("WEBGL_debug_renderer_info"),o=n.getExtension("WEBGL_draw_buffers"),s=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),l=[["Max Vertex Attributes","MAX_VERTEX_ATTRIBS",n.getParameter(n.MAX_VERTEX_ATTRIBS)],["Max Varying Vectors","MAX_VARYING_VECTORS",n.getParameter(n.MAX_VARYING_VECTORS)],["Max Vertex Uniform Vectors","MAX_VERTEX_UNIFORM_VECTORS",n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS)],["Max Fragment Uniform Vectors","MAX_FRAGMENT_UNIFORM_VECTORS",n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS)],["Max Fragment Texture Image Units","MAX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)],["Max Vertex Texture Image Units","MAX_VERTEX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)],["Max Combined Texture Image Units","MAX_COMBINED_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS)],["Max 2D Texture Size","MAX_TEXTURE_SIZE",n.getParameter(n.MAX_TEXTURE_SIZE)],["Max Cube Texture Size","MAX_CUBE_MAP_TEXTURE_SIZE",n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE)],["Max Texture Anisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT",s&&n.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT)],["Point Size Range","ALIASED_POINT_SIZE_RANGE",n.getParameter(n.ALIASED_POINT_SIZE_RANGE).join(" - ")],["Line Width Range","ALIASED_LINE_WIDTH_RANGE",n.getParameter(n.ALIASED_LINE_WIDTH_RANGE).join(" - ")],["Max Viewport Dimensions","MAX_VIEWPORT_DIMS",n.getParameter(n.MAX_VIEWPORT_DIMS).join(" - ")],["Max Renderbuffer Size","MAX_RENDERBUFFER_SIZE",n.getParameter(n.MAX_RENDERBUFFER_SIZE)],["Framebuffer Red Bits","RED_BITS",n.getParameter(n.RED_BITS)],["Framebuffer Green Bits","GREEN_BITS",n.getParameter(n.GREEN_BITS)],["Framebuffer Blue Bits","BLUE_BITS",n.getParameter(n.BLUE_BITS)],["Framebuffer Alpha Bits","ALPHA_BITS",n.getParameter(n.ALPHA_BITS)],["Framebuffer Depth Bits","DEPTH_BITS",n.getParameter(n.DEPTH_BITS)],["Framebuffer Stencil Bits","STENCIL_BITS",n.getParameter(n.STENCIL_BITS)],["Framebuffer Subpixel Bits","SUBPIXEL_BITS",n.getParameter(n.SUBPIXEL_BITS)],["MSAA Samples","SAMPLES",n.getParameter(n.SAMPLES)],["MSAA Sample Buffers","SAMPLE_BUFFERS",n.getParameter(n.SAMPLE_BUFFERS)],["Supported Formats for UByte Render Targets ","UNSIGNED_BYTE RENDER TARGET FORMATS",[r&&A(n,n.RGBA,n.UNSIGNED_BYTE)?"RGBA":"",r&&A(n,n.RGB,n.UNSIGNED_BYTE)?"RGB":"",r&&A(n,n.LUMINANCE,n.UNSIGNED_BYTE)?"LUMINANCE":"",r&&A(n,n.ALPHA,n.UNSIGNED_BYTE)?"ALPHA":"",r&&A(n,n.LUMINANCE_ALPHA,n.UNSIGNED_BYTE)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Half Float Render Targets","HALF FLOAT RENDER TARGET FORMATS",[a&&A(n,n.RGBA,a.HALF_FLOAT_OES)?"RGBA":"",a&&A(n,n.RGB,a.HALF_FLOAT_OES)?"RGB":"",a&&A(n,n.LUMINANCE,a.HALF_FLOAT_OES)?"LUMINANCE":"",a&&A(n,n.ALPHA,a.HALF_FLOAT_OES)?"ALPHA":"",a&&A(n,n.LUMINANCE_ALPHA,a.HALF_FLOAT_OES)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Full Float Render Targets","FLOAT RENDER TARGET FORMATS",[r&&A(n,n.RGBA,n.FLOAT)?"RGBA":"",r&&A(n,n.RGB,n.FLOAT)?"RGB":"",r&&A(n,n.LUMINANCE,n.FLOAT)?"LUMINANCE":"",r&&A(n,n.ALPHA,n.FLOAT)?"ALPHA":"",r&&A(n,n.LUMINANCE_ALPHA,n.FLOAT)?"LUMINANCE_ALPHA":""].join(" ")],["Max Multiple Render Targets Buffers","MAX_DRAW_BUFFERS_WEBGL",o?n.getParameter(o.MAX_DRAW_BUFFERS_WEBGL):0],["High Float Precision in Vertex Shader","HIGH_FLOAT VERTEX_SHADER",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision+" (-2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMax+")"],["Medium Float Precision in Vertex Shader","MEDIUM_FLOAT VERTEX_SHADER",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision+" (-2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMax+")"],["Low Float Precision in Vertex Shader","LOW_FLOAT VERTEX_SHADER",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).precision+" (-2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMax+")"],["High Float Precision in Fragment Shader","HIGH_FLOAT FRAGMENT_SHADER",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision+" (-2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMax+")"],["Medium Float Precision in Fragment Shader","MEDIUM_FLOAT FRAGMENT_SHADER",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision+" (-2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMax+")"],["Low Float Precision in Fragment Shader","LOW_FLOAT FRAGMENT_SHADER",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).precision+" (-2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMax+")"],["High Int Precision in Vertex Shader","HIGH_INT VERTEX_SHADER",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).precision+" (-2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMax+")"],["Medium Int Precision in Vertex Shader","MEDIUM_INT VERTEX_SHADER",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).precision+" (-2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMax+")"],["Low Int Precision in Vertex Shader","LOW_INT VERTEX_SHADER",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).precision+" (-2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMax+")"],["High Int Precision in Fragment Shader","HIGH_INT FRAGMENT_SHADER",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).precision+" (-2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMax+")"],["Medium Int Precision in Fragment Shader","MEDIUM_INT FRAGMENT_SHADER",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).precision+" (-2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMax+")"],["Low Int Precision in Fragment Shader","LOW_INT FRAGMENT_SHADER",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).precision+" (-2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMin+" - 2"+n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMax+")"],["Supported Extensions","EXTENSIONS",n.getSupportedExtensions().join("
")],["WebGL Renderer","RENDERER",n.getParameter(n.RENDERER)],["WebGL Vendor","VENDOR",n.getParameter(n.VENDOR)],["WebGL Version","VERSION",n.getParameter(n.VERSION)],["Shading Language Version","SHADING_LANGUAGE_VERSION",n.getParameter(n.SHADING_LANGUAGE_VERSION)],["Unmasked Renderer","UNMASKED_RENDERER",i&&n.getParameter(i.UNMASKED_RENDERER_WEBGL)],["Unmasked Vendor","UNMASKED_VENDOR",i&&n.getParameter(i.UNMASKED_VENDOR_WEBGL)],["WebGL Version","WEBGL_VERSION",t.webgl2?2:1]],c={};for(;l.length;){let[e,t,n]=l.pop();t&&(c[t]={label:e,value:n})}return t._glInformation=c,c},e.traverseAllPasses=()=>{if(t.renderPasses)for(let n=0;n{e.getViewProps().forEach(e=>{if(e.getContainer){let t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{let e=t.rootOpenGLRenderWindow;if(!e||!t.context2D||t.children.some(e=>!!e.getSelector?.()))return;let n=e.getCanvas(),r=t.canvas;t.context2D.drawImage(n,0,n.height-r.height,r.width,r.height,0,0,r.width,r.height)},e.resizeFromChildRenderWindows=()=>{let n=t.renderable.getChildRenderWindowsByReference();if(n.length>0){let t=[0,0];for(let r=0;rt[0]?a[0]:t[0],t[1]=a[1]>t[1]?a[1]:t[1])}e.setSize(...t)}},e.disableCullFace=()=>{t.cullFaceEnabled&&(t.context.disable(t.context.CULL_FACE),t.cullFaceEnabled=!1)},e.enableCullFace=()=>{t.cullFaceEnabled||(t.context.enable(t.context.CULL_FACE),t.cullFaceEnabled=!0)},e.setCullFaceMode=e=>{t.cullFaceMode!==e&&(t.context.cullFace(e),t.cullFaceMode=e)},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady(t=>e.setBackgroundImage(t.image)),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.createSelector=()=>{let t=c.Ay.newInstance();return t.setOpenGLRenderWindow(e),t},e.delete=r.Ay.chain(()=>{t.context&&(I--,S.forEach(e=>e(I))),e.setContainer(),e.setViewStream()},function(){t.canvas.removeEventListener("webglcontextlost",E),t.canvas.removeEventListener("webglcontextrestored",e.restoreContext)},e.delete),e.setActiveFramebuffer=e=>{t.activeFramebuffer=e};let l=e.setSize;e.setSize=(t,n)=>{let r=l(t,n);return r&&e.invokeWindowResizeEvent({width:t,height:n}),r},e.registerGraphicsResourceUser=(n,r)=>{t._graphicsResources.has(n)||e.setGraphicsResourceForObject(n,null,null),t._graphicsResources.get(n)?.users.add(r)},e.unregisterGraphicsResourceUser=(n,r)=>{let a=t._graphicsResources.get(n);a&&(a.users.delete(r),a.users.size||(a.oglObject?.releaseGraphicsResources(e),t._graphicsResources.delete(n)))},e.getGraphicsResourceForObject=e=>t._graphicsResources.get(e),e.setGraphicsResourceForObject=(n,r,a)=>{if(!n)return;let i=t._graphicsResources.get(n);i?.oglObject?.releaseGraphicsResources(e),t._graphicsResources.set(n,{coreObject:n,oglObject:r,hash:a,users:i?.users??new Set})},e.getGraphicsMemoryInfo=()=>{let e=0;return t._graphicsResources.forEach(({oglObject:t})=>{e+=t.getAllocatedGPUMemoryInBytes()}),e},e.releaseGraphicsResources=()=>{null!==t.shaderCache&&t.shaderCache.releaseGraphicsResources(e),t._graphicsResources.forEach(({oglObject:t})=>{t.releaseGraphicsResources(e)}),t._graphicsResources.clear(),null!==t.textureUnitManager&&t.textureUnitManager.freeAll(),t.renderable.getRenderersByReference().forEach(t=>{e.getViewNodeFor(t)?.releaseGraphicsResources()})};let u={...e};v.forEach(n=>{e[n]=(...e)=>t.rootOpenGLRenderWindow?t.rootOpenGLRenderWindow[n](...e):u[n](...e)})}(e,t)}var b=r.Ay.newInstance(M,"vtkOpenGLRenderWindow");(0,i.p$)("WebGL",b);var y={newInstance:b,extend:M,pushMonitorGLContextCount:function(e){S.push(e)},popMonitorGLContextCount:function(e){return S.pop()}};(0,o.c9)("vtkRenderWindow",b)},69301:(e,t,n)=>{"use strict";n.d(t,{Lp:()=>l.A,Mx:()=>o.Mx,Nf:()=>o.Nf,Qk:()=>s.Qk,Ry:()=>s.Ry,VQ:()=>s.VQ,kL:()=>a.kL,r:()=>o.r,uk:()=>r.uk,xS:()=>i.x});var r=n(18236),a=n(65509),i=n(76399),o=n(40454);n(37406);var s=n(26221),l=n(82875)},70192:(e,t,n)=>{"use strict";n.d(t,{T7:()=>L.T,ei:()=>A.A,Jj:()=>a,fX:()=>r,hS:()=>d.A,PX:()=>u.A,PP:()=>I.Ay,tX:()=>s.A,kJ:()=>S.Ay,b1:()=>S.b1,yj:()=>S.yj,zb:()=>S.zb,lD:()=>c.lD,qO:()=>c.qO,LH:()=>i.LH,G_:()=>i.G_,R2:()=>x,wx:()=>E,Hl:()=>l.A,BF:()=>O,sv:()=>g.sv,qV:()=>g.qV,UH:()=>C});var r=n(77280),a=n(79267),i=n(42215);n(32916);var o=n(13032),s=(n(41092),n(76879),n(3922)),l=n(69228);n(56872),n(35881),n(72661),n(8605),n(42684),n(66384),o.A;var c=n(16376),u=n(62685),d=n(2523);n(68337);var g=n(25294),h=n(62004),m=n(80405),p=n(39113),f=n(27112),v=n(48196);n(31608),g.g1,g.rE,g.N9,g.Pf,g.g6,h.Ay,h.JG,h.Xy,h.cs,h.L0,m.Ay,m.jY,m.hW,m.QJ,m.vL,p.Ay,p.ep,p.Iz,p.xn,p.Sy,f.Ay,f.Dl,f.zp,f.er,f.fB,v.Ay,v.v9,v.Jj,v.qn,v.LG,n(52219),n(44151);var A=n(21601);n(58851),n(39997),n(7842),n(55580),n(67058);var I=n(54268);n(54223),n(92391);var S=n(35088),E=n(39216);n(99376);let _=Symbol("DefaultSettings"),M=Symbol("RuntimeSettings"),b=Symbol("ObjectSettingsMap"),y=Symbol("Dictionary");class T{constructor(e){let t=Object.create(e instanceof T&&y in e?e[y]:null);Object.seal(Object.defineProperty(this,y,{value:t}))}set(e,t){return w(this[y],e,t,null)}get(e){var t;return t=this[y],t[e]}unset(e){return function(e,t){if(t.endsWith(".")){let n=0,r=t.slice(0,-1),a=0===r.length;for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(a||i.startsWith(t)||i===r)&&(delete e[i],++n);return n>0}return delete e[t]}(this[y],e+"")}forEach(e){R(this[y],e)}extend(){return new T(this)}import(e){D(e)&&Object.keys(e).forEach(t=>{w(this[y],t,e[t],null)})}dump(){let e={};return R(this[y],(t,n)=>{void 0!==n&&function e(t,n,r){let a=n.indexOf(".");if(a>=0){let i=n.slice(0,a),o=t[i];if("object"!=typeof o||null===o){let e=o;o={},void 0!==e&&(o[""]=e),t[i]=o}e(o,n.slice(a+1,n.length),r)}else t[n]=r}(e,t,n)}),e}static assert(e){return e instanceof T?e:T.getRuntimeSettings()}static getDefaultSettings(e=null){let t=T[_];if(t instanceof T||(t=new T,T[_]=t),e){let n={};return t.forEach(r=>{r.startsWith(e)&&(n[r.split(`${e}.`)[1]]=t.get(r))}),n}return t}static getRuntimeSettings(){let e=T[M];return e instanceof T||(e=new T(T.getDefaultSettings()),T[M]=e),e}static getObjectSettings(e,t){let n=null;if(e instanceof T)n=e;else if("object"==typeof e&&null!==e){let r=T[b];r instanceof WeakMap||(r=new WeakMap,T[b]=r),(n=r.get(e))instanceof T||(n=new T(T.assert(T.getObjectSettings(t))),r.set(e,n))}return n}static extendRuntimeSettings(){return T.getRuntimeSettings().extend()}}function R(e,t){for(let n in e)t(n,e[n])}function w(e,t,n,r){if(function(e){let t,n,r;if("string"!=typeof e||(t=e.length-1)<0)return!1;for(r=-1;(n=e.indexOf(".",r+1))>=0;){if(n-r<2||n===t)return!1;r=n}return!0}(t)){if(D(n)){let i;var a=r instanceof WeakSet?r:new WeakSet;if(a.has(n))return w(e,t,null,a);for(let r in a.add(n),i=0,n)Object.prototype.hasOwnProperty.call(n,r)&&!w(e,0===r.length?t:`${t}.${r}`,n[r],a)&&++i;return a.delete(n),0===i}return e[t]=n,!0}return!1}function D(e){if("object"==typeof e&&null!==e){let t=Object.getPrototypeOf(e);if(t===Object.prototype||null===t)return!0}return!1}T.getDefaultSettings().set("useCursors",!0);var C=n(20549),x=n(97938);n(14098),n(44191),n(98497);var L=n(1705),O=n(33174);n(13402),n(15721),n(26444),n(10115),g.g1,g.rE,g.N9,h.Ay,h.JG,h.Xy,h.cs,h.L0,m.Ay,m.jY,m.hW,m.QJ,m.vL,p.Ay,p.ep,p.Iz,p.xn,p.Sy,f.Ay,f.Dl,f.zp,f.er,f.fB,v.Ay,v.v9,v.Jj,v.qn,v.LG},73416:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>u});var r=n(17042),a=n(99298),i=n(87352),{isVtkObject:o}=r.Ay;function s(e){let t=[];for(let n=0;n((void 0===t.numberOfCells||n)&&(t.cellSizes?t.numberOfCells=t.cellSizes.length:t.numberOfCells=l(e.getData())),t.numberOfCells),e.getCellSizes=n=>((void 0===t.cellSizes||n)&&(t.cellSizes=s(e.getData())),t.cellSizes),e.resize=n=>{let a=e.getNumberOfTuples();r.resize(n);let i=e.getNumberOfTuples();i{r.setData(e,1),t.numberOfCells=void 0,t.cellSizes=void 0},e.getCell=e=>{let n=e,r=t.values[n++];return t.values.subarray(n,n+r)},e.insertNextCell=n=>{let r;r=o(n)?n.getPointsIds():n;let a=e.getNumberOfCells();return e.insertNextTuples([r.length,...r]),++t.numberOfCells,null!=t.cellSizes&&t.cellSizes.push(r.length),a},e.getMaxCellSize=()=>e.getCellSizes().reduce((e,t)=>Math.max(e,t),0)}var u={newInstance:r.Ay.newInstance(c,"vtkCellArray"),extend:c,...{extractCellSizes:s,getNumberOfCells:l}}},73526:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(70192),a=n(17964);let i=function(e,t){t||(t=(0,r.qO)().find(t=>t.getViewports().find(t=>t.id===e))?.id);let n=a.wk.toolGroups.filter(n=>n.viewportsInfo.some(n=>n.renderingEngineId===t&&(!n.viewportId||n.viewportId===e)));if(n.length){if(n.length>1)throw Error(`Multiple tool groups found for renderingEngineId: ${t} and viewportId: ${e}. You should only + have one tool group per viewport in a renderingEngine.`);return n[0]}}},73904:(e,t,n)=>{"use strict";n.d(t,{$2:()=>d,hp:()=>g.A,qX:()=>h.A,V6:()=>m.A,a5:()=>v.A,kd:()=>f.A,VV:()=>p.A,tk:()=>A.A,pJ:()=>I.A});var r=n(17964),a=n(70192);function i(e,t){if(r.wk.svgNodeCache[e]&&r.wk.svgNodeCache[e][t])return r.wk.svgNodeCache[e][t].domRef}function o(e,t,n,a){if(!r.wk.svgNodeCache[t])return null;r.wk.svgNodeCache[t][a]={touched:!0,domRef:n},e.appendChild(n)}function s(e,t){r.wk.svgNodeCache[e]&&r.wk.svgNodeCache[e][t]&&(r.wk.svgNodeCache[e][t].touched=!0)}function l(e,t){r.wk.svgNodeCache[t]&&Object.keys(r.wk.svgNodeCache[t]).forEach(n=>{let a=r.wk.svgNodeCache[t][n];!a.touched&&a.domRef&&(e.removeChild(a.domRef),delete r.wk.svgNodeCache[t][n])})}let c=function(e){let{viewportId:t,renderingEngineId:n}=(0,a.kJ)(e),c=`${t}:${n}`,u=function(e){let t=e.querySelector(".viewport-element");return t?.querySelector(":scope > .svg-layer")}(e);return Object.keys(r.wk.svgNodeCache[c]).forEach(e=>{r.wk.svgNodeCache[c][e].touched=!1}),{svgLayerElement:u,svgNodeCacheForCanvas:r.wk.svgNodeCache,getSvgNode:i.bind(this,c),appendNode:o.bind(this,u,c),setNodeTouched:s.bind(this,c),clearUntouched:l.bind(this,u,c)}};var u=n(10999);let d=function(e,t){let n=c(e);n.svgLayerElement&&(0,u.F4)(n.svgLayerElement),t(n),n.clearUntouched()};var g=n(6600),h=n(59187),m=n(76722),p=n(39172),f=n(49151),v=n(47315),A=n(85050),I=n(94066);n(99572)},74978:(e,t,n)=>{"use strict";n.d(t,{c9:()=>o});var r=n(17042),a=n(81522),i=Object.create(null);function o(e,t){i[e]=t}var s={};r.Ay.newInstance(function(e,t,n={}){Object.assign(t,s,n),t.overrides=i,a.Ay.extend(e,t,n),t.classHierarchy.push("vtkWebGPUViewNodeFactory")},"vtkWebGPUViewNodeFactory")},76826:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>r});var r={AttributeCopyOperations:{COPYTUPLE:0,INTERPOLATE:1,PASSDATA:2,ALLCOPY:3},AttributeLimitTypes:{MAX:0,EXACT:1,NOLIMIT:2},AttributeTypes:{SCALARS:0,VECTORS:1,NORMALS:2,TCOORDS:3,TENSORS:4,GLOBALIDS:5,PEDIGREEIDS:6,EDGEFLAG:7,NUM_ATTRIBUTES:8},CellGhostTypes:{DUPLICATECELL:1,HIGHCONNECTIVITYCELL:2,LOWCONNECTIVITYCELL:4,REFINEDCELL:8,EXTERIORCELL:16,HIDDENCELL:32},DesiredOutputPrecision:{DEFAULT:0,SINGLE:1,DOUBLE:2},PointGhostTypes:{DUPLICATEPOINT:1,HIDDENPOINT:2},ghostArrayName:"vtkGhostType"}},77280:(e,t,n)=>{"use strict";n.d(t,{gd:()=>c.A,ov:()=>m.A,sV:()=>i.A,dC:()=>d.A,FU:()=>f.A,VO:()=>l.A,WA:()=>g.A,nb:()=>A.A,KY:()=>u,YB:()=>S.A,FJ:()=>I.A,Yw:()=>o.A,yX:()=>h.A,QO:()=>v,Dt:()=>p.A,NV:()=>s.A});var r,a,i=n(76879),o=n(41831),s=n(56872);n(42357);var l=n(66692),c=n(33011);!function(e){e.AXIAL="axial",e.CORONAL="coronal",e.SAGITTAL="sagittal",e.ACQUISITION="acquisition",e.AXIAL_REFORMAT="axial_reformat",e.CORONAL_REFORMAT="coronal_reformat",e.SAGITTAL_REFORMAT="sagittal_reformat",e.REFORMAT="reformat"}(r||(r={}));let u=r;var d=n(29234);n(31620);var g=n(40523),h=n(5541);n(42151);var m=n(21339),p=n(17774),f=n(82866),v=n(65693),A=n(35752);!function(e){e.SUM="SUM",e.SUBTRACT="SUBTRACT",e.AVERAGE="AVERAGE"}(a||(a={})),n(42776);var I=n(89566),S=n(70639)},78928:(e,t,n)=>{var r="__lodash_hash_undefined__",a=1/0,i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,o=/^\w*$/,s=/^\./,l=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,c=/\\(\\)?/g,u=/^\[object .+?Constructor\]$/,d="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,g="object"==typeof self&&self&&self.Object===Object&&self,h=d||g||Function("return this")(),m=Array.prototype,p=Function.prototype,f=Object.prototype,v=h["__core-js_shared__"],A=function(){var e=/[^.]+$/.exec(v&&v.keys&&v.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),I=p.toString,S=f.hasOwnProperty,E=f.toString,_=RegExp("^"+I.call(S).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),M=h.Symbol,b=m.splice,y=P(h,"Map"),T=P(Object,"create"),R=M?M.prototype:void 0,w=R?R.toString:void 0;function D(e){var t=-1,n=e?e.length:0;for(this.clear();++t-1},C.prototype.set=function(e,t){var n=this.__data__,r=L(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},x.prototype.clear=function(){this.__data__={hash:new D,map:new(y||C),string:new D}},x.prototype.delete=function(e){return O(this,e).delete(e)},x.prototype.get=function(e){return O(this,e).get(e)},x.prototype.has=function(e){return O(this,e).has(e)},x.prototype.set=function(e,t){return O(this,e).set(e,t),this};var N=F(function(e){e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(k(e))return w?w.call(e):"";var t=e+"";return"0"==t&&1/e==-a?"-0":t}(t);var t,n=[];return s.test(e)&&n.push(""),e.replace(l,function(e,t,r,a){n.push(r?a.replace(c,"$1"):t||e)}),n});function F(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw TypeError("Expected a function");var n=function(){var r=arguments,a=t?t.apply(this,r):r[0],i=n.cache;if(i.has(a))return i.get(a);var o=e.apply(this,r);return n.cache=i.set(a,o),o};return n.cache=new(F.Cache||x),n}F.Cache=x;var V=Array.isArray;function U(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function k(e){return"symbol"==typeof e||!!e&&"object"==typeof e&&"[object Symbol]"==E.call(e)}e.exports=function(e,t,n){var r=null==e?void 0:function(e,t){var n;t=!function(e,t){if(V(e))return!1;var n=typeof e;return!!("number"==n||"symbol"==n||"boolean"==n||null==e||k(e))||o.test(e)||!i.test(e)||null!=t&&e in Object(t)}(t,e)?V(n=t)?n:N(n):[t];for(var r=0,s=t.length;null!=e&&r{"use strict";n.d(t,{A2:()=>i,BX:()=>I,LV:()=>g,p:()=>u});let r=Symbol("Comlink.proxy"),a=Symbol("Comlink.endpoint"),i=Symbol("Comlink.releaseProxy"),o=Symbol("Comlink.finalizer"),s=Symbol("Comlink.thrown"),l=e=>"object"==typeof e&&null!==e||"function"==typeof e,c=new Map([["proxy",{canHandle:e=>l(e)&&e[r],serialize(e){let{port1:t,port2:n}=new MessageChannel;return u(e,t),[n,[n]]},deserialize:e=>(e.start(),g(e))}],["throw",{canHandle:e=>l(e)&&s in e,serialize:({value:e})=>[e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[]],deserialize(e){if(e.isError)throw Object.assign(Error(e.value.message),e.value);throw e.value}}]]);function u(e,t=globalThis,n=["*"]){t.addEventListener("message",function r(a){let i;if(!a||!a.data)return;if(!function(e,t){for(let n of e)if(t===n||"*"===n||n instanceof RegExp&&n.test(t))return!0;return!1}(n,a.origin))return void console.warn(`Invalid origin '${a.origin}' for comlink proxy`);let{id:l,type:c,path:g}=Object.assign({path:[]},a.data),h=(a.data.argumentList||[]).map(E);try{let t=g.slice(0,-1).reduce((e,t)=>e[t],e),n=g.reduce((e,t)=>e[t],e);switch(c){case"GET":i=n;break;case"SET":t[g.slice(-1)[0]]=E(a.data.value),i=!0;break;case"APPLY":i=n.apply(t,h);break;case"CONSTRUCT":{let e=new n(...h);i=I(e)}break;case"ENDPOINT":{var m,p;let{port1:t,port2:n}=new MessageChannel;u(e,n),m=t,p=[t],A.set(m,p),i=m}break;case"RELEASE":i=void 0;break;default:return}}catch(e){i={value:e,[s]:0}}Promise.resolve(i).catch(e=>({value:e,[s]:0})).then(n=>{let[a,i]=S(n);t.postMessage(Object.assign(Object.assign({},a),{id:l}),i),"RELEASE"===c&&(t.removeEventListener("message",r),d(t),o in e&&"function"==typeof e[o]&&e[o]())}).catch(e=>{let[n,r]=S({value:TypeError("Unserializable return value"),[s]:0});t.postMessage(Object.assign(Object.assign({},n),{id:l}),r)})}),t.start&&t.start()}function d(e){"MessagePort"===e.constructor.name&&e.close()}function g(e,t){let n=new Map;return e.addEventListener("message",function(e){let{data:t}=e;if(!t||!t.id)return;let r=n.get(t.id);if(r)try{r(t)}finally{n.delete(t.id)}}),function e(t,n,r=[],o=function(){}){let s=!1,l=new Proxy(o,{get(a,o){if(h(s),o===i)return()=>{f&&f.unregister(l),m(t),n.clear(),s=!0};if("then"===o){if(0===r.length)return{then:()=>l};let e=_(t,n,{type:"GET",path:r.map(e=>e.toString())}).then(E);return e.then.bind(e)}return e(t,n,[...r,o])},set(e,a,i){h(s);let[o,l]=S(i);return _(t,n,{type:"SET",path:[...r,a].map(e=>e.toString()),value:o},l).then(E)},apply(i,o,l){h(s);let c=r[r.length-1];if(c===a)return _(t,n,{type:"ENDPOINT"}).then(E);if("bind"===c)return e(t,n,r.slice(0,-1));let[u,d]=v(l);return _(t,n,{type:"APPLY",path:r.map(e=>e.toString()),argumentList:u},d).then(E)},construct(e,a){h(s);let[i,o]=v(a);return _(t,n,{type:"CONSTRUCT",path:r.map(e=>e.toString()),argumentList:i},o).then(E)}}),c=(p.get(t)||0)+1;return p.set(t,c),f&&f.register(l,t,l),l}(e,n,[],t)}function h(e){if(e)throw Error("Proxy has been released and is not useable")}function m(e){return _(e,new Map,{type:"RELEASE"}).then(()=>{d(e)})}let p=new WeakMap,f="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{let t=(p.get(e)||0)-1;p.set(e,t),0===t&&m(e)});function v(e){var t;let n=e.map(S);return[n.map(e=>e[0]),(t=n.map(e=>e[1]),Array.prototype.concat.apply([],t))]}let A=new WeakMap;function I(e){return Object.assign(e,{[r]:!0})}function S(e){for(let[t,n]of c)if(n.canHandle(e)){let[r,a]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},a]}return[{type:"RAW",value:e},A.get(e)||[]]}function E(e){switch(e.type){case"HANDLER":return c.get(e.name).deserialize(e.value);case"RAW":return e.value}}function _(e,t,n,r){return new Promise(a=>{let i=[,,,,].fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");t.set(i,a),e.start&&e.start(),e.postMessage(Object.assign({id:i},n),r)})}},82006:(e,t,n)=>{"use strict";n.d(t,{Op:()=>c});let{ov:r}=n(70192).fX,a="voxels",i=[1,2,3,4],o=["4,3","4,7","4,-1"],s={0:"px",1:"percent",2:"dB",3:"cm",4:"seconds",5:"hertz",6:"dB/seconds",7:"cm/sec",8:"cm\xb2",9:"cm\xb2/s",12:"degrees",[-1]:"mV"},l=[r.ERMF,r.USER,r.ERROR,r.PROJECTION,r.CALIBRATED,r.UNKNOWN],c=(e,t)=>{let{calibration:n,hasPixelSpacing:c,spacing:u=[1,1,1]}=e,d=c?"mm":"px",g=c?"mm\xb3":a,h=d+"\xb2",m=n?.scale||1,p=m/(n?.columnPixelSpacing||u[0]),f=m/(n?.rowPixelSpacing||u[1]),v=m/u[2],A="";if(!n||!n.type&&!n.sequenceOfUltrasoundRegions)return{unit:d,areaUnit:h,scale:p,scaleY:f,scaleZ:v,volumeUnit:g};if(l.includes(n?.type)&&(A=n.type),n.type===r.UNCALIBRATED)return{unit:"px",areaUnit:"px\xb2",scale:p,scaleY:f,scaleZ:v,volumeUnit:a};if(n.sequenceOfUltrasoundRegions){let e=n.sequenceOfUltrasoundRegions.find(e=>t.every(t=>t[0]>=e.regionLocationMinX0&&t[0]<=e.regionLocationMaxX1&&t[1]>=e.regionLocationMinY0&&t[1]<=e.regionLocationMaxY1)&&(i.includes(e.regionDataType)||o.includes(`${e.physicalUnitsXDirection},${e.physicalUnitsYDirection}`)));if(e&&e.physicalUnitsXDirection===e.physicalUnitsYDirection){let t=Math.abs(e.physicalDeltaX),n=Math.abs(e.physicalDeltaY);p=1/t,f=1/n,A="US Region",h=(d=s[e.physicalUnitsXDirection]||"unknown")+"\xb2"}else if(e&&-1===e.physicalUnitsYDirection){let t=Math.abs(e.physicalDeltaX),n=Math.abs(e.physicalDeltaY);p=1/t,f=1/n,A="ECG Region",d=s[e.physicalUnitsXDirection]||s[e.physicalUnitsYDirection]||"unknown",h=(s[e.physicalUnitsYDirection]||"px")+"\xb2"}}else n.scale&&(p=n.scale);return{unit:d+(A?` ${A}`:""),areaUnit:h+(A?` ${A}`:""),volumeUnit:g+(A?` ${A}`:""),scale:p,scaleY:f,scaleZ:v}}},82332:(e,t,n)=>{"use strict";n.r(t),n.d(t,{aiLog:()=>u,coreLog:()=>s,cs3dLog:()=>i,dicomConsistencyLog:()=>g,examplesLog:()=>d,getLogger:()=>a,getRootLogger:()=>r,growCutLog:()=>m,imageConsistencyLog:()=>h,loaderLog:()=>c,toolsLog:()=>l,workerLog:()=>o});let{pp:r,tZ:a,gE:i,bM:o,uu:s,UA:l,_E:c,RZ:u,UX:d,HL:g,U5:h}=n(82280).m9,m=l.getLogger("growCut")},83603:(e,t,n)=>{"use strict";n(42067)},84305:(e,t,n)=>{"use strict";n.d(t,{P:()=>i});var r=n(10999),a=n(64777);function i(e,t,n=[]){if(!e?.length||!e[0])return[0,0];let a=function(e){let t=e.filter(Boolean),n=t[0];if(!n||t.length<2)return{left:n,right:n,top:n,bottom:n};let r=n,a=n,i=n,o=n;for(let e=1;ea[0]&&(a=n),n[1]o[1]&&(o=n)}return{left:r,top:i,bottom:o,right:a}}(e),l=(a.top[1]+a.bottom[1])/2,c=[a.right[0],l];if(!t)return c;let{width:u,height:d}=function(e){let t=e.reduce((e,t)=>Math.max(e,t?.length??0),0);return{width:8*t+50,height:17*Math.max(e.length,1)+50}}(n),g=t.clientWidth-4,h=t.clientHeight-4,m=a.right[0],p=l-d/2;m+u>g&&(m=a.left[0]-u),m=Math.max(4,Math.min(m,g-u)),p=Math.max(4,Math.min(p,h-d));let f=function(e){let t=e.querySelector(".viewport-element");return t?.querySelector(":scope > .svg-layer")||null}(t);if(f){let e=(0,r.Pd)(f);if(e.length>0){let t=function(e,t,n,r,a,i,l,c){if(!o(e,t,n,r,a))return[e,t];let u=t;for(let t=0;t<30;t++){let t=s(e,u,n,r,a);if(!t)break;if((u=t.y+t.height+6)+r>c){u=1/0;break}}if(u!==1/0&&!o(e,u,n,r,a))return[e,Math.max(4,Math.min(u,c-r))];u=t;for(let t=0;t<30;t++){let t=s(e,u,n,r,a);if(!t)break;if((u=t.y-r-6)(0,a.A)(o,l(e,3)))}function s(e,t,n,r,i){let o=l({x:e,y:t,width:n,height:r});return i.find(e=>(0,a.A)(o,l(e,3)))}function l(e,t=0){return{minX:e.x-t,minY:e.y-t,maxX:e.x+e.width+t,maxY:e.y+e.height+t}}},85250:(e,t,n)=>{"use strict";n.r(t),n.d(t,{add:()=>J,adjoint:()=>g,clone:()=>i,copy:()=>o,create:()=>a,determinant:()=>h,equals:()=>Q,exactEquals:()=>q,frob:()=>z,fromQuat:()=>P,fromQuat2:()=>w,fromRotation:()=>M,fromRotationTranslation:()=>R,fromRotationTranslationScale:()=>L,fromRotationTranslationScaleOrigin:()=>O,fromScaling:()=>_,fromTranslation:()=>E,fromValues:()=>s,fromXRotation:()=>b,fromYRotation:()=>y,fromZRotation:()=>T,frustum:()=>N,getRotation:()=>x,getScaling:()=>C,getTranslation:()=>D,identity:()=>c,invert:()=>d,lookAt:()=>W,mul:()=>Z,multiply:()=>m,multiplyScalar:()=>$,multiplyScalarAndAdd:()=>K,ortho:()=>G,orthoNO:()=>B,orthoZO:()=>H,perspective:()=>V,perspectiveFromFieldOfView:()=>k,perspectiveNO:()=>F,perspectiveZO:()=>U,rotate:()=>v,rotateX:()=>A,rotateY:()=>I,rotateZ:()=>S,scale:()=>f,set:()=>l,str:()=>j,sub:()=>ee,subtract:()=>Y,targetTo:()=>X,translate:()=>p,transpose:()=>u});var r=n(97633);function a(){var e=new r.tb(16);return r.tb!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function i(e){var t=new r.tb(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function o(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function s(e,t,n,a,i,o,s,l,c,u,d,g,h,m,p,f){var v=new r.tb(16);return v[0]=e,v[1]=t,v[2]=n,v[3]=a,v[4]=i,v[5]=o,v[6]=s,v[7]=l,v[8]=c,v[9]=u,v[10]=d,v[11]=g,v[12]=h,v[13]=m,v[14]=p,v[15]=f,v}function l(e,t,n,r,a,i,o,s,l,c,u,d,g,h,m,p,f){return e[0]=t,e[1]=n,e[2]=r,e[3]=a,e[4]=i,e[5]=o,e[6]=s,e[7]=l,e[8]=c,e[9]=u,e[10]=d,e[11]=g,e[12]=h,e[13]=m,e[14]=p,e[15]=f,e}function c(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function u(e,t){if(e===t){var n=t[1],r=t[2],a=t[3],i=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=a,e[13]=o,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function d(e,t){var n=t[0],r=t[1],a=t[2],i=t[3],o=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=t[9],g=t[10],h=t[11],m=t[12],p=t[13],f=t[14],v=t[15],A=n*s-r*o,I=n*l-a*o,S=n*c-i*o,E=r*l-a*s,_=r*c-i*s,M=a*c-i*l,b=u*p-d*m,y=u*f-g*m,T=u*v-h*m,R=d*f-g*p,w=d*v-h*p,D=g*v-h*f,C=A*D-I*w+S*R+E*T-_*y+M*b;return C?(C=1/C,e[0]=(s*D-l*w+c*R)*C,e[1]=(a*w-r*D-i*R)*C,e[2]=(p*M-f*_+v*E)*C,e[3]=(g*_-d*M-h*E)*C,e[4]=(l*T-o*D-c*y)*C,e[5]=(n*D-a*T+i*y)*C,e[6]=(f*S-m*M-v*I)*C,e[7]=(u*M-g*S+h*I)*C,e[8]=(o*w-s*T+c*b)*C,e[9]=(r*T-n*w-i*b)*C,e[10]=(m*_-p*S+v*A)*C,e[11]=(d*S-u*_-h*A)*C,e[12]=(s*y-o*R-l*b)*C,e[13]=(n*R-r*y+a*b)*C,e[14]=(p*I-m*E-f*A)*C,e[15]=(u*E-d*I+g*A)*C,e):null}function g(e,t){var n=t[0],r=t[1],a=t[2],i=t[3],o=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=t[9],g=t[10],h=t[11],m=t[12],p=t[13],f=t[14],v=t[15];return e[0]=s*(g*v-h*f)-d*(l*v-c*f)+p*(l*h-c*g),e[1]=-(r*(g*v-h*f)-d*(a*v-i*f)+p*(a*h-i*g)),e[2]=r*(l*v-c*f)-s*(a*v-i*f)+p*(a*c-i*l),e[3]=-(r*(l*h-c*g)-s*(a*h-i*g)+d*(a*c-i*l)),e[4]=-(o*(g*v-h*f)-u*(l*v-c*f)+m*(l*h-c*g)),e[5]=n*(g*v-h*f)-u*(a*v-i*f)+m*(a*h-i*g),e[6]=-(n*(l*v-c*f)-o*(a*v-i*f)+m*(a*c-i*l)),e[7]=n*(l*h-c*g)-o*(a*h-i*g)+u*(a*c-i*l),e[8]=o*(d*v-h*p)-u*(s*v-c*p)+m*(s*h-c*d),e[9]=-(n*(d*v-h*p)-u*(r*v-i*p)+m*(r*h-i*d)),e[10]=n*(s*v-c*p)-o*(r*v-i*p)+m*(r*c-i*s),e[11]=-(n*(s*h-c*d)-o*(r*h-i*d)+u*(r*c-i*s)),e[12]=-(o*(d*f-g*p)-u*(s*f-l*p)+m*(s*g-l*d)),e[13]=n*(d*f-g*p)-u*(r*f-a*p)+m*(r*g-a*d),e[14]=-(n*(s*f-l*p)-o*(r*f-a*p)+m*(r*l-a*s)),e[15]=n*(s*g-l*d)-o*(r*g-a*d)+u*(r*l-a*s),e}function h(e){var t=e[0],n=e[1],r=e[2],a=e[3],i=e[4],o=e[5],s=e[6],l=e[7],c=e[8],u=e[9],d=e[10],g=e[11],h=e[12],m=e[13],p=e[14],f=e[15];return(t*o-n*i)*(d*f-g*p)-(t*s-r*i)*(u*f-g*m)+(t*l-a*i)*(u*p-d*m)+(n*s-r*o)*(c*f-g*h)-(n*l-a*o)*(c*p-d*h)+(r*l-a*s)*(c*m-u*h)}function m(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],g=t[9],h=t[10],m=t[11],p=t[12],f=t[13],v=t[14],A=t[15],I=n[0],S=n[1],E=n[2],_=n[3];return e[0]=I*r+S*s+E*d+_*p,e[1]=I*a+S*l+E*g+_*f,e[2]=I*i+S*c+E*h+_*v,e[3]=I*o+S*u+E*m+_*A,I=n[4],S=n[5],E=n[6],_=n[7],e[4]=I*r+S*s+E*d+_*p,e[5]=I*a+S*l+E*g+_*f,e[6]=I*i+S*c+E*h+_*v,e[7]=I*o+S*u+E*m+_*A,I=n[8],S=n[9],E=n[10],_=n[11],e[8]=I*r+S*s+E*d+_*p,e[9]=I*a+S*l+E*g+_*f,e[10]=I*i+S*c+E*h+_*v,e[11]=I*o+S*u+E*m+_*A,I=n[12],S=n[13],E=n[14],_=n[15],e[12]=I*r+S*s+E*d+_*p,e[13]=I*a+S*l+E*g+_*f,e[14]=I*i+S*c+E*h+_*v,e[15]=I*o+S*u+E*m+_*A,e}function p(e,t,n){var r,a,i,o,s,l,c,u,d,g,h,m,p=n[0],f=n[1],v=n[2];return t===e?(e[12]=t[0]*p+t[4]*f+t[8]*v+t[12],e[13]=t[1]*p+t[5]*f+t[9]*v+t[13],e[14]=t[2]*p+t[6]*f+t[10]*v+t[14],e[15]=t[3]*p+t[7]*f+t[11]*v+t[15]):(r=t[0],a=t[1],i=t[2],o=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],g=t[9],h=t[10],m=t[11],e[0]=r,e[1]=a,e[2]=i,e[3]=o,e[4]=s,e[5]=l,e[6]=c,e[7]=u,e[8]=d,e[9]=g,e[10]=h,e[11]=m,e[12]=r*p+s*f+d*v+t[12],e[13]=a*p+l*f+g*v+t[13],e[14]=i*p+c*f+h*v+t[14],e[15]=o*p+u*f+m*v+t[15]),e}function f(e,t,n){var r=n[0],a=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*a,e[5]=t[5]*a,e[6]=t[6]*a,e[7]=t[7]*a,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function v(e,t,n,a){var i,o,s,l,c,u,d,g,h,m,p,f,v,A,I,S,E,_,M,b,y,T,R,w,D=a[0],C=a[1],x=a[2],L=Math.hypot(D,C,x);return L0?(n[0]=(l*s+d*a+c*o-u*i)*2/g,n[1]=(c*s+d*i+u*a-l*o)*2/g,n[2]=(u*s+d*o+l*i-c*a)*2/g):(n[0]=(l*s+d*a+c*o-u*i)*2,n[1]=(c*s+d*i+u*a-l*o)*2,n[2]=(u*s+d*o+l*i-c*a)*2),R(e,t,n),e}function D(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function C(e,t){var n=t[0],r=t[1],a=t[2],i=t[4],o=t[5],s=t[6],l=t[8],c=t[9],u=t[10];return e[0]=Math.hypot(n,r,a),e[1]=Math.hypot(i,o,s),e[2]=Math.hypot(l,c,u),e}function x(e,t){var n=new r.tb(3);C(n,t);var a=1/n[0],i=1/n[1],o=1/n[2],s=t[0]*a,l=t[1]*i,c=t[2]*o,u=t[4]*a,d=t[5]*i,g=t[6]*o,h=t[8]*a,m=t[9]*i,p=t[10]*o,f=s+d+p,v=0;return f>0?(v=2*Math.sqrt(f+1),e[3]=.25*v,e[0]=(g-m)/v,e[1]=(h-c)/v,e[2]=(l-u)/v):s>d&&s>p?(v=2*Math.sqrt(1+s-d-p),e[3]=(g-m)/v,e[0]=.25*v,e[1]=(l+u)/v,e[2]=(h+c)/v):d>p?(v=2*Math.sqrt(1+d-s-p),e[3]=(h-c)/v,e[0]=(l+u)/v,e[1]=.25*v,e[2]=(g+m)/v):(v=2*Math.sqrt(1+p-s-d),e[3]=(l-u)/v,e[0]=(h+c)/v,e[1]=(g+m)/v,e[2]=.25*v),e}function L(e,t,n,r){var a=t[0],i=t[1],o=t[2],s=t[3],l=a+a,c=i+i,u=o+o,d=a*l,g=a*c,h=a*u,m=i*c,p=i*u,f=o*u,v=s*l,A=s*c,I=s*u,S=r[0],E=r[1],_=r[2];return e[0]=(1-(m+f))*S,e[1]=(g+I)*S,e[2]=(h-A)*S,e[3]=0,e[4]=(g-I)*E,e[5]=(1-(d+f))*E,e[6]=(p+v)*E,e[7]=0,e[8]=(h+A)*_,e[9]=(p-v)*_,e[10]=(1-(d+m))*_,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function O(e,t,n,r,a){var i=t[0],o=t[1],s=t[2],l=t[3],c=i+i,u=o+o,d=s+s,g=i*c,h=i*u,m=i*d,p=o*u,f=o*d,v=s*d,A=l*c,I=l*u,S=l*d,E=r[0],_=r[1],M=r[2],b=a[0],y=a[1],T=a[2],R=(1-(p+v))*E,w=(h+S)*E,D=(m-I)*E,C=(h-S)*_,x=(1-(g+v))*_,L=(f+A)*_,O=(m+I)*M,P=(f-A)*M,N=(1-(g+p))*M;return e[0]=R,e[1]=w,e[2]=D,e[3]=0,e[4]=C,e[5]=x,e[6]=L,e[7]=0,e[8]=O,e[9]=P,e[10]=N,e[11]=0,e[12]=n[0]+b-(R*b+C*y+O*T),e[13]=n[1]+y-(w*b+x*y+P*T),e[14]=n[2]+T-(D*b+L*y+N*T),e[15]=1,e}function P(e,t){var n=t[0],r=t[1],a=t[2],i=t[3],o=n+n,s=r+r,l=a+a,c=n*o,u=r*o,d=r*s,g=a*o,h=a*s,m=a*l,p=i*o,f=i*s,v=i*l;return e[0]=1-d-m,e[1]=u+v,e[2]=g-f,e[3]=0,e[4]=u-v,e[5]=1-c-m,e[6]=h+p,e[7]=0,e[8]=g+f,e[9]=h-p,e[10]=1-c-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function N(e,t,n,r,a,i,o){var s=1/(n-t),l=1/(a-r),c=1/(i-o);return e[0]=2*i*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*i*l,e[6]=0,e[7]=0,e[8]=(n+t)*s,e[9]=(a+r)*l,e[10]=(o+i)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*c,e[15]=0,e}function F(e,t,n,r,a){var i,o=1/Math.tan(t/2);return e[0]=o/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=a&&a!==1/0?(i=1/(r-a),e[10]=(a+r)*i,e[14]=2*a*r*i):(e[10]=-1,e[14]=-2*r),e}var V=F;function U(e,t,n,r,a){var i,o=1/Math.tan(t/2);return e[0]=o/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=a&&a!==1/0?(i=1/(r-a),e[10]=a*i,e[14]=a*r*i):(e[10]=-1,e[14]=-r),e}function k(e,t,n,r){var a=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(o+s),c=2/(a+i);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=-((o-s)*l*.5),e[9]=(a-i)*c*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function B(e,t,n,r,a,i,o){var s=1/(t-n),l=1/(r-a),c=1/(i-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+n)*s,e[13]=(a+r)*l,e[14]=(o+i)*c,e[15]=1,e}var G=B;function H(e,t,n,r,a,i,o){var s=1/(t-n),l=1/(r-a),c=1/(i-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=c,e[11]=0,e[12]=(t+n)*s,e[13]=(a+r)*l,e[14]=i*c,e[15]=1,e}function W(e,t,n,a){var i,o,s,l,u,d,g,h,m,p,f=t[0],v=t[1],A=t[2],I=a[0],S=a[1],E=a[2],_=n[0],M=n[1],b=n[2];return Math.abs(f-_)0&&(u*=h=1/Math.sqrt(h),d*=h,g*=h);var m=l*g-c*d,p=c*u-s*g,f=s*d-l*u;return(h=m*m+p*p+f*f)>0&&(m*=h=1/Math.sqrt(h),p*=h,f*=h),e[0]=m,e[1]=p,e[2]=f,e[3]=0,e[4]=d*f-g*p,e[5]=g*m-u*f,e[6]=u*p-d*m,e[7]=0,e[8]=u,e[9]=d,e[10]=g,e[11]=0,e[12]=a,e[13]=i,e[14]=o,e[15]=1,e}function j(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function z(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function J(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function Y(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function $(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function K(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function q(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function Q(e,t){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],l=e[5],c=e[6],u=e[7],d=e[8],g=e[9],h=e[10],m=e[11],p=e[12],f=e[13],v=e[14],A=e[15],I=t[0],S=t[1],E=t[2],_=t[3],M=t[4],b=t[5],y=t[6],T=t[7],R=t[8],w=t[9],D=t[10],C=t[11],x=t[12],L=t[13],O=t[14],P=t[15];return Math.abs(n-I)<=r.p8*Math.max(1,Math.abs(n),Math.abs(I))&&Math.abs(a-S)<=r.p8*Math.max(1,Math.abs(a),Math.abs(S))&&Math.abs(i-E)<=r.p8*Math.max(1,Math.abs(i),Math.abs(E))&&Math.abs(o-_)<=r.p8*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(s-M)<=r.p8*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(l-b)<=r.p8*Math.max(1,Math.abs(l),Math.abs(b))&&Math.abs(c-y)<=r.p8*Math.max(1,Math.abs(c),Math.abs(y))&&Math.abs(u-T)<=r.p8*Math.max(1,Math.abs(u),Math.abs(T))&&Math.abs(d-R)<=r.p8*Math.max(1,Math.abs(d),Math.abs(R))&&Math.abs(g-w)<=r.p8*Math.max(1,Math.abs(g),Math.abs(w))&&Math.abs(h-D)<=r.p8*Math.max(1,Math.abs(h),Math.abs(D))&&Math.abs(m-C)<=r.p8*Math.max(1,Math.abs(m),Math.abs(C))&&Math.abs(p-x)<=r.p8*Math.max(1,Math.abs(p),Math.abs(x))&&Math.abs(f-L)<=r.p8*Math.max(1,Math.abs(f),Math.abs(L))&&Math.abs(v-O)<=r.p8*Math.max(1,Math.abs(v),Math.abs(O))&&Math.abs(A-P)<=r.p8*Math.max(1,Math.abs(A),Math.abs(P))}var Z=m,ee=Y},85839:(e,t,n)=>{"use strict";n.d(t,{EC:()=>a.A,F6:()=>i.Ay,oS:()=>r.A});var r=n(16410),a=n(53686);n(77680);var i=n(3721)},86216:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>p});var r=n(17042),a=n(11701),i=n(58804),o=n(10463),s=n(3570),l=n(88838),c=n(53695),{staticOffsetAPI:u,otherStaticMethods:d}=o.Ay,{SlicingMode:g}=s.A,h={slicingMode:g.NONE,closestIJKAxis:{ijkMode:g.NONE,flip:!1},renderToRectangle:!1,sliceAtFocalPoint:!1,preferSizeOverAccuracy:!1};function m(e,t,n={}){Object.assign(t,h,n),l.A.extend(e,t,n),r.Ay.get(e,t,["slicingMode"]),r.Ay.setGet(e,t,["closestIJKAxis","renderToRectangle","sliceAtFocalPoint","preferSizeOverAccuracy"]),o.Ay.implementCoincidentTopologyMethods(e,t);var s=t;function u(){let t;switch(s.slicingMode){case g.X:t=0;break;case g.Y:t=1;break;case g.Z:t=2;break;default:s.closestIJKAxis={ijkMode:s.slicingMode,flip:!1};return}let n=(0,a.xk)(e.getCurrentImage().getDirection()),r=0;for(;r<3&&0===n[t+3*r];++r);let i=n[t+3*r]<0;s.closestIJKAxis={ijkMode:r,flip:i}}s.classHierarchy.push("vtkImageMapper"),e.getSliceAtPosition=t=>{let n,r=e.getCurrentImage();if(3===t.length)n=t;else if(Number.isFinite(t)){let e=r.getBounds();switch(s.slicingMode){case g.X:n=[t,(e[3]+e[2])/2,(e[5]+e[4])/2];break;case g.Y:n=[(e[1]+e[0])/2,t,(e[5]+e[4])/2];break;case g.Z:n=[(e[1]+e[0])/2,(e[3]+e[2])/2,t]}}let i=[0,0,0];r.worldToIndex(n,i);let o=r.getExtent(),{ijkMode:l}=e.getClosestIJKAxis(),c=0;switch(l){case g.I:c=(0,a.L3)(i[0],o[0],o[1]);break;case g.J:c=(0,a.L3)(i[1],o[2],o[3]);break;case g.K:c=(0,a.L3)(i[2],o[4],o[5]);break;default:return 0}return c},e.setSliceFromCamera=t=>{let n=t.getFocalPoint();switch(s.slicingMode){case g.I:case g.J:case g.K:{let t=e.getSliceAtPosition(n);e.setSlice(t)}break;case g.X:e.setSlice(n[0]);break;case g.Y:e.setSlice(n[1]);break;case g.Z:e.setSlice(n[2])}},e.setXSlice=t=>{e.setSlicingMode(g.X),e.setSlice(t)},e.setYSlice=t=>{e.setSlicingMode(g.Y),e.setSlice(t)},e.setZSlice=t=>{e.setSlicingMode(g.Z),e.setSlice(t)},e.setISlice=t=>{e.setSlicingMode(g.I),e.setSlice(t)},e.setJSlice=t=>{e.setSlicingMode(g.J),e.setSlice(t)},e.setKSlice=t=>{e.setSlicingMode(g.K),e.setSlice(t)},e.getSlicingModeNormal=()=>{let t=[0,0,0],n=e.getCurrentImage().getDirection();switch(s.slicingMode){case g.X:t[0]=1;break;case g.Y:t[1]=1;break;case g.Z:t[2]=1;break;case g.I:(0,a.n_)(n,[1,0,0],t);break;case g.J:(0,a.n_)(n,[0,1,0],t);break;case g.K:(0,a.n_)(n,[0,0,1],t)}return t},e.setSlicingMode=t=>{s.slicingMode!==t&&(s.slicingMode=t,e.getCurrentImage()&&u(),e.modified())},e.getClosestIJKAxis=()=>((void 0===s.closestIJKAxis||s.closestIJKAxis.ijkMode===g.NONE)&&e.getCurrentImage()&&u(),s.closestIJKAxis),e.computeBounds=()=>{let t=e.getCurrentImage();if(!t)return void i.Ay.reset(s.bounds);if(!s.useCustomExtents)return void i.Ay.setBounds(s.bounds,t.getBounds());let n=s.customDisplayExtent.slice(),{ijkMode:r}=e.getClosestIJKAxis(),a=s.slice;switch(r!==s.slicingMode&&(a=e.getSliceAtPosition(s.slice)),r){case g.I:n[0]=a,n[1]=a;break;case g.J:n[2]=a,n[3]=a;break;case g.K:n[4]=a,n[5]=a}i.Ay.setBounds(s.bounds,t.extentToBounds(n))},e.getBoundsForSlice=(t=s.slice,n=0)=>{let r=e.getCurrentImage();if(!r)return(0,a.Z6)();let i=r.getSpatialExtent(),{ijkMode:o}=e.getClosestIJKAxis(),l=t;switch(o!==s.slicingMode&&(l=e.getSliceAtPosition(t)),o){case g.I:i[0]=l-n,i[1]=l+n;break;case g.J:i[2]=l-n,i[3]=l+n;break;case g.K:i[4]=l-n,i[5]=l+n}return r.extentToBounds(i)},e.intersectWithLineForPointPicking=(t,n)=>(0,c.I)(t,n,e),e.intersectWithLineForCellPicking=(t,n)=>(0,c.Y)(t,n,e),e.getCurrentImage=()=>e.getInputData()}var p={newInstance:r.Ay.newInstance(m,"vtkImageMapper"),extend:m,...u,...d,...s.A}},86779:(e,t,n)=>{"use strict";n.d(t,{getLockedSegmentIndices:()=>a});var r=n(43385);function a(e){let t=(0,r.T)(e);if(!t)throw Error(`No segmentation state found for ${e}`);let{segments:n}=t;return Object.keys(n).filter(e=>n[e].locked).map(e=>parseInt(e))}n(59998),n(49007),n(16835)},87086:(e,t,n)=>{"use strict";var r=n(78378),a=n(82243);n(23278),n(68764),r.dt.Highlighted,r.r$.Active,a.A},87195:(e,t,n)=>{"use strict";n.d(t,{zj:()=>a}),n(70192),n(31895);let r={};function a(){return r}},87944:(e,t,n)=>{"use strict";n.d(t,{Np:()=>u});var r=n(70192),a=n(78378),i=n(49007),o=n(87635),s=n(43385),l=n(4055);let c=new Map;function u(e,t,n){let u=(0,l.I)(n)?.getUpdateFunction(e);u&&function(e,t,n){c.has(e)||c.set(e,new Map);let l=c.get(e);l.has(t)&&function(e,t){let n=c.get(e);if(!n)return;let i=n.get(t);i&&(r.tX.removeEventListener(a.sV.SEGMENTATION_DATA_MODIFIED,i),n.delete(t))}(e,t);let u=function(e,t,n){let r=(0,o.A)(r=>{let a=r.detail?.segmentationId,o=(0,s.T)(a);a===e&&o?.representationData?.[t]&&(n(e),(0,i.triggerSegmentationModified)(e))},300);return e=>{r(e)}}(e,t,n);r.tX.addEventListener(a.sV.SEGMENTATION_DATA_MODIFIED,u),l.set(t,u)}(t,n,u)}},88819:(e,t,n)=>{"use strict";n.d(t,{A:()=>b});var r=n(70192),a=n(85839);n(90174);var i=n(41067),o=n(86779),s=n(43385),l=n(5469),c=n(19921),u=n(46702),d=n(78378),g=n(6001),h=n(93022),m=n(12487),p=n(42067),f=n(49007),v=n(61034),A=n(91792),I=n(66442),S=n(41918),E=n(60212),_=n(4101);class M extends a.oS{constructor(e,t){super(e,t),this.memoMap=new Map,this.acceptedMemoIds=new Map,this.centerSegmentIndexInfo={segmentIndex:null,hasSegmentIndex:!1,hasPreviewIndex:!1,changedIndices:[]}}_cancelTouchDraw(e){if(!this.isDrawing)return;let t=this.editData?.viewportIdsToRender;this._deactivateDraw(e),(0,_.Q_)(e),this.editData=null,this.isDrawing=!1,t&&(0,E.A)(t)}_historyRedoHandler(e){let{id:t,operationType:n}=e.detail;if("labelmap"===n){if(this.acceptedMemoIds.has(t)){this._hoverData=null;let e=this.acceptedMemoIds.get(t),n=e?.element,a=this.getOperationData(n);if(!a)return;a.segmentIndex=e?.segmentIndex,n&&this.applyActiveStrategyCallback((0,r.kJ)(n),a,d.Yh.AcceptPreview)}this._previewData.isDrag=!0}}get _previewData(){return M.previewData}hasPreviewData(){return!!this._previewData.preview}shouldResolvePreviewRequests(){return("Active"===this.mode||"Enabled"===this.mode)&&this.hasPreviewData()}createMemo(e,t){let n=t.id;if(this.memo&&this.memo.segmentationVoxelManager===t)return this.memo;let r=this.memoMap.get(n);return r?r.redoVoxelManager&&(r=g.hH(e,t),this.memoMap.set(n,r)):(r=g.hH(e,t),this.memoMap.set(n,r)),this.memo=r,r}createEditData(e){let{viewport:t}=(0,r.kJ)(e),n=(0,i.T)(t.id);if(!n)return null;let{segmentationId:a}=n,l=(0,o.getLockedSegmentIndices)(a),{representationData:c}=(0,s.T)(a);return this.getEditData({viewport:t,representationData:c,segmentsLocked:l,segmentationId:a})}getEditData({viewport:e,representationData:t,segmentsLocked:n,segmentationId:a}){let i=(0,A.A)(e),o=(0,u.Q)(a),c=(0,s.T)(a),d=o?(0,I.Nf)(c,o):void 0;if("volume"===i||e instanceof r.ei){let t=d?(0,I.kL)(d):void 0,a=d?.volumeId??t?.volumeId;if(!t||!a)return;let i=e.getActors().filter(e=>e.referencedId).map(e=>r.PP.getVolume(e.referencedId)).filter(e=>!!e),o=i.find(e=>r.BF.isEqual(e.dimensions,t.dimensions))?.volumeId||i[0]?.volumeId;return{volumeId:a,referencedVolumeId:this.configuration.threshold?.volumeId??d?.referencedVolumeId??t.referencedVolumeId??o,segmentsLocked:n}}if("image"===i){let t=(0,l.vl)(e.id,a);if(!t)return;return{imageId:t,segmentsLocked:n}}let g=new CustomEvent(r.fX.sV.ERROR_EVENT,{detail:{type:"Segmentation",message:"Cannot perform brush operation on the selected viewport"},cancelable:!0});return r.tX.dispatchEvent(g),null}createHoverData(e,t){let{viewport:n}=(0,r.kJ)(e),{viewPlaneNormal:a,viewUp:i}=(0,S.A)(n);if(!a||!i)return;let o=[n.id],s=this.getActiveSegmentationData(n);if(!s)return;let{segmentIndex:l,segmentationId:c,segmentColor:u}=s;return{brushCursor:{metadata:{viewPlaneNormal:[...a],viewUp:[...i],FrameOfReferenceUID:n.getFrameOfReferenceUID(),referencedImageId:"",toolName:this.getToolName(),segmentColor:u},data:{}},centerCanvas:t,segmentIndex:l,viewport:n,segmentationId:c,segmentColor:u,viewportIdsToRender:o}}getActiveSegmentationData(e){let t=e.id,n=(0,i.T)(t);if(!n)return;let{segmentationId:r}=n,a=(0,u.Q)(r);if(!a)return;let o=(0,c.getSegmentIndexColor)(t,r,a);return{segmentIndex:a,segmentationId:r,segmentColor:o}}getOperationData(e){let t=this._editData||this.createEditData(e),n=this._hoverData||this.createHoverData(e);if(!t||!n)return;let{segmentIndex:a,segmentationId:i,brushCursor:o}=n,{data:s,metadata:l={}}=o||{},{viewPlaneNormal:u,viewUp:d}=l,g=s?.editPoints||s?.handles?.points,h=this.configuration.preview?.previewColors?.[a],{viewport:m}=(0,r.kJ)(e)||{};if(!m||!a||!i)return;let p=(0,c.getSegmentIndexColor)(m.id,i,a);if(!h&&!p)return;let f=null,v=null;return this.configuration.preview?.enabled&&(f=h||function(e,t,n,r,a=.4){return[Math.round(e+(255-e)*a),Math.round(t+(255-t)*a),Math.round(n+(255-n)*a),r]}(...p),v=255),{...t,points:g,segmentIndex:a,viewPlaneNormal:u,previewOnHover:!this._previewData.isDrag,toolGroupId:this.toolGroupId,segmentationId:i,viewUp:d,centerSegmentIndexInfo:this.centerSegmentIndexInfo,activeStrategy:this.configuration.activeStrategy,configuration:this.configuration,previewColor:f,previewSegmentIndex:v,createMemo:this.createMemo.bind(this),hoverData:this._hoverData}}addPreview(e=this._previewData.element,t){let{_previewData:n}=this,a=t?.acceptReject;!0===a?this.acceptPreview(e):!1===a&&this.rejectPreview(e);let i=(0,r.kJ)(e),o=this.getOperationData(e);if(!i||!o)return;let s=this.applyActiveStrategyCallback(i,o,d.Yh.AddPreview);return n.isDrag=!0,s?.modified&&(n.preview=s,n.element=e),s}rejectPreview(e=this._previewData.element){if(!e)return;this.doneEditMemo();let t=(0,r.kJ)(e),n=this.getOperationData(e);t&&n&&(this.applyActiveStrategyCallback(t,n,d.Yh.RejectPreview),this._previewData.preview=null,this._previewData.isDrag=!1)}acceptPreview(e=this._previewData.element){if(!e)return;let t=this.getOperationData(e);if(!t)return;this.memo&&this.memo.id&&this.acceptedMemoIds.set(this.memo.id,{element:e,segmentIndex:t.segmentIndex});let n=(0,r.kJ)(e);this.applyActiveStrategyCallback(n,t,d.Yh.AcceptPreview),this.doneEditMemo(),this._previewData.preview=null,this._previewData.isDrag=!1}static viewportContoursToLabelmap(e,t){let n=t?.removeContours??!0,r=(0,h.getAllAnnotations)(),a=(0,m.k9)(e,r);if(!a?.length)return;let i=a.filter(e=>e.data.contour?.polyline?.length);if(!i.length)return;let{memo:o,segmentationId:s}=new M({},{configuration:{strategies:{FILL_INSIDE_CIRCLE:v.fillInsideCircle},activeStrategy:"FILL_INSIDE_CIRCLE"}}).addPreview(e.element),l=o?.voxelManager,c=l.sourceVoxelManager||l,{dimensions:d}=l,g=e.getDefaultActor().actor.getMapper().getInputData();for(let e of i){let t=[[1/0,-1/0],[1/0,-1/0],[1/0,-1/0]],{polyline:r}=e.data.contour;for(let e of r)g.worldToIndex(e).forEach((e,n)=>{t[n][0]=Math.min(t[n][0],e),t[n][1]=Math.max(t[n][1],e)});t.forEach((e,t)=>{e[0]=Math.round(Math.max(0,e[0])),e[1]=Math.round(Math.min(d[t]-1,e[1]))});let a=(0,u.Q)(s),i=e.data.handles?.[0]||r[0],o=g.worldToIndex(i).map(Math.round),m=c.getAtIJKPoint(o)||0,f=!1,v=!1;for(let e of r){let t=g.worldToIndex(e).map(Math.round),n=c.getAtIJKPoint(t);n===m?f=!0:n>=0&&(v=!0)}let A=f&&v?m:0===m?a:0;for(let e=t[0][0];e<=t[0][1];e++)for(let n=t[1][0];n<=t[1][1];n++)for(let a=t[2][0];a<=t[2][1];a++){let t=g.indexToWorld([e,n,a]);(0,p.isPointInsidePolyline3D)(t,r)&&l.setAtIJK(e,n,a,A)}n&&(0,h.removeAnnotation)(e.annotationUID)}let A=l.getArrayOfModifiedSlices();(0,f.triggerSegmentationDataModified)(s,A)}}M.previewData={preview:null,element:null,timerStart:0,timer:null,startPoint:[NaN,NaN],isDrag:!1};let b=M},89819:(e,t,n)=>{"use strict";n.d(t,{On:()=>i,pW:()=>a}),n(70192);var r=n(50923);function a(e,t,n){let a=n.toIJK(e),i=n.toIJK(t),o=r.vt(),{testIJK:s}=n,l=r.jb(r.vt(),a,i),c=Math.round(Math.max(...l.map(Math.abs)));if(c<2)return!0;let u=r.hs(r.vt(),l,1/c);for(let e=1;e{let c=r.WQ(r.vt(),e,l).map(e=>e/2),[u,d,g]=t.worldToIndex(c).map(Math.round),h=n.getAtIndex(u+d*o+g*s);return h===a||i?.has(h)},toIJK:e=>t.worldToIndex(e),testIJK:e=>{let[t,r,l]=e,c=Math.round(t)+Math.round(r)*o+Math.round(l)*s,u=n.getAtIndex(c);return u===a||i?.has(u)}}}},91006:(e,t,n)=>{"use strict";n(32207)},91336:(e,t,n)=>{"use strict";n.d(t,{Bw:()=>h,Io:()=>d,Ln:()=>u,Om:()=>p,Re:()=>c,S8:()=>m,WQ:()=>l,fA:()=>o,hG:()=>g,hZ:()=>s,jb:()=>f,o8:()=>i,vt:()=>a,xg:()=>v});var r=n(97633);function a(){var e=new r.tb(2);return r.tb!=Float32Array&&(e[0]=0,e[1]=0),e}function i(e){var t=new r.tb(2);return t[0]=e[0],t[1]=e[1],t}function o(e,t){var n=new r.tb(2);return n[0]=e,n[1]=t,n}function s(e,t,n){return e[0]=t,e[1]=n,e}function l(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}function c(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function u(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e}function d(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1])}function g(e,t){var n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r}function h(e){return Math.hypot(e[0],e[1])}function m(e,t){var n=t[0],r=t[1],a=n*n+r*r;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e}function p(e,t){return e[0]*t[0]+e[1]*t[1]}var f=c,v=d;a()},93022:(e,t,n)=>{"use strict";let r;n.r(t),n.d(t,{addAnnotation:()=>p,addChildAnnotation:()=>g,clearParentAnnotation:()=>d,getAllAnnotations:()=>u,getAnnotation:()=>c,getAnnotationManager:()=>o,getAnnotations:()=>l,getChildAnnotations:()=>m,getNumberOfAnnotations:()=>f,getParentAnnotation:()=>h,invalidateAnnotation:()=>I,removeAllAnnotations:()=>v,removeAnnotation:()=>function e(t){if(!t)return;let n=r,a=n.getAnnotation(t);a&&(a.childAnnotationUIDs?.forEach(t=>e(t)),n.removeAnnotation(t),(0,i.triggerAnnotationRemoved)({annotation:a,annotationManagerUID:n.uid}))},removeAnnotations:()=>A,setAnnotationManager:()=>s});var a=n(70192),i=n(34699);function o(){return r}function s(e){r=e}function l(e,t){let n=r,a=n.getGroupKey(t);return n.getAnnotations(a,e)}function c(e){return r.getAnnotation(e)}function u(){return r.getAllAnnotations()}function d(e){let{annotationUID:t,parentAnnotationUID:n}=e;if(!n)return;let r=c(n),a=r.childAnnotationUIDs.indexOf(t);r.childAnnotationUIDs.splice(a,1),e.parentAnnotationUID=void 0}function g(e,t){let{annotationUID:n}=e,{annotationUID:r}=t;d(t),e.childAnnotationUIDs||(e.childAnnotationUIDs=[]),e.childAnnotationUIDs.includes(r)||(e.childAnnotationUIDs.push(r),t.parentAnnotationUID=n)}function h(e){return e.parentAnnotationUID?c(e.parentAnnotationUID):void 0}function m(e){return e.childAnnotationUIDs?.map(e=>c(e))??[]}function p(e,t){e.annotationUID||(e.annotationUID=a.BF.uuidv4());let n=r;if(t instanceof HTMLDivElement&&(0,a.kJ)(t)){let r=n.getGroupKey(t);n.addAnnotation(e,r),(0,i.triggerAnnotationAddedForElement)(e,t)}else n.addAnnotation(e,void 0),(0,i.triggerAnnotationAddedForFOR)(e);return e.annotationUID}function f(e,t){let n=r,a=n.getGroupKey(t);return n.getNumberOfAnnotations(a,e)}function v(){let e=r;for(let t of e.removeAllAnnotations())(0,i.triggerAnnotationRemoved)({annotation:t,annotationManagerUID:e.uid})}function A(e,t){let n=r,a=n.getGroupKey(t);for(let t of n.removeAnnotations(a,e))(0,i.triggerAnnotationRemoved)({annotation:t,annotationManagerUID:n.uid})}function I(e){let t=e;for(;t;)t.invalidated=!0,t=t.parentAnnotationUID?c(t.parentAnnotationUID):void 0}},93084:(e,t,n)=>{"use strict";n.d(t,{QO:()=>c,yc:()=>l});var r=n(70192);n(65509);let a="labelmapImageMapper";function i(e){return e.type===r.fX.NV.PLANAR_NEXT&&function(e){let t=o(e);if(t){let n=e.getDisplaySetRenderMode?.(t);if(n)return n}return e.getDefaultActor?.()?.actorMapper?.renderMode}(e)===r.T7.VTK_VOLUME_SLICE}function o(e){let t=e.getSourceDataId?.();if(t)return t;let n=e._debug?.renderModes;if(n)return Object.entries(n).find(([t,n])=>e.getDisplaySetRole?.(t)==="source"&&n===r.T7.VTK_VOLUME_SLICE)?.[0]??Object.entries(n).find(([,e])=>e===r.T7.VTK_VOLUME_SLICE)?.[0]}function s(e){if(!e.getDisplaySetPresentation)return;let t=o(e);return t?e.getDisplaySetPresentation(t):void 0}function l(e){if(e?.useSliceRendering)return!0;if("undefined"==typeof window)return!1;let t=new URLSearchParams(window.location.search);if(!t.has(a))return!1;let n=t.get(a);if(null===n||""===n)return!0;let r=n.trim().toLowerCase();return"0"!==r&&"false"!==r&&"off"!==r}function c(e){let t=e instanceof r.PX,n=i(e);if(!t&&!n)return!1;let a=function(e){if(e instanceof r.PX)return e.getBlendMode?.();if(!i(e))return;let t=s(e)?.blendMode;return void 0!==t?t:r.fX.gd.AVERAGE_INTENSITY_BLEND}(e);if(t&&a!==r.fX.gd.COMPOSITE&&a!==r.fX.gd.AVERAGE_INTENSITY_BLEND||function(e){if(e instanceof r.PX)return e.getSlabThickness?.()??.1;if(!i(e))return .1;let t=(function(e){let t=e.getDefaultActor?.();return t?.actorMapper?.mapper??t?.actorMapper?.actor?.getMapper?.()})(e)?.getSlabThickness?.();return"number"==typeof t?t:s(e)?.slabThickness??.1}(e)>.101)return!1;if(t)try{e.getSliceViewInfo()}catch{return!1}return!0}},93287:(e,t,n)=>{"use strict";n(90174),n(51200),n(70192),n(32207),n(87944),n(4055)},94070:(e,t,n)=>{"use strict";var r,a;n.d(t,{i:()=>r,q:()=>a}),function(e){e[e.Primary=1]="Primary",e[e.Secondary=2]="Secondary",e[e.Primary_And_Secondary=3]="Primary_And_Secondary",e[e.Auxiliary=4]="Auxiliary",e[e.Primary_And_Auxiliary=5]="Primary_And_Auxiliary",e[e.Secondary_And_Auxiliary=6]="Secondary_And_Auxiliary",e[e.Primary_And_Secondary_And_Auxiliary=7]="Primary_And_Secondary_And_Auxiliary",e[e.Fourth_Button=8]="Fourth_Button",e[e.Fifth_Button=16]="Fifth_Button",e[e.Wheel=524288]="Wheel",e[e.Wheel_Primary=524289]="Wheel_Primary"}(r||(r={})),function(e){e[e.Shift=16]="Shift",e[e.Ctrl=17]="Ctrl",e[e.Alt=18]="Alt",e[e.Meta=91]="Meta",e[e.ShiftCtrl=1617]="ShiftCtrl",e[e.ShiftAlt=1618]="ShiftAlt",e[e.ShiftMeta=1691]="ShiftMeta",e[e.CtrlAlt=1718]="CtrlAlt",e[e.CtrlMeta=1791]="CtrlMeta",e[e.AltMeta=1891]="AltMeta"}(a||(a={}))},94194:(e,t,n)=>{"use strict";function r(e,t=!1){let n=e.getPoints(),a=e.getLines(),i=Array(n.getNumberOfPoints()).fill(0).map((e,t)=>n.getPoint(t).slice()),o=Array(a.getNumberOfCells()).fill(0).map((e,t)=>{let n=a.getCell(3*t).slice();return{a:n[0],b:n[1]}});if(t)return{points:i,lines:o};let s=[];for(let[e,t]of i.entries()){let n=s.findIndex(e=>e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]);if(n>=0)o.map(t=>(t.a===e&&(t.a=n),t.b===e&&(t.b=n),t));else{let n=s.length;s.push(t),o.map(t=>(t.a===e&&(t.a=n),t.b===e&&(t.b=n),t))}}return{points:s,lines:o.filter(e=>e.a!==e.b)}}n.d(t,{v:()=>r})},95324:(e,t,n)=>{"use strict";n(43385),n(32207)},95704:(e,t,n)=>{"use strict";var r,a;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(a=n.g.process)?void 0:a.env)?n.g.process:n(53965)},97132:(e,t,n)=>{"use strict";n.d(t,{wV:()=>i});var r=n(70192),a=n(78378);function i(e,t,n){return function(e,t,n){let a=(0,r.yj)(e);if(!a)return;let{renderingEngine:i,viewport:o}=a;if(!i||!o)return;let s=o.getActors().filter(n);return s.length>0?s[0]:void 0}(e,0,e=>e.representationUID?.startsWith(`${t}-${a.D_.Labelmap}`)&&(!n||e.referencedId===n))}},97442:(e,t,n)=>{"use strict";n.d(t,{O8:()=>r.removeAnnotation,Rh:()=>r.getAnnotations,lC:()=>r.addAnnotation}),n(36427),n(59998),n(12577);var r=n(93022);n(60721)},98723:(e,t,n)=>{"use strict";n.d(t,{V0:()=>a.V,rK:()=>i.rK,M:()=>r.M}),n(70192),n(97442);var r=n(76818),a=n(36965);n(34699),n(5801),n(51740),n(51718),n(34355),n(6088);var i=n(63306);n(44120),n(2997),n(96310),n(68566)}}]); \ No newline at end of file diff --git a/_next/static/chunks/987.0c5b0a0d50e19d04.js b/_next/static/chunks/987.0c5b0a0d50e19d04.js new file mode 100644 index 0000000000000000000000000000000000000000..a02b0d9193fe0b6ac42b0cb7272950f8487d7c57 --- /dev/null +++ b/_next/static/chunks/987.0c5b0a0d50e19d04.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[987],{4371:(t,e,i)=>{var n=i(15376).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.NIFTI2=void 0;let s=i(6958),r=i(42541);class a{littleEndian=!1;dim_info=0;dims=[];intent_p1=0;intent_p2=0;intent_p3=0;intent_code=0;datatypeCode=0;numBitsPerVoxel=0;slice_start=0;slice_end=0;slice_code=0;pixDims=[];vox_offset=0;scl_slope=1;scl_inter=0;xyzt_units=0;cal_max=0;cal_min=0;slice_duration=0;toffset=0;description="";aux_file="";intent_name="";qform_code=0;sform_code=0;quatern_b=0;quatern_c=0;quatern_d=0;qoffset_x=0;qoffset_y=0;qoffset_z=0;affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];magic="0";extensionFlag=[0,0,0,0];extensions=[];extensionSize=0;extensionCode=0;static MAGIC_COOKIE=540;static MAGIC_NUMBER_LOCATION=4;static MAGIC_NUMBER=[110,43,50,0,13,10,26,10];static MAGIC_NUMBER2=[110,105,50,0,13,10,26,10];readHeader(t){var e,i,n,s,o=new DataView(t),l=r.Utils.getIntAt(o,0,this.littleEndian);if(l!==a.MAGIC_COOKIE&&(this.littleEndian=!0,l=r.Utils.getIntAt(o,0,this.littleEndian)),l!==a.MAGIC_COOKIE)throw Error("This does not appear to be a NIFTI file!");for(e=0,this.magic=r.Utils.getStringAt(o,4,12),this.datatypeCode=r.Utils.getShortAt(o,12,this.littleEndian),this.numBitsPerVoxel=r.Utils.getShortAt(o,14,this.littleEndian);e<8;e+=1)s=16+8*e,this.dims[e]=r.Utils.getInt64At(o,s,this.littleEndian);for(e=0,this.intent_p1=r.Utils.getDoubleAt(o,80,this.littleEndian),this.intent_p2=r.Utils.getDoubleAt(o,88,this.littleEndian),this.intent_p3=r.Utils.getDoubleAt(o,96,this.littleEndian);e<8;e+=1)s=104+8*e,this.pixDims[e]=r.Utils.getDoubleAt(o,s,this.littleEndian);for(i=0,this.vox_offset=r.Utils.getInt64At(o,168,this.littleEndian),this.scl_slope=r.Utils.getDoubleAt(o,176,this.littleEndian),this.scl_inter=r.Utils.getDoubleAt(o,184,this.littleEndian),this.cal_max=r.Utils.getDoubleAt(o,192,this.littleEndian),this.cal_min=r.Utils.getDoubleAt(o,200,this.littleEndian),this.slice_duration=r.Utils.getDoubleAt(o,208,this.littleEndian),this.toffset=r.Utils.getDoubleAt(o,216,this.littleEndian),this.slice_start=r.Utils.getInt64At(o,224,this.littleEndian),this.slice_end=r.Utils.getInt64At(o,232,this.littleEndian),this.description=r.Utils.getStringAt(o,240,320),this.aux_file=r.Utils.getStringAt(o,320,344),this.qform_code=r.Utils.getIntAt(o,344,this.littleEndian),this.sform_code=r.Utils.getIntAt(o,348,this.littleEndian),this.quatern_b=r.Utils.getDoubleAt(o,352,this.littleEndian),this.quatern_c=r.Utils.getDoubleAt(o,360,this.littleEndian),this.quatern_d=r.Utils.getDoubleAt(o,368,this.littleEndian),this.qoffset_x=r.Utils.getDoubleAt(o,376,this.littleEndian),this.qoffset_y=r.Utils.getDoubleAt(o,384,this.littleEndian),this.qoffset_z=r.Utils.getDoubleAt(o,392,this.littleEndian);i<3;i+=1)for(n=0;n<4;n+=1)s=400+(4*i+n)*8,this.affine[i][n]=r.Utils.getDoubleAt(o,s,this.littleEndian);this.affine[3][0]=0,this.affine[3][1]=0,this.affine[3][2]=0,this.affine[3][3]=1,this.slice_code=r.Utils.getIntAt(o,496,this.littleEndian),this.xyzt_units=r.Utils.getIntAt(o,500,this.littleEndian),this.intent_code=r.Utils.getIntAt(o,504,this.littleEndian),this.intent_name=r.Utils.getStringAt(o,508,524),this.dim_info=r.Utils.getByteAt(o,524),o.byteLength>a.MAGIC_COOKIE&&(this.extensionFlag[0]=r.Utils.getByteAt(o,540),this.extensionFlag[1]=r.Utils.getByteAt(o,541),this.extensionFlag[2]=r.Utils.getByteAt(o,542),this.extensionFlag[3]=r.Utils.getByteAt(o,543),this.extensionFlag[0]&&(this.extensions=r.Utils.getExtensionsAt(o,this.getExtensionLocation(),this.littleEndian,this.vox_offset),this.extensionSize=this.extensions[0].esize,this.extensionCode=this.extensions[0].ecode))}toFormattedString(){var t=r.Utils.formatNumber,e="";return e+("Datatype = "+ +this.datatypeCode+" ("+this.getDatatypeCodeString(this.datatypeCode)+")\n"+("Bits Per Voxel = = "+this.numBitsPerVoxel)+"\n"+("Image Dimensions (1-8): "+this.dims[0]+", "+this.dims[1]+", "+this.dims[2]+", "+this.dims[3]+", "+this.dims[4]+", "+this.dims[5]+", "+this.dims[6]+", "+this.dims[7])+"\n"+("Intent Parameters (1-3): "+this.intent_p1+", "+this.intent_p2+", "+this.intent_p3)+"\n"+("Voxel Dimensions (1-8): "+t(this.pixDims[0])+", "+t(this.pixDims[1])+", "+t(this.pixDims[2])+", "+t(this.pixDims[3])+", "+t(this.pixDims[4])+", "+t(this.pixDims[5])+", "+t(this.pixDims[6])+", "+t(this.pixDims[7]))+"\n"+("Image Offset = "+this.vox_offset)+"\n"+("Data Scale: Slope = "+t(this.scl_slope)+" Intercept = "+t(this.scl_inter))+"\n"+("Display Range: Max = "+t(this.cal_max)+" Min = "+t(this.cal_min))+"\n"+("Slice Duration = "+this.slice_duration)+"\n"+("Time Axis Shift = "+this.toffset)+"\n"+("Slice Start = "+this.slice_start)+"\n"+("Slice End = "+this.slice_end)+"\n"+('Description: "'+this.description)+'"\n'+('Auxiliary File: "'+this.aux_file)+'"\n'+("Q-Form Code = "+this.qform_code+" ("+this.getTransformCodeString(this.qform_code))+")\n"+("S-Form Code = "+this.sform_code+" ("+this.getTransformCodeString(this.sform_code))+")\n"+("Quaternion Parameters: b = "+t(this.quatern_b)+" c = "+t(this.quatern_c)+" d = "+t(this.quatern_d))+"\n"+("Quaternion Offsets: x = "+this.qoffset_x+" y = "+this.qoffset_y+" z = "+this.qoffset_z)+"\n"+("S-Form Parameters X: "+t(this.affine[0][0])+", "+t(this.affine[0][1])+", "+t(this.affine[0][2])+", "+t(this.affine[0][3]))+"\n"+("S-Form Parameters Y: "+t(this.affine[1][0])+", "+t(this.affine[1][1])+", "+t(this.affine[1][2])+", "+t(this.affine[1][3]))+"\n"+("S-Form Parameters Z: "+t(this.affine[2][0])+", "+t(this.affine[2][1])+", "+t(this.affine[2][2])+", "+t(this.affine[2][3]))+"\n"+("Slice Code = "+this.slice_code)+"\n"+("Units Code = "+this.xyzt_units+" ("+this.getUnitsCodeString(s.NIFTI1.SPATIAL_UNITS_MASK&this.xyzt_units)+", "+this.getUnitsCodeString(s.NIFTI1.TEMPORAL_UNITS_MASK&this.xyzt_units))+")\n"+("Intent Code = "+this.intent_code)+"\n"+('Intent Name: "'+this.intent_name)+'"\n'+("Dim Info = "+this.dim_info)+"\n")}getExtensionLocation=function(){return a.MAGIC_COOKIE+4};getExtensionSize=s.NIFTI1.prototype.getExtensionSize;getExtensionCode=s.NIFTI1.prototype.getExtensionCode;addExtension=s.NIFTI1.prototype.addExtension;removeExtension=s.NIFTI1.prototype.removeExtension;getDatatypeCodeString=s.NIFTI1.prototype.getDatatypeCodeString;getTransformCodeString=s.NIFTI1.prototype.getTransformCodeString;getUnitsCodeString=s.NIFTI1.prototype.getUnitsCodeString;getQformMat=s.NIFTI1.prototype.getQformMat;convertNiftiQFormToNiftiSForm=s.NIFTI1.prototype.convertNiftiQFormToNiftiSForm;convertNiftiSFormToNEMA=s.NIFTI1.prototype.convertNiftiSFormToNEMA;nifti_mat33_mul=s.NIFTI1.prototype.nifti_mat33_mul;nifti_mat33_determ=s.NIFTI1.prototype.nifti_mat33_determ;toArrayBuffer(t=!1){let e=544;if(t)for(let t of this.extensions)e+=t.esize;let i=new Uint8Array(e),s=new DataView(i.buffer);s.setInt32(0,540,this.littleEndian),i.set(n.from(this.magic),4),s.setInt16(12,this.datatypeCode,this.littleEndian),s.setInt16(14,this.numBitsPerVoxel,this.littleEndian);for(let t=0;t<8;t++)s.setBigInt64(16+8*t,BigInt(this.dims[t]),this.littleEndian);s.setFloat64(80,this.intent_p1,this.littleEndian),s.setFloat64(88,this.intent_p2,this.littleEndian),s.setFloat64(96,this.intent_p3,this.littleEndian);for(let t=0;t<8;t++)s.setFloat64(104+8*t,this.pixDims[t],this.littleEndian);s.setBigInt64(168,BigInt(this.vox_offset),this.littleEndian),s.setFloat64(176,this.scl_slope,this.littleEndian),s.setFloat64(184,this.scl_inter,this.littleEndian),s.setFloat64(192,this.cal_max,this.littleEndian),s.setFloat64(200,this.cal_min,this.littleEndian),s.setFloat64(208,this.slice_duration,this.littleEndian),s.setFloat64(216,this.toffset,this.littleEndian),s.setBigInt64(224,BigInt(this.slice_start),this.littleEndian),s.setBigInt64(232,BigInt(this.slice_end),this.littleEndian),i.set(n.from(this.description),240),i.set(n.from(this.aux_file),320),s.setInt32(344,this.qform_code,this.littleEndian),s.setInt32(348,this.sform_code,this.littleEndian),s.setFloat64(352,this.quatern_b,this.littleEndian),s.setFloat64(360,this.quatern_c,this.littleEndian),s.setFloat64(368,this.quatern_d,this.littleEndian),s.setFloat64(376,this.qoffset_x,this.littleEndian),s.setFloat64(384,this.qoffset_y,this.littleEndian),s.setFloat64(392,this.qoffset_z,this.littleEndian);let r=this.affine.flat();for(let t=0;t<12;t++)s.setFloat64(400+8*t,r[t],this.littleEndian);if(s.setInt32(496,this.slice_code,this.littleEndian),s.setInt32(500,this.xyzt_units,this.littleEndian),s.setInt32(504,this.intent_code,this.littleEndian),i.set(n.from(this.intent_name),508),s.setUint8(524,this.dim_info),t){i.set(Uint8Array.from([1,0,0,0]),540);let t=this.getExtensionLocation();for(let e of this.extensions)s.setInt32(t,e.esize,e.littleEndian),s.setInt32(t+4,e.ecode,e.littleEndian),i.set(new Uint8Array(e.edata),t+8),t+=e.esize}else i.set(new Uint8Array(4).fill(0),540);return i.buffer}}e.NIFTI2=a},6958:(t,e,i)=>{var n=i(15376).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.NIFTI1=void 0;let s=i(42541);class r{littleEndian=!1;dim_info=0;dims=[];intent_p1=0;intent_p2=0;intent_p3=0;intent_code=0;datatypeCode=0;numBitsPerVoxel=0;slice_start=0;slice_end=0;slice_code=0;pixDims=[];vox_offset=0;scl_slope=1;scl_inter=0;xyzt_units=0;cal_max=0;cal_min=0;slice_duration=0;toffset=0;description="";aux_file="";intent_name="";qform_code=0;sform_code=0;quatern_a=0;quatern_b=0;quatern_c=0;quatern_d=0;qoffset_x=0;qoffset_y=0;qoffset_z=0;affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];qfac=1;quatern_R;magic="0";isHDR=!1;extensionFlag=[0,0,0,0];extensionSize=0;extensionCode=0;extensions=[];static TYPE_NONE=0;static TYPE_BINARY=1;static TYPE_UINT8=2;static TYPE_INT16=4;static TYPE_INT32=8;static TYPE_FLOAT32=16;static TYPE_COMPLEX64=32;static TYPE_FLOAT64=64;static TYPE_RGB24=128;static TYPE_INT8=256;static TYPE_UINT16=512;static TYPE_UINT32=768;static TYPE_INT64=1024;static TYPE_UINT64=1280;static TYPE_FLOAT128=1536;static TYPE_COMPLEX128=1792;static TYPE_COMPLEX256=2048;static XFORM_UNKNOWN=0;static XFORM_SCANNER_ANAT=1;static XFORM_ALIGNED_ANAT=2;static XFORM_TALAIRACH=3;static XFORM_MNI_152=4;static SPATIAL_UNITS_MASK=7;static TEMPORAL_UNITS_MASK=56;static UNITS_UNKNOWN=0;static UNITS_METER=1;static UNITS_MM=2;static UNITS_MICRON=3;static UNITS_SEC=8;static UNITS_MSEC=16;static UNITS_USEC=24;static UNITS_HZ=32;static UNITS_PPM=40;static UNITS_RADS=48;static MAGIC_COOKIE=348;static STANDARD_HEADER_SIZE=348;static MAGIC_NUMBER_LOCATION=344;static MAGIC_NUMBER=[110,43,49];static MAGIC_NUMBER2=[110,105,49];static EXTENSION_HEADER_SIZE=8;readHeader(t){var e,i,n,a,o=new DataView(t),l=s.Utils.getIntAt(o,0,this.littleEndian);if(l!==r.MAGIC_COOKIE&&(this.littleEndian=!0,l=s.Utils.getIntAt(o,0,this.littleEndian)),l!==r.MAGIC_COOKIE)throw Error("This does not appear to be a NIFTI file!");for(e=0,this.dim_info=s.Utils.getByteAt(o,39);e<8;e+=1)a=40+2*e,this.dims[e]=s.Utils.getShortAt(o,a,this.littleEndian);for(e=0,this.intent_p1=s.Utils.getFloatAt(o,56,this.littleEndian),this.intent_p2=s.Utils.getFloatAt(o,60,this.littleEndian),this.intent_p3=s.Utils.getFloatAt(o,64,this.littleEndian),this.intent_code=s.Utils.getShortAt(o,68,this.littleEndian),this.datatypeCode=s.Utils.getShortAt(o,70,this.littleEndian),this.numBitsPerVoxel=s.Utils.getShortAt(o,72,this.littleEndian),this.slice_start=s.Utils.getShortAt(o,74,this.littleEndian);e<8;e+=1)a=76+4*e,this.pixDims[e]=s.Utils.getFloatAt(o,a,this.littleEndian);if(this.vox_offset=s.Utils.getFloatAt(o,108,this.littleEndian),this.scl_slope=s.Utils.getFloatAt(o,112,this.littleEndian),this.scl_inter=s.Utils.getFloatAt(o,116,this.littleEndian),this.slice_end=s.Utils.getShortAt(o,120,this.littleEndian),this.slice_code=s.Utils.getByteAt(o,122),this.xyzt_units=s.Utils.getByteAt(o,123),this.cal_max=s.Utils.getFloatAt(o,124,this.littleEndian),this.cal_min=s.Utils.getFloatAt(o,128,this.littleEndian),this.slice_duration=s.Utils.getFloatAt(o,132,this.littleEndian),this.toffset=s.Utils.getFloatAt(o,136,this.littleEndian),this.description=s.Utils.getStringAt(o,148,228),this.aux_file=s.Utils.getStringAt(o,228,252),this.qform_code=s.Utils.getShortAt(o,252,this.littleEndian),this.sform_code=s.Utils.getShortAt(o,254,this.littleEndian),this.quatern_b=s.Utils.getFloatAt(o,256,this.littleEndian),this.quatern_c=s.Utils.getFloatAt(o,260,this.littleEndian),this.quatern_d=s.Utils.getFloatAt(o,264,this.littleEndian),this.quatern_a=Math.sqrt(1-(Math.pow(this.quatern_b,2)+Math.pow(this.quatern_c,2)+Math.pow(this.quatern_d,2))),this.qoffset_x=s.Utils.getFloatAt(o,268,this.littleEndian),this.qoffset_y=s.Utils.getFloatAt(o,272,this.littleEndian),this.qoffset_z=s.Utils.getFloatAt(o,276,this.littleEndian),this.qform_code<1&&this.sform_code<1&&(this.affine[0][0]=this.pixDims[1],this.affine[1][1]=this.pixDims[2],this.affine[2][2]=this.pixDims[3]),this.qform_code>0&&this.sform_code0)for(i=0;i<3;i+=1)for(n=0;n<4;n+=1)a=280+(4*i+n)*4,this.affine[i][n]=s.Utils.getFloatAt(o,a,this.littleEndian);if(this.affine[3][0]=0,this.affine[3][1]=0,this.affine[3][2]=0,this.affine[3][3]=1,this.intent_name=s.Utils.getStringAt(o,328,344),this.magic=s.Utils.getStringAt(o,344,348),this.isHDR=this.magic===String.fromCharCode.apply(null,r.MAGIC_NUMBER2),o.byteLength>r.MAGIC_COOKIE){this.extensionFlag[0]=s.Utils.getByteAt(o,348),this.extensionFlag[1]=s.Utils.getByteAt(o,349),this.extensionFlag[2]=s.Utils.getByteAt(o,350),this.extensionFlag[3]=s.Utils.getByteAt(o,351);let t=!0;!this.isHDR&&this.vox_offset<=352&&(t=!1),o.byteLength<=368&&(t=!1),t&&this.extensionFlag[0]&&(this.extensions=s.Utils.getExtensionsAt(o,this.getExtensionLocation(),this.littleEndian,this.vox_offset),this.extensionSize=this.extensions[0].esize,this.extensionCode=this.extensions[0].ecode)}}toFormattedString(){var t=s.Utils.formatNumber,e="";return e+="Dim Info = "+this.dim_info+"\n"+("Image Dimensions (1-8): "+this.dims[0]+", "+this.dims[1]+", "+this.dims[2]+", "+this.dims[3]+", "+this.dims[4]+", "+this.dims[5]+", "+this.dims[6]+", "+this.dims[7])+"\n"+("Intent Parameters (1-3): "+this.intent_p1+", "+this.intent_p2+", "+this.intent_p3)+"\n"+("Intent Code = "+this.intent_code)+"\n"+("Datatype = "+this.datatypeCode+" ("+this.getDatatypeCodeString(this.datatypeCode))+")\n"+("Bits Per Voxel = "+this.numBitsPerVoxel)+"\n"+("Slice Start = "+this.slice_start)+"\n"+("Voxel Dimensions (1-8): "+t(this.pixDims[0])+", "+t(this.pixDims[1])+", "+t(this.pixDims[2])+", "+t(this.pixDims[3])+", "+t(this.pixDims[4])+", "+t(this.pixDims[5])+", "+t(this.pixDims[6])+", "+t(this.pixDims[7]))+"\n"+("Image Offset = "+this.vox_offset)+"\n"+("Data Scale: Slope = "+t(this.scl_slope)+" Intercept = "+t(this.scl_inter))+"\n"+("Slice End = "+this.slice_end)+"\n"+("Slice Code = "+this.slice_code)+"\n"+("Units Code = "+this.xyzt_units+" ("+this.getUnitsCodeString(r.SPATIAL_UNITS_MASK&this.xyzt_units)+", "+this.getUnitsCodeString(r.TEMPORAL_UNITS_MASK&this.xyzt_units))+")\n"+("Display Range: Max = "+t(this.cal_max)+" Min = "+t(this.cal_min))+"\n"+("Slice Duration = "+this.slice_duration)+"\n"+("Time Axis Shift = "+this.toffset)+"\n"+('Description: "'+this.description)+'"\n'+('Auxiliary File: "'+this.aux_file)+'"\n'+("Q-Form Code = "+this.qform_code+" ("+this.getTransformCodeString(this.qform_code))+")\n"+("S-Form Code = "+this.sform_code+" ("+this.getTransformCodeString(this.sform_code))+")\n"+("Quaternion Parameters: b = "+t(this.quatern_b)+" c = "+t(this.quatern_c)+" d = "+t(this.quatern_d))+"\n"+("Quaternion Offsets: x = "+this.qoffset_x+" y = "+this.qoffset_y+" z = "+this.qoffset_z)+"\n"+("S-Form Parameters X: "+t(this.affine[0][0])+", "+t(this.affine[0][1])+", "+t(this.affine[0][2])+", "+t(this.affine[0][3]))+"\n"+("S-Form Parameters Y: "+t(this.affine[1][0])+", "+t(this.affine[1][1])+", "+t(this.affine[1][2])+", "+t(this.affine[1][3]))+"\n"+("S-Form Parameters Z: "+t(this.affine[2][0])+", "+t(this.affine[2][1])+", "+t(this.affine[2][2])+", "+t(this.affine[2][3]))+"\n"+('Intent Name: "'+this.intent_name)+'"\n',this.extensionFlag[0]&&(e+="Extension: Size = "+this.extensionSize+" Code = "+this.extensionCode+"\n"),e}getDatatypeCodeString=function(t){if(t===r.TYPE_UINT8)return"1-Byte Unsigned Integer";if(t===r.TYPE_INT16)return"2-Byte Signed Integer";if(t===r.TYPE_INT32)return"4-Byte Signed Integer";if(t===r.TYPE_FLOAT32)return"4-Byte Float";if(t===r.TYPE_FLOAT64)return"8-Byte Float";else if(t===r.TYPE_RGB24)return"RGB";else if(t===r.TYPE_INT8)return"1-Byte Signed Integer";else if(t===r.TYPE_UINT16)return"2-Byte Unsigned Integer";else if(t===r.TYPE_UINT32)return"4-Byte Unsigned Integer";else if(t===r.TYPE_INT64)return"8-Byte Signed Integer";else if(t===r.TYPE_UINT64)return"8-Byte Unsigned Integer";else return"Unknown"};getTransformCodeString=function(t){return t===r.XFORM_SCANNER_ANAT?"Scanner":t===r.XFORM_ALIGNED_ANAT?"Aligned":t===r.XFORM_TALAIRACH?"Talairach":t===r.XFORM_MNI_152?"MNI":"Unknown"};getUnitsCodeString=function(t){if(t===r.UNITS_METER)return"Meters";if(t===r.UNITS_MM)return"Millimeters";if(t===r.UNITS_MICRON)return"Microns";if(t===r.UNITS_SEC)return"Seconds";if(t===r.UNITS_MSEC)return"Milliseconds";else if(t===r.UNITS_USEC)return"Microseconds";else if(t===r.UNITS_HZ)return"Hz";else if(t===r.UNITS_PPM)return"PPM";else if(t===r.UNITS_RADS)return"Rads";else return"Unknown"};getQformMat(){return this.convertNiftiQFormToNiftiSForm(this.quatern_b,this.quatern_c,this.quatern_d,this.qoffset_x,this.qoffset_y,this.qoffset_z,this.pixDims[1],this.pixDims[2],this.pixDims[3],this.pixDims[0])}convertNiftiQFormToNiftiSForm(t,e,i,n,s,r,a,o,l,h){var f,u,c,d,p=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],g=t,_=e,m=i;return p[3][0]=p[3][1]=p[3][2]=0,p[3][3]=1,(f=1-(g*g+_*_+m*m))<1e-7?(f=1/Math.sqrt(g*g+_*_+m*m),g*=f,_*=f,m*=f,f=0):f=Math.sqrt(f),u=a>0?a:1,c=o>0?o:1,d=l>0?l:1,h<0&&(d=-d),p[0][0]=(f*f+g*g-_*_-m*m)*u,p[0][1]=2*(g*_-f*m)*c,p[0][2]=2*(g*m+f*_)*d,p[1][0]=2*(g*_+f*m)*u,p[1][1]=(f*f+_*_-g*g-m*m)*c,p[1][2]=2*(_*m-f*g)*d,p[2][0]=2*(g*m-f*_)*u,p[2][1]=2*(_*m+f*g)*c,p[2][2]=(f*f+m*m-_*_-g*g)*d,p[0][3]=n,p[1][3]=s,p[2][3]=r,p}convertNiftiSFormToNEMA(t){var e,i,n,s,r,a,o,l,h,f,u,c,d,p,g,_,m,I,v,E,y,A,T,x,b,U,N,F,S,M,w,C,O;if(p=0,U=[[0,0,0],[0,0,0],[0,0,0]],N=[[0,0,0],[0,0,0],[0,0,0]],e=t[0][0],i=t[0][1],n=t[0][2],s=t[1][0],r=t[1][1],a=t[1][2],o=t[2][0],l=t[2][1],h=t[2][2],0===(f=Math.sqrt(e*e+s*s+o*o))||(e/=f,s/=f,o/=f,0===(f=Math.sqrt(i*i+r*r+l*l))))return null;if(i/=f,r/=f,l/=f,Math.abs(f=e*i+s*r+o*l)>1e-4){if(i-=f*e,r-=f*s,l-=f*o,0===(f=Math.sqrt(i*i+r*r+l*l)))return null;i/=f,r/=f,l/=f}if(0===(f=Math.sqrt(n*n+a*a+h*h))?(n=s*l-o*r,a=o*i-l*e,h=e*r-s*i):(n/=f,a/=f,h/=f),Math.abs(f=e*n+s*a+o*h)>1e-4){if(n-=f*e,a-=f*s,h-=f*o,0===(f=Math.sqrt(n*n+a*a+h*h)))return null;n/=f,a/=f,h/=f}if(Math.abs(f=i*n+r*a+l*h)>1e-4){if(n-=f*i,a-=f*r,h-=f*l,0===(f=Math.sqrt(n*n+a*a+h*h)))return null;n/=f,a/=f,h/=f}if(U[0][0]=e,U[0][1]=i,U[0][2]=n,U[1][0]=s,U[1][1]=r,U[1][2]=a,U[2][0]=o,U[2][1]=l,U[2][2]=h,0===(u=this.nifti_mat33_determ(U)))return null;for(c=1,b=-666,I=y=A=T=1,v=2,E=3;c<=3;c+=1)for(d=1;d<=3;d+=1)if(c!==d){for(p=1;p<=3;p+=1)if(c!==p&&d!==p)for(g=-1,N[0][0]=N[0][1]=N[0][2]=N[1][0]=N[1][1]=N[1][2]=N[2][0]=N[2][1]=N[2][2]=0;g<=1;g+=2)for(_=-1;_<=1;_+=2)for(m=-1;m<=1;m+=2)N[0][c-1]=g,N[1][d-1]=_,N[2][p-1]=m,this.nifti_mat33_determ(N)*u>0&&(f=(x=this.nifti_mat33_mul(N,U))[0][0]+x[1][1]+x[2][2])>b&&(b=f,I=c,v=d,E=p,y=g,A=_,T=m)}switch(F=S=M=w=C=O="",I*y){case 1:F="X",w="+";break;case -1:F="X",w="-";break;case 2:F="Y",w="+";break;case -2:F="Y",w="-";break;case 3:F="Z",w="+";break;case -3:F="Z",w="-"}switch(v*A){case 1:S="X",C="+";break;case -1:S="X",C="-";break;case 2:S="Y",C="+";break;case -2:S="Y",C="-";break;case 3:S="Z",C="+";break;case -3:S="Z",C="-"}switch(E*T){case 1:M="X",O="+";break;case -1:M="X",O="-";break;case 2:M="Y",O="+";break;case -2:M="Y",O="-";break;case 3:M="Z",O="+";break;case -3:M="Z",O="-"}return F+S+M+w+C+O}nifti_mat33_mul=function(t,e){var i,n,s=[[0,0,0],[0,0,0],[0,0,0]];for(i=0;i<3;i+=1)for(n=0;n<3;n+=1)s[i][n]=t[i][0]*e[0][n]+t[i][1]*e[1][n]+t[i][2]*e[2][n];return s};nifti_mat33_determ=function(t){var e,i,n,s,r,a,o,l,h;return e=t[0][0],i=t[0][1],n=t[0][2],s=t[1][0],r=t[1][1],a=t[1][2],o=t[2][0],l=t[2][1],e*r*(h=t[2][2])-e*l*a-s*i*h+s*l*n+o*i*a-o*r*n};getExtensionLocation(){return r.MAGIC_COOKIE+4}getExtensionSize(t){return s.Utils.getIntAt(t,this.getExtensionLocation(),this.littleEndian)}getExtensionCode(t){return s.Utils.getIntAt(t,this.getExtensionLocation()+4,this.littleEndian)}addExtension(t,e=-1){-1==e?this.extensions.push(t):this.extensions.splice(e,0,t),this.vox_offset+=t.esize}removeExtension(t){let e=this.extensions[t];e&&(this.vox_offset-=e.esize),this.extensions.splice(t,1)}toArrayBuffer(t=!1){let e=352;if(t)for(let t of this.extensions)e+=t.esize;let i=new Uint8Array(e),s=new DataView(i.buffer);s.setInt32(0,348,this.littleEndian),s.setUint8(39,this.dim_info);for(let t=0;t<8;t++)s.setUint16(40+2*t,this.dims[t],this.littleEndian);s.setFloat32(56,this.intent_p1,this.littleEndian),s.setFloat32(60,this.intent_p2,this.littleEndian),s.setFloat32(64,this.intent_p3,this.littleEndian),s.setInt16(68,this.intent_code,this.littleEndian),s.setInt16(70,this.datatypeCode,this.littleEndian),s.setInt16(72,this.numBitsPerVoxel,this.littleEndian),s.setInt16(74,this.slice_start,this.littleEndian);for(let t=0;t<8;t++)s.setFloat32(76+4*t,this.pixDims[t],this.littleEndian);s.setFloat32(108,this.vox_offset,this.littleEndian),s.setFloat32(112,this.scl_slope,this.littleEndian),s.setFloat32(116,this.scl_inter,this.littleEndian),s.setInt16(120,this.slice_end,this.littleEndian),s.setUint8(122,this.slice_code),s.setUint8(123,this.xyzt_units),s.setFloat32(124,this.cal_max,this.littleEndian),s.setFloat32(128,this.cal_min,this.littleEndian),s.setFloat32(132,this.slice_duration,this.littleEndian),s.setFloat32(136,this.toffset,this.littleEndian),i.set(n.from(this.description),148),i.set(n.from(this.aux_file),228),s.setInt16(252,this.qform_code,this.littleEndian),s.setInt16(254,this.sform_code,this.littleEndian),s.setFloat32(256,this.quatern_b,this.littleEndian),s.setFloat32(260,this.quatern_c,this.littleEndian),s.setFloat32(264,this.quatern_d,this.littleEndian),s.setFloat32(268,this.qoffset_x,this.littleEndian),s.setFloat32(272,this.qoffset_y,this.littleEndian),s.setFloat32(276,this.qoffset_z,this.littleEndian);let r=this.affine.flat();for(let t=0;t<12;t++)s.setFloat32(280+4*t,r[t],this.littleEndian);if(i.set(n.from(this.intent_name),328),i.set(n.from(this.magic),344),t){i.set(Uint8Array.from([1,0,0,0]),348);let t=this.getExtensionLocation();for(let e of this.extensions)s.setInt32(t,e.esize,e.littleEndian),s.setInt32(t+4,e.ecode,e.littleEndian),i.set(new Uint8Array(e.edata),t+8),t+=e.esize}else i.set(new Uint8Array(4).fill(0),348);return i.buffer}}e.NIFTI1=r},33862:(t,e)=>{var i={};e.default=function(t,e,n,s,r){var a=new Worker(i[e]||(i[e]=URL.createObjectURL(new Blob([t+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return a.onmessage=function(t){var e=t.data,i=e.$e$;if(i){var n=Error(i[0]);n.code=i[1],n.stack=i[2],r(n,null)}else r(null,e)},a.postMessage(n,s),a}},42541:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Utils=void 0;let n=i(66035);class s{static crcTable=null;static GUNZIP_MAGIC_COOKIE1=31;static GUNZIP_MAGIC_COOKIE2=139;static getStringAt(t,e,i){var n,s,r="";for(n=e;nr&&(e=!e,(l=s.getIntAt(t,o,e))+o>r))throw Error("This does not appear to be a valid NIFTI extension");if(l%16!=0)throw Error("This does not appear to be a NIFTI extension");let h=s.getIntAt(t,o+4,e),f=t.buffer.slice(o+8,o+l);console.log("extensionByteIndex: "+(o+8)+" esize: "+l),console.log(f);let u=new n.NIFTIEXTENSION(l,h,f,e);a.push(u),o+=l}return a}static toArrayBuffer(t){var e,i,n;for(n=0,i=new Uint8Array(e=new ArrayBuffer(t.length));n>>1:t>>>1;e[i]=t}return e}static crc32(t){s.crcTable||(s.crcTable=s.makeCRCTable());let e=s.crcTable,i=-1;for(var n=0;n>>8^e[(i^t.getUint8(n))&255];return(-1^i)>>>0}}e.Utils=s},54987:(t,e,i)=>{i.d(e,{nL:()=>d,AZ:()=>E,Ts:()=>y});var n,s=i(70192),r=i(65387);!function(t){t.NIFTI_VOLUME_LOADED="CORNERSTONE_NIFTI_VOLUME_LOADED",t.NIFTI_VOLUME_PROGRESS="CORNERSTONE_NIFTI_VOLUME_PROGRESS"}(n||(n={}));let a=n;var o=i(50923);let{windowLevel:l}=s.BF;function h(t,e){let i=t/8*e;if(!s.PP.isCacheable(i))throw Error(s.fX.sV.CACHE_SIZE_EXCEEDED);return s.PP.decacheIfNecessaryUntilBytesAvailable(i),i}function f(t,e){let i,n=e.length;switch(t){case"Float32Array":h(32,n),i=new Float32Array(n);break;case"Int16Array":h(16,n),i=new Int16Array(n);break;case"Int8Array":h(8,n),i=new Int16Array(n);break;case"Uint16Array":h(16,n),i=new Uint16Array(n);break;case"Uint8Array":h(8,n),i=new Uint8Array(n);break;case"Float64Array":h(64,n),i=new Float64Array(n);break;default:throw Error(`TypedArray ${t} is not yet supported`)}return i.set(e),i}let u={beforeSend(){}},c=new Map;function d(t){let[e,i]=t.substring(6).split("?frame="),n=parseInt(i,10),r=s.wx.get(s.fX.nb.IMAGE_PIXEL,t),a=s.wx.get(s.fX.nb.IMAGE_PLANE,t);return{promise:new Promise((i,s)=>{var o,l,h,f,u;c.get(e)?(o=t,l=e,h=n,f=r,u=a,new Promise((t,e)=>{let i=setInterval(()=>{let n=c.get(l);n||(clearInterval(i),e(`dataFetchState for ${l} is not found. The cache was purged before it completed loading.`)),n?.status==="fetched"&&(clearInterval(i),t(g(o,h,f,u,n.scalarData)))},10)})).then(i).catch(s):(c.set(e,{status:"fetching"}),p(t,e,n,r,a).then(i).catch(s))}),cancelFn:void 0,decache:()=>{c.delete(e)}}}async function p(t,e,i,n,o){let l=await function({url:t,signal:e,onload:i}){return new Promise(async(n,r)=>{let o=new XMLHttpRequest;o.open("GET",t,!0);let l={},h=u,f=await h.beforeSend(o,l,t),c=Object.assign({},l,f);o.responseType="arraybuffer",Object.keys(c).forEach(function(t){null!==c[t]&&o.setRequestHeader(t,c[t])});let d=function(t){i&&"function"==typeof i&&i(),e&&e.removeEventListener("abort",p),n(o.response)},p=()=>{o.abort(),o.removeEventListener("load",d),r(Error("Request aborted"))};o.addEventListener("load",d),o.onprogress=function(e){var i,n;i=e.loaded,n=e.total,(0,s.Hl)(s.tX,a.NIFTI_VOLUME_PROGRESS,{data:{url:t,loaded:i,total:n}})},e&&e.aborted?(o.abort(),r(Error("Request aborted"))):e&&e.addEventListener("abort",p),o.send()})}({url:e}),h=null,d=null;if(r.isCompressed(l)&&(l=r.decompress(l)),r.isNIFTI(l))h=r.readHeader(l),d=r.readImage(h,l);else{let t="The provided buffer is not a valid NIFTI file.";throw console.warn(t),Error(t)}let{scalarData:p}=function(t,e){let i,n,{datatypeCode:s,scl_slope:r,scl_inter:a}=t,o=r,l=a;(!r||0===r||Number.isNaN(r))&&(o=1),(!a||Number.isNaN(a))&&(l=0);let h=l<0||o<0,u=l%1!=0||o%1!=0,c=1;switch(s){case 2:i=new Uint8Array(e),u?n=f("Float32Array",i):h?n=f("Int16Array",i):(c=0,n=f("Uint8Array",i));break;case 4:i=new Int16Array(e),n=u?f("Float32Array",i):f("Int16Array",i);break;case 8:n=f("Float32Array",i=new Int32Array(e));break;case 16:n=f("Float32Array",i=new Float32Array(e));break;case 256:i=new Int8Array(e),n=u?f("Float32Array",i):f("Int8Array",i);break;case 512:i=new Uint16Array(e),u||h?n=f("Float32Array",i):(c=0,n=f("Uint16Array",i));break;case 768:n=f("Float32Array",i=new Uint32Array(e));break;case 64:n=f("Float64Array",i=new Float64Array(e));break;default:throw Error(`NIFTI datatypeCode ${s} is not yet supported`)}let d=n.length;if(1!==o&&0!==l)for(let t=0;td&&(d=e)}return{imageId:t,dataType:r.constructor.name,columnPixelSpacing:n.columnPixelSpacing,columns:n.columns,height:n.rows,invert:"MONOCHROME1"===i.photometricInterpretation,rowPixelSpacing:n.rowPixelSpacing,rows:n.rows,sizeInBytes:a*o*r.BYTES_PER_ELEMENT,width:n.columns,getPixelData:()=>u.getScalarData(),getCanvas:void 0,numberOfComponents:void 0,voxelManager:u,minPixelValue:c,maxPixelValue:d}}let _=new Map;async function m({url:t,onProgress:e,controller:i,onLoad:n,onHeader:s,loadFullVolume:a=!1}){let l,h=new URL(t).pathname.endsWith(".gz"),f=new Uint8Array(0),c=null,d=i.signal,p=u,g={},_=await p.beforeSend?.(null,g,t),m=Object.assign({},g,_);Object.keys(m).forEach(function(t){null===m[t]&&(m[t]=void 0)});try{let e=await fetch(t,{signal:d,headers:m});if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);l=e.headers.get("Content-Length");let s=e.body.getReader(),r=h?new DecompressionStream("gzip"):null,o=r?r.writable.getWriter():null;if(I(s,o,h,0,v,i).catch(console.error),h){let t=r.readable.getReader();for(;;){let{done:e,value:n}=await t.read();if(e)break;if(v(n),c&&!a){i.abort();break}}}return n&&"function"==typeof n&&n(),{data:f,headerInfo:c,sliceInfo:null}}catch(t){throw"AbortError"===t.name?console.log("Fetch aborted"):console.error("Fetch error:",t),t}function v(t){(function(t){let e=new Uint8Array(f.length+t.length);e.set(f),e.set(t,f.length),f=e,a||c||!(f.length>=540)||((c=function(t){if(t.length<540)return{isValid:!1,message:"Not enough data to check header"};try{let e=t.slice(0,540).buffer,i=r.readHeader(e),n=540===i.sizeof_hdr?2:1,{orientation:s,origin:a,spacing:l}=function(t){let{affine:e}=t,{orientation:i,origin:n,spacing:s}=function(t){let e=[t[0][3],t[1][3],t[2][3]],i=[Math.sqrt(t[0][0]**2+t[1][0]**2+t[2][0]**2),Math.sqrt(t[0][1]**2+t[1][1]**2+t[2][1]**2),Math.sqrt(t[0][2]**2+t[1][2]**2+t[2][2]**2)];return{origin:e,orientation:[t[0][0]/i[0],t[0][1]/i[1],t[0][2]/i[2],t[1][0]/i[0],t[1][1]/i[1],t[1][2]/i[2],t[2][0]/i[0],t[2][1]/i[1],t[2][2]/i[2]],spacing:i}}(e);return{origin:[-n[0],-n[1],n[2]],orientation:[-i[0],-i[3],i[6],-i[1],-i[4],i[7],-i[2],-i[5],i[8]],spacing:s}}(i),{dimensions:h,direction:f}=function(t,e,i){let{numBitsPerVoxel:n,littleEndian:s,pixDims:r,dims:a}=t;a[1],a[2],a[3];let{windowWidth:l,windowCenter:h}={windowWidth:400,windowCenter:40},f=o.vt(),u=o.vt(),c=o.vt();return o.hZ(f,e[0],e[1],e[2]),o.hZ(u,e[3],e[4],e[5]),o.hZ(c,e[6],e[7],e[8]),{volumeMetadata:{BitsAllocated:n,BitsStored:n,SamplesPerPixel:1,HighBit:s?n-1:1,PhotometricInterpretation:"MONOCHROME2",PixelRepresentation:1,ImageOrientationPatient:[f[0],f[1],f[2],u[0],u[1],u[2]],PixelSpacing:[r[1],r[2]],Columns:a[1],Rows:a[2],voiLut:[{windowCenter:h,windowWidth:l}],FrameOfReferenceUID:"1.2.3",Modality:"MR",VOILUTFunction:"LINEAR"},dimensions:[a[1],a[2],a[3]],direction:new Float32Array([f[0],f[1],f[2],u[0],u[1],u[2],c[0],c[1],c[2]])}}(i,s,0),u=function(t){switch(t){case 2:return Uint8Array;case 4:return Int16Array;case 8:return Int32Array;case 16:return Float32Array;case 256:return Int8Array;case 512:return Uint16Array;case 768:return Uint32Array;case 64:return Float64Array;default:throw Error(`NIFTI datatypeCode ${t} is not yet supported`)}}(i.datatypeCode);return{dimensions:h,direction:f,isValid:!0,message:`Valid Nifti-${n} header detected`,origin:a,version:n,orientation:s,spacing:l,header:i,arrayConstructor:u}}catch(t){return console.error("Error reading Nifti header:",t),{isValid:!1,message:"Error reading Nifti header"}}}(f))&&c.isValid&&i.abort(),s?.(c))})(t),e&&"function"==typeof e&&e(0,l)}}async function I(t,e,i,n,s,r){for(;;){let{done:n,value:a}=await t.read();if(n){i&&e.close();break}if(a.length,i?await e.write(a):s(a),r.signal.aborted)break}}async function v(t){let e=(e,i)=>{(0,s.Hl)(s.tX,a.NIFTI_VOLUME_PROGRESS,{data:{volumeId:t,loaded:e,total:i}})},i=()=>{(0,s.Hl)(s.tX,a.NIFTI_VOLUME_LOADED,{data:{volumeId:t}})},n=new AbortController;_.set(t,{controller:n,loading:!0});let{dimensions:r,direction:o,isValid:l,message:h,origin:f,version:u,header:c,spacing:d,arrayConstructor:p}=await new Promise(s=>{m({url:t,onProgress:e,controller:n,onLoad:i,onHeader:s})}),g=r[2];if(!l)return void console.error(h);let I=[];for(let e=0;e{Object.defineProperty(e,"__esModule",{value:!0}),e.NIFTIEXTENSION=void 0;class i{esize;ecode;edata;littleEndian;constructor(t,e,i,n){if(t%16!=0)throw Error("This does not appear to be a NIFTI extension");this.esize=t,this.ecode=e,this.edata=i,this.littleEndian=n}toArrayBuffer(){let t=new Uint8Array(this.esize),e=new Uint8Array(this.edata);t.set(e,8);let i=new DataView(t.buffer);return i.setInt32(0,this.esize,this.littleEndian),i.setInt32(4,this.ecode,this.littleEndian),t.buffer}}e.NIFTIEXTENSION=i},66998:(t,e,i)=>{var n=i(33862),s=Uint8Array,r=Uint16Array,a=Uint32Array,o=new s([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),l=new s([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),h=new s([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),f=function(t,e){for(var i=new r(31),n=0;n<31;++n)i[n]=e+=1<>>1|(21845&I)<<1;v=(61680&(v=(52428&v)>>>2|(13107&v)<<2))>>>4|(3855&v)<<4,m[I]=((65280&v)>>>8|(255&v)<<8)>>>1}for(var E=function(t,e,i){for(var n,s=t.length,a=0,o=new r(e);a>>h]=f}else for(a=0,n=new r(s);a>>15-t[a]);return n},y=new s(288),I=0;I<144;++I)y[I]=8;for(var I=144;I<256;++I)y[I]=9;for(var I=256;I<280;++I)y[I]=7;for(var I=280;I<288;++I)y[I]=8;for(var A=new s(32),I=0;I<32;++I)A[I]=5;var T=E(y,9,0),x=E(y,9,1),b=E(A,5,0),U=E(A,5,1),N=function(t){for(var e=t[0],i=1;ie&&(e=t[i]);return e},F=function(t,e,i){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(7&e)&i},S=function(t,e){var i=e/8|0;return(t[i]|t[i+1]<<8|t[i+2]<<16)>>(7&e)},M=function(t){return(t+7)/8|0},w=function(t,e,i){(null==e||e<0)&&(e=0),(null==i||i>t.length)&&(i=t.length);var n=new(2==t.BYTES_PER_ELEMENT?r:4==t.BYTES_PER_ELEMENT?a:s)(i-e);return n.set(t.subarray(e,i)),n};e.FlateErrorCode={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14};var C=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],O=function(t,e,i){var n=Error(e||C[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,O),!i)throw n;return n},D=function(t,e,i){var n=t.length;if(!n||i&&i.f&&!i.l)return e||new s(0);var r=!e||i,a=!i||i.i;i||(i={}),e||(e=new s(3*n));var f=function(t){var i=e.length;if(t>i){var n=new s(Math.max(2*i,t));n.set(e),e=n}},u=i.f||0,d=i.p||0,p=i.b||0,_=i.l,m=i.d,I=i.m,v=i.n,y=8*n;do{if(!_){u=F(t,d,1);var A=F(t,d+1,3);if(d+=3,A)if(1==A)_=x,m=U,I=9,v=5;else if(2==A){var T=F(t,d,31)+257,b=F(t,d+10,15)+4,C=T+F(t,d+5,31)+1;d+=14;for(var D=new s(C),P=new s(19),R=0;R>>4;if(L<16)D[R++]=L;else{var G=0,Y=0;for(16==L?(Y=3+F(t,d,3),d+=2,G=D[R-1]):17==L?(Y=3+F(t,d,7),d+=3):18==L&&(Y=11+F(t,d,127),d+=7);Y--;)D[R++]=G}}var V=D.subarray(0,T),X=D.subarray(T);I=N(V),v=N(X),_=E(V,I,1),m=E(X,v,1)}else O(1);else{var L=M(d)+4,H=t[L-4]|t[L-3]<<8,Z=L+H;if(Z>n){a&&O(0);break}r&&f(p+H),e.set(t.subarray(L,Z),p),i.b=p+=H,i.p=d=8*Z,i.f=u;continue}if(d>y){a&&O(0);break}}r&&f(p+131072);for(var j=(1<>>4;if((d+=15&G)>y){a&&O(0);break}if(G||O(2),$<256)e[p++]=$;else if(256==$){Q=d,_=null;break}else{var W=$-254;if($>264){var R=$-257,J=o[R];W=F(t,d,(1<>>4;tt||O(3),d+=15&tt;var X=g[te];if(te>3){var J=l[te];X+=S(t,d)&(1<y){a&&O(0);break}r&&f(p+131072);for(var ti=p+W;p>>8},R=function(t,e,i){i<<=7&e;var n=e/8|0;t[n]|=i,t[n+1]|=i>>>8,t[n+2]|=i>>>16},q=function(t,e){for(var i=[],n=0;np&&(p=o[n].s);var g=new r(p+1),_=B(i[c-1],g,0);if(_>e){var n=0,m=0,I=_-e,v=1<e)m+=v-(1<<_-g[E]),g[E]=e;else break}for(m>>>=I;m>0;){var y=o[n].s;g[y]=0&&m;--n){var A=o[n].s;g[A]==e&&(--g[A],++m)}_=e}return[new s(g),_]},B=function(t,e,i){return -1==t.s?Math.max(B(t.l,e,i+1),B(t.r,e,i+1)):e[t.s]=i},z=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new r(++e),n=0,s=t[0],a=1,o=function(t){i[n++]=t},l=1;l<=e;++l)if(t[l]==s&&l!=e)++a;else{if(!s&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(s),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(s);a=1,s=t[l]}return[i.subarray(0,n),e]},k=function(t,e){for(var i=0,n=0;n>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var r=0;r4&&!X[h[Z-1]];--Z);var j=d+5<<3,K=k(s,y)+k(a,A)+f,Q=k(s,x)+k(a,F)+f+14+3*Z+k(G,X)+(2*G[16]+3*G[17]+7*G[18]);if(j<=K&&j<=Q)return L(e,p,t.subarray(c,c+d));if(P(e,p,1+(Q15&&(P(e,p,tt[Y]>>>5&127),p+=tt[Y]>>>12)}}else g=T,_=y,m=b,I=A;for(var Y=0;Y255){var te=n[Y]>>>18&31;R(e,p,g[te+257]),p+=_[te+257],te>7&&(P(e,p,n[Y]>>>23&31),p+=o[te]);var ti=31&n[Y];R(e,p,m[ti]),p+=I[ti],ti>3&&(R(e,p,n[Y]>>>5&8191),p+=l[ti])}else R(e,p,g[n[Y]]),p+=_[n[Y]];return R(e,p,g[256]),p+_[256]},Y=new a([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),V=new s(0),X=function(t,e,i,n,h,f){var u=t.length,c=new s(n+u+5*(1+Math.ceil(u/7e3))+h),p=c.subarray(n,c.length-h),g=0;if(!e||u<8)for(var m=0;m<=u;m+=65535){var I=m+65535;I>=u&&(p[g>>3]=f),g=L(p,g+1,t.subarray(m,I))}else{for(var v=Y[e-1],E=v>>>13,y=8191&v,A=(1<7e3||P>24576)&&X>423){g=G(t,p,0,F,S,C,D,P,q,m-q,g),P=O=D=0,q=m;for(var H=0;H<286;++H)S[H]=0;for(var H=0;H<30;++H)C[H]=0}var Z=2,j=0,K=y,Q=z-k&32767;if(X>2&&B==N(m-Q))for(var $=Math.min(E,X)-1,W=Math.min(32767,m),J=Math.min(258,X);Q<=W&&--K&&z!=k;){if(t[m+Z]==t[m+Z-Q]){for(var tt=0;ttZ){if(Z=tt,j=Q,tt>$)break;for(var te=Math.min(Q,tt-2),ti=0,H=0;Hti&&(ti=tr,k=tn)}}}k=T[z=k],Q+=z-k+32768&32767}if(j){F[P++]=0x10000000|d[Z]<<18|_[j];var ta=31&d[Z],to=31&_[j];D+=o[ta]+l[to],++S[257+ta],++C[to],R=m+Z,++O}else F[P++]=t[m],++S[t[m]]}}g=G(t,p,f,F,S,C,D,P,q,m-q,g),!f&&7&g&&(g=L(p,g+1,V))}return w(c,0,n+M(g)+h)},H=function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var i=e,n=9;--n;)i=(1&i&&-0x12477ce0)^i>>>1;t[e]=i}return t}(),Z=function(){var t=-1;return{p:function(e){for(var i=t,n=0;n>>8;t=i},d:function(){return~t}}},j=function(){var t=1,e=0;return{p:function(i){for(var n=t,s=e,r=0|i.length,a=0;a!=r;){for(var o=Math.min(a+2655,r);a>16),s=(65535&s)+15*(s>>16)}t=n,e=s},d:function(){return t%=65521,e%=65521,(255&t)<<24|t>>>8<<16|(255&e)<<8|e>>>8}}},K=function(t,e,i,n,s){return X(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,i,n,!s)},Q=function(t,e){var i={};for(var n in t)i[n]=t[n];for(var n in e)i[n]=e[n];return i},$=function(t,e,i){for(var n=t(),s=t.toString(),r=s.slice(s.indexOf("[")+1,s.lastIndexOf("]")).replace(/\s+/g,"").split(","),a=0;a>>0},tp=function(t,e){return td(t,e)+0x100000000*td(t,e+4)},tg=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8},t_=function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:2*(9==e.level),t[9]=3,0!=e.mtime&&tg(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var n=0;n<=i.length;++n)t[n+10]=i.charCodeAt(n)}},tm=function(t){(31!=t[0]||139!=t[1]||8!=t[2])&&O(6,"invalid gzip data");var e=t[3],i=10;4&e&&(i+=t[10]|(t[11]<<8)+2);for(var n=(e>>3&1)+(e>>4&1);n>0;n-=!t[i++]);return i+(2&e)},tI=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},tv=function(t){return 10+(t.filename&&t.filename.length+1||0)},tE=function(t,e){var i=e.level,n=0==i?0:i<6?1:9==i?3:2;t[0]=120,t[1]=n<<6|(n?32-2*n:1)},ty=function(t){((15&t[0])!=8||t[0]>>>4>7||(t[0]<<8|t[1])%31)&&O(6,"invalid zlib data"),32&t[1]&&O(6,"invalid zlib data: preset dictionaries not supported")};function tA(t,e){return e||"function"!=typeof t||(e=t,t={}),this.ondata=e,t}var tT=function(){function t(t,e){e||"function"!=typeof t||(e=t,t={}),this.ondata=e,this.o=t||{}}return t.prototype.p=function(t,e){this.ondata(K(t,this.o,0,0,!e),e)},t.prototype.push=function(t,e){this.ondata||O(5),this.d&&O(4),this.d=e,this.p(t,e||!1)},t}();e.Deflate=tT;var tx=function(t,e){tu([ti,function(){return[tf,tT]}],this,tA.call(this,t,e),function(t){onmessage=tf(new tT(t.data))},6)};function tb(t,e,i){return i||(i=e,e={}),"function"!=typeof i&&O(7),th(t,e,[ti],function(t){return to(tU(t.data[0],t.data[1]))},0,i)}function tU(t,e){return K(t,e||{},0,0)}e.AsyncDeflate=tx,e.deflate=tb,e.deflateSync=tU;var tN=function(){function t(t){this.s={},this.p=new s(0),this.ondata=t}return t.prototype.e=function(t){this.ondata||O(5),this.d&&O(4);var e=this.p.length,i=new s(e+t.length);i.set(this.p),i.set(t,e),this.p=i},t.prototype.c=function(t){this.d=this.s.i=t||!1;var e=this.s.b,i=D(this.p,this.o,this.s);this.ondata(w(i,e,this.s.b),this.d),this.o=w(i,this.s.b-32768),this.s.b=this.o.length,this.p=w(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(t,e){this.e(t),this.c(e)},t}();e.Inflate=tN;var tF=function(t){this.ondata=t,tu([te,function(){return[tf,tN]}],this,0,function(){onmessage=tf(new tN)},7)};function tS(t,e,i){return i||(i=e,e={}),"function"!=typeof i&&O(7),th(t,e,[te],function(t){var e;return to((e=t.data[0],D(e,tl(t.data[1]))))},1,i)}function tM(t,e){return D(t,e)}e.AsyncInflate=tF,e.inflate=tS,e.inflateSync=tM;var tw=function(){function t(t,e){this.c=Z(),this.l=0,this.v=1,tT.call(this,t,e)}return t.prototype.push=function(t,e){tT.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){this.c.p(t),this.l+=t.length;var i=K(t,this.o,this.v&&tv(this.o),e&&8,!e);this.v&&(t_(i,this.o),this.v=0),e&&(tg(i,i.length-8,this.c.d()),tg(i,i.length-4,this.l)),this.ondata(i,e)},t}();e.Gzip=tw,e.Compress=tw;var tC=function(t,e){tu([ti,tn,function(){return[tf,tT,tw]}],this,tA.call(this,t,e),function(t){onmessage=tf(new tw(t.data))},8)};function tO(t,e,i){return i||(i=e,e={}),"function"!=typeof i&&O(7),th(t,e,[ti,tn,function(){return[tD]}],function(t){return to(tD(t.data[0],t.data[1]))},2,i)}function tD(t,e){e||(e={});var i=Z(),n=t.length;i.p(t);var s=K(t,e,tv(e),8),r=s.length;return t_(s,e),tg(s,r-8,i.d()),tg(s,r-4,n),s}e.AsyncGzip=tC,e.AsyncCompress=tC,e.gzip=tO,e.compress=tO,e.gzipSync=tD,e.compressSync=tD;var tP=function(){function t(t){this.v=1,tN.call(this,t)}return t.prototype.push=function(t,e){if(tN.prototype.e.call(this,t),this.v){var i=this.p.length>3?tm(this.p):4;if(i>=this.p.length&&!e)return;this.p=this.p.subarray(i),this.v=0}e&&(this.p.length<8&&O(6,"invalid gzip data"),this.p=this.p.subarray(0,-8)),tN.prototype.c.call(this,e)},t}();e.Gunzip=tP;var tR=function(t){this.ondata=t,tu([te,ts,function(){return[tf,tN,tP]}],this,0,function(){onmessage=tf(new tP)},9)};function tq(t,e,i){return i||(i=e,e={}),"function"!=typeof i&&O(7),th(t,e,[te,ts,function(){return[tB]}],function(t){return to(tB(t.data[0]))},3,i)}function tB(t,e){return D(t.subarray(tm(t),-8),e||new s(tI(t)))}e.AsyncGunzip=tR,e.gunzip=tq,e.gunzipSync=tB;var tz=function(){function t(t,e){this.c=j(),this.v=1,tT.call(this,t,e)}return t.prototype.push=function(t,e){tT.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){this.c.p(t);var i=K(t,this.o,this.v&&2,e&&4,!e);this.v&&(tE(i,this.o),this.v=0),e&&tg(i,i.length-4,this.c.d()),this.ondata(i,e)},t}();function tk(t,e){e||(e={});var i=j();i.p(t);var n=K(t,e,2,4);return tE(n,e),tg(n,n.length-4,i.d()),n}e.Zlib=tz,e.AsyncZlib=function(t,e){tu([ti,tr,function(){return[tf,tT,tz]}],this,tA.call(this,t,e),function(t){onmessage=tf(new tz(t.data))},10)},e.zlib=function(t,e,i){return i||(i=e,e={}),"function"!=typeof i&&O(7),th(t,e,[ti,tr,function(){return[tk]}],function(t){return to(tk(t.data[0],t.data[1]))},4,i)},e.zlibSync=tk;var tL=function(){function t(t){this.v=1,tN.call(this,t)}return t.prototype.push=function(t,e){if(tN.prototype.e.call(this,t),this.v){if(this.p.length<2&&!e)return;this.p=this.p.subarray(2),this.v=0}e&&(this.p.length<4&&O(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),tN.prototype.c.call(this,e)},t}();e.Unzlib=tL;var tG=function(t){this.ondata=t,tu([te,ta,function(){return[tf,tN,tL]}],this,0,function(){onmessage=tf(new tL)},11)};function tY(t,e,i){return i||(i=e,e={}),"function"!=typeof i&&O(7),th(t,e,[te,ta,function(){return[tV]}],function(t){return to(tV(t.data[0],tl(t.data[1])))},5,i)}function tV(t,e){return D((ty(t),t.subarray(2,-4)),e)}e.AsyncUnzlib=tG,e.unzlib=tY,e.unzlibSync=tV;var tX=function(){function t(t){this.G=tP,this.I=tN,this.Z=tL,this.ondata=t}return t.prototype.push=function(t,e){if(this.ondata||O(5),this.s)this.s.push(t,e);else{if(this.p&&this.p.length){var i=new s(this.p.length+t.length);i.set(this.p),i.set(t,this.p.length)}else this.p=t;if(this.p.length>2){var n=this,r=function(){n.ondata.apply(n,arguments)};this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(r):(15&this.p[0])!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(r):new this.Z(r),this.s.push(this.p,e),this.p=null}}},t}();e.Decompress=tX,e.AsyncDecompress=function(){function t(t){this.G=tR,this.I=tF,this.Z=tG,this.ondata=t}return t.prototype.push=function(t,e){tX.prototype.push.call(this,t,e)},t}(),e.decompress=function(t,e,i){return i||(i=e,e={}),"function"!=typeof i&&O(7),31==t[0]&&139==t[1]&&8==t[2]?tq(t,e,i):(15&t[0])!=8||t[0]>>4>7||(t[0]<<8|t[1])%31?tS(t,e,i):tY(t,e,i)},e.decompressSync=function(t,e){return 31==t[0]&&139==t[1]&&8==t[2]?tB(t,e):(15&t[0])!=8||t[0]>>4>7||(t[0]<<8|t[1])%31?D(t,e):tV(t,e)};var tH=function(t,e,i,n){for(var r in t){var a=t[r],o=e+r,l=n;Array.isArray(a)&&(l=Q(n,a[1]),a=a[0]),a instanceof s?i[o]=[a,l]:(i[o+="/"]=[new s(0),l],tH(a,o,i,n))}},tZ="undefined"!=typeof TextEncoder&&new TextEncoder,tj="undefined"!=typeof TextDecoder&&new TextDecoder,tK=0;try{tj.decode(V,{stream:!0}),tK=1}catch(t){}var tQ=function(t){for(var e="",i=0;;){var n=t[i++],s=(n>127)+(n>223)+(n>239);if(i+s>t.length)return[e,w(t,i-1)];s?3==s?e+=String.fromCharCode(55296|(n=((15&n)<<18|(63&t[i++])<<12|(63&t[i++])<<6|63&t[i++])-65536)>>10,56320|1023&n):1&s?e+=String.fromCharCode((31&n)<<6|63&t[i++]):e+=String.fromCharCode((15&n)<<12|(63&t[i++])<<6|63&t[i++]):e+=String.fromCharCode(n)}};function t$(t,e){if(e){for(var i=new s(t.length),n=0;n>1)),o=0,l=function(t){a[o++]=t},n=0;na.length){var h=new s(o+8+(r-n<<1));h.set(a),a=h}var f=t.charCodeAt(n);f<128||e?l(f):(f<2048?l(192|f>>6):(f>55295&&f<57344?(l(240|(f=65536+(1047552&f)|1023&t.charCodeAt(++n))>>18),l(128|f>>12&63)):l(224|f>>12),l(128|f>>6&63)),l(128|63&f))}return w(a,0,o)}function tW(t,e){if(e){for(var i="",n=0;n65535&&O(9),e+=n+4}return e},t4=function(t,e,i,n,s,r,a,o){var l=n.length,h=i.extra,f=o&&o.length,u=t3(h);tg(t,e,null!=a?0x2014b50:0x4034b50),e+=4,null!=a&&(t[e++]=20,t[e++]=i.os),t[e]=20,e+=2,t[e++]=i.flag<<1|(null==r&&8),t[e++]=s&&8,t[e++]=255&i.compression,t[e++]=i.compression>>8;var c=new Date(null==i.mtime?Date.now():i.mtime),d=c.getFullYear()-1980;if((d<0||d>119)&&O(10),tg(t,e,d<<25|c.getMonth()+1<<21|c.getDate()<<16|c.getHours()<<11|c.getMinutes()<<5|c.getSeconds()>>>1),e+=4,null!=r&&(tg(t,e,i.crc),tg(t,e+4,r),tg(t,e+8,i.size)),tg(t,e+12,l),tg(t,e+14,u),e+=16,null!=a&&(tg(t,e,f),tg(t,e+6,i.attrs),tg(t,e+10,a),e+=14),t.set(n,e),e+=l,u)for(var p in h){var g=h[p],_=g.length;tg(t,e,+p),tg(t,e+2,_),t.set(g,e+4),e+=4+_}return f&&(t.set(o,e),e+=f),e},t8=function(t,e,i,n,s){tg(t,e,0x6054b50),tg(t,e+8,i),tg(t,e+10,i),tg(t,e+12,n),tg(t,e+16,s)},t6=function(){function t(t){this.filename=t,this.c=Z(),this.size=0,this.compression=0}return t.prototype.process=function(t,e){this.ondata(null,t,e)},t.prototype.push=function(t,e){this.ondata||O(5),this.c.p(t),this.size+=t.length,e&&(this.crc=this.c.d()),this.process(t,e||!1)},t}();e.ZipPassThrough=t6,e.ZipDeflate=function(){function t(t,e){var i=this;e||(e={}),t6.call(this,t),this.d=new tT(e,function(t,e){i.ondata(null,t,e)}),this.compression=8,this.flag=tJ(e.level)}return t.prototype.process=function(t,e){try{this.d.push(t,e)}catch(t){this.ondata(t,null,e)}},t.prototype.push=function(t,e){t6.prototype.push.call(this,t,e)},t}(),e.AsyncZipDeflate=function(){function t(t,e){var i=this;e||(e={}),t6.call(this,t),this.d=new tx(e,function(t,e,n){i.ondata(t,e,n)}),this.compression=8,this.flag=tJ(e.level),this.terminate=this.d.terminate}return t.prototype.process=function(t,e){this.d.push(t,e)},t.prototype.push=function(t,e){t6.prototype.push.call(this,t,e)},t}(),e.Zip=function(){function t(t){this.ondata=t,this.u=[],this.d=1}return t.prototype.add=function(t){var e=this;if(this.ondata||O(5),2&this.d)this.ondata(O(4+(1&this.d)*8,0,1),null,!1);else{var i=t$(t.filename),n=i.length,r=t.comment,a=r&&t$(r),o=n!=t.filename.length||a&&r.length!=a.length,l=n+t3(t.extra)+30;n>65535&&this.ondata(O(11,0,1),null,!1);var h=new s(l);t4(h,0,t,i,o);var f=[h],u=function(){for(var t=0,i=f;t65535&&x(O(11,0,1),null),T)if(_<16e4)try{x(null,tU(s,h))}catch(t){x(t,null)}else u.push(tb(s,h,x));else x(null,s)},_=0;_65535&&O(11);var I=u?tU(h,f):h,v=I.length,E=Z();E.p(h),n.push(Q(f,{size:h.length,crc:E.d(),c:I,f:c,m:g,u:d!=o.length||g&&p.length!=_,o:r,compression:u})),r+=30+d+m+v,a+=76+2*(d+m)+(_||0)+v}for(var y=new s(a+22),A=r,T=a-r,x=0;x0){var n=Math.min(this.c,t.length),r=t.subarray(0,n);if(this.c-=n,this.d?this.d.push(r,!this.c):this.k[0].push(r),(t=t.subarray(n)).length)return this.push(t,e)}else{var a=0,o=0,l=void 0,h=void 0;this.p.length?t.length?((h=new s(this.p.length+t.length)).set(this.p),h.set(t,this.p.length)):h=this.p:h=t;for(var f=h.length,u=this.c,c=u&&this.d,d=this;oo+30+r+c){var p,g,_=[];d.k.unshift(_),a=2;var m=td(h,o+18),I=td(h,o+22),v=tW(h.subarray(o+30,o+=30+r),!(2048&e));0xffffffff==m?(m=(p=s?[-2]:t2(h,o))[0],I=p[1]):s&&(m=-1),o+=c,d.c=m;var E={name:v,compression:n,start:function(){if(E.ondata||O(5),m){var t=i.o[n];t||E.ondata(O(14,"unknown compression type "+n,1),null,!1),(g=m<0?new t(v):new t(v,m,I)).ondata=function(t,e,i){E.ondata(t,e,i)};for(var e=0;e<_.length;e++){var s=_[e];g.push(s,!1)}i.k[0]==_&&i.c?i.d=g:g.push(V,!0)}else E.ondata(null,V,!0)},terminate:function(){g&&g.terminate&&g.terminate()}};m>=0&&(E.size=m,E.originalSize=I),d.onfile(E)}return"break"}if(u){if(0x8074b50==t)return l=o+=12+(-2==u&&8),a=3,d.c=0,"break";else if(0x2014b50==t)return l=o-=4,a=3,d.c=0,"break"}}();++o);if(this.p=V,u<0){var p=a?h.subarray(0,l-12-(-2==u&&8)-(0x8074b50==td(h,l-16)&&4)):h.subarray(0,o);c?c.push(p,!!a):this.k[+(2==a)].push(p)}if(2&a)return this.push(h.subarray(o),e);this.p=h.subarray(o)}e&&(this.c&&O(13),this.p=null)},t.prototype.register=function(t){this.o[t.compression]=t},t}();var t7="function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout?setTimeout:function(t){t()};e.unzip=function(t,e,i){i||(i=e,e={}),"function"!=typeof i&&O(7);var n=[],r=function(){for(var t=0;t65558)return o(O(13,0,1),null),r;var h=tc(t,l+8);if(h){var f=h,u=td(t,l+16),c=0xffffffff==u;if(c){if(l=td(t,l-12),0x6064b50!=td(t,l))return o(O(13,0,1),null),r;f=h=td(t,l+32),u=td(t,l+48)}for(var d=e&&e.filter,p=0;p65558)&&O(13);var r=tc(t,n+8);if(!r)return{};var a=td(t,n+16),o=0xffffffff==a;o&&(n=td(t,n-12),0x6064b50!=td(t,n)&&O(13),r=td(t,n+32),a=td(t,n+48));for(var l=e&&e.filter,h=0;h{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"styles",{enumerable:!0,get:function(){return l}});let l={error:{fontFamily:'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',height:"100vh",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},desc:{display:"inline-block"},h1:{display:"inline-block",margin:"0 20px 0 0",padding:"0 23px 0 0",fontSize:24,fontWeight:500,verticalAlign:"top",lineHeight:"49px"},h2:{fontSize:14,fontWeight:400,lineHeight:"49px",margin:0}};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},38886:(e,t,l)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"HTTPAccessErrorFallback",{enumerable:!0,get:function(){return o}});let r=l(95155),n=l(24585);function o(e){let{status:t,message:l}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("title",{children:t+": "+l}),(0,r.jsx)("div",{style:n.styles.error,children:(0,r.jsxs)("div",{children:[(0,r.jsx)("style",{dangerouslySetInnerHTML:{__html:"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}),(0,r.jsx)("h1",{className:"next-error-h1",style:n.styles.h1,children:t}),(0,r.jsx)("div",{style:n.styles.desc,children:(0,r.jsx)("h2",{style:n.styles.h2,children:l})})]})})]})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},71599:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/_not-found/page",function(){return l(79520)}])},79520:(e,t,l)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return o}});let r=l(95155),n=l(38886),o=function(){return(0,r.jsx)("html",{children:(0,r.jsx)("body",{children:(0,r.jsx)(n.HTTPAccessErrorFallback,{status:404,message:"This page could not be found."})})})};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)}},e=>{e.O(0,[441,255,358],()=>e(e.s=71599)),_N_E=e.O()}]); \ No newline at end of file diff --git a/_next/static/chunks/app/layout-23ac75db55e2192c.js b/_next/static/chunks/app/layout-23ac75db55e2192c.js new file mode 100644 index 0000000000000000000000000000000000000000..80348a7f3e4ff099fe6c9fb3fd866fc0abb081c1 --- /dev/null +++ b/_next/static/chunks/app/layout-23ac75db55e2192c.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[177],{13673:()=>{},29068:(e,t,s)=>{Promise.resolve().then(s.t.bind(s,13673,23)),Promise.resolve().then(s.bind(s,44079))},44079:(e,t,s)=>{"use strict";s.d(t,{QueryProvider:()=>q});var i=s(95155),r=s(34049),a=s(31668),n=s(74268),u=s(38445),h=class extends u.Q{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,s){let i=t.queryKey,n=t.queryHash??(0,r.F$)(i,t),u=this.get(n);return u||(u=new a.X({client:e,queryKey:i,queryHash:n,options:e.defaultQueryOptions(t),state:s,defaultOptions:e.getQueryDefaults(i)}),this.add(u)),u}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){n.jG.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,r.MK)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,r.MK)(e,t)):t}notify(e){n.jG.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){n.jG.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){n.jG.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},l=s(38559),o=class extends u.Q{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#s=new Map,this.#i=0}#t;#s;#i;build(e,t,s){let i=new l.s({client:e,mutationCache:this,mutationId:++this.#i,options:e.defaultMutationOptions(t),state:s});return this.add(i),i}add(e){this.#t.add(e);let t=c(e);if("string"==typeof t){let s=this.#s.get(t);s?s.push(e):this.#s.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){let t=c(e);if("string"==typeof t){let s=this.#s.get(t);if(s)if(s.length>1){let t=s.indexOf(e);-1!==t&&s.splice(t,1)}else s[0]===e&&this.#s.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=c(e);if("string"!=typeof t)return!0;{let s=this.#s.get(t),i=s?.find(e=>"pending"===e.state.status);return!i||i===e}}runNext(e){let t=c(e);if("string"!=typeof t)return Promise.resolve();{let s=this.#s.get(t)?.find(t=>t!==e&&t.state.isPaused);return s?.continue()??Promise.resolve()}}clear(){n.jG.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#s.clear()})}getAll(){return Array.from(this.#t)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,r.nJ)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,r.nJ)(e,t))}notify(e){n.jG.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return n.jG.batch(()=>Promise.all(e.map(e=>e.continue().catch(r.lQ))))}};function c(e){return e.options.scope?.id}var f=s(56195),d=s(63122);function y(e){return{onFetch:(t,s)=>{let i=t.options,a=t.fetchOptions?.meta?.fetchMore?.direction,n=t.state.data?.pages||[],u=t.state.data?.pageParams||[],h={pages:[],pageParams:[]},l=0,o=async()=>{let s=!1,o=(0,r.ZM)(t.options,t.fetchOptions),c=async(e,i,a)=>{if(s)return Promise.reject();if(null==i&&e.pages.length)return Promise.resolve(e);let n=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:i,direction:a?"backward":"forward",meta:t.options.meta};return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?s=!0:t.signal.addEventListener("abort",()=>{s=!0}),t.signal)}),e})(),u=await o(n),{maxPages:h}=t.options,l=a?r.ZZ:r.y9;return{pages:l(e.pages,u,h),pageParams:l(e.pageParams,i,h)}};if(a&&n.length){let e="backward"===a,t={pages:n,pageParams:u},s=(e?function(e,{pages:t,pageParams:s}){return t.length>0?e.getPreviousPageParam?.(t[0],t,s[0],s):void 0}:p)(i,t);h=await c(t,s,e)}else{let t=e??n.length;do{let e=0===l?u[0]??i.initialPageParam:p(i,h);if(l>0&&null==e)break;h=await c(h,e),l++}while(lt.options.persister?.(o,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},s):t.fetchFn=o}}}function p(e,{pages:t,pageParams:s}){let i=t.length-1;return t.length>0?e.getNextPageParam(t[i],t,s[i],s):void 0}var m=class{#r;#a;#n;#u;#h;#l;#o;#c;constructor(e={}){this.#r=e.queryCache||new h,this.#a=e.mutationCache||new o,this.#n=e.defaultOptions||{},this.#u=new Map,this.#h=new Map,this.#l=0}mount(){this.#l++,1===this.#l&&(this.#o=f.m.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#r.onFocus())}),this.#c=d.t.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#r.onOnline())}))}unmount(){this.#l--,0===this.#l&&(this.#o?.(),this.#o=void 0,this.#c?.(),this.#c=void 0)}isFetching(e){return this.#r.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#a.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#r.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),s=this.#r.build(this,t),i=s.state.data;return void 0===i?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime((0,r.d2)(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(i))}getQueriesData(e){return this.#r.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,s){let i=this.defaultQueryOptions({queryKey:e}),a=this.#r.get(i.queryHash),n=a?.state.data,u=(0,r.Zw)(t,n);if(void 0!==u)return this.#r.build(this,i).setData(u,{...s,manual:!0})}setQueriesData(e,t,s){return n.jG.batch(()=>this.#r.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,s)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#r.get(t.queryHash)?.state}removeQueries(e){let t=this.#r;n.jG.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let s=this.#r;return n.jG.batch(()=>(s.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let s={revert:!0,...t};return Promise.all(n.jG.batch(()=>this.#r.findAll(e).map(e=>e.cancel(s)))).then(r.lQ).catch(r.lQ)}invalidateQueries(e,t={}){return n.jG.batch(()=>(this.#r.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let s={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(n.jG.batch(()=>this.#r.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,s);return s.throwOnError||(t=t.catch(r.lQ)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(r.lQ)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let s=this.#r.build(this,t);return s.isStaleByTime((0,r.d2)(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(r.lQ).catch(r.lQ)}fetchInfiniteQuery(e){return e.behavior=y(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(r.lQ).catch(r.lQ)}ensureInfiniteQueryData(e){return e.behavior=y(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return d.t.isOnline()?this.#a.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#r}getMutationCache(){return this.#a}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#u.set((0,r.EN)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#u.values()],s={};return t.forEach(t=>{(0,r.Cp)(e,t.queryKey)&&Object.assign(s,t.defaultOptions)}),s}setMutationDefaults(e,t){this.#h.set((0,r.EN)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#h.values()],s={};return t.forEach(t=>{(0,r.Cp)(e,t.mutationKey)&&Object.assign(s,t.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,r.F$)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===r.hT&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#r.clear(),this.#a.clear()}},g=s(99776),b=s(12115);function q(e){let{children:t}=e,[s]=(0,b.useState)(()=>new m({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4,retry:1}}}));return(0,i.jsx)(g.Ht,{client:s,children:t})}}},e=>{e.O(0,[978,141,441,255,358],()=>e(e.s=29068)),_N_E=e.O()}]); \ No newline at end of file diff --git a/_next/static/chunks/app/page-91f7834d38336646.js b/_next/static/chunks/app/page-91f7834d38336646.js new file mode 100644 index 0000000000000000000000000000000000000000..581020a5e60de9bf6d3523d49267ce58cecc66b5 --- /dev/null +++ b/_next/static/chunks/app/page-91f7834d38336646.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[694,974],{35623:(e,t,n)=>{"use strict";n.d(t,{V:()=>l,z:()=>s});let i="end_header\n";function l(e){let t,n=new Uint8Array(e),l=new TextDecoder("ascii").decode(n.subarray(0,Math.min(4096,n.length))),s=l.indexOf(i);if(-1===s)throw Error("Not a PLY: no header terminator in the first 4 KB");let c=l.slice(0,s);if(!c.includes("format binary_little_endian 1.0"))throw Error("Unsupported PLY: expected binary little-endian");let r=a(c,"element vertex"),o=a(c,"element face"),d=function(e){let t=e.split("\n").find(e=>e.startsWith("comment spacing_mm"));if(!t)throw Error("PLY header has no spacing comment");let n=t.trim().split(/\s+/).slice(2,5).map(Number);if(3!==n.length||n.some(e=>!Number.isFinite(e)))throw Error("PLY header has a bad spacing comment");return[n[0],n[1],n[2]]}(c),u=c.includes("property float nx"),x=u?6:3,m=s+i.length,p=r*x*4,h=p+13*o,g=n.length-m;if(g!==h)throw Error("PLY body is ".concat(g," bytes, expected ").concat(h," (truncated or unexpected layout)"));let f=new Float32Array(r*x);new Uint8Array(f.buffer).set(n.subarray(m,m+p));let b=null;if(u){t=new Float32Array(3*r),b=new Float32Array(3*r);for(let e=0;el&&(l=r),o>a&&(a=o),d>s&&(s=d)}return[t,n,i,l,a,s]}(t)}}function a(e,t){let n=e.split("\n").find(e=>e.startsWith(t));if(!n)throw Error("PLY header has no '".concat(t,"'"));let i=Number(n.trim().split(/\s+/).at(-1));if(!Number.isInteger(i)||i<0)throw Error("PLY header has a bad count for '".concat(t,"'"));return i}function s(e){let t=e.filter(e=>e.some(e=>0!==e));return 0===t.length?null:t.reduce((e,t)=>[Math.min(e[0],t[0]),Math.min(e[1],t[1]),Math.min(e[2],t[2]),Math.max(e[3],t[3]),Math.max(e[4],t[4]),Math.max(e[5],t[5])])}},41234:()=>{},51920:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>V});var i=n(95155),l=n(22454),a=n(12115),s=n(99776),c=n(80549),r=n(67161),o=n(55545);let d=(0,n(25959).v)(e=>({patientId:null,timepointIndex:0,comparisonIndex:null,selectedLesionId:null,viewMode:"COMPARE_2D",evidencePanelOpen:!1,activeEvidenceId:null,setPatient:t=>e({patientId:t,timepointIndex:0,comparisonIndex:null,selectedLesionId:null,activeEvidenceId:null}),setTimepointIndex:t=>e({timepointIndex:t}),stepTimepoint:(t,n)=>e(e=>({timepointIndex:Math.min(Math.max(e.timepointIndex+t,0),n)})),setComparisonIndex:t=>e({comparisonIndex:t}),selectLesion:t=>e({selectedLesionId:t}),setViewMode:t=>e({viewMode:t}),showEvidence:t=>e({activeEvidenceId:t,evidencePanelOpen:!0}),closeEvidence:()=>e({evidencePanelOpen:!1,activeEvidenceId:null})})),u=[{question:"WHAT_CHANGED",label:"what changed"},{question:"LARGEST_CHANGE",label:"largest change"},{question:"WHEN_LARGEST_CHANGE",label:"when"},{question:"WHAT_REMAINED_STABLE",label:"what was stable"},{question:"EVIDENCE_FOR_FINDING",label:"why this lesion",needsLesion:!0}];function x(e){var t,n,x,g;let{patientId:f}=e,{activeEvidenceId:b,selectedLesionId:v,timepointIndex:y,showEvidence:j}=d(),N=(0,s.jE)(),[w,_]=(0,a.useState)(null),[E,I]=(0,a.useState)(null),[k,A]=(0,a.useState)(!1),{data:S,isLoading:T}=(0,l.I)({queryKey:r.lH.aiObservations(f),queryFn:()=>r.FH.listAIObservations(f)}),{data:C}=(0,l.I)({queryKey:r.lH.timeline(f),queryFn:()=>r.FH.getTimeline(f)}),M=(0,c.n)({mutationFn:e=>{var t;return r.FH.askAIObservation(f,{question:e,study_id:null==C||null==(t=C.points[y])?void 0:t.study.id,lesion_id:"EVIDENCE_FOR_FINDING"===e&&null!=v?v:void 0})},onMutate:()=>{I(null)},onSuccess:e=>{_(e.observation),j(null),N.invalidateQueries({queryKey:r.lH.aiObservations(f)})},onError:e=>{I(e instanceof r.hD?e.message:"The evidence engine could not be reached.")}}),L=null!=(t=null!=w?w:null==S?void 0:S[0])?t:null,O=null==L?void 0:L.evidence_items.find(e=>e.id===b);return(0,i.jsxs)("section",{className:"shrink-0 border-t border-clinical-700 bg-clinical-800 px-4 py-2","data-testid":"evidence-panel","data-answer-id":null!=(n=null==L?void 0:L.id)?n:"","data-evidence-count":null!=(x=null==L?void 0:L.evidence_items.length)?x:0,"data-safety-status":null!=(g=null==L?void 0:L.safety_status)?g:"","data-collapsed":k,children:[(0,i.jsxs)("div",{className:"mb-1.5 flex flex-wrap items-baseline gap-x-3 gap-y-1",children:[(0,i.jsx)("h2",{className:"text-[10px] font-semibold uppercase tracking-[0.15em] text-signal-ai",children:"AI evidence"}),(0,i.jsx)("ul",{className:"flex flex-wrap gap-1",children:u.map(e=>{let{question:t,label:n,needsLesion:l}=e,a=l&&!v;return(0,i.jsx)("li",{children:(0,i.jsx)("button",{type:"button",disabled:M.isPending||a,onClick:()=>M.mutate(t),"data-testid":"ask-".concat(t),title:a?"Select a lesion first — this question is about one lesion":"Ask: ".concat(n),className:(0,o.cn)("rounded border px-2 py-0.5 text-[10px] transition-colors","border-clinical-600 text-clinical-muted",!a&&!M.isPending&&"hover:border-signal-ai/60 hover:text-clinical-text",(a||M.isPending)&&"cursor-not-allowed opacity-40"),children:n})},t)})}),L&&(0,i.jsx)(m,{observation:L,pending:M.isPending}),(0,i.jsx)("button",{type:"button",onClick:()=>A(e=>!e),"aria-expanded":!k,"aria-controls":"evidence-body","aria-label":k?"Expand the AI evidence panel":"Shrink the AI evidence panel",title:k?"Expand — give the evidence more room":"Shrink — give the images more room","data-testid":"evidence-resize",className:"ml-auto rounded border border-clinical-600 px-1.5 py-0.5 text-[11px] leading-none text-clinical-muted transition-colors hover:border-signal-ai/60 hover:text-clinical-text",children:(0,i.jsx)("span",{"aria-hidden":!0,children:k?"⤢":"\xd7"})})]}),(0,i.jsxs)("div",{id:"evidence-body","data-testid":"evidence-body",className:(0,o.cn)(k&&"max-h-20 overflow-y-auto pr-1"),children:[M.isPending?(0,i.jsx)("p",{className:"text-[11px] text-clinical-dim",children:"Assembling findings…"}):E?(0,i.jsx)("p",{className:"text-[11px] leading-relaxed text-signal-concern","data-testid":"evidence-refusal",children:E}):T?(0,i.jsx)("p",{className:"text-[11px] text-clinical-dim",children:"Loading…"}):L?(0,i.jsx)(p,{observation:L,onSelectEvidence:j,activeId:b}):(0,i.jsx)("p",{className:"text-[11px] text-clinical-dim",children:"Ask one of the five questions above. Answers are generated from the measurements on this timeline, never from the images directly."}),O&&(0,i.jsx)(h,{item:O,timeline:C})]})]})}function m(e){let{observation:t,pending:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"text-[9px] text-clinical-dim",children:"none"===t.llm_provider?"composed from findings":"".concat(t.llm_model)}),null!=t.confidence&&(0,i.jsxs)("span",{className:(0,o.cn)("measurement text-[9px]",(0,o.Jv)(t.confidence)),"data-testid":"answer-confidence",children:[(100*t.confidence).toFixed(0),"% confidence"]}),"PASSED"!==t.safety_status&&(0,i.jsxs)("span",{className:"text-[9px] uppercase tracking-wider text-signal-concern",children:["safety: ",t.safety_status.toLowerCase()]}),!n&&(0,i.jsx)("span",{className:"text-[9px] text-clinical-dim",children:new Date(t.created_at).toLocaleString()})]})}function p(e){let{observation:t,onSelectEvidence:n,activeId:l}=e,a=t.safety_notes.filter(e=>e.startsWith("low confidence")||e.startsWith("quality flag"));return(0,i.jsxs)("div",{className:"flex items-start gap-4",children:[(0,i.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,i.jsx)("p",{className:"border-l-2 border-signal-ai/40 pl-3 text-[11px] leading-relaxed text-clinical-text","data-testid":"answer-text",children:t.answer_text}),a.length>0&&(0,i.jsx)("ul",{className:"mt-1 pl-3 text-[9px] leading-relaxed text-signal-caution",children:a.map(e=>(0,i.jsx)("li",{children:e},e))})]}),(0,i.jsx)("ul",{className:"flex shrink-0 flex-wrap gap-1.5","data-testid":"evidence-list",children:t.evidence_items.map(e=>(0,i.jsx)("li",{children:(0,i.jsx)("button",{type:"button",onClick:()=>n(e.id),title:e.label,className:(0,o.cn)("rounded border px-2 py-1 text-[10px] transition-colors",l===e.id?"border-signal-ai bg-signal-ai/15 text-clinical-text":"border-clinical-600 text-clinical-muted hover:border-signal-ai/60 hover:text-clinical-text"),children:function(e){switch(e){case"IMAGE_REGION":return"Image region";case"SEGMENTATION":return"Segmentation";case"MEASUREMENT":return"Measurement";case"PRIOR_STUDY":return"Prior study";case"CLINICAL_EVENT":return"Clinical event";case"QUALITY_FINDING":return"Quality finding";default:return e}}(e.kind)})},e.id))})]})}function h(e){var t;let{item:n,timeline:l}=e,{closeEvidence:a,setTimepointIndex:s,selectLesion:c}=d(),r="string"==typeof n.locator.study_id?n.locator.study_id:null,o="string"==typeof n.locator.lesion_id?n.locator.lesion_id:null,u=r&&null!=(t=null==l?void 0:l.points.findIndex(e=>e.study.id===r))?t:-1;return(0,i.jsxs)("div",{className:"mt-2 flex items-start justify-between gap-4 rounded border border-signal-ai/30 bg-clinical-850 px-3 py-2",children:[(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("p",{className:"text-[11px] text-clinical-text",children:n.label}),Object.keys(n.locator).length>0&&(0,i.jsx)("p",{className:"measurement mt-0.5 text-[9px] text-clinical-dim",children:Object.entries(n.locator).filter(e=>{let[,t]=e;return null!==t}).map(e=>{let[t,n]=e;return"".concat(t,": ").concat(JSON.stringify(n))}).join(" \xb7 ")})]}),(0,i.jsxs)("div",{className:"flex shrink-0 items-center gap-3",children:[(u>=0||null!==o)&&(0,i.jsx)("button",{type:"button","data-testid":"evidence-navigate",onClick:()=>{u>=0&&s(u),o&&c(o)},className:"rounded border border-signal-ai/50 px-2 py-1 text-[10px] text-clinical-text transition-colors hover:bg-signal-ai/15",children:"show me"}),(0,i.jsx)("button",{type:"button",onClick:a,className:"text-[10px] text-clinical-muted hover:text-clinical-text",children:"close"})]})]})}function g(e){var t;let{point:n,lesions:l}=e,{selectedLesionId:a,selectLesion:s}=d(),c=null!=(t=null==n?void 0:n.observations)?t:[];return(0,i.jsxs)("aside",{className:"flex w-72 shrink-0 flex-col border-l border-clinical-700 bg-clinical-850",children:[(0,i.jsx)("div",{className:"border-b border-clinical-700 px-3 py-2",children:(0,i.jsx)("h2",{className:"text-[10px] font-semibold uppercase tracking-[0.15em] text-clinical-muted",children:"Findings"})}),(0,i.jsx)("div",{className:"flex-1 overflow-y-auto",children:0===c.length?(0,i.jsx)("p",{className:"px-3 py-4 text-[11px] text-clinical-dim",children:"No findings recorded at this timepoint."}):(0,i.jsx)("ul",{className:"divide-y divide-clinical-800",children:c.map(e=>{var t,n;let c=l.find(t=>t.id===e.lesion_id),r=(0,o.S5)(e,"VOLUME"),d=(0,o.S5)(e,"LARGEST_DIAMETER"),u=(0,o.S5)(e,"VOLUME_CHANGE_REL"),x=(0,o.S5)(e,"GROWTH_RATE"),m=a===e.lesion_id,p=e.quality_flags.includes("MATCH_UNCERTAIN")||e.quality_flags.includes("WEAK_SCORE")||e.quality_flags.includes("AMBIGUOUS_ALTERNATIVE");return(0,i.jsx)("li",{children:(0,i.jsxs)("button",{type:"button",onClick:()=>s(m?null:e.lesion_id),"data-testid":"finding-row","data-lesion-id":null!=(t=e.lesion_id)?t:"",className:(0,o.cn)("w-full px-3 py-2.5 text-left transition-colors",m?"bg-clinical-750":"hover:bg-clinical-800"),children:[(0,i.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,i.jsx)("span",{className:"measurement text-xs font-semibold text-clinical-text",children:null!=(n=null==c?void 0:c.label)?n:"Lesion"}),(0,i.jsx)("span",{className:"text-[9px] uppercase tracking-wider text-clinical-dim",children:e.compartment.toLowerCase().replaceAll("_"," ")})]}),(null==c?void 0:c.anatomy_region)&&(0,i.jsx)("p",{className:"mt-0.5 text-[10px] text-clinical-muted",children:c.anatomy_region}),(0,i.jsxs)("dl",{className:"mt-2 space-y-1",children:[r&&(0,i.jsx)(f,{label:"Volume",children:(0,i.jsx)("span",{className:"measurement text-clinical-text",children:(0,o.s8)(r)})}),d&&(0,i.jsx)(f,{label:"Diameter",children:(0,i.jsx)("span",{className:"measurement text-clinical-text",children:(0,o.s8)(d)})}),u&&(0,i.jsx)(f,{label:"Change",children:(0,i.jsxs)("span",{className:(0,o.cn)("measurement",p?"text-clinical-dim line-through decoration-clinical-500/60":(0,o.Tu)(u.value,e.quality_flags)),title:p?"This lesion may not be the same one measured previously, so the change may compare two different findings.":void 0,children:[(0,o.s8)(u),(0,i.jsxs)("span",{className:"ml-1 text-clinical-dim",children:["/ ",(0,o.vy)(e.interval_days)]})]})}),x&&(0,i.jsx)(f,{label:"Rate",children:(0,i.jsx)("span",{className:"measurement text-clinical-muted",children:(0,o.s8)(x)})}),(0,i.jsx)(f,{label:"Confidence",children:(0,i.jsx)("span",{className:(0,o.cn)("measurement",(0,o.Jv)(e.confidence)),children:null!=e.confidence?"".concat((100*e.confidence).toFixed(0),"%"):"—"})})]}),p&&u&&(0,i.jsx)("p",{className:"mt-2 border-l-2 border-signal-uncertain/60 pl-2 text-[9px] leading-tight text-signal-uncertain",children:"This may not be the same lesion as before. Treat the change with caution."}),e.quality_flags.length>0&&(0,i.jsx)("ul",{className:"mt-2 space-y-0.5 border-t border-clinical-800 pt-2",children:e.quality_flags.map(e=>(0,i.jsx)("li",{className:"text-[9px] leading-tight text-signal-uncertain",children:(0,o.Wt)(e)},e))})]})},e.id)})})}),(0,i.jsx)("p",{className:"border-t border-clinical-700 px-3 py-2 text-[9px] leading-snug text-clinical-dim",children:"Measured change only. MEDTRACE does not assess tumour progression or treatment response."})]})}function f(e){let{label:t,children:n}=e;return(0,i.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,i.jsx)("dt",{className:"text-[10px] text-clinical-muted",children:t}),(0,i.jsx)("dd",{className:"text-[11px]",children:n})]})}function b(e){var t,n;let{patient:a,selector:s}=e,{data:c}=(0,l.I)({queryKey:r.lH.health,queryFn:r.FH.health,refetchInterval:3e4}),d=(null==c?void 0:c.status)==="ok";return(0,i.jsxs)("header",{className:"flex shrink-0 items-center gap-4 border-b border-clinical-700 bg-clinical-850 px-4 py-2",children:[(0,i.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,i.jsx)("span",{className:"text-sm font-semibold tracking-[0.2em] text-clinical-text",children:"MEDTRACE"}),(0,i.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-clinical-dim",children:"research prototype"})]}),(0,i.jsx)("div",{className:"h-4 w-px bg-clinical-700"}),s,a?(0,i.jsxs)("div",{className:"flex items-center gap-3 text-xs",children:[(0,i.jsxs)("span",{className:"text-clinical-muted",children:[null!=(t=a.sex)?t:"—",a.age_at_baseline_years?", ".concat(a.age_at_baseline_years," y"):""]}),(0,i.jsxs)("span",{className:"text-clinical-dim",children:[a.study_count," studies \xb7 ",a.lesion_count," lesions"]}),a.is_synthetic&&(0,i.jsx)("span",{className:"rounded border border-signal-uncertain/50 bg-signal-uncertain/10 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-signal-uncertain",children:"synthetic"})]}):(0,i.jsx)("span",{className:"text-xs text-clinical-dim",children:"No patient selected"}),(0,i.jsxs)("div",{className:"ml-auto flex items-center gap-4",children:[(0,i.jsx)("p",{className:"max-w-md text-right text-[10px] leading-tight text-clinical-dim",children:"Not for diagnosis or treatment. All clinical decisions remain with qualified healthcare professionals."}),(0,i.jsxs)("div",{className:"flex items-center gap-1.5",title:(n=c)?n.services.map(e=>"".concat(e.name,": ").concat(e.healthy?"ok":"unavailable")).join("\n"):"Checking services",children:[(0,i.jsx)("span",{className:(0,o.cn)("size-1.5 rounded-full",d?"bg-signal-stable":"bg-signal-concern")}),(0,i.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-clinical-dim",children:c?d?"services ok":"degraded":"checking"})]})]})]})}function v(e){var t;let{patients:n,selectedId:l,onSelect:s}=e,[c,r]=(0,a.useState)(!1),[d,u]=(0,a.useState)(""),x=(0,a.useMemo)(()=>[...n].sort((e,t)=>t.study_count-e.study_count),[n]),m=(0,a.useMemo)(()=>{let e=d.trim().toLowerCase();return e?x.filter(t=>t.external_id.toLowerCase().includes(e)||t.source_dataset.toLowerCase().includes(e)):x},[x,d]),p=n.find(e=>e.id===l);return(0,i.jsxs)("div",{className:"relative",children:[(0,i.jsxs)("button",{type:"button",onClick:()=>r(e=>!e),className:"flex items-center gap-2 rounded border border-clinical-600 px-2 py-1 text-[11px] text-clinical-text transition-colors hover:border-clinical-500",children:[(0,i.jsx)("span",{className:"measurement",children:null!=(t=null==p?void 0:p.external_id)?t:"Select patient"}),(0,i.jsx)("span",{className:"text-clinical-dim",children:c?"▲":"▼"})]}),c&&(0,i.jsxs)("div",{className:"absolute left-0 top-full z-50 mt-1 w-80 rounded border border-clinical-600 bg-clinical-850 shadow-xl",children:[(0,i.jsx)("input",{autoFocus:!0,value:d,onChange:e=>u(e.target.value),placeholder:"Filter by id or dataset",className:"w-full border-b border-clinical-700 bg-clinical-900 px-2 py-1.5 text-[11px] text-clinical-text placeholder:text-clinical-dim focus:outline-none"}),(0,i.jsxs)("ul",{className:"max-h-80 overflow-y-auto",children:[m.map(e=>(0,i.jsx)("li",{children:(0,i.jsxs)("button",{type:"button",onClick:()=>{s(e.id),r(!1),u("")},className:(0,o.cn)("flex w-full items-center justify-between gap-2 px-2 py-1.5 text-left text-[11px] transition-colors",e.id===l?"bg-clinical-750 text-clinical-text":"text-clinical-muted hover:bg-clinical-800"),children:[(0,i.jsx)("span",{className:"measurement",children:e.external_id}),(0,i.jsxs)("span",{className:"flex items-center gap-2 text-[9px] text-clinical-dim",children:[(0,i.jsxs)("span",{children:[e.study_count," studies"]}),(0,i.jsx)("span",{className:"uppercase tracking-wider",children:"BRATS2023_GLI"===e.source_dataset?"BraTS":e.source_dataset.toLowerCase()}),e.is_synthetic&&(0,i.jsx)("span",{className:"text-signal-uncertain",children:"synthetic"})]})]})},e.id)),0===m.length&&(0,i.jsx)("li",{className:"px-2 py-3 text-[11px] text-clinical-dim",children:"No match"})]}),(0,i.jsxs)("p",{className:"border-t border-clinical-700 px-2 py-1.5 text-[9px] text-clinical-dim",children:[n.length," patients \xb7 sorted by number of timepoints"]})]})]})}function y(e){let{points:t}=e,{timepointIndex:n,comparisonIndex:l,setTimepointIndex:a,setComparisonIndex:s}=d(),c=null!=l?l:n>0?n-1:null;return(0,i.jsxs)("aside",{className:"flex w-52 shrink-0 flex-col border-r border-clinical-700 bg-clinical-850",children:[(0,i.jsx)("div",{className:"border-b border-clinical-700 px-3 py-2",children:(0,i.jsx)("h2",{className:"text-[10px] font-semibold uppercase tracking-[0.15em] text-clinical-muted",children:"Studies"})}),(0,i.jsx)("ol",{className:"flex-1 overflow-y-auto",children:t.map((e,t)=>{var l,r;let d=t===n,u=e.study.quality,x=null!=(l=null==u?void 0:u.flags.length)?l:0;return(0,i.jsx)("li",{children:(0,i.jsxs)("button",{type:"button",onClick:()=>a(t),onContextMenu:e=>{e.preventDefault(),s(t===n?null:t)},"aria-current":d?"true":void 0,className:(0,o.cn)("flex w-full flex-col gap-1 border-l-2 px-3 py-2 text-left transition-colors",d?"border-l-signal-info bg-clinical-750":"border-l-transparent hover:bg-clinical-800"),children:[(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsx)("span",{className:"measurement text-xs text-clinical-text",children:e.study.timepoint_label}),e.study.is_reference&&(0,i.jsx)("span",{className:"text-[9px] uppercase tracking-wider text-clinical-dim",title:"Reference study — others are registered onto this one",children:"ref"})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2 text-[10px]",children:[(0,i.jsx)("span",{className:(0,o.uA)(null==u?void 0:u.status),children:null!=(r=null==u?void 0:u.status.toLowerCase())?r:"not assessed"}),(null==u?void 0:u.confidence)!=null&&(0,i.jsxs)("span",{className:"measurement text-clinical-dim",children:[(100*u.confidence).toFixed(0),"%"]})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2 text-[10px] text-clinical-dim",children:[(0,i.jsx)("span",{children:(0,o.vy)(e.study.days_from_baseline)}),e.observations.length>0&&(0,i.jsxs)("span",{children:[e.observations.length," obs"]}),x>0&&(0,i.jsxs)("span",{className:"text-signal-uncertain",children:[x," flag",x>1?"s":""]})]}),t===c&&!d&&(0,i.jsx)("span",{className:"text-[9px] uppercase tracking-wider text-signal-info",children:"comparing against"})]})},e.study.id)})}),(0,i.jsx)("p",{className:"border-t border-clinical-700 px-3 py-2 text-[9px] leading-snug text-clinical-dim",children:"Click to select. Right-click to set the comparison study."})]})}function j(e){var t;let{points:n}=e,{timepointIndex:l,setTimepointIndex:s,stepTimepoint:c}=d(),r=n.length-1;if((0,a.useEffect)(()=>{function e(e){let t=e.target;t&&["INPUT","TEXTAREA"].includes(t.tagName)||("ArrowLeft"===e.key?(e.preventDefault(),c(-1,r)):"ArrowRight"===e.key&&(e.preventDefault(),c(1,r)))}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[c,r]),0===n.length)return null;let u=n.map(e=>{var t;return null!=(t=e.study.days_from_baseline)?t:0}),x=Math.max(...u)||1,m=e=>u[e]/x*100,p=n[l],h=new Set,g=-1/0;for(let e=0;e=6)&&(h.add(e),g=t)}return h.add(l),(0,i.jsxs)("section",{className:"shrink-0 border-t border-clinical-700 bg-clinical-850 px-4 pb-3 pt-2",children:[(0,i.jsxs)("div",{className:"mb-1 flex items-baseline justify-between",children:[(0,i.jsx)("h2",{className:"text-[10px] font-semibold uppercase tracking-[0.15em] text-clinical-muted",children:"Disease timeline"}),(0,i.jsxs)("div",{className:"flex items-center gap-3 text-[10px] text-clinical-dim",children:[(0,i.jsxs)("span",{className:"measurement",children:[null==p?void 0:p.study.timepoint_label," \xb7"," ",(0,o.vy)(null!=(t=null==p?void 0:p.study.days_from_baseline)?t:null)," from baseline"]}),(0,i.jsx)("span",{children:"← → to move"})]})]}),(0,i.jsxs)("div",{className:"relative h-16",children:[(0,i.jsx)("div",{className:"absolute inset-x-0 top-7 h-px bg-clinical-600"}),(0,i.jsx)("div",{className:"absolute top-7 h-px bg-signal-info",style:{width:"".concat(m(l),"%")}}),n.map((e,t)=>{let n=t===l,a=e.study.quality,c=e.events.some(e=>e.is_within_treatment_window),r=e.events.filter(e=>!e.is_within_treatment_window);return(0,i.jsxs)("button",{type:"button",onClick:()=>s(t),"aria-label":"Timepoint ".concat(e.study.timepoint_label),"aria-current":n?"true":void 0,className:"absolute top-0 flex h-16 -translate-x-1/2 flex-col items-center justify-start gap-0.5 px-2",style:{left:"".concat(m(t),"%")},children:[(0,i.jsxs)("span",{className:"flex h-6 items-end gap-0.5",children:[c&&(0,i.jsx)("span",{className:"mb-0.5 size-1.5 rotate-45 bg-signal-uncertain",title:"Within 3 months of radiotherapy — progression cannot be assessed"}),r.map(e=>(0,i.jsx)("span",{className:"mb-0.5 size-1.5 rounded-full bg-clinical-500",title:e.label},e.id))]}),(0,i.jsx)("span",{className:(0,o.cn)("size-2.5 rounded-full border-2 transition-all",n?"scale-125 border-signal-info bg-signal-info":"border-clinical-500 bg-clinical-850")}),h.has(t)&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:(0,o.cn)("measurement mt-0.5 text-[9px] whitespace-nowrap",n?"text-clinical-text":"text-clinical-dim"),children:e.study.timepoint_label.replace("week-","w")}),(0,i.jsx)("span",{className:(0,o.cn)("text-[8px]",(0,o.uA)(null==a?void 0:a.status)),children:(null==a?void 0:a.status)==="READY"?"":null==a?void 0:a.status.toLowerCase()})]})]},e.study.id)})]}),(0,i.jsx)("label",{className:"sr-only",htmlFor:"time-scrubber",children:"Disease timeline position"}),(0,i.jsx)("input",{id:"time-scrubber",type:"range",min:0,max:r,step:1,value:l,onChange:e=>s(Number(e.target.value)),className:"w-full accent-signal-info"}),p&&p.events.length>0&&(0,i.jsx)("ul",{className:"mt-1.5 flex flex-wrap gap-x-4 gap-y-1",children:p.events.map(e=>(0,i.jsxs)("li",{className:(0,o.cn)("text-[10px]",e.is_within_treatment_window?"text-signal-uncertain":"text-clinical-muted"),children:[(0,i.jsx)("span",{className:"uppercase tracking-wider text-clinical-dim",children:e.event_type.toLowerCase().replaceAll("_"," ")})," ",e.label]},e.id))})]})}var N=n(67909),w=n(85330);function _(e){let{settings:t,onChange:n,available:l}=e;return(0,i.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,i.jsx)("button",{type:"button",disabled:!l,onClick:()=>n({...t,visible:!t.visible}),title:l?"Show the tumour segmentation over the image":"No mask aligned to this sequence. Try T1C, or see the 3D view.",className:(0,o.cn)("rounded px-2 py-0.5 text-[10px] uppercase tracking-wider transition-colors",l?t.visible?"bg-signal-info/20 text-signal-info":"text-clinical-dim hover:text-clinical-muted":"text-clinical-700"),children:"mask"}),l&&t.visible&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("button",{type:"button",onClick:()=>n({...t,outlineOnly:!t.outlineOnly}),title:t.outlineOnly?"Outline only — the tissue under the mask stays visible":"Filled — hides the tissue it describes",className:"rounded px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-clinical-dim transition-colors hover:text-clinical-muted",children:t.outlineOnly?"outline":"filled"}),!t.outlineOnly&&(0,i.jsxs)("label",{className:"flex items-center gap-1 text-[9px] text-clinical-dim",children:[(0,i.jsx)("span",{className:"sr-only",children:"Mask opacity"}),(0,i.jsx)("input",{type:"range",min:.1,max:.9,step:.05,value:t.opacity,onChange:e=>n({...t,opacity:Number(e.target.value)}),className:"w-16 accent-signal-info"}),Math.round(100*t.opacity),"%"]}),(0,i.jsx)("span",{className:"flex items-center gap-1.5 pl-1",children:[1,2,3].map(e=>(0,i.jsxs)("span",{className:"flex items-center gap-1 text-[9px]",children:[(0,i.jsx)("span",{className:"size-2 rounded-sm",style:{backgroundColor:"rgb(".concat(w.B[e].slice(0,3).join(","),")")},"aria-hidden":!0}),(0,i.jsx)("span",{className:"text-clinical-dim",children:w.eW[e]})]},e))})]})]})}function E(e,t){let[n,i]=(0,a.useState)(e);return(0,a.useEffect)(()=>{if(e===n)return;let l=setTimeout(()=>i(e),t);return()=>clearTimeout(l)},[e,n,t]),n}let I=(0,N.default)(()=>Promise.all([n.e(987),n.e(178),n.e(199)]).then(n.bind(n,22199)).then(e=>e.NiftiViewport),{loadableGenerated:{webpack:()=>[22199]},ssr:!1,loading:()=>(0,i.jsx)("div",{className:"flex size-full items-center justify-center bg-black",children:(0,i.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-clinical-dim",children:"initialising viewer"})})}),k=(0,N.default)(()=>Promise.all([n.e(987),n.e(178),n.e(534)]).then(n.bind(n,31534)).then(e=>e.ViewerMemory),{loadableGenerated:{webpack:()=>[31534]},ssr:!1}),A=(0,N.default)(()=>Promise.all([n.e(987),n.e(178),n.e(808)]).then(n.bind(n,5808)).then(e=>e.SliceSyncToggle),{loadableGenerated:{webpack:()=>[5808]},ssr:!1}),S=(0,N.default)(()=>Promise.all([n.e(481),n.e(405)]).then(n.bind(n,3405)).then(e=>e.EvolutionViewport),{loadableGenerated:{webpack:()=>[3405]},ssr:!1,loading:()=>(0,i.jsx)("div",{className:"flex min-h-0 flex-1 items-center justify-center bg-clinical-900",children:(0,i.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-clinical-dim",children:"loading 3D renderer"})})}),T=["T1C","T1","T2","FLAIR"],C=["axial","coronal","sagittal"];function M(e){var t,n;let{current:s,comparison:c,lesionLabels:o}=e,{viewMode:u,setViewMode:x}=d(),[m,p]=(0,a.useState)("T1C"),[h,g]=(0,a.useState)("axial"),[f,b]=(0,a.useState)({visible:!0,outlineOnly:!0,opacity:.4}),{data:v}=(0,l.I)({queryKey:r.lH.study(null!=(n=null==s?void 0:s.study.id)?n:"none"),queryFn:()=>r.FH.getStudy(s.study.id),enabled:!!s}),y=!!(null==v||null==(t=v.series.find(e=>e.sequence===m))?void 0:t.has_mask);return(0,i.jsxs)("section",{className:"flex min-w-0 flex-1 flex-col bg-clinical-900",children:[(0,i.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-clinical-700 bg-clinical-850 px-2 py-1.5",children:[(0,i.jsx)(L,{mode:"COMPARE_2D",active:u,onSelect:x,children:"2D comparison"}),(0,i.jsx)(L,{mode:"EVOLUTION_3D",active:u,onSelect:x,children:"3D evolution"}),"COMPARE_2D"===u&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"mx-1 h-4 w-px bg-clinical-700"}),(0,i.jsx)(O,{options:T,value:m,onChange:p}),(0,i.jsx)("span",{className:"mx-1 h-4 w-px bg-clinical-700"}),(0,i.jsx)(O,{options:C,value:h,onChange:g}),(0,i.jsx)("span",{className:"mx-1 h-4 w-px bg-clinical-700"}),(0,i.jsx)(A,{}),(0,i.jsx)("span",{className:"mx-1 h-4 w-px bg-clinical-700"}),(0,i.jsx)(_,{settings:f,onChange:b,available:y}),(0,i.jsx)("span",{className:"ml-auto text-[9px] text-clinical-dim",children:"drag: window/level \xb7 wheel: scroll \xb7 right-drag: zoom \xb7 middle: pan"}),(0,i.jsx)(k,{})]})]}),"COMPARE_2D"===u?(0,i.jsxs)("div",{className:"grid min-h-0 flex-1 grid-cols-2 gap-px bg-clinical-700","data-testid":"viewer-grid",children:[(0,i.jsx)(R,{pane:"prior",label:"Prior",point:c,sequence:m,orientation:h,maskSettings:f}),(0,i.jsx)(R,{pane:"current",label:"Current",point:s,sequence:m,orientation:h,maskSettings:f})]}):(0,i.jsx)(H,{current:s,comparison:c,lesionLabels:o})]})}function L(e){let{mode:t,active:n,onSelect:l,children:a}=e;return(0,i.jsx)("button",{type:"button",onClick:()=>l(t),className:(0,o.cn)("rounded px-2.5 py-1 text-[11px] transition-colors",n===t?"bg-clinical-700 text-clinical-text":"text-clinical-muted hover:bg-clinical-800"),children:a})}function O(e){let{options:t,value:n,onChange:l}=e;return(0,i.jsx)("div",{className:"flex gap-0.5",children:t.map(e=>(0,i.jsx)("button",{type:"button",onClick:()=>l(e),className:(0,o.cn)("rounded px-2 py-0.5 text-[10px] uppercase tracking-wider transition-colors",n===e?"bg-signal-info/20 text-signal-info":"text-clinical-dim hover:text-clinical-muted"),children:e},e))})}function R(e){var t,n,s,c,d,u;let{pane:x,label:m,point:p,sequence:h,orientation:g,maskSettings:f}=e,[b,v]=(0,a.useState)({state:"idle"}),[y,j]=(0,a.useState)(null),{data:N}=(0,l.I)({queryKey:r.lH.study(null!=(n=null==p?void 0:p.study.id)?n:"none"),queryFn:()=>r.FH.getStudy(p.study.id),enabled:!!p}),w=null==N?void 0:N.series.find(e=>e.sequence===h),_=null!=(s=null==p||null==(t=p.study.quality)?void 0:t.flags)?s:[],k=(null==w?void 0:w.has_file)?(0,r.VX)(w.id):void 0,A=E(k,400),S=E((null==w?void 0:w.has_mask)?(0,r.Fc)(w.id):void 0,400),T=E((null==w?void 0:w.has_mask)?w.id:void 0,400),C=null!==y&&void 0!==w&&y===k;return(0,i.jsxs)("div",{className:"relative flex min-h-0 flex-col bg-clinical-900","data-pane":x,"data-expected-study":null!=(c=null==p?void 0:p.study.id)?c:"","data-expected-series":null!=(d=null==w?void 0:w.id)?d:"","data-showing-correct-study":C?"true":"false",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between gap-2 px-2 py-1 text-[10px]",children:[(0,i.jsx)("span",{className:"uppercase tracking-wider text-clinical-muted",children:m}),(0,i.jsxs)("span",{className:"flex items-center gap-1.5",children:[p&&(null==w?void 0:w.has_file)&&(0,i.jsx)("span",{title:C?"Displaying ".concat(p.study.timepoint_label,", ").concat(h):"Image not yet loaded for this timepoint",className:(0,o.cn)("size-1.5 rounded-full",C?"bg-signal-stable":"bg-signal-uncertain")}),(0,i.jsx)("span",{className:"measurement text-clinical-text",children:null!=(u=null==p?void 0:p.study.timepoint_label)?u:"—"}),(0,i.jsx)("span",{className:"text-clinical-dim",children:p?h:""})]})]}),(0,i.jsxs)("div",{className:"relative min-h-0 flex-1 border-t border-clinical-800",children:[(0,i.jsx)(I,{pane:x,fileUrl:A,orientation:g,mask:{url:S,key:T,visible:f.visible,outlineOnly:f.outlineOnly,opacity:f.opacity},onStatusChange:v,onRenderedChange:j}),!p&&(0,i.jsx)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-clinical-900",children:(0,i.jsx)("p",{className:"text-[11px] text-clinical-dim",children:"No comparison study at this position"})}),p&&!N&&(0,i.jsx)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-clinical-900",children:(0,i.jsx)("p",{className:"text-[10px] text-clinical-dim",children:"loading study"})}),p&&N&&!w&&(0,i.jsx)("div",{className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center bg-clinical-900",children:(0,i.jsxs)("p",{className:"text-[11px] text-signal-uncertain",children:[h," not acquired at this timepoint"]})}),p&&w&&!w.has_file&&(0,i.jsx)("div",{className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center bg-clinical-900",children:(0,i.jsxs)("p",{className:"max-w-[80%] text-center text-[11px] leading-relaxed text-clinical-dim",children:["No imaging data for this series.",(0,i.jsx)("br",{}),(0,i.jsx)("span",{className:"text-[10px]",children:"Metadata only — this patient has no pixel data on disk."})]})}),w&&(0,i.jsx)(F,{study:N,sequence:h,status:b}),_.length>0&&(0,i.jsx)("ul",{className:"pointer-events-none absolute right-2 top-2 max-w-[15rem] space-y-1 text-right",children:_.map(e=>(0,i.jsx)("li",{className:"text-[9px] leading-tight text-signal-uncertain",children:(0,o.Wt)(e)},e))})]})]})}function F(e){let{study:t,sequence:n,status:l}=e,a=null==t?void 0:t.series.find(e=>e.sequence===n);if(!a)return null;let s=a.voxel_spacing_mm;return(0,i.jsxs)("dl",{className:"pointer-events-none absolute bottom-2 left-2 space-y-0.5 text-[9px] text-clinical-dim",children:[(0,i.jsxs)("div",{className:"measurement",children:[a.columns,"\xd7",a.rows,"\xd7",a.slice_count,"ready"===l.state&&" \xb7 ".concat(l.slices," slices loaded")]}),s&&(0,i.jsxs)("div",{className:"measurement",children:[s.map(e=>e.toFixed(2)).join(" \xd7 ")," mm"]}),(0,i.jsxs)("div",{className:"measurement",children:[a.field_strength_t?"".concat(a.field_strength_t," T"):"field strength unknown",a.manufacturer?" \xb7 ".concat(a.manufacturer.trim()):"",a.scanner_model?" ".concat(a.scanner_model.trim()):""]})]})}let D=["MATCH_UNCERTAIN","WEAK_SCORE","AMBIGUOUS_ALTERNATIVE"];function q(e,t){let n=e.measurements.find(e=>e.kind===t);return n?n.value:null}function P(e,t){return e?e.observations.filter(e=>e.has_mesh).map(e=>{var n,i;return{observationId:e.id,lesionId:e.lesion_id,lesionLabel:e.lesion_id&&null!=(n=t.get(e.lesion_id))?n:"—",relativeChange:q(e,"VOLUME_CHANGE_REL"),correspondenceDoubtful:e.quality_flags.some(e=>D.includes(e)),volumeCm3:null!=(i=q(e,"VOLUME"))?i:0}}):[]}function H(e){var t,n,s,c;let{current:u,comparison:x,lesionLabels:m}=e,{selectedLesionId:p,selectLesion:h}=d(),[g,f]=(0,a.useState)(!0),b=P(u,m),v=P(x,m),{data:y}=(0,l.I)({queryKey:r.lH.segmentations(null!=(n=null==u?void 0:u.study.id)?n:"none"),queryFn:()=>r.FH.listStudySegmentations(u.study.id),enabled:!!u}),j=null!=(s=null==y||null==(t=y.find(e=>e.has_mesh))?void 0:t.id)?s:null;return(0,i.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,i.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-clinical-800 px-2 py-1 text-[10px]",children:[(0,i.jsx)("span",{className:"uppercase tracking-wider text-clinical-muted",children:"3D evolution"}),(0,i.jsx)("span",{className:"measurement text-clinical-text",children:null!=(c=null==u?void 0:u.study.timepoint_label)?c:"—"}),(0,i.jsx)("button",{type:"button",onClick:()=>f(e=>!e),disabled:0===v.length,title:0===v.length?"No comparison surfaces at this position":"Show the comparison timepoint as an outline",className:(0,o.cn)("rounded px-2 py-0.5 uppercase tracking-wider transition-colors",0===v.length?"text-clinical-700":g?"bg-signal-info/20 text-signal-info":"text-clinical-dim hover:text-clinical-muted"),children:"prior outline"}),(0,i.jsx)("span",{className:"ml-auto text-[9px] text-clinical-dim",children:x?"compared against ".concat(x.study.timepoint_label):"baseline — nothing to compare against"})]}),(0,i.jsx)(S,{current:b,prior:v,showPrior:g&&v.length>0,selectedLesionId:p,onSelectLesion:h,brainSegmentationId:j})]})}function V(){var e,t;let{patientId:n,setPatient:s,timepointIndex:c,comparisonIndex:o}=d(),{data:u,isLoading:m,error:p}=(0,l.I)({queryKey:r.lH.patients,queryFn:()=>r.FH.listPatients(500)});(0,a.useEffect)(()=>{!n&&(null==u?void 0:u.length)&&s([...u].sort((e,t)=>t.study_count-e.study_count)[0].id)},[n,u,s]);let{data:h,isLoading:f}=(0,l.I)({queryKey:r.lH.timeline(null!=n?n:"none"),queryFn:()=>r.FH.getTimeline(n),enabled:!!n}),N=null!=(e=null==h?void 0:h.points)?e:[],w=N[c],_=null!=o?N[o]:c>0?N[c-1]:void 0,E=(0,a.useMemo)(()=>{var e;return new Map((null!=(e=null==h?void 0:h.lesions)?e:[]).map(e=>[e.id,e.label]))},[null==h?void 0:h.lesions]);return(0,i.jsxs)("main",{className:"flex h-screen flex-col overflow-hidden",children:[(0,i.jsx)(b,{patient:null==h?void 0:h.patient,selector:u&&u.length>0?(0,i.jsx)(v,{patients:u,selectedId:n,onSelect:s}):null}),p?(0,i.jsx)(G,{title:"Cannot reach the API",detail:"Start the backend with: make api"}):m||f?(0,i.jsx)(G,{title:"Loading patient"}):0===N.length?(0,i.jsx)(G,{title:"No patients",detail:"Seed the demonstration patient with: make seed"}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"flex min-h-0 flex-1",children:[(0,i.jsx)(y,{points:N}),(0,i.jsx)(M,{current:w,comparison:_,lesionLabels:E}),(0,i.jsx)(g,{point:w,lesions:null!=(t=null==h?void 0:h.lesions)?t:[]})]}),(0,i.jsx)(j,{points:N}),n&&(0,i.jsx)(x,{patientId:n})]})]})}function G(e){let{title:t,detail:n}=e;return(0,i.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2",children:[(0,i.jsx)("p",{className:"text-sm text-clinical-muted",children:t}),n&&(0,i.jsx)("code",{className:"text-[11px] text-clinical-dim",children:n})]})}},55545:(e,t,n)=>{"use strict";n.d(t,{Jv:()=>d,S5:()=>x,Tu:()=>o,Wt:()=>c,cn:()=>a,s8:()=>u,uA:()=>r,vy:()=>m});var i=n(2821),l=n(75889);function a(){for(var e=arguments.length,t=Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];return t.includes("WITHIN_TREATMENT_WINDOW")||t.includes("REGISTRATION_UNCERTAINTY")||t.includes("DIFFERENT_PROTOCOL_FROM_PRIOR")?"text-signal-uncertain":e>=.25?"text-signal-concern":e>=.1?"text-signal-change":e<=-.1?"text-signal-stable":"text-clinical-text"}function d(e){return null===e?"text-clinical-dim":e>=.85?"text-signal-stable":e>=.7?"text-signal-uncertain":"text-signal-concern"}function u(e){let{value:t,unit:n,uncertainty:i}=e;if("ratio"===n)return"".concat(t>=0?"+":"").concat((100*t).toFixed(1),"%");let l=Math.abs(t)>=100?0:1,a="".concat(t.toFixed(l)," ").concat(function(e){switch(e){case"cm3":return"cm\xb3";case"mm3":return"mm\xb3";case"cm3/month":return"cm\xb3/month";default:return e}}(n));return i?"".concat(a," \xb1 ").concat(i.toFixed(l)):a}function x(e,t){return null==e?void 0:e.measurements.find(e=>e.kind===t)}function m(e){if(null===e)return"interval unknown";if(e<14)return"".concat(e," d");let t=Math.round(e/7);return t<9?"".concat(t," wk"):"".concat((e/30.44).toFixed(1)," mo")}},59750:(e,t,n)=>{Promise.resolve().then(n.bind(n,51920))},67161:(e,t,n)=>{"use strict";n.d(t,{hD:()=>r,FH:()=>f,V$:()=>g,s4:()=>p,lH:()=>b,VX:()=>u,Fc:()=>x});var i=n(83846),l=n(35623);let a="https://huggingface.co/datasets/AIOmarRehan/medtrace-rhuh-gbm-derived/resolve/main";function s(e,t,n){return"".concat(a,"/").concat(e,"/").concat(t).concat(n)}let c={seriesFile:e=>s("images",e,".nii.gz"),seriesMask:e=>s("masks",e,".nii.gz"),segmentationVolume:e=>s("volumes",e,".nii.gz"),observationMesh:e=>s("meshes",e,".ply")};class r extends Error{constructor(e,t){super(e),this.status=t,this.name="ApiError"}}async function o(e,t){var n;let i=await fetch(e,{headers:{Accept:"application/json"},cache:"no-store"});if(!i.ok)throw new r("Recorded response for ".concat(t," is missing (").concat(i.status,")"),i.status);let l=await i.json();if("object"==typeof l&&null!==l&&"number"==typeof l.__recorded_status)throw new r(null!=(n=l.detail)?n:"Request to ".concat(t," failed with ").concat(l.__recorded_status),l.__recorded_status);return l}async function d(e,t){{let t=function(e){let[t]=e.split("?");if("/health"===t)return"".concat("api","/health.json");if("/api/v1/patients"===t)return"".concat("api","/patients.json");let n=t.match(/^\/api\/v1\/patients\/([^/]+)\/timeline$/);if(n)return"".concat("api","/timeline/").concat(n[1],".json");let i=t.match(/^\/api\/v1\/patients\/([^/]+)\/ai-observations$/);if(i)return"".concat("api","/ai-observations/").concat(i[1],".json");let l=t.match(/^\/api\/v1\/studies\/([^/]+)\/segmentations$/);if(l)return"".concat("api","/segmentations/").concat(l[1],".json");let a=t.match(/^\/api\/v1\/studies\/([^/]+)$/);if(a)return"".concat("api","/study/").concat(a[1],".json");let s=t.match(/^\/api\/v1\/lesions\/([^/]+)$/);return s?"".concat("api","/lesion/").concat(s[1],".json"):null}(e);if(null===t)throw new r("No recorded response for ".concat(e),501);return o(t,e)}}function u(e){return c.seriesFile(e)}function x(e){return c.seriesMask(e)}let m=new Map;function p(e){var t=c.observationMesh(e);let n=m.get(t);if(n)return n;let i=fetch(t).then(async e=>{if(!e.ok)throw new r("Mesh request failed with ".concat(e.status),e.status);return(0,l.V)(await e.arrayBuffer())}).catch(e=>{throw m.delete(t),e});return m.set(t,i),i}let h=new Map;function g(e){let t=c.segmentationVolume(e),n=h.get(t);if(n)return n;let l=fetch(t).then(async e=>{if(!e.ok)throw new r("Volume request failed with ".concat(e.status),e.status);return(0,i.uh)(await (0,i.gV)(await e.arrayBuffer()))}).catch(e=>{throw h.delete(t),e});return h.set(t,l),l}let f={health:()=>d("/health"),listPatients:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;return d("/api/v1/patients?limit=".concat(e))},getTimeline:e=>d("/api/v1/patients/".concat(e,"/timeline")),getStudy:e=>d("/api/v1/studies/".concat(e)),getLesion:e=>d("/api/v1/lesions/".concat(e)),listAIObservations:e=>d("/api/v1/patients/".concat(e,"/ai-observations")),askAIObservation:(e,t)=>o(function(e,t,n,i){return"".concat("api","/answers/").concat(e,"/").concat(t,"/").concat(null!=n?n:"none","/").concat(null!=i?i:"none",".json")}(e,t.question,t.study_id,t.lesion_id),"".concat(t.question," for ").concat(e)),listStudySegmentations:e=>d("/api/v1/studies/".concat(e,"/segmentations"))},b={health:["health"],patients:["patients"],timeline:e=>["timeline",e],study:e=>["study",e],lesion:e=>["lesion",e],aiObservations:e=>["ai-observations",e],segmentations:e=>["segmentations",e]}},83846:(e,t,n)=>{"use strict";n.d(t,{GX:()=>a,gV:()=>i,uh:()=>l});async function i(e){let t=new Uint8Array(e,0,Math.min(2,e.byteLength));if(t.length<2||31!==t[0]||139!==t[1])return e;if("undefined"==typeof DecompressionStream)throw Error("Volume arrived gzip-compressed and this browser has no DecompressionStream to inflate it");return new Response(new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip"))).arrayBuffer()}function l(e){if(e.byteLength<348)throw Error("Mask is only ".concat(e.byteLength," bytes; not a NIfTI file"));let t=new DataView(e),n=!0;if(348!==t.getInt32(0,!0))if(348===t.getInt32(0,!1))n=!1;else throw Error("Mask header is not a NIfTI-1 header");let i=t.getInt16(40,n);if(i<3)throw Error("Mask has rank ".concat(i,"; a 3D volume is required"));let l=[t.getInt16(42,n),t.getInt16(44,n),t.getInt16(46,n)];if(l.some(e=>e<=0))throw Error("Mask has invalid dimensions ".concat(l.join("x")));let a=t.getInt16(70,n);if(2!==a)throw Error("Mask datatype is ".concat(a,", expected ").concat(2," (uint8). Regenerate it with link_series_masks.py"));let s=Math.round(t.getFloat32(108,n))||352,c=l[0]*l[1]*l[2],r=e.byteLength-s;if(rNumber.isFinite(e)&&e>0?e:1)}}function a(e){let t=l(e),n=new Set,i=0;for(let e=0;ee-t),labelledVoxels:i}}},85330:(e,t,n)=>{"use strict";n.d(t,{AV:()=>h,B:()=>c,Cn:()=>m,Iy:()=>p,bh:()=>o,dp:()=>v,eW:()=>r,kl:()=>b,ml:()=>g,o:()=>x,zE:()=>u});var i=n(70192),l=n(20205),a=n(83846);let{D_:s}=l.fX,c={1:[255,92,92,255],2:[110,200,255,255],3:[250,214,120,255]},r={1:"enhancing",2:"necrotic core",3:"oedema"};function o(e){return"seg-".concat(e)}let d=new Map;async function u(e,t,n){var l;let s=d.get(n);if(s&&i.PP.getVolume(n))return s;let c=await fetch(e);if(!c.ok)throw Error("Mask request failed with ".concat(c.status));let r=(0,a.GX)(await (0,a.gV)(await c.arrayBuffer())),o=i.PP.getVolume(t);if(!o)throw Error("Image volume is not loaded, so no labelmap can be aligned to it");let u=null!=(l=o.dimensions)?l:[];if(3===u.length&&!r.dimensions.every((e,t)=>e===u[t]))throw Error("Mask grid ".concat(r.dimensions.join("x")," does not match the image ")+"".concat(u.join("x")));let x=i.UH.createAndCacheDerivedLabelmapVolume(t,{volumeId:n}).voxelManager;if(!(null==x?void 0:x.setAtIndex))throw Error("Labelmap has no writable voxel manager");for(let e=0;ee.referencedId===t||e.uid===t)}async function b(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4e3,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:16,l=Date.now()+n;for(;Date.now()setTimeout(e,i))}return f(e,t)}function v(e,t){try{l.b2.removeSegmentationRepresentations(e,{segmentationId:t,type:s.Labelmap})}catch(e){}}}},e=>{e.O(0,[977,658,141,156,441,255,358],()=>e(e.s=59750)),_N_E=e.O()}]); \ No newline at end of file diff --git a/_next/static/chunks/app/page-95b07fc08ebfaa5d.js b/_next/static/chunks/app/page-95b07fc08ebfaa5d.js new file mode 100644 index 0000000000000000000000000000000000000000..2cc28167ddc5ff2f6601c19bf2594d647f8133a1 --- /dev/null +++ b/_next/static/chunks/app/page-95b07fc08ebfaa5d.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[694,974],{35623:(e,t,n)=>{"use strict";n.d(t,{V:()=>l,z:()=>s});let i="end_header\n";function l(e){let t,n=new Uint8Array(e),l=new TextDecoder("ascii").decode(n.subarray(0,Math.min(4096,n.length))),s=l.indexOf(i);if(-1===s)throw Error("Not a PLY: no header terminator in the first 4 KB");let c=l.slice(0,s);if(!c.includes("format binary_little_endian 1.0"))throw Error("Unsupported PLY: expected binary little-endian");let r=a(c,"element vertex"),o=a(c,"element face"),d=function(e){let t=e.split("\n").find(e=>e.startsWith("comment spacing_mm"));if(!t)throw Error("PLY header has no spacing comment");let n=t.trim().split(/\s+/).slice(2,5).map(Number);if(3!==n.length||n.some(e=>!Number.isFinite(e)))throw Error("PLY header has a bad spacing comment");return[n[0],n[1],n[2]]}(c),u=c.includes("property float nx"),x=u?6:3,m=s+i.length,p=r*x*4,h=p+13*o,g=n.length-m;if(g!==h)throw Error("PLY body is ".concat(g," bytes, expected ").concat(h," (truncated or unexpected layout)"));let f=new Float32Array(r*x);new Uint8Array(f.buffer).set(n.subarray(m,m+p));let b=null;if(u){t=new Float32Array(3*r),b=new Float32Array(3*r);for(let e=0;el&&(l=r),o>a&&(a=o),d>s&&(s=d)}return[t,n,i,l,a,s]}(t)}}function a(e,t){let n=e.split("\n").find(e=>e.startsWith(t));if(!n)throw Error("PLY header has no '".concat(t,"'"));let i=Number(n.trim().split(/\s+/).at(-1));if(!Number.isInteger(i)||i<0)throw Error("PLY header has a bad count for '".concat(t,"'"));return i}function s(e){let t=e.filter(e=>e.some(e=>0!==e));return 0===t.length?null:t.reduce((e,t)=>[Math.min(e[0],t[0]),Math.min(e[1],t[1]),Math.min(e[2],t[2]),Math.max(e[3],t[3]),Math.max(e[4],t[4]),Math.max(e[5],t[5])])}},41234:()=>{},51920:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>V});var i=n(95155),l=n(22454),a=n(12115),s=n(99776),c=n(80549),r=n(67161),o=n(55545);let d=(0,n(25959).v)(e=>({patientId:null,timepointIndex:0,comparisonIndex:null,selectedLesionId:null,viewMode:"COMPARE_2D",evidencePanelOpen:!1,activeEvidenceId:null,setPatient:t=>e({patientId:t,timepointIndex:0,comparisonIndex:null,selectedLesionId:null,activeEvidenceId:null}),setTimepointIndex:t=>e({timepointIndex:t}),stepTimepoint:(t,n)=>e(e=>({timepointIndex:Math.min(Math.max(e.timepointIndex+t,0),n)})),setComparisonIndex:t=>e({comparisonIndex:t}),selectLesion:t=>e({selectedLesionId:t}),setViewMode:t=>e({viewMode:t}),showEvidence:t=>e({activeEvidenceId:t,evidencePanelOpen:!0}),closeEvidence:()=>e({evidencePanelOpen:!1,activeEvidenceId:null})})),u=[{question:"WHAT_CHANGED",label:"what changed"},{question:"LARGEST_CHANGE",label:"largest change"},{question:"WHEN_LARGEST_CHANGE",label:"when"},{question:"WHAT_REMAINED_STABLE",label:"what was stable"},{question:"EVIDENCE_FOR_FINDING",label:"why this lesion",needsLesion:!0}];function x(e){var t,n,x,g;let{patientId:f}=e,{activeEvidenceId:b,selectedLesionId:v,timepointIndex:y,showEvidence:j}=d(),N=(0,s.jE)(),[w,_]=(0,a.useState)(null),[E,I]=(0,a.useState)(null),[k,A]=(0,a.useState)(!1),{data:S,isLoading:T}=(0,l.I)({queryKey:r.lH.aiObservations(f),queryFn:()=>r.FH.listAIObservations(f)}),{data:C}=(0,l.I)({queryKey:r.lH.timeline(f),queryFn:()=>r.FH.getTimeline(f)}),M=(0,c.n)({mutationFn:e=>{var t;return r.FH.askAIObservation(f,{question:e,study_id:null==C||null==(t=C.points[y])?void 0:t.study.id,lesion_id:"EVIDENCE_FOR_FINDING"===e&&null!=v?v:void 0})},onMutate:()=>{I(null)},onSuccess:e=>{_(e.observation),j(null),N.invalidateQueries({queryKey:r.lH.aiObservations(f)})},onError:e=>{I(e instanceof r.hD?e.message:"The evidence engine could not be reached.")}}),L=null!=(t=null!=w?w:null==S?void 0:S[0])?t:null,O=null==L?void 0:L.evidence_items.find(e=>e.id===b);return(0,i.jsxs)("section",{className:"shrink-0 border-t border-clinical-700 bg-clinical-800 px-4 py-2","data-testid":"evidence-panel","data-answer-id":null!=(n=null==L?void 0:L.id)?n:"","data-evidence-count":null!=(x=null==L?void 0:L.evidence_items.length)?x:0,"data-safety-status":null!=(g=null==L?void 0:L.safety_status)?g:"","data-collapsed":k,children:[(0,i.jsxs)("div",{className:"mb-1.5 flex flex-wrap items-baseline gap-x-3 gap-y-1",children:[(0,i.jsx)("h2",{className:"text-[10px] font-semibold uppercase tracking-[0.15em] text-signal-ai",children:"AI evidence"}),(0,i.jsx)("ul",{className:"flex flex-wrap gap-1",children:u.map(e=>{let{question:t,label:n,needsLesion:l}=e,a=l&&!v;return(0,i.jsx)("li",{children:(0,i.jsx)("button",{type:"button",disabled:M.isPending||a,onClick:()=>M.mutate(t),"data-testid":"ask-".concat(t),title:a?"Select a lesion first — this question is about one lesion":"Ask: ".concat(n),className:(0,o.cn)("rounded border px-2 py-0.5 text-[10px] transition-colors","border-clinical-600 text-clinical-muted",!a&&!M.isPending&&"hover:border-signal-ai/60 hover:text-clinical-text",(a||M.isPending)&&"cursor-not-allowed opacity-40"),children:n})},t)})}),L&&(0,i.jsx)(m,{observation:L,pending:M.isPending}),(0,i.jsx)("button",{type:"button",onClick:()=>A(e=>!e),"aria-expanded":!k,"aria-controls":"evidence-body","aria-label":k?"Expand the AI evidence panel":"Shrink the AI evidence panel",title:k?"Expand — give the evidence more room":"Shrink — give the images more room","data-testid":"evidence-resize",className:"ml-auto rounded border border-clinical-600 px-1.5 py-0.5 text-[11px] leading-none text-clinical-muted transition-colors hover:border-signal-ai/60 hover:text-clinical-text",children:(0,i.jsx)("span",{"aria-hidden":!0,children:k?"⤢":"\xd7"})})]}),(0,i.jsxs)("div",{id:"evidence-body","data-testid":"evidence-body",className:(0,o.cn)(k&&"max-h-20 overflow-y-auto pr-1"),children:[M.isPending?(0,i.jsx)("p",{className:"text-[11px] text-clinical-dim",children:"Assembling findings…"}):E?(0,i.jsx)("p",{className:"text-[11px] leading-relaxed text-signal-concern","data-testid":"evidence-refusal",children:E}):T?(0,i.jsx)("p",{className:"text-[11px] text-clinical-dim",children:"Loading…"}):L?(0,i.jsx)(p,{observation:L,onSelectEvidence:j,activeId:b}):(0,i.jsx)("p",{className:"text-[11px] text-clinical-dim",children:"Ask one of the five questions above. Answers are generated from the measurements on this timeline, never from the images directly."}),O&&(0,i.jsx)(h,{item:O,timeline:C})]})]})}function m(e){let{observation:t,pending:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"text-[9px] text-clinical-dim",children:"none"===t.llm_provider?"composed from findings":"".concat(t.llm_model)}),null!=t.confidence&&(0,i.jsxs)("span",{className:(0,o.cn)("measurement text-[9px]",(0,o.Jv)(t.confidence)),"data-testid":"answer-confidence",children:[(100*t.confidence).toFixed(0),"% confidence"]}),"PASSED"!==t.safety_status&&(0,i.jsxs)("span",{className:"text-[9px] uppercase tracking-wider text-signal-concern",children:["safety: ",t.safety_status.toLowerCase()]}),!n&&(0,i.jsx)("span",{className:"text-[9px] text-clinical-dim",children:new Date(t.created_at).toLocaleString()})]})}function p(e){let{observation:t,onSelectEvidence:n,activeId:l}=e,a=t.safety_notes.filter(e=>e.startsWith("low confidence")||e.startsWith("quality flag"));return(0,i.jsxs)("div",{className:"flex items-start gap-4",children:[(0,i.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,i.jsx)("p",{className:"border-l-2 border-signal-ai/40 pl-3 text-[11px] leading-relaxed text-clinical-text","data-testid":"answer-text",children:t.answer_text}),a.length>0&&(0,i.jsx)("ul",{className:"mt-1 pl-3 text-[9px] leading-relaxed text-signal-caution",children:a.map(e=>(0,i.jsx)("li",{children:e},e))})]}),(0,i.jsx)("ul",{className:"flex shrink-0 flex-wrap gap-1.5","data-testid":"evidence-list",children:t.evidence_items.map(e=>(0,i.jsx)("li",{children:(0,i.jsx)("button",{type:"button",onClick:()=>n(e.id),title:e.label,className:(0,o.cn)("rounded border px-2 py-1 text-[10px] transition-colors",l===e.id?"border-signal-ai bg-signal-ai/15 text-clinical-text":"border-clinical-600 text-clinical-muted hover:border-signal-ai/60 hover:text-clinical-text"),children:function(e){switch(e){case"IMAGE_REGION":return"Image region";case"SEGMENTATION":return"Segmentation";case"MEASUREMENT":return"Measurement";case"PRIOR_STUDY":return"Prior study";case"CLINICAL_EVENT":return"Clinical event";case"QUALITY_FINDING":return"Quality finding";default:return e}}(e.kind)})},e.id))})]})}function h(e){var t;let{item:n,timeline:l}=e,{closeEvidence:a,setTimepointIndex:s,selectLesion:c}=d(),r="string"==typeof n.locator.study_id?n.locator.study_id:null,o="string"==typeof n.locator.lesion_id?n.locator.lesion_id:null,u=r&&null!=(t=null==l?void 0:l.points.findIndex(e=>e.study.id===r))?t:-1;return(0,i.jsxs)("div",{className:"mt-2 flex items-start justify-between gap-4 rounded border border-signal-ai/30 bg-clinical-850 px-3 py-2",children:[(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("p",{className:"text-[11px] text-clinical-text",children:n.label}),Object.keys(n.locator).length>0&&(0,i.jsx)("p",{className:"measurement mt-0.5 text-[9px] text-clinical-dim",children:Object.entries(n.locator).filter(e=>{let[,t]=e;return null!==t}).map(e=>{let[t,n]=e;return"".concat(t,": ").concat(JSON.stringify(n))}).join(" \xb7 ")})]}),(0,i.jsxs)("div",{className:"flex shrink-0 items-center gap-3",children:[(u>=0||null!==o)&&(0,i.jsx)("button",{type:"button","data-testid":"evidence-navigate",onClick:()=>{u>=0&&s(u),o&&c(o)},className:"rounded border border-signal-ai/50 px-2 py-1 text-[10px] text-clinical-text transition-colors hover:bg-signal-ai/15",children:"show me"}),(0,i.jsx)("button",{type:"button",onClick:a,className:"text-[10px] text-clinical-muted hover:text-clinical-text",children:"close"})]})]})}function g(e){var t;let{point:n,lesions:l}=e,{selectedLesionId:a,selectLesion:s}=d(),c=null!=(t=null==n?void 0:n.observations)?t:[];return(0,i.jsxs)("aside",{className:"flex w-72 shrink-0 flex-col border-l border-clinical-700 bg-clinical-850",children:[(0,i.jsx)("div",{className:"border-b border-clinical-700 px-3 py-2",children:(0,i.jsx)("h2",{className:"text-[10px] font-semibold uppercase tracking-[0.15em] text-clinical-muted",children:"Findings"})}),(0,i.jsx)("div",{className:"flex-1 overflow-y-auto",children:0===c.length?(0,i.jsx)("p",{className:"px-3 py-4 text-[11px] text-clinical-dim",children:"No findings recorded at this timepoint."}):(0,i.jsx)("ul",{className:"divide-y divide-clinical-800",children:c.map(e=>{var t,n;let c=l.find(t=>t.id===e.lesion_id),r=(0,o.S5)(e,"VOLUME"),d=(0,o.S5)(e,"LARGEST_DIAMETER"),u=(0,o.S5)(e,"VOLUME_CHANGE_REL"),x=(0,o.S5)(e,"GROWTH_RATE"),m=a===e.lesion_id,p=e.quality_flags.includes("MATCH_UNCERTAIN")||e.quality_flags.includes("WEAK_SCORE")||e.quality_flags.includes("AMBIGUOUS_ALTERNATIVE");return(0,i.jsx)("li",{children:(0,i.jsxs)("button",{type:"button",onClick:()=>s(m?null:e.lesion_id),"data-testid":"finding-row","data-lesion-id":null!=(t=e.lesion_id)?t:"",className:(0,o.cn)("w-full px-3 py-2.5 text-left transition-colors",m?"bg-clinical-750":"hover:bg-clinical-800"),children:[(0,i.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,i.jsx)("span",{className:"measurement text-xs font-semibold text-clinical-text",children:null!=(n=null==c?void 0:c.label)?n:"Lesion"}),(0,i.jsx)("span",{className:"text-[9px] uppercase tracking-wider text-clinical-dim",children:e.compartment.toLowerCase().replaceAll("_"," ")})]}),(null==c?void 0:c.anatomy_region)&&(0,i.jsx)("p",{className:"mt-0.5 text-[10px] text-clinical-muted",children:c.anatomy_region}),(0,i.jsxs)("dl",{className:"mt-2 space-y-1",children:[r&&(0,i.jsx)(f,{label:"Volume",children:(0,i.jsx)("span",{className:"measurement text-clinical-text",children:(0,o.s8)(r)})}),d&&(0,i.jsx)(f,{label:"Diameter",children:(0,i.jsx)("span",{className:"measurement text-clinical-text",children:(0,o.s8)(d)})}),u&&(0,i.jsx)(f,{label:"Change",children:(0,i.jsxs)("span",{className:(0,o.cn)("measurement",p?"text-clinical-dim line-through decoration-clinical-500/60":(0,o.Tu)(u.value,e.quality_flags)),title:p?"This lesion may not be the same one measured previously, so the change may compare two different findings.":void 0,children:[(0,o.s8)(u),(0,i.jsxs)("span",{className:"ml-1 text-clinical-dim",children:["/ ",(0,o.vy)(e.interval_days)]})]})}),x&&(0,i.jsx)(f,{label:"Rate",children:(0,i.jsx)("span",{className:"measurement text-clinical-muted",children:(0,o.s8)(x)})}),(0,i.jsx)(f,{label:"Confidence",children:(0,i.jsx)("span",{className:(0,o.cn)("measurement",(0,o.Jv)(e.confidence)),children:null!=e.confidence?"".concat((100*e.confidence).toFixed(0),"%"):"—"})})]}),p&&u&&(0,i.jsx)("p",{className:"mt-2 border-l-2 border-signal-uncertain/60 pl-2 text-[9px] leading-tight text-signal-uncertain",children:"This may not be the same lesion as before. Treat the change with caution."}),e.quality_flags.length>0&&(0,i.jsx)("ul",{className:"mt-2 space-y-0.5 border-t border-clinical-800 pt-2",children:e.quality_flags.map(e=>(0,i.jsx)("li",{className:"text-[9px] leading-tight text-signal-uncertain",children:(0,o.Wt)(e)},e))})]})},e.id)})})}),(0,i.jsx)("p",{className:"border-t border-clinical-700 px-3 py-2 text-[9px] leading-snug text-clinical-dim",children:"Measured change only. MEDTRACE does not assess tumour progression or treatment response."})]})}function f(e){let{label:t,children:n}=e;return(0,i.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,i.jsx)("dt",{className:"text-[10px] text-clinical-muted",children:t}),(0,i.jsx)("dd",{className:"text-[11px]",children:n})]})}function b(e){var t,n;let{patient:a,selector:s}=e,{data:c}=(0,l.I)({queryKey:r.lH.health,queryFn:r.FH.health,refetchInterval:3e4}),d=(null==c?void 0:c.status)==="ok";return(0,i.jsxs)("header",{className:"flex shrink-0 items-center gap-4 border-b border-clinical-700 bg-clinical-850 px-4 py-2",children:[(0,i.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,i.jsx)("span",{className:"text-sm font-semibold tracking-[0.2em] text-clinical-text",children:"MEDTRACE"}),(0,i.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-clinical-dim",children:"research prototype"})]}),(0,i.jsx)("div",{className:"h-4 w-px bg-clinical-700"}),s,a?(0,i.jsxs)("div",{className:"flex items-center gap-3 text-xs",children:[(0,i.jsxs)("span",{className:"text-clinical-muted",children:[null!=(t=a.sex)?t:"—",a.age_at_baseline_years?", ".concat(a.age_at_baseline_years," y"):""]}),(0,i.jsxs)("span",{className:"text-clinical-dim",children:[a.study_count," studies \xb7 ",a.lesion_count," lesions"]}),a.is_synthetic&&(0,i.jsx)("span",{className:"rounded border border-signal-uncertain/50 bg-signal-uncertain/10 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-signal-uncertain",children:"synthetic"})]}):(0,i.jsx)("span",{className:"text-xs text-clinical-dim",children:"No patient selected"}),(0,i.jsxs)("div",{className:"ml-auto flex items-center gap-4",children:[(0,i.jsx)("p",{className:"max-w-md text-right text-[10px] leading-tight text-clinical-dim",children:"Not for diagnosis or treatment. All clinical decisions remain with qualified healthcare professionals."}),(0,i.jsxs)("div",{className:"flex items-center gap-1.5",title:(n=c)?n.services.map(e=>"".concat(e.name,": ").concat(e.healthy?"ok":"unavailable")).join("\n"):"Checking services",children:[(0,i.jsx)("span",{className:(0,o.cn)("size-1.5 rounded-full",d?"bg-signal-stable":"bg-signal-concern")}),(0,i.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-clinical-dim",children:c?d?"services ok":"degraded":"checking"})]})]})]})}function v(e){var t;let{patients:n,selectedId:l,onSelect:s}=e,[c,r]=(0,a.useState)(!1),[d,u]=(0,a.useState)(""),x=(0,a.useMemo)(()=>[...n].sort((e,t)=>t.study_count-e.study_count),[n]),m=(0,a.useMemo)(()=>{let e=d.trim().toLowerCase();return e?x.filter(t=>t.external_id.toLowerCase().includes(e)||t.source_dataset.toLowerCase().includes(e)):x},[x,d]),p=n.find(e=>e.id===l);return(0,i.jsxs)("div",{className:"relative",children:[(0,i.jsxs)("button",{type:"button",onClick:()=>r(e=>!e),className:"flex items-center gap-2 rounded border border-clinical-600 px-2 py-1 text-[11px] text-clinical-text transition-colors hover:border-clinical-500",children:[(0,i.jsx)("span",{className:"measurement",children:null!=(t=null==p?void 0:p.external_id)?t:"Select patient"}),(0,i.jsx)("span",{className:"text-clinical-dim",children:c?"▲":"▼"})]}),c&&(0,i.jsxs)("div",{className:"absolute left-0 top-full z-50 mt-1 w-80 rounded border border-clinical-600 bg-clinical-850 shadow-xl",children:[(0,i.jsx)("input",{autoFocus:!0,value:d,onChange:e=>u(e.target.value),placeholder:"Filter by id or dataset",className:"w-full border-b border-clinical-700 bg-clinical-900 px-2 py-1.5 text-[11px] text-clinical-text placeholder:text-clinical-dim focus:outline-none"}),(0,i.jsxs)("ul",{className:"max-h-80 overflow-y-auto",children:[m.map(e=>(0,i.jsx)("li",{children:(0,i.jsxs)("button",{type:"button",onClick:()=>{s(e.id),r(!1),u("")},className:(0,o.cn)("flex w-full items-center justify-between gap-2 px-2 py-1.5 text-left text-[11px] transition-colors",e.id===l?"bg-clinical-750 text-clinical-text":"text-clinical-muted hover:bg-clinical-800"),children:[(0,i.jsx)("span",{className:"measurement",children:e.external_id}),(0,i.jsxs)("span",{className:"flex items-center gap-2 text-[9px] text-clinical-dim",children:[(0,i.jsxs)("span",{children:[e.study_count," studies"]}),(0,i.jsx)("span",{className:"uppercase tracking-wider",children:"BRATS2023_GLI"===e.source_dataset?"BraTS":e.source_dataset.toLowerCase()}),e.is_synthetic&&(0,i.jsx)("span",{className:"text-signal-uncertain",children:"synthetic"})]})]})},e.id)),0===m.length&&(0,i.jsx)("li",{className:"px-2 py-3 text-[11px] text-clinical-dim",children:"No match"})]}),(0,i.jsxs)("p",{className:"border-t border-clinical-700 px-2 py-1.5 text-[9px] text-clinical-dim",children:[n.length," patients \xb7 sorted by number of timepoints"]})]})]})}function y(e){let{points:t}=e,{timepointIndex:n,comparisonIndex:l,setTimepointIndex:a,setComparisonIndex:s}=d(),c=null!=l?l:n>0?n-1:null;return(0,i.jsxs)("aside",{className:"flex w-52 shrink-0 flex-col border-r border-clinical-700 bg-clinical-850",children:[(0,i.jsx)("div",{className:"border-b border-clinical-700 px-3 py-2",children:(0,i.jsx)("h2",{className:"text-[10px] font-semibold uppercase tracking-[0.15em] text-clinical-muted",children:"Studies"})}),(0,i.jsx)("ol",{className:"flex-1 overflow-y-auto",children:t.map((e,t)=>{var l,r;let d=t===n,u=e.study.quality,x=null!=(l=null==u?void 0:u.flags.length)?l:0;return(0,i.jsx)("li",{children:(0,i.jsxs)("button",{type:"button",onClick:()=>a(t),onContextMenu:e=>{e.preventDefault(),s(t===n?null:t)},"aria-current":d?"true":void 0,className:(0,o.cn)("flex w-full flex-col gap-1 border-l-2 px-3 py-2 text-left transition-colors",d?"border-l-signal-info bg-clinical-750":"border-l-transparent hover:bg-clinical-800"),children:[(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsx)("span",{className:"measurement text-xs text-clinical-text",children:e.study.timepoint_label}),e.study.is_reference&&(0,i.jsx)("span",{className:"text-[9px] uppercase tracking-wider text-clinical-dim",title:"Reference study — others are registered onto this one",children:"ref"})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2 text-[10px]",children:[(0,i.jsx)("span",{className:(0,o.uA)(null==u?void 0:u.status),children:null!=(r=null==u?void 0:u.status.toLowerCase())?r:"not assessed"}),(null==u?void 0:u.confidence)!=null&&(0,i.jsxs)("span",{className:"measurement text-clinical-dim",children:[(100*u.confidence).toFixed(0),"%"]})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2 text-[10px] text-clinical-dim",children:[(0,i.jsx)("span",{children:(0,o.vy)(e.study.days_from_baseline)}),e.observations.length>0&&(0,i.jsxs)("span",{children:[e.observations.length," obs"]}),x>0&&(0,i.jsxs)("span",{className:"text-signal-uncertain",children:[x," flag",x>1?"s":""]})]}),t===c&&!d&&(0,i.jsx)("span",{className:"text-[9px] uppercase tracking-wider text-signal-info",children:"comparing against"})]})},e.study.id)})}),(0,i.jsx)("p",{className:"border-t border-clinical-700 px-3 py-2 text-[9px] leading-snug text-clinical-dim",children:"Click to select. Right-click to set the comparison study."})]})}function j(e){var t;let{points:n}=e,{timepointIndex:l,setTimepointIndex:s,stepTimepoint:c}=d(),r=n.length-1;if((0,a.useEffect)(()=>{function e(e){let t=e.target;t&&["INPUT","TEXTAREA"].includes(t.tagName)||("ArrowLeft"===e.key?(e.preventDefault(),c(-1,r)):"ArrowRight"===e.key&&(e.preventDefault(),c(1,r)))}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[c,r]),0===n.length)return null;let u=n.map(e=>{var t;return null!=(t=e.study.days_from_baseline)?t:0}),x=Math.max(...u)||1,m=e=>u[e]/x*100,p=n[l],h=new Set,g=-1/0;for(let e=0;e=6)&&(h.add(e),g=t)}return h.add(l),(0,i.jsxs)("section",{className:"shrink-0 border-t border-clinical-700 bg-clinical-850 px-4 pb-3 pt-2",children:[(0,i.jsxs)("div",{className:"mb-1 flex items-baseline justify-between",children:[(0,i.jsx)("h2",{className:"text-[10px] font-semibold uppercase tracking-[0.15em] text-clinical-muted",children:"Disease timeline"}),(0,i.jsxs)("div",{className:"flex items-center gap-3 text-[10px] text-clinical-dim",children:[(0,i.jsxs)("span",{className:"measurement",children:[null==p?void 0:p.study.timepoint_label," \xb7"," ",(0,o.vy)(null!=(t=null==p?void 0:p.study.days_from_baseline)?t:null)," from baseline"]}),(0,i.jsx)("span",{children:"← → to move"})]})]}),(0,i.jsxs)("div",{className:"relative h-16",children:[(0,i.jsx)("div",{className:"absolute inset-x-0 top-7 h-px bg-clinical-600"}),(0,i.jsx)("div",{className:"absolute top-7 h-px bg-signal-info",style:{width:"".concat(m(l),"%")}}),n.map((e,t)=>{let n=t===l,a=e.study.quality,c=e.events.some(e=>e.is_within_treatment_window),r=e.events.filter(e=>!e.is_within_treatment_window);return(0,i.jsxs)("button",{type:"button",onClick:()=>s(t),"aria-label":"Timepoint ".concat(e.study.timepoint_label),"aria-current":n?"true":void 0,className:"absolute top-0 flex h-16 -translate-x-1/2 flex-col items-center justify-start gap-0.5 px-2",style:{left:"".concat(m(t),"%")},children:[(0,i.jsxs)("span",{className:"flex h-6 items-end gap-0.5",children:[c&&(0,i.jsx)("span",{className:"mb-0.5 size-1.5 rotate-45 bg-signal-uncertain",title:"Within 3 months of radiotherapy — progression cannot be assessed"}),r.map(e=>(0,i.jsx)("span",{className:"mb-0.5 size-1.5 rounded-full bg-clinical-500",title:e.label},e.id))]}),(0,i.jsx)("span",{className:(0,o.cn)("size-2.5 rounded-full border-2 transition-all",n?"scale-125 border-signal-info bg-signal-info":"border-clinical-500 bg-clinical-850")}),h.has(t)&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:(0,o.cn)("measurement mt-0.5 text-[9px] whitespace-nowrap",n?"text-clinical-text":"text-clinical-dim"),children:e.study.timepoint_label.replace("week-","w")}),(0,i.jsx)("span",{className:(0,o.cn)("text-[8px]",(0,o.uA)(null==a?void 0:a.status)),children:(null==a?void 0:a.status)==="READY"?"":null==a?void 0:a.status.toLowerCase()})]})]},e.study.id)})]}),(0,i.jsx)("label",{className:"sr-only",htmlFor:"time-scrubber",children:"Disease timeline position"}),(0,i.jsx)("input",{id:"time-scrubber",type:"range",min:0,max:r,step:1,value:l,onChange:e=>s(Number(e.target.value)),className:"w-full accent-signal-info"}),p&&p.events.length>0&&(0,i.jsx)("ul",{className:"mt-1.5 flex flex-wrap gap-x-4 gap-y-1",children:p.events.map(e=>(0,i.jsxs)("li",{className:(0,o.cn)("text-[10px]",e.is_within_treatment_window?"text-signal-uncertain":"text-clinical-muted"),children:[(0,i.jsx)("span",{className:"uppercase tracking-wider text-clinical-dim",children:e.event_type.toLowerCase().replaceAll("_"," ")})," ",e.label]},e.id))})]})}var N=n(67909),w=n(85330);function _(e){let{settings:t,onChange:n,available:l}=e;return(0,i.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,i.jsx)("button",{type:"button",disabled:!l,onClick:()=>n({...t,visible:!t.visible}),title:l?"Show the tumour segmentation over the image":"No mask aligned to this sequence. Try T1C, or see the 3D view.",className:(0,o.cn)("rounded px-2 py-0.5 text-[10px] uppercase tracking-wider transition-colors",l?t.visible?"bg-signal-info/20 text-signal-info":"text-clinical-dim hover:text-clinical-muted":"text-clinical-700"),children:"mask"}),l&&t.visible&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("button",{type:"button",onClick:()=>n({...t,outlineOnly:!t.outlineOnly}),title:t.outlineOnly?"Outline only — the tissue under the mask stays visible":"Filled — hides the tissue it describes",className:"rounded px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-clinical-dim transition-colors hover:text-clinical-muted",children:t.outlineOnly?"outline":"filled"}),!t.outlineOnly&&(0,i.jsxs)("label",{className:"flex items-center gap-1 text-[9px] text-clinical-dim",children:[(0,i.jsx)("span",{className:"sr-only",children:"Mask opacity"}),(0,i.jsx)("input",{type:"range",min:.1,max:.9,step:.05,value:t.opacity,onChange:e=>n({...t,opacity:Number(e.target.value)}),className:"w-16 accent-signal-info"}),Math.round(100*t.opacity),"%"]}),(0,i.jsx)("span",{className:"flex items-center gap-1.5 pl-1",children:[1,2,3].map(e=>(0,i.jsxs)("span",{className:"flex items-center gap-1 text-[9px]",children:[(0,i.jsx)("span",{className:"size-2 rounded-sm",style:{backgroundColor:"rgb(".concat(w.B[e].slice(0,3).join(","),")")},"aria-hidden":!0}),(0,i.jsx)("span",{className:"text-clinical-dim",children:w.eW[e]})]},e))})]})]})}function E(e,t){let[n,i]=(0,a.useState)(e);return(0,a.useEffect)(()=>{if(e===n)return;let l=setTimeout(()=>i(e),t);return()=>clearTimeout(l)},[e,n,t]),n}let I=(0,N.default)(()=>Promise.all([n.e(987),n.e(178),n.e(199)]).then(n.bind(n,22199)).then(e=>e.NiftiViewport),{loadableGenerated:{webpack:()=>[22199]},ssr:!1,loading:()=>(0,i.jsx)("div",{className:"flex size-full items-center justify-center bg-black",children:(0,i.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-clinical-dim",children:"initialising viewer"})})}),k=(0,N.default)(()=>Promise.all([n.e(987),n.e(178),n.e(534)]).then(n.bind(n,31534)).then(e=>e.ViewerMemory),{loadableGenerated:{webpack:()=>[31534]},ssr:!1}),A=(0,N.default)(()=>Promise.all([n.e(987),n.e(178),n.e(808)]).then(n.bind(n,5808)).then(e=>e.SliceSyncToggle),{loadableGenerated:{webpack:()=>[5808]},ssr:!1}),S=(0,N.default)(()=>Promise.all([n.e(481),n.e(405)]).then(n.bind(n,3405)).then(e=>e.EvolutionViewport),{loadableGenerated:{webpack:()=>[3405]},ssr:!1,loading:()=>(0,i.jsx)("div",{className:"flex min-h-0 flex-1 items-center justify-center bg-clinical-900",children:(0,i.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-clinical-dim",children:"loading 3D renderer"})})}),T=["T1C","T1","T2","FLAIR"],C=["axial","coronal","sagittal"];function M(e){var t,n;let{current:s,comparison:c,lesionLabels:o}=e,{viewMode:u,setViewMode:x}=d(),[m,p]=(0,a.useState)("T1C"),[h,g]=(0,a.useState)("axial"),[f,b]=(0,a.useState)({visible:!0,outlineOnly:!0,opacity:.4}),{data:v}=(0,l.I)({queryKey:r.lH.study(null!=(n=null==s?void 0:s.study.id)?n:"none"),queryFn:()=>r.FH.getStudy(s.study.id),enabled:!!s}),y=!!(null==v||null==(t=v.series.find(e=>e.sequence===m))?void 0:t.has_mask);return(0,i.jsxs)("section",{className:"flex min-w-0 flex-1 flex-col bg-clinical-900",children:[(0,i.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-clinical-700 bg-clinical-850 px-2 py-1.5",children:[(0,i.jsx)(L,{mode:"COMPARE_2D",active:u,onSelect:x,children:"2D comparison"}),(0,i.jsx)(L,{mode:"EVOLUTION_3D",active:u,onSelect:x,children:"3D evolution"}),"COMPARE_2D"===u&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"mx-1 h-4 w-px bg-clinical-700"}),(0,i.jsx)(O,{options:T,value:m,onChange:p}),(0,i.jsx)("span",{className:"mx-1 h-4 w-px bg-clinical-700"}),(0,i.jsx)(O,{options:C,value:h,onChange:g}),(0,i.jsx)("span",{className:"mx-1 h-4 w-px bg-clinical-700"}),(0,i.jsx)(A,{}),(0,i.jsx)("span",{className:"mx-1 h-4 w-px bg-clinical-700"}),(0,i.jsx)(_,{settings:f,onChange:b,available:y}),(0,i.jsx)("span",{className:"ml-auto text-[9px] text-clinical-dim",children:"drag: window/level \xb7 wheel: scroll \xb7 right-drag: zoom \xb7 middle: pan"}),(0,i.jsx)(k,{})]})]}),"COMPARE_2D"===u?(0,i.jsxs)("div",{className:"grid min-h-0 flex-1 grid-cols-2 gap-px bg-clinical-700","data-testid":"viewer-grid",children:[(0,i.jsx)(R,{pane:"prior",label:"Prior",point:c,sequence:m,orientation:h,maskSettings:f}),(0,i.jsx)(R,{pane:"current",label:"Current",point:s,sequence:m,orientation:h,maskSettings:f})]}):(0,i.jsx)(H,{current:s,comparison:c,lesionLabels:o})]})}function L(e){let{mode:t,active:n,onSelect:l,children:a}=e;return(0,i.jsx)("button",{type:"button",onClick:()=>l(t),className:(0,o.cn)("rounded px-2.5 py-1 text-[11px] transition-colors",n===t?"bg-clinical-700 text-clinical-text":"text-clinical-muted hover:bg-clinical-800"),children:a})}function O(e){let{options:t,value:n,onChange:l}=e;return(0,i.jsx)("div",{className:"flex gap-0.5",children:t.map(e=>(0,i.jsx)("button",{type:"button",onClick:()=>l(e),className:(0,o.cn)("rounded px-2 py-0.5 text-[10px] uppercase tracking-wider transition-colors",n===e?"bg-signal-info/20 text-signal-info":"text-clinical-dim hover:text-clinical-muted"),children:e},e))})}function R(e){var t,n,s,c,d,u;let{pane:x,label:m,point:p,sequence:h,orientation:g,maskSettings:f}=e,[b,v]=(0,a.useState)({state:"idle"}),[y,j]=(0,a.useState)(null),{data:N}=(0,l.I)({queryKey:r.lH.study(null!=(n=null==p?void 0:p.study.id)?n:"none"),queryFn:()=>r.FH.getStudy(p.study.id),enabled:!!p}),w=null==N?void 0:N.series.find(e=>e.sequence===h),_=null!=(s=null==p||null==(t=p.study.quality)?void 0:t.flags)?s:[],k=(null==w?void 0:w.has_file)?(0,r.VX)(w.id):void 0,A=E(k,400),S=E((null==w?void 0:w.has_mask)?(0,r.Fc)(w.id):void 0,400),T=E((null==w?void 0:w.has_mask)?w.id:void 0,400),C=null!==y&&void 0!==w&&y===k;return(0,i.jsxs)("div",{className:"relative flex min-h-0 flex-col bg-clinical-900","data-pane":x,"data-expected-study":null!=(c=null==p?void 0:p.study.id)?c:"","data-expected-series":null!=(d=null==w?void 0:w.id)?d:"","data-showing-correct-study":C?"true":"false",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between gap-2 px-2 py-1 text-[10px]",children:[(0,i.jsx)("span",{className:"uppercase tracking-wider text-clinical-muted",children:m}),(0,i.jsxs)("span",{className:"flex items-center gap-1.5",children:[p&&(null==w?void 0:w.has_file)&&(0,i.jsx)("span",{title:C?"Displaying ".concat(p.study.timepoint_label,", ").concat(h):"Image not yet loaded for this timepoint",className:(0,o.cn)("size-1.5 rounded-full",C?"bg-signal-stable":"bg-signal-uncertain")}),(0,i.jsx)("span",{className:"measurement text-clinical-text",children:null!=(u=null==p?void 0:p.study.timepoint_label)?u:"—"}),(0,i.jsx)("span",{className:"text-clinical-dim",children:p?h:""})]})]}),(0,i.jsxs)("div",{className:"relative min-h-0 flex-1 border-t border-clinical-800",children:[(0,i.jsx)(I,{pane:x,fileUrl:A,orientation:g,mask:{url:S,key:T,visible:f.visible,outlineOnly:f.outlineOnly,opacity:f.opacity},onStatusChange:v,onRenderedChange:j}),!p&&(0,i.jsx)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-clinical-900",children:(0,i.jsx)("p",{className:"text-[11px] text-clinical-dim",children:"No comparison study at this position"})}),p&&!N&&(0,i.jsx)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-clinical-900",children:(0,i.jsx)("p",{className:"text-[10px] text-clinical-dim",children:"loading study"})}),p&&N&&!w&&(0,i.jsx)("div",{className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center bg-clinical-900",children:(0,i.jsxs)("p",{className:"text-[11px] text-signal-uncertain",children:[h," not acquired at this timepoint"]})}),p&&w&&!w.has_file&&(0,i.jsx)("div",{className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center bg-clinical-900",children:(0,i.jsxs)("p",{className:"max-w-[80%] text-center text-[11px] leading-relaxed text-clinical-dim",children:["No imaging data for this series.",(0,i.jsx)("br",{}),(0,i.jsx)("span",{className:"text-[10px]",children:"Metadata only — this patient has no pixel data on disk."})]})}),w&&(0,i.jsx)(F,{study:N,sequence:h,status:b}),_.length>0&&(0,i.jsx)("ul",{className:"pointer-events-none absolute right-2 top-2 max-w-[15rem] space-y-1 text-right",children:_.map(e=>(0,i.jsx)("li",{className:"text-[9px] leading-tight text-signal-uncertain",children:(0,o.Wt)(e)},e))})]})]})}function F(e){let{study:t,sequence:n,status:l}=e,a=null==t?void 0:t.series.find(e=>e.sequence===n);if(!a)return null;let s=a.voxel_spacing_mm;return(0,i.jsxs)("dl",{className:"pointer-events-none absolute bottom-2 left-2 space-y-0.5 text-[9px] text-clinical-dim",children:[(0,i.jsxs)("div",{className:"measurement",children:[a.columns,"\xd7",a.rows,"\xd7",a.slice_count,"ready"===l.state&&" \xb7 ".concat(l.slices," slices loaded")]}),s&&(0,i.jsxs)("div",{className:"measurement",children:[s.map(e=>e.toFixed(2)).join(" \xd7 ")," mm"]}),(0,i.jsxs)("div",{className:"measurement",children:[a.field_strength_t?"".concat(a.field_strength_t," T"):"field strength unknown",a.manufacturer?" \xb7 ".concat(a.manufacturer.trim()):"",a.scanner_model?" ".concat(a.scanner_model.trim()):""]})]})}let D=["MATCH_UNCERTAIN","WEAK_SCORE","AMBIGUOUS_ALTERNATIVE"];function q(e,t){let n=e.measurements.find(e=>e.kind===t);return n?n.value:null}function P(e,t){return e?e.observations.filter(e=>e.has_mesh).map(e=>{var n,i;return{observationId:e.id,lesionId:e.lesion_id,lesionLabel:e.lesion_id&&null!=(n=t.get(e.lesion_id))?n:"—",relativeChange:q(e,"VOLUME_CHANGE_REL"),correspondenceDoubtful:e.quality_flags.some(e=>D.includes(e)),volumeCm3:null!=(i=q(e,"VOLUME"))?i:0}}):[]}function H(e){var t,n,s,c;let{current:u,comparison:x,lesionLabels:m}=e,{selectedLesionId:p,selectLesion:h}=d(),[g,f]=(0,a.useState)(!0),b=P(u,m),v=P(x,m),{data:y}=(0,l.I)({queryKey:r.lH.segmentations(null!=(n=null==u?void 0:u.study.id)?n:"none"),queryFn:()=>r.FH.listStudySegmentations(u.study.id),enabled:!!u}),j=null!=(s=null==y||null==(t=y.find(e=>e.has_mesh))?void 0:t.id)?s:null;return(0,i.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,i.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-clinical-800 px-2 py-1 text-[10px]",children:[(0,i.jsx)("span",{className:"uppercase tracking-wider text-clinical-muted",children:"3D evolution"}),(0,i.jsx)("span",{className:"measurement text-clinical-text",children:null!=(c=null==u?void 0:u.study.timepoint_label)?c:"—"}),(0,i.jsx)("button",{type:"button",onClick:()=>f(e=>!e),disabled:0===v.length,title:0===v.length?"No comparison surfaces at this position":"Show the comparison timepoint as an outline",className:(0,o.cn)("rounded px-2 py-0.5 uppercase tracking-wider transition-colors",0===v.length?"text-clinical-700":g?"bg-signal-info/20 text-signal-info":"text-clinical-dim hover:text-clinical-muted"),children:"prior outline"}),(0,i.jsx)("span",{className:"ml-auto text-[9px] text-clinical-dim",children:x?"compared against ".concat(x.study.timepoint_label):"baseline — nothing to compare against"})]}),(0,i.jsx)(S,{current:b,prior:v,showPrior:g&&v.length>0,selectedLesionId:p,onSelectLesion:h,brainSegmentationId:j})]})}function V(){var e,t;let{patientId:n,setPatient:s,timepointIndex:c,comparisonIndex:o}=d(),{data:u,isLoading:m,error:p}=(0,l.I)({queryKey:r.lH.patients,queryFn:()=>r.FH.listPatients(500)});(0,a.useEffect)(()=>{!n&&(null==u?void 0:u.length)&&s([...u].sort((e,t)=>t.study_count-e.study_count)[0].id)},[n,u,s]);let{data:h,isLoading:f}=(0,l.I)({queryKey:r.lH.timeline(null!=n?n:"none"),queryFn:()=>r.FH.getTimeline(n),enabled:!!n}),N=null!=(e=null==h?void 0:h.points)?e:[],w=N[c],_=null!=o?N[o]:c>0?N[c-1]:void 0,E=(0,a.useMemo)(()=>{var e;return new Map((null!=(e=null==h?void 0:h.lesions)?e:[]).map(e=>[e.id,e.label]))},[null==h?void 0:h.lesions]);return(0,i.jsxs)("main",{className:"flex h-screen flex-col overflow-hidden",children:[(0,i.jsx)(b,{patient:null==h?void 0:h.patient,selector:u&&u.length>0?(0,i.jsx)(v,{patients:u,selectedId:n,onSelect:s}):null}),p?(0,i.jsx)(G,{title:"Cannot reach the API",detail:"Start the backend with: make api"}):m||f?(0,i.jsx)(G,{title:"Loading patient"}):0===N.length?(0,i.jsx)(G,{title:"No patients",detail:"Seed the demonstration patient with: make seed"}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"flex min-h-0 flex-1",children:[(0,i.jsx)(y,{points:N}),(0,i.jsx)(M,{current:w,comparison:_,lesionLabels:E}),(0,i.jsx)(g,{point:w,lesions:null!=(t=null==h?void 0:h.lesions)?t:[]})]}),(0,i.jsx)(j,{points:N}),n&&(0,i.jsx)(x,{patientId:n})]})]})}function G(e){let{title:t,detail:n}=e;return(0,i.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2",children:[(0,i.jsx)("p",{className:"text-sm text-clinical-muted",children:t}),n&&(0,i.jsx)("code",{className:"text-[11px] text-clinical-dim",children:n})]})}},55545:(e,t,n)=>{"use strict";n.d(t,{Jv:()=>d,S5:()=>x,Tu:()=>o,Wt:()=>c,cn:()=>a,s8:()=>u,uA:()=>r,vy:()=>m});var i=n(2821),l=n(75889);function a(){for(var e=arguments.length,t=Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];return t.includes("WITHIN_TREATMENT_WINDOW")||t.includes("REGISTRATION_UNCERTAINTY")||t.includes("DIFFERENT_PROTOCOL_FROM_PRIOR")?"text-signal-uncertain":e>=.25?"text-signal-concern":e>=.1?"text-signal-change":e<=-.1?"text-signal-stable":"text-clinical-text"}function d(e){return null===e?"text-clinical-dim":e>=.85?"text-signal-stable":e>=.7?"text-signal-uncertain":"text-signal-concern"}function u(e){let{value:t,unit:n,uncertainty:i}=e;if("ratio"===n)return"".concat(t>=0?"+":"").concat((100*t).toFixed(1),"%");let l=Math.abs(t)>=100?0:1,a="".concat(t.toFixed(l)," ").concat(function(e){switch(e){case"cm3":return"cm\xb3";case"mm3":return"mm\xb3";case"cm3/month":return"cm\xb3/month";default:return e}}(n));return i?"".concat(a," \xb1 ").concat(i.toFixed(l)):a}function x(e,t){return null==e?void 0:e.measurements.find(e=>e.kind===t)}function m(e){if(null===e)return"interval unknown";if(e<14)return"".concat(e," d");let t=Math.round(e/7);return t<9?"".concat(t," wk"):"".concat((e/30.44).toFixed(1)," mo")}},59750:(e,t,n)=>{Promise.resolve().then(n.bind(n,51920))},67161:(e,t,n)=>{"use strict";n.d(t,{hD:()=>r,FH:()=>f,V$:()=>g,s4:()=>p,lH:()=>b,VX:()=>u,Fc:()=>x});var i=n(83846),l=n(35623);let a="https://huggingface.co/datasets/AIOmarRehan/medtrace-rhuh-gbm-derived/resolve/main";function s(e,t,n){return"".concat(a,"/").concat(e,"/").concat(t).concat(n)}let c={seriesFile:e=>s("images",e,".nii.gz"),seriesMask:e=>s("masks",e,".nii.gz"),segmentationVolume:e=>s("volumes",e,".nii.gz"),observationMesh:e=>s("meshes",e,".ply")};class r extends Error{constructor(e,t){super(e),this.status=t,this.name="ApiError"}}async function o(e,t){var n;let i=await fetch(e,{headers:{Accept:"application/json"},cache:"no-store"});if(!i.ok)throw new r("Recorded response for ".concat(t," is missing (").concat(i.status,")"),i.status);let l=await i.json();if("object"==typeof l&&null!==l&&"number"==typeof l.__recorded_status)throw new r(null!=(n=l.detail)?n:"Request to ".concat(t," failed with ").concat(l.__recorded_status),l.__recorded_status);return l}async function d(e,t){{let t=function(e){let[t]=e.split("?");if("/health"===t)return"".concat("api","/health.json");if("/api/v1/patients"===t)return"".concat("api","/patients.json");let n=t.match(/^\/api\/v1\/patients\/([^/]+)\/timeline$/);if(n)return"".concat("api","/timeline/").concat(n[1],".json");let i=t.match(/^\/api\/v1\/patients\/([^/]+)\/ai-observations$/);if(i)return"".concat("api","/ai-observations/").concat(i[1],".json");let l=t.match(/^\/api\/v1\/studies\/([^/]+)\/segmentations$/);if(l)return"".concat("api","/segmentations/").concat(l[1],".json");let a=t.match(/^\/api\/v1\/studies\/([^/]+)$/);if(a)return"".concat("api","/study/").concat(a[1],".json");let s=t.match(/^\/api\/v1\/lesions\/([^/]+)$/);return s?"".concat("api","/lesion/").concat(s[1],".json"):null}(e);if(null===t)throw new r("No recorded response for ".concat(e),501);return o(t,e)}}function u(e){return c.seriesFile(e)}function x(e){return c.seriesMask(e)}let m=new Map;function p(e){var t=c.observationMesh(e);let n=m.get(t);if(n)return n;let i=fetch(t).then(async e=>{if(!e.ok)throw new r("Mesh request failed with ".concat(e.status),e.status);return(0,l.V)(await e.arrayBuffer())}).catch(e=>{throw m.delete(t),e});return m.set(t,i),i}let h=new Map;function g(e){let t=c.segmentationVolume(e),n=h.get(t);if(n)return n;let l=fetch(t).then(async e=>{if(!e.ok)throw new r("Volume request failed with ".concat(e.status),e.status);return(0,i.u)(await e.arrayBuffer())}).catch(e=>{throw h.delete(t),e});return h.set(t,l),l}let f={health:()=>d("/health"),listPatients:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;return d("/api/v1/patients?limit=".concat(e))},getTimeline:e=>d("/api/v1/patients/".concat(e,"/timeline")),getStudy:e=>d("/api/v1/studies/".concat(e)),getLesion:e=>d("/api/v1/lesions/".concat(e)),listAIObservations:e=>d("/api/v1/patients/".concat(e,"/ai-observations")),askAIObservation:(e,t)=>o(function(e,t,n,i){return"".concat("api","/answers/").concat(e,"/").concat(t,"/").concat(null!=n?n:"none","/").concat(null!=i?i:"none",".json")}(e,t.question,t.study_id,t.lesion_id),"".concat(t.question," for ").concat(e)),listStudySegmentations:e=>d("/api/v1/studies/".concat(e,"/segmentations"))},b={health:["health"],patients:["patients"],timeline:e=>["timeline",e],study:e=>["study",e],lesion:e=>["lesion",e],aiObservations:e=>["ai-observations",e],segmentations:e=>["segmentations",e]}},83846:(e,t,n)=>{"use strict";function i(e){if(e.byteLength<348)throw Error("Mask is only ".concat(e.byteLength," bytes; not a NIfTI file"));let t=new DataView(e),n=!0;if(348!==t.getInt32(0,!0))if(348===t.getInt32(0,!1))n=!1;else throw Error("Mask header is not a NIfTI-1 header");let i=t.getInt16(40,n);if(i<3)throw Error("Mask has rank ".concat(i,"; a 3D volume is required"));let l=[t.getInt16(42,n),t.getInt16(44,n),t.getInt16(46,n)];if(l.some(e=>e<=0))throw Error("Mask has invalid dimensions ".concat(l.join("x")));let a=t.getInt16(70,n);if(2!==a)throw Error("Mask datatype is ".concat(a,", expected ").concat(2," (uint8). Regenerate it with link_series_masks.py"));let s=Math.round(t.getFloat32(108,n))||352,c=l[0]*l[1]*l[2],r=e.byteLength-s;if(rNumber.isFinite(e)&&e>0?e:1)}}function l(e){let t=i(e),n=new Set,l=0;for(let e=0;ee-t),labelledVoxels:l}}n.d(t,{G:()=>l,u:()=>i})},85330:(e,t,n)=>{"use strict";n.d(t,{AV:()=>h,B:()=>c,Cn:()=>m,Iy:()=>p,bh:()=>o,dp:()=>v,eW:()=>r,kl:()=>b,ml:()=>g,o:()=>x,zE:()=>u});var i=n(70192),l=n(20205),a=n(83846);let{D_:s}=l.fX,c={1:[255,92,92,255],2:[110,200,255,255],3:[250,214,120,255]},r={1:"enhancing",2:"necrotic core",3:"oedema"};function o(e){return"seg-".concat(e)}let d=new Map;async function u(e,t,n){var l;let s=d.get(n);if(s&&i.PP.getVolume(n))return s;let c=await fetch(e);if(!c.ok)throw Error("Mask request failed with ".concat(c.status));let r=(0,a.G)(await c.arrayBuffer()),o=i.PP.getVolume(t);if(!o)throw Error("Image volume is not loaded, so no labelmap can be aligned to it");let u=null!=(l=o.dimensions)?l:[];if(3===u.length&&!r.dimensions.every((e,t)=>e===u[t]))throw Error("Mask grid ".concat(r.dimensions.join("x")," does not match the image ")+"".concat(u.join("x")));let x=i.UH.createAndCacheDerivedLabelmapVolume(t,{volumeId:n}).voxelManager;if(!(null==x?void 0:x.setAtIndex))throw Error("Labelmap has no writable voxel manager");for(let e=0;ee.referencedId===t||e.uid===t)}async function b(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4e3,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:16,l=Date.now()+n;for(;Date.now()setTimeout(e,i))}return f(e,t)}function v(e,t){try{l.b2.removeSegmentationRepresentations(e,{segmentationId:t,type:s.Labelmap})}catch(e){}}}},e=>{e.O(0,[977,658,141,156,441,255,358],()=>e(e.s=59750)),_N_E=e.O()}]); \ No newline at end of file diff --git a/_next/static/chunks/compute.d10654f9aa3589b1.js b/_next/static/chunks/compute.d10654f9aa3589b1.js new file mode 100644 index 0000000000000000000000000000000000000000..930bf70c960eadc6401ea3fd0295e93c852ee3f1 --- /dev/null +++ b/_next/static/chunks/compute.d10654f9aa3589b1.js @@ -0,0 +1 @@ +(()=>{var e={41234:()=>{}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var a=t[o]={id:o,loaded:!1,exports:{}},i=!0;try{e[o].call(a.exports,a,a.exports,r),i=!1}finally{i&&delete t[o]}return a.loaded=!0,a.exports}r.m=e,r.x=()=>{var e=r.O(void 0,[977,658,942],()=>r(3821));return r.O(e)},r.amdD=function(){throw Error("define cannot be used indirect")},r.amdO={},(()=>{var e=[];r.O=(t,o,n,a)=>{if(o){a=a||0;for(var i=e.length;i>0&&e[i-1][2]>a;i--)e[i]=e[i-1];e[i]=[o,n,a];return}for(var c=1/0,i=0;i=a)&&Object.keys(r.O).every(e=>r.O[e](o[l]))?o.splice(l--,1):(s=!1,a{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((t,o)=>(r.f[o](e,t),t),[])),r.u=e=>977===e?"static/chunks/467ef8ee-6369ff81ae928fb4.js":658===e?"static/chunks/658-3bc27228933a69df.js":"static/chunks/"+(694===e?"compute":e)+"."+({694:"d10654f9aa3589b1",942:"1c41165479333662"})[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:e=>e},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("nextjs#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="/_next/",(()=>{r.b=self.location+"/../../../";var e={694:1};r.f.i=(t,o)=>{e[t]||importScripts(r.tu(r.p+r.u(t)))};var t=self.webpackChunk_N_E=self.webpackChunk_N_E||[],o=t.push.bind(t);t.push=t=>{var[n,a,i]=t;for(var c in a)r.o(a,c)&&(r.m[c]=a[c]);for(i&&i(r);n.length;)e[n.pop()]=1;o(t)}})(),(()=>{var e=r.x;r.x=()=>Promise.all([977,658,942].map(r.e,r)).then(e)})(),_N_E=r.x()})(); \ No newline at end of file diff --git a/_next/static/chunks/framework-e180e6045d9bc50e.js b/_next/static/chunks/framework-e180e6045d9bc50e.js new file mode 100644 index 0000000000000000000000000000000000000000..71e8b78e4f83946743d8bc3436023a7732f14496 --- /dev/null +++ b/_next/static/chunks/framework-e180e6045d9bc50e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[593],{14232:(e,t,n)=>{e.exports=n(42167)},24279:(e,t,n)=>{var r,l=n(65364),a=n(62786),o=n(14232),i=n(98477);function u(e){var t="https://react.dev/errors/"+e;if(1I||(e.current=M[I],M[I]=null,I--)}function H(e,t){M[++I]=e.current,e.current=t}var $=U(null),V=U(null),B=U(null),Q=U(null);function W(e,t){switch(H(B,t),H(V,e),H($,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?si(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)e=su(t=si(t),e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}j($),H($,e)}function q(){j($),j(V),j(B)}function K(e){null!==e.memoizedState&&H(Q,e);var t=$.current,n=su(t,e.type);t!==n&&(H(V,e),H($,n))}function Y(e){V.current===e&&(j($),j(V)),Q.current===e&&(j(Q),sX._currentValue=F)}var G=Object.prototype.hasOwnProperty,X=a.unstable_scheduleCallback,Z=a.unstable_cancelCallback,J=a.unstable_shouldYield,ee=a.unstable_requestPaint,et=a.unstable_now,en=a.unstable_getCurrentPriorityLevel,er=a.unstable_ImmediatePriority,el=a.unstable_UserBlockingPriority,ea=a.unstable_NormalPriority,eo=a.unstable_LowPriority,ei=a.unstable_IdlePriority,eu=a.log,es=a.unstable_setDisableYieldValue,ec=null,ef=null;function ed(e){if("function"==typeof eu&&es(e),ef&&"function"==typeof ef.setStrictMode)try{ef.setStrictMode(ec,e)}catch(e){}}var ep=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(em(e)/eh|0)|0},em=Math.log,eh=Math.LN2,eg=256,ey=4194304;function ev(e){var t=42&e;if(0!==t)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194048&e;case 4194304:case 8388608:case 0x1000000:case 0x2000000:return 0x3c00000&e;case 0x4000000:return 0x4000000;case 0x8000000:return 0x8000000;case 0x10000000:return 0x10000000;case 0x20000000:return 0x20000000;case 0x40000000:return 0;default:return e}}function eb(e,t,n){var r=e.pendingLanes;if(0===r)return 0;var l=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var i=0x7ffffff&r;return 0!==i?0!=(r=i&~a)?l=ev(r):0!=(o&=i)?l=ev(o):n||0!=(n=i&~e)&&(l=ev(n)):0!=(i=r&~a)?l=ev(i):0!==o?l=ev(o):n||0!=(n=r&~e)&&(l=ev(n)),0===l?0:0!==t&&t!==l&&0==(t&a)&&((a=l&-l)>=(n=t&-t)||32===a&&0!=(4194048&n))?t:l}function ek(e,t){return 0==(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function ew(){var e=eg;return 0==(4194048&(eg<<=1))&&(eg=256),e}function eS(){var e=ey;return 0==(0x3c00000&(ey<<=1))&&(ey=4194304),e}function ex(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function eE(e,t){e.pendingLanes|=t,0x10000000!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function eC(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-ep(t);e.entangledLanes|=t,e.entanglements[r]=0x40000000|e.entanglements[r]|4194090&n}function e_(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ep(n),l=1<)":-1l||u[r]!==s[l]){var c="\n"+u[r].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=r&&0<=l);break}}}finally{e2=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?e1(n):""}function e4(e){try{var t="";do t+=function(e){switch(e.tag){case 26:case 27:case 5:return e1(e.type);case 16:return e1("Lazy");case 13:return e1("Suspense");case 19:return e1("SuspenseList");case 0:case 15:return e3(e.type,!1);case 11:return e3(e.type.render,!1);case 1:return e3(e.type,!0);case 31:return e1("Activity");default:return""}}(e),e=e.return;while(e);return t}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}function e8(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function e6(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function e5(e){e._valueTracker||(e._valueTracker=function(e){var t=e6(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var l=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(e){r=""+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function e9(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=e6(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function e7(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}var te=/[\n"\\]/g;function tt(e){return e.replace(te,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function tn(e,t,n,r,l,a,o,i){e.name="",null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o?e.type=o:e.removeAttribute("type"),null!=t?"number"===o?(0===t&&""===e.value||e.value!=t)&&(e.value=""+e8(t)):e.value!==""+e8(t)&&(e.value=""+e8(t)):"submit"!==o&&"reset"!==o||e.removeAttribute("value"),null!=t?tl(e,o,e8(t)):null!=n?tl(e,o,e8(n)):null!=r&&e.removeAttribute("value"),null==l&&null!=a&&(e.defaultChecked=!!a),null!=l&&(e.checked=l&&"function"!=typeof l&&"symbol"!=typeof l),null!=i&&"function"!=typeof i&&"symbol"!=typeof i&&"boolean"!=typeof i?e.name=""+e8(i):e.removeAttribute("name")}function tr(e,t,n,r,l,a,o,i){if(null!=a&&"function"!=typeof a&&"symbol"!=typeof a&&"boolean"!=typeof a&&(e.type=a),null!=t||null!=n){if(("submit"===a||"reset"===a)&&null==t)return;n=null!=n?""+e8(n):"",t=null!=t?""+e8(t):n,i||t===e.value||(e.value=t),e.defaultValue=t}r="function"!=typeof(r=null!=r?r:l)&&"symbol"!=typeof r&&!!r,e.checked=i?e.checked:!!r,e.defaultChecked=!!r,null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o&&(e.name=o)}function tl(e,t,n){"number"===t&&e7(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function ta(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l=ne),nr=!1;function nl(e,t){switch(e){case"keyup":return -1!==t9.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function na(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var no=!1,ni={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function nu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!ni[e.type]:"textarea"===t}function ns(e,t,n,r){tv?tb?tb.push(r):tb=[r]:tv=r,0<(t=u3(t,"onChange")).length&&(n=new tH("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var nc=null,nf=null;function nd(e){uY(e,0)}function np(e){if(e9(e$(e)))return e}function nm(e,t){if("change"===e)return t}var nh=!1;if(tE){if(tE){var ng="oninput"in document;if(!ng){var ny=document.createElement("div");ny.setAttribute("oninput","return;"),ng="function"==typeof ny.oninput}r=ng}else r=!1;nh=r&&(!document.documentMode||9=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=n_(r)}}function nz(e){e=null!=e&&null!=e.ownerDocument&&null!=e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;for(var t=e7(e.document);t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(n)e=t.contentWindow;else break;t=e7(e.document)}return t}function nN(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var nT=tE&&"documentMode"in document&&11>=document.documentMode,nL=null,nO=null,nR=null,nD=!1;function nA(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;nD||null==nL||nL!==e7(r)||(r="selectionStart"in(r=nL)&&nN(r)?{start:r.selectionStart,end:r.selectionEnd}:{anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},nR&&nC(nR,r)||(nR=r,0<(r=u3(nO,"onSelect")).length&&(t=new tH("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=nL)))}function nF(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var nM={animationend:nF("Animation","AnimationEnd"),animationiteration:nF("Animation","AnimationIteration"),animationstart:nF("Animation","AnimationStart"),transitionrun:nF("Transition","TransitionRun"),transitionstart:nF("Transition","TransitionStart"),transitioncancel:nF("Transition","TransitionCancel"),transitionend:nF("Transition","TransitionEnd")},nI={},nU={};function nj(e){if(nI[e])return nI[e];if(!nM[e])return e;var t,n=nM[e];for(t in n)if(n.hasOwnProperty(t)&&t in nU)return nI[e]=n[t];return e}tE&&(nU=document.createElement("div").style,"AnimationEvent"in window||(delete nM.animationend.animation,delete nM.animationiteration.animation,delete nM.animationstart.animation),"TransitionEvent"in window||delete nM.transitionend.transition);var nH=nj("animationend"),n$=nj("animationiteration"),nV=nj("animationstart"),nB=nj("transitionrun"),nQ=nj("transitionstart"),nW=nj("transitioncancel"),nq=nj("transitionend"),nK=new Map,nY="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function nG(e,t){nK.set(e,t),eq(t,[e])}nY.push("scrollEnd");var nX=new WeakMap;function nZ(e,t){if("object"==typeof e&&null!==e){var n=nX.get(e);return void 0!==n?n:(t={value:e,source:t,stack:e4(t)},nX.set(e,t),t)}return{value:e,source:t,stack:e4(t)}}var nJ=[],n0=0,n1=0;function n2(){for(var e=n0,t=n1=n0=0;t>=o,l-=o,rh=1<<32-ep(t)+l|n<a?a:8;var o=D.T,i={};D.T=i,aj(e,!1,t,n);try{var u=l(),s=D.S;if(null!==s&&s(i,u),null!==u&&"object"==typeof u&&"function"==typeof u.then){var c,f,d=(c=[],f={status:"pending",value:null,reason:null,then:function(e){c.push(e)}},u.then(function(){f.status="fulfilled",f.value=r;for(var e=0;eh?(g=f,f=null):g=f.sibling;var y=p(l,f,i[h],u);if(null===y){null===f&&(f=g);break}e&&f&&null===y.alternate&&t(l,f),o=a(y,o,h),null===c?s=y:c.sibling=y,c=y,f=g}if(h===i.length)return n(l,f),rx&&ry(l,h),s;if(null===f){for(;hg?(y=h,h=null):y=h.sibling;var b=p(l,h,v.value,s);if(null===b){null===h&&(h=y);break}e&&h&&null===b.alternate&&t(l,h),o=a(b,o,g),null===f?c=b:f.sibling=b,f=b,h=y}if(v.done)return n(l,h),rx&&ry(l,g),c;if(null===h){for(;!v.done;g++,v=i.next())null!==(v=d(l,v.value,s))&&(o=a(v,o,g),null===f?c=v:f.sibling=v,f=v);return rx&&ry(l,g),c}for(h=r(h);!v.done;g++,v=i.next())null!==(v=m(h,l,g,v.value,s))&&(e&&null!==v.alternate&&h.delete(null===v.key?g:v.key),o=a(v,o,g),null===f?c=v:f.sibling=v,f=v);return e&&h.forEach(function(e){return t(l,e)}),rx&&ry(l,g),c}(s,c,f=b.call(f),v)}if("function"==typeof f.then)return i(s,c,aG(f),v);if(f.$$typeof===S)return i(s,c,rQ(s,f),v);aZ(s,f)}return"string"==typeof f&&""!==f||"number"==typeof f||"bigint"==typeof f?(f=""+f,null!==c&&6===c.tag?(n(s,c.sibling),(v=l(c,f)).return=s):(n(s,c),(v=ro(f,s.mode,v)).return=s),o(s=v)):n(s,c)}(i,s,c,f);return aK=null,v}catch(e){if(e===r7||e===lt)throw e;var b=re(29,e,null,i.mode);return b.lanes=f,b.return=i,b}finally{}}}var a1=a0(!0),a2=a0(!1),a3=U(null),a4=null;function a8(e){var t=e.alternate;H(a7,1&a7.current),H(a3,e),null===a4&&(null===t||null!==lw.current?a4=e:null!==t.memoizedState&&(a4=e))}function a6(e){if(22===e.tag){if(H(a7,a7.current),H(a3,e),null===a4){var t=e.alternate;null!==t&&null!==t.memoizedState&&(a4=e)}}else a5(e)}function a5(){H(a7,a7.current),H(a3,a3.current)}function a9(e){j(a3),a4===e&&(a4=null),j(a7)}var a7=U(0);function oe(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||sb(n)))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function ot(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:p({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var on={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=i6(),l=ld(r);l.payload=t,null!=n&&(l.callback=n),null!==(t=lp(e,l,r))&&(i9(t,e,r),lm(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=i6(),l=ld(r);l.tag=1,l.payload=t,null!=n&&(l.callback=n),null!==(t=lp(e,l,r))&&(i9(t,e,r),lm(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=i6(),r=ld(n);r.tag=2,null!=t&&(r.callback=t),null!==(t=lp(e,r,n))&&(i9(t,e,n),lm(t,e,n))}};function or(e,t,n,r,l,a,o){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,a,o):!t.prototype||!t.prototype.isPureReactComponent||!nC(n,r)||!nC(l,a)}function ol(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&on.enqueueReplaceState(t,t.state,null)}function oa(e,t){var n=t;if("ref"in t)for(var r in n={},t)"ref"!==r&&(n[r]=t[r]);if(e=e.defaultProps)for(var l in n===t&&(n=p({},n)),e)void 0===n[l]&&(n[l]=e[l]);return n}var oo="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof l&&"function"==typeof l.emit)return void l.emit("uncaughtException",e);console.error(e)};function oi(e){oo(e)}function ou(e){console.error(e)}function os(e){oo(e)}function oc(e,t){try{(0,e.onUncaughtError)(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function of(e,t,n){try{(0,e.onCaughtError)(n.value,{componentStack:n.stack,errorBoundary:1===t.tag?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function od(e,t,n){return(n=ld(n)).tag=3,n.payload={element:null},n.callback=function(){oc(e,t)},n}function op(e){return(e=ld(e)).tag=3,e}function om(e,t,n,r){var l=n.type.getDerivedStateFromError;if("function"==typeof l){var a=r.value;e.payload=function(){return l(a)},e.callback=function(){of(t,n,r)}}var o=n.stateNode;null!==o&&"function"==typeof o.componentDidCatch&&(e.callback=function(){of(t,n,r),"function"!=typeof l&&(null===iG?iG=new Set([this]):iG.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:null!==e?e:""})})}var oh=Error(u(461)),og=!1;function oy(e,t,n,r){t.child=null===e?a2(t,null,n,r):a1(t,e.child,n,r)}function ov(e,t,n,r,l){n=n.render;var a=t.ref;if("ref"in r){var o={};for(var i in r)"ref"!==i&&(o[i]=r[i])}else o=r;return(rV(t),r=lU(e,t,n,o,a,l),i=lV(),null===e||og)?(rx&&i&&rb(t),t.flags|=1,oy(e,t,r,l),t.child):(lB(e,t,l),oI(e,t,l))}function ob(e,t,n,r,l){if(null===e){var a=n.type;return"function"!=typeof a||rt(a)||void 0!==a.defaultProps||null!==n.compare?((e=rl(n.type,null,r,t,t.mode,l)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=a,ok(e,t,a,r,l))}if(a=e.child,!oU(e,l)){var o=a.memoizedProps;if((n=null!==(n=n.compare)?n:nC)(o,r)&&e.ref===t.ref)return oI(e,t,l)}return t.flags|=1,(e=rn(a,r)).ref=t.ref,e.return=t,t.child=e}function ok(e,t,n,r,l){if(null!==e){var a=e.memoizedProps;if(nC(a,r)&&e.ref===t.ref)if(og=!1,t.pendingProps=r=a,!oU(e,l))return t.lanes=e.lanes,oI(e,t,l);else 0!=(131072&e.flags)&&(og=!0)}return oE(e,t,n,r,l)}function ow(e,t,n){var r=t.pendingProps,l=r.children,a=null!==e?e.memoizedState:null;if("hidden"===r.mode){if(0!=(128&t.flags)){if(r=null!==a?a.baseLanes|n:n,null!==e){for(a=0,l=t.child=e.child;null!==l;)a=a|l.lanes|l.childLanes,l=l.sibling;t.childLanes=a&~r}else t.childLanes=0,t.child=null;return oS(e,t,r,n)}if(0==(0x20000000&n))return t.lanes=t.childLanes=0x20000000,oS(e,t,null!==a?a.baseLanes|n:n,n);t.memoizedState={baseLanes:0,cachePool:null},null!==e&&r5(t,null!==a?a.cachePool:null),null!==a?lx(t,a):lE(),a6(t)}else null!==a?(r5(t,a.cachePool),lx(t,a),a5(t),t.memoizedState=null):(null!==e&&r5(t,null),lE(),a5(t));return oy(e,t,l,n),t.child}function oS(e,t,n,r){var l=r6();return t.memoizedState={baseLanes:n,cachePool:l=null===l?null:{parent:rG._currentValue,pool:l}},null!==e&&r5(t,null),lE(),a6(t),null!==e&&rH(e,t,r,!0),null}function ox(e,t){var n=t.ref;if(null===n)null!==e&&null!==e.ref&&(t.flags|=4194816);else{if("function"!=typeof n&&"object"!=typeof n)throw Error(u(284));(null===e||e.ref!==n)&&(t.flags|=4194816)}}function oE(e,t,n,r,l){return(rV(t),n=lU(e,t,n,r,void 0,l),r=lV(),null===e||og)?(rx&&r&&rb(t),t.flags|=1,oy(e,t,n,l),t.child):(lB(e,t,l),oI(e,t,l))}function oC(e,t,n,r,l,a){return(rV(t),t.updateQueue=null,n=lH(t,r,n,l),lj(e),r=lV(),null===e||og)?(rx&&r&&rb(t),t.flags|=1,oy(e,t,n,a),t.child):(lB(e,t,a),oI(e,t,a))}function o_(e,t,n,r,l){if(rV(t),null===t.stateNode){var a=n9,o=n.contextType;"object"==typeof o&&null!==o&&(a=rB(o)),t.memoizedState=null!==(a=new n(r,a)).state&&void 0!==a.state?a.state:null,a.updater=on,t.stateNode=a,a._reactInternals=t,(a=t.stateNode).props=r,a.state=t.memoizedState,a.refs={},lc(t),o=n.contextType,a.context="object"==typeof o&&null!==o?rB(o):n9,a.state=t.memoizedState,"function"==typeof(o=n.getDerivedStateFromProps)&&(ot(t,n,o,r),a.state=t.memoizedState),"function"==typeof n.getDerivedStateFromProps||"function"==typeof a.getSnapshotBeforeUpdate||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||(o=a.state,"function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount(),o!==a.state&&on.enqueueReplaceState(a,a.state,null),lv(t,r,a,l),ly(),a.state=t.memoizedState),"function"==typeof a.componentDidMount&&(t.flags|=4194308),r=!0}else if(null===e){a=t.stateNode;var i=t.memoizedProps,u=oa(n,i);a.props=u;var s=a.context,c=n.contextType;o=n9,"object"==typeof c&&null!==c&&(o=rB(c));var f=n.getDerivedStateFromProps;c="function"==typeof f||"function"==typeof a.getSnapshotBeforeUpdate,i=t.pendingProps!==i,c||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(i||s!==o)&&ol(t,a,r,o),ls=!1;var d=t.memoizedState;a.state=d,lv(t,r,a,l),ly(),s=t.memoizedState,i||d!==s||ls?("function"==typeof f&&(ot(t,n,f,r),s=t.memoizedState),(u=ls||or(t,n,u,r,d,s,o))?(c||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||("function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"==typeof a.componentDidMount&&(t.flags|=4194308)):("function"==typeof a.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=s),a.props=r,a.state=s,a.context=o,r=u):("function"==typeof a.componentDidMount&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,lf(e,t),c=oa(n,o=t.memoizedProps),a.props=c,f=t.pendingProps,d=a.context,s=n.contextType,u=n9,"object"==typeof s&&null!==s&&(u=rB(s)),(s="function"==typeof(i=n.getDerivedStateFromProps)||"function"==typeof a.getSnapshotBeforeUpdate)||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(o!==f||d!==u)&&ol(t,a,r,u),ls=!1,d=t.memoizedState,a.state=d,lv(t,r,a,l),ly();var p=t.memoizedState;o!==f||d!==p||ls||null!==e&&null!==e.dependencies&&r$(e.dependencies)?("function"==typeof i&&(ot(t,n,i,r),p=t.memoizedState),(c=ls||or(t,n,c,r,d,p,u)||null!==e&&null!==e.dependencies&&r$(e.dependencies))?(s||"function"!=typeof a.UNSAFE_componentWillUpdate&&"function"!=typeof a.componentWillUpdate||("function"==typeof a.componentWillUpdate&&a.componentWillUpdate(r,p,u),"function"==typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(r,p,u)),"function"==typeof a.componentDidUpdate&&(t.flags|=4),"function"==typeof a.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof a.componentDidUpdate||o===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||o===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=u,r=c):("function"!=typeof a.componentDidUpdate||o===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||o===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,ox(e,t),r=0!=(128&t.flags),a||r?(a=t.stateNode,n=r&&"function"!=typeof n.getDerivedStateFromError?null:a.render(),t.flags|=1,null!==e&&r?(t.child=a1(t,e.child,null,l),t.child=a1(t,null,n,l)):oy(e,t,n,l),t.memoizedState=a.state,e=t.child):e=oI(e,t,l),e}function oP(e,t,n,r){return rL(),t.flags|=256,oy(e,t,n,r),t.child}var oz={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function oN(e){return{baseLanes:e,cachePool:r9()}}function oT(e,t,n){return e=null!==e?e.childLanes&~n:0,t&&(e|=i$),e}function oL(e,t,n){var r,l=t.pendingProps,a=!1,o=0!=(128&t.flags);if((r=o)||(r=(null===e||null!==e.memoizedState)&&0!=(2&a7.current)),r&&(a=!0,t.flags&=-129),r=0!=(32&t.flags),t.flags&=-33,null===e){if(rx){if(a?a8(t):a5(t),rx){var i,s=rS;if(i=s){n:{for(i=s,s=rC;8!==i.nodeType;)if(!s||null===(i=sk(i.nextSibling))){s=null;break n}s=i}null!==s?(t.memoizedState={dehydrated:s,treeContext:null!==rm?{id:rh,overflow:rg}:null,retryLane:0x20000000,hydrationErrors:null},(i=re(18,null,null,0)).stateNode=s,i.return=t,t.child=i,rw=t,rS=null,i=!0):i=!1}i||rP(t)}if(null!==(s=t.memoizedState)&&null!==(s=s.dehydrated))return sb(s)?t.lanes=32:t.lanes=0x20000000,null;a9(t)}return(s=l.children,l=l.fallback,a)?(a5(t),s=oR({mode:"hidden",children:s},a=t.mode),l=ra(l,a,n,null),s.return=t,l.return=t,s.sibling=l,t.child=s,(a=t.child).memoizedState=oN(n),a.childLanes=oT(e,r,n),t.memoizedState=oz,l):(a8(t),oO(t,s))}if(null!==(i=e.memoizedState)&&null!==(s=i.dehydrated)){if(o)256&t.flags?(a8(t),t.flags&=-257,t=oD(e,t,n)):null!==t.memoizedState?(a5(t),t.child=e.child,t.flags|=128,t=null):(a5(t),a=l.fallback,s=t.mode,l=oR({mode:"visible",children:l.children},s),a=ra(a,s,n,null),a.flags|=2,l.return=t,a.return=t,l.sibling=a,t.child=l,a1(t,e.child,null,n),(l=t.child).memoizedState=oN(n),l.childLanes=oT(e,r,n),t.memoizedState=oz,t=a);else if(a8(t),sb(s)){if(r=s.nextSibling&&s.nextSibling.dataset)var c=r.dgst;r=c,(l=Error(u(419))).stack="",l.digest=r,rR({value:l,source:null,stack:null}),t=oD(e,t,n)}else if(og||rH(e,t,n,!1),r=0!=(n&e.childLanes),og||r){if(null!==(r=iN)&&0!==(l=0!=((l=0!=(42&(l=n&-n))?1:eP(l))&(r.suspendedLanes|n))?0:l)&&l!==i.retryLane)throw i.retryLane=l,n8(e,l),i9(r,e,l),oh;"$?"===s.data||uu(),t=oD(e,t,n)}else"$?"===s.data?(t.flags|=192,t.child=e.child,t=null):(e=i.treeContext,rS=sk(s.nextSibling),rw=t,rx=!0,rE=null,rC=!1,null!==e&&(rd[rp++]=rh,rd[rp++]=rg,rd[rp++]=rm,rh=e.id,rg=e.overflow,rm=t),t=oO(t,l.children),t.flags|=4096);return t}return a?(a5(t),a=l.fallback,s=t.mode,c=(i=e.child).sibling,(l=rn(i,{mode:"hidden",children:l.children})).subtreeFlags=0x3e00000&i.subtreeFlags,null!==c?a=rn(c,a):(a=ra(a,s,n,null),a.flags|=2),a.return=t,l.return=t,l.sibling=a,t.child=l,l=a,a=t.child,null===(s=e.child.memoizedState)?s=oN(n):(null!==(i=s.cachePool)?(c=rG._currentValue,i=i.parent!==c?{parent:c,pool:c}:i):i=r9(),s={baseLanes:s.baseLanes|n,cachePool:i}),a.memoizedState=s,a.childLanes=oT(e,r,n),t.memoizedState=oz,l):(a8(t),e=(n=e.child).sibling,(n=rn(n,{mode:"visible",children:l.children})).return=t,n.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n)}function oO(e,t){return(t=oR({mode:"visible",children:t},e.mode)).return=e,e.child=t}function oR(e,t){return(e=re(22,e,null,t)).lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function oD(e,t,n){return a1(t,e.child,null,n),e=oO(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function oA(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),rU(e.return,t,n)}function oF(e,t,n,r,l){var a=e.memoizedState;null===a?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:l}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=l)}function oM(e,t,n){var r=t.pendingProps,l=r.revealOrder,a=r.tail;if(oy(e,t,r.children,n),0!=(2&(r=a7.current)))r=1&r|2,t.flags|=128;else{if(null!==e&&0!=(128&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&oA(e,n,t);else if(19===e.tag)oA(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}switch(H(a7,r),l){case"forwards":for(l=null,n=t.child;null!==n;)null!==(e=n.alternate)&&null===oe(e)&&(l=n),n=n.sibling;null===(n=l)?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),oF(t,!1,l,n,a);break;case"backwards":for(n=null,l=t.child,t.child=null;null!==l;){if(null!==(e=l.alternate)&&null===oe(e)){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}oF(t,!0,n,null,a);break;case"together":oF(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function oI(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),iU|=t.lanes,0==(n&t.childLanes)){if(null===e)return null;else if(rH(e,t,n,!1),0==(n&t.childLanes))return null}if(null!==e&&t.child!==e.child)throw Error(u(153));if(null!==t.child){for(n=rn(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=rn(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function oU(e,t){return 0!=(e.lanes&t)||!!(null!==(e=e.dependencies)&&r$(e))}function oj(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps)og=!0;else{if(!oU(e,n)&&0==(128&t.flags))return og=!1,function(e,t,n){switch(t.tag){case 3:W(t,t.stateNode.containerInfo),rM(t,rG,e.memoizedState.cache),rL();break;case 27:case 5:K(t);break;case 4:W(t,t.stateNode.containerInfo);break;case 10:rM(t,t.type,t.memoizedProps.value);break;case 13:var r=t.memoizedState;if(null!==r){if(null!==r.dehydrated)return a8(t),t.flags|=128,null;if(0!=(n&t.child.childLanes))return oL(e,t,n);return a8(t),null!==(e=oI(e,t,n))?e.sibling:null}a8(t);break;case 19:var l=0!=(128&e.flags);if((r=0!=(n&t.childLanes))||(rH(e,t,n,!1),r=0!=(n&t.childLanes)),l){if(r)return oM(e,t,n);t.flags|=128}if(null!==(l=t.memoizedState)&&(l.rendering=null,l.tail=null,l.lastEffect=null),H(a7,a7.current),!r)return null;break;case 22:case 23:return t.lanes=0,ow(e,t,n);case 24:rM(t,rG,e.memoizedState.cache)}return oI(e,t,n)}(e,t,n);og=0!=(131072&e.flags)}else og=!1,rx&&0!=(1048576&t.flags)&&rv(t,rf,t.index);switch(t.lanes=0,t.tag){case 16:e:{e=t.pendingProps;var r=t.elementType,l=r._init;if(r=l(r._payload),t.type=r,"function"==typeof r)rt(r)?(e=oa(r,e),t.tag=1,t=o_(null,t,r,e,n)):(t.tag=0,t=oE(null,t,r,e,n));else{if(null!=r){if((l=r.$$typeof)===x){t.tag=11,t=ov(null,t,r,e,n);break e}else if(l===_){t.tag=14,t=ob(null,t,r,e,n);break e}}throw Error(u(306,t=function e(t){if(null==t)return null;if("function"==typeof t)return t.$$typeof===O?null:t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case y:return"Fragment";case b:return"Profiler";case v:return"StrictMode";case E:return"Suspense";case C:return"SuspenseList";case z:return"Activity"}if("object"==typeof t)switch(t.$$typeof){case g:return"Portal";case S:return(t.displayName||"Context")+".Provider";case w:return(t._context.displayName||"Context")+".Consumer";case x:var n=t.render;return(t=t.displayName)||(t=""!==(t=n.displayName||n.name||"")?"ForwardRef("+t+")":"ForwardRef"),t;case _:return null!==(n=t.displayName||null)?n:e(t.type)||"Memo";case P:n=t._payload,t=t._init;try{return e(t(n))}catch(e){}}return null}(r)||r,""))}}return t;case 0:return oE(e,t,t.type,t.pendingProps,n);case 1:return l=oa(r=t.type,t.pendingProps),o_(e,t,r,l,n);case 3:e:{if(W(t,t.stateNode.containerInfo),null===e)throw Error(u(387));r=t.pendingProps;var a=t.memoizedState;l=a.element,lf(e,t),lv(t,r,null,n);var o=t.memoizedState;if(rM(t,rG,r=o.cache),r!==a.cache&&rj(t,[rG],n,!0),ly(),r=o.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=a,t.memoizedState=a,256&t.flags){t=oP(e,t,r,n);break e}else if(r!==l){rR(l=nZ(Error(u(424)),t)),t=oP(e,t,r,n);break e}else for(rS=sk((e=9===(e=t.stateNode.containerInfo).nodeType?e.body:"HTML"===e.nodeName?e.ownerDocument.body:e).firstChild),rw=t,rx=!0,rE=null,rC=!0,n=a2(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling;else{if(rL(),r===l){t=oI(e,t,n);break e}oy(e,t,r,n)}t=t.child}return t;case 26:return ox(e,t),null===e?(n=sL(t.type,null,t.pendingProps,null))?t.memoizedState=n:rx||(n=t.type,e=t.pendingProps,(r=so(B.current).createElement(n))[eL]=t,r[eO]=e,sr(r,n,e),eB(r),t.stateNode=r):t.memoizedState=sL(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return K(t),null===e&&rx&&(r=t.stateNode=sx(t.type,t.pendingProps,B.current),rw=t,rC=!0,l=rS,sg(t.type)?(sw=l,rS=sk(r.firstChild)):rS=l),oy(e,t,t.pendingProps.children,n),ox(e,t),null===e&&(t.flags|=4194304),t.child;case 5:return null===e&&rx&&((l=r=rS)&&(null!==(r=function(e,t,n,r){for(;1===e.nodeType;){if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&("INPUT"!==e.nodeName||"hidden"!==e.type))break}else if(r){if(!e[eI])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if("stylesheet"===(l=e.getAttribute("rel"))&&e.hasAttribute("data-precedence")||l!==n.rel||e.getAttribute("href")!==(null==n.href||""===n.href?null:n.href)||e.getAttribute("crossorigin")!==(null==n.crossOrigin?null:n.crossOrigin)||e.getAttribute("title")!==(null==n.title?null:n.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(((l=e.getAttribute("src"))!==(null==n.src?null:n.src)||e.getAttribute("type")!==(null==n.type?null:n.type)||e.getAttribute("crossorigin")!==(null==n.crossOrigin?null:n.crossOrigin))&&l&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else{if("input"!==t||"hidden"!==e.type)return e;var l=null==n.name?null:""+n.name;if("hidden"===n.type&&e.getAttribute("name")===l)return e}if(null===(e=sk(e.nextSibling)))break}return null}(r,t.type,t.pendingProps,rC))?(t.stateNode=r,rw=t,rS=sk(r.firstChild),rC=!1,l=!0):l=!1),l||rP(t)),K(t),l=t.type,a=t.pendingProps,o=null!==e?e.memoizedProps:null,r=a.children,ss(l,a)?r=null:null!==o&&ss(l,o)&&(t.flags|=32),null!==t.memoizedState&&(sX._currentValue=l=lU(e,t,l$,null,null,n)),ox(e,t),oy(e,t,r,n),t.child;case 6:return null===e&&rx&&((e=n=rS)&&(null!==(n=function(e,t,n){if(""===t)return null;for(;3!==e.nodeType;)if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!n||null===(e=sk(e.nextSibling)))return null;return e}(n,t.pendingProps,rC))?(t.stateNode=n,rw=t,rS=null,e=!0):e=!1),e||rP(t)),null;case 13:return oL(e,t,n);case 4:return W(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=a1(t,null,r,n):oy(e,t,r,n),t.child;case 11:return ov(e,t,t.type,t.pendingProps,n);case 7:return oy(e,t,t.pendingProps,n),t.child;case 8:case 12:return oy(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,rM(t,t.type,r.value),oy(e,t,r.children,n),t.child;case 9:return l=t.type._context,r=t.pendingProps.children,rV(t),r=r(l=rB(l)),t.flags|=1,oy(e,t,r,n),t.child;case 14:return ob(e,t,t.type,t.pendingProps,n);case 15:return ok(e,t,t.type,t.pendingProps,n);case 19:return oM(e,t,n);case 31:return r=t.pendingProps,n=t.mode,r={mode:r.mode,children:r.children},null===e?(n=oR(r,n)).ref=t.ref:(n=rn(e.child,r)).ref=t.ref,t.child=n,n.return=t,t=n;case 22:return ow(e,t,n);case 24:return rV(t),r=rB(rG),null===e?(null===(l=r6())&&(l=iN,a=rX(),l.pooledCache=a,a.refCount++,null!==a&&(l.pooledCacheLanes|=n),l=a),t.memoizedState={parent:r,cache:l},lc(t),rM(t,rG,l)):(0!=(e.lanes&n)&&(lf(e,t),lv(t,null,null,n),ly()),l=e.memoizedState,a=t.memoizedState,l.parent!==r?(l={parent:r,cache:r},t.memoizedState=l,0===t.lanes&&(t.memoizedState=t.updateQueue.baseState=l),rM(t,rG,r)):(rM(t,rG,r=a.cache),r!==l.cache&&rj(t,[rG],n,!0))),oy(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(u(156,t.tag))}function oH(e){e.flags|=4}function o$(e,t){if("stylesheet"!==t.type||0!=(4&t.state.loading))e.flags&=-0x1000001;else if(e.flags|=0x1000000,!sB(t)){if(null!==(t=a3.current)&&((4194048&iL)===iL?null!==a4:(0x3c00000&iL)!==iL&&0==(0x20000000&iL)||t!==a4))throw lo=ln,le;e.flags|=8192}}function oV(e,t){null!==t&&(e.flags|=4),16384&e.flags&&(t=22!==e.tag?eS():0x20000000,e.lanes|=t,iV|=t)}function oB(e,t){if(!rx)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function oQ(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var l=e.child;null!==l;)n|=l.lanes|l.childLanes,r|=0x3e00000&l.subtreeFlags,r|=0x3e00000&l.flags,l.return=e,l=l.sibling;else for(l=e.child;null!==l;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags,r|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function oW(e,t){switch(rk(t),t.tag){case 3:rI(rG),q();break;case 26:case 27:case 5:Y(t);break;case 4:q();break;case 13:a9(t);break;case 19:j(a7);break;case 10:rI(t.type);break;case 22:case 23:a9(t),lC(),null!==e&&j(r8);break;case 24:rI(rG)}}function oq(e,t){try{var n=t.updateQueue,r=null!==n?n.lastEffect:null;if(null!==r){var l=r.next;n=l;do{if((n.tag&e)===e){r=void 0;var a=n.create;n.inst.destroy=r=a()}n=n.next}while(n!==l)}}catch(e){ux(t,t.return,e)}}function oK(e,t,n){try{var r=t.updateQueue,l=null!==r?r.lastEffect:null;if(null!==l){var a=l.next;r=a;do{if((r.tag&e)===e){var o=r.inst,i=o.destroy;if(void 0!==i){o.destroy=void 0,l=t;try{i()}catch(e){ux(l,n,e)}}}r=r.next}while(r!==a)}}catch(e){ux(t,t.return,e)}}function oY(e){var t=e.updateQueue;if(null!==t){var n=e.stateNode;try{lk(t,n)}catch(t){ux(e,e.return,t)}}}function oG(e,t,n){n.props=oa(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){ux(e,t,n)}}function oX(e,t){try{var n=e.ref;if(null!==n){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;default:r=e.stateNode}"function"==typeof n?e.refCleanup=n(r):n.current=r}}catch(n){ux(e,t,n)}}function oZ(e,t){var n=e.ref,r=e.refCleanup;if(null!==n)if("function"==typeof r)try{r()}catch(n){ux(e,t,n)}finally{e.refCleanup=null,null!=(e=e.alternate)&&(e.refCleanup=null)}else if("function"==typeof n)try{n(null)}catch(n){ux(e,t,n)}else n.current=null}function oJ(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){ux(e,e.return,t)}}function o0(e,t,n){try{var r=e.stateNode;(function(e,t,n,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var l=null,a=null,o=null,i=null,s=null,c=null,f=null;for(m in n){var d=n[m];if(n.hasOwnProperty(m)&&null!=d)switch(m){case"checked":case"value":break;case"defaultValue":s=d;default:r.hasOwnProperty(m)||st(e,t,m,null,r,d)}}for(var p in r){var m=r[p];if(d=n[p],r.hasOwnProperty(p)&&(null!=m||null!=d))switch(p){case"type":a=m;break;case"name":l=m;break;case"checked":c=m;break;case"defaultChecked":f=m;break;case"value":o=m;break;case"defaultValue":i=m;break;case"children":case"dangerouslySetInnerHTML":if(null!=m)throw Error(u(137,t));break;default:m!==d&&st(e,t,p,m,r,d)}}tn(e,o,i,s,c,f,a,l);return;case"select":for(a in m=o=i=p=null,n)if(s=n[a],n.hasOwnProperty(a)&&null!=s)switch(a){case"value":break;case"multiple":m=s;default:r.hasOwnProperty(a)||st(e,t,a,null,r,s)}for(l in r)if(a=r[l],s=n[l],r.hasOwnProperty(l)&&(null!=a||null!=s))switch(l){case"value":p=a;break;case"defaultValue":i=a;break;case"multiple":o=a;default:a!==s&&st(e,t,l,a,r,s)}t=i,n=o,r=m,null!=p?ta(e,!!n,p,!1):!!r!=!!n&&(null!=t?ta(e,!!n,t,!0):ta(e,!!n,n?[]:"",!1));return;case"textarea":for(i in m=p=null,n)if(l=n[i],n.hasOwnProperty(i)&&null!=l&&!r.hasOwnProperty(i))switch(i){case"value":case"children":break;default:st(e,t,i,null,r,l)}for(o in r)if(l=r[o],a=n[o],r.hasOwnProperty(o)&&(null!=l||null!=a))switch(o){case"value":p=l;break;case"defaultValue":m=l;break;case"children":break;case"dangerouslySetInnerHTML":if(null!=l)throw Error(u(91));break;default:l!==a&&st(e,t,o,l,r,a)}to(e,p,m);return;case"option":for(var h in n)p=n[h],n.hasOwnProperty(h)&&null!=p&&!r.hasOwnProperty(h)&&("selected"===h?e.selected=!1:st(e,t,h,null,r,p));for(s in r)p=r[s],m=n[s],r.hasOwnProperty(s)&&p!==m&&(null!=p||null!=m)&&("selected"===s?e.selected=p&&"function"!=typeof p&&"symbol"!=typeof p:st(e,t,s,p,r,m));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var g in n)p=n[g],n.hasOwnProperty(g)&&null!=p&&!r.hasOwnProperty(g)&&st(e,t,g,null,r,p);for(c in r)if(p=r[c],m=n[c],r.hasOwnProperty(c)&&p!==m&&(null!=p||null!=m))switch(c){case"children":case"dangerouslySetInnerHTML":if(null!=p)throw Error(u(137,t));break;default:st(e,t,c,p,r,m)}return;default:if(td(t)){for(var y in n)p=n[y],n.hasOwnProperty(y)&&void 0!==p&&!r.hasOwnProperty(y)&&sn(e,t,y,void 0,r,p);for(f in r)p=r[f],m=n[f],r.hasOwnProperty(f)&&p!==m&&(void 0!==p||void 0!==m)&&sn(e,t,f,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&null!=p&&!r.hasOwnProperty(v)&&st(e,t,v,null,r,p);for(d in r)p=r[d],m=n[d],r.hasOwnProperty(d)&&p!==m&&(null!=p||null!=m)&&st(e,t,d,p,r,m)})(r,e.type,n,t),r[eO]=t}catch(t){ux(e,e.return,t)}}function o1(e){return 5===e.tag||3===e.tag||26===e.tag||27===e.tag&&sg(e.type)||4===e.tag}function o2(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||o1(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(27===e.tag&&sg(e.type)||2&e.flags||null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function o3(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&(27===r&&sg(e.type)&&(n=e.stateNode),null!==(e=e.child)))for(o3(e,t,n),e=e.sibling;null!==e;)o3(e,t,n),e=e.sibling}function o4(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,l=t.attributes;l.length;)t.removeAttributeNode(l[0]);sr(t,r,n),t[eL]=e,t[eO]=n}catch(t){ux(e,e.return,t)}}var o8=!1,o6=!1,o5=!1,o9="function"==typeof WeakSet?WeakSet:Set,o7=null;function ie(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:ip(e,n),4&r&&oq(5,n);break;case 1:if(ip(e,n),4&r)if(e=n.stateNode,null===t)try{e.componentDidMount()}catch(e){ux(n,n.return,e)}else{var l=oa(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(l,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){ux(n,n.return,e)}}64&r&&oY(n),512&r&&oX(n,n.return);break;case 3:if(ip(e,n),64&r&&null!==(e=n.updateQueue)){if(t=null,null!==n.child)switch(n.child.tag){case 27:case 5:case 1:t=n.child.stateNode}try{lk(e,t)}catch(e){ux(n,n.return,e)}}break;case 27:null===t&&4&r&&o4(n);case 26:case 5:ip(e,n),null===t&&4&r&&oJ(n),512&r&&oX(n,n.return);break;case 12:default:ip(e,n);break;case 13:ip(e,n),4&r&&io(e,n),64&r&&null!==(e=n.memoizedState)&&null!==(e=e.dehydrated)&&function(e,t){var n=e.ownerDocument;if("$?"!==e.data||"complete"===n.readyState)t();else{var r=function(){t(),n.removeEventListener("DOMContentLoaded",r)};n.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}(e,n=uP.bind(null,n));break;case 22:if(!(r=null!==n.memoizedState||o8)){t=null!==t&&null!==t.memoizedState||o6,l=o8;var a=o6;o8=r,(o6=t)&&!a?function e(t,n,r){for(r=r&&0!=(8772&n.subtreeFlags),n=n.child;null!==n;){var l=n.alternate,a=t,o=n,i=o.flags;switch(o.tag){case 0:case 11:case 15:e(a,o,r),oq(4,o);break;case 1:if(e(a,o,r),"function"==typeof(a=(l=o).stateNode).componentDidMount)try{a.componentDidMount()}catch(e){ux(l,l.return,e)}if(null!==(a=(l=o).updateQueue)){var u=l.stateNode;try{var s=a.shared.hiddenCallbacks;if(null!==s)for(a.shared.hiddenCallbacks=null,a=0;a title"))),sr(a,r,n),a[eL]=e,eB(a),r=a;break e;case"link":var o=s$("link","href",l).get(r+(n.href||""));if(o){for(var i=0;i<\/script>",e=e.removeChild(e.firstChild);break;case"select":e="string"==typeof r.is?l.createElement("select",{is:r.is}):l.createElement("select"),r.multiple?e.multiple=!0:r.size&&(e.size=r.size);break;default:e="string"==typeof r.is?l.createElement(n,{is:r.is}):l.createElement(n)}}e[eL]=t,e[eO]=r;e:for(l=t.child;null!==l;){if(5===l.tag||6===l.tag)e.appendChild(l.stateNode);else if(4!==l.tag&&27!==l.tag&&null!==l.child){l.child.return=l,l=l.child;continue}if(l===t)break;for(;null===l.sibling;){if(null===l.return||l.return===t)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}switch(t.stateNode=e,sr(e,n,r),n){case"button":case"input":case"select":case"textarea":e=!!r.autoFocus;break;case"img":e=!0;break;default:e=!1}e&&oH(t)}}return oQ(t),t.flags&=-0x1000001,null;case 6:if(e&&null!=t.stateNode)e.memoizedProps!==r&&oH(t);else{if("string"!=typeof r&&null===t.stateNode)throw Error(u(166));if(e=B.current,rT(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,null!==(l=rw))switch(l.tag){case 27:case 5:r=l.memoizedProps}e[eL]=t,(e=!!(e.nodeValue===n||null!==r&&!0===r.suppressHydrationWarning||u7(e.nodeValue,n)))||rP(t)}else(e=so(e).createTextNode(r))[eL]=t,t.stateNode=e}return oQ(t),null;case 13:if(r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(l=rT(t),null!==r&&null!==r.dehydrated){if(null===e){if(!l)throw Error(u(318));if(!(l=null!==(l=t.memoizedState)?l.dehydrated:null))throw Error(u(317));l[eL]=t}else rL(),0==(128&t.flags)&&(t.memoizedState=null),t.flags|=4;oQ(t),l=!1}else l=rO(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=l),l=!0;if(!l){if(256&t.flags)return a9(t),t;return a9(t),null}}if(a9(t),0!=(128&t.flags))return t.lanes=n,t;if(n=null!==r,e=null!==e&&null!==e.memoizedState,n){r=t.child,l=null,null!==r.alternate&&null!==r.alternate.memoizedState&&null!==r.alternate.memoizedState.cachePool&&(l=r.alternate.memoizedState.cachePool.pool);var a=null;null!==r.memoizedState&&null!==r.memoizedState.cachePool&&(a=r.memoizedState.cachePool.pool),a!==l&&(r.flags|=2048)}return n!==e&&n&&(t.child.flags|=8192),oV(t,t.updateQueue),oQ(t),null;case 4:return q(),null===e&&uJ(t.stateNode.containerInfo),oQ(t),null;case 10:return rI(t.type),oQ(t),null;case 19:if(j(a7),null===(l=t.memoizedState))return oQ(t),null;if(r=0!=(128&t.flags),null===(a=l.rendering))if(r)oB(l,!1);else{if(0!==iI||null!==e&&0!=(128&e.flags))for(e=t.child;null!==e;){if(null!==(a=oe(e))){for(t.flags|=128,oB(l,!1),e=a.updateQueue,t.updateQueue=e,oV(t,e),t.subtreeFlags=0,e=n,n=t.child;null!==n;)rr(n,e),n=n.sibling;return H(a7,1&a7.current|2),t.child}e=e.sibling}null!==l.tail&&et()>iK&&(t.flags|=128,r=!0,oB(l,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=oe(a))){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,oV(t,e),oB(l,!0),null===l.tail&&"hidden"===l.tailMode&&!a.alternate&&!rx)return oQ(t),null}else 2*et()-l.renderingStartTime>iK&&0x20000000!==n&&(t.flags|=128,r=!0,oB(l,!1),t.lanes=4194304);l.isBackwards?(a.sibling=t.child,t.child=a):(null!==(e=l.last)?e.sibling=a:t.child=a,l.last=a)}if(null!==l.tail)return t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=et(),t.sibling=null,e=a7.current,H(a7,r?1&e|2:1&e),t;return oQ(t),null;case 22:case 23:return a9(t),lC(),r=null!==t.memoizedState,null!==e?null!==e.memoizedState!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?0!=(0x20000000&n)&&0==(128&t.flags)&&(oQ(t),6&t.subtreeFlags&&(t.flags|=8192)):oQ(t),null!==(n=t.updateQueue)&&oV(t,n.retryQueue),n=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),r=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),null!==e&&j(r8),null;case 24:return n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),rI(rG),oQ(t),null;case 25:case 30:return null}throw Error(u(156,t.tag))}(t.alternate,t,iM);if(null!==n){iT=n;return}if(null!==(t=t.sibling)){iT=t;return}iT=t=e}while(null!==t);0===iI&&(iI=5)}function um(e,t){do{var n=function(e,t){switch(rk(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return rI(rG),q(),0!=(65536&(e=t.flags))&&0==(128&e)?(t.flags=-65537&e|128,t):null;case 26:case 27:case 5:return Y(t),null;case 13:if(a9(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(u(340));rL()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return j(a7),null;case 4:return q(),null;case 10:return rI(t.type),null;case 22:case 23:return a9(t),lC(),null!==e&&j(r8),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return rI(rG),null;default:return null}}(e.alternate,e);if(null!==n){n.flags&=32767,iT=n;return}if(null!==(n=e.return)&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&null!==(e=e.sibling)){iT=e;return}iT=e=n}while(null!==e);iI=6,iT=null}function uh(e,t,n,r,l,a,o,i,s){e.cancelPendingCommit=null;do uk();while(0!==iX);if(0!=(6&iz))throw Error(u(327));if(null!==t){if(t===e.current)throw Error(u(177));if(!function(e,t,n,r,l,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var i=e.entanglements,u=e.expirationTimes,s=e.hiddenUpdates;for(n=o&~n;0g&&(o=g,g=h,h=o);var y=nP(i,h),v=nP(i,g);if(y&&v&&(1!==p.rangeCount||p.anchorNode!==y.node||p.anchorOffset!==y.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var b=f.createRange();b.setStart(y.node,y.offset),p.removeAllRanges(),h>g?(p.addRange(b),p.extend(v.node,v.offset)):(b.setEnd(v.node,v.offset),p.addRange(b))}}}}for(f=[],p=i;p=p.parentNode;)1===p.nodeType&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for("function"==typeof i.focus&&i.focus(),i=0;in?32:n,D.T=null,n=i2,i2=null;var a=iZ,o=i0;if(iX=0,iJ=iZ=null,i0=0,0!=(6&iz))throw Error(u(331));var i=iz;if(iz|=4,iE(a.current),iy(a,a.current,o,n),iz=i,uF(0,!1),ef&&"function"==typeof ef.onPostCommitFiberRoot)try{ef.onPostCommitFiberRoot(ec,a)}catch(e){}return!0}finally{A.p=l,D.T=r,ub(e,t)}}function uS(e,t,n){t=nZ(n,t),t=od(e.stateNode,t,2),null!==(e=lp(e,t,2))&&(eE(e,2),uA(e))}function ux(e,t,n){if(3===e.tag)uS(e,e,n);else for(;null!==t;){if(3===t.tag){uS(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===iG||!iG.has(r))){e=nZ(n,e),null!==(r=lp(t,n=op(2),2))&&(om(n,r,t,e),eE(r,2),uA(r));break}}t=t.return}}function uE(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new iP;var l=new Set;r.set(t,l)}else void 0===(l=r.get(t))&&(l=new Set,r.set(t,l));l.has(n)||(iF=!0,l.add(n),e=uC.bind(null,e,t,n),t.then(e,e))}function uC(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,iN===e&&(iL&n)===n&&(4===iI||3===iI&&(0x3c00000&iL)===iL&&300>et()-iq?0==(2&iz)&&ul(e,0):iH|=n,iV===iL&&(iV=0)),uA(e)}function u_(e,t){0===t&&(t=eS()),null!==(e=n8(e,t))&&(eE(e,t),uA(e))}function uP(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),u_(e,n)}function uz(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;null!==l&&(n=l.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(u(314))}null!==r&&r.delete(t),u_(e,n)}var uN=null,uT=null,uL=!1,uO=!1,uR=!1,uD=0;function uA(e){e!==uT&&null===e.next&&(null===uT?uN=uT=e:uT=uT.next=e),uO=!0,uL||(uL=!0,sm(function(){0!=(6&iz)?X(er,uM):uI()}))}function uF(e,t){if(!uR&&uO){uR=!0;do for(var n=!1,r=uN;null!==r;){if(!t)if(0!==e){var l=r.pendingLanes;if(0===l)var a=0;else{var o=r.suspendedLanes,i=r.pingedLanes;a=0xc000095&(a=(1<<31-ep(42|e)+1)-1&(l&~(o&~i)))?0xc000095&a|1:a?2|a:0}0!==a&&(n=!0,uH(r,a))}else a=iL,0==(3&(a=eb(r,r===iN?a:0,null!==r.cancelPendingCommit||-1!==r.timeoutHandle)))||ek(r,a)||(n=!0,uH(r,a));r=r.next}while(n);uR=!1}}function uM(){uI()}function uI(){uO=uL=!1;var e,t=0;0!==uD&&(((e=window.event)&&"popstate"===e.type?e===sc||(sc=e,0):(sc=null,1))||(t=uD),uD=0);for(var n=et(),r=null,l=uN;null!==l;){var a=l.next,o=uU(l,n);0===o?(l.next=null,null===r?uN=a:r.next=a,null===a&&(uT=r)):(r=l,(0!==t||0!=(3&o))&&(uO=!0)),l=a}uF(t,!1)}function uU(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,l=e.expirationTimes,a=-0x3c00001&e.pendingLanes;0r){n=r;var o=e.ownerDocument;if(1&n&&sE(o.documentElement),2&n&&sE(o.body),4&n)for(sE(n=o.head),o=n.firstChild;o;){var i=o.nextSibling,u=o.nodeName;o[eI]||"SCRIPT"===u||"STYLE"===u||"LINK"===u&&"stylesheet"===o.rel.toLowerCase()||n.removeChild(o),o=i}}if(0===l){e.removeChild(a),cb(t);return}l--}else"$"===n||"$?"===n||"$!"===n?l++:r=n.charCodeAt(0)-48;else r=0;n=a}while(n);cb(t)}function sv(e){var t=e.firstChild;for(t&&10===t.nodeType&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":sv(n),eU(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if("stylesheet"===n.rel.toLowerCase())continue}e.removeChild(n)}}function sb(e){return"$!"===e.data||"$?"===e.data&&"complete"===e.ownerDocument.readyState}function sk(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t||"F!"===t||"F"===t)break;if("/$"===t)return null}}return e}var sw=null;function sS(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}function sx(e,t,n){switch(t=so(n),e){case"html":if(!(e=t.documentElement))throw Error(u(452));return e;case"head":if(!(e=t.head))throw Error(u(453));return e;case"body":if(!(e=t.body))throw Error(u(454));return e;default:throw Error(u(451))}}function sE(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);eU(e)}var sC=new Map,s_=new Set;function sP(e){return"function"==typeof e.getRootNode?e.getRootNode():9===e.nodeType?e:e.ownerDocument}var sz=A.d;A.d={f:function(){var e=sz.f(),t=un();return e||t},r:function(e){var t=eH(e);null!==t&&5===t.tag&&"form"===t.type?aO(t):sz.r(e)},D:function(e){sz.D(e),sT("dns-prefetch",e,null)},C:function(e,t){sz.C(e,t),sT("preconnect",e,t)},L:function(e,t,n){if(sz.L(e,t,n),sN&&e&&t){var r='link[rel="preload"][as="'+tt(t)+'"]';"image"===t&&n&&n.imageSrcSet?(r+='[imagesrcset="'+tt(n.imageSrcSet)+'"]',"string"==typeof n.imageSizes&&(r+='[imagesizes="'+tt(n.imageSizes)+'"]')):r+='[href="'+tt(e)+'"]';var l=r;switch(t){case"style":l=sO(e);break;case"script":l=sA(e)}sC.has(l)||(e=p({rel:"preload",href:"image"===t&&n&&n.imageSrcSet?void 0:e,as:t},n),sC.set(l,e),null!==sN.querySelector(r)||"style"===t&&sN.querySelector(sR(l))||"script"===t&&sN.querySelector(sF(l))||(sr(t=sN.createElement("link"),"link",e),eB(t),sN.head.appendChild(t)))}},m:function(e,t){if(sz.m(e,t),sN&&e){var n=t&&"string"==typeof t.as?t.as:"script",r='link[rel="modulepreload"][as="'+tt(n)+'"][href="'+tt(e)+'"]',l=r;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":l=sA(e)}if(!sC.has(l)&&(e=p({rel:"modulepreload",href:e},t),sC.set(l,e),null===sN.querySelector(r))){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(sN.querySelector(sF(l)))return}sr(n=sN.createElement("link"),"link",e),eB(n),sN.head.appendChild(n)}}},X:function(e,t){if(sz.X(e,t),sN&&e){var n=eV(sN).hoistableScripts,r=sA(e),l=n.get(r);l||((l=sN.querySelector(sF(r)))||(e=p({src:e,async:!0},t),(t=sC.get(r))&&sj(e,t),eB(l=sN.createElement("script")),sr(l,"link",e),sN.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},n.set(r,l))}},S:function(e,t,n){if(sz.S(e,t,n),sN&&e){var r=eV(sN).hoistableStyles,l=sO(e);t=t||"default";var a=r.get(l);if(!a){var o={loading:0,preload:null};if(a=sN.querySelector(sR(l)))o.loading=5;else{e=p({rel:"stylesheet",href:e,"data-precedence":t},n),(n=sC.get(l))&&sU(e,n);var i=a=sN.createElement("link");eB(i),sr(i,"link",e),i._p=new Promise(function(e,t){i.onload=e,i.onerror=t}),i.addEventListener("load",function(){o.loading|=1}),i.addEventListener("error",function(){o.loading|=2}),o.loading|=4,sI(a,t,sN)}a={type:"stylesheet",instance:a,count:1,state:o},r.set(l,a)}}},M:function(e,t){if(sz.M(e,t),sN&&e){var n=eV(sN).hoistableScripts,r=sA(e),l=n.get(r);l||((l=sN.querySelector(sF(r)))||(e=p({src:e,async:!0,type:"module"},t),(t=sC.get(r))&&sj(e,t),eB(l=sN.createElement("script")),sr(l,"link",e),sN.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},n.set(r,l))}}};var sN="undefined"==typeof document?null:document;function sT(e,t,n){if(sN&&"string"==typeof t&&t){var r=tt(t);r='link[rel="'+e+'"][href="'+r+'"]',"string"==typeof n&&(r+='[crossorigin="'+n+'"]'),s_.has(r)||(s_.add(r),e={rel:e,crossOrigin:n,href:t},null===sN.querySelector(r)&&(sr(t=sN.createElement("link"),"link",e),eB(t),sN.head.appendChild(t)))}}function sL(e,t,n,r){var l=(l=B.current)?sP(l):null;if(!l)throw Error(u(446));switch(e){case"meta":case"title":return null;case"style":return"string"==typeof n.precedence&&"string"==typeof n.href?(t=sO(n.href),(r=(n=eV(l).hoistableStyles).get(t))||(r={type:"style",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if("stylesheet"===n.rel&&"string"==typeof n.href&&"string"==typeof n.precedence){e=sO(n.href);var a,o,i,s,c=eV(l).hoistableStyles,f=c.get(e);if(f||(l=l.ownerDocument||l,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},c.set(e,f),(c=l.querySelector(sR(e)))&&!c._p&&(f.instance=c,f.state.loading=5),sC.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},sC.set(e,n),c||(a=l,o=e,i=n,s=f.state,a.querySelector('link[rel="preload"][as="style"]['+o+"]")?s.loading=1:(s.preload=o=a.createElement("link"),o.addEventListener("load",function(){return s.loading|=1}),o.addEventListener("error",function(){return s.loading|=2}),sr(o,"link",i),eB(o),a.head.appendChild(o))))),t&&null===r)throw Error(u(528,""));return f}if(t&&null!==r)throw Error(u(529,""));return null;case"script":return t=n.async,"string"==typeof(n=n.src)&&t&&"function"!=typeof t&&"symbol"!=typeof t?(t=sA(n),(r=(n=eV(l).hoistableScripts).get(t))||(r={type:"script",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(u(444,e))}}function sO(e){return'href="'+tt(e)+'"'}function sR(e){return'link[rel="stylesheet"]['+e+"]"}function sD(e){return p({},e,{"data-precedence":e.precedence,precedence:null})}function sA(e){return'[src="'+tt(e)+'"]'}function sF(e){return"script[async]"+e}function sM(e,t,n){if(t.count++,null===t.instance)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+tt(n.href)+'"]');if(r)return t.instance=r,eB(r),r;var l=p({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return eB(r=(e.ownerDocument||e).createElement("style")),sr(r,"style",l),sI(r,n.precedence,e),t.instance=r;case"stylesheet":l=sO(n.href);var a=e.querySelector(sR(l));if(a)return t.state.loading|=4,t.instance=a,eB(a),a;r=sD(n),(l=sC.get(l))&&sU(r,l),eB(a=(e.ownerDocument||e).createElement("link"));var o=a;return o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),sr(a,"link",r),t.state.loading|=4,sI(a,n.precedence,e),t.instance=a;case"script":if(a=sA(n.src),l=e.querySelector(sF(a)))return t.instance=l,eB(l),l;return r=n,(l=sC.get(a))&&sj(r=p({},n),l),eB(l=(e=e.ownerDocument||e).createElement("script")),sr(l,"link",r),e.head.appendChild(l),t.instance=l;case"void":return null;default:throw Error(u(443,t.type))}return"stylesheet"===t.type&&0==(4&t.state.loading)&&(r=t.instance,t.state.loading|=4,sI(r,n.precedence,e)),t.instance}function sI(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),l=r.length?r[r.length-1]:null,a=l,o=0;o title"):null)}function sB(e){return"stylesheet"!==e.type||0!=(3&e.state.loading)}var sQ=null;function sW(){}function sq(){if(this.count--,0===this.count){if(this.stylesheets)sY(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var sK=null;function sY(e,t){e.stylesheets=null,null!==e.unsuspend&&(e.count++,sK=new Map,t.forEach(sG,e),sK=null,sq.call(e))}function sG(e,t){if(!(4&t.state.loading)){var n=sK.get(e);if(n)var r=n.get(null);else{n=new Map,sK.set(e,n);for(var l=e.querySelectorAll("link[data-precedence],style[data-precedence]"),a=0;a{var n=Symbol.for("react.transitional.element");function r(e,t,r){var l=null;if(void 0!==r&&(l=""+r),void 0!==t.key&&(l=""+t.key),"key"in t)for(var a in r={},t)"key"!==a&&(r[a]=t[a]);else r=t;return{$$typeof:n,type:e,key:l,ref:void 0!==(t=r.ref)?t:null,props:r}}t.Fragment=Symbol.for("react.fragment"),t.jsx=r,t.jsxs=r},37876:(e,t,n)=>{e.exports=n(28228)},42167:(e,t,n)=>{var r=n(65364),l=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),h=Symbol.iterator,g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,v={};function b(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}function k(){}function w(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}b.prototype.isReactComponent={},b.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("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")},b.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},k.prototype=b.prototype;var S=w.prototype=new k;S.constructor=w,y(S,b.prototype),S.isPureReactComponent=!0;var x=Array.isArray,E={H:null,A:null,T:null,S:null,V:null},C=Object.prototype.hasOwnProperty;function _(e,t,n,r,a,o){return{$$typeof:l,type:e,key:t,ref:void 0!==(n=o.ref)?n:null,props:o}}function P(e){return"object"==typeof e&&null!==e&&e.$$typeof===l}var z=/\/+/g;function N(e,t){var n,r;return"object"==typeof e&&null!==e&&null!=e.key?(n=""+e.key,r={"=":"=0",":":"=2"},"$"+n.replace(/[=:]/g,function(e){return r[e]})):t.toString(36)}function T(){}function L(e,t,n){if(null==e)return e;var r=[],o=0;return!function e(t,n,r,o,i){var u,s,c,f=typeof t;("undefined"===f||"boolean"===f)&&(t=null);var d=!1;if(null===t)d=!0;else switch(f){case"bigint":case"string":case"number":d=!0;break;case"object":switch(t.$$typeof){case l:case a:d=!0;break;case m:return e((d=t._init)(t._payload),n,r,o,i)}}if(d)return i=i(t),d=""===o?"."+N(t,0):o,x(i)?(r="",null!=d&&(r=d.replace(z,"$&/")+"/"),e(i,n,r,"",function(e){return e})):null!=i&&(P(i)&&(u=i,s=r+(null==i.key||t&&t.key===i.key?"":(""+i.key).replace(z,"$&/")+"/")+d,i=_(u.type,s,void 0,void 0,void 0,u.props)),n.push(i)),1;d=0;var p=""===o?".":o+":";if(x(t))for(var g=0;g{function n(e,t){var n=e.length;for(e.push(t);0>>1,l=e[r];if(0>>1;ra(u,n))sa(c,u)?(e[r]=c,e[s]=n,r=s):(e[r]=u,e[i]=n,r=i);else if(sa(c,n))e[r]=c,e[s]=n,r=s;else break}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(t.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o,i=performance;t.unstable_now=function(){return i.now()}}else{var u=Date,s=u.now();t.unstable_now=function(){return u.now()-s}}var c=[],f=[],d=1,p=null,m=3,h=!1,g=!1,y=!1,v=!1,b="function"==typeof setTimeout?setTimeout:null,k="function"==typeof clearTimeout?clearTimeout:null,w="undefined"!=typeof setImmediate?setImmediate:null;function S(e){for(var t=r(f);null!==t;){if(null===t.callback)l(f);else if(t.startTime<=e)l(f),t.sortIndex=t.expirationTime,n(c,t);else break;t=r(f)}}function x(e){if(y=!1,S(e),!g)if(null!==r(c))g=!0,E||(E=!0,o());else{var t=r(f);null!==t&&O(x,t.startTime-e)}}var E=!1,C=-1,_=5,P=-1;function z(){return!!v||!(t.unstable_now()-P<_)}function N(){if(v=!1,E){var e=t.unstable_now();P=e;var n=!0;try{e:{g=!1,y&&(y=!1,k(C),C=-1),h=!0;var a=m;try{t:{for(S(e),p=r(c);null!==p&&!(p.expirationTime>e&&z());){var i=p.callback;if("function"==typeof i){p.callback=null,m=p.priorityLevel;var u=i(p.expirationTime<=e);if(e=t.unstable_now(),"function"==typeof u){p.callback=u,S(e),n=!0;break t}p===r(c)&&l(c),S(e)}else l(c);p=r(c)}if(null!==p)n=!0;else{var s=r(f);null!==s&&O(x,s.startTime-e),n=!1}}break e}finally{p=null,m=a,h=!1}}}finally{n?o():E=!1}}}if("function"==typeof w)o=function(){w(N)};else if("undefined"!=typeof MessageChannel){var T=new MessageChannel,L=T.port2;T.port1.onmessage=N,o=function(){L.postMessage(null)}}else o=function(){b(N,0)};function O(e,n){C=b(function(){e(t.unstable_now())},n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_forceFrameRate=function(e){0>e||125i?(e.sortIndex=a,n(f,e),null===r(c)&&e===r(f)&&(y?(k(C),C=-1):y=!0,O(x,a-i))):(e.sortIndex=u,n(c,e),g||h||(g=!0,E||(E=!0,o()))),e},t.unstable_shouldYield=z,t.unstable_wrapCallback=function(e){var t=m;return function(){var n=m;m=t;try{return e.apply(this,arguments)}finally{m=n}}}},62786:(e,t,n)=>{e.exports=n(45919)},78944:(e,t,n)=>{!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),e.exports=n(24279)},84655:(e,t,n)=>{var r=n(14232);function l(e){var t="https://react.dev/errors/"+e;if(1{!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),e.exports=n(84655)}}]); \ No newline at end of file diff --git a/_next/static/chunks/main-599738e4e4dd0ebe.js b/_next/static/chunks/main-599738e4e4dd0ebe.js new file mode 100644 index 0000000000000000000000000000000000000000..6d57bc1a8a0bd04db82341f76797b59bbc359ea7 --- /dev/null +++ b/_next/static/chunks/main-599738e4e4dd0ebe.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[792],{321:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"pathHasPrefix",{enumerable:!0,get:function(){return a}});let n=r(82585);function a(e,t){if("string"!=typeof e)return!1;let{pathname:r}=(0,n.parsePath)(e);return r===t||r.startsWith(t+"/")}},359:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{formatUrl:function(){return o},formatWithValidation:function(){return u},urlObjectKeys:function(){return i}});let n=r(88365)._(r(67825)),a=/https?|ftp|gopher|file/;function o(e){let{auth:t,hostname:r}=e,o=e.protocol||"",i=e.pathname||"",u=e.hash||"",s=e.query||"",l=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?l=t+e.host:r&&(l=t+(~r.indexOf(":")?"["+r+"]":r),e.port&&(l+=":"+e.port)),s&&"object"==typeof s&&(s=String(n.urlQueryToSearchParams(s)));let c=e.search||s&&"?"+s||"";return o&&!o.endsWith(":")&&(o+=":"),e.slashes||(!o||a.test(o))&&!1!==l?(l="//"+(l||""),i&&"/"!==i[0]&&(i="/"+i)):l||(l=""),u&&"#"!==u[0]&&(u="#"+u),c&&"?"!==c[0]&&(c="?"+c),""+o+l+(i=i.replace(/[?#]/g,encodeURIComponent))+(c=c.replace("#","%23"))+u}let i=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function u(e){return o(e)}},1033:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{DecodeError:function(){return h},MiddlewareNotFoundError:function(){return E},MissingStaticPage:function(){return g},NormalizeError:function(){return _},PageNotFoundError:function(){return m},SP:function(){return d},ST:function(){return p},WEB_VITALS:function(){return r},execOnce:function(){return n},getDisplayName:function(){return s},getLocationOrigin:function(){return i},getURL:function(){return u},isAbsoluteUrl:function(){return o},isResSent:function(){return l},loadGetInitialProps:function(){return f},normalizeRepeatedSlashes:function(){return c},stringifyError:function(){return y}});let r=["CLS","FCP","FID","INP","LCP","TTFB"];function n(e){let t,r=!1;return function(){for(var n=arguments.length,a=Array(n),o=0;oa.test(e);function i(){let{protocol:e,hostname:t,port:r}=window.location;return e+"//"+t+(r?":"+r:"")}function u(){let{href:e}=window.location,t=i();return e.substring(t.length)}function s(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function l(e){return e.finished||e.headersSent}function c(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?"?"+t.slice(1).join("?"):"")}async function f(e,t){let r=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await f(t.Component,t.ctx)}:{};let n=await e.getInitialProps(t);if(r&&l(r))return n;if(!n)throw Object.defineProperty(Error('"'+s(e)+'.getInitialProps()" should resolve to an object. But found "'+n+'" instead.'),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return n}let d="undefined"!=typeof performance,p=d&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class h extends Error{}class _ extends Error{}class m extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message="Cannot find module for page: "+e}}class g extends Error{constructor(e,t){super(),this.message="Failed to load static file for page: "+e+" "+t}}class E extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function y(e){return JSON.stringify({message:e.message,stack:e.stack})}},2326:(e,t)=>{"use strict";function r(e){return"/api"===e||!!(null==e?void 0:e.startsWith("/api/"))}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isAPIRoute",{enumerable:!0,get:function(){return r}})},2786:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{normalizeAppPath:function(){return o},normalizeRscURL:function(){return i}});let n=r(71775),a=r(54933);function o(e){return(0,n.ensureLeadingSlash)(e.split("/").reduce((e,t,r,n)=>!t||(0,a.isGroupSegment)(t)||"@"===t[0]||("page"===t||"route"===t)&&r===n.length-1?e:e+"/"+t,""))}function i(e){return e.replace(/\.rsc($|\?)/,"$1")}},2974:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"HTML_LIMITED_BOT_UA_RE",{enumerable:!0,get:function(){return r}});let r=/[\w-]+-Google|Google-[\w-]+|Chrome-Lighthouse|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Yeti|googleweblight/i},3239:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"escapeStringRegexp",{enumerable:!0,get:function(){return a}});let r=/[|\\{}()[\]^$+*?.-]/,n=/[|\\{}()[\]^$+*?.-]/g;function a(e){return r.test(e)?e.replace(n,"\\$&"):e}},3669:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{AppRouterContext:function(){return a},GlobalLayoutRouterContext:function(){return i},LayoutRouterContext:function(){return o},MissingSlotContext:function(){return s},TemplateContext:function(){return u}});let n=r(64252)._(r(14232)),a=n.default.createContext(null),o=n.default.createContext(null),i=n.default.createContext(null),u=n.default.createContext(null),s=n.default.createContext(new Set)},4316:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{HTML_LIMITED_BOT_UA_RE:function(){return n.HTML_LIMITED_BOT_UA_RE},HTML_LIMITED_BOT_UA_RE_STRING:function(){return o},getBotType:function(){return s},isBot:function(){return u}});let n=r(2974),a=/Googlebot(?!-)|Googlebot$/i,o=n.HTML_LIMITED_BOT_UA_RE.source;function i(e){return n.HTML_LIMITED_BOT_UA_RE.test(e)}function u(e){return a.test(e)||i(e)}function s(e){return a.test(e)?"dom":i(e)?"html":void 0}},5025:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{RouteAnnouncer:function(){return s},default:function(){return l}});let n=r(64252),a=r(37876),o=n._(r(14232)),i=r(6763),u={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",top:0,width:"1px",whiteSpace:"nowrap",wordWrap:"normal"},s=()=>{let{asPath:e}=(0,i.useRouter)(),[t,r]=o.default.useState(""),n=o.default.useRef(e);return o.default.useEffect(()=>{if(n.current!==e)if(n.current=e,document.title)r(document.title);else{var t;let n=document.querySelector("h1");r((null!=(t=null==n?void 0:n.innerText)?t:null==n?void 0:n.textContent)||e)}},[e]),(0,a.jsx)("p",{"aria-live":"assertive",id:"__next-route-announcer__",role:"alert",style:u,children:t})},l=s;("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},5402:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"parseRelativeUrl",{enumerable:!0,get:function(){return o}});let n=r(1033),a=r(67825);function o(e,t,r){void 0===r&&(r=!0);let o=new URL((0,n.getLocationOrigin)()),i=t?new URL(t,o):e.startsWith(".")?new URL(window.location.href):o,{pathname:u,searchParams:s,search:l,hash:c,href:f,origin:d}=new URL(e,i);if(d!==o.origin)throw Object.defineProperty(Error("invariant: invalid relative URL, router received "+e),"__NEXT_ERROR_CODE",{value:"E159",enumerable:!1,configurable:!0});return{pathname:u,query:r?(0,a.searchParamsToUrlQuery)(s):void 0,search:l,hash:c,href:f.slice(d.length),slashes:void 0}}},6763:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{Router:function(){return o.default},createRouter:function(){return _},default:function(){return p},makePublicRouterInstance:function(){return m},useRouter:function(){return h},withRouter:function(){return s.default}});let n=r(64252),a=n._(r(14232)),o=n._(r(54267)),i=r(54387),u=n._(r(66240)),s=n._(r(73824)),l={router:null,readyCallbacks:[],ready(e){if(this.router)return e();this.readyCallbacks.push(e)}},c=["pathname","route","query","asPath","components","isFallback","basePath","locale","locales","defaultLocale","isReady","isPreview","isLocaleDomain","domainLocales"],f=["push","replace","reload","back","prefetch","beforePopState"];function d(){if(!l.router)throw Object.defineProperty(Error('No router instance found.\nYou should only use "next/router" on the client side of your app.\n'),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return l.router}Object.defineProperty(l,"events",{get:()=>o.default.events}),c.forEach(e=>{Object.defineProperty(l,e,{get:()=>d()[e]})}),f.forEach(e=>{l[e]=function(){for(var t=arguments.length,r=Array(t),n=0;n{l.ready(()=>{o.default.events.on(e,function(){for(var t=arguments.length,r=Array(t),n=0;ne()),l.readyCallbacks=[],l.router}function m(e){let t={};for(let r of c){if("object"==typeof e[r]){t[r]=Object.assign(Array.isArray(e[r])?[]:{},e[r]);continue}t[r]=e[r]}return t.events=o.default.events,f.forEach(r=>{t[r]=function(){for(var t=arguments.length,n=Array(t),a=0;a{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{PathParamsContext:function(){return i},PathnameContext:function(){return o},SearchParamsContext:function(){return a}});let n=r(14232),a=(0,n.createContext)(null),o=(0,n.createContext)(null),i=(0,n.createContext)(null)},13666:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"RedirectStatusCode",{enumerable:!0,get:function(){return r}});var r=function(e){return e[e.SeeOther=303]="SeeOther",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e}({});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},15358:(e,t)=>{"use strict";function r(e,t){return void 0===t&&(t=""),("/"===e?"/index":/^\/index(\/|$)/.test(e)?"/index"+e:e)+t}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return r}})},15861:e=>{!function(){var t={229:function(e){var t,r,n,a=e.exports={};function o(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}function u(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}var s=[],l=!1,c=-1;function f(){l&&n&&(l=!1,n.length?s=n.concat(s):c=-1,s.length&&d())}function d(){if(!l){var e=u(f);l=!0;for(var t=s.length;t;){for(n=s,s=[];++c1)for(var r=1;r{"use strict";let n,a,o,i,u,s,l,c,f,d,p,h;Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{emitter:function(){return H},hydrate:function(){return eu},initialize:function(){return q},router:function(){return n},version:function(){return B}});let _=r(64252),m=r(37876);r(21291);let g=_._(r(14232)),E=_._(r(78944)),y=r(74324),b=_._(r(24622)),P=r(54387),v=r(20785),R=r(88668),O=r(67825),S=r(83378),T=r(1033),A=r(27311),j=_._(r(57962)),w=_._(r(82155)),C=r(5025),I=r(6763),x=r(66240),N=r(81854),M=r(39116),L=r(92860),D=r(3669),U=r(83250),F=r(9440),k=r(49452);r(69272),r(23428);let B="15.5.4",H=(0,b.default)(),X=e=>[].slice.call(e),W=!1;class G extends g.default.Component{componentDidCatch(e,t){this.props.fn(e,t)}componentDidMount(){this.scrollToHash(),n.isSsr&&(a.isFallback||a.nextExport&&((0,R.isDynamicRoute)(n.pathname)||location.search||W)||a.props&&a.props.__N_SSG&&(location.search||W))&&n.replace(n.pathname+"?"+String((0,O.assign)((0,O.urlQueryToSearchParams)(n.query),new URLSearchParams(location.search))),o,{_h:1,shallow:!a.isFallback&&!W}).catch(e=>{if(!e.cancelled)throw e})}componentDidUpdate(){this.scrollToHash()}scrollToHash(){let{hash:e}=location;if(!(e=e&&e.substring(1)))return;let t=document.getElementById(e);t&&setTimeout(()=>t.scrollIntoView(),0)}render(){return this.props.children}}async function q(e){void 0===e&&(e={}),a=JSON.parse(document.getElementById("__NEXT_DATA__").textContent),window.__NEXT_DATA__=a,h=a.defaultLocale;let t=a.assetPrefix||"";if(self.__next_set_public_path__(""+t+"/_next/"),(0,S.setConfig)({serverRuntimeConfig:{},publicRuntimeConfig:a.runtimeConfig||{}}),o=(0,T.getURL)(),(0,L.hasBasePath)(o)&&(o=(0,M.removeBasePath)(o)),a.scriptLoader){let{initScriptLoader:e}=r(87665);e(a.scriptLoader)}i=new w.default(a.buildId,t);let l=e=>{let[t,r]=e;return i.routeLoader.onEntrypoint(t,r)};return window.__NEXT_P&&window.__NEXT_P.map(e=>setTimeout(()=>l(e),0)),window.__NEXT_P=[],window.__NEXT_P.push=l,(s=(0,j.default)()).getIsSsr=()=>n.isSsr,u=document.getElementById("__next"),{assetPrefix:t}}function z(e,t){return(0,m.jsx)(e,{...t})}function V(e){var t;let{children:r}=e,a=g.default.useMemo(()=>(0,U.adaptForAppRouterInstance)(n),[]);return(0,m.jsx)(G,{fn:e=>K({App:f,err:e}).catch(e=>console.error("Error rendering page: ",e)),children:(0,m.jsx)(D.AppRouterContext.Provider,{value:a,children:(0,m.jsx)(F.SearchParamsContext.Provider,{value:(0,U.adaptForSearchParams)(n),children:(0,m.jsx)(U.PathnameContextProviderAdapter,{router:n,isAutoExport:null!=(t=self.__NEXT_DATA__.autoExport)&&t,children:(0,m.jsx)(F.PathParamsContext.Provider,{value:(0,U.adaptForPathParams)(n),children:(0,m.jsx)(P.RouterContext.Provider,{value:(0,I.makePublicRouterInstance)(n),children:(0,m.jsx)(y.HeadManagerContext.Provider,{value:s,children:(0,m.jsx)(N.ImageConfigContext.Provider,{value:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image/",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!0},children:r})})})})})})})})}let Y=e=>t=>{let r={...t,Component:p,err:a.err,router:n};return(0,m.jsx)(V,{children:z(e,r)})};function K(e){let{App:t,err:u}=e;return console.error(u),console.error("A client-side exception has occurred, see here for more info: https://nextjs.org/docs/messages/client-side-exception-occurred"),i.loadPage("/_error").then(n=>{let{page:a,styleSheets:o}=n;return(null==l?void 0:l.Component)===a?r.e(646).then(r.t.bind(r,31646,23)).then(n=>r.e(139).then(r.t.bind(r,45139,23)).then(r=>(e.App=t=r.default,n))).then(e=>({ErrorComponent:e.default,styleSheets:[]})):{ErrorComponent:a,styleSheets:o}}).then(r=>{var i;let{ErrorComponent:s,styleSheets:l}=r,c=Y(t),f={Component:s,AppTree:c,router:n,ctx:{err:u,pathname:a.page,query:a.query,asPath:o,AppTree:c}};return Promise.resolve((null==(i=e.props)?void 0:i.err)?e.props:(0,T.loadGetInitialProps)(t,f)).then(t=>eo({...e,err:u,Component:s,styleSheets:l,props:t}))})}function $(e){let{callback:t}=e;return g.default.useLayoutEffect(()=>t(),[t]),null}let Q={navigationStart:"navigationStart",beforeRender:"beforeRender",afterRender:"afterRender",afterHydrate:"afterHydrate",routeChange:"routeChange"},J={hydration:"Next.js-hydration",beforeHydration:"Next.js-before-hydration",routeChangeToRender:"Next.js-route-change-to-render",render:"Next.js-render"},Z=null,ee=!0;function et(){[Q.beforeRender,Q.afterHydrate,Q.afterRender,Q.routeChange].forEach(e=>performance.clearMarks(e))}function er(){T.ST&&(performance.mark(Q.afterHydrate),performance.getEntriesByName(Q.beforeRender,"mark").length&&(performance.measure(J.beforeHydration,Q.navigationStart,Q.beforeRender),performance.measure(J.hydration,Q.beforeRender,Q.afterHydrate)),d&&performance.getEntriesByName(J.hydration).forEach(d),et())}function en(){if(!T.ST)return;performance.mark(Q.afterRender);let e=performance.getEntriesByName(Q.routeChange,"mark");e.length&&(performance.getEntriesByName(Q.beforeRender,"mark").length&&(performance.measure(J.routeChangeToRender,e[0].name,Q.beforeRender),performance.measure(J.render,Q.beforeRender,Q.afterRender),d&&(performance.getEntriesByName(J.render).forEach(d),performance.getEntriesByName(J.routeChangeToRender).forEach(d))),et(),[J.routeChangeToRender,J.render].forEach(e=>performance.clearMeasures(e)))}function ea(e){let{callbacks:t,children:r}=e;return g.default.useLayoutEffect(()=>t.forEach(e=>e()),[t]),r}function eo(e){let t,r,{App:a,Component:o,props:i,err:s}=e,f="initial"in e?void 0:e.styleSheets;o=o||l.Component;let d={...i=i||l.props,Component:o,err:s,router:n};l=d;let p=!1,h=new Promise((e,t)=>{c&&c(),r=()=>{c=null,e()},c=()=>{p=!0,c=null;let e=Object.defineProperty(Error("Cancel rendering route"),"__NEXT_ERROR_CODE",{value:"E503",enumerable:!1,configurable:!0});e.cancelled=!0,t(e)}});function _(){r()}!function(){if(!f)return;let e=new Set(X(document.querySelectorAll("style[data-n-href]")).map(e=>e.getAttribute("data-n-href"))),t=document.querySelector("noscript[data-n-css]"),r=null==t?void 0:t.getAttribute("data-n-css");f.forEach(t=>{let{href:n,text:a}=t;if(!e.has(n)){let e=document.createElement("style");e.setAttribute("data-n-href",n),e.setAttribute("media","x"),r&&e.setAttribute("nonce",r),document.head.appendChild(e),e.appendChild(document.createTextNode(a))}})}();let y=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)($,{callback:function(){if(f&&!p){let e=new Set(f.map(e=>e.href)),t=X(document.querySelectorAll("style[data-n-href]")),r=t.map(e=>e.getAttribute("data-n-href"));for(let n=0;n{let{href:t}=e,r=document.querySelector('style[data-n-href="'+t+'"]');r&&(n.parentNode.insertBefore(r,n.nextSibling),n=r)}),X(document.querySelectorAll("link[data-n-p]")).forEach(e=>{e.parentNode.removeChild(e)})}if(e.scroll){let{x:t,y:r}=e.scroll;(0,v.disableSmoothScrollDuringRouteTransition)(()=>{window.scrollTo(t,r)})}}}),(0,m.jsxs)(V,{children:[z(a,d),(0,m.jsx)(A.Portal,{type:"next-route-announcer",children:(0,m.jsx)(C.RouteAnnouncer,{})})]})]});var b=u;T.ST&&performance.mark(Q.beforeRender);let P=(t=ee?er:en,(0,m.jsx)(ea,{callbacks:[t,_],children:(0,m.jsx)(g.default.StrictMode,{children:y})}));return Z?(0,g.default.startTransition)(()=>{Z.render(P)}):(Z=E.default.hydrateRoot(b,P,{onRecoverableError:k.onRecoverableError}),ee=!1),h}async function ei(e){if(e.err&&(void 0===e.Component||!e.isHydratePass))return void await K(e);try{await eo(e)}catch(r){let t=(0,x.getProperError)(r);if(t.cancelled)throw t;await K({...e,err:t})}}async function eu(e){let t=a.err;try{let e=await i.routeLoader.whenEntrypoint("/_app");if("error"in e)throw e.error;let{component:t,exports:r}=e;f=t,r&&r.reportWebVitals&&(d=e=>{let t,{id:n,name:a,startTime:o,value:i,duration:u,entryType:s,entries:l,attribution:c}=e,f=Date.now()+"-"+(Math.floor(Math.random()*(9e12-1))+1e12);l&&l.length&&(t=l[0].startTime);let d={id:n||f,name:a,startTime:o||t,value:null==i?u:i,label:"mark"===s||"measure"===s?"custom":"web-vital"};c&&(d.attribution=c),r.reportWebVitals(d)});let n=await i.routeLoader.whenEntrypoint(a.page);if("error"in n)throw n.error;p=n.component}catch(e){t=(0,x.getProperError)(e)}window.__NEXT_PRELOADREADY&&await window.__NEXT_PRELOADREADY(a.dynamicIds),n=(0,I.createRouter)(a.page,a.query,o,{initialProps:a.props,pageLoader:i,App:f,Component:p,wrapApp:Y,err:t,isFallback:!!a.isFallback,subscription:(e,t,r)=>ei(Object.assign({},e,{App:t,scroll:r})),locale:a.locale,locales:a.locales,defaultLocale:h,domainLocales:a.domainLocales,isPreview:a.isPreview}),W=await n._initialMatchesMiddlewarePromise;let r={App:f,initial:!0,Component:p,props:a.props,err:t,isHydratePass:!0};(null==e?void 0:e.beforeRender)&&await e.beforeRender(),ei(r)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},17136:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getNextPathnameInfo",{enumerable:!0,get:function(){return i}});let n=r(83847),a=r(98091),o=r(321);function i(e,t){var r,i;let{basePath:u,i18n:s,trailingSlash:l}=null!=(r=t.nextConfig)?r:{},c={pathname:e,trailingSlash:"/"!==e?e.endsWith("/"):l};u&&(0,o.pathHasPrefix)(c.pathname,u)&&(c.pathname=(0,a.removePathPrefix)(c.pathname,u),c.basePath=u);let f=c.pathname;if(c.pathname.startsWith("/_next/data/")&&c.pathname.endsWith(".json")){let e=c.pathname.replace(/^\/_next\/data\//,"").replace(/\.json$/,"").split("/");c.buildId=e[0],f="index"!==e[1]?"/"+e.slice(1).join("/"):"/",!0===t.parseData&&(c.pathname=f)}if(s){let e=t.i18nProvider?t.i18nProvider.analyze(c.pathname):(0,n.normalizeLocalePath)(c.pathname,s.locales);c.locale=e.detectedLocale,c.pathname=null!=(i=e.pathname)?i:c.pathname,!e.detectedLocale&&c.buildId&&(e=t.i18nProvider?t.i18nProvider.analyze(f):(0,n.normalizeLocalePath)(f,s.locales)).detectedLocale&&(c.locale=e.detectedLocale)}return c}},18804:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{HTTPAccessErrorStatus:function(){return r},HTTP_ERROR_FALLBACK_ERROR_CODE:function(){return a},getAccessFallbackErrorTypeByStatus:function(){return u},getAccessFallbackHTTPStatus:function(){return i},isHTTPAccessFallbackError:function(){return o}});let r={NOT_FOUND:404,FORBIDDEN:403,UNAUTHORIZED:401},n=new Set(Object.values(r)),a="NEXT_HTTP_ERROR_FALLBACK";function o(e){if("object"!=typeof e||null===e||!("digest"in e)||"string"!=typeof e.digest)return!1;let[t,r]=e.digest.split(";");return t===a&&n.has(Number(r))}function i(e){return Number(e.digest.split(";")[1])}function u(e){switch(e){case 401:return"unauthorized";case 403:return"forbidden";case 404:return"not-found";default:return}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},19393:()=>{},20718:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"interpolateAs",{enumerable:!0,get:function(){return o}});let n=r(51082),a=r(70159);function o(e,t,r){let o="",i=(0,a.getRouteRegex)(e),u=i.groups,s=(t!==e?(0,n.getRouteMatcher)(i)(t):"")||r;o=e;let l=Object.keys(u);return l.every(e=>{let t=s[e]||"",{repeat:r,optional:n}=u[e],a="["+(r?"...":"")+e+"]";return n&&(a=(t?"":"/")+"["+a+"]"),r&&!Array.isArray(t)&&(t=[t]),(n||e in s)&&(o=o.replace(a,r?t.map(e=>encodeURIComponent(e)).join("/"):encodeURIComponent(t))||"/")})||(o=""),{params:l,result:o}}},20785:(e,t,r)=>{"use strict";function n(e,t){if(void 0===t&&(t={}),t.onlyHashChange)return void e();let r=document.documentElement;r.dataset.scrollBehavior;let n=r.style.scrollBehavior;r.style.scrollBehavior="auto",t.dontForceLayout||r.getClientRects(),e(),r.style.scrollBehavior=n}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"disableSmoothScrollDuringRouteTransition",{enumerable:!0,get:function(){return n}}),r(76456)},21112:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{cancelIdleCallback:function(){return n},requestIdleCallback:function(){return r}});let r="undefined"!=typeof self&&self.requestIdleCallback&&self.requestIdleCallback.bind(window)||function(e){let t=Date.now();return self.setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-t))}})},1)},n="undefined"!=typeof self&&self.cancelIdleCallback&&self.cancelIdleCallback.bind(window)||function(e){return clearTimeout(e)};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},21291:()=>{"trimStart"in String.prototype||(String.prototype.trimStart=String.prototype.trimLeft),"trimEnd"in String.prototype||(String.prototype.trimEnd=String.prototype.trimRight),"description"in Symbol.prototype||Object.defineProperty(Symbol.prototype,"description",{configurable:!0,get:function(){var e=/\((.*)\)/.exec(this.toString());return e?e[1]:void 0}}),Array.prototype.flat||(Array.prototype.flat=function(e,t){return t=this.concat.apply([],this),e>1&&t.some(Array.isArray)?t.flat(e-1):t},Array.prototype.flatMap=function(e,t){return this.map(e,t).flat()}),Promise.prototype.finally||(Promise.prototype.finally=function(e){if("function"!=typeof e)return this.then(e,e);var t=this.constructor||Promise;return this.then(function(r){return t.resolve(e()).then(function(){return r})},function(r){return t.resolve(e()).then(function(){throw r})})}),Object.fromEntries||(Object.fromEntries=function(e){return Array.from(e).reduce(function(e,t){return e[t[0]]=t[1],e},{})}),Array.prototype.at||(Array.prototype.at=function(e){var t=Math.trunc(e)||0;if(t<0&&(t+=this.length),!(t<0||t>=this.length))return this[t]}),Object.hasOwn||(Object.hasOwn=function(e,t){if(null==e)throw TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(e),t)}),"canParse"in URL||(URL.canParse=function(e,t){try{return new URL(e,t),!0}catch(e){return!1}})},23428:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isNextRouterError",{enumerable:!0,get:function(){return o}});let n=r(18804),a=r(86500);function o(e){return(0,a.isRedirectError)(e)||(0,n.isHTTPAccessFallbackError)(e)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},24622:(e,t)=>{"use strict";function r(){let e=Object.create(null);return{on(t,r){(e[t]||(e[t]=[])).push(r)},off(t,r){e[t]&&e[t].splice(e[t].indexOf(r)>>>0,1)},emit(t){for(var r=arguments.length,n=Array(r>1?r-1:0),a=1;a{e(...n)})}}}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return r}})},24802:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{getSortedRouteObjects:function(){return a},getSortedRoutes:function(){return n}});class r{insert(e){this._insert(e.split("/").filter(Boolean),[],!1)}smoosh(){return this._smoosh()}_smoosh(e){void 0===e&&(e="/");let t=[...this.children.keys()].sort();null!==this.slugName&&t.splice(t.indexOf("[]"),1),null!==this.restSlugName&&t.splice(t.indexOf("[...]"),1),null!==this.optionalRestSlugName&&t.splice(t.indexOf("[[...]]"),1);let r=t.map(t=>this.children.get(t)._smoosh(""+e+t+"/")).reduce((e,t)=>[...e,...t],[]);if(null!==this.slugName&&r.push(...this.children.get("[]")._smoosh(e+"["+this.slugName+"]/")),!this.placeholder){let t="/"===e?"/":e.slice(0,-1);if(null!=this.optionalRestSlugName)throw Object.defineProperty(Error('You cannot define a route with the same specificity as a optional catch-all route ("'+t+'" and "'+t+"[[..."+this.optionalRestSlugName+']]").'),"__NEXT_ERROR_CODE",{value:"E458",enumerable:!1,configurable:!0});r.unshift(t)}return null!==this.restSlugName&&r.push(...this.children.get("[...]")._smoosh(e+"[..."+this.restSlugName+"]/")),null!==this.optionalRestSlugName&&r.push(...this.children.get("[[...]]")._smoosh(e+"[[..."+this.optionalRestSlugName+"]]/")),r}_insert(e,t,n){if(0===e.length){this.placeholder=!1;return}if(n)throw Object.defineProperty(Error("Catch-all must be the last part of the URL."),"__NEXT_ERROR_CODE",{value:"E392",enumerable:!1,configurable:!0});let a=e[0];if(a.startsWith("[")&&a.endsWith("]")){let r=a.slice(1,-1),i=!1;if(r.startsWith("[")&&r.endsWith("]")&&(r=r.slice(1,-1),i=!0),r.startsWith("…"))throw Object.defineProperty(Error("Detected a three-dot character ('…') at ('"+r+"'). Did you mean ('...')?"),"__NEXT_ERROR_CODE",{value:"E147",enumerable:!1,configurable:!0});if(r.startsWith("...")&&(r=r.substring(3),n=!0),r.startsWith("[")||r.endsWith("]"))throw Object.defineProperty(Error("Segment names may not start or end with extra brackets ('"+r+"')."),"__NEXT_ERROR_CODE",{value:"E421",enumerable:!1,configurable:!0});if(r.startsWith("."))throw Object.defineProperty(Error("Segment names may not start with erroneous periods ('"+r+"')."),"__NEXT_ERROR_CODE",{value:"E288",enumerable:!1,configurable:!0});function o(e,r){if(null!==e&&e!==r)throw Object.defineProperty(Error("You cannot use different slug names for the same dynamic path ('"+e+"' !== '"+r+"')."),"__NEXT_ERROR_CODE",{value:"E337",enumerable:!1,configurable:!0});t.forEach(e=>{if(e===r)throw Object.defineProperty(Error('You cannot have the same slug name "'+r+'" repeat within a single dynamic path'),"__NEXT_ERROR_CODE",{value:"E247",enumerable:!1,configurable:!0});if(e.replace(/\W/g,"")===a.replace(/\W/g,""))throw Object.defineProperty(Error('You cannot have the slug names "'+e+'" and "'+r+'" differ only by non-word symbols within a single dynamic path'),"__NEXT_ERROR_CODE",{value:"E499",enumerable:!1,configurable:!0})}),t.push(r)}if(n)if(i){if(null!=this.restSlugName)throw Object.defineProperty(Error('You cannot use both an required and optional catch-all route at the same level ("[...'+this.restSlugName+']" and "'+e[0]+'" ).'),"__NEXT_ERROR_CODE",{value:"E299",enumerable:!1,configurable:!0});o(this.optionalRestSlugName,r),this.optionalRestSlugName=r,a="[[...]]"}else{if(null!=this.optionalRestSlugName)throw Object.defineProperty(Error('You cannot use both an optional and required catch-all route at the same level ("[[...'+this.optionalRestSlugName+']]" and "'+e[0]+'").'),"__NEXT_ERROR_CODE",{value:"E300",enumerable:!1,configurable:!0});o(this.restSlugName,r),this.restSlugName=r,a="[...]"}else{if(i)throw Object.defineProperty(Error('Optional route parameters are not yet supported ("'+e[0]+'").'),"__NEXT_ERROR_CODE",{value:"E435",enumerable:!1,configurable:!0});o(this.slugName,r),this.slugName=r,a="[]"}}this.children.has(a)||this.children.set(a,new r),this.children.get(a)._insert(e.slice(1),t,n)}constructor(){this.placeholder=!0,this.children=new Map,this.slugName=null,this.restSlugName=null,this.optionalRestSlugName=null}}function n(e){let t=new r;return e.forEach(e=>t.insert(e)),t.smoosh()}function a(e,t){let r={},a=[];for(let n=0;ne[r[t]])}},27311:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Portal",{enumerable:!0,get:function(){return o}});let n=r(14232),a=r(98477),o=e=>{let{children:t,type:r}=e,[o,i]=(0,n.useState)(null);return(0,n.useEffect)(()=>{let e=document.createElement(r);return document.body.appendChild(e),i(e),()=>{document.body.removeChild(e)}},[r]),o?(0,a.createPortal)(t,o):null};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},27426:(e,t)=>{"use strict";function r(e){return new URL(e,"http://n").searchParams}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"asPathToSearchParams",{enumerable:!0,get:function(){return r}})},29509:e=>{(()=>{"use strict";"undefined"!=typeof __nccwpck_require__&&(__nccwpck_require__.ab="//");var t={};(()=>{function e(e,t){void 0===t&&(t={});for(var r=function(e){for(var t=[],r=0;r=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122||95===i){a+=e[o++];continue}break}if(!a)throw TypeError("Missing parameter name at ".concat(r));t.push({type:"NAME",index:r,value:a}),r=o;continue}if("("===n){var u=1,s="",o=r+1;if("?"===e[o])throw TypeError('Pattern cannot start with "?" at '.concat(o));for(;o-1)return!0}return!1},m=function(e){var t=s[s.length-1],r=e||(t&&"string"==typeof t?t:"");if(t&&!r)throw TypeError('Must have text between two parameters, missing text after "'.concat(t.name,'"'));return!r||_(r)?"[^".concat(a(u),"]+?"):"(?:(?!".concat(a(r),")[^").concat(a(u),"])+?")};c-1:void 0===P;i||(_+="(?:".concat(h,"(?=").concat(p,"))?")),v||(_+="(?=".concat(h,"|").concat(p,")"))}return new RegExp(_,o(r))}function u(t,r,n){if(t instanceof RegExp){var a;if(!r)return t;for(var s=/\((?:\?<(.*?)>)?(?!\?)/g,l=0,c=s.exec(t.source);c;)r.push({name:c[1]||l++,prefix:"",suffix:"",modifier:"",pattern:""}),c=s.exec(t.source);return t}return Array.isArray(t)?(a=t.map(function(e){return u(e,r,n).source}),new RegExp("(?:".concat(a.join("|"),")"),o(n))):i(e(t,n),r,n)}Object.defineProperty(t,"__esModule",{value:!0}),t.pathToRegexp=t.tokensToRegexp=t.regexpToFunction=t.match=t.tokensToFunction=t.compile=t.parse=void 0,t.parse=e,t.compile=function(t,n){return r(e(t,n),n)},t.tokensToFunction=r,t.match=function(e,t){var r=[];return n(u(e,r,t),r,t)},t.regexpToFunction=n,t.tokensToRegexp=i,t.pathToRegexp=u})(),e.exports=t})()},30425:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{createRouteLoader:function(){return m},getClientBuildManifest:function(){return h},isAssetError:function(){return c},markAssetError:function(){return l}}),r(64252),r(15358);let n=r(87233),a=r(21112),o=r(78757),i=r(44047);function u(e,t,r){let n,a=t.get(e);if(a)return"future"in a?a.future:Promise.resolve(a);let o=new Promise(e=>{n=e});return t.set(e,{resolve:n,future:o}),r?r().then(e=>(n(e),e)).catch(r=>{throw t.delete(e),r}):o}let s=Symbol("ASSET_LOAD_ERROR");function l(e){return Object.defineProperty(e,s,{})}function c(e){return e&&s in e}let f=function(e){try{return e=document.createElement("link"),!!window.MSInputMethodContext&&!!document.documentMode||e.relList.supports("prefetch")}catch(e){return!1}}(),d=()=>(0,o.getDeploymentIdQueryOrEmptyString)();function p(e,t,r){return new Promise((n,o)=>{let i=!1;e.then(e=>{i=!0,n(e)}).catch(o),(0,a.requestIdleCallback)(()=>setTimeout(()=>{i||o(r)},t))})}function h(){return self.__BUILD_MANIFEST?Promise.resolve(self.__BUILD_MANIFEST):p(new Promise(e=>{let t=self.__BUILD_MANIFEST_CB;self.__BUILD_MANIFEST_CB=()=>{e(self.__BUILD_MANIFEST),t&&t()}}),3800,l(Object.defineProperty(Error("Failed to load client build manifest"),"__NEXT_ERROR_CODE",{value:"E273",enumerable:!1,configurable:!0})))}function _(e,t){return h().then(r=>{if(!(t in r))throw l(Object.defineProperty(Error("Failed to lookup route: "+t),"__NEXT_ERROR_CODE",{value:"E446",enumerable:!1,configurable:!0}));let a=r[t].map(t=>e+"/_next/"+(0,i.encodeURIPath)(t));return{scripts:a.filter(e=>e.endsWith(".js")).map(e=>(0,n.__unsafeCreateTrustedScriptURL)(e)+d()),css:a.filter(e=>e.endsWith(".css")).map(e=>e+d())}})}function m(e){let t=new Map,r=new Map,n=new Map,o=new Map;function i(e){{var t;let n=r.get(e.toString());return n?n:document.querySelector('script[src^="'+e+'"]')?Promise.resolve():(r.set(e.toString(),n=new Promise((r,n)=>{(t=document.createElement("script")).onload=r,t.onerror=()=>n(l(Object.defineProperty(Error("Failed to load script: "+e),"__NEXT_ERROR_CODE",{value:"E74",enumerable:!1,configurable:!0}))),t.crossOrigin=void 0,t.src=e,document.body.appendChild(t)})),n)}}function s(e){let t=n.get(e);return t||n.set(e,t=fetch(e,{credentials:"same-origin"}).then(t=>{if(!t.ok)throw Object.defineProperty(Error("Failed to load stylesheet: "+e),"__NEXT_ERROR_CODE",{value:"E189",enumerable:!1,configurable:!0});return t.text().then(t=>({href:e,content:t}))}).catch(e=>{throw l(e)})),t}return{whenEntrypoint:e=>u(e,t),onEntrypoint(e,r){(r?Promise.resolve().then(()=>r()).then(e=>({component:e&&e.default||e,exports:e}),e=>({error:e})):Promise.resolve(void 0)).then(r=>{let n=t.get(e);n&&"resolve"in n?r&&(t.set(e,r),n.resolve(r)):(r?t.set(e,r):t.delete(e),o.delete(e))})},loadRoute(r,n){return u(r,o,()=>{let a;return p(_(e,r).then(e=>{let{scripts:n,css:a}=e;return Promise.all([t.has(r)?[]:Promise.all(n.map(i)),Promise.all(a.map(s))])}).then(e=>this.whenEntrypoint(r).then(t=>({entrypoint:t,styles:e[1]}))),3800,l(Object.defineProperty(Error("Route did not complete loading: "+r),"__NEXT_ERROR_CODE",{value:"E12",enumerable:!1,configurable:!0}))).then(e=>{let{entrypoint:t,styles:r}=e,n=Object.assign({styles:r},t);return"error"in t?t:n}).catch(e=>{if(n)throw e;return{error:e}}).finally(()=>null==a?void 0:a())})},prefetch(t){let r;return(r=navigator.connection)&&(r.saveData||/2g/.test(r.effectiveType))?Promise.resolve():_(e,t).then(e=>Promise.all(f?e.scripts.map(e=>{var t,r,n;return t=e.toString(),r="script",new Promise((e,a)=>{let o='\n link[rel="prefetch"][href^="'+t+'"],\n link[rel="preload"][href^="'+t+'"],\n script[src^="'+t+'"]';if(document.querySelector(o))return e();n=document.createElement("link"),r&&(n.as=r),n.rel="prefetch",n.crossOrigin=void 0,n.onload=e,n.onerror=()=>a(l(Object.defineProperty(Error("Failed to prefetch: "+t),"__NEXT_ERROR_CODE",{value:"E268",enumerable:!1,configurable:!0}))),n.href=t,document.head.appendChild(n)})}):[])).then(()=>{(0,a.requestIdleCallback)(()=>this.loadRoute(t,!0).catch(()=>{}))}).catch(()=>{})}}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},31277:(e,t)=>{"use strict";function r(e,t){let r={};return Object.keys(e).forEach(n=>{t.includes(n)||(r[n]=e[n])}),r}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"omit",{enumerable:!0,get:function(){return r}})},31500:(e,t)=>{"use strict";function r(e,t,r,n,o){let i=e[t];if(o&&o.has(t)?i=o.get(t):Array.isArray(i)?i=i.map(e=>encodeURIComponent(e)):"string"==typeof i&&(i=encodeURIComponent(i)),!i){let o="oc"===r;if("c"===r||o)return o?{param:t,value:null,type:r,treeSegment:[t,"",r]}:{param:t,value:i=n.split("/").slice(1).flatMap(t=>{var r;let n=a(t);return null!=(r=e[n.key])?r:n.key}),type:r,treeSegment:[t,i.join("/"),r]}}return{param:t,value:i,treeSegment:[t,Array.isArray(i)?i.join("/"):i,r],type:r}}Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{PARAMETER_PATTERN:function(){return n},getDynamicParam:function(){return r},parseMatchedParameter:function(){return o},parseParameter:function(){return a}});let n=/^([^[]*)\[((?:\[[^\]]*\])|[^\]]+)\](.*)$/;function a(e){let t=e.match(n);return t?o(t[2]):o(e)}function o(e){let t=e.startsWith("[")&&e.endsWith("]");t&&(e=e.slice(1,-1));let r=e.startsWith("...");return r&&(e=e.slice(3)),{key:e,repeat:r,optional:t}}},32117:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{hasAdjacentParameterIssues:function(){return n},normalizeAdjacentParameters:function(){return a},normalizeTokensForRegexp:function(){return o},stripParameterSeparators:function(){return i}});let r="_NEXTSEP_";function n(e){return"string"==typeof e&&!!(/\/\(\.{1,3}\):[^/\s]+/.test(e)||/:[a-zA-Z_][a-zA-Z0-9_]*:[a-zA-Z_][a-zA-Z0-9_]*/.test(e))}function a(e){let t=e;return(t=t.replace(/(\([^)]*\)):([^/\s]+)/g,`$1${r}:$2`)).replace(/:([^:/\s)]+)(?=:)/g,`:$1${r}`)}function o(e){return e.map(e=>"object"==typeof e&&null!==e&&"modifier"in e&&("*"===e.modifier||"+"===e.modifier)&&"prefix"in e&&"suffix"in e&&""===e.prefix&&""===e.suffix?{...e,prefix:"/"}:e)}function i(e){let t={};for(let[n,a]of Object.entries(e))"string"==typeof a?t[n]=a.replace(RegExp(`^${r}`),""):Array.isArray(a)?t[n]=a.map(e=>"string"==typeof e?e.replace(RegExp(`^${r}`),""):e):t[n]=a;return t}},37535:(e,t,r)=>{"use strict";function n(e,t){return e}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"removeLocale",{enumerable:!0,get:function(){return n}}),r(82585),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},39116:(e,t,r)=>{"use strict";function n(e){return e}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"removeBasePath",{enumerable:!0,get:function(){return n}}),r(92860),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},39308:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{ACTION_SUFFIX:function(){return h},APP_DIR_ALIAS:function(){return M},CACHE_ONE_YEAR:function(){return T},DOT_NEXT_ALIAS:function(){return x},ESLINT_DEFAULT_DIRS:function(){return ee},GSP_NO_RETURNED_VALUE:function(){return Y},GSSP_COMPONENT_MEMBER_ERROR:function(){return Q},GSSP_NO_RETURNED_VALUE:function(){return K},HTML_CONTENT_TYPE_HEADER:function(){return n},INFINITE_CACHE:function(){return A},INSTRUMENTATION_HOOK_FILENAME:function(){return C},JSON_CONTENT_TYPE_HEADER:function(){return a},MATCHED_PATH_HEADER:function(){return u},MIDDLEWARE_FILENAME:function(){return j},MIDDLEWARE_LOCATION_REGEXP:function(){return w},NEXT_BODY_SUFFIX:function(){return g},NEXT_CACHE_IMPLICIT_TAG_ID:function(){return S},NEXT_CACHE_REVALIDATED_TAGS_HEADER:function(){return y},NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER:function(){return b},NEXT_CACHE_SOFT_TAG_MAX_LENGTH:function(){return O},NEXT_CACHE_TAGS_HEADER:function(){return E},NEXT_CACHE_TAG_MAX_ITEMS:function(){return v},NEXT_CACHE_TAG_MAX_LENGTH:function(){return R},NEXT_DATA_SUFFIX:function(){return _},NEXT_INTERCEPTION_MARKER_PREFIX:function(){return i},NEXT_META_SUFFIX:function(){return m},NEXT_QUERY_PARAM_PREFIX:function(){return o},NEXT_RESUME_HEADER:function(){return P},NON_STANDARD_NODE_ENV:function(){return J},PAGES_DIR_ALIAS:function(){return I},PRERENDER_REVALIDATE_HEADER:function(){return s},PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER:function(){return l},PUBLIC_DIR_MIDDLEWARE_CONFLICT:function(){return X},ROOT_DIR_ALIAS:function(){return N},RSC_ACTION_CLIENT_WRAPPER_ALIAS:function(){return H},RSC_ACTION_ENCRYPTION_ALIAS:function(){return B},RSC_ACTION_PROXY_ALIAS:function(){return U},RSC_ACTION_VALIDATE_ALIAS:function(){return D},RSC_CACHE_WRAPPER_ALIAS:function(){return F},RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS:function(){return k},RSC_MOD_REF_PROXY_ALIAS:function(){return L},RSC_PREFETCH_SUFFIX:function(){return c},RSC_SEGMENTS_DIR_SUFFIX:function(){return f},RSC_SEGMENT_SUFFIX:function(){return d},RSC_SUFFIX:function(){return p},SERVER_PROPS_EXPORT_ERROR:function(){return V},SERVER_PROPS_GET_INIT_PROPS_CONFLICT:function(){return G},SERVER_PROPS_SSG_CONFLICT:function(){return q},SERVER_RUNTIME:function(){return et},SSG_FALLBACK_EXPORT_ERROR:function(){return Z},SSG_GET_INITIAL_PROPS_CONFLICT:function(){return W},STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR:function(){return z},TEXT_PLAIN_CONTENT_TYPE_HEADER:function(){return r},UNSTABLE_REVALIDATE_RENAME_ERROR:function(){return $},WEBPACK_LAYERS:function(){return en},WEBPACK_RESOURCE_QUERIES:function(){return ea}});let r="text/plain",n="text/html; charset=utf-8",a="application/json; charset=utf-8",o="nxtP",i="nxtI",u="x-matched-path",s="x-prerender-revalidate",l="x-prerender-revalidate-if-generated",c=".prefetch.rsc",f=".segments",d=".segment.rsc",p=".rsc",h=".action",_=".json",m=".meta",g=".body",E="x-next-cache-tags",y="x-next-revalidated-tags",b="x-next-revalidate-tag-token",P="next-resume",v=128,R=256,O=1024,S="_N_T_",T=31536e3,A=0xfffffffe,j="middleware",w=`(?:src/)?${j}`,C="instrumentation",I="private-next-pages",x="private-dot-next",N="private-next-root-dir",M="private-next-app-dir",L="private-next-rsc-mod-ref-proxy",D="private-next-rsc-action-validate",U="private-next-rsc-server-reference",F="private-next-rsc-cache-wrapper",k="private-next-rsc-track-dynamic-import",B="private-next-rsc-action-encryption",H="private-next-rsc-action-client-wrapper",X="You can not have a '_next' folder inside of your public folder. This conflicts with the internal '/_next' route. https://nextjs.org/docs/messages/public-next-folder-conflict",W="You can not use getInitialProps with getStaticProps. To use SSG, please remove your getInitialProps",G="You can not use getInitialProps with getServerSideProps. Please remove getInitialProps.",q="You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps",z="can not have getInitialProps/getServerSideProps, https://nextjs.org/docs/messages/404-get-initial-props",V="pages with `getServerSideProps` can not be exported. See more info here: https://nextjs.org/docs/messages/gssp-export",Y="Your `getStaticProps` function did not return an object. Did you forget to add a `return`?",K="Your `getServerSideProps` function did not return an object. Did you forget to add a `return`?",$="The `unstable_revalidate` property is available for general use.\nPlease use `revalidate` instead.",Q="can not be attached to a page's component and must be exported from the page. See more info here: https://nextjs.org/docs/messages/gssp-component-member",J='You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env',Z="Pages with `fallback` enabled in `getStaticPaths` can not be exported. See more info here: https://nextjs.org/docs/messages/ssg-fallback-true-export",ee=["app","pages","components","lib","src"],et={edge:"edge",experimentalEdge:"experimental-edge",nodejs:"nodejs"},er={shared:"shared",reactServerComponents:"rsc",serverSideRendering:"ssr",actionBrowser:"action-browser",apiNode:"api-node",apiEdge:"api-edge",middleware:"middleware",instrument:"instrument",edgeAsset:"edge-asset",appPagesBrowser:"app-pages-browser",pagesDirBrowser:"pages-dir-browser",pagesDirEdge:"pages-dir-edge",pagesDirNode:"pages-dir-node"},en={...er,GROUP:{builtinReact:[er.reactServerComponents,er.actionBrowser],serverOnly:[er.reactServerComponents,er.actionBrowser,er.instrument,er.middleware],neutralTarget:[er.apiNode,er.apiEdge],clientOnly:[er.serverSideRendering,er.appPagesBrowser],bundled:[er.reactServerComponents,er.actionBrowser,er.serverSideRendering,er.appPagesBrowser,er.shared,er.instrument,er.middleware],appPages:[er.reactServerComponents,er.serverSideRendering,er.appPagesBrowser,er.actionBrowser]}},ea={edgeSSREntry:"__next_edge_ssr_entry__",metadata:"__next_metadata__",metadataRoute:"__next_metadata_route__",metadataImageMeta:"__next_metadata_image_meta__"}},40342:(e,t)=>{"use strict";function r(e){return e.replace(/\\/g,"/")}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"normalizePathSep",{enumerable:!0,get:function(){return r}})},40840:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"addPathPrefix",{enumerable:!0,get:function(){return a}});let n=r(82585);function a(e,t){if(!e.startsWith("/")||!t)return e;let{pathname:r,query:a,hash:o}=(0,n.parsePath)(e);return""+t+r+a+o}},42133:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"detectDomainLocale",{enumerable:!0,get:function(){return r}});let r=function(){for(var e=arguments.length,t=Array(e),r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"addLocale",{enumerable:!0,get:function(){return o}});let n=r(40840),a=r(321);function o(e,t,r,o){if(!t||t===r)return e;let i=e.toLowerCase();return!o&&((0,a.pathHasPrefix)(i,"/api")||(0,a.pathHasPrefix)(i,"/"+t.toLowerCase()))?e:(0,n.addPathPrefix)(e,"/"+t)}},43004:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"reportGlobalError",{enumerable:!0,get:function(){return r}});let r="function"==typeof reportError?reportError:e=>{globalThis.console.error(e)};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},44047:(e,t)=>{"use strict";function r(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"encodeURIPath",{enumerable:!0,get:function(){return r}})},46175:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(63021),r(67647);let n=r(16450);window.next={version:n.version,get router(){return n.router},emitter:n.emitter},(0,n.initialize)({}).then(()=>(0,n.hydrate)()).catch(console.error),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},48076:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BloomFilter",{enumerable:!0,get:function(){return r}});class r{static from(e,t){void 0===t&&(t=1e-4);let n=new r(e.length,t);for(let t of e)n.add(t);return n}export(){return{numItems:this.numItems,errorRate:this.errorRate,numBits:this.numBits,numHashes:this.numHashes,bitArray:this.bitArray}}import(e){this.numItems=e.numItems,this.errorRate=e.errorRate,this.numBits=e.numBits,this.numHashes=e.numHashes,this.bitArray=e.bitArray}add(e){this.getHashValues(e).forEach(e=>{this.bitArray[e]=1})}contains(e){return this.getHashValues(e).every(e=>this.bitArray[e])}getHashValues(e){let t=[];for(let r=1;r<=this.numHashes;r++){let n=function(e){let t=0;for(let r=0;r>>13,t=Math.imul(t,0x5bd1e995);return t>>>0}(""+e+r)%this.numBits;t.push(n)}return t}constructor(e,t=1e-4){this.numItems=e,this.errorRate=t,this.numBits=Math.ceil(-(e*Math.log(t))/(Math.log(2)*Math.log(2))),this.numHashes=Math.ceil(this.numBits/e*Math.log(2)),this.bitArray=Array(this.numBits).fill(0)}}},49452:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{isRecoverableError:function(){return s},onRecoverableError:function(){return l}});let n=r(64252),a=r(66336),o=n._(r(66240)),i=r(43004),u=new WeakSet;function s(e){return u.has(e)}let l=e=>{let t=(0,o.default)(e)&&"cause"in e?e.cause:e;(0,a.isBailoutToCSRError)(t)||(0,i.reportGlobalError)(t)};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},50563:e=>{"use strict";e.exports=["chrome 64","edge 79","firefox 67","opera 51","safari 12"]},50781:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{INTERCEPTION_ROUTE_MARKERS:function(){return a},extractInterceptionRouteInformation:function(){return i},isInterceptionRouteAppPath:function(){return o}});let n=r(2786),a=["(..)(..)","(.)","(..)","(...)"];function o(e){return void 0!==e.split("/").find(e=>a.find(t=>e.startsWith(t)))}function i(e){let t,r,o;for(let n of e.split("/"))if(r=a.find(e=>n.startsWith(e))){[t,o]=e.split(r,2);break}if(!t||!r||!o)throw Object.defineProperty(Error("Invalid interception route: "+e+". Must be in the format //(..|...|..)(..)/"),"__NEXT_ERROR_CODE",{value:"E269",enumerable:!1,configurable:!0});switch(t=(0,n.normalizeAppPath)(t),r){case"(.)":o="/"===t?"/"+o:t+"/"+o;break;case"(..)":if("/"===t)throw Object.defineProperty(Error("Invalid interception route: "+e+". Cannot use (..) marker at the root level, use (.) instead."),"__NEXT_ERROR_CODE",{value:"E207",enumerable:!1,configurable:!0});o=t.split("/").slice(0,-1).concat(o).join("/");break;case"(...)":o="/"+o;break;case"(..)(..)":let i=t.split("/");if(i.length<=2)throw Object.defineProperty(Error("Invalid interception route: "+e+". Cannot use (..)(..) marker at the root level or one level up."),"__NEXT_ERROR_CODE",{value:"E486",enumerable:!1,configurable:!0});o=i.slice(0,-2).concat(o).join("/");break;default:throw Object.defineProperty(Error("Invariant: unexpected marker"),"__NEXT_ERROR_CODE",{value:"E112",enumerable:!1,configurable:!0})}return{interceptingRoute:t,interceptedRoute:o}}},51082:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getRouteMatcher",{enumerable:!0,get:function(){return o}});let n=r(1033),a=r(61137);function o(e){let{re:t,groups:r}=e;return(0,a.safeRouteMatcher)(e=>{let a=t.exec(e);if(!a)return!1;let o=e=>{try{return decodeURIComponent(e)}catch(e){throw Object.defineProperty(new n.DecodeError("failed to decode param"),"__NEXT_ERROR_CODE",{value:"E528",enumerable:!1,configurable:!0})}},i={};for(let[e,t]of Object.entries(r)){let r=a[t.pos];void 0!==r&&(t.repeat?i[e]=r.split("/").map(e=>o(e)):i[e]=o(r))}return i})}},54267:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{createKey:function(){return G},default:function(){return V},matchesMiddleware:function(){return D}});let n=r(64252),a=r(88365),o=r(69239),i=r(30425),u=r(87665),s=a._(r(66240)),l=r(88524),c=r(83847),f=n._(r(24622)),d=r(1033),p=r(88668),h=r(5402),_=r(51082),m=r(70159),g=r(359);r(42133);let E=r(82585),y=r(89266),b=r(37535),P=r(39116),v=r(69011),R=r(92860),O=r(58004),S=r(2326),T=r(17136),A=r(72129),j=r(99328),w=r(65790),C=r(4316),I=r(31277),x=r(20718),N=r(20785),M=r(39308);function L(){return Object.assign(Object.defineProperty(Error("Route Cancelled"),"__NEXT_ERROR_CODE",{value:"E315",enumerable:!1,configurable:!0}),{cancelled:!0})}async function D(e){let t=await Promise.resolve(e.router.pageLoader.getMiddleware());if(!t)return!1;let{pathname:r}=(0,E.parsePath)(e.asPath),n=(0,R.hasBasePath)(r)?(0,P.removeBasePath)(r):r,a=(0,v.addBasePath)((0,y.addLocale)(n,e.locale));return t.some(e=>new RegExp(e.regexp).test(a))}function U(e){let t=(0,d.getLocationOrigin)();return e.startsWith(t)?e.substring(t.length):e}function F(e,t,r){let[n,a]=(0,O.resolveHref)(e,t,!0),o=(0,d.getLocationOrigin)(),i=n.startsWith(o),u=a&&a.startsWith(o);n=U(n),a=a?U(a):a;let s=i?n:(0,v.addBasePath)(n),l=r?U((0,O.resolveHref)(e,r)):a||n;return{url:s,as:u?l:(0,v.addBasePath)(l)}}function k(e,t){let r=(0,o.removeTrailingSlash)((0,l.denormalizePagePath)(e));return"/404"===r||"/_error"===r?e:(t.includes(r)||t.some(t=>{if((0,p.isDynamicRoute)(t)&&(0,m.getRouteRegex)(t).re.test(r))return e=t,!0}),(0,o.removeTrailingSlash)(e))}async function B(e){if(!await D(e)||!e.fetchData)return null;let t=await e.fetchData(),r=await function(e,t,r){let n={basePath:r.router.basePath,i18n:{locales:r.router.locales},trailingSlash:!0},a=t.headers.get("x-nextjs-rewrite"),u=a||t.headers.get("x-nextjs-matched-path"),s=t.headers.get(M.MATCHED_PATH_HEADER);if(!s||u||s.includes("__next_data_catchall")||s.includes("/_error")||s.includes("/404")||(u=s),u){if(u.startsWith("/")){let t=(0,h.parseRelativeUrl)(u),s=(0,T.getNextPathnameInfo)(t.pathname,{nextConfig:n,parseData:!0}),l=(0,o.removeTrailingSlash)(s.pathname);return Promise.all([r.router.pageLoader.getPageList(),(0,i.getClientBuildManifest)()]).then(o=>{let[i,{__rewrites:u}]=o,f=(0,y.addLocale)(s.pathname,s.locale);if((0,p.isDynamicRoute)(f)||!a&&i.includes((0,c.normalizeLocalePath)((0,P.removeBasePath)(f),r.router.locales).pathname)){let r=(0,T.getNextPathnameInfo)((0,h.parseRelativeUrl)(e).pathname,{nextConfig:n,parseData:!0});t.pathname=f=(0,v.addBasePath)(r.pathname)}if(!i.includes(l)){let e=k(l,i);e!==l&&(l=e)}let d=i.includes(l)?l:k((0,c.normalizeLocalePath)((0,P.removeBasePath)(t.pathname),r.router.locales).pathname,i);if((0,p.isDynamicRoute)(d)){let e=(0,_.getRouteMatcher)((0,m.getRouteRegex)(d))(f);Object.assign(t.query,e||{})}return{type:"rewrite",parsedAs:t,resolvedHref:d}})}let t=(0,E.parsePath)(e);return Promise.resolve({type:"redirect-external",destination:""+(0,A.formatNextPathnameInfo)({...(0,T.getNextPathnameInfo)(t.pathname,{nextConfig:n,parseData:!0}),defaultLocale:r.router.defaultLocale,buildId:""})+t.query+t.hash})}let l=t.headers.get("x-nextjs-redirect");if(l){if(l.startsWith("/")){let e=(0,E.parsePath)(l),t=(0,A.formatNextPathnameInfo)({...(0,T.getNextPathnameInfo)(e.pathname,{nextConfig:n,parseData:!0}),defaultLocale:r.router.defaultLocale,buildId:""});return Promise.resolve({type:"redirect-internal",newAs:""+t+e.query+e.hash,newUrl:""+t+e.query+e.hash})}return Promise.resolve({type:"redirect-external",destination:l})}return Promise.resolve({type:"next"})}(t.dataHref,t.response,e);return{dataHref:t.dataHref,json:t.json,response:t.response,text:t.text,cacheKey:t.cacheKey,effect:r}}let H=Symbol("SSG_DATA_NOT_FOUND");function X(e){try{return JSON.parse(e)}catch(e){return null}}function W(e){let{dataHref:t,inflightCache:r,isPrefetch:n,hasMiddleware:a,isServerRender:o,parseJSON:u,persistCache:s,isBackground:l,unstable_skipClientCache:c}=e,{href:f}=new URL(t,window.location.href),d=e=>{var l;return(function e(t,r,n){return fetch(t,{credentials:"same-origin",method:n.method||"GET",headers:Object.assign({},n.headers,{"x-nextjs-data":"1"})}).then(a=>!a.ok&&r>1&&a.status>=500?e(t,r-1,n):a)})(t,o?3:1,{headers:Object.assign({},n?{purpose:"prefetch"}:{},n&&a?{"x-middleware-prefetch":"1"}:{},{}),method:null!=(l=null==e?void 0:e.method)?l:"GET"}).then(r=>r.ok&&(null==e?void 0:e.method)==="HEAD"?{dataHref:t,response:r,text:"",json:{},cacheKey:f}:r.text().then(e=>{if(!r.ok){if(a&&[301,302,307,308].includes(r.status))return{dataHref:t,response:r,text:e,json:{},cacheKey:f};if(404===r.status){var n;if(null==(n=X(e))?void 0:n.notFound)return{dataHref:t,json:{notFound:H},response:r,text:e,cacheKey:f}}let u=Object.defineProperty(Error("Failed to load static props"),"__NEXT_ERROR_CODE",{value:"E124",enumerable:!1,configurable:!0});throw o||(0,i.markAssetError)(u),u}return{dataHref:t,json:u?X(e):null,response:r,text:e,cacheKey:f}})).then(e=>(s&&"no-cache"!==e.response.headers.get("x-middleware-cache")||delete r[f],e)).catch(e=>{throw c||delete r[f],("Failed to fetch"===e.message||"NetworkError when attempting to fetch resource."===e.message||"Load failed"===e.message)&&(0,i.markAssetError)(e),e})};return c&&s?d({}).then(e=>("no-cache"!==e.response.headers.get("x-middleware-cache")&&(r[f]=Promise.resolve(e)),e)):void 0!==r[f]?r[f]:r[f]=d(l?{method:"HEAD"}:{})}function G(){return Math.random().toString(36).slice(2,10)}function q(e){let{url:t,router:r}=e;if(t===(0,v.addBasePath)((0,y.addLocale)(r.asPath,r.locale)))throw Object.defineProperty(Error("Invariant: attempted to hard navigate to the same URL "+t+" "+location.href),"__NEXT_ERROR_CODE",{value:"E282",enumerable:!1,configurable:!0});window.location.href=t}let z=e=>{let{route:t,router:r}=e,n=!1,a=r.clc=()=>{n=!0};return()=>{if(n){let e=Object.defineProperty(Error('Abort fetching component for route: "'+t+'"'),"__NEXT_ERROR_CODE",{value:"E483",enumerable:!1,configurable:!0});throw e.cancelled=!0,e}a===r.clc&&(r.clc=null)}};class V{reload(){window.location.reload()}back(){window.history.back()}forward(){window.history.forward()}push(e,t,r){return void 0===r&&(r={}),{url:e,as:t}=F(this,e,t),this.change("pushState",e,t,r)}replace(e,t,r){return void 0===r&&(r={}),{url:e,as:t}=F(this,e,t),this.change("replaceState",e,t,r)}async _bfl(e,t,n,a){{if(!this._bfl_s&&!this._bfl_d){let t,o,{BloomFilter:u}=r(48076);try{({__routerFilterStatic:t,__routerFilterDynamic:o}=await (0,i.getClientBuildManifest)())}catch(t){if(console.error(t),a)return!0;return q({url:(0,v.addBasePath)((0,y.addLocale)(e,n||this.locale,this.defaultLocale)),router:this}),new Promise(()=>{})}(null==t?void 0:t.numHashes)&&(this._bfl_s=new u(t.numItems,t.errorRate),this._bfl_s.import(t)),(null==o?void 0:o.numHashes)&&(this._bfl_d=new u(o.numItems,o.errorRate),this._bfl_d.import(o))}let c=!1,f=!1;for(let{as:r,allowMatchCurrent:i}of[{as:e},{as:t}])if(r){let t=(0,o.removeTrailingSlash)(new URL(r,"http://n").pathname),d=(0,v.addBasePath)((0,y.addLocale)(t,n||this.locale));if(i||t!==(0,o.removeTrailingSlash)(new URL(this.asPath,"http://n").pathname)){var u,s,l;for(let e of(c=c||!!(null==(u=this._bfl_s)?void 0:u.contains(t))||!!(null==(s=this._bfl_s)?void 0:s.contains(d)),[t,d])){let t=e.split("/");for(let e=0;!f&&e{})}}}}return!1}async change(e,t,r,n,a){var l,c,f,O,S,T,A,C,N;let M,U;if(!(0,w.isLocalURL)(t))return q({url:t,router:this}),!1;let B=1===n._h;B||n.shallow||await this._bfl(r,void 0,n.locale);let X=B||n._shouldResolveHref||(0,E.parsePath)(t).pathname===(0,E.parsePath)(r).pathname,W={...this.state},G=!0!==this.isReady;this.isReady=!0;let z=this.isSsr;if(B||(this.isSsr=!1),B&&this.clc)return!1;let Y=W.locale;d.ST&&performance.mark("routeChange");let{shallow:K=!1,scroll:$=!0}=n,Q={shallow:K};this._inFlightRoute&&this.clc&&(z||V.events.emit("routeChangeError",L(),this._inFlightRoute,Q),this.clc(),this.clc=null),r=(0,v.addBasePath)((0,y.addLocale)((0,R.hasBasePath)(r)?(0,P.removeBasePath)(r):r,n.locale,this.defaultLocale));let J=(0,b.removeLocale)((0,R.hasBasePath)(r)?(0,P.removeBasePath)(r):r,W.locale);this._inFlightRoute=r;let Z=Y!==W.locale;if(!B&&this.onlyAHashChange(J)&&!Z){W.asPath=J,V.events.emit("hashChangeStart",r,Q),this.changeState(e,t,r,{...n,scroll:!1}),$&&this.scrollToHash(J);try{await this.set(W,this.components[W.route],null)}catch(e){throw(0,s.default)(e)&&e.cancelled&&V.events.emit("routeChangeError",e,J,Q),e}return V.events.emit("hashChangeComplete",r,Q),!0}let ee=(0,h.parseRelativeUrl)(t),{pathname:et,query:er}=ee;try{[M,{__rewrites:U}]=await Promise.all([this.pageLoader.getPageList(),(0,i.getClientBuildManifest)(),this.pageLoader.getMiddleware()])}catch(e){return q({url:r,router:this}),!1}this.urlIsNew(J)||Z||(e="replaceState");let en=r;et=et?(0,o.removeTrailingSlash)((0,P.removeBasePath)(et)):et;let ea=(0,o.removeTrailingSlash)(et),eo=r.startsWith("/")&&(0,h.parseRelativeUrl)(r).pathname;if(null==(l=this.components[et])?void 0:l.__appRouter)return q({url:r,router:this}),new Promise(()=>{});let ei=!!(eo&&ea!==eo&&(!(0,p.isDynamicRoute)(ea)||!(0,_.getRouteMatcher)((0,m.getRouteRegex)(ea))(eo))),eu=!n.shallow&&await D({asPath:r,locale:W.locale,router:this});if(B&&eu&&(X=!1),X&&"/_error"!==et&&(n._shouldResolveHref=!0,ee.pathname=k(et,M),ee.pathname!==et&&(et=ee.pathname,ee.pathname=(0,v.addBasePath)(et),eu||(t=(0,g.formatWithValidation)(ee)))),!(0,w.isLocalURL)(r))return q({url:r,router:this}),!1;en=(0,b.removeLocale)((0,P.removeBasePath)(en),W.locale),ea=(0,o.removeTrailingSlash)(et);let es=!1;if((0,p.isDynamicRoute)(ea)){let e=(0,h.parseRelativeUrl)(en),n=e.pathname,a=(0,m.getRouteRegex)(ea);es=(0,_.getRouteMatcher)(a)(n);let o=ea===n,i=o?(0,x.interpolateAs)(ea,n,er):{};if(es&&(!o||i.result))o?r=(0,g.formatWithValidation)(Object.assign({},e,{pathname:i.result,query:(0,I.omit)(er,i.params)})):Object.assign(er,es);else{let e=Object.keys(a.groups).filter(e=>!er[e]&&!a.groups[e].optional);if(e.length>0&&!eu)throw Object.defineProperty(Error((o?"The provided `href` ("+t+") value is missing query values ("+e.join(", ")+") to be interpolated properly. ":"The provided `as` value ("+n+") is incompatible with the `href` value ("+ea+"). ")+"Read more: https://nextjs.org/docs/messages/"+(o?"href-interpolation-failed":"incompatible-href-as")),"__NEXT_ERROR_CODE",{value:"E344",enumerable:!1,configurable:!0})}}B||V.events.emit("routeChangeStart",r,Q);let el="/404"===this.pathname||"/_error"===this.pathname;try{let o=await this.getRouteInfo({route:ea,pathname:et,query:er,as:r,resolvedAs:en,routeProps:Q,locale:W.locale,isPreview:W.isPreview,hasMiddleware:eu,unstable_skipClientCache:n.unstable_skipClientCache,isQueryUpdating:B&&!this.isFallback,isMiddlewareRewrite:ei});if(B||n.shallow||await this._bfl(r,"resolvedAs"in o?o.resolvedAs:void 0,W.locale),"route"in o&&eu){ea=et=o.route||ea,Q.shallow||(er=Object.assign({},o.query||{},er));let e=(0,R.hasBasePath)(ee.pathname)?(0,P.removeBasePath)(ee.pathname):ee.pathname;if(es&&et!==e&&Object.keys(es).forEach(e=>{es&&er[e]===es[e]&&delete er[e]}),(0,p.isDynamicRoute)(et)){let e=!Q.shallow&&o.resolvedAs?o.resolvedAs:(0,v.addBasePath)((0,y.addLocale)(new URL(r,location.href).pathname,W.locale),!0);(0,R.hasBasePath)(e)&&(e=(0,P.removeBasePath)(e));let t=(0,m.getRouteRegex)(et),n=(0,_.getRouteMatcher)(t)(new URL(e,location.href).pathname);n&&Object.assign(er,n)}}if("type"in o)if("redirect-internal"===o.type)return this.change(e,o.newUrl,o.newAs,n);else return q({url:o.destination,router:this}),new Promise(()=>{});let i=o.Component;if(i&&i.unstable_scriptLoader&&[].concat(i.unstable_scriptLoader()).forEach(e=>{(0,u.handleClientScriptLoad)(e.props)}),(o.__N_SSG||o.__N_SSP)&&o.props){if(o.props.pageProps&&o.props.pageProps.__N_REDIRECT){n.locale=!1;let t=o.props.pageProps.__N_REDIRECT;if(t.startsWith("/")&&!1!==o.props.pageProps.__N_REDIRECT_BASE_PATH){let r=(0,h.parseRelativeUrl)(t);r.pathname=k(r.pathname,M);let{url:a,as:o}=F(this,t,t);return this.change(e,a,o,n)}return q({url:t,router:this}),new Promise(()=>{})}if(W.isPreview=!!o.props.__N_PREVIEW,o.props.notFound===H){let e;try{await this.fetchComponent("/404"),e="/404"}catch(t){e="/_error"}if(o=await this.getRouteInfo({route:e,pathname:e,query:er,as:r,resolvedAs:en,routeProps:{shallow:!1},locale:W.locale,isPreview:W.isPreview,isNotFound:!0}),"type"in o)throw Object.defineProperty(Error("Unexpected middleware effect on /404"),"__NEXT_ERROR_CODE",{value:"E158",enumerable:!1,configurable:!0})}}B&&"/_error"===this.pathname&&(null==(f=self.__NEXT_DATA__.props)||null==(c=f.pageProps)?void 0:c.statusCode)===500&&(null==(O=o.props)?void 0:O.pageProps)&&(o.props.pageProps.statusCode=500);let l=n.shallow&&W.route===(null!=(S=o.route)?S:ea),d=null!=(T=n.scroll)?T:!B&&!l,g=null!=a?a:d?{x:0,y:0}:null,E={...W,route:ea,pathname:et,query:er,asPath:J,isFallback:!1};if(B&&el){if(o=await this.getRouteInfo({route:this.pathname,pathname:this.pathname,query:er,as:r,resolvedAs:en,routeProps:{shallow:!1},locale:W.locale,isPreview:W.isPreview,isQueryUpdating:B&&!this.isFallback}),"type"in o)throw Object.defineProperty(Error("Unexpected middleware effect on "+this.pathname),"__NEXT_ERROR_CODE",{value:"E225",enumerable:!1,configurable:!0});"/_error"===this.pathname&&(null==(C=self.__NEXT_DATA__.props)||null==(A=C.pageProps)?void 0:A.statusCode)===500&&(null==(N=o.props)?void 0:N.pageProps)&&(o.props.pageProps.statusCode=500);try{await this.set(E,o,g)}catch(e){throw(0,s.default)(e)&&e.cancelled&&V.events.emit("routeChangeError",e,J,Q),e}return!0}if(V.events.emit("beforeHistoryChange",r,Q),this.changeState(e,t,r,n),!(B&&!g&&!G&&!Z&&(0,j.compareRouterStates)(E,this.state))){try{await this.set(E,o,g)}catch(e){if(e.cancelled)o.error=o.error||e;else throw e}if(o.error)throw B||V.events.emit("routeChangeError",o.error,J,Q),o.error;B||V.events.emit("routeChangeComplete",r,Q),d&&/#.+$/.test(r)&&this.scrollToHash(r)}return!0}catch(e){if((0,s.default)(e)&&e.cancelled)return!1;throw e}}changeState(e,t,r,n){void 0===n&&(n={}),("pushState"!==e||(0,d.getURL)()!==r)&&(this._shallow=n.shallow,window.history[e]({url:t,as:r,options:n,__N:!0,key:this._key="pushState"!==e?this._key:G()},"",r))}async handleRouteInfoError(e,t,r,n,a,o){if(e.cancelled)throw e;if((0,i.isAssetError)(e)||o)throw V.events.emit("routeChangeError",e,n,a),q({url:n,router:this}),L();console.error(e);try{let n,{page:a,styleSheets:o}=await this.fetchComponent("/_error"),i={props:n,Component:a,styleSheets:o,err:e,error:e};if(!i.props)try{i.props=await this.getInitialProps(a,{err:e,pathname:t,query:r})}catch(e){console.error("Error in error page `getInitialProps`: ",e),i.props={}}return i}catch(e){return this.handleRouteInfoError((0,s.default)(e)?e:Object.defineProperty(Error(e+""),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0}),t,r,n,a,!0)}}async getRouteInfo(e){let{route:t,pathname:r,query:n,as:a,resolvedAs:i,routeProps:u,locale:l,hasMiddleware:f,isPreview:d,unstable_skipClientCache:p,isQueryUpdating:h,isMiddlewareRewrite:_,isNotFound:m}=e,E=t;try{var y,b,v,R;let e=this.components[E];if(u.shallow&&e&&this.route===E)return e;let t=z({route:E,router:this});f&&(e=void 0);let s=!e||"initial"in e?void 0:e,O={dataHref:this.pageLoader.getDataHref({href:(0,g.formatWithValidation)({pathname:r,query:n}),skipInterpolation:!0,asPath:m?"/404":i,locale:l}),hasMiddleware:!0,isServerRender:this.isSsr,parseJSON:!0,inflightCache:h?this.sbc:this.sdc,persistCache:!d,isPrefetch:!1,unstable_skipClientCache:p,isBackground:h},T=h&&!_?null:await B({fetchData:()=>W(O),asPath:m?"/404":i,locale:l,router:this}).catch(e=>{if(h)return null;throw e});if(T&&("/_error"===r||"/404"===r)&&(T.effect=void 0),h&&(T?T.json=self.__NEXT_DATA__.props:T={json:self.__NEXT_DATA__.props}),t(),(null==T||null==(y=T.effect)?void 0:y.type)==="redirect-internal"||(null==T||null==(b=T.effect)?void 0:b.type)==="redirect-external")return T.effect;if((null==T||null==(v=T.effect)?void 0:v.type)==="rewrite"){let t=(0,o.removeTrailingSlash)(T.effect.resolvedHref),a=await this.pageLoader.getPageList();if((!h||a.includes(t))&&(E=t,r=T.effect.resolvedHref,n={...n,...T.effect.parsedAs.query},i=(0,P.removeBasePath)((0,c.normalizeLocalePath)(T.effect.parsedAs.pathname,this.locales).pathname),e=this.components[E],u.shallow&&e&&this.route===E&&!f))return{...e,route:E}}if((0,S.isAPIRoute)(E))return q({url:a,router:this}),new Promise(()=>{});let A=s||await this.fetchComponent(E).then(e=>({Component:e.page,styleSheets:e.styleSheets,__N_SSG:e.mod.__N_SSG,__N_SSP:e.mod.__N_SSP})),j=null==T||null==(R=T.response)?void 0:R.headers.get("x-middleware-skip"),w=A.__N_SSG||A.__N_SSP;j&&(null==T?void 0:T.dataHref)&&delete this.sdc[T.dataHref];let{props:C,cacheKey:I}=await this._getData(async()=>{if(w){if((null==T?void 0:T.json)&&!j)return{cacheKey:T.cacheKey,props:T.json};let e=(null==T?void 0:T.dataHref)?T.dataHref:this.pageLoader.getDataHref({href:(0,g.formatWithValidation)({pathname:r,query:n}),asPath:i,locale:l}),t=await W({dataHref:e,isServerRender:this.isSsr,parseJSON:!0,inflightCache:j?{}:this.sdc,persistCache:!d,isPrefetch:!1,unstable_skipClientCache:p});return{cacheKey:t.cacheKey,props:t.json||{}}}return{headers:{},props:await this.getInitialProps(A.Component,{pathname:r,query:n,asPath:a,locale:l,locales:this.locales,defaultLocale:this.defaultLocale})}});return A.__N_SSP&&O.dataHref&&I&&delete this.sdc[I],this.isPreview||!A.__N_SSG||h||W(Object.assign({},O,{isBackground:!0,persistCache:!1,inflightCache:this.sbc})).catch(()=>{}),C.pageProps=Object.assign({},C.pageProps),A.props=C,A.route=E,A.query=n,A.resolvedAs=i,this.components[E]=A,A}catch(e){return this.handleRouteInfoError((0,s.getProperError)(e),r,n,a,u)}}set(e,t,r){return this.state=e,this.sub(t,this.components["/_app"].Component,r)}beforePopState(e){this._bps=e}onlyAHashChange(e){if(!this.asPath)return!1;let[t,r]=this.asPath.split("#",2),[n,a]=e.split("#",2);return!!a&&t===n&&r===a||t===n&&r!==a}scrollToHash(e){let[,t=""]=e.split("#",2);(0,N.disableSmoothScrollDuringRouteTransition)(()=>{if(""===t||"top"===t)return void window.scrollTo(0,0);let e=decodeURIComponent(t),r=document.getElementById(e);if(r)return void r.scrollIntoView();let n=document.getElementsByName(e)[0];n&&n.scrollIntoView()},{onlyHashChange:this.onlyAHashChange(e)})}urlIsNew(e){return this.asPath!==e}async prefetch(e,t,r){if(void 0===t&&(t=e),void 0===r&&(r={}),(0,C.isBot)(window.navigator.userAgent))return;let n=(0,h.parseRelativeUrl)(e),a=n.pathname,{pathname:i,query:u}=n,s=i,l=await this.pageLoader.getPageList(),c=t,f=void 0!==r.locale?r.locale||void 0:this.locale,d=await D({asPath:t,locale:f,router:this});n.pathname=k(n.pathname,l),(0,p.isDynamicRoute)(n.pathname)&&(i=n.pathname,n.pathname=i,Object.assign(u,(0,_.getRouteMatcher)((0,m.getRouteRegex)(n.pathname))((0,E.parsePath)(t).pathname)||{}),d||(e=(0,g.formatWithValidation)(n)));let y=await B({fetchData:()=>W({dataHref:this.pageLoader.getDataHref({href:(0,g.formatWithValidation)({pathname:s,query:u}),skipInterpolation:!0,asPath:c,locale:f}),hasMiddleware:!0,isServerRender:!1,parseJSON:!0,inflightCache:this.sdc,persistCache:!this.isPreview,isPrefetch:!0}),asPath:t,locale:f,router:this});if((null==y?void 0:y.effect.type)==="rewrite"&&(n.pathname=y.effect.resolvedHref,i=y.effect.resolvedHref,u={...u,...y.effect.parsedAs.query},c=y.effect.parsedAs.pathname,e=(0,g.formatWithValidation)(n)),(null==y?void 0:y.effect.type)==="redirect-external")return;let b=(0,o.removeTrailingSlash)(i);await this._bfl(t,c,r.locale,!0)&&(this.components[a]={__appRouter:!0}),await Promise.all([this.pageLoader._isSsg(b).then(t=>!!t&&W({dataHref:(null==y?void 0:y.json)?null==y?void 0:y.dataHref:this.pageLoader.getDataHref({href:e,asPath:c,locale:f}),isServerRender:!1,parseJSON:!0,inflightCache:this.sdc,persistCache:!this.isPreview,isPrefetch:!0,unstable_skipClientCache:r.unstable_skipClientCache||r.priority&&!0}).then(()=>!1).catch(()=>!1)),this.pageLoader[r.priority?"loadPage":"prefetch"](b)])}async fetchComponent(e){let t=z({route:e,router:this});try{let r=await this.pageLoader.loadPage(e);return t(),r}catch(e){throw t(),e}}_getData(e){let t=!1,r=()=>{t=!0};return this.clc=r,e().then(e=>{if(r===this.clc&&(this.clc=null),t){let e=Object.defineProperty(Error("Loading initial props cancelled"),"__NEXT_ERROR_CODE",{value:"E405",enumerable:!1,configurable:!0});throw e.cancelled=!0,e}return e})}getInitialProps(e,t){let{Component:r}=this.components["/_app"],n=this._wrapApp(r);return t.AppTree=n,(0,d.loadGetInitialProps)(r,{AppTree:n,Component:e,router:this,ctx:t})}get route(){return this.state.route}get pathname(){return this.state.pathname}get query(){return this.state.query}get asPath(){return this.state.asPath}get locale(){return this.state.locale}get isFallback(){return this.state.isFallback}get isPreview(){return this.state.isPreview}constructor(e,t,r,{initialProps:n,pageLoader:a,App:i,wrapApp:u,Component:s,err:l,subscription:c,isFallback:f,locale:_,locales:m,defaultLocale:E,domainLocales:y,isPreview:b}){this.sdc={},this.sbc={},this.isFirstPopStateEvent=!0,this._key=G(),this.onPopState=e=>{let t,{isFirstPopStateEvent:r}=this;this.isFirstPopStateEvent=!1;let n=e.state;if(!n){let{pathname:e,query:t}=this;this.changeState("replaceState",(0,g.formatWithValidation)({pathname:(0,v.addBasePath)(e),query:t}),(0,d.getURL)());return}if(n.__NA)return void window.location.reload();if(!n.__N||r&&this.locale===n.options.locale&&n.as===this.asPath)return;let{url:a,as:o,options:i,key:u}=n;this._key=u;let{pathname:s}=(0,h.parseRelativeUrl)(a);(!this.isSsr||o!==(0,v.addBasePath)(this.asPath)||s!==(0,v.addBasePath)(this.pathname))&&(!this._bps||this._bps(n))&&this.change("replaceState",a,o,Object.assign({},i,{shallow:i.shallow&&this._shallow,locale:i.locale||this.defaultLocale,_h:0}),t)};let P=(0,o.removeTrailingSlash)(e);this.components={},"/_error"!==e&&(this.components[P]={Component:s,initial:!0,props:n,err:l,__N_SSG:n&&n.__N_SSG,__N_SSP:n&&n.__N_SSP}),this.components["/_app"]={Component:i,styleSheets:[]},this.events=V.events,this.pageLoader=a;let R=(0,p.isDynamicRoute)(e)&&self.__NEXT_DATA__.autoExport;if(this.basePath="",this.sub=c,this.clc=null,this._wrapApp=u,this.isSsr=!0,this.isLocaleDomain=!1,this.isReady=!!(self.__NEXT_DATA__.gssp||self.__NEXT_DATA__.gip||self.__NEXT_DATA__.isExperimentalCompile||self.__NEXT_DATA__.appGip&&!self.__NEXT_DATA__.gsp||!R&&!self.location.search),this.state={route:P,pathname:e,query:t,asPath:R?e:r,isPreview:!!b,locale:void 0,isFallback:f},this._initialMatchesMiddlewarePromise=Promise.resolve(!1),!r.startsWith("//")){let n={locale:_},a=(0,d.getURL)();this._initialMatchesMiddlewarePromise=D({router:this,locale:_,asPath:a}).then(o=>(n._shouldResolveHref=r!==e,this.changeState("replaceState",o?a:(0,g.formatWithValidation)({pathname:(0,v.addBasePath)(e),query:t}),a,n),o))}window.addEventListener("popstate",this.onPopState)}}V.events=(0,f.default)()},54387:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"RouterContext",{enumerable:!0,get:function(){return n}});let n=r(64252)._(r(14232)).default.createContext(null)},54933:(e,t)=>{"use strict";function r(e){return"("===e[0]&&e.endsWith(")")}function n(e){return e.startsWith("@")&&"@children"!==e}function a(e,t){if(e.includes(o)){let e=JSON.stringify(t);return"{}"!==e?o+"?"+e:o}return e}Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{DEFAULT_SEGMENT_KEY:function(){return i},PAGE_SEGMENT_KEY:function(){return o},addSearchParamsIfPageSegment:function(){return a},isGroupSegment:function(){return r},isParallelRouteSegment:function(){return n}});let o="__PAGE__",i="__DEFAULT__"},54968:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"normalizePathTrailingSlash",{enumerable:!0,get:function(){return o}});let n=r(69239),a=r(82585),o=e=>{if(!e.startsWith("/"))return e;let{pathname:t,query:r,hash:o}=(0,a.parsePath)(e);return/\.[^/]+\/?$/.test(t)?""+(0,n.removeTrailingSlash)(t)+r+o:t.endsWith("/")?""+t+r+o:t+"/"+r+o};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},57962:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{default:function(){return o},isEqualNode:function(){return a}});let n=r(60348);function a(e,t){if(e instanceof HTMLElement&&t instanceof HTMLElement){let r=t.getAttribute("nonce");if(r&&!e.getAttribute("nonce")){let n=t.cloneNode(!0);return n.setAttribute("nonce",""),n.nonce=r,r===e.nonce&&e.isEqualNode(n)}}return e.isEqualNode(t)}function o(){return{mountedInstances:new Set,updateHead:e=>{let t={};e.forEach(e=>{if("link"===e.type&&e.props["data-optimized-fonts"])if(document.querySelector('style[data-href="'+e.props["data-href"]+'"]'))return;else e.props.href=e.props["data-href"],e.props["data-href"]=void 0;let r=t[e.type]||[];r.push(e),t[e.type]=r});let r=t.title?t.title[0]:null,o="";if(r){let{children:e}=r.props;o="string"==typeof e?e:Array.isArray(e)?e.join(""):""}o!==document.title&&(document.title=o),["meta","base","link","style","script"].forEach(e=>{!function(e,t){let r=document.querySelector("head");if(!r)return;let o=new Set(r.querySelectorAll(""+e+"[data-next-head]"));if("meta"===e){let e=r.querySelector("meta[charset]");null!==e&&o.add(e)}let i=[];for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"resolveHref",{enumerable:!0,get:function(){return p}});let n=r(67825),a=r(359),o=r(31277),i=r(1033),u=r(54968),s=r(65790),l=r(92712),c=r(20718),f=r(70159),d=r(51082);function p(e,t,r){let p,h="string"==typeof t?t:(0,a.formatWithValidation)(t),_=h.match(/^[a-z][a-z0-9+.-]*:\/\//i),m=_?h.slice(_[0].length):h;if((m.split("?",1)[0]||"").match(/(\/\/|\\)/)){console.error("Invalid href '"+h+"' passed to next/router in page: '"+e.pathname+"'. Repeated forward-slashes (//) or backslashes \\ are not valid in the href.");let t=(0,i.normalizeRepeatedSlashes)(m);h=(_?_[0]:"")+t}if(!(0,s.isLocalURL)(h))return r?[h]:h;try{let t=h.startsWith("#")?e.asPath:e.pathname;if(h.startsWith("?")&&(t=e.asPath,(0,l.isDynamicRoute)(e.pathname))){t=e.pathname;let r=(0,f.getRouteRegex)(e.pathname);(0,d.getRouteMatcher)(r)(e.asPath)||(t=e.asPath)}p=new URL(t,"http://n")}catch(e){p=new URL("/","http://n")}try{let e=new URL(h,p);e.pathname=(0,u.normalizePathTrailingSlash)(e.pathname);let t="";if((0,l.isDynamicRoute)(e.pathname)&&e.searchParams&&r){let r=(0,n.searchParamsToUrlQuery)(e.searchParams),{result:i,params:u}=(0,c.interpolateAs)(e.pathname,e.pathname,r);i&&(t=(0,a.formatWithValidation)({pathname:i,hash:e.hash,query:(0,o.omit)(r,u)}))}let i=e.origin===p.origin?e.href.slice(e.origin.length):e.href;return r?[i,t||i]:i}catch(e){return r?[h]:h}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},60348:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"setAttributesFromProps",{enumerable:!0,get:function(){return o}});let r={acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv",noModule:"noModule"},n=["onLoad","onReady","dangerouslySetInnerHTML","children","onError","strategy","stylesheets"];function a(e){return["async","defer","noModule"].includes(e)}function o(e,t){for(let[o,i]of Object.entries(t)){if(!t.hasOwnProperty(o)||n.includes(o)||void 0===i)continue;let u=r[o]||o.toLowerCase();"SCRIPT"===e.tagName&&a(u)?e[u]=!!i:e.setAttribute(u,String(i)),(!1===i||"SCRIPT"===e.tagName&&a(u)&&(!i||"false"===i))&&(e.setAttribute(u,""),e.removeAttribute(u))}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},61137:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{safeCompile:function(){return i},safePathToRegexp:function(){return o},safeRegexpToFunction:function(){return u},safeRouteMatcher:function(){return s}});let n=r(29509),a=r(32117);function o(e,t,r){if("string"!=typeof e)return(0,n.pathToRegexp)(e,t,r);let o=(0,a.hasAdjacentParameterIssues)(e),i=o?(0,a.normalizeAdjacentParameters)(e):e;try{return(0,n.pathToRegexp)(i,t,r)}catch(i){if(!o)try{let o=(0,a.normalizeAdjacentParameters)(e);return(0,n.pathToRegexp)(o,t,r)}catch(e){}throw i}}function i(e,t){let r=(0,a.hasAdjacentParameterIssues)(e),o=r?(0,a.normalizeAdjacentParameters)(e):e;try{return(0,n.compile)(o,t)}catch(o){if(!r)try{let r=(0,a.normalizeAdjacentParameters)(e);return(0,n.compile)(r,t)}catch(e){}throw o}}function u(e,t){let r=(0,n.regexpToFunction)(e,t||[]);return e=>{let t=r(e);return!!t&&{...t,params:(0,a.stripParameterSeparators)(t.params)}}}function s(e){return t=>{let r=e(t);return!!r&&(0,a.stripParameterSeparators)(r)}}},63021:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(78757),self.__next_set_public_path__=e=>{r.p=e},("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},63258:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{VALID_LOADERS:function(){return r},imageConfigDefault:function(){return n}});let r=["default","imgix","cloudinary","akamai","custom"],n={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:60,formats:["image/webp"],dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"attachment",localPatterns:void 0,remotePatterns:[],qualities:void 0,unoptimized:!1}},64252:(e,t,r)=>{"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.r(t),r.d(t,{_:()=>n})},65364:(e,t,r)=>{"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(15861)},65790:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isLocalURL",{enumerable:!0,get:function(){return o}});let n=r(1033),a=r(92860);function o(e){if(!(0,n.isAbsoluteUrl)(e))return!0;try{let t=(0,n.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,a.hasBasePath)(r.pathname)}catch(e){return!1}}},66240:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{default:function(){return a},getProperError:function(){return o}});let n=r(77891);function a(e){return"object"==typeof e&&null!==e&&"name"in e&&"message"in e}function o(e){return a(e)?e:Object.defineProperty(Error((0,n.isPlainObject)(e)?function(e){let t=new WeakSet;return JSON.stringify(e,(e,r)=>{if("object"==typeof r&&null!==r){if(t.has(r))return"[Circular]";t.add(r)}return r})}(e):e+""),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0})}},66336:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{BailoutToCSRError:function(){return n},isBailoutToCSRError:function(){return a}});let r="BAILOUT_TO_CLIENT_SIDE_RENDERING";class n extends Error{constructor(e){super("Bail out to client-side rendering: "+e),this.reason=e,this.digest=r}}function a(e){return"object"==typeof e&&null!==e&&"digest"in e&&e.digest===r}},67647:(e,t,r)=>{"use strict";e.exports=r(19393)},67825:(e,t)=>{"use strict";function r(e){let t={};for(let[r,n]of e.entries()){let e=t[r];void 0===e?t[r]=n:Array.isArray(e)?e.push(n):t[r]=[e,n]}return t}function n(e){return"string"==typeof e?e:("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}function a(e){let t=new URLSearchParams;for(let[r,a]of Object.entries(e))if(Array.isArray(a))for(let e of a)t.append(r,n(e));else t.set(r,n(a));return t}function o(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"addBasePath",{enumerable:!0,get:function(){return o}});let n=r(40840),a=r(54968);function o(e,t){return(0,a.normalizePathTrailingSlash)((0,n.addPathPrefix)(e,""))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},69239:(e,t)=>{"use strict";function r(e){return e.replace(/\/$/,"")||"/"}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"removeTrailingSlash",{enumerable:!0,get:function(){return r}})},69272:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return i}});let n=r(64252)._(r(24622));class a{end(e){if("ended"===this.state.state)throw Object.defineProperty(Error("Span has already ended"),"__NEXT_ERROR_CODE",{value:"E17",enumerable:!1,configurable:!0});this.state={state:"ended",endTime:null!=e?e:Date.now()},this.onSpanEnd(this)}constructor(e,t,r){var n,a;this.name=e,this.attributes=null!=(n=t.attributes)?n:{},this.startTime=null!=(a=t.startTime)?a:Date.now(),this.onSpanEnd=r,this.state={state:"inprogress"}}}class o{startSpan(e,t){return new a(e,t,this.handleSpanEnd)}onSpanEnd(e){return this._emitter.on("spanend",e),()=>{this._emitter.off("spanend",e)}}constructor(){this._emitter=(0,n.default)(),this.handleSpanEnd=e=>{this._emitter.emit("spanend",e)}}}let i=new o;("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},70159:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{getNamedMiddlewareRegex:function(){return p},getNamedRouteRegex:function(){return d},getRouteRegex:function(){return l}});let n=r(39308),a=r(50781),o=r(3239),i=r(69239),u=r(31500);function s(e,t,r){let n={},s=1,l=[];for(let c of(0,i.removeTrailingSlash)(e).slice(1).split("/")){let e=a.INTERCEPTION_ROUTE_MARKERS.find(e=>c.startsWith(e)),i=c.match(u.PARAMETER_PATTERN);if(e&&i&&i[2]){let{key:t,optional:r,repeat:a}=(0,u.parseMatchedParameter)(i[2]);n[t]={pos:s++,repeat:a,optional:r},l.push("/"+(0,o.escapeStringRegexp)(e)+"([^/]+?)")}else if(i&&i[2]){let{key:e,repeat:t,optional:a}=(0,u.parseMatchedParameter)(i[2]);n[e]={pos:s++,repeat:t,optional:a},r&&i[1]&&l.push("/"+(0,o.escapeStringRegexp)(i[1]));let c=t?a?"(?:/(.+?))?":"/(.+?)":"/([^/]+?)";r&&i[1]&&(c=c.substring(1)),l.push(c)}else l.push("/"+(0,o.escapeStringRegexp)(c));t&&i&&i[3]&&l.push((0,o.escapeStringRegexp)(i[3]))}return{parameterizedRoute:l.join(""),groups:n}}function l(e,t){let{includeSuffix:r=!1,includePrefix:n=!1,excludeOptionalTrailingSlash:a=!1}=void 0===t?{}:t,{parameterizedRoute:o,groups:i}=s(e,r,n),u=o;return a||(u+="(?:/)?"),{re:RegExp("^"+u+"$"),groups:i}}function c(e){let t,{interceptionMarker:r,getSafeRouteKey:n,segment:a,routeKeys:i,keyPrefix:s,backreferenceDuplicateKeys:l}=e,{key:c,optional:f,repeat:d}=(0,u.parseMatchedParameter)(a),p=c.replace(/\W/g,"");s&&(p=""+s+p);let h=!1;(0===p.length||p.length>30)&&(h=!0),isNaN(parseInt(p.slice(0,1)))||(h=!0),h&&(p=n());let _=p in i;s?i[p]=""+s+c:i[p]=c;let m=r?(0,o.escapeStringRegexp)(r):"";return t=_&&l?"\\k<"+p+">":d?"(?<"+p+">.+?)":"(?<"+p+">[^/]+?)",f?"(?:/"+m+t+")?":"/"+m+t}function f(e,t,r,s,l){let f,d=(f=0,()=>{let e="",t=++f;for(;t>0;)e+=String.fromCharCode(97+(t-1)%26),t=Math.floor((t-1)/26);return e}),p={},h=[];for(let f of(0,i.removeTrailingSlash)(e).slice(1).split("/")){let e=a.INTERCEPTION_ROUTE_MARKERS.some(e=>f.startsWith(e)),i=f.match(u.PARAMETER_PATTERN);if(e&&i&&i[2])h.push(c({getSafeRouteKey:d,interceptionMarker:i[1],segment:i[2],routeKeys:p,keyPrefix:t?n.NEXT_INTERCEPTION_MARKER_PREFIX:void 0,backreferenceDuplicateKeys:l}));else if(i&&i[2]){s&&i[1]&&h.push("/"+(0,o.escapeStringRegexp)(i[1]));let e=c({getSafeRouteKey:d,segment:i[2],routeKeys:p,keyPrefix:t?n.NEXT_QUERY_PARAM_PREFIX:void 0,backreferenceDuplicateKeys:l});s&&i[1]&&(e=e.substring(1)),h.push(e)}else h.push("/"+(0,o.escapeStringRegexp)(f));r&&i&&i[3]&&h.push((0,o.escapeStringRegexp)(i[3]))}return{namedParameterizedRoute:h.join(""),routeKeys:p}}function d(e,t){var r,n,a;let o=f(e,t.prefixRouteKeys,null!=(r=t.includeSuffix)&&r,null!=(n=t.includePrefix)&&n,null!=(a=t.backreferenceDuplicateKeys)&&a),i=o.namedParameterizedRoute;return t.excludeOptionalTrailingSlash||(i+="(?:/)?"),{...l(e,t),namedRegex:"^"+i+"$",routeKeys:o.routeKeys}}function p(e,t){let{parameterizedRoute:r}=s(e,!1,!1),{catchAll:n=!0}=t;if("/"===r)return{namedRegex:"^/"+(n?".*":"")+"$"};let{namedParameterizedRoute:a}=f(e,!1,!1,!1,!1);return{namedRegex:"^"+a+(n?"(?:(/.*)?)":"")+"$"}}},71775:(e,t)=>{"use strict";function r(e){return e.startsWith("/")?e:"/"+e}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ensureLeadingSlash",{enumerable:!0,get:function(){return r}})},71905:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"addPathSuffix",{enumerable:!0,get:function(){return a}});let n=r(82585);function a(e,t){if(!e.startsWith("/")||!t)return e;let{pathname:r,query:a,hash:o}=(0,n.parsePath)(e);return""+r+t+a+o}},72129:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"formatNextPathnameInfo",{enumerable:!0,get:function(){return u}});let n=r(69239),a=r(40840),o=r(71905),i=r(42560);function u(e){let t=(0,i.addLocale)(e.pathname,e.locale,e.buildId?void 0:e.defaultLocale,e.ignorePrefix);return(e.buildId||!e.trailingSlash)&&(t=(0,n.removeTrailingSlash)(t)),e.buildId&&(t=(0,o.addPathSuffix)((0,a.addPathPrefix)(t,"/_next/data/"+e.buildId),"/"===e.pathname?"index.json":".json")),t=(0,a.addPathPrefix)(t,e.basePath),!e.buildId&&e.trailingSlash?t.endsWith("/")?t:(0,o.addPathSuffix)(t,"/"):(0,n.removeTrailingSlash)(t)}},73824:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return o}}),r(64252);let n=r(37876);r(14232);let a=r(6763);function o(e){function t(t){return(0,n.jsx)(e,{router:(0,a.useRouter)(),...t})}return t.getInitialProps=e.getInitialProps,t.origGetInitialProps=e.origGetInitialProps,t}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},74324:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"HeadManagerContext",{enumerable:!0,get:function(){return n}});let n=r(64252)._(r(14232)).default.createContext({})},76456:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"warnOnce",{enumerable:!0,get:function(){return r}});let r=e=>{}},77891:(e,t)=>{"use strict";function r(e){return Object.prototype.toString.call(e)}function n(e){if("[object Object]"!==r(e))return!1;let t=Object.getPrototypeOf(e);return null===t||t.hasOwnProperty("isPrototypeOf")}Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{getObjectClassLabel:function(){return r},isPlainObject:function(){return n}})},78757:(e,t)=>{"use strict";function r(){return""}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getDeploymentIdQueryOrEmptyString",{enumerable:!0,get:function(){return r}})},81854:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ImageConfigContext",{enumerable:!0,get:function(){return o}});let n=r(64252)._(r(14232)),a=r(63258),o=n.default.createContext(a.imageConfigDefault)},82155:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return d}});let n=r(64252),a=r(69011),o=r(20718),i=n._(r(15358)),u=r(89266),s=r(88668),l=r(5402),c=r(69239),f=r(30425);r(93309);class d{getPageList(){return(0,f.getClientBuildManifest)().then(e=>e.sortedPages)}getMiddleware(){return window.__MIDDLEWARE_MATCHERS=[],window.__MIDDLEWARE_MATCHERS}getDataHref(e){let{asPath:t,href:r,locale:n}=e,{pathname:f,query:d,search:p}=(0,l.parseRelativeUrl)(r),{pathname:h}=(0,l.parseRelativeUrl)(t),_=(0,c.removeTrailingSlash)(f);if("/"!==_[0])throw Object.defineProperty(Error('Route name should start with a "/", got "'+_+'"'),"__NEXT_ERROR_CODE",{value:"E303",enumerable:!1,configurable:!0});var m=e.skipInterpolation?h:(0,s.isDynamicRoute)(_)?(0,o.interpolateAs)(f,h,d).result:_;let g=(0,i.default)((0,c.removeTrailingSlash)((0,u.addLocale)(m,n)),".json");return(0,a.addBasePath)("/_next/data/"+this.buildId+g+p,!0)}_isSsg(e){return this.promisedSsgManifest.then(t=>t.has(e))}loadPage(e){return this.routeLoader.loadRoute(e).then(e=>{if("component"in e)return{page:e.component,mod:e.exports,styleSheets:e.styles.map(e=>({href:e.href,text:e.content}))};throw e.error})}prefetch(e){return this.routeLoader.prefetch(e)}constructor(e,t){this.routeLoader=(0,f.createRouteLoader)(t),this.buildId=e,this.assetPrefix=t,this.promisedSsgManifest=new Promise(e=>{window.__SSG_MANIFEST?e(window.__SSG_MANIFEST):window.__SSG_MANIFEST_CB=()=>{e(window.__SSG_MANIFEST)}})}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},82585:(e,t)=>{"use strict";function r(e){let t=e.indexOf("#"),r=e.indexOf("?"),n=r>-1&&(t<0||r-1?{pathname:e.substring(0,n?r:t),query:n?e.substring(r,t>-1?t:void 0):"",hash:t>-1?e.slice(t):""}:{pathname:e,query:"",hash:""}}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"parsePath",{enumerable:!0,get:function(){return r}})},83250:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{PathnameContextProviderAdapter:function(){return p},adaptForAppRouterInstance:function(){return c},adaptForPathParams:function(){return d},adaptForSearchParams:function(){return f}});let n=r(88365),a=r(37876),o=n._(r(14232)),i=r(9440),u=r(92712),s=r(27426),l=r(70159);function c(e){return{back(){e.back()},forward(){e.forward()},refresh(){e.reload()},hmrRefresh(){},push(t,r){let{scroll:n}=void 0===r?{}:r;e.push(t,void 0,{scroll:n})},replace(t,r){let{scroll:n}=void 0===r?{}:r;e.replace(t,void 0,{scroll:n})},prefetch(t){e.prefetch(t)}}}function f(e){return e.isReady&&e.query?(0,s.asPathToSearchParams)(e.asPath):new URLSearchParams}function d(e){if(!e.isReady||!e.query)return null;let t={};for(let r of Object.keys((0,l.getRouteRegex)(e.pathname).groups))t[r]=e.query[r];return t}function p(e){let{children:t,router:r,...n}=e,s=(0,o.useRef)(n.isAutoExport),l=(0,o.useMemo)(()=>{let e,t=s.current;if(t&&(s.current=!1),(0,u.isDynamicRoute)(r.pathname)&&(r.isFallback||t&&!r.isReady))return null;try{e=new URL(r.asPath,"http://f")}catch(e){return"/"}return e.pathname},[r.asPath,r.isFallback,r.isReady,r.pathname]);return(0,a.jsx)(i.PathnameContext.Provider,{value:l,children:t})}},83378:(e,t)=>{"use strict";let r;Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{default:function(){return n},setConfig:function(){return a}});let n=()=>r;function a(e){r=e}},83847:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"normalizeLocalePath",{enumerable:!0,get:function(){return n}});let r=new WeakMap;function n(e,t){let n;if(!t)return{pathname:e};let a=r.get(t);a||(a=t.map(e=>e.toLowerCase()),r.set(t,a));let o=e.split("/",2);if(!o[1])return{pathname:e};let i=o[1].toLowerCase(),u=a.indexOf(i);return u<0?{pathname:e}:(n=t[u],{pathname:e=e.slice(n.length+1)||"/",detectedLocale:n})}},86500:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{REDIRECT_ERROR_CODE:function(){return a},RedirectType:function(){return o},isRedirectError:function(){return i}});let n=r(13666),a="NEXT_REDIRECT";var o=function(e){return e.push="push",e.replace="replace",e}({});function i(e){if("object"!=typeof e||null===e||!("digest"in e)||"string"!=typeof e.digest)return!1;let t=e.digest.split(";"),[r,o]=t,i=t.slice(2,-2).join(";"),u=Number(t.at(-2));return r===a&&("replace"===o||"push"===o)&&"string"==typeof i&&!isNaN(u)&&u in n.RedirectStatusCode}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},87233:(e,t)=>{"use strict";let r;function n(e){var t;return(null==(t=function(){if(void 0===r){var e;r=(null==(e=window.trustedTypes)?void 0:e.createPolicy("nextjs",{createHTML:e=>e,createScript:e=>e,createScriptURL:e=>e}))||null}return r}())?void 0:t.createScriptURL(e))||e}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"__unsafeCreateTrustedScriptURL",{enumerable:!0,get:function(){return n}}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},87665:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{default:function(){return g},handleClientScriptLoad:function(){return h},initScriptLoader:function(){return _}});let n=r(64252),a=r(88365),o=r(37876),i=n._(r(98477)),u=a._(r(14232)),s=r(74324),l=r(60348),c=r(21112),f=new Map,d=new Set,p=e=>{let{src:t,id:r,onLoad:n=()=>{},onReady:a=null,dangerouslySetInnerHTML:o,children:u="",strategy:s="afterInteractive",onError:c,stylesheets:p}=e,h=r||t;if(h&&d.has(h))return;if(f.has(t)){d.add(h),f.get(t).then(n,c);return}let _=()=>{a&&a(),d.add(h)},m=document.createElement("script"),g=new Promise((e,t)=>{m.addEventListener("load",function(t){e(),n&&n.call(this,t),_()}),m.addEventListener("error",function(e){t(e)})}).catch(function(e){c&&c(e)});o?(m.innerHTML=o.__html||"",_()):u?(m.textContent="string"==typeof u?u:Array.isArray(u)?u.join(""):"",_()):t&&(m.src=t,f.set(t,g)),(0,l.setAttributesFromProps)(m,e),"worker"===s&&m.setAttribute("type","text/partytown"),m.setAttribute("data-nscript",s),p&&(e=>{if(i.default.preinit)return e.forEach(e=>{i.default.preinit(e,{as:"style"})});{let t=document.head;e.forEach(e=>{let r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.href=e,t.appendChild(r)})}})(p),document.body.appendChild(m)};function h(e){let{strategy:t="afterInteractive"}=e;"lazyOnload"===t?window.addEventListener("load",()=>{(0,c.requestIdleCallback)(()=>p(e))}):p(e)}function _(e){e.forEach(h),[...document.querySelectorAll('[data-nscript="beforeInteractive"]'),...document.querySelectorAll('[data-nscript="beforePageRender"]')].forEach(e=>{let t=e.id||e.getAttribute("src");d.add(t)})}function m(e){let{id:t,src:r="",onLoad:n=()=>{},onReady:a=null,strategy:l="afterInteractive",onError:f,stylesheets:h,..._}=e,{updateScripts:m,scripts:g,getIsSsr:E,appDir:y,nonce:b}=(0,u.useContext)(s.HeadManagerContext);b=_.nonce||b;let P=(0,u.useRef)(!1);(0,u.useEffect)(()=>{let e=t||r;P.current||(a&&e&&d.has(e)&&a(),P.current=!0)},[a,t,r]);let v=(0,u.useRef)(!1);if((0,u.useEffect)(()=>{if(!v.current){if("afterInteractive"===l)p(e);else"lazyOnload"===l&&("complete"===document.readyState?(0,c.requestIdleCallback)(()=>p(e)):window.addEventListener("load",()=>{(0,c.requestIdleCallback)(()=>p(e))}));v.current=!0}},[e,l]),("beforeInteractive"===l||"worker"===l)&&(m?(g[l]=(g[l]||[]).concat([{id:t,src:r,onLoad:n,onReady:a,onError:f,..._,nonce:b}]),m(g)):E&&E()?d.add(t||r):E&&!E()&&p({...e,nonce:b})),y){if(h&&h.forEach(e=>{i.default.preinit(e,{as:"style"})}),"beforeInteractive"===l)if(!r)return _.dangerouslySetInnerHTML&&(_.children=_.dangerouslySetInnerHTML.__html,delete _.dangerouslySetInnerHTML),(0,o.jsx)("script",{nonce:b,dangerouslySetInnerHTML:{__html:"(self.__next_s=self.__next_s||[]).push("+JSON.stringify([0,{..._,id:t}])+")"}});else return i.default.preload(r,_.integrity?{as:"script",integrity:_.integrity,nonce:b,crossOrigin:_.crossOrigin}:{as:"script",nonce:b,crossOrigin:_.crossOrigin}),(0,o.jsx)("script",{nonce:b,dangerouslySetInnerHTML:{__html:"(self.__next_s=self.__next_s||[]).push("+JSON.stringify([r,{..._,id:t}])+")"}});"afterInteractive"===l&&r&&i.default.preload(r,_.integrity?{as:"script",integrity:_.integrity,nonce:b,crossOrigin:_.crossOrigin}:{as:"script",nonce:b,crossOrigin:_.crossOrigin})}return null}Object.defineProperty(m,"__nextScript",{value:!0});let g=m;("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},88365:(e,t,r)=>{"use strict";function n(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(n=function(e){return e?r:t})(e)}function a(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=n(t);if(r&&r.has(e))return r.get(e);var a={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var u=o?Object.getOwnPropertyDescriptor(e,i):null;u&&(u.get||u.set)?Object.defineProperty(a,i,u):a[i]=e[i]}return a.default=e,r&&r.set(e,a),a}r.r(t),r.d(t,{_:()=>a})},88524:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"denormalizePagePath",{enumerable:!0,get:function(){return o}});let n=r(92712),a=r(40342);function o(e){let t=(0,a.normalizePathSep)(e);return t.startsWith("/index/")&&!(0,n.isDynamicRoute)(t)?t.slice(6):"/index"!==t?t:"/"}},88668:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isDynamicRoute",{enumerable:!0,get:function(){return i}});let n=r(50781),a=/\/[^/]*\[[^/]+\][^/]*(?=\/|$)/,o=/\/\[[^/]+\](?=\/|$)/;function i(e,t){return(void 0===t&&(t=!0),(0,n.isInterceptionRouteAppPath)(e)&&(e=(0,n.extractInterceptionRouteInformation)(e).interceptedRoute),t)?o.test(e):a.test(e)}},89266:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"addLocale",{enumerable:!0,get:function(){return n}}),r(54968);let n=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{getSortedRouteObjects:function(){return n.getSortedRouteObjects},getSortedRoutes:function(){return n.getSortedRoutes},isDynamicRoute:function(){return a.isDynamicRoute}});let n=r(24802),a=r(88668)},92860:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"hasBasePath",{enumerable:!0,get:function(){return a}});let n=r(321);function a(e){return(0,n.pathHasPrefix)(e,"")}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},93309:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{APP_BUILD_MANIFEST:function(){return b},APP_CLIENT_INTERNALS:function(){return Z},APP_PATHS_MANIFEST:function(){return g},APP_PATH_ROUTES_MANIFEST:function(){return E},AdapterOutputType:function(){return o},BARREL_OPTIMIZATION_PREFIX:function(){return G},BLOCKED_PAGES:function(){return k},BUILD_ID_FILE:function(){return F},BUILD_MANIFEST:function(){return y},CLIENT_PUBLIC_FILES_PATH:function(){return B},CLIENT_REFERENCE_MANIFEST:function(){return q},CLIENT_STATIC_FILES_PATH:function(){return H},CLIENT_STATIC_FILES_RUNTIME_AMP:function(){return et},CLIENT_STATIC_FILES_RUNTIME_MAIN:function(){return Q},CLIENT_STATIC_FILES_RUNTIME_MAIN_APP:function(){return J},CLIENT_STATIC_FILES_RUNTIME_POLYFILLS:function(){return en},CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL:function(){return ea},CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH:function(){return ee},CLIENT_STATIC_FILES_RUNTIME_WEBPACK:function(){return er},COMPILER_INDEXES:function(){return i},COMPILER_NAMES:function(){return a},CONFIG_FILES:function(){return U},DEFAULT_RUNTIME_WEBPACK:function(){return eo},DEFAULT_SANS_SERIF_FONT:function(){return ec},DEFAULT_SERIF_FONT:function(){return el},DEV_CLIENT_MIDDLEWARE_MANIFEST:function(){return M},DEV_CLIENT_PAGES_MANIFEST:function(){return C},DYNAMIC_CSS_MANIFEST:function(){return $},EDGE_RUNTIME_WEBPACK:function(){return ei},EDGE_UNSUPPORTED_NODE_APIS:function(){return e_},EXPORT_DETAIL:function(){return S},EXPORT_MARKER:function(){return O},FUNCTIONS_CONFIG_MANIFEST:function(){return P},IMAGES_MANIFEST:function(){return j},INTERCEPTION_ROUTE_REWRITE_MANIFEST:function(){return K},MIDDLEWARE_BUILD_MANIFEST:function(){return V},MIDDLEWARE_MANIFEST:function(){return I},MIDDLEWARE_REACT_LOADABLE_MANIFEST:function(){return Y},MODERN_BROWSERSLIST_TARGET:function(){return n.default},NEXT_BUILTIN_DOCUMENT:function(){return W},NEXT_FONT_MANIFEST:function(){return R},PAGES_MANIFEST:function(){return _},PHASE_DEVELOPMENT_SERVER:function(){return d},PHASE_EXPORT:function(){return l},PHASE_INFO:function(){return h},PHASE_PRODUCTION_BUILD:function(){return c},PHASE_PRODUCTION_SERVER:function(){return f},PHASE_TEST:function(){return p},PRERENDER_MANIFEST:function(){return T},REACT_LOADABLE_MANIFEST:function(){return L},ROUTES_MANIFEST:function(){return A},RSC_MODULE_TYPES:function(){return eh},SERVER_DIRECTORY:function(){return D},SERVER_FILES_MANIFEST:function(){return w},SERVER_PROPS_ID:function(){return es},SERVER_REFERENCE_MANIFEST:function(){return z},STATIC_PROPS_ID:function(){return eu},STATIC_STATUS_PAGES:function(){return ef},STRING_LITERAL_DROP_BUNDLE:function(){return X},SUBRESOURCE_INTEGRITY_MANIFEST:function(){return v},SYSTEM_ENTRYPOINTS:function(){return em},TRACE_OUTPUT_VERSION:function(){return ed},TURBOPACK_CLIENT_BUILD_MANIFEST:function(){return N},TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST:function(){return x},TURBO_TRACE_DEFAULT_MEMORY_LIMIT:function(){return ep},UNDERSCORE_NOT_FOUND_ROUTE:function(){return u},UNDERSCORE_NOT_FOUND_ROUTE_ENTRY:function(){return s},WEBPACK_STATS:function(){return m}});let n=r(64252)._(r(50563)),a={client:"client",server:"server",edgeServer:"edge-server"};var o=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.PRERENDER="PRERENDER",e.STATIC_FILE="STATIC_FILE",e.MIDDLEWARE="MIDDLEWARE",e}({});let i={[a.client]:0,[a.server]:1,[a.edgeServer]:2},u="/_not-found",s=""+u+"/page",l="phase-export",c="phase-production-build",f="phase-production-server",d="phase-development-server",p="phase-test",h="phase-info",_="pages-manifest.json",m="webpack-stats.json",g="app-paths-manifest.json",E="app-path-routes-manifest.json",y="build-manifest.json",b="app-build-manifest.json",P="functions-config-manifest.json",v="subresource-integrity-manifest",R="next-font-manifest",O="export-marker.json",S="export-detail.json",T="prerender-manifest.json",A="routes-manifest.json",j="images-manifest.json",w="required-server-files.json",C="_devPagesManifest.json",I="middleware-manifest.json",x="_clientMiddlewareManifest.json",N="client-build-manifest.json",M="_devMiddlewareManifest.json",L="react-loadable-manifest.json",D="server",U=["next.config.js","next.config.mjs","next.config.ts"],F="BUILD_ID",k=["/_document","/_app","/_error"],B="public",H="static",X="__NEXT_DROP_CLIENT_FILE__",W="__NEXT_BUILTIN_DOCUMENT__",G="__barrel_optimize__",q="client-reference-manifest",z="server-reference-manifest",V="middleware-build-manifest",Y="middleware-react-loadable-manifest",K="interception-route-rewrite-manifest",$="dynamic-css-manifest",Q="main",J=""+Q+"-app",Z="app-pages-internals",ee="react-refresh",et="amp",er="webpack",en="polyfills",ea=Symbol(en),eo="webpack-runtime",ei="edge-runtime-webpack",eu="__N_SSG",es="__N_SSP",el={name:"Times New Roman",xAvgCharWidth:821,azAvgWidth:854.3953488372093,unitsPerEm:2048},ec={name:"Arial",xAvgCharWidth:904,azAvgWidth:934.5116279069767,unitsPerEm:2048},ef=["/500"],ed=1,ep=6e3,eh={client:"client",server:"server"},e_=["clearImmediate","setImmediate","BroadcastChannel","ByteLengthQueuingStrategy","CompressionStream","CountQueuingStrategy","DecompressionStream","DomException","MessageChannel","MessageEvent","MessagePort","ReadableByteStreamController","ReadableStreamBYOBRequest","ReadableStreamDefaultController","TransformStreamDefaultController","WritableStreamDefaultController"],em=new Set([Q,ee,et,J]);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},98091:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"removePathPrefix",{enumerable:!0,get:function(){return a}});let n=r(321);function a(e,t){if(!(0,n.pathHasPrefix)(e,t))return e;let r=e.slice(t.length);return r.startsWith("/")?r:"/"+r}},99328:(e,t)=>{"use strict";function r(e,t){let r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let n=r.length;n--;){let a=r[n];if("query"===a){let r=Object.keys(e.query);if(r.length!==Object.keys(t.query).length)return!1;for(let n=r.length;n--;){let a=r[n];if(!t.query.hasOwnProperty(a)||e.query[a]!==t.query[a])return!1}}else if(!t.hasOwnProperty(a)||e[a]!==t[a])return!1}return!0}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"compareRouterStates",{enumerable:!0,get:function(){return r}})}},e=>{e.O(0,[593],()=>e(e.s=46175)),_N_E=e.O()}]); \ No newline at end of file diff --git a/_next/static/chunks/main-app-674d0f61ba780985.js b/_next/static/chunks/main-app-674d0f61ba780985.js new file mode 100644 index 0000000000000000000000000000000000000000..3f7a5d6f535367aa103c1fa9767fb76ccc6afdd6 --- /dev/null +++ b/_next/static/chunks/main-app-674d0f61ba780985.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[358],{19393:()=>{},75591:(e,s,n)=>{Promise.resolve().then(n.t.bind(n,57150,23)),Promise.resolve().then(n.t.bind(n,81959,23)),Promise.resolve().then(n.t.bind(n,17989,23)),Promise.resolve().then(n.t.bind(n,63886,23)),Promise.resolve().then(n.t.bind(n,9766,23)),Promise.resolve().then(n.t.bind(n,15278,23)),Promise.resolve().then(n.t.bind(n,98924,23)),Promise.resolve().then(n.t.bind(n,24431,23)),Promise.resolve().then(n.bind(n,80622))}},e=>{var s=s=>e(e.s=s);e.O(0,[441,255],()=>(s(1666),s(75591))),_N_E=e.O()}]); \ No newline at end of file diff --git a/_next/static/chunks/pages/_app-0d6ce27712411be2.js b/_next/static/chunks/pages/_app-0d6ce27712411be2.js new file mode 100644 index 0000000000000000000000000000000000000000..04a6598c6e9ab7a835db4c585ff1eca8da177aed --- /dev/null +++ b/_next/static/chunks/pages/_app-0d6ce27712411be2.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[139,636],{45139:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return s}});let u=n(64252),l=n(37876),a=u._(n(14232)),o=n(1033);async function r(e){let{Component:t,ctx:n}=e;return{pageProps:await (0,o.loadGetInitialProps)(t,n)}}class s extends a.default.Component{render(){let{Component:e,pageProps:t}=this.props;return(0,l.jsx)(e,{...t})}}s.origGetInitialProps=r,s.getInitialProps=r,("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},50326:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/_app",function(){return n(45139)}])}},e=>{var t=t=>e(e.s=t);e.O(0,[593,792],()=>(t(50326),t(6763))),_N_E=e.O()}]); \ No newline at end of file diff --git a/_next/static/chunks/pages/_error-a8479a8c7bc399cf.js b/_next/static/chunks/pages/_error-a8479a8c7bc399cf.js new file mode 100644 index 0000000000000000000000000000000000000000..965eaf9adf5945d7d1c8eab2b08e3c7797ee5fbc --- /dev/null +++ b/_next/static/chunks/pages/_error-a8479a8c7bc399cf.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[646,731],{12479:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return i}});let r=n(14232),o=r.useLayoutEffect,l=r.useEffect;function i(e){let{headManager:t,reduceComponentsToState:n}=e;function i(){if(t&&t.mountedInstances){let o=r.Children.toArray(Array.from(t.mountedInstances).filter(Boolean));t.updateHead(n(o,e))}}return o(()=>{var n;return null==t||null==(n=t.mountedInstances)||n.add(e.children),()=>{var n;null==t||null==(n=t.mountedInstances)||n.delete(e.children)}}),o(()=>(t&&(t._pendingUpdate=i),()=>{t&&(t._pendingUpdate=i)})),l(()=>(t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null),()=>{t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null)})),null}},18438:(e,t)=>{"use strict";function n(e){let{ampFirst:t=!1,hybrid:n=!1,hasQuery:r=!1}=void 0===e?{}:e;return t||n&&r}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isInAmpMode",{enumerable:!0,get:function(){return n}})},31646:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return u}});let r=n(64252),o=n(37876),l=r._(n(14232)),i=r._(n(97918)),a={400:"Bad Request",404:"This page could not be found",405:"Method Not Allowed",500:"Internal Server Error"};function d(e){let{req:t,res:n,err:r}=e;return{statusCode:n&&n.statusCode?n.statusCode:r?r.statusCode:404,hostname:window.location.hostname}}let s={error:{fontFamily:'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',height:"100vh",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},desc:{lineHeight:"48px"},h1:{display:"inline-block",margin:"0 20px 0 0",paddingRight:23,fontSize:24,fontWeight:500,verticalAlign:"top"},h2:{fontSize:14,fontWeight:400,lineHeight:"28px"},wrap:{display:"inline-block"}};class u extends l.default.Component{render(){let{statusCode:e,withDarkMode:t=!0}=this.props,n=this.props.title||a[e]||"An unexpected error has occurred";return(0,o.jsxs)("div",{style:s.error,children:[(0,o.jsx)(i.default,{children:(0,o.jsx)("title",{children:e?e+": "+n:"Application error: a client-side exception has occurred"})}),(0,o.jsxs)("div",{style:s.desc,children:[(0,o.jsx)("style",{dangerouslySetInnerHTML:{__html:"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}"+(t?"@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}":"")}}),e?(0,o.jsx)("h1",{className:"next-error-h1",style:s.h1,children:e}):null,(0,o.jsx)("div",{style:s.wrap,children:(0,o.jsxs)("h2",{style:s.h2,children:[this.props.title||e?n:(0,o.jsxs)(o.Fragment,{children:["Application error: a client-side exception has occurred"," ",!!this.props.hostname&&(0,o.jsxs)(o.Fragment,{children:["while loading ",this.props.hostname]})," ","(see the browser console for more information)"]}),"."]})})]})]})}}u.displayName="ErrorPage",u.getInitialProps=d,u.origGetInitialProps=d,("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},55066:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"AmpStateContext",{enumerable:!0,get:function(){return r}});let r=n(64252)._(n(14232)).default.createContext({})},92164:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/_error",function(){return n(31646)}])},97918:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{default:function(){return y},defaultHead:function(){return c}});let r=n(64252),o=n(88365),l=n(37876),i=o._(n(14232)),a=r._(n(12479)),d=n(55066),s=n(74324),u=n(18438);function c(e){void 0===e&&(e=!1);let t=[(0,l.jsx)("meta",{charSet:"utf-8"},"charset")];return e||t.push((0,l.jsx)("meta",{name:"viewport",content:"width=device-width"},"viewport")),t}function p(e,t){return"string"==typeof t||"number"==typeof t?e:t.type===i.default.Fragment?e.concat(i.default.Children.toArray(t.props.children).reduce((e,t)=>"string"==typeof t||"number"==typeof t?e:e.concat(t),[])):e.concat(t)}n(76456);let f=["name","httpEquiv","charSet","itemProp"];function h(e,t){let{inAmpMode:n}=t;return e.reduce(p,[]).reverse().concat(c(n).reverse()).filter(function(){let e=new Set,t=new Set,n=new Set,r={};return o=>{let l=!0,i=!1;if(o.key&&"number"!=typeof o.key&&o.key.indexOf("$")>0){i=!0;let t=o.key.slice(o.key.indexOf("$")+1);e.has(t)?l=!1:e.add(t)}switch(o.type){case"title":case"base":t.has(o.type)?l=!1:t.add(o.type);break;case"meta":for(let e=0,t=f.length;e{let n=e.key||t;return i.default.cloneElement(e,{key:n})})}let y=function(e){let{children:t}=e,n=(0,i.useContext)(d.AmpStateContext),r=(0,i.useContext)(s.HeadManagerContext);return(0,l.jsx)(a.default,{reduceComponentsToState:h,headManager:r,inAmpMode:(0,u.isInAmpMode)(n),children:t})};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)}},e=>{e.O(0,[636,593,792],()=>e(e.s=92164)),_N_E=e.O()}]); \ No newline at end of file diff --git a/_next/static/chunks/polyfills-42372ed130431b0a.js b/_next/static/chunks/polyfills-42372ed130431b0a.js new file mode 100644 index 0000000000000000000000000000000000000000..ab422b94a4fbe76275d31c0bf7ef334768b39cae --- /dev/null +++ b/_next/static/chunks/polyfills-42372ed130431b0a.js @@ -0,0 +1 @@ +!function(){var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t){var e={exports:{}};return t(e,e.exports),e.exports}var r,n,o=function(t){return t&&t.Math===Math&&t},i=o("object"==typeof globalThis&&globalThis)||o("object"==typeof window&&window)||o("object"==typeof self&&self)||o("object"==typeof t&&t)||o("object"==typeof t&&t)||function(){return this}()||Function("return this")(),a=function(t){try{return!!t()}catch(t){return!0}},u=!a(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}),s=!a(function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}),c=Function.prototype.call,f=s?c.bind(c):function(){return c.apply(c,arguments)},l={}.propertyIsEnumerable,h=Object.getOwnPropertyDescriptor,p=h&&!l.call({1:2},1)?function(t){var e=h(this,t);return!!e&&e.enumerable}:l,v={f:p},d=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},g=Function.prototype,y=g.call,m=s&&g.bind.bind(y,y),b=s?m:function(t){return function(){return y.apply(t,arguments)}},w=b({}.toString),S=b("".slice),E=function(t){return S(w(t),8,-1)},O=Object,x=b("".split),R=a(function(){return!O("z").propertyIsEnumerable(0)})?function(t){return"String"===E(t)?x(t,""):O(t)}:O,P=function(t){return null==t},A=TypeError,j=function(t){if(P(t))throw new A("Can't call method on "+t);return t},k=function(t){return R(j(t))},I="object"==typeof document&&document.all,T=void 0===I&&void 0!==I?function(t){return"function"==typeof t||t===I}:function(t){return"function"==typeof t},M=function(t){return"object"==typeof t?null!==t:T(t)},L=function(t,e){return arguments.length<2?T(r=i[t])?r:void 0:i[t]&&i[t][e];var r},U=b({}.isPrototypeOf),N=i.navigator,C=N&&N.userAgent,_=C?String(C):"",F=i.process,B=i.Deno,D=F&&F.versions||B&&B.version,z=D&&D.v8;z&&(n=(r=z.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!n&&_&&(!(r=_.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=_.match(/Chrome\/(\d+)/))&&(n=+r[1]);var W=n,q=i.String,H=!!Object.getOwnPropertySymbols&&!a(function(){var t=Symbol("symbol detection");return!q(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&W&&W<41}),$=H&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,K=Object,G=$?function(t){return"symbol"==typeof t}:function(t){var e=L("Symbol");return T(e)&&U(e.prototype,K(t))},V=String,Y=function(t){try{return V(t)}catch(t){return"Object"}},X=TypeError,J=function(t){if(T(t))return t;throw new X(Y(t)+" is not a function")},Q=function(t,e){var r=t[e];return P(r)?void 0:J(r)},Z=TypeError,tt=Object.defineProperty,et=function(t,e){try{tt(i,t,{value:e,configurable:!0,writable:!0})}catch(r){i[t]=e}return e},rt=e(function(t){var e="__core-js_shared__",r=t.exports=i[e]||et(e,{});(r.versions||(r.versions=[])).push({version:"3.38.1",mode:"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.38.1/LICENSE",source:"https://github.com/zloirock/core-js"})}),nt=function(t,e){return rt[t]||(rt[t]=e||{})},ot=Object,it=function(t){return ot(j(t))},at=b({}.hasOwnProperty),ut=Object.hasOwn||function(t,e){return at(it(t),e)},st=0,ct=Math.random(),ft=b(1..toString),lt=function(t){return"Symbol("+(void 0===t?"":t)+")_"+ft(++st+ct,36)},ht=i.Symbol,pt=nt("wks"),vt=$?ht.for||ht:ht&&ht.withoutSetter||lt,dt=function(t){return ut(pt,t)||(pt[t]=H&&ut(ht,t)?ht[t]:vt("Symbol."+t)),pt[t]},gt=TypeError,yt=dt("toPrimitive"),mt=function(t,e){if(!M(t)||G(t))return t;var r,n=Q(t,yt);if(n){if(void 0===e&&(e="default"),r=f(n,t,e),!M(r)||G(r))return r;throw new gt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var r,n;if("string"===e&&T(r=t.toString)&&!M(n=f(r,t)))return n;if(T(r=t.valueOf)&&!M(n=f(r,t)))return n;if("string"!==e&&T(r=t.toString)&&!M(n=f(r,t)))return n;throw new Z("Can't convert object to primitive value")}(t,e)},bt=function(t){var e=mt(t,"string");return G(e)?e:e+""},wt=i.document,St=M(wt)&&M(wt.createElement),Et=function(t){return St?wt.createElement(t):{}},Ot=!u&&!a(function(){return 7!==Object.defineProperty(Et("div"),"a",{get:function(){return 7}}).a}),xt=Object.getOwnPropertyDescriptor,Rt={f:u?xt:function(t,e){if(t=k(t),e=bt(e),Ot)try{return xt(t,e)}catch(t){}if(ut(t,e))return d(!f(v.f,t,e),t[e])}},Pt=u&&a(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype}),At=String,jt=TypeError,kt=function(t){if(M(t))return t;throw new jt(At(t)+" is not an object")},It=TypeError,Tt=Object.defineProperty,Mt=Object.getOwnPropertyDescriptor,Lt="enumerable",Ut="configurable",Nt="writable",Ct={f:u?Pt?function(t,e,r){if(kt(t),e=bt(e),kt(r),"function"==typeof t&&"prototype"===e&&"value"in r&&Nt in r&&!r[Nt]){var n=Mt(t,e);n&&n[Nt]&&(t[e]=r.value,r={configurable:Ut in r?r[Ut]:n[Ut],enumerable:Lt in r?r[Lt]:n[Lt],writable:!1})}return Tt(t,e,r)}:Tt:function(t,e,r){if(kt(t),e=bt(e),kt(r),Ot)try{return Tt(t,e,r)}catch(t){}if("get"in r||"set"in r)throw new It("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},_t=u?function(t,e,r){return Ct.f(t,e,d(1,r))}:function(t,e,r){return t[e]=r,t},Ft=Function.prototype,Bt=u&&Object.getOwnPropertyDescriptor,Dt=ut(Ft,"name"),zt={EXISTS:Dt,PROPER:Dt&&"something"===function(){}.name,CONFIGURABLE:Dt&&(!u||u&&Bt(Ft,"name").configurable)},Wt=b(Function.toString);T(rt.inspectSource)||(rt.inspectSource=function(t){return Wt(t)});var qt,Ht,$t,Kt=rt.inspectSource,Gt=i.WeakMap,Vt=T(Gt)&&/native code/.test(String(Gt)),Yt=nt("keys"),Xt=function(t){return Yt[t]||(Yt[t]=lt(t))},Jt={},Qt="Object already initialized",Zt=i.TypeError;if(Vt||rt.state){var te=rt.state||(rt.state=new(0,i.WeakMap));te.get=te.get,te.has=te.has,te.set=te.set,qt=function(t,e){if(te.has(t))throw new Zt(Qt);return e.facade=t,te.set(t,e),e},Ht=function(t){return te.get(t)||{}},$t=function(t){return te.has(t)}}else{var ee=Xt("state");Jt[ee]=!0,qt=function(t,e){if(ut(t,ee))throw new Zt(Qt);return e.facade=t,_t(t,ee,e),e},Ht=function(t){return ut(t,ee)?t[ee]:{}},$t=function(t){return ut(t,ee)}}var re,ne={set:qt,get:Ht,has:$t,enforce:function(t){return $t(t)?Ht(t):qt(t,{})},getterFor:function(t){return function(e){var r;if(!M(e)||(r=Ht(e)).type!==t)throw new Zt("Incompatible receiver, "+t+" required");return r}}},oe=e(function(t){var e=zt.CONFIGURABLE,r=ne.enforce,n=ne.get,o=String,i=Object.defineProperty,s=b("".slice),c=b("".replace),f=b([].join),l=u&&!a(function(){return 8!==i(function(){},"length",{value:8}).length}),h=String(String).split("String"),p=t.exports=function(t,n,a){"Symbol("===s(o(n),0,7)&&(n="["+c(o(n),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),a&&a.getter&&(n="get "+n),a&&a.setter&&(n="set "+n),(!ut(t,"name")||e&&t.name!==n)&&(u?i(t,"name",{value:n,configurable:!0}):t.name=n),l&&a&&ut(a,"arity")&&t.length!==a.arity&&i(t,"length",{value:a.arity});try{a&&ut(a,"constructor")&&a.constructor?u&&i(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var p=r(t);return ut(p,"source")||(p.source=f(h,"string"==typeof n?n:"")),t};Function.prototype.toString=p(function(){return T(this)&&n(this).source||Kt(this)},"toString")}),ie=function(t,e,r,n){n||(n={});var o=n.enumerable,i=void 0!==n.name?n.name:e;if(T(r)&&oe(r,i,n),n.global)o?t[e]=r:et(e,r);else{try{n.unsafe?t[e]&&(o=!0):delete t[e]}catch(t){}o?t[e]=r:Ct.f(t,e,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},ae=Math.ceil,ue=Math.floor,se=Math.trunc||function(t){var e=+t;return(e>0?ue:ae)(e)},ce=function(t){var e=+t;return e!=e||0===e?0:se(e)},fe=Math.max,le=Math.min,he=function(t,e){var r=ce(t);return r<0?fe(r+e,0):le(r,e)},pe=Math.min,ve=function(t){var e=ce(t);return e>0?pe(e,9007199254740991):0},de=function(t){return ve(t.length)},ge=function(t){return function(e,r,n){var o=k(e),i=de(o);if(0===i)return!t&&-1;var a,u=he(n,i);if(t&&r!=r){for(;i>u;)if((a=o[u++])!=a)return!0}else for(;i>u;u++)if((t||u in o)&&o[u]===r)return t||u||0;return!t&&-1}},ye={includes:ge(!0),indexOf:ge(!1)},me=ye.indexOf,be=b([].push),we=function(t,e){var r,n=k(t),o=0,i=[];for(r in n)!ut(Jt,r)&&ut(n,r)&&be(i,r);for(;e.length>o;)ut(n,r=e[o++])&&(~me(i,r)||be(i,r));return i},Se=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ee=Se.concat("length","prototype"),Oe={f:Object.getOwnPropertyNames||function(t){return we(t,Ee)}},xe={f:Object.getOwnPropertySymbols},Re=b([].concat),Pe=L("Reflect","ownKeys")||function(t){var e=Oe.f(kt(t)),r=xe.f;return r?Re(e,r(t)):e},Ae=function(t,e,r){for(var n=Pe(e),o=Ct.f,i=Rt.f,a=0;aa;)Ct.f(t,r=o[a++],n[r]);return t},Be={f:Fe},De=L("document","documentElement"),ze="prototype",We="script",qe=Xt("IE_PROTO"),He=function(){},$e=function(t){return"<"+We+">"+t+""},Ke=function(t){t.write($e("")),t.close();var e=t.parentWindow.Object;return t=null,e},Ge=function(){try{re=new ActiveXObject("htmlfile")}catch(t){}var t,e,r;Ge="undefined"!=typeof document?document.domain&&re?Ke(re):(e=Et("iframe"),r="java"+We+":",e.style.display="none",De.appendChild(e),e.src=String(r),(t=e.contentWindow.document).open(),t.write($e("document.F=Object")),t.close(),t.F):Ke(re);for(var n=Se.length;n--;)delete Ge[ze][Se[n]];return Ge()};Jt[qe]=!0;var Ve=Object.create||function(t,e){var r;return null!==t?(He[ze]=kt(t),r=new He,He[ze]=null,r[qe]=t):r=Ge(),void 0===e?r:Be.f(r,e)},Ye=Ct.f,Xe=dt("unscopables"),Je=Array.prototype;void 0===Je[Xe]&&Ye(Je,Xe,{configurable:!0,value:Ve(null)});var Qe=function(t){Je[Xe][t]=!0};Ce({target:"Array",proto:!0},{at:function(t){var e=it(this),r=de(e),n=ce(t),o=n>=0?n:r+n;return o<0||o>=r?void 0:e[o]}}),Qe("at");var Ze=function(t,e){return b(i[t].prototype[e])},tr=(Ze("Array","at"),TypeError),er=function(t,e){if(!delete t[e])throw new tr("Cannot delete property "+Y(e)+" of "+Y(t))},rr=Math.min,nr=[].copyWithin||function(t,e){var r=it(this),n=de(r),o=he(t,n),i=he(e,n),a=arguments.length>2?arguments[2]:void 0,u=rr((void 0===a?n:he(a,n))-i,n-o),s=1;for(i0;)i in r?r[o]=r[i]:er(r,o),o+=s,i+=s;return r};Ce({target:"Array",proto:!0},{copyWithin:nr}),Qe("copyWithin"),Ze("Array","copyWithin"),Ce({target:"Array",proto:!0},{fill:function(t){for(var e=it(this),r=de(e),n=arguments.length,o=he(n>1?arguments[1]:void 0,r),i=n>2?arguments[2]:void 0,a=void 0===i?r:he(i,r);a>o;)e[o++]=t;return e}}),Qe("fill"),Ze("Array","fill");var or=function(t){if("Function"===E(t))return b(t)},ir=or(or.bind),ar=function(t,e){return J(t),void 0===e?t:s?ir(t,e):function(){return t.apply(e,arguments)}},ur=Array.isArray||function(t){return"Array"===E(t)},sr={};sr[dt("toStringTag")]="z";var cr="[object z]"===String(sr),fr=dt("toStringTag"),lr=Object,hr="Arguments"===E(function(){return arguments}()),pr=cr?E:function(t){var e,r,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(e=lr(t),fr))?r:hr?E(e):"Object"===(n=E(e))&&T(e.callee)?"Arguments":n},vr=function(){},dr=L("Reflect","construct"),gr=/^\s*(?:class|function)\b/,yr=b(gr.exec),mr=!gr.test(vr),br=function(t){if(!T(t))return!1;try{return dr(vr,[],t),!0}catch(t){return!1}},wr=function(t){if(!T(t))return!1;switch(pr(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return mr||!!yr(gr,Kt(t))}catch(t){return!0}};wr.sham=!0;var Sr=!dr||a(function(){var t;return br(br.call)||!br(Object)||!br(function(){t=!0})||t})?wr:br,Er=dt("species"),Or=Array,xr=function(t,e){return new(function(t){var e;return ur(t)&&(Sr(e=t.constructor)&&(e===Or||ur(e.prototype))||M(e)&&null===(e=e[Er]))&&(e=void 0),void 0===e?Or:e}(t))(0===e?0:e)},Rr=b([].push),Pr=function(t){var e=1===t,r=2===t,n=3===t,o=4===t,i=6===t,a=7===t,u=5===t||i;return function(s,c,f,l){for(var h,p,v=it(s),d=R(v),g=de(d),y=ar(c,f),m=0,b=l||xr,w=e?b(s,g):r||a?b(s,0):void 0;g>m;m++)if((u||m in d)&&(p=y(h=d[m],m,v),t))if(e)w[m]=p;else if(p)switch(t){case 3:return!0;case 5:return h;case 6:return m;case 2:Rr(w,h)}else switch(t){case 4:return!1;case 7:Rr(w,h)}return i?-1:n||o?o:w}},Ar={forEach:Pr(0),map:Pr(1),filter:Pr(2),some:Pr(3),every:Pr(4),find:Pr(5),findIndex:Pr(6),filterReject:Pr(7)},jr=Ar.find,kr="find",Ir=!0;kr in[]&&Array(1)[kr](function(){Ir=!1}),Ce({target:"Array",proto:!0,forced:Ir},{find:function(t){return jr(this,t,arguments.length>1?arguments[1]:void 0)}}),Qe(kr),Ze("Array","find");var Tr=Ar.findIndex,Mr="findIndex",Lr=!0;Mr in[]&&Array(1)[Mr](function(){Lr=!1}),Ce({target:"Array",proto:!0,forced:Lr},{findIndex:function(t){return Tr(this,t,arguments.length>1?arguments[1]:void 0)}}),Qe(Mr),Ze("Array","findIndex");var Ur=TypeError,Nr=function(t){if(t>9007199254740991)throw Ur("Maximum allowed index exceeded");return t},Cr=function(t,e,r,n,o,i,a,u){for(var s,c,f=o,l=0,h=!!a&&ar(a,u);l0&&ur(s)?(c=de(s),f=Cr(t,e,s,c,f,i-1)-1):(Nr(f+1),t[f]=s),f++),l++;return f},_r=Cr;Ce({target:"Array",proto:!0},{flatMap:function(t){var e,r=it(this),n=de(r);return J(t),(e=xr(r,0)).length=_r(e,r,r,n,0,1,t,arguments.length>1?arguments[1]:void 0),e}}),Qe("flatMap"),Ze("Array","flatMap"),Ce({target:"Array",proto:!0},{flat:function(){var t=arguments.length?arguments[0]:void 0,e=it(this),r=de(e),n=xr(e,0);return n.length=_r(n,e,e,r,0,void 0===t?1:ce(t)),n}}),Qe("flat"),Ze("Array","flat");var Fr,Br,Dr,zr=String,Wr=function(t){if("Symbol"===pr(t))throw new TypeError("Cannot convert a Symbol value to a string");return zr(t)},qr=b("".charAt),Hr=b("".charCodeAt),$r=b("".slice),Kr=function(t){return function(e,r){var n,o,i=Wr(j(e)),a=ce(r),u=i.length;return a<0||a>=u?t?"":void 0:(n=Hr(i,a))<55296||n>56319||a+1===u||(o=Hr(i,a+1))<56320||o>57343?t?qr(i,a):n:t?$r(i,a,a+2):o-56320+(n-55296<<10)+65536}},Gr={codeAt:Kr(!1),charAt:Kr(!0)},Vr=!a(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}),Yr=Xt("IE_PROTO"),Xr=Object,Jr=Xr.prototype,Qr=Vr?Xr.getPrototypeOf:function(t){var e=it(t);if(ut(e,Yr))return e[Yr];var r=e.constructor;return T(r)&&e instanceof r?r.prototype:e instanceof Xr?Jr:null},Zr=dt("iterator"),tn=!1;[].keys&&("next"in(Dr=[].keys())?(Br=Qr(Qr(Dr)))!==Object.prototype&&(Fr=Br):tn=!0);var en=!M(Fr)||a(function(){var t={};return Fr[Zr].call(t)!==t});en&&(Fr={}),T(Fr[Zr])||ie(Fr,Zr,function(){return this});var rn={IteratorPrototype:Fr,BUGGY_SAFARI_ITERATORS:tn},nn=Ct.f,on=dt("toStringTag"),an=function(t,e,r){t&&!r&&(t=t.prototype),t&&!ut(t,on)&&nn(t,on,{configurable:!0,value:e})},un={},sn=rn.IteratorPrototype,cn=function(){return this},fn=function(t,e,r,n){var o=e+" Iterator";return t.prototype=Ve(sn,{next:d(+!n,r)}),an(t,o,!1),un[o]=cn,t},ln=function(t,e,r){try{return b(J(Object.getOwnPropertyDescriptor(t,e)[r]))}catch(t){}},hn=String,pn=TypeError,vn=function(t){if(function(t){return M(t)||null===t}(t))return t;throw new pn("Can't set "+hn(t)+" as a prototype")},dn=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,r={};try{(t=ln(Object.prototype,"__proto__","set"))(r,[]),e=r instanceof Array}catch(t){}return function(r,n){return j(r),vn(n),M(r)?(e?t(r,n):r.__proto__=n,r):r}}():void 0),gn=zt.PROPER,yn=zt.CONFIGURABLE,mn=rn.IteratorPrototype,bn=rn.BUGGY_SAFARI_ITERATORS,wn=dt("iterator"),Sn="keys",En="values",On="entries",xn=function(){return this},Rn=function(t,e,r,n,o,i,a){fn(r,e,n);var u,s,c,l=function(t){if(t===o&&g)return g;if(!bn&&t&&t in v)return v[t];switch(t){case Sn:case En:case On:return function(){return new r(this,t)}}return function(){return new r(this)}},h=e+" Iterator",p=!1,v=t.prototype,d=v[wn]||v["@@iterator"]||o&&v[o],g=!bn&&d||l(o),y="Array"===e&&v.entries||d;if(y&&(u=Qr(y.call(new t)))!==Object.prototype&&u.next&&(Qr(u)!==mn&&(dn?dn(u,mn):T(u[wn])||ie(u,wn,xn)),an(u,h,!0)),gn&&o===En&&d&&d.name!==En&&(yn?_t(v,"name",En):(p=!0,g=function(){return f(d,this)})),o)if(s={values:l(En),keys:i?g:l(Sn),entries:l(On)},a)for(c in s)(bn||p||!(c in v))&&ie(v,c,s[c]);else Ce({target:e,proto:!0,forced:bn||p},s);return v[wn]!==g&&ie(v,wn,g,{name:o}),un[e]=g,s},Pn=function(t,e){return{value:t,done:e}},An=Gr.charAt,jn="String Iterator",kn=ne.set,In=ne.getterFor(jn);Rn(String,"String",function(t){kn(this,{type:jn,string:Wr(t),index:0})},function(){var t,e=In(this),r=e.string,n=e.index;return n>=r.length?Pn(void 0,!0):(t=An(r,n),e.index+=t.length,Pn(t,!1))});var Tn=function(t,e,r){var n,o;kt(t);try{if(!(n=Q(t,"return"))){if("throw"===e)throw r;return r}n=f(n,t)}catch(t){o=!0,n=t}if("throw"===e)throw r;if(o)throw n;return kt(n),r},Mn=function(t,e,r,n){try{return n?e(kt(r)[0],r[1]):e(r)}catch(e){Tn(t,"throw",e)}},Ln=dt("iterator"),Un=Array.prototype,Nn=function(t){return void 0!==t&&(un.Array===t||Un[Ln]===t)},Cn=function(t,e,r){u?Ct.f(t,e,d(0,r)):t[e]=r},_n=dt("iterator"),Fn=function(t){if(!P(t))return Q(t,_n)||Q(t,"@@iterator")||un[pr(t)]},Bn=TypeError,Dn=function(t,e){var r=arguments.length<2?Fn(t):e;if(J(r))return kt(f(r,t));throw new Bn(Y(t)+" is not iterable")},zn=Array,Wn=function(t){var e=it(t),r=Sr(this),n=arguments.length,o=n>1?arguments[1]:void 0,i=void 0!==o;i&&(o=ar(o,n>2?arguments[2]:void 0));var a,u,s,c,l,h,p=Fn(e),v=0;if(!p||this===zn&&Nn(p))for(a=de(e),u=r?new this(a):zn(a);a>v;v++)h=i?o(e[v],v):e[v],Cn(u,v,h);else for(u=r?new this:[],l=(c=Dn(e,p)).next;!(s=f(l,c)).done;v++)h=i?Mn(c,o,[s.value,v],!0):s.value,Cn(u,v,h);return u.length=v,u},qn=dt("iterator"),Hn=!1;try{var $n=0,Kn={next:function(){return{done:!!$n++}},return:function(){Hn=!0}};Kn[qn]=function(){return this},Array.from(Kn,function(){throw 2})}catch(t){}var Gn=function(t,e){try{if(!e&&!Hn)return!1}catch(t){return!1}var r=!1;try{var n={};n[qn]=function(){return{next:function(){return{done:r=!0}}}},t(n)}catch(t){}return r},Vn=!Gn(function(t){Array.from(t)});Ce({target:"Array",stat:!0,forced:Vn},{from:Wn});var Yn=i,Xn=ye.includes,Jn=a(function(){return!Array(1).includes()});Ce({target:"Array",proto:!0,forced:Jn},{includes:function(t){return Xn(this,t,arguments.length>1?arguments[1]:void 0)}}),Qe("includes"),Ze("Array","includes");var Qn=Ct.f,Zn="Array Iterator",to=ne.set,eo=ne.getterFor(Zn),ro=Rn(Array,"Array",function(t,e){to(this,{type:Zn,target:k(t),index:0,kind:e})},function(){var t=eo(this),e=t.target,r=t.index++;if(!e||r>=e.length)return t.target=null,Pn(void 0,!0);switch(t.kind){case"keys":return Pn(r,!1);case"values":return Pn(e[r],!1)}return Pn([r,e[r]],!1)},"values"),no=un.Arguments=un.Array;if(Qe("keys"),Qe("values"),Qe("entries"),u&&"values"!==no.name)try{Qn(no,"name",{value:"values"})}catch(t){}cr||ie(Object.prototype,"toString",cr?{}.toString:function(){return"[object "+pr(this)+"]"},{unsafe:!0}),Ze("Array","values");var oo=Array,io=a(function(){function t(){}return!(oo.of.call(t)instanceof t)});Ce({target:"Array",stat:!0,forced:io},{of:function(){for(var t=0,e=arguments.length,r=new(Sr(this)?this:oo)(e);e>t;)Cn(r,t,arguments[t++]);return r.length=e,r}});var ao=dt("hasInstance"),uo=Function.prototype;ao in uo||Ct.f(uo,ao,{value:oe(function(t){if(!T(this)||!M(t))return!1;var e=this.prototype;return M(e)?U(e,t):t instanceof this},ao)}),dt("hasInstance");var so=function(t,e,r){return r.get&&oe(r.get,e,{getter:!0}),r.set&&oe(r.set,e,{setter:!0}),Ct.f(t,e,r)},co=zt.EXISTS,fo=Function.prototype,lo=b(fo.toString),ho=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,po=b(ho.exec);u&&!co&&so(fo,"name",{configurable:!0,get:function(){try{return po(ho,lo(this))[1]}catch(t){return""}}});var vo=b([].slice),go=Oe.f,yo="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],mo={f:function(t){return yo&&"Window"===E(t)?function(t){try{return go(t)}catch(t){return vo(yo)}}(t):go(k(t))}},bo=a(function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}}),wo=Object.isExtensible,So=a(function(){wo(1)})||bo?function(t){return!!M(t)&&(!bo||"ArrayBuffer"!==E(t))&&(!wo||wo(t))}:wo,Eo=!a(function(){return Object.isExtensible(Object.preventExtensions({}))}),Oo=e(function(t){var e=Ct.f,r=!1,n=lt("meta"),o=0,i=function(t){e(t,n,{value:{objectID:"O"+o++,weakData:{}}})},a=t.exports={enable:function(){a.enable=function(){},r=!0;var t=Oe.f,e=b([].splice),o={};o[n]=1,t(o).length&&(Oe.f=function(r){for(var o=t(r),i=0,a=o.length;ii;i++)if((u=y(t[i]))&&U(Po,u))return u;return new Ro(!1)}n=Dn(t,o)}for(s=h?t.next:n.next;!(c=f(s,n)).done;){try{u=y(c.value)}catch(t){Tn(n,"throw",t)}if("object"==typeof u&&u&&U(Po,u))return u}return new Ro(!1)},jo=TypeError,ko=function(t,e){if(U(e,t))return t;throw new jo("Incorrect invocation")},Io=function(t,e,r){var n,o;return dn&&T(n=e.constructor)&&n!==r&&M(o=n.prototype)&&o!==r.prototype&&dn(t,o),t},To=function(t,e,r){var n=-1!==t.indexOf("Map"),o=-1!==t.indexOf("Weak"),u=n?"set":"add",s=i[t],c=s&&s.prototype,f=s,l={},h=function(t){var e=b(c[t]);ie(c,t,"add"===t?function(t){return e(this,0===t?0:t),this}:"delete"===t?function(t){return!(o&&!M(t))&&e(this,0===t?0:t)}:"get"===t?function(t){return o&&!M(t)?void 0:e(this,0===t?0:t)}:"has"===t?function(t){return!(o&&!M(t))&&e(this,0===t?0:t)}:function(t,r){return e(this,0===t?0:t,r),this})};if(Ue(t,!T(s)||!(o||c.forEach&&!a(function(){(new s).entries().next()}))))f=r.getConstructor(e,t,n,u),Oo.enable();else if(Ue(t,!0)){var p=new f,v=p[u](o?{}:-0,1)!==p,d=a(function(){p.has(1)}),g=Gn(function(t){new s(t)}),y=!o&&a(function(){for(var t=new s,e=5;e--;)t[u](e,e);return!t.has(-0)});g||((f=e(function(t,e){ko(t,c);var r=Io(new s,t,f);return P(e)||Ao(e,r[u],{that:r,AS_ENTRIES:n}),r})).prototype=c,c.constructor=f),(d||y)&&(h("delete"),h("has"),n&&h("get")),(y||v)&&h(u),o&&c.clear&&delete c.clear}return l[t]=f,Ce({global:!0,constructor:!0,forced:f!==s},l),an(f,t),o||r.setStrong(f,t,n),f},Mo=function(t,e,r){for(var n in e)ie(t,n,e[n],r);return t},Lo=dt("species"),Uo=function(t){var e=L(t);u&&e&&!e[Lo]&&so(e,Lo,{configurable:!0,get:function(){return this}})},No=Oo.fastKey,Co=ne.set,_o=ne.getterFor,Fo={getConstructor:function(t,e,r,n){var o=t(function(t,o){ko(t,i),Co(t,{type:e,index:Ve(null),first:null,last:null,size:0}),u||(t.size=0),P(o)||Ao(o,t[n],{that:t,AS_ENTRIES:r})}),i=o.prototype,a=_o(e),s=function(t,e,r){var n,o,i=a(t),s=c(t,e);return s?s.value=r:(i.last=s={index:o=No(e,!0),key:e,value:r,previous:n=i.last,next:null,removed:!1},i.first||(i.first=s),n&&(n.next=s),u?i.size++:t.size++,"F"!==o&&(i.index[o]=s)),t},c=function(t,e){var r,n=a(t),o=No(e);if("F"!==o)return n.index[o];for(r=n.first;r;r=r.next)if(r.key===e)return r};return Mo(i,{clear:function(){for(var t=a(this),e=t.first;e;)e.removed=!0,e.previous&&(e.previous=e.previous.next=null),e=e.next;t.first=t.last=null,t.index=Ve(null),u?t.size=0:this.size=0},delete:function(t){var e=this,r=a(e),n=c(e,t);if(n){var o=n.next,i=n.previous;delete r.index[n.index],n.removed=!0,i&&(i.next=o),o&&(o.previous=i),r.first===n&&(r.first=o),r.last===n&&(r.last=i),u?r.size--:e.size--}return!!n},forEach:function(t){for(var e,r=a(this),n=ar(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:r.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!c(this,t)}}),Mo(i,r?{get:function(t){var e=c(this,t);return e&&e.value},set:function(t,e){return s(this,0===t?0:t,e)}}:{add:function(t){return s(this,t=0===t?0:t,t)}}),u&&so(i,"size",{configurable:!0,get:function(){return a(this).size}}),o},setStrong:function(t,e,r){var n=e+" Iterator",o=_o(e),i=_o(n);Rn(t,e,function(t,e){Co(this,{type:n,target:t,state:o(t),kind:e,last:null})},function(){for(var t=i(this),e=t.kind,r=t.last;r&&r.removed;)r=r.previous;return t.target&&(t.last=r=r?r.next:t.state.first)?Pn("keys"===e?r.key:"values"===e?r.value:[r.key,r.value],!1):(t.target=null,Pn(void 0,!0))},r?"entries":"values",!r,!0),Uo(e)}};To("Map",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},Fo);var Bo=Map.prototype,Do={Map:Map,set:b(Bo.set),get:b(Bo.get),has:b(Bo.has),remove:b(Bo.delete),proto:Bo},zo=Do.Map,Wo=Do.has,qo=Do.get,Ho=Do.set,$o=b([].push),Ko=a(function(){return 1!==zo.groupBy("ab",function(t){return t}).get("a").length});Ce({target:"Map",stat:!0,forced:Ko},{groupBy:function(t,e){j(t),J(e);var r=new zo,n=0;return Ao(t,function(t){var o=e(t,n++);Wo(r,o)?$o(qo(r,o),t):Ho(r,o,[t])}),r}});var Go={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Vo=Et("span").classList,Yo=Vo&&Vo.constructor&&Vo.constructor.prototype,Xo=Yo===Object.prototype?void 0:Yo,Jo=dt("iterator"),Qo=ro.values,Zo=function(t,e){if(t){if(t[Jo]!==Qo)try{_t(t,Jo,Qo)}catch(e){t[Jo]=Qo}if(an(t,e,!0),Go[e])for(var r in ro)if(t[r]!==ro[r])try{_t(t,r,ro[r])}catch(e){t[r]=ro[r]}}};for(var ti in Go)Zo(i[ti]&&i[ti].prototype,ti);Zo(Xo,"DOMTokenList");var ei=function(t,e,r){return function(n){var o=it(n),i=arguments.length,a=i>1?arguments[1]:void 0,u=void 0!==a,s=u?ar(a,i>2?arguments[2]:void 0):void 0,c=new t,f=0;return Ao(o,function(t){var n=u?s(t,f++):t;r?e(c,kt(n)[0],n[1]):e(c,n)}),c}};Ce({target:"Map",stat:!0,forced:!0},{from:ei(Do.Map,Do.set,!0)});var ri=function(t,e,r){return function(){for(var n=new t,o=arguments.length,i=0;i1?arguments[1]:void 0);return!1!==di(e,function(t,n){if(!r(t,n,e))return!1},!0)}});var gi=Do.Map,yi=Do.set;Ce({target:"Map",proto:!0,real:!0,forced:!0},{filter:function(t){var e=oi(this),r=ar(t,arguments.length>1?arguments[1]:void 0),n=new gi;return di(e,function(t,o){r(t,o,e)&&yi(n,o,t)}),n}}),Ce({target:"Map",proto:!0,real:!0,forced:!0},{find:function(t){var e=oi(this),r=ar(t,arguments.length>1?arguments[1]:void 0),n=di(e,function(t,n){if(r(t,n,e))return{value:t}},!0);return n&&n.value}}),Ce({target:"Map",proto:!0,real:!0,forced:!0},{findKey:function(t){var e=oi(this),r=ar(t,arguments.length>1?arguments[1]:void 0),n=di(e,function(t,n){if(r(t,n,e))return{key:n}},!0);return n&&n.key}}),Ce({target:"Map",proto:!0,real:!0,forced:!0},{includes:function(t){return!0===di(oi(this),function(e){if((r=e)===(n=t)||r!=r&&n!=n)return!0;var r,n},!0)}});var mi=Do.Map;Ce({target:"Map",stat:!0,forced:!0},{keyBy:function(t,e){var r=new(T(this)?this:mi);J(e);var n=J(r.set);return Ao(t,function(t){f(n,r,e(t),t)}),r}}),Ce({target:"Map",proto:!0,real:!0,forced:!0},{keyOf:function(t){var e=di(oi(this),function(e,r){if(e===t)return{key:r}},!0);return e&&e.key}});var bi=Do.Map,wi=Do.set;Ce({target:"Map",proto:!0,real:!0,forced:!0},{mapKeys:function(t){var e=oi(this),r=ar(t,arguments.length>1?arguments[1]:void 0),n=new bi;return di(e,function(t,o){wi(n,r(t,o,e),t)}),n}});var Si=Do.Map,Ei=Do.set;Ce({target:"Map",proto:!0,real:!0,forced:!0},{mapValues:function(t){var e=oi(this),r=ar(t,arguments.length>1?arguments[1]:void 0),n=new Si;return di(e,function(t,o){Ei(n,o,r(t,o,e))}),n}});var Oi=Do.set;Ce({target:"Map",proto:!0,real:!0,arity:1,forced:!0},{merge:function(t){for(var e=oi(this),r=arguments.length,n=0;n1?arguments[1]:void 0);return!0===di(e,function(t,n){if(r(t,n,e))return!0},!0)}});var Ri=TypeError,Pi=Do.get,Ai=Do.has,ji=Do.set;Ce({target:"Map",proto:!0,real:!0,forced:!0},{update:function(t,e){var r=oi(this),n=arguments.length;J(e);var o=Ai(r,t);if(!o&&n<3)throw new Ri("Updating absent value");var i=o?Pi(r,t):J(n>2?arguments[2]:void 0)(t,r);return ji(r,t,e(i,t,r)),r}});var ki=TypeError,Ii=function(t,e){var r,n=kt(this),o=J(n.get),i=J(n.has),a=J(n.set),u=arguments.length>2?arguments[2]:void 0;if(!T(e)&&!T(u))throw new ki("At least one callback required");return f(i,n,t)?(r=f(o,n,t),T(e)&&(r=e(r),f(a,n,t,r))):T(u)&&(r=u(),f(a,n,t,r)),r};Ce({target:"Map",proto:!0,real:!0,forced:!0},{upsert:Ii}),Ce({target:"Map",proto:!0,real:!0,name:"upsert",forced:!0},{updateOrInsert:Ii});var Ti=b(1..valueOf),Mi="\t\n\v\f\r                 \u2028\u2029\ufeff",Li=b("".replace),Ui=RegExp("^["+Mi+"]+"),Ni=RegExp("(^|[^"+Mi+"])["+Mi+"]+$"),Ci=function(t){return function(e){var r=Wr(j(e));return 1&t&&(r=Li(r,Ui,"")),2&t&&(r=Li(r,Ni,"$1")),r}},_i={start:Ci(1),end:Ci(2),trim:Ci(3)},Fi=Oe.f,Bi=Rt.f,Di=Ct.f,zi=_i.trim,Wi="Number",qi=i[Wi],Hi=qi.prototype,$i=i.TypeError,Ki=b("".slice),Gi=b("".charCodeAt),Vi=Ue(Wi,!qi(" 0o1")||!qi("0b1")||qi("+0x1")),Yi=function(t){var e,r=arguments.length<1?0:qi(function(t){var e=mt(t,"number");return"bigint"==typeof e?e:function(t){var e,r,n,o,i,a,u,s,c=mt(t,"number");if(G(c))throw new $i("Cannot convert a Symbol value to a number");if("string"==typeof c&&c.length>2)if(c=zi(c),43===(e=Gi(c,0))||45===e){if(88===(r=Gi(c,2))||120===r)return NaN}else if(48===e){switch(Gi(c,1)){case 66:case 98:n=2,o=49;break;case 79:case 111:n=8,o=55;break;default:return+c}for(a=(i=Ki(c,2)).length,u=0;uo)return NaN;return parseInt(i,n)}return+c}(e)}(t));return U(Hi,e=this)&&a(function(){Ti(e)})?Io(Object(r),this,Yi):r};Yi.prototype=Hi,Vi&&(Hi.constructor=Yi),Ce({global:!0,constructor:!0,wrap:!0,forced:Vi},{Number:Yi}),Vi&&function(t,e){for(var r,n=u?Fi(e):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),o=0;n.length>o;o++)ut(e,r=n[o])&&!ut(t,r)&&Di(t,r,Bi(e,r))}(Yn[Wi],qi),Ce({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{EPSILON:Math.pow(2,-52)});var Xi=i.isFinite;Ce({target:"Number",stat:!0},{isFinite:Number.isFinite||function(t){return"number"==typeof t&&Xi(t)}});var Ji=Math.floor,Qi=Number.isInteger||function(t){return!M(t)&&isFinite(t)&&Ji(t)===t};Ce({target:"Number",stat:!0},{isInteger:Qi}),Ce({target:"Number",stat:!0},{isNaN:function(t){return t!=t}});var Zi=Math.abs;Ce({target:"Number",stat:!0},{isSafeInteger:function(t){return Qi(t)&&Zi(t)<=9007199254740991}}),Ce({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{MAX_SAFE_INTEGER:9007199254740991}),Ce({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{MIN_SAFE_INTEGER:-9007199254740991});var ta=_i.trim,ea=b("".charAt),ra=i.parseFloat,na=i.Symbol,oa=na&&na.iterator,ia=1/ra(Mi+"-0")!=-Infinity||oa&&!a(function(){ra(Object(oa))})?function(t){var e=ta(Wr(t)),r=ra(e);return 0===r&&"-"===ea(e,0)?-0:r}:ra;Ce({target:"Number",stat:!0,forced:Number.parseFloat!==ia},{parseFloat:ia});var aa=_i.trim,ua=i.parseInt,sa=i.Symbol,ca=sa&&sa.iterator,fa=/^[+-]?0x/i,la=b(fa.exec),ha=8!==ua(Mi+"08")||22!==ua(Mi+"0x16")||ca&&!a(function(){ua(Object(ca))})?function(t,e){var r=aa(Wr(t));return ua(r,e>>>0||(la(fa,r)?16:10))}:ua;Ce({target:"Number",stat:!0,forced:Number.parseInt!==ha},{parseInt:ha});var pa=b(v.f),va=b([].push),da=u&&a(function(){var t=Object.create(null);return t[2]=2,!pa(t,2)}),ga=function(t){return function(e){for(var r,n=k(e),o=_e(n),i=da&&null===Qr(n),a=o.length,s=0,c=[];a>s;)r=o[s++],u&&!(i?r in n:pa(n,r))||va(c,t?[r,n[r]]:n[r]);return c}},ya={entries:ga(!0),values:ga(!1)},ma=ya.entries;Ce({target:"Object",stat:!0},{entries:function(t){return ma(t)}}),Ce({target:"Object",stat:!0,sham:!u},{getOwnPropertyDescriptors:function(t){for(var e,r,n=k(t),o=Rt.f,i=Pe(n),a={},u=0;i.length>u;)void 0!==(r=o(n,e=i[u++]))&&Cn(a,e,r);return a}});var ba=a(function(){_e(1)});Ce({target:"Object",stat:!0,forced:ba},{keys:function(t){return _e(it(t))}});var wa=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e};Ce({target:"Object",stat:!0},{is:wa});var Sa=ya.values;Ce({target:"Object",stat:!0},{values:function(t){return Sa(t)}}),Ce({target:"Object",stat:!0},{hasOwn:ut});var Ea=Function.prototype,Oa=Ea.apply,xa=Ea.call,Ra="object"==typeof Reflect&&Reflect.apply||(s?xa.bind(Oa):function(){return xa.apply(Oa,arguments)}),Pa=!a(function(){Reflect.apply(function(){})});Ce({target:"Reflect",stat:!0,forced:Pa},{apply:function(t,e,r){return Ra(J(t),e,kt(r))}});var Aa=Function,ja=b([].concat),ka=b([].join),Ia={},Ta=s?Aa.bind:function(t){var e=J(this),r=e.prototype,n=vo(arguments,1),o=function(){var r=ja(n,vo(arguments));return this instanceof o?function(t,e,r){if(!ut(Ia,e)){for(var n=[],o=0;ob)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$c")}),gs=Oe.f,ys=ne.enforce,ms=dt("match"),bs=i.RegExp,ws=bs.prototype,Ss=i.SyntaxError,Es=b(ws.exec),Os=b("".charAt),xs=b("".replace),Rs=b("".indexOf),Ps=b("".slice),As=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,js=/a/g,ks=/a/g,Is=new bs(js)!==js,Ts=cs.MISSED_STICKY,Ms=cs.UNSUPPORTED_Y,Ls=u&&(!Is||Ts||ps||ds||a(function(){return ks[ms]=!1,bs(js)!==js||bs(ks)===ks||"/a/i"!==String(bs(js,"i"))}));if(Ue("RegExp",Ls)){for(var Us=function(t,e){var r,n,o,i,a,u,s=U(ws,this),c=es(t),f=void 0===e,l=[],h=t;if(!s&&c&&f&&t.constructor===Us)return t;if((c||U(ws,t))&&(t=t.source,f&&(e=os(h))),t=void 0===t?"":Wr(t),e=void 0===e?"":Wr(e),h=t,ps&&"dotAll"in js&&(n=!!e&&Rs(e,"s")>-1)&&(e=xs(e,/s/g,"")),r=e,Ts&&"sticky"in js&&(o=!!e&&Rs(e,"y")>-1)&&Ms&&(e=xs(e,/y/g,"")),ds&&(i=function(t){for(var e,r=t.length,n=0,o="",i=[],a=Ve(null),u=!1,s=!1,c=0,f="";n<=r;n++){if("\\"===(e=Os(t,n)))e+=Os(t,++n);else if("]"===e)u=!1;else if(!u)switch(!0){case"["===e:u=!0;break;case"("===e:if(o+=e,"?:"===Ps(t,n+1,n+3))continue;Es(As,Ps(t,n+1))&&(n+=2,s=!0),c++;continue;case">"===e&&s:if(""===f||ut(a,f))throw new Ss("Invalid capture group name");a[f]=!0,i[i.length]=[f,c],s=!1,f="";continue}s?f+=e:o+=e}return[o,i]}(t),t=i[0],l=i[1]),a=Io(bs(t,e),s?this:ws,Us),(n||o||l.length)&&(u=ys(a),n&&(u.dotAll=!0,u.raw=Us(function(t){for(var e,r=t.length,n=0,o="",i=!1;n<=r;n++)"\\"!==(e=Os(t,n))?i||"."!==e?("["===e?i=!0:"]"===e&&(i=!1),o+=e):o+="[\\s\\S]":o+=e+Os(t,++n);return o}(t),r)),o&&(u.sticky=!0),l.length&&(u.groups=l)),t!==h)try{_t(a,"source",""===h?"(?:)":h)}catch(t){}return a},Ns=gs(bs),Cs=0;Ns.length>Cs;)ls(Us,bs,Ns[Cs++]);ws.constructor=Us,Us.prototype=ws,ie(i,"RegExp",Us,{constructor:!0})}Uo("RegExp");var _s=zt.PROPER,Fs="toString",Bs=RegExp.prototype,Ds=Bs[Fs];(a(function(){return"/a/b"!==Ds.call({source:"a",flags:"b"})})||_s&&Ds.name!==Fs)&&ie(Bs,Fs,function(){var t=kt(this);return"/"+Wr(t.source)+"/"+Wr(os(t))},{unsafe:!0});var zs=ne.get,Ws=RegExp.prototype,qs=TypeError;u&&ps&&so(Ws,"dotAll",{configurable:!0,get:function(){if(this!==Ws){if("RegExp"===E(this))return!!zs(this).dotAll;throw new qs("Incompatible receiver, RegExp required")}}});var Hs=ne.get,$s=nt("native-string-replace",String.prototype.replace),Ks=RegExp.prototype.exec,Gs=Ks,Vs=b("".charAt),Ys=b("".indexOf),Xs=b("".replace),Js=b("".slice),Qs=function(){var t=/a/,e=/b*/g;return f(Ks,t,"a"),f(Ks,e,"a"),0!==t.lastIndex||0!==e.lastIndex}(),Zs=cs.BROKEN_CARET,tc=void 0!==/()??/.exec("")[1];(Qs||tc||Zs||ps||ds)&&(Gs=function(t){var e,r,n,o,i,a,u,s=this,c=Hs(s),l=Wr(t),h=c.raw;if(h)return h.lastIndex=s.lastIndex,e=f(Gs,h,l),s.lastIndex=h.lastIndex,e;var p=c.groups,v=Zs&&s.sticky,d=f(rs,s),g=s.source,y=0,m=l;if(v&&(d=Xs(d,"y",""),-1===Ys(d,"g")&&(d+="g"),m=Js(l,s.lastIndex),s.lastIndex>0&&(!s.multiline||s.multiline&&"\n"!==Vs(l,s.lastIndex-1))&&(g="(?: "+g+")",m=" "+m,y++),r=new RegExp("^(?:"+g+")",d)),tc&&(r=new RegExp("^"+g+"$(?!\\s)",d)),Qs&&(n=s.lastIndex),o=f(Ks,v?r:s,m),v?o?(o.input=Js(o.input,y),o[0]=Js(o[0],y),o.index=s.lastIndex,s.lastIndex+=o[0].length):s.lastIndex=0:Qs&&o&&(s.lastIndex=s.global?o.index+o[0].length:n),tc&&o&&o.length>1&&f($s,o[0],r,function(){for(i=1;i]*>)/g,Oc=/\$([$&'`]|\d{1,2})/g,xc=function(t,e,r,n,o,i){var a=r+t.length,u=n.length,s=Oc;return void 0!==o&&(o=it(o),s=Ec),wc(i,s,function(i,s){var c;switch(bc(s,0)){case"$":return"$";case"&":return t;case"`":return Sc(e,0,r);case"'":return Sc(e,a);case"<":c=o[Sc(s,1,-1)];break;default:var f=+s;if(0===f)return i;if(f>u){var l=mc(f/10);return 0===l?i:l<=u?void 0===n[l-1]?bc(s,1):n[l-1]+bc(s,1):i}c=n[f-1]}return void 0===c?"":c})},Rc=dt("replace"),Pc=Math.max,Ac=Math.min,jc=b([].concat),kc=b([].push),Ic=b("".indexOf),Tc=b("".slice),Mc="$0"==="a".replace(/./,"$0"),Lc=!!/./[Rc]&&""===/./[Rc]("a","$0"),Uc=!a(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")});pc("replace",function(t,e,r){var n=Lc?"$":"$0";return[function(t,r){var n=j(this),o=P(t)?void 0:Q(t,Rc);return o?f(o,t,n,r):f(e,Wr(n),t,r)},function(t,o){var i=kt(this),a=Wr(t);if("string"==typeof o&&-1===Ic(o,n)&&-1===Ic(o,"$<")){var u=r(e,i,a,o);if(u.done)return u.value}var s=T(o);s||(o=Wr(o));var c,f=i.global;f&&(c=i.unicode,i.lastIndex=0);for(var l,h=[];null!==(l=yc(i,a))&&(kc(h,l),f);)""===Wr(l[0])&&(i.lastIndex=dc(a,ve(i.lastIndex),c));for(var p,v="",d=0,g=0;g=d&&(v+=Tc(a,d,b)+y,d=b+m.length)}return v+Tc(a,d)}]},!Uc||!Mc||Lc),pc("search",function(t,e,r){return[function(e){var r=j(this),n=P(e)?void 0:Q(e,t);return n?f(n,e,r):new RegExp(e)[t](Wr(r))},function(t){var n=kt(this),o=Wr(t),i=r(e,n,o);if(i.done)return i.value;var a=n.lastIndex;wa(a,0)||(n.lastIndex=0);var u=yc(n,o);return wa(n.lastIndex,a)||(n.lastIndex=a),null===u?-1:u.index}]});var Nc=dt("species"),Cc=function(t,e){var r,n=kt(t).constructor;return void 0===n||P(r=kt(n)[Nc])?e:La(r)},_c=cs.UNSUPPORTED_Y,Fc=Math.min,Bc=b([].push),Dc=b("".slice),zc=!a(function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var r="ab".split(t);return 2!==r.length||"a"!==r[0]||"b"!==r[1]}),Wc="c"==="abbc".split(/(b)*/)[1]||4!=="test".split(/(?:)/,-1).length||2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length;pc("split",function(t,e,r){var n="0".split(void 0,0).length?function(t,r){return void 0===t&&0===r?[]:f(e,this,t,r)}:e;return[function(e,r){var o=j(this),i=P(e)?void 0:Q(e,t);return i?f(i,e,o,r):f(n,Wr(o),e,r)},function(t,o){var i=kt(this),a=Wr(t);if(!Wc){var u=r(n,i,a,o,n!==e);if(u.done)return u.value}var s=Cc(i,RegExp),c=i.unicode,f=new s(_c?"^(?:"+i.source+")":i,(i.ignoreCase?"i":"")+(i.multiline?"m":"")+(i.unicode?"u":"")+(_c?"g":"y")),l=void 0===o?4294967295:o>>>0;if(0===l)return[];if(0===a.length)return null===yc(f,a)?[a]:[];for(var h=0,p=0,v=[];p0;(n>>>=1)&&(e+=e))1&n&&(r+=e);return r},Kc=b($c),Gc=b("".slice),Vc=Math.ceil,Yc=function(t){return function(e,r,n){var o,i,a=Wr(j(e)),u=ve(r),s=a.length,c=void 0===n?" ":Wr(n);return u<=s||""===c?a:((i=Kc(c,Vc((o=u-s)/c.length))).length>o&&(i=Gc(i,0,o)),t?a+i:i+a)}},Xc={start:Yc(!1),end:Yc(!0)},Jc=Xc.start,Qc=Array,Zc=RegExp.escape,tf=b("".charAt),ef=b("".charCodeAt),rf=b(1.1.toString),nf=b([].join),of=/^[0-9a-z]/i,af=/^[$()*+./?[\\\]^{|}]/,uf=RegExp("^[!\"#%&',\\-:;<=>@`~"+Mi+"]"),sf=b(of.exec),cf={"\t":"t","\n":"n","\v":"v","\f":"f","\r":"r"},ff=function(t){var e=rf(ef(t,0),16);return e.length<3?"\\x"+Jc(e,2,"0"):"\\u"+Jc(e,4,"0")},lf=!Zc||"\\x61b"!==Zc("ab");Ce({target:"RegExp",stat:!0,forced:lf},{escape:function(t){!function(t){if("string"==typeof t)return t;throw new qc("Argument is not a string")}(t);for(var e=t.length,r=Qc(e),n=0;n=56320||n+1>=e||56320!=(64512&ef(t,n+1))?r[n]=ff(o):(r[n]=o,r[++n]=tf(t,n))}}return nf(r,"")}}),To("Set",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},Fo);var hf=Set.prototype,pf={Set:Set,add:b(hf.add),has:b(hf.has),remove:b(hf.delete),proto:hf},vf=pf.has,df=function(t){return vf(t),t},gf=pf.Set,yf=pf.proto,mf=b(yf.forEach),bf=b(yf.keys),wf=bf(new gf).next,Sf=function(t,e,r){return r?ci({iterator:bf(t),next:wf},e):mf(t,e)},Ef=pf.Set,Of=pf.add,xf=function(t){var e=new Ef;return Sf(t,function(t){Of(e,t)}),e},Rf=ln(pf.proto,"size","get")||function(t){return t.size},Pf="Invalid size",Af=RangeError,jf=TypeError,kf=Math.max,If=function(t,e){this.set=t,this.size=kf(e,0),this.has=J(t.has),this.keys=J(t.keys)};If.prototype={getIterator:function(){return{iterator:t=kt(f(this.keys,this.set)),next:t.next,done:!1};var t},includes:function(t){return f(this.has,this.set,t)}};var Tf=function(t){kt(t);var e=+t.size;if(e!=e)throw new jf(Pf);var r=ce(e);if(r<0)throw new Af(Pf);return new If(t,r)},Mf=pf.has,Lf=pf.remove,Uf=function(t){var e=df(this),r=Tf(t),n=xf(e);return Rf(e)<=r.size?Sf(e,function(t){r.includes(t)&&Lf(n,t)}):ci(r.getIterator(),function(t){Mf(e,t)&&Lf(n,t)}),n},Nf=function(t){return{size:t,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},Cf=function(t){var e=L("Set");try{(new e)[t](Nf(0));try{return(new e)[t](Nf(-1)),!1}catch(t){return!0}}catch(t){return!1}};Ce({target:"Set",proto:!0,real:!0,forced:!Cf("difference")},{difference:Uf});var _f=pf.Set,Ff=pf.add,Bf=pf.has,Df=function(t){var e=df(this),r=Tf(t),n=new _f;return Rf(e)>r.size?ci(r.getIterator(),function(t){Bf(e,t)&&Ff(n,t)}):Sf(e,function(t){r.includes(t)&&Ff(n,t)}),n},zf=!Cf("intersection")||a(function(){return"3,2"!==String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))});Ce({target:"Set",proto:!0,real:!0,forced:zf},{intersection:Df});var Wf=pf.has,qf=function(t){var e=df(this),r=Tf(t);if(Rf(e)<=r.size)return!1!==Sf(e,function(t){if(r.includes(t))return!1},!0);var n=r.getIterator();return!1!==ci(n,function(t){if(Wf(e,t))return Tn(n,"normal",!1)})};Ce({target:"Set",proto:!0,real:!0,forced:!Cf("isDisjointFrom")},{isDisjointFrom:qf});var Hf=function(t){var e=df(this),r=Tf(t);return!(Rf(e)>r.size)&&!1!==Sf(e,function(t){if(!r.includes(t))return!1},!0)};Ce({target:"Set",proto:!0,real:!0,forced:!Cf("isSubsetOf")},{isSubsetOf:Hf});var $f=pf.has,Kf=function(t){var e=df(this),r=Tf(t);if(Rf(e)1?arguments[1]:void 0);return!1!==Sf(e,function(t){if(!r(t,t,e))return!1},!0)}});var el=dt("iterator"),rl=Object,nl=L("Set"),ol=function(t){return function(t){return M(t)&&"number"==typeof t.size&&T(t.has)&&T(t.keys)}(t)?t:function(t){if(P(t))return!1;var e=rl(t);return void 0!==e[el]||"@@iterator"in e||ut(un,pr(e))}(t)?new nl(t):t};Ce({target:"Set",proto:!0,real:!0,forced:!0},{difference:function(t){return f(Uf,this,ol(t))}});var il=pf.Set,al=pf.add;Ce({target:"Set",proto:!0,real:!0,forced:!0},{filter:function(t){var e=df(this),r=ar(t,arguments.length>1?arguments[1]:void 0),n=new il;return Sf(e,function(t){r(t,t,e)&&al(n,t)}),n}}),Ce({target:"Set",proto:!0,real:!0,forced:!0},{find:function(t){var e=df(this),r=ar(t,arguments.length>1?arguments[1]:void 0),n=Sf(e,function(t){if(r(t,t,e))return{value:t}},!0);return n&&n.value}}),Ce({target:"Set",proto:!0,real:!0,forced:!0},{intersection:function(t){return f(Df,this,ol(t))}}),Ce({target:"Set",proto:!0,real:!0,forced:!0},{isDisjointFrom:function(t){return f(qf,this,ol(t))}}),Ce({target:"Set",proto:!0,real:!0,forced:!0},{isSubsetOf:function(t){return f(Hf,this,ol(t))}}),Ce({target:"Set",proto:!0,real:!0,forced:!0},{isSupersetOf:function(t){return f(Kf,this,ol(t))}});var ul=b([].join),sl=b([].push);Ce({target:"Set",proto:!0,real:!0,forced:!0},{join:function(t){var e=df(this),r=void 0===t?",":Wr(t),n=[];return Sf(e,function(t){sl(n,t)}),ul(n,r)}});var cl=pf.Set,fl=pf.add;Ce({target:"Set",proto:!0,real:!0,forced:!0},{map:function(t){var e=df(this),r=ar(t,arguments.length>1?arguments[1]:void 0),n=new cl;return Sf(e,function(t){fl(n,r(t,t,e))}),n}});var ll=TypeError;Ce({target:"Set",proto:!0,real:!0,forced:!0},{reduce:function(t){var e=df(this),r=arguments.length<2,n=r?void 0:arguments[1];if(J(t),Sf(e,function(o){r?(r=!1,n=o):n=t(n,o,o,e)}),r)throw new ll("Reduce of empty set with no initial value");return n}}),Ce({target:"Set",proto:!0,real:!0,forced:!0},{some:function(t){var e=df(this),r=ar(t,arguments.length>1?arguments[1]:void 0);return!0===Sf(e,function(t){if(r(t,t,e))return!0},!0)}}),Ce({target:"Set",proto:!0,real:!0,forced:!0},{symmetricDifference:function(t){return f(Xf,this,ol(t))}}),Ce({target:"Set",proto:!0,real:!0,forced:!0},{union:function(t){return f(Qf,this,ol(t))}});var hl=dt("species"),pl=dt("isConcatSpreadable"),vl=W>=51||!a(function(){var t=[];return t[pl]=!1,t.concat()[0]!==t}),dl=function(t){if(!M(t))return!1;var e=t[pl];return void 0!==e?!!e:ur(t)},gl=!(vl&&(W>=51||!a(function(){var t=[];return(t.constructor={})[hl]=function(){return{foo:1}},1!==t.concat(Boolean).foo})));Ce({target:"Array",proto:!0,arity:1,forced:gl},{concat:function(t){var e,r,n,o,i,a=it(this),u=xr(a,0),s=0;for(e=-1,n=arguments.length;e1?arguments[1]:void 0,n=e.length,o=void 0===r?n:ip(ve(r),n),i=Wr(t);return op(e,o-i.length,o)===i}}),Ze("String","endsWith");var sp=RangeError,cp=String.fromCharCode,fp=String.fromCodePoint,lp=b([].join);Ce({target:"String",stat:!0,arity:1,forced:!!fp&&1!==fp.length},{fromCodePoint:function(t){for(var e,r=[],n=arguments.length,o=0;n>o;){if(e=+arguments[o++],he(e,1114111)!==e)throw new sp(e+" is not a valid code point");r[o]=e<65536?cp(e):cp(55296+((e-=65536)>>10),e%1024+56320)}return lp(r,"")}});var hp=b("".indexOf);Ce({target:"String",proto:!0,forced:!rp("includes")},{includes:function(t){return!!~hp(Wr(j(this)),Wr(tp(t)),arguments.length>1?arguments[1]:void 0)}}),Ze("String","includes"),b(un.String);var pp=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(_),vp=Xc.start;Ce({target:"String",proto:!0,forced:pp},{padStart:function(t){return vp(this,t,arguments.length>1?arguments[1]:void 0)}}),Ze("String","padStart");var dp=Xc.end;Ce({target:"String",proto:!0,forced:pp},{padEnd:function(t){return dp(this,t,arguments.length>1?arguments[1]:void 0)}}),Ze("String","padEnd");var gp=b([].push),yp=b([].join);Ce({target:"String",stat:!0},{raw:function(t){var e=k(it(t).raw),r=de(e);if(!r)return"";for(var n=arguments.length,o=[],i=0;;){if(gp(o,Wr(e[i++])),i===r)return yp(o,"");i1?arguments[1]:void 0,e.length)),n=Wr(t);return bp(e,r,r+n.length)===n}}),Ze("String","startsWith");var Op=zt.PROPER,xp=function(t){return a(function(){return!!Mi[t]()||"​…᠎"!=="​…᠎"[t]()||Op&&Mi[t].name!==t})},Rp=_i.start,Pp=xp("trimStart")?function(){return Rp(this)}:"".trimStart;Ce({target:"String",proto:!0,name:"trimStart",forced:"".trimLeft!==Pp},{trimLeft:Pp}),Ce({target:"String",proto:!0,name:"trimStart",forced:"".trimStart!==Pp},{trimStart:Pp}),Ze("String","trimLeft");var Ap=_i.end,jp=xp("trimEnd")?function(){return Ap(this)}:"".trimEnd;Ce({target:"String",proto:!0,name:"trimEnd",forced:"".trimRight!==jp},{trimRight:jp}),Ce({target:"String",proto:!0,name:"trimEnd",forced:"".trimEnd!==jp},{trimEnd:jp}),Ze("String","trimRight");var kp=Object.getOwnPropertyDescriptor,Ip=function(t){if(!u)return i[t];var e=kp(i,t);return e&&e.value},Tp=dt("iterator"),Mp=!a(function(){var t=new URL("b?a=1&b=2&c=3","https://a"),e=t.searchParams,r=new URLSearchParams("a=1&a=2&b=3"),n="";return t.pathname="c%20d",e.forEach(function(t,r){e.delete("b"),n+=r+t}),r.delete("a",2),r.delete("b",void 0),!e.size&&!u||!e.sort||"https://a/c%20d?a=1&c=3"!==t.href||"3"!==e.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!e[Tp]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==n||"x"!==new URL("https://x",void 0).host}),Lp=TypeError,Up=function(t,e){if(t0;)t[o]=t[--o];o!==i++&&(t[o]=n)}else for(var a=Np(r/2),u=Cp(vo(t,0,a),e),s=Cp(vo(t,a),e),c=u.length,f=s.length,l=0,h=0;l0&&0!=(t&r);r>>=1)e++;return e},pv=function(t){var e=null;switch(t.length){case 1:e=t[0];break;case 2:e=(31&t[0])<<6|63&t[1];break;case 3:e=(15&t[0])<<12|(63&t[1])<<6|63&t[2];break;case 4:e=(7&t[0])<<18|(63&t[1])<<12|(63&t[2])<<6|63&t[3]}return e>1114111?null:e},vv=function(t){for(var e=(t=nv(t,cv," ")).length,r="",n=0;ne){r+="%",n++;continue}var i=lv(t,n+1);if(i!=i){r+=o,n++;continue}n+=2;var a=hv(i);if(0===a)o=Jp(i);else{if(1===a||a>4){r+="�",n++;continue}for(var u=[i],s=1;se||"%"!==tv(t,n));){var c=lv(t,n+1);if(c!=c){n+=3;break}if(c>191||c<128)break;rv(u,c),n+=2,s++}if(u.length!==a){r+="�";continue}var f=pv(u);null===f?r+="�":o=Qp(f)}}r+=o,n++}return r},dv=/[!'()~]|%20/g,gv={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},yv=function(t){return gv[t]},mv=function(t){return nv(Xp(t),dv,yv)},bv=fn(function(t,e){zp(this,{type:Dp,target:Wp(t).entries,index:0,kind:e})},Bp,function(){var t=qp(this),e=t.target,r=t.index++;if(!e||r>=e.length)return t.target=null,Pn(void 0,!0);var n=e[r];switch(t.kind){case"keys":return Pn(n.key,!1);case"values":return Pn(n.value,!1)}return Pn([n.key,n.value],!1)},!0),wv=function(t){this.entries=[],this.url=null,void 0!==t&&(M(t)?this.parseObject(t):this.parseQuery("string"==typeof t?"?"===tv(t,0)?uv(t,1):t:Wr(t)))};wv.prototype={type:Bp,bindURL:function(t){this.url=t,this.update()},parseObject:function(t){var e,r,n,o,i,a,u,s=this.entries,c=Fn(t);if(c)for(r=(e=Dn(t,c)).next;!(n=f(r,e)).done;){if(o=Dn(kt(n.value)),(a=f(i=o.next,o)).done||(u=f(i,o)).done||!f(i,o).done)throw new Yp("Expected sequence with length 2");rv(s,{key:Wr(a.value),value:Wr(u.value)})}else for(var l in t)ut(t,l)&&rv(s,{key:l,value:Wr(t[l])})},parseQuery:function(t){if(t)for(var e,r,n=this.entries,o=av(t,"&"),i=0;i0?arguments[0]:void 0));u||(this.size=t.entries.length)},Ev=Sv.prototype;if(Mo(Ev,{append:function(t,e){var r=Wp(this);Up(arguments.length,2),rv(r.entries,{key:Wr(t),value:Wr(e)}),u||this.length++,r.updateURL()},delete:function(t){for(var e=Wp(this),r=Up(arguments.length,1),n=e.entries,o=Wr(t),i=r<2?void 0:arguments[1],a=void 0===i?i:Wr(i),s=0;se.key?1:-1}),t.updateURL()},forEach:function(t){for(var e,r=Wp(this).entries,n=ar(t,arguments.length>1?arguments[1]:void 0),o=0;o1?Rv(arguments[1]):{})}}),T($p)){var Pv=function(t){return ko(this,Gp),new $p(t,arguments.length>1?Rv(arguments[1]):{})};Gp.constructor=Pv,Pv.prototype=Gp,Ce({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Pv})}}var Av={URLSearchParams:Sv,getState:Wp},jv=URLSearchParams,kv=jv.prototype,Iv=b(kv.append),Tv=b(kv.delete),Mv=b(kv.forEach),Lv=b([].push),Uv=new jv("a=1&a=2&b=3");Uv.delete("a",1),Uv.delete("b",void 0),Uv+""!="a=2"&&ie(kv,"delete",function(t){var e=arguments.length,r=e<2?void 0:arguments[1];if(e&&void 0===r)return Tv(this,t);var n=[];Mv(this,function(t,e){Lv(n,{key:e,value:t})}),Up(e,1);for(var o,i=Wr(t),a=Wr(r),u=0,s=0,c=!1,f=n.length;uo;)for(var s,c=R(arguments[o++]),l=i?$v(_e(c),i(c)):_e(c),h=l.length,p=0;h>p;)s=l[p++],u&&!f(a,c,s)||(r[s]=c[s]);return r}:qv,Gv=2147483647,Vv=/[^\0-\u007E]/,Yv=/[.\u3002\uFF0E\uFF61]/g,Xv="Overflow: input needs wider integers to process",Jv=RangeError,Qv=b(Yv.exec),Zv=Math.floor,td=String.fromCharCode,ed=b("".charCodeAt),rd=b([].join),nd=b([].push),od=b("".replace),id=b("".split),ad=b("".toLowerCase),ud=function(t){return t+22+75*(t<26)},sd=function(t,e,r){var n=0;for(t=r?Zv(t/700):t>>1,t+=Zv(t/e);t>455;)t=Zv(t/35),n+=36;return Zv(n+36*t/(t+38))},cd=function(t){var e=[];t=function(t){for(var e=[],r=0,n=t.length;r=55296&&o<=56319&&r=i&&nZv((Gv-a)/l))throw new Jv(Xv);for(a+=(f-i)*l,i=f,r=0;rGv)throw new Jv(Xv);if(n===i){for(var h=a,p=36;;){var v=p<=u?1:p>=u+26?26:p-u;if(h?@[\\\]^|]/,qd=/[\0\t\n\r #/:<>?@[\\\]^|]/,Hd=/^[\u0000-\u0020]+/,$d=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,Kd=/[\t\n\r]/g,Gd=function(t){var e,r,n,o;if("number"==typeof t){for(e=[],r=0;r<4;r++)Td(e,t%256),t=md(t/256);return Ed(e,".")}if("object"==typeof t){for(e="",n=function(t){for(var e=null,r=1,n=null,o=0,i=0;i<8;i++)0!==t[i]?(o>r&&(e=n,r=o),n=null,o=0):(null===n&&(n=i),++o);return o>r?n:e}(t),r=0;r<8;r++)o&&0===t[r]||(o&&(o=!1),n===r?(e+=r?":":"::",o=!0):(e+=Od(t[r],16),r<7&&(e+=":")));return"["+e+"]"}return t},Vd={},Yd=Kv({},Vd,{" ":1,'"':1,"<":1,">":1,"`":1}),Xd=Kv({},Yd,{"#":1,"?":1,"{":1,"}":1}),Jd=Kv({},Xd,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Qd=function(t,e){var r=fd(t,0);return r>32&&r<127&&!ut(e,t)?t:encodeURIComponent(t)},Zd={ftp:21,file:null,http:80,https:443,ws:80,wss:443},tg=function(t,e){var r;return 2===t.length&&Sd(Nd,wd(t,0))&&(":"===(r=wd(t,1))||!e&&"|"===r)},eg=function(t){var e;return t.length>1&&tg(kd(t,0,2))&&(2===t.length||"/"===(e=wd(t,2))||"\\"===e||"?"===e||"#"===e)},rg=function(t){return"."===t||"%2e"===Id(t)},ng={},og={},ig={},ag={},ug={},sg={},cg={},fg={},lg={},hg={},pg={},vg={},dg={},gg={},yg={},mg={},bg={},wg={},Sg={},Eg={},Og={},xg=function(t,e,r){var n,o,i,a=Wr(t);if(e){if(o=this.parse(a))throw new gd(o);this.searchParams=null}else{if(void 0!==r&&(n=new xg(r,!0)),o=this.parse(a,null,n))throw new gd(o);(i=vd(new pd)).bindURL(this),this.searchParams=i}};xg.prototype={type:"URL",parse:function(t,e,r){var n,o,i,a,u,s=this,c=e||ng,f=0,l="",h=!1,p=!1,v=!1;for(t=Wr(t),e||(s.scheme="",s.username="",s.password="",s.host=null,s.port=null,s.path=[],s.query=null,s.fragment=null,s.cannotBeABaseURL=!1,t=Pd(t,Hd,""),t=Pd(t,$d,"$1")),t=Pd(t,Kd,""),n=Wn(t);f<=n.length;){switch(o=n[f],c){case ng:if(!o||!Sd(Nd,o)){if(e)return Md;c=ig;continue}l+=Id(o),c=og;break;case og:if(o&&(Sd(Cd,o)||"+"===o||"-"===o||"."===o))l+=Id(o);else{if(":"!==o){if(e)return Md;l="",c=ig,f=0;continue}if(e&&(s.isSpecial()!==ut(Zd,l)||"file"===l&&(s.includesCredentials()||null!==s.port)||"file"===s.scheme&&!s.host))return;if(s.scheme=l,e)return void(s.isSpecial()&&Zd[s.scheme]===s.port&&(s.port=null));l="","file"===s.scheme?c=gg:s.isSpecial()&&r&&r.scheme===s.scheme?c=ag:s.isSpecial()?c=fg:"/"===n[f+1]?(c=ug,f++):(s.cannotBeABaseURL=!0,Rd(s.path,""),c=Sg)}break;case ig:if(!r||r.cannotBeABaseURL&&"#"!==o)return Md;if(r.cannotBeABaseURL&&"#"===o){s.scheme=r.scheme,s.path=vo(r.path),s.query=r.query,s.fragment="",s.cannotBeABaseURL=!0,c=Og;break}c="file"===r.scheme?gg:sg;continue;case ag:if("/"!==o||"/"!==n[f+1]){c=sg;continue}c=lg,f++;break;case ug:if("/"===o){c=hg;break}c=wg;continue;case sg:if(s.scheme=r.scheme,o===Wv)s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=vo(r.path),s.query=r.query;else if("/"===o||"\\"===o&&s.isSpecial())c=cg;else if("?"===o)s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=vo(r.path),s.query="",c=Eg;else{if("#"!==o){s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=vo(r.path),s.path.length--,c=wg;continue}s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=vo(r.path),s.query=r.query,s.fragment="",c=Og}break;case cg:if(!s.isSpecial()||"/"!==o&&"\\"!==o){if("/"!==o){s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,c=wg;continue}c=hg}else c=lg;break;case fg:if(c=lg,"/"!==o||"/"!==wd(l,f+1))continue;f++;break;case lg:if("/"!==o&&"\\"!==o){c=hg;continue}break;case hg:if("@"===o){h&&(l="%40"+l),h=!0,i=Wn(l);for(var d=0;d65535)return Ud;s.port=s.isSpecial()&&m===Zd[s.scheme]?null:m,l=""}if(e)return;c=bg;continue}return Ud}l+=o;break;case gg:if(s.scheme="file","/"===o||"\\"===o)c=yg;else{if(!r||"file"!==r.scheme){c=wg;continue}switch(o){case Wv:s.host=r.host,s.path=vo(r.path),s.query=r.query;break;case"?":s.host=r.host,s.path=vo(r.path),s.query="",c=Eg;break;case"#":s.host=r.host,s.path=vo(r.path),s.query=r.query,s.fragment="",c=Og;break;default:eg(Ed(vo(n,f),""))||(s.host=r.host,s.path=vo(r.path),s.shortenPath()),c=wg;continue}}break;case yg:if("/"===o||"\\"===o){c=mg;break}r&&"file"===r.scheme&&!eg(Ed(vo(n,f),""))&&(tg(r.path[0],!0)?Rd(s.path,r.path[0]):s.host=r.host),c=wg;continue;case mg:if(o===Wv||"/"===o||"\\"===o||"?"===o||"#"===o){if(!e&&tg(l))c=wg;else if(""===l){if(s.host="",e)return;c=bg}else{if(a=s.parseHost(l))return a;if("localhost"===s.host&&(s.host=""),e)return;l="",c=bg}continue}l+=o;break;case bg:if(s.isSpecial()){if(c=wg,"/"!==o&&"\\"!==o)continue}else if(e||"?"!==o)if(e||"#"!==o){if(o!==Wv&&(c=wg,"/"!==o))continue}else s.fragment="",c=Og;else s.query="",c=Eg;break;case wg:if(o===Wv||"/"===o||"\\"===o&&s.isSpecial()||!e&&("?"===o||"#"===o)){if(".."===(u=Id(u=l))||"%2e."===u||".%2e"===u||"%2e%2e"===u?(s.shortenPath(),"/"===o||"\\"===o&&s.isSpecial()||Rd(s.path,"")):rg(l)?"/"===o||"\\"===o&&s.isSpecial()||Rd(s.path,""):("file"===s.scheme&&!s.path.length&&tg(l)&&(s.host&&(s.host=""),l=wd(l,0)+":"),Rd(s.path,l)),l="","file"===s.scheme&&(o===Wv||"?"===o||"#"===o))for(;s.path.length>1&&""===s.path[0];)Ad(s.path);"?"===o?(s.query="",c=Eg):"#"===o&&(s.fragment="",c=Og)}else l+=Qd(o,Xd);break;case Sg:"?"===o?(s.query="",c=Eg):"#"===o?(s.fragment="",c=Og):o!==Wv&&(s.path[0]+=Qd(o,Vd));break;case Eg:e||"#"!==o?o!==Wv&&("'"===o&&s.isSpecial()?s.query+="%27":s.query+="#"===o?"%23":Qd(o,Vd)):(s.fragment="",c=Og);break;case Og:o!==Wv&&(s.fragment+=Qd(o,Yd))}f++}},parseHost:function(t){var e,r,n;if("["===wd(t,0)){if("]"!==wd(t,t.length-1))return Ld;if(e=function(t){var e,r,n,o,i,a,u,s=[0,0,0,0,0,0,0,0],c=0,f=null,l=0,h=function(){return wd(t,l)};if(":"===h()){if(":"!==wd(t,1))return;l+=2,f=++c}for(;h();){if(8===c)return;if(":"!==h()){for(e=r=0;r<4&&Sd(zd,h());)e=16*e+yd(h(),16),l++,r++;if("."===h()){if(0===r)return;if(l-=r,c>6)return;for(n=0;h();){if(o=null,n>0){if(!("."===h()&&n<4))return;l++}if(!Sd(_d,h()))return;for(;Sd(_d,h());){if(i=yd(h(),10),null===o)o=i;else{if(0===o)return;o=10*o+i}if(o>255)return;l++}s[c]=256*s[c]+o,2!=++n&&4!==n||c++}if(4!==n)return;break}if(":"===h()){if(l++,!h())return}else if(h())return;s[c++]=e}else{if(null!==f)return;l++,f=++c}}if(null!==f)for(a=c-f,c=7;0!==c&&a>0;)u=s[c],s[c--]=s[f+a-1],s[f+--a]=u;else if(8!==c)return;return s}(kd(t,1,-1)),!e)return Ld;this.host=e}else if(this.isSpecial()){if(t=function(t){var e,r,n=[],o=id(od(ad(t),Yv,"."),".");for(e=0;e4)return t;for(r=[],n=0;n1&&"0"===wd(o,0)&&(i=Sd(Fd,o)?16:8,o=kd(o,8===i?1:2)),""===o)a=0;else{if(!Sd(10===i?Dd:8===i?Bd:zd,o))return t;a=yd(o,i)}Rd(r,a)}for(n=0;n=bd(256,5-e))return null}else if(a>255)return null;for(u=xd(r),n=0;n1?arguments[1]:void 0,n=ld(e,new xg(t,!1,r));u||(e.href=n.serialize(),e.origin=n.getOrigin(),e.protocol=n.getProtocol(),e.username=n.getUsername(),e.password=n.getPassword(),e.host=n.getHost(),e.hostname=n.getHostname(),e.port=n.getPort(),e.pathname=n.getPathname(),e.search=n.getSearch(),e.searchParams=n.getSearchParams(),e.hash=n.getHash())},Pg=Rg.prototype,Ag=function(t,e){return{get:function(){return hd(this)[t]()},set:e&&function(t){return hd(this)[e](t)},configurable:!0,enumerable:!0}};if(u&&(so(Pg,"href",Ag("serialize","setHref")),so(Pg,"origin",Ag("getOrigin")),so(Pg,"protocol",Ag("getProtocol","setProtocol")),so(Pg,"username",Ag("getUsername","setUsername")),so(Pg,"password",Ag("getPassword","setPassword")),so(Pg,"host",Ag("getHost","setHost")),so(Pg,"hostname",Ag("getHostname","setHostname")),so(Pg,"port",Ag("getPort","setPort")),so(Pg,"pathname",Ag("getPathname","setPathname")),so(Pg,"search",Ag("getSearch","setSearch")),so(Pg,"searchParams",Ag("getSearchParams")),so(Pg,"hash",Ag("getHash","setHash"))),ie(Pg,"toJSON",function(){return hd(this).serialize()},{enumerable:!0}),ie(Pg,"toString",function(){return hd(this).serialize()},{enumerable:!0}),dd){var jg=dd.createObjectURL,kg=dd.revokeObjectURL;jg&&ie(Rg,"createObjectURL",ar(jg,dd)),kg&&ie(Rg,"revokeObjectURL",ar(kg,dd))}an(Rg,"URL"),Ce({global:!0,constructor:!0,forced:!Mp,sham:!u},{URL:Rg});var Ig=L("URL"),Tg=Mp&&a(function(){Ig.canParse()}),Mg=a(function(){return 1!==Ig.canParse.length});Ce({target:"URL",stat:!0,forced:!Tg||Mg},{canParse:function(t){var e=Up(arguments.length,1),r=Wr(t),n=e<2||void 0===arguments[1]?void 0:Wr(arguments[1]);try{return!!new Ig(r,n)}catch(t){return!1}}});var Lg=L("URL");Ce({target:"URL",stat:!0,forced:!Mp},{parse:function(t){var e=Up(arguments.length,1),r=Wr(t),n=e<2||void 0===arguments[1]?void 0:Wr(arguments[1]);try{return new Lg(r,n)}catch(t){return null}}}),Ce({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return f(URL.prototype.toString,this)}});var Ug=WeakMap.prototype,Ng={WeakMap:WeakMap,set:b(Ug.set),get:b(Ug.get),has:b(Ug.has),remove:b(Ug.delete)},Cg=Ng.has,_g=function(t){return Cg(t),t},Fg=Ng.get,Bg=Ng.has,Dg=Ng.set;Ce({target:"WeakMap",proto:!0,real:!0,forced:!0},{emplace:function(t,e){var r,n,o=_g(this);return Bg(o,t)?(r=Fg(o,t),"update"in e&&(r=e.update(r,t,o),Dg(o,t,r)),r):(n=e.insert(t,o),Dg(o,t,n),n)}}),Ce({target:"WeakMap",stat:!0,forced:!0},{from:ei(Ng.WeakMap,Ng.set,!0)}),Ce({target:"WeakMap",stat:!0,forced:!0},{of:ri(Ng.WeakMap,Ng.set,!0)});var zg=Ng.remove;Ce({target:"WeakMap",proto:!0,real:!0,forced:!0},{deleteAll:function(){for(var t,e=_g(this),r=!0,n=0,o=arguments.length;n2&&(n=r,M(o=arguments[2])&&"cause"in o&&_t(n,"cause",o.cause));var s=[];return Ao(t,ny,{that:s}),_t(r,"errors",s),r};dn?dn(oy,ry):Ae(oy,ry,{name:!0});var iy=oy.prototype=Ve(ry.prototype,{constructor:d(1,oy),message:d(1,""),name:d(1,"AggregateError")});Ce({global:!0,constructor:!0,arity:2},{AggregateError:oy});var ay,uy,sy,cy,fy=function(t){return _.slice(0,t.length)===t},ly=fy("Bun/")?"BUN":fy("Cloudflare-Workers")?"CLOUDFLARE":fy("Deno/")?"DENO":fy("Node.js/")?"NODE":i.Bun&&"string"==typeof Bun.version?"BUN":i.Deno&&"object"==typeof Deno.version?"DENO":"process"===E(i.process)?"NODE":i.window&&i.document?"BROWSER":"REST",hy="NODE"===ly,py=/(?:ipad|iphone|ipod).*applewebkit/i.test(_),vy=i.setImmediate,dy=i.clearImmediate,gy=i.process,yy=i.Dispatch,my=i.Function,by=i.MessageChannel,wy=i.String,Sy=0,Ey={},Oy="onreadystatechange";a(function(){ay=i.location});var xy=function(t){if(ut(Ey,t)){var e=Ey[t];delete Ey[t],e()}},Ry=function(t){return function(){xy(t)}},Py=function(t){xy(t.data)},Ay=function(t){i.postMessage(wy(t),ay.protocol+"//"+ay.host)};vy&&dy||(vy=function(t){Up(arguments.length,1);var e=T(t)?t:my(t),r=vo(arguments,1);return Ey[++Sy]=function(){Ra(e,void 0,r)},uy(Sy),Sy},dy=function(t){delete Ey[t]},hy?uy=function(t){gy.nextTick(Ry(t))}:yy&&yy.now?uy=function(t){yy.now(Ry(t))}:by&&!py?(cy=(sy=new by).port2,sy.port1.onmessage=Py,uy=ar(cy.postMessage,cy)):i.addEventListener&&T(i.postMessage)&&!i.importScripts&&ay&&"file:"!==ay.protocol&&!a(Ay)?(uy=Ay,i.addEventListener("message",Py,!1)):uy=Oy in Et("script")?function(t){De.appendChild(Et("script"))[Oy]=function(){De.removeChild(this),xy(t)}}:function(t){setTimeout(Ry(t),0)});var jy={set:vy,clear:dy},ky=function(){this.head=null,this.tail=null};ky.prototype={add:function(t){var e={item:t,next:null},r=this.tail;r?r.next=e:this.head=e,this.tail=e},get:function(){var t=this.head;if(t)return null===(this.head=t.next)&&(this.tail=null),t.item}};var Iy,Ty,My,Ly,Uy,Ny=ky,Cy=/ipad|iphone|ipod/i.test(_)&&"undefined"!=typeof Pebble,_y=/web0s(?!.*chrome)/i.test(_),Fy=jy.set,By=i.MutationObserver||i.WebKitMutationObserver,Dy=i.document,zy=i.process,Wy=i.Promise,qy=Ip("queueMicrotask");if(!qy){var Hy=new Ny,$y=function(){var t,e;for(hy&&(t=zy.domain)&&t.exit();e=Hy.get();)try{e()}catch(t){throw Hy.head&&Iy(),t}t&&t.enter()};py||hy||_y||!By||!Dy?!Cy&&Wy&&Wy.resolve?((Ly=Wy.resolve(void 0)).constructor=Wy,Uy=ar(Ly.then,Ly),Iy=function(){Uy($y)}):hy?Iy=function(){zy.nextTick($y)}:(Fy=ar(Fy,i),Iy=function(){Fy($y)}):(Ty=!0,My=Dy.createTextNode(""),new By($y).observe(My,{characterData:!0}),Iy=function(){My.data=Ty=!Ty}),qy=function(t){Hy.head||Iy(),Hy.add(t)}}var Ky,Gy,Vy,Yy=qy,Xy=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},Jy=i.Promise,Qy=dt("species"),Zy=!1,tm=T(i.PromiseRejectionEvent),em=Ue("Promise",function(){var t=Kt(Jy),e=t!==String(Jy);if(!e&&66===W)return!0;if(!W||W<51||!/native code/.test(t)){var r=new Jy(function(t){t(1)}),n=function(t){t(function(){},function(){})};if((r.constructor={})[Qy]=n,!(Zy=r.then(function(){})instanceof n))return!0}return!(e||"BROWSER"!==ly&&"DENO"!==ly||tm)}),rm={CONSTRUCTOR:em,REJECTION_EVENT:tm,SUBCLASSING:Zy},nm=TypeError,om=function(t){var e,r;this.promise=new t(function(t,n){if(void 0!==e||void 0!==r)throw new nm("Bad Promise constructor");e=t,r=n}),this.resolve=J(e),this.reject=J(r)},im={f:function(t){return new om(t)}},am=jy.set,um="Promise",sm=rm.CONSTRUCTOR,cm=rm.REJECTION_EVENT,fm=rm.SUBCLASSING,lm=ne.getterFor(um),hm=ne.set,pm=Jy&&Jy.prototype,vm=Jy,dm=pm,gm=i.TypeError,ym=i.document,mm=i.process,bm=im.f,wm=bm,Sm=!!(ym&&ym.createEvent&&i.dispatchEvent),Em="unhandledrejection",Om=function(t){var e;return!(!M(t)||!T(e=t.then))&&e},xm=function(t,e){var r,n,o,i=e.value,a=1===e.state,u=a?t.ok:t.fail,s=t.resolve,c=t.reject,l=t.domain;try{u?(a||(2===e.rejection&&km(e),e.rejection=1),!0===u?r=i:(l&&l.enter(),r=u(i),l&&(l.exit(),o=!0)),r===t.promise?c(new gm("Promise-chain cycle")):(n=Om(r))?f(n,r,s,c):s(r)):c(i)}catch(t){l&&!o&&l.exit(),c(t)}},Rm=function(t,e){t.notified||(t.notified=!0,Yy(function(){for(var r,n=t.reactions;r=n.get();)xm(r,t);t.notified=!1,e&&!t.rejection&&Am(t)}))},Pm=function(t,e,r){var n,o;Sm?((n=ym.createEvent("Event")).promise=e,n.reason=r,n.initEvent(t,!1,!0),i.dispatchEvent(n)):n={promise:e,reason:r},!cm&&(o=i["on"+t])?o(n):t===Em&&function(t,e){try{1===arguments.length?console.error(t):console.error(t,e)}catch(t){}}("Unhandled promise rejection",r)},Am=function(t){f(am,i,function(){var e,r=t.facade,n=t.value;if(jm(t)&&(e=Xy(function(){hy?mm.emit("unhandledRejection",n,r):Pm(Em,r,n)}),t.rejection=hy||jm(t)?2:1,e.error))throw e.value})},jm=function(t){return 1!==t.rejection&&!t.parent},km=function(t){f(am,i,function(){var e=t.facade;hy?mm.emit("rejectionHandled",e):Pm("rejectionhandled",e,t.value)})},Im=function(t,e,r){return function(n){t(e,n,r)}},Tm=function(t,e,r){t.done||(t.done=!0,r&&(t=r),t.value=e,t.state=2,Rm(t,!0))},Mm=function(t,e,r){if(!t.done){t.done=!0,r&&(t=r);try{if(t.facade===e)throw new gm("Promise can't be resolved itself");var n=Om(e);n?Yy(function(){var r={done:!1};try{f(n,e,Im(Mm,r,t),Im(Tm,r,t))}catch(e){Tm(r,e,t)}}):(t.value=e,t.state=1,Rm(t,!1))}catch(e){Tm({done:!1},e,t)}}};if(sm&&(vm=function(t){ko(this,dm),J(t),f(Ky,this);var e=lm(this);try{t(Im(Mm,e),Im(Tm,e))}catch(t){Tm(e,t)}},(Ky=function(t){hm(this,{type:um,done:!1,notified:!1,parent:!1,reactions:new Ny,rejection:!1,state:0,value:null})}).prototype=ie(dm=vm.prototype,"then",function(t,e){var r=lm(this),n=bm(Cc(this,vm));return r.parent=!0,n.ok=!T(t)||t,n.fail=T(e)&&e,n.domain=hy?mm.domain:void 0,0===r.state?r.reactions.add(n):Yy(function(){xm(n,r)}),n.promise}),Gy=function(){var t=new Ky,e=lm(t);this.promise=t,this.resolve=Im(Mm,e),this.reject=Im(Tm,e)},im.f=bm=function(t){return t===vm||void 0===t?new Gy(t):wm(t)},T(Jy)&&pm!==Object.prototype)){Vy=pm.then,fm||ie(pm,"then",function(t,e){var r=this;return new vm(function(t,e){f(Vy,r,t,e)}).then(t,e)},{unsafe:!0});try{delete pm.constructor}catch(t){}dn&&dn(pm,dm)}Ce({global:!0,constructor:!0,wrap:!0,forced:sm},{Promise:vm}),an(vm,um,!1),Uo(um);var Lm=rm.CONSTRUCTOR||!Gn(function(t){Jy.all(t).then(void 0,function(){})});Ce({target:"Promise",stat:!0,forced:Lm},{all:function(t){var e=this,r=im.f(e),n=r.resolve,o=r.reject,i=Xy(function(){var r=J(e.resolve),i=[],a=0,u=1;Ao(t,function(t){var s=a++,c=!1;u++,f(r,e,t).then(function(t){c||(c=!0,i[s]=t,--u||n(i))},o)}),--u||n(i)});return i.error&&o(i.value),r.promise}});var Um=Jy&&Jy.prototype;if(Ce({target:"Promise",proto:!0,forced:rm.CONSTRUCTOR,real:!0},{catch:function(t){return this.then(void 0,t)}}),T(Jy)){var Nm=L("Promise").prototype.catch;Um.catch!==Nm&&ie(Um,"catch",Nm,{unsafe:!0})}Ce({target:"Promise",stat:!0,forced:Lm},{race:function(t){var e=this,r=im.f(e),n=r.reject,o=Xy(function(){var o=J(e.resolve);Ao(t,function(t){f(o,e,t).then(r.resolve,n)})});return o.error&&n(o.value),r.promise}}),Ce({target:"Promise",stat:!0,forced:rm.CONSTRUCTOR},{reject:function(t){var e=im.f(this);return(0,e.reject)(t),e.promise}});var Cm=function(t,e){if(kt(t),M(e)&&e.constructor===t)return e;var r=im.f(t);return(0,r.resolve)(e),r.promise};Ce({target:"Promise",stat:!0,forced:rm.CONSTRUCTOR},{resolve:function(t){return Cm(this,t)}}),Ce({target:"Promise",stat:!0,forced:Lm},{allSettled:function(t){var e=this,r=im.f(e),n=r.resolve,o=r.reject,i=Xy(function(){var r=J(e.resolve),o=[],i=0,a=1;Ao(t,function(t){var u=i++,s=!1;a++,f(r,e,t).then(function(t){s||(s=!0,o[u]={status:"fulfilled",value:t},--a||n(o))},function(t){s||(s=!0,o[u]={status:"rejected",reason:t},--a||n(o))})}),--a||n(o)});return i.error&&o(i.value),r.promise}});var _m="No one promise resolved";Ce({target:"Promise",stat:!0,forced:Lm},{any:function(t){var e=this,r=L("AggregateError"),n=im.f(e),o=n.resolve,i=n.reject,a=Xy(function(){var n=J(e.resolve),a=[],u=0,s=1,c=!1;Ao(t,function(t){var l=u++,h=!1;s++,f(n,e,t).then(function(t){h||c||(c=!0,o(t))},function(t){h||c||(h=!0,a[l]=t,--s||i(new r(a,_m)))})}),--s||i(new r(a,_m))});return a.error&&i(a.value),n.promise}}),Ce({target:"Promise",stat:!0},{withResolvers:function(){var t=im.f(this);return{promise:t.promise,resolve:t.resolve,reject:t.reject}}});var Fm=Jy&&Jy.prototype,Bm=!!Jy&&a(function(){Fm.finally.call({then:function(){}},function(){})});if(Ce({target:"Promise",proto:!0,real:!0,forced:Bm},{finally:function(t){var e=Cc(this,L("Promise")),r=T(t);return this.then(r?function(r){return Cm(e,t()).then(function(){return r})}:t,r?function(r){return Cm(e,t()).then(function(){throw r})}:t)}}),T(Jy)){var Dm=L("Promise").prototype.finally;Fm.finally!==Dm&&ie(Fm,"finally",Dm,{unsafe:!0})}var zm=i.Promise,Wm=!1,qm=!zm||!zm.try||Xy(function(){zm.try(function(t){Wm=8===t},8)}).error||!Wm;Ce({target:"Promise",stat:!0,forced:qm},{try:function(t){var e=arguments.length>1?vo(arguments,1):[],r=im.f(this),n=Xy(function(){return Ra(J(t),void 0,e)});return(n.error?r.reject:r.resolve)(n.value),r.promise}}),Ze("Promise","finally");var Hm="URLSearchParams"in self,$m="Symbol"in self&&"iterator"in Symbol,Km="FileReader"in self&&"Blob"in self&&function(){try{return new Blob,!0}catch(t){return!1}}(),Gm="FormData"in self,Vm="ArrayBuffer"in self;if(Vm)var Ym=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],Xm=ArrayBuffer.isView||function(t){return t&&Ym.indexOf(Object.prototype.toString.call(t))>-1};function Jm(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function Qm(t){return"string"!=typeof t&&(t=String(t)),t}function Zm(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return $m&&(e[Symbol.iterator]=function(){return e}),e}function tb(t){this.map={},t instanceof tb?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function eb(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function rb(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function nb(t){var e=new FileReader,r=rb(e);return e.readAsArrayBuffer(t),r}function ob(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function ib(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:Km&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:Gm&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:Hm&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():Vm&&Km&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=ob(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):Vm&&(ArrayBuffer.prototype.isPrototypeOf(t)||Xm(t))?this._bodyArrayBuffer=ob(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):Hm&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},Km&&(this.blob=function(){var t=eb(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?eb(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(nb)}),this.text=function(){var t=eb(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,r=rb(e);return e.readAsText(t),r}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n-1?e:t}(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function sb(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e}function cb(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new tb(e.headers),this.url=e.url||"",this._initBody(t)}ub.prototype.clone=function(){return new ub(this,{body:this._bodyInit})},ib.call(ub.prototype),ib.call(cb.prototype),cb.prototype.clone=function(){return new cb(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new tb(this.headers),url:this.url})},cb.error=function(){var t=new cb(null,{status:0,statusText:""});return t.type="error",t};var fb=[301,302,303,307,308];cb.redirect=function(t,e){if(-1===fb.indexOf(e))throw new RangeError("Invalid status code");return new cb(null,{status:e,headers:{location:t}})};var lb=self.DOMException;try{new lb}catch(t){(lb=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack}).prototype=Object.create(Error.prototype),lb.prototype.constructor=lb}function hb(t,e){return new Promise(function(r,n){var o=new ub(t,e);if(o.signal&&o.signal.aborted)return n(new lb("Aborted","AbortError"));var i=new XMLHttpRequest;function a(){i.abort()}i.onload=function(){var t,e,n={status:i.status,statusText:i.statusText,headers:(t=i.getAllResponseHeaders()||"",e=new tb,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}}),e)};n.url="responseURL"in i?i.responseURL:n.headers.get("X-Request-URL"),r(new cb("response"in i?i.response:i.responseText,n))},i.onerror=function(){n(new TypeError("Network request failed"))},i.ontimeout=function(){n(new TypeError("Network request failed"))},i.onabort=function(){n(new lb("Aborted","AbortError"))},i.open(o.method,o.url,!0),"include"===o.credentials?i.withCredentials=!0:"omit"===o.credentials&&(i.withCredentials=!1),"responseType"in i&&Km&&(i.responseType="blob"),o.headers.forEach(function(t,e){i.setRequestHeader(e,t)}),o.signal&&(o.signal.addEventListener("abort",a),i.onreadystatechange=function(){4===i.readyState&&o.signal.removeEventListener("abort",a)}),i.send(void 0===o._bodyInit?null:o._bodyInit)})}hb.polyfill=!0,self.fetch||(self.fetch=hb,self.Headers=tb,self.Request=ub,self.Response=cb);var pb=Object.getOwnPropertySymbols,vb=Object.prototype.hasOwnProperty,db=Object.prototype.propertyIsEnumerable,gb=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(t){n[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,n,o=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),i=1;i{"use strict";var e={},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var a=t[o]={id:o,loaded:!1,exports:{}},i=!0;try{e[o].call(a.exports,a,a.exports,r),i=!1}finally{i&&delete t[o]}return a.loaded=!0,a.exports}r.m=e,r.amdD=function(){throw Error("define cannot be used indirect")},r.amdO={},(()=>{var e=[];r.O=(t,o,n,a)=>{if(o){a=a||0;for(var i=e.length;i>0&&e[i-1][2]>a;i--)e[i]=e[i-1];e[i]=[o,n,a];return}for(var d=1/0,i=0;i=a)&&Object.keys(r.O).every(e=>r.O[e](o[c]))?o.splice(c--,1):(u=!1,a{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},(()=>{var e,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;r.t=function(o,n){if(1&n&&(o=this(o)),8&n||"object"==typeof o&&o&&(4&n&&o.__esModule||16&n&&"function"==typeof o.then))return o;var a=Object.create(null);r.r(a);var i={};e=e||[null,t({}),t([]),t(t)];for(var d=2&n&&o;"object"==typeof d&&!~e.indexOf(d);d=t(d))Object.getOwnPropertyNames(d).forEach(e=>i[e]=()=>o[e]);return i.default=()=>o,r.d(a,i),a}})(),r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((t,o)=>(r.f[o](e,t),t),[])),r.u=e=>"static/chunks/"+(694===e?"compute":e)+"."+({139:"8d54880d25bc452f",178:"c399c7425cacc4ec",199:"9b66732a108fbca1",405:"19edef85d9a977c9",481:"6d33ebcca51aa184",534:"8ac9c9b001e41ba4",646:"c2c67a3e35c59670",694:"d10654f9aa3589b1",808:"846f0159cc232e21",987:"0c5b0a0d50e19d04"})[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={},t="_N_E:";r.l=(o,n,a,i)=>{if(e[o])return void e[o].push(n);if(void 0!==a)for(var d,u,c=document.getElementsByTagName("script"),l=0;l{d.onerror=d.onload=null,clearTimeout(p);var n=e[o];if(delete e[o],d.parentNode&&d.parentNode.removeChild(d),n&&n.forEach(e=>e(r)),t)return t(r)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:d}),12e4);d.onerror=s.bind(null,d.onerror),d.onload=s.bind(null,d.onload),u&&document.head.appendChild(d)}})(),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:e=>e},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("nextjs#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="/_next/",(()=>{r.b=document.baseURI||self.location.href;var e={68:0,978:0};r.f.j=(t,o)=>{var n=r.o(e,t)?e[t]:void 0;if(0!==n)if(n)o.push(n[2]);else if(/^(6|97)8$/.test(t))e[t]=0;else{var a=new Promise((r,o)=>n=e[t]=[r,o]);o.push(n[2]=a);var i=r.p+r.u(t),d=Error();r.l(i,o=>{if(r.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=o&&("load"===o.type?"missing":o.type),i=o&&o.target&&o.target.src;d.message="Loading chunk "+t+" failed.\n("+a+": "+i+")",d.name="ChunkLoadError",d.type=a,d.request=i,n[1](d)}},"chunk-"+t,t)}},r.O.j=t=>0===e[t];var t=(t,o)=>{var n,a,[i,d,u]=o,c=0;if(i.some(t=>0!==e[t])){for(n in d)r.o(d,n)&&(r.m[n]=d[n]);if(u)var l=u(r)}for(t&&t(o);c:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}.gap-x-3{column-gap:calc(var(--spacing)*3)}.gap-x-4{column-gap:calc(var(--spacing)*4)}.gap-y-1{row-gap:calc(var(--spacing)*1)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-clinical-800>:not(:last-child)){border-color:var(--color-clinical-800)}.truncate{text-overflow:ellipsis;white-space:nowrap}.overflow-hidden,.truncate{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e+38px}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-clinical-500{border-color:var(--color-clinical-500)}.border-clinical-600{border-color:var(--color-clinical-600)}.border-clinical-700{border-color:var(--color-clinical-700)}.border-clinical-800{border-color:var(--color-clinical-800)}.border-signal-ai{border-color:var(--color-signal-ai)}.border-signal-ai\/30{border-color:#a877f04d}@supports (color:color-mix(in lab,red,red)){.border-signal-ai\/30{border-color:color-mix(in oklab,var(--color-signal-ai)30%,transparent)}}.border-signal-ai\/40{border-color:#a877f066}@supports (color:color-mix(in lab,red,red)){.border-signal-ai\/40{border-color:color-mix(in oklab,var(--color-signal-ai)40%,transparent)}}.border-signal-ai\/50{border-color:#a877f080}@supports (color:color-mix(in lab,red,red)){.border-signal-ai\/50{border-color:color-mix(in oklab,var(--color-signal-ai)50%,transparent)}}.border-signal-info{border-color:var(--color-signal-info)}.border-signal-uncertain\/50{border-color:#e8c34a80}@supports (color:color-mix(in lab,red,red)){.border-signal-uncertain\/50{border-color:color-mix(in oklab,var(--color-signal-uncertain)50%,transparent)}}.border-signal-uncertain\/60{border-color:#e8c34a99}@supports (color:color-mix(in lab,red,red)){.border-signal-uncertain\/60{border-color:color-mix(in oklab,var(--color-signal-uncertain)60%,transparent)}}.border-l-signal-info{border-left-color:var(--color-signal-info)}.border-l-transparent{border-left-color:#0000}.bg-black{background-color:var(--color-black)}.bg-clinical-500{background-color:var(--color-clinical-500)}.bg-clinical-600{background-color:var(--color-clinical-600)}.bg-clinical-700{background-color:var(--color-clinical-700)}.bg-clinical-750{background-color:var(--color-clinical-750)}.bg-clinical-800{background-color:var(--color-clinical-800)}.bg-clinical-850{background-color:var(--color-clinical-850)}.bg-clinical-900{background-color:var(--color-clinical-900)}.bg-clinical-900\/80{background-color:#080b12cc}@supports (color:color-mix(in lab,red,red)){.bg-clinical-900\/80{background-color:color-mix(in oklab,var(--color-clinical-900)80%,transparent)}}.bg-signal-ai\/15{background-color:#a877f026}@supports (color:color-mix(in lab,red,red)){.bg-signal-ai\/15{background-color:color-mix(in oklab,var(--color-signal-ai)15%,transparent)}}.bg-signal-concern{background-color:var(--color-signal-concern)}.bg-signal-info{background-color:var(--color-signal-info)}.bg-signal-info\/20{background-color:#4d94ff33}@supports (color:color-mix(in lab,red,red)){.bg-signal-info\/20{background-color:color-mix(in oklab,var(--color-signal-info)20%,transparent)}}.bg-signal-stable{background-color:var(--color-signal-stable)}.bg-signal-uncertain{background-color:var(--color-signal-uncertain)}.bg-signal-uncertain\/10{background-color:#e8c34a1a}@supports (color:color-mix(in lab,red,red)){.bg-signal-uncertain\/10{background-color:color-mix(in oklab,var(--color-signal-uncertain)10%,transparent)}}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.pt-0\.5{padding-top:calc(var(--spacing)*.5)}.pt-2{padding-top:calc(var(--spacing)*2)}.pr-1{padding-right:calc(var(--spacing)*1)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pl-1{padding-left:calc(var(--spacing)*1)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-3{padding-left:calc(var(--spacing)*3)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.2em\]{--tw-tracking:.2em;letter-spacing:.2em}.tracking-\[0\.15em\]{--tw-tracking:.15em;letter-spacing:.15em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.whitespace-nowrap{white-space:nowrap}.text-clinical-700{color:var(--color-clinical-700)}.text-clinical-dim{color:var(--color-clinical-dim)}.text-clinical-muted{color:var(--color-clinical-muted)}.text-clinical-text{color:var(--color-clinical-text)}.text-signal-ai{color:var(--color-signal-ai)}.text-signal-change{color:var(--color-signal-change)}.text-signal-concern{color:var(--color-signal-concern)}.text-signal-info{color:var(--color-signal-info)}.text-signal-stable{color:var(--color-signal-stable)}.text-signal-uncertain{color:var(--color-signal-uncertain)}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.line-through{text-decoration-line:line-through}.decoration-clinical-500\/60{text-decoration-color:#3b475999}@supports (color:color-mix(in lab,red,red)){.decoration-clinical-500\/60{-webkit-text-decoration-color:color-mix(in oklab,var(--color-clinical-500)60%,transparent);text-decoration-color:color-mix(in oklab,var(--color-clinical-500)60%,transparent)}}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.accent-signal-info{accent-color:var(--color-signal-info)}.opacity-40{opacity:.4}.opacity-70{opacity:.7}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a)}.ring,.shadow-xl{box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.invert{--tw-invert:invert(100%)}.filter,.invert{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.placeholder\:text-clinical-dim::placeholder{color:var(--color-clinical-dim)}@media (hover:hover){.hover\:border-clinical-500:hover{border-color:var(--color-clinical-500)}.hover\:border-signal-ai\/60:hover{border-color:#a877f099}@supports (color:color-mix(in lab,red,red)){.hover\:border-signal-ai\/60:hover{border-color:color-mix(in oklab,var(--color-signal-ai)60%,transparent)}}.hover\:border-signal-info\/60:hover{border-color:#4d94ff99}@supports (color:color-mix(in lab,red,red)){.hover\:border-signal-info\/60:hover{border-color:color-mix(in oklab,var(--color-signal-info)60%,transparent)}}.hover\:bg-clinical-800:hover{background-color:var(--color-clinical-800)}.hover\:bg-signal-ai\/15:hover{background-color:#a877f026}@supports (color:color-mix(in lab,red,red)){.hover\:bg-signal-ai\/15:hover{background-color:color-mix(in oklab,var(--color-signal-ai)15%,transparent)}}.hover\:text-clinical-muted:hover{color:var(--color-clinical-muted)}.hover\:text-clinical-text:hover{color:var(--color-clinical-text)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}}body,html{height:100%}body{background-color:var(--color-clinical-900);color:var(--color-clinical-text);font-feature-settings:"tnum" 1;-webkit-font-smoothing:antialiased}.measurement{font-family:var(--font-mono);font-variant-numeric:tabular-nums}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background:var(--color-clinical-850)}::-webkit-scrollbar-thumb{background:var(--color-clinical-600);border-radius:5px}::-webkit-scrollbar-thumb:hover{background:var(--color-clinical-500)}:focus-visible{outline:2px solid var(--color-signal-info);outline-offset:1px}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false} \ No newline at end of file diff --git a/api/ai-observations/041c2146-8e58-4c2d-b5dd-6c888ff2447e.json b/api/ai-observations/041c2146-8e58-4c2d-b5dd-6c888ff2447e.json new file mode 100644 index 0000000000000000000000000000000000000000..8ef17badd0a7353e0c11c847f8e8f0ae31ce5a1e --- /dev/null +++ b/api/ai-observations/041c2146-8e58-4c2d-b5dd-6c888ff2447e.json @@ -0,0 +1 @@ +[{"answer_text":"No measured enhancing volume changed by more than 25%. 1 lesion had no prior to compare against: L02 measures 3.8 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:41.587603Z","evidence_items":[{"id":"19575ae2-8456-44c7-a91b-d4ea14e7a390","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"d928425b-f596-49a3-b4b5-068ef58d0af8","observation_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","study_id":"94d8c40b-022d-40bd-a1ab-3af52f7a4287","volume_cm3":0.0},"target_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","target_table":"lesion_observations"},{"id":"1f72d474-4982-4e36-b91d-b15b02a66dfe","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"d928425b-f596-49a3-b4b5-068ef58d0af8","observation_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","study_id":"94d8c40b-022d-40bd-a1ab-3af52f7a4287"},"target_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","target_table":"lesion_observations"}],"id":"ebba5b6c-6ae8-469e-b137-5713c5248419","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3.json b/api/ai-observations/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3.json new file mode 100644 index 0000000000000000000000000000000000000000..323742f71bb9e60175e3378627fc3d2ff4835fc6 --- /dev/null +++ b/api/ai-observations/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3.json @@ -0,0 +1 @@ +[{"answer_text":"No measured enhancing volume changed by more than 25%. 2 lesions had no prior to compare against: L03 measures 21.0 mm\u00b3 (first measurement, no prior to compare); L04 measures 0.0 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:43.607499Z","evidence_items":[{"id":"2c87c1cf-2511-448f-8678-4bf0c2b2de7c","kind":"MEASUREMENT","label":"L03 volume 0.02 cm\u00b3 at recurrence","locator":{"lesion_id":"e9d82174-9b6b-4619-966c-74169ed6903e","observation_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7","volume_cm3":0.02},"target_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","target_table":"lesion_observations"},{"id":"4f2df9b6-cb59-43ef-95da-2fad66592364","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"e9d82174-9b6b-4619-966c-74169ed6903e","observation_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7"},"target_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","target_table":"lesion_observations"},{"id":"28ea33eb-c6c4-44e3-bb38-f272dfbe7c0f","kind":"MEASUREMENT","label":"L04 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"093413a8-d6a7-4c3e-b162-beb55610f174","observation_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7","volume_cm3":0.0},"target_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","target_table":"lesion_observations"},{"id":"7f81d150-3fb1-49c5-a9cd-efa40b6d944a","kind":"SEGMENTATION","label":"Segmented enhancing for L04","locator":{"lesion_id":"093413a8-d6a7-4c3e-b162-beb55610f174","observation_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7"},"target_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","target_table":"lesion_observations"}],"id":"092c8132-435d-4a08-87d7-27b2cacb4b5a","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/0a1ba0ca-23d8-46ed-9974-f86a08bf7027.json b/api/ai-observations/0a1ba0ca-23d8-46ed-9974-f86a08bf7027.json new file mode 100644 index 0000000000000000000000000000000000000000..d19642b9dfb51b2498549a1203a85be0ece14818 --- /dev/null +++ b/api/ai-observations/0a1ba0ca-23d8-46ed-9974-f86a08bf7027.json @@ -0,0 +1 @@ +[{"answer_text":"No lesion was measured within 25% of its previous enhancing volume at recurrence. All 1 lesion with a measured change moved by more than that: L01 measures 14.0 mm\u00b3, increased by 67.5% (5.7 mm\u00b3). Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:45.482904Z","evidence_items":[{"id":"2c1497ea-2a9a-47e4-84e4-45d7403b2eec","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935","volume_cm3":0.01},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"2d7ca551-9c94-4f4c-8ab9-b3a3b67438d3","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935"},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"}],"id":"d9fe8998-3ad5-49d1-8804-5b02ee0a44b0","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_REMAINED_STABLE","question_text":"What remained stable?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest total measured enhancing volume change was recorded at recurrence, 5.7 mm\u00b3 summed across 1 lesion, 161 days after the study it is compared with. Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:45.430947Z","evidence_items":[{"id":"004b5bd0-5b11-4f89-8655-0d94eba4fa77","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935","volume_cm3":0.01},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"c5d7ada0-0cc6-4552-9506-4310ce7f6c55","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935"},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"}],"id":"9290b492-75ea-49f8-9b8b-32472cd8f478","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest measured enhancing volume change is L01 measures 14.0 mm\u00b3, increased by 67.5% (5.7 mm\u00b3) at recurrence, compared against preoperative. This is the largest of 1 measured change across the timeline. Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:45.384462Z","evidence_items":[{"id":"05bd46b2-ed91-4d77-a761-861e51ebfd63","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935","volume_cm3":0.01},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"973a2f4e-8a92-42f4-8b4b-8e2d8e4e336a","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935"},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"e3d10849-12bc-4726-a301-c64fd7c2f3ec","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","timepoint":"preoperative"},"target_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","target_table":"studies"}],"id":"8ddfa5ed-2d0a-4cc6-8d33-10aa1bc3847f","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"Measured enhancing volume changed by more than 25% for 1 lesion between preoperative and recurrence, 161 days apart: L01 measures 14.0 mm\u00b3, increased by 67.5% (5.7 mm\u00b3). Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:45.338471Z","evidence_items":[{"id":"a5499bdc-7971-4701-b379-0d1fdc32b577","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935","volume_cm3":0.01},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"915f85a6-d917-4c9b-966e-4b78d8f1d11d","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935"},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"0ad43409-5f07-441c-85bc-3b5c40df4bf7","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","timepoint":"preoperative"},"target_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","target_table":"studies"}],"id":"52d7a659-7632-4100-ab96-5f8658f0f0b5","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/0e36f014-cba2-4b67-a60a-d5c720f13384.json b/api/ai-observations/0e36f014-cba2-4b67-a60a-d5c720f13384.json new file mode 100644 index 0000000000000000000000000000000000000000..dc7dd0b4c1584d308e311f5b167ed8031fc3f59d --- /dev/null +++ b/api/ai-observations/0e36f014-cba2-4b67-a60a-d5c720f13384.json @@ -0,0 +1 @@ +[{"answer_text":"No lesion was measured within 25% of its previous enhancing volume at recurrence. All 1 lesion with a measured change moved by more than that: L01 measures 0.5 mm\u00b3, decreased by 93.7% (8.1 mm\u00b3). Confidence 0.80; the interval between the two examinations is not recorded, the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.587570Z","evidence_items":[{"id":"98b72c13-4bc4-4710-926e-0cb62e732f6b","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.0},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"482f4bd1-6263-43a7-91bc-f44c5e5bbb0b","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"}],"id":"1b0d0185-0cac-4fbf-96cd-0cc125b86baa","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_REMAINED_STABLE","question_text":"What remained stable?","safety_notes":["quality flag on input: NO_INTERVAL","quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest total measured enhancing volume change was recorded at recurrence, 8.1 mm\u00b3 summed across 1 lesion, 710 days after the study it is compared with. Confidence 0.80; the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.532672Z","evidence_items":[{"id":"fe9b0913-2a76-4b11-b58a-cd712e6126f3","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.0},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"794691c7-8e44-468f-9a59-6be5e7c8defb","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"}],"id":"3c93a13b-6db8-42cc-806a-4bbb3f79eed2","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest measured enhancing volume change is L01 measures 0.5 mm\u00b3, decreased by 93.7% (8.1 mm\u00b3) at recurrence, compared against preoperative. This is the largest of 1 measured change across the timeline. Confidence 0.80; the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.482637Z","evidence_items":[{"id":"b276fe1b-1f4c-4344-9fd3-05c904c75062","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.0},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"8c99cb0f-a58d-440d-8994-ad74754e97d2","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"8913dea0-125d-4432-ba83-fee93d12487a","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","timepoint":"preoperative"},"target_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","target_table":"studies"}],"id":"d7524d0a-c660-490c-bce0-5a0f02c837a9","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"Measured enhancing volume changed by more than 25% for 1 lesion between preoperative and recurrence, 710 days apart: L01 measures 0.5 mm\u00b3, decreased by 93.7% (8.1 mm\u00b3). 1 lesion had no prior to compare against: L02 measures 35.2 mm\u00b3 (first measurement, no prior to compare). Confidence 0.80; the interval between the two examinations is not recorded, the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.434897Z","evidence_items":[{"id":"21682d27-cbde-4f5a-a102-c8967c21f21c","kind":"MEASUREMENT","label":"L02 volume 0.04 cm\u00b3 at recurrence","locator":{"lesion_id":"a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831","observation_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.04},"target_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","target_table":"lesion_observations"},{"id":"ebb6a2c6-c812-4091-ae6a-c39d51793cfb","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831","observation_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","target_table":"lesion_observations"},{"id":"2260c1df-e052-499f-94dd-b7feb4ecde9c","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.0},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"cf645c46-88a0-4bca-8617-ccab37686ddb","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"00facdb2-b018-4a32-affc-42981238f4c0","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","timepoint":"preoperative"},"target_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","target_table":"studies"}],"id":"2c3f3d22-bf2c-4124-916e-694aff08a14b","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/1644cc40-79e6-47bf-a4e4-51c8248a7ad9.json b/api/ai-observations/1644cc40-79e6-47bf-a4e4-51c8248a7ad9.json new file mode 100644 index 0000000000000000000000000000000000000000..e7198343ed03d02cf45a1aad6b6f5220d7db2698 --- /dev/null +++ b/api/ai-observations/1644cc40-79e6-47bf-a4e4-51c8248a7ad9.json @@ -0,0 +1 @@ +[{"answer_text":"No measured enhancing volume changed by more than 25%. 2 lesions had no prior to compare against: L02 measures 5.4 mm\u00b3 (first measurement, no prior to compare); L03 measures 0.4 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:40.038524Z","evidence_items":[{"id":"c7062b9e-1906-4310-92a7-1b2af5384c89","kind":"MEASUREMENT","label":"L02 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b","observation_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84","volume_cm3":0.01},"target_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","target_table":"lesion_observations"},{"id":"70873a60-8f1b-47bf-9055-173d4b65113f","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b","observation_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84"},"target_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","target_table":"lesion_observations"},{"id":"d4986659-135d-49ca-b792-8bbe6888dcc1","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f","observation_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84","volume_cm3":0.0},"target_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","target_table":"lesion_observations"},{"id":"f178f0ac-86dc-4b5d-a234-0f5df2e8e15e","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f","observation_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84"},"target_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","target_table":"lesion_observations"}],"id":"e6285085-d5c3-4260-96c4-632feaec248b","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/2043be8c-57f4-4845-88d0-cadadd106f19.json b/api/ai-observations/2043be8c-57f4-4845-88d0-cadadd106f19.json new file mode 100644 index 0000000000000000000000000000000000000000..ec895c3ebc87a34b82b15fd80a8a3b7ecbb05be7 --- /dev/null +++ b/api/ai-observations/2043be8c-57f4-4845-88d0-cadadd106f19.json @@ -0,0 +1 @@ +[{"answer_text":"No measured enhancing volume changed by more than 25%. 1 lesion had no prior to compare against: L03 measures 0.7 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:41.339914Z","evidence_items":[{"id":"5c0c1b7e-cbc0-454a-9568-e7b5422352e6","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"03a303d7-5935-4d2a-ba9f-9d3fd3e2e710","observation_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","study_id":"b4d0c863-a94f-4cb7-8c20-0544dadd2b55","volume_cm3":0.0},"target_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","target_table":"lesion_observations"},{"id":"d9ce64fd-35e8-4362-b09c-c23e3749462d","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"03a303d7-5935-4d2a-ba9f-9d3fd3e2e710","observation_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","study_id":"b4d0c863-a94f-4cb7-8c20-0544dadd2b55"},"target_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","target_table":"lesion_observations"}],"id":"e06689d6-2033-4efd-9e4f-4e3e589feeb0","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/2166fc98-aac6-45a6-855a-bad61c98e806.json b/api/ai-observations/2166fc98-aac6-45a6-855a-bad61c98e806.json new file mode 100644 index 0000000000000000000000000000000000000000..eecae6c7d7298b63718a8366e5ae5ad22564584c --- /dev/null +++ b/api/ai-observations/2166fc98-aac6-45a6-855a-bad61c98e806.json @@ -0,0 +1 @@ +[{"answer_text":"No lesion was measured within 25% of its previous enhancing volume at recurrence. All 1 lesion with a measured change moved by more than that: L02 measures 0.1 mm\u00b3, decreased by 72.8% (0.3 mm\u00b3). Confidence 0.80; the interval between the two examinations is not recorded, the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:45.974768Z","evidence_items":[{"id":"284d444a-24c3-4ff0-bc31-e68e5f67c365","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"9e47ef3f-ccc3-4b81-820a-cd83535c52d3","observation_id":"318f13bf-4ec3-4083-9c46-b639d1b5c978","study_id":"77bec26e-b844-4e0b-9769-3887372c01a0","volume_cm3":0.0},"target_id":"318f13bf-4ec3-4083-9c46-b639d1b5c978","target_table":"lesion_observations"},{"id":"4911489b-7c0d-4d8d-834e-98f29139fa31","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"9e47ef3f-ccc3-4b81-820a-cd83535c52d3","observation_id":"318f13bf-4ec3-4083-9c46-b639d1b5c978","study_id":"77bec26e-b844-4e0b-9769-3887372c01a0"},"target_id":"318f13bf-4ec3-4083-9c46-b639d1b5c978","target_table":"lesion_observations"}],"id":"080b7f52-50a9-4ca6-b062-7875abb9bc11","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_REMAINED_STABLE","question_text":"What remained stable?","safety_notes":["quality flag on input: NO_INTERVAL","quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest total measured enhancing volume change was recorded at recurrence, 0.3 mm\u00b3 summed across 1 lesion, 475 days after the study it is compared with. Confidence 0.80; the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:45.909180Z","evidence_items":[{"id":"b609dd02-6f03-45a6-bef5-fa7b8871e3e4","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"9e47ef3f-ccc3-4b81-820a-cd83535c52d3","observation_id":"318f13bf-4ec3-4083-9c46-b639d1b5c978","study_id":"77bec26e-b844-4e0b-9769-3887372c01a0","volume_cm3":0.0},"target_id":"318f13bf-4ec3-4083-9c46-b639d1b5c978","target_table":"lesion_observations"},{"id":"dc3a31c7-b3d2-4c5d-8008-3001365039aa","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"9e47ef3f-ccc3-4b81-820a-cd83535c52d3","observation_id":"318f13bf-4ec3-4083-9c46-b639d1b5c978","study_id":"77bec26e-b844-4e0b-9769-3887372c01a0"},"target_id":"318f13bf-4ec3-4083-9c46-b639d1b5c978","target_table":"lesion_observations"}],"id":"261296be-9283-413f-b763-c8a7ee464094","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest measured enhancing volume change is L02 measures 0.1 mm\u00b3, decreased by 72.8% (0.3 mm\u00b3) at recurrence, compared against early-postoperative. This is the largest of 1 measured change across the timeline. Confidence 0.80; the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:45.848558Z","evidence_items":[{"id":"ffb0baff-c447-4485-abf4-473361528c7b","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"9e47ef3f-ccc3-4b81-820a-cd83535c52d3","observation_id":"318f13bf-4ec3-4083-9c46-b639d1b5c978","study_id":"77bec26e-b844-4e0b-9769-3887372c01a0","volume_cm3":0.0},"target_id":"318f13bf-4ec3-4083-9c46-b639d1b5c978","target_table":"lesion_observations"},{"id":"da74d778-9253-46c0-98a5-f133f228d8af","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"9e47ef3f-ccc3-4b81-820a-cd83535c52d3","observation_id":"318f13bf-4ec3-4083-9c46-b639d1b5c978","study_id":"77bec26e-b844-4e0b-9769-3887372c01a0"},"target_id":"318f13bf-4ec3-4083-9c46-b639d1b5c978","target_table":"lesion_observations"},{"id":"b83ec3b2-cc80-4385-95ae-579a33b4fb96","kind":"PRIOR_STUDY","label":"Compared against early-postoperative","locator":{"study_id":"7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5","timepoint":"early-postoperative"},"target_id":"7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5","target_table":"studies"}],"id":"690099ac-891b-4dfd-ba41-8bc4141fbbfb","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"Measured enhancing volume changed by more than 25% for 1 lesion between early-postoperative and recurrence, 475 days apart: L02 measures 0.1 mm\u00b3, decreased by 72.8% (0.3 mm\u00b3). 2 lesions had no prior to compare against: L03 measures 12.2 mm\u00b3 (first measurement, no prior to compare); L04 measures 0.2 mm\u00b3 (first measurement, no prior to compare). Confidence 0.80; the interval between the two examinations is not recorded, the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:45.785137Z","evidence_items":[{"id":"408e9f68-27f9-4642-b63b-e442f55be34a","kind":"MEASUREMENT","label":"L03 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"2e8827c1-46a4-4399-8c94-2fa76af52e96","observation_id":"deb468e9-2694-4e8d-b629-a51cf4aa6452","study_id":"77bec26e-b844-4e0b-9769-3887372c01a0","volume_cm3":0.01},"target_id":"deb468e9-2694-4e8d-b629-a51cf4aa6452","target_table":"lesion_observations"},{"id":"330400f5-001e-49cf-aad8-3ee6a5bd14b2","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"2e8827c1-46a4-4399-8c94-2fa76af52e96","observation_id":"deb468e9-2694-4e8d-b629-a51cf4aa6452","study_id":"77bec26e-b844-4e0b-9769-3887372c01a0"},"target_id":"deb468e9-2694-4e8d-b629-a51cf4aa6452","target_table":"lesion_observations"},{"id":"26338d0e-dcab-4daa-a761-992dfd61bd6a","kind":"MEASUREMENT","label":"L04 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"c7ab0b24-d573-4fa9-b44c-a437ac7505b5","observation_id":"8cd8ed80-0a30-4196-a36c-6c9db2aabd33","study_id":"77bec26e-b844-4e0b-9769-3887372c01a0","volume_cm3":0.0},"target_id":"8cd8ed80-0a30-4196-a36c-6c9db2aabd33","target_table":"lesion_observations"},{"id":"a752e528-2db4-49a9-94c2-cd1b0a7e5393","kind":"SEGMENTATION","label":"Segmented enhancing for L04","locator":{"lesion_id":"c7ab0b24-d573-4fa9-b44c-a437ac7505b5","observation_id":"8cd8ed80-0a30-4196-a36c-6c9db2aabd33","study_id":"77bec26e-b844-4e0b-9769-3887372c01a0"},"target_id":"8cd8ed80-0a30-4196-a36c-6c9db2aabd33","target_table":"lesion_observations"},{"id":"5454e335-f7f8-43e7-8608-05e986fa6bcd","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"9e47ef3f-ccc3-4b81-820a-cd83535c52d3","observation_id":"318f13bf-4ec3-4083-9c46-b639d1b5c978","study_id":"77bec26e-b844-4e0b-9769-3887372c01a0","volume_cm3":0.0},"target_id":"318f13bf-4ec3-4083-9c46-b639d1b5c978","target_table":"lesion_observations"},{"id":"f3f16ea6-a82f-407d-a1ba-75a317b75f98","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"9e47ef3f-ccc3-4b81-820a-cd83535c52d3","observation_id":"318f13bf-4ec3-4083-9c46-b639d1b5c978","study_id":"77bec26e-b844-4e0b-9769-3887372c01a0"},"target_id":"318f13bf-4ec3-4083-9c46-b639d1b5c978","target_table":"lesion_observations"},{"id":"4a7483f3-b756-4060-ae76-5b6d05e293ab","kind":"PRIOR_STUDY","label":"Compared against early-postoperative","locator":{"study_id":"7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5","timepoint":"early-postoperative"},"target_id":"7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5","target_table":"studies"}],"id":"931f4618-a2ee-49a6-9f85-d84d9a3ce81d","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/2be8a602-8102-4bf4-a6a0-87df5f84f3c1.json b/api/ai-observations/2be8a602-8102-4bf4-a6a0-87df5f84f3c1.json new file mode 100644 index 0000000000000000000000000000000000000000..69d9260da78c752bc9b67fb806015694e20f4a5e --- /dev/null +++ b/api/ai-observations/2be8a602-8102-4bf4-a6a0-87df5f84f3c1.json @@ -0,0 +1 @@ +[{"answer_text":"No lesion was measured within 25% of its previous enhancing volume at early-postoperative. All 1 lesion with a measured change moved by more than that: L02 measures 0.3 mm\u00b3, decreased by 42.5% (0.2 mm\u00b3). Confidence 0.80; the correspondence to the prior lesion is not confident, the lesion does not overlap its match in the prior study, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:43.063000Z","evidence_items":[{"id":"ed2dc62f-c13d-4013-ac2d-8171a4719dab","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"a6267041-4c96-4162-97d7-87a315531b54","observation_id":"ab37a6dc-3ee7-4695-8f73-a9d03440a2a5","study_id":"e2e99632-5b1e-4ef7-86d7-ae6ba1909392","volume_cm3":0.0},"target_id":"ab37a6dc-3ee7-4695-8f73-a9d03440a2a5","target_table":"lesion_observations"},{"id":"eb37fb3e-1c86-4977-b13e-895338012e75","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"a6267041-4c96-4162-97d7-87a315531b54","observation_id":"ab37a6dc-3ee7-4695-8f73-a9d03440a2a5","study_id":"e2e99632-5b1e-4ef7-86d7-ae6ba1909392"},"target_id":"ab37a6dc-3ee7-4695-8f73-a9d03440a2a5","target_table":"lesion_observations"}],"id":"947bcb36-20b2-4ce5-b285-b6bc2b054421","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_REMAINED_STABLE","question_text":"What remained stable?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: NO_OVERLAP","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest total measured enhancing volume change was recorded at early-postoperative, 0.2 mm\u00b3 summed across 1 lesion, 10 days after the study it is compared with. Confidence 0.80; the correspondence to the prior lesion is not confident, the lesion does not overlap its match in the prior study, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:43.003295Z","evidence_items":[{"id":"6c2db5bc-2eb9-45a0-899c-8087b851e1f2","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"a6267041-4c96-4162-97d7-87a315531b54","observation_id":"ab37a6dc-3ee7-4695-8f73-a9d03440a2a5","study_id":"e2e99632-5b1e-4ef7-86d7-ae6ba1909392","volume_cm3":0.0},"target_id":"ab37a6dc-3ee7-4695-8f73-a9d03440a2a5","target_table":"lesion_observations"},{"id":"d5f983a1-d34d-40d4-b92a-d026829c343f","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"a6267041-4c96-4162-97d7-87a315531b54","observation_id":"ab37a6dc-3ee7-4695-8f73-a9d03440a2a5","study_id":"e2e99632-5b1e-4ef7-86d7-ae6ba1909392"},"target_id":"ab37a6dc-3ee7-4695-8f73-a9d03440a2a5","target_table":"lesion_observations"}],"id":"26ff2ff8-4e55-4cf9-a5b5-41d47fea96c6","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: NO_OVERLAP","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest measured enhancing volume change is L02 measures 0.3 mm\u00b3, decreased by 42.5% (0.2 mm\u00b3) at early-postoperative, compared against preoperative. This is the largest of 1 measured change across the timeline. Confidence 0.80; the correspondence to the prior lesion is not confident, the lesion does not overlap its match in the prior study, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:42.935392Z","evidence_items":[{"id":"0bd635c6-ad12-4952-9682-b40b638e2c89","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"a6267041-4c96-4162-97d7-87a315531b54","observation_id":"ab37a6dc-3ee7-4695-8f73-a9d03440a2a5","study_id":"e2e99632-5b1e-4ef7-86d7-ae6ba1909392","volume_cm3":0.0},"target_id":"ab37a6dc-3ee7-4695-8f73-a9d03440a2a5","target_table":"lesion_observations"},{"id":"a5069ecf-4c6c-48d2-a22f-77fd96a099ea","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"a6267041-4c96-4162-97d7-87a315531b54","observation_id":"ab37a6dc-3ee7-4695-8f73-a9d03440a2a5","study_id":"e2e99632-5b1e-4ef7-86d7-ae6ba1909392"},"target_id":"ab37a6dc-3ee7-4695-8f73-a9d03440a2a5","target_table":"lesion_observations"},{"id":"3b288c4c-2ba2-4afa-bc43-ad5e95583e33","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"71f83359-3065-4843-8c63-6d27998c4099","timepoint":"preoperative"},"target_id":"71f83359-3065-4843-8c63-6d27998c4099","target_table":"studies"}],"id":"f95cd8fc-115f-4ae8-b165-d3feadea4b6b","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: NO_OVERLAP","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"Measured enhancing volume changed by more than 25% for 1 lesion between preoperative and early-postoperative, 10 days apart: L02 measures 0.3 mm\u00b3, decreased by 42.5% (0.2 mm\u00b3). Confidence 0.80; the correspondence to the prior lesion is not confident, the lesion does not overlap its match in the prior study, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:42.859867Z","evidence_items":[{"id":"1f223be7-2ef8-49fe-b3bc-138765f8f51c","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"a6267041-4c96-4162-97d7-87a315531b54","observation_id":"ab37a6dc-3ee7-4695-8f73-a9d03440a2a5","study_id":"e2e99632-5b1e-4ef7-86d7-ae6ba1909392","volume_cm3":0.0},"target_id":"ab37a6dc-3ee7-4695-8f73-a9d03440a2a5","target_table":"lesion_observations"},{"id":"91382226-e87d-41d6-9375-bac6c6578ff2","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"a6267041-4c96-4162-97d7-87a315531b54","observation_id":"ab37a6dc-3ee7-4695-8f73-a9d03440a2a5","study_id":"e2e99632-5b1e-4ef7-86d7-ae6ba1909392"},"target_id":"ab37a6dc-3ee7-4695-8f73-a9d03440a2a5","target_table":"lesion_observations"},{"id":"dac82aad-a62e-4d53-9716-0d72a2633539","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"71f83359-3065-4843-8c63-6d27998c4099","timepoint":"preoperative"},"target_id":"71f83359-3065-4843-8c63-6d27998c4099","target_table":"studies"}],"id":"4e11107a-fb6f-4d01-8870-75f371ef9cd0","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: NO_OVERLAP","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/31d3fa6c-d577-4972-9845-fd45c6d03801.json b/api/ai-observations/31d3fa6c-d577-4972-9845-fd45c6d03801.json new file mode 100644 index 0000000000000000000000000000000000000000..991d6ff28f7696d42986a3150316f0ce62cd3e37 --- /dev/null +++ b/api/ai-observations/31d3fa6c-d577-4972-9845-fd45c6d03801.json @@ -0,0 +1 @@ +[{"answer_text":"No measured enhancing volume changed by more than 25%. 1 lesion had no prior to compare against: L04 measures 25.5 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:41.800035Z","evidence_items":[{"id":"311a0efc-7985-4a3c-b923-d96a611826d5","kind":"MEASUREMENT","label":"L04 volume 0.03 cm\u00b3 at recurrence","locator":{"lesion_id":"78ef9305-6125-4334-8785-506ce70462d9","observation_id":"7aac196e-901d-442a-a817-5261341ca0b6","study_id":"62ec3a94-03fb-4477-860a-e4068c3f2bad","volume_cm3":0.03},"target_id":"7aac196e-901d-442a-a817-5261341ca0b6","target_table":"lesion_observations"},{"id":"ac4c57fb-d742-444f-b515-4f7d567ccbd3","kind":"SEGMENTATION","label":"Segmented enhancing for L04","locator":{"lesion_id":"78ef9305-6125-4334-8785-506ce70462d9","observation_id":"7aac196e-901d-442a-a817-5261341ca0b6","study_id":"62ec3a94-03fb-4477-860a-e4068c3f2bad"},"target_id":"7aac196e-901d-442a-a817-5261341ca0b6","target_table":"lesion_observations"}],"id":"6e7a1ff1-83c5-4e46-ab77-37ba313cc048","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/37ab76a9-f8d9-4ccb-8ae7-5b617bc333f8.json b/api/ai-observations/37ab76a9-f8d9-4ccb-8ae7-5b617bc333f8.json new file mode 100644 index 0000000000000000000000000000000000000000..82ef248c9ca624c68a9393c330310f60681e8050 --- /dev/null +++ b/api/ai-observations/37ab76a9-f8d9-4ccb-8ae7-5b617bc333f8.json @@ -0,0 +1 @@ +[{"answer_text":"1 lesion changed by 25% or less in measured enhancing volume at recurrence: L02 measures 0.2 mm\u00b3, decreased by 15.9% (0.0 mm\u00b3). Confidence 0.72; the correspondence to the prior lesion is not confident, the change is smaller than the measurement uncertainty, the lesion does not overlap its match in the prior study, the similarity score for the correspondence is weak.","confidence":0.72,"created_at":"2026-08-18T22:19:39.345900Z","evidence_items":[{"id":"04d5a9eb-3fd1-4f7a-b2e3-259bdb3ba779","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"e01128b9-d80a-42e2-9743-21b1098bb9bc","observation_id":"0924c56e-ef14-427d-a372-319bccb4cf20","study_id":"bf46ee7b-a403-4562-a149-7811740eb6ab","volume_cm3":0.0},"target_id":"0924c56e-ef14-427d-a372-319bccb4cf20","target_table":"lesion_observations"},{"id":"612a3195-0c3e-4828-af8a-77aa854dc2a2","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"e01128b9-d80a-42e2-9743-21b1098bb9bc","observation_id":"0924c56e-ef14-427d-a372-319bccb4cf20","study_id":"bf46ee7b-a403-4562-a149-7811740eb6ab"},"target_id":"0924c56e-ef14-427d-a372-319bccb4cf20","target_table":"lesion_observations"}],"id":"aaa5d303-0c78-423e-b5f0-609e5ac9b735","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_REMAINED_STABLE","question_text":"What remained stable?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: BELOW_UNCERTAINTY","quality flag on input: NO_OVERLAP","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest total measured enhancing volume change was recorded at recurrence, 11.5 mm\u00b3 summed across 2 lesions, 141 days after the study it is compared with. Confidence 0.72; the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak, the change is smaller than the measurement uncertainty, the lesion does not overlap its match in the prior study.","confidence":0.72,"created_at":"2026-08-18T22:19:39.264878Z","evidence_items":[{"id":"192c00ca-5be2-4b9c-80b5-996ccf291659","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"1c572a43-b5f7-4915-9167-0d577ca39887","observation_id":"7d887f9f-a518-4065-ab83-bda4ae30f053","study_id":"bf46ee7b-a403-4562-a149-7811740eb6ab","volume_cm3":0.0},"target_id":"7d887f9f-a518-4065-ab83-bda4ae30f053","target_table":"lesion_observations"},{"id":"d880c34b-2201-4c32-a6fd-48ed4c340e9d","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"1c572a43-b5f7-4915-9167-0d577ca39887","observation_id":"7d887f9f-a518-4065-ab83-bda4ae30f053","study_id":"bf46ee7b-a403-4562-a149-7811740eb6ab"},"target_id":"7d887f9f-a518-4065-ab83-bda4ae30f053","target_table":"lesion_observations"},{"id":"c6c241f0-b2b9-47ce-9312-ef31aeb5a2b6","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"e01128b9-d80a-42e2-9743-21b1098bb9bc","observation_id":"0924c56e-ef14-427d-a372-319bccb4cf20","study_id":"bf46ee7b-a403-4562-a149-7811740eb6ab","volume_cm3":0.0},"target_id":"0924c56e-ef14-427d-a372-319bccb4cf20","target_table":"lesion_observations"},{"id":"2d860d45-a5af-4a53-b3a8-b3a7dc4a4491","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"e01128b9-d80a-42e2-9743-21b1098bb9bc","observation_id":"0924c56e-ef14-427d-a372-319bccb4cf20","study_id":"bf46ee7b-a403-4562-a149-7811740eb6ab"},"target_id":"0924c56e-ef14-427d-a372-319bccb4cf20","target_table":"lesion_observations"}],"id":"658df23c-61c8-4c55-a5ca-b82ba0e2ae24","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","quality flag on input: BELOW_UNCERTAINTY","quality flag on input: NO_OVERLAP","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest measured enhancing volume change is L01 measures 2.4 mm\u00b3, decreased by 82.9% (11.5 mm\u00b3) at recurrence, compared against preoperative. This is the largest of 2 measured changes across the timeline. Confidence 0.80; the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.198561Z","evidence_items":[{"id":"d3eadb75-ee96-45ab-875c-c5744f7dca92","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"1c572a43-b5f7-4915-9167-0d577ca39887","observation_id":"7d887f9f-a518-4065-ab83-bda4ae30f053","study_id":"bf46ee7b-a403-4562-a149-7811740eb6ab","volume_cm3":0.0},"target_id":"7d887f9f-a518-4065-ab83-bda4ae30f053","target_table":"lesion_observations"},{"id":"863bc4dc-80a7-4ec7-b79d-0b2acb011604","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"1c572a43-b5f7-4915-9167-0d577ca39887","observation_id":"7d887f9f-a518-4065-ab83-bda4ae30f053","study_id":"bf46ee7b-a403-4562-a149-7811740eb6ab"},"target_id":"7d887f9f-a518-4065-ab83-bda4ae30f053","target_table":"lesion_observations"},{"id":"c22dd66f-8c98-44a0-901b-ff57a7009eed","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"50c7e8b0-067e-4c68-b476-5f78dfcd7a62","timepoint":"preoperative"},"target_id":"50c7e8b0-067e-4c68-b476-5f78dfcd7a62","target_table":"studies"}],"id":"12f48be4-377b-4b27-b0ec-e3ad129be880","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"Measured enhancing volume changed by more than 25% for 1 lesion between preoperative and recurrence, 141 days apart: L01 measures 2.4 mm\u00b3, decreased by 82.9% (11.5 mm\u00b3). 1 lesion changed by less: L02 measures 0.2 mm\u00b3, decreased by 15.9% (0.0 mm\u00b3). 2 lesions had no prior to compare against: L03 measures 2.0 mm\u00b3 (first measurement, no prior to compare); L04 measures 0.0 mm\u00b3 (first measurement, no prior to compare). Confidence 0.72; the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak, the interval between the two examinations is not recorded, the change is smaller than the measurement uncertainty, the lesion does not overlap its match in the prior study.","confidence":0.72,"created_at":"2026-08-18T22:19:39.140545Z","evidence_items":[{"id":"d9e167bd-926e-4156-a229-c5823bf868f3","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"1c572a43-b5f7-4915-9167-0d577ca39887","observation_id":"7d887f9f-a518-4065-ab83-bda4ae30f053","study_id":"bf46ee7b-a403-4562-a149-7811740eb6ab","volume_cm3":0.0},"target_id":"7d887f9f-a518-4065-ab83-bda4ae30f053","target_table":"lesion_observations"},{"id":"10208c27-cfac-4ae0-937a-043eb04a7acd","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"1c572a43-b5f7-4915-9167-0d577ca39887","observation_id":"7d887f9f-a518-4065-ab83-bda4ae30f053","study_id":"bf46ee7b-a403-4562-a149-7811740eb6ab"},"target_id":"7d887f9f-a518-4065-ab83-bda4ae30f053","target_table":"lesion_observations"},{"id":"33079d50-e49f-4bca-98af-d990e1368658","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"e3cc1862-b0c2-404d-9620-b3125cd5ddde","observation_id":"6730331d-032a-437e-a3af-be8d0bb1c257","study_id":"bf46ee7b-a403-4562-a149-7811740eb6ab","volume_cm3":0.0},"target_id":"6730331d-032a-437e-a3af-be8d0bb1c257","target_table":"lesion_observations"},{"id":"7de47dad-3e8a-4e56-9671-cc3cb9bd09dd","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"e3cc1862-b0c2-404d-9620-b3125cd5ddde","observation_id":"6730331d-032a-437e-a3af-be8d0bb1c257","study_id":"bf46ee7b-a403-4562-a149-7811740eb6ab"},"target_id":"6730331d-032a-437e-a3af-be8d0bb1c257","target_table":"lesion_observations"},{"id":"45706439-8684-441f-9c5b-deadc2eb7319","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"e01128b9-d80a-42e2-9743-21b1098bb9bc","observation_id":"0924c56e-ef14-427d-a372-319bccb4cf20","study_id":"bf46ee7b-a403-4562-a149-7811740eb6ab","volume_cm3":0.0},"target_id":"0924c56e-ef14-427d-a372-319bccb4cf20","target_table":"lesion_observations"},{"id":"6eebda81-5d2d-4097-a80f-01ca86c0a564","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"e01128b9-d80a-42e2-9743-21b1098bb9bc","observation_id":"0924c56e-ef14-427d-a372-319bccb4cf20","study_id":"bf46ee7b-a403-4562-a149-7811740eb6ab"},"target_id":"0924c56e-ef14-427d-a372-319bccb4cf20","target_table":"lesion_observations"},{"id":"9c652c99-32c1-4b40-814a-a52ed9ccb10b","kind":"MEASUREMENT","label":"L04 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"03fbc286-7b48-4e0f-bc7d-a7a5bc6bbbe3","observation_id":"f8dd7f1c-e9eb-413e-8876-dc1348b6ac13","study_id":"bf46ee7b-a403-4562-a149-7811740eb6ab","volume_cm3":0.0},"target_id":"f8dd7f1c-e9eb-413e-8876-dc1348b6ac13","target_table":"lesion_observations"},{"id":"fd729e95-043a-4b0d-a6ff-3547eda6db8c","kind":"SEGMENTATION","label":"Segmented enhancing for L04","locator":{"lesion_id":"03fbc286-7b48-4e0f-bc7d-a7a5bc6bbbe3","observation_id":"f8dd7f1c-e9eb-413e-8876-dc1348b6ac13","study_id":"bf46ee7b-a403-4562-a149-7811740eb6ab"},"target_id":"f8dd7f1c-e9eb-413e-8876-dc1348b6ac13","target_table":"lesion_observations"},{"id":"3938c1b9-c6a0-490e-a5ee-e8f6f9955e1d","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"50c7e8b0-067e-4c68-b476-5f78dfcd7a62","timepoint":"preoperative"},"target_id":"50c7e8b0-067e-4c68-b476-5f78dfcd7a62","target_table":"studies"}],"id":"191df22c-4c07-4877-9263-b2d274e9fd5a","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","quality flag on input: NO_INTERVAL","quality flag on input: BELOW_UNCERTAINTY","quality flag on input: NO_OVERLAP","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/4709627e-6d9f-467a-9c36-76e45ed24071.json b/api/ai-observations/4709627e-6d9f-467a-9c36-76e45ed24071.json new file mode 100644 index 0000000000000000000000000000000000000000..7e6c4c38cab90a18ac652a62d27f537ee32612db --- /dev/null +++ b/api/ai-observations/4709627e-6d9f-467a-9c36-76e45ed24071.json @@ -0,0 +1 @@ +[{"answer_text":"No measured enhancing volume changed by more than 25%. 4 lesions had no prior to compare against: L02 measures 3.4 mm\u00b3 (first measurement, no prior to compare); L03 measures 0.5 mm\u00b3 (first measurement, no prior to compare); L04 measures 0.2 mm\u00b3 (first measurement, no prior to compare); L05 measures 0.1 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:38.943990Z","evidence_items":[{"id":"6b7080e9-2689-4fe8-a5a4-bd2ddf00a899","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"31c8e958-ff3f-4b70-8949-b368b58d6287","observation_id":"b31ea8d2-26e2-4f18-88d0-a3f63349fde6","study_id":"49fff636-3d0c-4bbc-866d-fd34845e8803","volume_cm3":0.0},"target_id":"b31ea8d2-26e2-4f18-88d0-a3f63349fde6","target_table":"lesion_observations"},{"id":"ad06d09c-1f26-4ffa-b52c-5ee2b3d53f87","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"31c8e958-ff3f-4b70-8949-b368b58d6287","observation_id":"b31ea8d2-26e2-4f18-88d0-a3f63349fde6","study_id":"49fff636-3d0c-4bbc-866d-fd34845e8803"},"target_id":"b31ea8d2-26e2-4f18-88d0-a3f63349fde6","target_table":"lesion_observations"},{"id":"f4aacf44-7c50-4bd4-a030-26d9aa093049","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"829204f4-53cb-4fc1-a74e-c73ebd9f5420","observation_id":"5c536362-9ba7-4327-8aa2-304c9f4e64f7","study_id":"49fff636-3d0c-4bbc-866d-fd34845e8803","volume_cm3":0.0},"target_id":"5c536362-9ba7-4327-8aa2-304c9f4e64f7","target_table":"lesion_observations"},{"id":"feeb2335-65d2-472d-829c-3f22d77e36b0","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"829204f4-53cb-4fc1-a74e-c73ebd9f5420","observation_id":"5c536362-9ba7-4327-8aa2-304c9f4e64f7","study_id":"49fff636-3d0c-4bbc-866d-fd34845e8803"},"target_id":"5c536362-9ba7-4327-8aa2-304c9f4e64f7","target_table":"lesion_observations"},{"id":"6d1eea9b-a4f4-48b8-b644-c868e717bf49","kind":"MEASUREMENT","label":"L04 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"30114963-0ca7-40e9-857a-cb4edfefe911","observation_id":"2199f51c-1c5e-4ed6-be4a-bad5fd5be320","study_id":"49fff636-3d0c-4bbc-866d-fd34845e8803","volume_cm3":0.0},"target_id":"2199f51c-1c5e-4ed6-be4a-bad5fd5be320","target_table":"lesion_observations"},{"id":"0c59425d-c34d-485b-bae0-aefbb3574d27","kind":"SEGMENTATION","label":"Segmented enhancing for L04","locator":{"lesion_id":"30114963-0ca7-40e9-857a-cb4edfefe911","observation_id":"2199f51c-1c5e-4ed6-be4a-bad5fd5be320","study_id":"49fff636-3d0c-4bbc-866d-fd34845e8803"},"target_id":"2199f51c-1c5e-4ed6-be4a-bad5fd5be320","target_table":"lesion_observations"},{"id":"e0770475-2729-43e4-bd80-997d241a0c4f","kind":"MEASUREMENT","label":"L05 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"fbc33fe6-783a-4e4b-9785-49535c649a98","observation_id":"58b6d6cb-e075-4540-a601-ad338d376e94","study_id":"49fff636-3d0c-4bbc-866d-fd34845e8803","volume_cm3":0.0},"target_id":"58b6d6cb-e075-4540-a601-ad338d376e94","target_table":"lesion_observations"},{"id":"206c9a4f-f1c6-4500-a156-7b0ed8e65e27","kind":"SEGMENTATION","label":"Segmented enhancing for L05","locator":{"lesion_id":"fbc33fe6-783a-4e4b-9785-49535c649a98","observation_id":"58b6d6cb-e075-4540-a601-ad338d376e94","study_id":"49fff636-3d0c-4bbc-866d-fd34845e8803"},"target_id":"58b6d6cb-e075-4540-a601-ad338d376e94","target_table":"lesion_observations"}],"id":"35c08d3a-933a-44c6-b36d-f556577315d1","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/4ec108df-781d-4553-b5e0-56aa6c18c94a.json b/api/ai-observations/4ec108df-781d-4553-b5e0-56aa6c18c94a.json new file mode 100644 index 0000000000000000000000000000000000000000..64bd1dbf56459114afca3f3efc91190af75efcac --- /dev/null +++ b/api/ai-observations/4ec108df-781d-4553-b5e0-56aa6c18c94a.json @@ -0,0 +1 @@ +[{"answer_text":"No lesion was measured within 25% of its previous enhancing volume at recurrence. All 1 lesion with a measured change moved by more than that: L01 measures 5.4 mm\u00b3, decreased by 56.3% (6.9 mm\u00b3). Confidence 0.80; the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:44.795235Z","evidence_items":[{"id":"8076a4a9-bb6e-49aa-8a9a-492045d507ec","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"1108649e-d9b0-4d55-9ade-ad598f201934","observation_id":"ef290c1e-98a3-43cd-88d4-3c6e8b31a9e1","study_id":"9092c616-07c7-41e2-b50a-ea0bdca26e44","volume_cm3":0.01},"target_id":"ef290c1e-98a3-43cd-88d4-3c6e8b31a9e1","target_table":"lesion_observations"},{"id":"7ccb0523-6b69-40c8-9a54-66e4756ded25","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"1108649e-d9b0-4d55-9ade-ad598f201934","observation_id":"ef290c1e-98a3-43cd-88d4-3c6e8b31a9e1","study_id":"9092c616-07c7-41e2-b50a-ea0bdca26e44"},"target_id":"ef290c1e-98a3-43cd-88d4-3c6e8b31a9e1","target_table":"lesion_observations"}],"id":"eced4ed1-033d-491d-8e20-612e742d07bf","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_REMAINED_STABLE","question_text":"What remained stable?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest total measured enhancing volume change was recorded at recurrence, 6.9 mm\u00b3 summed across 1 lesion, 154 days after the study it is compared with. Confidence 0.80; the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:44.739097Z","evidence_items":[{"id":"8208ecac-1422-4797-b52f-5175d29f5cb7","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"1108649e-d9b0-4d55-9ade-ad598f201934","observation_id":"ef290c1e-98a3-43cd-88d4-3c6e8b31a9e1","study_id":"9092c616-07c7-41e2-b50a-ea0bdca26e44","volume_cm3":0.01},"target_id":"ef290c1e-98a3-43cd-88d4-3c6e8b31a9e1","target_table":"lesion_observations"},{"id":"d128f5fb-7173-415c-8acf-96d9ea47a892","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"1108649e-d9b0-4d55-9ade-ad598f201934","observation_id":"ef290c1e-98a3-43cd-88d4-3c6e8b31a9e1","study_id":"9092c616-07c7-41e2-b50a-ea0bdca26e44"},"target_id":"ef290c1e-98a3-43cd-88d4-3c6e8b31a9e1","target_table":"lesion_observations"}],"id":"65dd1ad6-4c97-4c21-82b6-ba185aae1e72","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest measured enhancing volume change is L01 measures 5.4 mm\u00b3, decreased by 56.3% (6.9 mm\u00b3) at recurrence, compared against preoperative. This is the largest of 1 measured change across the timeline. Confidence 0.80; the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:44.679224Z","evidence_items":[{"id":"980f362c-4b93-4962-85ff-d9362ed54c13","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"1108649e-d9b0-4d55-9ade-ad598f201934","observation_id":"ef290c1e-98a3-43cd-88d4-3c6e8b31a9e1","study_id":"9092c616-07c7-41e2-b50a-ea0bdca26e44","volume_cm3":0.01},"target_id":"ef290c1e-98a3-43cd-88d4-3c6e8b31a9e1","target_table":"lesion_observations"},{"id":"b1dc0fe0-a008-4122-9dcc-bd0784434a23","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"1108649e-d9b0-4d55-9ade-ad598f201934","observation_id":"ef290c1e-98a3-43cd-88d4-3c6e8b31a9e1","study_id":"9092c616-07c7-41e2-b50a-ea0bdca26e44"},"target_id":"ef290c1e-98a3-43cd-88d4-3c6e8b31a9e1","target_table":"lesion_observations"},{"id":"69bbecd0-5817-4d88-8a00-197780c4bca6","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"d117d92a-bdda-4456-bff9-a18b78431102","timepoint":"preoperative"},"target_id":"d117d92a-bdda-4456-bff9-a18b78431102","target_table":"studies"}],"id":"40040771-d151-49f4-98bb-bd516525b43b","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"Measured enhancing volume changed by more than 25% for 1 lesion between preoperative and recurrence, 154 days apart: L01 measures 5.4 mm\u00b3, decreased by 56.3% (6.9 mm\u00b3). Confidence 0.80; the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:44.621050Z","evidence_items":[{"id":"7813dae5-a1dc-4101-a401-f9dcf0ca07e0","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"1108649e-d9b0-4d55-9ade-ad598f201934","observation_id":"ef290c1e-98a3-43cd-88d4-3c6e8b31a9e1","study_id":"9092c616-07c7-41e2-b50a-ea0bdca26e44","volume_cm3":0.01},"target_id":"ef290c1e-98a3-43cd-88d4-3c6e8b31a9e1","target_table":"lesion_observations"},{"id":"2af5ab25-1f4a-4279-a353-9adcfc2e561f","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"1108649e-d9b0-4d55-9ade-ad598f201934","observation_id":"ef290c1e-98a3-43cd-88d4-3c6e8b31a9e1","study_id":"9092c616-07c7-41e2-b50a-ea0bdca26e44"},"target_id":"ef290c1e-98a3-43cd-88d4-3c6e8b31a9e1","target_table":"lesion_observations"},{"id":"dec7c956-9a17-4067-b32b-78deb8f33894","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"d117d92a-bdda-4456-bff9-a18b78431102","timepoint":"preoperative"},"target_id":"d117d92a-bdda-4456-bff9-a18b78431102","target_table":"studies"}],"id":"fa727aba-0004-43fe-8bde-95244e827c9f","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/5cbd85a6-01b0-40aa-b6ba-eb8a5dd942c3.json b/api/ai-observations/5cbd85a6-01b0-40aa-b6ba-eb8a5dd942c3.json new file mode 100644 index 0000000000000000000000000000000000000000..ee45c5a90bdca2251698f7085d2b41177e6f08d4 --- /dev/null +++ b/api/ai-observations/5cbd85a6-01b0-40aa-b6ba-eb8a5dd942c3.json @@ -0,0 +1 @@ +[{"answer_text":"No lesion was measured within 25% of its previous enhancing volume at recurrence. All 1 lesion with a measured change moved by more than that: L01 measures 9.9 mm\u00b3, increased by 74.6% (4.2 mm\u00b3). Confidence 0.80; the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:45.260926Z","evidence_items":[{"id":"ce379118-8249-4860-a03d-918e17c7abf1","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"8ed11258-94f9-4f70-8dd8-5c6978145285","observation_id":"2454f266-7772-4ebb-a39d-9383abbe4619","study_id":"824a3e19-8c80-4983-86c3-d5b15d10b882","volume_cm3":0.01},"target_id":"2454f266-7772-4ebb-a39d-9383abbe4619","target_table":"lesion_observations"},{"id":"7f0138a7-4c46-4132-9468-be633dcfc727","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"8ed11258-94f9-4f70-8dd8-5c6978145285","observation_id":"2454f266-7772-4ebb-a39d-9383abbe4619","study_id":"824a3e19-8c80-4983-86c3-d5b15d10b882"},"target_id":"2454f266-7772-4ebb-a39d-9383abbe4619","target_table":"lesion_observations"}],"id":"d7b47d10-e45a-42d8-bd3b-f9ce71a5248d","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_REMAINED_STABLE","question_text":"What remained stable?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest total measured enhancing volume change was recorded at recurrence, 4.2 mm\u00b3 summed across 1 lesion, 80 days after the study it is compared with. Confidence 0.80; the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:45.209353Z","evidence_items":[{"id":"f44f10bb-cee5-4774-a146-b5cc652d5fc7","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"8ed11258-94f9-4f70-8dd8-5c6978145285","observation_id":"2454f266-7772-4ebb-a39d-9383abbe4619","study_id":"824a3e19-8c80-4983-86c3-d5b15d10b882","volume_cm3":0.01},"target_id":"2454f266-7772-4ebb-a39d-9383abbe4619","target_table":"lesion_observations"},{"id":"a24df315-8619-43b1-af38-9f7f71d80e50","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"8ed11258-94f9-4f70-8dd8-5c6978145285","observation_id":"2454f266-7772-4ebb-a39d-9383abbe4619","study_id":"824a3e19-8c80-4983-86c3-d5b15d10b882"},"target_id":"2454f266-7772-4ebb-a39d-9383abbe4619","target_table":"lesion_observations"}],"id":"9fe86627-9aea-494a-ab2a-0ee7b45d1636","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest measured enhancing volume change is L01 measures 9.9 mm\u00b3, increased by 74.6% (4.2 mm\u00b3) at recurrence, compared against preoperative. This is the largest of 1 measured change across the timeline. Confidence 0.80; the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:45.162317Z","evidence_items":[{"id":"c808a135-744e-440d-b3f1-70ceccf33199","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"8ed11258-94f9-4f70-8dd8-5c6978145285","observation_id":"2454f266-7772-4ebb-a39d-9383abbe4619","study_id":"824a3e19-8c80-4983-86c3-d5b15d10b882","volume_cm3":0.01},"target_id":"2454f266-7772-4ebb-a39d-9383abbe4619","target_table":"lesion_observations"},{"id":"fc92726a-aae4-4754-861a-1bb5cbc4dc0d","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"8ed11258-94f9-4f70-8dd8-5c6978145285","observation_id":"2454f266-7772-4ebb-a39d-9383abbe4619","study_id":"824a3e19-8c80-4983-86c3-d5b15d10b882"},"target_id":"2454f266-7772-4ebb-a39d-9383abbe4619","target_table":"lesion_observations"},{"id":"c2a233ad-d693-4d88-a2ea-fb73703abecd","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"f476432c-9081-4a87-95e2-f2493a745fb1","timepoint":"preoperative"},"target_id":"f476432c-9081-4a87-95e2-f2493a745fb1","target_table":"studies"}],"id":"6b7d98e8-c714-47d8-a2fe-2b89011482ef","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"Measured enhancing volume changed by more than 25% for 1 lesion between preoperative and recurrence, 80 days apart: L01 measures 9.9 mm\u00b3, increased by 74.6% (4.2 mm\u00b3). Confidence 0.80; the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:45.108676Z","evidence_items":[{"id":"b0deb63f-e3a7-4500-9f3b-efbb0da52706","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"8ed11258-94f9-4f70-8dd8-5c6978145285","observation_id":"2454f266-7772-4ebb-a39d-9383abbe4619","study_id":"824a3e19-8c80-4983-86c3-d5b15d10b882","volume_cm3":0.01},"target_id":"2454f266-7772-4ebb-a39d-9383abbe4619","target_table":"lesion_observations"},{"id":"0052e096-79e5-49de-9e23-5aca73e80707","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"8ed11258-94f9-4f70-8dd8-5c6978145285","observation_id":"2454f266-7772-4ebb-a39d-9383abbe4619","study_id":"824a3e19-8c80-4983-86c3-d5b15d10b882"},"target_id":"2454f266-7772-4ebb-a39d-9383abbe4619","target_table":"lesion_observations"},{"id":"22471ba5-5a9a-4c1e-b221-f73b150e4ce0","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"f476432c-9081-4a87-95e2-f2493a745fb1","timepoint":"preoperative"},"target_id":"f476432c-9081-4a87-95e2-f2493a745fb1","target_table":"studies"}],"id":"4e7860fd-b167-496d-8e74-69b909634d8e","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/65c97660-6722-4a04-8a81-840ce91c1a8d.json b/api/ai-observations/65c97660-6722-4a04-8a81-840ce91c1a8d.json new file mode 100644 index 0000000000000000000000000000000000000000..3a53f599452388a530f4b4854102e0bfff9dce18 --- /dev/null +++ b/api/ai-observations/65c97660-6722-4a04-8a81-840ce91c1a8d.json @@ -0,0 +1 @@ +[{"answer_text":"No lesion was measured within 25% of its previous enhancing volume at early-postoperative. All 2 lesions with a measured change moved by more than that: L02 measures 0.5 mm\u00b3, increased by 46.0% (0.2 mm\u00b3); L03 measures 0.0 mm\u00b3, decreased by 76.3% (0.1 mm\u00b3). Confidence 0.80; the interval between the two examinations is not recorded, the correspondence to the prior lesion is not confident, the lesion does not overlap its match in the prior study, the similarity score for the correspondence is weak, another lesion scored almost as well as this correspondence.","confidence":0.8,"created_at":"2026-08-18T22:19:42.193232Z","evidence_items":[{"id":"51fd9904-1013-4fd1-a1f8-1acf5105a09a","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"25e2590d-dde9-4bb6-a1b4-02606e776b65","observation_id":"d5343f9b-26e0-4081-a3a2-7a3709137d15","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3","volume_cm3":0.0},"target_id":"d5343f9b-26e0-4081-a3a2-7a3709137d15","target_table":"lesion_observations"},{"id":"8dbddf91-67c6-4a46-a407-5ea8ec658ce3","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"25e2590d-dde9-4bb6-a1b4-02606e776b65","observation_id":"d5343f9b-26e0-4081-a3a2-7a3709137d15","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3"},"target_id":"d5343f9b-26e0-4081-a3a2-7a3709137d15","target_table":"lesion_observations"},{"id":"5721a20c-a83e-4892-ad91-953507cdf547","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"0c772fe3-273f-4419-b816-c8ad71aebddd","observation_id":"f686fa80-7320-407a-b564-1d7cd3213357","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3","volume_cm3":0.0},"target_id":"f686fa80-7320-407a-b564-1d7cd3213357","target_table":"lesion_observations"},{"id":"08a53839-bdd7-4644-a3e5-24cd630ad986","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"0c772fe3-273f-4419-b816-c8ad71aebddd","observation_id":"f686fa80-7320-407a-b564-1d7cd3213357","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3"},"target_id":"f686fa80-7320-407a-b564-1d7cd3213357","target_table":"lesion_observations"}],"id":"a309413c-e467-4a41-9b49-386828312adf","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_REMAINED_STABLE","question_text":"What remained stable?","safety_notes":["quality flag on input: NO_INTERVAL","quality flag on input: MATCH_UNCERTAIN","quality flag on input: NO_OVERLAP","quality flag on input: WEAK_SCORE","quality flag on input: AMBIGUOUS_ALTERNATIVE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest total measured enhancing volume change was recorded at early-postoperative, 0.3 mm\u00b3 summed across 2 lesions, 3 days after the study it is compared with. Confidence 0.80; the correspondence to the prior lesion is not confident, the lesion does not overlap its match in the prior study, the similarity score for the correspondence is weak, another lesion scored almost as well as this correspondence.","confidence":0.8,"created_at":"2026-08-18T22:19:42.125029Z","evidence_items":[{"id":"cc032b21-5eca-4046-9828-431151c5c677","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"25e2590d-dde9-4bb6-a1b4-02606e776b65","observation_id":"d5343f9b-26e0-4081-a3a2-7a3709137d15","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3","volume_cm3":0.0},"target_id":"d5343f9b-26e0-4081-a3a2-7a3709137d15","target_table":"lesion_observations"},{"id":"562d9695-3487-414a-9002-449c396db048","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"25e2590d-dde9-4bb6-a1b4-02606e776b65","observation_id":"d5343f9b-26e0-4081-a3a2-7a3709137d15","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3"},"target_id":"d5343f9b-26e0-4081-a3a2-7a3709137d15","target_table":"lesion_observations"},{"id":"d1412193-d90c-41ea-a8fa-1bfa0fb02571","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"0c772fe3-273f-4419-b816-c8ad71aebddd","observation_id":"f686fa80-7320-407a-b564-1d7cd3213357","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3","volume_cm3":0.0},"target_id":"f686fa80-7320-407a-b564-1d7cd3213357","target_table":"lesion_observations"},{"id":"467cd27b-4b94-461f-869d-785e2766d64c","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"0c772fe3-273f-4419-b816-c8ad71aebddd","observation_id":"f686fa80-7320-407a-b564-1d7cd3213357","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3"},"target_id":"f686fa80-7320-407a-b564-1d7cd3213357","target_table":"lesion_observations"}],"id":"595f491b-736d-43ae-80eb-2e7da463ced3","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: NO_OVERLAP","quality flag on input: WEAK_SCORE","quality flag on input: AMBIGUOUS_ALTERNATIVE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest measured enhancing volume change is L03 measures 0.0 mm\u00b3, decreased by 76.3% (0.1 mm\u00b3) at early-postoperative, compared against preoperative. This is the largest of 2 measured changes across the timeline. Confidence 0.80; the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak, another lesion scored almost as well as this correspondence.","confidence":0.8,"created_at":"2026-08-18T22:19:42.068871Z","evidence_items":[{"id":"e6a53046-085a-4975-8826-c29654044227","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"0c772fe3-273f-4419-b816-c8ad71aebddd","observation_id":"f686fa80-7320-407a-b564-1d7cd3213357","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3","volume_cm3":0.0},"target_id":"f686fa80-7320-407a-b564-1d7cd3213357","target_table":"lesion_observations"},{"id":"39789b0b-0331-45ec-b650-086dd17c466c","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"0c772fe3-273f-4419-b816-c8ad71aebddd","observation_id":"f686fa80-7320-407a-b564-1d7cd3213357","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3"},"target_id":"f686fa80-7320-407a-b564-1d7cd3213357","target_table":"lesion_observations"},{"id":"ead736b5-0fac-4035-8860-b78aa327a019","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"02502ba4-5660-47b5-bffa-2670a34dfe7b","timepoint":"preoperative"},"target_id":"02502ba4-5660-47b5-bffa-2670a34dfe7b","target_table":"studies"}],"id":"60d3619c-6b46-4c6a-bb2a-d97f7935e5f4","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","quality flag on input: AMBIGUOUS_ALTERNATIVE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"Measured enhancing volume changed by more than 25% for 2 lesions between preoperative and early-postoperative, 3 days apart: L02 measures 0.5 mm\u00b3, increased by 46.0% (0.2 mm\u00b3); L03 measures 0.0 mm\u00b3, decreased by 76.3% (0.1 mm\u00b3). 4 lesions had no prior to compare against: L04 measures 0.8 mm\u00b3 (first measurement, no prior to compare); L05 measures 0.2 mm\u00b3 (first measurement, no prior to compare); L06 measures 0.0 mm\u00b3 (first measurement, no prior to compare); L07 measures 0.0 mm\u00b3 (first measurement, no prior to compare). Confidence 0.80; the interval between the two examinations is not recorded, the correspondence to the prior lesion is not confident, the lesion does not overlap its match in the prior study, the similarity score for the correspondence is weak, another lesion scored almost as well as this correspondence.","confidence":0.8,"created_at":"2026-08-18T22:19:42.010276Z","evidence_items":[{"id":"8c3e1021-a15a-412a-9118-63af7ae13b39","kind":"MEASUREMENT","label":"L04 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"f0920ce3-fdfc-4b32-9478-e865a3e9cb74","observation_id":"c9f65a64-fd9b-4df2-b2b3-8ec76402c853","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3","volume_cm3":0.0},"target_id":"c9f65a64-fd9b-4df2-b2b3-8ec76402c853","target_table":"lesion_observations"},{"id":"c94656f0-1b49-4c68-b210-6454c1b7b7d0","kind":"SEGMENTATION","label":"Segmented enhancing for L04","locator":{"lesion_id":"f0920ce3-fdfc-4b32-9478-e865a3e9cb74","observation_id":"c9f65a64-fd9b-4df2-b2b3-8ec76402c853","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3"},"target_id":"c9f65a64-fd9b-4df2-b2b3-8ec76402c853","target_table":"lesion_observations"},{"id":"ee9fe71a-e41d-42ea-9613-dc990fef2ef8","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"25e2590d-dde9-4bb6-a1b4-02606e776b65","observation_id":"d5343f9b-26e0-4081-a3a2-7a3709137d15","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3","volume_cm3":0.0},"target_id":"d5343f9b-26e0-4081-a3a2-7a3709137d15","target_table":"lesion_observations"},{"id":"bdf5b9d6-ea3b-434f-93c4-dc8143ecc489","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"25e2590d-dde9-4bb6-a1b4-02606e776b65","observation_id":"d5343f9b-26e0-4081-a3a2-7a3709137d15","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3"},"target_id":"d5343f9b-26e0-4081-a3a2-7a3709137d15","target_table":"lesion_observations"},{"id":"1380c0d1-d1f5-4c3e-8849-1419155be45b","kind":"MEASUREMENT","label":"L05 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"d73efc2a-804a-4a3a-96c6-946c678bfd02","observation_id":"94ac4c1c-da76-48ef-8f00-146253f4244c","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3","volume_cm3":0.0},"target_id":"94ac4c1c-da76-48ef-8f00-146253f4244c","target_table":"lesion_observations"},{"id":"8b453baa-e86b-4034-b9c3-d1f6a180000e","kind":"SEGMENTATION","label":"Segmented enhancing for L05","locator":{"lesion_id":"d73efc2a-804a-4a3a-96c6-946c678bfd02","observation_id":"94ac4c1c-da76-48ef-8f00-146253f4244c","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3"},"target_id":"94ac4c1c-da76-48ef-8f00-146253f4244c","target_table":"lesion_observations"},{"id":"080a8380-3988-4807-98d6-3606e37daa4d","kind":"MEASUREMENT","label":"L06 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"b42056dd-8b55-48a2-84b7-0f96a36cea31","observation_id":"21443394-5deb-480c-b737-8ddd3fbc82f7","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3","volume_cm3":0.0},"target_id":"21443394-5deb-480c-b737-8ddd3fbc82f7","target_table":"lesion_observations"},{"id":"daa99788-7dc0-41fe-b85c-828a77cb98c5","kind":"SEGMENTATION","label":"Segmented enhancing for L06","locator":{"lesion_id":"b42056dd-8b55-48a2-84b7-0f96a36cea31","observation_id":"21443394-5deb-480c-b737-8ddd3fbc82f7","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3"},"target_id":"21443394-5deb-480c-b737-8ddd3fbc82f7","target_table":"lesion_observations"},{"id":"863bf131-4bfa-49ed-940c-bf203f0ab93d","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"0c772fe3-273f-4419-b816-c8ad71aebddd","observation_id":"f686fa80-7320-407a-b564-1d7cd3213357","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3","volume_cm3":0.0},"target_id":"f686fa80-7320-407a-b564-1d7cd3213357","target_table":"lesion_observations"},{"id":"719b72d4-dcd1-4bf3-9377-ebe2c85a6624","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"0c772fe3-273f-4419-b816-c8ad71aebddd","observation_id":"f686fa80-7320-407a-b564-1d7cd3213357","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3"},"target_id":"f686fa80-7320-407a-b564-1d7cd3213357","target_table":"lesion_observations"},{"id":"b3cd429b-fb88-4232-bba0-a1bc3e3ccc65","kind":"MEASUREMENT","label":"L07 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"b0b9a542-83d4-4f7a-a140-88a75d4274e5","observation_id":"08f390d9-5939-41c4-bbce-1b7465a2f0eb","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3","volume_cm3":0.0},"target_id":"08f390d9-5939-41c4-bbce-1b7465a2f0eb","target_table":"lesion_observations"},{"id":"ced58fa9-67c2-4024-9b1f-5737b70d1b6e","kind":"SEGMENTATION","label":"Segmented enhancing for L07","locator":{"lesion_id":"b0b9a542-83d4-4f7a-a140-88a75d4274e5","observation_id":"08f390d9-5939-41c4-bbce-1b7465a2f0eb","study_id":"33bf232d-ced9-495b-9152-eb6d149877d3"},"target_id":"08f390d9-5939-41c4-bbce-1b7465a2f0eb","target_table":"lesion_observations"},{"id":"8bd14c14-f19d-49af-a997-da8792a3c730","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"02502ba4-5660-47b5-bffa-2670a34dfe7b","timepoint":"preoperative"},"target_id":"02502ba4-5660-47b5-bffa-2670a34dfe7b","target_table":"studies"}],"id":"86e90d75-a2aa-4190-8c1a-730fffaaafd1","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","quality flag on input: MATCH_UNCERTAIN","quality flag on input: NO_OVERLAP","quality flag on input: WEAK_SCORE","quality flag on input: AMBIGUOUS_ALTERNATIVE","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/69ea08eb-e7e9-4728-b9f5-4eaeac564c4a.json b/api/ai-observations/69ea08eb-e7e9-4728-b9f5-4eaeac564c4a.json new file mode 100644 index 0000000000000000000000000000000000000000..5b74a7c531fabe8ec4b193442ebd6049853400aa --- /dev/null +++ b/api/ai-observations/69ea08eb-e7e9-4728-b9f5-4eaeac564c4a.json @@ -0,0 +1 @@ +[{"answer_text":"No measured enhancing volume changed by more than 25%. 2 lesions had no prior to compare against: L04 measures 42.5 mm\u00b3 (first measurement, no prior to compare); L05 measures 0.0 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:44.892398Z","evidence_items":[{"id":"f7c0b583-617d-428b-87a8-962f764d939c","kind":"MEASUREMENT","label":"L04 volume 0.04 cm\u00b3 at recurrence","locator":{"lesion_id":"dd0a01aa-e7be-4e11-a311-d739d7d7d145","observation_id":"7df2ea7d-4d19-4a9c-a777-f990d2fee36e","study_id":"c729590a-bb92-4893-8505-76eda6bb4cca","volume_cm3":0.04},"target_id":"7df2ea7d-4d19-4a9c-a777-f990d2fee36e","target_table":"lesion_observations"},{"id":"8d31bacd-e2a1-4370-a927-b88161f6a89c","kind":"SEGMENTATION","label":"Segmented enhancing for L04","locator":{"lesion_id":"dd0a01aa-e7be-4e11-a311-d739d7d7d145","observation_id":"7df2ea7d-4d19-4a9c-a777-f990d2fee36e","study_id":"c729590a-bb92-4893-8505-76eda6bb4cca"},"target_id":"7df2ea7d-4d19-4a9c-a777-f990d2fee36e","target_table":"lesion_observations"},{"id":"89b7e1f4-0318-4cc1-a362-f8eed69a988a","kind":"MEASUREMENT","label":"L05 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"c331e61d-1fae-40bb-b9ae-6da8319967c5","observation_id":"bc9d39bf-45e9-499d-aea5-4bb4222cec27","study_id":"c729590a-bb92-4893-8505-76eda6bb4cca","volume_cm3":0.0},"target_id":"bc9d39bf-45e9-499d-aea5-4bb4222cec27","target_table":"lesion_observations"},{"id":"0e6f01cf-d939-4309-b100-bbca10f09a24","kind":"SEGMENTATION","label":"Segmented enhancing for L05","locator":{"lesion_id":"c331e61d-1fae-40bb-b9ae-6da8319967c5","observation_id":"bc9d39bf-45e9-499d-aea5-4bb4222cec27","study_id":"c729590a-bb92-4893-8505-76eda6bb4cca"},"target_id":"bc9d39bf-45e9-499d-aea5-4bb4222cec27","target_table":"lesion_observations"}],"id":"206bbbbe-696b-45cf-b1fa-33645e0b379d","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/6bc843a9-e804-46d5-9d7d-d387a1f9c1ed.json b/api/ai-observations/6bc843a9-e804-46d5-9d7d-d387a1f9c1ed.json new file mode 100644 index 0000000000000000000000000000000000000000..eaf63656e84495acaeaf080190c7c0931cdea56f --- /dev/null +++ b/api/ai-observations/6bc843a9-e804-46d5-9d7d-d387a1f9c1ed.json @@ -0,0 +1 @@ +[{"answer_text":"No measured enhancing volume changed by more than 25%. 2 lesions had no prior to compare against: L02 measures 2.0 mm\u00b3 (first measurement, no prior to compare); L03 measures 1.3 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:40.286927Z","evidence_items":[{"id":"b977813c-7ef9-42c1-bd12-ac757acba5a6","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"9aa400db-54e2-4d2e-a7f9-06b4c41d3937","observation_id":"5d5601fc-ebd8-47dc-947d-d4eca18545cf","study_id":"7c494e6b-eaed-4929-8b88-442a9714b660","volume_cm3":0.0},"target_id":"5d5601fc-ebd8-47dc-947d-d4eca18545cf","target_table":"lesion_observations"},{"id":"be699f33-0f30-49f9-8ad5-07f33fec7fb2","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"9aa400db-54e2-4d2e-a7f9-06b4c41d3937","observation_id":"5d5601fc-ebd8-47dc-947d-d4eca18545cf","study_id":"7c494e6b-eaed-4929-8b88-442a9714b660"},"target_id":"5d5601fc-ebd8-47dc-947d-d4eca18545cf","target_table":"lesion_observations"},{"id":"10f3fd40-d707-4dc4-9af4-62566232a4ed","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"c9281a8d-12ad-4748-ba43-3c0ab8b35806","observation_id":"4c6e65b4-a201-4d0a-9ee0-03cd6709089b","study_id":"7c494e6b-eaed-4929-8b88-442a9714b660","volume_cm3":0.0},"target_id":"4c6e65b4-a201-4d0a-9ee0-03cd6709089b","target_table":"lesion_observations"},{"id":"fd71c79b-ff3e-4205-86b1-f0c7c8d5bedb","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"c9281a8d-12ad-4748-ba43-3c0ab8b35806","observation_id":"4c6e65b4-a201-4d0a-9ee0-03cd6709089b","study_id":"7c494e6b-eaed-4929-8b88-442a9714b660"},"target_id":"4c6e65b4-a201-4d0a-9ee0-03cd6709089b","target_table":"lesion_observations"}],"id":"ce905af8-2233-448d-8b7e-b6dbd122829d","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/75835d9b-32d4-4c9a-8cf9-8f57b066084b.json b/api/ai-observations/75835d9b-32d4-4c9a-8cf9-8f57b066084b.json new file mode 100644 index 0000000000000000000000000000000000000000..e850b26eb3aa86c44b3cadc8493f4bc96e46b97b --- /dev/null +++ b/api/ai-observations/75835d9b-32d4-4c9a-8cf9-8f57b066084b.json @@ -0,0 +1 @@ +[{"answer_text":"No lesion was measured within 25% of its previous enhancing volume at recurrence. All 1 lesion with a measured change moved by more than that: L01 measures 26.4 mm\u00b3, increased by 152.1% (15.9 mm\u00b3). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:41.235206Z","evidence_items":[{"id":"a33ab521-d8d4-421b-af5d-b148b96a5b8c","kind":"MEASUREMENT","label":"L01 volume 0.03 cm\u00b3 at recurrence","locator":{"lesion_id":"165ea25a-db3b-4a83-acd8-bc7a15fde834","observation_id":"021641b9-4821-4496-82ec-bf819d0f2b62","study_id":"06f843bf-75d5-45a7-8630-56ea34a8acc0","volume_cm3":0.03},"target_id":"021641b9-4821-4496-82ec-bf819d0f2b62","target_table":"lesion_observations"},{"id":"2951410b-c790-4438-853e-15e1ee078025","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"165ea25a-db3b-4a83-acd8-bc7a15fde834","observation_id":"021641b9-4821-4496-82ec-bf819d0f2b62","study_id":"06f843bf-75d5-45a7-8630-56ea34a8acc0"},"target_id":"021641b9-4821-4496-82ec-bf819d0f2b62","target_table":"lesion_observations"}],"id":"8bd58274-84f2-4b11-bd36-a869c556731c","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_REMAINED_STABLE","question_text":"What remained stable?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest total measured enhancing volume change was recorded at recurrence, 15.9 mm\u00b3 summed across 1 lesion, 362 days after the study it is compared with. Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:41.176043Z","evidence_items":[{"id":"f91a963b-892d-453d-87e5-4eead27020e7","kind":"MEASUREMENT","label":"L01 volume 0.03 cm\u00b3 at recurrence","locator":{"lesion_id":"165ea25a-db3b-4a83-acd8-bc7a15fde834","observation_id":"021641b9-4821-4496-82ec-bf819d0f2b62","study_id":"06f843bf-75d5-45a7-8630-56ea34a8acc0","volume_cm3":0.03},"target_id":"021641b9-4821-4496-82ec-bf819d0f2b62","target_table":"lesion_observations"},{"id":"d0933ff0-f27f-4510-9f3e-1d895c4bfe3e","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"165ea25a-db3b-4a83-acd8-bc7a15fde834","observation_id":"021641b9-4821-4496-82ec-bf819d0f2b62","study_id":"06f843bf-75d5-45a7-8630-56ea34a8acc0"},"target_id":"021641b9-4821-4496-82ec-bf819d0f2b62","target_table":"lesion_observations"}],"id":"d7a12bfc-15d9-482b-84f9-3572184f6240","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest measured enhancing volume change is L01 measures 26.4 mm\u00b3, increased by 152.1% (15.9 mm\u00b3) at recurrence, compared against preoperative. This is the largest of 1 measured change across the timeline. Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:41.126637Z","evidence_items":[{"id":"8c04e639-e47d-4aca-92e6-fc98d126f5ac","kind":"MEASUREMENT","label":"L01 volume 0.03 cm\u00b3 at recurrence","locator":{"lesion_id":"165ea25a-db3b-4a83-acd8-bc7a15fde834","observation_id":"021641b9-4821-4496-82ec-bf819d0f2b62","study_id":"06f843bf-75d5-45a7-8630-56ea34a8acc0","volume_cm3":0.03},"target_id":"021641b9-4821-4496-82ec-bf819d0f2b62","target_table":"lesion_observations"},{"id":"f2001d10-c495-41da-a739-25b8be21705a","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"165ea25a-db3b-4a83-acd8-bc7a15fde834","observation_id":"021641b9-4821-4496-82ec-bf819d0f2b62","study_id":"06f843bf-75d5-45a7-8630-56ea34a8acc0"},"target_id":"021641b9-4821-4496-82ec-bf819d0f2b62","target_table":"lesion_observations"},{"id":"824cff4b-17b3-4220-8b7d-c3778ac7b7c0","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"784f8c9d-23b0-4cd1-acf6-b78107faef67","timepoint":"preoperative"},"target_id":"784f8c9d-23b0-4cd1-acf6-b78107faef67","target_table":"studies"}],"id":"d98da64f-59e4-43db-96e1-dc49a739bbec","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"Measured enhancing volume changed by more than 25% for 1 lesion between preoperative and recurrence, 362 days apart: L01 measures 26.4 mm\u00b3, increased by 152.1% (15.9 mm\u00b3). 1 lesion had no prior to compare against: L02 measures 0.8 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:40.979141Z","evidence_items":[{"id":"59898afa-e813-4383-a80d-1a0c5625b9f5","kind":"MEASUREMENT","label":"L01 volume 0.03 cm\u00b3 at recurrence","locator":{"lesion_id":"165ea25a-db3b-4a83-acd8-bc7a15fde834","observation_id":"021641b9-4821-4496-82ec-bf819d0f2b62","study_id":"06f843bf-75d5-45a7-8630-56ea34a8acc0","volume_cm3":0.03},"target_id":"021641b9-4821-4496-82ec-bf819d0f2b62","target_table":"lesion_observations"},{"id":"e9c75655-bf4d-4b37-9d9b-7d3b30a23062","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"165ea25a-db3b-4a83-acd8-bc7a15fde834","observation_id":"021641b9-4821-4496-82ec-bf819d0f2b62","study_id":"06f843bf-75d5-45a7-8630-56ea34a8acc0"},"target_id":"021641b9-4821-4496-82ec-bf819d0f2b62","target_table":"lesion_observations"},{"id":"e32a449a-9cff-419f-9a90-2fbf1ba8f56a","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"a2ea2a2e-c404-4a7f-b8dd-68a2110e6bcd","observation_id":"848b8524-81c7-4874-a36f-e6e07cd2327a","study_id":"06f843bf-75d5-45a7-8630-56ea34a8acc0","volume_cm3":0.0},"target_id":"848b8524-81c7-4874-a36f-e6e07cd2327a","target_table":"lesion_observations"},{"id":"7734f412-aabe-4bc2-bb62-694c58ddced6","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"a2ea2a2e-c404-4a7f-b8dd-68a2110e6bcd","observation_id":"848b8524-81c7-4874-a36f-e6e07cd2327a","study_id":"06f843bf-75d5-45a7-8630-56ea34a8acc0"},"target_id":"848b8524-81c7-4874-a36f-e6e07cd2327a","target_table":"lesion_observations"},{"id":"37f8e5e5-73ad-4786-8ae4-1b316567a648","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"784f8c9d-23b0-4cd1-acf6-b78107faef67","timepoint":"preoperative"},"target_id":"784f8c9d-23b0-4cd1-acf6-b78107faef67","target_table":"studies"}],"id":"9c89db64-2269-41d2-bb1a-c4399d611d05","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/8180e98b-ffa6-4f09-b73b-b35f9937a765.json b/api/ai-observations/8180e98b-ffa6-4f09-b73b-b35f9937a765.json new file mode 100644 index 0000000000000000000000000000000000000000..111e979045eeb597fd094a052bb892bb69ba8c40 --- /dev/null +++ b/api/ai-observations/8180e98b-ffa6-4f09-b73b-b35f9937a765.json @@ -0,0 +1 @@ +[{"answer_text":"No measured enhancing volume changed by more than 25%. 1 lesion had no prior to compare against: L02 measures 1.0 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:40.770299Z","evidence_items":[{"id":"9021611b-faa1-4c58-9069-a08d09d579c3","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"cf0da9b7-53f8-43f3-b091-c40fbc9ea553","observation_id":"d786fabb-8218-4a5f-be79-b6b4f38111ff","study_id":"0cd019eb-859f-4687-8c74-fa0b7a36e4e4","volume_cm3":0.0},"target_id":"d786fabb-8218-4a5f-be79-b6b4f38111ff","target_table":"lesion_observations"},{"id":"59a36d31-c9d6-4f4d-8da3-54afdbd330a1","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"cf0da9b7-53f8-43f3-b091-c40fbc9ea553","observation_id":"d786fabb-8218-4a5f-be79-b6b4f38111ff","study_id":"0cd019eb-859f-4687-8c74-fa0b7a36e4e4"},"target_id":"d786fabb-8218-4a5f-be79-b6b4f38111ff","target_table":"lesion_observations"}],"id":"2233d336-ab63-47d3-b296-075233cd7624","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/8280c78d-5068-4b5a-ac27-d33c0839b167.json b/api/ai-observations/8280c78d-5068-4b5a-ac27-d33c0839b167.json new file mode 100644 index 0000000000000000000000000000000000000000..8491629c0490429a739de0bf7dcd622fd9141ff7 --- /dev/null +++ b/api/ai-observations/8280c78d-5068-4b5a-ac27-d33c0839b167.json @@ -0,0 +1 @@ +[{"answer_text":"No lesion was measured within 25% of its previous enhancing volume at recurrence. All 1 lesion with a measured change moved by more than that: L01 measures 16.5 mm\u00b3, increased by 134.0% (9.4 mm\u00b3). Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:44.489353Z","evidence_items":[{"id":"94961e82-91a9-4c29-a068-5c9a4cb98d78","kind":"MEASUREMENT","label":"L01 volume 0.02 cm\u00b3 at recurrence","locator":{"lesion_id":"95ef6d84-68c0-4894-8088-0b57f5cff3d0","observation_id":"aaab74e0-fcbe-4e21-841b-c872e1f8ee80","study_id":"f365b21e-4d53-4d15-9135-8dd0ea65a1ab","volume_cm3":0.02},"target_id":"aaab74e0-fcbe-4e21-841b-c872e1f8ee80","target_table":"lesion_observations"},{"id":"6e37bb65-6476-4435-8e94-6644b110f5f2","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"95ef6d84-68c0-4894-8088-0b57f5cff3d0","observation_id":"aaab74e0-fcbe-4e21-841b-c872e1f8ee80","study_id":"f365b21e-4d53-4d15-9135-8dd0ea65a1ab"},"target_id":"aaab74e0-fcbe-4e21-841b-c872e1f8ee80","target_table":"lesion_observations"}],"id":"040d6779-2750-4bf2-9d15-3aede37cec85","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_REMAINED_STABLE","question_text":"What remained stable?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest total measured enhancing volume change was recorded at recurrence, 9.4 mm\u00b3 summed across 1 lesion, 391 days after the study it is compared with. Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:44.429928Z","evidence_items":[{"id":"e3a619f8-b04a-4e3a-b0ab-b263f16856fc","kind":"MEASUREMENT","label":"L01 volume 0.02 cm\u00b3 at recurrence","locator":{"lesion_id":"95ef6d84-68c0-4894-8088-0b57f5cff3d0","observation_id":"aaab74e0-fcbe-4e21-841b-c872e1f8ee80","study_id":"f365b21e-4d53-4d15-9135-8dd0ea65a1ab","volume_cm3":0.02},"target_id":"aaab74e0-fcbe-4e21-841b-c872e1f8ee80","target_table":"lesion_observations"},{"id":"d4cc44c3-5efd-4ef4-a93f-8c2f65c4f38c","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"95ef6d84-68c0-4894-8088-0b57f5cff3d0","observation_id":"aaab74e0-fcbe-4e21-841b-c872e1f8ee80","study_id":"f365b21e-4d53-4d15-9135-8dd0ea65a1ab"},"target_id":"aaab74e0-fcbe-4e21-841b-c872e1f8ee80","target_table":"lesion_observations"}],"id":"f53d8c70-5e99-4163-a42d-3a4799313fbd","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest measured enhancing volume change is L01 measures 16.5 mm\u00b3, increased by 134.0% (9.4 mm\u00b3) at recurrence, compared against preoperative. This is the largest of 1 measured change across the timeline. Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:44.352888Z","evidence_items":[{"id":"94f8f3ee-bf06-4716-b11c-e439c5d64a17","kind":"MEASUREMENT","label":"L01 volume 0.02 cm\u00b3 at recurrence","locator":{"lesion_id":"95ef6d84-68c0-4894-8088-0b57f5cff3d0","observation_id":"aaab74e0-fcbe-4e21-841b-c872e1f8ee80","study_id":"f365b21e-4d53-4d15-9135-8dd0ea65a1ab","volume_cm3":0.02},"target_id":"aaab74e0-fcbe-4e21-841b-c872e1f8ee80","target_table":"lesion_observations"},{"id":"2c8e633c-167f-47a2-8b51-46e16a90bade","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"95ef6d84-68c0-4894-8088-0b57f5cff3d0","observation_id":"aaab74e0-fcbe-4e21-841b-c872e1f8ee80","study_id":"f365b21e-4d53-4d15-9135-8dd0ea65a1ab"},"target_id":"aaab74e0-fcbe-4e21-841b-c872e1f8ee80","target_table":"lesion_observations"},{"id":"7270096f-b3d4-4a70-804f-ae7d3a343f05","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"059c5744-67cd-40d2-8d09-a44ccb563c16","timepoint":"preoperative"},"target_id":"059c5744-67cd-40d2-8d09-a44ccb563c16","target_table":"studies"}],"id":"c29c631c-1210-427b-afa8-08356d4ced92","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"Measured enhancing volume changed by more than 25% for 1 lesion between preoperative and recurrence, 391 days apart: L01 measures 16.5 mm\u00b3, increased by 134.0% (9.4 mm\u00b3). Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:44.292076Z","evidence_items":[{"id":"bab452a0-e6a2-4418-b2f2-646812911497","kind":"MEASUREMENT","label":"L01 volume 0.02 cm\u00b3 at recurrence","locator":{"lesion_id":"95ef6d84-68c0-4894-8088-0b57f5cff3d0","observation_id":"aaab74e0-fcbe-4e21-841b-c872e1f8ee80","study_id":"f365b21e-4d53-4d15-9135-8dd0ea65a1ab","volume_cm3":0.02},"target_id":"aaab74e0-fcbe-4e21-841b-c872e1f8ee80","target_table":"lesion_observations"},{"id":"10ca1f68-da73-41cc-9dac-9695bf66ecfb","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"95ef6d84-68c0-4894-8088-0b57f5cff3d0","observation_id":"aaab74e0-fcbe-4e21-841b-c872e1f8ee80","study_id":"f365b21e-4d53-4d15-9135-8dd0ea65a1ab"},"target_id":"aaab74e0-fcbe-4e21-841b-c872e1f8ee80","target_table":"lesion_observations"},{"id":"d60e58c4-f393-4a75-ad44-13046d53d239","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"059c5744-67cd-40d2-8d09-a44ccb563c16","timepoint":"preoperative"},"target_id":"059c5744-67cd-40d2-8d09-a44ccb563c16","target_table":"studies"}],"id":"73633e82-1fa2-4926-8a75-25ac722e0531","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/904c26dc-10ec-4454-9767-9758b9dc9789.json b/api/ai-observations/904c26dc-10ec-4454-9767-9758b9dc9789.json new file mode 100644 index 0000000000000000000000000000000000000000..ec5eb86f5cbdb70db707a70ccc0628db6c7f3ad8 --- /dev/null +++ b/api/ai-observations/904c26dc-10ec-4454-9767-9758b9dc9789.json @@ -0,0 +1 @@ +[{"answer_text":"No measured enhancing volume changed by more than 25%. 2 lesions had no prior to compare against: L02 measures 4.9 mm\u00b3 (first measurement, no prior to compare); L03 measures 0.1 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:42.576024Z","evidence_items":[{"id":"408899a1-5bc7-40c8-8f96-0cde63c47d69","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"09a85cf9-a029-4376-8334-6ae0d1a35480","observation_id":"827e22cb-4a22-4e15-9852-24a3f404b47c","study_id":"4f456804-060e-47f1-a54b-c714bfcf58dc","volume_cm3":0.0},"target_id":"827e22cb-4a22-4e15-9852-24a3f404b47c","target_table":"lesion_observations"},{"id":"a66921f8-2caa-4bf5-a01f-1da0c06f5c63","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"09a85cf9-a029-4376-8334-6ae0d1a35480","observation_id":"827e22cb-4a22-4e15-9852-24a3f404b47c","study_id":"4f456804-060e-47f1-a54b-c714bfcf58dc"},"target_id":"827e22cb-4a22-4e15-9852-24a3f404b47c","target_table":"lesion_observations"},{"id":"50b1cf78-a511-4c53-930f-10f6dd574458","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"8d35e81b-2245-42dc-80ba-d1dab4b5d2f7","observation_id":"7552b89e-12cb-4686-ab59-f97007c07add","study_id":"4f456804-060e-47f1-a54b-c714bfcf58dc","volume_cm3":0.0},"target_id":"7552b89e-12cb-4686-ab59-f97007c07add","target_table":"lesion_observations"},{"id":"fe1c4880-1f11-4592-8243-a95499e2bd18","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"8d35e81b-2245-42dc-80ba-d1dab4b5d2f7","observation_id":"7552b89e-12cb-4686-ab59-f97007c07add","study_id":"4f456804-060e-47f1-a54b-c714bfcf58dc"},"target_id":"7552b89e-12cb-4686-ab59-f97007c07add","target_table":"lesion_observations"}],"id":"f350d901-f312-428f-ac5b-f1896693ec00","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/92f0ea5a-eacc-42a8-a3c6-2345fc9e3722.json b/api/ai-observations/92f0ea5a-eacc-42a8-a3c6-2345fc9e3722.json new file mode 100644 index 0000000000000000000000000000000000000000..3d560b054bed821a50c881fcf2e80ef4f9c7166c --- /dev/null +++ b/api/ai-observations/92f0ea5a-eacc-42a8-a3c6-2345fc9e3722.json @@ -0,0 +1 @@ +[{"answer_text":"No lesion was measured within 25% of its previous enhancing volume at recurrence. All 1 lesion with a measured change moved by more than that: L01 measures 3.8 mm\u00b3, decreased by 56.7% (5.0 mm\u00b3). Confidence 0.80; the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:42.482993Z","evidence_items":[{"id":"a5ff6a3a-dd73-4d4f-b750-558ad33bcc75","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"ca3ba1e6-3596-40f6-9abe-40464e930a65","observation_id":"8c50a36f-55c3-4c9b-bd90-cdccd0e3e95b","study_id":"e983db6d-bead-4dc5-9d63-ac653445414d","volume_cm3":0.0},"target_id":"8c50a36f-55c3-4c9b-bd90-cdccd0e3e95b","target_table":"lesion_observations"},{"id":"b7e9861e-5840-444b-9ae2-7c81fa8c1011","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"ca3ba1e6-3596-40f6-9abe-40464e930a65","observation_id":"8c50a36f-55c3-4c9b-bd90-cdccd0e3e95b","study_id":"e983db6d-bead-4dc5-9d63-ac653445414d"},"target_id":"8c50a36f-55c3-4c9b-bd90-cdccd0e3e95b","target_table":"lesion_observations"}],"id":"b901ca30-e5e7-4652-a37d-0dbd9d77add9","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_REMAINED_STABLE","question_text":"What remained stable?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest total measured enhancing volume change was recorded at recurrence, 5.0 mm\u00b3 summed across 1 lesion, 60 days after the study it is compared with. Confidence 0.80; the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:42.428424Z","evidence_items":[{"id":"433d6d91-d08c-4bd7-adb7-746d3a95c47a","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"ca3ba1e6-3596-40f6-9abe-40464e930a65","observation_id":"8c50a36f-55c3-4c9b-bd90-cdccd0e3e95b","study_id":"e983db6d-bead-4dc5-9d63-ac653445414d","volume_cm3":0.0},"target_id":"8c50a36f-55c3-4c9b-bd90-cdccd0e3e95b","target_table":"lesion_observations"},{"id":"ca3a4151-f41c-4347-8a71-1634cfcf42f1","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"ca3ba1e6-3596-40f6-9abe-40464e930a65","observation_id":"8c50a36f-55c3-4c9b-bd90-cdccd0e3e95b","study_id":"e983db6d-bead-4dc5-9d63-ac653445414d"},"target_id":"8c50a36f-55c3-4c9b-bd90-cdccd0e3e95b","target_table":"lesion_observations"}],"id":"7a0439ed-ab04-4580-9303-70d9b4b81c2a","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest measured enhancing volume change is L01 measures 3.8 mm\u00b3, decreased by 56.7% (5.0 mm\u00b3) at recurrence, compared against preoperative. This is the largest of 1 measured change across the timeline. Confidence 0.80; the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:42.365086Z","evidence_items":[{"id":"50a5749a-8200-4eb6-a2e3-a1a40ad48280","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"ca3ba1e6-3596-40f6-9abe-40464e930a65","observation_id":"8c50a36f-55c3-4c9b-bd90-cdccd0e3e95b","study_id":"e983db6d-bead-4dc5-9d63-ac653445414d","volume_cm3":0.0},"target_id":"8c50a36f-55c3-4c9b-bd90-cdccd0e3e95b","target_table":"lesion_observations"},{"id":"39d0fd43-439d-4270-8aef-6c725276295e","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"ca3ba1e6-3596-40f6-9abe-40464e930a65","observation_id":"8c50a36f-55c3-4c9b-bd90-cdccd0e3e95b","study_id":"e983db6d-bead-4dc5-9d63-ac653445414d"},"target_id":"8c50a36f-55c3-4c9b-bd90-cdccd0e3e95b","target_table":"lesion_observations"},{"id":"70f10a24-6a09-443f-a5b9-ed400b5e3ffd","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"c7fe339f-f3c9-411e-b9a7-a902b5b6fc3c","timepoint":"preoperative"},"target_id":"c7fe339f-f3c9-411e-b9a7-a902b5b6fc3c","target_table":"studies"}],"id":"6e1dcb37-a40c-469d-9adb-fa0112200a22","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"Measured enhancing volume changed by more than 25% for 1 lesion between preoperative and recurrence, 60 days apart: L01 measures 3.8 mm\u00b3, decreased by 56.7% (5.0 mm\u00b3). Confidence 0.80; the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:42.304751Z","evidence_items":[{"id":"1b63688a-7561-468e-a3c9-384430f2ada5","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"ca3ba1e6-3596-40f6-9abe-40464e930a65","observation_id":"8c50a36f-55c3-4c9b-bd90-cdccd0e3e95b","study_id":"e983db6d-bead-4dc5-9d63-ac653445414d","volume_cm3":0.0},"target_id":"8c50a36f-55c3-4c9b-bd90-cdccd0e3e95b","target_table":"lesion_observations"},{"id":"ae619843-bd7d-44fb-ad30-7f58f44a6bc7","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"ca3ba1e6-3596-40f6-9abe-40464e930a65","observation_id":"8c50a36f-55c3-4c9b-bd90-cdccd0e3e95b","study_id":"e983db6d-bead-4dc5-9d63-ac653445414d"},"target_id":"8c50a36f-55c3-4c9b-bd90-cdccd0e3e95b","target_table":"lesion_observations"},{"id":"e9f065b0-01c3-421d-9883-9fa923b2358f","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"c7fe339f-f3c9-411e-b9a7-a902b5b6fc3c","timepoint":"preoperative"},"target_id":"c7fe339f-f3c9-411e-b9a7-a902b5b6fc3c","target_table":"studies"}],"id":"fc63d491-1411-43cd-9162-c0c9010b2862","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/9bf9a4c8-66f6-470a-a03a-e425c4f5f438.json b/api/ai-observations/9bf9a4c8-66f6-470a-a03a-e425c4f5f438.json new file mode 100644 index 0000000000000000000000000000000000000000..00da6d57ef9ca679ef771a2bc299ecba88c4aed6 --- /dev/null +++ b/api/ai-observations/9bf9a4c8-66f6-470a-a03a-e425c4f5f438.json @@ -0,0 +1 @@ +[{"answer_text":"No measured enhancing volume changed by more than 25%. 3 lesions had no prior to compare against: L06 measures 7.8 mm\u00b3 (first measurement, no prior to compare); L07 measures 1.0 mm\u00b3 (first measurement, no prior to compare); L08 measures 0.8 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:43.168913Z","evidence_items":[{"id":"31648b4a-3068-40ab-b4db-fa4e1ec6abc6","kind":"MEASUREMENT","label":"L06 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"98c47e90-8ab0-40e5-9f24-f90bbf27c049","observation_id":"baf9222f-51c8-4120-8abb-41a77bd779ef","study_id":"ef3fc55e-bd5c-4431-ac8d-7b88ad2222ff","volume_cm3":0.01},"target_id":"baf9222f-51c8-4120-8abb-41a77bd779ef","target_table":"lesion_observations"},{"id":"96b8d5d1-a36c-4671-b05b-83d23994fc97","kind":"SEGMENTATION","label":"Segmented enhancing for L06","locator":{"lesion_id":"98c47e90-8ab0-40e5-9f24-f90bbf27c049","observation_id":"baf9222f-51c8-4120-8abb-41a77bd779ef","study_id":"ef3fc55e-bd5c-4431-ac8d-7b88ad2222ff"},"target_id":"baf9222f-51c8-4120-8abb-41a77bd779ef","target_table":"lesion_observations"},{"id":"fe8c9e8d-0619-4c5b-b893-3f83bedca3c7","kind":"MEASUREMENT","label":"L07 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"17717467-a021-445a-bbb5-ee7e89bc090a","observation_id":"b8f218f6-bd28-474a-ac98-a1fc31642d5b","study_id":"ef3fc55e-bd5c-4431-ac8d-7b88ad2222ff","volume_cm3":0.0},"target_id":"b8f218f6-bd28-474a-ac98-a1fc31642d5b","target_table":"lesion_observations"},{"id":"28490953-3dd7-465f-a340-61b77308b06a","kind":"SEGMENTATION","label":"Segmented enhancing for L07","locator":{"lesion_id":"17717467-a021-445a-bbb5-ee7e89bc090a","observation_id":"b8f218f6-bd28-474a-ac98-a1fc31642d5b","study_id":"ef3fc55e-bd5c-4431-ac8d-7b88ad2222ff"},"target_id":"b8f218f6-bd28-474a-ac98-a1fc31642d5b","target_table":"lesion_observations"},{"id":"df3051cb-e093-44fd-905c-6e39488976a5","kind":"MEASUREMENT","label":"L08 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"ef5d6bd9-5a5f-4ff3-a9aa-0a761086d8cb","observation_id":"0a760ffc-01ce-4526-ad35-2efabf975ab8","study_id":"ef3fc55e-bd5c-4431-ac8d-7b88ad2222ff","volume_cm3":0.0},"target_id":"0a760ffc-01ce-4526-ad35-2efabf975ab8","target_table":"lesion_observations"},{"id":"8a574714-a8b3-430c-a817-b9e5f77c8270","kind":"SEGMENTATION","label":"Segmented enhancing for L08","locator":{"lesion_id":"ef5d6bd9-5a5f-4ff3-a9aa-0a761086d8cb","observation_id":"0a760ffc-01ce-4526-ad35-2efabf975ab8","study_id":"ef3fc55e-bd5c-4431-ac8d-7b88ad2222ff"},"target_id":"0a760ffc-01ce-4526-ad35-2efabf975ab8","target_table":"lesion_observations"}],"id":"2f1a57aa-1513-4519-9ee6-4bbd875fc07a","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/a2cf6c6a-db6d-493a-9f48-ada357b32b83.json b/api/ai-observations/a2cf6c6a-db6d-493a-9f48-ada357b32b83.json new file mode 100644 index 0000000000000000000000000000000000000000..9556596f81359cae7a8b9f7ff6ef8a8d7b48c4ae --- /dev/null +++ b/api/ai-observations/a2cf6c6a-db6d-493a-9f48-ada357b32b83.json @@ -0,0 +1 @@ +[{"answer_text":"No lesion was measured within 25% of its previous enhancing volume at recurrence. All 1 lesion with a measured change moved by more than that: L02 measures 10.1 mm\u00b3, increased by 4415.7% (9.8 mm\u00b3). Confidence 0.80; the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.905485Z","evidence_items":[{"id":"50934884-4e32-4692-a7d0-50f82050673f","kind":"MEASUREMENT","label":"L02 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"fb7c8abf-469b-4034-9bbd-83d3789e5625","observation_id":"033a25be-40fd-471c-9d73-bd777a75a438","study_id":"76fe4d95-b610-42dc-8276-4caa3700a292","volume_cm3":0.01},"target_id":"033a25be-40fd-471c-9d73-bd777a75a438","target_table":"lesion_observations"},{"id":"8b0a1b15-7456-460a-a33a-e3ab81c7a4b9","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"fb7c8abf-469b-4034-9bbd-83d3789e5625","observation_id":"033a25be-40fd-471c-9d73-bd777a75a438","study_id":"76fe4d95-b610-42dc-8276-4caa3700a292"},"target_id":"033a25be-40fd-471c-9d73-bd777a75a438","target_table":"lesion_observations"}],"id":"6ae27fa2-94e5-4ba2-a4e9-6ca28121a5d4","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_REMAINED_STABLE","question_text":"What remained stable?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest total measured enhancing volume change was recorded at recurrence, 9.8 mm\u00b3 summed across 1 lesion, 467 days after the study it is compared with. Confidence 0.80; the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.826483Z","evidence_items":[{"id":"0bce4fb7-17e2-4781-a622-717b6412432f","kind":"MEASUREMENT","label":"L02 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"fb7c8abf-469b-4034-9bbd-83d3789e5625","observation_id":"033a25be-40fd-471c-9d73-bd777a75a438","study_id":"76fe4d95-b610-42dc-8276-4caa3700a292","volume_cm3":0.01},"target_id":"033a25be-40fd-471c-9d73-bd777a75a438","target_table":"lesion_observations"},{"id":"38b46b92-e276-4b58-b961-c291b73efcd4","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"fb7c8abf-469b-4034-9bbd-83d3789e5625","observation_id":"033a25be-40fd-471c-9d73-bd777a75a438","study_id":"76fe4d95-b610-42dc-8276-4caa3700a292"},"target_id":"033a25be-40fd-471c-9d73-bd777a75a438","target_table":"lesion_observations"}],"id":"a77bed87-c369-4552-a347-ce99b313fc93","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest measured enhancing volume change is L02 measures 10.1 mm\u00b3, increased by 4415.7% (9.8 mm\u00b3) at recurrence, compared against early-postoperative. This is the largest of 1 measured change across the timeline. Confidence 0.80; the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.754058Z","evidence_items":[{"id":"33ebf3a7-474f-4cb7-8704-87fb12d485c2","kind":"MEASUREMENT","label":"L02 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"fb7c8abf-469b-4034-9bbd-83d3789e5625","observation_id":"033a25be-40fd-471c-9d73-bd777a75a438","study_id":"76fe4d95-b610-42dc-8276-4caa3700a292","volume_cm3":0.01},"target_id":"033a25be-40fd-471c-9d73-bd777a75a438","target_table":"lesion_observations"},{"id":"a31e3502-7775-478a-a9ea-23d8ead23c87","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"fb7c8abf-469b-4034-9bbd-83d3789e5625","observation_id":"033a25be-40fd-471c-9d73-bd777a75a438","study_id":"76fe4d95-b610-42dc-8276-4caa3700a292"},"target_id":"033a25be-40fd-471c-9d73-bd777a75a438","target_table":"lesion_observations"},{"id":"b4f53c57-106e-470f-877b-6ede4e69efcb","kind":"PRIOR_STUDY","label":"Compared against early-postoperative","locator":{"study_id":"25404115-694f-41e1-8308-c135a6327bb1","timepoint":"early-postoperative"},"target_id":"25404115-694f-41e1-8308-c135a6327bb1","target_table":"studies"}],"id":"74914f03-eafe-403c-922f-ebb7ab2864ec","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"Measured enhancing volume changed by more than 25% for 1 lesion between early-postoperative and recurrence, 467 days apart: L02 measures 10.1 mm\u00b3, increased by 4415.7% (9.8 mm\u00b3). Confidence 0.80; the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.679985Z","evidence_items":[{"id":"c6840db0-0ec4-40a4-af63-0ded86b7661b","kind":"MEASUREMENT","label":"L02 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"fb7c8abf-469b-4034-9bbd-83d3789e5625","observation_id":"033a25be-40fd-471c-9d73-bd777a75a438","study_id":"76fe4d95-b610-42dc-8276-4caa3700a292","volume_cm3":0.01},"target_id":"033a25be-40fd-471c-9d73-bd777a75a438","target_table":"lesion_observations"},{"id":"1371e69b-8980-4032-8e2f-ca1d47c13d38","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"fb7c8abf-469b-4034-9bbd-83d3789e5625","observation_id":"033a25be-40fd-471c-9d73-bd777a75a438","study_id":"76fe4d95-b610-42dc-8276-4caa3700a292"},"target_id":"033a25be-40fd-471c-9d73-bd777a75a438","target_table":"lesion_observations"},{"id":"22403ad8-bad3-4c59-ab95-dd66ff9dfd2a","kind":"PRIOR_STUDY","label":"Compared against early-postoperative","locator":{"study_id":"25404115-694f-41e1-8308-c135a6327bb1","timepoint":"early-postoperative"},"target_id":"25404115-694f-41e1-8308-c135a6327bb1","target_table":"studies"}],"id":"1fa81c03-b350-46b4-854f-3aacdf686896","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/add7899e-4dcb-4587-9733-ec0a4068cfa5.json b/api/ai-observations/add7899e-4dcb-4587-9733-ec0a4068cfa5.json new file mode 100644 index 0000000000000000000000000000000000000000..82b8ee9307e576aa8e3157bef3b364e0289172d2 --- /dev/null +++ b/api/ai-observations/add7899e-4dcb-4587-9733-ec0a4068cfa5.json @@ -0,0 +1 @@ +[{"answer_text":"No measured enhancing volume changed by more than 25%. 6 lesions had no prior to compare against: L02 measures 3.5 mm\u00b3 (first measurement, no prior to compare); L03 measures 1.7 mm\u00b3 (first measurement, no prior to compare); L04 measures 0.3 mm\u00b3 (first measurement, no prior to compare); L05 measures 0.3 mm\u00b3 (first measurement, no prior to compare); L06 measures 0.3 mm\u00b3 (first measurement, no prior to compare); L07 measures 0.0 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:43.888045Z","evidence_items":[{"id":"8acbb6c2-3709-4a9e-9182-405a072f3688","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"7ac37554-b80a-425e-b0b9-b41e4ecdadc9","observation_id":"e8456990-9f64-4205-8827-2a4a37df74ed","study_id":"9a9a9127-57b3-48da-b89b-15b6f8981fd4","volume_cm3":0.0},"target_id":"e8456990-9f64-4205-8827-2a4a37df74ed","target_table":"lesion_observations"},{"id":"c1fef4db-bac0-4936-ade0-310daac0844f","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"7ac37554-b80a-425e-b0b9-b41e4ecdadc9","observation_id":"e8456990-9f64-4205-8827-2a4a37df74ed","study_id":"9a9a9127-57b3-48da-b89b-15b6f8981fd4"},"target_id":"e8456990-9f64-4205-8827-2a4a37df74ed","target_table":"lesion_observations"},{"id":"468a0554-8430-48f5-ad75-72dd9c2783c4","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"27037494-575c-496b-ad0a-0d6f89354fe2","observation_id":"d6c17e68-93f1-4690-8cec-1723ca1fb68c","study_id":"9a9a9127-57b3-48da-b89b-15b6f8981fd4","volume_cm3":0.0},"target_id":"d6c17e68-93f1-4690-8cec-1723ca1fb68c","target_table":"lesion_observations"},{"id":"5a3f68f4-3281-46b5-b875-82889066a191","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"27037494-575c-496b-ad0a-0d6f89354fe2","observation_id":"d6c17e68-93f1-4690-8cec-1723ca1fb68c","study_id":"9a9a9127-57b3-48da-b89b-15b6f8981fd4"},"target_id":"d6c17e68-93f1-4690-8cec-1723ca1fb68c","target_table":"lesion_observations"},{"id":"687f4843-c73e-4ec7-a633-0828682bab3a","kind":"MEASUREMENT","label":"L04 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"451b1221-74e3-4dcc-b0d0-156f751c12bc","observation_id":"faa922be-ace4-478e-91d2-041e422a785b","study_id":"9a9a9127-57b3-48da-b89b-15b6f8981fd4","volume_cm3":0.0},"target_id":"faa922be-ace4-478e-91d2-041e422a785b","target_table":"lesion_observations"},{"id":"7199a4dc-901a-4404-b69e-81cb072550a4","kind":"SEGMENTATION","label":"Segmented enhancing for L04","locator":{"lesion_id":"451b1221-74e3-4dcc-b0d0-156f751c12bc","observation_id":"faa922be-ace4-478e-91d2-041e422a785b","study_id":"9a9a9127-57b3-48da-b89b-15b6f8981fd4"},"target_id":"faa922be-ace4-478e-91d2-041e422a785b","target_table":"lesion_observations"},{"id":"48525729-8440-4b0f-b0de-be120c97b1da","kind":"MEASUREMENT","label":"L05 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"e5b5cf52-342f-4094-b169-4c89bf5e241c","observation_id":"be2ec907-98ab-4f91-b464-464bb6a29294","study_id":"9a9a9127-57b3-48da-b89b-15b6f8981fd4","volume_cm3":0.0},"target_id":"be2ec907-98ab-4f91-b464-464bb6a29294","target_table":"lesion_observations"},{"id":"3354e43d-ebd5-4ebd-9c48-91645e4d21de","kind":"SEGMENTATION","label":"Segmented enhancing for L05","locator":{"lesion_id":"e5b5cf52-342f-4094-b169-4c89bf5e241c","observation_id":"be2ec907-98ab-4f91-b464-464bb6a29294","study_id":"9a9a9127-57b3-48da-b89b-15b6f8981fd4"},"target_id":"be2ec907-98ab-4f91-b464-464bb6a29294","target_table":"lesion_observations"},{"id":"24519100-ebba-44d1-9561-f72f74c87cf0","kind":"MEASUREMENT","label":"L06 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"483969f7-9bb6-4259-906a-50292ffaecac","observation_id":"d5c728a4-e2e9-4dda-b327-0a61d4e27ca4","study_id":"9a9a9127-57b3-48da-b89b-15b6f8981fd4","volume_cm3":0.0},"target_id":"d5c728a4-e2e9-4dda-b327-0a61d4e27ca4","target_table":"lesion_observations"},{"id":"d40396d1-815d-47fc-8ce7-b220442280b1","kind":"SEGMENTATION","label":"Segmented enhancing for L06","locator":{"lesion_id":"483969f7-9bb6-4259-906a-50292ffaecac","observation_id":"d5c728a4-e2e9-4dda-b327-0a61d4e27ca4","study_id":"9a9a9127-57b3-48da-b89b-15b6f8981fd4"},"target_id":"d5c728a4-e2e9-4dda-b327-0a61d4e27ca4","target_table":"lesion_observations"},{"id":"57b47368-4a50-4ecb-8fe7-59c68925e911","kind":"MEASUREMENT","label":"L07 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"95fbd493-94aa-47ec-8e8b-b7125407d300","observation_id":"35561e56-c1f6-4427-b093-1b215c6fdcde","study_id":"9a9a9127-57b3-48da-b89b-15b6f8981fd4","volume_cm3":0.0},"target_id":"35561e56-c1f6-4427-b093-1b215c6fdcde","target_table":"lesion_observations"},{"id":"ac5503e9-18a6-4a78-94c8-438b021d4939","kind":"SEGMENTATION","label":"Segmented enhancing for L07","locator":{"lesion_id":"95fbd493-94aa-47ec-8e8b-b7125407d300","observation_id":"35561e56-c1f6-4427-b093-1b215c6fdcde","study_id":"9a9a9127-57b3-48da-b89b-15b6f8981fd4"},"target_id":"35561e56-c1f6-4427-b093-1b215c6fdcde","target_table":"lesion_observations"}],"id":"2fbaf565-d822-438c-b337-eec928a802d2","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/cd9672c3-d41d-42ee-8245-d0579bcafe2b.json b/api/ai-observations/cd9672c3-d41d-42ee-8245-d0579bcafe2b.json new file mode 100644 index 0000000000000000000000000000000000000000..d04d5cff39c5b33557cbeb82b4e66edbeb760a2f --- /dev/null +++ b/api/ai-observations/cd9672c3-d41d-42ee-8245-d0579bcafe2b.json @@ -0,0 +1 @@ +[{"answer_text":"No measured enhancing volume changed by more than 25%. 4 lesions had no prior to compare against: L05 measures 48.9 mm\u00b3 (first measurement, no prior to compare); L06 measures 28.9 mm\u00b3 (first measurement, no prior to compare); L07 measures 6.4 mm\u00b3 (first measurement, no prior to compare); L08 measures 0.2 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:46.076559Z","evidence_items":[{"id":"015494ec-156e-4498-8d5e-29317501bb0e","kind":"MEASUREMENT","label":"L05 volume 0.05 cm\u00b3 at recurrence","locator":{"lesion_id":"a031846c-90eb-479a-835b-041778046686","observation_id":"f47aebc9-0a0e-40f0-a5ee-cb58d4b05189","study_id":"3d314d09-a3c4-4ca8-be24-8d35bfcab419","volume_cm3":0.05},"target_id":"f47aebc9-0a0e-40f0-a5ee-cb58d4b05189","target_table":"lesion_observations"},{"id":"6386e782-1141-413e-b298-b1b95860f581","kind":"SEGMENTATION","label":"Segmented enhancing for L05","locator":{"lesion_id":"a031846c-90eb-479a-835b-041778046686","observation_id":"f47aebc9-0a0e-40f0-a5ee-cb58d4b05189","study_id":"3d314d09-a3c4-4ca8-be24-8d35bfcab419"},"target_id":"f47aebc9-0a0e-40f0-a5ee-cb58d4b05189","target_table":"lesion_observations"},{"id":"b1ccbd0d-d30f-4572-ba39-2bed8c6f1fb7","kind":"MEASUREMENT","label":"L06 volume 0.03 cm\u00b3 at recurrence","locator":{"lesion_id":"09a5b3c8-dd72-4947-9256-5f9c6de19e2a","observation_id":"c0a091cb-a715-4ba6-a665-94ec17cb26dd","study_id":"3d314d09-a3c4-4ca8-be24-8d35bfcab419","volume_cm3":0.03},"target_id":"c0a091cb-a715-4ba6-a665-94ec17cb26dd","target_table":"lesion_observations"},{"id":"7caf3aee-a6f0-4ae0-8ced-e50300c228d0","kind":"SEGMENTATION","label":"Segmented enhancing for L06","locator":{"lesion_id":"09a5b3c8-dd72-4947-9256-5f9c6de19e2a","observation_id":"c0a091cb-a715-4ba6-a665-94ec17cb26dd","study_id":"3d314d09-a3c4-4ca8-be24-8d35bfcab419"},"target_id":"c0a091cb-a715-4ba6-a665-94ec17cb26dd","target_table":"lesion_observations"},{"id":"be357bfd-285b-4093-ae7d-92f96160735a","kind":"MEASUREMENT","label":"L07 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"a487cbcc-f4a1-4c08-aaf0-42afe224b5b1","observation_id":"e56fad1e-1a5b-400c-95e3-e10d25eb9289","study_id":"3d314d09-a3c4-4ca8-be24-8d35bfcab419","volume_cm3":0.01},"target_id":"e56fad1e-1a5b-400c-95e3-e10d25eb9289","target_table":"lesion_observations"},{"id":"a568b21a-7f82-4bd1-aaad-ab85db26ecf4","kind":"SEGMENTATION","label":"Segmented enhancing for L07","locator":{"lesion_id":"a487cbcc-f4a1-4c08-aaf0-42afe224b5b1","observation_id":"e56fad1e-1a5b-400c-95e3-e10d25eb9289","study_id":"3d314d09-a3c4-4ca8-be24-8d35bfcab419"},"target_id":"e56fad1e-1a5b-400c-95e3-e10d25eb9289","target_table":"lesion_observations"},{"id":"2dbbcc70-8ea3-46df-996a-757688511825","kind":"MEASUREMENT","label":"L08 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"fd2b5e87-781b-45c7-a05b-82d6c00d6cc3","observation_id":"4c6a24ca-6697-4622-8895-aec0d555a3a6","study_id":"3d314d09-a3c4-4ca8-be24-8d35bfcab419","volume_cm3":0.0},"target_id":"4c6a24ca-6697-4622-8895-aec0d555a3a6","target_table":"lesion_observations"},{"id":"8cdb15b4-7341-4b25-994c-568edd69907b","kind":"SEGMENTATION","label":"Segmented enhancing for L08","locator":{"lesion_id":"fd2b5e87-781b-45c7-a05b-82d6c00d6cc3","observation_id":"4c6a24ca-6697-4622-8895-aec0d555a3a6","study_id":"3d314d09-a3c4-4ca8-be24-8d35bfcab419"},"target_id":"4c6a24ca-6697-4622-8895-aec0d555a3a6","target_table":"lesion_observations"}],"id":"fb5845f2-a143-45e2-8a12-e94b34fa0b74","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/d84b4c77-418f-4934-8b0b-257a47d73d31.json b/api/ai-observations/d84b4c77-418f-4934-8b0b-257a47d73d31.json new file mode 100644 index 0000000000000000000000000000000000000000..483117a0dd487e66600a7e5e2a81c1e7741b689e --- /dev/null +++ b/api/ai-observations/d84b4c77-418f-4934-8b0b-257a47d73d31.json @@ -0,0 +1 @@ +[{"answer_text":"No measured enhancing volume changed by more than 25%. 4 lesions had no prior to compare against: L02 measures 0.2 mm\u00b3 (first measurement, no prior to compare); L03 measures 0.1 mm\u00b3 (first measurement, no prior to compare); L04 measures 0.1 mm\u00b3 (first measurement, no prior to compare); L05 measures 0.0 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:45.578605Z","evidence_items":[{"id":"1807f635-f623-43c0-8ac8-d67b57f0ed5d","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"e07d6afc-76ac-4766-b7b8-ce480eb3b9df","observation_id":"95a93652-a03a-45c8-9067-ab4697a1bad7","study_id":"026d5991-8bf0-4f22-9be3-a427cd017cdb","volume_cm3":0.0},"target_id":"95a93652-a03a-45c8-9067-ab4697a1bad7","target_table":"lesion_observations"},{"id":"52def39b-ddc5-4bb8-b1d2-e96520cd71cb","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"e07d6afc-76ac-4766-b7b8-ce480eb3b9df","observation_id":"95a93652-a03a-45c8-9067-ab4697a1bad7","study_id":"026d5991-8bf0-4f22-9be3-a427cd017cdb"},"target_id":"95a93652-a03a-45c8-9067-ab4697a1bad7","target_table":"lesion_observations"},{"id":"13063e71-4729-4f94-b0f3-94bd77d76ebd","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"6b1974b8-8630-43ee-bc82-8fc2ca580294","observation_id":"60d99f82-d712-4fab-91dc-05d14d034748","study_id":"026d5991-8bf0-4f22-9be3-a427cd017cdb","volume_cm3":0.0},"target_id":"60d99f82-d712-4fab-91dc-05d14d034748","target_table":"lesion_observations"},{"id":"1e4a2eed-4f4a-420d-b77c-66333d11b915","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"6b1974b8-8630-43ee-bc82-8fc2ca580294","observation_id":"60d99f82-d712-4fab-91dc-05d14d034748","study_id":"026d5991-8bf0-4f22-9be3-a427cd017cdb"},"target_id":"60d99f82-d712-4fab-91dc-05d14d034748","target_table":"lesion_observations"},{"id":"ba039702-b795-4376-8af5-63e4ead61569","kind":"MEASUREMENT","label":"L04 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"203f528b-c344-4e83-9d2e-e2d7355bcb8b","observation_id":"1b6b878e-83a2-4a45-b04a-a0bc2a297b7a","study_id":"026d5991-8bf0-4f22-9be3-a427cd017cdb","volume_cm3":0.0},"target_id":"1b6b878e-83a2-4a45-b04a-a0bc2a297b7a","target_table":"lesion_observations"},{"id":"dea226c9-586f-4d47-8328-3b9e5686be38","kind":"SEGMENTATION","label":"Segmented enhancing for L04","locator":{"lesion_id":"203f528b-c344-4e83-9d2e-e2d7355bcb8b","observation_id":"1b6b878e-83a2-4a45-b04a-a0bc2a297b7a","study_id":"026d5991-8bf0-4f22-9be3-a427cd017cdb"},"target_id":"1b6b878e-83a2-4a45-b04a-a0bc2a297b7a","target_table":"lesion_observations"},{"id":"8b62b87f-7d19-4f0b-8faf-80068d24f3ae","kind":"MEASUREMENT","label":"L05 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"f6e95396-76f2-4ab0-935c-921ecfcb7a89","observation_id":"94dc070b-b7bc-4207-8248-b70eeb99c2b4","study_id":"026d5991-8bf0-4f22-9be3-a427cd017cdb","volume_cm3":0.0},"target_id":"94dc070b-b7bc-4207-8248-b70eeb99c2b4","target_table":"lesion_observations"},{"id":"2f259dcb-35c5-477d-834c-1ca6bb879a71","kind":"SEGMENTATION","label":"Segmented enhancing for L05","locator":{"lesion_id":"f6e95396-76f2-4ab0-935c-921ecfcb7a89","observation_id":"94dc070b-b7bc-4207-8248-b70eeb99c2b4","study_id":"026d5991-8bf0-4f22-9be3-a427cd017cdb"},"target_id":"94dc070b-b7bc-4207-8248-b70eeb99c2b4","target_table":"lesion_observations"}],"id":"0e28339b-a121-4280-b321-27bdf65fe085","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/e6fe336a-7b59-43a7-a419-3f01b51196bb.json b/api/ai-observations/e6fe336a-7b59-43a7-a419-3f01b51196bb.json new file mode 100644 index 0000000000000000000000000000000000000000..9ac29520a56ac18502d6ba82b4a14a4f791bfd9b --- /dev/null +++ b/api/ai-observations/e6fe336a-7b59-43a7-a419-3f01b51196bb.json @@ -0,0 +1 @@ +[{"answer_text":"No measured enhancing volume changed by more than 25%. 1 lesion had no prior to compare against: L02 measures 14.2 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:40.514164Z","evidence_items":[{"id":"69bb447b-6fb6-4b25-9f9a-a5136ee1ab61","kind":"MEASUREMENT","label":"L02 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"f27a46b9-1d99-491e-8a09-3a84cff67f83","observation_id":"4759776a-aa6b-484b-b264-0a311b75224c","study_id":"5b364a21-a771-4f24-b34f-648c56159bb3","volume_cm3":0.01},"target_id":"4759776a-aa6b-484b-b264-0a311b75224c","target_table":"lesion_observations"},{"id":"08924de7-c16d-4cf3-999c-9953cbf9bc6b","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"f27a46b9-1d99-491e-8a09-3a84cff67f83","observation_id":"4759776a-aa6b-484b-b264-0a311b75224c","study_id":"5b364a21-a771-4f24-b34f-648c56159bb3"},"target_id":"4759776a-aa6b-484b-b264-0a311b75224c","target_table":"lesion_observations"}],"id":"40fb80d4-0005-4775-9536-684457a66a61","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/ai-observations/eb1d080b-101f-45ce-8455-cf9f4967dd55.json b/api/ai-observations/eb1d080b-101f-45ce-8455-cf9f4967dd55.json new file mode 100644 index 0000000000000000000000000000000000000000..5f58b77e990d6e4cf00cb9fc0c4f96e4cf560c83 --- /dev/null +++ b/api/ai-observations/eb1d080b-101f-45ce-8455-cf9f4967dd55.json @@ -0,0 +1 @@ +[{"answer_text":"No lesion was measured within 25% of its previous enhancing volume at recurrence. All 1 lesion with a measured change moved by more than that: L01 measures 57.6 mm\u00b3, increased by 88.3% (27.0 mm\u00b3). Confidence 0.80; the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak, the interval between the two examinations is not recorded.","confidence":0.8,"created_at":"2026-08-18T22:19:38.845630Z","evidence_items":[{"id":"9bc43583-8ec5-4388-91ff-3f5f7bd28844","kind":"MEASUREMENT","label":"L01 volume 0.06 cm\u00b3 at recurrence","locator":{"lesion_id":"57e36cfa-78b5-4637-9243-9dc1b2c01be7","observation_id":"f5774d37-d5ce-4cdb-90d3-3e5201dd1e4d","study_id":"f55bdf14-0e4c-4ef4-8f7a-82d7f0e76bbc","volume_cm3":0.06},"target_id":"f5774d37-d5ce-4cdb-90d3-3e5201dd1e4d","target_table":"lesion_observations"},{"id":"824dbaad-167b-4705-a8b2-0cede2cce351","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"57e36cfa-78b5-4637-9243-9dc1b2c01be7","observation_id":"f5774d37-d5ce-4cdb-90d3-3e5201dd1e4d","study_id":"f55bdf14-0e4c-4ef4-8f7a-82d7f0e76bbc"},"target_id":"f5774d37-d5ce-4cdb-90d3-3e5201dd1e4d","target_table":"lesion_observations"}],"id":"b561de08-d609-4a15-8b5e-e054e8f8811d","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_REMAINED_STABLE","question_text":"What remained stable?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest total measured enhancing volume change was recorded at recurrence, 27.0 mm\u00b3 summed across 1 lesion, 650 days after the study it is compared with. Confidence 0.80; the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:38.787219Z","evidence_items":[{"id":"f7cd2f63-faa8-4f6f-9e71-fe690f23689e","kind":"MEASUREMENT","label":"L01 volume 0.06 cm\u00b3 at recurrence","locator":{"lesion_id":"57e36cfa-78b5-4637-9243-9dc1b2c01be7","observation_id":"f5774d37-d5ce-4cdb-90d3-3e5201dd1e4d","study_id":"f55bdf14-0e4c-4ef4-8f7a-82d7f0e76bbc","volume_cm3":0.06},"target_id":"f5774d37-d5ce-4cdb-90d3-3e5201dd1e4d","target_table":"lesion_observations"},{"id":"214d8810-49d3-478c-becf-8abf3643e6e7","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"57e36cfa-78b5-4637-9243-9dc1b2c01be7","observation_id":"f5774d37-d5ce-4cdb-90d3-3e5201dd1e4d","study_id":"f55bdf14-0e4c-4ef4-8f7a-82d7f0e76bbc"},"target_id":"f5774d37-d5ce-4cdb-90d3-3e5201dd1e4d","target_table":"lesion_observations"}],"id":"a25ffbdc-cc6f-49c4-a1bc-7e066bca7936","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"The largest measured enhancing volume change is L01 measures 57.6 mm\u00b3, increased by 88.3% (27.0 mm\u00b3) at recurrence, compared against preoperative. This is the largest of 1 measured change across the timeline. Confidence 0.80; the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:38.689764Z","evidence_items":[{"id":"7e5b5a27-ceaa-42ee-a105-eb9bef6c693a","kind":"MEASUREMENT","label":"L01 volume 0.06 cm\u00b3 at recurrence","locator":{"lesion_id":"57e36cfa-78b5-4637-9243-9dc1b2c01be7","observation_id":"f5774d37-d5ce-4cdb-90d3-3e5201dd1e4d","study_id":"f55bdf14-0e4c-4ef4-8f7a-82d7f0e76bbc","volume_cm3":0.06},"target_id":"f5774d37-d5ce-4cdb-90d3-3e5201dd1e4d","target_table":"lesion_observations"},{"id":"e5eb1bbe-d512-491f-b4b7-b04f821293eb","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"57e36cfa-78b5-4637-9243-9dc1b2c01be7","observation_id":"f5774d37-d5ce-4cdb-90d3-3e5201dd1e4d","study_id":"f55bdf14-0e4c-4ef4-8f7a-82d7f0e76bbc"},"target_id":"f5774d37-d5ce-4cdb-90d3-3e5201dd1e4d","target_table":"lesion_observations"},{"id":"ada7531d-eb9b-47f5-9eb1-eb12eb2498fc","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"169e9c49-2ef2-4c22-9245-3dc3ad32b545","timepoint":"preoperative"},"target_id":"169e9c49-2ef2-4c22-9245-3dc3ad32b545","target_table":"studies"}],"id":"4094adef-06b7-4fb3-8373-1cade4b63303","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"},{"answer_text":"Measured enhancing volume changed by more than 25% for 1 lesion between preoperative and recurrence, 650 days apart: L01 measures 57.6 mm\u00b3, increased by 88.3% (27.0 mm\u00b3). 1 lesion had no prior to compare against: L02 measures 0.2 mm\u00b3 (first measurement, no prior to compare). Confidence 0.80; the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak, the interval between the two examinations is not recorded.","confidence":0.8,"created_at":"2026-08-18T22:19:38.598572Z","evidence_items":[{"id":"279bc847-b259-4840-b493-26b4002a0cc2","kind":"MEASUREMENT","label":"L01 volume 0.06 cm\u00b3 at recurrence","locator":{"lesion_id":"57e36cfa-78b5-4637-9243-9dc1b2c01be7","observation_id":"f5774d37-d5ce-4cdb-90d3-3e5201dd1e4d","study_id":"f55bdf14-0e4c-4ef4-8f7a-82d7f0e76bbc","volume_cm3":0.06},"target_id":"f5774d37-d5ce-4cdb-90d3-3e5201dd1e4d","target_table":"lesion_observations"},{"id":"d1e929bd-3e4d-4712-b3d6-1a84500609b0","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"57e36cfa-78b5-4637-9243-9dc1b2c01be7","observation_id":"f5774d37-d5ce-4cdb-90d3-3e5201dd1e4d","study_id":"f55bdf14-0e4c-4ef4-8f7a-82d7f0e76bbc"},"target_id":"f5774d37-d5ce-4cdb-90d3-3e5201dd1e4d","target_table":"lesion_observations"},{"id":"7006639f-a5c9-4856-97fc-825653fb8b20","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"2b1bd605-c7d0-4ad4-95b1-c034bdfab6af","observation_id":"cf1feb8f-d34c-4b6a-a62f-d73966e8e5ce","study_id":"f55bdf14-0e4c-4ef4-8f7a-82d7f0e76bbc","volume_cm3":0.0},"target_id":"cf1feb8f-d34c-4b6a-a62f-d73966e8e5ce","target_table":"lesion_observations"},{"id":"2c8bf1e1-241c-4815-a81e-bf7c199c6de8","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"2b1bd605-c7d0-4ad4-95b1-c034bdfab6af","observation_id":"cf1feb8f-d34c-4b6a-a62f-d73966e8e5ce","study_id":"f55bdf14-0e4c-4ef4-8f7a-82d7f0e76bbc"},"target_id":"cf1feb8f-d34c-4b6a-a62f-d73966e8e5ce","target_table":"lesion_observations"},{"id":"888ec8c3-a5cd-4369-a580-f1def8d66430","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"169e9c49-2ef2-4c22-9245-3dc3ad32b545","timepoint":"preoperative"},"target_id":"169e9c49-2ef2-4c22-9245-3dc3ad32b545","target_table":"studies"}],"id":"d9fa4a76-73de-41bb-acd8-7803919f9ce1","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}] \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/d6d795a5-1c51-455c-bea7-5712ba1542e2.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/d6d795a5-1c51-455c-bea7-5712ba1542e2.json new file mode 100644 index 0000000000000000000000000000000000000000..0e35d2a80e512e64bfe37a07660cd7951e04698c --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/d6d795a5-1c51-455c-bea7-5712ba1542e2.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L01 was measured at 1 timepoint, enhancing volume: preoperative: 20.3 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:15.223425Z","evidence_items":[{"id":"1f387f81-bb44-43c5-b470-0ef88de21686","kind":"MEASUREMENT","label":"L01 volume 0.02 cm\u00b3 at preoperative","locator":{"lesion_id":"d6d795a5-1c51-455c-bea7-5712ba1542e2","observation_id":"aedc0da3-b53c-441a-a94d-adc5efcdf325","study_id":"e203ab54-400a-4ae5-a613-ea750490e0ef","volume_cm3":0.02},"target_id":"aedc0da3-b53c-441a-a94d-adc5efcdf325","target_table":"lesion_observations"},{"id":"ddca2e30-27e2-4111-b130-9fe5cc0b3736","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"d6d795a5-1c51-455c-bea7-5712ba1542e2","observation_id":"aedc0da3-b53c-441a-a94d-adc5efcdf325","study_id":"e203ab54-400a-4ae5-a613-ea750490e0ef"},"target_id":"aedc0da3-b53c-441a-a94d-adc5efcdf325","target_table":"lesion_observations"}],"id":"5e6ba09f-8aed-4013-baae-af1c6151c590","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/d928425b-f596-49a3-b4b5-068ef58d0af8.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/d928425b-f596-49a3-b4b5-068ef58d0af8.json new file mode 100644 index 0000000000000000000000000000000000000000..40763fa6e9378800086961a861cb93d70db947e0 --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/d928425b-f596-49a3-b4b5-068ef58d0af8.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L02 was measured at 1 timepoint, enhancing volume: recurrence: 3.8 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:15.287920Z","evidence_items":[{"id":"85c4baa5-ecdb-4cae-b6ed-04a165f5547a","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"d928425b-f596-49a3-b4b5-068ef58d0af8","observation_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","study_id":"94d8c40b-022d-40bd-a1ab-3af52f7a4287","volume_cm3":0.0},"target_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","target_table":"lesion_observations"},{"id":"e2fa4ed7-a6bb-4a60-b915-ae2a9231af58","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"d928425b-f596-49a3-b4b5-068ef58d0af8","observation_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","study_id":"94d8c40b-022d-40bd-a1ab-3af52f7a4287"},"target_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","target_table":"lesion_observations"}],"id":"6c3b689e-98f7-4491-bf12-e993817c513f","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/none.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/94d8c40b-022d-40bd-a1ab-3af52f7a4287/d6d795a5-1c51-455c-bea7-5712ba1542e2.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/94d8c40b-022d-40bd-a1ab-3af52f7a4287/d6d795a5-1c51-455c-bea7-5712ba1542e2.json new file mode 100644 index 0000000000000000000000000000000000000000..0e35d2a80e512e64bfe37a07660cd7951e04698c --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/94d8c40b-022d-40bd-a1ab-3af52f7a4287/d6d795a5-1c51-455c-bea7-5712ba1542e2.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L01 was measured at 1 timepoint, enhancing volume: preoperative: 20.3 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:15.223425Z","evidence_items":[{"id":"1f387f81-bb44-43c5-b470-0ef88de21686","kind":"MEASUREMENT","label":"L01 volume 0.02 cm\u00b3 at preoperative","locator":{"lesion_id":"d6d795a5-1c51-455c-bea7-5712ba1542e2","observation_id":"aedc0da3-b53c-441a-a94d-adc5efcdf325","study_id":"e203ab54-400a-4ae5-a613-ea750490e0ef","volume_cm3":0.02},"target_id":"aedc0da3-b53c-441a-a94d-adc5efcdf325","target_table":"lesion_observations"},{"id":"ddca2e30-27e2-4111-b130-9fe5cc0b3736","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"d6d795a5-1c51-455c-bea7-5712ba1542e2","observation_id":"aedc0da3-b53c-441a-a94d-adc5efcdf325","study_id":"e203ab54-400a-4ae5-a613-ea750490e0ef"},"target_id":"aedc0da3-b53c-441a-a94d-adc5efcdf325","target_table":"lesion_observations"}],"id":"5e6ba09f-8aed-4013-baae-af1c6151c590","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/94d8c40b-022d-40bd-a1ab-3af52f7a4287/d928425b-f596-49a3-b4b5-068ef58d0af8.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/94d8c40b-022d-40bd-a1ab-3af52f7a4287/d928425b-f596-49a3-b4b5-068ef58d0af8.json new file mode 100644 index 0000000000000000000000000000000000000000..40763fa6e9378800086961a861cb93d70db947e0 --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/94d8c40b-022d-40bd-a1ab-3af52f7a4287/d928425b-f596-49a3-b4b5-068ef58d0af8.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L02 was measured at 1 timepoint, enhancing volume: recurrence: 3.8 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:15.287920Z","evidence_items":[{"id":"85c4baa5-ecdb-4cae-b6ed-04a165f5547a","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"d928425b-f596-49a3-b4b5-068ef58d0af8","observation_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","study_id":"94d8c40b-022d-40bd-a1ab-3af52f7a4287","volume_cm3":0.0},"target_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","target_table":"lesion_observations"},{"id":"e2fa4ed7-a6bb-4a60-b915-ae2a9231af58","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"d928425b-f596-49a3-b4b5-068ef58d0af8","observation_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","study_id":"94d8c40b-022d-40bd-a1ab-3af52f7a4287"},"target_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","target_table":"lesion_observations"}],"id":"6c3b689e-98f7-4491-bf12-e993817c513f","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/94d8c40b-022d-40bd-a1ab-3af52f7a4287/none.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/94d8c40b-022d-40bd-a1ab-3af52f7a4287/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/94d8c40b-022d-40bd-a1ab-3af52f7a4287/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/e203ab54-400a-4ae5-a613-ea750490e0ef/d6d795a5-1c51-455c-bea7-5712ba1542e2.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/e203ab54-400a-4ae5-a613-ea750490e0ef/d6d795a5-1c51-455c-bea7-5712ba1542e2.json new file mode 100644 index 0000000000000000000000000000000000000000..74a319df5ecce5354a2346ec4b7cd41fc2f673c6 --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/e203ab54-400a-4ae5-a613-ea750490e0ef/d6d795a5-1c51-455c-bea7-5712ba1542e2.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"L01 was measured at 1 timepoint, enhancing volume: preoperative: 20.3 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:15.223425Z","evidence_items":[{"id":"1f387f81-bb44-43c5-b470-0ef88de21686","kind":"MEASUREMENT","label":"L01 volume 0.02 cm\u00b3 at preoperative","locator":{"lesion_id":"d6d795a5-1c51-455c-bea7-5712ba1542e2","observation_id":"aedc0da3-b53c-441a-a94d-adc5efcdf325","study_id":"e203ab54-400a-4ae5-a613-ea750490e0ef","volume_cm3":0.02},"target_id":"aedc0da3-b53c-441a-a94d-adc5efcdf325","target_table":"lesion_observations"},{"id":"ddca2e30-27e2-4111-b130-9fe5cc0b3736","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"d6d795a5-1c51-455c-bea7-5712ba1542e2","observation_id":"aedc0da3-b53c-441a-a94d-adc5efcdf325","study_id":"e203ab54-400a-4ae5-a613-ea750490e0ef"},"target_id":"aedc0da3-b53c-441a-a94d-adc5efcdf325","target_table":"lesion_observations"}],"id":"5e6ba09f-8aed-4013-baae-af1c6151c590","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/e203ab54-400a-4ae5-a613-ea750490e0ef/d928425b-f596-49a3-b4b5-068ef58d0af8.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/e203ab54-400a-4ae5-a613-ea750490e0ef/d928425b-f596-49a3-b4b5-068ef58d0af8.json new file mode 100644 index 0000000000000000000000000000000000000000..8997aa5ef263bc5aa0de253e08140320c564ae4f --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/e203ab54-400a-4ae5-a613-ea750490e0ef/d928425b-f596-49a3-b4b5-068ef58d0af8.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"L02 was measured at 1 timepoint, enhancing volume: recurrence: 3.8 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:15.287920Z","evidence_items":[{"id":"85c4baa5-ecdb-4cae-b6ed-04a165f5547a","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"d928425b-f596-49a3-b4b5-068ef58d0af8","observation_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","study_id":"94d8c40b-022d-40bd-a1ab-3af52f7a4287","volume_cm3":0.0},"target_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","target_table":"lesion_observations"},{"id":"e2fa4ed7-a6bb-4a60-b915-ae2a9231af58","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"d928425b-f596-49a3-b4b5-068ef58d0af8","observation_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","study_id":"94d8c40b-022d-40bd-a1ab-3af52f7a4287"},"target_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","target_table":"lesion_observations"}],"id":"6c3b689e-98f7-4491-bf12-e993817c513f","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/e203ab54-400a-4ae5-a613-ea750490e0ef/none.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/e203ab54-400a-4ae5-a613-ea750490e0ef/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/e203ab54-400a-4ae5-a613-ea750490e0ef/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/none/d6d795a5-1c51-455c-bea7-5712ba1542e2.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/none/d6d795a5-1c51-455c-bea7-5712ba1542e2.json new file mode 100644 index 0000000000000000000000000000000000000000..0e35d2a80e512e64bfe37a07660cd7951e04698c --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/none/d6d795a5-1c51-455c-bea7-5712ba1542e2.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L01 was measured at 1 timepoint, enhancing volume: preoperative: 20.3 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:15.223425Z","evidence_items":[{"id":"1f387f81-bb44-43c5-b470-0ef88de21686","kind":"MEASUREMENT","label":"L01 volume 0.02 cm\u00b3 at preoperative","locator":{"lesion_id":"d6d795a5-1c51-455c-bea7-5712ba1542e2","observation_id":"aedc0da3-b53c-441a-a94d-adc5efcdf325","study_id":"e203ab54-400a-4ae5-a613-ea750490e0ef","volume_cm3":0.02},"target_id":"aedc0da3-b53c-441a-a94d-adc5efcdf325","target_table":"lesion_observations"},{"id":"ddca2e30-27e2-4111-b130-9fe5cc0b3736","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"d6d795a5-1c51-455c-bea7-5712ba1542e2","observation_id":"aedc0da3-b53c-441a-a94d-adc5efcdf325","study_id":"e203ab54-400a-4ae5-a613-ea750490e0ef"},"target_id":"aedc0da3-b53c-441a-a94d-adc5efcdf325","target_table":"lesion_observations"}],"id":"5e6ba09f-8aed-4013-baae-af1c6151c590","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/none/d928425b-f596-49a3-b4b5-068ef58d0af8.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/none/d928425b-f596-49a3-b4b5-068ef58d0af8.json new file mode 100644 index 0000000000000000000000000000000000000000..40763fa6e9378800086961a861cb93d70db947e0 --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/none/d928425b-f596-49a3-b4b5-068ef58d0af8.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L02 was measured at 1 timepoint, enhancing volume: recurrence: 3.8 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:15.287920Z","evidence_items":[{"id":"85c4baa5-ecdb-4cae-b6ed-04a165f5547a","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"d928425b-f596-49a3-b4b5-068ef58d0af8","observation_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","study_id":"94d8c40b-022d-40bd-a1ab-3af52f7a4287","volume_cm3":0.0},"target_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","target_table":"lesion_observations"},{"id":"e2fa4ed7-a6bb-4a60-b915-ae2a9231af58","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"d928425b-f596-49a3-b4b5-068ef58d0af8","observation_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","study_id":"94d8c40b-022d-40bd-a1ab-3af52f7a4287"},"target_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","target_table":"lesion_observations"}],"id":"6c3b689e-98f7-4491-bf12-e993817c513f","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/none/none.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/EVIDENCE_FOR_FINDING/none/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/LARGEST_CHANGE/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/none.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/LARGEST_CHANGE/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/LARGEST_CHANGE/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/LARGEST_CHANGE/94d8c40b-022d-40bd-a1ab-3af52f7a4287/none.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/LARGEST_CHANGE/94d8c40b-022d-40bd-a1ab-3af52f7a4287/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/LARGEST_CHANGE/94d8c40b-022d-40bd-a1ab-3af52f7a4287/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/LARGEST_CHANGE/e203ab54-400a-4ae5-a613-ea750490e0ef/none.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/LARGEST_CHANGE/e203ab54-400a-4ae5-a613-ea750490e0ef/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/LARGEST_CHANGE/e203ab54-400a-4ae5-a613-ea750490e0ef/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/LARGEST_CHANGE/none/none.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/LARGEST_CHANGE/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/LARGEST_CHANGE/none/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_CHANGED/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/none.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_CHANGED/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/none.json new file mode 100644 index 0000000000000000000000000000000000000000..536bd808d7870cd5caa730bc9edffd6c38484ef5 --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_CHANGED/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measurements support an answer"} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_CHANGED/94d8c40b-022d-40bd-a1ab-3af52f7a4287/none.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_CHANGED/94d8c40b-022d-40bd-a1ab-3af52f7a4287/none.json new file mode 100644 index 0000000000000000000000000000000000000000..ecf6aaa392212417eae770dd167b6b8ce9dfd203 --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_CHANGED/94d8c40b-022d-40bd-a1ab-3af52f7a4287/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"No measured enhancing volume changed by more than 25%. 1 lesion had no prior to compare against: L02 measures 3.8 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:41.587603Z","evidence_items":[{"id":"19575ae2-8456-44c7-a91b-d4ea14e7a390","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"d928425b-f596-49a3-b4b5-068ef58d0af8","observation_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","study_id":"94d8c40b-022d-40bd-a1ab-3af52f7a4287","volume_cm3":0.0},"target_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","target_table":"lesion_observations"},{"id":"1f72d474-4982-4e36-b91d-b15b02a66dfe","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"d928425b-f596-49a3-b4b5-068ef58d0af8","observation_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","study_id":"94d8c40b-022d-40bd-a1ab-3af52f7a4287"},"target_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","target_table":"lesion_observations"}],"id":"ebba5b6c-6ae8-469e-b137-5713c5248419","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_CHANGED/e203ab54-400a-4ae5-a613-ea750490e0ef/none.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_CHANGED/e203ab54-400a-4ae5-a613-ea750490e0ef/none.json new file mode 100644 index 0000000000000000000000000000000000000000..15d633010cd99712c9633fc6f73361e01547cd80 --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_CHANGED/e203ab54-400a-4ae5-a613-ea750490e0ef/none.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"No measured enhancing volume changed by more than 25%. 1 lesion had no prior to compare against: L01 measures 20.3 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:14.815893Z","evidence_items":[{"id":"d09de02a-aa2f-477d-98f6-e0be5848f420","kind":"MEASUREMENT","label":"L01 volume 0.02 cm\u00b3 at preoperative","locator":{"lesion_id":"d6d795a5-1c51-455c-bea7-5712ba1542e2","observation_id":"aedc0da3-b53c-441a-a94d-adc5efcdf325","study_id":"e203ab54-400a-4ae5-a613-ea750490e0ef","volume_cm3":0.02},"target_id":"aedc0da3-b53c-441a-a94d-adc5efcdf325","target_table":"lesion_observations"},{"id":"c6335fbe-3a1e-4d02-b3a0-d453eb0f5804","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"d6d795a5-1c51-455c-bea7-5712ba1542e2","observation_id":"aedc0da3-b53c-441a-a94d-adc5efcdf325","study_id":"e203ab54-400a-4ae5-a613-ea750490e0ef"},"target_id":"aedc0da3-b53c-441a-a94d-adc5efcdf325","target_table":"lesion_observations"}],"id":"b5336bc3-2f77-408d-8383-a6385fa16275","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_CHANGED/none/none.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_CHANGED/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..ecf6aaa392212417eae770dd167b6b8ce9dfd203 --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_CHANGED/none/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"No measured enhancing volume changed by more than 25%. 1 lesion had no prior to compare against: L02 measures 3.8 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:41.587603Z","evidence_items":[{"id":"19575ae2-8456-44c7-a91b-d4ea14e7a390","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"d928425b-f596-49a3-b4b5-068ef58d0af8","observation_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","study_id":"94d8c40b-022d-40bd-a1ab-3af52f7a4287","volume_cm3":0.0},"target_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","target_table":"lesion_observations"},{"id":"1f72d474-4982-4e36-b91d-b15b02a66dfe","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"d928425b-f596-49a3-b4b5-068ef58d0af8","observation_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","study_id":"94d8c40b-022d-40bd-a1ab-3af52f7a4287"},"target_id":"e046ac65-722c-4008-9edb-fcf8fbd8bf2a","target_table":"lesion_observations"}],"id":"ebba5b6c-6ae8-469e-b137-5713c5248419","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_REMAINED_STABLE/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/none.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_REMAINED_STABLE/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af543f9540f61e6cc3a9aa73745474348db5f614 --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_REMAINED_STABLE/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion has a measured change at this timepoint"} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_REMAINED_STABLE/94d8c40b-022d-40bd-a1ab-3af52f7a4287/none.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_REMAINED_STABLE/94d8c40b-022d-40bd-a1ab-3af52f7a4287/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af543f9540f61e6cc3a9aa73745474348db5f614 --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_REMAINED_STABLE/94d8c40b-022d-40bd-a1ab-3af52f7a4287/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion has a measured change at this timepoint"} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_REMAINED_STABLE/e203ab54-400a-4ae5-a613-ea750490e0ef/none.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_REMAINED_STABLE/e203ab54-400a-4ae5-a613-ea750490e0ef/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af543f9540f61e6cc3a9aa73745474348db5f614 --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_REMAINED_STABLE/e203ab54-400a-4ae5-a613-ea750490e0ef/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion has a measured change at this timepoint"} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_REMAINED_STABLE/none/none.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_REMAINED_STABLE/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af543f9540f61e6cc3a9aa73745474348db5f614 --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHAT_REMAINED_STABLE/none/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion has a measured change at this timepoint"} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHEN_LARGEST_CHANGE/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/none.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHEN_LARGEST_CHANGE/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHEN_LARGEST_CHANGE/7c5d5c7e-bad4-4b9b-bba1-b54ca63a29d7/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHEN_LARGEST_CHANGE/94d8c40b-022d-40bd-a1ab-3af52f7a4287/none.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHEN_LARGEST_CHANGE/94d8c40b-022d-40bd-a1ab-3af52f7a4287/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHEN_LARGEST_CHANGE/94d8c40b-022d-40bd-a1ab-3af52f7a4287/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHEN_LARGEST_CHANGE/e203ab54-400a-4ae5-a613-ea750490e0ef/none.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHEN_LARGEST_CHANGE/e203ab54-400a-4ae5-a613-ea750490e0ef/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHEN_LARGEST_CHANGE/e203ab54-400a-4ae5-a613-ea750490e0ef/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHEN_LARGEST_CHANGE/none/none.json b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHEN_LARGEST_CHANGE/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/041c2146-8e58-4c2d-b5dd-6c888ff2447e/WHEN_LARGEST_CHANGE/none/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/0a15d8e4-145f-4cab-9167-8b13a9ff444f/093413a8-d6a7-4c3e-b162-beb55610f174.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/0a15d8e4-145f-4cab-9167-8b13a9ff444f/093413a8-d6a7-4c3e-b162-beb55610f174.json new file mode 100644 index 0000000000000000000000000000000000000000..ed8460df7cc7613ec36b04360e687153da0220ca --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/0a15d8e4-145f-4cab-9167-8b13a9ff444f/093413a8-d6a7-4c3e-b162-beb55610f174.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L04 was measured at 1 timepoint, enhancing volume: recurrence: 0.0 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:28.527505Z","evidence_items":[{"id":"9d090f89-feff-4350-8a76-efbcf8e467bb","kind":"MEASUREMENT","label":"L04 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"093413a8-d6a7-4c3e-b162-beb55610f174","observation_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7","volume_cm3":0.0},"target_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","target_table":"lesion_observations"},{"id":"806838fa-9d2f-4caf-be02-ef22bb248a61","kind":"SEGMENTATION","label":"Segmented enhancing for L04","locator":{"lesion_id":"093413a8-d6a7-4c3e-b162-beb55610f174","observation_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7"},"target_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","target_table":"lesion_observations"}],"id":"3397a4a6-7909-49dd-974c-cd5f37762c07","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/0a15d8e4-145f-4cab-9167-8b13a9ff444f/63b15ede-4a1f-4cd1-abc6-7a623f78c746.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/0a15d8e4-145f-4cab-9167-8b13a9ff444f/63b15ede-4a1f-4cd1-abc6-7a623f78c746.json new file mode 100644 index 0000000000000000000000000000000000000000..816e68d3fdca2ea42d08a361f8c5a44012eaa108 --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/0a15d8e4-145f-4cab-9167-8b13a9ff444f/63b15ede-4a1f-4cd1-abc6-7a623f78c746.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L02 was measured at 1 timepoint, enhancing volume: early-postoperative: 0.6 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:28.601721Z","evidence_items":[{"id":"9ae72468-90a7-4284-9341-e7869c646397","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"63b15ede-4a1f-4cd1-abc6-7a623f78c746","observation_id":"b39bb167-fd48-4a32-9a33-9a32f78e1bb7","study_id":"0a15d8e4-145f-4cab-9167-8b13a9ff444f","volume_cm3":0.0},"target_id":"b39bb167-fd48-4a32-9a33-9a32f78e1bb7","target_table":"lesion_observations"},{"id":"9ff2223f-935c-44f7-a6be-627d840d203c","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"63b15ede-4a1f-4cd1-abc6-7a623f78c746","observation_id":"b39bb167-fd48-4a32-9a33-9a32f78e1bb7","study_id":"0a15d8e4-145f-4cab-9167-8b13a9ff444f"},"target_id":"b39bb167-fd48-4a32-9a33-9a32f78e1bb7","target_table":"lesion_observations"}],"id":"034aaaa5-2d89-403b-8ee9-1ed8081bf9be","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/0a15d8e4-145f-4cab-9167-8b13a9ff444f/6cec2805-34cb-4baf-b7af-a735f90468f4.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/0a15d8e4-145f-4cab-9167-8b13a9ff444f/6cec2805-34cb-4baf-b7af-a735f90468f4.json new file mode 100644 index 0000000000000000000000000000000000000000..69e4909e78db51bef38326648b70769f845b2015 --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/0a15d8e4-145f-4cab-9167-8b13a9ff444f/6cec2805-34cb-4baf-b7af-a735f90468f4.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L01 was measured at 1 timepoint, enhancing volume: preoperative: 15.1 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:28.665165Z","evidence_items":[{"id":"1b9b31e4-3fdf-463c-8e93-efd8e1a0c3fa","kind":"MEASUREMENT","label":"L01 volume 0.02 cm\u00b3 at preoperative","locator":{"lesion_id":"6cec2805-34cb-4baf-b7af-a735f90468f4","observation_id":"9c6300ba-e7ef-4143-b503-bca2a0ebbaea","study_id":"27e46bbd-9461-4c3d-8fde-414291f5bc72","volume_cm3":0.02},"target_id":"9c6300ba-e7ef-4143-b503-bca2a0ebbaea","target_table":"lesion_observations"},{"id":"547fbd18-2b37-454a-9f63-ef8987842932","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"6cec2805-34cb-4baf-b7af-a735f90468f4","observation_id":"9c6300ba-e7ef-4143-b503-bca2a0ebbaea","study_id":"27e46bbd-9461-4c3d-8fde-414291f5bc72"},"target_id":"9c6300ba-e7ef-4143-b503-bca2a0ebbaea","target_table":"lesion_observations"}],"id":"29690f29-726e-4fe8-8db5-4a9255defb19","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/0a15d8e4-145f-4cab-9167-8b13a9ff444f/e9d82174-9b6b-4619-966c-74169ed6903e.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/0a15d8e4-145f-4cab-9167-8b13a9ff444f/e9d82174-9b6b-4619-966c-74169ed6903e.json new file mode 100644 index 0000000000000000000000000000000000000000..cb8890250bc58a85b02320c64f94e2068725cc22 --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/0a15d8e4-145f-4cab-9167-8b13a9ff444f/e9d82174-9b6b-4619-966c-74169ed6903e.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L03 was measured at 1 timepoint, enhancing volume: recurrence: 21.0 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:28.728653Z","evidence_items":[{"id":"c47df75c-4fe2-4c91-a35a-1182cbe105c0","kind":"MEASUREMENT","label":"L03 volume 0.02 cm\u00b3 at recurrence","locator":{"lesion_id":"e9d82174-9b6b-4619-966c-74169ed6903e","observation_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7","volume_cm3":0.02},"target_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","target_table":"lesion_observations"},{"id":"4b3c02c5-cfc9-44f2-b814-db9359f71b70","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"e9d82174-9b6b-4619-966c-74169ed6903e","observation_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7"},"target_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","target_table":"lesion_observations"}],"id":"03bd84cb-6266-4b1c-9ac1-27759f08e837","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/0a15d8e4-145f-4cab-9167-8b13a9ff444f/none.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/0a15d8e4-145f-4cab-9167-8b13a9ff444f/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/0a15d8e4-145f-4cab-9167-8b13a9ff444f/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/27e46bbd-9461-4c3d-8fde-414291f5bc72/093413a8-d6a7-4c3e-b162-beb55610f174.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/27e46bbd-9461-4c3d-8fde-414291f5bc72/093413a8-d6a7-4c3e-b162-beb55610f174.json new file mode 100644 index 0000000000000000000000000000000000000000..0240a19443aa969add613bf7d54644142d5966a8 --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/27e46bbd-9461-4c3d-8fde-414291f5bc72/093413a8-d6a7-4c3e-b162-beb55610f174.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"L04 was measured at 1 timepoint, enhancing volume: recurrence: 0.0 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:28.527505Z","evidence_items":[{"id":"9d090f89-feff-4350-8a76-efbcf8e467bb","kind":"MEASUREMENT","label":"L04 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"093413a8-d6a7-4c3e-b162-beb55610f174","observation_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7","volume_cm3":0.0},"target_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","target_table":"lesion_observations"},{"id":"806838fa-9d2f-4caf-be02-ef22bb248a61","kind":"SEGMENTATION","label":"Segmented enhancing for L04","locator":{"lesion_id":"093413a8-d6a7-4c3e-b162-beb55610f174","observation_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7"},"target_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","target_table":"lesion_observations"}],"id":"3397a4a6-7909-49dd-974c-cd5f37762c07","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/27e46bbd-9461-4c3d-8fde-414291f5bc72/63b15ede-4a1f-4cd1-abc6-7a623f78c746.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/27e46bbd-9461-4c3d-8fde-414291f5bc72/63b15ede-4a1f-4cd1-abc6-7a623f78c746.json new file mode 100644 index 0000000000000000000000000000000000000000..ab8a1a59fbb9be1184bb2afffce3a96829987406 --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/27e46bbd-9461-4c3d-8fde-414291f5bc72/63b15ede-4a1f-4cd1-abc6-7a623f78c746.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"L02 was measured at 1 timepoint, enhancing volume: early-postoperative: 0.6 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:28.601721Z","evidence_items":[{"id":"9ae72468-90a7-4284-9341-e7869c646397","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"63b15ede-4a1f-4cd1-abc6-7a623f78c746","observation_id":"b39bb167-fd48-4a32-9a33-9a32f78e1bb7","study_id":"0a15d8e4-145f-4cab-9167-8b13a9ff444f","volume_cm3":0.0},"target_id":"b39bb167-fd48-4a32-9a33-9a32f78e1bb7","target_table":"lesion_observations"},{"id":"9ff2223f-935c-44f7-a6be-627d840d203c","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"63b15ede-4a1f-4cd1-abc6-7a623f78c746","observation_id":"b39bb167-fd48-4a32-9a33-9a32f78e1bb7","study_id":"0a15d8e4-145f-4cab-9167-8b13a9ff444f"},"target_id":"b39bb167-fd48-4a32-9a33-9a32f78e1bb7","target_table":"lesion_observations"}],"id":"034aaaa5-2d89-403b-8ee9-1ed8081bf9be","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/27e46bbd-9461-4c3d-8fde-414291f5bc72/6cec2805-34cb-4baf-b7af-a735f90468f4.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/27e46bbd-9461-4c3d-8fde-414291f5bc72/6cec2805-34cb-4baf-b7af-a735f90468f4.json new file mode 100644 index 0000000000000000000000000000000000000000..a61adaf58d48f5b5e1c5c31c2cf1e8e0aa27c443 --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/27e46bbd-9461-4c3d-8fde-414291f5bc72/6cec2805-34cb-4baf-b7af-a735f90468f4.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"L01 was measured at 1 timepoint, enhancing volume: preoperative: 15.1 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:28.665165Z","evidence_items":[{"id":"1b9b31e4-3fdf-463c-8e93-efd8e1a0c3fa","kind":"MEASUREMENT","label":"L01 volume 0.02 cm\u00b3 at preoperative","locator":{"lesion_id":"6cec2805-34cb-4baf-b7af-a735f90468f4","observation_id":"9c6300ba-e7ef-4143-b503-bca2a0ebbaea","study_id":"27e46bbd-9461-4c3d-8fde-414291f5bc72","volume_cm3":0.02},"target_id":"9c6300ba-e7ef-4143-b503-bca2a0ebbaea","target_table":"lesion_observations"},{"id":"547fbd18-2b37-454a-9f63-ef8987842932","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"6cec2805-34cb-4baf-b7af-a735f90468f4","observation_id":"9c6300ba-e7ef-4143-b503-bca2a0ebbaea","study_id":"27e46bbd-9461-4c3d-8fde-414291f5bc72"},"target_id":"9c6300ba-e7ef-4143-b503-bca2a0ebbaea","target_table":"lesion_observations"}],"id":"29690f29-726e-4fe8-8db5-4a9255defb19","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/27e46bbd-9461-4c3d-8fde-414291f5bc72/e9d82174-9b6b-4619-966c-74169ed6903e.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/27e46bbd-9461-4c3d-8fde-414291f5bc72/e9d82174-9b6b-4619-966c-74169ed6903e.json new file mode 100644 index 0000000000000000000000000000000000000000..0c65651d92ea4b153732083bdad0992597e4a008 --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/27e46bbd-9461-4c3d-8fde-414291f5bc72/e9d82174-9b6b-4619-966c-74169ed6903e.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"L03 was measured at 1 timepoint, enhancing volume: recurrence: 21.0 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:28.728653Z","evidence_items":[{"id":"c47df75c-4fe2-4c91-a35a-1182cbe105c0","kind":"MEASUREMENT","label":"L03 volume 0.02 cm\u00b3 at recurrence","locator":{"lesion_id":"e9d82174-9b6b-4619-966c-74169ed6903e","observation_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7","volume_cm3":0.02},"target_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","target_table":"lesion_observations"},{"id":"4b3c02c5-cfc9-44f2-b814-db9359f71b70","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"e9d82174-9b6b-4619-966c-74169ed6903e","observation_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7"},"target_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","target_table":"lesion_observations"}],"id":"03bd84cb-6266-4b1c-9ac1-27759f08e837","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/27e46bbd-9461-4c3d-8fde-414291f5bc72/none.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/27e46bbd-9461-4c3d-8fde-414291f5bc72/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/27e46bbd-9461-4c3d-8fde-414291f5bc72/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/093413a8-d6a7-4c3e-b162-beb55610f174.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/093413a8-d6a7-4c3e-b162-beb55610f174.json new file mode 100644 index 0000000000000000000000000000000000000000..ed8460df7cc7613ec36b04360e687153da0220ca --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/093413a8-d6a7-4c3e-b162-beb55610f174.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L04 was measured at 1 timepoint, enhancing volume: recurrence: 0.0 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:28.527505Z","evidence_items":[{"id":"9d090f89-feff-4350-8a76-efbcf8e467bb","kind":"MEASUREMENT","label":"L04 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"093413a8-d6a7-4c3e-b162-beb55610f174","observation_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7","volume_cm3":0.0},"target_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","target_table":"lesion_observations"},{"id":"806838fa-9d2f-4caf-be02-ef22bb248a61","kind":"SEGMENTATION","label":"Segmented enhancing for L04","locator":{"lesion_id":"093413a8-d6a7-4c3e-b162-beb55610f174","observation_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7"},"target_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","target_table":"lesion_observations"}],"id":"3397a4a6-7909-49dd-974c-cd5f37762c07","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/63b15ede-4a1f-4cd1-abc6-7a623f78c746.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/63b15ede-4a1f-4cd1-abc6-7a623f78c746.json new file mode 100644 index 0000000000000000000000000000000000000000..816e68d3fdca2ea42d08a361f8c5a44012eaa108 --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/63b15ede-4a1f-4cd1-abc6-7a623f78c746.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L02 was measured at 1 timepoint, enhancing volume: early-postoperative: 0.6 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:28.601721Z","evidence_items":[{"id":"9ae72468-90a7-4284-9341-e7869c646397","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"63b15ede-4a1f-4cd1-abc6-7a623f78c746","observation_id":"b39bb167-fd48-4a32-9a33-9a32f78e1bb7","study_id":"0a15d8e4-145f-4cab-9167-8b13a9ff444f","volume_cm3":0.0},"target_id":"b39bb167-fd48-4a32-9a33-9a32f78e1bb7","target_table":"lesion_observations"},{"id":"9ff2223f-935c-44f7-a6be-627d840d203c","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"63b15ede-4a1f-4cd1-abc6-7a623f78c746","observation_id":"b39bb167-fd48-4a32-9a33-9a32f78e1bb7","study_id":"0a15d8e4-145f-4cab-9167-8b13a9ff444f"},"target_id":"b39bb167-fd48-4a32-9a33-9a32f78e1bb7","target_table":"lesion_observations"}],"id":"034aaaa5-2d89-403b-8ee9-1ed8081bf9be","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/6cec2805-34cb-4baf-b7af-a735f90468f4.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/6cec2805-34cb-4baf-b7af-a735f90468f4.json new file mode 100644 index 0000000000000000000000000000000000000000..69e4909e78db51bef38326648b70769f845b2015 --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/6cec2805-34cb-4baf-b7af-a735f90468f4.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L01 was measured at 1 timepoint, enhancing volume: preoperative: 15.1 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:28.665165Z","evidence_items":[{"id":"1b9b31e4-3fdf-463c-8e93-efd8e1a0c3fa","kind":"MEASUREMENT","label":"L01 volume 0.02 cm\u00b3 at preoperative","locator":{"lesion_id":"6cec2805-34cb-4baf-b7af-a735f90468f4","observation_id":"9c6300ba-e7ef-4143-b503-bca2a0ebbaea","study_id":"27e46bbd-9461-4c3d-8fde-414291f5bc72","volume_cm3":0.02},"target_id":"9c6300ba-e7ef-4143-b503-bca2a0ebbaea","target_table":"lesion_observations"},{"id":"547fbd18-2b37-454a-9f63-ef8987842932","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"6cec2805-34cb-4baf-b7af-a735f90468f4","observation_id":"9c6300ba-e7ef-4143-b503-bca2a0ebbaea","study_id":"27e46bbd-9461-4c3d-8fde-414291f5bc72"},"target_id":"9c6300ba-e7ef-4143-b503-bca2a0ebbaea","target_table":"lesion_observations"}],"id":"29690f29-726e-4fe8-8db5-4a9255defb19","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/e9d82174-9b6b-4619-966c-74169ed6903e.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/e9d82174-9b6b-4619-966c-74169ed6903e.json new file mode 100644 index 0000000000000000000000000000000000000000..cb8890250bc58a85b02320c64f94e2068725cc22 --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/e9d82174-9b6b-4619-966c-74169ed6903e.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L03 was measured at 1 timepoint, enhancing volume: recurrence: 21.0 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:28.728653Z","evidence_items":[{"id":"c47df75c-4fe2-4c91-a35a-1182cbe105c0","kind":"MEASUREMENT","label":"L03 volume 0.02 cm\u00b3 at recurrence","locator":{"lesion_id":"e9d82174-9b6b-4619-966c-74169ed6903e","observation_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7","volume_cm3":0.02},"target_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","target_table":"lesion_observations"},{"id":"4b3c02c5-cfc9-44f2-b814-db9359f71b70","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"e9d82174-9b6b-4619-966c-74169ed6903e","observation_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7"},"target_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","target_table":"lesion_observations"}],"id":"03bd84cb-6266-4b1c-9ac1-27759f08e837","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/none.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/none/093413a8-d6a7-4c3e-b162-beb55610f174.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/none/093413a8-d6a7-4c3e-b162-beb55610f174.json new file mode 100644 index 0000000000000000000000000000000000000000..ed8460df7cc7613ec36b04360e687153da0220ca --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/none/093413a8-d6a7-4c3e-b162-beb55610f174.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L04 was measured at 1 timepoint, enhancing volume: recurrence: 0.0 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:28.527505Z","evidence_items":[{"id":"9d090f89-feff-4350-8a76-efbcf8e467bb","kind":"MEASUREMENT","label":"L04 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"093413a8-d6a7-4c3e-b162-beb55610f174","observation_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7","volume_cm3":0.0},"target_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","target_table":"lesion_observations"},{"id":"806838fa-9d2f-4caf-be02-ef22bb248a61","kind":"SEGMENTATION","label":"Segmented enhancing for L04","locator":{"lesion_id":"093413a8-d6a7-4c3e-b162-beb55610f174","observation_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7"},"target_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","target_table":"lesion_observations"}],"id":"3397a4a6-7909-49dd-974c-cd5f37762c07","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/none/63b15ede-4a1f-4cd1-abc6-7a623f78c746.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/none/63b15ede-4a1f-4cd1-abc6-7a623f78c746.json new file mode 100644 index 0000000000000000000000000000000000000000..816e68d3fdca2ea42d08a361f8c5a44012eaa108 --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/none/63b15ede-4a1f-4cd1-abc6-7a623f78c746.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L02 was measured at 1 timepoint, enhancing volume: early-postoperative: 0.6 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:28.601721Z","evidence_items":[{"id":"9ae72468-90a7-4284-9341-e7869c646397","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"63b15ede-4a1f-4cd1-abc6-7a623f78c746","observation_id":"b39bb167-fd48-4a32-9a33-9a32f78e1bb7","study_id":"0a15d8e4-145f-4cab-9167-8b13a9ff444f","volume_cm3":0.0},"target_id":"b39bb167-fd48-4a32-9a33-9a32f78e1bb7","target_table":"lesion_observations"},{"id":"9ff2223f-935c-44f7-a6be-627d840d203c","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"63b15ede-4a1f-4cd1-abc6-7a623f78c746","observation_id":"b39bb167-fd48-4a32-9a33-9a32f78e1bb7","study_id":"0a15d8e4-145f-4cab-9167-8b13a9ff444f"},"target_id":"b39bb167-fd48-4a32-9a33-9a32f78e1bb7","target_table":"lesion_observations"}],"id":"034aaaa5-2d89-403b-8ee9-1ed8081bf9be","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/none/6cec2805-34cb-4baf-b7af-a735f90468f4.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/none/6cec2805-34cb-4baf-b7af-a735f90468f4.json new file mode 100644 index 0000000000000000000000000000000000000000..69e4909e78db51bef38326648b70769f845b2015 --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/none/6cec2805-34cb-4baf-b7af-a735f90468f4.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L01 was measured at 1 timepoint, enhancing volume: preoperative: 15.1 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:28.665165Z","evidence_items":[{"id":"1b9b31e4-3fdf-463c-8e93-efd8e1a0c3fa","kind":"MEASUREMENT","label":"L01 volume 0.02 cm\u00b3 at preoperative","locator":{"lesion_id":"6cec2805-34cb-4baf-b7af-a735f90468f4","observation_id":"9c6300ba-e7ef-4143-b503-bca2a0ebbaea","study_id":"27e46bbd-9461-4c3d-8fde-414291f5bc72","volume_cm3":0.02},"target_id":"9c6300ba-e7ef-4143-b503-bca2a0ebbaea","target_table":"lesion_observations"},{"id":"547fbd18-2b37-454a-9f63-ef8987842932","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"6cec2805-34cb-4baf-b7af-a735f90468f4","observation_id":"9c6300ba-e7ef-4143-b503-bca2a0ebbaea","study_id":"27e46bbd-9461-4c3d-8fde-414291f5bc72"},"target_id":"9c6300ba-e7ef-4143-b503-bca2a0ebbaea","target_table":"lesion_observations"}],"id":"29690f29-726e-4fe8-8db5-4a9255defb19","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/none/e9d82174-9b6b-4619-966c-74169ed6903e.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/none/e9d82174-9b6b-4619-966c-74169ed6903e.json new file mode 100644 index 0000000000000000000000000000000000000000..cb8890250bc58a85b02320c64f94e2068725cc22 --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/none/e9d82174-9b6b-4619-966c-74169ed6903e.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L03 was measured at 1 timepoint, enhancing volume: recurrence: 21.0 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:28.728653Z","evidence_items":[{"id":"c47df75c-4fe2-4c91-a35a-1182cbe105c0","kind":"MEASUREMENT","label":"L03 volume 0.02 cm\u00b3 at recurrence","locator":{"lesion_id":"e9d82174-9b6b-4619-966c-74169ed6903e","observation_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7","volume_cm3":0.02},"target_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","target_table":"lesion_observations"},{"id":"4b3c02c5-cfc9-44f2-b814-db9359f71b70","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"e9d82174-9b6b-4619-966c-74169ed6903e","observation_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7"},"target_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","target_table":"lesion_observations"}],"id":"03bd84cb-6266-4b1c-9ac1-27759f08e837","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/none/none.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/EVIDENCE_FOR_FINDING/none/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/LARGEST_CHANGE/0a15d8e4-145f-4cab-9167-8b13a9ff444f/none.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/LARGEST_CHANGE/0a15d8e4-145f-4cab-9167-8b13a9ff444f/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/LARGEST_CHANGE/0a15d8e4-145f-4cab-9167-8b13a9ff444f/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/LARGEST_CHANGE/27e46bbd-9461-4c3d-8fde-414291f5bc72/none.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/LARGEST_CHANGE/27e46bbd-9461-4c3d-8fde-414291f5bc72/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/LARGEST_CHANGE/27e46bbd-9461-4c3d-8fde-414291f5bc72/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/LARGEST_CHANGE/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/none.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/LARGEST_CHANGE/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/LARGEST_CHANGE/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/LARGEST_CHANGE/none/none.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/LARGEST_CHANGE/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/LARGEST_CHANGE/none/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_CHANGED/0a15d8e4-145f-4cab-9167-8b13a9ff444f/none.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_CHANGED/0a15d8e4-145f-4cab-9167-8b13a9ff444f/none.json new file mode 100644 index 0000000000000000000000000000000000000000..db4fa0d5407d8972232de9897dc112ab13f9c591 --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_CHANGED/0a15d8e4-145f-4cab-9167-8b13a9ff444f/none.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"No measured enhancing volume changed by more than 25%. 1 lesion had no prior to compare against: L02 measures 0.6 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:28.024394Z","evidence_items":[{"id":"67f1ac27-10e1-42f7-938b-2858b1a239c9","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"63b15ede-4a1f-4cd1-abc6-7a623f78c746","observation_id":"b39bb167-fd48-4a32-9a33-9a32f78e1bb7","study_id":"0a15d8e4-145f-4cab-9167-8b13a9ff444f","volume_cm3":0.0},"target_id":"b39bb167-fd48-4a32-9a33-9a32f78e1bb7","target_table":"lesion_observations"},{"id":"6b304199-6fb8-4e18-a64d-1a5eaf2baa54","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"63b15ede-4a1f-4cd1-abc6-7a623f78c746","observation_id":"b39bb167-fd48-4a32-9a33-9a32f78e1bb7","study_id":"0a15d8e4-145f-4cab-9167-8b13a9ff444f"},"target_id":"b39bb167-fd48-4a32-9a33-9a32f78e1bb7","target_table":"lesion_observations"}],"id":"3d904340-769d-4de6-ba3c-14d8c35dc9f6","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_CHANGED/27e46bbd-9461-4c3d-8fde-414291f5bc72/none.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_CHANGED/27e46bbd-9461-4c3d-8fde-414291f5bc72/none.json new file mode 100644 index 0000000000000000000000000000000000000000..ff5e40b01a9c0118f6b98b9a8796fb061d2a95dc --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_CHANGED/27e46bbd-9461-4c3d-8fde-414291f5bc72/none.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"No measured enhancing volume changed by more than 25%. 1 lesion had no prior to compare against: L01 measures 15.1 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:27.781728Z","evidence_items":[{"id":"407cd74f-2e04-447a-9b69-a45ebf716791","kind":"MEASUREMENT","label":"L01 volume 0.02 cm\u00b3 at preoperative","locator":{"lesion_id":"6cec2805-34cb-4baf-b7af-a735f90468f4","observation_id":"9c6300ba-e7ef-4143-b503-bca2a0ebbaea","study_id":"27e46bbd-9461-4c3d-8fde-414291f5bc72","volume_cm3":0.02},"target_id":"9c6300ba-e7ef-4143-b503-bca2a0ebbaea","target_table":"lesion_observations"},{"id":"6cdd7349-ca15-452e-b2ae-07a83a7af65d","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"6cec2805-34cb-4baf-b7af-a735f90468f4","observation_id":"9c6300ba-e7ef-4143-b503-bca2a0ebbaea","study_id":"27e46bbd-9461-4c3d-8fde-414291f5bc72"},"target_id":"9c6300ba-e7ef-4143-b503-bca2a0ebbaea","target_table":"lesion_observations"}],"id":"d7648e6a-dcac-4b48-b406-aad2118051fc","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_CHANGED/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/none.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_CHANGED/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/none.json new file mode 100644 index 0000000000000000000000000000000000000000..49c61693c014d4f6082b879a59d4d6bbf1e082cb --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_CHANGED/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"No measured enhancing volume changed by more than 25%. 2 lesions had no prior to compare against: L03 measures 21.0 mm\u00b3 (first measurement, no prior to compare); L04 measures 0.0 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:43.607499Z","evidence_items":[{"id":"2c87c1cf-2511-448f-8678-4bf0c2b2de7c","kind":"MEASUREMENT","label":"L03 volume 0.02 cm\u00b3 at recurrence","locator":{"lesion_id":"e9d82174-9b6b-4619-966c-74169ed6903e","observation_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7","volume_cm3":0.02},"target_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","target_table":"lesion_observations"},{"id":"4f2df9b6-cb59-43ef-95da-2fad66592364","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"e9d82174-9b6b-4619-966c-74169ed6903e","observation_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7"},"target_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","target_table":"lesion_observations"},{"id":"28ea33eb-c6c4-44e3-bb38-f272dfbe7c0f","kind":"MEASUREMENT","label":"L04 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"093413a8-d6a7-4c3e-b162-beb55610f174","observation_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7","volume_cm3":0.0},"target_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","target_table":"lesion_observations"},{"id":"7f81d150-3fb1-49c5-a9cd-efa40b6d944a","kind":"SEGMENTATION","label":"Segmented enhancing for L04","locator":{"lesion_id":"093413a8-d6a7-4c3e-b162-beb55610f174","observation_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7"},"target_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","target_table":"lesion_observations"}],"id":"092c8132-435d-4a08-87d7-27b2cacb4b5a","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_CHANGED/none/none.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_CHANGED/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..49c61693c014d4f6082b879a59d4d6bbf1e082cb --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_CHANGED/none/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"No measured enhancing volume changed by more than 25%. 2 lesions had no prior to compare against: L03 measures 21.0 mm\u00b3 (first measurement, no prior to compare); L04 measures 0.0 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:43.607499Z","evidence_items":[{"id":"2c87c1cf-2511-448f-8678-4bf0c2b2de7c","kind":"MEASUREMENT","label":"L03 volume 0.02 cm\u00b3 at recurrence","locator":{"lesion_id":"e9d82174-9b6b-4619-966c-74169ed6903e","observation_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7","volume_cm3":0.02},"target_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","target_table":"lesion_observations"},{"id":"4f2df9b6-cb59-43ef-95da-2fad66592364","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"e9d82174-9b6b-4619-966c-74169ed6903e","observation_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7"},"target_id":"501eaeb2-222c-4a4c-8de0-8a0029bbd341","target_table":"lesion_observations"},{"id":"28ea33eb-c6c4-44e3-bb38-f272dfbe7c0f","kind":"MEASUREMENT","label":"L04 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"093413a8-d6a7-4c3e-b162-beb55610f174","observation_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7","volume_cm3":0.0},"target_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","target_table":"lesion_observations"},{"id":"7f81d150-3fb1-49c5-a9cd-efa40b6d944a","kind":"SEGMENTATION","label":"Segmented enhancing for L04","locator":{"lesion_id":"093413a8-d6a7-4c3e-b162-beb55610f174","observation_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","study_id":"facc5eed-6372-4287-a4ab-0c53a7dc1ca7"},"target_id":"faa6f9d0-f4e5-4b4c-a55f-1efaa685ba6d","target_table":"lesion_observations"}],"id":"092c8132-435d-4a08-87d7-27b2cacb4b5a","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_REMAINED_STABLE/0a15d8e4-145f-4cab-9167-8b13a9ff444f/none.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_REMAINED_STABLE/0a15d8e4-145f-4cab-9167-8b13a9ff444f/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af543f9540f61e6cc3a9aa73745474348db5f614 --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_REMAINED_STABLE/0a15d8e4-145f-4cab-9167-8b13a9ff444f/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion has a measured change at this timepoint"} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_REMAINED_STABLE/27e46bbd-9461-4c3d-8fde-414291f5bc72/none.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_REMAINED_STABLE/27e46bbd-9461-4c3d-8fde-414291f5bc72/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af543f9540f61e6cc3a9aa73745474348db5f614 --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_REMAINED_STABLE/27e46bbd-9461-4c3d-8fde-414291f5bc72/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion has a measured change at this timepoint"} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_REMAINED_STABLE/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/none.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_REMAINED_STABLE/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af543f9540f61e6cc3a9aa73745474348db5f614 --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_REMAINED_STABLE/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion has a measured change at this timepoint"} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_REMAINED_STABLE/none/none.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_REMAINED_STABLE/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af543f9540f61e6cc3a9aa73745474348db5f614 --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHAT_REMAINED_STABLE/none/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion has a measured change at this timepoint"} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHEN_LARGEST_CHANGE/0a15d8e4-145f-4cab-9167-8b13a9ff444f/none.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHEN_LARGEST_CHANGE/0a15d8e4-145f-4cab-9167-8b13a9ff444f/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHEN_LARGEST_CHANGE/0a15d8e4-145f-4cab-9167-8b13a9ff444f/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHEN_LARGEST_CHANGE/27e46bbd-9461-4c3d-8fde-414291f5bc72/none.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHEN_LARGEST_CHANGE/27e46bbd-9461-4c3d-8fde-414291f5bc72/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHEN_LARGEST_CHANGE/27e46bbd-9461-4c3d-8fde-414291f5bc72/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHEN_LARGEST_CHANGE/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/none.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHEN_LARGEST_CHANGE/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHEN_LARGEST_CHANGE/facc5eed-6372-4287-a4ab-0c53a7dc1ca7/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHEN_LARGEST_CHANGE/none/none.json b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHEN_LARGEST_CHANGE/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/05e8f381-fc6b-4afa-a8ae-e1a8888b7be3/WHEN_LARGEST_CHANGE/none/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/11d9fd96-2cf5-4a80-8a39-8ad4ce075a86/9c34e27c-5cb8-483b-b3b4-7426985ac984.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/11d9fd96-2cf5-4a80-8a39-8ad4ce075a86/9c34e27c-5cb8-483b-b3b4-7426985ac984.json new file mode 100644 index 0000000000000000000000000000000000000000..ea5a0d67bbecf1176569a1a2698740c652ef25f5 --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/11d9fd96-2cf5-4a80-8a39-8ad4ce075a86/9c34e27c-5cb8-483b-b3b4-7426985ac984.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"L01 was measured at 2 timepoints, enhancing volume: preoperative: 8.4 mm\u00b3; recurrence: 14.0 mm\u00b3 (+67.5%). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:37.393667Z","evidence_items":[{"id":"fdbf0c2e-275b-477f-8305-5e3125752d22","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at preoperative","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"a6e86aaa-3771-40d4-b15f-fb7b0eaf2cc8","study_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","volume_cm3":0.01},"target_id":"a6e86aaa-3771-40d4-b15f-fb7b0eaf2cc8","target_table":"lesion_observations"},{"id":"a64bdfb9-6018-458d-9b04-545a1673ec2c","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"a6e86aaa-3771-40d4-b15f-fb7b0eaf2cc8","study_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86"},"target_id":"a6e86aaa-3771-40d4-b15f-fb7b0eaf2cc8","target_table":"lesion_observations"},{"id":"ae3c8e21-e77f-40f9-b681-29239eb53a0b","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935","volume_cm3":0.01},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"754822f1-0cbd-476e-8d54-a93c550c457f","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935"},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"}],"id":"263e249c-0510-478f-a987-48222bd4c795","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/11d9fd96-2cf5-4a80-8a39-8ad4ce075a86/none.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/11d9fd96-2cf5-4a80-8a39-8ad4ce075a86/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/11d9fd96-2cf5-4a80-8a39-8ad4ce075a86/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/26272b5b-80dd-4201-8001-3de172691935/9c34e27c-5cb8-483b-b3b4-7426985ac984.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/26272b5b-80dd-4201-8001-3de172691935/9c34e27c-5cb8-483b-b3b4-7426985ac984.json new file mode 100644 index 0000000000000000000000000000000000000000..87e8aa328bc710bb2095a24db97e5880aa3713a5 --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/26272b5b-80dd-4201-8001-3de172691935/9c34e27c-5cb8-483b-b3b4-7426985ac984.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L01 was measured at 2 timepoints, enhancing volume: preoperative: 8.4 mm\u00b3; recurrence: 14.0 mm\u00b3 (+67.5%). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:37.393667Z","evidence_items":[{"id":"fdbf0c2e-275b-477f-8305-5e3125752d22","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at preoperative","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"a6e86aaa-3771-40d4-b15f-fb7b0eaf2cc8","study_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","volume_cm3":0.01},"target_id":"a6e86aaa-3771-40d4-b15f-fb7b0eaf2cc8","target_table":"lesion_observations"},{"id":"a64bdfb9-6018-458d-9b04-545a1673ec2c","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"a6e86aaa-3771-40d4-b15f-fb7b0eaf2cc8","study_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86"},"target_id":"a6e86aaa-3771-40d4-b15f-fb7b0eaf2cc8","target_table":"lesion_observations"},{"id":"ae3c8e21-e77f-40f9-b681-29239eb53a0b","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935","volume_cm3":0.01},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"754822f1-0cbd-476e-8d54-a93c550c457f","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935"},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"}],"id":"263e249c-0510-478f-a987-48222bd4c795","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/26272b5b-80dd-4201-8001-3de172691935/none.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/26272b5b-80dd-4201-8001-3de172691935/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/26272b5b-80dd-4201-8001-3de172691935/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/2a721993-2746-49fd-ab08-363c33187bc1/9c34e27c-5cb8-483b-b3b4-7426985ac984.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/2a721993-2746-49fd-ab08-363c33187bc1/9c34e27c-5cb8-483b-b3b4-7426985ac984.json new file mode 100644 index 0000000000000000000000000000000000000000..87e8aa328bc710bb2095a24db97e5880aa3713a5 --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/2a721993-2746-49fd-ab08-363c33187bc1/9c34e27c-5cb8-483b-b3b4-7426985ac984.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L01 was measured at 2 timepoints, enhancing volume: preoperative: 8.4 mm\u00b3; recurrence: 14.0 mm\u00b3 (+67.5%). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:37.393667Z","evidence_items":[{"id":"fdbf0c2e-275b-477f-8305-5e3125752d22","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at preoperative","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"a6e86aaa-3771-40d4-b15f-fb7b0eaf2cc8","study_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","volume_cm3":0.01},"target_id":"a6e86aaa-3771-40d4-b15f-fb7b0eaf2cc8","target_table":"lesion_observations"},{"id":"a64bdfb9-6018-458d-9b04-545a1673ec2c","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"a6e86aaa-3771-40d4-b15f-fb7b0eaf2cc8","study_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86"},"target_id":"a6e86aaa-3771-40d4-b15f-fb7b0eaf2cc8","target_table":"lesion_observations"},{"id":"ae3c8e21-e77f-40f9-b681-29239eb53a0b","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935","volume_cm3":0.01},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"754822f1-0cbd-476e-8d54-a93c550c457f","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935"},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"}],"id":"263e249c-0510-478f-a987-48222bd4c795","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/2a721993-2746-49fd-ab08-363c33187bc1/none.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/2a721993-2746-49fd-ab08-363c33187bc1/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/2a721993-2746-49fd-ab08-363c33187bc1/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/none/9c34e27c-5cb8-483b-b3b4-7426985ac984.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/none/9c34e27c-5cb8-483b-b3b4-7426985ac984.json new file mode 100644 index 0000000000000000000000000000000000000000..87e8aa328bc710bb2095a24db97e5880aa3713a5 --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/none/9c34e27c-5cb8-483b-b3b4-7426985ac984.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L01 was measured at 2 timepoints, enhancing volume: preoperative: 8.4 mm\u00b3; recurrence: 14.0 mm\u00b3 (+67.5%). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:37.393667Z","evidence_items":[{"id":"fdbf0c2e-275b-477f-8305-5e3125752d22","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at preoperative","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"a6e86aaa-3771-40d4-b15f-fb7b0eaf2cc8","study_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","volume_cm3":0.01},"target_id":"a6e86aaa-3771-40d4-b15f-fb7b0eaf2cc8","target_table":"lesion_observations"},{"id":"a64bdfb9-6018-458d-9b04-545a1673ec2c","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"a6e86aaa-3771-40d4-b15f-fb7b0eaf2cc8","study_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86"},"target_id":"a6e86aaa-3771-40d4-b15f-fb7b0eaf2cc8","target_table":"lesion_observations"},{"id":"ae3c8e21-e77f-40f9-b681-29239eb53a0b","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935","volume_cm3":0.01},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"754822f1-0cbd-476e-8d54-a93c550c457f","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935"},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"}],"id":"263e249c-0510-478f-a987-48222bd4c795","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/none/none.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/EVIDENCE_FOR_FINDING/none/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/LARGEST_CHANGE/11d9fd96-2cf5-4a80-8a39-8ad4ce075a86/none.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/LARGEST_CHANGE/11d9fd96-2cf5-4a80-8a39-8ad4ce075a86/none.json new file mode 100644 index 0000000000000000000000000000000000000000..f9a066a98cecd446d52ec49782f8dac6a1f06ca0 --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/LARGEST_CHANGE/11d9fd96-2cf5-4a80-8a39-8ad4ce075a86/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"The largest measured enhancing volume change is L01 measures 14.0 mm\u00b3, increased by 67.5% (5.7 mm\u00b3) at recurrence, compared against preoperative. This is the largest of 1 measured change across the timeline. Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:45.384462Z","evidence_items":[{"id":"05bd46b2-ed91-4d77-a761-861e51ebfd63","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935","volume_cm3":0.01},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"973a2f4e-8a92-42f4-8b4b-8e2d8e4e336a","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935"},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"e3d10849-12bc-4726-a301-c64fd7c2f3ec","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","timepoint":"preoperative"},"target_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","target_table":"studies"}],"id":"8ddfa5ed-2d0a-4cc6-8d33-10aa1bc3847f","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/LARGEST_CHANGE/26272b5b-80dd-4201-8001-3de172691935/none.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/LARGEST_CHANGE/26272b5b-80dd-4201-8001-3de172691935/none.json new file mode 100644 index 0000000000000000000000000000000000000000..f9a066a98cecd446d52ec49782f8dac6a1f06ca0 --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/LARGEST_CHANGE/26272b5b-80dd-4201-8001-3de172691935/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"The largest measured enhancing volume change is L01 measures 14.0 mm\u00b3, increased by 67.5% (5.7 mm\u00b3) at recurrence, compared against preoperative. This is the largest of 1 measured change across the timeline. Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:45.384462Z","evidence_items":[{"id":"05bd46b2-ed91-4d77-a761-861e51ebfd63","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935","volume_cm3":0.01},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"973a2f4e-8a92-42f4-8b4b-8e2d8e4e336a","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935"},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"e3d10849-12bc-4726-a301-c64fd7c2f3ec","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","timepoint":"preoperative"},"target_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","target_table":"studies"}],"id":"8ddfa5ed-2d0a-4cc6-8d33-10aa1bc3847f","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/LARGEST_CHANGE/2a721993-2746-49fd-ab08-363c33187bc1/none.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/LARGEST_CHANGE/2a721993-2746-49fd-ab08-363c33187bc1/none.json new file mode 100644 index 0000000000000000000000000000000000000000..f9a066a98cecd446d52ec49782f8dac6a1f06ca0 --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/LARGEST_CHANGE/2a721993-2746-49fd-ab08-363c33187bc1/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"The largest measured enhancing volume change is L01 measures 14.0 mm\u00b3, increased by 67.5% (5.7 mm\u00b3) at recurrence, compared against preoperative. This is the largest of 1 measured change across the timeline. Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:45.384462Z","evidence_items":[{"id":"05bd46b2-ed91-4d77-a761-861e51ebfd63","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935","volume_cm3":0.01},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"973a2f4e-8a92-42f4-8b4b-8e2d8e4e336a","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935"},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"e3d10849-12bc-4726-a301-c64fd7c2f3ec","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","timepoint":"preoperative"},"target_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","target_table":"studies"}],"id":"8ddfa5ed-2d0a-4cc6-8d33-10aa1bc3847f","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/LARGEST_CHANGE/none/none.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/LARGEST_CHANGE/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..f9a066a98cecd446d52ec49782f8dac6a1f06ca0 --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/LARGEST_CHANGE/none/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"The largest measured enhancing volume change is L01 measures 14.0 mm\u00b3, increased by 67.5% (5.7 mm\u00b3) at recurrence, compared against preoperative. This is the largest of 1 measured change across the timeline. Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:45.384462Z","evidence_items":[{"id":"05bd46b2-ed91-4d77-a761-861e51ebfd63","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935","volume_cm3":0.01},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"973a2f4e-8a92-42f4-8b4b-8e2d8e4e336a","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935"},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"e3d10849-12bc-4726-a301-c64fd7c2f3ec","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","timepoint":"preoperative"},"target_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","target_table":"studies"}],"id":"8ddfa5ed-2d0a-4cc6-8d33-10aa1bc3847f","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_CHANGED/11d9fd96-2cf5-4a80-8a39-8ad4ce075a86/none.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_CHANGED/11d9fd96-2cf5-4a80-8a39-8ad4ce075a86/none.json new file mode 100644 index 0000000000000000000000000000000000000000..e6ca53ac70a577dca8dbb3e7f306415a4ef7ad13 --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_CHANGED/11d9fd96-2cf5-4a80-8a39-8ad4ce075a86/none.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"No measured enhancing volume changed by more than 25%. 1 lesion had no prior to compare against: L01 measures 8.4 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:37.001990Z","evidence_items":[{"id":"9ec7c454-d95f-4a97-86c7-386c9290d689","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at preoperative","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"a6e86aaa-3771-40d4-b15f-fb7b0eaf2cc8","study_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","volume_cm3":0.01},"target_id":"a6e86aaa-3771-40d4-b15f-fb7b0eaf2cc8","target_table":"lesion_observations"},{"id":"e7bba29c-d3a9-4882-91c3-e3f9927a7f7f","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"a6e86aaa-3771-40d4-b15f-fb7b0eaf2cc8","study_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86"},"target_id":"a6e86aaa-3771-40d4-b15f-fb7b0eaf2cc8","target_table":"lesion_observations"}],"id":"d76296aa-953e-46e6-af0b-b6dd9ffdd6a9","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_CHANGED/26272b5b-80dd-4201-8001-3de172691935/none.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_CHANGED/26272b5b-80dd-4201-8001-3de172691935/none.json new file mode 100644 index 0000000000000000000000000000000000000000..7c20cd023f4c08f352f702eefa73e9dcdbe2f3f3 --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_CHANGED/26272b5b-80dd-4201-8001-3de172691935/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"Measured enhancing volume changed by more than 25% for 1 lesion between preoperative and recurrence, 161 days apart: L01 measures 14.0 mm\u00b3, increased by 67.5% (5.7 mm\u00b3). Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:45.338471Z","evidence_items":[{"id":"a5499bdc-7971-4701-b379-0d1fdc32b577","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935","volume_cm3":0.01},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"915f85a6-d917-4c9b-966e-4b78d8f1d11d","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935"},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"0ad43409-5f07-441c-85bc-3b5c40df4bf7","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","timepoint":"preoperative"},"target_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","target_table":"studies"}],"id":"52d7a659-7632-4100-ab96-5f8658f0f0b5","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_CHANGED/2a721993-2746-49fd-ab08-363c33187bc1/none.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_CHANGED/2a721993-2746-49fd-ab08-363c33187bc1/none.json new file mode 100644 index 0000000000000000000000000000000000000000..536bd808d7870cd5caa730bc9edffd6c38484ef5 --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_CHANGED/2a721993-2746-49fd-ab08-363c33187bc1/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measurements support an answer"} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_CHANGED/none/none.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_CHANGED/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..7c20cd023f4c08f352f702eefa73e9dcdbe2f3f3 --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_CHANGED/none/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"Measured enhancing volume changed by more than 25% for 1 lesion between preoperative and recurrence, 161 days apart: L01 measures 14.0 mm\u00b3, increased by 67.5% (5.7 mm\u00b3). Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:45.338471Z","evidence_items":[{"id":"a5499bdc-7971-4701-b379-0d1fdc32b577","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935","volume_cm3":0.01},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"915f85a6-d917-4c9b-966e-4b78d8f1d11d","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935"},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"0ad43409-5f07-441c-85bc-3b5c40df4bf7","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","timepoint":"preoperative"},"target_id":"11d9fd96-2cf5-4a80-8a39-8ad4ce075a86","target_table":"studies"}],"id":"52d7a659-7632-4100-ab96-5f8658f0f0b5","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_REMAINED_STABLE/11d9fd96-2cf5-4a80-8a39-8ad4ce075a86/none.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_REMAINED_STABLE/11d9fd96-2cf5-4a80-8a39-8ad4ce075a86/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af543f9540f61e6cc3a9aa73745474348db5f614 --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_REMAINED_STABLE/11d9fd96-2cf5-4a80-8a39-8ad4ce075a86/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion has a measured change at this timepoint"} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_REMAINED_STABLE/26272b5b-80dd-4201-8001-3de172691935/none.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_REMAINED_STABLE/26272b5b-80dd-4201-8001-3de172691935/none.json new file mode 100644 index 0000000000000000000000000000000000000000..a150b20bd4e00e6af88d728979c72d1c18c55e4b --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_REMAINED_STABLE/26272b5b-80dd-4201-8001-3de172691935/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"No lesion was measured within 25% of its previous enhancing volume at recurrence. All 1 lesion with a measured change moved by more than that: L01 measures 14.0 mm\u00b3, increased by 67.5% (5.7 mm\u00b3). Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:45.482904Z","evidence_items":[{"id":"2c1497ea-2a9a-47e4-84e4-45d7403b2eec","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935","volume_cm3":0.01},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"2d7ca551-9c94-4f4c-8ab9-b3a3b67438d3","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935"},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"}],"id":"d9fe8998-3ad5-49d1-8804-5b02ee0a44b0","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_REMAINED_STABLE","question_text":"What remained stable?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_REMAINED_STABLE/2a721993-2746-49fd-ab08-363c33187bc1/none.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_REMAINED_STABLE/2a721993-2746-49fd-ab08-363c33187bc1/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af543f9540f61e6cc3a9aa73745474348db5f614 --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_REMAINED_STABLE/2a721993-2746-49fd-ab08-363c33187bc1/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion has a measured change at this timepoint"} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_REMAINED_STABLE/none/none.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_REMAINED_STABLE/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..a150b20bd4e00e6af88d728979c72d1c18c55e4b --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHAT_REMAINED_STABLE/none/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"No lesion was measured within 25% of its previous enhancing volume at recurrence. All 1 lesion with a measured change moved by more than that: L01 measures 14.0 mm\u00b3, increased by 67.5% (5.7 mm\u00b3). Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:45.482904Z","evidence_items":[{"id":"2c1497ea-2a9a-47e4-84e4-45d7403b2eec","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935","volume_cm3":0.01},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"2d7ca551-9c94-4f4c-8ab9-b3a3b67438d3","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935"},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"}],"id":"d9fe8998-3ad5-49d1-8804-5b02ee0a44b0","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_REMAINED_STABLE","question_text":"What remained stable?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHEN_LARGEST_CHANGE/11d9fd96-2cf5-4a80-8a39-8ad4ce075a86/none.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHEN_LARGEST_CHANGE/11d9fd96-2cf5-4a80-8a39-8ad4ce075a86/none.json new file mode 100644 index 0000000000000000000000000000000000000000..a9f4bccc534085b64dc21fb328767f1551949e2f --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHEN_LARGEST_CHANGE/11d9fd96-2cf5-4a80-8a39-8ad4ce075a86/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"The largest total measured enhancing volume change was recorded at recurrence, 5.7 mm\u00b3 summed across 1 lesion, 161 days after the study it is compared with. Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:45.430947Z","evidence_items":[{"id":"004b5bd0-5b11-4f89-8655-0d94eba4fa77","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935","volume_cm3":0.01},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"c5d7ada0-0cc6-4552-9506-4310ce7f6c55","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935"},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"}],"id":"9290b492-75ea-49f8-9b8b-32472cd8f478","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHEN_LARGEST_CHANGE/26272b5b-80dd-4201-8001-3de172691935/none.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHEN_LARGEST_CHANGE/26272b5b-80dd-4201-8001-3de172691935/none.json new file mode 100644 index 0000000000000000000000000000000000000000..a9f4bccc534085b64dc21fb328767f1551949e2f --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHEN_LARGEST_CHANGE/26272b5b-80dd-4201-8001-3de172691935/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"The largest total measured enhancing volume change was recorded at recurrence, 5.7 mm\u00b3 summed across 1 lesion, 161 days after the study it is compared with. Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:45.430947Z","evidence_items":[{"id":"004b5bd0-5b11-4f89-8655-0d94eba4fa77","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935","volume_cm3":0.01},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"c5d7ada0-0cc6-4552-9506-4310ce7f6c55","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935"},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"}],"id":"9290b492-75ea-49f8-9b8b-32472cd8f478","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHEN_LARGEST_CHANGE/2a721993-2746-49fd-ab08-363c33187bc1/none.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHEN_LARGEST_CHANGE/2a721993-2746-49fd-ab08-363c33187bc1/none.json new file mode 100644 index 0000000000000000000000000000000000000000..a9f4bccc534085b64dc21fb328767f1551949e2f --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHEN_LARGEST_CHANGE/2a721993-2746-49fd-ab08-363c33187bc1/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"The largest total measured enhancing volume change was recorded at recurrence, 5.7 mm\u00b3 summed across 1 lesion, 161 days after the study it is compared with. Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:45.430947Z","evidence_items":[{"id":"004b5bd0-5b11-4f89-8655-0d94eba4fa77","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935","volume_cm3":0.01},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"c5d7ada0-0cc6-4552-9506-4310ce7f6c55","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935"},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"}],"id":"9290b492-75ea-49f8-9b8b-32472cd8f478","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHEN_LARGEST_CHANGE/none/none.json b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHEN_LARGEST_CHANGE/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..a9f4bccc534085b64dc21fb328767f1551949e2f --- /dev/null +++ b/api/answers/0a1ba0ca-23d8-46ed-9974-f86a08bf7027/WHEN_LARGEST_CHANGE/none/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"The largest total measured enhancing volume change was recorded at recurrence, 5.7 mm\u00b3 summed across 1 lesion, 161 days after the study it is compared with. Confidence 0.92.","confidence":0.92,"created_at":"2026-08-18T22:19:45.430947Z","evidence_items":[{"id":"004b5bd0-5b11-4f89-8655-0d94eba4fa77","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935","volume_cm3":0.01},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"},{"id":"c5d7ada0-0cc6-4552-9506-4310ce7f6c55","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"9c34e27c-5cb8-483b-b3b4-7426985ac984","observation_id":"d842f767-6e05-486e-8797-4f5198bafd93","study_id":"26272b5b-80dd-4201-8001-3de172691935"},"target_id":"d842f767-6e05-486e-8797-4f5198bafd93","target_table":"lesion_observations"}],"id":"9290b492-75ea-49f8-9b8b-32472cd8f478","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/311dcc60-732d-49ef-98e8-146429b35fa8/a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/311dcc60-732d-49ef-98e8-146429b35fa8/a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831.json new file mode 100644 index 0000000000000000000000000000000000000000..93590ff2cd4a8d8ff589a453f2b419059ca620d0 --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/311dcc60-732d-49ef-98e8-146429b35fa8/a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L02 was measured at 1 timepoint, enhancing volume: recurrence: 35.2 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:05.654222Z","evidence_items":[{"id":"9eda02dd-af4e-4494-93b8-d8ba859642fb","kind":"MEASUREMENT","label":"L02 volume 0.04 cm\u00b3 at recurrence","locator":{"lesion_id":"a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831","observation_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.04},"target_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","target_table":"lesion_observations"},{"id":"dd91acf3-7c4d-4bc0-b358-46d306e42e61","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831","observation_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","target_table":"lesion_observations"}],"id":"1a44da7d-044d-4f6a-9767-15657e0d398d","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/311dcc60-732d-49ef-98e8-146429b35fa8/b7be23e8-bef9-4836-86d6-afd7c60a963d.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/311dcc60-732d-49ef-98e8-146429b35fa8/b7be23e8-bef9-4836-86d6-afd7c60a963d.json new file mode 100644 index 0000000000000000000000000000000000000000..c0f0c17d8e982041ca8d579c0443ea5816f21b2f --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/311dcc60-732d-49ef-98e8-146429b35fa8/b7be23e8-bef9-4836-86d6-afd7c60a963d.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L01 was measured at 2 timepoints, enhancing volume: preoperative: 8.6 mm\u00b3; recurrence: 0.5 mm\u00b3 (-93.7%). Confidence 0.80; the interval between the two examinations is not recorded, the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:23:05.720610Z","evidence_items":[{"id":"58486ed1-1970-4328-a580-4ede346a8dca","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at preoperative","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"935e4787-2291-44c8-b749-b34a2ed5badf","study_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","volume_cm3":0.01},"target_id":"935e4787-2291-44c8-b749-b34a2ed5badf","target_table":"lesion_observations"},{"id":"20427d37-3c6e-41a1-abc5-36f1d114eba3","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"935e4787-2291-44c8-b749-b34a2ed5badf","study_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836"},"target_id":"935e4787-2291-44c8-b749-b34a2ed5badf","target_table":"lesion_observations"},{"id":"3cf43c81-2078-415c-b570-f1da9fa4b216","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.0},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"5d27b7aa-01cb-47f6-9311-2885d813d6be","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"}],"id":"a6eec742-9f9f-4a4a-af08-f7afbcdc17dc","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/311dcc60-732d-49ef-98e8-146429b35fa8/none.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/311dcc60-732d-49ef-98e8-146429b35fa8/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/311dcc60-732d-49ef-98e8-146429b35fa8/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/9c028656-fa40-4171-9040-e4cba54359ae/a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/9c028656-fa40-4171-9040-e4cba54359ae/a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831.json new file mode 100644 index 0000000000000000000000000000000000000000..93590ff2cd4a8d8ff589a453f2b419059ca620d0 --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/9c028656-fa40-4171-9040-e4cba54359ae/a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L02 was measured at 1 timepoint, enhancing volume: recurrence: 35.2 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:05.654222Z","evidence_items":[{"id":"9eda02dd-af4e-4494-93b8-d8ba859642fb","kind":"MEASUREMENT","label":"L02 volume 0.04 cm\u00b3 at recurrence","locator":{"lesion_id":"a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831","observation_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.04},"target_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","target_table":"lesion_observations"},{"id":"dd91acf3-7c4d-4bc0-b358-46d306e42e61","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831","observation_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","target_table":"lesion_observations"}],"id":"1a44da7d-044d-4f6a-9767-15657e0d398d","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/9c028656-fa40-4171-9040-e4cba54359ae/b7be23e8-bef9-4836-86d6-afd7c60a963d.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/9c028656-fa40-4171-9040-e4cba54359ae/b7be23e8-bef9-4836-86d6-afd7c60a963d.json new file mode 100644 index 0000000000000000000000000000000000000000..c0f0c17d8e982041ca8d579c0443ea5816f21b2f --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/9c028656-fa40-4171-9040-e4cba54359ae/b7be23e8-bef9-4836-86d6-afd7c60a963d.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L01 was measured at 2 timepoints, enhancing volume: preoperative: 8.6 mm\u00b3; recurrence: 0.5 mm\u00b3 (-93.7%). Confidence 0.80; the interval between the two examinations is not recorded, the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:23:05.720610Z","evidence_items":[{"id":"58486ed1-1970-4328-a580-4ede346a8dca","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at preoperative","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"935e4787-2291-44c8-b749-b34a2ed5badf","study_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","volume_cm3":0.01},"target_id":"935e4787-2291-44c8-b749-b34a2ed5badf","target_table":"lesion_observations"},{"id":"20427d37-3c6e-41a1-abc5-36f1d114eba3","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"935e4787-2291-44c8-b749-b34a2ed5badf","study_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836"},"target_id":"935e4787-2291-44c8-b749-b34a2ed5badf","target_table":"lesion_observations"},{"id":"3cf43c81-2078-415c-b570-f1da9fa4b216","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.0},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"5d27b7aa-01cb-47f6-9311-2885d813d6be","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"}],"id":"a6eec742-9f9f-4a4a-af08-f7afbcdc17dc","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/9c028656-fa40-4171-9040-e4cba54359ae/none.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/9c028656-fa40-4171-9040-e4cba54359ae/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/9c028656-fa40-4171-9040-e4cba54359ae/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831.json new file mode 100644 index 0000000000000000000000000000000000000000..06caa6a34b4e27339bac0d573a33ea83d18b971f --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"L02 was measured at 1 timepoint, enhancing volume: recurrence: 35.2 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:05.654222Z","evidence_items":[{"id":"9eda02dd-af4e-4494-93b8-d8ba859642fb","kind":"MEASUREMENT","label":"L02 volume 0.04 cm\u00b3 at recurrence","locator":{"lesion_id":"a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831","observation_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.04},"target_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","target_table":"lesion_observations"},{"id":"dd91acf3-7c4d-4bc0-b358-46d306e42e61","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831","observation_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","target_table":"lesion_observations"}],"id":"1a44da7d-044d-4f6a-9767-15657e0d398d","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/b7be23e8-bef9-4836-86d6-afd7c60a963d.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/b7be23e8-bef9-4836-86d6-afd7c60a963d.json new file mode 100644 index 0000000000000000000000000000000000000000..4ded7bda1d49c61c3059b9d5e63f580e43a306a6 --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/b7be23e8-bef9-4836-86d6-afd7c60a963d.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"L01 was measured at 2 timepoints, enhancing volume: preoperative: 8.6 mm\u00b3; recurrence: 0.5 mm\u00b3 (-93.7%). Confidence 0.80; the interval between the two examinations is not recorded, the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:23:05.720610Z","evidence_items":[{"id":"58486ed1-1970-4328-a580-4ede346a8dca","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at preoperative","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"935e4787-2291-44c8-b749-b34a2ed5badf","study_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","volume_cm3":0.01},"target_id":"935e4787-2291-44c8-b749-b34a2ed5badf","target_table":"lesion_observations"},{"id":"20427d37-3c6e-41a1-abc5-36f1d114eba3","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"935e4787-2291-44c8-b749-b34a2ed5badf","study_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836"},"target_id":"935e4787-2291-44c8-b749-b34a2ed5badf","target_table":"lesion_observations"},{"id":"3cf43c81-2078-415c-b570-f1da9fa4b216","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.0},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"5d27b7aa-01cb-47f6-9311-2885d813d6be","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"}],"id":"a6eec742-9f9f-4a4a-af08-f7afbcdc17dc","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/none.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/none/a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/none/a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831.json new file mode 100644 index 0000000000000000000000000000000000000000..93590ff2cd4a8d8ff589a453f2b419059ca620d0 --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/none/a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L02 was measured at 1 timepoint, enhancing volume: recurrence: 35.2 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:05.654222Z","evidence_items":[{"id":"9eda02dd-af4e-4494-93b8-d8ba859642fb","kind":"MEASUREMENT","label":"L02 volume 0.04 cm\u00b3 at recurrence","locator":{"lesion_id":"a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831","observation_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.04},"target_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","target_table":"lesion_observations"},{"id":"dd91acf3-7c4d-4bc0-b358-46d306e42e61","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831","observation_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","target_table":"lesion_observations"}],"id":"1a44da7d-044d-4f6a-9767-15657e0d398d","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/none/b7be23e8-bef9-4836-86d6-afd7c60a963d.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/none/b7be23e8-bef9-4836-86d6-afd7c60a963d.json new file mode 100644 index 0000000000000000000000000000000000000000..c0f0c17d8e982041ca8d579c0443ea5816f21b2f --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/none/b7be23e8-bef9-4836-86d6-afd7c60a963d.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L01 was measured at 2 timepoints, enhancing volume: preoperative: 8.6 mm\u00b3; recurrence: 0.5 mm\u00b3 (-93.7%). Confidence 0.80; the interval between the two examinations is not recorded, the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:23:05.720610Z","evidence_items":[{"id":"58486ed1-1970-4328-a580-4ede346a8dca","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at preoperative","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"935e4787-2291-44c8-b749-b34a2ed5badf","study_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","volume_cm3":0.01},"target_id":"935e4787-2291-44c8-b749-b34a2ed5badf","target_table":"lesion_observations"},{"id":"20427d37-3c6e-41a1-abc5-36f1d114eba3","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"935e4787-2291-44c8-b749-b34a2ed5badf","study_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836"},"target_id":"935e4787-2291-44c8-b749-b34a2ed5badf","target_table":"lesion_observations"},{"id":"3cf43c81-2078-415c-b570-f1da9fa4b216","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.0},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"5d27b7aa-01cb-47f6-9311-2885d813d6be","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"}],"id":"a6eec742-9f9f-4a4a-af08-f7afbcdc17dc","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/none/none.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/EVIDENCE_FOR_FINDING/none/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/LARGEST_CHANGE/311dcc60-732d-49ef-98e8-146429b35fa8/none.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/LARGEST_CHANGE/311dcc60-732d-49ef-98e8-146429b35fa8/none.json new file mode 100644 index 0000000000000000000000000000000000000000..c67ad3717ce24b893252c09af839118ba49bbb9e --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/LARGEST_CHANGE/311dcc60-732d-49ef-98e8-146429b35fa8/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"The largest measured enhancing volume change is L01 measures 0.5 mm\u00b3, decreased by 93.7% (8.1 mm\u00b3) at recurrence, compared against preoperative. This is the largest of 1 measured change across the timeline. Confidence 0.80; the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.482637Z","evidence_items":[{"id":"b276fe1b-1f4c-4344-9fd3-05c904c75062","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.0},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"8c99cb0f-a58d-440d-8994-ad74754e97d2","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"8913dea0-125d-4432-ba83-fee93d12487a","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","timepoint":"preoperative"},"target_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","target_table":"studies"}],"id":"d7524d0a-c660-490c-bce0-5a0f02c837a9","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/LARGEST_CHANGE/9c028656-fa40-4171-9040-e4cba54359ae/none.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/LARGEST_CHANGE/9c028656-fa40-4171-9040-e4cba54359ae/none.json new file mode 100644 index 0000000000000000000000000000000000000000..c67ad3717ce24b893252c09af839118ba49bbb9e --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/LARGEST_CHANGE/9c028656-fa40-4171-9040-e4cba54359ae/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"The largest measured enhancing volume change is L01 measures 0.5 mm\u00b3, decreased by 93.7% (8.1 mm\u00b3) at recurrence, compared against preoperative. This is the largest of 1 measured change across the timeline. Confidence 0.80; the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.482637Z","evidence_items":[{"id":"b276fe1b-1f4c-4344-9fd3-05c904c75062","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.0},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"8c99cb0f-a58d-440d-8994-ad74754e97d2","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"8913dea0-125d-4432-ba83-fee93d12487a","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","timepoint":"preoperative"},"target_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","target_table":"studies"}],"id":"d7524d0a-c660-490c-bce0-5a0f02c837a9","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/LARGEST_CHANGE/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/none.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/LARGEST_CHANGE/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/none.json new file mode 100644 index 0000000000000000000000000000000000000000..c67ad3717ce24b893252c09af839118ba49bbb9e --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/LARGEST_CHANGE/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"The largest measured enhancing volume change is L01 measures 0.5 mm\u00b3, decreased by 93.7% (8.1 mm\u00b3) at recurrence, compared against preoperative. This is the largest of 1 measured change across the timeline. Confidence 0.80; the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.482637Z","evidence_items":[{"id":"b276fe1b-1f4c-4344-9fd3-05c904c75062","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.0},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"8c99cb0f-a58d-440d-8994-ad74754e97d2","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"8913dea0-125d-4432-ba83-fee93d12487a","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","timepoint":"preoperative"},"target_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","target_table":"studies"}],"id":"d7524d0a-c660-490c-bce0-5a0f02c837a9","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/LARGEST_CHANGE/none/none.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/LARGEST_CHANGE/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..c67ad3717ce24b893252c09af839118ba49bbb9e --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/LARGEST_CHANGE/none/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"The largest measured enhancing volume change is L01 measures 0.5 mm\u00b3, decreased by 93.7% (8.1 mm\u00b3) at recurrence, compared against preoperative. This is the largest of 1 measured change across the timeline. Confidence 0.80; the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.482637Z","evidence_items":[{"id":"b276fe1b-1f4c-4344-9fd3-05c904c75062","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.0},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"8c99cb0f-a58d-440d-8994-ad74754e97d2","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"8913dea0-125d-4432-ba83-fee93d12487a","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","timepoint":"preoperative"},"target_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","target_table":"studies"}],"id":"d7524d0a-c660-490c-bce0-5a0f02c837a9","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"LARGEST_CHANGE","question_text":"Which change is the largest?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_CHANGED/311dcc60-732d-49ef-98e8-146429b35fa8/none.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_CHANGED/311dcc60-732d-49ef-98e8-146429b35fa8/none.json new file mode 100644 index 0000000000000000000000000000000000000000..536bd808d7870cd5caa730bc9edffd6c38484ef5 --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_CHANGED/311dcc60-732d-49ef-98e8-146429b35fa8/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measurements support an answer"} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_CHANGED/9c028656-fa40-4171-9040-e4cba54359ae/none.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_CHANGED/9c028656-fa40-4171-9040-e4cba54359ae/none.json new file mode 100644 index 0000000000000000000000000000000000000000..3be92d8f09fe8ebeb2a0cdae8b448596704664a6 --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_CHANGED/9c028656-fa40-4171-9040-e4cba54359ae/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"Measured enhancing volume changed by more than 25% for 1 lesion between preoperative and recurrence, 710 days apart: L01 measures 0.5 mm\u00b3, decreased by 93.7% (8.1 mm\u00b3). 1 lesion had no prior to compare against: L02 measures 35.2 mm\u00b3 (first measurement, no prior to compare). Confidence 0.80; the interval between the two examinations is not recorded, the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.434897Z","evidence_items":[{"id":"21682d27-cbde-4f5a-a102-c8967c21f21c","kind":"MEASUREMENT","label":"L02 volume 0.04 cm\u00b3 at recurrence","locator":{"lesion_id":"a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831","observation_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.04},"target_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","target_table":"lesion_observations"},{"id":"ebb6a2c6-c812-4091-ae6a-c39d51793cfb","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831","observation_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","target_table":"lesion_observations"},{"id":"2260c1df-e052-499f-94dd-b7feb4ecde9c","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.0},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"cf645c46-88a0-4bca-8617-ccab37686ddb","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"00facdb2-b018-4a32-affc-42981238f4c0","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","timepoint":"preoperative"},"target_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","target_table":"studies"}],"id":"2c3f3d22-bf2c-4124-916e-694aff08a14b","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_CHANGED/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/none.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_CHANGED/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/none.json new file mode 100644 index 0000000000000000000000000000000000000000..32d8eeede17703a7550dc16e268b93bb25335baa --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_CHANGED/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/none.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"No measured enhancing volume changed by more than 25%. 1 lesion had no prior to compare against: L01 measures 8.6 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:05.182347Z","evidence_items":[{"id":"78b46330-95b0-454a-84ed-ec0891bd6936","kind":"MEASUREMENT","label":"L01 volume 0.01 cm\u00b3 at preoperative","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"935e4787-2291-44c8-b749-b34a2ed5badf","study_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","volume_cm3":0.01},"target_id":"935e4787-2291-44c8-b749-b34a2ed5badf","target_table":"lesion_observations"},{"id":"a22ecf17-5810-42dd-8b06-0e99c5e564cd","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"935e4787-2291-44c8-b749-b34a2ed5badf","study_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836"},"target_id":"935e4787-2291-44c8-b749-b34a2ed5badf","target_table":"lesion_observations"}],"id":"9a47b27b-5ccb-446e-aeb7-50394e95a56c","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_CHANGED/none/none.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_CHANGED/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..3be92d8f09fe8ebeb2a0cdae8b448596704664a6 --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_CHANGED/none/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"Measured enhancing volume changed by more than 25% for 1 lesion between preoperative and recurrence, 710 days apart: L01 measures 0.5 mm\u00b3, decreased by 93.7% (8.1 mm\u00b3). 1 lesion had no prior to compare against: L02 measures 35.2 mm\u00b3 (first measurement, no prior to compare). Confidence 0.80; the interval between the two examinations is not recorded, the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.434897Z","evidence_items":[{"id":"21682d27-cbde-4f5a-a102-c8967c21f21c","kind":"MEASUREMENT","label":"L02 volume 0.04 cm\u00b3 at recurrence","locator":{"lesion_id":"a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831","observation_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.04},"target_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","target_table":"lesion_observations"},{"id":"ebb6a2c6-c812-4091-ae6a-c39d51793cfb","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"a53dafaa-d8fa-4a05-b6ac-0ae0e1b8f831","observation_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"04d132bc-cb4c-4dbb-b218-d6c8af102ed7","target_table":"lesion_observations"},{"id":"2260c1df-e052-499f-94dd-b7feb4ecde9c","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.0},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"cf645c46-88a0-4bca-8617-ccab37686ddb","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"00facdb2-b018-4a32-affc-42981238f4c0","kind":"PRIOR_STUDY","label":"Compared against preoperative","locator":{"study_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","timepoint":"preoperative"},"target_id":"dcb50ac6-7ed8-455f-8c79-99ee2ae46836","target_table":"studies"}],"id":"2c3f3d22-bf2c-4124-916e-694aff08a14b","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_REMAINED_STABLE/311dcc60-732d-49ef-98e8-146429b35fa8/none.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_REMAINED_STABLE/311dcc60-732d-49ef-98e8-146429b35fa8/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af543f9540f61e6cc3a9aa73745474348db5f614 --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_REMAINED_STABLE/311dcc60-732d-49ef-98e8-146429b35fa8/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion has a measured change at this timepoint"} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_REMAINED_STABLE/9c028656-fa40-4171-9040-e4cba54359ae/none.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_REMAINED_STABLE/9c028656-fa40-4171-9040-e4cba54359ae/none.json new file mode 100644 index 0000000000000000000000000000000000000000..4ff4128148a751f386444a8c652b3ce26a199d88 --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_REMAINED_STABLE/9c028656-fa40-4171-9040-e4cba54359ae/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"No lesion was measured within 25% of its previous enhancing volume at recurrence. All 1 lesion with a measured change moved by more than that: L01 measures 0.5 mm\u00b3, decreased by 93.7% (8.1 mm\u00b3). Confidence 0.80; the interval between the two examinations is not recorded, the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.587570Z","evidence_items":[{"id":"98b72c13-4bc4-4710-926e-0cb62e732f6b","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.0},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"482f4bd1-6263-43a7-91bc-f44c5e5bbb0b","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"}],"id":"1b0d0185-0cac-4fbf-96cd-0cc125b86baa","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_REMAINED_STABLE","question_text":"What remained stable?","safety_notes":["quality flag on input: NO_INTERVAL","quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_REMAINED_STABLE/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/none.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_REMAINED_STABLE/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af543f9540f61e6cc3a9aa73745474348db5f614 --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_REMAINED_STABLE/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion has a measured change at this timepoint"} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_REMAINED_STABLE/none/none.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_REMAINED_STABLE/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..4ff4128148a751f386444a8c652b3ce26a199d88 --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHAT_REMAINED_STABLE/none/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"No lesion was measured within 25% of its previous enhancing volume at recurrence. All 1 lesion with a measured change moved by more than that: L01 measures 0.5 mm\u00b3, decreased by 93.7% (8.1 mm\u00b3). Confidence 0.80; the interval between the two examinations is not recorded, the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.587570Z","evidence_items":[{"id":"98b72c13-4bc4-4710-926e-0cb62e732f6b","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.0},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"482f4bd1-6263-43a7-91bc-f44c5e5bbb0b","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"}],"id":"1b0d0185-0cac-4fbf-96cd-0cc125b86baa","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_REMAINED_STABLE","question_text":"What remained stable?","safety_notes":["quality flag on input: NO_INTERVAL","quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHEN_LARGEST_CHANGE/311dcc60-732d-49ef-98e8-146429b35fa8/none.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHEN_LARGEST_CHANGE/311dcc60-732d-49ef-98e8-146429b35fa8/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af83df298cc83a86934765246b6c1fb67fbf0b4a --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHEN_LARGEST_CHANGE/311dcc60-732d-49ef-98e8-146429b35fa8/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"The largest total measured enhancing volume change was recorded at recurrence, 8.1 mm\u00b3 summed across 1 lesion, 710 days after the study it is compared with. Confidence 0.80; the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.532672Z","evidence_items":[{"id":"fe9b0913-2a76-4b11-b58a-cd712e6126f3","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.0},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"794691c7-8e44-468f-9a59-6be5e7c8defb","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"}],"id":"3c93a13b-6db8-42cc-806a-4bbb3f79eed2","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHEN_LARGEST_CHANGE/9c028656-fa40-4171-9040-e4cba54359ae/none.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHEN_LARGEST_CHANGE/9c028656-fa40-4171-9040-e4cba54359ae/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af83df298cc83a86934765246b6c1fb67fbf0b4a --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHEN_LARGEST_CHANGE/9c028656-fa40-4171-9040-e4cba54359ae/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"The largest total measured enhancing volume change was recorded at recurrence, 8.1 mm\u00b3 summed across 1 lesion, 710 days after the study it is compared with. Confidence 0.80; the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.532672Z","evidence_items":[{"id":"fe9b0913-2a76-4b11-b58a-cd712e6126f3","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.0},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"794691c7-8e44-468f-9a59-6be5e7c8defb","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"}],"id":"3c93a13b-6db8-42cc-806a-4bbb3f79eed2","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHEN_LARGEST_CHANGE/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/none.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHEN_LARGEST_CHANGE/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af83df298cc83a86934765246b6c1fb67fbf0b4a --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHEN_LARGEST_CHANGE/dcb50ac6-7ed8-455f-8c79-99ee2ae46836/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"The largest total measured enhancing volume change was recorded at recurrence, 8.1 mm\u00b3 summed across 1 lesion, 710 days after the study it is compared with. Confidence 0.80; the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.532672Z","evidence_items":[{"id":"fe9b0913-2a76-4b11-b58a-cd712e6126f3","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.0},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"794691c7-8e44-468f-9a59-6be5e7c8defb","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"}],"id":"3c93a13b-6db8-42cc-806a-4bbb3f79eed2","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHEN_LARGEST_CHANGE/none/none.json b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHEN_LARGEST_CHANGE/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af83df298cc83a86934765246b6c1fb67fbf0b4a --- /dev/null +++ b/api/answers/0e36f014-cba2-4b67-a60a-d5c720f13384/WHEN_LARGEST_CHANGE/none/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"The largest total measured enhancing volume change was recorded at recurrence, 8.1 mm\u00b3 summed across 1 lesion, 710 days after the study it is compared with. Confidence 0.80; the correspondence to the prior lesion is not confident, the volume difference is large enough to weaken the correspondence, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:19:39.532672Z","evidence_items":[{"id":"fe9b0913-2a76-4b11-b58a-cd712e6126f3","kind":"MEASUREMENT","label":"L01 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae","volume_cm3":0.0},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"},{"id":"794691c7-8e44-468f-9a59-6be5e7c8defb","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"b7be23e8-bef9-4836-86d6-afd7c60a963d","observation_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","study_id":"9c028656-fa40-4171-9040-e4cba54359ae"},"target_id":"b9ab1333-8f7e-4e08-b834-8071aa9835c4","target_table":"lesion_observations"}],"id":"3c93a13b-6db8-42cc-806a-4bbb3f79eed2","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHEN_LARGEST_CHANGE","question_text":"When was the largest change measured?","safety_notes":["quality flag on input: MATCH_UNCERTAIN","quality flag on input: LARGE_VOLUME_CHANGE","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/495eb8a6-8859-4a12-9c11-b0b88f665c76/4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/495eb8a6-8859-4a12-9c11-b0b88f665c76/4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f.json new file mode 100644 index 0000000000000000000000000000000000000000..b47c9d39aee42aaca76d1102705b9af6d3a70aea --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/495eb8a6-8859-4a12-9c11-b0b88f665c76/4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L03 was measured at 1 timepoint, enhancing volume: recurrence: 0.4 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:07.814155Z","evidence_items":[{"id":"04890b1b-9b2f-464f-9d7e-08260c4f1cfe","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f","observation_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84","volume_cm3":0.0},"target_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","target_table":"lesion_observations"},{"id":"3d0c09d0-0443-469d-bff0-dd1f0529e7cd","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f","observation_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84"},"target_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","target_table":"lesion_observations"}],"id":"b25a06dc-0534-4800-a7e2-b535e71de673","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/495eb8a6-8859-4a12-9c11-b0b88f665c76/ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/495eb8a6-8859-4a12-9c11-b0b88f665c76/ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b.json new file mode 100644 index 0000000000000000000000000000000000000000..bcf6e4748fe84cc7642000615531fc950f098dd5 --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/495eb8a6-8859-4a12-9c11-b0b88f665c76/ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L02 was measured at 1 timepoint, enhancing volume: recurrence: 5.4 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:07.867551Z","evidence_items":[{"id":"0a5fa6fb-244b-4aab-88a4-e29773908b2a","kind":"MEASUREMENT","label":"L02 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b","observation_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84","volume_cm3":0.01},"target_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","target_table":"lesion_observations"},{"id":"9c1cb049-3a68-4f96-8816-80ba10c70c2d","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b","observation_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84"},"target_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","target_table":"lesion_observations"}],"id":"828e1b40-25f1-4469-9202-114f69fb62e6","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/495eb8a6-8859-4a12-9c11-b0b88f665c76/fa770d32-a6f0-4a63-a772-6d9726e32477.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/495eb8a6-8859-4a12-9c11-b0b88f665c76/fa770d32-a6f0-4a63-a772-6d9726e32477.json new file mode 100644 index 0000000000000000000000000000000000000000..f707b3eee77262ec14ae5c71b0c5ef0b5e9a0f11 --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/495eb8a6-8859-4a12-9c11-b0b88f665c76/fa770d32-a6f0-4a63-a772-6d9726e32477.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L01 was measured at 1 timepoint, enhancing volume: preoperative: 37.8 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:07.919284Z","evidence_items":[{"id":"11739036-7eac-4fca-9bcf-93a006350844","kind":"MEASUREMENT","label":"L01 volume 0.04 cm\u00b3 at preoperative","locator":{"lesion_id":"fa770d32-a6f0-4a63-a772-6d9726e32477","observation_id":"3a1e7785-ed0b-4fab-a0e0-9d20c5aaa2d2","study_id":"ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1","volume_cm3":0.04},"target_id":"3a1e7785-ed0b-4fab-a0e0-9d20c5aaa2d2","target_table":"lesion_observations"},{"id":"82ce5919-a35f-4b95-8881-9cf3f6fb0166","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"fa770d32-a6f0-4a63-a772-6d9726e32477","observation_id":"3a1e7785-ed0b-4fab-a0e0-9d20c5aaa2d2","study_id":"ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1"},"target_id":"3a1e7785-ed0b-4fab-a0e0-9d20c5aaa2d2","target_table":"lesion_observations"}],"id":"b983123f-9f21-4c18-8d1e-5e82d03dc547","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/495eb8a6-8859-4a12-9c11-b0b88f665c76/none.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/495eb8a6-8859-4a12-9c11-b0b88f665c76/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/495eb8a6-8859-4a12-9c11-b0b88f665c76/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/6b329524-c37b-4581-9859-84a55b0f7d84/4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/6b329524-c37b-4581-9859-84a55b0f7d84/4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f.json new file mode 100644 index 0000000000000000000000000000000000000000..b47c9d39aee42aaca76d1102705b9af6d3a70aea --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/6b329524-c37b-4581-9859-84a55b0f7d84/4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L03 was measured at 1 timepoint, enhancing volume: recurrence: 0.4 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:07.814155Z","evidence_items":[{"id":"04890b1b-9b2f-464f-9d7e-08260c4f1cfe","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f","observation_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84","volume_cm3":0.0},"target_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","target_table":"lesion_observations"},{"id":"3d0c09d0-0443-469d-bff0-dd1f0529e7cd","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f","observation_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84"},"target_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","target_table":"lesion_observations"}],"id":"b25a06dc-0534-4800-a7e2-b535e71de673","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/6b329524-c37b-4581-9859-84a55b0f7d84/ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/6b329524-c37b-4581-9859-84a55b0f7d84/ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b.json new file mode 100644 index 0000000000000000000000000000000000000000..bcf6e4748fe84cc7642000615531fc950f098dd5 --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/6b329524-c37b-4581-9859-84a55b0f7d84/ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L02 was measured at 1 timepoint, enhancing volume: recurrence: 5.4 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:07.867551Z","evidence_items":[{"id":"0a5fa6fb-244b-4aab-88a4-e29773908b2a","kind":"MEASUREMENT","label":"L02 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b","observation_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84","volume_cm3":0.01},"target_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","target_table":"lesion_observations"},{"id":"9c1cb049-3a68-4f96-8816-80ba10c70c2d","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b","observation_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84"},"target_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","target_table":"lesion_observations"}],"id":"828e1b40-25f1-4469-9202-114f69fb62e6","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/6b329524-c37b-4581-9859-84a55b0f7d84/fa770d32-a6f0-4a63-a772-6d9726e32477.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/6b329524-c37b-4581-9859-84a55b0f7d84/fa770d32-a6f0-4a63-a772-6d9726e32477.json new file mode 100644 index 0000000000000000000000000000000000000000..f707b3eee77262ec14ae5c71b0c5ef0b5e9a0f11 --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/6b329524-c37b-4581-9859-84a55b0f7d84/fa770d32-a6f0-4a63-a772-6d9726e32477.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L01 was measured at 1 timepoint, enhancing volume: preoperative: 37.8 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:07.919284Z","evidence_items":[{"id":"11739036-7eac-4fca-9bcf-93a006350844","kind":"MEASUREMENT","label":"L01 volume 0.04 cm\u00b3 at preoperative","locator":{"lesion_id":"fa770d32-a6f0-4a63-a772-6d9726e32477","observation_id":"3a1e7785-ed0b-4fab-a0e0-9d20c5aaa2d2","study_id":"ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1","volume_cm3":0.04},"target_id":"3a1e7785-ed0b-4fab-a0e0-9d20c5aaa2d2","target_table":"lesion_observations"},{"id":"82ce5919-a35f-4b95-8881-9cf3f6fb0166","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"fa770d32-a6f0-4a63-a772-6d9726e32477","observation_id":"3a1e7785-ed0b-4fab-a0e0-9d20c5aaa2d2","study_id":"ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1"},"target_id":"3a1e7785-ed0b-4fab-a0e0-9d20c5aaa2d2","target_table":"lesion_observations"}],"id":"b983123f-9f21-4c18-8d1e-5e82d03dc547","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/6b329524-c37b-4581-9859-84a55b0f7d84/none.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/6b329524-c37b-4581-9859-84a55b0f7d84/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/6b329524-c37b-4581-9859-84a55b0f7d84/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f.json new file mode 100644 index 0000000000000000000000000000000000000000..afda629cb946f764e8fc8b557edfa6dae634ceb6 --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"L03 was measured at 1 timepoint, enhancing volume: recurrence: 0.4 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:07.814155Z","evidence_items":[{"id":"04890b1b-9b2f-464f-9d7e-08260c4f1cfe","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f","observation_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84","volume_cm3":0.0},"target_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","target_table":"lesion_observations"},{"id":"3d0c09d0-0443-469d-bff0-dd1f0529e7cd","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f","observation_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84"},"target_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","target_table":"lesion_observations"}],"id":"b25a06dc-0534-4800-a7e2-b535e71de673","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b.json new file mode 100644 index 0000000000000000000000000000000000000000..2de5c8bb64cea685c88dbef0f77fac546188fd02 --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"L02 was measured at 1 timepoint, enhancing volume: recurrence: 5.4 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:07.867551Z","evidence_items":[{"id":"0a5fa6fb-244b-4aab-88a4-e29773908b2a","kind":"MEASUREMENT","label":"L02 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b","observation_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84","volume_cm3":0.01},"target_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","target_table":"lesion_observations"},{"id":"9c1cb049-3a68-4f96-8816-80ba10c70c2d","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b","observation_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84"},"target_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","target_table":"lesion_observations"}],"id":"828e1b40-25f1-4469-9202-114f69fb62e6","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/fa770d32-a6f0-4a63-a772-6d9726e32477.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/fa770d32-a6f0-4a63-a772-6d9726e32477.json new file mode 100644 index 0000000000000000000000000000000000000000..99ab22e9cd819c01875a9d0b9b878d5c89806e09 --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/fa770d32-a6f0-4a63-a772-6d9726e32477.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"L01 was measured at 1 timepoint, enhancing volume: preoperative: 37.8 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:07.919284Z","evidence_items":[{"id":"11739036-7eac-4fca-9bcf-93a006350844","kind":"MEASUREMENT","label":"L01 volume 0.04 cm\u00b3 at preoperative","locator":{"lesion_id":"fa770d32-a6f0-4a63-a772-6d9726e32477","observation_id":"3a1e7785-ed0b-4fab-a0e0-9d20c5aaa2d2","study_id":"ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1","volume_cm3":0.04},"target_id":"3a1e7785-ed0b-4fab-a0e0-9d20c5aaa2d2","target_table":"lesion_observations"},{"id":"82ce5919-a35f-4b95-8881-9cf3f6fb0166","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"fa770d32-a6f0-4a63-a772-6d9726e32477","observation_id":"3a1e7785-ed0b-4fab-a0e0-9d20c5aaa2d2","study_id":"ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1"},"target_id":"3a1e7785-ed0b-4fab-a0e0-9d20c5aaa2d2","target_table":"lesion_observations"}],"id":"b983123f-9f21-4c18-8d1e-5e82d03dc547","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/none.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/none/4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/none/4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f.json new file mode 100644 index 0000000000000000000000000000000000000000..b47c9d39aee42aaca76d1102705b9af6d3a70aea --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/none/4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L03 was measured at 1 timepoint, enhancing volume: recurrence: 0.4 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:07.814155Z","evidence_items":[{"id":"04890b1b-9b2f-464f-9d7e-08260c4f1cfe","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f","observation_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84","volume_cm3":0.0},"target_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","target_table":"lesion_observations"},{"id":"3d0c09d0-0443-469d-bff0-dd1f0529e7cd","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f","observation_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84"},"target_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","target_table":"lesion_observations"}],"id":"b25a06dc-0534-4800-a7e2-b535e71de673","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/none/ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/none/ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b.json new file mode 100644 index 0000000000000000000000000000000000000000..bcf6e4748fe84cc7642000615531fc950f098dd5 --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/none/ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L02 was measured at 1 timepoint, enhancing volume: recurrence: 5.4 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:07.867551Z","evidence_items":[{"id":"0a5fa6fb-244b-4aab-88a4-e29773908b2a","kind":"MEASUREMENT","label":"L02 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b","observation_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84","volume_cm3":0.01},"target_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","target_table":"lesion_observations"},{"id":"9c1cb049-3a68-4f96-8816-80ba10c70c2d","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b","observation_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84"},"target_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","target_table":"lesion_observations"}],"id":"828e1b40-25f1-4469-9202-114f69fb62e6","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/none/fa770d32-a6f0-4a63-a772-6d9726e32477.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/none/fa770d32-a6f0-4a63-a772-6d9726e32477.json new file mode 100644 index 0000000000000000000000000000000000000000..f707b3eee77262ec14ae5c71b0c5ef0b5e9a0f11 --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/none/fa770d32-a6f0-4a63-a772-6d9726e32477.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L01 was measured at 1 timepoint, enhancing volume: preoperative: 37.8 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:07.919284Z","evidence_items":[{"id":"11739036-7eac-4fca-9bcf-93a006350844","kind":"MEASUREMENT","label":"L01 volume 0.04 cm\u00b3 at preoperative","locator":{"lesion_id":"fa770d32-a6f0-4a63-a772-6d9726e32477","observation_id":"3a1e7785-ed0b-4fab-a0e0-9d20c5aaa2d2","study_id":"ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1","volume_cm3":0.04},"target_id":"3a1e7785-ed0b-4fab-a0e0-9d20c5aaa2d2","target_table":"lesion_observations"},{"id":"82ce5919-a35f-4b95-8881-9cf3f6fb0166","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"fa770d32-a6f0-4a63-a772-6d9726e32477","observation_id":"3a1e7785-ed0b-4fab-a0e0-9d20c5aaa2d2","study_id":"ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1"},"target_id":"3a1e7785-ed0b-4fab-a0e0-9d20c5aaa2d2","target_table":"lesion_observations"}],"id":"b983123f-9f21-4c18-8d1e-5e82d03dc547","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/none/none.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/EVIDENCE_FOR_FINDING/none/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/LARGEST_CHANGE/495eb8a6-8859-4a12-9c11-b0b88f665c76/none.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/LARGEST_CHANGE/495eb8a6-8859-4a12-9c11-b0b88f665c76/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/LARGEST_CHANGE/495eb8a6-8859-4a12-9c11-b0b88f665c76/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/LARGEST_CHANGE/6b329524-c37b-4581-9859-84a55b0f7d84/none.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/LARGEST_CHANGE/6b329524-c37b-4581-9859-84a55b0f7d84/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/LARGEST_CHANGE/6b329524-c37b-4581-9859-84a55b0f7d84/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/LARGEST_CHANGE/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/none.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/LARGEST_CHANGE/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/LARGEST_CHANGE/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/LARGEST_CHANGE/none/none.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/LARGEST_CHANGE/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/LARGEST_CHANGE/none/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_CHANGED/495eb8a6-8859-4a12-9c11-b0b88f665c76/none.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_CHANGED/495eb8a6-8859-4a12-9c11-b0b88f665c76/none.json new file mode 100644 index 0000000000000000000000000000000000000000..536bd808d7870cd5caa730bc9edffd6c38484ef5 --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_CHANGED/495eb8a6-8859-4a12-9c11-b0b88f665c76/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measurements support an answer"} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_CHANGED/6b329524-c37b-4581-9859-84a55b0f7d84/none.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_CHANGED/6b329524-c37b-4581-9859-84a55b0f7d84/none.json new file mode 100644 index 0000000000000000000000000000000000000000..50ddaaf7af5d5c98f43705a7d0d6650b3a60019e --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_CHANGED/6b329524-c37b-4581-9859-84a55b0f7d84/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"No measured enhancing volume changed by more than 25%. 2 lesions had no prior to compare against: L02 measures 5.4 mm\u00b3 (first measurement, no prior to compare); L03 measures 0.4 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:40.038524Z","evidence_items":[{"id":"c7062b9e-1906-4310-92a7-1b2af5384c89","kind":"MEASUREMENT","label":"L02 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b","observation_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84","volume_cm3":0.01},"target_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","target_table":"lesion_observations"},{"id":"70873a60-8f1b-47bf-9055-173d4b65113f","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b","observation_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84"},"target_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","target_table":"lesion_observations"},{"id":"d4986659-135d-49ca-b792-8bbe6888dcc1","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f","observation_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84","volume_cm3":0.0},"target_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","target_table":"lesion_observations"},{"id":"f178f0ac-86dc-4b5d-a234-0f5df2e8e15e","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f","observation_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84"},"target_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","target_table":"lesion_observations"}],"id":"e6285085-d5c3-4260-96c4-632feaec248b","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_CHANGED/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/none.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_CHANGED/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/none.json new file mode 100644 index 0000000000000000000000000000000000000000..78ff9c5ea5c9191aa1aa9ffaf6d460e10a79101a --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_CHANGED/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/none.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"No measured enhancing volume changed by more than 25%. 1 lesion had no prior to compare against: L01 measures 37.8 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:07.448614Z","evidence_items":[{"id":"08a16a62-1b8b-4f4f-bb36-33faed3c6857","kind":"MEASUREMENT","label":"L01 volume 0.04 cm\u00b3 at preoperative","locator":{"lesion_id":"fa770d32-a6f0-4a63-a772-6d9726e32477","observation_id":"3a1e7785-ed0b-4fab-a0e0-9d20c5aaa2d2","study_id":"ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1","volume_cm3":0.04},"target_id":"3a1e7785-ed0b-4fab-a0e0-9d20c5aaa2d2","target_table":"lesion_observations"},{"id":"2d39d29e-e24e-4d30-98e1-eeba14048d3b","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"fa770d32-a6f0-4a63-a772-6d9726e32477","observation_id":"3a1e7785-ed0b-4fab-a0e0-9d20c5aaa2d2","study_id":"ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1"},"target_id":"3a1e7785-ed0b-4fab-a0e0-9d20c5aaa2d2","target_table":"lesion_observations"}],"id":"055380e6-1629-4a83-a6fe-97fe99598f38","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_CHANGED/none/none.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_CHANGED/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..50ddaaf7af5d5c98f43705a7d0d6650b3a60019e --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_CHANGED/none/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"No measured enhancing volume changed by more than 25%. 2 lesions had no prior to compare against: L02 measures 5.4 mm\u00b3 (first measurement, no prior to compare); L03 measures 0.4 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:40.038524Z","evidence_items":[{"id":"c7062b9e-1906-4310-92a7-1b2af5384c89","kind":"MEASUREMENT","label":"L02 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b","observation_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84","volume_cm3":0.01},"target_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","target_table":"lesion_observations"},{"id":"70873a60-8f1b-47bf-9055-173d4b65113f","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"ba5e450e-8dc0-4b84-a5b9-2ab98a67f85b","observation_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84"},"target_id":"6cbae5c3-0adb-40b3-848d-a67efbfe7eb4","target_table":"lesion_observations"},{"id":"d4986659-135d-49ca-b792-8bbe6888dcc1","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f","observation_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84","volume_cm3":0.0},"target_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","target_table":"lesion_observations"},{"id":"f178f0ac-86dc-4b5d-a234-0f5df2e8e15e","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"4ef55edd-f946-4fc6-9ff2-b21d2fdcb86f","observation_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","study_id":"6b329524-c37b-4581-9859-84a55b0f7d84"},"target_id":"a7719e45-3af0-4e6c-a364-0a937aba199e","target_table":"lesion_observations"}],"id":"e6285085-d5c3-4260-96c4-632feaec248b","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_REMAINED_STABLE/495eb8a6-8859-4a12-9c11-b0b88f665c76/none.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_REMAINED_STABLE/495eb8a6-8859-4a12-9c11-b0b88f665c76/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af543f9540f61e6cc3a9aa73745474348db5f614 --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_REMAINED_STABLE/495eb8a6-8859-4a12-9c11-b0b88f665c76/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion has a measured change at this timepoint"} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_REMAINED_STABLE/6b329524-c37b-4581-9859-84a55b0f7d84/none.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_REMAINED_STABLE/6b329524-c37b-4581-9859-84a55b0f7d84/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af543f9540f61e6cc3a9aa73745474348db5f614 --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_REMAINED_STABLE/6b329524-c37b-4581-9859-84a55b0f7d84/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion has a measured change at this timepoint"} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_REMAINED_STABLE/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/none.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_REMAINED_STABLE/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af543f9540f61e6cc3a9aa73745474348db5f614 --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_REMAINED_STABLE/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion has a measured change at this timepoint"} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_REMAINED_STABLE/none/none.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_REMAINED_STABLE/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af543f9540f61e6cc3a9aa73745474348db5f614 --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHAT_REMAINED_STABLE/none/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion has a measured change at this timepoint"} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHEN_LARGEST_CHANGE/495eb8a6-8859-4a12-9c11-b0b88f665c76/none.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHEN_LARGEST_CHANGE/495eb8a6-8859-4a12-9c11-b0b88f665c76/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHEN_LARGEST_CHANGE/495eb8a6-8859-4a12-9c11-b0b88f665c76/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHEN_LARGEST_CHANGE/6b329524-c37b-4581-9859-84a55b0f7d84/none.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHEN_LARGEST_CHANGE/6b329524-c37b-4581-9859-84a55b0f7d84/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHEN_LARGEST_CHANGE/6b329524-c37b-4581-9859-84a55b0f7d84/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHEN_LARGEST_CHANGE/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/none.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHEN_LARGEST_CHANGE/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHEN_LARGEST_CHANGE/ddd7488d-8a1e-4790-b9fb-89c49dc8a5a1/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHEN_LARGEST_CHANGE/none/none.json b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHEN_LARGEST_CHANGE/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/1644cc40-79e6-47bf-a4e4-51c8248a7ad9/WHEN_LARGEST_CHANGE/none/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/02a98a19-4bb3-44ed-8cd5-8a07fb856056.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/02a98a19-4bb3-44ed-8cd5-8a07fb856056.json new file mode 100644 index 0000000000000000000000000000000000000000..70f6d4151e26530193d6be975d0c78a0e6d47392 --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/02a98a19-4bb3-44ed-8cd5-8a07fb856056.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"L02 was measured at 1 timepoint, enhancing volume: preoperative: 0.1 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:13.846721Z","evidence_items":[{"id":"97974d99-0bbe-447a-a57d-610b9a886a98","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at preoperative","locator":{"lesion_id":"02a98a19-4bb3-44ed-8cd5-8a07fb856056","observation_id":"630f5433-607e-4a8e-bbe5-de3a347c4cdd","study_id":"0664cdeb-7fac-4da4-a80a-a55c6723ae2e","volume_cm3":0.0},"target_id":"630f5433-607e-4a8e-bbe5-de3a347c4cdd","target_table":"lesion_observations"},{"id":"a6610f07-1871-4958-8fcf-19ea2f4375f4","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"02a98a19-4bb3-44ed-8cd5-8a07fb856056","observation_id":"630f5433-607e-4a8e-bbe5-de3a347c4cdd","study_id":"0664cdeb-7fac-4da4-a80a-a55c6723ae2e"},"target_id":"630f5433-607e-4a8e-bbe5-de3a347c4cdd","target_table":"lesion_observations"}],"id":"fe0c4dd3-0e7f-459b-9493-1bbd92e3d61f","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/03a303d7-5935-4d2a-ba9f-9d3fd3e2e710.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/03a303d7-5935-4d2a-ba9f-9d3fd3e2e710.json new file mode 100644 index 0000000000000000000000000000000000000000..32816c364f4ae2a5149b3295dfa97db9f1829d4b --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/03a303d7-5935-4d2a-ba9f-9d3fd3e2e710.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"L03 was measured at 1 timepoint, enhancing volume: recurrence: 0.7 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:13.897650Z","evidence_items":[{"id":"349a571c-692d-4aef-b4fa-ffd952ab36a3","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"03a303d7-5935-4d2a-ba9f-9d3fd3e2e710","observation_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","study_id":"b4d0c863-a94f-4cb7-8c20-0544dadd2b55","volume_cm3":0.0},"target_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","target_table":"lesion_observations"},{"id":"e28b0b39-2d2d-4aa0-b175-f7fe02ead4f0","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"03a303d7-5935-4d2a-ba9f-9d3fd3e2e710","observation_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","study_id":"b4d0c863-a94f-4cb7-8c20-0544dadd2b55"},"target_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","target_table":"lesion_observations"}],"id":"82fff64f-8def-4062-b52a-b42dd5dc5c73","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/7deec6f6-b787-4b08-86cb-f2381eb36046.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/7deec6f6-b787-4b08-86cb-f2381eb36046.json new file mode 100644 index 0000000000000000000000000000000000000000..60c73801bbbb790d0f355e3f4f1d86ef7cc8e165 --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/7deec6f6-b787-4b08-86cb-f2381eb36046.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"L01 was measured at 1 timepoint, enhancing volume: preoperative: 43.6 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:13.989123Z","evidence_items":[{"id":"a626ae45-385e-4fde-b128-08db84f745c4","kind":"MEASUREMENT","label":"L01 volume 0.04 cm\u00b3 at preoperative","locator":{"lesion_id":"7deec6f6-b787-4b08-86cb-f2381eb36046","observation_id":"2bb84115-9b36-4bd3-9de9-53e1e729b44c","study_id":"0664cdeb-7fac-4da4-a80a-a55c6723ae2e","volume_cm3":0.04},"target_id":"2bb84115-9b36-4bd3-9de9-53e1e729b44c","target_table":"lesion_observations"},{"id":"025403c6-f415-4b73-a791-68dd940d06f1","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"7deec6f6-b787-4b08-86cb-f2381eb36046","observation_id":"2bb84115-9b36-4bd3-9de9-53e1e729b44c","study_id":"0664cdeb-7fac-4da4-a80a-a55c6723ae2e"},"target_id":"2bb84115-9b36-4bd3-9de9-53e1e729b44c","target_table":"lesion_observations"}],"id":"29057e53-befc-4b22-bf6b-59f52692ab9c","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/none.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/2f4c8574-9ea0-4334-b96f-29f82fd556d5/02a98a19-4bb3-44ed-8cd5-8a07fb856056.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/2f4c8574-9ea0-4334-b96f-29f82fd556d5/02a98a19-4bb3-44ed-8cd5-8a07fb856056.json new file mode 100644 index 0000000000000000000000000000000000000000..3d4cd6b66fc8d5a9914144a7d1aafef41843c39c --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/2f4c8574-9ea0-4334-b96f-29f82fd556d5/02a98a19-4bb3-44ed-8cd5-8a07fb856056.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L02 was measured at 1 timepoint, enhancing volume: preoperative: 0.1 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:13.846721Z","evidence_items":[{"id":"97974d99-0bbe-447a-a57d-610b9a886a98","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at preoperative","locator":{"lesion_id":"02a98a19-4bb3-44ed-8cd5-8a07fb856056","observation_id":"630f5433-607e-4a8e-bbe5-de3a347c4cdd","study_id":"0664cdeb-7fac-4da4-a80a-a55c6723ae2e","volume_cm3":0.0},"target_id":"630f5433-607e-4a8e-bbe5-de3a347c4cdd","target_table":"lesion_observations"},{"id":"a6610f07-1871-4958-8fcf-19ea2f4375f4","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"02a98a19-4bb3-44ed-8cd5-8a07fb856056","observation_id":"630f5433-607e-4a8e-bbe5-de3a347c4cdd","study_id":"0664cdeb-7fac-4da4-a80a-a55c6723ae2e"},"target_id":"630f5433-607e-4a8e-bbe5-de3a347c4cdd","target_table":"lesion_observations"}],"id":"fe0c4dd3-0e7f-459b-9493-1bbd92e3d61f","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/2f4c8574-9ea0-4334-b96f-29f82fd556d5/03a303d7-5935-4d2a-ba9f-9d3fd3e2e710.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/2f4c8574-9ea0-4334-b96f-29f82fd556d5/03a303d7-5935-4d2a-ba9f-9d3fd3e2e710.json new file mode 100644 index 0000000000000000000000000000000000000000..4c2b21b571897d4fda4531fde586bc399437d75c --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/2f4c8574-9ea0-4334-b96f-29f82fd556d5/03a303d7-5935-4d2a-ba9f-9d3fd3e2e710.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L03 was measured at 1 timepoint, enhancing volume: recurrence: 0.7 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:13.897650Z","evidence_items":[{"id":"349a571c-692d-4aef-b4fa-ffd952ab36a3","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"03a303d7-5935-4d2a-ba9f-9d3fd3e2e710","observation_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","study_id":"b4d0c863-a94f-4cb7-8c20-0544dadd2b55","volume_cm3":0.0},"target_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","target_table":"lesion_observations"},{"id":"e28b0b39-2d2d-4aa0-b175-f7fe02ead4f0","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"03a303d7-5935-4d2a-ba9f-9d3fd3e2e710","observation_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","study_id":"b4d0c863-a94f-4cb7-8c20-0544dadd2b55"},"target_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","target_table":"lesion_observations"}],"id":"82fff64f-8def-4062-b52a-b42dd5dc5c73","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/2f4c8574-9ea0-4334-b96f-29f82fd556d5/7deec6f6-b787-4b08-86cb-f2381eb36046.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/2f4c8574-9ea0-4334-b96f-29f82fd556d5/7deec6f6-b787-4b08-86cb-f2381eb36046.json new file mode 100644 index 0000000000000000000000000000000000000000..387ce5369309ae99ca26afff48dc2cca246320db --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/2f4c8574-9ea0-4334-b96f-29f82fd556d5/7deec6f6-b787-4b08-86cb-f2381eb36046.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L01 was measured at 1 timepoint, enhancing volume: preoperative: 43.6 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:13.989123Z","evidence_items":[{"id":"a626ae45-385e-4fde-b128-08db84f745c4","kind":"MEASUREMENT","label":"L01 volume 0.04 cm\u00b3 at preoperative","locator":{"lesion_id":"7deec6f6-b787-4b08-86cb-f2381eb36046","observation_id":"2bb84115-9b36-4bd3-9de9-53e1e729b44c","study_id":"0664cdeb-7fac-4da4-a80a-a55c6723ae2e","volume_cm3":0.04},"target_id":"2bb84115-9b36-4bd3-9de9-53e1e729b44c","target_table":"lesion_observations"},{"id":"025403c6-f415-4b73-a791-68dd940d06f1","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"7deec6f6-b787-4b08-86cb-f2381eb36046","observation_id":"2bb84115-9b36-4bd3-9de9-53e1e729b44c","study_id":"0664cdeb-7fac-4da4-a80a-a55c6723ae2e"},"target_id":"2bb84115-9b36-4bd3-9de9-53e1e729b44c","target_table":"lesion_observations"}],"id":"29057e53-befc-4b22-bf6b-59f52692ab9c","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/2f4c8574-9ea0-4334-b96f-29f82fd556d5/none.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/2f4c8574-9ea0-4334-b96f-29f82fd556d5/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/2f4c8574-9ea0-4334-b96f-29f82fd556d5/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/02a98a19-4bb3-44ed-8cd5-8a07fb856056.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/02a98a19-4bb3-44ed-8cd5-8a07fb856056.json new file mode 100644 index 0000000000000000000000000000000000000000..3d4cd6b66fc8d5a9914144a7d1aafef41843c39c --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/02a98a19-4bb3-44ed-8cd5-8a07fb856056.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L02 was measured at 1 timepoint, enhancing volume: preoperative: 0.1 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:13.846721Z","evidence_items":[{"id":"97974d99-0bbe-447a-a57d-610b9a886a98","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at preoperative","locator":{"lesion_id":"02a98a19-4bb3-44ed-8cd5-8a07fb856056","observation_id":"630f5433-607e-4a8e-bbe5-de3a347c4cdd","study_id":"0664cdeb-7fac-4da4-a80a-a55c6723ae2e","volume_cm3":0.0},"target_id":"630f5433-607e-4a8e-bbe5-de3a347c4cdd","target_table":"lesion_observations"},{"id":"a6610f07-1871-4958-8fcf-19ea2f4375f4","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"02a98a19-4bb3-44ed-8cd5-8a07fb856056","observation_id":"630f5433-607e-4a8e-bbe5-de3a347c4cdd","study_id":"0664cdeb-7fac-4da4-a80a-a55c6723ae2e"},"target_id":"630f5433-607e-4a8e-bbe5-de3a347c4cdd","target_table":"lesion_observations"}],"id":"fe0c4dd3-0e7f-459b-9493-1bbd92e3d61f","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/03a303d7-5935-4d2a-ba9f-9d3fd3e2e710.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/03a303d7-5935-4d2a-ba9f-9d3fd3e2e710.json new file mode 100644 index 0000000000000000000000000000000000000000..4c2b21b571897d4fda4531fde586bc399437d75c --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/03a303d7-5935-4d2a-ba9f-9d3fd3e2e710.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L03 was measured at 1 timepoint, enhancing volume: recurrence: 0.7 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:13.897650Z","evidence_items":[{"id":"349a571c-692d-4aef-b4fa-ffd952ab36a3","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"03a303d7-5935-4d2a-ba9f-9d3fd3e2e710","observation_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","study_id":"b4d0c863-a94f-4cb7-8c20-0544dadd2b55","volume_cm3":0.0},"target_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","target_table":"lesion_observations"},{"id":"e28b0b39-2d2d-4aa0-b175-f7fe02ead4f0","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"03a303d7-5935-4d2a-ba9f-9d3fd3e2e710","observation_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","study_id":"b4d0c863-a94f-4cb7-8c20-0544dadd2b55"},"target_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","target_table":"lesion_observations"}],"id":"82fff64f-8def-4062-b52a-b42dd5dc5c73","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/7deec6f6-b787-4b08-86cb-f2381eb36046.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/7deec6f6-b787-4b08-86cb-f2381eb36046.json new file mode 100644 index 0000000000000000000000000000000000000000..387ce5369309ae99ca26afff48dc2cca246320db --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/7deec6f6-b787-4b08-86cb-f2381eb36046.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L01 was measured at 1 timepoint, enhancing volume: preoperative: 43.6 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:13.989123Z","evidence_items":[{"id":"a626ae45-385e-4fde-b128-08db84f745c4","kind":"MEASUREMENT","label":"L01 volume 0.04 cm\u00b3 at preoperative","locator":{"lesion_id":"7deec6f6-b787-4b08-86cb-f2381eb36046","observation_id":"2bb84115-9b36-4bd3-9de9-53e1e729b44c","study_id":"0664cdeb-7fac-4da4-a80a-a55c6723ae2e","volume_cm3":0.04},"target_id":"2bb84115-9b36-4bd3-9de9-53e1e729b44c","target_table":"lesion_observations"},{"id":"025403c6-f415-4b73-a791-68dd940d06f1","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"7deec6f6-b787-4b08-86cb-f2381eb36046","observation_id":"2bb84115-9b36-4bd3-9de9-53e1e729b44c","study_id":"0664cdeb-7fac-4da4-a80a-a55c6723ae2e"},"target_id":"2bb84115-9b36-4bd3-9de9-53e1e729b44c","target_table":"lesion_observations"}],"id":"29057e53-befc-4b22-bf6b-59f52692ab9c","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/none.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/none/02a98a19-4bb3-44ed-8cd5-8a07fb856056.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/none/02a98a19-4bb3-44ed-8cd5-8a07fb856056.json new file mode 100644 index 0000000000000000000000000000000000000000..3d4cd6b66fc8d5a9914144a7d1aafef41843c39c --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/none/02a98a19-4bb3-44ed-8cd5-8a07fb856056.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L02 was measured at 1 timepoint, enhancing volume: preoperative: 0.1 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:13.846721Z","evidence_items":[{"id":"97974d99-0bbe-447a-a57d-610b9a886a98","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at preoperative","locator":{"lesion_id":"02a98a19-4bb3-44ed-8cd5-8a07fb856056","observation_id":"630f5433-607e-4a8e-bbe5-de3a347c4cdd","study_id":"0664cdeb-7fac-4da4-a80a-a55c6723ae2e","volume_cm3":0.0},"target_id":"630f5433-607e-4a8e-bbe5-de3a347c4cdd","target_table":"lesion_observations"},{"id":"a6610f07-1871-4958-8fcf-19ea2f4375f4","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"02a98a19-4bb3-44ed-8cd5-8a07fb856056","observation_id":"630f5433-607e-4a8e-bbe5-de3a347c4cdd","study_id":"0664cdeb-7fac-4da4-a80a-a55c6723ae2e"},"target_id":"630f5433-607e-4a8e-bbe5-de3a347c4cdd","target_table":"lesion_observations"}],"id":"fe0c4dd3-0e7f-459b-9493-1bbd92e3d61f","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/none/03a303d7-5935-4d2a-ba9f-9d3fd3e2e710.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/none/03a303d7-5935-4d2a-ba9f-9d3fd3e2e710.json new file mode 100644 index 0000000000000000000000000000000000000000..4c2b21b571897d4fda4531fde586bc399437d75c --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/none/03a303d7-5935-4d2a-ba9f-9d3fd3e2e710.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L03 was measured at 1 timepoint, enhancing volume: recurrence: 0.7 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:13.897650Z","evidence_items":[{"id":"349a571c-692d-4aef-b4fa-ffd952ab36a3","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"03a303d7-5935-4d2a-ba9f-9d3fd3e2e710","observation_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","study_id":"b4d0c863-a94f-4cb7-8c20-0544dadd2b55","volume_cm3":0.0},"target_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","target_table":"lesion_observations"},{"id":"e28b0b39-2d2d-4aa0-b175-f7fe02ead4f0","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"03a303d7-5935-4d2a-ba9f-9d3fd3e2e710","observation_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","study_id":"b4d0c863-a94f-4cb7-8c20-0544dadd2b55"},"target_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","target_table":"lesion_observations"}],"id":"82fff64f-8def-4062-b52a-b42dd5dc5c73","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/none/7deec6f6-b787-4b08-86cb-f2381eb36046.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/none/7deec6f6-b787-4b08-86cb-f2381eb36046.json new file mode 100644 index 0000000000000000000000000000000000000000..387ce5369309ae99ca26afff48dc2cca246320db --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/none/7deec6f6-b787-4b08-86cb-f2381eb36046.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L01 was measured at 1 timepoint, enhancing volume: preoperative: 43.6 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:13.989123Z","evidence_items":[{"id":"a626ae45-385e-4fde-b128-08db84f745c4","kind":"MEASUREMENT","label":"L01 volume 0.04 cm\u00b3 at preoperative","locator":{"lesion_id":"7deec6f6-b787-4b08-86cb-f2381eb36046","observation_id":"2bb84115-9b36-4bd3-9de9-53e1e729b44c","study_id":"0664cdeb-7fac-4da4-a80a-a55c6723ae2e","volume_cm3":0.04},"target_id":"2bb84115-9b36-4bd3-9de9-53e1e729b44c","target_table":"lesion_observations"},{"id":"025403c6-f415-4b73-a791-68dd940d06f1","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"7deec6f6-b787-4b08-86cb-f2381eb36046","observation_id":"2bb84115-9b36-4bd3-9de9-53e1e729b44c","study_id":"0664cdeb-7fac-4da4-a80a-a55c6723ae2e"},"target_id":"2bb84115-9b36-4bd3-9de9-53e1e729b44c","target_table":"lesion_observations"}],"id":"29057e53-befc-4b22-bf6b-59f52692ab9c","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/none/none.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/EVIDENCE_FOR_FINDING/none/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/LARGEST_CHANGE/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/none.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/LARGEST_CHANGE/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/LARGEST_CHANGE/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/LARGEST_CHANGE/2f4c8574-9ea0-4334-b96f-29f82fd556d5/none.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/LARGEST_CHANGE/2f4c8574-9ea0-4334-b96f-29f82fd556d5/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/LARGEST_CHANGE/2f4c8574-9ea0-4334-b96f-29f82fd556d5/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/LARGEST_CHANGE/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/none.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/LARGEST_CHANGE/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/LARGEST_CHANGE/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/LARGEST_CHANGE/none/none.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/LARGEST_CHANGE/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/LARGEST_CHANGE/none/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_CHANGED/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/none.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_CHANGED/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/none.json new file mode 100644 index 0000000000000000000000000000000000000000..402eaa6a32bd90bb26bd8dd95e3a187c3aeee43c --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_CHANGED/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/none.json @@ -0,0 +1 @@ +{"cached":false,"observation":{"answer_text":"No measured enhancing volume changed by more than 25%. 2 lesions had no prior to compare against: L01 measures 43.6 mm\u00b3 (first measurement, no prior to compare); L02 measures 0.1 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:13.459069Z","evidence_items":[{"id":"1e78103e-05f7-41eb-a943-a12dde0fd53f","kind":"MEASUREMENT","label":"L01 volume 0.04 cm\u00b3 at preoperative","locator":{"lesion_id":"7deec6f6-b787-4b08-86cb-f2381eb36046","observation_id":"2bb84115-9b36-4bd3-9de9-53e1e729b44c","study_id":"0664cdeb-7fac-4da4-a80a-a55c6723ae2e","volume_cm3":0.04},"target_id":"2bb84115-9b36-4bd3-9de9-53e1e729b44c","target_table":"lesion_observations"},{"id":"5624d9af-ca9f-45ee-9025-46888c446e4a","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"7deec6f6-b787-4b08-86cb-f2381eb36046","observation_id":"2bb84115-9b36-4bd3-9de9-53e1e729b44c","study_id":"0664cdeb-7fac-4da4-a80a-a55c6723ae2e"},"target_id":"2bb84115-9b36-4bd3-9de9-53e1e729b44c","target_table":"lesion_observations"},{"id":"f799a545-9e61-4780-af8a-e2d9742960e8","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at preoperative","locator":{"lesion_id":"02a98a19-4bb3-44ed-8cd5-8a07fb856056","observation_id":"630f5433-607e-4a8e-bbe5-de3a347c4cdd","study_id":"0664cdeb-7fac-4da4-a80a-a55c6723ae2e","volume_cm3":0.0},"target_id":"630f5433-607e-4a8e-bbe5-de3a347c4cdd","target_table":"lesion_observations"},{"id":"2664f52a-4ca3-4f1b-bede-70be080aa098","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"02a98a19-4bb3-44ed-8cd5-8a07fb856056","observation_id":"630f5433-607e-4a8e-bbe5-de3a347c4cdd","study_id":"0664cdeb-7fac-4da4-a80a-a55c6723ae2e"},"target_id":"630f5433-607e-4a8e-bbe5-de3a347c4cdd","target_table":"lesion_observations"}],"id":"3f819423-fcaa-4a30-83fb-098690e67b34","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_CHANGED/2f4c8574-9ea0-4334-b96f-29f82fd556d5/none.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_CHANGED/2f4c8574-9ea0-4334-b96f-29f82fd556d5/none.json new file mode 100644 index 0000000000000000000000000000000000000000..536bd808d7870cd5caa730bc9edffd6c38484ef5 --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_CHANGED/2f4c8574-9ea0-4334-b96f-29f82fd556d5/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measurements support an answer"} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_CHANGED/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/none.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_CHANGED/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/none.json new file mode 100644 index 0000000000000000000000000000000000000000..66bbab424c774777f5cc14dd61d820dc809b82e1 --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_CHANGED/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"No measured enhancing volume changed by more than 25%. 1 lesion had no prior to compare against: L03 measures 0.7 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:41.339914Z","evidence_items":[{"id":"5c0c1b7e-cbc0-454a-9568-e7b5422352e6","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"03a303d7-5935-4d2a-ba9f-9d3fd3e2e710","observation_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","study_id":"b4d0c863-a94f-4cb7-8c20-0544dadd2b55","volume_cm3":0.0},"target_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","target_table":"lesion_observations"},{"id":"d9ce64fd-35e8-4362-b09c-c23e3749462d","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"03a303d7-5935-4d2a-ba9f-9d3fd3e2e710","observation_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","study_id":"b4d0c863-a94f-4cb7-8c20-0544dadd2b55"},"target_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","target_table":"lesion_observations"}],"id":"e06689d6-2033-4efd-9e4f-4e3e589feeb0","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_CHANGED/none/none.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_CHANGED/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..66bbab424c774777f5cc14dd61d820dc809b82e1 --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_CHANGED/none/none.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"No measured enhancing volume changed by more than 25%. 1 lesion had no prior to compare against: L03 measures 0.7 mm\u00b3 (first measurement, no prior to compare). Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:19:41.339914Z","evidence_items":[{"id":"5c0c1b7e-cbc0-454a-9568-e7b5422352e6","kind":"MEASUREMENT","label":"L03 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"03a303d7-5935-4d2a-ba9f-9d3fd3e2e710","observation_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","study_id":"b4d0c863-a94f-4cb7-8c20-0544dadd2b55","volume_cm3":0.0},"target_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","target_table":"lesion_observations"},{"id":"d9ce64fd-35e8-4362-b09c-c23e3749462d","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"03a303d7-5935-4d2a-ba9f-9d3fd3e2e710","observation_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","study_id":"b4d0c863-a94f-4cb7-8c20-0544dadd2b55"},"target_id":"f42cf460-16e3-4d5c-a476-8e75f8b41022","target_table":"lesion_observations"}],"id":"e06689d6-2033-4efd-9e4f-4e3e589feeb0","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"WHAT_CHANGED","question_text":"What changed since the previous scan?","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_REMAINED_STABLE/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/none.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_REMAINED_STABLE/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af543f9540f61e6cc3a9aa73745474348db5f614 --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_REMAINED_STABLE/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion has a measured change at this timepoint"} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_REMAINED_STABLE/2f4c8574-9ea0-4334-b96f-29f82fd556d5/none.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_REMAINED_STABLE/2f4c8574-9ea0-4334-b96f-29f82fd556d5/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af543f9540f61e6cc3a9aa73745474348db5f614 --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_REMAINED_STABLE/2f4c8574-9ea0-4334-b96f-29f82fd556d5/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion has a measured change at this timepoint"} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_REMAINED_STABLE/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/none.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_REMAINED_STABLE/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af543f9540f61e6cc3a9aa73745474348db5f614 --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_REMAINED_STABLE/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion has a measured change at this timepoint"} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_REMAINED_STABLE/none/none.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_REMAINED_STABLE/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..af543f9540f61e6cc3a9aa73745474348db5f614 --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHAT_REMAINED_STABLE/none/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion has a measured change at this timepoint"} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHEN_LARGEST_CHANGE/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/none.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHEN_LARGEST_CHANGE/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHEN_LARGEST_CHANGE/0664cdeb-7fac-4da4-a80a-a55c6723ae2e/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHEN_LARGEST_CHANGE/2f4c8574-9ea0-4334-b96f-29f82fd556d5/none.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHEN_LARGEST_CHANGE/2f4c8574-9ea0-4334-b96f-29f82fd556d5/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHEN_LARGEST_CHANGE/2f4c8574-9ea0-4334-b96f-29f82fd556d5/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHEN_LARGEST_CHANGE/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/none.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHEN_LARGEST_CHANGE/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHEN_LARGEST_CHANGE/b4d0c863-a94f-4cb7-8c20-0544dadd2b55/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHEN_LARGEST_CHANGE/none/none.json b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHEN_LARGEST_CHANGE/none/none.json new file mode 100644 index 0000000000000000000000000000000000000000..2ec428f0b84f872b58fdf0703372e9635adae73d --- /dev/null +++ b/api/answers/2043be8c-57f4-4845-88d0-cadadd106f19/WHEN_LARGEST_CHANGE/none/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no measured change between any two studies"} \ No newline at end of file diff --git a/api/answers/2166fc98-aac6-45a6-855a-bad61c98e806/EVIDENCE_FOR_FINDING/7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5/2e8827c1-46a4-4399-8c94-2fa76af52e96.json b/api/answers/2166fc98-aac6-45a6-855a-bad61c98e806/EVIDENCE_FOR_FINDING/7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5/2e8827c1-46a4-4399-8c94-2fa76af52e96.json new file mode 100644 index 0000000000000000000000000000000000000000..f3f2ef25240bc60bb1beb8ad922a25a0eae33969 --- /dev/null +++ b/api/answers/2166fc98-aac6-45a6-855a-bad61c98e806/EVIDENCE_FOR_FINDING/7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5/2e8827c1-46a4-4399-8c94-2fa76af52e96.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L03 was measured at 1 timepoint, enhancing volume: recurrence: 12.2 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:40.216119Z","evidence_items":[{"id":"edd9d736-00e5-4fe4-9a55-dc1d5e1262ca","kind":"MEASUREMENT","label":"L03 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"2e8827c1-46a4-4399-8c94-2fa76af52e96","observation_id":"deb468e9-2694-4e8d-b629-a51cf4aa6452","study_id":"77bec26e-b844-4e0b-9769-3887372c01a0","volume_cm3":0.01},"target_id":"deb468e9-2694-4e8d-b629-a51cf4aa6452","target_table":"lesion_observations"},{"id":"776bc242-00e5-4b3d-baeb-5c047b20e762","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"2e8827c1-46a4-4399-8c94-2fa76af52e96","observation_id":"deb468e9-2694-4e8d-b629-a51cf4aa6452","study_id":"77bec26e-b844-4e0b-9769-3887372c01a0"},"target_id":"deb468e9-2694-4e8d-b629-a51cf4aa6452","target_table":"lesion_observations"}],"id":"bbf88798-ebbe-42f6-a47a-20250ed74b6b","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/2166fc98-aac6-45a6-855a-bad61c98e806/EVIDENCE_FOR_FINDING/7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5/9e47ef3f-ccc3-4b81-820a-cd83535c52d3.json b/api/answers/2166fc98-aac6-45a6-855a-bad61c98e806/EVIDENCE_FOR_FINDING/7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5/9e47ef3f-ccc3-4b81-820a-cd83535c52d3.json new file mode 100644 index 0000000000000000000000000000000000000000..568132f8b48bb9c0a68d7a0043c7bee44fb0b9ab --- /dev/null +++ b/api/answers/2166fc98-aac6-45a6-855a-bad61c98e806/EVIDENCE_FOR_FINDING/7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5/9e47ef3f-ccc3-4b81-820a-cd83535c52d3.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L02 was measured at 2 timepoints, enhancing volume: early-postoperative: 0.4 mm\u00b3; recurrence: 0.1 mm\u00b3 (-72.8%). Confidence 0.80; the interval between the two examinations is not recorded, the correspondence to the prior lesion is not confident, the similarity score for the correspondence is weak.","confidence":0.8,"created_at":"2026-08-18T22:23:40.275821Z","evidence_items":[{"id":"f2cde631-0d56-47cc-bfb8-99c0d22d0d0d","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at early-postoperative","locator":{"lesion_id":"9e47ef3f-ccc3-4b81-820a-cd83535c52d3","observation_id":"42da6cd5-511e-4ae0-88a0-d79caf318393","study_id":"7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5","volume_cm3":0.0},"target_id":"42da6cd5-511e-4ae0-88a0-d79caf318393","target_table":"lesion_observations"},{"id":"6bb9dd45-c231-45fb-91d0-8a698e64b30e","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"9e47ef3f-ccc3-4b81-820a-cd83535c52d3","observation_id":"42da6cd5-511e-4ae0-88a0-d79caf318393","study_id":"7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5"},"target_id":"42da6cd5-511e-4ae0-88a0-d79caf318393","target_table":"lesion_observations"},{"id":"8aae768d-b431-446b-a610-53b306727cc7","kind":"MEASUREMENT","label":"L02 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"9e47ef3f-ccc3-4b81-820a-cd83535c52d3","observation_id":"318f13bf-4ec3-4083-9c46-b639d1b5c978","study_id":"77bec26e-b844-4e0b-9769-3887372c01a0","volume_cm3":0.0},"target_id":"318f13bf-4ec3-4083-9c46-b639d1b5c978","target_table":"lesion_observations"},{"id":"fa8fea06-3355-4609-9a78-7a598c7ba223","kind":"SEGMENTATION","label":"Segmented enhancing for L02","locator":{"lesion_id":"9e47ef3f-ccc3-4b81-820a-cd83535c52d3","observation_id":"318f13bf-4ec3-4083-9c46-b639d1b5c978","study_id":"77bec26e-b844-4e0b-9769-3887372c01a0"},"target_id":"318f13bf-4ec3-4083-9c46-b639d1b5c978","target_table":"lesion_observations"}],"id":"865e2df8-d575-46a4-80f7-c630e7eae23e","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","quality flag on input: MATCH_UNCERTAIN","quality flag on input: WEAK_SCORE","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/2166fc98-aac6-45a6-855a-bad61c98e806/EVIDENCE_FOR_FINDING/7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5/c7ab0b24-d573-4fa9-b44c-a437ac7505b5.json b/api/answers/2166fc98-aac6-45a6-855a-bad61c98e806/EVIDENCE_FOR_FINDING/7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5/c7ab0b24-d573-4fa9-b44c-a437ac7505b5.json new file mode 100644 index 0000000000000000000000000000000000000000..d6a3437acf5c95da38c88666fefb2a6ca95ccf9b --- /dev/null +++ b/api/answers/2166fc98-aac6-45a6-855a-bad61c98e806/EVIDENCE_FOR_FINDING/7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5/c7ab0b24-d573-4fa9-b44c-a437ac7505b5.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L04 was measured at 1 timepoint, enhancing volume: recurrence: 0.2 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:40.330711Z","evidence_items":[{"id":"4a86ebdd-70e8-4df4-984c-f30f6936a2fa","kind":"MEASUREMENT","label":"L04 volume 0.0 cm\u00b3 at recurrence","locator":{"lesion_id":"c7ab0b24-d573-4fa9-b44c-a437ac7505b5","observation_id":"8cd8ed80-0a30-4196-a36c-6c9db2aabd33","study_id":"77bec26e-b844-4e0b-9769-3887372c01a0","volume_cm3":0.0},"target_id":"8cd8ed80-0a30-4196-a36c-6c9db2aabd33","target_table":"lesion_observations"},{"id":"e78dfa0b-e12a-4a32-ad5c-07b1032d792d","kind":"SEGMENTATION","label":"Segmented enhancing for L04","locator":{"lesion_id":"c7ab0b24-d573-4fa9-b44c-a437ac7505b5","observation_id":"8cd8ed80-0a30-4196-a36c-6c9db2aabd33","study_id":"77bec26e-b844-4e0b-9769-3887372c01a0"},"target_id":"8cd8ed80-0a30-4196-a36c-6c9db2aabd33","target_table":"lesion_observations"}],"id":"a65f793c-938f-43fa-b090-c84e00a395b6","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/2166fc98-aac6-45a6-855a-bad61c98e806/EVIDENCE_FOR_FINDING/7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5/f92a3b73-4dcf-4602-8c03-8abb61616f74.json b/api/answers/2166fc98-aac6-45a6-855a-bad61c98e806/EVIDENCE_FOR_FINDING/7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5/f92a3b73-4dcf-4602-8c03-8abb61616f74.json new file mode 100644 index 0000000000000000000000000000000000000000..48cfae8dd79d6dbb79df42e32b407aab9c26ac7e --- /dev/null +++ b/api/answers/2166fc98-aac6-45a6-855a-bad61c98e806/EVIDENCE_FOR_FINDING/7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5/f92a3b73-4dcf-4602-8c03-8abb61616f74.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L01 was measured at 1 timepoint, enhancing volume: preoperative: 33.8 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:40.400149Z","evidence_items":[{"id":"44f0e6da-5d0b-4267-a7fb-78aec23400ce","kind":"MEASUREMENT","label":"L01 volume 0.03 cm\u00b3 at preoperative","locator":{"lesion_id":"f92a3b73-4dcf-4602-8c03-8abb61616f74","observation_id":"d6dc09d2-119e-4afc-952f-2fef4ca01e52","study_id":"7f3fa908-e65f-45ec-998d-7971a6ade75b","volume_cm3":0.03},"target_id":"d6dc09d2-119e-4afc-952f-2fef4ca01e52","target_table":"lesion_observations"},{"id":"17276e01-96c0-4810-b74e-447841fa44a4","kind":"SEGMENTATION","label":"Segmented enhancing for L01","locator":{"lesion_id":"f92a3b73-4dcf-4602-8c03-8abb61616f74","observation_id":"d6dc09d2-119e-4afc-952f-2fef4ca01e52","study_id":"7f3fa908-e65f-45ec-998d-7971a6ade75b"},"target_id":"d6dc09d2-119e-4afc-952f-2fef4ca01e52","target_table":"lesion_observations"}],"id":"4534932c-98e9-43c2-90ba-c8f16b1c6975","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file diff --git a/api/answers/2166fc98-aac6-45a6-855a-bad61c98e806/EVIDENCE_FOR_FINDING/7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5/none.json b/api/answers/2166fc98-aac6-45a6-855a-bad61c98e806/EVIDENCE_FOR_FINDING/7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5/none.json new file mode 100644 index 0000000000000000000000000000000000000000..373538fea7b80d49ebf99b23f193aa883e53b9ce --- /dev/null +++ b/api/answers/2166fc98-aac6-45a6-855a-bad61c98e806/EVIDENCE_FOR_FINDING/7388fa67-3ca2-4c5a-a0bb-2b7dd8374ed5/none.json @@ -0,0 +1 @@ +{"__recorded_status":422,"detail":"No answer can be supported by the measurements: no lesion specified"} \ No newline at end of file diff --git a/api/answers/2166fc98-aac6-45a6-855a-bad61c98e806/EVIDENCE_FOR_FINDING/77bec26e-b844-4e0b-9769-3887372c01a0/2e8827c1-46a4-4399-8c94-2fa76af52e96.json b/api/answers/2166fc98-aac6-45a6-855a-bad61c98e806/EVIDENCE_FOR_FINDING/77bec26e-b844-4e0b-9769-3887372c01a0/2e8827c1-46a4-4399-8c94-2fa76af52e96.json new file mode 100644 index 0000000000000000000000000000000000000000..f3f2ef25240bc60bb1beb8ad922a25a0eae33969 --- /dev/null +++ b/api/answers/2166fc98-aac6-45a6-855a-bad61c98e806/EVIDENCE_FOR_FINDING/77bec26e-b844-4e0b-9769-3887372c01a0/2e8827c1-46a4-4399-8c94-2fa76af52e96.json @@ -0,0 +1 @@ +{"cached":true,"observation":{"answer_text":"L03 was measured at 1 timepoint, enhancing volume: recurrence: 12.2 mm\u00b3. Confidence 0.92; the interval between the two examinations is not recorded.","confidence":0.92,"created_at":"2026-08-18T22:23:40.216119Z","evidence_items":[{"id":"edd9d736-00e5-4fe4-9a55-dc1d5e1262ca","kind":"MEASUREMENT","label":"L03 volume 0.01 cm\u00b3 at recurrence","locator":{"lesion_id":"2e8827c1-46a4-4399-8c94-2fa76af52e96","observation_id":"deb468e9-2694-4e8d-b629-a51cf4aa6452","study_id":"77bec26e-b844-4e0b-9769-3887372c01a0","volume_cm3":0.01},"target_id":"deb468e9-2694-4e8d-b629-a51cf4aa6452","target_table":"lesion_observations"},{"id":"776bc242-00e5-4b3d-baeb-5c047b20e762","kind":"SEGMENTATION","label":"Segmented enhancing for L03","locator":{"lesion_id":"2e8827c1-46a4-4399-8c94-2fa76af52e96","observation_id":"deb468e9-2694-4e8d-b629-a51cf4aa6452","study_id":"77bec26e-b844-4e0b-9769-3887372c01a0"},"target_id":"deb468e9-2694-4e8d-b629-a51cf4aa6452","target_table":"lesion_observations"}],"id":"bbf88798-ebbe-42f6-a47a-20250ed74b6b","llm_model":"google/medgemma-27b-text-it","llm_provider":"none","question":"EVIDENCE_FOR_FINDING","question_text":"Show me the evidence for this lesion.","safety_notes":["quality flag on input: NO_INTERVAL","composed from findings without a language model"],"safety_status":"PASSED"}} \ No newline at end of file