@fnndsc/argus 0.18.15 → 0.19.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.
Files changed (26) hide show
  1. package/dist/assets/{Settings-DRJQ5vM9.js → Settings-DtQS3pSQ.js} +1 -1
  2. package/dist/assets/{Texture-D1w-H9mm.js → Texture-DTS8gN4X.js} +1 -1
  3. package/dist/assets/{addVolumesToViewports-BKv6xg3B.js → addVolumesToViewports-BmTKFXHo.js} +1 -1
  4. package/dist/assets/{cornerstoneEngine-DH6oYLiJ.js → cornerstoneEngine-D7LlegT9.js} +2 -2
  5. package/dist/assets/field-B9Q3MQXT.js +12 -0
  6. package/dist/assets/{index-Ce7pky6w.js → index-BXW7Tk-y.js} +1 -1
  7. package/dist/assets/index-BbLqxNmR.js +1 -0
  8. package/dist/assets/index-Bg8kKECW.js +1 -0
  9. package/dist/assets/index-C3mZD6Qc.js +13 -0
  10. package/dist/assets/index-CPSjKTCr.js +1 -0
  11. package/dist/assets/index-Cg6MXiwK.js +3 -0
  12. package/dist/assets/{index-BMNkDkCF.js → index-CjHzi1GP.js} +1 -1
  13. package/dist/assets/index-CpDeLelw.js +1 -0
  14. package/dist/assets/{index-anlcyU1R.js → index-D1xu7Ktv.js} +1 -1
  15. package/dist/assets/index-D3_lERwV.js +6 -0
  16. package/dist/assets/index-DMBeBa6w.css +1 -0
  17. package/dist/assets/index-DeWW6Jmk.js +4259 -0
  18. package/dist/assets/{index-CRH7cDVY.js → index-H1DQLyb-.js} +1 -1
  19. package/dist/assets/{index-D0AbmRUx.js → index-PdgFkf4u.js} +1 -1
  20. package/dist/assets/{index-C-7UZOyK.js → index-fI0XijLj.js} +1 -1
  21. package/dist/assets/{niivueEngine-DG2Y1Dom.js → niivueEngine-_Z7OfQ_k.js} +2 -2
  22. package/dist/assets/{slabScene-vT9y2IQz.js → slabScene-Y0E2vshU.js} +1 -1
  23. package/dist/index.html +54 -2
  24. package/package.json +13 -2
  25. package/dist/assets/index-C068GSUl.css +0 -1
  26. package/dist/assets/index-Q1X-tLaK.js +0 -4256
