mirror of
https://github.com/aaPanel/aaPanel.git
synced 2026-08-17 21:25:47 +02:00
3 lines
34 KiB
JavaScript
3 lines
34 KiB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/index-BFsKxFBK.js?v=1777002971908","js/vue-core-BlDeWrD6.js?v=1777002971908","js/prismjs-BZPoR7_J.js?v=1777002971908","css/prismjs-D-3FhBe_.css?v=1777002971908","js/index-Cr9LAN38.js?v=1777002971908","js/naive-ui-rbGGSgyg.js?v=1777002971908","css/index-oO25hiXf.css?v=1777002971908","js/files-k9g1xcH5.js?v=1777002971908","js/index-D1-lQg0r.js?v=1777002971908","js/ace-CNnfDSio.js?v=1777002971908","js/index.vue_vue_type_script_setup_true_lang-b9RpSmRA.js?v=1777002971908","js/data-BgYxBxLN.js?v=1777002971908","js/useTableColumns-B283bojo.js?v=1777002971908","js/index-BVt33XpJ.js?v=1777002971908","js/copy-CiK19cyX.js?v=1777002971908","js/index-ClZseaek.js?v=1777002971908","js/index.vue_vue_type_script_setup_true_lang-CQDF3YkI.js?v=1777002971908","js/index-mWmpjpyC.js?v=1777002971908","css/index-CvD67Ali.css?v=1777002971908","js/FileTask-DIEvlh_r.js?v=1777002971908","js/useLoop-CG4Cjj7d.js?v=1777002971908","css/FileTask-CpN2e5PY.css?v=1777002971908"])))=>i.map(i=>d[i]);
|
|
import{c5 as we,av as y,as as Se,a6 as ae,i as z,m as L,h as oe,p as Pe,S as Oe,n as Je,b4 as Le,c0 as Ve,au as He,at as Xe,c as Ye}from"./index-Cr9LAN38.js?v=1777002971908";import{r as w,X as We,av as V,a4 as Qe,c as Te,a3 as Ee,n as re,a0 as G,F as Ze,k as et,$ as tt,Z as at,L as nt,S as st}from"./vue-core-BlDeWrD6.js?v=1777002971908";import{g as ie,r as it,s as me,c as lt,a as ot}from"./files-k9g1xcH5.js?v=1777002971908";import{p as rt,am as be}from"./naive-ui-rbGGSgyg.js?v=1777002971908";import{c as ct}from"./copy-CiK19cyX.js?v=1777002971908";function ut(t,e,a){const n=w(!0),s=w(0),i=w(0),l=w(0),r=w(0),u=w(0),f=w(0),p=w(0),k=w(0);function x(){let S=null;return e?()=>{S||(S=setTimeout(()=>{e({m_flag:n,m_left:s,m_right:i,m_bottom:r,m_top:l,m_x:p,m_y:k,m_height:u,m_width:f}),clearTimeout(S),S=null},10))}:!1}let b;We(t)?b=t.value:typeof t=="string"?b=document.querySelector(t):t instanceof Element&&(b=t);const m=x();function K(S){const{left:M,right:R,top:q,bottom:N,height:d,width:P,x:D,y:A}=S.getBoundingClientRect();s.value=M,i.value=R,l.value=q,r.value=N,u.value=d,f.value=P,p.value=D,k.value=A}const Y=S=>{if(a&&a(S,{m_flag:n,m_left:s,m_right:i,m_bottom:r,m_top:l,m_x:p,m_y:k,m_height:u,m_width:f}),!n.value)return;const{left:M,right:R,top:q,bottom:N}=b.getBoundingClientRect(),d=document.createElement("div"),P=S.clientX,D=S.clientY;d.style.position="absolute",d.style.left=P-M+"px",d.style.top=D-q+"px",d.style.width="0px",d.style.height="0px",d.style.backgroundColor="rgba(135, 182, 130, 0.1)",d.classList.add("district-wrapper"),b.appendChild(d),S.preventDefault();const A=O=>{O.preventDefault(),!de.value&&!Q.value&&(P<=O.clientX?d.style.width=O.clientX-P+"px":(d.style.width=P-O.clientX+"px",d.style.marginLeft=-(P-O.clientX)+"px"),D<=O.clientY?(d.style.height=O.clientY-D+ee+"px",d.style.marginTop=-ee+"px"):(d.style.height=D-O.clientY+ne+"px",d.style.marginTop=-(D-O.clientY)+"px"),O.clientX<M&&(d.style.width=P-M+"px",d.style.marginLeft=-(P-M)+"px"),O.clientX>R&&(d.style.width=R-P+"px")),O.clientY>N&&fe(),O.clientY<q&&W(),K(d),m&&m()},{pause:v,resume:fe,isActive:de}=we(()=>{if(B.scrollTop>=B.scrollHeight-B.clientHeight){v();return}d.style.height=d.offsetHeight+10+"px",d.style.marginTop=parseInt(getComputedStyle(d).marginTop)-10+"px",B.scrollTop+=10,ee=B.scrollTop,K(d),m&&m()},{immediate:!1}),{pause:pe,resume:W,isActive:Q}=we(()=>{if(B.scrollTop<=0){pe();return}d.style.height=d.offsetHeight+10+"px",B.scrollTop-=10,ne+=10,K(d),m&&m()},{immediate:!1}),B=b.querySelector(".n-scrollbar-container");let ee=0,ne=0;document.onmousemove=A,document.onmouseup=()=>{document.onmousemove=null,b.contains(d)&&b.removeChild(d)}};return b&&(b.onmousedown=Y),{m_flag:n,m_x:p,m_y:k,m_left:s,m_right:i,m_top:l,m_bottom:r,m_height:u,m_width:f}}function ft(t,e){const a=V(t.m_left),n=V(t.m_right),s=V(t.m_top),i=V(t.m_bottom),l=V(e.left),r=V(e.right),u=V(e.top),f=V(e.bottom);return!(r<a||l>n||f<s||u>i)}const{t:dt}=ae.global;async function pt(t){const{shareList:e,shareListPage:a,shareListTotal:n}=t;try{const s=await y.post("/files?action=get_download_url_list",{p:a.value,row:12});return e.value=s.message.data,n.value=Se(s.message.page),e.value}catch(s){return console.warn(s),[]}}async function mt(t,e){try{await y.post("/files?action=remove_download_url",{id:e},{requestOptions:{loading:dt("file.shareListModal.deletingShare"),successMessage:!0}}),_(t)}catch(a){console.warn(a)}}const Ce={supportedModes:{Apache_Conf:["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],CSS:["css"],HTML:["html|htm|xhtml|vue|we|wpy"],Java:["java"],JavaScript:["js|jsm|jsx"],JSON:["json"],JSP:["jsp"],Makefile:["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],Markdown:["md|markdown"],MySQL:["mysql"],Nginx:["nginx|conf"],PHP:["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],Powershell:["ps1"],Python:["py"],SQL:["sql"],SQLServer:["sqlserver"],Text:["txt"],XML:["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],YAML:["yaml|yml"],images:["icon|jpg|jpeg|png|bmp|gif|tif|emf"]},nameOverrides:{PHP_Laravel_blade:"PHP (Blade Template)"},encodingList:["ASCII","UTF-8","GBK","GB2312","BIG5"],themeList:["chrome","monokai","tomorrow_night_bright"],aceEditor:{editorTheme:"monokai",fontSize:14,lineHeight:1.5,softLabel:!1,useSoftTabs:!0,tabSize:4,wrap:!0,indentedSoftWrap:!0,enableSnippets:!0,enableLiveAutocompletion:!0,enableBasicAutocompletion:!0,highlightActiveLine:!0,highlightSelectedWord:!0,animatedScroll:!1,showInvisibles:!0,showFoldWidgets:!0,showLineNumbers:!0,showGutter:!0,displayIndentGuides:!1},fontFamily:"'Consolas', 'Menlo', 'Monaco', 'Ubuntu Mono', 'source-code-pro', 'Courier New', monospace",encoding:"utf-8"},xe="/www/server/panel/BTPanel/static/ace/ace.editor.config.json",{t:E}=ae.global,vt=Qe("fileEditor",()=>{const t=w(!1),e=w(!1),a=w(null),n=w({show:!1,type:null,data:{}}),s=w([]),i=w(-1),l=w("/www"),r=w(0),u=w(!1),f=w(rt(Ce)),p=w(null),k=w(!1),x=w(""),b=w(!1),m=Te(()=>i.value>=0&&i.value<s.value.length?s.value[i.value]:null),K=o=>{const c=o.split("/").pop()||E("fileEditor.store.untitled"),g=o.split(".").pop()||"text";return{path:o,type:g,name:c,loading:!1,lineEnding:"LF",content:"",originalContent:"",encoding:"",st_mtime:0,onlyRead:!1,history:[]}},Y=async o=>{const c=s.value.findIndex(C=>C.path===o);if(c!==-1){i.value=c;return}const{message:g}=await ie({path:o});if(z(g)){const C=K(o),I=i.value+1;s.value.splice(I,0,C),i.value=I;const h=s.value[I];h.content=g.data,h.originalContent=g.data,h.encoding=g.encoding,h.st_mtime=Number(g.st_mtime),h.onlyRead=g.only_read,h.history=g.historys||[],h.onlyRead&&L.warning(E("fileEditor.store.fileTooLarge"))}},S=()=>{const o="__shortcut__",c=s.value.findIndex(I=>I.path===o);if(c!==-1){i.value=c;return}const g={path:o,type:"shortcut",name:E("fileEditor.store.shortcutTabName"),loading:!1,lineEnding:"LF",content:"",originalContent:"",encoding:"UTF-8",st_mtime:0,onlyRead:!1,history:[]},C=i.value+1;s.value.splice(C,0,g),i.value=C},M=async(o,c)=>{var U,ye;const g=o.split("/").pop()||"Untitled",C="__diff__".concat(o,"__").concat(c),I=s.value.findIndex(Z=>Z.path===C);if(I!==-1){i.value=I;return}const h={path:C,type:"diff",name:"".concat(g," <-> ").concat(g),loading:!0,lineEnding:"LF",content:"",originalContent:"",encoding:"UTF-8",st_mtime:0,onlyRead:!0,history:[],originalPath:o,historyTime:c},j=i.value+1;s.value.splice(j,0,h),i.value=j;try{const[Z,J]=await Promise.all([ie({path:o}),it({filename:o,history:c})]),se=s.value[i.value];Z.message&&z(Z.message)&&(se.rightContent=Z.message.data,se.encoding=Z.message.encoding),J.message&&z(J.message),se.leftContent=typeof J.message=="string"?J.message:(ye=(U=J.message)==null?void 0:U.data)!=null?ye:"",se.loading=!1}catch(Z){const J=s.value[i.value];J&&(J.loading=!1)}},R=async o=>{const{message:c}=await ie({path:o});if(z(c)){const g=s.value.findIndex(C=>C.path===o);if(g!==-1){const C=s.value[g];C.content=c.data,C.originalContent=c.data,C.encoding=c.encoding,C.st_mtime=Number(c.st_mtime),C.history=c.historys||[]}}},q=async()=>{m.value&&m.value.type!=="shortcut"&&await R(m.value.path)},N=o=>{s.value.splice(o,1),i.value>=s.value.length&&(i.value=Math.max(0,s.value.length-1)),s.value.length===0&&(i.value=-1)},d=(o,c)=>{const g=s.value[o];g&&(g.content=c)},P=o=>{l.value=o},D=()=>{const o=l.value,c=o.lastIndexOf("/");c>0?l.value=o.substring(0,c):l.value="/"},A=()=>{r.value++},v=o=>{k.value=o,o||(x.value="",A())},fe=(o,c)=>{x.value=o,b.value=c,A()},de=o=>{u.value=o},pe=async()=>{const{message:o}=await ie({path:xe});if(z(o)){const c=JSON.parse(o.data);Object.assign(f.value,{...Ce,...c})}},W=async()=>{await me({data:JSON.stringify({supportedModes:f.value.supportedModes,nameOverrides:f.value.nameOverrides,encodingList:f.value.encodingList,themeList:f.value.themeList,aceEditor:f.value.aceEditor,fontFamily:f.value.fontFamily,encoding:f.value.encoding}),path:xe,encoding:f.value.encoding||"UTF-8",force:1})},Q=(o,c=!0,g=!0)=>new Promise(async(C,I)=>{const h=s.value[o];if(h.type==="shortcut"){C();return}try{const{message:j}=await me({data:h.content,path:h.path,encoding:h.encoding,st_mtime:h.st_mtime,force:0},c);z(j)&&(j.status?(h.originalContent=h.content,h.history=j.historys||[],h.st_mtime=Number(j.st_mtime),g&&L.success(j.msg),C()):oe({title:E("fileEditor.store.conflictTitle"),content:j.result||E("fileEditor.store.conflictContentFallback"),confirmText:E("fileEditor.store.forceSave"),confirmType:"warning",onConfirm:async()=>{try{const{message:U}=await me({data:h.content,path:h.path,encoding:h.encoding,st_mtime:h.st_mtime,force:1},!0);z(U)&&(h.originalContent=h.content,h.history=U.historys||[],h.st_mtime=Number(U.st_mtime),g&&L.success(U.msg),C())}catch(U){I(U)}},onCancel:()=>I(new Error("User cancelled override."))}))}catch(j){I(j)}}),B=async(o,c=!0,g=!0)=>{await Q(o,c,g),N(o)},ee=async()=>{m.value&&m.value.content!==m.value.originalContent&&await Q(i.value)},ne=async()=>{const o=L.loading(E("fileEditor.store.saveAllLoading"));try{const c=s.value.map((g,C)=>g.content!==g.originalContent&&g.type!=="shortcut"?Q(C,!1,!1):null).filter(Boolean);c.length>0&&(await Promise.all(c),L.success(E("fileEditor.store.saveAllSuccess")))}finally{o.close()}},O=(o,c)=>c==="CRLF"?o.replace(/\r?\n/g,"\r\n"):c==="LF"?o.replace(/\r\n/g,"\n"):o;return{isOpen:t,isMinimize:e,unminimize:a,toolsModal:n,currentPath:l,fileList:s,currentFileIndex:i,currentFile:m,refreshKey:r,isLoading:u,editorConfig:f,creatingType:p,isSearchMode:k,searchWord:x,searchAll:b,openFile:Y,openShortcutTab:S,openDiffTab:M,closeTab:N,updateTabContent:d,setCurrentPath:P,goToParent:D,refreshFileList:A,setLoading:de,getEditorConfig:pe,saveEditorConfig:W,saveFileContent:Q,saveFileContentAndClose:B,saveCurrentFileContent:ee,saveAllFile:ne,getFileContent:R,changeLineEnding:async o=>{!m.value||m.value.type==="shortcut"||(m.value.content=O(m.value.content,o),await ee(),m.value.lineEnding=o)},changeEncoding:async o=>{if(!m.value||m.value.type==="shortcut")return;const c=m.value.path;f.value.aceEditor.encoding=o,await W(),m.value.encoding=o,await Q(i.value,!0,!0),R(c)},changeTheme:async o=>{f.value.aceEditor.editorTheme=o,await W()},toggleSetting:async o=>{const c=f.value.aceEditor;c[o]=!c[o],await W()},updateTabSettings:async(o,c)=>{f.value.aceEditor.useSoftTabs=o!=="tab",f.value.aceEditor.tabSize=c,await W(),L.success(E("fileEditor.store.tabSettingsRefreshed"))},getCurrentFileContent:q,startCreateNewItem:o=>{p.value=o},cancelCreateNewItem:()=>{p.value=null},confirmCreateNewItem:async o=>{if(!o.trim()){L.warning(E("fileEditor.store.nameRequired"));return}const c=p.value;c==="file"?await lt({path:"".concat(l.value,"/").concat(o)}):c==="folder"&&await ot({path:"".concat(l.value,"/").concat(o),name:o}),L.success(E("fileEditor.store.createSuccess",{type:E(c==="file"?"fileEditor.store.newFile":"fileEditor.store.newFolder")})),p.value=null,A()},toggleSearchMode:v,executeSearch:fe,openToolsModal:(o,c)=>{n.value={show:!0,type:o,data:c||{}}},closeToolsModal:()=>{n.value={show:!1,type:null,data:{}}}}}),Me=(t,e)=>{const a=vt();if(a.isOpen){a.openFile(t),a.unminimize&&a.unminimize();return}Pe({width:"1440px",height:"80vh",bgColor:"transparent",hideClose:!0,showMask:!1,data:{filePath:t,currentPath:e},component:Ee(()=>Oe(()=>import("./index-BFsKxFBK.js?v=1777002971908"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])))})},gt=Le(t=>Lt(t),100),{t:T}=ae.global;async function _(t,e){var q;const{tableLoading:a,currentPath:n,favoriteList:s,fileRecycle:i,fileList:l,filesView:r,dirNums:u,fileNums:f,total:p,page:k,size:x,sort:b,reverse:m,diskMountPoint:K,currentFile:Y,currentDirSize:S,uploadFileList:M,dragUploadRef:R}=t;a.value=!0;try{const N=await ia(n.value,v=>{s.value=v.store,i.value=v.file_recycle,u.value=v.dir.length,f.value=v.files.length,p.value=Se(v.page),K.value=v.disk,n.value=v.path},{p:k.value,showRow:x.value,...b.value?{sort:b.value,reverse:m.value}:{},disk:!0,...e});Y.value=null,S.value=-1;const d=await Ne(t);let P=[];d.length&&(P=d.map(v=>v.key));const D=await pt(t);let A=[];D.length&&(A=D.map(v=>v.filename)),l.value=N.map(v=>(v.remarks_hover=!1,v.isEditRemarks=!1,v.isCreate=!1,v.card_hover=!1,v.card_choosed=!1,v.isRenameForCard=!1,v.operation_show=!1,P.includes(v.path)?v.isFavorite=!0:v.isFavorite=!1,A.includes(v.path)&&(v.isShare=!0),v)),M.value=[],(q=R.value)==null||q.listenDragEvent(),re(()=>{r.value=="list"&&(Re(t),Ct(t))}),la(t)}catch(N){console.warn(N)}finally{a.value=!1}}function Re(t){const{tableRef:e}=t;e.value&&ut(e.value.querySelector(".n-data-table-base-table-body"),a=>ht(t,a),(a,n)=>yt(a,n,t))}async function Ne(t){const{resetFavoriteOptions:e,favoriteOptions:a}=t;try{const s=(await y.post("/files?action=get_files_store",{},{requestOptions:{isOriginalResult:!0}})).message.map(i=>({type:i.type,icon:i.type,label:i.name,key:i.path}));return e(),a.value=[...s,...a.value],a.value}catch(n){return console.warn(n),[]}}function ht(t,e){const{trRectArr:a,choosedKeys:n}=t,s=[];for(let i=0;i<a.value.length;i++){const[[l,r]]=Object.entries(a.value[i]);ft(e,r.getClientRects()[0])&&s.push(l)}n.value=[...new Set(s)]}function yt(t,e,a){const{choosedKeys:n}=a;if(!t.target.closest(".n-checkbox-box")){if(t.target.classList.contains("file-checkbox")){const s=t.target.closest("tr").dataset.key;n.value.includes(s)?n.value=n.value.filter(i=>i!==s):n.value.push(s);return}if(wt(a),t.target.closest("tr")){const s=t.target.closest("tr").dataset.key;if(t.button==0&&(n.value=[s]),t.button==2){if(n.value.includes(s))return;n.value=[s]}}t.target.nodeName=="INPUT"?e.m_flag.value=!1:e.m_flag.value=!0}}function wt(t){const{normalTrList:e,trRectArr:a}=t;e.value=document.querySelectorAll('[class*="normal-tr"]');const n=[];for(let s=0;s<e.value.length;s++){const i=e.value[s].dataset.key;n.push({[i]:e.value[s]})}a.value=n}function Fa(t,e){const{currentPath:a}=t;e.type=="dir"?(a.value=a.value=="/"?"/".concat(e.nm):a.value+"/"+e.nm,_(t)):Ge(e)?ve(t,e.path):ue(e.ext)?F(t,"Decompress",n=>n.value.open()):he(e.ext)?ge(t,e):ze(t)}function bt(t,e,a){const{currentPath:n}=t,{type:s,name:i}=a,l=Ue(i,s);if(console.log(a),s=="dir")n.value=e,_(t);else if(sa(l))ve(t,e);else if(ue(l))F(t,"Decompress",r=>r.value.open(e,l));else if(he(l))ge(t,{path:e,nm:a.name});else{const r=e.substring(0,e.lastIndexOf("/"));Me(e,r)}}function Ct(t){const{tableRef:e,choosePathRef:a}=t;let n=0;const s=setInterval(()=>{if(n<10?n++:clearInterval(s),e.value){const i=e.value;i.querySelector(".n-data-table-base-table-body")&&Re(t),i.oncontextmenu=l=>{l.preventDefault(),xt(l,t)},i.onclick=l=>{l.target.nodeName!="INPUT"&&(gt(t),a.value.handleEnterDown())},clearInterval(s)}else return},1e3)}function xt(t,e){const{choosedKeys:a,contextRef:n}=e;let s="empty";t.target.closest("tr")&&(a.value.length>1?s="multiple":a.value.length==1?s="single":s="empty"),n.value.filesOperation(t,s)}function De(){var e;const t=(e=document.querySelector("#createInput"))==null?void 0:e.querySelector("input");t==null||t.focus(),t==null||t.select()}async function _a(t){try{return(await y.post("/files?action=GetDirSize",{path:t},{requestOptions:{isOriginalResult:!0}})).message}catch(e){return console.warn(e),"计算失败"}}const ka=Le((t,e)=>{const{choosedKeys:a}=t;if(e.type=="dir")a.value=[e.nm],Ke(t);else return},200);async function Sa(t,e){const{close:a}=L.loading("Processing, please wait...");try{await Ve("tamper_core",71);const{message:n}=await y.post("/tamper_core/get_effective_path.json",{path:e.path},{requestOptions:{isOriginalResult:!0}});if(z(n)&&n.status){const{data:s}=n;e.type==="dir"?Ft(t,e,s):_t(t,e,s)}}finally{a()}}function Ft(t,e,a){const{pid:n,lock:s,action:i}=a,l=(s?"Turning off protection ":"Turning on protection ")+"[".concat(e.path,"]"),r=T(s?"file.tableController.afterTurningOffProtectionDir":"file.tableController.afterTurningOnProtectionDir");oe({width:480,title:l,content:r,onConfirm:async()=>{if(i[0]==="create"&&n===0){await Ie(e.path,[]),_(t);return}const u=[];s?u.push({key:e.path.indexOf("/www/server/panel/class")!=-1?"add_wd":i[0],values:[e.path]}):u.push({key:i[0],values:[e.path]}),await qe(n,u),_(t)}})}function _t(t,e,a){const{pid:n,lock:s,action:i}=a,l=s?T("file.tableController.turningOffProtection",{path:e.path}):T("file.tableController.turningOnProtection",{path:e.path}),r=T(s?"file.tableController.afterTurningOffProtectionFile":"file.tableController.afterTurningOnProtectionFile"),u=w(!1),f=w(!0);oe({title:l,width:480,content:()=>G(Ze,null,[G("div",null,[r]),G("div",{class:"mt-8px"},[G(be,{checked:f.value,"onUpdate:checked":p=>f.value=p},{default:()=>[G("span",null,[s?T("file.tableController.turningOffProtectionFile",{path:e.nm}):T("file.tableController.turningOnProtectionFile",{path:e.nm})])]})]),G("div",{class:"mt-8px"},[G(be,{checked:u.value,"onUpdate:checked":p=>u.value=p},{default:()=>[G("span",null,[s?T("file.tableController.turningOffProtectionSuffix",{suffix:e.ext}):T("file.tableController.turningOnProtectionSuffix",{suffix:e.ext})])]})])]),onConfirm:async()=>{if(i[0]==="create"&&n===0){const k=e.path.substring(0,e.path.lastIndexOf("/")),x=[];if(f.value){const b=e.path.split("/"),m=b.length>=2?b[b.length-2]:"";x.push("".concat(m,"/").concat(e.nm))}u.value&&x.push("."+e.ext),await Ie(k,x),_(t);return}const p=[];s?(f.value&&(p.push({key:"remove_bf",values:[e.path]}),p.push({key:"add_wf",values:[e.path]})),u.value&&p.push({key:"remove_bf",values:["."+e.ext]})):(f.value&&(p.push({key:"add_bf",values:[e.path]}),p.push({key:"remove_wf",values:[e.path]})),u.value&&p.push({key:"add_bf",values:["."+e.ext]})),await qe(n,p),_(t)}})}async function Ie(t,e){const{message:a}=await y.post("/tamper_core/create_path.json",{path:t,exts:JSON.stringify(e)},{requestOptions:{loading:T("file.tableController.creatingDirectoryProtection"),isOriginalResult:!0}});if(z(a))if(a.status)L.success(a.msg);else return L.error(a.msg),Promise.reject()}async function qe(t,e){const{message:a}=await y.post("/tamper_core/batch_setting.json",{pid:t,settings:JSON.stringify(e)},{requestOptions:{loading:T("file.tableController.executing"),isOriginalResult:!0}});if(z(a))if(a.status)L.success(a.msg);else return L.error(a.msg),Promise.reject()}function ve(t,e){const{currentPreviewImg:a,previewShow:n}=t;a.value=e,n.value=!0}function ge(t,e){const{currentPreviewVideo:a,previewVideoShow:n}=t;a.value={path:e.path,name:e.nm},n.value=!0}async function kt(t){await y.post("/files?action=set_file_ps",t,{requestOptions:{successMessage:!0}})}async function St(t){const{currentFile:e,currentPath:a}=t;if(e.value&&(e.value.isCreate&&e.value.isRename||e.value.isRenameForCard)&&(e.value.editName||(e.value.isCreate=!1),e.value.editName==e.value.nm&&(e.value.isCreate=!1),e.value.isCreate&&e.value.isRename||e.value.isRenameForCard))if(e.value.editName!==e.value.nm){try{await zt(e.value.path,a.value+"/"+e.value.editName),_(t)}catch(n){console.log(n)}finally{e.value.isCreate=!1,e.value.isRenameForCard=!1,e.value.isRename=!1}return!0}else e.value.isCreate=!1,e.value.isRenameForCard=!1,e.value.isRename=!1}async function Pt(t){const{currentFile:e,currentPath:a,fileList:n}=t;if(e.value&&e.value.isCreate&&!e.value.isRename)if(e.value.editName=="")n.value.shift();else try{return e.value.type=="dir"?await Et(a.value+"/"+e.value.editName):await Mt(a.value+"/"+e.value.editName),await _(t),!0}catch(s){n.value.shift(),console.warn(s)}}async function Ot(t){const{currentFile:e}=t;if(e.value&&e.value.isEditRemarks)return e.value.editRemarks!=e.value.rmk?(await kt({filename:e.value.path,ps_type:0,ps_body:e.value.editRemarks}),await _(t),!0):(e.value.isEditRemarks=!1,e.value.remarks_hover=!1,!1)}async function Lt(t){await Ot(t)||await St(t)||await Pt(t)}async function Tt(){return y.post("/task?action=get_task_lists",{status:-3})}async function Pa(t){if(document.querySelector(".file-task-modal"))return;const{message:a}=await Tt();Je(a)&&a.length>0&&Pe({title:T("file.tableController.realtimeTaskQueue"),width:510,class:"file-task-modal",unstableShowMask:!1,data:{store:t,taskList:a},component:Ee(()=>Oe(()=>import("./FileTask-DIEvlh_r.js?v=1777002971908"),__vite__mapDeps([19,4,1,2,3,5,6,20,7,14,21])))})}async function Oa(t){return y.post("/task?action=remove_task",{id:t},{requestOptions:{loading:T("file.tableController.deletingTask"),successMessage:!0}})}const{t:te}=ae.global;async function Et(t){try{await y.post("/files?action=CreateDir",{path:t},{requestOptions:{loading:te("file.buttonGroup.loading.creatingDirectory"),successMessage:!0}})}catch(e){console.warn(e)}}async function Mt(t){try{await y.post("/files?action=CreateFile",{path:t},{requestOptions:{loading:te("file.buttonGroup.loading.creatingFile"),successMessage:!0}})}catch(e){console.warn(e)}}async function La(t,e){try{await y.post("/files?action=CreateLink",{sfile:t,dfile:e},{requestOptions:{loading:te("file.buttonGroup.loading.creatingSoftlink"),successMessage:!0}})}catch(a){console.warn(a)}}function Ta(t,e){const{filesView:a}=t;a.value=e}function Ea(t){F(t,"UploadFile",e=>{e.value.open()})}function Ma(t){F(t,"RemoteDownload",e=>{e.value.open()})}function Ra(t){F(t,"SearchFileContent",e=>{e.value.open()})}const Rt=t=>{F(t,"FavoriteList",e=>{e.value.open()})};function Na(t,e,a){e=="management"?Rt(t):bt(t,e,a)}function Da(t){F(t,"ShareList",e=>{e.value.open()})}function Ia(t){const{currentPath:e}=t;e.value="/",_(t)}function qa(t){F(t,"Backup",e=>{e.value.open()})}function Aa(t){F(t,"Recycle",e=>{e.value.open()})}function ja(t){F(t,"Terminal",e=>{e.value.open()})}function le(t,e,a,n){const{fileList:s,currentFile:i}=t,l={nm:e,isCreate:!0,type:a,ext:n,path:"",editName:e};i.value=l,i.value.editName=i.value.nm,s.value.unshift(i.value),re(De)}function $a(t,e){switch(e){case"dir":le(t,te("file.buttonGroup.defaultNames.untitledDirectory"),"dir","folder");break;case"file":le(t,te("file.buttonGroup.defaultNames.untitledFile"),"file","unknown");break;case"softlink":F(t,"Softlink",a=>{a.value.open()})}}function za(t){const{optionToolsRef:e,isMiniScreen:a}=t;e.value.offsetWidth<1560?a.value=!0:a.value=!1}async function Nt(t,e){try{await y.post("/files?action=del_files_store",{path:e},{requestOptions:{loading:te("file.buttonGroup.loading.deletingFavorite"),successMessage:!0}}),_(t)}catch(a){console.warn(a)}}const{t:H}=ae.global,Dt=(t,e)=>{const{fileRecycle:a}=t;return a.value?It(t,e):qt(t,e)},It=(t,e)=>new Promise(a=>{const{currentPath:n,choosedKeys:s,fileList:i}=t,l=e||i.value.filter(r=>s.value.includes(r.nm));oe({title:l.length===1?H("file.deleteController.deleteSingleFileTitle",{name:l[0].nm}):H("file.deleteController.batchDeleteTitle"),content:H("file.deleteController.recycleBinMessage"),width:400,onConfirm:async()=>{if(l.length===1)await Ae(l[0].path,l[0].type);else{let r=n.value;if(e&&l.length>0){const u=l[0].path.lastIndexOf("/");u!==-1&&(r=l[0].path.substring(0,u))}await je(l.map(u=>u.nm),r)}_(t),a()}})}),qt=(t,e)=>new Promise(a=>{const{currentPath:n,choosedKeys:s,fileList:i}=t,l=e||i.value.filter(r=>s.value.includes(r.nm));He({title:l.length===1?H("file.deleteController.deleteSingleFileTitle",{name:l[0].nm}):H("file.deleteController.batchDeleteTitle"),content:()=>G("span",{class:"text-error"},[H("file.deleteController.permanentDeleteMessage")]),width:400,onConfirm:async()=>{if(l.length===1)await Ae(l[0].path,l[0].type);else{let r=n.value;if(e&&l.length>0){const u=l[0].path.lastIndexOf("/");u!==-1&&(r=l[0].path.substring(0,u))}await je(l.map(u=>u.nm),r)}_(t),a()}})});async function Ae(t,e){await y.post("/files?action=".concat(e==="dir"?"DeleteDir":"DeleteFile"),{path:t},{requestOptions:{loading:H("file.deleteController.deletingSingle"),successMessage:!0}})}async function je(t,e){await y.post("/files?action=SetBatchData",{data:JSON.stringify(t),type:4,path:e},{requestOptions:{loading:H("file.deleteController.deletingBatch"),successMessage:!0}})}const{t:$}=ae.global;async function Fe(t,e){return(await y.post("/files?action=CheckExistsFiles",{dfile:t,filename:e},{requestOptions:{isOriginalResult:!0}})).message.length>0}async function At(t,e,a){return await y.post("/files?action=SetBatchData",{data:JSON.stringify(t),type:e,path:a},{requestOptions:{loading:$("file.contextMenu.loading.batchSetting"),successMessage:!0}})}async function jt(t,e){return await y.post("/files?action=CopyFile",{sfile:t,dfile:e},{requestOptions:{loading:$("file.contextMenu.loading.copying"),successMessage:!0}})}async function $t(t,e){return await y.post("/files?action=BatchPaste",{type:t,path:e},{requestOptions:{loading:$("file.contextMenu.loading.pasting"),successMessage:!0}})}async function $e(t,e,a){return await y.post("/files?action=MvFile",{sfile:t,dfile:e,...a},{requestOptions:{loading:$("file.contextMenu.loading.moving"),successMessage:!0}})}function zt(t,e){return $e(t,e,{rename:!0})}async function Ka(t,e,a,n){try{await y.post("/files?action=Zip",{sfile:t,dfile:e,z_type:a,path:n},{requestOptions:{loading:$("file.contextMenu.loading.compressing"),successMessage:!0}})}catch(s){console.warn(s)}}async function Ba(t){await y.post("/files?action=UnZip",t,{requestOptions:{loading:$("file.contextMenu.loading.decompressing"),successMessage:!0}})}function _e(t,e){return e.map(a=>t[a])}function Ua(t,e){const{fileList:a,choosedKeys:n}=t,s=X(a.value,n.value)[0];let i=["share","favorite","permission","copy","copyPath","cut","rename","del","compression","attrs"];if(!s)return _e(e.value,["refresh","upload","create","terminal"]);if(s.type=="dir"?i.unshift("open","openNewWindow"):i.unshift("edit","download"),Ge(s)&&(i.unshift("preview"),i=i.filter(l=>l!=="edit")),he(s.ext)&&(i.unshift("playVideo"),i=i.filter(l=>l!=="edit")),s.isFavorite){const l=i.findIndex(r=>r=="favorite");i[l]="unfavorite"}if(s.isShare){const l=i.findIndex(r=>r=="share");i[l]="unShare"}return ue(s.ext)&&(i.unshift("decompress"),i=i.filter(l=>l!=="edit")),_e(e.value,i)}function ze(t){const{choosedKeys:e,currentPath:a,fileList:n}=t,s=n.value.find(i=>i.nm==e.value[0]);s&&Me(s.path,a.value)}function Ke(t){const{choosedKeys:e,currentPath:a,fileList:n}=t,s=n.value.find(i=>i.nm==e.value[0]);t.page.value=1,a.value=s.path,_(t)}async function Kt(t){const{choosedKeys:e,fileList:a}=t,n=a.value.find(s=>s.nm==e.value[0]);try{await y.post("/files?action=add_files_store",{path:n.path},{requestOptions:{loading:$("file.contextMenu.loading.addingToFavorites"),successMessage:!0}}),Ne(t),_(t)}catch(s){console.warn(s)}}async function Bt(t){const{choosedKeys:e,fileList:a}=t,n=X(a.value,e.value)[0];Nt(t,n.path)}async function Be(t,e,a){const{choosedKeys:n,fileList:s,fileCopyCache:i,waitForPaste:l,copiedFile:r,currentPath:u}=t;if(n.value.length==1)L.success(e),i.value=JSON.parse(JSON.stringify(n.value)),r.value=X(s.value,i.value)[0],l.value=!0;else try{(await At(n.value,a,u.value)).status==0&&(i.value=JSON.parse(JSON.stringify(n.value)),l.value=!0)}catch(f){console.warn(f)}}async function Ut(t){const{fileCopyCache:e,fileOperationFlag:a,currentPath:n,copiedFile:s,waitForPaste:i}=t;e.value.length>1?await $t(a.value,n.value):e.value.length==1&&(a.value==1?await jt(s.value.path,n.value+"/"+s.value.nm):a.value==2&&await $e(s.value.path,n.value+"/"+s.value.nm)),_(t),i.value=!1}async function Gt(t){const{fileOperationFlag:e,waitForPaste:a}=t;e.value=1,await Be(t,$("file.contextMenu.messages.copySuccess"),1),a.value=!0}async function Jt(t){const{choosedKeys:e,fileList:a}=t,n=X(a.value,e.value)[0];n&&ct(n.path)}async function Vt(t){const{fileOperationFlag:e,waitForPaste:a}=t;e.value=2,await Be(t,$("file.contextMenu.messages.cutSuccess"),2),a.value=!0}async function Ht(t){const{fileCopyCache:e,currentPath:a,waitForPaste:n}=t;if(!n.value)return;let s=!1;e.value.length==1?s=await Fe(a.value,e.value[0]):e.value.length>1&&(s=await Fe(a.value)),s?e.value.length==1?F(t,"PasteSingleConfirm",i=>i.value.open()):e.value.length>1&&F(t,"PasteConfirm",i=>i.value.open()):Ut(t)}async function Xt(t){const{currentPath:e,choosedKeys:a}=t;Xe("".concat(e.value==="/"?"":e.value,"/").concat(a.value[0]))}async function Yt(t){const{choosedKeys:e,fileList:a,currentFile:n,filesView:s}=t,i=X(a.value,e.value)[0];n.value=i,s.value==="card"?(n.value.isRenameForCard=!0,n.value.editName=n.value.nm):(i.isCreate=!0,i.isRename=!0,i.editName=i.nm,re(De))}function Wt(t){F(t,"Compression",e=>e.value.open())}function Qt(t){const{choosedKeys:e,fileList:a}=t,n=X(a.value,e.value)[0];ve(t,n.path)}function Zt(t){const{choosedKeys:e,fileList:a,shareList:n}=t,s=X(a.value,e.value)[0],i=n.value.find(l=>l.filename.includes(s.nm));mt(t,i==null?void 0:i.id)}function ea(t){const{choosedKeys:e,fileList:a}=t,n=X(a.value,e.value)[0];ge(t,n)}function Ga(t,e){const{menuShow:a}=e;switch(t){case"edit":ze(e);break;case"copy":Gt(e);break;case"copyPath":Jt(e);break;case"cut":Vt(e);break;case"paste":Ht(e);break;case"permission":F(e,"Permission",n=>n.value.open());break;case"compression":Wt(e);break;case"decompress":F(e,"Decompress",n=>n.value.open());break;case"conversion":console.log("conversion");break;case"del":Dt(e);break;case"refresh":_(e);break;case"upload":F(e,"UploadFile",n=>n.value.open());break;case"createFile":le(e,$("file.contextMenu.defaultNames.untitledFile"),"file","file");break;case"createDir":le(e,$("file.contextMenu.defaultNames.untitledDirectory"),"dir","folder");break;case"download":Xt(e);break;case"terminal":F(e,"Terminal",n=>n.value.open());break;case"open":Ke(e);break;case"share":F(e,"Share",n=>n.value.open());break;case"unShare":Zt(e);break;case"favorite":Kt(e);break;case"unfavorite":Bt(e);break;case"rename":Yt(e);break;case"attrs":F(e,"Properties",n=>n.value.open());break;case"preview":Qt(e);break;case"playVideo":ea(e);break}a.value=!1}function ke(t){const{type:e,list:a,path:n}=t,s=[];for(const i of a)s.push(ta({type:e,item:i,path:n}));return s}function ta(t){const{type:e,item:a,path:n}=t,{nm:s,sz:i,is_link:l,lnk:r,mt:u,ctime:f,atime:p,gid:k,uid:x,group:b,user:m,acc:K,rmk:Y,durl:S,cmp:M,fav:R,top:q,sn:N}=a;return{ext:Ue(a.nm,e),nm:s,sz:i,mt:u,acc:K,user:m,is_link:l?r:"",lnk:r,durl:S,cmp:M,fav:R,rmk:Y,top:q,sn:N,path:aa(n,s),ctime:f,atime:p,gid:k,uid:x,group:b,type:e}}function Ue(t,e){if(e==="dir")return"folder";const a=["tar.gz"],n=t.toLowerCase();for(const i of a)if(n.endsWith(i))return i;const s=n.lastIndexOf(".");return s!==-1?n.substring(s+1):"file"}function aa(t,e){return na("".concat(t,"/").concat(e))}function na(t){return t.replace(/\/\//g,"/")}function ce(t){const e=["folder"],a=["txt","rtf","md","log","conf"],n=["json"],s=["htm","html","xhtml"],i=["css","less","scss"],l=["js","ts"],r=["php"],u=["pdf","pdfa","pdfx","pdfu"],f=["doc","docx","docm","dot","dotx","dotm"],p=["xlsx","xlsm","xltx","xltm"],k=["jpg","jpeg","png","gif","bmp","webp","tiff","tif","psd","ai","eps","cr2","cr3","nef","nrw","dng","svg","cdr","wmf","emf","apng","heic","ico","xbm","xpm","xcf","iff","pnm"],x=["py","java","js","ts","c","cpp","cs","php","rb","go","swift","kt","html","css","jsx","vue","scss","less","tsx","json","xml","yaml","yml","ini","properties","env","sql","pl","sh","bat","ps1","m","swift","kt","gradle","makefile","cmake","jar","war","exe","md","gitignore","dockerfile","yml","ipynb","asm","lua","rs","hs"],b=["zip","rar","7z","tar","tar.gz","gz","tgz","tar.bz2","tar.xz","cab","iso","msi","rpm","deb","xz","zipx","lz4","zst","rar5","part1.rar","rar.part1","z01","z02"];return e.includes(t)?"file-dir":a.includes(t)?"file-txt":n.includes(t)?"file-json":s.includes(t)?"file-html":i.includes(t)?"file-css":l.includes(t)?"file-js":r.includes(t)?"file-php":f.includes(t)?"file-doc":u.includes(t)?"file-pdf":p.includes(t)?"file-excel":k.includes(t)?"file-img":x.includes(t)?"file-sh":b.includes(t)?"file-compression":"file-unknown-file"}function Ja(t){return!!["file-txt","file-json","file-html","file-css","file-js","file-php","file-doc","file-sh"].includes(ce(t.ext))}function he(t){return["mp3","mp4","avi","mov","mkv","wmv","flv","3gp","3g2","vob","webm","ogv"].includes(t)}function Ge(t){return ce(t.ext)==="file-img"}function sa(t){return ce(t)==="file-img"}function ue(t){return ce(t)==="file-compression"}async function ia(t,e,a){try{const{message:n}=await y.post("/files?action=GetDirNew",{path:t,is_operating:!0,...a});e&&e(n);let s=ke({type:"dir",list:n.dir,path:n.path}),i=ke({type:"file",list:n.files,path:n.path});return s=s.map((l,r)=>({...l,protected:n.tamper_data.dirs&&n.tamper_data.dirs[r]?Number(n.tamper_data.dirs[r].split(";")[0]):0,protected_rule:n.tamper_data.dirs&&n.tamper_data.dirs[r]?Number(n.tamper_data.dirs[r].split(";")[1]):0})),i=i.map((l,r)=>({...l,protected:n.tamper_data.files&&n.tamper_data.files[r]?Number(n.tamper_data.files[r].split(";")[0]):0,protected_rule:n.tamper_data.files&&n.tamper_data.files[r]?Number(n.tamper_data.files[r].split(";")[1]):0})),[...s,...i]}catch(n){return console.warn(n),[]}}async function Va(t,e,a,n,s,i){const l=[],r=Math.ceil(t.size/a);for(let u=0;u<r;u++){const f=u*a,p=Math.min(f+a,t.size),k=t.slice(f,p),x=new FormData;x.append("f_path",n),x.append("f_name",t.name),x.append("f_size","".concat(t.size)),x.append("f_start","".concat(f)),x.append("blob",k),l.push(x)}try{for(let u=0;u<l.length;u++){const f=await y.post(e,l[u],{headers:{"Content-Type":"multipart/form-data"},requestOptions:{isOriginalResult:!0}});typeof f.message=="number"&&i&&i(f);const p=Math.round(u/l.length*100);s(p,f)}s(100,null)}catch(u){return console.log(u),Promise.reject({msg:u.message})}}function X(t,e){return t.filter(a=>e.includes(a.nm))}async function F(t,e,a){const{dynamicCmptObj:n,dynamicCmpt:s,dynamicCmptRef:i}=t,l=n[e]();await l.__asyncLoader(),s.value=l,re(()=>{a&&a(i)})}function la(t){const{choosedKeys:e}=t;e.value=[]}const oa=et({__name:"FileIcon",props:{ext:{type:String,default:""},size:{type:String,default:"medium"}},setup(t){const e=Te(()=>ue(t.ext)?"compress":t.ext==="Dir"?"folder":t.ext);return(a,n)=>(tt(),at("div",{class:nt(["files-icon",["table-".concat(st(e),"-icon"),"".concat(t.size,"-icon")]])},null,2))}}),Ha=Ye(oa,[["__scopeId","data-v-989c0bf5"]]);export{Ka as $,ve as A,Ja as B,ue as C,_a as D,Re as E,Ha as F,Fa as G,xt as H,Lt as I,ka as J,Sa as K,ut as L,Ke as M,ze as N,ft as O,Pa as P,he as Q,ke as R,$t as S,Fe as T,jt as U,Va as V,Me as W,Nt as X,mt as Y,pt as Z,La as _,Ma as a,Ba as a0,Tt as a1,Oa as a2,vt as a3,$a as b,za as c,F as d,Ra as e,Na as f,Da as g,Ea as h,ja as i,Ia as j,Gt as k,Vt as l,Wt as m,qa as n,Rt as o,Ht as p,Aa as q,Dt as r,Et as s,_ as t,_e as u,Ta as v,Ua as w,Ga as x,X as y,Ge as z};
|