@ohif/extension-dicom-pdf 3.13.10 → 3.13.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@ohif/core"),require("@ohif/i18n")):"function"==typeof define&&define.amd?define(["@ohif/core","@ohif/i18n"],t):"object"==typeof exports?exports["ohif-extension-dicom-pdf"]=t(require("@ohif/core"),require("@ohif/i18n")):e["ohif-extension-dicom-pdf"]=t(e["@ohif/core"],e["@ohif/i18n"])}(globalThis,(e,t)=>(()=>{var r,n,o={596(e,t,r){"use strict";r.r(t),r.d(t,{default:()=>T});var n,o=r(326),a=r(598),i=r.n(a);function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=u(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==u(t)?t:t+""}function c(){if(console&&console.warn){for(var e,t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];"string"==typeof r[0]&&(r[0]="react-i18next:: ".concat(r[0])),(e=console).warn.apply(e,r)}}r(741),Object.create(null);var l={};function f(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];"string"==typeof t[0]&&l[t[0]]||("string"==typeof t[0]&&(l[t[0]]=new Date),c.apply(void 0,t))}var p=function(e,t){return function(){e.isInitialized?t():e.on("initialized",function r(){setTimeout(function(){e.off("initialized",r)},0),t()})}};function d(e,t,r){e.loadNamespaces(t,p(e,r))}function y(e,t,r,n){"string"==typeof r&&(r=[r]),r.forEach(function(t){0>e.options.ns.indexOf(t)&&e.options.ns.push(t)}),e.loadLanguages(t,p(e,n))}var m=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,b={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"\xa9","©":"\xa9","®":"\xae","®":"\xae","…":"…","…":"…","/":"/","/":"/"},g=function(e){return b[e]},h={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:function(e){return e.replace(m,g)}},v=(0,o.createContext)(),S=function(){var e;function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");this.usedNamespaces={}}return e=[{key:"addUsedNamespaces",value:function(e){var t=this;e.forEach(function(e){t.usedNamespaces[e]||(t.usedNamespaces[e]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?O(Object(r),!0).forEach(function(t){var n,o;n=t,o=r[t],(n=s(n))in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var k=function(e,t){var r=(0,o.useRef)();return(0,o.useEffect)(function(){r.current=t?r.current:e},[e,t]),r.current},j=r(2);let _={"unsupported-type":"This document type cannot be displayed","signature-mismatch":"Document content does not match its declared type","retrieve-failed":"Unable to retrieve this document",aborted:"Loading document..."};function E({displaySets:e,viewportId:t="pdf-viewport"}){let[r,a]=(0,o.useState)(null),[i,s]=(0,o.useState)(null),c=(0,o.useRef)(null),l=(0,j.useViewportRef)(t),{t:p}=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.i18n,i=(0,o.useContext)(v)||{},s=i.i18n,c=i.defaultNS,l=a||s||n;if(l&&!l.reportNamespaces&&(l.reportNamespaces=new S),!l){f("You will need to pass in an i18next instance by using initReactI18next");var p=function(e,t){return"string"==typeof t?t:t&&"object"===u(t)&&"string"==typeof t.defaultValue?t.defaultValue:Array.isArray(e)?e[e.length-1]:e},m=[p,{},!1];return m.t=p,m.i18n={},m.ready=!1,m}l.options.react&&void 0!==l.options.react.wait&&f("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var b=w(w(w({},h),l.options.react),r),g=b.useSuspense,O=b.keyPrefix,j=e||c||l.options&&l.options.defaultNS;j="string"==typeof j?[j]:j||["translation"],l.reportNamespaces.addUsedNamespaces&&l.reportNamespaces.addUsedNamespaces(j);var _=(l.isInitialized||l.initializedStoreOnce)&&j.every(function(e){return function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.languages&&t.languages.length?void 0===t.options.ignoreJSONStructure?function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=t.languages[0],o=!!t.options&&t.options.fallbackLng,a=t.languages[t.languages.length-1];if("cimode"===n.toLowerCase())return!0;var i=function(e,r){var n=t.services.backendConnector.state["".concat(e,"|").concat(r)];return -1===n||2===n};return(!(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1)||!t.services.backendConnector.backend||!t.isLanguageChangingTo||!!i(t.isLanguageChangingTo,e))&&!!(t.hasResourceBundle(n,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||i(n,e)&&(!o||i(a,e)))}(e,t,r):t.hasLoadedNamespace(e,{lng:r.lng,precheck:function(t,n){if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!n(t.isLanguageChangingTo,e))return!1}}):(f("i18n.languages were undefined or empty",t.languages),!0)}(e,l,b)});function E(){return l.getFixedT(r.lng||null,"fallback"===b.nsMode?j:j[0],O)}var T=function(e){if(Array.isArray(e))return e}(t=(0,o.useState)(E))||function(e){var t=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,n,o,a,i=[],u=!0,s=!1;try{o=(t=t.call(e)).next,!1;for(;!(u=(r=o.call(t)).done)&&(i.push(r.value),2!==i.length);u=!0);}catch(e){s=!0,n=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw n}}return i}}(t)||function(e){if(e){if("string"==typeof e)return x(e,2);var t=({}).toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?x(e,2):void 0}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),P=T[0],C=T[1],L=j.join();r.lng&&(L="".concat(r.lng).concat(L));var N=k(L),I=(0,o.useRef)(!0);(0,o.useEffect)(function(){var e=b.bindI18n,t=b.bindI18nStore;function n(){I.current&&C(E)}return I.current=!0,_||g||(r.lng?y(l,r.lng,j,function(){I.current&&C(E)}):d(l,j,function(){I.current&&C(E)})),_&&N&&N!==L&&I.current&&C(E),e&&l&&l.on(e,n),t&&l&&l.store.on(t,n),function(){I.current=!1,e&&l&&e.split(" ").forEach(function(e){return l.off(e,n)}),t&&l&&t.split(" ").forEach(function(e){return l.store.off(e,n)})}},[l,L]);var A=(0,o.useRef)(!0);(0,o.useEffect)(function(){I.current&&!A.current&&C(E),A.current=!1},[l,O]);var U=[P,l,_];if(U.t=P,U.i18n=l,U.ready=_,_||!_&&!g)return U;throw new Promise(function(e){r.lng?y(l,r.lng,j,function(){return e()}):d(l,j,function(){return e()})})}("EncapsulatedDocument");(0,o.useEffect)(()=>(document.body.addEventListener("drag",g),function(){document.body.removeEventListener("drag",g),l.unregister()}),[]);let[m,b]=(0,o.useState)("pdf-yes-click"),g=()=>{b("pdf-no-click")};if(e&&e.length>1)throw Error("OHIFCornerstonePdfViewport: only one display set is supported for dicom pdf right now");let{getDocument:O,label:T}=e[0];return(0,o.useEffect)(()=>{let e,t=!1,r=new AbortController,n=async()=>{let n=await O({signal:r.signal});if(t){n.ok&&n.revoke();return}if(!n.ok){a(null),s(n.reason);return}e=n.revoke,a({url:n.url,documentType:n.documentType}),s(null)};return a(null),s(null),n(),()=>{t=!0,r.abort(),e?.()}},[O]),o.createElement("div",{className:"bg-primary-black text-foreground h-full w-full",onClick:()=>{b("pdf-yes-click")},ref:e=>{c.current=e,e&&l.register(e)},"data-viewport-id":t},r?function({url:e,documentType:t},r,n,a){return"object"===t.strategy?o.createElement("object",{data:e,type:t.mimeType,className:r},o.createElement("div",null,n("No viewer installed for {{mimeType}}",{mimeType:t.mimeType}))):o.createElement("iframe",{src:e,title:a||n("Encapsulated document"),className:`${r} border-0`,sandbox:t.sandbox??"",referrerPolicy:"no-referrer",allow:""})}(r,m,p,T):o.createElement("div",{className:"flex h-full w-full items-center justify-center"},p(i?_[i]:"Loading document...")))}E.propTypes={displaySets:i().arrayOf(i().object).isRequired,viewportId:i().string};let T=E},856(e,t,r){"use strict";var n=r(183);function o(){}function a(){}a.resetWarningCache=o,e.exports=function(){function e(e,t,r,o,a,i){if(i!==n){var u=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function t(){return e}e.isRequired=e;var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:o};return r.PropTypes=r,r}},598(e,t,r){e.exports=r(856)()},183(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},249(e,t){"use strict";var r=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=(Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider")),a=Symbol.for("react.context"),i=(Symbol.for("react.forward_ref"),Symbol.for("react.suspense")),u=(Symbol.for("react.memo"),Symbol.for("react.lazy")),s=Symbol.iterator,c={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},l=Object.assign,f={};function p(e,t,r){this.props=e,this.context=t,this.refs=f,this.updater=r||c}function d(){}function y(e,t,r){this.props=e,this.context=t,this.refs=f,this.updater=r||c}p.prototype.isReactComponent={},p.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},p.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},d.prototype=p.prototype;var m=y.prototype=new d;m.constructor=y,l(m,p.prototype),m.isPureReactComponent=!0;var b=Array.isArray,g=Object.prototype.hasOwnProperty,h=null,v={key:!0,ref:!0,__self:!0,__source:!0};function S(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){(0===e._status||-1===e._status)&&(e._status=1,e._result=t)},function(t){(0===e._status||-1===e._status)&&(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var x=null;t.Suspense=i,t.createContext=function(e){return(e={$$typeof:a,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:o,_context:e},e.Consumer=e},t.createElement=function(e,t,n){var o,a={},i=null,u=null;if(null!=t)for(o in void 0!==t.ref&&(u=t.ref),void 0!==t.key&&(i=""+t.key),t)g.call(t,o)&&!v.hasOwnProperty(o)&&(a[o]=t[o]);var s=arguments.length-2;if(1===s)a.children=n;else if(1<s){for(var c=Array(s),l=0;l<s;l++)c[l]=arguments[l+2];a.children=c}if(e&&e.defaultProps)for(o in s=e.defaultProps)void 0===a[o]&&(a[o]=s[o]);return{$$typeof:r,type:e,key:i,ref:u,props:a,_owner:h}},t.lazy=function(e){return{$$typeof:u,_payload:{_status:-1,_result:e},_init:S}},t.useContext=function(e){return x.useContext(e)},t.useEffect=function(e,t){return x.useEffect(e,t)},t.useRef=function(e){return x.useRef(e)},t.useState=function(e){return x.useState(e)}},326(e,t,r){"use strict";e.exports=r(249)},741(e){e.exports={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}},2(t){"use strict";t.exports=e},545(e){"use strict";e.exports=t}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return o[e](r,r.exports,i),r.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r=[],i.O=(e,t,n,o)=>{if(t){o=o||0;for(var a=r.length;a>0&&r[a-1][2]>o;a--)r[a]=r[a-1];r[a]=[t,n,o];return}for(var u=1/0,a=0;a<r.length;a++){for(var[t,n,o]=r[a],s=!0,c=0;c<t.length;c++)(!1&o||u>=o)&&Object.keys(i.O).every(e=>i.O[e](t[c]))?t.splice(c--,1):(s=!1,o<u&&(u=o));if(s){r.splice(a--,1);var l=n();void 0!==l&&(e=l)}}return e},i.F={},i.E=e=>{Object.keys(i.F).map(t=>{i.F[t](e)})},n={509:0},i.F.j=e=>{if(!i.o(n,e)||void 0===n[e]){n[e]=null;var t=document.createElement("link");i.nc&&t.setAttribute("nonce",i.nc),t.rel="prefetch",t.as="script",t.href=i.p+i.u(e),document.head.appendChild(t)}},i.O.j=e=>0===n[e],i.O(0,[509],()=>{[509].map(i.E)},5);var u={};return(()=>{"use strict";i.r(u),i.d(u,{default:()=>g});var e=i(326);let t=JSON.parse('{"UU":"@ohif/extension-dicom-pdf"}').UU,r=`${t}.sopClassHandlerModule.dicom-pdf`;var n=i(2),o=i(545),a=i.n(o);let s={"application/pdf":{mimeType:"application/pdf",strategy:"object",signature:[37,80,68,70,45],signatureSearchLimit:1024},"text/html":{mimeType:"text/html",strategy:"iframe",sandbox:""},"application/xhtml+xml":{mimeType:"application/xhtml+xml",strategy:"iframe",sandbox:""},"text/xml":{mimeType:"text/xml",strategy:"iframe",sandbox:""},"application/xml":{mimeType:"application/xml",strategy:"iframe",sandbox:""},"text/plain":{mimeType:"text/plain",strategy:"iframe",sandbox:""}},c={"application/html":"text/html","application/x-pdf":"application/pdf","application/acrobat":"application/pdf","text/pdf":"application/pdf","application/xhtml":"application/xhtml+xml"};function l(e){if("string"==typeof e)return e.split(";")[0].trim().toLowerCase()||void 0}async function f({instance:e,mimeType:t,tag:r="EncapsulatedDocument"},{signal:n}={}){var o;let a,i,u=function(e){let t=l(e);if(t)return s[c[t]??t]}(t);if(!u)return{ok:!1,reason:"unsupported-type",mimeType:t};let d=e?.[r];if(!d)return{ok:!1,reason:"retrieve-failed"};if(n?.aborted)return{ok:!1,reason:"aborted"};try{i=await p(d,u.mimeType)}catch(e){return console.warn("Failed to retrieve encapsulated document",e),{ok:!1,reason:"retrieve-failed"}}if(!i?.byteLength)return{ok:!1,reason:"retrieve-failed"};if(n?.aborted)return{ok:!1,reason:"aborted"};if(!function(e,t){let{signature:r,signatureSearchLimit:n=0}=e;if(!r?.length)return!0;if(t.byteLength<r.length)return!1;let o=Math.min(n,t.byteLength-r.length),a=new Uint8Array(t,0,o+r.length);for(let e=0;e<=o;e++)if(r.every((t,r)=>a[e+r]===t))return!0;return!1}(u,i))return{ok:!1,reason:"signature-mismatch",mimeType:u.mimeType};let y=URL.createObjectURL(new Blob([i],{type:u.mimeType}));return n?.aborted?(URL.revokeObjectURL(y),{ok:!1,reason:"aborted"}):{ok:!0,url:y,documentType:u,revoke:(o=y,a=!1,()=>{a||(URL.revokeObjectURL(o),a=!0)})}}async function p(e,t){return e.InlineBinary?function(e){let t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r.buffer}(e.InlineBinary):Array.isArray(e)?d(e[0]):e.Value?d(Array.isArray(e.Value)?e.Value[0]:e.Value):"function"==typeof e.retrieveBulkData?d(await e.retrieveBulkData({mediaType:t})):void 0}function d(e){return ArrayBuffer.isView(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(e)?e:void 0}let y=Object.values({ENCAPSULATED_PDF:"1.2.840.10008.5.1.4.1.1.104.1"}),m=e.lazy(()=>Promise.resolve().then(i.bind(i,596))),b=t=>e.createElement(e.Suspense,{fallback:e.createElement("div",null,"Loading...")},e.createElement(m,t)),g={id:t,getViewportModule:()=>[{name:"dicom-pdf",component:t=>e.createElement(b,t)}],getSopClassHandlerModule:function(e){let{servicesManager:t,extensionManager:o}=e;return[{name:"dicom-pdf",sopClassUids:y,getDisplaySetsFromSeries:e=>e.map(e=>{let{Modality:t,SOPInstanceUID:o}=e,{SeriesDescription:i="PDF",MIMETypeOfEncapsulatedDocument:u}=e,{SeriesNumber:s,SeriesDate:c,SeriesInstanceUID:p,StudyInstanceUID:d,SOPClassUID:m}=e,b=l(u)||"application/pdf",g={instance:e,tag:"EncapsulatedDocument",mimeType:b};return{Modality:t,displaySetInstanceUID:n.utils.guid(),SeriesDescription:i,SeriesNumber:s,SeriesDate:c,SOPInstanceUID:o,SeriesInstanceUID:p,StudyInstanceUID:d,SOPClassHandlerId:r,SOPClassUID:m,referencedImages:null,measurements:null,getDocument:e=>f(g,e),mimeType:b,instances:[e],thumbnailSrc:null,isDerivedDisplaySet:!0,isLoaded:!1,sopClassUids:y,numImageFrames:0,numInstances:1,instance:e,supportsWindowLevel:!0,label:i||`${a().t("Series")} ${s} - ${a().t(t)}`}})}]}}})(),u=i.O(u)})());
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@ohif/core"),require("@ohif/i18n")):"function"==typeof define&&define.amd?define(["@ohif/core","@ohif/i18n"],t):"object"==typeof exports?exports["ohif-extension-dicom-pdf"]=t(require("@ohif/core"),require("@ohif/i18n")):e["ohif-extension-dicom-pdf"]=t(e["@ohif/core"],e["@ohif/i18n"])}(globalThis,(e,t)=>(()=>{var r,n,o={822(e,t,r){"use strict";r.r(t),r.d(t,{default:()=>T});var n,o=r(326),a=r(598),i=r.n(a);function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=u(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==u(t)?t:t+""}function c(){if(console&&console.warn){for(var e,t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];"string"==typeof r[0]&&(r[0]="react-i18next:: ".concat(r[0])),(e=console).warn.apply(e,r)}}r(741),Object.create(null);var l={};function f(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];"string"==typeof t[0]&&l[t[0]]||("string"==typeof t[0]&&(l[t[0]]=new Date),c.apply(void 0,t))}var p=function(e,t){return function(){e.isInitialized?t():e.on("initialized",function r(){setTimeout(function(){e.off("initialized",r)},0),t()})}};function d(e,t,r){e.loadNamespaces(t,p(e,r))}function y(e,t,r,n){"string"==typeof r&&(r=[r]),r.forEach(function(t){0>e.options.ns.indexOf(t)&&e.options.ns.push(t)}),e.loadLanguages(t,p(e,n))}var m=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,b={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"\xa9","©":"\xa9","®":"\xae","®":"\xae","…":"…","…":"…","/":"/","/":"/"},g=function(e){return b[e]},h={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:function(e){return e.replace(m,g)}},v=(0,o.createContext)(),S=function(){var e;function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");this.usedNamespaces={}}return e=[{key:"addUsedNamespaces",value:function(e){var t=this;e.forEach(function(e){t.usedNamespaces[e]||(t.usedNamespaces[e]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?O(Object(r),!0).forEach(function(t){var n,o;n=t,o=r[t],(n=s(n))in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var k=function(e,t){var r=(0,o.useRef)();return(0,o.useEffect)(function(){r.current=t?r.current:e},[e,t]),r.current},j=r(2);let _={"unsupported-type":"This document type cannot be displayed","signature-mismatch":"Document content does not match its declared type","retrieve-failed":"Unable to retrieve this document",aborted:"Loading document..."};function E({displaySets:e,viewportId:t="pdf-viewport"}){let[r,a]=(0,o.useState)(null),[i,s]=(0,o.useState)(null),c=(0,o.useRef)(null),l=(0,j.useViewportRef)(t),{t:p}=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.i18n,i=(0,o.useContext)(v)||{},s=i.i18n,c=i.defaultNS,l=a||s||n;if(l&&!l.reportNamespaces&&(l.reportNamespaces=new S),!l){f("You will need to pass in an i18next instance by using initReactI18next");var p=function(e,t){return"string"==typeof t?t:t&&"object"===u(t)&&"string"==typeof t.defaultValue?t.defaultValue:Array.isArray(e)?e[e.length-1]:e},m=[p,{},!1];return m.t=p,m.i18n={},m.ready=!1,m}l.options.react&&void 0!==l.options.react.wait&&f("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var b=w(w(w({},h),l.options.react),r),g=b.useSuspense,O=b.keyPrefix,j=e||c||l.options&&l.options.defaultNS;j="string"==typeof j?[j]:j||["translation"],l.reportNamespaces.addUsedNamespaces&&l.reportNamespaces.addUsedNamespaces(j);var _=(l.isInitialized||l.initializedStoreOnce)&&j.every(function(e){return function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.languages&&t.languages.length?void 0===t.options.ignoreJSONStructure?function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=t.languages[0],o=!!t.options&&t.options.fallbackLng,a=t.languages[t.languages.length-1];if("cimode"===n.toLowerCase())return!0;var i=function(e,r){var n=t.services.backendConnector.state["".concat(e,"|").concat(r)];return -1===n||2===n};return(!(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1)||!t.services.backendConnector.backend||!t.isLanguageChangingTo||!!i(t.isLanguageChangingTo,e))&&!!(t.hasResourceBundle(n,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||i(n,e)&&(!o||i(a,e)))}(e,t,r):t.hasLoadedNamespace(e,{lng:r.lng,precheck:function(t,n){if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!n(t.isLanguageChangingTo,e))return!1}}):(f("i18n.languages were undefined or empty",t.languages),!0)}(e,l,b)});function E(){return l.getFixedT(r.lng||null,"fallback"===b.nsMode?j:j[0],O)}var T=function(e){if(Array.isArray(e))return e}(t=(0,o.useState)(E))||function(e){var t=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,n,o,a,i=[],u=!0,s=!1;try{o=(t=t.call(e)).next,!1;for(;!(u=(r=o.call(t)).done)&&(i.push(r.value),2!==i.length);u=!0);}catch(e){s=!0,n=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw n}}return i}}(t)||function(e){if(e){if("string"==typeof e)return x(e,2);var t=({}).toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?x(e,2):void 0}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),P=T[0],C=T[1],L=j.join();r.lng&&(L="".concat(r.lng).concat(L));var N=k(L),I=(0,o.useRef)(!0);(0,o.useEffect)(function(){var e=b.bindI18n,t=b.bindI18nStore;function n(){I.current&&C(E)}return I.current=!0,_||g||(r.lng?y(l,r.lng,j,function(){I.current&&C(E)}):d(l,j,function(){I.current&&C(E)})),_&&N&&N!==L&&I.current&&C(E),e&&l&&l.on(e,n),t&&l&&l.store.on(t,n),function(){I.current=!1,e&&l&&e.split(" ").forEach(function(e){return l.off(e,n)}),t&&l&&t.split(" ").forEach(function(e){return l.store.off(e,n)})}},[l,L]);var A=(0,o.useRef)(!0);(0,o.useEffect)(function(){I.current&&!A.current&&C(E),A.current=!1},[l,O]);var U=[P,l,_];if(U.t=P,U.i18n=l,U.ready=_,_||!_&&!g)return U;throw new Promise(function(e){r.lng?y(l,r.lng,j,function(){return e()}):d(l,j,function(){return e()})})}("EncapsulatedDocument");(0,o.useEffect)(()=>(document.body.addEventListener("drag",g),function(){document.body.removeEventListener("drag",g),l.unregister()}),[]);let[m,b]=(0,o.useState)("pdf-yes-click"),g=()=>{b("pdf-no-click")};if(e&&e.length>1)throw Error("OHIFCornerstonePdfViewport: only one display set is supported for dicom pdf right now");let{getDocument:O,label:T}=e[0];return(0,o.useEffect)(()=>{let e,t=!1,r=new AbortController,n=async()=>{let n=await O({signal:r.signal});if(t){n.ok&&n.revoke();return}if(!n.ok){a(null),s(n.reason);return}e=n.revoke,a({url:n.url,documentType:n.documentType}),s(null)};return a(null),s(null),n(),()=>{t=!0,r.abort(),e?.()}},[O]),o.createElement("div",{className:"bg-primary-black text-foreground h-full w-full",onClick:()=>{b("pdf-yes-click")},ref:e=>{c.current=e,e&&l.register(e)},"data-viewport-id":t},r?function({url:e,documentType:t},r,n,a){return"object"===t.strategy?o.createElement("object",{data:e,type:t.mimeType,className:r},o.createElement("div",null,n("No viewer installed for {{mimeType}}",{mimeType:t.mimeType}))):o.createElement("iframe",{src:e,title:a||n("Encapsulated document"),className:`${r} border-0`,sandbox:t.sandbox??"",referrerPolicy:"no-referrer",allow:""})}(r,m,p,T):o.createElement("div",{className:"flex h-full w-full items-center justify-center"},p(i?_[i]:"Loading document...")))}E.propTypes={displaySets:i().arrayOf(i().object).isRequired,viewportId:i().string};let T=E},856(e,t,r){"use strict";var n=r(183);function o(){}function a(){}a.resetWarningCache=o,e.exports=function(){function e(e,t,r,o,a,i){if(i!==n){var u=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function t(){return e}e.isRequired=e;var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:o};return r.PropTypes=r,r}},598(e,t,r){e.exports=r(856)()},183(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},249(e,t){"use strict";var r=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=(Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider")),a=Symbol.for("react.context"),i=(Symbol.for("react.forward_ref"),Symbol.for("react.suspense")),u=(Symbol.for("react.memo"),Symbol.for("react.lazy")),s=Symbol.iterator,c={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},l=Object.assign,f={};function p(e,t,r){this.props=e,this.context=t,this.refs=f,this.updater=r||c}function d(){}function y(e,t,r){this.props=e,this.context=t,this.refs=f,this.updater=r||c}p.prototype.isReactComponent={},p.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},p.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},d.prototype=p.prototype;var m=y.prototype=new d;m.constructor=y,l(m,p.prototype),m.isPureReactComponent=!0;var b=Array.isArray,g=Object.prototype.hasOwnProperty,h=null,v={key:!0,ref:!0,__self:!0,__source:!0};function S(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){(0===e._status||-1===e._status)&&(e._status=1,e._result=t)},function(t){(0===e._status||-1===e._status)&&(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var x=null;t.Suspense=i,t.createContext=function(e){return(e={$$typeof:a,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:o,_context:e},e.Consumer=e},t.createElement=function(e,t,n){var o,a={},i=null,u=null;if(null!=t)for(o in void 0!==t.ref&&(u=t.ref),void 0!==t.key&&(i=""+t.key),t)g.call(t,o)&&!v.hasOwnProperty(o)&&(a[o]=t[o]);var s=arguments.length-2;if(1===s)a.children=n;else if(1<s){for(var c=Array(s),l=0;l<s;l++)c[l]=arguments[l+2];a.children=c}if(e&&e.defaultProps)for(o in s=e.defaultProps)void 0===a[o]&&(a[o]=s[o]);return{$$typeof:r,type:e,key:i,ref:u,props:a,_owner:h}},t.lazy=function(e){return{$$typeof:u,_payload:{_status:-1,_result:e},_init:S}},t.useContext=function(e){return x.useContext(e)},t.useEffect=function(e,t){return x.useEffect(e,t)},t.useRef=function(e){return x.useRef(e)},t.useState=function(e){return x.useState(e)}},326(e,t,r){"use strict";e.exports=r(249)},741(e){e.exports={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}},2(t){"use strict";t.exports=e},545(e){"use strict";e.exports=t}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return o[e](r,r.exports,i),r.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r=[],i.O=(e,t,n,o)=>{if(t){o=o||0;for(var a=r.length;a>0&&r[a-1][2]>o;a--)r[a]=r[a-1];r[a]=[t,n,o];return}for(var u=1/0,a=0;a<r.length;a++){for(var[t,n,o]=r[a],s=!0,c=0;c<t.length;c++)(!1&o||u>=o)&&Object.keys(i.O).every(e=>i.O[e](t[c]))?t.splice(c--,1):(s=!1,o<u&&(u=o));if(s){r.splice(a--,1);var l=n();void 0!==l&&(e=l)}}return e},i.F={},i.E=e=>{Object.keys(i.F).map(t=>{i.F[t](e)})},n={509:0},i.F.j=e=>{if(!i.o(n,e)||void 0===n[e]){n[e]=null;var t=document.createElement("link");i.nc&&t.setAttribute("nonce",i.nc),t.rel="prefetch",t.as="script",t.href=i.p+i.u(e),document.head.appendChild(t)}},i.O.j=e=>0===n[e],i.O(0,[509],()=>{[509].map(i.E)},5);var u={};return(()=>{"use strict";i.r(u),i.d(u,{default:()=>g});var e=i(326);let t=JSON.parse('{"UU":"@ohif/extension-dicom-pdf"}').UU,r=`${t}.sopClassHandlerModule.dicom-pdf`;var n=i(2),o=i(545),a=i.n(o);let s={"application/pdf":{mimeType:"application/pdf",strategy:"object",signature:[37,80,68,70,45],signatureSearchLimit:1024},"text/html":{mimeType:"text/html",strategy:"iframe",sandbox:""},"application/xhtml+xml":{mimeType:"application/xhtml+xml",strategy:"iframe",sandbox:""},"text/xml":{mimeType:"text/xml",strategy:"iframe",sandbox:""},"application/xml":{mimeType:"application/xml",strategy:"iframe",sandbox:""},"text/plain":{mimeType:"text/plain",strategy:"iframe",sandbox:""}},c={"application/html":"text/html","application/x-pdf":"application/pdf","application/acrobat":"application/pdf","text/pdf":"application/pdf","application/xhtml":"application/xhtml+xml"};function l(e){if("string"==typeof e)return e.split(";")[0].trim().toLowerCase()||void 0}async function f({instance:e,mimeType:t,tag:r="EncapsulatedDocument"},{signal:n}={}){var o;let a,i,u=function(e){let t=l(e);if(t)return s[c[t]??t]}(t);if(!u)return{ok:!1,reason:"unsupported-type",mimeType:t};let d=e?.[r];if(!d)return{ok:!1,reason:"retrieve-failed"};if(n?.aborted)return{ok:!1,reason:"aborted"};try{i=await p(d,u.mimeType)}catch(e){return console.warn("Failed to retrieve encapsulated document",e),{ok:!1,reason:"retrieve-failed"}}if(!i?.byteLength)return{ok:!1,reason:"retrieve-failed"};if(n?.aborted)return{ok:!1,reason:"aborted"};if(!function(e,t){let{signature:r,signatureSearchLimit:n=0}=e;if(!r?.length)return!0;if(t.byteLength<r.length)return!1;let o=Math.min(n,t.byteLength-r.length),a=new Uint8Array(t,0,o+r.length);for(let e=0;e<=o;e++)if(r.every((t,r)=>a[e+r]===t))return!0;return!1}(u,i))return{ok:!1,reason:"signature-mismatch",mimeType:u.mimeType};let y=URL.createObjectURL(new Blob([i],{type:u.mimeType}));return n?.aborted?(URL.revokeObjectURL(y),{ok:!1,reason:"aborted"}):{ok:!0,url:y,documentType:u,revoke:(o=y,a=!1,()=>{a||(URL.revokeObjectURL(o),a=!0)})}}async function p(e,t){return e.InlineBinary?function(e){let t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r.buffer}(e.InlineBinary):Array.isArray(e)?d(e[0]):e.Value?d(Array.isArray(e.Value)?e.Value[0]:e.Value):"function"==typeof e.retrieveBulkData?d(await e.retrieveBulkData({mediaType:t})):void 0}function d(e){return ArrayBuffer.isView(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(e)?e:void 0}let y=Object.values({ENCAPSULATED_PDF:"1.2.840.10008.5.1.4.1.1.104.1"}),m=e.lazy(()=>Promise.resolve().then(i.bind(i,822))),b=t=>e.createElement(e.Suspense,{fallback:e.createElement("div",null,"Loading...")},e.createElement(m,t)),g={id:t,getViewportModule:()=>[{name:"dicom-pdf",component:t=>e.createElement(b,t)}],getSopClassHandlerModule:function(e){let{servicesManager:t,extensionManager:o}=e;return[{name:"dicom-pdf",sopClassUids:y,getDisplaySetsFromSeries:e=>e.map(e=>{let{Modality:t,SOPInstanceUID:o}=e,{SeriesDescription:i="PDF",MIMETypeOfEncapsulatedDocument:u}=e,{SeriesNumber:s,SeriesDate:c,SeriesInstanceUID:p,StudyInstanceUID:d,SOPClassUID:m}=e,b=l(u)||"application/pdf",g={instance:e,tag:"EncapsulatedDocument",mimeType:b};return{Modality:t,displaySetInstanceUID:n.utils.guid(),SeriesDescription:i,SeriesNumber:s,SeriesDate:c,SOPInstanceUID:o,SeriesInstanceUID:p,StudyInstanceUID:d,SOPClassHandlerId:r,SOPClassUID:m,referencedImages:null,measurements:null,getDocument:e=>f(g,e),mimeType:b,instances:[e],thumbnailSrc:null,isDerivedDisplaySet:!0,isLoaded:!1,sopClassUids:y,numImageFrames:0,numInstances:1,instance:e,supportsWindowLevel:!0,label:i||`${a().t("Series")} ${s} - ${a().t(t)}`}})}]}}})(),u=i.O(u)})());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ohif/extension-dicom-pdf",
|
|
3
|
-
"version": "3.13.
|
|
3
|
+
"version": "3.13.12",
|
|
4
4
|
"description": "OHIF extension for PDF display",
|
|
5
5
|
"author": "OHIF",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
+
"@ohif/core": "3.13.12",
|
|
25
|
+
"@ohif/ui": "3.13.12",
|
|
24
26
|
"dcmjs": "0.52.0",
|
|
25
27
|
"dicom-parser": "1.8.21",
|
|
26
28
|
"hammerjs": "2.0.8",
|
|
27
29
|
"prop-types": "15.8.1",
|
|
28
30
|
"react": "18.3.1",
|
|
29
|
-
"react-i18next": "12.3.1"
|
|
30
|
-
"@ohif/core": "3.13.10",
|
|
31
|
-
"@ohif/ui": "3.13.10"
|
|
31
|
+
"react-i18next": "12.3.1"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "7.29.7",
|