@@ -1,2 +1,2 @@
1
- import We,{data as A,normalizers as k,utilities as D,derivations as Ie,constants as hn,sr as yn}from"./dcmjs.es-DfWkgqfk.js";import{bY as Bt,bZ as Yt,dA as Dn,at as Tn,cD as Kt,t as Cn,e as bn,bi as q,cp as $e,cs as Rn}from"./Settings-DRJQ5vM9.js";import"./cornerstoneEngine-DH6oYLiJ.js";import"./Texture-D1w-H9mm.js";import{m as Mn,t as Pn}from"./throttle-CjIII7Yf.js";import"./index-Q1X-tLaK.js";import"./refusal-DOpm8I8L.js";import"./_commonjsHelpers-CE1G-McA.js";const R=r=>Array.isArray(r)?r:r!==void 0?[r]:[],Pe=r=>e=>e.ConceptNameCodeSequence.CodeMeaning===r;A.datasetToBlob;const vn=Bt;let Nn=vn;function E(r,e){let t=r.is3DMeasurement,n=r.referencedImageId;if(t)return{x:e[0],y:e[1],z:e[2]};const a=Nn(n,e);return{x:a[0],y:a[1]}}function Q(r,e){return e.map(t=>E(r,t))}const En=Yt;function pe(r,e){let t=r.is3DMeasurement,n=r.referencedImageId;const a=[];if(t){const o=e.GraphicData;for(let s=0;s<o.length;s+=3){const i=[o[s],o[s+1],o[s+2]];a.push(i)}}else{const o=e.GraphicData;for(let s=0;s<o.length;s+=2){const i=En(n,[o[s],o[s+1]]);a.push(i)}}return a}const zt=D.TID1500,st=D.addAccessors,wn=Ie.StructuredReport,An=k.Normalizer,Un=zt.TID1500MeasurementReport,jn=zt.TID1501MeasurementGroup,xn=A.DicomMetaDictionary,Gn={CodingSchemeDesignator:"DCM",CodeValue:"121071"},_n={CodingSchemeDesignator:"SCT",CodeValue:"363698007"},Vn={CodingSchemeDesignator:"SRT",CodeValue:"G-C0E3"},it=(r,e,t)=>{const n=r.ConceptNameCodeSequence;if(!n)return;const a=n.CodingSchemeDesignator,o=n.CodeValue;return a==e.CodingSchemeDesignator&&o==e.CodeValue||t&&a==t.CodingSchemeDesignator&&o==t.CodeValue};function $n(r,e,t){const n=t.getTID300RepresentationArguments(r);return n.ReferencedSOPSequence=e,n.ReferencedFrameOfReferenceUID=n.use3DSpatialCoordinates?r.metadata.FrameOfReferenceUID:null,new t.TID300Representation(n)}function qn(r,e,t){const n=e[r],a=M.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE[r];if(!n||!n.data||!n.data.length||!a)return;const o=n.data.map(s=>$n(s,t,a));return new jn(o)}let M=class ue{static getSetupMeasurementData(e){const t=e.ContentSequence,n=R(t),a=n.find(g=>it(g,Gn)),o=n.filter(g=>it(g,_n,Vn))||[],s=n.find(g=>g.ValueType==="NUM"),i=R(s.ContentSequence).find(g=>g.ValueType==="SCOORD"),c=i.ContentSequence.ReferencedSOPSequence,u=c.ReferencedSOPInstanceUID,l=c.ReferencedFrameNumber,d={sopInstanceUid:u,frameIndex:l||1,complete:!0,finding:a?st(a.ConceptCodeSequence):void 0,findingSites:o.map(g=>st(g.ConceptCodeSequence))};d.finding&&(d.description=d.finding.CodeMeaning);const p=d.findingSites&&d.findingSites[0];return p&&(d.location=p[0]&&p[0].CodeMeaning||p.CodeMeaning),{defaultState:d,findingGroup:a,findingSiteGroups:o,NUMGroup:s,SCOORDGroup:i,ReferencedSOPSequence:c,ReferencedSOPInstanceUID:u,ReferencedFrameNumber:l}}static generateReport(e,t,n){let a=[];const o=Object.keys(e)[0];if(!o)throw new Error("No measurements provided.");const s=t.get("generalSeriesModule",o),i=s.studyInstanceUID,c=s.seriesInstanceUID;Object.keys(e).forEach(m=>{const h=t.get("sopCommonModule",m),O=t.get("frameNumber",m),y=e[m],S=Object.keys(y),b={ReferencedSOPClassUID:h.sopClassUID,ReferencedSOPInstanceUID:h.sopInstanceUID};An.isMultiframeSOPClassUID(h.sopClassUID)&&(b.ReferencedFrameNumber=O);const T=[];S.forEach(v=>{const j=qn(v,y,b);j&&T.push(j)}),a=a.concat(T)});const u=new Un({TID1501MeasurementGroups:a},n),l=new Uint8Array(2);l[1]=1;const d={StudyInstanceUID:i,SeriesInstanceUID:c},p={FileMetaInformationVersion:{Value:[l.buffer],vr:"OB"},TransferSyntaxUID:{Value:["1.2.840.10008.1.2.1"],vr:"UI"},ImplementationClassUID:{Value:[xn.uid()],vr:"UI"},ImplementationVersionName:{Value:["dcmjs"],vr:"SH"}},g={PixelData:"OW"};d._meta=p,d._vrMap=g;const f=new wn([d]),I=u.contentItem(d);return f.dataset=Object.assign(f.dataset,I),f.dataset._meta=p,f.dataset.SpecificCharacterSet="ISO_IR 192",f}static generateToolState(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e.ContentTemplateSequence.TemplateIdentifier!=="1500")throw new Error("This package can currently only interpret DICOM SR TID 1500");const n="Imaging Measurements",a="Measurement Group",o="Tracking Identifier",s=R(e.ContentSequence).find(Pe(n)),i=R(s.ContentSequence).filter(Pe(a)),c={},u=ue.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE,l=[];return Object.keys(u).forEach(d=>{l.push(u[d]),c[d]=[]}),i.forEach(d=>{const f=R(d.ContentSequence).find(m=>m.ConceptNameCodeSequence.CodeMeaning===o).TextValue,I=t.getToolClass?t.getToolClass(d,e,l):l.find(m=>m.isValidCornerstoneTrackingIdentifier(f));if(I){const m=I.getMeasurementData(d);console.log("=== ".concat(I.toolType," ===")),console.log(m),c[I.toolType].push(m)}}),c}static registerTool(e){ue.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE[e.utilityToolType]=e,ue.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE[e.toolType]=e,ue.MEASUREMENT_BY_TOOLTYPE[e.toolType]=e.utilityToolType}};M.MEASUREMENT_BY_TOOLTYPE={};M.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE={};M.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE={};function Fn(r){if(Array.isArray(r))return r}function Ln(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n,a,o,s,i=[],c=!0,u=!1;try{if(o=(t=t.call(r)).next,e===0){if(Object(t)!==t)return;c=!1}else for(;!(c=(n=o.call(t)).done)&&(i.push(n.value),i.length!==e);c=!0);}catch(l){u=!0,a=l}finally{try{if(!c&&t.return!=null&&(s=t.return(),Object(s)!==s))return}finally{if(u)throw a}}return i}}function ct(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function kn(r,e){if(r){if(typeof r=="string")return ct(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ct(r,e):void 0}}function Bn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import We,{data as A,normalizers as k,utilities as D,derivations as Ie,constants as hn,sr as yn}from"./dcmjs.es-DfWkgqfk.js";import{bY as Bt,bZ as Yt,dA as Dn,at as Tn,cD as Kt,t as Cn,e as bn,bi as q,cp as $e,cs as Rn}from"./Settings-DtQS3pSQ.js";import"./cornerstoneEngine-D7LlegT9.js";import"./Texture-DTS8gN4X.js";import{m as Mn,t as Pn}from"./throttle-CjIII7Yf.js";import"./index-DeWW6Jmk.js";import"./refusal-DOpm8I8L.js";import"./_commonjsHelpers-CE1G-McA.js";const R=r=>Array.isArray(r)?r:r!==void 0?[r]:[],Pe=r=>e=>e.ConceptNameCodeSequence.CodeMeaning===r;A.datasetToBlob;const vn=Bt;let Nn=vn;function E(r,e){let t=r.is3DMeasurement,n=r.referencedImageId;if(t)return{x:e[0],y:e[1],z:e[2]};const a=Nn(n,e);return{x:a[0],y:a[1]}}function Q(r,e){return e.map(t=>E(r,t))}const En=Yt;function pe(r,e){let t=r.is3DMeasurement,n=r.referencedImageId;const a=[];if(t){const o=e.GraphicData;for(let s=0;s<o.length;s+=3){const i=[o[s],o[s+1],o[s+2]];a.push(i)}}else{const o=e.GraphicData;for(let s=0;s<o.length;s+=2){const i=En(n,[o[s],o[s+1]]);a.push(i)}}return a}const zt=D.TID1500,st=D.addAccessors,wn=Ie.StructuredReport,An=k.Normalizer,Un=zt.TID1500MeasurementReport,jn=zt.TID1501MeasurementGroup,xn=A.DicomMetaDictionary,Gn={CodingSchemeDesignator:"DCM",CodeValue:"121071"},_n={CodingSchemeDesignator:"SCT",CodeValue:"363698007"},Vn={CodingSchemeDesignator:"SRT",CodeValue:"G-C0E3"},it=(r,e,t)=>{const n=r.ConceptNameCodeSequence;if(!n)return;const a=n.CodingSchemeDesignator,o=n.CodeValue;return a==e.CodingSchemeDesignator&&o==e.CodeValue||t&&a==t.CodingSchemeDesignator&&o==t.CodeValue};function $n(r,e,t){const n=t.getTID300RepresentationArguments(r);return n.ReferencedSOPSequence=e,n.ReferencedFrameOfReferenceUID=n.use3DSpatialCoordinates?r.metadata.FrameOfReferenceUID:null,new t.TID300Representation(n)}function qn(r,e,t){const n=e[r],a=M.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE[r];if(!n||!n.data||!n.data.length||!a)return;const o=n.data.map(s=>$n(s,t,a));return new jn(o)}let M=class ue{static getSetupMeasurementData(e){const t=e.ContentSequence,n=R(t),a=n.find(g=>it(g,Gn)),o=n.filter(g=>it(g,_n,Vn))||[],s=n.find(g=>g.ValueType==="NUM"),i=R(s.ContentSequence).find(g=>g.ValueType==="SCOORD"),c=i.ContentSequence.ReferencedSOPSequence,u=c.ReferencedSOPInstanceUID,l=c.ReferencedFrameNumber,d={sopInstanceUid:u,frameIndex:l||1,complete:!0,finding:a?st(a.ConceptCodeSequence):void 0,findingSites:o.map(g=>st(g.ConceptCodeSequence))};d.finding&&(d.description=d.finding.CodeMeaning);const p=d.findingSites&&d.findingSites[0];return p&&(d.location=p[0]&&p[0].CodeMeaning||p.CodeMeaning),{defaultState:d,findingGroup:a,findingSiteGroups:o,NUMGroup:s,SCOORDGroup:i,ReferencedSOPSequence:c,ReferencedSOPInstanceUID:u,ReferencedFrameNumber:l}}static generateReport(e,t,n){let a=[];const o=Object.keys(e)[0];if(!o)throw new Error("No measurements provided.");const s=t.get("generalSeriesModule",o),i=s.studyInstanceUID,c=s.seriesInstanceUID;Object.keys(e).forEach(m=>{const h=t.get("sopCommonModule",m),O=t.get("frameNumber",m),y=e[m],S=Object.keys(y),b={ReferencedSOPClassUID:h.sopClassUID,ReferencedSOPInstanceUID:h.sopInstanceUID};An.isMultiframeSOPClassUID(h.sopClassUID)&&(b.ReferencedFrameNumber=O);const T=[];S.forEach(v=>{const j=qn(v,y,b);j&&T.push(j)}),a=a.concat(T)});const u=new Un({TID1501MeasurementGroups:a},n),l=new Uint8Array(2);l[1]=1;const d={StudyInstanceUID:i,SeriesInstanceUID:c},p={FileMetaInformationVersion:{Value:[l.buffer],vr:"OB"},TransferSyntaxUID:{Value:["1.2.840.10008.1.2.1"],vr:"UI"},ImplementationClassUID:{Value:[xn.uid()],vr:"UI"},ImplementationVersionName:{Value:["dcmjs"],vr:"SH"}},g={PixelData:"OW"};d._meta=p,d._vrMap=g;const f=new wn([d]),I=u.contentItem(d);return f.dataset=Object.assign(f.dataset,I),f.dataset._meta=p,f.dataset.SpecificCharacterSet="ISO_IR 192",f}static generateToolState(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e.ContentTemplateSequence.TemplateIdentifier!=="1500")throw new Error("This package can currently only interpret DICOM SR TID 1500");const n="Imaging Measurements",a="Measurement Group",o="Tracking Identifier",s=R(e.ContentSequence).find(Pe(n)),i=R(s.ContentSequence).filter(Pe(a)),c={},u=ue.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE,l=[];return Object.keys(u).forEach(d=>{l.push(u[d]),c[d]=[]}),i.forEach(d=>{const f=R(d.ContentSequence).find(m=>m.ConceptNameCodeSequence.CodeMeaning===o).TextValue,I=t.getToolClass?t.getToolClass(d,e,l):l.find(m=>m.isValidCornerstoneTrackingIdentifier(f));if(I){const m=I.getMeasurementData(d);console.log("=== ".concat(I.toolType," ===")),console.log(m),c[I.toolType].push(m)}}),c}static registerTool(e){ue.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE[e.utilityToolType]=e,ue.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE[e.toolType]=e,ue.MEASUREMENT_BY_TOOLTYPE[e.toolType]=e.utilityToolType}};M.MEASUREMENT_BY_TOOLTYPE={};M.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE={};M.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE={};function Fn(r){if(Array.isArray(r))return r}function Ln(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n,a,o,s,i=[],c=!0,u=!1;try{if(o=(t=t.call(r)).next,e===0){if(Object(t)!==t)return;c=!1}else for(;!(c=(n=o.call(t)).done)&&(i.push(n.value),i.length!==e);c=!0);}catch(l){u=!0,a=l}finally{try{if(!c&&t.return!=null&&(s=t.return(),Object(s)!==s))return}finally{if(u)throw a}}return i}}function ct(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function kn(r,e){if(r){if(typeof r=="string")return ct(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ct(r,e):void 0}}function Bn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w(r,e){return Fn(r)||Ln(r,e)||kn(r,e)||Bn()}function me(r){"@babel/helpers - typeof";return me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},me(r)}function Yn(r,e){if(me(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(me(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Kn(r){var e=Yn(r,"string");return me(e)=="symbol"?e:e+""}function P(r,e,t){return(e=Kn(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}var $="cornerstoneTools@^4.0.0";function ut(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function dt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ut(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ut(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const zn=D.TID300.Length,Qe="Length";let J=class Xt{static getMeasurementData(e){const t=M.getSetupMeasurementData(e),n=t.defaultState,a=t.NUMGroup,o=t.SCOORDGroup,s=dt(dt({},n),{},{length:a.MeasuredValueSequence.NumericValue,toolType:Xt.toolType,handles:{start:{},end:{},textBox:{hasMoved:!1,movesIndependently:!1,drawnIndependently:!0,allowedOutsideImage:!0,hasBoundingBox:!0}}});var i=w(o.GraphicData,4);return s.handles.start.x=i[0],s.handles.start.y=i[1],s.handles.end.x=i[2],s.handles.end.y=i[3],s}static getTID300RepresentationArguments(e){const t=e.handles,n=e.finding,a=e.findingSites,o=t.start,s=t.end,i=e.length;return{point1:o,point2:s,distance:i,trackingIdentifierTextValue:"cornerstoneTools@^4.0.0:Length",finding:n,findingSites:a||[]}}};J.toolType=Qe;J.utilityToolType=Qe;J.TID300Representation=zn;J.isValidCornerstoneTrackingIdentifier=r=>{if(!r.includes(":"))return!1;const e=r.split(":"),t=w(e,2),n=t[0],a=t[1];return n!==$?!1:a===Qe};M.registerTool(J);function lt(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function pt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?lt(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):lt(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const Xn=D.TID300.Polyline;class _{static getMeasurementData(e){const t=M.getSetupMeasurementData(e),n=t.defaultState,a=t.SCOORDGroup,o=t.NUMGroup,s=pt(pt({},n),{},{toolType:_.toolType,handles:{points:[],textBox:{active:!1,hasMoved:!1,movesIndependently:!1,drawnIndependently:!0,allowedOutsideImage:!0,hasBoundingBox:!0}},cachedStats:{area:o?o.MeasuredValueSequence.NumericValue:0},color:void 0,invalidated:!0}),i=a.GraphicData;for(let c=0;c<i.length;c+=2)s.handles.points.push({x:i[c],y:i[c+1]});return s}static getTID300RepresentationArguments(e){const t=e.handles,n=e.finding,a=e.findingSites,o=e.cachedStats,s=o===void 0?{}:o,i=t.points,c=s.area,u=c===void 0?0:c,l=s.perimeter;return{points:i,area:u,perimeter:l===void 0?0:l,trackingIdentifierTextValue:"cornerstoneTools@^4.0.0:FreehandRoi",finding:n,findingSites:a||[]}}}_.toolType="FreehandRoi";_.utilityToolType="FreehandRoi";_.TID300Representation=Xn;_.isValidCornerstoneTrackingIdentifier=r=>{if(!r.includes(":"))return!1;const e=r.split(":"),t=w(e,2),n=t[0],a=t[1];return n!==$?!1:a===_.toolType};M.registerTool(_);const Hn=D.TID300.Bidirectional,Je="Bidirectional",Wn="Long Axis",Qn="Short Axis",Jn="121071",Zn="G-C0E3";let Z=class Ht{static getMeasurementData(e){const t=e.ContentSequence,n=R(t).find(m=>m.ConceptNameCodeSequence.CodeValue===Jn),a=R(t).filter(m=>m.ConceptNameCodeSequence.CodeValue===Zn),o=R(t).find(m=>m.ConceptNameCodeSequence.CodeMeaning===Wn),s=R(o.ContentSequence).find(m=>m.ValueType==="SCOORD"),i=R(t).find(m=>m.ConceptNameCodeSequence.CodeMeaning===Qn),c=R(i.ContentSequence).find(m=>m.ValueType==="SCOORD"),u=s.ContentSequence.ReferencedSOPSequence,l=u.ReferencedSOPInstanceUID,d=u.ReferencedFrameNumber,p=String(o.MeasuredValueSequence.NumericValue),g=String(i.MeasuredValueSequence.NumericValue),f={x:Math.max(s.GraphicData[0],s.GraphicData[2],c.GraphicData[0],c.GraphicData[2]),y:Math.max(s.GraphicData[1],s.GraphicData[3],c.GraphicData[1],c.GraphicData[3])};return{sopInstanceUid:l,frameIndex:d||1,toolType:Ht.toolType,active:!1,handles:{start:{x:s.GraphicData[0],y:s.GraphicData[1],drawnIndependently:!1,allowedOutsideImage:!1,active:!1,highlight:!1,index:0},end:{x:s.GraphicData[2],y:s.GraphicData[3],drawnIndependently:!1,allowedOutsideImage:!1,active:!1,highlight:!1,index:1},perpendicularStart:{x:c.GraphicData[0],y:c.GraphicData[1],drawnIndependently:!1,allowedOutsideImage:!1,active:!1,highlight:!1,index:2},perpendicularEnd:{x:c.GraphicData[2],y:c.GraphicData[3],drawnIndependently:!1,allowedOutsideImage:!1,active:!1,highlight:!1,index:3},textBox:{highlight:!1,hasMoved:!0,active:!1,movesIndependently:!1,drawnIndependently:!0,allowedOutsideImage:!0,hasBoundingBox:!0,x:f.x+10,y:f.y+10}},invalidated:!1,isCreating:!1,longestDiameter:p,shortestDiameter:g,toolName:"Bidirectional",visible:!0,finding:n?n.ConceptCodeSequence:void 0,findingSites:a.map(m=>m.ConceptCodeSequence)}}static getTID300RepresentationArguments(e){const t=e.handles,n=t.start,a=t.end,o=t.perpendicularStart,s=t.perpendicularEnd,i=e.shortestDiameter,c=e.longestDiameter,u=e.finding,l=e.findingSites;return{longAxis:{point1:n,point2:a},shortAxis:{point1:o,point2:s},longAxisLength:c,shortAxisLength:i,trackingIdentifierTextValue:"cornerstoneTools@^4.0.0:Bidirectional",finding:u,findingSites:l||[]}}};Z.toolType=Je;Z.utilityToolType=Je;Z.TID300Representation=Hn;Z.isValidCornerstoneTrackingIdentifier=r=>{if(!r.includes(":"))return!1;const e=r.split(":"),t=w(e,2),n=t[0],a=t[1];return n!==$?!1:a===Je};M.registerTool(Z);function gt(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function ft(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gt(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):gt(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const er=D.TID300.Ellipse,Ze="EllipticalRoi";class B{static getMeasurementData(e){const t=M.getSetupMeasurementData(e),n=t.defaultState,a=t.NUMGroup,s=t.SCOORDGroup.GraphicData,i=[{x:s[0],y:s[1]},{x:s[2],y:s[3]}],c=[{x:s[4],y:s[5]},{x:s[6],y:s[7]}],u=Math.sqrt(Math.pow(c[0].x-c[1].x,2)+Math.pow(c[0].y-c[1].y,2)),l={x:(c[1].x-c[0].x)/u,y:(c[1].y-c[0].y)/u},d=u/2,p={x:i[0].x+l.x*d,y:i[0].y+l.y*d},g={x:i[1].x-l.x*d,y:i[1].y-l.y*d};return ft(ft({},n),{},{toolType:B.toolType,active:!1,cachedStats:{area:a?a.MeasuredValueSequence.NumericValue:0},handles:{end:{x:p.x,y:p.y,highlight:!1,active:!1},initialRotation:0,start:{x:g.x,y:g.y,highlight:!1,active:!1},textBox:{hasMoved:!1,movesIndependently:!1,drawnIndependently:!0,allowedOutsideImage:!0,hasBoundingBox:!0}},invalidated:!0,visible:!0})}static getTID300RepresentationArguments(e){const t=e.cachedStats,n=t===void 0?{}:t,a=e.handles,o=e.finding,s=e.findingSites,i=a.start,c=a.end,u=n.area,l=Math.abs(i.x-c.x)/2,d=Math.abs(i.y-c.y)/2,p=[],g={x:(i.x+c.x)/2,y:(i.y+c.y)/2};return l>d?(p.push({x:g.x-l,y:g.y}),p.push({x:g.x+l,y:g.y}),p.push({x:g.x,y:g.y-d}),p.push({x:g.x,y:g.y+d})):(p.push({x:g.x,y:g.y-d}),p.push({x:g.x,y:g.y+d}),p.push({x:g.x-l,y:g.y}),p.push({x:g.x+l,y:g.y})),{area:u,points:p,trackingIdentifierTextValue:"cornerstoneTools@^4.0.0:EllipticalRoi",finding:o,findingSites:s||[]}}}B.toolType=Ze;B.utilityToolType=Ze;B.TID300Representation=er;B.isValidCornerstoneTrackingIdentifier=r=>{if(!r.includes(":"))return!1;const e=r.split(":"),t=w(e,2),n=t[0],a=t[1];return n!==$?!1:a===Ze};M.registerTool(B);function mt(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function X(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?mt(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):mt(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const tr=D.TID300.Circle,et="CircleRoi";class Y{static getMeasurementData(e){const t=M.getSetupMeasurementData(e),n=t.defaultState,a=t.NUMGroup,s=t.SCOORDGroup.GraphicData,i={x:s[0],y:s[1]},c={x:s[2],y:s[3]};return X(X({},n),{},{toolType:Y.toolType,active:!1,cachedStats:{area:a?a.MeasuredValueSequence.NumericValue:0,radius:0,perimeter:0},handles:{end:X(X({},c),{},{highlight:!1,active:!1}),initialRotation:0,start:X(X({},i),{},{highlight:!1,active:!1}),textBox:{hasMoved:!1,movesIndependently:!1,drawnIndependently:!0,allowedOutsideImage:!0,hasBoundingBox:!0}},invalidated:!0,visible:!0})}static getTID300RepresentationArguments(e){const t=e.cachedStats,n=t===void 0?{}:t,a=e.handles,o=e.finding,s=e.findingSites,i=a.start,c=a.end,u=n.area,l=n.radius,d=2*Math.PI*l,p=[];return p.push(i),p.push(c),{area:u,perimeter:d,radius:l,points:p,trackingIdentifierTextValue:"cornerstoneTools@^4.0.0:CircleRoi",finding:o,findingSites:s||[]}}}Y.toolType=et;Y.utilityToolType=et;Y.TID300Representation=tr;Y.isValidCornerstoneTrackingIdentifier=r=>{if(!r.includes(":"))return!1;const e=r.split(":"),t=w(e,2),n=t[0],a=t[1];return n!==$?!1:a===et};M.registerTool(Y);function It(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function St(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?It(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):It(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const nr=D.TID300.Point,tt="ArrowAnnotate",Ot="CORNERSTONEFREETEXT";let ee=class Wt{static getMeasurementData(e){const t=M.getSetupMeasurementData(e),n=t.defaultState,a=t.SCOORDGroup;t.findingGroup;const o=a.GraphicData;return St(St({},n),{},{toolType:Wt.toolType,active:!1,handles:{start:{x:o[0],y:o[1],highlight:!0,active:!1},end:{x:o.length==4?o[2]:o[0]+20,y:o.length==4?o[3]:o[1]+20,highlight:!0,active:!1},textBox:{hasMoved:!1,movesIndependently:!1,drawnIndependently:!0,allowedOutsideImage:!0,hasBoundingBox:!0}},invalidated:!0,visible:!0})}static getTID300RepresentationArguments(e){const t=[e.handles.start,e.handles.end],n=e.findingSites;let a=e.finding;const o={points:t,trackingIdentifierTextValue:"cornerstoneTools@^4.0.0:ArrowAnnotate",findingSites:n||[]};return(!a||a.CodeValue!==Ot)&&(a={CodeValue:Ot,CodingSchemeDesignator:"CST4",CodeMeaning:e.label}),o.finding=a,o}};ee.toolType=tt;ee.utilityToolType=tt;ee.TID300Representation=nr;ee.isValidCornerstoneTrackingIdentifier=r=>{if(!r.includes(":"))return!1;const e=r.split(":"),t=w(e,2),n=t[0],a=t[1];return n!==$?!1:a===tt};M.registerTool(ee);function ht(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function yt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ht(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ht(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const rr=D.TID300.CobbAngle,nt="CobbAngle";let te=class Qt{static getMeasurementData(e){const t=M.getSetupMeasurementData(e),n=t.defaultState,a=t.NUMGroup,o=t.SCOORDGroup,s=yt(yt({},n),{},{rAngle:a.MeasuredValueSequence.NumericValue,toolType:Qt.toolType,handles:{start:{},end:{},start2:{highlight:!0,drawnIndependently:!0},end2:{highlight:!0,drawnIndependently:!0},textBox:{hasMoved:!1,movesIndependently:!1,drawnIndependently:!0,allowedOutsideImage:!0,hasBoundingBox:!0}}});var i=w(o.GraphicData,8);return s.handles.start.x=i[0],s.handles.start.y=i[1],s.handles.end.x=i[2],s.handles.end.y=i[3],s.handles.start2.x=i[4],s.handles.start2.y=i[5],s.handles.end2.x=i[6],s.handles.end2.y=i[7],s}static getTID300RepresentationArguments(e){const t=e.handles,n=e.finding,a=e.findingSites,o=t.start,s=t.end,i=t.start2,c=t.end2,u=e.rAngle;return{point1:o,point2:s,point3:i,point4:c,rAngle:u,trackingIdentifierTextValue:"cornerstoneTools@^4.0.0:CobbAngle",finding:n,findingSites:a||[]}}};te.toolType=nt;te.utilityToolType=nt;te.TID300Representation=rr;te.isValidCornerstoneTrackingIdentifier=r=>{if(!r.includes(":"))return!1;const e=r.split(":"),t=w(e,2),n=t[0],a=t[1];return n!==$?!1:a===nt};M.registerTool(te);function Dt(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function Tt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Dt(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Dt(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const ar=D.TID300.Angle,rt="Angle";let ne=class Jt{static getMeasurementData(e){const t=M.getSetupMeasurementData(e),n=t.defaultState,a=t.NUMGroup,o=t.SCOORDGroup,s=Tt(Tt({},n),{},{rAngle:a.MeasuredValueSequence.NumericValue,toolType:Jt.toolType,handles:{start:{},middle:{},end:{},textBox:{hasMoved:!1,movesIndependently:!1,drawnIndependently:!0,allowedOutsideImage:!0,hasBoundingBox:!0}}});var i=w(o.GraphicData,8);return s.handles.start.x=i[0],s.handles.start.y=i[1],s.handles.middle.x=i[2],s.handles.middle.y=i[3],s.handles.middle.x=i[4],s.handles.middle.y=i[5],s.handles.end.x=i[6],s.handles.end.y=i[7],s}static getTID300RepresentationArguments(e){const t=e.handles,n=e.finding,a=e.findingSites,o=t.start,s=t.middle,i=t.middle,c=t.end,u=e.rAngle;return{point1:o,point2:s,point3:i,point4:c,rAngle:u,trackingIdentifierTextValue:"cornerstoneTools@^4.0.0:Angle",finding:n,findingSites:a||[]}}};ne.toolType=rt;ne.utilityToolType=rt;ne.TID300Representation=ar;ne.isValidCornerstoneTrackingIdentifier=r=>{if(!r.includes(":"))return!1;const e=r.split(":"),t=w(e,2),n=t[0],a=t[1];return n!==$?!1:a===rt};M.registerTool(ne);function Ct(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function bt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ct(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ct(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const or=D.TID300.Polyline;class V{static getMeasurementData(e){const t=M.getSetupMeasurementData(e),n=t.defaultState,a=t.SCOORDGroup,o=t.NUMGroup,s=bt(bt({},n),{},{toolType:V.toolType,handles:{start:{},end:{},textBox:{active:!1,hasMoved:!1,movesIndependently:!1,drawnIndependently:!0,allowedOutsideImage:!0,hasBoundingBox:!0},initialRotation:0},cachedStats:{area:o?o.MeasuredValueSequence.NumericValue:0},color:void 0,invalidated:!0});var i=w(a.GraphicData,6);return s.handles.start.x=i[0],s.handles.start.y=i[1],i[2],i[3],s.handles.end.x=i[4],s.handles.end.y=i[5],s}static getTID300RepresentationArguments(e){const t=e.finding,n=e.findingSites,a=e.cachedStats,o=a===void 0?{}:a,s=e.handles,i=s.start,c=s.end,u=[i,{x:i.x,y:c.y},c,{x:c.x,y:i.y}],l=o.area,d=o.perimeter;return{points:u,area:l,perimeter:d,trackingIdentifierTextValue:"cornerstoneTools@^4.0.0:RectangleRoi",finding:t,findingSites:n||[]}}}V.toolType="RectangleRoi";V.utilityToolType="RectangleRoi";V.TID300Representation=or;V.isValidCornerstoneTrackingIdentifier=r=>{if(!r.includes(":"))return!1;const e=r.split(":"),t=w(e,2),n=t[0],a=t[1];return n!==$?!1:a===V.toolType};M.registerTool(V);A.DicomMessage;A.DicomMetaDictionary;k.Normalizer;const we=D.orientation;we.rotateDirectionCosinesInPlane;we.flipImageOrientationPatient;we.flipMatrix2D;we.rotateMatrix902D;D.datasetToBlob;D.BitArray;D.DicomMessage;D.DicomMetaDictionary;k.Normalizer;Ie.Segmentation;hn.EXPLICIT_LITTLE_ENDIAN;var qe;(function(r){r.SEGMENTATION_LOAD_PROGRESS="CORNERSTONE_ADAPTER_SEGMENTATION_LOAD_PROGRESS"})(qe||(qe={}));const Ae=D.orientation;Ae.rotateDirectionCosinesInPlane;Ae.flipImageOrientationPatient;Ae.flipMatrix2D;Ae.rotateMatrix902D;A.BitArray;A.DicomMessage;A.DicomMetaDictionary;k.Normalizer;Ie.Segmentation;const Zt=D.compression;Zt.encode;Zt.decode;A.DicomMessage;A.DicomMetaDictionary;k.Normalizer;const sr={Length:J,FreehandRoi:_,Bidirectional:Z,EllipticalRoi:B,CircleRoi:Y,ArrowAnnotate:ee,MeasurementReport:M,CobbAngle:te,Angle:ne,RectangleRoi:V};var ge="Cornerstone3DTools@^0.1.0";const ir=["PatientName","PatientID","PatientBirthDate","PatientBirthTime","IssuerOfPatientID","OtherPatientIDs","OtherPatientIDsSequence","PatientSex","PatientIdentityRemoved","DeidentificationMethodCodeSequence"],cr=["StudyDate","StudyTime","StudyStatusID","StudyPriorityID","StudyInstanceUID","StudyDescription","AccessionNumber","StudyID","ReferringPhysicianName","TimezoneOffsetFromUTC"],ur=[...ir,...cr];function dr(r){const e={_meta:r._meta,_vrMap:r._vrMap};for(const t of ur){const n=r[t];n!==void 0&&(e[t]=n)}return e}const lr=["SeriesInstanceUID","SeriesNumber","SeriesDescription","Modality","SeriesDate","SeriesTime","_meta","_vrMap"];function pr(r){const e={};for(const t of lr){const n=r[t];n!==void 0&&(e[t]=n)}return e}function gr(r){const e=[];if(!(r!=null&&r.length))return e;const t=r.length;if(t%3!==0)throw new Error("Points array should be divisible by 3 for SCOORD3D, but contents are: ".concat(JSON.stringify(r)," of length ").concat(t));for(let n=0;n<t;n+=3)e.push([r[n],r[n+1],r[n+2]]);return e}const fr="CORNERSTONEFREETEXT",mr="CORNERSTONEJS",en={CodingSchemeDesignator:mr,codeValues:{CORNERSTONEFREETEXT:fr}};function Rt(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function Mt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Rt(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Rt(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const Fe="none",at="99CS3D",ve={schemeDesignator:at,meaning:"Text Annotation Position",value:"TextPosition"},F={schemeDesignator:at,meaning:"Control Points",value:"ControlPoints"},fe={schemeDesignator:at,meaning:"Spline Type",value:"SplineType"},Ne={schemeDesignator:"DCM",meaning:"Comment",value:"121106"},Ir=new Uint8Array(2);Ir[1]=1;const tn=new Uint8Array(2);tn[1]=2;const Sr="2.25.2470123695996825859949881583571202391.1.0.1",Or="2.25.2470123695996825859949881583571202391.2.0.1",hr=new Uint8Array(2);hr[1]=1;const ot={FileMetaInformationVersion:{Value:[tn.buffer],vr:"OB"},TransferSyntaxUID:{Value:["1.2.840.10008.1.2"],vr:"UI"},ImplementationClassUID:{Value:[Sr],vr:"UI"},ImplementationVersionName:{Value:["cs3d-4.8.4"],vr:"SH"}},yr=Mt(Mt({},ot),{},{ImplementationClassUID:{Value:[Or],vr:"UI"}}),nn=We.sr,x=nn.valueTypes,Pt=nn.coding,Dr=We.adapters.Cornerstone3D;class Tr{constructor(e,t){this.tid300Item=e,this.annotation=t,this.ReferencedSOPSequence=e.ReferencedSOPSequence}contentItem(){var e;const t=this.tid300Item.contentItem();this.fixScoordRelationships(t);const n=this.annotation.data,a=n.label,o=n.handles;return a&&(t.push(this.createQualitativeLabel(a)),this.filterCornerstoneFreeText(t)),o!=null&&(e=o.textBox)!==null&&e!==void 0&&e.hasMoved&&t.push(this.createQualitativeLabelPosition(this.annotation)),t}fixScoordRelationships(e){const t=x.RelationshipTypes.INFERRED_FROM;for(const n of e){const o=n.ContentSequence,s=this.normalizeContentSequence(o);for(const i of s)(i.ValueType==="SCOORD"||i.ValueType==="SCOORD3D")&&(i.RelationshipType==="CONTAINS"||i.RelationshipType==="Contains")&&(i.RelationshipType=t)}}normalizeContentSequence(e){return e?Array.isArray(e)?e:[e]:[]}filterCornerstoneFreeText(e){const t=Dr.CodeScheme.codeValues,n=[t.FREE_TEXT_CODE_VALUE,t.CORNERSTONEFREETEXT];for(let a=0;a<e.length;a++){const o=e[a];if(!o.ConceptCodeSequence)continue;const s=o.ConceptCodeSequence.findIndex(i=>n.includes(i.CodeValue));if(s!==-1){o.ConceptCodeSequence.splice(s,1),o.ConceptCodeSequence.length===0&&e.splice(a,1);return}}}createQualitativeLabel(e){const t=x.RelationshipTypes.CONTAINS;return new x.TextContentItem({name:new Pt.CodedConcept(Ne),relationshipType:t,value:e})}createQualitativeLabelPosition(e){const t=e.data.handles.textBox,n=e.metadata,a=n.referencedImageId,o=n.FrameOfReferenceUID,s=!a,i=E({is3DMeasurement:s,referencedImageId:a},t.worldPosition),c=i.x,u=i.y,l=i.z,d=x.GraphicTypes.POINT,p=x.RelationshipTypes.CONTAINS,g=new Pt.CodedConcept(ve),f=s?new x.Scoord3DContentItem({name:g,relationshipType:p,graphicType:d,graphicData:[c,u,l],frameOfReferenceUID:o}):new x.ScoordContentItem({name:g,relationshipType:p,graphicType:d,graphicData:[c,u]});return f.ContentSequence=[{RelationshipType:x.RelationshipTypes.SELECTED_FROM,ValueType:x.ValueTypes.IMAGE,ReferencedSOPSequence:this.ReferencedSOPSequence}],f}}var z;function vt(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function W(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vt(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):vt(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const Cr=Kt,rn=D.TID1500,Nt=D.addAccessors,br=Ie.StructuredReport,Rr=k.Normalizer,Mr=rn.TID1500MeasurementReport,Pr=rn.TID1501MeasurementGroup,Se=A.DicomMetaDictionary,vr={CodingSchemeDesignator:"DCM",CodeValue:"121071"},Nr={CodingSchemeDesignator:Ne.schemeDesignator,CodeValue:Ne.value},Er={CodingSchemeDesignator:ve.schemeDesignator,CodeValue:ve.value},Ee={CodingSchemeDesignator:F.schemeDesignator,CodeValue:F.value},wr={CodingSchemeDesignator:"SCT",CodeValue:"363698007"},Ar={CodingSchemeDesignator:"SRT",CodeValue:"G-C0E3"};function Et(r){if(r.ValueType!=="SCOORD"&&r.ValueType!=="SCOORD3D")return!1;const e=r.ConceptNameCodeSequence,t=Array.isArray(e)?e[0]:e;return!!t&&t.CodingSchemeDesignator===Ee.CodingSchemeDesignator&&t.CodeValue===Ee.CodeValue}class N{static getTID300ContentItem(e,t,n,a){const o=n.getTID300RepresentationArguments(e,a);o.ReferencedSOPSequence=t,o.use3DSpatialCoordinates&&(o.ReferencedFrameOfReferenceUID=e.metadata.FrameOfReferenceUID);const s=new n.TID300Representation(o);return new Tr(s,e)}static getMeasurementGroup(e,t,n,a){const o=t[e],s=this.measurementAdapterByToolType.get(e);if(!o||!o.data||!o.data.length||!s)return;const i=o.data.map(c=>this.getTID300ContentItem(c,n,s,a));return new Pr(i)}static getCornerstoneLabelFromDefaultState(e){const t=e.findingSites,n=t===void 0?[]:t,a=e.finding,o=e.commentGroup;if(o!=null&&o.TextValue)return o.TextValue;const s=en.codeValues.CORNERSTONEFREETEXT,i=n.find(c=>c.CodeValue===s);if(i)return i.CodeMeaning;if(a&&a.CodeValue===s)return a.CodeMeaning}static generateDatasetMeta(){return ot}static processSCOORDGroup(e){let t=e.SCOORDGroup,n=e.toolType,a=e.sopInstanceUIDToImageIdMap,o=e.metadata;const s=t.ContentSequence.ReferencedSOPSequence,i=s.ReferencedSOPInstanceUID,c=s.ReferencedFrameNumber,u=c===void 0?1:c,l=a["".concat(i,":").concat(u)],d=o.get("imagePlaneModule",l),p=Se.uid();return{SCOORDGroup:t,ReferencedSOPSequence:s,ReferencedSOPInstanceUID:i,ReferencedFrameNumber:u,referencedImageId:l,state:{description:void 0,sopInstanceUid:i,annotation:{data:{annotationUID:p,cachedStats:{},handles:{activeHandleIndex:0,textBox:{hasMoved:!1}}},annotationUID:p,metadata:{toolName:n,referencedImageId:l,FrameOfReferenceUID:d.frameOfReferenceUID}}}}}static processSCOORD3DGroup(e){let t=e.SCOORD3DGroup,n=e.toolType;const a=Se.uid(),o={SCOORD3DGroup:t,FrameOfReferenceUID:t.ReferencedFrameOfReferenceUID,state:{description:void 0,annotation:{annotationUID:a,data:{annotationUID:a,cachedStats:{},handles:{activeHandleIndex:0,textBox:{hasMoved:!1}}},metadata:{toolName:n,FrameOfReferenceUID:t.ReferencedFrameOfReferenceUID}}}};return Dn(gr(t.GraphicData),o.state.annotation.metadata),o}static getSpatialCoordinatesState(e){var t,n;let a=e.NUMGroup,o=e.sopInstanceUIDToImageIdMap,s=e.metadata,i=e.toolType;const c=R(a.ContentSequence),u=(t=c.find(p=>p.ValueType==="SCOORD"&&!Et(p)))!==null&&t!==void 0?t:c.find(p=>p.ValueType==="SCOORD"),l=(n=c.find(p=>p.ValueType==="SCOORD3D"&&!Et(p)))!==null&&n!==void 0?n:c.find(p=>p.ValueType==="SCOORD3D"),d=l&&this.processSCOORD3DGroup({SCOORD3DGroup:l,toolType:i})||u&&this.processSCOORDGroup({SCOORDGroup:u,toolType:i,metadata:s,sopInstanceUIDToImageIdMap:o});if(!d)throw new Error("No spatial coordinates group found.");return d}static processSpatialCoordinatesGroup(e){let t=e.NUMGroup,n=e.sopInstanceUIDToImageIdMap,a=e.metadata,o=e.findingGroup,s=e.findingSiteGroups,i=e.commentGroup,c=e.commentPositionGroup,u=e.controlPointsGroup,l=e.toolType;const d=this.getSpatialCoordinatesState({NUMGroup:t,sopInstanceUIDToImageIdMap:n,metadata:a,toolType:l}),p=d.state,g=d.SCOORDGroup,f=d.ReferencedSOPSequence,I=d.ReferencedSOPInstanceUID,m=d.ReferencedFrameNumber,h=d.SCOORD3DGroup,O=d.FrameOfReferenceUID,y=d.referencedImageId,S=d.textBoxPosition,b=o?Nt(o.ConceptCodeSequence):void 0,T=s.map(v=>Nt(v.ConceptCodeSequence));if(c){p.commentPositionGroup=c;const v=pe({is3DMeasurement:!y,referencedImageId:y},c);p.annotation.data.handles.textBox={hasMoved:!0,worldPosition:v[0]}}if(u){const v=pe({is3DMeasurement:!y,referencedImageId:y},u);p.annotation.data.handles.points=v}return p.finding=b,p.findingSites=T,p.commentGroup=i,p.commentPositionGroup=c,b&&(p.description=b.CodeMeaning),p.annotation.data.label=this.getCornerstoneLabelFromDefaultState(p),{defaultState:p,state:p,NUMGroup:t,scoord:h||g,SCOORDGroup:g,ReferencedSOPSequence:f,ReferencedSOPInstanceUID:I,referencedImageId:y,textBoxPosition:S,ReferencedFrameNumber:m,SCOORD3DGroup:h,FrameOfReferenceUID:O}}static getSetupMeasurementData(e,t,n,a){const o=e.ContentSequence,s=R(o),i=s.find(S=>this.codeValueMatch(S,vr)),c=s.find(S=>this.codeValueMatch(S,Nr)),u=s.find(S=>this.codeValueMatch(S,Er));let l=s.find(S=>this.codeValueMatch(S,Ee));const d=s.find(S=>S.ValueType==="NUM");!l&&d!==null&&d!==void 0&&d.ContentSequence&&(l=R(d.ContentSequence).find(S=>this.codeValueMatch(S,Ee)));const p=s.filter(S=>this.codeValueMatch(S,wr,Ar))||[],g=d||{ContentSequence:s.filter(S=>S.ValueType==="SCOORD"||S.ValueType==="SCOORD3D")},f=this.processSpatialCoordinatesGroup({NUMGroup:g,sopInstanceUIDToImageIdMap:t,metadata:n,findingGroup:i,findingSiteGroups:p,commentGroup:c,commentPositionGroup:u,controlPointsGroup:l,toolType:a}),I=f.state.annotation.metadata.referencedImageId,m=!!f.SCOORD3DGroup,h={referencedImageId:I,is3DMeasurement:m},O=f.SCOORD3DGroup||f.SCOORDGroup,y=pe(h,O);return W(W({},f),{},{is3DMeasurement:m,scoordArgs:h,scoord:O,worldCoords:y})}static generateReferencedSOPSequence(e){let t=e.toolData,n=e.toolTypes,a=e.metadataProvider,o=e.imageId,s=e.sopInstanceUIDsToSeriesInstanceUIDMap,i=e.derivationSourceDatasets;const c=o===Fe?this.getImageIdFromVolume({toolData:t,toolTypes:n}):o,u=a.get("sopCommonModule",c),l=a.get("instance",c),d=u.sopInstanceUID,p=u.sopClassUID,g=l.SeriesInstanceUID;if(s[d]=g,!i.find(m=>m.SeriesInstanceUID===g)){const m=N.generateDerivationSourceDataset(l);i.push(m)}const f=a.get("frameNumber",c),I={ReferencedSOPClassUID:p,ReferencedSOPInstanceUID:d,ReferencedFrameNumber:void 0};return(l&&l.NumberOfFrames&&l.NumberOfFrames>1||Rr.isMultiframeSOPClassUID(p))&&(I.ReferencedFrameNumber=f),I}static getImageIdFromVolume(e){var t,n;let a=e.toolData,o=e.toolTypes;const s=a==null||(t=a[o?.[0]])===null||t===void 0||(t=t.data)===null||t===void 0?void 0:t[0],i=s==null||(n=s.metadata)===null||n===void 0?void 0:n.volumeId,c=Tn.getVolume(i);if(!c)throw new Error("No volume found for ".concat(i));return c.imageIds[0]}static generateReport(e,t,n){var a;let o=[];const s={},i=[],c=N.generateDatasetMeta();let u=!1;Object.keys(e).forEach(g=>{const f=e[g],I=Object.keys(f),m=g===Fe,h=this.generateReferencedSOPSequence({toolData:f,toolTypes:I,metadataProvider:t,imageId:g,sopInstanceUIDsToSeriesInstanceUIDMap:s,derivationSourceDatasets:i});m&&(u=!0);const O=[];I.forEach(y=>{const S=this.getMeasurementGroup(y,f,h,m);S&&O.push(S)}),o=o.concat(O)});const l=new Mr({TID1501MeasurementGroups:o},n),d=new br(i,n),p=l.contentItem(i,W(W({},n),{},{sopInstanceUIDsToSeriesInstanceUIDMap:s}));if(d.dataset=Object.assign(d.dataset,p),d.dataset._meta=c,d.SpecificCharacterSet="ISO_IR 192",(a=d.dataset).InstanceNumber||(a.InstanceNumber=n.InstanceNumber||1),n.predecessorImageId&&Object.assign(d.dataset,t.get(Cr.PREDECESSOR_SEQUENCE,n.predecessorImageId)),u&&(d.dataset.SOPClassUID=Se.sopClassUIDsByName.Comprehensive3DSR,!d.dataset.SOPClassUID))throw new Error("NO sop class defined for Comprehensive3DSR in ".concat(JSON.stringify(Se.sopClassUIDsByName)));return d}static generateToolState(e,t,n,a){if(e.ContentTemplateSequence.TemplateIdentifier!=="1500")throw new Error("This package can currently only interpret DICOM SR TID 1500");const o="Imaging Measurements",s="Measurement Group",i="Tracking Identifier",c="Tracking Unique Identifier",u=e.imageId,l=R(e.ContentSequence).find(Pe(o)),d=R(l.ContentSequence).filter(Pe(s)),p={};return d.forEach(g=>{try{var f;const m=R(g.ContentSequence),O=m.find(T=>T.ConceptNameCodeSequence.CodeMeaning===i).TextValue,y=m.find(T=>T.ConceptNameCodeSequence.CodeMeaning===c),S=y?.UID,b=(a==null||(f=a.getToolClass)===null||f===void 0?void 0:f.call(a,g,e,this.measurementAdapterByToolType))||this.getAdapterForTrackingIdentifier(O)||this.getAdapterForCodeType(g);if(b){var I;const T=b.getMeasurementData(g,t,n,O);T.TrackingUniqueIdentifier=S,T.predecessorImageId=u,console.log("=== ".concat(b.toolType," ===")),console.log(T),p[I=b.toolType]||(p[I]=[]),p[b.toolType].push(T)}}catch(m){console.warn("Unable to generate tool state for",g,m)}}),p}static registerTool(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=e.toolType;if(this.measurementAdapterByToolType.has(n)){if(!t)throw new Error("The registered tool name ".concat(n," already exists in adapters, use a different toolType or use replace"));typeof t=="function"&&t(this.measurementAdapterByToolType.get(n))}this.measurementAdapterByToolType.set(e.toolType,e),this.measurementAdapterByTrackingIdentifier.set(e.trackingIdentifierTextValue,e)}static registerTrackingIdentifier(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];for(const o of n)this.measurementAdapterByTrackingIdentifier.set(o,e)}static getAdapterForTrackingIdentifier(e){const t=this.measurementAdapterByTrackingIdentifier.get(e);if(t)return t;for(const n of[...this.measurementAdapterByToolType.values()])if(n.isValidCornerstoneTrackingIdentifier(e))return this.measurementAdapterByTrackingIdentifier.set(e,n),n}static getAdapterForCodeType(e){for(const t of this.measurementAdapterByTrackingIdentifier.values())if(t.isValidMeasurement(e))return t}static registerAdapterTypes(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];for(const o of n){this.measurementAdaptersByType.has(o)||this.measurementAdaptersByType.set(o,[]);const s=this.measurementAdaptersByType.get(o);s.indexOf(e)===-1&&s.push(e)}}static getAdaptersForTypes(e,t,n){const a=[];return Oe(a,this.measurementAdaptersByType.get("".concat(e,"-").concat(t,"-").concat(n))),Oe(a,this.measurementAdaptersByType.get("".concat(e,"-").concat(t))),Oe(a,this.measurementAdaptersByType.get(e)),Oe(a,this.measurementAdaptersByType.get(t)),a}}z=N;z.CORNERSTONE_3D_TAG=ge;z.measurementAdapterByToolType=new Map;z.measurementAdaptersByType=new Map;z.measurementAdapterByTrackingIdentifier=new Map;z.codeValueMatch=(r,e,t)=>{const n=r.ConceptNameCodeSequence;if(!n)return;const a=Array.isArray(n)?n[0]:n;if(!a)return;const o=a.CodingSchemeDesignator,s=a.CodeValue;return o==e.CodingSchemeDesignator&&s==e.CodeValue||t&&o==t.CodingSchemeDesignator&&s==t.CodeValue};z.generateDerivationSourceDataset=r=>{const e=dr(r),t=pr(r);return W(W({},e),t)};function Oe(r,e){e!=null&&e.length&&r.push(...e)}class U{static registerType(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=e;t&&(a="".concat(a).concat(a.length?"-":"").concat(t)),n&&(a="".concat(a).concat(a.length?"-":"").concat(n)),N.registerAdapterTypes(this,a)}static getPointsCount(e){const n=e.ValueType==="SCOORD3D"?3:2;return e.GraphicData.length/n}static getGraphicItems(e,t){const n=e.ContentSequence.filter(a=>a.ValueType==="SCOORD"||a.ValueType==="SCOORD3D");return t?n.filter(t):n}static getGraphicItem(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;return this.getGraphicItems(e,n&&(o=>o.ValueType===n))[t]}static getGraphicCode(e){const t=e.ConceptNameCodeSequence,n=t.CodeValue,a=t.CodingSchemeDesignator;return"".concat(a,":").concat(n)}static getGraphicType(e){return e.GraphicType}static isValidMeasurement(e){return!1}static init(e,t,n){if(this.toolType=e,U.toolType)throw new Error("Base adapter tool type set to ".concat(this.toolType," while setting ").concat(e));if(this.parentType=n?.parentType,this.trackingIdentifiers=new Set,this.TID300Representation=t,this.parentType){this.trackingIdentifierTextValue="".concat(ge,":").concat(this.parentType,":").concat(this.toolType);const a="".concat(ge,":").concat(this.toolType);this.trackingIdentifiers.add(a)}else this.trackingIdentifierTextValue="".concat(ge,":").concat(e);this.trackingIdentifiers.add(this.trackingIdentifierTextValue),N.registerTool(this)}static registerLegacy(){this.trackingIdentifiers.add("cornerstoneTools@^4.0.0:".concat(this.toolType))}static registerSubType(e,t,n){const a=Object.create(e);return a.init(t,e.TID300Representation,{parentType:e.parentType||e.toolType,replace:n}),a}static isValidCornerstoneTrackingIdentifier(e){return this.trackingIdentifiers.has(e)?!0:e.includes(":")?e.startsWith(this.trackingIdentifierTextValue):!1}static getMeasurementData(e,t,n,a){const o=N.getSetupMeasurementData(e,t,n,this.toolType),s=o.defaultState,i=o.ReferencedFrameNumber;return s.annotation.data={cachedStats:{},frameNumber:i,seriesLevel:a?.indexOf(":Series")>0},s}static getTID300RepresentationArguments(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=e.metadata,a=e.finding,o=e.findingSites,s=n.referencedImageId;return{points:Q({is3DMeasurement:t,referencedImageId:s},e.data.handles.points),trackingIdentifierTextValue:this.trackingIdentifierTextValue,findingSites:o||[],finding:a,ReferencedFrameOfReferenceUID:t?n.FrameOfReferenceUID:null}}static getCachedStats(e,t){const n=t.referencedImageId,a=t.volumeId;return e["imageId:".concat(n)]||e["volumeId:".concat(a)]||{}}}var Le;function wt(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function he(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wt(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):wt(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const Ur=D.TID300.ArrowAnnotate,jr=Yt;class an extends U{static getMeasurementData(e,t,n,a){const o=N.getSetupMeasurementData(e,t,n,this.toolType),s=o.state,i=o.SCOORDGroup,c=o.worldCoords,u=o.referencedImageId,l=o.ReferencedFrameNumber,d=s.annotation.data.label;if(c.length===1&&i){const p=n.get("imagePixelModule",u);let g=10,f=10;if(p){const h=p.columns,O=p.rows;g=h/10,f=O/10}const I=i.GraphicData,m=jr(u,[I[0]+g,I[1]+f]);c.push(m)}return s.annotation.data=he(he({},s.annotation.data),{},{text:d,handles:he(he({},s.annotation.data.handles),{},{arrowFirst:!0,points:c}),frameNumber:l}),s}static getTID300RepresentationArguments(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=e.data,a=e.metadata,o=e.findingSites,s=e.finding,i=a.referencedImageId,c={is3DMeasurement:t,referencedImageId:i},u=n.handles,l=u.points,d=u.arrowFirst,p=d?l[0]:l[1],g=d?l[1]:l[0],f=E(c,p),I=E(c,g);return{points:[f,I],trackingIdentifierTextValue:this.trackingIdentifierTextValue,findingSites:o||[],finding:s,ReferencedFrameOfReferenceUID:t?a.FrameOfReferenceUID:null,use3DSpatialCoordinates:t}}}Le=an;Le.init("ArrowAnnotate",Ur),Le.registerLegacy();var ke;function At(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function ye(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?At(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):At(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const xr=D.TID300.Bidirectional,Gr="Long Axis",_r="Short Axis";class on extends U{static getMeasurementData(e,t,n){const a=N.getSetupMeasurementData(e,t,n,this.toolType),o=a.state,s=a.scoordArgs,i=a.referencedImageId,c=a.ReferencedFrameNumber,u=e.ContentSequence,l=R(u).find(I=>I.ConceptNameCodeSequence.CodeMeaning===Gr),d=R(u).find(I=>I.ConceptNameCodeSequence.CodeMeaning===_r),p=R(l.ContentSequence).find(I=>I.ValueType==="SCOORD3D"||I.ValueType==="SCOORD"),g=R(d.ContentSequence).find(I=>I.ValueType==="SCOORD3D"||I.ValueType==="SCOORD"),f=[];return f.push(...pe(s,p)),f.push(...pe(s,g)),o.annotation.data=ye(ye({},o.annotation.data),{},{handles:ye(ye({},o.annotation.data.handles),{},{points:[f[0],f[1],f[2],f[3]]}),frameNumber:c}),i&&(o.annotation.data.cachedStats={["imageId:".concat(i)]:{length:l.MeasuredValueSequence.NumericValue,width:d.MeasuredValueSequence.NumericValue,unit:l.MeasuredValueSequence.MeasurementUnitsCodeSequence.CodeValue,widthUnit:d.MeasuredValueSequence.MeasurementUnitsCodeSequence.CodeValue}}),o}static getTID300RepresentationArguments(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=e.data,a=e.finding,o=e.findingSites,s=e.metadata,i=n.cachedStats,c=i===void 0?{}:i,u=n.handles,l=s.referencedImageId,d={is3DMeasurement:t,referencedImageId:l},p=u.points,g=[p[0],p[1]],f=[p[2],p[3]],I=Math.sqrt(Math.pow(g[0][0]-g[1][0],2)+Math.pow(g[0][1]-g[1][1],2)+Math.pow(g[0][2]-g[1][2],2)),m=Math.sqrt(Math.pow(f[0][0]-f[1][0],2)+Math.pow(f[0][1]-f[1][1],2)+Math.pow(f[0][2]-f[1][2],2));let h,O;I>m?(h=g,O=f):(h=f,O=g);const y=E(d,h[0]),S=E(d,h[1]),b=E(d,O[0]),T=E(d,O[1]),v=super.getCachedStats(c,s),j=v.length,re=v.width,ae=v.unit;return{longAxis:{point1:y,point2:S},shortAxis:{point1:b,point2:T},longAxisLength:j,shortAxisLength:re,unit:ae,trackingIdentifierTextValue:this.trackingIdentifierTextValue,finding:a,findingSites:o||[],ReferencedFrameOfReferenceUID:t?s.FrameOfReferenceUID:null,use3DSpatialCoordinates:t}}}ke=on;ke.init("Bidirectional",xr),ke.registerLegacy();var Be;function Ut(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function De(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ut(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ut(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const Vr=D.TID300.CobbAngle;class sn extends U{static getMeasurementData(e,t,n){const a=N.getSetupMeasurementData(e,t,n,this.toolType),o=a.state,s=a.NUMGroup,i=a.worldCoords,c=a.referencedImageId,u=a.ReferencedFrameNumber,l=c?{["imageId:".concat(c)]:{angle:s?s.MeasuredValueSequence.NumericValue:null}}:{};return o.annotation.data=De(De({},o.annotation.data),{},{handles:De(De({},o.annotation.data.handles),{},{points:[i[0],i[1],i[3]]}),cachedStats:l,frameNumber:u}),o}static getTID300RepresentationArguments(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=e.data,a=e.finding,o=e.findingSites,s=e.metadata,i=n.cachedStats,c=i===void 0?{}:i,u=n.handles,l=s.referencedImageId,d={is3DMeasurement:t,referencedImageId:l},p=E(d,u.points[0]),g=E(d,u.points[1]),f=E(d,u.points[1]),I=E(d,u.points[2]),m=super.getCachedStats(c,s),h=m.angle;return{point1:p,point2:g,point3:f,point4:I,rAngle:h,trackingIdentifierTextValue:this.trackingIdentifierTextValue,finding:a,findingSites:o||[],ReferencedFrameOfReferenceUID:t?s.FrameOfReferenceUID:null,use3DSpatialCoordinates:t}}}Be=sn;Be.init("Angle",Vr),Be.registerLegacy();var Ye;function jt(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function Te(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?jt(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):jt(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const $r=D.TID300.CobbAngle;class Ue extends U{static getMeasurementData(e,t,n){const a=N.getSetupMeasurementData(e,t,n,Ue.toolType),o=a.state,s=a.NUMGroup,i=a.referencedImageId,c=a.worldCoords,u=a.ReferencedFrameNumber;return o.annotation.data=Te(Te({},o.annotation.data),{},{handles:Te(Te({},o.annotation.data.handles),{},{points:[c[0],c[1],c[2],c[3]]}),frameNumber:u}),i&&(o.annotation.data.cachedStats={["imageId:".concat(i)]:{angle:s?s.MeasuredValueSequence.NumericValue:null}}),o}static getTID300RepresentationArguments(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=e.data,a=e.finding,o=e.findingSites,s=e.metadata,i=n.cachedStats,c=i===void 0?{}:i,u=n.handles,l=s.referencedImageId,p=Q({is3DMeasurement:t,referencedImageId:l},u.points),g=w(p,4),f=g[0],I=g[1],m=g[2],h=g[3],O=c["imageId:".concat(l)]||{},y=O.angle;return{point1:f,point2:I,point3:m,point4:h,rAngle:y,trackingIdentifierTextValue:this.trackingIdentifierTextValue,finding:a,findingSites:o||[],ReferencedFrameOfReferenceUID:t?s.FrameOfReferenceUID:null,use3DSpatialCoordinates:t}}}Ye=Ue;Ye.init("CobbAngle",$r),Ye.registerLegacy();const qr="[hnsf'U]",Fr="HU",Lr="mm2",kr="mm²",Br={[qr]:Fr,[Lr]:kr};function cn(r){return r&&(Br[r]||r)}const Ke=new Set(["Mean","Standard Deviation","Maximum","Minimum"]);function je(r,e){const t={};return r.ContentSequence&&r.ContentSequence.forEach(n=>{if(n.ValueType==="NUM"&&n.ConceptNameCodeSequence){var a,o;const s=n.ConceptNameCodeSequence.CodeMeaning,i=(a=n.MeasuredValueSequence)===null||a===void 0?void 0:a.NumericValue,c=(o=n.MeasuredValueSequence)===null||o===void 0||(o=o.MeasurementUnitsCodeSequence)===null||o===void 0?void 0:o.CodeValue;if(i!==void 0&&e){t[e]||(t[e]={});let u="";c&&(u=Yr(s,c)),t[e][s]={value:i,unit:u}}}}),t}function xe(r){const e={};let t="";const n={Mean:"mean","Standard Deviation":"stdDev",Maximum:"max",Minimum:"min",Area:"area",Radius:"radius",Perimeter:"perimeter",Length:"length",Width:"width"},a={mean:"modalityUnit",stdDev:"modalityUnit",max:"modalityUnit",min:"modalityUnit",area:"areaUnit",radius:"radiusUnit",perimeter:"unit",length:"unit",width:"widthUnit"};for(const s of Object.entries(n)){var o=w(s,2);const i=o[0],c=o[1],u=r[i];if(!u)continue;const l=u.value,d=u.unit;if(l==null||(e[c]=l,!d))continue;const p=cn(d);if(!p)continue;Ke.has(i)&&!t&&(t=p);const g=a[c];g?e[g]||(e[g]=p):e["".concat(c,"Unit")]=p}return e.modalityUnit=t,e}function Yr(r,e){if(!e)return"";const t=e.CodeValue,n=e.CodeMeaning;return t==="1"?!Ke.has(r)&&r==="Area"?"".concat(n,"²"):Ke.has(r)?"":n:t}var ze;function xt(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function oe(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xt(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):xt(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const Kr=D.TID300.Circle;class un extends U{static getMeasurementData(e,t,n){const a=N.getSetupMeasurementData(e,t,n,this.toolType),o=a.state,s=a.NUMGroup,i=a.worldCoords,c=a.referencedImageId,u=a.ReferencedFrameNumber,l=o.sopInstanceUid,p=je(e,l)[l]||{};return o.annotation.data=oe(oe({},o.annotation.data),{},{handles:oe(oe({},o.annotation.data.handles),{},{points:i}),frameNumber:u}),c&&(o.annotation.data.cachedStats={["imageId:".concat(c)]:oe({area:s?s.MeasuredValueSequence.NumericValue:0,radius:0,perimeter:0},xe(p))}),o}static getTID300RepresentationArguments(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=e.data,a=e.finding,o=e.findingSites,s=e.metadata,i=n.cachedStats,c=i===void 0?{}:i,u=n.handles,l=s.referencedImageId,d={is3DMeasurement:t,referencedImageId:l},p=E(d,u.points[0]),g=E(d,u.points[1]),f=super.getCachedStats(c,s),I=f.area,m=f.radius,h=f.max,O=f.min,y=f.stdDev,S=f.mean,b=f.modalityUnit,T=f.radiusUnit,v=f.areaUnit,j=2*Math.PI*m;return{area:I,areaUnit:v,perimeter:j,modalityUnit:b,radiusUnit:T,radius:m,max:h,min:O,stdDev:y,mean:S,points:[p,g],trackingIdentifierTextValue:this.trackingIdentifierTextValue,finding:a,findingSites:o||[],ReferencedFrameOfReferenceUID:t?s.FrameOfReferenceUID:null,use3DSpatialCoordinates:t}}}ze=un;ze.init("CircleROI",Kr),ze.registerLegacy();var dn;function Gt(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function se(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Gt(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Gt(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const zr=D.TID300.Ellipse;class Ge extends U{static getMeasurementData(e,t,n){const a=N.getSetupMeasurementData(e,t,n,Ge.toolType),o=a.state,s=a.NUMGroup,i=a.worldCoords,c=a.referencedImageId,u=a.ReferencedFrameNumber,l=o.sopInstanceUid,p=je(e,l)[l]||{};return o.annotation.data=se(se({},o.annotation.data),{},{handles:se(se({},o.annotation.data.handles),{},{points:i}),frameNumber:u}),o.annotation.data.cachedStats=c?{["imageId:".concat(c)]:se({area:s?s.MeasuredValueSequence.NumericValue:0},xe(p))}:{},o}static getTID300RepresentationArguments(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=e.data,a=e.finding,o=e.findingSites,s=e.metadata,i=n.cachedStats,c=i===void 0?{}:i,u=n.handles,l=n.initialRotation||0,d=s.referencedImageId,p={is3DMeasurement:t,referencedImageId:d};let g,f,I,m;l==90||l==270?(f=u.points[2],g=u.points[3],I=u.points[0],m=u.points[1]):(g=u.points[0],f=u.points[1],I=u.points[2],m=u.points[3]);const h=Math.sqrt((g[0]-f[0])**2+(g[1]-f[1])**2+(g[2]-f[2])**2),O=Math.sqrt((I[0]-m[0])**2+(I[1]-m[1])**2+(I[2]-m[2])**2),y=[];h>O?y.push(g,f,I,m):y.push(I,m,g,f);const S=super.getCachedStats(c,s),b=S.area,T=S.max,v=S.min,j=S.mean,re=S.stdDev,ae=S.modalityUnit,Ve=S.areaUnit,Sn=y.map(On=>E(p,On));return{area:b,areaUnit:Ve,max:T,min:v,mean:j,stdDev:re,modalityUnit:ae,points:Sn,trackingIdentifierTextValue:this.trackingIdentifierTextValue,finding:a,findingSites:o||[],ReferencedFrameOfReferenceUID:t?s.FrameOfReferenceUID:null,use3DSpatialCoordinates:t}}}dn=Ge;dn.init("EllipticalROI",zr);var de;function _t(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function ie(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_t(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):_t(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const Xr=D.TID300.Polyline;class ln extends U{static isValidMeasurement(e){const t=this.getGraphicItem(e),n=this.getPointsCount(t);return this.getGraphicType(t)==="POLYLINE"&&(n===4||n===5)}static getMeasurementData(e,t,n){var a,o;const s=N.getSetupMeasurementData(e,t,n,this.toolType),i=s.state,c=s.worldCoords,u=s.referencedImageId,l=s.ReferencedFrameNumber,d=c.length===5?c.slice(0,4):c,p=e.ContentSequence.find(T=>T.ValueType==="NUM"&&T.ConceptNameCodeSequence.CodeMeaning==="Area"),g=i.sopInstanceUid,I=je(e,g)[g]||{},m=xe(I),h=p==null||(a=p.MeasuredValueSequence)===null||a===void 0||(a=a[0])===null||a===void 0?void 0:a.MeasurementUnitsCodeSequence,O=h?.CodeValue,y=O?cn(O):m.areaUnit,S=u?{["imageId:".concat(u)]:ie({area:(p==null||(o=p.MeasuredValueSequence)===null||o===void 0||(o=o[0])===null||o===void 0?void 0:o.NumericValue)||0,areaUnit:y},m)}:{},b=[d[0],d[1],d[3],d[2]];return i.annotation.data=ie(ie({},i.annotation.data),{},{handles:ie(ie({},i.annotation.data.handles),{},{points:b}),cachedStats:S,frameNumber:l}),i}static getTID300RepresentationArguments(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=e.data,a=e.finding,o=e.findingSites,s=e.metadata,i=s.referencedImageId,u=Q({is3DMeasurement:t,referencedImageId:i},n.handles.points),l=super.getCachedStats(n.cachedStats,s),d=l.area,p=l.perimeter,g=l.max,f=l.mean,I=l.stdDev,m=l.areaUnit,h=l.modalityUnit;return{points:[u[0],u[1],u[3],u[2],u[0]],area:d,perimeter:p,max:g,mean:f,stdDev:I,areaUnit:m,modalityUnit:h,trackingIdentifierTextValue:this.trackingIdentifierTextValue,finding:a,findingSites:o||[],use3DSpatialCoordinates:t}}}de=ln;de.init("RectangleROI",Xr),de.registerLegacy(),de.registerType("DCM:111030","POLYLINE",4),de.registerType("DCM:111030","POLYLINE",5);var Xe;function Vt(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function Ce(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Vt(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Vt(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const Hr=D.TID300.Length,Wr="Length";class pn extends U{static getMeasurementData(e,t,n){const a=N.getSetupMeasurementData(e,t,n,this.toolType),o=a.state,s=a.NUMGroup,i=a.worldCoords,c=a.referencedImageId,u=a.ReferencedFrameNumber,l=c?{["imageId:".concat(c)]:{length:s?s.MeasuredValueSequence.NumericValue:0,unit:s.MeasuredValueSequence.MeasurementUnitsCodeSequence.CodeValue}}:{};return o.annotation.data=Ce(Ce({},o.annotation.data),{},{handles:Ce(Ce({},o.annotation.data.handles),{},{points:[i[0],i[1]],activeHandleIndex:0}),cachedStats:l,frameNumber:u}),o}static getTID300RepresentationArguments(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=e.data,a=e.finding,o=e.findingSites,s=e.metadata,i=n.cachedStats,c=i===void 0?{}:i,u=n.handles,l=s.referencedImageId,d={is3DMeasurement:t,referencedImageId:l},p=E(d,u.points[0]),g=E(d,u.points[1]),f=super.getCachedStats(c,s),I=f.length;return{point1:p,point2:g,distance:I,trackingIdentifierTextValue:this.trackingIdentifierTextValue,finding:a,findingSites:o||[],use3DSpatialCoordinates:t}}}Xe=pn;Xe.init(Wr,Hr),Xe.registerLegacy();const G=yn.valueTypes,Qr=D.TID300.Polyline;class Jr extends Qr{contentItem(){const e=super.contentItem(),t=this,n=t.props,a=n.controlPoints,o=n.use3DSpatialCoordinates,s=n.ReferencedSOPSequence,i=n.ReferencedFrameOfReferenceUID,c=n.use3DSpatialCoordinates;if(!(a!=null&&a.length))return e;const u=t.flattenPoints({points:a,use3DSpatialCoordinates:o}),l=G.GraphicTypes.MULTIPOINT,d=c?{RelationshipType:G.RelationshipTypes.CONTAINS,ValueType:"SCOORD3D",ConceptNameCodeSequence:[{CodeValue:F.value,CodingSchemeDesignator:F.schemeDesignator,CodeMeaning:F.meaning}],GraphicType:l,GraphicData:u,ReferencedFrameOfReferenceUID:i,ContentSequence:[{RelationshipType:G.RelationshipTypes.SELECTED_FROM,ValueType:G.ValueTypes.IMAGE,ReferencedSOPSequence:s}]}:{RelationshipType:G.RelationshipTypes.CONTAINS,ValueType:"SCOORD",ConceptNameCodeSequence:[{CodeValue:F.value,CodingSchemeDesignator:F.schemeDesignator,CodeMeaning:F.meaning}],GraphicType:l,GraphicData:u,ContentSequence:[{RelationshipType:G.RelationshipTypes.SELECTED_FROM,ValueType:G.ValueTypes.IMAGE,ReferencedSOPSequence:s}]},p=t.props.splineType,g=e,f=g.find(I=>I.ValueType==="NUM");if(f){const I=f.ContentSequence,m=Array.isArray(I)?I:I?[I]:[];f.ContentSequence=[...m,d]}else g.push(d);if(p){const I={RelationshipType:G.RelationshipTypes.HAS_OBS_CONTEXT,ValueType:"TEXT",ConceptNameCodeSequence:{CodeValue:fe.value,CodingSchemeDesignator:fe.schemeDesignator,CodeMeaning:fe.meaning},TextValue:p},m=g.findIndex(O=>O.RelationshipType===G.RelationshipTypes.HAS_OBS_CONTEXT),h=m>=0?m+2:2;g.splice(h,0,I)}return g}}var K;function $t(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function H(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$t(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):$t(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}class gn extends U{static getMeasurementData(e,t,n){var a,o,s;const i=N.getSetupMeasurementData(e,t,n,this.toolType),c=i.state,u=i.NUMGroup,l=i.worldCoords,d=i.referencedImageId,p=i.ReferencedFrameNumber,g=Mn(l[l.length-1],l[0]);let f=!0;g<this.closedContourThreshold&&(l.pop(),f=!1);let I=(a=(o=c.annotation.data.handles)===null||o===void 0?void 0:o.points)!==null&&a!==void 0?a:[];f&&I.length===0&&(I=[l[0],l[l.length-1]]);const m=c.sopInstanceUid,O=je(e,m)[m]||{},y={CodingSchemeDesignator:fe.schemeDesignator,CodeValue:fe.value},S=u?R(u.ContentSequence):[],b=R(e.ContentSequence),T=(s=S.find(v=>N.codeValueMatch(v,y)))!==null&&s!==void 0?s:b.find(v=>N.codeValueMatch(v,y));return c.annotation.data=H(H({},c.annotation.data),{},{contour:{polyline:l,closed:!f},handles:H(H({},c.annotation.data.handles),{},{points:I}),frameNumber:p},T&&{spline:{type:T.TextValue}}),d&&(c.annotation.data.cachedStats={["imageId:".concat(d)]:H(H({},!f&&u?{area:u.MeasuredValueSequence.NumericValue}:{}),xe(O))}),c}static getTID300RepresentationArguments(e){var t,n;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const o=e.data,s=e.finding,i=e.findingSites,c=e.metadata,u=o.handles,l=o.contour,d=l.polyline,g=l.closed!==!0,f=c.referencedImageId,I={is3DMeasurement:a,referencedImageId:f},m=Q(I,d);if(!g){const Ve=m[0];m.push(Ve)}const h=(u==null||(t=u.points)===null||t===void 0?void 0:t.length)&&Q(I,u.points),O=super.getCachedStats(o.cachedStats,c),y=O.area,S=O.areaUnit,b=O.modalityUnit,T=O.perimeter,v=O.mean,j=O.max,re=O.stdDev,ae=O.length;return{points:m,controlPoints:h,area:y,areaUnit:S,perimeter:T??ae,modalityUnit:b,mean:v,max:j,stdDev:re,splineType:(n=o.spline)===null||n===void 0?void 0:n.type,trackingIdentifierTextValue:this.trackingIdentifierTextValue,finding:s,findingSites:i||[],ReferencedFrameOfReferenceUID:a?c.FrameOfReferenceUID:null,use3DSpatialCoordinates:a}}}K=gn;K.closedContourThreshold=1e-5;K.init("PlanarFreehandROI",Jr),K.registerSubType(K,"LivewireContour"),K.registerSubType(K,"SplineROI");var le;function qt(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function be(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qt(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):qt(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const Zr=D.TID300.Point;class _e extends U{static isValidMeasurement(e){const t=this.getGraphicItem(e);return this.getGraphicType(t)==="POINT"&&this.getPointsCount(t)<=2}static getMeasurementData(e,t,n,a){var o,s;const i=N.getSetupMeasurementData(e,t,n,this.toolType),c=i.state,u=i.NUMGroup,l=i.worldCoords,d=i.referencedImageId,p=i.ReferencedFrameNumber,g=d?{["imageId:".concat(d)]:{value:(o=u==null||(s=u.MeasuredValueSequence)===null||s===void 0?void 0:s.NumericValue)!==null&&o!==void 0?o:null}}:{};return c.annotation.data=be(be({},c.annotation.data),{},{handles:be(be({},c.annotation.data.handles),{},{points:l}),cachedStats:g,frameNumber:p,invalidated:!0}),c}static getTID300RepresentationArguments(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=e.data,a=e.metadata,o=e.finding,s=e.findingSites,i=a.referencedImageId,c={is3DMeasurement:t,referencedImageId:i},u=n.handles.points;return{points:Q(c,u===void 0?[]:u),trackingIdentifierTextValue:this.trackingIdentifierTextValue,findingSites:s||[],finding:o,ReferencedFrameOfReferenceUID:t?a.FrameOfReferenceUID:null,use3DSpatialCoordinates:t}}}le=_e;le.init("Probe",Zr),le.registerLegacy(),le.registerType("DCM:111030","POINT",1),le.registerType("DCM:111030","POINT",2);var fn;function Ft(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function Re(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ft(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ft(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const ea=D.TID300.Length,Lt=Bt;class mn extends U{static getMeasurementData(e,t,n){const a=N.getSetupMeasurementData(e,t,n,this.toolType),o=a.state,s=a.worldCoords,i=a.ReferencedFrameNumber;return o.annotation.data=Re(Re({},o.annotation.data),{},{handles:Re(Re({},o.annotation.data.handles),{},{points:s}),frameNumber:i}),o}static getTID300RepresentationArguments(e,t){const n=e.data,a=e.finding,o=e.findingSites,s=e.metadata,i=n.handles,c=s.referencedImageId;if(!c)throw new Error("UltrasoundDirectionalTool.getTID300RepresentationArguments: referencedImageId is not defined");const u=Lt(c,i.points[0]),l=Lt(c,i.points[1]),d={x:u[0],y:u[1]},p={x:l[0],y:l[1]};return{point1:d,point2:p,trackingIdentifierTextValue:this.trackingIdentifierTextValue,finding:a,findingSites:o||[]}}}fn=mn;fn.init("UltrasoundDirectionalTool",ea);k.SEGImageNormalizer;Ie.Segmentation;A.DicomMessage;A.DicomMetaDictionary;k.Normalizer;Pn(r=>{Cn(bn,qe.SEGMENTATION_LOAD_PROGRESS,{percentComplete:r})},200);function kt(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function ce(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?kt(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):kt(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const Me=We.data.DicomMetaDictionary,C=Kt,ta=[C.GENERAL_STUDY,C.PATIENT_STUDY,C.PATIENT],na=[C.GENERAL_SERIES],ra=[C.GENERAL_IMAGE,C.IMAGE_PLANE,C.CINE,C.VOI_LUT,C.MODALITY_LUT,C.SOP_COMMON],He={get:function(r,e,t){var n;return(n=He[r])===null||n===void 0?void 0:n.call(He,e,t)},[C.IMAGE_SOP_INSTANCE_REFERENCE]:function(r){const e=q(C.FRAME_MODULE,r),t=e.sopClassUID,n=e.sopInstanceUID,a=e.frameNumber;return e.numberOfFrames>1?{ReferencedSOPClassUID:t,ReferencedSOPInstanceUID:n,ReferencedFrameNumber:a}:{ReferencedSOPClassUID:e.sopClassUID,ReferencedSOPInstanceUID:e.sopInstanceUID}},[C.REFERENCED_SERIES_REFERENCE]:r=>{const e=q(C.SOP_COMMON,r);return{SeriesInstanceUID:q(C.GENERAL_SERIES,r).seriesInstanceUID,ReferencedInstanceSequence:[{ReferencedSOPClassUID:e.sopClassUID,ReferencedSOPInstanceUID:e.sopInstanceUID}]}},[C.PREDECESSOR_SEQUENCE]:r=>{const e=ce({},q(C.SERIES_DATA,r)),t=q(C.GENERAL_IMAGE,r),n=q(C.GENERAL_STUDY,r);return e.InstanceNumber=1+Number(t.instanceNumber),e.PredecessorDocumentsSequence={StudyInstanceUID:n.studyInstanceUID,ReferencedSeriesSequence:{SeriesInstanceUID:e.SeriesInstanceUID,ReferencedSOPSequence:{ReferencedSOPClassUID:t.sopClassUID,ReferencedSOPInstanceUID:t.sopInstanceUID}}},e},[C.STUDY_DATA]:r=>$e(r,ta),[C.SERIES_DATA]:r=>$e(r,na),[C.IMAGE_DATA]:r=>$e(r,ra),[C.RTSS_INSTANCE_DATA]:r=>{const e=q(C.NEW_INSTANCE_DATA,r);return ce(ce({},e),{},{SeriesNumber:"3201",StructureSetROISequence:[],ROIContourSequence:[],RTROIObservationsSequence:[],ReferencedFrameOfReferenceSequence:[],Modality:"RTSTRUCT",SOPClassUID:"1.2.840.10008.5.1.4.1.1.481.3",PositionReferenceIndicator:"",StructureSetLabel:"",StructureSetName:"",StructureSetDate:Me.date(),StructureSetTime:Me.time()})},[C.NEW_INSTANCE_DATA]:r=>{const e=q(C.STUDY_DATA,r);return ce(ce({},e),{},{SeriesNumber:"50000",InstanceNumber:"1",OperatorsName:"",ReferringPhysicianName:"",SpecificCharacterSet:"ISO_IR 192",Manufacturer:"cs3d",SOPInstanceUID:Me.uid(),SeriesInstanceUID:Me.uid()})},[C.RTSS_CONTOUR]:()=>yr,[C.SR_ANNOTATION]:()=>ot};Rn(He.get,9023);var L;const aa=D.TID300.Point;class In extends _e{static getMeasurementData(e,t,n,a){const o=super.getMeasurementData(e,t,n,a),s=o.annotation.data;return s.isPoint=a.indexOf("Point")!==-1,o}static getTID300RepresentationArguments(e){const t=super.getTID300RepresentationArguments(e),n=e.data;return n.isPoint&&(n.seriesLevel?t.trackingIdentifierTextValue=this.trackingSeriesPointIdentifier:t.trackingIdentifierTextValue=this.trackingPointIdentifier),n.seriesLevel&&(t.trackingIdentifierTextValue=this.trackingSeriesIdentifier),t.points.length||t.points.push({x:0,y:0}),t}}L=In;L.init("KeyImage",aa,{parentType:_e.toolType});L.trackingSeriesIdentifier="".concat(L.trackingIdentifierTextValue,":Series");L.trackingPointIdentifier="".concat(L.trackingIdentifierTextValue,":Point");L.trackingSeriesPointIdentifier="".concat(L.trackingIdentifierTextValue,":SeriesPoint");const oa={BaseAdapter3D:U,Bidirectional:on,CobbAngle:Ue,Angle:sn,Length:pn,CircleROI:un,EllipticalROI:Ge,RectangleROI:ln,ArrowAnnotate:an,Probe:_e,PlanarFreehandROI:gn,UltrasoundDirectional:mn,KeyImage:In,MeasurementReport:N,CodeScheme:en,CORNERSTONE_3D_TAG:ge,COMMENT_CODE:Ne,NO_IMAGE_ID:Fe,TEXT_ANNOTATION_POSITION:ve};A.Colors;A.BitArray;const fa={Cornerstone:sr,Cornerstone3D:oa};export{Fe as NO_IMAGE_ID,fa as adaptersSR};
@@ -0,0 +1 @@
1
+ import{P as L,g as $,N as E,O as j,e as y,h as S,I as G}from"./field-B9Q3MQXT.js";var N={};class v{constructor(t,e,s,i,h,r,n,o,a,u=0,f){this.p=t,this.stack=e,this.state=s,this.reducePos=i,this.pos=h,this.score=r,this.buffer=n,this.bufferBase=o,this.curContext=a,this.lookAhead=u,this.parent=f}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,s=0){let i=t.parser.context;return new v(t,[],e,s,s,0,[],0,i?new R(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let s=t>>19,i=t&65535,{parser:h}=this.p,r=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),n=h.dynamicPrecedence(i);if(n&&(this.score+=n),s==0){i<h.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(h.getGoto(this.state,i,!0),this.reducePos),i<h.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,r?8:4,!0),this.reduceContext(i,this.reducePos);return}let o=this.stack.length-(s-1)*3-(t&262144?6:0),a=o?this.stack[o-2]:this.p.ranges[0].from;i<h.minRepeatTerm&&a==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let u=this.reducePos-a;u>=2e3&&!(!((e=this.p.parser.nodeSet.types[i])===null||e===void 0)&&e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=u));let f=o?this.stack[o-1]:0,d=this.bufferBase+this.buffer.length-f;if(i<h.minRepeatTerm||t&131072){let c=h.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,a,c,d+4,!0)}if(t&262144)this.state=this.stack[o];else{let c=this.stack[o-3];this.state=h.getGoto(c,i,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(i,a)}storeNode(t,e,s,i=4,h=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let r=this.buffer.length;if(r>0&&this.buffer[r-4]==0&&this.buffer[r-1]>-1){if(e==s)return;if(this.buffer[r-2]>=e){this.buffer[r-2]=s;return}}}if(!h||this.pos==s)this.buffer.push(t,e,s,i);else{let r=this.buffer.length;if(r>0&&(this.buffer[r-4]!=0||this.buffer[r-1]<0)){let n=!1;for(let o=r;o>0&&this.buffer[o-2]>s;o-=4)if(this.buffer[o-1]>=0){n=!0;break}if(n)for(;r>0&&this.buffer[r-2]>s;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4)}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=s,this.buffer[r+3]=i}}shift(t,e,s,i){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let h=t,{parser:r}=this.p;this.pos=i;let n=r.stateFlag(h,1);!n&&(i>s||e<=r.maxNode)&&(this.reducePos=i),this.pushState(h,n?s:Math.min(s,this.reducePos)),this.shiftContext(e,s),e<=r.maxNode&&this.buffer.push(e,s,i,4)}else this.pos=i,this.shiftContext(e,s),e<=this.p.parser.maxNode&&this.buffer.push(e,s,i,4)}apply(t,e,s,i){t&65536?this.reduce(t):this.shift(t,e,s,i)}useNode(t,e){let s=this.p.reused.length-1;(s<0||this.p.reused[s]!=t)&&(this.p.reused.push(t),s++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(e,i),this.buffer.push(s,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(e&&t.buffer[e-4]==0&&(e-=4);e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let s=t.buffer.slice(e),i=t.bufferBase+e;for(;t&&i==t.bufferBase;)t=t.parent;return new v(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let s=t<=this.p.parser.maxNode;s&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,s?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new U(this);;){let s=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(s==0)return!1;if((s&65536)==0)return!0;e.reduce(s)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let h=0,r;h<e.length;h+=2)(r=e[h+1])!=this.state&&this.p.parser.hasAction(r,t)&&i.push(e[h],r);if(this.stack.length<120)for(let h=0;i.length<8&&h<e.length;h+=2){let r=e[h+1];i.some((n,o)=>o&1&&n==r)||i.push(e[h],r)}e=i}let s=[];for(let i=0;i<e.length&&s.length<4;i+=2){let h=e[i+1];if(h==this.state)continue;let r=this.split();r.pushState(h,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(e[i],this.pos),r.reducePos=this.pos,r.score-=200,s.push(r)}return s}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if((e&65536)==0)return!1;if(!t.validAction(this.state,e)){let s=e>>19,i=e&65535,h=this.stack.length-s*3;if(h<0||t.getGoto(this.stack[h],i,!1)<0){let r=this.findForcedReduction();if(r==null)return!1;e=r}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],s=(i,h)=>{if(!e.includes(i))return e.push(i),t.allActions(i,r=>{if(!(r&393216))if(r&65536){let n=(r>>19)-h;if(n>1){let o=r&65535,a=this.stack.length-n*3;if(a>=0&&t.getGoto(this.stack[a],o,!1)>=0)return n<<19|65536|o}}else{let n=s(r,h+1);if(n!=null)return n}})};return s(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new R(this.curContext.tracker,t);e.hash!=this.curContext.hash&&this.emitContext(),this.curContext=e}}setLookAhead(t){return t<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=t,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class R{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class U{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,s=t>>19;s==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(s-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class A{constructor(t,e,s){this.stack=t,this.pos=e,this.index=s,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new A(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new A(this.stack,this.pos,this.index)}}function x(l,t=Uint16Array){if(typeof l!="string")return l;let e=null;for(let s=0,i=0;s<l.length;){let h=0;for(;;){let r=l.charCodeAt(s++),n=!1;if(r==126){h=65535;break}r>=92&&r--,r>=34&&r--;let o=r-32;if(o>=46&&(o-=46,n=!0),h+=o,n)break;h*=46}e?e[i++]=h:e=new t(h)}return e}class P{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const z=new P;class H{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=z,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let s=this.range,i=this.rangeIndex,h=this.pos+t;for(;h<s.from;){if(!i)return null;let r=this.ranges[--i];h-=s.from-r.to,s=r}for(;e<0?h>s.to:h>=s.to;){if(i==this.ranges.length-1)return null;let r=this.ranges[++i];h+=r.from-s.to,s=r}return h}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,s,i;if(e>=0&&e<this.chunk.length)s=this.pos+t,i=this.chunk.charCodeAt(e);else{let h=this.resolveOffset(t,1);if(h==null)return-1;if(s=h,s>=this.chunk2Pos&&s<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(s-this.chunk2Pos);else{let r=this.rangeIndex,n=this.range;for(;n.to<=s;)n=this.ranges[++r];this.chunk2=this.input.chunk(this.chunk2Pos=s),s+this.chunk2.length>n.to&&(this.chunk2=this.chunk2.slice(0,n.to-s)),i=this.chunk2.charCodeAt(0)}}return s>=this.token.lookAhead&&(this.token.lookAhead=s+1),i}acceptToken(t,e=0){let s=e?this.resolveOffset(e,-1):this.pos;if(s==null||s<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=t,this.token.end=s}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),e=this.pos+t.length;this.chunk=e>this.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=z,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;t>=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t<this.chunkPos+this.chunk.length?this.chunkOff=t-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let s="";for(let i of this.ranges){if(i.from>=e)break;i.to>t&&(s+=this.input.read(Math.max(i.from,t),Math.min(i.to,e)))}return s}}class m{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:s}=e.p;F(this.data,t,e,this.id,s.data,s.tokenPrecTable)}}m.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class W{constructor(t,e,s){this.precTable=e,this.elseToken=s,this.data=typeof t=="string"?x(t):t}token(t,e){let s=t.pos,i=0;for(;;){let h=t.next<0,r=t.resolveOffset(1,1);if(F(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(h||i++,r==null)break;t.reset(r,t.token)}i&&(t.reset(s,t.token),t.acceptToken(this.elseToken,i))}}W.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class Z{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function F(l,t,e,s,i,h){let r=0,n=1<<s,{dialect:o}=e.p.parser;t:for(;(n&l[r])!=0;){let a=l[r+1];for(let c=r+3;c<a;c+=2)if((l[c+1]&n)>0){let p=l[c];if(o.allows(p)&&(t.token.value==-1||t.token.value==p||q(p,t.token.value,i,h))){t.acceptToken(p);break}}let u=t.next,f=0,d=l[r+2];if(t.next<0&&d>f&&l[a+d*3-3]==65535){r=l[a+d*3-1];continue t}for(;f<d;){let c=f+d>>1,p=a+c+(c<<1),b=l[p],M=l[p+1]||65536;if(u<b)d=c;else if(u>=M)f=c+1;else{r=l[p+2],t.advance();continue t}}break}}function I(l,t,e){for(let s=t,i;(i=l[s])!=65535;s++)if(i==e)return s-t;return-1}function q(l,t,e,s){let i=I(e,s,t);return i<0||I(e,s,l)<i}const g=typeof process<"u"&&N&&/\bparse\b/.test(N.LOG);let T=null;function D(l,t,e){let s=l.cursor(G.IncludeAnonymous);for(s.moveTo(t);;)if(!(e<0?s.childBefore(t):s.childAfter(t)))for(;;){if((e<0?s.to<t:s.from>t)&&!s.type.isError)return e<0?Math.max(0,Math.min(s.to-1,t-25)):Math.min(l.length,Math.max(s.from+1,t+25));if(e<0?s.prevSibling():s.nextSibling())break;if(!s.parent())return e<0?0:l.length}}class J{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?D(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?D(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;for(;this.fragment&&this.safeTo<=t;)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let s=this.trees[e],i=this.index[e];if(i==s.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let h=s.children[i],r=this.start[e]+s.positions[i];if(r>t)return this.nextStart=r,null;if(h instanceof S){if(r==t){if(r<this.safeFrom)return null;let n=r+h.length;if(n<=this.safeTo){let o=h.prop(y.lookAhead);if(!o||n+o<this.fragment.to)return h}}this.index[e]++,r+h.length>=Math.max(this.safeFrom,t)&&(this.trees.push(h),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+h.length}}}class K{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(s=>new P)}getActions(t){let e=0,s=null,{parser:i}=t.p,{tokenizers:h}=i,r=i.stateSlot(t.state,3),n=t.curContext?t.curContext.hash:0,o=0;for(let a=0;a<h.length;a++){if((1<<a&r)==0)continue;let u=h[a],f=this.tokens[a];if(!(s&&!u.fallback)&&((u.contextual||f.start!=t.pos||f.mask!=r||f.context!=n)&&(this.updateCachedToken(f,u,t),f.mask=r,f.context=n),f.lookAhead>f.end+25&&(o=Math.max(f.lookAhead,o)),f.value!=0)){let d=e;if(f.extended>-1&&(e=this.addActions(t,f.extended,f.end,e)),e=this.addActions(t,f.value,f.end,e),!u.extend&&(s=f,e>d))break}}for(;this.actions.length>e;)this.actions.pop();return o&&t.setLookAhead(o),!s&&t.pos==this.stream.end&&(s=new P,s.value=t.p.parser.eofTerm,s.start=s.end=t.pos,e=this.addActions(t,s.value,s.end,e)),this.mainToken=s,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new P,{pos:s,p:i}=t;return e.start=s,e.end=Math.min(s+1,i.stream.end),e.value=s==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,s){let i=this.stream.clipPos(s.pos);if(e.token(this.stream.reset(i,t),s),t.value>-1){let{parser:h}=s.p;for(let r=0;r<h.specialized.length;r++)if(h.specialized[r]==t.value){let n=h.specializers[r](this.stream.read(t.start,t.end),s);if(n>=0&&s.p.parser.dialect.allows(n>>1)){(n&1)==0?t.value=n>>1:t.extended=n>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,s,i){for(let h=0;h<i;h+=3)if(this.actions[h]==t)return i;return this.actions[i++]=t,this.actions[i++]=e,this.actions[i++]=s,i}addActions(t,e,s,i){let{state:h}=t,{parser:r}=t.p,{data:n}=r;for(let o=0;o<2;o++)for(let a=r.stateSlot(h,o?2:1);;a+=3){if(n[a]==65535)if(n[a+1]==1)a=k(n,a+2);else{i==0&&n[a+1]==2&&(i=this.putAction(k(n,a+2),e,s,i));break}n[a]==e&&(i=this.putAction(k(n,a+1),e,s,i))}return i}}class Q{constructor(t,e,s,i){this.parser=t,this.input=e,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new H(e,i),this.tokens=new K(t,this.stream),this.topTerm=t.top[1];let{from:h}=i[0];this.stacks=[v.start(this,t.top[0],h)],this.fragments=s.length&&this.stream.end-h>t.bufferLength*4?new J(s,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,s=this.stacks=[],i,h;if(this.bigReductionCount>300&&t.length==1){let[r]=t;for(;r.forceReduce()&&r.stack.length&&r.stack[r.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;r<t.length;r++){let n=t[r];for(;;){if(this.tokens.mainToken=null,n.pos>e)s.push(n);else{if(this.advanceStack(n,s,t))continue;{i||(i=[],h=[]),i.push(n);let o=this.tokens.getMainToken(n);h.push(o.value,o.end)}}break}}if(!s.length){let r=i&&X(i);if(r)return g&&console.log("Finish with "+this.stackID(r)),this.stackToTree(r);if(this.parser.strict)throw g&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&i){let r=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,h,s);if(r)return g&&console.log("Force-finish "+this.stackID(r)),this.stackToTree(r.forceAll())}if(this.recovering){let r=this.recovering==1?1:this.recovering*3;if(s.length>r)for(s.sort((n,o)=>o.score-n.score);s.length>r;)s.pop();s.some(n=>n.reducePos>e)&&this.recovering--}else if(s.length>1){t:for(let r=0;r<s.length-1;r++){let n=s[r];for(let o=r+1;o<s.length;o++){let a=s[o];if(n.sameState(a)||n.buffer.length>500&&a.buffer.length>500)if((n.score-a.score||n.buffer.length-a.buffer.length)>0)s.splice(o--,1);else{s.splice(r--,1);continue t}}}s.length>12&&(s.sort((r,n)=>n.score-r.score),s.splice(12,s.length-12))}this.minStackPos=s[0].pos;for(let r=1;r<s.length;r++)s[r].pos<this.minStackPos&&(this.minStackPos=s[r].pos);return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,s){let i=t.pos,{parser:h}=this,r=g?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let a=t.curContext&&t.curContext.tracker.strict,u=a?t.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let d=this.parser.nodeSet.types[f.type.id]==f.type?h.getGoto(t.state,f.type.id):-1;if(d>-1&&f.length&&(!a||(f.prop(y.contextHash)||0)==u))return t.useNode(f,d),g&&console.log(r+this.stackID(t)+` (via reuse of ${h.getName(f.type.id)})`),!0;if(!(f instanceof S)||f.children.length==0||f.positions[0]>0)break;let c=f.children[0];if(c instanceof S&&f.positions[0]==0)f=c;else break}}let n=h.stateSlot(t.state,4);if(n>0)return t.reduce(n),g&&console.log(r+this.stackID(t)+` (via always-reduce ${h.getName(n&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let o=this.tokens.getActions(t);for(let a=0;a<o.length;){let u=o[a++],f=o[a++],d=o[a++],c=a==o.length||!s,p=c?t:t.split(),b=this.tokens.mainToken;if(p.apply(u,f,b?b.start:p.pos,d),g&&console.log(r+this.stackID(p)+` (via ${(u&65536)==0?"shift":`reduce of ${h.getName(u&65535)}`} for ${h.getName(f)} @ ${i}${p==t?"":", split"})`),c)return!0;p.pos>i?e.push(p):s.push(p)}return!1}advanceFully(t,e){let s=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>s)return B(t,e),!0}}runRecovery(t,e,s){let i=null,h=!1;for(let r=0;r<t.length;r++){let n=t[r],o=e[r<<1],a=e[(r<<1)+1],u=g?this.stackID(n)+" -> ":"";if(n.deadEnd&&(h||(h=!0,n.restart(),g&&console.log(u+this.stackID(n)+" (restarted)"),this.advanceFully(n,s))))continue;let f=n.split(),d=u;for(let c=0;c<10&&f.forceReduce()&&(g&&console.log(d+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,s));c++)g&&(d=this.stackID(f)+" -> ");for(let c of n.recoverByInsert(o))g&&console.log(u+this.stackID(c)+" (via recover-insert)"),this.advanceFully(c,s);this.stream.end>n.pos?(a==n.pos&&(a++,o=0),n.recoverByDelete(o,a),g&&console.log(u+this.stackID(n)+` (via recover-delete ${this.parser.getName(o)})`),B(n,s)):(!i||i.score<f.score)&&(i=f)}return i}stackToTree(t){return t.close(),S.build({buffer:A.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(T||(T=new WeakMap)).get(t);return e||T.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}}function B(l,t){for(let e=0;e<t.length;e++){let s=t[e];if(s.pos==l.pos&&s.sameState(l)){t[e].score<l.score&&(t[e]=l);return}}t.push(l)}class V{constructor(t,e,s){this.source=t,this.flags=e,this.disabled=s}allows(t){return!this.disabled||this.disabled[t]==0}}const C=l=>l;class _{constructor(t){this.start=t.start,this.shift=t.shift||C,this.reduce=t.reduce||C,this.reuse=t.reuse||C,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class w extends L{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;n<t.repeatNodeCount;n++)e.push("");let s=Object.keys(t.topRules).map(n=>t.topRules[n][1]),i=[];for(let n=0;n<e.length;n++)i.push([]);function h(n,o,a){i[n].push([o,o.deserialize(String(a))])}if(t.nodeProps)for(let n of t.nodeProps){let o=n[0];typeof o=="string"&&(o=y[o]);for(let a=1;a<n.length;){let u=n[a++];if(u>=0)h(u,o,n[a++]);else{let f=n[a+-u];for(let d=-u;d>0;d--)h(n[a++],o,f);a++}}}this.nodeSet=new $(e.map((n,o)=>E.define({name:o>=this.minRepeatTerm?void 0:n,id:o,props:i[o],top:s.indexOf(o)>-1,error:o==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(o)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=j;let r=x(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let n=0;n<this.specializerSpecs.length;n++)this.specialized[n]=this.specializerSpecs[n].term;this.specializers=this.specializerSpecs.map(O),this.states=x(t.states,Uint32Array),this.data=x(t.stateData),this.goto=x(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(n=>typeof n=="number"?new m(r,n):n),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,s){let i=new Q(this,t,e,s);for(let h of this.wrappers)i=h(i,t,e,s);return i}getGoto(t,e,s=!1){let i=this.goto;if(e>=i[0])return-1;for(let h=i[e+1];;){let r=i[h++],n=r&1,o=i[h++];if(n&&s)return o;for(let a=h+(r>>1);h<a;h++)if(i[h]==t)return o;if(n)return-1}}hasAction(t,e){let s=this.data;for(let i=0;i<2;i++)for(let h=this.stateSlot(t,i?2:1),r;;h+=3){if((r=s[h])==65535)if(s[h+1]==1)r=s[h=k(s,h+2)];else{if(s[h+1]==2)return k(s,h+2);break}if(r==e||r==0)return k(s,h+1)}return 0}stateSlot(t,e){return this.states[t*6+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,s=>s==e?!0:null)}allActions(t,e){let s=this.stateSlot(t,4),i=s?e(s):void 0;for(let h=this.stateSlot(t,1);i==null;h+=3){if(this.data[h]==65535)if(this.data[h+1]==1)h=k(this.data,h+2);else break;i=e(k(this.data,h+1))}return i}nextStates(t){let e=[];for(let s=this.stateSlot(t,1);;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=k(this.data,s+2);else break;if((this.data[s+2]&1)==0){let i=this.data[s+1];e.some((h,r)=>r&1&&h==i)||e.push(this.data[s],i)}}return e}configure(t){let e=Object.assign(Object.create(w.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let s=this.topRules[t.top];if(!s)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=s}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(s=>{let i=t.tokenizers.find(h=>h.from==s);return i?i.to:s})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((s,i)=>{let h=t.specializers.find(n=>n.from==s.external);if(!h)return s;let r=Object.assign(Object.assign({},s),{external:h.to});return e.specializers[i]=O(r),r})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),s=e.map(()=>!1);if(t)for(let h of t.split(" ")){let r=e.indexOf(h);r>=0&&(s[r]=!0)}let i=null;for(let h=0;h<e.length;h++)if(!s[h])for(let r=this.dialects[e[h]],n;(n=this.data[r++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new V(t,s,i)}static deserialize(t){return new w(t)}}function k(l,t){return l[t]|l[t+1]<<16}function X(l){let t=null;for(let e of l){let s=e.p.stoppedAt;(e.pos==e.p.stream.end||s!=null&&e.pos>s)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.score<e.score)&&(t=e)}return t}function O(l){if(l.external){let t=l.extend?1:0;return(e,s)=>l.external(e,s)<<1|t}return l.get}export{_ as C,Z as E,w as L,W as a};
@@ -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-DRJQ5vM9.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-DH6oYLiJ.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-D1w-H9mm.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-C-7UZOyK.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-BKv6xg3B.js";import"./dcmjs.es-DfWkgqfk.js";import"./index-Q1X-tLaK.js";import"./refusal-DOpm8I8L.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 xG=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-DtQS3pSQ.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-D7LlegT9.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-DTS8gN4X.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-fI0XijLj.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-BmTKFXHo.js";import"./dcmjs.es-DfWkgqfk.js";import"./index-DeWW6Jmk.js";import"./refusal-DOpm8I8L.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 xG=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=`