New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@starlly-labs/photo-viewer

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@starlly-labs/photo-viewer - npm Package Compare versions

Comparing version 1.0.10 to 1.0.11

1

dist/components/CustomToolbars.d.ts

@@ -9,2 +9,3 @@ import React from 'react';

toolbarRightRender?: any;
toolbarBottomRender?: any;
overlayParams: any;

@@ -11,0 +12,0 @@ }

2

dist/react-photo-view.js

@@ -1,2 +0,2 @@

var e=require("react"),t=require("react-dom");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=/*#__PURE__*/n(e);function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(null,arguments)}function o(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function a(t){var n=e.useRef({fn:t,curr:void 0}).current;if(n.fn=t,!n.curr){var r=Object.create(null);Object.keys(t).forEach(function(e){r[e]=function(){var t;return(t=n.fn[e]).call.apply(t,[n.fn].concat([].slice.call(arguments)))}}),n.curr=r}return n.curr}function u(t){return e.useReducer(function(e,t){return i({},e,"function"==typeof t?t(e):t)},t)}var l=e.createContext(void 0),c="cubic-bezier(0.25, 0.8, 0.25, 1)",s=20,d="undefined"!=typeof window&&"ontouchstart"in window,f=function(e,t,n){return Math.max(Math.min(e,n),t)},h=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=0),f(e,1*(1-n),Math.max(6,t)*(1+n))},v="undefined"==typeof window||/ServerSideRendering/.test(navigator&&navigator.userAgent)?e.useEffect:e.useLayoutEffect;function m(t,n,r){var i=e.useRef(n);i.current=n,e.useEffect(function(){function e(e){i.current(e)}return t&&window.addEventListener(t,e,r),function(){t&&window.removeEventListener(t,e)}},[t])}var g=["container"];function p(e){var n=e.container,a=void 0===n?document.body:n,u=o(e,g);return t.createPortal(r.default.createElement("div",i({},u)),a)}function w(e){return r.default.createElement("svg",i({width:"44",height:"44",viewBox:"0 0 768 768"},e),r.default.createElement("path",{d:"M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"}))}function b(e){return r.default.createElement("svg",i({width:"44",height:"44",viewBox:"0 0 768 768"},e),r.default.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function E(){return e.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function y(e){return r.default.createElement("svg",i({width:"44",height:"44",viewBox:"0 0 768 768"},e),r.default.createElement("path",{d:"M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"}))}function R(e){var t=e.toolbarRender,n=e.overlayParams,i=e.toolbarLeftRender,o=e.toolbarRightRender;return r.default.createElement(r.default.Fragment,null,e.bannerVisible&&r.default.createElement("div",{className:"PhotoView-Slider__BannerWrap"},r.default.createElement("div",{className:"PhotoView-Slider__Counter"},e.index+1," / ",e.imageLength),r.default.createElement("div",{className:"PhotoView-Slider__BannerRight"},t&&n&&t(n),r.default.createElement(y,{className:"PhotoView-Slider__toolbarIcon",onClick:close}))),i&&n&&r.default.createElement("div",{className:"PhotoView-Slider__Toolbar PhotoView-Slider__Toolbar--Left"},i(n)),o&&n&&r.default.createElement("div",{className:"PhotoView-Slider__Toolbar PhotoView-Slider__Toolbar--Right"},o(n)))}function x(e){var t=e.touches[0],n=t.clientX,r=t.clientY;if(e.touches.length>=2){var i=e.touches[1],o=i.clientX,a=i.clientY;return[(n+o)/2,(r+a)/2,Math.sqrt(Math.pow(o-n,2)+Math.pow(a-r,2))]}return[n,r,0]}var C=function(e,t,n,r){var i,o=n*t,a=(o-r)/2,u=e;return o<=r?(i=1,u=0):e>0&&a-e<=0?(i=2,u=a):e<0&&a+e<=0&&(i=3,u=-a),[i,u]};function P(e,t,n,r,i,o,a,u,l,c){void 0===a&&(a=innerWidth/2),void 0===u&&(u=innerHeight/2),void 0===l&&(l=0),void 0===c&&(c=0);var s=C(e,o,n,innerWidth)[0],d=C(t,o,r,innerHeight),f=innerWidth/2,h=innerHeight/2;return{x:a-o/i*(a-(f+e))-f+(r/n>=3&&n*o===innerWidth?0:s?l/2:l),y:u-o/i*(u-(h+t))-h+(d[0]?c/2:c),lastCX:a,lastCY:u}}function S(e,t,n){var r=e%180!=0;return r?[n,t,r]:[t,n,r]}function _(e,t,n){var r=S(n,innerWidth,innerHeight),i=r[0],o=r[1],a=0,u=i,l=o,c=e/t*o,s=t/e*i;return e<i&&t<o?(u=e,l=t):e<i&&t>=o?u=c:e>=i&&t<o||e/t>i/o?l=s:t/e>=3&&!r[2]?a=((l=s)-o)/2:u=c,{width:u,height:l,x:0,y:a,pause:!0}}function k(t,n){var r=n.leading,i=void 0!==r&&r,o=n.maxWait,a=n.wait,u=void 0===a?o||0:a,l=e.useRef(t);l.current=t;var c=e.useRef(0),s=e.useRef(),d=function(){return s.current&&clearTimeout(s.current)},f=e.useCallback(function(){var e=[].slice.call(arguments),t=Date.now();function n(){c.current=t,d(),l.current.apply(null,e)}var r=c.current,a=t-r;if(0===r&&(i&&n(),c.current=t),void 0!==o){if(a>o)return void n()}else a<u&&(c.current=t);d(),s.current=setTimeout(function(){n(),c.current=0},u)},[u,o,i]);return f.cancel=d,f}var M=function(e,t,n){return W(e,t,n,100,function(e){return e},function(){return W(t,e,n)})},V=function(e){return 1-Math.pow(1-e,4)};function W(e,t,n,r,i,o){void 0===r&&(r=400),void 0===i&&(i=V);var a=t-e;if(0!==a){var u=Date.now(),l=0,c=function(){var t=Math.min(1,(Date.now()-u)/r);n(e+i(t)*a)&&t<1?s():(cancelAnimationFrame(l),t>=1&&o&&o())};s()}function s(){l=requestAnimationFrame(c)}}var N={T:0,L:0,W:0,H:0,FIT:void 0},Y=function(){var t=e.useRef(!1);return e.useEffect(function(){return t.current=!0,function(){t.current=!1}},[]),t},F=["className"];function X(e){var t=e.className,n=void 0===t?"":t,a=o(e,F);return r.default.createElement("div",i({className:"PhotoView__Spinner "+n},a),r.default.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},r.default.createElement("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),r.default.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var T=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function L(e){var t=e.src,n=e.loaded,a=e.broken,u=e.className,l=e.onPhotoLoad,c=e.loadingElement,s=e.brokenElement,d=o(e,T),f=Y();return t&&!a?r.default.createElement(r.default.Fragment,null,r.default.createElement("img",i({className:"PhotoView__Photo"+(u?" "+u:""),src:t,onLoad:function(e){var t=e.target;f.current&&l({loaded:!0,naturalWidth:t.naturalWidth,naturalHeight:t.naturalHeight})},onError:function(){f.current&&l({broken:!0})},alt:""},d)),!n&&(r.default.createElement("span",{className:"PhotoView__icon"},c)||r.default.createElement(X,{className:"PhotoView__icon"}))):s?r.default.createElement("span",{className:"PhotoView__icon"},"function"==typeof s?s({src:t}):s):null}var I={naturalWidth:void 0,naturalHeight:void 0,width:void 0,height:void 0,loaded:void 0,broken:!1,x:0,y:0,touched:!1,maskTouched:!1,rotate:0,scale:1,CX:0,CY:0,lastX:0,lastY:0,lastCX:0,lastCY:0,lastScale:1,touchTime:0,touchLength:0,pause:!0,stopRaf:!0,reach:void 0};function A(t){var n=t.item,o=n.src,l=n.render,c=n.width,s=void 0===c?0:c,f=n.height,g=void 0===f?0:f,p=n.originRef,w=t.visible,b=t.speed,E=t.easing,y=t.wrapClassName,R=t.className,V=t.style,F=t.loadingElement,X=t.brokenElement,T=t.onPhotoTap,A=t.onMaskTap,q=t.onReachMove,D=t.onReachUp,H=t.onPhotoResize,O=t.isActive,B=t.expose,z=u(I),j=z[0],K=z[1],U=e.useRef(0),G=Y(),J=j.naturalWidth,Q=void 0===J?s:J,Z=j.naturalHeight,$=void 0===Z?g:Z,ee=j.width,te=void 0===ee?s:ee,ne=j.height,re=void 0===ne?g:ne,ie=j.loaded,oe=void 0===ie?!o:ie,ae=j.broken,ue=j.x,le=j.y,ce=j.touched,se=j.stopRaf,de=j.maskTouched,fe=j.rotate,he=j.scale,ve=j.CX,me=j.CY,ge=j.lastX,pe=j.lastY,we=j.lastCX,be=j.lastCY,Ee=j.lastScale,ye=j.touchTime,Re=j.touchLength,xe=j.pause,Ce=j.reach,Pe=a({onScale:function(e){return Se(h(e))},onRotate:function(e){fe!==e&&(B({rotate:e}),K(i({rotate:e},_(Q,$,e))))}});function Se(e,t,n){he!==e&&(B({scale:e}),K(i({scale:e},P(ue,le,te,re,he,e,t,n),e<=1&&{x:0,y:0})))}var _e=k(function(e,t,n){if(void 0===n&&(n=0),(ce||de)&&O){var r=S(fe,te,re),o=r[0],a=r[1];if(0===n&&0===U.current){var u=Math.abs(e-ve)<=20,l=Math.abs(t-me)<=20;if(u&&l)return void K({lastCX:e,lastCY:t});U.current=u?t>me?3:2:1}var c,s=e-we,d=t-be;if(0===n){var f=C(s+ge,he,o,innerWidth)[0],v=C(d+pe,he,a,innerHeight);c=function(e,t,n,r){return t&&1===e||"x"===r?"x":n&&e>1||"y"===r?"y":void 0}(U.current,f,v[0],Ce),void 0!==c&&q(c,e,t,he)}if("x"===c||de)return void K({reach:"x"});var m=h(he+(n-Re)/100/2*he,Q/te,.2);B({scale:m}),K(i({touchLength:n,reach:c,scale:m},P(ue,le,te,re,he,m,e,t,s,d)))}},{maxWait:8});function ke(e){return!se&&!ce&&(G.current&&K(i({},e,{pause:w})),G.current)}var Me,Ve,We,Ne,Ye,Fe,Xe,Te,Le=(Ye=function(e){return ke({x:e})},Fe=function(e){return ke({y:e})},Xe=function(e){return G.current&&(B({scale:e}),K({scale:e})),!ce&&G.current},Te=a({X:function(e){return Ye(e)},Y:function(e){return Fe(e)},S:function(e){return Xe(e)}}),function(e,t,n,r,i,o,a,u,l,c,s){var d=S(c,i,o),f=d[0],h=d[1],v=C(e,u,f,innerWidth),m=v[0],g=v[1],p=C(t,u,h,innerHeight),w=p[0],b=p[1],E=Date.now()-s;if(E>=200||u!==a||Math.abs(l-a)>1){var y=P(e,t,i,o,a,u),R=y.x,x=y.y,_=m?g:R!==e?R:null,k=w?b:x!==t?x:null;return null!==_&&W(e,_,Te.X),null!==k&&W(t,k,Te.Y),void(u!==a&&W(a,u,Te.S))}var V=(e-n)/E,N=(t-r)/E,Y=Math.sqrt(Math.pow(V,2)+Math.pow(N,2)),F=!1,X=!1;!function(e,t){var n,r=e,i=0,o=0,a=function(o){n||(n=o);var a=o-n,c=Math.sign(e),s=-.001*c,d=Math.sign(-r)*Math.pow(r,2)*2e-4,f=r*a+(s+d)*Math.pow(a,2)/2;i+=f,n=o,c*(r+=(s+d)*a)<=0?l():t(i)?u():l()};function u(){o=requestAnimationFrame(a)}function l(){cancelAnimationFrame(o)}u()}(Y,function(n){var r=e+n*(V/Y),i=t+n*(N/Y),o=C(r,a,f,innerWidth),u=o[0],l=o[1],c=C(i,a,h,innerHeight),s=c[0],d=c[1];if(u&&!F&&(F=!0,m?W(r,l,Te.X):M(l,r+(r-l),Te.X)),s&&!X&&(X=!0,w?W(i,d,Te.Y):M(d,i+(i-d),Te.Y)),F&&X)return!1;var v=F||Te.X(l),g=X||Te.Y(d);return v&&g})}),Ie=(Me=T,Ve=function(e,t){Ce||Se(1!==he?1:Math.max(2,Q/te),e,t)},We=e.useRef(0),Ne=k(function(){We.current=0,Me.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var e=[].slice.call(arguments);We.current+=1,Ne.apply(void 0,e),We.current>=2&&(Ne.cancel(),We.current=0,Ve.apply(void 0,e))});function Ae(e,t){if(U.current=0,(ce||de)&&O){K({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var n=h(he,Q/te);if(Le(ue,le,ge,pe,te,re,he,n,Ee,fe,ye),D(e,t),ve===e&&me===t){if(ce)return void Ie(e,t);de&&A(e,t)}}}function qe(e,t,n){void 0===n&&(n=0),K({touched:!0,CX:e,CY:t,lastCX:e,lastCY:t,lastX:ue,lastY:le,lastScale:he,touchLength:n,touchTime:Date.now()})}function De(e){K({maskTouched:!0,CX:e.clientX,CY:e.clientY,lastX:ue,lastY:le})}m(d?void 0:"mousemove",function(e){e.preventDefault(),_e(e.clientX,e.clientY)}),m(d?void 0:"mouseup",function(e){Ae(e.clientX,e.clientY)}),m(d?"touchmove":void 0,function(e){e.preventDefault();var t=x(e);_e.apply(void 0,t)},{passive:!1}),m(d?"touchend":void 0,function(e){var t=e.changedTouches[0];Ae(t.clientX,t.clientY)},{passive:!1}),m("resize",k(function(){oe&&!ce&&(K(_(Q,$,fe)),H())},{maxWait:8})),v(function(){O&&B(i({scale:he,rotate:fe},Pe))},[O]);var He=function(t,n,r,i,o,l,c,s,d,f){var h=function(t,n,r,i,o){var a=e.useRef(!1),l=u({lead:!0,scale:r}),c=l[0],s=c.lead,d=c.scale,f=l[1],h=k(function(e){try{return o(!0),f({lead:!1,scale:e}),Promise.resolve()}catch(e){return Promise.reject(e)}},{wait:i});return v(function(){a.current?(o(!1),f({lead:!0}),h(r)):a.current=!0},[r]),s?[t*d,n*d,r/d]:[t*r,n*r,1]}(l,c,s,d,f),m=h[0],g=h[1],p=h[2],w=function(t,n,r,i,o){var u=e.useState(N),l=u[0],c=u[1],s=e.useState(0),d=s[0],f=s[1],h=e.useRef(),v=a({OK:function(){return t&&f(4)}});function m(e){o(!1),f(e)}return e.useEffect(function(){if(h.current||(h.current=Date.now()),r){if(function(e,t){var n=e&&e.current;if(n&&1===n.nodeType){var r=n.getBoundingClientRect();t({T:r.top,L:r.left,W:r.width,H:r.height,FIT:"IMG"===n.tagName?getComputedStyle(n).objectFit:void 0})}}(n,c),t)return Date.now()-h.current<250?(f(1),requestAnimationFrame(function(){f(2),requestAnimationFrame(function(){return m(3)})}),void setTimeout(v.OK,i)):void f(4);m(5)}},[t,r]),[d,l]}(t,n,r,d,f),b=w[0],E=w[1],y=E.W,R=E.FIT,x=innerWidth/2,C=innerHeight/2,P=b<3||b>4;return[P?y?E.L:x:i+(x-l*s/2),P?y?E.T:C:o+(C-c*s/2),m,P&&R?m*(E.H/y):g,0===b?p:P?y/(l*s)||.01:p,P?R?1:0:1,b,R]}(w,p,oe,ue,le,te,re,he,b,function(e){return K({pause:e})}),Oe=He[4],Be=He[6],ze="transform "+b+"ms "+E,je={className:R,onMouseDown:d?void 0:function(e){e.stopPropagation(),0===e.button&&qe(e.clientX,e.clientY,0)},onTouchStart:d?function(e){e.stopPropagation(),qe.apply(void 0,x(e))}:void 0,onWheel:function(e){if(!Ce){var t=h(he-e.deltaY/100/2,Q/te);K({stopRaf:!0}),Se(t,e.clientX,e.clientY)}},style:{width:He[2]+"px",height:He[3]+"px",opacity:He[5],objectFit:4===Be?void 0:He[7],transform:fe?"rotate("+fe+"deg)":void 0,transition:Be>2?ze+", opacity "+b+"ms ease, height "+(Be<4?b/2:Be>4?b:0)+"ms "+E:void 0}};return r.default.createElement("div",{className:"PhotoView__PhotoWrap"+(y?" "+y:""),style:V,onMouseDown:!d&&O?De:void 0,onTouchStart:d&&O?function(e){return De(e.touches[0])}:void 0},r.default.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+Oe+", 0, 0, "+Oe+", "+He[0]+", "+He[1]+")",transition:ce||xe?void 0:ze,willChange:O?"transform":void 0}},o?r.default.createElement(L,i({src:o,loaded:oe,broken:ae},je,{onPhotoLoad:function(e){K(i({},e,e.loaded&&_(e.naturalWidth||0,e.naturalHeight||0,fe)))},loadingElement:F,brokenElement:X})):l&&l({attrs:je,scale:Oe,rotate:fe})))}var q={x:0,touched:!1,pause:!1,lastCX:void 0,lastCY:void 0,bg:void 0,lastBg:void 0,overlay:!0,minimal:!0,scale:1,rotate:0};function D(t){var n=t.loop,i=void 0===n?3:n,o=t.speed,l=t.easing,h=t.photoClosable,g=t.maskClosable,y=void 0===g||g,x=t.maskOpacity,C=void 0===x?1:x,P=t.pullClosable,S=void 0===P||P,_=t.pullAction,k=t.bannerVisible,M=void 0===k||k,V=t.overlayRender,W=t.toolbarRender,N=t.showBackdropImage,Y=t.disableScroll,F=void 0===Y||Y,X=t.toolbarLeftRender,T=t.toolbarRightRender,L=t.sidebarWidth,I=t.sidebarLeftRender,D=t.sidebarRightRender,H=t.className,O=t.maskClassName,B=t.photoClassName,z=t.photoWrapClassName,j=t.loadingElement,K=t.brokenElement,U=t.images,G=t.index,J=void 0===G?0:G,Q=t.onIndexChange,Z=t.visible,$=t.onClose,ee=t.afterClose,te=t.portalContainer,ne=t.fullScreen,re=t.onFullScreen,ie=e.useRef(),oe=u(q),ae=oe[0],ue=oe[1],le=e.useState(0),ce=le[0],se=le[1],de=ae.x,fe=ae.touched,he=ae.pause,ve=ae.lastCX,me=ae.lastCY,ge=ae.bg,pe=void 0===ge?C:ge,we=ae.lastBg,be=ae.overlay,Ee=ae.minimal,ye=ae.scale,Re=ae.rotate,xe=ae.onScale,Ce=ae.onRotate,Pe=t.hasOwnProperty("index"),Se=Pe?J:ce,_e=Pe?Q:se,ke=e.useRef(Se),Me=U.length,Ve=U[Se],We="boolean"==typeof i?i:Me>i,Ne=function(t,n){var r=e.useReducer(function(e){return!e},!1)[1],i=e.useRef(0),o=function(n){var r=e.useRef(n);function o(e){r.current=e}return e.useMemo(function(){!function(e){t?(e(t),i.current=1):i.current=2}(o)},[n]),[r.current,o]}(t),a=o[1];return[o[0],i.current,function(){r(),2===i.current&&(a(!1),n&&n()),i.current=0}]}(Z,ee),Ye=Ne[0],Fe=Ne[1],Xe=Ne[2];v(function(){if(Ye)return ue({pause:!0,x:Se*-(innerWidth+s)}),void(ke.current=Se);ue(q)},[Ye]);var Te=a({close:function(e){Ce&&Ce(0),ue({overlay:!0,lastBg:pe}),$(e)},changeIndex:function(e,t){void 0===t&&(t=!1);var n=We?ke.current+(e-Se):e,r=Me-1,i=f(n,0,r),o=We?n:i,a=innerWidth+s;ue({touched:!1,lastCX:void 0,lastCY:void 0,x:-a*o,pause:t}),ke.current=o,_e&&_e(We?e<0?r:e>r?0:e:i)}}),Le=Te.close,Ie=Te.changeIndex,Ae=e.useCallback(function(){re(!ne)},[ne,re]),qe=e.useMemo(function(){return function(){!document.fullscreenElement&&ne&&Ae()}},[ne,Ae]),De=e.useMemo(function(){return function(){if(document.fullscreenElement)document.exitFullscreen();else if(ne){var e=ie.current;if(!e)return;!function(e){try{e&&(e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen&&e.msRequestFullscreen())}catch(e){console.log("Error al intentar activar el modo de pantalla completa",e)}}(e)}}},[ne]);function He(e){return e?Le():ue({overlay:!be})}function Oe(){ue({x:-(innerWidth+s)*Se,lastCX:void 0,lastCY:void 0,pause:!0}),ke.current=Se}function Be(e,t,n,r){"x"===e?function(e){if(void 0!==ve){var t=e-ve,n=t;!We&&(0===Se&&t>0||Se===Me-1&&t<0)&&(n=t/2),ue({touched:!0,lastCX:ve,x:-(innerWidth+s)*ke.current+n,pause:!1})}else ue({touched:!0,lastCX:e,x:de,pause:!1})}(t):"y"===e&&function(e,t){if(void 0!==me){var n=null===C?null:f(C,.01,C-Math.abs(e-me)/100/4);ue({touched:!0,lastCY:me,bg:1===t?n:C,minimal:1===t})}else ue({touched:!0,lastCY:e,bg:pe,minimal:!0})}(n,r)}function ze(e,t){var n=e-(null!=ve?ve:e),r=t-(null!=me?me:t),i=!1;if(n<-40)Ie(Se+1);else if(n>40)Ie(Se-1);else{var o=-(innerWidth+s)*ke.current;Math.abs(r)>100&&Ee&&S?(i=!0,Le()):Math.abs(r)>100&&Ee&&"function"==typeof _&&_({direction:r<0?"top":"bottom",offsetY:r}),ue({touched:!1,x:o,lastCX:void 0,lastCY:void 0,bg:C,overlay:!!i||be})}}e.useEffect(function(){if(ie.current)return De(),document.addEventListener("fullscreenchange",qe),function(){document.removeEventListener("fullscreenchange",qe)}},[ne,qe,De]),m("keydown",function(e){if(Z)switch(e.key){case"ArrowLeft":Ie(Se-1,!1);break;case"ArrowRight":Ie(Se+1,!1);break;case"Escape":Le()}});var je=function(t,n,r){return e.useMemo(function(){var e=t.length;return r?t.concat(t).concat(t).slice(e+n-1,e+n+2):t.slice(Math.max(n-1,0),Math.min(n+2,e+1))},[t,n,r])}(U,Se,We);if(!Ye)return null;var Ke=be&&!Fe,Ue=Z?pe:we,Ge=xe&&Ce&&{images:U,index:Se,visible:Z,onClose:Le,onIndexChange:Ie,overlayVisible:Ke,overlay:Ve&&Ve.overlay,scale:ye,rotate:Re,onScale:xe,onRotate:Ce,fullScreen:ne,fullScreenAvailable:document.documentElement.requestFullscreen||document.documentElement.mozRequestFullScreen||document.documentElement.webkitRequestFullscreen||document.documentElement.msRequestFullscreen,toggleFullScreen:function(){return re(!ne)}},Je=o?o(Fe):400,Qe=l?l(Fe):c,Ze=o?o(3):600,$e=l?l(3):c,et="number"==typeof L?L+"px":L,tt=innerWidth<=900;return r.default.createElement(p,{className:"PhotoView-Portal"+(Ke?"":" PhotoView-Slider__clean")+(Z?"":" PhotoView-Slider__willClose")+(H?" "+H:""),role:"dialog",onClick:function(e){return e.stopPropagation()},container:te},Z&&F&&r.default.createElement(E,null),r.default.createElement("div",{className:"PhotoView-Container"},I&&Ge&&!tt&&r.default.createElement("div",{className:"PhotoView-Sidebar PhotoView-Sidebar__Left "+(1===Fe?" PhotoView-Slider__fadeIn":2===Fe?" PhotoView-Slider__fadeOut":""),style:{width:et,transitionTimingFunction:Qe,transitionDuration:(fe?0:Je)+"ms",animationDuration:Je+"ms"}},I(Ge)),r.default.createElement("div",{ref:ie,className:"PhotoView-Viewer"},r.default.createElement("div",{className:"PhotoView-Slider__Backdrop"+(O?" "+O:"")+(1===Fe?" PhotoView-Slider__fadeIn":2===Fe?" PhotoView-Slider__fadeOut":"")+" "+(N?"with-backdrop-image":""),style:{background:N?"url("+Ve.src+")":Ue?"rgba(0, 0, 0, "+Ue+")":void 0,transitionTimingFunction:Qe,transitionDuration:(fe?0:Je)+"ms",animationDuration:Je+"ms"},onAnimationEnd:Xe}),r.default.createElement(R,{bannerVisible:M,index:Se,imageLength:Me,overlayParams:Ge,toolbarRender:W,toolbarLeftRender:X,toolbarRightRender:T}),je.map(function(e,t){var n=We||0!==Se?ke.current-1+t:Se+t;return r.default.createElement(A,{key:We?e.key+"/"+e.src+"/"+n:e.key,item:e,speed:Je,easing:Qe,visible:Z,onReachMove:Be,onReachUp:ze,onPhotoTap:function(){return He(h)},onMaskTap:function(){return He(y)},wrapClassName:z,className:B,style:{left:(innerWidth+s)*n+"px",transform:"translate3d("+de+"px, 0px, 0)",transition:fe||he?void 0:"transform "+Ze+"ms "+$e},loadingElement:j,brokenElement:K,onPhotoResize:Oe,isActive:ke.current===n,expose:ue})}),!d&&M&&r.default.createElement(r.default.Fragment,null,(We||0!==Se)&&r.default.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return Ie(Se-1,!0)}},r.default.createElement(w,null)),(We||Se+1<Me)&&r.default.createElement("div",{className:"PhotoView-Slider__ArrowRight",onClick:function(){return Ie(Se+1,!0)}},r.default.createElement(b,null))),V&&Ge&&r.default.createElement("div",{className:"PhotoView-Slider__Overlay"},V(Ge))),D&&Ge&&!tt&&r.default.createElement("div",{className:"PhotoView-Sidebar PhotoView-Sidebar__Right "+(1===Fe?" PhotoView-Slider__fadeIn":2===Fe?" PhotoView-Slider__fadeOut":""),style:{width:et,transitionTimingFunction:Qe,transitionDuration:(fe?0:Je)+"ms",animationDuration:Je+"ms"}},D(Ge))))}var H=["children","onIndexChange","onVisibleChange","sidebarLeftRender","sidebarRightRender","sidebarWidth"],O={images:[],visible:!1,index:0,fullScreen:!1};exports.PhotoProvider=function(t){var n=t.children,c=t.onIndexChange,s=t.onVisibleChange,d=t.sidebarLeftRender,f=t.sidebarRightRender,h=t.sidebarWidth,v=void 0===h?400:h,m=o(t,H),g=u(O),p=g[0],w=g[1],b=e.useRef(0),E=e.useRef(!1),y=p.images,R=p.visible,x=p.index,C=e.useCallback(function(){if(d||f){var e=Object.getOwnPropertyDescriptor(window,"innerWidth");!e||e.configurable||E.current!==p.fullScreen?(Object.defineProperty(window,"innerWidth",{get:function(){return window.outerWidth<=900||p.fullScreen?window.outerWidth:window.outerWidth-v},configurable:!0,enumerable:!0}),E.current=p.fullScreen):console.warn("innerWidth is already defined and is not configurable")}},[d,f,p.fullScreen,v]);e.useEffect(function(){C()},[]),e.useEffect(function(){C()},[p.fullScreen,C]);var P=a({nextId:function(){return b.current+=1},update:function(e){var t=y.findIndex(function(t){return t.key===e.key});if(t>-1){var n=y.slice();return n.splice(t,1,e),void w({images:n})}w(function(t){return{images:t.images.concat(e)}})},remove:function(e){w(function(t){var n=t.images.filter(function(t){return t.key!==e});return{images:n,index:Math.min(n.length-1,x)}})},show:function(e){var t=y.findIndex(function(t){return t.key===e});w({visible:!0,index:t}),s&&s(!0,t,p)}}),S=a({close:function(){w({visible:!1}),s&&s(!1,x,p)},changeIndex:function(e){w({index:e}),c&&c(e,p)},fullScreen:function(e){w({fullScreen:e})}}),_=e.useMemo(function(){return i({},p,P)},[p,P]);return r.default.createElement(l.Provider,{value:_},n,r.default.createElement(D,i({images:y,visible:R,index:x,fullScreen:p.fullScreen,onIndexChange:S.changeIndex,onClose:S.close,onFullScreen:S.fullScreen,sidebarWidth:v,sidebarLeftRender:d,sidebarRightRender:f},m)))},exports.PhotoSlider=D,exports.PhotoView=function(t){var n,r,o=t.src,u=t.render,c=t.overlay,s=t.width,d=t.height,f=t.triggers,h=void 0===f?["onClick"]:f,v=t.children,m=e.useContext(l),g=(n=function(){return m.nextId()},(r=e.useRef({sign:!1,fn:void 0}).current).sign||(r.sign=!0,r.fn=n()),r.fn),p=e.useRef(null);e.useImperativeHandle(null==v?void 0:v.ref,function(){return p.current}),e.useEffect(function(){return function(){m.remove(g)}},[]);var w=a({render:function(e){return u&&u(e)},show:function(e,t){m.show(g),function(e,t){if(v){var n=v.props[e];n&&n(t)}}(e,t)}}),b=e.useMemo(function(){var e={};return h.forEach(function(t){e[t]=w.show.bind(null,t)}),e},[]);return e.useEffect(function(){m.update({key:g,src:o,originRef:p,render:w.render,overlay:c,width:s,height:d})},[o]),v?e.Children.only(e.cloneElement(v,i({},b,{ref:p}))):null};
var e=require("react"),t=require("react-dom");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=/*#__PURE__*/n(e);function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(null,arguments)}function o(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function a(t){var n=e.useRef({fn:t,curr:void 0}).current;if(n.fn=t,!n.curr){var r=Object.create(null);Object.keys(t).forEach(function(e){r[e]=function(){var t;return(t=n.fn[e]).call.apply(t,[n.fn].concat([].slice.call(arguments)))}}),n.curr=r}return n.curr}function u(t){return e.useReducer(function(e,t){return i({},e,"function"==typeof t?t(e):t)},t)}var l=e.createContext(void 0),c="cubic-bezier(0.25, 0.8, 0.25, 1)",s=20,d="undefined"!=typeof window&&"ontouchstart"in window,f=function(e,t,n){return Math.max(Math.min(e,n),t)},h=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=0),f(e,1*(1-n),Math.max(6,t)*(1+n))},v="undefined"==typeof window||/ServerSideRendering/.test(navigator&&navigator.userAgent)?e.useEffect:e.useLayoutEffect;function m(t,n,r){var i=e.useRef(n);i.current=n,e.useEffect(function(){function e(e){i.current(e)}return t&&window.addEventListener(t,e,r),function(){t&&window.removeEventListener(t,e)}},[t])}var g=["container"];function p(e){var n=e.container,a=void 0===n?document.body:n,u=o(e,g);return t.createPortal(r.default.createElement("div",i({},u)),a)}function w(e){return r.default.createElement("svg",i({width:"44",height:"44",viewBox:"0 0 768 768"},e),r.default.createElement("path",{d:"M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"}))}function b(e){return r.default.createElement("svg",i({width:"44",height:"44",viewBox:"0 0 768 768"},e),r.default.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function E(){return e.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function y(e){return r.default.createElement("svg",i({width:"44",height:"44",viewBox:"0 0 768 768"},e),r.default.createElement("path",{d:"M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"}))}function R(e){var t=e.toolbarRender,n=e.overlayParams,i=e.toolbarLeftRender,o=e.toolbarRightRender;return r.default.createElement(r.default.Fragment,null,e.bannerVisible&&r.default.createElement("div",{className:"PhotoView-Slider__BannerWrap"},r.default.createElement("div",{className:"PhotoView-Slider__Counter"},e.index+1," / ",e.imageLength),r.default.createElement("div",{className:"PhotoView-Slider__BannerRight"},t&&n&&t(n),r.default.createElement(y,{className:"PhotoView-Slider__toolbarIcon",onClick:close}))),i&&n&&r.default.createElement("div",{className:"PhotoView-Slider__Toolbar PhotoView-Slider__Toolbar--Left"},i(n)),o&&n&&r.default.createElement("div",{className:"PhotoView-Slider__Toolbar PhotoView-Slider__Toolbar--Right"},o(n)))}function x(e){var t=e.touches[0],n=t.clientX,r=t.clientY;if(e.touches.length>=2){var i=e.touches[1],o=i.clientX,a=i.clientY;return[(n+o)/2,(r+a)/2,Math.sqrt(Math.pow(o-n,2)+Math.pow(a-r,2))]}return[n,r,0]}var C=function(e,t,n,r){var i,o=n*t,a=(o-r)/2,u=e;return o<=r?(i=1,u=0):e>0&&a-e<=0?(i=2,u=a):e<0&&a+e<=0&&(i=3,u=-a),[i,u]};function P(e,t,n,r,i,o,a,u,l,c){void 0===a&&(a=innerWidth/2),void 0===u&&(u=innerHeight/2),void 0===l&&(l=0),void 0===c&&(c=0);var s=C(e,o,n,innerWidth)[0],d=C(t,o,r,innerHeight),f=innerWidth/2,h=innerHeight/2;return{x:a-o/i*(a-(f+e))-f+(r/n>=3&&n*o===innerWidth?0:s?l/2:l),y:u-o/i*(u-(h+t))-h+(d[0]?c/2:c),lastCX:a,lastCY:u}}function S(e,t,n){var r=e%180!=0;return r?[n,t,r]:[t,n,r]}function _(e,t,n){var r=S(n,innerWidth,innerHeight),i=r[0],o=r[1],a=0,u=i,l=o,c=e/t*o,s=t/e*i;return e<i&&t<o?(u=e,l=t):e<i&&t>=o?u=c:e>=i&&t<o||e/t>i/o?l=s:t/e>=3&&!r[2]?a=((l=s)-o)/2:u=c,{width:u,height:l,x:0,y:a,pause:!0}}function k(t,n){var r=n.leading,i=void 0!==r&&r,o=n.maxWait,a=n.wait,u=void 0===a?o||0:a,l=e.useRef(t);l.current=t;var c=e.useRef(0),s=e.useRef(),d=function(){return s.current&&clearTimeout(s.current)},f=e.useCallback(function(){var e=[].slice.call(arguments),t=Date.now();function n(){c.current=t,d(),l.current.apply(null,e)}var r=c.current,a=t-r;if(0===r&&(i&&n(),c.current=t),void 0!==o){if(a>o)return void n()}else a<u&&(c.current=t);d(),s.current=setTimeout(function(){n(),c.current=0},u)},[u,o,i]);return f.cancel=d,f}var M=function(e,t,n){return W(e,t,n,100,function(e){return e},function(){return W(t,e,n)})},V=function(e){return 1-Math.pow(1-e,4)};function W(e,t,n,r,i,o){void 0===r&&(r=400),void 0===i&&(i=V);var a=t-e;if(0!==a){var u=Date.now(),l=0,c=function(){var t=Math.min(1,(Date.now()-u)/r);n(e+i(t)*a)&&t<1?s():(cancelAnimationFrame(l),t>=1&&o&&o())};s()}function s(){l=requestAnimationFrame(c)}}var N={T:0,L:0,W:0,H:0,FIT:void 0},Y=function(){var t=e.useRef(!1);return e.useEffect(function(){return t.current=!0,function(){t.current=!1}},[]),t},F=["className"];function T(e){var t=e.className,n=void 0===t?"":t,a=o(e,F);return r.default.createElement("div",i({className:"PhotoView__Spinner "+n},a),r.default.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},r.default.createElement("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),r.default.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var X=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function L(e){var t=e.src,n=e.loaded,a=e.broken,u=e.className,l=e.onPhotoLoad,c=e.loadingElement,s=e.brokenElement,d=o(e,X),f=Y();return t&&!a?r.default.createElement(r.default.Fragment,null,r.default.createElement("img",i({className:"PhotoView__Photo"+(u?" "+u:""),src:t,onLoad:function(e){var t=e.target;f.current&&l({loaded:!0,naturalWidth:t.naturalWidth,naturalHeight:t.naturalHeight})},onError:function(){f.current&&l({broken:!0})},alt:""},d)),!n&&(r.default.createElement("span",{className:"PhotoView__icon"},c)||r.default.createElement(T,{className:"PhotoView__icon"}))):s?r.default.createElement("span",{className:"PhotoView__icon"},"function"==typeof s?s({src:t}):s):null}var I={naturalWidth:void 0,naturalHeight:void 0,width:void 0,height:void 0,loaded:void 0,broken:!1,x:0,y:0,touched:!1,maskTouched:!1,rotate:0,scale:1,CX:0,CY:0,lastX:0,lastY:0,lastCX:0,lastCY:0,lastScale:1,touchTime:0,touchLength:0,pause:!0,stopRaf:!0,reach:void 0};function A(t){var n=t.item,o=n.src,l=n.render,c=n.width,s=void 0===c?0:c,f=n.height,g=void 0===f?0:f,p=n.originRef,w=t.visible,b=t.speed,E=t.easing,y=t.wrapClassName,R=t.className,V=t.style,F=t.loadingElement,T=t.brokenElement,X=t.onPhotoTap,A=t.onMaskTap,q=t.onReachMove,D=t.onReachUp,H=t.onPhotoResize,O=t.isActive,B=t.expose,z=u(I),j=z[0],K=z[1],U=e.useRef(0),G=Y(),J=j.naturalWidth,Q=void 0===J?s:J,Z=j.naturalHeight,$=void 0===Z?g:Z,ee=j.width,te=void 0===ee?s:ee,ne=j.height,re=void 0===ne?g:ne,ie=j.loaded,oe=void 0===ie?!o:ie,ae=j.broken,ue=j.x,le=j.y,ce=j.touched,se=j.stopRaf,de=j.maskTouched,fe=j.rotate,he=j.scale,ve=j.CX,me=j.CY,ge=j.lastX,pe=j.lastY,we=j.lastCX,be=j.lastCY,Ee=j.lastScale,ye=j.touchTime,Re=j.touchLength,xe=j.pause,Ce=j.reach,Pe=a({onScale:function(e){return Se(h(e))},onRotate:function(e){fe!==e&&(B({rotate:e}),K(i({rotate:e},_(Q,$,e))))}});function Se(e,t,n){he!==e&&(B({scale:e}),K(i({scale:e},P(ue,le,te,re,he,e,t,n),e<=1&&{x:0,y:0})))}var _e=k(function(e,t,n){if(void 0===n&&(n=0),(ce||de)&&O){var r=S(fe,te,re),o=r[0],a=r[1];if(0===n&&0===U.current){var u=Math.abs(e-ve)<=20,l=Math.abs(t-me)<=20;if(u&&l)return void K({lastCX:e,lastCY:t});U.current=u?t>me?3:2:1}var c,s=e-we,d=t-be;if(0===n){var f=C(s+ge,he,o,innerWidth)[0],v=C(d+pe,he,a,innerHeight);c=function(e,t,n,r){return t&&1===e||"x"===r?"x":n&&e>1||"y"===r?"y":void 0}(U.current,f,v[0],Ce),void 0!==c&&q(c,e,t,he)}if("x"===c||de)return void K({reach:"x"});var m=h(he+(n-Re)/100/2*he,Q/te,.2);B({scale:m}),K(i({touchLength:n,reach:c,scale:m},P(ue,le,te,re,he,m,e,t,s,d)))}},{maxWait:8});function ke(e){return!se&&!ce&&(G.current&&K(i({},e,{pause:w})),G.current)}var Me,Ve,We,Ne,Ye,Fe,Te,Xe,Le=(Ye=function(e){return ke({x:e})},Fe=function(e){return ke({y:e})},Te=function(e){return G.current&&(B({scale:e}),K({scale:e})),!ce&&G.current},Xe=a({X:function(e){return Ye(e)},Y:function(e){return Fe(e)},S:function(e){return Te(e)}}),function(e,t,n,r,i,o,a,u,l,c,s){var d=S(c,i,o),f=d[0],h=d[1],v=C(e,u,f,innerWidth),m=v[0],g=v[1],p=C(t,u,h,innerHeight),w=p[0],b=p[1],E=Date.now()-s;if(E>=200||u!==a||Math.abs(l-a)>1){var y=P(e,t,i,o,a,u),R=y.x,x=y.y,_=m?g:R!==e?R:null,k=w?b:x!==t?x:null;return null!==_&&W(e,_,Xe.X),null!==k&&W(t,k,Xe.Y),void(u!==a&&W(a,u,Xe.S))}var V=(e-n)/E,N=(t-r)/E,Y=Math.sqrt(Math.pow(V,2)+Math.pow(N,2)),F=!1,T=!1;!function(e,t){var n,r=e,i=0,o=0,a=function(o){n||(n=o);var a=o-n,c=Math.sign(e),s=-.001*c,d=Math.sign(-r)*Math.pow(r,2)*2e-4,f=r*a+(s+d)*Math.pow(a,2)/2;i+=f,n=o,c*(r+=(s+d)*a)<=0?l():t(i)?u():l()};function u(){o=requestAnimationFrame(a)}function l(){cancelAnimationFrame(o)}u()}(Y,function(n){var r=e+n*(V/Y),i=t+n*(N/Y),o=C(r,a,f,innerWidth),u=o[0],l=o[1],c=C(i,a,h,innerHeight),s=c[0],d=c[1];if(u&&!F&&(F=!0,m?W(r,l,Xe.X):M(l,r+(r-l),Xe.X)),s&&!T&&(T=!0,w?W(i,d,Xe.Y):M(d,i+(i-d),Xe.Y)),F&&T)return!1;var v=F||Xe.X(l),g=T||Xe.Y(d);return v&&g})}),Ie=(Me=X,Ve=function(e,t){Ce||Se(1!==he?1:Math.max(2,Q/te),e,t)},We=e.useRef(0),Ne=k(function(){We.current=0,Me.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var e=[].slice.call(arguments);We.current+=1,Ne.apply(void 0,e),We.current>=2&&(Ne.cancel(),We.current=0,Ve.apply(void 0,e))});function Ae(e,t){if(U.current=0,(ce||de)&&O){K({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var n=h(he,Q/te);if(Le(ue,le,ge,pe,te,re,he,n,Ee,fe,ye),D(e,t),ve===e&&me===t){if(ce)return void Ie(e,t);de&&A(e,t)}}}function qe(e,t,n){void 0===n&&(n=0),K({touched:!0,CX:e,CY:t,lastCX:e,lastCY:t,lastX:ue,lastY:le,lastScale:he,touchLength:n,touchTime:Date.now()})}function De(e){K({maskTouched:!0,CX:e.clientX,CY:e.clientY,lastX:ue,lastY:le})}m(d?void 0:"mousemove",function(e){e.preventDefault(),_e(e.clientX,e.clientY)}),m(d?void 0:"mouseup",function(e){Ae(e.clientX,e.clientY)}),m(d?"touchmove":void 0,function(e){e.preventDefault();var t=x(e);_e.apply(void 0,t)},{passive:!1}),m(d?"touchend":void 0,function(e){var t=e.changedTouches[0];Ae(t.clientX,t.clientY)},{passive:!1}),m("resize",k(function(){oe&&!ce&&(K(_(Q,$,fe)),H())},{maxWait:8})),v(function(){O&&B(i({scale:he,rotate:fe},Pe))},[O]);var He=function(t,n,r,i,o,l,c,s,d,f){var h=function(t,n,r,i,o){var a=e.useRef(!1),l=u({lead:!0,scale:r}),c=l[0],s=c.lead,d=c.scale,f=l[1],h=k(function(e){try{return o(!0),f({lead:!1,scale:e}),Promise.resolve()}catch(e){return Promise.reject(e)}},{wait:i});return v(function(){a.current?(o(!1),f({lead:!0}),h(r)):a.current=!0},[r]),s?[t*d,n*d,r/d]:[t*r,n*r,1]}(l,c,s,d,f),m=h[0],g=h[1],p=h[2],w=function(t,n,r,i,o){var u=e.useState(N),l=u[0],c=u[1],s=e.useState(0),d=s[0],f=s[1],h=e.useRef(),v=a({OK:function(){return t&&f(4)}});function m(e){o(!1),f(e)}return e.useEffect(function(){if(h.current||(h.current=Date.now()),r){if(function(e,t){var n=e&&e.current;if(n&&1===n.nodeType){var r=n.getBoundingClientRect();t({T:r.top,L:r.left,W:r.width,H:r.height,FIT:"IMG"===n.tagName?getComputedStyle(n).objectFit:void 0})}}(n,c),t)return Date.now()-h.current<250?(f(1),requestAnimationFrame(function(){f(2),requestAnimationFrame(function(){return m(3)})}),void setTimeout(v.OK,i)):void f(4);m(5)}},[t,r]),[d,l]}(t,n,r,d,f),b=w[0],E=w[1],y=E.W,R=E.FIT,x=innerWidth/2,C=innerHeight/2,P=b<3||b>4;return[P?y?E.L:x:i+(x-l*s/2),P?y?E.T:C:o+(C-c*s/2),m,P&&R?m*(E.H/y):g,0===b?p:P?y/(l*s)||.01:p,P?R?1:0:1,b,R]}(w,p,oe,ue,le,te,re,he,b,function(e){return K({pause:e})}),Oe=He[4],Be=He[6],ze="transform "+b+"ms "+E,je={className:R,onMouseDown:d?void 0:function(e){e.stopPropagation(),0===e.button&&qe(e.clientX,e.clientY,0)},onTouchStart:d?function(e){e.stopPropagation(),qe.apply(void 0,x(e))}:void 0,onWheel:function(e){if(!Ce){var t=h(he-e.deltaY/100/2,Q/te);K({stopRaf:!0}),Se(t,e.clientX,e.clientY)}},style:{width:He[2]+"px",height:He[3]+"px",opacity:He[5],objectFit:4===Be?void 0:He[7],transform:fe?"rotate("+fe+"deg)":void 0,transition:Be>2?ze+", opacity "+b+"ms ease, height "+(Be<4?b/2:Be>4?b:0)+"ms "+E:void 0}};return r.default.createElement("div",{className:"PhotoView__PhotoWrap"+(y?" "+y:""),style:V,onMouseDown:!d&&O?De:void 0,onTouchStart:d&&O?function(e){return De(e.touches[0])}:void 0},r.default.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+Oe+", 0, 0, "+Oe+", "+He[0]+", "+He[1]+")",transition:ce||xe?void 0:ze,willChange:O?"transform":void 0}},o?r.default.createElement(L,i({src:o,loaded:oe,broken:ae},je,{onPhotoLoad:function(e){K(i({},e,e.loaded&&_(e.naturalWidth||0,e.naturalHeight||0,fe)))},loadingElement:F,brokenElement:T})):l&&l({attrs:je,scale:Oe,rotate:fe})))}var q={x:0,touched:!1,pause:!1,lastCX:void 0,lastCY:void 0,bg:void 0,lastBg:void 0,overlay:!0,minimal:!0,scale:1,rotate:0};function D(t){var n=t.loop,i=void 0===n?3:n,o=t.speed,l=t.easing,h=t.photoClosable,g=t.maskClosable,y=void 0===g||g,x=t.maskOpacity,C=void 0===x?1:x,P=t.pullClosable,S=void 0===P||P,_=t.pullAction,k=t.bannerVisible,M=void 0===k||k,V=t.overlayRender,W=t.toolbarRender,N=t.showBackdropImage,Y=t.disableScroll,F=void 0===Y||Y,T=t.toolbarLeftRender,X=t.toolbarRightRender,L=t.toolbarBottomRender,I=t.sidebarWidth,D=t.sidebarLeftRender,H=t.sidebarRightRender,O=t.className,B=t.maskClassName,z=t.photoClassName,j=t.photoWrapClassName,K=t.loadingElement,U=t.brokenElement,G=t.images,J=t.index,Q=void 0===J?0:J,Z=t.onIndexChange,$=t.visible,ee=t.onClose,te=t.afterClose,ne=t.portalContainer,re=t.fullScreen,ie=t.onFullScreen,oe=e.useRef(),ae=u(q),ue=ae[0],le=ae[1],ce=e.useState(0),se=ce[0],de=ce[1],fe=ue.x,he=ue.touched,ve=ue.pause,me=ue.lastCX,ge=ue.lastCY,pe=ue.bg,we=void 0===pe?C:pe,be=ue.lastBg,Ee=ue.overlay,ye=ue.minimal,Re=ue.scale,xe=ue.rotate,Ce=ue.onScale,Pe=ue.onRotate,Se=t.hasOwnProperty("index"),_e=Se?Q:se,ke=Se?Z:de,Me=e.useRef(_e),Ve=G.length,We=G[_e],Ne="boolean"==typeof i?i:Ve>i,Ye=function(t,n){var r=e.useReducer(function(e){return!e},!1)[1],i=e.useRef(0),o=function(n){var r=e.useRef(n);function o(e){r.current=e}return e.useMemo(function(){!function(e){t?(e(t),i.current=1):i.current=2}(o)},[n]),[r.current,o]}(t),a=o[1];return[o[0],i.current,function(){r(),2===i.current&&(a(!1),n&&n()),i.current=0}]}($,te),Fe=Ye[0],Te=Ye[1],Xe=Ye[2];v(function(){if(Fe)return le({pause:!0,x:_e*-(innerWidth+s)}),void(Me.current=_e);le(q)},[Fe]);var Le=a({close:function(e){Pe&&Pe(0),le({overlay:!0,lastBg:we}),ee(e)},changeIndex:function(e,t){void 0===t&&(t=!1);var n=Ne?Me.current+(e-_e):e,r=Ve-1,i=f(n,0,r),o=Ne?n:i,a=innerWidth+s;le({touched:!1,lastCX:void 0,lastCY:void 0,x:-a*o,pause:t}),Me.current=o,ke&&ke(Ne?e<0?r:e>r?0:e:i)}}),Ie=Le.close,Ae=Le.changeIndex,qe=e.useCallback(function(){ie(!re)},[re,ie]),De=e.useMemo(function(){return function(){!document.fullscreenElement&&re&&qe()}},[re,qe]),He=e.useMemo(function(){return function(){if(document.fullscreenElement)document.exitFullscreen();else if(re){var e=oe.current;if(!e)return;!function(e){try{e&&(e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen&&e.msRequestFullscreen())}catch(e){console.log("Error al intentar activar el modo de pantalla completa",e)}}(e)}}},[re]);function Oe(e){return e?Ie():le({overlay:!Ee})}function Be(){le({x:-(innerWidth+s)*_e,lastCX:void 0,lastCY:void 0,pause:!0}),Me.current=_e}function ze(e,t,n,r){"x"===e?function(e){if(void 0!==me){var t=e-me,n=t;!Ne&&(0===_e&&t>0||_e===Ve-1&&t<0)&&(n=t/2),le({touched:!0,lastCX:me,x:-(innerWidth+s)*Me.current+n,pause:!1})}else le({touched:!0,lastCX:e,x:fe,pause:!1})}(t):"y"===e&&function(e,t){if(void 0!==ge){var n=null===C?null:f(C,.01,C-Math.abs(e-ge)/100/4);le({touched:!0,lastCY:ge,bg:1===t?n:C,minimal:1===t})}else le({touched:!0,lastCY:e,bg:we,minimal:!0})}(n,r)}function je(e,t){var n=e-(null!=me?me:e),r=t-(null!=ge?ge:t),i=!1;if(n<-40)Ae(_e+1);else if(n>40)Ae(_e-1);else{var o=-(innerWidth+s)*Me.current;Math.abs(r)>100&&ye&&S?(i=!0,Ie()):Math.abs(r)>100&&ye&&"function"==typeof _&&_({direction:r<0?"top":"bottom",offsetY:r}),le({touched:!1,x:o,lastCX:void 0,lastCY:void 0,bg:C,overlay:!!i||Ee})}}e.useEffect(function(){if(oe.current)return He(),document.addEventListener("fullscreenchange",De),function(){document.removeEventListener("fullscreenchange",De)}},[re,De,He]),m("keydown",function(e){if($)switch(e.key){case"ArrowLeft":Ae(_e-1,!1);break;case"ArrowRight":Ae(_e+1,!1);break;case"Escape":Ie()}});var Ke=function(t,n,r){return e.useMemo(function(){var e=t.length;return r?t.concat(t).concat(t).slice(e+n-1,e+n+2):t.slice(Math.max(n-1,0),Math.min(n+2,e+1))},[t,n,r])}(G,_e,Ne);if(!Fe)return null;var Ue=Ee&&!Te,Ge=$?we:be,Je=Ce&&Pe&&{images:G,index:_e,visible:$,onClose:Ie,onIndexChange:Ae,overlayVisible:Ue,overlay:We&&We.overlay,scale:Re,rotate:xe,onScale:Ce,onRotate:Pe,fullScreen:re,fullScreenAvailable:document.documentElement.requestFullscreen||document.documentElement.mozRequestFullScreen||document.documentElement.webkitRequestFullscreen||document.documentElement.msRequestFullscreen,toggleFullScreen:function(){return ie(!re)}},Qe=o?o(Te):400,Ze=l?l(Te):c,$e=o?o(3):600,et=l?l(3):c,tt="number"==typeof I?I+"px":I,nt=innerWidth<=900;return r.default.createElement(p,{className:"PhotoView-Portal"+(Ue?"":" PhotoView-Slider__clean")+($?"":" PhotoView-Slider__willClose")+(O?" "+O:""),role:"dialog",onClick:function(e){return e.stopPropagation()},container:ne},$&&F&&r.default.createElement(E,null),r.default.createElement("div",{className:"PhotoView-Container"},D&&Je&&!nt&&r.default.createElement("div",{className:"PhotoView-Sidebar PhotoView-Sidebar__Left "+(1===Te?" PhotoView-Slider__fadeIn":2===Te?" PhotoView-Slider__fadeOut":""),style:{width:tt,transitionTimingFunction:Ze,transitionDuration:(he?0:Qe)+"ms",animationDuration:Qe+"ms"}},D(Je)),r.default.createElement("div",{ref:oe,className:"PhotoView-Viewer"},r.default.createElement("div",{className:"PhotoView-Slider__Backdrop"+(B?" "+B:"")+(1===Te?" PhotoView-Slider__fadeIn":2===Te?" PhotoView-Slider__fadeOut":"")+" "+(N?"with-backdrop-image":""),style:{background:N?"url("+We.src+")":Ge?"rgba(0, 0, 0, "+Ge+")":void 0,transitionTimingFunction:Ze,transitionDuration:(he?0:Qe)+"ms",animationDuration:Qe+"ms"},onAnimationEnd:Xe}),r.default.createElement(R,{bannerVisible:M,index:_e,imageLength:Ve,overlayParams:Je,toolbarRender:W,toolbarLeftRender:T,toolbarRightRender:X,toolbarBottomRender:L}),Ke.map(function(e,t){var n=Ne||0!==_e?Me.current-1+t:_e+t;return r.default.createElement(A,{key:Ne?e.key+"/"+e.src+"/"+n:e.key,item:e,speed:Qe,easing:Ze,visible:$,onReachMove:ze,onReachUp:je,onPhotoTap:function(){return Oe(h)},onMaskTap:function(){return Oe(y)},wrapClassName:j,className:z,style:{left:(innerWidth+s)*n+"px",transform:"translate3d("+fe+"px, 0px, 0)",transition:he||ve?void 0:"transform "+$e+"ms "+et},loadingElement:K,brokenElement:U,onPhotoResize:Be,isActive:Me.current===n,expose:le})}),!d&&M&&r.default.createElement(r.default.Fragment,null,(Ne||0!==_e)&&r.default.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return Ae(_e-1,!0)}},r.default.createElement(w,null)),(Ne||_e+1<Ve)&&r.default.createElement("div",{className:"PhotoView-Slider__ArrowRight",onClick:function(){return Ae(_e+1,!0)}},r.default.createElement(b,null))),V&&Je&&r.default.createElement("div",{className:"PhotoView-Slider__Overlay"},V(Je))),H&&Je&&!nt&&r.default.createElement("div",{className:"PhotoView-Sidebar PhotoView-Sidebar__Right "+(1===Te?" PhotoView-Slider__fadeIn":2===Te?" PhotoView-Slider__fadeOut":""),style:{width:tt,transitionTimingFunction:Ze,transitionDuration:(he?0:Qe)+"ms",animationDuration:Qe+"ms"}},H(Je)),L&&Je&&r.default.createElement("div",{className:"PhotoView-Slider__Toolbar PhotoView-Slider__Toolbar--Bottom",style:{width:"calc(100% - "+(nt?0:tt)+")"}},L(Je))))}var H=["children","onIndexChange","onVisibleChange","sidebarLeftRender","sidebarRightRender","sidebarWidth"],O={images:[],visible:!1,index:0,fullScreen:!1};exports.PhotoProvider=function(t){var n=t.children,c=t.onIndexChange,s=t.onVisibleChange,d=t.sidebarLeftRender,f=t.sidebarRightRender,h=t.sidebarWidth,v=void 0===h?400:h,m=o(t,H),g=u(O),p=g[0],w=g[1],b=e.useRef(0),E=e.useRef(!1),y=p.images,R=p.visible,x=p.index,C=e.useCallback(function(){if(d||f){var e=Object.getOwnPropertyDescriptor(window,"innerWidth");!e||e.configurable||E.current!==p.fullScreen?(Object.defineProperty(window,"innerWidth",{get:function(){return window.outerWidth<=900||p.fullScreen?window.outerWidth:window.outerWidth-v},configurable:!0,enumerable:!0}),E.current=p.fullScreen):console.warn("innerWidth is already defined and is not configurable")}},[d,f,p.fullScreen,v]);e.useEffect(function(){C()},[]),e.useEffect(function(){C()},[p.fullScreen,C]);var P=a({nextId:function(){return b.current+=1},update:function(e){var t=y.findIndex(function(t){return t.key===e.key});if(t>-1){var n=y.slice();return n.splice(t,1,e),void w({images:n})}w(function(t){return{images:t.images.concat(e)}})},remove:function(e){w(function(t){var n=t.images.filter(function(t){return t.key!==e});return{images:n,index:Math.min(n.length-1,x)}})},show:function(e){var t=y.findIndex(function(t){return t.key===e});w({visible:!0,index:t}),s&&s(!0,t,p)}}),S=a({close:function(){w({visible:!1}),s&&s(!1,x,p)},changeIndex:function(e){w({index:e}),c&&c(e,p)},fullScreen:function(e){w({fullScreen:e})}}),_=e.useMemo(function(){return i({},p,P)},[p,P]);return r.default.createElement(l.Provider,{value:_},n,r.default.createElement(D,i({images:y,visible:R,index:x,fullScreen:p.fullScreen,onIndexChange:S.changeIndex,onClose:S.close,onFullScreen:S.fullScreen,sidebarWidth:v,sidebarLeftRender:d,sidebarRightRender:f},m)))},exports.PhotoSlider=D,exports.PhotoView=function(t){var n,r,o=t.src,u=t.render,c=t.overlay,s=t.width,d=t.height,f=t.triggers,h=void 0===f?["onClick"]:f,v=t.children,m=e.useContext(l),g=(n=function(){return m.nextId()},(r=e.useRef({sign:!1,fn:void 0}).current).sign||(r.sign=!0,r.fn=n()),r.fn),p=e.useRef(null);e.useImperativeHandle(null==v?void 0:v.ref,function(){return p.current}),e.useEffect(function(){return function(){m.remove(g)}},[]);var w=a({render:function(e){return u&&u(e)},show:function(e,t){m.show(g),function(e,t){if(v){var n=v.props[e];n&&n(t)}}(e,t)}}),b=e.useMemo(function(){var e={};return h.forEach(function(t){e[t]=w.show.bind(null,t)}),e},[]);return e.useEffect(function(){m.update({key:g,src:o,originRef:p,render:w.render,overlay:c,width:s,height:d})},[o]),v?e.Children.only(e.cloneElement(v,i({},b,{ref:p}))):null};
//# sourceMappingURL=react-photo-view.js.map

@@ -1,2 +0,2 @@

import e,{useRef as t,useReducer as n,createContext as o,useEffect as r,useLayoutEffect as i,useMemo as a,useCallback as c,useState as l,useContext as s,useImperativeHandle as u,Children as d,cloneElement as h}from"react";import{createPortal as m}from"react-dom";function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},f.apply(null,arguments)}function g(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.includes(o))continue;n[o]=e[o]}return n}function v(e){const{current:n}=t({fn:e,curr:void 0});if(n.fn=e,!n.curr){const t=Object.create(null);Object.keys(e).forEach(e=>{t[e]=(...t)=>n.fn[e].call(n.fn,...t)}),n.curr=t}return n.curr}function w(e){return n((e,t)=>f({},e,"function"==typeof t?t(e):t),e)}var b=o(void 0);const p="cubic-bezier(0.25, 0.8, 0.25, 1)",E=20,y=1,x="undefined"!=typeof window&&"ontouchstart"in window,C=(e,t,n)=>Math.max(Math.min(e,n),t),S=(e,t=0,n=0)=>C(e,1*(1-n),Math.max(6,t)*(1+n));var _="undefined"==typeof window||/ServerSideRendering/.test(navigator&&navigator.userAgent)?r:i;function P(e,n,o){const i=t(n);i.current=n,r(()=>{function t(e){i.current(e)}return e&&window.addEventListener(e,t,o),()=>{e&&window.removeEventListener(e,t)}},[e])}const R=["container"];function k(t){let{container:n=document.body}=t,o=g(t,R);return m(e.createElement("div",f({},o)),n)}function V(t){return e.createElement("svg",f({width:"44",height:"44",viewBox:"0 0 768 768"},t),e.createElement("path",{d:"M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"}))}function W(t){return e.createElement("svg",f({width:"44",height:"44",viewBox:"0 0 768 768"},t),e.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function $(){return r(()=>{const{style:e}=document.body,t=e.overflow;return e.overflow="hidden",()=>{e.overflow=t}},[]),null}function N(t){return e.createElement("svg",f({width:"44",height:"44",viewBox:"0 0 768 768"},t),e.createElement("path",{d:"M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"}))}function Y({bannerVisible:t,index:n,imageLength:o,toolbarRender:r,overlayParams:i,toolbarLeftRender:a,toolbarRightRender:c}){return e.createElement(e.Fragment,null,t&&e.createElement("div",{className:"PhotoView-Slider__BannerWrap"},e.createElement("div",{className:"PhotoView-Slider__Counter"},n+1," / ",o),e.createElement("div",{className:"PhotoView-Slider__BannerRight"},r&&i&&r(i),e.createElement(N,{className:"PhotoView-Slider__toolbarIcon",onClick:close}))),a&&i&&e.createElement("div",{className:"PhotoView-Slider__Toolbar PhotoView-Slider__Toolbar--Left"},a(i)),c&&i&&e.createElement("div",{className:"PhotoView-Slider__Toolbar PhotoView-Slider__Toolbar--Right"},c(i)))}function F(e){const{clientX:t,clientY:n}=e.touches[0];if(e.touches.length>=2){const{clientX:o,clientY:r}=e.touches[1];return[(t+o)/2,(n+r)/2,Math.sqrt((o-t)**2+(r-n)**2)]}return[t,n,0]}const X=(e,t,n,o)=>{const r=n*t,i=(r-o)/2;let a,c=e;return r<=o?(a=1,c=0):e>0&&i-e<=0?(a=2,c=i):e<0&&i+e<=0&&(a=3,c=-i),[a,c]};function M(e,t,n,o,r,i,a=innerWidth/2,c=innerHeight/2,l=0,s=0){const[u]=X(e,i,n,innerWidth),[d]=X(t,i,o,innerHeight),h=innerWidth/2,m=innerHeight/2;return{x:a-i/r*(a-(h+e))-h+(o/n>=3&&n*i===innerWidth?0:u?l/2:l),y:c-i/r*(c-(m+t))-m+(d?s/2:s),lastCX:a,lastCY:c}}function T(e,t,n){const o=e%180!=0;return o?[n,t,o]:[t,n,o]}function L(e,t,n){const[o,r,i]=T(n,innerWidth,innerHeight);let a=0,c=o,l=r;const s=e/t*r,u=t/e*o;return e<o&&t<r?(c=e,l=t):e<o&&t>=r?c=s:e>=o&&t<r||e/t>o/r?l=u:t/e>=3&&!i?(l=u,a=(l-r)/2):c=s,{width:c,height:l,x:0,y:a,pause:!0}}function A(e,{leading:n=!1,maxWait:o,wait:r=o||0}){const i=t(e);i.current=e;const a=t(0),l=t(),s=()=>l.current&&clearTimeout(l.current),u=c((...e)=>{const t=Date.now();function c(){a.current=t,s(),i.current.apply(null,e)}const u=a.current,d=t-u;if(0===u&&(n&&c(),a.current=t),void 0!==o){if(d>o)return void c()}else d<r&&(a.current=t);s(),l.current=setTimeout(()=>{c(),a.current=0},r)},[r,o,n]);return u.cancel=s,u}const I=(e,t,n)=>D(e,t,n,100,e=>e,()=>D(t,e,n)),q=e=>1-(1-e)**4;function D(e,t,n,o=400,r=q,i){const a=t-e;if(0===a)return;const c=Date.now();let l=0;const s=()=>{const t=Math.min(1,(Date.now()-c)/o);n(e+r(t)*a)&&t<1?u():(cancelAnimationFrame(l),t>=1&&i&&i())};function u(){l=requestAnimationFrame(s)}u()}const O={T:0,L:0,W:0,H:0,FIT:void 0},H=()=>{const e=t(!1);return r(()=>(e.current=!0,()=>{e.current=!1}),[]),e},B=["className"];function z(t){let{className:n=""}=t,o=g(t,B);return e.createElement("div",f({className:`PhotoView__Spinner ${n}`},o),e.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},e.createElement("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),e.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}const j=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function K(t){let{src:n,loaded:o,broken:r,className:i,onPhotoLoad:a,loadingElement:c,brokenElement:l}=t,s=g(t,j);const u=H();return n&&!r?e.createElement(e.Fragment,null,e.createElement("img",f({className:"PhotoView__Photo"+(i?` ${i}`:""),src:n,onLoad:function(e){const{naturalWidth:t,naturalHeight:n}=e.target;u.current&&a({loaded:!0,naturalWidth:t,naturalHeight:n})},onError:function(){u.current&&a({broken:!0})},alt:""},s)),!o&&(e.createElement("span",{className:"PhotoView__icon"},c)||e.createElement(z,{className:"PhotoView__icon"}))):l?e.createElement("span",{className:"PhotoView__icon"},"function"==typeof l?l({src:n}):l):null}const U={naturalWidth:void 0,naturalHeight:void 0,width:void 0,height:void 0,loaded:void 0,broken:!1,x:0,y:0,touched:!1,maskTouched:!1,rotate:0,scale:1,CX:0,CY:0,lastX:0,lastY:0,lastCX:0,lastCY:0,lastScale:1,touchTime:0,touchLength:0,pause:!0,stopRaf:!0,reach:void 0};function G({item:{src:n,render:o,width:i=0,height:a=0,originRef:c},visible:s,speed:u,easing:d,wrapClassName:h,className:m,style:g,loadingElement:b,brokenElement:p,onPhotoTap:E,onMaskTap:y,onReachMove:C,onReachUp:R,onPhotoResize:k,isActive:V,expose:W}){const[$,N]=w(U),Y=t(0),q=H(),{naturalWidth:B=i,naturalHeight:z=a,width:j=i,height:G=a,loaded:J=!n,broken:Q,x:Z,y:ee,touched:te,stopRaf:ne,maskTouched:oe,rotate:re,scale:ie,CX:ae,CY:ce,lastX:le,lastY:se,lastCX:ue,lastCY:de,lastScale:he,touchTime:me,touchLength:fe,pause:ge,reach:ve}=$,we=v({onScale:e=>be(S(e)),onRotate(e){re!==e&&(W({rotate:e}),N(f({rotate:e},L(B,z,e))))}});function be(e,t,n){ie!==e&&(W({scale:e}),N(f({scale:e},M(Z,ee,j,G,ie,e,t,n),e<=1&&{x:0,y:0})))}const pe=A((e,t,n=0)=>{if((te||oe)&&V){const[o,r]=T(re,j,G);if(0===n&&0===Y.current){const n=Math.abs(e-ae)<=20,o=Math.abs(t-ce)<=20;if(n&&o)return void N({lastCX:e,lastCY:t});Y.current=n?t>ce?3:2:1}const i=e-ue,a=t-de;let c;if(0===n){const[n]=X(i+le,ie,o,innerWidth),[l]=X(a+se,ie,r,innerHeight);c=((e,t,n,o)=>t&&1===e||"x"===o?"x":n&&e>1||"y"===o?"y":void 0)(Y.current,n,l,ve),void 0!==c&&C(c,e,t,ie)}if("x"===c||oe)return void N({reach:"x"});const l=S(ie+(n-fe)/100/2*ie,B/j,.2);W({scale:l}),N(f({touchLength:n,reach:c,scale:l},M(Z,ee,j,G,ie,l,e,t,i,a)))}},{maxWait:8});function Ee(e){return!ne&&!te&&(q.current&&N(f({},e,{pause:s})),q.current)}const ye=function(){const e=v({X:e=>Ee({x:e}),Y:e=>Ee({y:e}),S:e=>{return t=e,q.current&&(W({scale:t}),N({scale:t})),!te&&q.current;var t}});return(t,n,o,r,i,a,c,l,s,u,d)=>{const[h,m]=T(u,i,a),[f,g]=X(t,l,h,innerWidth),[v,w]=X(n,l,m,innerHeight),b=Date.now()-d;if(b>=200||l!==c||Math.abs(s-c)>1){const{x:o,y:r}=M(t,n,i,a,c,l),s=f?g:o!==t?o:null,u=v?w:r!==n?r:null;return null!==s&&D(t,s,e.X),null!==u&&D(n,u,e.Y),void(l!==c&&D(c,l,e.S))}const p=(t-o)/b,E=(n-r)/b,y=Math.sqrt(p**2+E**2);let x=!1,C=!1;!function(e,t){let n,o=e,r=0,i=0;const a=i=>{n||(n=i);const a=i-n,s=Math.sign(e),u=-.001*s,d=Math.sign(-o)*o**2*2e-4,h=o*a+(u+d)*a**2/2;o+=(u+d)*a,r+=h,n=i,s*o<=0?l():t(r)?c():l()};function c(){i=requestAnimationFrame(a)}function l(){cancelAnimationFrame(i)}c()}(y,o=>{const r=t+o*(p/y),i=n+o*(E/y),[a,l]=X(r,c,h,innerWidth),[s,u]=X(i,c,m,innerHeight);if(a&&!x&&(x=!0,f?D(r,l,e.X):I(l,r+(r-l),e.X)),s&&!C&&(C=!0,v?D(i,u,e.Y):I(u,i+(i-u),e.Y)),x&&C)return!1;const d=x||e.X(l),g=C||e.Y(u);return d&&g})}}(),xe=function(e){const n=t(0),o=A((...t)=>{n.current=0,e(...t)},{wait:300});return function(...e){n.current+=1,o(...e),n.current>=2&&(o.cancel(),n.current=0,((e,t)=>{ve||be(1!==ie?1:Math.max(2,B/j),e,t)})(...e))}}(E);function Ce(e,t){if(Y.current=0,(te||oe)&&V){N({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});const n=S(ie,B/j);if(ye(Z,ee,le,se,j,G,ie,n,he,re,me),R(e,t),ae===e&&ce===t){if(te)return void xe(e,t);oe&&y(e,t)}}}function Se(e,t,n=0){N({touched:!0,CX:e,CY:t,lastCX:e,lastCY:t,lastX:Z,lastY:ee,lastScale:ie,touchLength:n,touchTime:Date.now()})}function _e(e){N({maskTouched:!0,CX:e.clientX,CY:e.clientY,lastX:Z,lastY:ee})}P(x?void 0:"mousemove",e=>{e.preventDefault(),pe(e.clientX,e.clientY)}),P(x?void 0:"mouseup",e=>{Ce(e.clientX,e.clientY)}),P(x?"touchmove":void 0,e=>{e.preventDefault();const t=F(e);pe(...t)},{passive:!1}),P(x?"touchend":void 0,({changedTouches:e})=>{const t=e[0];Ce(t.clientX,t.clientY)},{passive:!1}),P("resize",A(()=>{J&&!te&&(N(L(B,z,re)),k())},{maxWait:8})),_(()=>{V&&W(f({scale:ie,rotate:re},we))},[V]);const[Pe,Re,ke,Ve,We,$e,Ne,Ye]=function(e,n,o,i,a,c,s,u,d,h){const[m,f,g]=function(e,n,o,r,i){const a=t(!1),[{lead:c,scale:l},s]=w({lead:!0,scale:o}),u=A(async e=>{i(!0),s({lead:!1,scale:e})},{wait:r});return _(()=>{a.current?(i(!1),s({lead:!0}),u(o)):a.current=!0},[o]),c?[e*l,n*l,o/l]:[e*o,n*o,1]}(c,s,u,d,h),[b,p]=function(e,n,o,i,a){const[c,s]=l(O),[u,d]=l(0),h=t(),m=v({OK:()=>e&&d(4)});function f(e){a(!1),d(e)}return r(()=>{if(h.current||(h.current=Date.now()),o){if(function(e,t){const n=e&&e.current;if(n&&1===n.nodeType){const{top:e,left:o,width:r,height:i}=n.getBoundingClientRect();t({T:e,L:o,W:r,H:i,FIT:"IMG"===n.tagName?getComputedStyle(n).objectFit:void 0})}}(n,s),e)return Date.now()-h.current<250?(d(1),requestAnimationFrame(()=>{d(2),requestAnimationFrame(()=>f(3))}),void setTimeout(m.OK,i)):void d(4);f(5)}},[e,o]),[u,c]}(e,n,o,d,h),{T:E,L:y,W:x,H:C,FIT:S}=p,P=innerWidth/2,R=innerHeight/2,k=b<3||b>4;return[k?x?y:P:i+(P-c*u/2),k?x?E:R:a+(R-s*u/2),m,k&&S?m*(C/x):f,0===b?g:k?x/(c*u)||.01:g,k?S?1:0:1,b,S]}(s,c,J,Z,ee,j,G,ie,u,e=>N({pause:e})),Fe=`transform ${u}ms ${d}`,Xe={className:m,onMouseDown:x?void 0:function(e){e.stopPropagation(),0===e.button&&Se(e.clientX,e.clientY,0)},onTouchStart:x?function(e){e.stopPropagation(),Se(...F(e))}:void 0,onWheel:function(e){if(!ve){const t=S(ie-e.deltaY/100/2,B/j);N({stopRaf:!0}),be(t,e.clientX,e.clientY)}},style:{width:`${ke}px`,height:`${Ve}px`,opacity:$e,objectFit:4===Ne?void 0:Ye,transform:re?`rotate(${re}deg)`:void 0,transition:Ne>2?`${Fe}, opacity ${u}ms ease, height ${Ne<4?u/2:Ne>4?u:0}ms ${d}`:void 0}};return e.createElement("div",{className:"PhotoView__PhotoWrap"+(h?` ${h}`:""),style:g,onMouseDown:!x&&V?_e:void 0,onTouchStart:x&&V?e=>_e(e.touches[0]):void 0},e.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:`matrix(${We}, 0, 0, ${We}, ${Pe}, ${Re})`,transition:te||ge?void 0:Fe,willChange:V?"transform":void 0}},n?e.createElement(K,f({src:n,loaded:J,broken:Q},Xe,{onPhotoLoad:function(e){N(f({},e,e.loaded&&L(e.naturalWidth||0,e.naturalHeight||0,re)))},loadingElement:b,brokenElement:p})):o&&o({attrs:Xe,scale:We,rotate:re})))}const J={x:0,touched:!1,pause:!1,lastCX:void 0,lastCY:void 0,bg:void 0,lastBg:void 0,overlay:!0,minimal:!0,scale:1,rotate:0};function Q(o){const{loop:i=3,speed:s,easing:u,photoClosable:d,maskClosable:h=!0,maskOpacity:m=y,pullClosable:f=!0,pullAction:g,bannerVisible:b=!0,overlayRender:S,toolbarRender:R,showBackdropImage:N,disableScroll:F=!0,toolbarLeftRender:X,toolbarRightRender:M,sidebarWidth:T,sidebarLeftRender:L,sidebarRightRender:A,className:I,maskClassName:q,photoClassName:D,photoWrapClassName:O,loadingElement:H,brokenElement:B,images:z,index:j=0,onIndexChange:K,visible:U,onClose:Q,afterClose:Z,portalContainer:ee,fullScreen:te,onFullScreen:ne}=o,oe=t(),[re,ie]=w(J),[ae,ce]=l(0),{x:le,touched:se,pause:ue,lastCX:de,lastCY:he,bg:me=m,lastBg:fe,overlay:ge,minimal:ve,scale:we,rotate:be,onScale:pe,onRotate:Ee}=re,ye=o.hasOwnProperty("index"),xe=ye?j:ae,Ce=ye?K:ce,Se=t(xe),_e=z.length,Pe=z[xe],Re="boolean"==typeof i?i:_e>i,[ke,Ve,We]=function(e,o){const[,r]=n(e=>!e,!1),i=t(0),[c,l]=function(n){const o=t(n);function r(e){o.current=e}return a(()=>{(t=>{e?(t(e),i.current=1):i.current=2})(r)},[n]),[o.current,r]}(e);return[c,i.current,function(){r(),2===i.current&&(l(!1),o&&o()),i.current=0}]}(U,Z);_(()=>{if(ke)return ie({pause:!0,x:xe*-(innerWidth+E)}),void(Se.current=xe);ie(J)},[ke]);const{close:$e,changeIndex:Ne}=v({close(e){Ee&&Ee(0),ie({overlay:!0,lastBg:me}),Q(e)},changeIndex(e,t=!1){const n=Re?Se.current+(e-xe):e,o=_e-1,r=C(n,0,o),i=Re?n:r,a=innerWidth+E;ie({touched:!1,lastCX:void 0,lastCY:void 0,x:-a*i,pause:t}),Se.current=i,Ce&&Ce(Re?e<0?o:e>o?0:e:r)}}),Ye=c(()=>{ne(!te)},[te,ne]),Fe=a(()=>()=>{!document.fullscreenElement&&te&&Ye()},[te,Ye]),Xe=a(()=>()=>{if(document.fullscreenElement)document.exitFullscreen();else if(te){const e=oe.current;if(!e)return;(e=>{try{e&&(e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen&&e.msRequestFullscreen())}catch(e){console.log("Error al intentar activar el modo de pantalla completa",e)}})(e)}},[te]);function Me(e){return e?$e():ie({overlay:!ge})}function Te(){ie({x:-(innerWidth+E)*xe,lastCX:void 0,lastCY:void 0,pause:!0}),Se.current=xe}function Le(e,t,n,o){"x"===e?function(e){if(void 0===de)return void ie({touched:!0,lastCX:e,x:le,pause:!1});const t=e-de;let n=t;!Re&&(0===xe&&t>0||xe===_e-1&&t<0)&&(n=t/2),ie({touched:!0,lastCX:de,x:-(innerWidth+E)*Se.current+n,pause:!1})}(t):"y"===e&&function(e,t){if(void 0===he)return void ie({touched:!0,lastCY:e,bg:me,minimal:!0});const n=null===m?null:C(m,.01,m-Math.abs(e-he)/100/4);ie({touched:!0,lastCY:he,bg:1===t?n:m,minimal:1===t})}(n,o)}function Ae(e,t){const n=e-(null!=de?de:e),o=t-(null!=he?he:t);let r=!1;if(n<-40)return void Ne(xe+1);if(n>40)return void Ne(xe-1);const i=-(innerWidth+E)*Se.current;Math.abs(o)>100&&ve&&f?(r=!0,$e()):Math.abs(o)>100&&ve&&"function"==typeof g&&g({direction:o<0?"top":"bottom",offsetY:o}),ie({touched:!1,x:i,lastCX:void 0,lastCY:void 0,bg:m,overlay:!!r||ge})}r(()=>{if(oe.current)return Xe(),document.addEventListener("fullscreenchange",Fe),()=>{document.removeEventListener("fullscreenchange",Fe)}},[te,Fe,Xe]),P("keydown",e=>{if(U)switch(e.key){case"ArrowLeft":Ne(xe-1,!1);break;case"ArrowRight":Ne(xe+1,!1);break;case"Escape":$e()}});const Ie=function(e,t,n){return a(()=>{const o=e.length;return n?e.concat(e).concat(e).slice(o+t-1,o+t+2):e.slice(Math.max(t-1,0),Math.min(t+2,o+1))},[e,t,n])}(z,xe,Re);if(!ke)return null;const qe=ge&&!Ve,De=U?me:fe,Oe=pe&&Ee&&{images:z,index:xe,visible:U,onClose:$e,onIndexChange:Ne,overlayVisible:qe,overlay:Pe&&Pe.overlay,scale:we,rotate:be,onScale:pe,onRotate:Ee,fullScreen:te,fullScreenAvailable:document.documentElement.requestFullscreen||document.documentElement.mozRequestFullScreen||document.documentElement.webkitRequestFullscreen||document.documentElement.msRequestFullscreen,toggleFullScreen:()=>ne(!te)},He=s?s(Ve):400,Be=u?u(Ve):p,ze=s?s(3):600,je=u?u(3):p,Ke="number"==typeof T?`${T}px`:T,Ue=innerWidth<=900;return e.createElement(k,{className:`PhotoView-Portal${qe?"":" PhotoView-Slider__clean"}${U?"":" PhotoView-Slider__willClose"}${I?` ${I}`:""}`,role:"dialog",onClick:e=>e.stopPropagation(),container:ee},U&&F&&e.createElement($,null),e.createElement("div",{className:"PhotoView-Container"},L&&Oe&&!Ue&&e.createElement("div",{className:"PhotoView-Sidebar PhotoView-Sidebar__Left "+(1===Ve?" PhotoView-Slider__fadeIn":2===Ve?" PhotoView-Slider__fadeOut":""),style:{width:Ke,transitionTimingFunction:Be,transitionDuration:`${se?0:He}ms`,animationDuration:`${He}ms`}},L(Oe)),e.createElement("div",{ref:oe,className:"PhotoView-Viewer"},e.createElement("div",{className:`PhotoView-Slider__Backdrop${q?` ${q}`:""}${1===Ve?" PhotoView-Slider__fadeIn":2===Ve?" PhotoView-Slider__fadeOut":""} ${N?"with-backdrop-image":""}`,style:{background:N?`url(${Pe.src})`:De?`rgba(0, 0, 0, ${De})`:void 0,transitionTimingFunction:Be,transitionDuration:`${se?0:He}ms`,animationDuration:`${He}ms`},onAnimationEnd:We}),e.createElement(Y,{bannerVisible:b,index:xe,imageLength:_e,overlayParams:Oe,toolbarRender:R,toolbarLeftRender:X,toolbarRightRender:M}),Ie.map((t,n)=>{const o=Re||0!==xe?Se.current-1+n:xe+n;return e.createElement(G,{key:Re?`${t.key}/${t.src}/${o}`:t.key,item:t,speed:He,easing:Be,visible:U,onReachMove:Le,onReachUp:Ae,onPhotoTap:()=>Me(d),onMaskTap:()=>Me(h),wrapClassName:O,className:D,style:{left:(innerWidth+E)*o+"px",transform:`translate3d(${le}px, 0px, 0)`,transition:se||ue?void 0:`transform ${ze}ms ${je}`},loadingElement:H,brokenElement:B,onPhotoResize:Te,isActive:Se.current===o,expose:ie})}),!x&&b&&e.createElement(e.Fragment,null,(Re||0!==xe)&&e.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:()=>Ne(xe-1,!0)},e.createElement(V,null)),(Re||xe+1<_e)&&e.createElement("div",{className:"PhotoView-Slider__ArrowRight",onClick:()=>Ne(xe+1,!0)},e.createElement(W,null))),S&&Oe&&e.createElement("div",{className:"PhotoView-Slider__Overlay"},S(Oe))),A&&Oe&&!Ue&&e.createElement("div",{className:"PhotoView-Sidebar PhotoView-Sidebar__Right "+(1===Ve?" PhotoView-Slider__fadeIn":2===Ve?" PhotoView-Slider__fadeOut":""),style:{width:Ke,transitionTimingFunction:Be,transitionDuration:`${se?0:He}ms`,animationDuration:`${He}ms`}},A(Oe))))}const Z=["children","onIndexChange","onVisibleChange","sidebarLeftRender","sidebarRightRender","sidebarWidth"],ee={images:[],visible:!1,index:0,fullScreen:!1};function te(n){let{children:o,onIndexChange:i,onVisibleChange:l,sidebarLeftRender:s,sidebarRightRender:u,sidebarWidth:d=400}=n,h=g(n,Z);const[m,p]=w(ee),E=t(0),y=t(!1),{images:x,visible:C,index:S}=m,_=c(()=>{if(!s&&!u)return;const e=Object.getOwnPropertyDescriptor(window,"innerWidth");!e||e.configurable||y.current!==m.fullScreen?(Object.defineProperty(window,"innerWidth",{get:()=>window.outerWidth<=900||m.fullScreen?window.outerWidth:window.outerWidth-d,configurable:!0,enumerable:!0}),y.current=m.fullScreen):console.warn("innerWidth is already defined and is not configurable")},[s,u,m.fullScreen,d]);r(()=>{_()},[]),r(()=>{_()},[m.fullScreen,_]);const P=v({nextId:()=>E.current+=1,update(e){const t=x.findIndex(t=>t.key===e.key);if(t>-1){const n=x.slice();return n.splice(t,1,e),void p({images:n})}p(t=>({images:t.images.concat(e)}))},remove(e){p(t=>{const n=t.images.filter(t=>t.key!==e);return{images:n,index:Math.min(n.length-1,S)}})},show(e){const t=x.findIndex(t=>t.key===e);p({visible:!0,index:t}),l&&l(!0,t,m)}}),R=v({close(){p({visible:!1}),l&&l(!1,S,m)},changeIndex(e){p({index:e}),i&&i(e,m)},fullScreen(e){p({fullScreen:e})}}),k=a(()=>f({},m,P),[m,P]);return e.createElement(b.Provider,{value:k},o,e.createElement(Q,f({images:x,visible:C,index:S,fullScreen:m.fullScreen,onIndexChange:R.changeIndex,onClose:R.close,onFullScreen:R.fullScreen,sidebarWidth:d,sidebarLeftRender:s,sidebarRightRender:u},h)))}const ne=({src:e,render:n,overlay:o,width:i,height:c,triggers:l=["onClick"],children:m})=>{const g=s(b),w=function(){const{current:e}=t({sign:!1,fn:void 0});return e.sign||(e.sign=!0,e.fn=g.nextId()),e.fn}(),p=t(null);u(null==m?void 0:m.ref,()=>p.current),r(()=>()=>{g.remove(w)},[]);const E=v({render:e=>n&&n(e),show(e,t){g.show(w),function(e,t){if(m){const n=m.props[e];n&&n(t)}}(e,t)}}),y=a(()=>{const e={};return l.forEach(t=>{e[t]=E.show.bind(null,t)}),e},[]);return r(()=>{g.update({key:w,src:e,originRef:p,render:E.render,overlay:o,width:i,height:c})},[e]),m?d.only(h(m,f({},y,{ref:p}))):null};export{te as PhotoProvider,Q as PhotoSlider,ne as PhotoView};
import e,{useRef as t,useReducer as n,createContext as o,useEffect as r,useLayoutEffect as i,useMemo as a,useCallback as c,useState as l,useContext as s,useImperativeHandle as u,Children as d,cloneElement as h}from"react";import{createPortal as m}from"react-dom";function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},f.apply(null,arguments)}function v(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.includes(o))continue;n[o]=e[o]}return n}function g(e){const{current:n}=t({fn:e,curr:void 0});if(n.fn=e,!n.curr){const t=Object.create(null);Object.keys(e).forEach(e=>{t[e]=(...t)=>n.fn[e].call(n.fn,...t)}),n.curr=t}return n.curr}function w(e){return n((e,t)=>f({},e,"function"==typeof t?t(e):t),e)}var b=o(void 0);const p="cubic-bezier(0.25, 0.8, 0.25, 1)",E=20,y=1,x="undefined"!=typeof window&&"ontouchstart"in window,C=(e,t,n)=>Math.max(Math.min(e,n),t),_=(e,t=0,n=0)=>C(e,1*(1-n),Math.max(6,t)*(1+n));var S="undefined"==typeof window||/ServerSideRendering/.test(navigator&&navigator.userAgent)?r:i;function P(e,n,o){const i=t(n);i.current=n,r(()=>{function t(e){i.current(e)}return e&&window.addEventListener(e,t,o),()=>{e&&window.removeEventListener(e,t)}},[e])}const R=["container"];function k(t){let{container:n=document.body}=t,o=v(t,R);return m(e.createElement("div",f({},o)),n)}function V(t){return e.createElement("svg",f({width:"44",height:"44",viewBox:"0 0 768 768"},t),e.createElement("path",{d:"M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"}))}function W(t){return e.createElement("svg",f({width:"44",height:"44",viewBox:"0 0 768 768"},t),e.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function $(){return r(()=>{const{style:e}=document.body,t=e.overflow;return e.overflow="hidden",()=>{e.overflow=t}},[]),null}function N(t){return e.createElement("svg",f({width:"44",height:"44",viewBox:"0 0 768 768"},t),e.createElement("path",{d:"M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"}))}function Y({bannerVisible:t,index:n,imageLength:o,toolbarRender:r,overlayParams:i,toolbarLeftRender:a,toolbarRightRender:c}){return e.createElement(e.Fragment,null,t&&e.createElement("div",{className:"PhotoView-Slider__BannerWrap"},e.createElement("div",{className:"PhotoView-Slider__Counter"},n+1," / ",o),e.createElement("div",{className:"PhotoView-Slider__BannerRight"},r&&i&&r(i),e.createElement(N,{className:"PhotoView-Slider__toolbarIcon",onClick:close}))),a&&i&&e.createElement("div",{className:"PhotoView-Slider__Toolbar PhotoView-Slider__Toolbar--Left"},a(i)),c&&i&&e.createElement("div",{className:"PhotoView-Slider__Toolbar PhotoView-Slider__Toolbar--Right"},c(i)))}function F(e){const{clientX:t,clientY:n}=e.touches[0];if(e.touches.length>=2){const{clientX:o,clientY:r}=e.touches[1];return[(t+o)/2,(n+r)/2,Math.sqrt((o-t)**2+(r-n)**2)]}return[t,n,0]}const T=(e,t,n,o)=>{const r=n*t,i=(r-o)/2;let a,c=e;return r<=o?(a=1,c=0):e>0&&i-e<=0?(a=2,c=i):e<0&&i+e<=0&&(a=3,c=-i),[a,c]};function X(e,t,n,o,r,i,a=innerWidth/2,c=innerHeight/2,l=0,s=0){const[u]=T(e,i,n,innerWidth),[d]=T(t,i,o,innerHeight),h=innerWidth/2,m=innerHeight/2;return{x:a-i/r*(a-(h+e))-h+(o/n>=3&&n*i===innerWidth?0:u?l/2:l),y:c-i/r*(c-(m+t))-m+(d?s/2:s),lastCX:a,lastCY:c}}function M(e,t,n){const o=e%180!=0;return o?[n,t,o]:[t,n,o]}function L(e,t,n){const[o,r,i]=M(n,innerWidth,innerHeight);let a=0,c=o,l=r;const s=e/t*r,u=t/e*o;return e<o&&t<r?(c=e,l=t):e<o&&t>=r?c=s:e>=o&&t<r||e/t>o/r?l=u:t/e>=3&&!i?(l=u,a=(l-r)/2):c=s,{width:c,height:l,x:0,y:a,pause:!0}}function A(e,{leading:n=!1,maxWait:o,wait:r=o||0}){const i=t(e);i.current=e;const a=t(0),l=t(),s=()=>l.current&&clearTimeout(l.current),u=c((...e)=>{const t=Date.now();function c(){a.current=t,s(),i.current.apply(null,e)}const u=a.current,d=t-u;if(0===u&&(n&&c(),a.current=t),void 0!==o){if(d>o)return void c()}else d<r&&(a.current=t);s(),l.current=setTimeout(()=>{c(),a.current=0},r)},[r,o,n]);return u.cancel=s,u}const I=(e,t,n)=>D(e,t,n,100,e=>e,()=>D(t,e,n)),q=e=>1-(1-e)**4;function D(e,t,n,o=400,r=q,i){const a=t-e;if(0===a)return;const c=Date.now();let l=0;const s=()=>{const t=Math.min(1,(Date.now()-c)/o);n(e+r(t)*a)&&t<1?u():(cancelAnimationFrame(l),t>=1&&i&&i())};function u(){l=requestAnimationFrame(s)}u()}const O={T:0,L:0,W:0,H:0,FIT:void 0},B=()=>{const e=t(!1);return r(()=>(e.current=!0,()=>{e.current=!1}),[]),e},H=["className"];function z(t){let{className:n=""}=t,o=v(t,H);return e.createElement("div",f({className:`PhotoView__Spinner ${n}`},o),e.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},e.createElement("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),e.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}const j=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function K(t){let{src:n,loaded:o,broken:r,className:i,onPhotoLoad:a,loadingElement:c,brokenElement:l}=t,s=v(t,j);const u=B();return n&&!r?e.createElement(e.Fragment,null,e.createElement("img",f({className:"PhotoView__Photo"+(i?` ${i}`:""),src:n,onLoad:function(e){const{naturalWidth:t,naturalHeight:n}=e.target;u.current&&a({loaded:!0,naturalWidth:t,naturalHeight:n})},onError:function(){u.current&&a({broken:!0})},alt:""},s)),!o&&(e.createElement("span",{className:"PhotoView__icon"},c)||e.createElement(z,{className:"PhotoView__icon"}))):l?e.createElement("span",{className:"PhotoView__icon"},"function"==typeof l?l({src:n}):l):null}const U={naturalWidth:void 0,naturalHeight:void 0,width:void 0,height:void 0,loaded:void 0,broken:!1,x:0,y:0,touched:!1,maskTouched:!1,rotate:0,scale:1,CX:0,CY:0,lastX:0,lastY:0,lastCX:0,lastCY:0,lastScale:1,touchTime:0,touchLength:0,pause:!0,stopRaf:!0,reach:void 0};function G({item:{src:n,render:o,width:i=0,height:a=0,originRef:c},visible:s,speed:u,easing:d,wrapClassName:h,className:m,style:v,loadingElement:b,brokenElement:p,onPhotoTap:E,onMaskTap:y,onReachMove:C,onReachUp:R,onPhotoResize:k,isActive:V,expose:W}){const[$,N]=w(U),Y=t(0),q=B(),{naturalWidth:H=i,naturalHeight:z=a,width:j=i,height:G=a,loaded:J=!n,broken:Q,x:Z,y:ee,touched:te,stopRaf:ne,maskTouched:oe,rotate:re,scale:ie,CX:ae,CY:ce,lastX:le,lastY:se,lastCX:ue,lastCY:de,lastScale:he,touchTime:me,touchLength:fe,pause:ve,reach:ge}=$,we=g({onScale:e=>be(_(e)),onRotate(e){re!==e&&(W({rotate:e}),N(f({rotate:e},L(H,z,e))))}});function be(e,t,n){ie!==e&&(W({scale:e}),N(f({scale:e},X(Z,ee,j,G,ie,e,t,n),e<=1&&{x:0,y:0})))}const pe=A((e,t,n=0)=>{if((te||oe)&&V){const[o,r]=M(re,j,G);if(0===n&&0===Y.current){const n=Math.abs(e-ae)<=20,o=Math.abs(t-ce)<=20;if(n&&o)return void N({lastCX:e,lastCY:t});Y.current=n?t>ce?3:2:1}const i=e-ue,a=t-de;let c;if(0===n){const[n]=T(i+le,ie,o,innerWidth),[l]=T(a+se,ie,r,innerHeight);c=((e,t,n,o)=>t&&1===e||"x"===o?"x":n&&e>1||"y"===o?"y":void 0)(Y.current,n,l,ge),void 0!==c&&C(c,e,t,ie)}if("x"===c||oe)return void N({reach:"x"});const l=_(ie+(n-fe)/100/2*ie,H/j,.2);W({scale:l}),N(f({touchLength:n,reach:c,scale:l},X(Z,ee,j,G,ie,l,e,t,i,a)))}},{maxWait:8});function Ee(e){return!ne&&!te&&(q.current&&N(f({},e,{pause:s})),q.current)}const ye=function(){const e=g({X:e=>Ee({x:e}),Y:e=>Ee({y:e}),S:e=>{return t=e,q.current&&(W({scale:t}),N({scale:t})),!te&&q.current;var t}});return(t,n,o,r,i,a,c,l,s,u,d)=>{const[h,m]=M(u,i,a),[f,v]=T(t,l,h,innerWidth),[g,w]=T(n,l,m,innerHeight),b=Date.now()-d;if(b>=200||l!==c||Math.abs(s-c)>1){const{x:o,y:r}=X(t,n,i,a,c,l),s=f?v:o!==t?o:null,u=g?w:r!==n?r:null;return null!==s&&D(t,s,e.X),null!==u&&D(n,u,e.Y),void(l!==c&&D(c,l,e.S))}const p=(t-o)/b,E=(n-r)/b,y=Math.sqrt(p**2+E**2);let x=!1,C=!1;!function(e,t){let n,o=e,r=0,i=0;const a=i=>{n||(n=i);const a=i-n,s=Math.sign(e),u=-.001*s,d=Math.sign(-o)*o**2*2e-4,h=o*a+(u+d)*a**2/2;o+=(u+d)*a,r+=h,n=i,s*o<=0?l():t(r)?c():l()};function c(){i=requestAnimationFrame(a)}function l(){cancelAnimationFrame(i)}c()}(y,o=>{const r=t+o*(p/y),i=n+o*(E/y),[a,l]=T(r,c,h,innerWidth),[s,u]=T(i,c,m,innerHeight);if(a&&!x&&(x=!0,f?D(r,l,e.X):I(l,r+(r-l),e.X)),s&&!C&&(C=!0,g?D(i,u,e.Y):I(u,i+(i-u),e.Y)),x&&C)return!1;const d=x||e.X(l),v=C||e.Y(u);return d&&v})}}(),xe=function(e){const n=t(0),o=A((...t)=>{n.current=0,e(...t)},{wait:300});return function(...e){n.current+=1,o(...e),n.current>=2&&(o.cancel(),n.current=0,((e,t)=>{ge||be(1!==ie?1:Math.max(2,H/j),e,t)})(...e))}}(E);function Ce(e,t){if(Y.current=0,(te||oe)&&V){N({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});const n=_(ie,H/j);if(ye(Z,ee,le,se,j,G,ie,n,he,re,me),R(e,t),ae===e&&ce===t){if(te)return void xe(e,t);oe&&y(e,t)}}}function _e(e,t,n=0){N({touched:!0,CX:e,CY:t,lastCX:e,lastCY:t,lastX:Z,lastY:ee,lastScale:ie,touchLength:n,touchTime:Date.now()})}function Se(e){N({maskTouched:!0,CX:e.clientX,CY:e.clientY,lastX:Z,lastY:ee})}P(x?void 0:"mousemove",e=>{e.preventDefault(),pe(e.clientX,e.clientY)}),P(x?void 0:"mouseup",e=>{Ce(e.clientX,e.clientY)}),P(x?"touchmove":void 0,e=>{e.preventDefault();const t=F(e);pe(...t)},{passive:!1}),P(x?"touchend":void 0,({changedTouches:e})=>{const t=e[0];Ce(t.clientX,t.clientY)},{passive:!1}),P("resize",A(()=>{J&&!te&&(N(L(H,z,re)),k())},{maxWait:8})),S(()=>{V&&W(f({scale:ie,rotate:re},we))},[V]);const[Pe,Re,ke,Ve,We,$e,Ne,Ye]=function(e,n,o,i,a,c,s,u,d,h){const[m,f,v]=function(e,n,o,r,i){const a=t(!1),[{lead:c,scale:l},s]=w({lead:!0,scale:o}),u=A(async e=>{i(!0),s({lead:!1,scale:e})},{wait:r});return S(()=>{a.current?(i(!1),s({lead:!0}),u(o)):a.current=!0},[o]),c?[e*l,n*l,o/l]:[e*o,n*o,1]}(c,s,u,d,h),[b,p]=function(e,n,o,i,a){const[c,s]=l(O),[u,d]=l(0),h=t(),m=g({OK:()=>e&&d(4)});function f(e){a(!1),d(e)}return r(()=>{if(h.current||(h.current=Date.now()),o){if(function(e,t){const n=e&&e.current;if(n&&1===n.nodeType){const{top:e,left:o,width:r,height:i}=n.getBoundingClientRect();t({T:e,L:o,W:r,H:i,FIT:"IMG"===n.tagName?getComputedStyle(n).objectFit:void 0})}}(n,s),e)return Date.now()-h.current<250?(d(1),requestAnimationFrame(()=>{d(2),requestAnimationFrame(()=>f(3))}),void setTimeout(m.OK,i)):void d(4);f(5)}},[e,o]),[u,c]}(e,n,o,d,h),{T:E,L:y,W:x,H:C,FIT:_}=p,P=innerWidth/2,R=innerHeight/2,k=b<3||b>4;return[k?x?y:P:i+(P-c*u/2),k?x?E:R:a+(R-s*u/2),m,k&&_?m*(C/x):f,0===b?v:k?x/(c*u)||.01:v,k?_?1:0:1,b,_]}(s,c,J,Z,ee,j,G,ie,u,e=>N({pause:e})),Fe=`transform ${u}ms ${d}`,Te={className:m,onMouseDown:x?void 0:function(e){e.stopPropagation(),0===e.button&&_e(e.clientX,e.clientY,0)},onTouchStart:x?function(e){e.stopPropagation(),_e(...F(e))}:void 0,onWheel:function(e){if(!ge){const t=_(ie-e.deltaY/100/2,H/j);N({stopRaf:!0}),be(t,e.clientX,e.clientY)}},style:{width:`${ke}px`,height:`${Ve}px`,opacity:$e,objectFit:4===Ne?void 0:Ye,transform:re?`rotate(${re}deg)`:void 0,transition:Ne>2?`${Fe}, opacity ${u}ms ease, height ${Ne<4?u/2:Ne>4?u:0}ms ${d}`:void 0}};return e.createElement("div",{className:"PhotoView__PhotoWrap"+(h?` ${h}`:""),style:v,onMouseDown:!x&&V?Se:void 0,onTouchStart:x&&V?e=>Se(e.touches[0]):void 0},e.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:`matrix(${We}, 0, 0, ${We}, ${Pe}, ${Re})`,transition:te||ve?void 0:Fe,willChange:V?"transform":void 0}},n?e.createElement(K,f({src:n,loaded:J,broken:Q},Te,{onPhotoLoad:function(e){N(f({},e,e.loaded&&L(e.naturalWidth||0,e.naturalHeight||0,re)))},loadingElement:b,brokenElement:p})):o&&o({attrs:Te,scale:We,rotate:re})))}const J={x:0,touched:!1,pause:!1,lastCX:void 0,lastCY:void 0,bg:void 0,lastBg:void 0,overlay:!0,minimal:!0,scale:1,rotate:0};function Q(o){const{loop:i=3,speed:s,easing:u,photoClosable:d,maskClosable:h=!0,maskOpacity:m=y,pullClosable:f=!0,pullAction:v,bannerVisible:b=!0,overlayRender:_,toolbarRender:R,showBackdropImage:N,disableScroll:F=!0,toolbarLeftRender:T,toolbarRightRender:X,toolbarBottomRender:M,sidebarWidth:L,sidebarLeftRender:A,sidebarRightRender:I,className:q,maskClassName:D,photoClassName:O,photoWrapClassName:B,loadingElement:H,brokenElement:z,images:j,index:K=0,onIndexChange:U,visible:Q,onClose:Z,afterClose:ee,portalContainer:te,fullScreen:ne,onFullScreen:oe}=o,re=t(),[ie,ae]=w(J),[ce,le]=l(0),{x:se,touched:ue,pause:de,lastCX:he,lastCY:me,bg:fe=m,lastBg:ve,overlay:ge,minimal:we,scale:be,rotate:pe,onScale:Ee,onRotate:ye}=ie,xe=o.hasOwnProperty("index"),Ce=xe?K:ce,_e=xe?U:le,Se=t(Ce),Pe=j.length,Re=j[Ce],ke="boolean"==typeof i?i:Pe>i,[Ve,We,$e]=function(e,o){const[,r]=n(e=>!e,!1),i=t(0),[c,l]=function(n){const o=t(n);function r(e){o.current=e}return a(()=>{(t=>{e?(t(e),i.current=1):i.current=2})(r)},[n]),[o.current,r]}(e);return[c,i.current,function(){r(),2===i.current&&(l(!1),o&&o()),i.current=0}]}(Q,ee);S(()=>{if(Ve)return ae({pause:!0,x:Ce*-(innerWidth+E)}),void(Se.current=Ce);ae(J)},[Ve]);const{close:Ne,changeIndex:Ye}=g({close(e){ye&&ye(0),ae({overlay:!0,lastBg:fe}),Z(e)},changeIndex(e,t=!1){const n=ke?Se.current+(e-Ce):e,o=Pe-1,r=C(n,0,o),i=ke?n:r,a=innerWidth+E;ae({touched:!1,lastCX:void 0,lastCY:void 0,x:-a*i,pause:t}),Se.current=i,_e&&_e(ke?e<0?o:e>o?0:e:r)}}),Fe=c(()=>{oe(!ne)},[ne,oe]),Te=a(()=>()=>{!document.fullscreenElement&&ne&&Fe()},[ne,Fe]),Xe=a(()=>()=>{if(document.fullscreenElement)document.exitFullscreen();else if(ne){const e=re.current;if(!e)return;(e=>{try{e&&(e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen&&e.msRequestFullscreen())}catch(e){console.log("Error al intentar activar el modo de pantalla completa",e)}})(e)}},[ne]);function Me(e){return e?Ne():ae({overlay:!ge})}function Le(){ae({x:-(innerWidth+E)*Ce,lastCX:void 0,lastCY:void 0,pause:!0}),Se.current=Ce}function Ae(e,t,n,o){"x"===e?function(e){if(void 0===he)return void ae({touched:!0,lastCX:e,x:se,pause:!1});const t=e-he;let n=t;!ke&&(0===Ce&&t>0||Ce===Pe-1&&t<0)&&(n=t/2),ae({touched:!0,lastCX:he,x:-(innerWidth+E)*Se.current+n,pause:!1})}(t):"y"===e&&function(e,t){if(void 0===me)return void ae({touched:!0,lastCY:e,bg:fe,minimal:!0});const n=null===m?null:C(m,.01,m-Math.abs(e-me)/100/4);ae({touched:!0,lastCY:me,bg:1===t?n:m,minimal:1===t})}(n,o)}function Ie(e,t){const n=e-(null!=he?he:e),o=t-(null!=me?me:t);let r=!1;if(n<-40)return void Ye(Ce+1);if(n>40)return void Ye(Ce-1);const i=-(innerWidth+E)*Se.current;Math.abs(o)>100&&we&&f?(r=!0,Ne()):Math.abs(o)>100&&we&&"function"==typeof v&&v({direction:o<0?"top":"bottom",offsetY:o}),ae({touched:!1,x:i,lastCX:void 0,lastCY:void 0,bg:m,overlay:!!r||ge})}r(()=>{if(re.current)return Xe(),document.addEventListener("fullscreenchange",Te),()=>{document.removeEventListener("fullscreenchange",Te)}},[ne,Te,Xe]),P("keydown",e=>{if(Q)switch(e.key){case"ArrowLeft":Ye(Ce-1,!1);break;case"ArrowRight":Ye(Ce+1,!1);break;case"Escape":Ne()}});const qe=function(e,t,n){return a(()=>{const o=e.length;return n?e.concat(e).concat(e).slice(o+t-1,o+t+2):e.slice(Math.max(t-1,0),Math.min(t+2,o+1))},[e,t,n])}(j,Ce,ke);if(!Ve)return null;const De=ge&&!We,Oe=Q?fe:ve,Be=Ee&&ye&&{images:j,index:Ce,visible:Q,onClose:Ne,onIndexChange:Ye,overlayVisible:De,overlay:Re&&Re.overlay,scale:be,rotate:pe,onScale:Ee,onRotate:ye,fullScreen:ne,fullScreenAvailable:document.documentElement.requestFullscreen||document.documentElement.mozRequestFullScreen||document.documentElement.webkitRequestFullscreen||document.documentElement.msRequestFullscreen,toggleFullScreen:()=>oe(!ne)},He=s?s(We):400,ze=u?u(We):p,je=s?s(3):600,Ke=u?u(3):p,Ue="number"==typeof L?`${L}px`:L,Ge=innerWidth<=900;return e.createElement(k,{className:`PhotoView-Portal${De?"":" PhotoView-Slider__clean"}${Q?"":" PhotoView-Slider__willClose"}${q?` ${q}`:""}`,role:"dialog",onClick:e=>e.stopPropagation(),container:te},Q&&F&&e.createElement($,null),e.createElement("div",{className:"PhotoView-Container"},A&&Be&&!Ge&&e.createElement("div",{className:"PhotoView-Sidebar PhotoView-Sidebar__Left "+(1===We?" PhotoView-Slider__fadeIn":2===We?" PhotoView-Slider__fadeOut":""),style:{width:Ue,transitionTimingFunction:ze,transitionDuration:`${ue?0:He}ms`,animationDuration:`${He}ms`}},A(Be)),e.createElement("div",{ref:re,className:"PhotoView-Viewer"},e.createElement("div",{className:`PhotoView-Slider__Backdrop${D?` ${D}`:""}${1===We?" PhotoView-Slider__fadeIn":2===We?" PhotoView-Slider__fadeOut":""} ${N?"with-backdrop-image":""}`,style:{background:N?`url(${Re.src})`:Oe?`rgba(0, 0, 0, ${Oe})`:void 0,transitionTimingFunction:ze,transitionDuration:`${ue?0:He}ms`,animationDuration:`${He}ms`},onAnimationEnd:$e}),e.createElement(Y,{bannerVisible:b,index:Ce,imageLength:Pe,overlayParams:Be,toolbarRender:R,toolbarLeftRender:T,toolbarRightRender:X,toolbarBottomRender:M}),qe.map((t,n)=>{const o=ke||0!==Ce?Se.current-1+n:Ce+n;return e.createElement(G,{key:ke?`${t.key}/${t.src}/${o}`:t.key,item:t,speed:He,easing:ze,visible:Q,onReachMove:Ae,onReachUp:Ie,onPhotoTap:()=>Me(d),onMaskTap:()=>Me(h),wrapClassName:B,className:O,style:{left:(innerWidth+E)*o+"px",transform:`translate3d(${se}px, 0px, 0)`,transition:ue||de?void 0:`transform ${je}ms ${Ke}`},loadingElement:H,brokenElement:z,onPhotoResize:Le,isActive:Se.current===o,expose:ae})}),!x&&b&&e.createElement(e.Fragment,null,(ke||0!==Ce)&&e.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:()=>Ye(Ce-1,!0)},e.createElement(V,null)),(ke||Ce+1<Pe)&&e.createElement("div",{className:"PhotoView-Slider__ArrowRight",onClick:()=>Ye(Ce+1,!0)},e.createElement(W,null))),_&&Be&&e.createElement("div",{className:"PhotoView-Slider__Overlay"},_(Be))),I&&Be&&!Ge&&e.createElement("div",{className:"PhotoView-Sidebar PhotoView-Sidebar__Right "+(1===We?" PhotoView-Slider__fadeIn":2===We?" PhotoView-Slider__fadeOut":""),style:{width:Ue,transitionTimingFunction:ze,transitionDuration:`${ue?0:He}ms`,animationDuration:`${He}ms`}},I(Be)),M&&Be&&e.createElement("div",{className:"PhotoView-Slider__Toolbar PhotoView-Slider__Toolbar--Bottom",style:{width:`calc(100% - ${Ge?0:Ue})`}},M(Be))))}const Z=["children","onIndexChange","onVisibleChange","sidebarLeftRender","sidebarRightRender","sidebarWidth"],ee={images:[],visible:!1,index:0,fullScreen:!1};function te(n){let{children:o,onIndexChange:i,onVisibleChange:l,sidebarLeftRender:s,sidebarRightRender:u,sidebarWidth:d=400}=n,h=v(n,Z);const[m,p]=w(ee),E=t(0),y=t(!1),{images:x,visible:C,index:_}=m,S=c(()=>{if(!s&&!u)return;const e=Object.getOwnPropertyDescriptor(window,"innerWidth");!e||e.configurable||y.current!==m.fullScreen?(Object.defineProperty(window,"innerWidth",{get:()=>window.outerWidth<=900||m.fullScreen?window.outerWidth:window.outerWidth-d,configurable:!0,enumerable:!0}),y.current=m.fullScreen):console.warn("innerWidth is already defined and is not configurable")},[s,u,m.fullScreen,d]);r(()=>{S()},[]),r(()=>{S()},[m.fullScreen,S]);const P=g({nextId:()=>E.current+=1,update(e){const t=x.findIndex(t=>t.key===e.key);if(t>-1){const n=x.slice();return n.splice(t,1,e),void p({images:n})}p(t=>({images:t.images.concat(e)}))},remove(e){p(t=>{const n=t.images.filter(t=>t.key!==e);return{images:n,index:Math.min(n.length-1,_)}})},show(e){const t=x.findIndex(t=>t.key===e);p({visible:!0,index:t}),l&&l(!0,t,m)}}),R=g({close(){p({visible:!1}),l&&l(!1,_,m)},changeIndex(e){p({index:e}),i&&i(e,m)},fullScreen(e){p({fullScreen:e})}}),k=a(()=>f({},m,P),[m,P]);return e.createElement(b.Provider,{value:k},o,e.createElement(Q,f({images:x,visible:C,index:_,fullScreen:m.fullScreen,onIndexChange:R.changeIndex,onClose:R.close,onFullScreen:R.fullScreen,sidebarWidth:d,sidebarLeftRender:s,sidebarRightRender:u},h)))}const ne=({src:e,render:n,overlay:o,width:i,height:c,triggers:l=["onClick"],children:m})=>{const v=s(b),w=function(){const{current:e}=t({sign:!1,fn:void 0});return e.sign||(e.sign=!0,e.fn=v.nextId()),e.fn}(),p=t(null);u(null==m?void 0:m.ref,()=>p.current),r(()=>()=>{v.remove(w)},[]);const E=g({render:e=>n&&n(e),show(e,t){v.show(w),function(e,t){if(m){const n=m.props[e];n&&n(t)}}(e,t)}}),y=a(()=>{const e={};return l.forEach(t=>{e[t]=E.show.bind(null,t)}),e},[]);return r(()=>{v.update({key:w,src:e,originRef:p,render:E.render,overlay:o,width:i,height:c})},[e]),m?d.only(h(m,f({},y,{ref:p}))):null};export{te as PhotoProvider,Q as PhotoSlider,ne as PhotoView};
//# sourceMappingURL=react-photo-view.modern.js.map

@@ -1,2 +0,2 @@

import e,{useRef as n,useReducer as t,createContext as r,useEffect as i,useLayoutEffect as o,useMemo as a,useCallback as c,useState as l,useContext as u,useImperativeHandle as s,Children as d,cloneElement as f}from"react";import{createPortal as h}from"react-dom";function v(){return v=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)({}).hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},v.apply(null,arguments)}function m(e,n){if(null==e)return{};var t={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.includes(r))continue;t[r]=e[r]}return t}function g(e){var t=n({fn:e,curr:void 0}).current;if(t.fn=e,!t.curr){var r=Object.create(null);Object.keys(e).forEach(function(e){r[e]=function(){var n;return(n=t.fn[e]).call.apply(n,[t.fn].concat([].slice.call(arguments)))}}),t.curr=r}return t.curr}function p(e){return t(function(e,n){return v({},e,"function"==typeof n?n(e):n)},e)}var w=r(void 0),b="cubic-bezier(0.25, 0.8, 0.25, 1)",y=20,E="undefined"!=typeof window&&"ontouchstart"in window,x=function(e,n,t){return Math.max(Math.min(e,t),n)},C=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=0),x(e,1*(1-t),Math.max(6,n)*(1+t))},S="undefined"==typeof window||/ServerSideRendering/.test(navigator&&navigator.userAgent)?i:o;function P(e,t,r){var o=n(t);o.current=t,i(function(){function n(e){o.current(e)}return e&&window.addEventListener(e,n,r),function(){e&&window.removeEventListener(e,n)}},[e])}var _=["container"];function R(n){var t=n.container,r=void 0===t?document.body:t,i=m(n,_);return h(e.createElement("div",v({},i)),r)}function k(n){return e.createElement("svg",v({width:"44",height:"44",viewBox:"0 0 768 768"},n),e.createElement("path",{d:"M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"}))}function V(n){return e.createElement("svg",v({width:"44",height:"44",viewBox:"0 0 768 768"},n),e.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function W(){return i(function(){var e=document.body.style,n=e.overflow;return e.overflow="hidden",function(){e.overflow=n}},[]),null}function M(n){return e.createElement("svg",v({width:"44",height:"44",viewBox:"0 0 768 768"},n),e.createElement("path",{d:"M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"}))}function N(n){var t=n.toolbarRender,r=n.overlayParams,i=n.toolbarLeftRender,o=n.toolbarRightRender;return e.createElement(e.Fragment,null,n.bannerVisible&&e.createElement("div",{className:"PhotoView-Slider__BannerWrap"},e.createElement("div",{className:"PhotoView-Slider__Counter"},n.index+1," / ",n.imageLength),e.createElement("div",{className:"PhotoView-Slider__BannerRight"},t&&r&&t(r),e.createElement(M,{className:"PhotoView-Slider__toolbarIcon",onClick:close}))),i&&r&&e.createElement("div",{className:"PhotoView-Slider__Toolbar PhotoView-Slider__Toolbar--Left"},i(r)),o&&r&&e.createElement("div",{className:"PhotoView-Slider__Toolbar PhotoView-Slider__Toolbar--Right"},o(r)))}function Y(e){var n=e.touches[0],t=n.clientX,r=n.clientY;if(e.touches.length>=2){var i=e.touches[1],o=i.clientX,a=i.clientY;return[(t+o)/2,(r+a)/2,Math.sqrt(Math.pow(o-t,2)+Math.pow(a-r,2))]}return[t,r,0]}var F=function(e,n,t,r){var i,o=t*n,a=(o-r)/2,c=e;return o<=r?(i=1,c=0):e>0&&a-e<=0?(i=2,c=a):e<0&&a+e<=0&&(i=3,c=-a),[i,c]};function X(e,n,t,r,i,o,a,c,l,u){void 0===a&&(a=innerWidth/2),void 0===c&&(c=innerHeight/2),void 0===l&&(l=0),void 0===u&&(u=0);var s=F(e,o,t,innerWidth)[0],d=F(n,o,r,innerHeight),f=innerWidth/2,h=innerHeight/2;return{x:a-o/i*(a-(f+e))-f+(r/t>=3&&t*o===innerWidth?0:s?l/2:l),y:c-o/i*(c-(h+n))-h+(d[0]?u/2:u),lastCX:a,lastCY:c}}function T(e,n,t){var r=e%180!=0;return r?[t,n,r]:[n,t,r]}function L(e,n,t){var r=T(t,innerWidth,innerHeight),i=r[0],o=r[1],a=0,c=i,l=o,u=e/n*o,s=n/e*i;return e<i&&n<o?(c=e,l=n):e<i&&n>=o?c=u:e>=i&&n<o||e/n>i/o?l=s:n/e>=3&&!r[2]?a=((l=s)-o)/2:c=u,{width:c,height:l,x:0,y:a,pause:!0}}function A(e,t){var r=t.leading,i=void 0!==r&&r,o=t.maxWait,a=t.wait,l=void 0===a?o||0:a,u=n(e);u.current=e;var s=n(0),d=n(),f=function(){return d.current&&clearTimeout(d.current)},h=c(function(){var e=[].slice.call(arguments),n=Date.now();function t(){s.current=n,f(),u.current.apply(null,e)}var r=s.current,a=n-r;if(0===r&&(i&&t(),s.current=n),void 0!==o){if(a>o)return void t()}else a<l&&(s.current=n);f(),d.current=setTimeout(function(){t(),s.current=0},l)},[l,o,i]);return h.cancel=f,h}var I=function(e,n,t){return D(e,n,t,100,function(e){return e},function(){return D(n,e,t)})},q=function(e){return 1-Math.pow(1-e,4)};function D(e,n,t,r,i,o){void 0===r&&(r=400),void 0===i&&(i=q);var a=n-e;if(0!==a){var c=Date.now(),l=0,u=function(){var n=Math.min(1,(Date.now()-c)/r);t(e+i(n)*a)&&n<1?s():(cancelAnimationFrame(l),n>=1&&o&&o())};s()}function s(){l=requestAnimationFrame(u)}}var O={T:0,L:0,W:0,H:0,FIT:void 0},H=function(){var e=n(!1);return i(function(){return e.current=!0,function(){e.current=!1}},[]),e},B=["className"];function z(n){var t=n.className,r=void 0===t?"":t,i=m(n,B);return e.createElement("div",v({className:"PhotoView__Spinner "+r},i),e.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},e.createElement("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),e.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var j=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function K(n){var t=n.src,r=n.loaded,i=n.broken,o=n.className,a=n.onPhotoLoad,c=n.loadingElement,l=n.brokenElement,u=m(n,j),s=H();return t&&!i?e.createElement(e.Fragment,null,e.createElement("img",v({className:"PhotoView__Photo"+(o?" "+o:""),src:t,onLoad:function(e){var n=e.target;s.current&&a({loaded:!0,naturalWidth:n.naturalWidth,naturalHeight:n.naturalHeight})},onError:function(){s.current&&a({broken:!0})},alt:""},u)),!r&&(e.createElement("span",{className:"PhotoView__icon"},c)||e.createElement(z,{className:"PhotoView__icon"}))):l?e.createElement("span",{className:"PhotoView__icon"},"function"==typeof l?l({src:t}):l):null}var U={naturalWidth:void 0,naturalHeight:void 0,width:void 0,height:void 0,loaded:void 0,broken:!1,x:0,y:0,touched:!1,maskTouched:!1,rotate:0,scale:1,CX:0,CY:0,lastX:0,lastY:0,lastCX:0,lastCY:0,lastScale:1,touchTime:0,touchLength:0,pause:!0,stopRaf:!0,reach:void 0};function G(t){var r=t.item,o=r.src,a=r.render,c=r.width,u=void 0===c?0:c,s=r.height,d=void 0===s?0:s,f=r.originRef,h=t.visible,m=t.speed,w=t.easing,b=t.wrapClassName,y=t.className,x=t.style,_=t.loadingElement,R=t.brokenElement,k=t.onPhotoTap,V=t.onMaskTap,W=t.onReachMove,M=t.onReachUp,N=t.onPhotoResize,q=t.isActive,B=t.expose,z=p(U),j=z[0],G=z[1],J=n(0),Q=H(),Z=j.naturalWidth,$=void 0===Z?u:Z,ee=j.naturalHeight,ne=void 0===ee?d:ee,te=j.width,re=void 0===te?u:te,ie=j.height,oe=void 0===ie?d:ie,ae=j.loaded,ce=void 0===ae?!o:ae,le=j.broken,ue=j.x,se=j.y,de=j.touched,fe=j.stopRaf,he=j.maskTouched,ve=j.rotate,me=j.scale,ge=j.CX,pe=j.CY,we=j.lastX,be=j.lastY,ye=j.lastCX,Ee=j.lastCY,xe=j.lastScale,Ce=j.touchTime,Se=j.touchLength,Pe=j.pause,_e=j.reach,Re=g({onScale:function(e){return ke(C(e))},onRotate:function(e){ve!==e&&(B({rotate:e}),G(v({rotate:e},L($,ne,e))))}});function ke(e,n,t){me!==e&&(B({scale:e}),G(v({scale:e},X(ue,se,re,oe,me,e,n,t),e<=1&&{x:0,y:0})))}var Ve=A(function(e,n,t){if(void 0===t&&(t=0),(de||he)&&q){var r=T(ve,re,oe),i=r[0],o=r[1];if(0===t&&0===J.current){var a=Math.abs(e-ge)<=20,c=Math.abs(n-pe)<=20;if(a&&c)return void G({lastCX:e,lastCY:n});J.current=a?n>pe?3:2:1}var l,u=e-ye,s=n-Ee;if(0===t){var d=F(u+we,me,i,innerWidth)[0],f=F(s+be,me,o,innerHeight);l=function(e,n,t,r){return n&&1===e||"x"===r?"x":t&&e>1||"y"===r?"y":void 0}(J.current,d,f[0],_e),void 0!==l&&W(l,e,n,me)}if("x"===l||he)return void G({reach:"x"});var h=C(me+(t-Se)/100/2*me,$/re,.2);B({scale:h}),G(v({touchLength:t,reach:l,scale:h},X(ue,se,re,oe,me,h,e,n,u,s)))}},{maxWait:8});function We(e){return!fe&&!de&&(Q.current&&G(v({},e,{pause:h})),Q.current)}var Me,Ne,Ye,Fe,Xe,Te,Le,Ae,Ie=(Xe=function(e){return We({x:e})},Te=function(e){return We({y:e})},Le=function(e){return Q.current&&(B({scale:e}),G({scale:e})),!de&&Q.current},Ae=g({X:function(e){return Xe(e)},Y:function(e){return Te(e)},S:function(e){return Le(e)}}),function(e,n,t,r,i,o,a,c,l,u,s){var d=T(u,i,o),f=d[0],h=d[1],v=F(e,c,f,innerWidth),m=v[0],g=v[1],p=F(n,c,h,innerHeight),w=p[0],b=p[1],y=Date.now()-s;if(y>=200||c!==a||Math.abs(l-a)>1){var E=X(e,n,i,o,a,c),x=E.x,C=E.y,S=m?g:x!==e?x:null,P=w?b:C!==n?C:null;return null!==S&&D(e,S,Ae.X),null!==P&&D(n,P,Ae.Y),void(c!==a&&D(a,c,Ae.S))}var _=(e-t)/y,R=(n-r)/y,k=Math.sqrt(Math.pow(_,2)+Math.pow(R,2)),V=!1,W=!1;!function(e,n){var t,r=e,i=0,o=0,a=function(o){t||(t=o);var a=o-t,u=Math.sign(e),s=-.001*u,d=Math.sign(-r)*Math.pow(r,2)*2e-4,f=r*a+(s+d)*Math.pow(a,2)/2;i+=f,t=o,u*(r+=(s+d)*a)<=0?l():n(i)?c():l()};function c(){o=requestAnimationFrame(a)}function l(){cancelAnimationFrame(o)}c()}(k,function(t){var r=e+t*(_/k),i=n+t*(R/k),o=F(r,a,f,innerWidth),c=o[0],l=o[1],u=F(i,a,h,innerHeight),s=u[0],d=u[1];if(c&&!V&&(V=!0,m?D(r,l,Ae.X):I(l,r+(r-l),Ae.X)),s&&!W&&(W=!0,w?D(i,d,Ae.Y):I(d,i+(i-d),Ae.Y)),V&&W)return!1;var v=V||Ae.X(l),g=W||Ae.Y(d);return v&&g})}),qe=(Me=k,Ne=function(e,n){_e||ke(1!==me?1:Math.max(2,$/re),e,n)},Ye=n(0),Fe=A(function(){Ye.current=0,Me.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var e=[].slice.call(arguments);Ye.current+=1,Fe.apply(void 0,e),Ye.current>=2&&(Fe.cancel(),Ye.current=0,Ne.apply(void 0,e))});function De(e,n){if(J.current=0,(de||he)&&q){G({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var t=C(me,$/re);if(Ie(ue,se,we,be,re,oe,me,t,xe,ve,Ce),M(e,n),ge===e&&pe===n){if(de)return void qe(e,n);he&&V(e,n)}}}function Oe(e,n,t){void 0===t&&(t=0),G({touched:!0,CX:e,CY:n,lastCX:e,lastCY:n,lastX:ue,lastY:se,lastScale:me,touchLength:t,touchTime:Date.now()})}function He(e){G({maskTouched:!0,CX:e.clientX,CY:e.clientY,lastX:ue,lastY:se})}P(E?void 0:"mousemove",function(e){e.preventDefault(),Ve(e.clientX,e.clientY)}),P(E?void 0:"mouseup",function(e){De(e.clientX,e.clientY)}),P(E?"touchmove":void 0,function(e){e.preventDefault();var n=Y(e);Ve.apply(void 0,n)},{passive:!1}),P(E?"touchend":void 0,function(e){var n=e.changedTouches[0];De(n.clientX,n.clientY)},{passive:!1}),P("resize",A(function(){ce&&!de&&(G(L($,ne,ve)),N())},{maxWait:8})),S(function(){q&&B(v({scale:me,rotate:ve},Re))},[q]);var Be=function(e,t,r,o,a,c,u,s,d,f){var h=function(e,t,r,i,o){var a=n(!1),c=p({lead:!0,scale:r}),l=c[0],u=l.lead,s=l.scale,d=c[1],f=A(function(e){try{return o(!0),d({lead:!1,scale:e}),Promise.resolve()}catch(e){return Promise.reject(e)}},{wait:i});return S(function(){a.current?(o(!1),d({lead:!0}),f(r)):a.current=!0},[r]),u?[e*s,t*s,r/s]:[e*r,t*r,1]}(c,u,s,d,f),v=h[0],m=h[1],w=h[2],b=function(e,t,r,o,a){var c=l(O),u=c[0],s=c[1],d=l(0),f=d[0],h=d[1],v=n(),m=g({OK:function(){return e&&h(4)}});function p(e){a(!1),h(e)}return i(function(){if(v.current||(v.current=Date.now()),r){if(function(e,n){var t=e&&e.current;if(t&&1===t.nodeType){var r=t.getBoundingClientRect();n({T:r.top,L:r.left,W:r.width,H:r.height,FIT:"IMG"===t.tagName?getComputedStyle(t).objectFit:void 0})}}(t,s),e)return Date.now()-v.current<250?(h(1),requestAnimationFrame(function(){h(2),requestAnimationFrame(function(){return p(3)})}),void setTimeout(m.OK,o)):void h(4);p(5)}},[e,r]),[f,u]}(e,t,r,d,f),y=b[0],E=b[1],x=E.W,C=E.FIT,P=innerWidth/2,_=innerHeight/2,R=y<3||y>4;return[R?x?E.L:P:o+(P-c*s/2),R?x?E.T:_:a+(_-u*s/2),v,R&&C?v*(E.H/x):m,0===y?w:R?x/(c*s)||.01:w,R?C?1:0:1,y,C]}(h,f,ce,ue,se,re,oe,me,m,function(e){return G({pause:e})}),ze=Be[4],je=Be[6],Ke="transform "+m+"ms "+w,Ue={className:y,onMouseDown:E?void 0:function(e){e.stopPropagation(),0===e.button&&Oe(e.clientX,e.clientY,0)},onTouchStart:E?function(e){e.stopPropagation(),Oe.apply(void 0,Y(e))}:void 0,onWheel:function(e){if(!_e){var n=C(me-e.deltaY/100/2,$/re);G({stopRaf:!0}),ke(n,e.clientX,e.clientY)}},style:{width:Be[2]+"px",height:Be[3]+"px",opacity:Be[5],objectFit:4===je?void 0:Be[7],transform:ve?"rotate("+ve+"deg)":void 0,transition:je>2?Ke+", opacity "+m+"ms ease, height "+(je<4?m/2:je>4?m:0)+"ms "+w:void 0}};return e.createElement("div",{className:"PhotoView__PhotoWrap"+(b?" "+b:""),style:x,onMouseDown:!E&&q?He:void 0,onTouchStart:E&&q?function(e){return He(e.touches[0])}:void 0},e.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+ze+", 0, 0, "+ze+", "+Be[0]+", "+Be[1]+")",transition:de||Pe?void 0:Ke,willChange:q?"transform":void 0}},o?e.createElement(K,v({src:o,loaded:ce,broken:le},Ue,{onPhotoLoad:function(e){G(v({},e,e.loaded&&L(e.naturalWidth||0,e.naturalHeight||0,ve)))},loadingElement:_,brokenElement:R})):a&&a({attrs:Ue,scale:ze,rotate:ve})))}var J={x:0,touched:!1,pause:!1,lastCX:void 0,lastCY:void 0,bg:void 0,lastBg:void 0,overlay:!0,minimal:!0,scale:1,rotate:0};function Q(r){var o=r.loop,u=void 0===o?3:o,s=r.speed,d=r.easing,f=r.photoClosable,h=r.maskClosable,v=void 0===h||h,m=r.maskOpacity,w=void 0===m?1:m,C=r.pullClosable,_=void 0===C||C,M=r.pullAction,Y=r.bannerVisible,F=void 0===Y||Y,X=r.overlayRender,T=r.toolbarRender,L=r.showBackdropImage,A=r.disableScroll,I=void 0===A||A,q=r.toolbarLeftRender,D=r.toolbarRightRender,O=r.sidebarWidth,H=r.sidebarLeftRender,B=r.sidebarRightRender,z=r.className,j=r.maskClassName,K=r.photoClassName,U=r.photoWrapClassName,Q=r.loadingElement,Z=r.brokenElement,$=r.images,ee=r.index,ne=void 0===ee?0:ee,te=r.onIndexChange,re=r.visible,ie=r.onClose,oe=r.afterClose,ae=r.portalContainer,ce=r.fullScreen,le=r.onFullScreen,ue=n(),se=p(J),de=se[0],fe=se[1],he=l(0),ve=he[0],me=he[1],ge=de.x,pe=de.touched,we=de.pause,be=de.lastCX,ye=de.lastCY,Ee=de.bg,xe=void 0===Ee?w:Ee,Ce=de.lastBg,Se=de.overlay,Pe=de.minimal,_e=de.scale,Re=de.rotate,ke=de.onScale,Ve=de.onRotate,We=r.hasOwnProperty("index"),Me=We?ne:ve,Ne=We?te:me,Ye=n(Me),Fe=$.length,Xe=$[Me],Te="boolean"==typeof u?u:Fe>u,Le=function(e,r){var i=t(function(e){return!e},!1)[1],o=n(0),c=function(t){var r=n(t);function i(e){r.current=e}return a(function(){!function(n){e?(n(e),o.current=1):o.current=2}(i)},[t]),[r.current,i]}(e),l=c[1];return[c[0],o.current,function(){i(),2===o.current&&(l(!1),r&&r()),o.current=0}]}(re,oe),Ae=Le[0],Ie=Le[1],qe=Le[2];S(function(){if(Ae)return fe({pause:!0,x:Me*-(innerWidth+y)}),void(Ye.current=Me);fe(J)},[Ae]);var De=g({close:function(e){Ve&&Ve(0),fe({overlay:!0,lastBg:xe}),ie(e)},changeIndex:function(e,n){void 0===n&&(n=!1);var t=Te?Ye.current+(e-Me):e,r=Fe-1,i=x(t,0,r),o=Te?t:i,a=innerWidth+y;fe({touched:!1,lastCX:void 0,lastCY:void 0,x:-a*o,pause:n}),Ye.current=o,Ne&&Ne(Te?e<0?r:e>r?0:e:i)}}),Oe=De.close,He=De.changeIndex,Be=c(function(){le(!ce)},[ce,le]),ze=a(function(){return function(){!document.fullscreenElement&&ce&&Be()}},[ce,Be]),je=a(function(){return function(){if(document.fullscreenElement)document.exitFullscreen();else if(ce){var e=ue.current;if(!e)return;!function(e){try{e&&(e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen&&e.msRequestFullscreen())}catch(e){console.log("Error al intentar activar el modo de pantalla completa",e)}}(e)}}},[ce]);function Ke(e){return e?Oe():fe({overlay:!Se})}function Ue(){fe({x:-(innerWidth+y)*Me,lastCX:void 0,lastCY:void 0,pause:!0}),Ye.current=Me}function Ge(e,n,t,r){"x"===e?function(e){if(void 0!==be){var n=e-be,t=n;!Te&&(0===Me&&n>0||Me===Fe-1&&n<0)&&(t=n/2),fe({touched:!0,lastCX:be,x:-(innerWidth+y)*Ye.current+t,pause:!1})}else fe({touched:!0,lastCX:e,x:ge,pause:!1})}(n):"y"===e&&function(e,n){if(void 0!==ye){var t=null===w?null:x(w,.01,w-Math.abs(e-ye)/100/4);fe({touched:!0,lastCY:ye,bg:1===n?t:w,minimal:1===n})}else fe({touched:!0,lastCY:e,bg:xe,minimal:!0})}(t,r)}function Je(e,n){var t=e-(null!=be?be:e),r=n-(null!=ye?ye:n),i=!1;if(t<-40)He(Me+1);else if(t>40)He(Me-1);else{var o=-(innerWidth+y)*Ye.current;Math.abs(r)>100&&Pe&&_?(i=!0,Oe()):Math.abs(r)>100&&Pe&&"function"==typeof M&&M({direction:r<0?"top":"bottom",offsetY:r}),fe({touched:!1,x:o,lastCX:void 0,lastCY:void 0,bg:w,overlay:!!i||Se})}}i(function(){if(ue.current)return je(),document.addEventListener("fullscreenchange",ze),function(){document.removeEventListener("fullscreenchange",ze)}},[ce,ze,je]),P("keydown",function(e){if(re)switch(e.key){case"ArrowLeft":He(Me-1,!1);break;case"ArrowRight":He(Me+1,!1);break;case"Escape":Oe()}});var Qe=function(e,n,t){return a(function(){var r=e.length;return t?e.concat(e).concat(e).slice(r+n-1,r+n+2):e.slice(Math.max(n-1,0),Math.min(n+2,r+1))},[e,n,t])}($,Me,Te);if(!Ae)return null;var Ze=Se&&!Ie,$e=re?xe:Ce,en=ke&&Ve&&{images:$,index:Me,visible:re,onClose:Oe,onIndexChange:He,overlayVisible:Ze,overlay:Xe&&Xe.overlay,scale:_e,rotate:Re,onScale:ke,onRotate:Ve,fullScreen:ce,fullScreenAvailable:document.documentElement.requestFullscreen||document.documentElement.mozRequestFullScreen||document.documentElement.webkitRequestFullscreen||document.documentElement.msRequestFullscreen,toggleFullScreen:function(){return le(!ce)}},nn=s?s(Ie):400,tn=d?d(Ie):b,rn=s?s(3):600,on=d?d(3):b,an="number"==typeof O?O+"px":O,cn=innerWidth<=900;return e.createElement(R,{className:"PhotoView-Portal"+(Ze?"":" PhotoView-Slider__clean")+(re?"":" PhotoView-Slider__willClose")+(z?" "+z:""),role:"dialog",onClick:function(e){return e.stopPropagation()},container:ae},re&&I&&e.createElement(W,null),e.createElement("div",{className:"PhotoView-Container"},H&&en&&!cn&&e.createElement("div",{className:"PhotoView-Sidebar PhotoView-Sidebar__Left "+(1===Ie?" PhotoView-Slider__fadeIn":2===Ie?" PhotoView-Slider__fadeOut":""),style:{width:an,transitionTimingFunction:tn,transitionDuration:(pe?0:nn)+"ms",animationDuration:nn+"ms"}},H(en)),e.createElement("div",{ref:ue,className:"PhotoView-Viewer"},e.createElement("div",{className:"PhotoView-Slider__Backdrop"+(j?" "+j:"")+(1===Ie?" PhotoView-Slider__fadeIn":2===Ie?" PhotoView-Slider__fadeOut":"")+" "+(L?"with-backdrop-image":""),style:{background:L?"url("+Xe.src+")":$e?"rgba(0, 0, 0, "+$e+")":void 0,transitionTimingFunction:tn,transitionDuration:(pe?0:nn)+"ms",animationDuration:nn+"ms"},onAnimationEnd:qe}),e.createElement(N,{bannerVisible:F,index:Me,imageLength:Fe,overlayParams:en,toolbarRender:T,toolbarLeftRender:q,toolbarRightRender:D}),Qe.map(function(n,t){var r=Te||0!==Me?Ye.current-1+t:Me+t;return e.createElement(G,{key:Te?n.key+"/"+n.src+"/"+r:n.key,item:n,speed:nn,easing:tn,visible:re,onReachMove:Ge,onReachUp:Je,onPhotoTap:function(){return Ke(f)},onMaskTap:function(){return Ke(v)},wrapClassName:U,className:K,style:{left:(innerWidth+y)*r+"px",transform:"translate3d("+ge+"px, 0px, 0)",transition:pe||we?void 0:"transform "+rn+"ms "+on},loadingElement:Q,brokenElement:Z,onPhotoResize:Ue,isActive:Ye.current===r,expose:fe})}),!E&&F&&e.createElement(e.Fragment,null,(Te||0!==Me)&&e.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return He(Me-1,!0)}},e.createElement(k,null)),(Te||Me+1<Fe)&&e.createElement("div",{className:"PhotoView-Slider__ArrowRight",onClick:function(){return He(Me+1,!0)}},e.createElement(V,null))),X&&en&&e.createElement("div",{className:"PhotoView-Slider__Overlay"},X(en))),B&&en&&!cn&&e.createElement("div",{className:"PhotoView-Sidebar PhotoView-Sidebar__Right "+(1===Ie?" PhotoView-Slider__fadeIn":2===Ie?" PhotoView-Slider__fadeOut":""),style:{width:an,transitionTimingFunction:tn,transitionDuration:(pe?0:nn)+"ms",animationDuration:nn+"ms"}},B(en))))}var Z=["children","onIndexChange","onVisibleChange","sidebarLeftRender","sidebarRightRender","sidebarWidth"],$={images:[],visible:!1,index:0,fullScreen:!1};function ee(t){var r=t.children,o=t.onIndexChange,l=t.onVisibleChange,u=t.sidebarLeftRender,s=t.sidebarRightRender,d=t.sidebarWidth,f=void 0===d?400:d,h=m(t,Z),b=p($),y=b[0],E=b[1],x=n(0),C=n(!1),S=y.images,P=y.visible,_=y.index,R=c(function(){if(u||s){var e=Object.getOwnPropertyDescriptor(window,"innerWidth");!e||e.configurable||C.current!==y.fullScreen?(Object.defineProperty(window,"innerWidth",{get:function(){return window.outerWidth<=900||y.fullScreen?window.outerWidth:window.outerWidth-f},configurable:!0,enumerable:!0}),C.current=y.fullScreen):console.warn("innerWidth is already defined and is not configurable")}},[u,s,y.fullScreen,f]);i(function(){R()},[]),i(function(){R()},[y.fullScreen,R]);var k=g({nextId:function(){return x.current+=1},update:function(e){var n=S.findIndex(function(n){return n.key===e.key});if(n>-1){var t=S.slice();return t.splice(n,1,e),void E({images:t})}E(function(n){return{images:n.images.concat(e)}})},remove:function(e){E(function(n){var t=n.images.filter(function(n){return n.key!==e});return{images:t,index:Math.min(t.length-1,_)}})},show:function(e){var n=S.findIndex(function(n){return n.key===e});E({visible:!0,index:n}),l&&l(!0,n,y)}}),V=g({close:function(){E({visible:!1}),l&&l(!1,_,y)},changeIndex:function(e){E({index:e}),o&&o(e,y)},fullScreen:function(e){E({fullScreen:e})}}),W=a(function(){return v({},y,k)},[y,k]);return e.createElement(w.Provider,{value:W},r,e.createElement(Q,v({images:S,visible:P,index:_,fullScreen:y.fullScreen,onIndexChange:V.changeIndex,onClose:V.close,onFullScreen:V.fullScreen,sidebarWidth:f,sidebarLeftRender:u,sidebarRightRender:s},h)))}var ne=function(e){var t,r,o=e.src,c=e.render,l=e.overlay,h=e.width,m=e.height,p=e.triggers,b=void 0===p?["onClick"]:p,y=e.children,E=u(w),x=(t=function(){return E.nextId()},(r=n({sign:!1,fn:void 0}).current).sign||(r.sign=!0,r.fn=t()),r.fn),C=n(null);s(null==y?void 0:y.ref,function(){return C.current}),i(function(){return function(){E.remove(x)}},[]);var S=g({render:function(e){return c&&c(e)},show:function(e,n){E.show(x),function(e,n){if(y){var t=y.props[e];t&&t(n)}}(e,n)}}),P=a(function(){var e={};return b.forEach(function(n){e[n]=S.show.bind(null,n)}),e},[]);return i(function(){E.update({key:x,src:o,originRef:C,render:S.render,overlay:l,width:h,height:m})},[o]),y?d.only(f(y,v({},P,{ref:C}))):null};export{ee as PhotoProvider,Q as PhotoSlider,ne as PhotoView};
import e,{useRef as n,useReducer as t,createContext as r,useEffect as i,useLayoutEffect as o,useMemo as a,useCallback as c,useState as l,useContext as u,useImperativeHandle as s,Children as d,cloneElement as f}from"react";import{createPortal as h}from"react-dom";function v(){return v=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)({}).hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},v.apply(null,arguments)}function m(e,n){if(null==e)return{};var t={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.includes(r))continue;t[r]=e[r]}return t}function g(e){var t=n({fn:e,curr:void 0}).current;if(t.fn=e,!t.curr){var r=Object.create(null);Object.keys(e).forEach(function(e){r[e]=function(){var n;return(n=t.fn[e]).call.apply(n,[t.fn].concat([].slice.call(arguments)))}}),t.curr=r}return t.curr}function p(e){return t(function(e,n){return v({},e,"function"==typeof n?n(e):n)},e)}var w=r(void 0),b="cubic-bezier(0.25, 0.8, 0.25, 1)",y=20,E="undefined"!=typeof window&&"ontouchstart"in window,x=function(e,n,t){return Math.max(Math.min(e,t),n)},C=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=0),x(e,1*(1-t),Math.max(6,n)*(1+t))},_="undefined"==typeof window||/ServerSideRendering/.test(navigator&&navigator.userAgent)?i:o;function S(e,t,r){var o=n(t);o.current=t,i(function(){function n(e){o.current(e)}return e&&window.addEventListener(e,n,r),function(){e&&window.removeEventListener(e,n)}},[e])}var P=["container"];function R(n){var t=n.container,r=void 0===t?document.body:t,i=m(n,P);return h(e.createElement("div",v({},i)),r)}function k(n){return e.createElement("svg",v({width:"44",height:"44",viewBox:"0 0 768 768"},n),e.createElement("path",{d:"M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"}))}function V(n){return e.createElement("svg",v({width:"44",height:"44",viewBox:"0 0 768 768"},n),e.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function W(){return i(function(){var e=document.body.style,n=e.overflow;return e.overflow="hidden",function(){e.overflow=n}},[]),null}function M(n){return e.createElement("svg",v({width:"44",height:"44",viewBox:"0 0 768 768"},n),e.createElement("path",{d:"M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"}))}function N(n){var t=n.toolbarRender,r=n.overlayParams,i=n.toolbarLeftRender,o=n.toolbarRightRender;return e.createElement(e.Fragment,null,n.bannerVisible&&e.createElement("div",{className:"PhotoView-Slider__BannerWrap"},e.createElement("div",{className:"PhotoView-Slider__Counter"},n.index+1," / ",n.imageLength),e.createElement("div",{className:"PhotoView-Slider__BannerRight"},t&&r&&t(r),e.createElement(M,{className:"PhotoView-Slider__toolbarIcon",onClick:close}))),i&&r&&e.createElement("div",{className:"PhotoView-Slider__Toolbar PhotoView-Slider__Toolbar--Left"},i(r)),o&&r&&e.createElement("div",{className:"PhotoView-Slider__Toolbar PhotoView-Slider__Toolbar--Right"},o(r)))}function Y(e){var n=e.touches[0],t=n.clientX,r=n.clientY;if(e.touches.length>=2){var i=e.touches[1],o=i.clientX,a=i.clientY;return[(t+o)/2,(r+a)/2,Math.sqrt(Math.pow(o-t,2)+Math.pow(a-r,2))]}return[t,r,0]}var F=function(e,n,t,r){var i,o=t*n,a=(o-r)/2,c=e;return o<=r?(i=1,c=0):e>0&&a-e<=0?(i=2,c=a):e<0&&a+e<=0&&(i=3,c=-a),[i,c]};function T(e,n,t,r,i,o,a,c,l,u){void 0===a&&(a=innerWidth/2),void 0===c&&(c=innerHeight/2),void 0===l&&(l=0),void 0===u&&(u=0);var s=F(e,o,t,innerWidth)[0],d=F(n,o,r,innerHeight),f=innerWidth/2,h=innerHeight/2;return{x:a-o/i*(a-(f+e))-f+(r/t>=3&&t*o===innerWidth?0:s?l/2:l),y:c-o/i*(c-(h+n))-h+(d[0]?u/2:u),lastCX:a,lastCY:c}}function X(e,n,t){var r=e%180!=0;return r?[t,n,r]:[n,t,r]}function L(e,n,t){var r=X(t,innerWidth,innerHeight),i=r[0],o=r[1],a=0,c=i,l=o,u=e/n*o,s=n/e*i;return e<i&&n<o?(c=e,l=n):e<i&&n>=o?c=u:e>=i&&n<o||e/n>i/o?l=s:n/e>=3&&!r[2]?a=((l=s)-o)/2:c=u,{width:c,height:l,x:0,y:a,pause:!0}}function A(e,t){var r=t.leading,i=void 0!==r&&r,o=t.maxWait,a=t.wait,l=void 0===a?o||0:a,u=n(e);u.current=e;var s=n(0),d=n(),f=function(){return d.current&&clearTimeout(d.current)},h=c(function(){var e=[].slice.call(arguments),n=Date.now();function t(){s.current=n,f(),u.current.apply(null,e)}var r=s.current,a=n-r;if(0===r&&(i&&t(),s.current=n),void 0!==o){if(a>o)return void t()}else a<l&&(s.current=n);f(),d.current=setTimeout(function(){t(),s.current=0},l)},[l,o,i]);return h.cancel=f,h}var I=function(e,n,t){return D(e,n,t,100,function(e){return e},function(){return D(n,e,t)})},q=function(e){return 1-Math.pow(1-e,4)};function D(e,n,t,r,i,o){void 0===r&&(r=400),void 0===i&&(i=q);var a=n-e;if(0!==a){var c=Date.now(),l=0,u=function(){var n=Math.min(1,(Date.now()-c)/r);t(e+i(n)*a)&&n<1?s():(cancelAnimationFrame(l),n>=1&&o&&o())};s()}function s(){l=requestAnimationFrame(u)}}var O={T:0,L:0,W:0,H:0,FIT:void 0},B=function(){var e=n(!1);return i(function(){return e.current=!0,function(){e.current=!1}},[]),e},H=["className"];function z(n){var t=n.className,r=void 0===t?"":t,i=m(n,H);return e.createElement("div",v({className:"PhotoView__Spinner "+r},i),e.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},e.createElement("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),e.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var j=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function K(n){var t=n.src,r=n.loaded,i=n.broken,o=n.className,a=n.onPhotoLoad,c=n.loadingElement,l=n.brokenElement,u=m(n,j),s=B();return t&&!i?e.createElement(e.Fragment,null,e.createElement("img",v({className:"PhotoView__Photo"+(o?" "+o:""),src:t,onLoad:function(e){var n=e.target;s.current&&a({loaded:!0,naturalWidth:n.naturalWidth,naturalHeight:n.naturalHeight})},onError:function(){s.current&&a({broken:!0})},alt:""},u)),!r&&(e.createElement("span",{className:"PhotoView__icon"},c)||e.createElement(z,{className:"PhotoView__icon"}))):l?e.createElement("span",{className:"PhotoView__icon"},"function"==typeof l?l({src:t}):l):null}var U={naturalWidth:void 0,naturalHeight:void 0,width:void 0,height:void 0,loaded:void 0,broken:!1,x:0,y:0,touched:!1,maskTouched:!1,rotate:0,scale:1,CX:0,CY:0,lastX:0,lastY:0,lastCX:0,lastCY:0,lastScale:1,touchTime:0,touchLength:0,pause:!0,stopRaf:!0,reach:void 0};function G(t){var r=t.item,o=r.src,a=r.render,c=r.width,u=void 0===c?0:c,s=r.height,d=void 0===s?0:s,f=r.originRef,h=t.visible,m=t.speed,w=t.easing,b=t.wrapClassName,y=t.className,x=t.style,P=t.loadingElement,R=t.brokenElement,k=t.onPhotoTap,V=t.onMaskTap,W=t.onReachMove,M=t.onReachUp,N=t.onPhotoResize,q=t.isActive,H=t.expose,z=p(U),j=z[0],G=z[1],J=n(0),Q=B(),Z=j.naturalWidth,$=void 0===Z?u:Z,ee=j.naturalHeight,ne=void 0===ee?d:ee,te=j.width,re=void 0===te?u:te,ie=j.height,oe=void 0===ie?d:ie,ae=j.loaded,ce=void 0===ae?!o:ae,le=j.broken,ue=j.x,se=j.y,de=j.touched,fe=j.stopRaf,he=j.maskTouched,ve=j.rotate,me=j.scale,ge=j.CX,pe=j.CY,we=j.lastX,be=j.lastY,ye=j.lastCX,Ee=j.lastCY,xe=j.lastScale,Ce=j.touchTime,_e=j.touchLength,Se=j.pause,Pe=j.reach,Re=g({onScale:function(e){return ke(C(e))},onRotate:function(e){ve!==e&&(H({rotate:e}),G(v({rotate:e},L($,ne,e))))}});function ke(e,n,t){me!==e&&(H({scale:e}),G(v({scale:e},T(ue,se,re,oe,me,e,n,t),e<=1&&{x:0,y:0})))}var Ve=A(function(e,n,t){if(void 0===t&&(t=0),(de||he)&&q){var r=X(ve,re,oe),i=r[0],o=r[1];if(0===t&&0===J.current){var a=Math.abs(e-ge)<=20,c=Math.abs(n-pe)<=20;if(a&&c)return void G({lastCX:e,lastCY:n});J.current=a?n>pe?3:2:1}var l,u=e-ye,s=n-Ee;if(0===t){var d=F(u+we,me,i,innerWidth)[0],f=F(s+be,me,o,innerHeight);l=function(e,n,t,r){return n&&1===e||"x"===r?"x":t&&e>1||"y"===r?"y":void 0}(J.current,d,f[0],Pe),void 0!==l&&W(l,e,n,me)}if("x"===l||he)return void G({reach:"x"});var h=C(me+(t-_e)/100/2*me,$/re,.2);H({scale:h}),G(v({touchLength:t,reach:l,scale:h},T(ue,se,re,oe,me,h,e,n,u,s)))}},{maxWait:8});function We(e){return!fe&&!de&&(Q.current&&G(v({},e,{pause:h})),Q.current)}var Me,Ne,Ye,Fe,Te,Xe,Le,Ae,Ie=(Te=function(e){return We({x:e})},Xe=function(e){return We({y:e})},Le=function(e){return Q.current&&(H({scale:e}),G({scale:e})),!de&&Q.current},Ae=g({X:function(e){return Te(e)},Y:function(e){return Xe(e)},S:function(e){return Le(e)}}),function(e,n,t,r,i,o,a,c,l,u,s){var d=X(u,i,o),f=d[0],h=d[1],v=F(e,c,f,innerWidth),m=v[0],g=v[1],p=F(n,c,h,innerHeight),w=p[0],b=p[1],y=Date.now()-s;if(y>=200||c!==a||Math.abs(l-a)>1){var E=T(e,n,i,o,a,c),x=E.x,C=E.y,_=m?g:x!==e?x:null,S=w?b:C!==n?C:null;return null!==_&&D(e,_,Ae.X),null!==S&&D(n,S,Ae.Y),void(c!==a&&D(a,c,Ae.S))}var P=(e-t)/y,R=(n-r)/y,k=Math.sqrt(Math.pow(P,2)+Math.pow(R,2)),V=!1,W=!1;!function(e,n){var t,r=e,i=0,o=0,a=function(o){t||(t=o);var a=o-t,u=Math.sign(e),s=-.001*u,d=Math.sign(-r)*Math.pow(r,2)*2e-4,f=r*a+(s+d)*Math.pow(a,2)/2;i+=f,t=o,u*(r+=(s+d)*a)<=0?l():n(i)?c():l()};function c(){o=requestAnimationFrame(a)}function l(){cancelAnimationFrame(o)}c()}(k,function(t){var r=e+t*(P/k),i=n+t*(R/k),o=F(r,a,f,innerWidth),c=o[0],l=o[1],u=F(i,a,h,innerHeight),s=u[0],d=u[1];if(c&&!V&&(V=!0,m?D(r,l,Ae.X):I(l,r+(r-l),Ae.X)),s&&!W&&(W=!0,w?D(i,d,Ae.Y):I(d,i+(i-d),Ae.Y)),V&&W)return!1;var v=V||Ae.X(l),g=W||Ae.Y(d);return v&&g})}),qe=(Me=k,Ne=function(e,n){Pe||ke(1!==me?1:Math.max(2,$/re),e,n)},Ye=n(0),Fe=A(function(){Ye.current=0,Me.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var e=[].slice.call(arguments);Ye.current+=1,Fe.apply(void 0,e),Ye.current>=2&&(Fe.cancel(),Ye.current=0,Ne.apply(void 0,e))});function De(e,n){if(J.current=0,(de||he)&&q){G({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var t=C(me,$/re);if(Ie(ue,se,we,be,re,oe,me,t,xe,ve,Ce),M(e,n),ge===e&&pe===n){if(de)return void qe(e,n);he&&V(e,n)}}}function Oe(e,n,t){void 0===t&&(t=0),G({touched:!0,CX:e,CY:n,lastCX:e,lastCY:n,lastX:ue,lastY:se,lastScale:me,touchLength:t,touchTime:Date.now()})}function Be(e){G({maskTouched:!0,CX:e.clientX,CY:e.clientY,lastX:ue,lastY:se})}S(E?void 0:"mousemove",function(e){e.preventDefault(),Ve(e.clientX,e.clientY)}),S(E?void 0:"mouseup",function(e){De(e.clientX,e.clientY)}),S(E?"touchmove":void 0,function(e){e.preventDefault();var n=Y(e);Ve.apply(void 0,n)},{passive:!1}),S(E?"touchend":void 0,function(e){var n=e.changedTouches[0];De(n.clientX,n.clientY)},{passive:!1}),S("resize",A(function(){ce&&!de&&(G(L($,ne,ve)),N())},{maxWait:8})),_(function(){q&&H(v({scale:me,rotate:ve},Re))},[q]);var He=function(e,t,r,o,a,c,u,s,d,f){var h=function(e,t,r,i,o){var a=n(!1),c=p({lead:!0,scale:r}),l=c[0],u=l.lead,s=l.scale,d=c[1],f=A(function(e){try{return o(!0),d({lead:!1,scale:e}),Promise.resolve()}catch(e){return Promise.reject(e)}},{wait:i});return _(function(){a.current?(o(!1),d({lead:!0}),f(r)):a.current=!0},[r]),u?[e*s,t*s,r/s]:[e*r,t*r,1]}(c,u,s,d,f),v=h[0],m=h[1],w=h[2],b=function(e,t,r,o,a){var c=l(O),u=c[0],s=c[1],d=l(0),f=d[0],h=d[1],v=n(),m=g({OK:function(){return e&&h(4)}});function p(e){a(!1),h(e)}return i(function(){if(v.current||(v.current=Date.now()),r){if(function(e,n){var t=e&&e.current;if(t&&1===t.nodeType){var r=t.getBoundingClientRect();n({T:r.top,L:r.left,W:r.width,H:r.height,FIT:"IMG"===t.tagName?getComputedStyle(t).objectFit:void 0})}}(t,s),e)return Date.now()-v.current<250?(h(1),requestAnimationFrame(function(){h(2),requestAnimationFrame(function(){return p(3)})}),void setTimeout(m.OK,o)):void h(4);p(5)}},[e,r]),[f,u]}(e,t,r,d,f),y=b[0],E=b[1],x=E.W,C=E.FIT,S=innerWidth/2,P=innerHeight/2,R=y<3||y>4;return[R?x?E.L:S:o+(S-c*s/2),R?x?E.T:P:a+(P-u*s/2),v,R&&C?v*(E.H/x):m,0===y?w:R?x/(c*s)||.01:w,R?C?1:0:1,y,C]}(h,f,ce,ue,se,re,oe,me,m,function(e){return G({pause:e})}),ze=He[4],je=He[6],Ke="transform "+m+"ms "+w,Ue={className:y,onMouseDown:E?void 0:function(e){e.stopPropagation(),0===e.button&&Oe(e.clientX,e.clientY,0)},onTouchStart:E?function(e){e.stopPropagation(),Oe.apply(void 0,Y(e))}:void 0,onWheel:function(e){if(!Pe){var n=C(me-e.deltaY/100/2,$/re);G({stopRaf:!0}),ke(n,e.clientX,e.clientY)}},style:{width:He[2]+"px",height:He[3]+"px",opacity:He[5],objectFit:4===je?void 0:He[7],transform:ve?"rotate("+ve+"deg)":void 0,transition:je>2?Ke+", opacity "+m+"ms ease, height "+(je<4?m/2:je>4?m:0)+"ms "+w:void 0}};return e.createElement("div",{className:"PhotoView__PhotoWrap"+(b?" "+b:""),style:x,onMouseDown:!E&&q?Be:void 0,onTouchStart:E&&q?function(e){return Be(e.touches[0])}:void 0},e.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+ze+", 0, 0, "+ze+", "+He[0]+", "+He[1]+")",transition:de||Se?void 0:Ke,willChange:q?"transform":void 0}},o?e.createElement(K,v({src:o,loaded:ce,broken:le},Ue,{onPhotoLoad:function(e){G(v({},e,e.loaded&&L(e.naturalWidth||0,e.naturalHeight||0,ve)))},loadingElement:P,brokenElement:R})):a&&a({attrs:Ue,scale:ze,rotate:ve})))}var J={x:0,touched:!1,pause:!1,lastCX:void 0,lastCY:void 0,bg:void 0,lastBg:void 0,overlay:!0,minimal:!0,scale:1,rotate:0};function Q(r){var o=r.loop,u=void 0===o?3:o,s=r.speed,d=r.easing,f=r.photoClosable,h=r.maskClosable,v=void 0===h||h,m=r.maskOpacity,w=void 0===m?1:m,C=r.pullClosable,P=void 0===C||C,M=r.pullAction,Y=r.bannerVisible,F=void 0===Y||Y,T=r.overlayRender,X=r.toolbarRender,L=r.showBackdropImage,A=r.disableScroll,I=void 0===A||A,q=r.toolbarLeftRender,D=r.toolbarRightRender,O=r.toolbarBottomRender,B=r.sidebarWidth,H=r.sidebarLeftRender,z=r.sidebarRightRender,j=r.className,K=r.maskClassName,U=r.photoClassName,Q=r.photoWrapClassName,Z=r.loadingElement,$=r.brokenElement,ee=r.images,ne=r.index,te=void 0===ne?0:ne,re=r.onIndexChange,ie=r.visible,oe=r.onClose,ae=r.afterClose,ce=r.portalContainer,le=r.fullScreen,ue=r.onFullScreen,se=n(),de=p(J),fe=de[0],he=de[1],ve=l(0),me=ve[0],ge=ve[1],pe=fe.x,we=fe.touched,be=fe.pause,ye=fe.lastCX,Ee=fe.lastCY,xe=fe.bg,Ce=void 0===xe?w:xe,_e=fe.lastBg,Se=fe.overlay,Pe=fe.minimal,Re=fe.scale,ke=fe.rotate,Ve=fe.onScale,We=fe.onRotate,Me=r.hasOwnProperty("index"),Ne=Me?te:me,Ye=Me?re:ge,Fe=n(Ne),Te=ee.length,Xe=ee[Ne],Le="boolean"==typeof u?u:Te>u,Ae=function(e,r){var i=t(function(e){return!e},!1)[1],o=n(0),c=function(t){var r=n(t);function i(e){r.current=e}return a(function(){!function(n){e?(n(e),o.current=1):o.current=2}(i)},[t]),[r.current,i]}(e),l=c[1];return[c[0],o.current,function(){i(),2===o.current&&(l(!1),r&&r()),o.current=0}]}(ie,ae),Ie=Ae[0],qe=Ae[1],De=Ae[2];_(function(){if(Ie)return he({pause:!0,x:Ne*-(innerWidth+y)}),void(Fe.current=Ne);he(J)},[Ie]);var Oe=g({close:function(e){We&&We(0),he({overlay:!0,lastBg:Ce}),oe(e)},changeIndex:function(e,n){void 0===n&&(n=!1);var t=Le?Fe.current+(e-Ne):e,r=Te-1,i=x(t,0,r),o=Le?t:i,a=innerWidth+y;he({touched:!1,lastCX:void 0,lastCY:void 0,x:-a*o,pause:n}),Fe.current=o,Ye&&Ye(Le?e<0?r:e>r?0:e:i)}}),Be=Oe.close,He=Oe.changeIndex,ze=c(function(){ue(!le)},[le,ue]),je=a(function(){return function(){!document.fullscreenElement&&le&&ze()}},[le,ze]),Ke=a(function(){return function(){if(document.fullscreenElement)document.exitFullscreen();else if(le){var e=se.current;if(!e)return;!function(e){try{e&&(e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen&&e.msRequestFullscreen())}catch(e){console.log("Error al intentar activar el modo de pantalla completa",e)}}(e)}}},[le]);function Ue(e){return e?Be():he({overlay:!Se})}function Ge(){he({x:-(innerWidth+y)*Ne,lastCX:void 0,lastCY:void 0,pause:!0}),Fe.current=Ne}function Je(e,n,t,r){"x"===e?function(e){if(void 0!==ye){var n=e-ye,t=n;!Le&&(0===Ne&&n>0||Ne===Te-1&&n<0)&&(t=n/2),he({touched:!0,lastCX:ye,x:-(innerWidth+y)*Fe.current+t,pause:!1})}else he({touched:!0,lastCX:e,x:pe,pause:!1})}(n):"y"===e&&function(e,n){if(void 0!==Ee){var t=null===w?null:x(w,.01,w-Math.abs(e-Ee)/100/4);he({touched:!0,lastCY:Ee,bg:1===n?t:w,minimal:1===n})}else he({touched:!0,lastCY:e,bg:Ce,minimal:!0})}(t,r)}function Qe(e,n){var t=e-(null!=ye?ye:e),r=n-(null!=Ee?Ee:n),i=!1;if(t<-40)He(Ne+1);else if(t>40)He(Ne-1);else{var o=-(innerWidth+y)*Fe.current;Math.abs(r)>100&&Pe&&P?(i=!0,Be()):Math.abs(r)>100&&Pe&&"function"==typeof M&&M({direction:r<0?"top":"bottom",offsetY:r}),he({touched:!1,x:o,lastCX:void 0,lastCY:void 0,bg:w,overlay:!!i||Se})}}i(function(){if(se.current)return Ke(),document.addEventListener("fullscreenchange",je),function(){document.removeEventListener("fullscreenchange",je)}},[le,je,Ke]),S("keydown",function(e){if(ie)switch(e.key){case"ArrowLeft":He(Ne-1,!1);break;case"ArrowRight":He(Ne+1,!1);break;case"Escape":Be()}});var Ze=function(e,n,t){return a(function(){var r=e.length;return t?e.concat(e).concat(e).slice(r+n-1,r+n+2):e.slice(Math.max(n-1,0),Math.min(n+2,r+1))},[e,n,t])}(ee,Ne,Le);if(!Ie)return null;var $e=Se&&!qe,en=ie?Ce:_e,nn=Ve&&We&&{images:ee,index:Ne,visible:ie,onClose:Be,onIndexChange:He,overlayVisible:$e,overlay:Xe&&Xe.overlay,scale:Re,rotate:ke,onScale:Ve,onRotate:We,fullScreen:le,fullScreenAvailable:document.documentElement.requestFullscreen||document.documentElement.mozRequestFullScreen||document.documentElement.webkitRequestFullscreen||document.documentElement.msRequestFullscreen,toggleFullScreen:function(){return ue(!le)}},tn=s?s(qe):400,rn=d?d(qe):b,on=s?s(3):600,an=d?d(3):b,cn="number"==typeof B?B+"px":B,ln=innerWidth<=900;return e.createElement(R,{className:"PhotoView-Portal"+($e?"":" PhotoView-Slider__clean")+(ie?"":" PhotoView-Slider__willClose")+(j?" "+j:""),role:"dialog",onClick:function(e){return e.stopPropagation()},container:ce},ie&&I&&e.createElement(W,null),e.createElement("div",{className:"PhotoView-Container"},H&&nn&&!ln&&e.createElement("div",{className:"PhotoView-Sidebar PhotoView-Sidebar__Left "+(1===qe?" PhotoView-Slider__fadeIn":2===qe?" PhotoView-Slider__fadeOut":""),style:{width:cn,transitionTimingFunction:rn,transitionDuration:(we?0:tn)+"ms",animationDuration:tn+"ms"}},H(nn)),e.createElement("div",{ref:se,className:"PhotoView-Viewer"},e.createElement("div",{className:"PhotoView-Slider__Backdrop"+(K?" "+K:"")+(1===qe?" PhotoView-Slider__fadeIn":2===qe?" PhotoView-Slider__fadeOut":"")+" "+(L?"with-backdrop-image":""),style:{background:L?"url("+Xe.src+")":en?"rgba(0, 0, 0, "+en+")":void 0,transitionTimingFunction:rn,transitionDuration:(we?0:tn)+"ms",animationDuration:tn+"ms"},onAnimationEnd:De}),e.createElement(N,{bannerVisible:F,index:Ne,imageLength:Te,overlayParams:nn,toolbarRender:X,toolbarLeftRender:q,toolbarRightRender:D,toolbarBottomRender:O}),Ze.map(function(n,t){var r=Le||0!==Ne?Fe.current-1+t:Ne+t;return e.createElement(G,{key:Le?n.key+"/"+n.src+"/"+r:n.key,item:n,speed:tn,easing:rn,visible:ie,onReachMove:Je,onReachUp:Qe,onPhotoTap:function(){return Ue(f)},onMaskTap:function(){return Ue(v)},wrapClassName:Q,className:U,style:{left:(innerWidth+y)*r+"px",transform:"translate3d("+pe+"px, 0px, 0)",transition:we||be?void 0:"transform "+on+"ms "+an},loadingElement:Z,brokenElement:$,onPhotoResize:Ge,isActive:Fe.current===r,expose:he})}),!E&&F&&e.createElement(e.Fragment,null,(Le||0!==Ne)&&e.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return He(Ne-1,!0)}},e.createElement(k,null)),(Le||Ne+1<Te)&&e.createElement("div",{className:"PhotoView-Slider__ArrowRight",onClick:function(){return He(Ne+1,!0)}},e.createElement(V,null))),T&&nn&&e.createElement("div",{className:"PhotoView-Slider__Overlay"},T(nn))),z&&nn&&!ln&&e.createElement("div",{className:"PhotoView-Sidebar PhotoView-Sidebar__Right "+(1===qe?" PhotoView-Slider__fadeIn":2===qe?" PhotoView-Slider__fadeOut":""),style:{width:cn,transitionTimingFunction:rn,transitionDuration:(we?0:tn)+"ms",animationDuration:tn+"ms"}},z(nn)),O&&nn&&e.createElement("div",{className:"PhotoView-Slider__Toolbar PhotoView-Slider__Toolbar--Bottom",style:{width:"calc(100% - "+(ln?0:cn)+")"}},O(nn))))}var Z=["children","onIndexChange","onVisibleChange","sidebarLeftRender","sidebarRightRender","sidebarWidth"],$={images:[],visible:!1,index:0,fullScreen:!1};function ee(t){var r=t.children,o=t.onIndexChange,l=t.onVisibleChange,u=t.sidebarLeftRender,s=t.sidebarRightRender,d=t.sidebarWidth,f=void 0===d?400:d,h=m(t,Z),b=p($),y=b[0],E=b[1],x=n(0),C=n(!1),_=y.images,S=y.visible,P=y.index,R=c(function(){if(u||s){var e=Object.getOwnPropertyDescriptor(window,"innerWidth");!e||e.configurable||C.current!==y.fullScreen?(Object.defineProperty(window,"innerWidth",{get:function(){return window.outerWidth<=900||y.fullScreen?window.outerWidth:window.outerWidth-f},configurable:!0,enumerable:!0}),C.current=y.fullScreen):console.warn("innerWidth is already defined and is not configurable")}},[u,s,y.fullScreen,f]);i(function(){R()},[]),i(function(){R()},[y.fullScreen,R]);var k=g({nextId:function(){return x.current+=1},update:function(e){var n=_.findIndex(function(n){return n.key===e.key});if(n>-1){var t=_.slice();return t.splice(n,1,e),void E({images:t})}E(function(n){return{images:n.images.concat(e)}})},remove:function(e){E(function(n){var t=n.images.filter(function(n){return n.key!==e});return{images:t,index:Math.min(t.length-1,P)}})},show:function(e){var n=_.findIndex(function(n){return n.key===e});E({visible:!0,index:n}),l&&l(!0,n,y)}}),V=g({close:function(){E({visible:!1}),l&&l(!1,P,y)},changeIndex:function(e){E({index:e}),o&&o(e,y)},fullScreen:function(e){E({fullScreen:e})}}),W=a(function(){return v({},y,k)},[y,k]);return e.createElement(w.Provider,{value:W},r,e.createElement(Q,v({images:_,visible:S,index:P,fullScreen:y.fullScreen,onIndexChange:V.changeIndex,onClose:V.close,onFullScreen:V.fullScreen,sidebarWidth:f,sidebarLeftRender:u,sidebarRightRender:s},h)))}var ne=function(e){var t,r,o=e.src,c=e.render,l=e.overlay,h=e.width,m=e.height,p=e.triggers,b=void 0===p?["onClick"]:p,y=e.children,E=u(w),x=(t=function(){return E.nextId()},(r=n({sign:!1,fn:void 0}).current).sign||(r.sign=!0,r.fn=t()),r.fn),C=n(null);s(null==y?void 0:y.ref,function(){return C.current}),i(function(){return function(){E.remove(x)}},[]);var _=g({render:function(e){return c&&c(e)},show:function(e,n){E.show(x),function(e,n){if(y){var t=y.props[e];t&&t(n)}}(e,n)}}),S=a(function(){var e={};return b.forEach(function(n){e[n]=_.show.bind(null,n)}),e},[]);return i(function(){E.update({key:x,src:o,originRef:C,render:_.render,overlay:l,width:h,height:m})},[o]),y?d.only(f(y,v({},S,{ref:C}))):null};export{ee as PhotoProvider,Q as PhotoSlider,ne as PhotoView};
//# sourceMappingURL=react-photo-view.module.js.map

@@ -90,2 +90,3 @@ import type React from 'react';

toolbarRightRender?: (overlayProps: OverlayRenderProps) => React.ReactNode;
toolbarBottomRender?: (overlayProps: OverlayRenderProps) => React.ReactNode;
sidebarLeftRender?: (overlayProps: OverlayRenderProps) => React.ReactNode;

@@ -92,0 +93,0 @@ sidebarRightRender?: (overlayProps: OverlayRenderProps) => React.ReactNode;

{
"name": "@starlly-labs/photo-viewer",
"version": "1.0.10",
"version": "1.0.11",
"description": "An exquisite React photo preview component",

@@ -5,0 +5,0 @@ "author": "johnjaider1000",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc