small-package/luci-app-linkease/htdocs/luci-static/linkeasefile/chunk.4ea0593d.js

2 lines
9.9 KiB
JavaScript
Raw Normal View History

2022-11-09 20:26:02 +08:00
var be=Object.defineProperty,ye=Object.defineProperties;var xe=Object.getOwnPropertyDescriptors;var ce=Object.getOwnPropertySymbols;var Ie=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable;var ue=(r,o,n)=>o in r?be(r,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[o]=n,Y=(r,o)=>{for(var n in o||(o={}))Ie.call(o,n)&&ue(r,n,o[n]);if(ce)for(var n of ce(o))Ee.call(o,n)&&ue(r,n,o[n]);return r},U=(r,o)=>ye(r,xe(o));var de=(r,o,n)=>new Promise((c,_)=>{var L=k=>{try{u(n.next(k))}catch(w){_(w)}},R=k=>{try{u(n.throw(k))}catch(w){_(w)}},u=k=>k.done?c(k.value):Promise.resolve(k.value).then(L,R);u((n=n.apply(r,o)).next())});import{i as Ce,a as Ne,b as Te,d as Oe,m as ze,c as pe,e as Q,f as _e,g as Re,s as $e,u as Ae,h as De,j as Le,r as H,k as Fe,l as Se,n as v,w as fe,o as Be,p as Pe,q as m,t as D,v as l,x as f,y as t,z as p,A as e,B as Me,C as $,E as T,D as Ve,F as A,G as Xe,H as Ye,I as G,J as He,K as qe,L as ge,M as We,N as Ue,O as he,P as Ze,Q as je,R as me,S as Ge,T as Qe,U as Je,_ as Ke,V as Z,W as P,X as et,Y as tt,Z as st,$ as nt,a0 as at,a1 as O,a2 as ve,a3 as ot,a4 as j,a5 as lt,a6 as it,a7 as rt}from"./index.js";import{u as ke}from"./chunk.6424c2fc.js";import{d as ct}from"./chunk.22632dc4.js";import{l as ut}from"./chunk.4a114b4a.js";var dt="Expected a function";function ae(r,o,n){var c=!0,_=!0;if(typeof r!="function")throw new TypeError(dt);return Ce(n)&&(c="leading"in n?!!n.leading:c,_="trailing"in n?!!n.trailing:_),ct(r,o,{leading:c,maxWait:o,trailing:_})}const _t=()=>Ne&&/firefox/i.test(window.navigator.userAgent),ft=Te({urlList:{type:Oe(Array),default:()=>ze([])},zIndex:{type:Number},initialIndex:{type:Number,default:0},infinite:{type:Boolean,default:!0},hideOnClickModal:{type:Boolean,default:!1},teleported:{type:Boolean,default:!1},closeOnPressEscape:{type:Boolean,default:!0}}),mt={close:()=>!0,switch:r=>pe(r)},vt=["src"],pt={name:"ElImageViewer"},gt=Q(U(Y({},pt),{props:ft,emits:mt,setup(r,{expose:o,emit:n}){const c=r,_={CONTAIN:{name:"contain",icon:_e(Re)},ORIGINAL:{name:"original",icon:_e($e)}},L=_t()?"DOMMouseScroll":"mousewheel",{t:R}=Ae(),u=De("image-viewer"),{nextZIndex:k}=Le(),w=H(),F=H([]),q=Fe(),E=H(!0),b=H(c.initialIndex),S=Se(_.CONTAIN),a=H({scale:1,deg:0,offsetX:0,offsetY:0,enableTransition:!1}),C=v(()=>{const{urlList:s}=c;return s.length<=1}),M=v(()=>b.value===0),W=v(()=>b.value===c.urlList.length-1),J=v(()=>c.urlList[b.value]),K=v(()=>{const{scale:s,deg:i,offsetX:d,offsetY:g,enableTransition:x}=a.value;let h=d/s,I=g/s;switch(i%360){case 90:case-270:[h,I]=[I,-h];break;case 180:case-180:[h,I]=[-h,-I];break;case 270:case-90:[h,I]=[-I,h];break}const B={transform:`scale(${s}) rotate(${i}deg) translate(${h}px, ${I}px)`,transition:x?"transform .3s":""};return S.value.name===_.CONTAIN.name&&(B.maxWidth=B.maxHeight="100%"),B}),V=v(()=>pe(c.zIndex)?c.zIndex:k());function X(){te(),n("close")}function ee(){const s=ae(d=>{switch(d.code){case P.esc:c.closeOnPressEscape&&X();break;case P.space:le();break;case P.left:ie();break;case P.up:N("zoomIn");break;case P.right:re();break;case P.down:N("zoomOut");break}}),i=ae(d=>{(d.wheelDelta?d.wheelDelta:-d.detail)>0?N("zoomIn",{zoomRate:1.2,enableTransition:!1}):N("zoomOut",{zoomRate:1.2,enableTransition:!1})});q.run(()=>{Z(document,"keydown",s),Z(document,L,i)})}function te(){q.stop()}function y(){E.value=!1}function se(s){E.value=!1,s.target.alt=R("el.image.error")}function we(s){if(E.value||s.button!==0||!w.value)return;a.value.enableTransition=!1;const{offsetX:i,offsetY:d}=a.value,g=s.pageX,x=s.pageY,h=ae(B=>{a.value=U(Y({},a.value),{offsetX:i+B.pageX-g,offsetY:d+B.pageY-x})}),I=Z(document,"mousemove",h);Z(document,"mouseup",()=>{I()}),s.preventDefault()}function oe(){a.value={scale:1,deg:0,offsetX:0,offsetY:0,enableTransition:!1}}function le(){if(E.value)return;const s=et(_),i=Object.values(_),d=S.value.name,x=(i.findIndex(h=>h.name===d)+1)%s.length;S.value=_[s[x]],oe()}function ne(s){const i=c.urlList.length;b.value=(s+i)%i}function ie(){M.value&&!c.infinite||ne(b.value-1)}function re(){W.value&&!c.infinite||ne(b.value+1)}function N(s,i