diff --git a/app/stage/protyle/js/viewerjs/viewer.js b/app/stage/protyle/js/viewerjs/viewer.js index 2212caeb415..871eb9cc130 100644 --- a/app/stage/protyle/js/viewerjs/viewer.js +++ b/app/stage/protyle/js/viewerjs/viewer.js @@ -5,6 +5,6 @@ * Copyright 2015-present Chen Fengyuan * Released under the MIT license * - * Date: 2024-12-28T15:04:08.802Z + * Date: 2024-12-28T15:07:25.323Z */ -((t,e)=>{"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Viewer=e()})(this,function(){function n(t,e){for(var i=0;i{if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0===i)return("string"===e?String:Number)(t);if("object"!=typeof(i=i.call(t,e||"default")))return i;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string");return"symbol"==typeof t?t:t+""}function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var W={backdrop:!0,button:!0,navbar:!0,title:!0,toolbar:!0,className:"",container:"body",filter:null,fullscreen:!0,inheritedAttributes:["crossOrigin","decoding","isMap","loading","referrerPolicy","sizes","srcset","useMap"],initialCoverage:.9,initialViewIndex:0,inline:!1,interval:5e3,keyboard:!0,focus:!0,loading:!0,loop:!0,minWidth:200,minHeight:100,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,slideOnTouch:!0,toggleOnDblclick:!0,tooltip:!0,transition:!0,zIndex:2015,zIndexInline:0,zoomRatio:.1,minZoomRatio:.01,maxZoomRatio:100,url:"src",ready:null,show:null,shown:null,hide:null,hidden:null,view:null,viewed:null,move:null,moved:null,rotate:null,rotated:null,scale:null,scaled:null,zoom:null,zoomed:null,play:null,stop:null},t="undefined"!=typeof window&&void 0!==window.document,e=t?window:{},a=!(!t||!e.document.documentElement)&&"ontouchstart"in e.document.documentElement,i=t&&"PointerEvent"in e,g="viewer",h="move",j="switch",c="zoom",f="".concat(g,"-active"),H="".concat(g,"-close"),B="".concat(g,"-fade"),V="".concat(g,"-fixed"),U="".concat(g,"-fullscreen"),K="".concat(g,"-fullscreen-exit"),v="".concat(g,"-hide"),Z="".concat(g,"-hide-md-down"),$="".concat(g,"-hide-sm-down"),_="".concat(g,"-hide-xs-down"),u="".concat(g,"-in"),p="".concat(g,"-invisible"),b="".concat(g,"-loading"),G="".concat(g,"-move"),J="".concat(g,"-open"),d="".concat(g,"-show"),m="".concat(g,"-transition"),w="click",Q="dblclick",tt="dragstart",et="focusin",it="keydown",y="load",x="error",nt=i?"pointerdown":a?"touchstart":"mousedown",ot=i?"pointermove":a?"touchmove":"mousemove",st=i?"pointerup pointercancel":a?"touchend touchcancel":"mouseup",at="resize",k="transitionend",rt="wheel",z="viewed",lt="rotated",ht="".concat(g,"Action"),ct=/\s\s*/,ut=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"];function T(t){return"string"==typeof t}var dt=Number.isNaN||e.isNaN;function E(t){return"number"==typeof t&&!dt(t)}function D(t){return void 0===t}function o(t){return"object"===l(t)&&null!==t}var mt=Object.prototype.hasOwnProperty;function S(t){if(!o(t))return!1;try{var e=t.constructor,i=e.prototype;return e&&i&&mt.call(i,"isPrototypeOf")}catch(t){return!1}}function I(t){return"function"==typeof t}function A(e,i){if(e&&I(i))if(Array.isArray(e)||E(e.length))for(var t=e.length,n=0;n{if(!T(e))return"";e=e.replace(/^.*\//,"").replace(/[?&#].*$/,"");try{return decodeURIComponent(e)}catch(t){return e}})(o),a=r.getImageURL(i);(o||a)&&(e=document.createElement("li"),n=document.createElement("img"),A(l.inheritedAttributes,function(t){var e=i.getAttribute(t);null!==e&&n.setAttribute(t,e)}),l.navbar&&(n.src=o||a),n.alt=s,n.setAttribute("data-original-url",a||o),e.setAttribute("data-index",t),e.setAttribute("data-viewer-action","view"),e.setAttribute("role","button"),l.keyboard&&e.setAttribute("tabindex",0),e.appendChild(n),h.appendChild(e),c.push(e))}),A(this.items=c,function(e){var t,i,n=e.firstElementChild;pt(n,"filled",!0),l.loading&&R(e,b),X(n,y,t=function(t){Y(n,x,i),l.loading&&M(e,b),r.loadImage(t)},{once:!0}),X(n,x,i=function(){Y(n,y,t),l.loading&&M(e,b)},{once:!0})}),l.transition&&X(t,z,function(){R(h,m)},{once:!0})},renderList:function(){var t,e,i=this.index,n=this.items[i];n&&(t=n.nextElementSibling,t=parseInt(window.getComputedStyle(t||n).marginLeft,10),n=n.offsetWidth,C(this.list,O({width:(e=n+t)*this.length-t},xt({translateX:(this.viewerData.width-n)/2-e*i}))))},resetList:function(){var t=this.list;t.innerHTML="",M(t,m),C(t,xt({translateX:0}))},initImage:function(r){var t,l=this,h=this.options,e=this.image,i=this.viewerData,n=this.footer.offsetHeight,c=i.width,u=Math.max(i.height-n,n),d=this.imageData||{};this.imageInitializing={abort:function(){t.onload=null}},t=zt(e,h,function(t,e){var i=t/e,n=Math.max(0,Math.min(1,h.initialCoverage)),o=c,s=u,n=(l.imageInitializing=!1,c=this.length||this.viewed&&t===this.index)){if(!this.isShown)return this.index=t,this.show();this.viewing&&this.viewing.abort();var e,n,o,s=this.element,a=this.options,r=this.title,l=this.canvas,h=this.items[t],c=h.querySelector("img"),u=N(c,"originalUrl"),d=c.getAttribute("alt"),m=document.createElement("img");A(a.inheritedAttributes,function(t){var e=c.getAttribute(t);null!==e&&m.setAttribute(t,e)}),m.src=u,m.alt=d,I(a.view)&&X(s,"view",a.view,{once:!0}),!1===P(s,"view",{originalImage:this.images[t],index:t,image:m})||!this.isShown||this.hiding||this.played||((u=this.items[this.index])&&(M(u,f),u.removeAttribute("aria-selected")),R(h,f),h.setAttribute("aria-selected",!0),a.focus&&h.focus(),this.image=m,this.viewed=!1,this.index=t,this.imageData={},R(m,p),a.loading&&R(l,b),l.innerHTML="",l.appendChild(m),this.renderList(),r.innerHTML="",X(s,z,e=function(){var t=i.imageData,e=Array.isArray(a.title)?a.title[1]:a.title;r.innerHTML=T(e=I(e)?e.call(i,m,t):"".concat(d," (").concat(t.naturalWidth," × ").concat(t.naturalHeight,")"))?e.replace(/&(?!amp;|quot;|#39;|lt;|gt;)/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">"):e},{once:!0}),this.viewing={abort:function(){Y(s,z,e),m.complete?i.imageRendering?i.imageRendering.abort():i.imageInitializing&&i.imageInitializing.abort():(m.src="",Y(m,y,n),i.timeout&&clearTimeout(i.timeout))}},m.complete?this.load():(X(m,y,n=function(){Y(m,x,o),i.load()},{once:!0}),X(m,x,o=function(){Y(m,y,n),i.timeout&&(clearTimeout(i.timeout),i.timeout=!1),M(m,p),a.loading&&M(i.canvas,b)},{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){M(m,p),i.timeout=!1},1e3)))}return this},prev:function(){var t=this.index-1;return t<0&&(t=0Math.abs(r)&&(this.pointers={},1{function o(t){var e=1
',d=(i=d.querySelector(".".concat(g,"-container"))).querySelector(".".concat(g,"-title")),n=i.querySelector(".".concat(g,"-toolbar")),m=i.querySelector(".".concat(g,"-navbar")),o=i.querySelector(".".concat(g,"-button")),a=i.querySelector(".".concat(g,"-canvas")),this.parent=e,this.viewer=i,this.title=d,this.toolbar=n,this.navbar=m,this.button=o,this.canvas=a,this.footer=i.querySelector(".".concat(g,"-footer")),this.tooltipBox=i.querySelector(".".concat(g,"-tooltip")),this.player=i.querySelector(".".concat(g,"-player")),this.list=i.querySelector(".".concat(g,"-list")),i.id="".concat(g).concat(this.id),d.id="".concat(g,"Title").concat(this.id),R(d,s.title?Tt(Array.isArray(s.title)?s.title[0]:s.title):v),R(m,s.navbar?Tt(s.navbar):v),F(o,v,!s.button),s.keyboard&&o.setAttribute("tabindex",0),s.backdrop&&(R(i,"".concat(g,"-backdrop")),s.inline||"static"===s.backdrop||pt(a,ht,"hide")),T(s.className)&&s.className&&s.className.split(ct).forEach(function(t){R(i,t)}),s.toolbar?(r=document.createElement("ul"),l=S(s.toolbar),h=ut.slice(0,3),c=ut.slice(7,9),u=ut.slice(9),l||R(n,Tt(s.toolbar)),A(l?s.toolbar:ut,function(t,e){var i,n=l&&S(t),e=l?vt(e):t,o=n&&!D(t.show)?t.show:t;!o||!s.zoomable&&-1!==h.indexOf(e)||!s.rotatable&&-1!==c.indexOf(e)||!s.scalable&&-1!==u.indexOf(e)||(i=n&&!D(t.size)?t.size:t,n=n&&!D(t.click)?t.click:t,t=document.createElement("li"),s.keyboard&&t.setAttribute("tabindex",0),t.setAttribute("role","button"),R(t,"".concat(g,"-").concat(e)),I(n)||pt(t,ht,e),E(o)&&R(t,Tt(o)),-1!==["small","large"].indexOf(i)?R(t,"".concat(g,"-").concat(i)):"play"===e&&R(t,"".concat(g,"-large")),I(n)&&X(t,w,n),o="","zoom-in"===e?o="Add":"zoom-out"===e?o="Line":"one-to-one"===e?o="Pause":"reset"===e?o="Refresh":"prev"===e?o="Left":"play"===e?o="Play":"next"===e?o="Right":"rotate-left"===e?o="Undo":"rotate-right"===e?o="Redo":"flip-horizontal"===e?o="SplitLR":"flip-vertical"===e?o="SplitTB":"close"===e&&(o="Close"),t.innerHTML="'),r.appendChild(t))}),n.appendChild(r)):R(n,v),s.rotatable||(R(d=n.querySelectorAll('li[class*="rotate"]'),p),A(d,function(t){n.appendChild(t)})),s.inline?(R(o,U),C(i,{zIndex:s.zIndexInline}),"static"===window.getComputedStyle(e).position&&C(e,{position:"relative"}),e.insertBefore(i,t.nextSibling)):(R(o,H),R(i,V),R(i,B),R(i,v),C(i,{zIndex:s.zIndex}),(m=(m=T(m=s.container)?t.ownerDocument.querySelector(m):m)||this.body).appendChild(i)),s.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,I(s.ready)&&X(t,"ready",s.ready,{once:!0}),!1===P(t,"ready")?this.ready=!1:this.ready&&s.inline&&this.view(this.index))}}])&&n(t.prototype,e),i&&n(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i})();return O(e.prototype,i,t,St,It,At),e}); +((t,e)=>{"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Viewer=e()})(this,function(){function n(t,e){for(var i=0;i{if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0===i)return("string"===e?String:Number)(t);if("object"!=typeof(i=i.call(t,e||"default")))return i;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string");return"symbol"==typeof t?t:t+""}function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var W={backdrop:!0,button:!0,navbar:!0,title:!0,toolbar:!0,className:"",container:"body",filter:null,fullscreen:!0,inheritedAttributes:["crossOrigin","decoding","isMap","loading","referrerPolicy","sizes","srcset","useMap"],initialCoverage:.9,initialViewIndex:0,inline:!1,interval:5e3,keyboard:!0,focus:!0,loading:!0,loop:!0,minWidth:200,minHeight:100,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,slideOnTouch:!0,toggleOnDblclick:!0,tooltip:!0,transition:!0,zIndex:2015,zIndexInline:0,zoomRatio:.1,minZoomRatio:.01,maxZoomRatio:100,url:"src",ready:null,show:null,shown:null,hide:null,hidden:null,view:null,viewed:null,move:null,moved:null,rotate:null,rotated:null,scale:null,scaled:null,zoom:null,zoomed:null,play:null,stop:null},t="undefined"!=typeof window&&void 0!==window.document,e=t?window:{},a=!(!t||!e.document.documentElement)&&"ontouchstart"in e.document.documentElement,i=t&&"PointerEvent"in e,g="viewer",h="move",j="switch",c="zoom",f="".concat(g,"-active"),H="".concat(g,"-close"),B="".concat(g,"-fade"),V="".concat(g,"-fixed"),U="".concat(g,"-fullscreen"),K="".concat(g,"-fullscreen-exit"),v="".concat(g,"-hide"),Z="".concat(g,"-hide-md-down"),$="".concat(g,"-hide-sm-down"),_="".concat(g,"-hide-xs-down"),u="".concat(g,"-in"),p="".concat(g,"-invisible"),b="".concat(g,"-loading"),G="".concat(g,"-move"),J="".concat(g,"-open"),d="".concat(g,"-show"),m="".concat(g,"-transition"),w="click",Q="dblclick",tt="dragstart",et="focusin",it="keydown",y="load",x="error",nt=i?"pointerdown":a?"touchstart":"mousedown",ot=i?"pointermove":a?"touchmove":"mousemove",st=i?"pointerup pointercancel":a?"touchend touchcancel":"mouseup",at="resize",k="transitionend",rt="wheel",z="viewed",lt="rotated",ht="".concat(g,"Action"),ct=/\s\s*/,ut=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"];function T(t){return"string"==typeof t}var dt=Number.isNaN||e.isNaN;function E(t){return"number"==typeof t&&!dt(t)}function D(t){return void 0===t}function o(t){return"object"===l(t)&&null!==t}var mt=Object.prototype.hasOwnProperty;function S(t){if(!o(t))return!1;try{var e=t.constructor,i=e.prototype;return e&&i&&mt.call(i,"isPrototypeOf")}catch(t){return!1}}function I(t){return"function"==typeof t}function A(e,i){if(e&&I(i))if(Array.isArray(e)||E(e.length))for(var t=e.length,n=0;n{if(!T(e))return"";e=e.replace(/^.*\//,"").replace(/[?&#].*$/,"");try{return decodeURIComponent(e)}catch(t){return e}})(o),a=r.getImageURL(i);(o||a)&&(e=document.createElement("li"),n=document.createElement("img"),A(l.inheritedAttributes,function(t){var e=i.getAttribute(t);null!==e&&n.setAttribute(t,e)}),l.navbar&&(n.src=o||a),n.alt=s,n.setAttribute("data-original-url",a||o),e.setAttribute("data-index",t),e.setAttribute("data-viewer-action","view"),e.setAttribute("role","button"),l.keyboard&&e.setAttribute("tabindex",0),e.appendChild(n),h.appendChild(e),c.push(e))}),A(this.items=c,function(e){var t,i,n=e.firstElementChild;pt(n,"filled",!0),l.loading&&R(e,b),X(n,y,t=function(t){Y(n,x,i),l.loading&&M(e,b),r.loadImage(t)},{once:!0}),X(n,x,i=function(){Y(n,y,t),l.loading&&M(e,b)},{once:!0})}),l.transition&&X(t,z,function(){R(h,m)},{once:!0})},renderList:function(){var t,e,i=this.index,n=this.items[i];n&&(t=n.nextElementSibling,t=parseInt(window.getComputedStyle(t||n).marginLeft,10),n=n.offsetWidth,C(this.list,O({width:(e=n+t)*this.length-t},xt({translateX:(this.viewerData.width-n)/2-e*i}))))},resetList:function(){var t=this.list;t.innerHTML="",M(t,m),C(t,O({width:0},xt({translateX:0})))},initImage:function(r){var t,l=this,h=this.options,e=this.image,i=this.viewerData,n=this.footer.offsetHeight,c=i.width,u=Math.max(i.height-n,n),d=this.imageData||{};this.imageInitializing={abort:function(){t.onload=null}},t=zt(e,h,function(t,e){var i=t/e,n=Math.max(0,Math.min(1,h.initialCoverage)),o=c,s=u,n=(l.imageInitializing=!1,c=this.length||this.viewed&&t===this.index)){if(!this.isShown)return this.index=t,this.show();this.viewing&&this.viewing.abort();var e,n,o,s=this.element,a=this.options,r=this.title,l=this.canvas,h=this.items[t],c=h.querySelector("img"),u=N(c,"originalUrl"),d=c.getAttribute("alt"),m=document.createElement("img");A(a.inheritedAttributes,function(t){var e=c.getAttribute(t);null!==e&&m.setAttribute(t,e)}),m.src=u,m.alt=d,I(a.view)&&X(s,"view",a.view,{once:!0}),!1===P(s,"view",{originalImage:this.images[t],index:t,image:m})||!this.isShown||this.hiding||this.played||((u=this.items[this.index])&&(M(u,f),u.removeAttribute("aria-selected")),R(h,f),h.setAttribute("aria-selected",!0),a.focus&&h.focus(),this.image=m,this.viewed=!1,this.index=t,this.imageData={},R(m,p),a.loading&&R(l,b),l.innerHTML="",l.appendChild(m),this.renderList(),r.innerHTML="",X(s,z,e=function(){var t=i.imageData,e=Array.isArray(a.title)?a.title[1]:a.title;r.innerHTML=T(e=I(e)?e.call(i,m,t):"".concat(d," (").concat(t.naturalWidth," × ").concat(t.naturalHeight,")"))?e.replace(/&(?!amp;|quot;|#39;|lt;|gt;)/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">"):e},{once:!0}),this.viewing={abort:function(){Y(s,z,e),m.complete?i.imageRendering?i.imageRendering.abort():i.imageInitializing&&i.imageInitializing.abort():(m.src="",Y(m,y,n),i.timeout&&clearTimeout(i.timeout))}},m.complete?this.load():(X(m,y,n=function(){Y(m,x,o),i.load()},{once:!0}),X(m,x,o=function(){Y(m,y,n),i.timeout&&(clearTimeout(i.timeout),i.timeout=!1),M(m,p),a.loading&&M(i.canvas,b)},{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){M(m,p),i.timeout=!1},1e3)))}return this},prev:function(){var t=this.index-1;return t<0&&(t=0Math.abs(r)&&(this.pointers={},1{function o(t){var e=1
',d=(i=d.querySelector(".".concat(g,"-container"))).querySelector(".".concat(g,"-title")),n=i.querySelector(".".concat(g,"-toolbar")),m=i.querySelector(".".concat(g,"-navbar")),o=i.querySelector(".".concat(g,"-button")),a=i.querySelector(".".concat(g,"-canvas")),this.parent=e,this.viewer=i,this.title=d,this.toolbar=n,this.navbar=m,this.button=o,this.canvas=a,this.footer=i.querySelector(".".concat(g,"-footer")),this.tooltipBox=i.querySelector(".".concat(g,"-tooltip")),this.player=i.querySelector(".".concat(g,"-player")),this.list=i.querySelector(".".concat(g,"-list")),i.id="".concat(g).concat(this.id),d.id="".concat(g,"Title").concat(this.id),R(d,s.title?Tt(Array.isArray(s.title)?s.title[0]:s.title):v),R(m,s.navbar?Tt(s.navbar):v),F(o,v,!s.button),s.keyboard&&o.setAttribute("tabindex",0),s.backdrop&&(R(i,"".concat(g,"-backdrop")),s.inline||"static"===s.backdrop||pt(a,ht,"hide")),T(s.className)&&s.className&&s.className.split(ct).forEach(function(t){R(i,t)}),s.toolbar?(r=document.createElement("ul"),l=S(s.toolbar),h=ut.slice(0,3),c=ut.slice(7,9),u=ut.slice(9),l||R(n,Tt(s.toolbar)),A(l?s.toolbar:ut,function(t,e){var i,n=l&&S(t),e=l?vt(e):t,o=n&&!D(t.show)?t.show:t;!o||!s.zoomable&&-1!==h.indexOf(e)||!s.rotatable&&-1!==c.indexOf(e)||!s.scalable&&-1!==u.indexOf(e)||(i=n&&!D(t.size)?t.size:t,n=n&&!D(t.click)?t.click:t,t=document.createElement("li"),s.keyboard&&t.setAttribute("tabindex",0),t.setAttribute("role","button"),R(t,"".concat(g,"-").concat(e)),I(n)||pt(t,ht,e),E(o)&&R(t,Tt(o)),-1!==["small","large"].indexOf(i)?R(t,"".concat(g,"-").concat(i)):"play"===e&&R(t,"".concat(g,"-large")),I(n)&&X(t,w,n),o="","zoom-in"===e?o="Add":"zoom-out"===e?o="Line":"one-to-one"===e?o="Pause":"reset"===e?o="Refresh":"prev"===e?o="Left":"play"===e?o="Play":"next"===e?o="Right":"rotate-left"===e?o="Undo":"rotate-right"===e?o="Redo":"flip-horizontal"===e?o="SplitLR":"flip-vertical"===e?o="SplitTB":"close"===e&&(o="Close"),t.innerHTML="'),r.appendChild(t))}),n.appendChild(r)):R(n,v),s.rotatable||(R(d=n.querySelectorAll('li[class*="rotate"]'),p),A(d,function(t){n.appendChild(t)})),s.inline?(R(o,U),C(i,{zIndex:s.zIndexInline}),"static"===window.getComputedStyle(e).position&&C(e,{position:"relative"}),e.insertBefore(i,t.nextSibling)):(R(o,H),R(i,V),R(i,B),R(i,v),C(i,{zIndex:s.zIndex}),(m=(m=T(m=s.container)?t.ownerDocument.querySelector(m):m)||this.body).appendChild(i)),s.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,I(s.ready)&&X(t,"ready",s.ready,{once:!0}),!1===P(t,"ready")?this.ready=!1:this.ready&&s.inline&&this.view(this.index))}}])&&n(t.prototype,e),i&&n(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i})();return O(e.prototype,i,t,St,It,At),e});