You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
28 KiB

7 months ago
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[60],{55060:function(In,rt,h){h.d(rt,{Z:function(){return wn}});var o=h(67294),it=h(1208),st=h(93967),ee=h.n(st),K=h(87462),N=h(1413),te=h(4942),A=h(97685),Ye=h(71002),de=h(91),Ee=h(27678),Ne=h(21770),Te=["crossOrigin","decoding","draggable","loading","referrerPolicy","sizes","srcSet","useMap","alt"],we=o.createContext(null),Xe=0;function lt(t,e){var n=o.useState(function(){return Xe+=1,String(Xe)}),a=(0,A.Z)(n,1),r=a[0],i=o.useContext(we),f={data:e,canPreview:t};return o.useEffect(function(){if(i)return i.register(r,f)},[]),o.useEffect(function(){i&&i.register(r,f)},[t,e]),r}function ct(t){return new Promise(function(e){var n=document.createElement("img");n.onerror=function(){return e(!1)},n.onload=function(){return e(!0)},n.src=t})}function ke(t){var e=t.src,n=t.isCustomPlaceholder,a=t.fallback,r=(0,o.useState)(n?"loading":"normal"),i=(0,A.Z)(r,2),f=i[0],s=i[1],u=(0,o.useRef)(!1),v=f==="error";(0,o.useEffect)(function(){var p=!0;return ct(e).then(function(m){!m&&p&&s("error")}),function(){p=!1}},[e]),(0,o.useEffect)(function(){n&&!u.current?s("loading"):v&&s("normal")},[e]);var w=function(){s("normal")},l=function(m){u.current=!1,f==="loading"&&m!==null&&m!==void 0&&m.complete&&(m.naturalWidth||m.naturalHeight)&&(u.current=!0,w())},x=v&&a?{src:a}:{onLoad:w,src:e};return[l,x,f]}var ut=h(40974),me=h(64019),Le=h(15105),vt=h(91881),ft=h(75164),Ze={x:0,y:0,rotate:0,scale:1,flipX:!1,flipY:!1};function dt(t,e,n,a){var r=(0,o.useRef)(null),i=(0,o.useRef)([]),f=(0,o.useState)(Ze),s=(0,A.Z)(f,2),u=s[0],v=s[1],w=function(m){v(Ze),a&&!(0,vt.Z)(Ze,u)&&a({transform:Ze,action:m})},l=function(m,y){r.current===null&&(i.current=[],r.current=(0,ft.Z)(function(){v(function(S){var Z=S;return i.current.forEach(function(P){Z=(0,N.Z)((0,N.Z)({},Z),P)}),r.current=null,a==null||a({transform:Z,action:y}),Z})})),i.current.push((0,N.Z)((0,N.Z)({},u),m))},x=function(m,y,S,Z,P){var L=t.current,M=L.width,c=L.height,R=L.offsetWidth,g=L.offsetHeight,d=L.offsetLeft,I=L.offsetTop,b=m,C=u.scale*m;C>n?(C=n,b=n/u.scale):C<e&&(C=P?C:e,b=C/u.scale);var E=S!=null?S:innerWidth/2,D=Z!=null?Z:innerHeight/2,z=b-1,Y=z*M*.5,H=z*c*.5,W=z*(E-u.x-d),X=z*(D-u.y-I),G=u.x-(W-Y),F=u.y-(X-H);if(m<1&&C===1){var Q=R*C,J=g*C,oe=(0,Ee.g1)(),ie=oe.width,k=oe.height;Q<=ie&&J<=k&&(G=0,F=0)}l({x:G,y:F,scale:C},y)};return{transform:u,resetTransform:w,updateTransform:l,dispatchZoomChange:x}}var mt=h(80334);function He(t,e,n,a){var r=e+n,i=(n-a)/2;if(n>a){if(e>0)return(0,te.Z)({},t,i);if(e<0&&r<a)return(0,te.Z)({},t,-i)}else if(e<0||r>a)return(0,te.Z)({},t,e<0?i:-i);return{}}function Be(t,e,n,a){var r=(0,Ee.g1)(),i=r.width,f=r.height,s=null;return t<=i&&e<=f?s={x:0,y:0}:(t>i||e>f)&&(s=(0,N.Z)((0,N.Z)({},He("x",n,t,i)),He("y",a,e,f))),s}var ge=1,gt=1;function ht(t,e,n,a,r,i,f){var s=r.rotate,u=r.scale,v=r.x,w=r.y,l=(0,o.useState)(!1),x=(0,A.Z)(l,2),p=x[0],m=x[1],y=(0,o.useRef)({diffX:0,diffY:0,transformX:0,transformY:0}),S=function(c){!e||c.button!==0||(c.preventDefault(),c.stopPropagation(),y.current={diffX:c.pageX-v,diffY:c.pageY-w,transformX:v,transformY:w},m(!0))},Z=function(c){n&&p&&i({x:c.pageX-y.current.diffX,y:c.pageY-y.current.diffY},"move")},P=function(){if(n&&p){m(!1);var c=y.current,R=c.transformX,g=c.transformY,d=v!==R&&w!==g;if(!d)return;var I=t.current.offsetWidth*u,b=t.current.offsetHeight*u,C=t.current.getBoundingClientRect(),E=C.left,D=C.top,z=s%180!==0,Y=Be(z?b:I,z?I:b,E,D);Y&&i((0,N.Z)({},Y),"dragRebound")}},L=function(c){if(!(!n||c.deltaY==0)){var R=Math.abs(c.deltaY/100),g=Math.min(R,gt),d=ge+g*a;c.deltaY>0&&(d=ge/d),f(d,"wheel",c.clientX,c.clientY)}};return(0,o.useEffect)(function(){var M,c,R,g;if(e){R=(0,me.Z)(window,"mouseup",P,!1),g=(0,me.Z)(window,"mousemove",Z,!1);try{window.top!==window.self&&(M=(0,me.Z)(window.top,"mouseup",P,!1),c=(0,me.Z)(window.top,"mousemove",Z,!1))}catch(d){(0,mt.Kp)(!1,"[rc-image] ".concat(d))}}return function(){var d,I,b,C;(d=R)===null||d===void 0||d.remove(),(I=g)===null||I===void 0||I.remove(),(b=M)===null||b===void 0||b.remove(),(C=c)===null