@fnndsc/argus 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{t as T,E as R,e as M,B as We,v as Ae,a as ne,b as F,s as ke,c as Fe,f as oe,cw as ue,c8 as Ne,bW as P,aK as z,cx as fe,aJ as Y,ag as se,V as G,cy as ge,cz as D,cA as Ue,cB as Ge,cC as Be,bL as He,at as O,aO as ze,bi as B,cD as me,bN as je,cE as he,bt as $e,b_ as qe,cF as ie,cG as E,cH as H,cI as J,cJ as L,cK as re,cL as Je,cM as Ke,cN as Ze,bC as pe,am as Q,b8 as ee,cO as Xe,cP as Ye,ai as Qe,ar as we,bm as te,i as Ie,L as Ve,bK as Se,cQ as be,bA as Z,bG as et,bc as ve,bz as N,cR as ae,cS as Ee,bP as ye,cT as tt,cr as nt,K as ot,cU as st,cV as it,c1 as rt,cW as at,cX as ct,bf as lt,cY as dt,cZ as ut,c_ as ft,c$ as gt,bp as mt,d0 as ht,d1 as pt,d2 as wt,d3 as It,d4 as Vt,d5 as St,d6 as bt,d7 as vt,bg as Et,d8 as yt,av as Rt,d9 as Ct,da as Pt,H as Tt,b7 as xt,bk as Mt,db as Dt,dc as Ot,J as _t,dd as Lt,bo as Wt,de as At,df as kt,bq as Ft,dg as Nt,bs as Ut,dh as Gt,bR as Bt,di as Ht,dj as zt,bF as jt,bj as $t,dk as qt,bh as Jt,bn as Kt,dl as Zt,dm as Xt,dn as Yt,dp as Qt,dq as en,dr as tn,ds as nn,dt as on,bl as sn,bZ as rn,du as an,bT as cn,dv as ln,bS as dn,bv as un,br as fn,ct as gn,dw as mn,dx as hn,bI as pn,dy as wn,M as In,dz as Vn,dA as Sn,bw as bn,dB as vn,bD as En,bJ as yn,dC as Rn,dD as Cn,bM as Pn,dE as Tn,dF as xn,dG as Mn,bY as Dn}from"./Settings-CFaVCNLh.js";import"./Texture--SwN-Vnl.js";import"./cornerstoneEngine-Bvuqk7P7.js";function On(e){return!!(e&&typeof e.setVolumes=="function"&&typeof e.addVolumes=="function")}async function _n(e,t,n,o=!1,i=!1){const s=n.map(r=>{const a=e.getViewport(r);if(!a)throw new Error(`Viewport with Id ${r} does not exist`);if(!On(a))throw new Error("setVolumesForViewports only supports viewports that implement setVolumes");return a});await Promise.all(s.map(r=>r.setVolumes(t,o,i)))}function Ln(e,t,n=0){const o=e.getOpenGLRenderWindow?.()?.getCanvas?.();o&&(o.addEventListener("webglcontextlost",()=>{console.warn(`CornerstoneRender: WebGL context lost (renderingEngine=${t}, context=${n})`),T(M,R.WEBGL_CONTEXT_LOST,{renderingEngineId:t,contextIndex:n})}),o.addEventListener("webglcontextrestored",()=>{T(M,R.WEBGL_CONTEXT_RESTORED,{renderingEngineId:t,contextIndex:n})}))}class Wn extends We{constructor(t){super(t),this._renderFlaggedViewports=()=>{this._throwIfDestroyed(),this.offscreenMultiRenderWindow&&this.performVtkDrawCall();const n=this._getViewportsAsArray(),o=[];for(let i=0;i<n.length;i++){const s=n[i];if(this._needsRender.has(s.id)){const r=this.renderViewportUsingCustomOrVtkPipeline(s);if(o.push(r),s.setRendered(),this._needsRender.delete(s.id),this._needsRender.size===0)break}}this._animationFrameSet=!1,this._animationFrameHandle=null,o.forEach(i=>{i?.element&&T(i.element,R.IMAGE_RENDERED,i)})},this.useCPURendering||this.ensureOffscreenResources()}ensureOffscreenResources(){this.offscreenMultiRenderWindow||(this.offscreenMultiRenderWindow=Ae.newInstance(),this.offScreenCanvasContainer=document.createElement("div"),this.offscreenMultiRenderWindow.setContainer(this.offScreenCanvasContainer),Ln(this.offscreenMultiRenderWindow,this.id))}enableVTKjsDrivenViewport(t){this.ensureOffscreenResources();const o=this._getViewportsAsArray().filter(l=>ne(l.type)===!1),i=o.map(l=>l.canvas),s=F(t.element);i.push(s);const{offScreenCanvasWidth:r,offScreenCanvasHeight:a}=this._resizeOffScreenCanvas(i),c=this._resize(o,r,a),d={...t,canvas:s};this.addVtkjsDrivenViewport(d,{offScreenCanvasWidth:r,offScreenCanvasHeight:a,xOffset:c})}addVtkjsDrivenViewport(t,n){this.ensureOffscreenResources();const{element:o,canvas:i,viewportId:s,type:r,defaultOptions:a}=t;o.tabIndex=-1,ke(o);const{offScreenCanvasWidth:c,offScreenCanvasHeight:d,xOffset:l}=n,{sxStartDisplayCoords:u,syStartDisplayCoords:f,sxEndDisplayCoords:m,syEndDisplayCoords:w,sx:V,sy:h,sWidth:g,sHeight:b}=this._getViewportCoordsOnOffScreenCanvas(t,c,d,l);this.offscreenMultiRenderWindow.addRenderer({viewport:[u,f,m,w],id:s,background:a.background?a.background:[0,0,0]});const S={id:s,element:o,renderingEngineId:this.id,type:r,canvas:i,sx:V,sy:h,sWidth:g,sHeight:b,defaultOptions:a||{}},v=Fe(t);if(!v)throw new Error(`Viewport Type ${r} is not supported`);const p=new v(S);p.requestedType=t.requestedType??r,this._viewports.set(s,p);const y={element:o,viewportId:s,renderingEngineId:this.id};p.suppressEvents||T(M,R.ELEMENT_ENABLED,y)}setVtkjsDrivenViewports(t){if(t.length){const n=t.map(r=>F(r.element));n.forEach(r=>{const a=window.devicePixelRatio||1,c=r.getBoundingClientRect();r.width=c.width*a,r.height=c.height*a});const{offScreenCanvasWidth:o,offScreenCanvasHeight:i}=this._resizeOffScreenCanvas(n);let s=0;for(let r=0;r<t.length;r++){const a=t[r],c=n[r],d={...a,canvas:c};this.addVtkjsDrivenViewport(d,{offScreenCanvasWidth:o,offScreenCanvasHeight:i,xOffset:s}),s+=c.width}}}_resizeVTKViewports(t,n=!0,o=!0){const i=t.map(s=>F(s.element));if(i.forEach(s=>{const r=window.devicePixelRatio||1;s.width=s.clientWidth*r,s.height=s.clientHeight*r}),i.length){const{offScreenCanvasWidth:s,offScreenCanvasHeight:r}=this._resizeOffScreenCanvas(i);this._resize(t,s,r)}t.forEach(s=>{const r=s.getCamera(),a=s.getRotation(),{flipHorizontal:c}=r,d=s;d.resetViewStateForResize?d.resetViewStateForResize():d.resetCameraForResize();const l=s.getDisplayArea();n&&(l?(c&&s.setCamera({flipHorizontal:c}),a&&s.setViewPresentation({rotation:a})):s.setCamera(r))}),o&&this.render()}performVtkDrawCall(){const{offscreenMultiRenderWindow:t}=this,n=t.getRenderWindow(),o=t.getRenderers();if(o.length){for(let i=0;i<o.length;i++){const{renderer:s,id:r}=o[i],a=r.split("::")[0];this._needsRender.has(a)?s.setDraw(!0):s.setDraw(!1)}n.render();for(let i=0;i<o.length;i++)o[i].renderer.setDraw(!1)}}renderViewportUsingCustomOrVtkPipeline(t){let n;if(t.sWidth<oe||t.sHeight<oe){console.warn("Viewport is too small",t.sWidth,t.sHeight);return}if(ne(t.type)===!0)n=t.customRenderViewportToCanvas();else{if(!this.offscreenMultiRenderWindow)throw new Error("GPU not available, and using a viewport with no custom render pipeline.");const{offscreenMultiRenderWindow:o}=this,r=o.getOpenGLRenderWindow().get3DContext().canvas;n=this._renderViewportFromVtkCanvasToOnscreenCanvas(t,r)}return n}_renderViewportFromVtkCanvasToOnscreenCanvas(t,n){const{element:o,canvas:i,sx:s,sy:r,sWidth:a,sHeight:c,id:d,renderingEngineId:l,suppressEvents:u}=t,{width:f,height:m}=i;return i.getContext("2d").drawImage(n,s,r,a,c,0,0,f,m),{element:o,suppressEvents:u,viewportId:d,renderingEngineId:l,viewportStatus:t.viewportStatus}}_resizeOffScreenCanvas(t){const{offScreenCanvasContainer:n,offscreenMultiRenderWindow:o}=this,i=Math.max(...t.map(r=>r.height));let s=0;return t.forEach(r=>{s+=r.width}),n.width=s,n.height=i,o.resize(),{offScreenCanvasWidth:s,offScreenCanvasHeight:i}}_resize(t,n,o){let i=0;for(let s=0;s<t.length;s++){const r=t[s],{sxStartDisplayCoords:a,syStartDisplayCoords:c,sxEndDisplayCoords:d,syEndDisplayCoords:l,sx:u,sy:f,sWidth:m,sHeight:w}=this._getViewportCoordsOnOffScreenCanvas(r,n,o,i);i+=r.canvas.width,r.sx=u,r.sy=f,r.sWidth=m,r.sHeight=w,this.offscreenMultiRenderWindow.getRenderer(r.id).setViewport(a,c,d,l)}return i}_getViewportCoordsOnOffScreenCanvas(t,n,o,i){const{canvas:s}=t,{width:r,height:a}=s,c=i,d=0,l=c/n,u=d+(o-a)/o,f=r/n,m=a/o;return{sxStartDisplayCoords:l,syStartDisplayCoords:u,sxEndDisplayCoords:l+f,syEndDisplayCoords:u+m,sx:c,sy:d,sWidth:r,sHeight:a}}}function No(e){return!!(e&&typeof e.canvasToWorld=="function"&&typeof e.worldToCanvas=="function")}function Uo(e){return!!(e&&typeof e.getZoom=="function"&&typeof e.setZoom=="function")}function Go(e){return!!(e&&typeof e.getPan=="function"&&typeof e.setPan=="function")}function An(e){return!!(e&&typeof e.getFrameOfReferenceUID=="function")}class kn{constructor(){this._targetsEventListeners=new Map}addEventListener(t,n,o,i){let s=this._targetsEventListeners.get(t);s||(s=new ue(t),this._targetsEventListeners.set(t,s)),s.addEventListener(n,o,i)}removeEventListener(t,n,o,i){const s=this._targetsEventListeners.get(t);s&&(s.removeEventListener(n,o,i),s.isEmpty&&this._targetsEventListeners.delete(t))}reset(){Array.from(this._targetsEventListeners.entries()).forEach(([t,n])=>{n.reset(),this._targetsEventListeners.delete(t)})}}const Fn=Object.freeze(Object.defineProperty({__proto__:null,MultiTargetEventListenerManager:kn,TargetEventListeners:ue},Symbol.toStringTag,{value:"Module"}));function Nn(e,t){const n=e.getSize();for(let o=0;o<n;o++){const i=[];e.getNodeValue(o,i),i[1]=i[1]*t,i[2]=i[2]*t,i[3]=i[3]*t,e.setNodeValue(o,i)}}const Un=Symbol("LastRuntimeId"),Gn={},Bn=4294967295,Hn="-";function zn(e,t,n){return jn(e!==null&&typeof e=="object"?e:Gn,Un,(typeof n=="number"&&n>0?n:Bn)>>>0).join(typeof t=="string"?t:Hn)}function jn(e,t,n){let o=e[t];o instanceof Array||(o=[0],Object.defineProperty(e,t,{value:o}));for(let i=!0,s=0;i&&s<o.length;++s){let r=o[s]|0;r<n?(i=!1,r=r+1):(r=0,s+1===o.length&&o.push(0)),o[s]=r}return o}const $n=Ne;function qn(e,t,n=1e-5){return Math.abs(e[0]+t[0])<n&&Math.abs(e[1]+t[1])<n&&Math.abs(e[2]+t[2])<n}function Jn(e,t){return!(e[0]<0||e[0]>=t[0]||e[1]<0||e[1]>=t[1]||e[2]<0||e[2]>=t[2])}function Kn(e,t){return!(e[0]<-P||e[0]>=t[0]+P||e[1]<-P||e[1]>=t[1]+P||e[2]<-P||e[2]>=t[2]+P)}function Zn(e,t){let n;t?n=[Y(t)]:n=z();const o=[];return n.forEach(i=>{const s=e.getActors(),r=i.getViewports().filter(fe);for(const a of r){const c=a.getActors();if(c.length!==s.length)continue;s.every(({uid:l})=>c.find(u=>l===u.uid))&&o.push(a)}}),o}function Re(e,t,n=void 0,o="_thumbnails",i={displayArea:{imageArea:[1,1]}}){if(!e||!(e instanceof HTMLCanvasElement))throw new Error("canvas element is required");const s=!t.imageId,r=!s&&t,a=s&&t,d=`renderGPUViewport-${r.imageId||a.volumeId}`,l=document.createElement("div"),u=window.devicePixelRatio||1;i.displayArea||(i.displayArea={imageArea:[1,1]});const f=e.width,m=e.height;l.style.width=`${f/u+se}px`,l.style.height=`${m/u+se}px`,l.style.visibility="hidden",l.style.position="absolute",document.body.appendChild(l);const w=d.split(":").join("-");l.setAttribute("viewport-id-for-remove",w);const V=F(l),h=Y(o)||new Wn(o);let g=h.getViewport(d);if(!g){const b={viewportId:d,type:s?G.ORTHOGRAPHIC:G.STACK,element:l,defaultOptions:{...i,suppressEvents:!0}};h.enableElement(b),g=h.getViewport(d)}return new Promise(b=>{let S=!1,{viewReference:v}=i;const p=y=>{if(S)return;if(v){const A=v;v=null,g.setViewReference(A),g.render();return}e.getContext("2d").drawImage(V,0,0,V.width,V.height,0,0,e.width,e.height);const I=g.canvasToWorld([0,0]),C=g.canvasToWorld([V.width/u,0]),$=g.canvasToWorld([0,V.height/u]),_=D([0,0,0],g.canvasToWorld([1/u,0]),I),W=D([0,0,0],g.canvasToWorld([0,1/u]),I),q=1;S=!0,l.removeEventListener(R.IMAGE_RENDERED,p),setTimeout(()=>{h.disableElement(d),document.querySelectorAll(`[viewport-id-for-remove="${w}"]`).forEach(Le=>{Le.remove()})},0),b({origin:I,bottomLeft:$,topRight:C,thicknessMm:q,rightVector:_,downVector:W})};l.addEventListener(R.IMAGE_RENDERED,p),s?g.setVolumes([a],!1,!0):g.renderImageObject(t),g.resetCamera(),n==="PT"&&!ge(r)&&g.setProperties({voiRange:{lower:r.minPixelValue,upper:r.maxPixelValue}}),g.render()})}function Ce(e,t,n,o,i){if(t.volumeId)throw new Error("Unsupported volume rendering for CPU");const r=t,a=Ue(e,r,n),c={canvas:e,viewport:a,image:r,renderingTools:{}};c.transform=Ge(c);const d=!0;return new Promise((l,u)=>{Be(c,d),l(null)})}function Xn(e){const{canvas:t,imageId:n,viewReference:o,requestType:i=He.Thumbnail,priority:s=-5,renderingEngineId:r="_thumbnails",useCPURendering:a=!1,thumbnail:c=!1,imageAspect:d=!1,viewportOptions:l}=e,u=o?.volumeId,f=u&&!n,m=o&&l?{...l,viewReference:o}:l,w=a?Ce:Re;return new Promise((V,h)=>{function g(p,y){const{modality:x}=B(me.GENERAL_SERIES,y)||{},I=!f&&p,C=f&&p;I&&(I.isPreScaled=I.isPreScaled||I.preScale?.scaled),c&&(t.height=256,t.width=256),d&&I&&(t.width=I&&t.height*I.width/I.height),t.style.width=`${t.width/devicePixelRatio}px`,t.style.height=`${t.height/devicePixelRatio}px`,C&&a&&h(new Error("CPU rendering of volume not supported")),w(t,p,x,r,m).then(V)}function b(p,y){console.error(p,y),h(p)}function S(p,y,x){return je(p,x).then(I=>{g.call(this,I,p)},I=>{b.call(this,I,p)})}const v={useRGBA:!!a,requestType:i};if(u){const p=O.getVolume(u);p||h(new Error(`Volume id ${u} not found in cache`));const y=p.imageIds[0];g(p,y)}else ze.addRequest(S.bind(null,n,null,v),i,{imageId:n},s)})}function Yn(e){const t=z(),n=[];return t.forEach(o=>{o.getViewports().filter(he).forEach(s=>{s.hasImageURI(e)&&n.push(s)})}),n}function Qn(e,t){const n=eo(e,t);return n?n.index:null}function eo(e,t){const n=t.getImageIds(),o=t.getCurrentImageIdIndex();if(n.length===0)return null;const i=c=>{const d=to(c);if(!d)return null;const l=$e(d.planeNormal,d.imagePositionPatient);return qe(l,e)},s={distance:i(n[o])??1/0,index:o},r=n.slice(o+1);for(let c=0;c<r.length;c++){const d=r[c],l=i(d);if(l!==null)if(l<=s.distance)s.distance=l,s.index=c+o+1;else break}const a=n.slice(0,o);for(let c=a.length-1;c>=0;c--){const d=a[c],l=i(d);if(!(l===null||l===s.distance))if(l<s.distance)s.distance=l,s.index=c;else break}return s.distance===1/0?null:s}function to(e){const t=B(me.IMAGE_PLANE,e);if(!t||!(t.rowCosines instanceof Array&&t.rowCosines.length===3)||!(t.columnCosines instanceof Array&&t.columnCosines.length===3)||!(t.imagePositionPatient instanceof Array&&t.imagePositionPatient.length===3))return null;const{rowCosines:n,columnCosines:o,imagePositionPatient:i}=t,s=ie(E(),...n),r=ie(E(),...o),a=H(E(),s,r);return{rowCosines:n,columnCosines:o,imagePositionPatient:i,planeNormal:a}}function no(e){const{width:t,height:n}=e.getCanvas(),{sliceToIndexMatrix:o,indexToSliceMatrix:i}=e.getSliceViewInfo(),s=J(e,[0,0]),r=J(e,[t-1,0]),a=J(e,[0,n-1]),c=D(E(),r,s),d=D(E(),a,s),l=H(E(),c,d);L(c,c),L(d,d),L(l,l);const u=Math.max(Math.abs(c[0]),Math.abs(c[1]),Math.abs(c[2])),f=Math.max(Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2]));if(!re(1,u)||!re(1,f))throw new Error("getCurrentVolumeViewportSlice is not available for rotate/oblique viewports");const{voxelManager:m}=e.getImageData(),w=e.getSliceViewInfo(),V=m.getSliceData(w);return{width:w.width,height:w.height,scalarData:V,sliceToIndexMatrix:o,indexToSliceMatrix:i}}const oo=.05;function so(e,t){const n=e.getSliceIndex(),o=t.getSliceIndex(),i=B("imagePlaneModule",n.toString()),s=B("imagePlaneModule",o.toString());if(!i||!s){console.log("Viewport spatial registration requires image plane module");return}const{imageOrientationPatient:r}=s;if(!i.imageOrientationPatient.every((f,m)=>Math.abs(f-r[m])<oo)){console.log("Viewport spatial registration only supported for same orientation (hence translation only) for now",i?.imageOrientationPatient,s?.imageOrientationPatient);return}const c=i.imagePositionPatient,d=s.imagePositionPatient,l=Je(E(),c,d),u=Ke(Ze(),l);pe.add([e.id,t.id],u)}function io(e){const{imageData:t,dimensions:n}=e.getImageData()||{};if(!t||!n)return[];const{canvas:o}=e,i=window.devicePixelRatio,s=[0,0],r=[o.width/i,0],a=[o.width/i,o.height/i],c=[0,o.height/i],d=e.canvasToWorld(s),l=e.canvasToWorld(r),u=e.canvasToWorld(a),f=e.canvasToWorld(c),m=t.worldToIndex(d),w=t.worldToIndex(l),V=t.worldToIndex(u),h=t.worldToIndex(f);return ro({dimensions:n,imageData:t,topLeftImage:m,topRightImage:w,bottomRightImage:V,bottomLeftImage:h,topLeftWorld:d,topRightWorld:l,bottomRightWorld:u,bottomLeftWorld:f})}function ro({dimensions:e,imageData:t,topLeftImage:n,topRightImage:o,bottomRightImage:i,bottomLeftImage:s,topLeftWorld:r,topRightWorld:a,bottomRightWorld:c,bottomLeftWorld:d}){const l=k(n,e)?r:t.indexToWorld([0,0,0]),u=k(o,e)?a:t.indexToWorld([e[0]-1,0,0]),f=k(i,e)?c:t.indexToWorld([e[0]-1,e[1]-1,0]),m=k(s,e)?d:t.indexToWorld([0,e[1]-1,0]);return[l,u,m,f]}function k(e,t){return e[0]>0||e[0]<t[0]-1||e[1]>0||e[1]<t[1]-1||e[2]>0||e[2]<t[2]-1}function j(e){if(!e)return;const{viewportUid:t,renderingEngineUid:n}=e.dataset;return Pe(t,n)}function Pe(e,t){if(!t||!e)return;const n=Y(t);if(!n||n.hasBeenDestroyed)return;const o=n.getViewport(e);if(!o)return;const i=An(o)?o.getFrameOfReferenceUID():void 0;return{viewport:o,renderingEngine:n,viewportId:e,renderingEngineId:t,FrameOfReferenceUID:i}}function Bo(e){const t=z();for(let n=0;n<t.length;n++){const o=t[n];if(o.getViewport(e))return Pe(e,o.id)}}function Ho(){const e=[];return z().forEach(n=>{n.getViewports().forEach(({element:i})=>{e.push(j(i))})}),e}function ao(e){const t=j(e);if(!t)return;const{viewport:n}=t;if(!(n instanceof Q))throw new Error(`An image can only be fetched for a stack viewport and not for a viewport of type: ${n.type}`);return n.getCornerstoneImage()}async function co({viewport:e,options:t={}}){const n=e.getRenderingEngine();let o=t.volumeId||`${ee()}`;o.split(":").length===0&&(o=`${Xe()}:${o}`);const{id:i,element:s}=e,r=t.viewportId||i,a=e.getImageIds(),c=e.getViewPresentation(),d=e.getViewReference();n.enableElement({viewportId:r,type:G.ORTHOGRAPHIC,element:s,defaultOptions:{background:t.background,orientation:t.orientation}}),(await Ye(o,{imageIds:a})).load();const u=n.getViewport(r);await _n(n,[{volumeId:o}],[r]);const f=()=>{u.render(),s.removeEventListener(R.VOLUME_VIEWPORT_NEW_VOLUME,f)};return s.addEventListener(R.VOLUME_VIEWPORT_NEW_VOLUME,f),u.setViewPresentation(c),u.setViewReference(d),u.render(),u}async function lo({viewport:e,options:t}){const n=e,{id:o,element:i}=n,s=e.getRenderingEngine(),{background:r}=t,a=t.viewportId||o,c=O.getVolume(n.getVolumeId());if(!(c instanceof Qe))throw new 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.");const d={viewportId:a,type:G.STACK,element:i,defaultOptions:{background:r}},l=n.getViewReference();s.enableElement(d);const u=s.getViewport(a);return await u.setStack(c.imageIds),u.setViewReference(l),u.render(),u}function Te(e,t=2){if(Array.isArray(e))return e.map(i=>Te(i,t)).join(", ");if(e==null||e==="")return"NaN";e=Number(e);const n=Math.abs(e);if(n<1e-4)return`${e}`;const o=n>=100?t-2:n>=10?t-1:n>=1?t:n>=.1?t+1:n>=.01?t+2:n>=.001?t+3:t+4;return e.toFixed(o)}function uo(e){return Math.round(e/P)*P}function fo(e,t,n){const o=e.length===t*n*4,i=e.length===t*n*3;if(o||i){const s=new Float32Array(t*n);let r=0,a=0;const c=o?4:3;for(let d=0;d<t;d++)for(let l=0;l<n;l++){const u=e[r],f=e[r+1],m=e[r+2];s[a]=(u+f+m)/3,r+=c,a++}return s}else return e}function go(e){if(e instanceof we)return O.getVolume(e.getVolumeId()).imageIds;if(e.getImageIds)return e.getImageIds()}function mo(e,t){const n=[...e];return t>=n.length?(ce(n),n):(ce(n),n.slice(0,t))}function ce(e){for(let t=e.length-1;t>0;t--){const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}}function K(e){const t=e.toString(16);return t.length==1?"0"+t:t}function ho(e,t,n){return"#"+K(e)+K(t)+K(n)}function po(e){const 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}const wo=Object.freeze(Object.defineProperty({__proto__:null,hexToRgb:po,rgbToHex:ho},Symbol.toStringTag,{value:"Module"}));function Io(e,t){if(e===t)return!0;if(e==null||t==null)return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch(n){return console.debug("Error in JSON.stringify during deep comparison:",n),e===t}}function xe(e,t){const n=e,o=n.getActors?.()??[];return(t?o.find(s=>s.referencedId===t)??o.find(s=>s.referencedId?.endsWith(`:${t}`)):void 0)?.referencedId??(t?te(t):void 0)??n.getDefaultActor?.()?.referencedId}function Me(e,t,n){if(!n)throw new Error("getVolume is required, use the utilities export instead");if(Ie(e)){const o=xe(e,t),i=o?n(o):void 0,s=e.getImageData?.();return{modality:i?.metadata?.Modality??s?.metadata?.Modality,isPreScaled:le(i?.scaling)}}if(typeof e.setVolumes=="function"){const i=t?te(t):e.getVolumeId(),s=i?n(i):void 0;return{modality:s?.metadata?.Modality,isPreScaled:le(s?.scaling)}}if(typeof e.setStack=="function"){const o=e,{preScale:i}=o.getImageData()||{};return{modality:o.modality,isPreScaled:!!i?.scaled}}}function le(e){return!!e&&Object.keys(e).length>0}function Vo(e,t,n){const o=Me(e,t,n);if(!o)throw new Error("Invalid viewport type");return o.modality}function So(e){const{imageIdGroups:t,splittingTag:n}=Ve(e);return{isDynamicVolume:t.length>1,timePoints:t,splittingTag:n}}function bo(e,t){const n=e.length,{rescaleSlope:o,rescaleIntercept:i,suvbw:s}=t;if(t.modality==="PT"&&typeof s=="number")for(let r=0;r<n;r++)e[r]=s*(e[r]*o+i);else for(let r=0;r<n;r++)e[r]=e[r]*o+i;return e}function De(e,t,n){return Math.min(Math.max(t,e),n)}function Oe(e,t){if(!j(e.element))throw new Error("Scroll::Viewport is not enabled (it might be disabled)");if(e instanceof Q&&e.getImageIds().length===0)throw new Error("Scroll::Stack Viewport has no images");const{volumeId:o,delta:i,scrollSlabs:s}=t;if(e instanceof we)vo(e,o,i,s);else{if(typeof e.getCurrentImageIdIndex!="function"||typeof e.scroll!="function")return;const r=e.getCurrentImageIdIndex();if(r+i>e.getImageIds().length-1||r+i<0){const a={imageIdIndex:r,direction:i};T(M,R.STACK_SCROLL_OUT_OF_BOUNDS,a)}e.scroll(i,t.debounceLoading,t.loop)}}function vo(e,t,n,o=!1){const i=o,{numScrollSteps:s,currentStepIndex:r,sliceRangeInfo:a}=Se(e,t,i);if(s===0||!a)return;const{sliceRange:c,spacingInNormalDirection:d,camera:l}=a,{focalPoint:u,viewPlaneNormal:f,position:m}=l,{newFocalPoint:w,newPosition:V}=be(u,m,c,f,d,n);e.setCamera({focalPoint:w,position:V}),e.render();const h=r+n,g={volumeId:t,viewport:e,delta:n,desiredStepIndex:h,currentStepIndex:r,numScrollSteps:s,currentImageId:e.getCurrentImageId()};(h>s||h<0)&&e.getCurrentImageId()?T(M,R.VOLUME_VIEWPORT_SCROLL_OUT_OF_BOUNDS,g):T(M,R.VOLUME_VIEWPORT_SCROLL,g)}async function Eo(e,t={}){const{imageIndex:n,debounceLoading:o,volumeId:i}=t,s=j(e);if(!s)throw new Error("Element has been disabled");const{viewport:r}=s,{imageIndex:a,numberOfSlices:c}=yo(r,o),l=Ro(c,n)-a;Oe(r,{delta:l,debounceLoading:o,volumeId:i})}function yo(e,t){return e instanceof Q?{numberOfSlices:e.getImageIds().length,imageIndex:t?e.getTargetImageIdIndex():e.getCurrentImageIdIndex()}:{numberOfSlices:e.getNumberOfSlices(),imageIndex:e.getSliceIndex()}}function Ro(e,t){const n=e-1;return De(t,0,n)}function Co(e,t,n={}){const o=O.getVolume(e);if(!o)throw new Error(`Referenced volume with id ${e} does not exist.`);const{metadata:i,spacing:s,direction:r,dimensions:a}=o,{minX:c,maxX:d,minY:l,maxY:u,minZ:f,maxZ:m}=t,w=[Math.min(c,d),Math.min(l,u),Math.min(f,m)],V=Z(o.imageData,w),h=[Math.abs(d-c)+1,Math.abs(u-l)+1,Math.abs(m-f)+1],{targetBuffer:g}=n,b={metadata:i,dimensions:h,spacing:s,origin:V,direction:r,targetBuffer:g,scalarData:g?.type==="Float32Array"?new Float32Array(h[0]*h[1]*h[2]):void 0},S=et(ee(),b),v=S.voxelManager.getCompleteScalarDataArray(),p=h[0]*h[1],y=a[0]*a[1],x=o.voxelManager.getCompleteScalarDataArray();for(let I=0;I<h[2];I++)for(let C=0;C<h[1];C++){const $=Z(S.imageData,[0,C,I]),_=ve(o.imageData,$),W=_[2]*y+_[1]*a[0]+_[0],q=x.slice(W,W+h[0]),A=I*p+C*h[0];v.set(q,A)}return S.voxelManager.setCompleteScalarDataArray(v),S}function Po(e,t){const{viewUp:n,viewPlaneNormal:o}=t,i=N(e,[0,0,0]),s=ae(E(),n),r=ae(E(),o),a=H(E(),s,r),c=D(E(),N(e,s),i),d=D(E(),N(e,r),i);L(c,c),L(d,d);const l=H(E(),c,d);return{worldVecRowDir:a,worldVecColDir:s,worldVecSliceDir:r,ijkVecRowDir:l,ijkVecColDir:c,ijkVecSliceDir:d}}function To(e,t,n,o){const[i,s,r]=t,a=i*s;let c=0,d=0,l=0;const[u,f,m]=n.map(Math.round);for(let g=m-o;g<=m+o;g++)if(!(g<0||g>=r)){for(let b=f-o;b<=f+o;b++)if(!(b<0||b>=s))for(let S=u-o;S<=u+o;S++){if(S<0||S>=i)continue;const v=g*a+b*i+S,p=e[v];c+=p,d+=p*p,l++}}if(l===0){const g=m*a+f*i+u;return g>=0&&g<e.length?{mean:e[g],stdDev:0,count:1}:{mean:0,stdDev:0,count:0}}const w=c/l,V=d/l-w*w,h=Math.sqrt(Math.max(0,V));return{mean:w,stdDev:h,count:l}}const de=1e-6;function xo(e,t){const{lower:n,upper:o}=t.voiRange,i=o-n,s=t.VOILUTFunction,r=a=>t.invert===!0?1-a:a;if(s===Ee.SAMPLED_SIGMOID||s==="SIGMOID"){const{windowCenter:a,windowWidth:c}=ye(n,o),d=Math.max(Math.abs(c),1e-12);return r(1/(1+Math.exp(-4*(e-a)/d)))}return i===0||!Number.isFinite(i)?r(0):r(U((e-n)/i))}function X(e,t){const{lower:n,upper:o}=t.voiRange,i=t.VOILUTFunction,s=t.invert===!0?U(1-U(e)):U(e);if(i===Ee.SAMPLED_SIGMOID||i==="SIGMOID"){const{windowCenter:a,windowWidth:c}=ye(n,o),d=_e(s,de,1-de);return tt(d,a,c)}const r=o-n;return r===0||!Number.isFinite(r)?n:n+s*r}function Mo(e,t,n){const o=Math.min(e,t),i=Math.max(e,t),s=X(o,n),r=X(i,n);return{rawMin:Math.min(s,r),rawMax:Math.max(s,r)}}function U(e){return Number.isFinite(e)?_e(e,0,1):0}function _e(e,t,n){return Math.min(n,Math.max(t,e))}const{getPixelSpacingInformation:Do,calculateRadiographicPixelSpacing:Oo,getERMF:_o}=nt,Lo=(e,t)=>Vo(e,t,O.getVolume),Wo=(e,t)=>Me(e,t,O.getVolume),zo=Object.freeze(Object.defineProperty({__proto__:null,ECGUtilities:ft,FrameRange:gt,HistoryMemo:mt,PointsManager:at,ProgressiveIterator:it,RLEVoxelMap:st,VideoUtilities:ht,VoxelManager:ot,WSIUtilities:pt,actorIsA:wt,applyPreset:It,asArray:Vt,autoLoad:St,buildMetadata:bt,calculateNeighborhoodStats:To,calculateRadiographicPixelSpacing:Oo,calculateSpacingBetweenImageIds:vt,calculateViewportsSpatialRegistration:so,calibratedPixelSpacingMetadataProvider:$n,clamp:ut,clip:De,clonePoint3:Et,color:wo,colormap:yt,convertColorArrayToRgbString:Rt,convertStackToVolumeViewport:co,convertToGrayscale:fo,convertVolumeToStackViewport:lo,createLinearRGBTransferFunction:Ct,createSigmoidRGBTransferFunction:Pt,createSubVolume:Co,decimate:Tt,deepClone:xt,deepEqual:Io,deepMerge:Mt,eventListener:Fn,fnv1aHash:Dt,generateFrameImageId:Ot,generateVolumePropsFromImageIds:_t,genericMetadataProvider:Lt,genericViewportDisplaySetMetadataProvider:Wt,getAcquisitionPlaneOrientation:At,getBufferConfiguration:kt,getClosestImageId:Ft,getClosestStackImageIndexForPoint:Qn,getCubeSizeInView:Nt,getCurrentVolumeViewportSlice:no,getDynamicVolumeInfo:So,getERMF:_o,getImageDataMetadata:Ut,getImageLegacy:ao,getImageSliceDataForVolumeViewport:Gt,getMinMax:Bt,getNormalizedAspectRatio:dt,getPixelSpacingInformation:Do,getRandomSampleFromArray:mo,getRuntimeId:zn,getScalingDescriptor:Wo,getScalingParameters:Ht,getSliceRange:zt,getSpacingInNormalDirection:jt,getTargetVolumeAndSpacingInNormalDir:$t,getVOIRangeFromWindowLevel:qt,getViewportContentMode:Jt,getViewportImageCornersInWorld:io,getViewportImageIds:go,getViewportModality:Lo,getViewportsWithImageURI:Yn,getViewportsWithVolumeId:Kt,getVoiFromSigmoidRGBTransferFunction:Zt,getVolumeActorCorners:Xt,getVolumeDirectionVectors:Po,getVolumeId:te,getVolumeSliceRangeInfo:Yt,getVolumeViewReferenceId:Qt,getVolumeViewportScrollInfo:Se,getVolumeViewportsContainingSameVolumes:Zn,handleMultiframe4D:en,hasFloatScalingParameters:tn,hasNaNValues:nn,hasOwn:on,imageIdToURI:sn,imageRetrieveMetadataProvider:ct,imageToWorldCoords:rn,indexAlmostWithinDimensions:Kn,indexWithinDimensions:Jn,invertRgbTransferFunction:an,isEqual:lt,isEqualAbs:cn,isEqualNegative:ln,isGenericViewport:Ie,isImageActor:dn,isNumber:un,isOpposite:qn,isPTPrescaledWithSUV:ge,isValidVolume:fn,isVideoTransferSyntax:gn,jumpToSlice:Eo,loadImageToCanvas:Xn,logger:rt,makeVolumeMetadata:mn,mapMappedBandToRawRange:Mo,mapScalarToViewportVoiIntensity:xo,mapViewportVoiIntensityToScalar:X,planar:hn,pointInShapeCallback:pn,renderToCanvasCPU:Ce,renderToCanvasGPU:Re,resolveGenericViewportVolumeId:xe,rotateToViewCoordinates:wn,roundNumber:Te,roundToPrecision:uo,scaleArray:bo,scaleRgbTransferFunction:Nn,scroll:Oe,snapFocalPointToSlice:be,sortImageIdsAndGetSpacing:In,spatialRegistrationMetadataProvider:pe,splitImageIdsBy4DTags:Ve,transferFunctionUtils:Vn,transformIndexToWorld:Z,transformWorldToIndex:ve,transformWorldToIndexContinuous:N,triggerEvent:T,updatePlaneRestriction:Sn,updateVTKImageDataWithCornerstoneImage:bn,uuidv4:ee,viewportIsInStackMode:vn,viewportIsInVolumeMode:En,viewportSupportsDisplaySetPresentation:yn,viewportSupportsImageSlices:he,viewportSupportsStackCalibration:Rn,viewportSupportsStackCompatibility:Cn,viewportSupportsVolumeActors:fe,viewportSupportsVolumeCompatibility:Pn,viewportSupportsVolumeId:Tn,viewportSupportsVolumeURI:xn,windowLevel:Mn,worldToImageCoords:Dn},Symbol.toStringTag,{value:"Module"}));export{Oe as A,no as B,De as C,qn as D,io as E,fo as F,On as G,kn as M,Wn as T,Ln as a,Pe as b,Bo as c,Ho as d,An as e,Go as f,j as g,Uo as h,zn as i,Io as j,mo as k,Wo as l,Yn as m,Kn as n,Qn as o,so as p,Eo as q,Te as r,_n as s,Jn as t,zo as u,No as v,uo as w,Po as x,Co as y,To as z};
1
+ import{t as T,E as R,e as M,B as We,v as Ae,a as ne,b as F,s as ke,c as Fe,f as oe,cw as ue,c8 as Ne,bW as P,aK as z,cx as fe,aJ as Y,ag as se,V as G,cy as ge,cz as D,cA as Ue,cB as Ge,cC as Be,bL as He,at as O,aO as ze,bi as B,cD as me,bN as je,cE as he,bt as $e,b_ as qe,cF as ie,cG as E,cH as H,cI as J,cJ as L,cK as re,cL as Je,cM as Ke,cN as Ze,bC as pe,am as Q,b8 as ee,cO as Xe,cP as Ye,ai as Qe,ar as we,bm as te,i as Ie,L as Ve,bK as Se,cQ as be,bA as Z,bG as et,bc as ve,bz as N,cR as ae,cS as Ee,bP as ye,cT as tt,cr as nt,K as ot,cU as st,cV as it,c1 as rt,cW as at,cX as ct,bf as lt,cY as dt,cZ as ut,c_ as ft,c$ as gt,bp as mt,d0 as ht,d1 as pt,d2 as wt,d3 as It,d4 as Vt,d5 as St,d6 as bt,d7 as vt,bg as Et,d8 as yt,av as Rt,d9 as Ct,da as Pt,H as Tt,b7 as xt,bk as Mt,db as Dt,dc as Ot,J as _t,dd as Lt,bo as Wt,de as At,df as kt,bq as Ft,dg as Nt,bs as Ut,dh as Gt,bR as Bt,di as Ht,dj as zt,bF as jt,bj as $t,dk as qt,bh as Jt,bn as Kt,dl as Zt,dm as Xt,dn as Yt,dp as Qt,dq as en,dr as tn,ds as nn,dt as on,bl as sn,bZ as rn,du as an,bT as cn,dv as ln,bS as dn,bv as un,br as fn,ct as gn,dw as mn,dx as hn,bI as pn,dy as wn,M as In,dz as Vn,dA as Sn,bw as bn,dB as vn,bD as En,bJ as yn,dC as Rn,dD as Cn,bM as Pn,dE as Tn,dF as xn,dG as Mn,bY as Dn}from"./Settings-CKWXQZHN.js";import"./Texture-CIGczsau.js";import"./cornerstoneEngine-hAkB6jjG.js";function On(e){return!!(e&&typeof e.setVolumes=="function"&&typeof e.addVolumes=="function")}async function _n(e,t,n,o=!1,i=!1){const s=n.map(r=>{const a=e.getViewport(r);if(!a)throw new Error(`Viewport with Id ${r} does not exist`);if(!On(a))throw new Error("setVolumesForViewports only supports viewports that implement setVolumes");return a});await Promise.all(s.map(r=>r.setVolumes(t,o,i)))}function Ln(e,t,n=0){const o=e.getOpenGLRenderWindow?.()?.getCanvas?.();o&&(o.addEventListener("webglcontextlost",()=>{console.warn(`CornerstoneRender: WebGL context lost (renderingEngine=${t}, context=${n})`),T(M,R.WEBGL_CONTEXT_LOST,{renderingEngineId:t,contextIndex:n})}),o.addEventListener("webglcontextrestored",()=>{T(M,R.WEBGL_CONTEXT_RESTORED,{renderingEngineId:t,contextIndex:n})}))}class Wn extends We{constructor(t){super(t),this._renderFlaggedViewports=()=>{this._throwIfDestroyed(),this.offscreenMultiRenderWindow&&this.performVtkDrawCall();const n=this._getViewportsAsArray(),o=[];for(let i=0;i<n.length;i++){const s=n[i];if(this._needsRender.has(s.id)){const r=this.renderViewportUsingCustomOrVtkPipeline(s);if(o.push(r),s.setRendered(),this._needsRender.delete(s.id),this._needsRender.size===0)break}}this._animationFrameSet=!1,this._animationFrameHandle=null,o.forEach(i=>{i?.element&&T(i.element,R.IMAGE_RENDERED,i)})},this.useCPURendering||this.ensureOffscreenResources()}ensureOffscreenResources(){this.offscreenMultiRenderWindow||(this.offscreenMultiRenderWindow=Ae.newInstance(),this.offScreenCanvasContainer=document.createElement("div"),this.offscreenMultiRenderWindow.setContainer(this.offScreenCanvasContainer),Ln(this.offscreenMultiRenderWindow,this.id))}enableVTKjsDrivenViewport(t){this.ensureOffscreenResources();const o=this._getViewportsAsArray().filter(l=>ne(l.type)===!1),i=o.map(l=>l.canvas),s=F(t.element);i.push(s);const{offScreenCanvasWidth:r,offScreenCanvasHeight:a}=this._resizeOffScreenCanvas(i),c=this._resize(o,r,a),d={...t,canvas:s};this.addVtkjsDrivenViewport(d,{offScreenCanvasWidth:r,offScreenCanvasHeight:a,xOffset:c})}addVtkjsDrivenViewport(t,n){this.ensureOffscreenResources();const{element:o,canvas:i,viewportId:s,type:r,defaultOptions:a}=t;o.tabIndex=-1,ke(o);const{offScreenCanvasWidth:c,offScreenCanvasHeight:d,xOffset:l}=n,{sxStartDisplayCoords:u,syStartDisplayCoords:f,sxEndDisplayCoords:m,syEndDisplayCoords:w,sx:V,sy:h,sWidth:g,sHeight:b}=this._getViewportCoordsOnOffScreenCanvas(t,c,d,l);this.offscreenMultiRenderWindow.addRenderer({viewport:[u,f,m,w],id:s,background:a.background?a.background:[0,0,0]});const S={id:s,element:o,renderingEngineId:this.id,type:r,canvas:i,sx:V,sy:h,sWidth:g,sHeight:b,defaultOptions:a||{}},v=Fe(t);if(!v)throw new Error(`Viewport Type ${r} is not supported`);const p=new v(S);p.requestedType=t.requestedType??r,this._viewports.set(s,p);const y={element:o,viewportId:s,renderingEngineId:this.id};p.suppressEvents||T(M,R.ELEMENT_ENABLED,y)}setVtkjsDrivenViewports(t){if(t.length){const n=t.map(r=>F(r.element));n.forEach(r=>{const a=window.devicePixelRatio||1,c=r.getBoundingClientRect();r.width=c.width*a,r.height=c.height*a});const{offScreenCanvasWidth:o,offScreenCanvasHeight:i}=this._resizeOffScreenCanvas(n);let s=0;for(let r=0;r<t.length;r++){const a=t[r],c=n[r],d={...a,canvas:c};this.addVtkjsDrivenViewport(d,{offScreenCanvasWidth:o,offScreenCanvasHeight:i,xOffset:s}),s+=c.width}}}_resizeVTKViewports(t,n=!0,o=!0){const i=t.map(s=>F(s.element));if(i.forEach(s=>{const r=window.devicePixelRatio||1;s.width=s.clientWidth*r,s.height=s.clientHeight*r}),i.length){const{offScreenCanvasWidth:s,offScreenCanvasHeight:r}=this._resizeOffScreenCanvas(i);this._resize(t,s,r)}t.forEach(s=>{const r=s.getCamera(),a=s.getRotation(),{flipHorizontal:c}=r,d=s;d.resetViewStateForResize?d.resetViewStateForResize():d.resetCameraForResize();const l=s.getDisplayArea();n&&(l?(c&&s.setCamera({flipHorizontal:c}),a&&s.setViewPresentation({rotation:a})):s.setCamera(r))}),o&&this.render()}performVtkDrawCall(){const{offscreenMultiRenderWindow:t}=this,n=t.getRenderWindow(),o=t.getRenderers();if(o.length){for(let i=0;i<o.length;i++){const{renderer:s,id:r}=o[i],a=r.split("::")[0];this._needsRender.has(a)?s.setDraw(!0):s.setDraw(!1)}n.render();for(let i=0;i<o.length;i++)o[i].renderer.setDraw(!1)}}renderViewportUsingCustomOrVtkPipeline(t){let n;if(t.sWidth<oe||t.sHeight<oe){console.warn("Viewport is too small",t.sWidth,t.sHeight);return}if(ne(t.type)===!0)n=t.customRenderViewportToCanvas();else{if(!this.offscreenMultiRenderWindow)throw new Error("GPU not available, and using a viewport with no custom render pipeline.");const{offscreenMultiRenderWindow:o}=this,r=o.getOpenGLRenderWindow().get3DContext().canvas;n=this._renderViewportFromVtkCanvasToOnscreenCanvas(t,r)}return n}_renderViewportFromVtkCanvasToOnscreenCanvas(t,n){const{element:o,canvas:i,sx:s,sy:r,sWidth:a,sHeight:c,id:d,renderingEngineId:l,suppressEvents:u}=t,{width:f,height:m}=i;return i.getContext("2d").drawImage(n,s,r,a,c,0,0,f,m),{element:o,suppressEvents:u,viewportId:d,renderingEngineId:l,viewportStatus:t.viewportStatus}}_resizeOffScreenCanvas(t){const{offScreenCanvasContainer:n,offscreenMultiRenderWindow:o}=this,i=Math.max(...t.map(r=>r.height));let s=0;return t.forEach(r=>{s+=r.width}),n.width=s,n.height=i,o.resize(),{offScreenCanvasWidth:s,offScreenCanvasHeight:i}}_resize(t,n,o){let i=0;for(let s=0;s<t.length;s++){const r=t[s],{sxStartDisplayCoords:a,syStartDisplayCoords:c,sxEndDisplayCoords:d,syEndDisplayCoords:l,sx:u,sy:f,sWidth:m,sHeight:w}=this._getViewportCoordsOnOffScreenCanvas(r,n,o,i);i+=r.canvas.width,r.sx=u,r.sy=f,r.sWidth=m,r.sHeight=w,this.offscreenMultiRenderWindow.getRenderer(r.id).setViewport(a,c,d,l)}return i}_getViewportCoordsOnOffScreenCanvas(t,n,o,i){const{canvas:s}=t,{width:r,height:a}=s,c=i,d=0,l=c/n,u=d+(o-a)/o,f=r/n,m=a/o;return{sxStartDisplayCoords:l,syStartDisplayCoords:u,sxEndDisplayCoords:l+f,syEndDisplayCoords:u+m,sx:c,sy:d,sWidth:r,sHeight:a}}}function No(e){return!!(e&&typeof e.canvasToWorld=="function"&&typeof e.worldToCanvas=="function")}function Uo(e){return!!(e&&typeof e.getZoom=="function"&&typeof e.setZoom=="function")}function Go(e){return!!(e&&typeof e.getPan=="function"&&typeof e.setPan=="function")}function An(e){return!!(e&&typeof e.getFrameOfReferenceUID=="function")}class kn{constructor(){this._targetsEventListeners=new Map}addEventListener(t,n,o,i){let s=this._targetsEventListeners.get(t);s||(s=new ue(t),this._targetsEventListeners.set(t,s)),s.addEventListener(n,o,i)}removeEventListener(t,n,o,i){const s=this._targetsEventListeners.get(t);s&&(s.removeEventListener(n,o,i),s.isEmpty&&this._targetsEventListeners.delete(t))}reset(){Array.from(this._targetsEventListeners.entries()).forEach(([t,n])=>{n.reset(),this._targetsEventListeners.delete(t)})}}const Fn=Object.freeze(Object.defineProperty({__proto__:null,MultiTargetEventListenerManager:kn,TargetEventListeners:ue},Symbol.toStringTag,{value:"Module"}));function Nn(e,t){const n=e.getSize();for(let o=0;o<n;o++){const i=[];e.getNodeValue(o,i),i[1]=i[1]*t,i[2]=i[2]*t,i[3]=i[3]*t,e.setNodeValue(o,i)}}const Un=Symbol("LastRuntimeId"),Gn={},Bn=4294967295,Hn="-";function zn(e,t,n){return jn(e!==null&&typeof e=="object"?e:Gn,Un,(typeof n=="number"&&n>0?n:Bn)>>>0).join(typeof t=="string"?t:Hn)}function jn(e,t,n){let o=e[t];o instanceof Array||(o=[0],Object.defineProperty(e,t,{value:o}));for(let i=!0,s=0;i&&s<o.length;++s){let r=o[s]|0;r<n?(i=!1,r=r+1):(r=0,s+1===o.length&&o.push(0)),o[s]=r}return o}const $n=Ne;function qn(e,t,n=1e-5){return Math.abs(e[0]+t[0])<n&&Math.abs(e[1]+t[1])<n&&Math.abs(e[2]+t[2])<n}function Jn(e,t){return!(e[0]<0||e[0]>=t[0]||e[1]<0||e[1]>=t[1]||e[2]<0||e[2]>=t[2])}function Kn(e,t){return!(e[0]<-P||e[0]>=t[0]+P||e[1]<-P||e[1]>=t[1]+P||e[2]<-P||e[2]>=t[2]+P)}function Zn(e,t){let n;t?n=[Y(t)]:n=z();const o=[];return n.forEach(i=>{const s=e.getActors(),r=i.getViewports().filter(fe);for(const a of r){const c=a.getActors();if(c.length!==s.length)continue;s.every(({uid:l})=>c.find(u=>l===u.uid))&&o.push(a)}}),o}function Re(e,t,n=void 0,o="_thumbnails",i={displayArea:{imageArea:[1,1]}}){if(!e||!(e instanceof HTMLCanvasElement))throw new Error("canvas element is required");const s=!t.imageId,r=!s&&t,a=s&&t,d=`renderGPUViewport-${r.imageId||a.volumeId}`,l=document.createElement("div"),u=window.devicePixelRatio||1;i.displayArea||(i.displayArea={imageArea:[1,1]});const f=e.width,m=e.height;l.style.width=`${f/u+se}px`,l.style.height=`${m/u+se}px`,l.style.visibility="hidden",l.style.position="absolute",document.body.appendChild(l);const w=d.split(":").join("-");l.setAttribute("viewport-id-for-remove",w);const V=F(l),h=Y(o)||new Wn(o);let g=h.getViewport(d);if(!g){const b={viewportId:d,type:s?G.ORTHOGRAPHIC:G.STACK,element:l,defaultOptions:{...i,suppressEvents:!0}};h.enableElement(b),g=h.getViewport(d)}return new Promise(b=>{let S=!1,{viewReference:v}=i;const p=y=>{if(S)return;if(v){const A=v;v=null,g.setViewReference(A),g.render();return}e.getContext("2d").drawImage(V,0,0,V.width,V.height,0,0,e.width,e.height);const I=g.canvasToWorld([0,0]),C=g.canvasToWorld([V.width/u,0]),$=g.canvasToWorld([0,V.height/u]),_=D([0,0,0],g.canvasToWorld([1/u,0]),I),W=D([0,0,0],g.canvasToWorld([0,1/u]),I),q=1;S=!0,l.removeEventListener(R.IMAGE_RENDERED,p),setTimeout(()=>{h.disableElement(d),document.querySelectorAll(`[viewport-id-for-remove="${w}"]`).forEach(Le=>{Le.remove()})},0),b({origin:I,bottomLeft:$,topRight:C,thicknessMm:q,rightVector:_,downVector:W})};l.addEventListener(R.IMAGE_RENDERED,p),s?g.setVolumes([a],!1,!0):g.renderImageObject(t),g.resetCamera(),n==="PT"&&!ge(r)&&g.setProperties({voiRange:{lower:r.minPixelValue,upper:r.maxPixelValue}}),g.render()})}function Ce(e,t,n,o,i){if(t.volumeId)throw new Error("Unsupported volume rendering for CPU");const r=t,a=Ue(e,r,n),c={canvas:e,viewport:a,image:r,renderingTools:{}};c.transform=Ge(c);const d=!0;return new Promise((l,u)=>{Be(c,d),l(null)})}function Xn(e){const{canvas:t,imageId:n,viewReference:o,requestType:i=He.Thumbnail,priority:s=-5,renderingEngineId:r="_thumbnails",useCPURendering:a=!1,thumbnail:c=!1,imageAspect:d=!1,viewportOptions:l}=e,u=o?.volumeId,f=u&&!n,m=o&&l?{...l,viewReference:o}:l,w=a?Ce:Re;return new Promise((V,h)=>{function g(p,y){const{modality:x}=B(me.GENERAL_SERIES,y)||{},I=!f&&p,C=f&&p;I&&(I.isPreScaled=I.isPreScaled||I.preScale?.scaled),c&&(t.height=256,t.width=256),d&&I&&(t.width=I&&t.height*I.width/I.height),t.style.width=`${t.width/devicePixelRatio}px`,t.style.height=`${t.height/devicePixelRatio}px`,C&&a&&h(new Error("CPU rendering of volume not supported")),w(t,p,x,r,m).then(V)}function b(p,y){console.error(p,y),h(p)}function S(p,y,x){return je(p,x).then(I=>{g.call(this,I,p)},I=>{b.call(this,I,p)})}const v={useRGBA:!!a,requestType:i};if(u){const p=O.getVolume(u);p||h(new Error(`Volume id ${u} not found in cache`));const y=p.imageIds[0];g(p,y)}else ze.addRequest(S.bind(null,n,null,v),i,{imageId:n},s)})}function Yn(e){const t=z(),n=[];return t.forEach(o=>{o.getViewports().filter(he).forEach(s=>{s.hasImageURI(e)&&n.push(s)})}),n}function Qn(e,t){const n=eo(e,t);return n?n.index:null}function eo(e,t){const n=t.getImageIds(),o=t.getCurrentImageIdIndex();if(n.length===0)return null;const i=c=>{const d=to(c);if(!d)return null;const l=$e(d.planeNormal,d.imagePositionPatient);return qe(l,e)},s={distance:i(n[o])??1/0,index:o},r=n.slice(o+1);for(let c=0;c<r.length;c++){const d=r[c],l=i(d);if(l!==null)if(l<=s.distance)s.distance=l,s.index=c+o+1;else break}const a=n.slice(0,o);for(let c=a.length-1;c>=0;c--){const d=a[c],l=i(d);if(!(l===null||l===s.distance))if(l<s.distance)s.distance=l,s.index=c;else break}return s.distance===1/0?null:s}function to(e){const t=B(me.IMAGE_PLANE,e);if(!t||!(t.rowCosines instanceof Array&&t.rowCosines.length===3)||!(t.columnCosines instanceof Array&&t.columnCosines.length===3)||!(t.imagePositionPatient instanceof Array&&t.imagePositionPatient.length===3))return null;const{rowCosines:n,columnCosines:o,imagePositionPatient:i}=t,s=ie(E(),...n),r=ie(E(),...o),a=H(E(),s,r);return{rowCosines:n,columnCosines:o,imagePositionPatient:i,planeNormal:a}}function no(e){const{width:t,height:n}=e.getCanvas(),{sliceToIndexMatrix:o,indexToSliceMatrix:i}=e.getSliceViewInfo(),s=J(e,[0,0]),r=J(e,[t-1,0]),a=J(e,[0,n-1]),c=D(E(),r,s),d=D(E(),a,s),l=H(E(),c,d);L(c,c),L(d,d),L(l,l);const u=Math.max(Math.abs(c[0]),Math.abs(c[1]),Math.abs(c[2])),f=Math.max(Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2]));if(!re(1,u)||!re(1,f))throw new Error("getCurrentVolumeViewportSlice is not available for rotate/oblique viewports");const{voxelManager:m}=e.getImageData(),w=e.getSliceViewInfo(),V=m.getSliceData(w);return{width:w.width,height:w.height,scalarData:V,sliceToIndexMatrix:o,indexToSliceMatrix:i}}const oo=.05;function so(e,t){const n=e.getSliceIndex(),o=t.getSliceIndex(),i=B("imagePlaneModule",n.toString()),s=B("imagePlaneModule",o.toString());if(!i||!s){console.log("Viewport spatial registration requires image plane module");return}const{imageOrientationPatient:r}=s;if(!i.imageOrientationPatient.every((f,m)=>Math.abs(f-r[m])<oo)){console.log("Viewport spatial registration only supported for same orientation (hence translation only) for now",i?.imageOrientationPatient,s?.imageOrientationPatient);return}const c=i.imagePositionPatient,d=s.imagePositionPatient,l=Je(E(),c,d),u=Ke(Ze(),l);pe.add([e.id,t.id],u)}function io(e){const{imageData:t,dimensions:n}=e.getImageData()||{};if(!t||!n)return[];const{canvas:o}=e,i=window.devicePixelRatio,s=[0,0],r=[o.width/i,0],a=[o.width/i,o.height/i],c=[0,o.height/i],d=e.canvasToWorld(s),l=e.canvasToWorld(r),u=e.canvasToWorld(a),f=e.canvasToWorld(c),m=t.worldToIndex(d),w=t.worldToIndex(l),V=t.worldToIndex(u),h=t.worldToIndex(f);return ro({dimensions:n,imageData:t,topLeftImage:m,topRightImage:w,bottomRightImage:V,bottomLeftImage:h,topLeftWorld:d,topRightWorld:l,bottomRightWorld:u,bottomLeftWorld:f})}function ro({dimensions:e,imageData:t,topLeftImage:n,topRightImage:o,bottomRightImage:i,bottomLeftImage:s,topLeftWorld:r,topRightWorld:a,bottomRightWorld:c,bottomLeftWorld:d}){const l=k(n,e)?r:t.indexToWorld([0,0,0]),u=k(o,e)?a:t.indexToWorld([e[0]-1,0,0]),f=k(i,e)?c:t.indexToWorld([e[0]-1,e[1]-1,0]),m=k(s,e)?d:t.indexToWorld([0,e[1]-1,0]);return[l,u,m,f]}function k(e,t){return e[0]>0||e[0]<t[0]-1||e[1]>0||e[1]<t[1]-1||e[2]>0||e[2]<t[2]-1}function j(e){if(!e)return;const{viewportUid:t,renderingEngineUid:n}=e.dataset;return Pe(t,n)}function Pe(e,t){if(!t||!e)return;const n=Y(t);if(!n||n.hasBeenDestroyed)return;const o=n.getViewport(e);if(!o)return;const i=An(o)?o.getFrameOfReferenceUID():void 0;return{viewport:o,renderingEngine:n,viewportId:e,renderingEngineId:t,FrameOfReferenceUID:i}}function Bo(e){const t=z();for(let n=0;n<t.length;n++){const o=t[n];if(o.getViewport(e))return Pe(e,o.id)}}function Ho(){const e=[];return z().forEach(n=>{n.getViewports().forEach(({element:i})=>{e.push(j(i))})}),e}function ao(e){const t=j(e);if(!t)return;const{viewport:n}=t;if(!(n instanceof Q))throw new Error(`An image can only be fetched for a stack viewport and not for a viewport of type: ${n.type}`);return n.getCornerstoneImage()}async function co({viewport:e,options:t={}}){const n=e.getRenderingEngine();let o=t.volumeId||`${ee()}`;o.split(":").length===0&&(o=`${Xe()}:${o}`);const{id:i,element:s}=e,r=t.viewportId||i,a=e.getImageIds(),c=e.getViewPresentation(),d=e.getViewReference();n.enableElement({viewportId:r,type:G.ORTHOGRAPHIC,element:s,defaultOptions:{background:t.background,orientation:t.orientation}}),(await Ye(o,{imageIds:a})).load();const u=n.getViewport(r);await _n(n,[{volumeId:o}],[r]);const f=()=>{u.render(),s.removeEventListener(R.VOLUME_VIEWPORT_NEW_VOLUME,f)};return s.addEventListener(R.VOLUME_VIEWPORT_NEW_VOLUME,f),u.setViewPresentation(c),u.setViewReference(d),u.render(),u}async function lo({viewport:e,options:t}){const n=e,{id:o,element:i}=n,s=e.getRenderingEngine(),{background:r}=t,a=t.viewportId||o,c=O.getVolume(n.getVolumeId());if(!(c instanceof Qe))throw new 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.");const d={viewportId:a,type:G.STACK,element:i,defaultOptions:{background:r}},l=n.getViewReference();s.enableElement(d);const u=s.getViewport(a);return await u.setStack(c.imageIds),u.setViewReference(l),u.render(),u}function Te(e,t=2){if(Array.isArray(e))return e.map(i=>Te(i,t)).join(", ");if(e==null||e==="")return"NaN";e=Number(e);const n=Math.abs(e);if(n<1e-4)return`${e}`;const o=n>=100?t-2:n>=10?t-1:n>=1?t:n>=.1?t+1:n>=.01?t+2:n>=.001?t+3:t+4;return e.toFixed(o)}function uo(e){return Math.round(e/P)*P}function fo(e,t,n){const o=e.length===t*n*4,i=e.length===t*n*3;if(o||i){const s=new Float32Array(t*n);let r=0,a=0;const c=o?4:3;for(let d=0;d<t;d++)for(let l=0;l<n;l++){const u=e[r],f=e[r+1],m=e[r+2];s[a]=(u+f+m)/3,r+=c,a++}return s}else return e}function go(e){if(e instanceof we)return O.getVolume(e.getVolumeId()).imageIds;if(e.getImageIds)return e.getImageIds()}function mo(e,t){const n=[...e];return t>=n.length?(ce(n),n):(ce(n),n.slice(0,t))}function ce(e){for(let t=e.length-1;t>0;t--){const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}}function K(e){const t=e.toString(16);return t.length==1?"0"+t:t}function ho(e,t,n){return"#"+K(e)+K(t)+K(n)}function po(e){const 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}const wo=Object.freeze(Object.defineProperty({__proto__:null,hexToRgb:po,rgbToHex:ho},Symbol.toStringTag,{value:"Module"}));function Io(e,t){if(e===t)return!0;if(e==null||t==null)return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch(n){return console.debug("Error in JSON.stringify during deep comparison:",n),e===t}}function xe(e,t){const n=e,o=n.getActors?.()??[];return(t?o.find(s=>s.referencedId===t)??o.find(s=>s.referencedId?.endsWith(`:${t}`)):void 0)?.referencedId??(t?te(t):void 0)??n.getDefaultActor?.()?.referencedId}function Me(e,t,n){if(!n)throw new Error("getVolume is required, use the utilities export instead");if(Ie(e)){const o=xe(e,t),i=o?n(o):void 0,s=e.getImageData?.();return{modality:i?.metadata?.Modality??s?.metadata?.Modality,isPreScaled:le(i?.scaling)}}if(typeof e.setVolumes=="function"){const i=t?te(t):e.getVolumeId(),s=i?n(i):void 0;return{modality:s?.metadata?.Modality,isPreScaled:le(s?.scaling)}}if(typeof e.setStack=="function"){const o=e,{preScale:i}=o.getImageData()||{};return{modality:o.modality,isPreScaled:!!i?.scaled}}}function le(e){return!!e&&Object.keys(e).length>0}function Vo(e,t,n){const o=Me(e,t,n);if(!o)throw new Error("Invalid viewport type");return o.modality}function So(e){const{imageIdGroups:t,splittingTag:n}=Ve(e);return{isDynamicVolume:t.length>1,timePoints:t,splittingTag:n}}function bo(e,t){const n=e.length,{rescaleSlope:o,rescaleIntercept:i,suvbw:s}=t;if(t.modality==="PT"&&typeof s=="number")for(let r=0;r<n;r++)e[r]=s*(e[r]*o+i);else for(let r=0;r<n;r++)e[r]=e[r]*o+i;return e}function De(e,t,n){return Math.min(Math.max(t,e),n)}function Oe(e,t){if(!j(e.element))throw new Error("Scroll::Viewport is not enabled (it might be disabled)");if(e instanceof Q&&e.getImageIds().length===0)throw new Error("Scroll::Stack Viewport has no images");const{volumeId:o,delta:i,scrollSlabs:s}=t;if(e instanceof we)vo(e,o,i,s);else{if(typeof e.getCurrentImageIdIndex!="function"||typeof e.scroll!="function")return;const r=e.getCurrentImageIdIndex();if(r+i>e.getImageIds().length-1||r+i<0){const a={imageIdIndex:r,direction:i};T(M,R.STACK_SCROLL_OUT_OF_BOUNDS,a)}e.scroll(i,t.debounceLoading,t.loop)}}function vo(e,t,n,o=!1){const i=o,{numScrollSteps:s,currentStepIndex:r,sliceRangeInfo:a}=Se(e,t,i);if(s===0||!a)return;const{sliceRange:c,spacingInNormalDirection:d,camera:l}=a,{focalPoint:u,viewPlaneNormal:f,position:m}=l,{newFocalPoint:w,newPosition:V}=be(u,m,c,f,d,n);e.setCamera({focalPoint:w,position:V}),e.render();const h=r+n,g={volumeId:t,viewport:e,delta:n,desiredStepIndex:h,currentStepIndex:r,numScrollSteps:s,currentImageId:e.getCurrentImageId()};(h>s||h<0)&&e.getCurrentImageId()?T(M,R.VOLUME_VIEWPORT_SCROLL_OUT_OF_BOUNDS,g):T(M,R.VOLUME_VIEWPORT_SCROLL,g)}async function Eo(e,t={}){const{imageIndex:n,debounceLoading:o,volumeId:i}=t,s=j(e);if(!s)throw new Error("Element has been disabled");const{viewport:r}=s,{imageIndex:a,numberOfSlices:c}=yo(r,o),l=Ro(c,n)-a;Oe(r,{delta:l,debounceLoading:o,volumeId:i})}function yo(e,t){return e instanceof Q?{numberOfSlices:e.getImageIds().length,imageIndex:t?e.getTargetImageIdIndex():e.getCurrentImageIdIndex()}:{numberOfSlices:e.getNumberOfSlices(),imageIndex:e.getSliceIndex()}}function Ro(e,t){const n=e-1;return De(t,0,n)}function Co(e,t,n={}){const o=O.getVolume(e);if(!o)throw new Error(`Referenced volume with id ${e} does not exist.`);const{metadata:i,spacing:s,direction:r,dimensions:a}=o,{minX:c,maxX:d,minY:l,maxY:u,minZ:f,maxZ:m}=t,w=[Math.min(c,d),Math.min(l,u),Math.min(f,m)],V=Z(o.imageData,w),h=[Math.abs(d-c)+1,Math.abs(u-l)+1,Math.abs(m-f)+1],{targetBuffer:g}=n,b={metadata:i,dimensions:h,spacing:s,origin:V,direction:r,targetBuffer:g,scalarData:g?.type==="Float32Array"?new Float32Array(h[0]*h[1]*h[2]):void 0},S=et(ee(),b),v=S.voxelManager.getCompleteScalarDataArray(),p=h[0]*h[1],y=a[0]*a[1],x=o.voxelManager.getCompleteScalarDataArray();for(let I=0;I<h[2];I++)for(let C=0;C<h[1];C++){const $=Z(S.imageData,[0,C,I]),_=ve(o.imageData,$),W=_[2]*y+_[1]*a[0]+_[0],q=x.slice(W,W+h[0]),A=I*p+C*h[0];v.set(q,A)}return S.voxelManager.setCompleteScalarDataArray(v),S}function Po(e,t){const{viewUp:n,viewPlaneNormal:o}=t,i=N(e,[0,0,0]),s=ae(E(),n),r=ae(E(),o),a=H(E(),s,r),c=D(E(),N(e,s),i),d=D(E(),N(e,r),i);L(c,c),L(d,d);const l=H(E(),c,d);return{worldVecRowDir:a,worldVecColDir:s,worldVecSliceDir:r,ijkVecRowDir:l,ijkVecColDir:c,ijkVecSliceDir:d}}function To(e,t,n,o){const[i,s,r]=t,a=i*s;let c=0,d=0,l=0;const[u,f,m]=n.map(Math.round);for(let g=m-o;g<=m+o;g++)if(!(g<0||g>=r)){for(let b=f-o;b<=f+o;b++)if(!(b<0||b>=s))for(let S=u-o;S<=u+o;S++){if(S<0||S>=i)continue;const v=g*a+b*i+S,p=e[v];c+=p,d+=p*p,l++}}if(l===0){const g=m*a+f*i+u;return g>=0&&g<e.length?{mean:e[g],stdDev:0,count:1}:{mean:0,stdDev:0,count:0}}const w=c/l,V=d/l-w*w,h=Math.sqrt(Math.max(0,V));return{mean:w,stdDev:h,count:l}}const de=1e-6;function xo(e,t){const{lower:n,upper:o}=t.voiRange,i=o-n,s=t.VOILUTFunction,r=a=>t.invert===!0?1-a:a;if(s===Ee.SAMPLED_SIGMOID||s==="SIGMOID"){const{windowCenter:a,windowWidth:c}=ye(n,o),d=Math.max(Math.abs(c),1e-12);return r(1/(1+Math.exp(-4*(e-a)/d)))}return i===0||!Number.isFinite(i)?r(0):r(U((e-n)/i))}function X(e,t){const{lower:n,upper:o}=t.voiRange,i=t.VOILUTFunction,s=t.invert===!0?U(1-U(e)):U(e);if(i===Ee.SAMPLED_SIGMOID||i==="SIGMOID"){const{windowCenter:a,windowWidth:c}=ye(n,o),d=_e(s,de,1-de);return tt(d,a,c)}const r=o-n;return r===0||!Number.isFinite(r)?n:n+s*r}function Mo(e,t,n){const o=Math.min(e,t),i=Math.max(e,t),s=X(o,n),r=X(i,n);return{rawMin:Math.min(s,r),rawMax:Math.max(s,r)}}function U(e){return Number.isFinite(e)?_e(e,0,1):0}function _e(e,t,n){return Math.min(n,Math.max(t,e))}const{getPixelSpacingInformation:Do,calculateRadiographicPixelSpacing:Oo,getERMF:_o}=nt,Lo=(e,t)=>Vo(e,t,O.getVolume),Wo=(e,t)=>Me(e,t,O.getVolume),zo=Object.freeze(Object.defineProperty({__proto__:null,ECGUtilities:ft,FrameRange:gt,HistoryMemo:mt,PointsManager:at,ProgressiveIterator:it,RLEVoxelMap:st,VideoUtilities:ht,VoxelManager:ot,WSIUtilities:pt,actorIsA:wt,applyPreset:It,asArray:Vt,autoLoad:St,buildMetadata:bt,calculateNeighborhoodStats:To,calculateRadiographicPixelSpacing:Oo,calculateSpacingBetweenImageIds:vt,calculateViewportsSpatialRegistration:so,calibratedPixelSpacingMetadataProvider:$n,clamp:ut,clip:De,clonePoint3:Et,color:wo,colormap:yt,convertColorArrayToRgbString:Rt,convertStackToVolumeViewport:co,convertToGrayscale:fo,convertVolumeToStackViewport:lo,createLinearRGBTransferFunction:Ct,createSigmoidRGBTransferFunction:Pt,createSubVolume:Co,decimate:Tt,deepClone:xt,deepEqual:Io,deepMerge:Mt,eventListener:Fn,fnv1aHash:Dt,generateFrameImageId:Ot,generateVolumePropsFromImageIds:_t,genericMetadataProvider:Lt,genericViewportDisplaySetMetadataProvider:Wt,getAcquisitionPlaneOrientation:At,getBufferConfiguration:kt,getClosestImageId:Ft,getClosestStackImageIndexForPoint:Qn,getCubeSizeInView:Nt,getCurrentVolumeViewportSlice:no,getDynamicVolumeInfo:So,getERMF:_o,getImageDataMetadata:Ut,getImageLegacy:ao,getImageSliceDataForVolumeViewport:Gt,getMinMax:Bt,getNormalizedAspectRatio:dt,getPixelSpacingInformation:Do,getRandomSampleFromArray:mo,getRuntimeId:zn,getScalingDescriptor:Wo,getScalingParameters:Ht,getSliceRange:zt,getSpacingInNormalDirection:jt,getTargetVolumeAndSpacingInNormalDir:$t,getVOIRangeFromWindowLevel:qt,getViewportContentMode:Jt,getViewportImageCornersInWorld:io,getViewportImageIds:go,getViewportModality:Lo,getViewportsWithImageURI:Yn,getViewportsWithVolumeId:Kt,getVoiFromSigmoidRGBTransferFunction:Zt,getVolumeActorCorners:Xt,getVolumeDirectionVectors:Po,getVolumeId:te,getVolumeSliceRangeInfo:Yt,getVolumeViewReferenceId:Qt,getVolumeViewportScrollInfo:Se,getVolumeViewportsContainingSameVolumes:Zn,handleMultiframe4D:en,hasFloatScalingParameters:tn,hasNaNValues:nn,hasOwn:on,imageIdToURI:sn,imageRetrieveMetadataProvider:ct,imageToWorldCoords:rn,indexAlmostWithinDimensions:Kn,indexWithinDimensions:Jn,invertRgbTransferFunction:an,isEqual:lt,isEqualAbs:cn,isEqualNegative:ln,isGenericViewport:Ie,isImageActor:dn,isNumber:un,isOpposite:qn,isPTPrescaledWithSUV:ge,isValidVolume:fn,isVideoTransferSyntax:gn,jumpToSlice:Eo,loadImageToCanvas:Xn,logger:rt,makeVolumeMetadata:mn,mapMappedBandToRawRange:Mo,mapScalarToViewportVoiIntensity:xo,mapViewportVoiIntensityToScalar:X,planar:hn,pointInShapeCallback:pn,renderToCanvasCPU:Ce,renderToCanvasGPU:Re,resolveGenericViewportVolumeId:xe,rotateToViewCoordinates:wn,roundNumber:Te,roundToPrecision:uo,scaleArray:bo,scaleRgbTransferFunction:Nn,scroll:Oe,snapFocalPointToSlice:be,sortImageIdsAndGetSpacing:In,spatialRegistrationMetadataProvider:pe,splitImageIdsBy4DTags:Ve,transferFunctionUtils:Vn,transformIndexToWorld:Z,transformWorldToIndex:ve,transformWorldToIndexContinuous:N,triggerEvent:T,updatePlaneRestriction:Sn,updateVTKImageDataWithCornerstoneImage:bn,uuidv4:ee,viewportIsInStackMode:vn,viewportIsInVolumeMode:En,viewportSupportsDisplaySetPresentation:yn,viewportSupportsImageSlices:he,viewportSupportsStackCalibration:Rn,viewportSupportsStackCompatibility:Cn,viewportSupportsVolumeActors:fe,viewportSupportsVolumeCompatibility:Pn,viewportSupportsVolumeId:Tn,viewportSupportsVolumeURI:xn,windowLevel:Mn,worldToImageCoords:Dn},Symbol.toStringTag,{value:"Module"}));export{Oe as A,no as B,De as C,qn as D,io as E,fo as F,On as G,kn as M,Wn as T,Ln as a,Pe as b,Bo as c,Ho as d,An as e,Go as f,j as g,Uo as h,zn as i,Io as j,mo as k,Wo as l,Yn as m,Kn as n,Qn as o,so as p,Eo as q,Te as r,_n as s,Jn as t,zo as u,No as v,uo as w,Po as x,Co as y,To as z};
@@ -1,4 +1,4 @@
1
- import{b7 as Re,t as Rt,e as Z,al as mv,aJ as Ne,aK as Vi,b8 as Se,at as Q,b9 as jr,ba as pv,ac as We,V as so,ar as Xe,bb as Gn,ad as pn,am as Pn,ae as Qo,bc as wn,bd as Xr,be as vv,ah as Ea,bf as ve,i as ie,bg as vc,bh as Iv,bi as rn,bj as bh,bk as Hn,bl as eo,bm as Fi,bn as _h,bo as yh,bp as Nl,bq as qr,E as yt,aN as Es,br as Ss,bs as wv,bt as $o,bu as IC,bv as Fn,bw as wC,bx as EC,by as SC,bz as CC,bA as Yc,bB as bC,aw as _C,b5 as Kc,bC as yC,bD as Ev,bE as xC,bF as xh,bG as Sv,bH as PC,bI as DC,aL as Eg,K as kl,bJ as Sa,ao as Cv,bK as TC,bL as MC,bM as AC,aO as fr,bN as bv,bO as Ud,bP as _v,bQ as Ph,bR as Dh,bS as LC,bT as OC,av as RC,g as NC,bU as po,bV as kC,bW as UC,bX as Zc,bY as Sg,bZ as VC,b_ as Vd,ag as Ks,af as FC,b$ as Cg,J as GC,ai as HC,c0 as WC,c1 as Th,c2 as BC,c3 as zC}from"./Settings-CFaVCNLh.js";import{D as _n,I as Mh,M as Vt,m as Lt,P as Di,a as ku,V as bg,B as di,b as $C,s as jC,d as _g,n as tr,c as XC,t as qC,i as YC,e as yg,f as KC,g as ZC,h as Bc,j as JC}from"./cornerstoneEngine-Bvuqk7P7.js";import{C as yv,P as Ah,I as QC,a as tb,b as Vo,c as la,M as Oo,A as vo,d as Ul,R as xv,T as Pv,t as Jc,e as er,f as xg,Q as eb,g as nb,h as ob,L as ib}from"./Texture--SwN-Vnl.js";import{i as sb,b as ae,g as N,j as ab,c as le,u as oe,k as Dv,l as Lh,m as Uu,f as gr,h as Zs,n as rb,d as cb,o as Oh,r as de,p as lb,q as Tv,t as gn,w as is,x as Rh,y as Mv,z as db,A as da,M as ub,B as Av,C as Pg,D as Fa,E as Vu,F as hb}from"./index-BNC34LKA.js";import{c as Ic,g as fb}from"./_commonjsHelpers-CE1G-McA.js";import{A as Kn,E as Js,c as B,f as Ot,d as xt,a as Me,l as mr,n as Wt,e as pr,s as bn,b as Oe,g as tn,h as mn,i as ee,j as Yr,k as gb,m as ke,t as Un,o as Ue,p as Lv,q as Fu,r as yn,u as Ov,v as ho,w as Rv,x as Nv,y as mb,z as pb,B as vb,C as Dg,D as Ib,F as wb,G as Eb}from"./throttle-CjIII7Yf.js";import{a as Sb}from"./addVolumesToViewports-CW49lHCE.js";import"./dcmjs.es-DfWkgqfk.js";import"./index-C19QNF8p.js";function Cb(i,t){let n;if(t===void 0)for(const e of i)e!=null&&(n>e||n===void 0&&e>=e)&&(n=e);else{let e=-1;for(let o of i)(o=t(o,++e,i))!=null&&(n>o||n===void 0&&o>=o)&&(n=o)}return n}function bb(i){if(!(s=i.length))return[];for(var t=-1,n=Cb(i,_b),e=new Array(n);++t<n;)for(var o=-1,s,a=e[t]=new Array(s);++o<s;)a[o]=i[o][t];return e}function _b(i){return i.length}function Tg(){return bb(arguments)}function yb(i,t,n,e,o){var s=i*i,a=s*i;return((1-3*i+3*s-a)*t+(4-6*s+3*a)*n+(1+3*i+3*s-3*a)*e+a*o)/6}function Fd(i){var t=i.length-1;return function(n){var e=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),o=i[e],s=i[e+1],a=e>0?i[e-1]:2*o-s,r=e<t-1?i[e+2]:2*s-o;return yb((n-e/t)*t,a,o,s,r)}}function Ga(i,t){for(var n=new Array(t),e=0;e<t;++e)n[e]=i(e/(t-1));return n}var Fo;(function(i){i[i.Primary=1]="Primary",i[i.Secondary=2]="Secondary",i[i.Primary_And_Secondary=3]="Primary_And_Secondary",i[i.Auxiliary=4]="Auxiliary",i[i.Primary_And_Auxiliary=5]="Primary_And_Auxiliary",i[i.Secondary_And_Auxiliary=6]="Secondary_And_Auxiliary",i[i.Primary_And_Secondary_And_Auxiliary=7]="Primary_And_Secondary_And_Auxiliary",i[i.Fourth_Button=8]="Fourth_Button",i[i.Fifth_Button=16]="Fifth_Button",i[i.Wheel=524288]="Wheel",i[i.Wheel_Primary=524289]="Wheel_Primary"})(Fo||(Fo={}));var vn;(function(i){i[i.Shift=16]="Shift",i[i.Ctrl=17]="Ctrl",i[i.Alt=18]="Alt",i[i.Meta=91]="Meta",i[i.ShiftCtrl=1617]="ShiftCtrl",i[i.ShiftAlt=1618]="ShiftAlt",i[i.ShiftMeta=1691]="ShiftMeta",i[i.CtrlAlt=1718]="CtrlAlt",i[i.CtrlMeta=1791]="CtrlMeta",i[i.AltMeta=1891]="AltMeta"})(vn||(vn={}));var se;(function(i){i.Active="Active",i.Passive="Passive",i.Enabled="Enabled",i.Disabled="Disabled"})(se||(se={}));var To;(function(i){i.Default="",i.Highlighted="Highlighted",i.Selected="Selected",i.Locked="Locked",i.AutoGenerated="AutoGenerated"})(To||(To={}));var E;(function(i){i.TOOL_ACTIVATED="CORNERSTONE_TOOLS_TOOL_ACTIVATED",i.TOOLGROUP_VIEWPORT_ADDED="CORNERSTONE_TOOLS_TOOLGROUP_VIEWPORT_ADDED",i.TOOLGROUP_VIEWPORT_REMOVED="CORNERSTONE_TOOLS_TOOLGROUP_VIEWPORT_REMOVED",i.TOOL_MODE_CHANGED="CORNERSTONE_TOOLS_TOOL_MODE_CHANGED",i.CROSSHAIR_TOOL_CENTER_CHANGED="CORNERSTONE_TOOLS_CROSSHAIR_TOOL_CENTER_CHANGED",i.WORLD_CROSSHAIR_POINT_CHANGED="CORNERSTONE_TOOLS_WORLD_CROSSHAIR_POINT_CHANGED",i.WORLD_CROSSHAIR_POINT_CLEARED="CORNERSTONE_TOOLS_WORLD_CROSSHAIR_POINT_CLEARED",i.WORLD_CROSSHAIR_JUMPED_TO_POINT="CORNERSTONE_TOOLS_WORLD_CROSSHAIR_JUMPED_TO_POINT",i.SLICE_INTERSECTION_LINE_SELECTED="CORNERSTONE_TOOLS_SLICE_INTERSECTION_LINE_SELECTED",i.SLICE_INTERSECTION_MANIPULATION_STARTED="CORNERSTONE_TOOLS_SLICE_INTERSECTION_MANIPULATION_STARTED",i.SLICE_INTERSECTION_MANIPULATION_ENDED="CORNERSTONE_TOOLS_SLICE_INTERSECTION_MANIPULATION_ENDED",i.SLICE_INTERSECTION_SLAB_THICKNESS_CHANGED="CORNERSTONE_TOOLS_SLICE_INTERSECTION_SLAB_THICKNESS_CHANGED",i.VOLUMECROPPINGCONTROL_TOOL_CHANGED="CORNERSTONE_TOOLS_VOLUMECROPPINGCONTROL_TOOL_CHANGED",i.VOLUMECROPPING_TOOL_CHANGED="CORNERSTONE_TOOLS_VOLUMECROPPING_TOOL_CHANGED",i.STACK_PREFETCH_COMPLETE="CORNERSTONE_TOOLS_STACK_PREFETCH_COMPLETE",i.ANNOTATION_ADDED="CORNERSTONE_TOOLS_ANNOTATION_ADDED",i.ANNOTATION_COMPLETED="CORNERSTONE_TOOLS_ANNOTATION_COMPLETED",i.ANNOTATION_MODIFIED="CORNERSTONE_TOOLS_ANNOTATION_MODIFIED",i.ANNOTATION_REMOVED="CORNERSTONE_TOOLS_ANNOTATION_REMOVED",i.ANNOTATION_SELECTION_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_SELECTION_CHANGE",i.ANNOTATION_LOCK_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_LOCK_CHANGE",i.ANNOTATION_VISIBILITY_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_VISIBILITY_CHANGE",i.ANNOTATION_RENDERED="CORNERSTONE_TOOLS_ANNOTATION_RENDERED",i.ANNOTATION_CUT_MERGE_PROCESS_COMPLETED="CORNERSTONE_TOOLS_ANNOTATION_CUT_MERGE_PROCESS_COMPLETED",i.ANNOTATION_INTERPOLATION_PROCESS_COMPLETED="CORNERSTONE_TOOLS_ANNOTATION_INTERPOLATION_PROCESS_COMPLETED",i.INTERPOLATED_ANNOTATIONS_REMOVED="CORNERSTONE_TOOLS_INTERPOLATED_ANNOTATIONS_REMOVED",i.SEGMENTATION_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_MODIFIED",i.SEGMENTATION_RENDERED="CORNERSTONE_TOOLS_SEGMENTATION_RENDERED",i.SEGMENTATION_REPRESENTATION_ADDED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_ADDED",i.SEGMENTATION_ADDED="CORNERSTONE_TOOLS_SEGMENTATION_ADDED",i.SEGMENTATION_REPRESENTATION_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_MODIFIED",i.SEGMENTATION_REMOVED="CORNERSTONE_TOOLS_SEGMENTATION_REMOVED",i.SEGMENTATION_REPRESENTATION_REMOVED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_REMOVED",i.SEGMENTATION_DATA_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_DATA_MODIFIED",i.HISTORY_UNDO="CORNERSTONE_TOOLS_HISTORY_UNDO",i.HISTORY_REDO="CORNERSTONE_TOOLS_HISTORY_REDO",i.KEY_DOWN="CORNERSTONE_TOOLS_KEY_DOWN",i.KEY_UP="CORNERSTONE_TOOLS_KEY_UP",i.MOUSE_DOWN="CORNERSTONE_TOOLS_MOUSE_DOWN",i.MOUSE_UP="CORNERSTONE_TOOLS_MOUSE_UP",i.MOUSE_DOWN_ACTIVATE="CORNERSTONE_TOOLS_MOUSE_DOWN_ACTIVATE",i.MOUSE_DRAG="CORNERSTONE_TOOLS_MOUSE_DRAG",i.MOUSE_MOVE="CORNERSTONE_TOOLS_MOUSE_MOVE",i.MOUSE_CLICK="CORNERSTONE_TOOLS_MOUSE_CLICK",i.MOUSE_DOUBLE_CLICK="CORNERSTONE_TOOLS_MOUSE_DOUBLE_CLICK",i.MOUSE_WHEEL="CORNERSTONE_TOOLS_MOUSE_WHEEL",i.TOUCH_START="CORNERSTONE_TOOLS_TOUCH_START",i.TOUCH_START_ACTIVATE="CORNERSTONE_TOOLS_TOUCH_START_ACTIVATE",i.TOUCH_PRESS="CORNERSTONE_TOOLS_TOUCH_PRESS",i.TOUCH_DRAG="CORNERSTONE_TOOLS_TOUCH_DRAG",i.TOUCH_END="CORNERSTONE_TOOLS_TOUCH_END",i.TOUCH_TAP="CORNERSTONE_TOOLS_TAP",i.TOUCH_SWIPE="CORNERSTONE_TOOLS_SWIPE"})(E||(E={}));var St;(function(i){i.Labelmap="Labelmap",i.Contour="Contour",i.Surface="Surface"})(St||(St={}));var ss;(function(i){i.UP="UP",i.DOWN="DOWN",i.LEFT="LEFT",i.RIGHT="RIGHT"})(ss||(ss={}));var dt;(function(i){i.CalculateCursorGeometry="calculateCursorGeometry",i.RenderCursor="renderCursor",i.OnInteractionStart="onInteractionStart",i.OnInteractionEnd="onInteractionEnd",i.Preview="preview",i.RejectPreview="rejectPreview",i.AcceptPreview="acceptPreview",i.Fill="fill",i.Interpolate="interpolate",i.StrategyFunction="strategyFunction",i.CreateIsInThreshold="createIsInThreshold",i.Initialize="initialize",i.INTERNAL_setValue="setValue",i.AddPreview="addPreview",i.ComputeInnerCircleRadius="computeInnerCircleRadius",i.GetStatistics="getStatistics",i.EnsureImageVolumeFor3DManipulation="ensureImageVolumeFor3DManipulation",i.EnsureSegmentationVolumeFor3DManipulation="ensureSegmentationVolumeFor3DManipulation"})(dt||(dt={}));var Bt;(function(i){i.Interaction="Interaction",i.HandlesUpdated="HandlesUpdated",i.StatsUpdated="StatsUpdated",i.InitialSetup="InitialSetup",i.Completed="Completed",i.InterpolationUpdated="InterpolationUpdated",i.History="History",i.MetadataReferenceModified="MetadataReferenceModified",i.LabelChange="LabelChange"})(Bt||(Bt={}));var no;(function(i){i.POLYSEG_CONTOUR_TO_LABELMAP="Converting Contour to Labelmap",i.POLYSEG_SURFACE_TO_LABELMAP="Converting Surfaces to Labelmap",i.POLYSEG_CONTOUR_TO_SURFACE="Converting Contour to Surface",i.POLYSEG_LABELMAP_TO_SURFACE="Converting Labelmap to Surface",i.SURFACE_CLIPPING="Clipping Surfaces",i.COMPUTE_STATISTICS="Computing Statistics",i.INTERPOLATE_LABELMAP="Interpolating Labelmap",i.COMPUTE_LARGEST_BIDIRECTIONAL="Computing Largest Bidirectional",i.GENERATE_CONTOUR_SETS="Generating Contour Sets"})(no||(no={}));var Io;(function(i){i.Linear="Linear",i.Area="Area",i.Volume="Volume",i.Pixel="Pixel"})(Io||(Io={}));const yG=Object.freeze(Object.defineProperty({__proto__:null,AnnotationStyleStates:To,ChangeTypes:Bt,Events:E,get KeyboardBindings(){return vn},get MeasurementType(){return Io},get MouseBindings(){return Fo},SegmentationRepresentations:St,StrategyCallbacks:dt,get Swipe(){return ss},ToolModes:se,WorkerTypes:no},Symbol.toStringTag,{value:"Module"}));let Vl={};function xb(){Vl={}}const Mg={isInteractingWithTool:!1,isMultiPartToolActive:!1,tools:{},toolGroups:[],synchronizers:[],svgNodeCache:Vl,enabledElements:[],handleRadius:6};let $={isInteractingWithTool:!1,isMultiPartToolActive:!1,tools:{},toolGroups:[],synchronizers:[],svgNodeCache:Vl,enabledElements:[],handleRadius:6};function Pb(){xb(),$={...Re({...Mg,svgNodeCache:{}}),svgNodeCache:{...Mg.svgNodeCache}}}var Gd,Ag;function Db(){if(Ag)return Gd;Ag=1;var i="Expected a function",t="__lodash_hash_undefined__",n="[object Function]",e="[object GeneratorFunction]",o="[object Symbol]",s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/,r=/^\./,c=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,l=/[\\^$.*+?()[\]{}|]/g,d=/\\(\\)?/g,u=/^\[object .+?Constructor\]$/,h=typeof Ic=="object"&&Ic&&Ic.Object===Object&&Ic,f=typeof self=="object"&&self&&self.Object===Object&&self,g=h||f||Function("return this")();function m(G,et){return G?.[et]}function p(G){var et=!1;if(G!=null&&typeof G.toString!="function")try{et=!!(G+"")}catch{}return et}var v=Array.prototype,I=Function.prototype,w=Object.prototype,C=g["__core-js_shared__"],S=(function(){var G=/[^.]+$/.exec(C&&C.keys&&C.keys.IE_PROTO||"");return G?"Symbol(src)_1."+G:""})(),b=I.toString,_=w.hasOwnProperty,y=w.toString,D=RegExp("^"+b.call(_).replace(l,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),T=g.Symbol,P=v.splice,x=Ht(g,"Map"),M=Ht(Object,"create"),L=T?T.prototype:void 0,R=L?L.toString:void 0;function U(G){var et=-1,at=G?G.length:0;for(this.clear();++et<at;){var jt=G[et];this.set(jt[0],jt[1])}}function W(){this.__data__=M?M(null):{}}function K(G){return this.has(G)&&delete this.__data__[G]}function j(G){var et=this.__data__;if(M){var at=et[G];return at===t?void 0:at}return _.call(et,G)?et[G]:void 0}function F(G){var et=this.__data__;return M?et[G]!==void 0:_.call(et,G)}function z(G,et){var at=this.__data__;return at[G]=M&&et===void 0?t:et,this}U.prototype.clear=W,U.prototype.delete=K,U.prototype.get=j,U.prototype.has=F,U.prototype.set=z;function q(G){var et=-1,at=G?G.length:0;for(this.clear();++et<at;){var jt=G[et];this.set(jt[0],jt[1])}}function J(){this.__data__=[]}function it(G){var et=this.__data__,at=te(et,G);if(at<0)return!1;var jt=et.length-1;return at==jt?et.pop():P.call(et,at,1),!0}function tt(G){var et=this.__data__,at=te(et,G);return at<0?void 0:et[at][1]}function ot(G){return te(this.__data__,G)>-1}function nt(G,et){var at=this.__data__,jt=te(at,G);return jt<0?at.push([G,et]):at[jt][1]=et,this}q.prototype.clear=J,q.prototype.delete=it,q.prototype.get=tt,q.prototype.has=ot,q.prototype.set=nt;function lt(G){var et=-1,at=G?G.length:0;for(this.clear();++et<at;){var jt=G[et];this.set(jt[0],jt[1])}}function rt(){this.__data__={hash:new U,map:new(x||q),string:new U}}function ut(G){return Ut(this,G).delete(G)}function Tt(G){return Ut(this,G).get(G)}function kt(G){return Ut(this,G).has(G)}function Pt(G,et){return Ut(this,G).set(G,et),this}lt.prototype.clear=rt,lt.prototype.delete=ut,lt.prototype.get=Tt,lt.prototype.has=kt,lt.prototype.set=Pt;function te(G,et){for(var at=G.length;at--;)if(Bo(G[at][0],et))return at;return-1}function Ie(G,et){et=Jt(et,G)?[et]:ce(et);for(var at=0,jt=et.length;G!=null&&at<jt;)G=G[Ve(et[at++])];return at&&at==jt?G:void 0}function re(G){if(!lo(G)||De(G))return!1;var et=yi(G)||p(G)?D:u;return et.test(Wo(G))}function Zt(G){if(typeof G=="string")return G;if(oi(G))return R?R.call(G):"";var et=G+"";return et=="0"&&1/G==-1/0?"-0":et}function ce(G){return co(G)?G:ln(G)}function Ut(G,et){var at=G.__data__;return Pe(et)?at[typeof et=="string"?"string":"hash"]:at.map}function Ht(G,et){var at=m(G,et);return re(at)?at:void 0}function Jt(G,et){if(co(G))return!1;var at=typeof G;return at=="number"||at=="symbol"||at=="boolean"||G==null||oi(G)?!0:a.test(G)||!s.test(G)||et!=null&&G in Object(et)}function Pe(G){var et=typeof G;return et=="string"||et=="number"||et=="symbol"||et=="boolean"?G!=="__proto__":G===null}function De(G){return!!S&&S in G}var ln=jn(function(G){G=st(G);var et=[];return r.test(G)&&et.push(""),G.replace(c,function(at,jt,je,dn){et.push(je?dn.replace(d,"$1"):jt||at)}),et});function Ve(G){if(typeof G=="string"||oi(G))return G;var et=G+"";return et=="0"&&1/G==-1/0?"-0":et}function Wo(G){if(G!=null){try{return b.call(G)}catch{}try{return G+""}catch{}}return""}function jn(G,et){if(typeof G!="function"||et&&typeof et!="function")throw new TypeError(i);var at=function(){var jt=arguments,je=et?et.apply(this,jt):jt[0],dn=at.cache;if(dn.has(je))return dn.get(je);var yo=G.apply(this,jt);return at.cache=dn.set(je,yo),yo};return at.cache=new(jn.Cache||lt),at}jn.Cache=lt;function Bo(G,et){return G===et||G!==G&&et!==et}var co=Array.isArray;function yi(G){var et=lo(G)?y.call(G):"";return et==n||et==e}function lo(G){var et=typeof G;return!!G&&(et=="object"||et=="function")}function xi(G){return!!G&&typeof G=="object"}function oi(G){return typeof G=="symbol"||xi(G)&&y.call(G)==o}function st(G){return G==null?"":Zt(G)}function Mt(G,et,at){var jt=G==null?void 0:Ie(G,et);return jt===void 0?at:jt}return Gd=Mt,Gd}var Tb=Db();const Mb=fb(Tb),Lg=Symbol("DefinedCursors"),kv=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 An{constructor(t,n){this.name=t+"",this.fallback=n}getName(){return this.name+""}addFallbackStyleProperty(t){const{fallback:n}=this;return n instanceof An?`${t}, ${n.getStyleProperty()}`:t+""}getStyleProperty(){return this.addFallbackStyleProperty(this.name)+""}static getDefinedCursor(t){const n=Og(An,Lg);let e=n.get(t);if(e instanceof An)return e;if(kv.has(t))return e=new An(t),n.set(t,e),e}static setDefinedCursor(t,n){return n instanceof An?(Og(An,Lg).set(t,n),!0):!1}}function Og(i,t){let n=i[t];return n instanceof Map||(n=new Map,Object.defineProperty(i,t,{value:n})),n}const Ab=kv.values(),Lb="image-cursor";class vr extends An{constructor(t,n,e,o,s){super(o||vr.getUniqueInstanceName(Lb),s),this.url=t,this.x=Number(n)||0,this.y=Number(e)||0}getStyleProperty(){const{url:t,x:n,y:e}=this;let o=`url('${t}')`;return n>=0&&e>=0&&(n>0||e>0)&&(o+=` ${n} ${e}`),this.addFallbackStyleProperty(o)}static getUniqueInstanceName(t){return`${t}-${sb(vr)}`}}const he={iconContent:"",iconSize:16,viewBox:{x:16,y:16},mousePoint:{x:8,y:8},mousePointerGroupString:`
1
+ import{b7 as Re,t as Rt,e as Z,al as mv,aJ as Ne,aK as Vi,b8 as Se,at as Q,b9 as jr,ba as pv,ac as We,V as so,ar as Xe,bb as Gn,ad as pn,am as Pn,ae as Qo,bc as wn,bd as Xr,be as vv,ah as Ea,bf as ve,i as ie,bg as vc,bh as Iv,bi as rn,bj as bh,bk as Hn,bl as eo,bm as Fi,bn as _h,bo as yh,bp as Nl,bq as qr,E as yt,aN as Es,br as Ss,bs as wv,bt as $o,bu as IC,bv as Fn,bw as wC,bx as EC,by as SC,bz as CC,bA as Yc,bB as bC,aw as _C,b5 as Kc,bC as yC,bD as Ev,bE as xC,bF as xh,bG as Sv,bH as PC,bI as DC,aL as Eg,K as kl,bJ as Sa,ao as Cv,bK as TC,bL as MC,bM as AC,aO as fr,bN as bv,bO as Ud,bP as _v,bQ as Ph,bR as Dh,bS as LC,bT as OC,av as RC,g as NC,bU as po,bV as kC,bW as UC,bX as Zc,bY as Sg,bZ as VC,b_ as Vd,ag as Ks,af as FC,b$ as Cg,J as GC,ai as HC,c0 as WC,c1 as Th,c2 as BC,c3 as zC}from"./Settings-CKWXQZHN.js";import{D as _n,I as Mh,M as Vt,m as Lt,P as Di,a as ku,V as bg,B as di,b as $C,s as jC,d as _g,n as tr,c as XC,t as qC,i as YC,e as yg,f as KC,g as ZC,h as Bc,j as JC}from"./cornerstoneEngine-hAkB6jjG.js";import{C as yv,P as Ah,I as QC,a as tb,b as Vo,c as la,M as Oo,A as vo,d as Ul,R as xv,T as Pv,t as Jc,e as er,f as xg,Q as eb,g as nb,h as ob,L as ib}from"./Texture-CIGczsau.js";import{i as sb,b as ae,g as N,j as ab,c as le,u as oe,k as Dv,l as Lh,m as Uu,f as gr,h as Zs,n as rb,d as cb,o as Oh,r as de,p as lb,q as Tv,t as gn,w as is,x as Rh,y as Mv,z as db,A as da,M as ub,B as Av,C as Pg,D as Fa,E as Vu,F as hb}from"./index-DdXuWqY6.js";import{c as Ic,g as fb}from"./_commonjsHelpers-CE1G-McA.js";import{A as Kn,E as Js,c as B,f as Ot,d as xt,a as Me,l as mr,n as Wt,e as pr,s as bn,b as Oe,g as tn,h as mn,i as ee,j as Yr,k as gb,m as ke,t as Un,o as Ue,p as Lv,q as Fu,r as yn,u as Ov,v as ho,w as Rv,x as Nv,y as mb,z as pb,B as vb,C as Dg,D as Ib,F as wb,G as Eb}from"./throttle-CjIII7Yf.js";import{a as Sb}from"./addVolumesToViewports-BsIV1_Qz.js";import"./dcmjs.es-DfWkgqfk.js";import"./index-QlzdWpod.js";function Cb(i,t){let n;if(t===void 0)for(const e of i)e!=null&&(n>e||n===void 0&&e>=e)&&(n=e);else{let e=-1;for(let o of i)(o=t(o,++e,i))!=null&&(n>o||n===void 0&&o>=o)&&(n=o)}return n}function bb(i){if(!(s=i.length))return[];for(var t=-1,n=Cb(i,_b),e=new Array(n);++t<n;)for(var o=-1,s,a=e[t]=new Array(s);++o<s;)a[o]=i[o][t];return e}function _b(i){return i.length}function Tg(){return bb(arguments)}function yb(i,t,n,e,o){var s=i*i,a=s*i;return((1-3*i+3*s-a)*t+(4-6*s+3*a)*n+(1+3*i+3*s-3*a)*e+a*o)/6}function Fd(i){var t=i.length-1;return function(n){var e=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),o=i[e],s=i[e+1],a=e>0?i[e-1]:2*o-s,r=e<t-1?i[e+2]:2*s-o;return yb((n-e/t)*t,a,o,s,r)}}function Ga(i,t){for(var n=new Array(t),e=0;e<t;++e)n[e]=i(e/(t-1));return n}var Fo;(function(i){i[i.Primary=1]="Primary",i[i.Secondary=2]="Secondary",i[i.Primary_And_Secondary=3]="Primary_And_Secondary",i[i.Auxiliary=4]="Auxiliary",i[i.Primary_And_Auxiliary=5]="Primary_And_Auxiliary",i[i.Secondary_And_Auxiliary=6]="Secondary_And_Auxiliary",i[i.Primary_And_Secondary_And_Auxiliary=7]="Primary_And_Secondary_And_Auxiliary",i[i.Fourth_Button=8]="Fourth_Button",i[i.Fifth_Button=16]="Fifth_Button",i[i.Wheel=524288]="Wheel",i[i.Wheel_Primary=524289]="Wheel_Primary"})(Fo||(Fo={}));var vn;(function(i){i[i.Shift=16]="Shift",i[i.Ctrl=17]="Ctrl",i[i.Alt=18]="Alt",i[i.Meta=91]="Meta",i[i.ShiftCtrl=1617]="ShiftCtrl",i[i.ShiftAlt=1618]="ShiftAlt",i[i.ShiftMeta=1691]="ShiftMeta",i[i.CtrlAlt=1718]="CtrlAlt",i[i.CtrlMeta=1791]="CtrlMeta",i[i.AltMeta=1891]="AltMeta"})(vn||(vn={}));var se;(function(i){i.Active="Active",i.Passive="Passive",i.Enabled="Enabled",i.Disabled="Disabled"})(se||(se={}));var To;(function(i){i.Default="",i.Highlighted="Highlighted",i.Selected="Selected",i.Locked="Locked",i.AutoGenerated="AutoGenerated"})(To||(To={}));var E;(function(i){i.TOOL_ACTIVATED="CORNERSTONE_TOOLS_TOOL_ACTIVATED",i.TOOLGROUP_VIEWPORT_ADDED="CORNERSTONE_TOOLS_TOOLGROUP_VIEWPORT_ADDED",i.TOOLGROUP_VIEWPORT_REMOVED="CORNERSTONE_TOOLS_TOOLGROUP_VIEWPORT_REMOVED",i.TOOL_MODE_CHANGED="CORNERSTONE_TOOLS_TOOL_MODE_CHANGED",i.CROSSHAIR_TOOL_CENTER_CHANGED="CORNERSTONE_TOOLS_CROSSHAIR_TOOL_CENTER_CHANGED",i.WORLD_CROSSHAIR_POINT_CHANGED="CORNERSTONE_TOOLS_WORLD_CROSSHAIR_POINT_CHANGED",i.WORLD_CROSSHAIR_POINT_CLEARED="CORNERSTONE_TOOLS_WORLD_CROSSHAIR_POINT_CLEARED",i.WORLD_CROSSHAIR_JUMPED_TO_POINT="CORNERSTONE_TOOLS_WORLD_CROSSHAIR_JUMPED_TO_POINT",i.SLICE_INTERSECTION_LINE_SELECTED="CORNERSTONE_TOOLS_SLICE_INTERSECTION_LINE_SELECTED",i.SLICE_INTERSECTION_MANIPULATION_STARTED="CORNERSTONE_TOOLS_SLICE_INTERSECTION_MANIPULATION_STARTED",i.SLICE_INTERSECTION_MANIPULATION_ENDED="CORNERSTONE_TOOLS_SLICE_INTERSECTION_MANIPULATION_ENDED",i.SLICE_INTERSECTION_SLAB_THICKNESS_CHANGED="CORNERSTONE_TOOLS_SLICE_INTERSECTION_SLAB_THICKNESS_CHANGED",i.VOLUMECROPPINGCONTROL_TOOL_CHANGED="CORNERSTONE_TOOLS_VOLUMECROPPINGCONTROL_TOOL_CHANGED",i.VOLUMECROPPING_TOOL_CHANGED="CORNERSTONE_TOOLS_VOLUMECROPPING_TOOL_CHANGED",i.STACK_PREFETCH_COMPLETE="CORNERSTONE_TOOLS_STACK_PREFETCH_COMPLETE",i.ANNOTATION_ADDED="CORNERSTONE_TOOLS_ANNOTATION_ADDED",i.ANNOTATION_COMPLETED="CORNERSTONE_TOOLS_ANNOTATION_COMPLETED",i.ANNOTATION_MODIFIED="CORNERSTONE_TOOLS_ANNOTATION_MODIFIED",i.ANNOTATION_REMOVED="CORNERSTONE_TOOLS_ANNOTATION_REMOVED",i.ANNOTATION_SELECTION_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_SELECTION_CHANGE",i.ANNOTATION_LOCK_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_LOCK_CHANGE",i.ANNOTATION_VISIBILITY_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_VISIBILITY_CHANGE",i.ANNOTATION_RENDERED="CORNERSTONE_TOOLS_ANNOTATION_RENDERED",i.ANNOTATION_CUT_MERGE_PROCESS_COMPLETED="CORNERSTONE_TOOLS_ANNOTATION_CUT_MERGE_PROCESS_COMPLETED",i.ANNOTATION_INTERPOLATION_PROCESS_COMPLETED="CORNERSTONE_TOOLS_ANNOTATION_INTERPOLATION_PROCESS_COMPLETED",i.INTERPOLATED_ANNOTATIONS_REMOVED="CORNERSTONE_TOOLS_INTERPOLATED_ANNOTATIONS_REMOVED",i.SEGMENTATION_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_MODIFIED",i.SEGMENTATION_RENDERED="CORNERSTONE_TOOLS_SEGMENTATION_RENDERED",i.SEGMENTATION_REPRESENTATION_ADDED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_ADDED",i.SEGMENTATION_ADDED="CORNERSTONE_TOOLS_SEGMENTATION_ADDED",i.SEGMENTATION_REPRESENTATION_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_MODIFIED",i.SEGMENTATION_REMOVED="CORNERSTONE_TOOLS_SEGMENTATION_REMOVED",i.SEGMENTATION_REPRESENTATION_REMOVED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_REMOVED",i.SEGMENTATION_DATA_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_DATA_MODIFIED",i.HISTORY_UNDO="CORNERSTONE_TOOLS_HISTORY_UNDO",i.HISTORY_REDO="CORNERSTONE_TOOLS_HISTORY_REDO",i.KEY_DOWN="CORNERSTONE_TOOLS_KEY_DOWN",i.KEY_UP="CORNERSTONE_TOOLS_KEY_UP",i.MOUSE_DOWN="CORNERSTONE_TOOLS_MOUSE_DOWN",i.MOUSE_UP="CORNERSTONE_TOOLS_MOUSE_UP",i.MOUSE_DOWN_ACTIVATE="CORNERSTONE_TOOLS_MOUSE_DOWN_ACTIVATE",i.MOUSE_DRAG="CORNERSTONE_TOOLS_MOUSE_DRAG",i.MOUSE_MOVE="CORNERSTONE_TOOLS_MOUSE_MOVE",i.MOUSE_CLICK="CORNERSTONE_TOOLS_MOUSE_CLICK",i.MOUSE_DOUBLE_CLICK="CORNERSTONE_TOOLS_MOUSE_DOUBLE_CLICK",i.MOUSE_WHEEL="CORNERSTONE_TOOLS_MOUSE_WHEEL",i.TOUCH_START="CORNERSTONE_TOOLS_TOUCH_START",i.TOUCH_START_ACTIVATE="CORNERSTONE_TOOLS_TOUCH_START_ACTIVATE",i.TOUCH_PRESS="CORNERSTONE_TOOLS_TOUCH_PRESS",i.TOUCH_DRAG="CORNERSTONE_TOOLS_TOUCH_DRAG",i.TOUCH_END="CORNERSTONE_TOOLS_TOUCH_END",i.TOUCH_TAP="CORNERSTONE_TOOLS_TAP",i.TOUCH_SWIPE="CORNERSTONE_TOOLS_SWIPE"})(E||(E={}));var St;(function(i){i.Labelmap="Labelmap",i.Contour="Contour",i.Surface="Surface"})(St||(St={}));var ss;(function(i){i.UP="UP",i.DOWN="DOWN",i.LEFT="LEFT",i.RIGHT="RIGHT"})(ss||(ss={}));var dt;(function(i){i.CalculateCursorGeometry="calculateCursorGeometry",i.RenderCursor="renderCursor",i.OnInteractionStart="onInteractionStart",i.OnInteractionEnd="onInteractionEnd",i.Preview="preview",i.RejectPreview="rejectPreview",i.AcceptPreview="acceptPreview",i.Fill="fill",i.Interpolate="interpolate",i.StrategyFunction="strategyFunction",i.CreateIsInThreshold="createIsInThreshold",i.Initialize="initialize",i.INTERNAL_setValue="setValue",i.AddPreview="addPreview",i.ComputeInnerCircleRadius="computeInnerCircleRadius",i.GetStatistics="getStatistics",i.EnsureImageVolumeFor3DManipulation="ensureImageVolumeFor3DManipulation",i.EnsureSegmentationVolumeFor3DManipulation="ensureSegmentationVolumeFor3DManipulation"})(dt||(dt={}));var Bt;(function(i){i.Interaction="Interaction",i.HandlesUpdated="HandlesUpdated",i.StatsUpdated="StatsUpdated",i.InitialSetup="InitialSetup",i.Completed="Completed",i.InterpolationUpdated="InterpolationUpdated",i.History="History",i.MetadataReferenceModified="MetadataReferenceModified",i.LabelChange="LabelChange"})(Bt||(Bt={}));var no;(function(i){i.POLYSEG_CONTOUR_TO_LABELMAP="Converting Contour to Labelmap",i.POLYSEG_SURFACE_TO_LABELMAP="Converting Surfaces to Labelmap",i.POLYSEG_CONTOUR_TO_SURFACE="Converting Contour to Surface",i.POLYSEG_LABELMAP_TO_SURFACE="Converting Labelmap to Surface",i.SURFACE_CLIPPING="Clipping Surfaces",i.COMPUTE_STATISTICS="Computing Statistics",i.INTERPOLATE_LABELMAP="Interpolating Labelmap",i.COMPUTE_LARGEST_BIDIRECTIONAL="Computing Largest Bidirectional",i.GENERATE_CONTOUR_SETS="Generating Contour Sets"})(no||(no={}));var Io;(function(i){i.Linear="Linear",i.Area="Area",i.Volume="Volume",i.Pixel="Pixel"})(Io||(Io={}));const yG=Object.freeze(Object.defineProperty({__proto__:null,AnnotationStyleStates:To,ChangeTypes:Bt,Events:E,get KeyboardBindings(){return vn},get MeasurementType(){return Io},get MouseBindings(){return Fo},SegmentationRepresentations:St,StrategyCallbacks:dt,get Swipe(){return ss},ToolModes:se,WorkerTypes:no},Symbol.toStringTag,{value:"Module"}));let Vl={};function xb(){Vl={}}const Mg={isInteractingWithTool:!1,isMultiPartToolActive:!1,tools:{},toolGroups:[],synchronizers:[],svgNodeCache:Vl,enabledElements:[],handleRadius:6};let $={isInteractingWithTool:!1,isMultiPartToolActive:!1,tools:{},toolGroups:[],synchronizers:[],svgNodeCache:Vl,enabledElements:[],handleRadius:6};function Pb(){xb(),$={...Re({...Mg,svgNodeCache:{}}),svgNodeCache:{...Mg.svgNodeCache}}}var Gd,Ag;function Db(){if(Ag)return Gd;Ag=1;var i="Expected a function",t="__lodash_hash_undefined__",n="[object Function]",e="[object GeneratorFunction]",o="[object Symbol]",s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/,r=/^\./,c=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,l=/[\\^$.*+?()[\]{}|]/g,d=/\\(\\)?/g,u=/^\[object .+?Constructor\]$/,h=typeof Ic=="object"&&Ic&&Ic.Object===Object&&Ic,f=typeof self=="object"&&self&&self.Object===Object&&self,g=h||f||Function("return this")();function m(G,et){return G?.[et]}function p(G){var et=!1;if(G!=null&&typeof G.toString!="function")try{et=!!(G+"")}catch{}return et}var v=Array.prototype,I=Function.prototype,w=Object.prototype,C=g["__core-js_shared__"],S=(function(){var G=/[^.]+$/.exec(C&&C.keys&&C.keys.IE_PROTO||"");return G?"Symbol(src)_1."+G:""})(),b=I.toString,_=w.hasOwnProperty,y=w.toString,D=RegExp("^"+b.call(_).replace(l,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),T=g.Symbol,P=v.splice,x=Ht(g,"Map"),M=Ht(Object,"create"),L=T?T.prototype:void 0,R=L?L.toString:void 0;function U(G){var et=-1,at=G?G.length:0;for(this.clear();++et<at;){var jt=G[et];this.set(jt[0],jt[1])}}function W(){this.__data__=M?M(null):{}}function K(G){return this.has(G)&&delete this.__data__[G]}function j(G){var et=this.__data__;if(M){var at=et[G];return at===t?void 0:at}return _.call(et,G)?et[G]:void 0}function F(G){var et=this.__data__;return M?et[G]!==void 0:_.call(et,G)}function z(G,et){var at=this.__data__;return at[G]=M&&et===void 0?t:et,this}U.prototype.clear=W,U.prototype.delete=K,U.prototype.get=j,U.prototype.has=F,U.prototype.set=z;function q(G){var et=-1,at=G?G.length:0;for(this.clear();++et<at;){var jt=G[et];this.set(jt[0],jt[1])}}function J(){this.__data__=[]}function it(G){var et=this.__data__,at=te(et,G);if(at<0)return!1;var jt=et.length-1;return at==jt?et.pop():P.call(et,at,1),!0}function tt(G){var et=this.__data__,at=te(et,G);return at<0?void 0:et[at][1]}function ot(G){return te(this.__data__,G)>-1}function nt(G,et){var at=this.__data__,jt=te(at,G);return jt<0?at.push([G,et]):at[jt][1]=et,this}q.prototype.clear=J,q.prototype.delete=it,q.prototype.get=tt,q.prototype.has=ot,q.prototype.set=nt;function lt(G){var et=-1,at=G?G.length:0;for(this.clear();++et<at;){var jt=G[et];this.set(jt[0],jt[1])}}function rt(){this.__data__={hash:new U,map:new(x||q),string:new U}}function ut(G){return Ut(this,G).delete(G)}function Tt(G){return Ut(this,G).get(G)}function kt(G){return Ut(this,G).has(G)}function Pt(G,et){return Ut(this,G).set(G,et),this}lt.prototype.clear=rt,lt.prototype.delete=ut,lt.prototype.get=Tt,lt.prototype.has=kt,lt.prototype.set=Pt;function te(G,et){for(var at=G.length;at--;)if(Bo(G[at][0],et))return at;return-1}function Ie(G,et){et=Jt(et,G)?[et]:ce(et);for(var at=0,jt=et.length;G!=null&&at<jt;)G=G[Ve(et[at++])];return at&&at==jt?G:void 0}function re(G){if(!lo(G)||De(G))return!1;var et=yi(G)||p(G)?D:u;return et.test(Wo(G))}function Zt(G){if(typeof G=="string")return G;if(oi(G))return R?R.call(G):"";var et=G+"";return et=="0"&&1/G==-1/0?"-0":et}function ce(G){return co(G)?G:ln(G)}function Ut(G,et){var at=G.__data__;return Pe(et)?at[typeof et=="string"?"string":"hash"]:at.map}function Ht(G,et){var at=m(G,et);return re(at)?at:void 0}function Jt(G,et){if(co(G))return!1;var at=typeof G;return at=="number"||at=="symbol"||at=="boolean"||G==null||oi(G)?!0:a.test(G)||!s.test(G)||et!=null&&G in Object(et)}function Pe(G){var et=typeof G;return et=="string"||et=="number"||et=="symbol"||et=="boolean"?G!=="__proto__":G===null}function De(G){return!!S&&S in G}var ln=jn(function(G){G=st(G);var et=[];return r.test(G)&&et.push(""),G.replace(c,function(at,jt,je,dn){et.push(je?dn.replace(d,"$1"):jt||at)}),et});function Ve(G){if(typeof G=="string"||oi(G))return G;var et=G+"";return et=="0"&&1/G==-1/0?"-0":et}function Wo(G){if(G!=null){try{return b.call(G)}catch{}try{return G+""}catch{}}return""}function jn(G,et){if(typeof G!="function"||et&&typeof et!="function")throw new TypeError(i);var at=function(){var jt=arguments,je=et?et.apply(this,jt):jt[0],dn=at.cache;if(dn.has(je))return dn.get(je);var yo=G.apply(this,jt);return at.cache=dn.set(je,yo),yo};return at.cache=new(jn.Cache||lt),at}jn.Cache=lt;function Bo(G,et){return G===et||G!==G&&et!==et}var co=Array.isArray;function yi(G){var et=lo(G)?y.call(G):"";return et==n||et==e}function lo(G){var et=typeof G;return!!G&&(et=="object"||et=="function")}function xi(G){return!!G&&typeof G=="object"}function oi(G){return typeof G=="symbol"||xi(G)&&y.call(G)==o}function st(G){return G==null?"":Zt(G)}function Mt(G,et,at){var jt=G==null?void 0:Ie(G,et);return jt===void 0?at:jt}return Gd=Mt,Gd}var Tb=Db();const Mb=fb(Tb),Lg=Symbol("DefinedCursors"),kv=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 An{constructor(t,n){this.name=t+"",this.fallback=n}getName(){return this.name+""}addFallbackStyleProperty(t){const{fallback:n}=this;return n instanceof An?`${t}, ${n.getStyleProperty()}`:t+""}getStyleProperty(){return this.addFallbackStyleProperty(this.name)+""}static getDefinedCursor(t){const n=Og(An,Lg);let e=n.get(t);if(e instanceof An)return e;if(kv.has(t))return e=new An(t),n.set(t,e),e}static setDefinedCursor(t,n){return n instanceof An?(Og(An,Lg).set(t,n),!0):!1}}function Og(i,t){let n=i[t];return n instanceof Map||(n=new Map,Object.defineProperty(i,t,{value:n})),n}const Ab=kv.values(),Lb="image-cursor";class vr extends An{constructor(t,n,e,o,s){super(o||vr.getUniqueInstanceName(Lb),s),this.url=t,this.x=Number(n)||0,this.y=Number(e)||0}getStyleProperty(){const{url:t,x:n,y:e}=this;let o=`url('${t}')`;return n>=0&&e>=0&&(n>0||e>0)&&(o+=` ${n} ${e}`),this.addFallbackStyleProperty(o)}static getUniqueInstanceName(t){return`${t}-${sb(vr)}`}}const he={iconContent:"",iconSize:16,viewBox:{x:16,y:16},mousePoint:{x:8,y:8},mousePointerGroupString:`
2
2
  <path stroke="{{color}}" d="M8 16L8 0"></path>
3
3
  <path stroke="{{color}}" d="M16 8L0 8"></path>
4
4
  `},Xn={x:127,y:60},As=`