directus-extension-storage-manager 1.2.7 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +1 -1
- package/package.json +1 -1
package/dist/app.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useApi as e,useStores as t,defineModule as a}from"@directus/extensions-sdk";import{ref as n,computed as l,defineComponent as o,resolveComponent as r,openBlock as i,createBlock as s,withCtx as d,createVNode as u,createElementBlock as c,Fragment as v,renderList as f,createTextVNode as p,toDisplayString as m,watch as g,onMounted as h,createCommentVNode as b,useModel as y,createElementVNode as _,mergeModels as k,withKeys as w,withModifiers as x,unref as S,isRef as C,normalizeClass as $,normalizeStyle as F,reactive as M,resolveDirective as V,withDirectives as z,onUnmounted as B,inject as I,toRefs as D,vShow as U,renderSlot as N,resolveDynamicComponent as A,mergeProps as E,createSlots as L,normalizeProps as P,guardReactiveProps as O,nextTick as j}from"vue";import{useRouter as T,useRoute as R,onBeforeRouteLeave as q,onBeforeRouteUpdate as K}from"vue-router";function J(e){if(!e||"object"!=typeof e)return!1;const t=e;if(!0===t.admin_access)return!0;const a=t.role;return!(!a||"object"!=typeof a||!0!==a.admin_access)}const W=n(!1),H=n(null),Q=n(null),G=n([]);function Y(){const t=e(),a=l(()=>Q.value||null),n=l({get:()=>G.value,set(e){G.value=e}});return null===H.value&&o(),{loading:W,folders:H,nestedFolders:a,fetchFolders:o,openFolders:n};async function o(){if(!W.value){W.value=!0;try{const e=await t.get("/folders",{params:{sort:"name",limit:-1,fields:["id","name","parent"]}}),a=e.data?.data||[];H.value=a,Q.value=function(e){const t=new Map;for(const a of e)if(a.parent){const e=t.get(a.parent)||[];e.push(a),t.set(a.parent,e)}const a=e=>{const n=t.get(e.id)||[];return n.length>0?{...e,children:n.map(a)}:{...e}};return e.filter(e=>null===e.parent).map(a)}(a)}catch{H.value=[],Q.value=[]}finally{W.value=!1}}}}const X=n([]),Z=n(!1),ee=n(null);function te(e){const t={"Content-Type":"application/json",Accept:"text/event-stream"},a=e?.defaults?.headers,n=a?.common?.Authorization||a?.Authorization||a?.common?.authorization||a?.authorization;return"string"==typeof n&&n&&(t.Authorization=n),t}function ae(){const t=e();return{storages:X,storagesLoading:Z,storagesError:ee,loadStorages:async function(e=!1){if(X.value.length&&!e)return X.value;Z.value=!0,ee.value=null;try{const e=await t.get("/storage-manager/storages");return X.value=e.data?.data||[],X.value}catch(e){throw ee.value=e?.response?.data?.errors?.[0]?.message||e?.message||"Failed to load storages",e}finally{Z.value=!1}},loadFiles:async function(e){const a=await t.get("/storage-manager/files",{params:{storage:e.storage||void 0,folder:null===e.folder?"null":e.folder||void 0,search:e.search||void 0,filter:e.filter?JSON.stringify(e.filter):void 0,recursive:e.recursive?"true":void 0,page:e.page||1,limit:e.limit||50,sort:e.sort||"-uploaded_on"}});return{data:a.data?.data||[],meta:a.data?.meta}},loadFolders:async function(e={}){const a=await t.get("/storage-manager/folders",{params:{parent:null===e.parent?"null":e.parent||void 0,storage:e.storage||void 0}});return{data:a.data?.data||[],root_files:a.data?.meta?.root_files}},loadFolderPath:async function(e){const a=await t.get(`/storage-manager/folders/${e}/path`);return a.data?.data||[]},migrate:async function(e){const a=await t.post("/storage-manager/migrate",e);return a.data?.data},migrateWithProgress:async function(e,a,n){return async function(e,t){if(!e.ok){let t=`Migration failed (${e.status})`;try{const a=await e.json();t=a?.errors?.[0]?.message||t}catch{}throw new Error(t)}if(!e.body)throw new Error("No response body for progress stream");const a=e.body.getReader(),n=new TextDecoder;let l="",o=null;for(;;){const{done:e,value:r}=await a.read();if(e)break;l+=n.decode(r,{stream:!0});const i=l.split("\n\n");l=i.pop()||"";for(const e of i){const a=e.split("\n");for(const e of a){const a=e.trim();if(!a.startsWith("data:"))continue;const n=a.slice(5).trim();if(!n)continue;let l;try{l=JSON.parse(n)}catch{continue}if(t(l),"done"===l.type&&(o=l.data),"error"===l.type)throw new Error(l.message||"Migration failed")}}}if(!o)throw new Error("Migration stream ended without a result");return o}(await fetch(function(e){const t=String(e?.defaults?.baseURL||"").replace(/\/$/,""),a="/storage-manager/migrate/stream";return t?`${t}${a}`:a}(t),{method:"POST",headers:te(t),body:JSON.stringify(e),credentials:"same-origin",signal:n}),a)}}}const ne=n({}),le=n(!1),oe=n([]);function re(){const t=e();async function a(e){try{const a=await t.get(`/storage-manager/storages/${encodeURIComponent(e)}/folder-tree`);ne.value={...ne.value,[e]:a.data?.data||[]}}catch{ne.value={...ne.value,[e]:[]}}}return{trees:ne,loading:le,openFolders:oe,loadTree:a,loadTrees:async function(e){le.value=!0;try{await Promise.all(e.map(e=>a(e)))}finally{le.value=!1}},refreshTree:async function(e){await a(e)}}}var ie=o({name:"NavFolderItem",__name:"nav-folder-item",props:{folder:{},currentFolder:{},clickHandler:{type:Function}},setup:e=>(t,a)=>{const n=r("v-icon"),l=r("v-list-item-icon"),o=r("v-text-overflow"),p=r("v-list-item-content"),m=r("v-list-item"),g=r("nav-folder-item",!0),h=r("v-list-group");return e.folder.children&&0!==e.folder.children.length?(i(),s(h,{key:1,clickable:"",scope:"files-navigation",value:e.folder.id,active:e.currentFolder===e.folder.id,"arrow-placement":"after","disable-groupable-parent":"",onClick:a[1]||(a[1]=t=>e.clickHandler({folder:e.folder.id}))},{activator:d(()=>[u(l,null,{default:d(()=>[u(n,{name:"folder",outline:""})]),_:1}),u(p,null,{default:d(()=>[u(o,{text:e.folder.name},null,8,["text"])]),_:1})]),default:d(()=>[(i(!0),c(v,null,f(e.folder.children,t=>(i(),s(g,{key:t.id,folder:t,"current-folder":e.currentFolder,"click-handler":e.clickHandler},null,8,["folder","current-folder","click-handler"]))),128))]),_:1},8,["value","active"])):(i(),s(m,{key:0,clickable:"",active:e.currentFolder===e.folder.id,onClick:a[0]||(a[0]=t=>e.clickHandler({folder:e.folder.id}))},{default:d(()=>[u(l,null,{default:d(()=>[u(n,{name:"folder",outline:""})]),_:1}),u(p,null,{default:d(()=>[u(o,{text:e.folder.name},null,8,["text"])]),_:1})]),_:1},8,["active"]))}});const se={class:"folder-picker-list-item"};var de=o({name:"StorageFolderPickerItem",__name:"storage-folder-picker-item",props:{folder:{},currentPath:{},clickHandler:{},disabled:{type:Boolean},disabledPaths:{},scope:{default:"storage-folder-picker"},valuePrefix:{default:""}},setup(e){const t=e;function a(e){return(t.disabledPaths||[]).some(t=>e===t||e.startsWith(`${t}/`))}const n=l(()=>Boolean(t.disabled)||a(t.folder.path)),o=l(()=>`${t.valuePrefix}${t.folder.path}`);return(t,l)=>{const g=r("v-icon"),h=r("v-list-item-icon"),b=r("v-list-item-content"),y=r("v-list-item"),_=r("storage-folder-picker-item",!0),k=r("v-list-group");return i(),c("div",se,[e.folder.children?.length?(i(),s(k,{key:1,clickable:"",scope:e.scope,value:o.value,active:e.currentPath===e.folder.path,disabled:n.value,"disable-groupable-parent":"","arrow-placement":"after",onClick:l[1]||(l[1]=t=>e.clickHandler(e.folder.path))},{activator:d(()=>[u(h,null,{default:d(()=>[u(g,{name:e.currentPath===e.folder.path?"folder_open":"folder"},null,8,["name"])]),_:1}),u(b,null,{default:d(()=>[p(m(e.folder.name),1)]),_:1})]),default:d(()=>[(i(!0),c(v,null,f(e.folder.children,t=>(i(),s(_,{key:t.path,folder:t,"current-path":e.currentPath,"click-handler":e.clickHandler,disabled:a(t.path),"disabled-paths":e.disabledPaths,scope:e.scope,"value-prefix":e.valuePrefix},null,8,["folder","current-path","click-handler","disabled","disabled-paths","scope","value-prefix"]))),128))]),_:1},8,["scope","value","active","disabled"])):(i(),s(y,{key:0,clickable:"",active:e.currentPath===e.folder.path,disabled:n.value,onClick:l[0]||(l[0]=t=>e.clickHandler(e.folder.path))},{default:d(()=>[u(h,null,{default:d(()=>[u(g,{name:e.currentPath===e.folder.path?"folder_open":"folder"},null,8,["name"])]),_:1}),u(b,null,{default:d(()=>[p(m(e.folder.name),1)]),_:1})]),_:1},8,["active","disabled"]))])}}});const ue={key:1,class:"folder-picker"},ce={key:0,class:"empty"};var ve=o({__name:"storage-folder-picker",props:{location:{},modelValue:{},disabledPaths:{}},emits:["update:modelValue"],setup(t,{emit:a}){const o=t,y=a,_=e(),k=n(!1),w=n([]),x=n(["root"]),S=l(()=>{const e=String(o.modelValue||"").replace(/^\/+|\/+$/g,"");if(!e)return[];const t=e.split("/").filter(Boolean),a=[];for(let e=1;e<t.length;e++)a.push(t.slice(0,e).join("/"));return a});async function C(){k.value=!0;try{const e=await _.get(`/storage-manager/storages/${encodeURIComponent(o.location)}/folder-tree`);w.value=e.data?.data||[]}catch{w.value=[]}finally{k.value=!1}}function $(e){y("update:modelValue",e)}return g(S,e=>{const t=new Set(x.value);t.add("root");for(const a of e)t.add(a);x.value=Array.from(t)},{immediate:!0}),g(()=>o.location,()=>{C()}),h(()=>{C()}),(e,a)=>{const n=r("v-skeleton-loader"),l=r("v-icon"),o=r("v-list-item-icon"),g=r("v-list-item-content"),h=r("v-list-group"),y=r("v-item-group"),_=r("v-list");return k.value?(i(),s(n,{key:0})):(i(),c("div",ue,[u(_,null,{default:d(()=>[u(y,{modelValue:x.value,"onUpdate:modelValue":a[1]||(a[1]=e=>x.value=e),scope:"storage-folder-picker",multiple:""},{default:d(()=>[u(h,{"disable-groupable-parent":"",clickable:"",active:""===t.modelValue,scope:"storage-folder-picker",value:"root","arrow-placement":w.value.length>0&&"after",onClick:a[0]||(a[0]=e=>$(""))},{activator:d(()=>[u(o,null,{default:d(()=>[u(l,{name:"storage"})]),_:1}),u(g,null,{default:d(()=>[p("Root ("+m(t.location)+")",1)]),_:1})]),default:d(()=>[(i(!0),c(v,null,f(w.value,e=>(i(),s(de,{key:e.path,folder:e,"current-path":t.modelValue,"click-handler":$,disabled:t.disabledPaths?.includes(e.path),"disabled-paths":t.disabledPaths},null,8,["folder","current-path","disabled","disabled-paths"]))),128))]),_:1},8,["active","arrow-placement"])]),_:1},8,["modelValue"])]),_:1}),w.value.length?b("v-if",!0):(i(),c("p",ce,"No storage folders yet."))]))}}}),fe=[],pe=[];function me(e,t){if(e&&"undefined"!=typeof document){var a,n=!0===t.prepend?"prepend":"append",l=!0===t.singleTag,o="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(l){var r=fe.indexOf(o);-1===r&&(r=fe.push(o)-1,pe[r]={}),a=pe[r]&&pe[r][n]?pe[r][n]:pe[r][n]=i()}else a=i();65279===e.charCodeAt(0)&&(e=e.substring(1)),a.styleSheet?a.styleSheet.cssText+=e:a.appendChild(document.createTextNode(e))}function i(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),t.attributes)for(var a=Object.keys(t.attributes),l=0;l<a.length;l++)e.setAttribute(a[l],t.attributes[a[l]]);var r="prepend"===n?"afterbegin":"beforeend";return o.insertAdjacentElement(r,e),e}}me("\n.folder-picker[data-v-10885802] {\n\t--v-list-item-background-color-hover: var(--theme--background-accent);\n\t--v-list-item-background-color-active: var(--theme--background-accent);\n\n\tpadding: 0.6875rem;\n\tbackground-color: var(--theme--background-normal);\n\tborder-radius: var(--theme--border-radius);\n\tmax-block-size: 17.5rem;\n\toverflow: auto;\n}\n.empty[data-v-10885802] {\n\tmargin: 8px 12px 4px;\n\tfont-size: 13px;\n\tcolor: var(--theme--foreground-subdued);\n}\n",{});var ge=(e,t)=>{const a=e.__vccOpts||e;for(const[e,n]of t)a[e]=n;return a},he=ge(ve,[["__scopeId","data-v-10885802"]]);const be={class:"radio-options"};var ye=o({__name:"delete-storage-folder-dialog",props:k({location:{},paths:{},folderName:{}},{modelValue:{type:Boolean,required:!0},modelModifiers:{}}),emits:k(["done"],["update:modelValue"]),setup(t,{emit:a}){const l=y(t,"modelValue"),o=t,h=a,b=e(),k=n("move"),w=n(!1),x=[{value:"move",label:"Move content one level up"},{value:"delete",label:"Delete all content"}];async function S(){if(!w.value&&o.location&&o.paths.length){w.value=!0;try{const e=await b.delete(`/storage-manager/storages/${encodeURIComponent(o.location)}/folders`,{data:{paths:o.paths,mode:k.value}}),t=e.data?.data?.skipped||[];if(t.length)return void window.alert(t[0]?.error||"Folder could not be deleted");l.value=!1,h("done")}catch(e){window.alert(e?.response?.data?.errors?.[0]?.message||e?.message||"Delete failed")}finally{w.value=!1}}}return g(l,e=>{e&&(k.value="move")}),(e,a)=>{const n=r("v-card-title"),o=r("v-radio"),g=r("v-card-text"),h=r("v-button"),b=r("v-card-actions"),y=r("v-card"),C=r("v-dialog");return i(),s(C,{"model-value":l.value,persistent:"","onUpdate:modelValue":a[2]||(a[2]=e=>l.value=e),onEsc:a[3]||(a[3]=e=>l.value=!1),onApply:S},{default:d(()=>[u(y,null,{default:d(()=>[u(n,null,{default:d(()=>[...a[4]||(a[4]=[p("Delete Folder",-1)])]),_:1}),u(g,null,{default:d(()=>[_("p",null,[t.folderName&&1===t.paths.length?(i(),c(v,{key:0},[p(" What should happen to the contents of “"+m(t.folderName)+"”? ",1)],64)):1===t.paths.length?(i(),c(v,{key:1},[p("What should happen to the folder contents?")],64)):(i(),c(v,{key:2},[p("What should happen to the contents of "+m(t.paths.length)+" folders?",1)],64))]),_("div",be,[(i(),c(v,null,f(x,e=>u(o,{key:e.value,modelValue:k.value,"onUpdate:modelValue":a[0]||(a[0]=e=>k.value=e),value:e.value,label:e.label},null,8,["modelValue","value","label"])),64))])]),_:1}),u(b,null,{default:d(()=>[u(h,{secondary:"",disabled:w.value,onClick:a[1]||(a[1]=e=>l.value=!1)},{default:d(()=>[...a[5]||(a[5]=[p("Cancel",-1)])]),_:1},8,["disabled"]),u(h,{kind:"danger",loading:w.value,onClick:S},{default:d(()=>[...a[6]||(a[6]=[p("Delete",-1)])]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1},8,["model-value"])}}});me("\n.radio-options[data-v-3129fd6a] {\n\tmargin-block-start: 0.675rem;\n}\n.radio-options .v-radio + .v-radio[data-v-3129fd6a] {\n\tmargin-block-start: 0.45rem;\n}\n",{});var _e=ge(ye,[["__scopeId","data-v-3129fd6a"]]);function ke(e){return String(e||"").replace(/\\/g,"/").replace(/^\/+|\/+$/g,"")}function we(e){return String(e).replace(/_/g,"__").replace(/ /g,"_")}function xe(e){let t=String(e||"");try{t=decodeURIComponent(t)}catch{}return t.replace(/__/g,"\0").replace(/_/g," ").replace(/\0/g,"_")}function Se(e){return ke(e).split("/").filter(Boolean).map(xe).join("/")}function Ce(e,t){const a=`/storage-manager/storage/${encodeURIComponent(e)}`,n=function(e){return ke(e).split("/").filter(Boolean).map(we).join("/")}(t);return n?`${a}/path/${n}`:a}var $e=o({__name:"storage-folder-context-menu",props:{location:{},path:{},name:{}},emits:["changed"],setup(t,{expose:a,emit:o}){const s=t,f=o,m=e(),h=T(),{refreshTree:b}=re(),y=n(null),_=n(!1),k=n(s.name),x=n(!1),S=n(!1),C=n(""),$=n(!1),F=n(!1),M=l(()=>{const e=String(s.path||""),t=e.lastIndexOf("/");return-1===t?"":e.slice(0,t)}),V=l(()=>[s.path]),z=l(()=>[s.path]);function B(){if(!h.currentRoute.value.path.includes("/storage/"))return"";return Se(Array.isArray(h.currentRoute.value.params.storagePath)?h.currentRoute.value.params.storagePath.filter(Boolean).join("/"):String(h.currentRoute.value.params.storagePath||""))}function I(e){const t=B();if(t&&(t===s.path||t.startsWith(`${s.path}/`))){const a=t===s.path?"":t.slice(s.path.length+1);h.replace(Ce(s.location,a?`${e}/${a}`:e))}}async function D(e){await b(s.location).catch(()=>{}),f("changed",e)}async function U(){if(k.value?.trim()&&!x.value){x.value=!0;try{const e=await m.patch(`/storage-manager/storages/${encodeURIComponent(s.location)}/folders`,{path:s.path,name:k.value.trim()}),t=String(e.data?.data?.path||"");_.value=!1,t&&I(t),await D(t||void 0)}catch(e){window.alert(e?.response?.data?.errors?.[0]?.message||e?.message||"Rename failed")}finally{x.value=!1}}}async function N(){if(!$.value){$.value=!0;try{const e=await m.patch(`/storage-manager/storages/${encodeURIComponent(s.location)}/folders`,{path:s.path,parent_path:C.value||""}),t=String(e.data?.data?.path||"");S.value=!1,t&&I(t),await D(t||void 0)}catch(e){window.alert(e?.response?.data?.errors?.[0]?.message||e?.message||"Move failed")}finally{$.value=!1}}}async function A(){const e=B();(e===s.path||e.startsWith(`${s.path}/`))&&h.replace(Ce(s.location,M.value||void 0)),await D(M.value||void 0)}return g(()=>s.name,e=>{_.value||(k.value=e)}),g(_,e=>{e&&(k.value=s.name)}),g(S,e=>{e&&(C.value=M.value)}),a({open:function(e){y.value?.activate?.(e)}}),(e,a)=>{const n=r("v-icon"),l=r("v-list-item-icon"),o=r("v-list-item-content"),s=r("v-list-item"),f=r("v-list"),m=r("v-menu"),g=r("v-card-title"),h=r("v-input"),b=r("v-card-text"),M=r("v-button"),B=r("v-card-actions"),I=r("v-card"),D=r("v-dialog");return i(),c(v,null,[u(m,{ref_key:"contextMenu",ref:y,"show-arrow":"",placement:"bottom-start"},{default:d(()=>[u(f,null,{default:d(()=>[u(s,{clickable:"",onClick:a[0]||(a[0]=e=>_.value=!0)},{default:d(()=>[u(l,null,{default:d(()=>[u(n,{name:"edit",outline:""})]),_:1}),u(o,null,{default:d(()=>[...a[12]||(a[12]=[p("Rename Folder",-1)])]),_:1})]),_:1}),u(s,{clickable:"",onClick:a[1]||(a[1]=e=>S.value=!0)},{default:d(()=>[u(l,null,{default:d(()=>[u(n,{name:"folder_move",outline:""})]),_:1}),u(o,null,{default:d(()=>[...a[13]||(a[13]=[p("Move to Folder",-1)])]),_:1})]),_:1}),u(s,{class:"danger",clickable:"",onClick:a[2]||(a[2]=e=>F.value=!0)},{default:d(()=>[u(l,null,{default:d(()=>[u(n,{name:"delete",outline:""})]),_:1}),u(o,null,{default:d(()=>[...a[14]||(a[14]=[p("Delete Folder",-1)])]),_:1})]),_:1})]),_:1})]),_:1},512),u(D,{modelValue:_.value,"onUpdate:modelValue":a[5]||(a[5]=e=>_.value=e),persistent:"",onEsc:a[6]||(a[6]=e=>_.value=!1),onApply:U},{default:d(()=>[u(I,null,{default:d(()=>[u(g,null,{default:d(()=>[...a[15]||(a[15]=[p("Rename Folder",-1)])]),_:1}),u(b,null,{default:d(()=>[u(h,{modelValue:k.value,"onUpdate:modelValue":a[3]||(a[3]=e=>k.value=e),autofocus:"",onKeyup:w(U,["enter"])},null,8,["modelValue"])]),_:1}),u(B,null,{default:d(()=>[u(M,{secondary:"",onClick:a[4]||(a[4]=e=>_.value=!1)},{default:d(()=>[...a[16]||(a[16]=[p("Cancel",-1)])]),_:1}),u(M,{disabled:!k.value?.trim(),loading:x.value,onClick:U},{default:d(()=>[...a[17]||(a[17]=[p("Save",-1)])]),_:1},8,["disabled","loading"])]),_:1})]),_:1})]),_:1},8,["modelValue"]),u(D,{modelValue:S.value,"onUpdate:modelValue":a[9]||(a[9]=e=>S.value=e),persistent:"",onEsc:a[10]||(a[10]=e=>S.value=!1),onApply:N},{default:d(()=>[u(I,null,{default:d(()=>[u(g,null,{default:d(()=>[...a[18]||(a[18]=[p("Move to Folder",-1)])]),_:1}),u(b,null,{default:d(()=>[u(he,{modelValue:C.value,"onUpdate:modelValue":a[7]||(a[7]=e=>C.value=e),location:t.location,"disabled-paths":V.value},null,8,["modelValue","location","disabled-paths"])]),_:1}),u(B,null,{default:d(()=>[u(M,{secondary:"",onClick:a[8]||(a[8]=e=>S.value=!1)},{default:d(()=>[...a[19]||(a[19]=[p("Cancel",-1)])]),_:1}),u(M,{loading:$.value,onClick:N},{default:d(()=>[...a[20]||(a[20]=[p("Save",-1)])]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1},8,["modelValue"]),u(_e,{modelValue:F.value,"onUpdate:modelValue":a[11]||(a[11]=e=>F.value=e),location:t.location,paths:z.value,"folder-name":t.name,onDone:A},null,8,["modelValue","location","paths","folder-name"])],64)}}});me("\n.v-list-item.danger[data-v-73188cf0] {\n\t--v-list-item-color: var(--theme--danger);\n\t--v-list-item-color-hover: var(--theme--danger);\n\t--v-list-item-icon-color: var(--theme--danger);\n}\n",{});var Fe=ge($e,[["__scopeId","data-v-73188cf0"]]),Me=o({name:"NavStorageFolderItem",__name:"nav-storage-folder-item",props:{location:{},folder:{},currentLocation:{},currentPath:{},clickHandler:{type:Function}},emits:["changed"],setup(e,{emit:t}){const a=t,l=n(null);function o(e,t,a,n){return a===e&&(n||"")===t}function p(e){l.value?.open(e)}function m(){a("changed")}return(t,a)=>{const n=r("v-icon"),g=r("v-list-item-icon"),h=r("v-text-overflow"),b=r("v-list-item-content"),y=r("v-list-item"),_=r("nav-storage-folder-item",!0),k=r("v-list-group");return i(),c(v,null,[e.folder.children&&0!==e.folder.children.length?(i(),s(k,{key:1,clickable:"",scope:"storage-navigation",value:(w=e.location,S=e.folder.path,`${w}:${S}`),active:o(e.location,e.folder.path,e.currentLocation,e.currentPath),"arrow-placement":"after","disable-groupable-parent":"",onClick:a[1]||(a[1]=t=>e.clickHandler({location:e.location,path:e.folder.path})),onContextmenu:x(p,["prevent"])},{activator:d(()=>[u(g,null,{default:d(()=>[u(n,{name:"folder",outline:""})]),_:1}),u(b,null,{default:d(()=>[u(h,{text:e.folder.name},null,8,["text"])]),_:1})]),default:d(()=>[(i(!0),c(v,null,f(e.folder.children,t=>(i(),s(_,{key:t.path,location:e.location,folder:t,"current-location":e.currentLocation,"current-path":e.currentPath,"click-handler":e.clickHandler,onChanged:m},null,8,["location","folder","current-location","current-path","click-handler"]))),128))]),_:1},8,["value","active"])):(i(),s(y,{key:0,clickable:"",active:o(e.location,e.folder.path,e.currentLocation,e.currentPath),onClick:a[0]||(a[0]=t=>e.clickHandler({location:e.location,path:e.folder.path})),onContextmenu:x(p,["prevent"])},{default:d(()=>[u(g,null,{default:d(()=>[u(n,{name:"folder",outline:""})]),_:1}),u(b,null,{default:d(()=>[u(h,{text:e.folder.name},null,8,["text"])]),_:1})]),_:1},8,["active"])),u(Fe,{ref_key:"menu",ref:l,location:e.location,path:e.folder.path,name:e.folder.name,onChanged:m},null,8,["location","path","name"])],64);var w,S}}}),Ve=o({name:"NavStorageItem",__name:"nav-storage-item",props:{storage:{},folders:{},currentLocation:{},currentPath:{},clickHandler:{type:Function}},setup:e=>(t,a)=>{const n=r("v-icon"),l=r("v-list-item-icon"),o=r("v-text-overflow"),p=r("v-list-item-content"),m=r("v-list-item"),g=r("v-list-group");return e.folders.length?(i(),s(g,{key:1,clickable:"",scope:"storage-navigation",value:(h=e.storage.location,`@${h}`),active:e.currentLocation===e.storage.location,"arrow-placement":"after","disable-groupable-parent":"",onClick:a[1]||(a[1]=t=>e.clickHandler({location:e.storage.location}))},{activator:d(()=>[u(l,null,{default:d(()=>[u(n,{name:e.storage.icon},null,8,["name"])]),_:1}),u(p,null,{default:d(()=>[u(o,{text:e.storage.location},null,8,["text"])]),_:1})]),default:d(()=>[(i(!0),c(v,null,f(e.folders,t=>(i(),s(Me,{key:t.path,location:e.storage.location,folder:t,"current-location":e.currentLocation,"current-path":e.currentPath,"click-handler":e.clickHandler},null,8,["location","folder","current-location","current-path","click-handler"]))),128))]),_:1},8,["value","active"])):(i(),s(m,{key:0,clickable:"",active:e.currentLocation===e.storage.location&&!e.currentPath,onClick:a[0]||(a[0]=t=>e.clickHandler({location:e.storage.location}))},{default:d(()=>[u(l,null,{default:d(()=>[u(n,{name:e.storage.icon},null,8,["name"])]),_:1}),u(p,null,{default:d(()=>[u(o,{text:e.storage.location},null,8,["text"])]),_:1})]),_:1},8,["active"]));var h}});const ze={class:"storages"},Be={class:"folders"};var Ie=o({__name:"navigation",setup(e){const t=R(),a=T(),{nestedFolders:n,folders:o,loading:p,openFolders:m}=Y(),{storages:y,loadStorages:k}=ae(),{trees:w,openFolders:x}=re(),$=l(()=>{if(!t.path.startsWith("/storage-manager/folders"))return;const e=t.params.folderId;return e?String(e):void 0}),F=l(()=>{if(t.path.startsWith("/storage-manager/storage/"))return String(t.params.location||"")||void 0}),M=l(()=>{if(!F.value)return"";const e=t.params.storagePath;return Se(Array.isArray(e)?e.filter(Boolean).join("/"):e?String(e):"")}),V=l(()=>"/storage-manager/folders"===t.path||"/storage-manager/folders/"===t.path),z=l(()=>"/storage-manager"===t.path||"/storage-manager/"===t.path),B=l(()=>t.path.startsWith("/storage-manager/settings"));function I(e){e.folder?a.push(`/storage-manager/folders/${e.folder}`):a.push("/storage-manager/folders")}function D(e){a.push(Ce(e.location,e.path))}function U(){a.push("/storage-manager")}function N(){a.push("/storage-manager/settings")}return g([$,p,o],function(){if(!o.value||p.value)return;if(!m?.value)return;if(!$.value)return;const e=["root"],t=o.value.find(e=>e.id===$.value);t?.parent&&function t(a){if(!o.value)return;e.push(a);const n=o.value.find(e=>e.id===a);n?.parent&&t(n.parent)}(t.parent);const a=[...m.value];let n=!1;for(const t of e)a.includes(t)||(a.push(t),n=!0);n&&(m.value=a)},{immediate:!0}),g([F,M,w],function(){const e=F.value;if(!e)return;const t=[`@${e}`],a=M.value;if(a){const n=a.split("/").filter(Boolean);for(let a=1;a<=n.length;a++)t.push(`${e}:${n.slice(0,a).join("/")}`)}x.value=Array.from(new Set([...x.value,...t]))},{immediate:!0,deep:!0}),h(()=>{k().catch(()=>{})}),(e,t)=>{const a=r("v-icon"),l=r("v-list-item-icon"),o=r("v-text-overflow"),g=r("v-list-item-content"),h=r("v-list-item"),k=r("v-divider"),A=r("v-skeleton-loader"),E=r("v-item-group"),L=r("v-list-group"),P=r("v-list");return i(),s(P,{nav:""},{default:d(()=>[u(h,{clickable:"",active:z.value,onClick:U},{default:d(()=>[u(l,null,{default:d(()=>[u(a,{name:"dashboard"})]),_:1}),u(g,null,{default:d(()=>[u(o,{text:"Storage Manager"})]),_:1})]),_:1},8,["active"]),u(k),!S(p)||S(n)&&0!==S(n).length?b("v-if",!0):(i(),c(v,{key:0},f(4,e=>u(h,{key:e},{default:d(()=>[u(A,{type:"list-item-icon"})]),_:1})),64)),t[3]||(t[3]=_("div",{class:"section-label"},"Storage adapters",-1)),_("div",ze,[u(E,{modelValue:S(x),"onUpdate:modelValue":t[0]||(t[0]=e=>C(x)?x.value=e:null),scope:"storage-navigation",multiple:""},{default:d(()=>[(i(!0),c(v,null,f(S(y),e=>(i(),s(Ve,{key:e.location,storage:e,folders:S(w)[e.location]||[],"current-location":F.value,"current-path":M.value,"click-handler":D},null,8,["storage","folders","current-location","current-path"]))),128))]),_:1},8,["modelValue"])]),u(k),_("div",Be,[u(E,{modelValue:S(m),"onUpdate:modelValue":t[2]||(t[2]=e=>C(m)?m.value=e:null),scope:"files-navigation",multiple:""},{default:d(()=>[u(L,{clickable:"",active:V.value||Boolean($.value),value:"root",scope:"files-navigation",exact:"","disable-groupable-parent":"","arrow-placement":!!(S(n)&&S(n).length>0)&&"after",onClick:t[1]||(t[1]=e=>I({}))},{activator:d(()=>[u(l,null,{default:d(()=>[u(a,{name:"folder_special",outline:""})]),_:1}),u(g,null,{default:d(()=>[u(o,{text:"Directus Folders"})]),_:1})]),default:d(()=>[(i(!0),c(v,null,f(S(n)||[],e=>(i(),s(ie,{key:e.id,folder:e,"current-folder":$.value,"click-handler":I},null,8,["folder","current-folder"]))),128))]),_:1},8,["active","arrow-placement"])]),_:1},8,["modelValue"])]),u(h,{clickable:"",active:B.value,onClick:N},{default:d(()=>[u(l,null,{default:d(()=>[u(a,{name:"settings"})]),_:1}),u(g,null,{default:d(()=>[u(o,{text:"Settings"})]),_:1})]),_:1},8,["active"])]),_:1})}}});me("\n.v-skeleton-loader[data-v-7be226a3] {\n\t--v-skeleton-loader-background-color: var(--theme--background-accent);\n}\n.folders[data-v-7be226a3],\n.storages[data-v-7be226a3] {\n\twidth: 100%;\n\toverflow-x: hidden;\n}\n.folders[data-v-7be226a3] .v-list-item-content,\n.storages[data-v-7be226a3] .v-list-item-content {\n\toverflow: hidden;\n\twhite-space: nowrap;\n\ttext-overflow: ellipsis;\n}\n.section-label[data-v-7be226a3] {\n\tpadding: 4px 12px 4px;\n\tfont-size: 11px;\n\tfont-weight: 700;\n\tletter-spacing: 0.04em;\n\ttext-transform: uppercase;\n\tcolor: var(--theme--foreground-subdued);\n}\n",{});var De=ge(Ie,[["__scopeId","data-v-7be226a3"]]);function Ue(e){if(null==e||!Number.isFinite(e)||e<0)return"—";if(0===e)return"0 B";const t=["B","KB","MB","GB","TB","PB"],a=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),n=e/Math.pow(1024,a),l=n>=100||0===a?0:n>=10?1:2;return`${n.toFixed(l)} ${t[a]}`}function Ne(e){if(null==e||!Number.isFinite(e)||e<0)return"—";const t=8*e/1e6;return t<.1?`${t.toFixed(2)} Mbit/s`:t<10?`${t.toFixed(1)} Mbit/s`:`${Math.round(t)} Mbit/s`}function Ae(e){if(null==e||!Number.isFinite(e)||e<0)return"—";const t=Math.floor(e/1e3),a=Math.floor(t/3600),n=Math.floor(t%3600/60),l=t%60;return a>0?`${a}h ${n}m ${l}s`:n>0?`${n}m ${l}s`:`${l}s`}const Ee={class:"usage-top"},Le={class:"label"},Pe={class:"value"},Oe={key:0,class:"track"},je={key:1,class:"secondary"};var Te=o({__name:"usage-bar",props:{usage:{},label:{default:"Usage"},compact:{type:Boolean,default:!1},plain:{type:Boolean,default:!1}},setup(e){const t=e,a=l(()=>t.usage.disk_available&&null!=t.usage.disk_used_percent),n=l(()=>{const e=t.usage.disk_used_percent??0;return Math.max(0,Math.min(100,e))}),o=l(()=>{const e=n.value;return e>=90?"danger":e>=75?"warning":"ok"}),r=l(()=>{return a.value?`${e=t.usage.disk_used_percent,null!=e&&Number.isFinite(e)?`${Math.round(e)}%`:"—"} used · ${Ue(t.usage.disk_used_bytes)} / ${Ue(t.usage.disk_total_bytes)}`:`${t.usage.file_count.toLocaleString()} files · ${Ue(t.usage.total_bytes)}`;var e}),s=l(()=>a.value?`${t.usage.file_count.toLocaleString()} files in Directus · ${Ue(t.usage.total_bytes)} · ${Ue(t.usage.disk_free_bytes)} free`:"Cloud quota not available — showing Directus-tracked size");return(t,l)=>(i(),c("div",{class:$(["usage-bar",{compact:e.compact,plain:e.plain}])},[_("div",Ee,[_("span",Le,m(e.label),1),_("span",Pe,m(r.value),1)]),a.value?(i(),c("div",Oe,[_("div",{class:$(["fill",o.value]),style:F({width:`${n.value}%`})},null,6)])):b("v-if",!0),s.value?(i(),c("div",je,m(s.value),1)):b("v-if",!0)],2))}});me("\n.usage-bar[data-v-475a6a41] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n\tpadding: 12px 14px;\n\tbackground: var(--theme--background-subdued);\n\tborder-radius: var(--theme--border-radius);\n\tborder: var(--theme--border-width) solid var(--theme--border-color-subdued);\n}\n.usage-bar.compact[data-v-475a6a41] {\n\tpadding: 8px 10px;\n}\n.usage-bar.plain[data-v-475a6a41] {\n\tpadding: 0;\n\tbackground: transparent;\n\tborder: none;\n\tborder-radius: 0;\n}\n.usage-top[data-v-475a6a41] {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\tgap: 12px;\n\talign-items: baseline;\n}\n.label[data-v-475a6a41] {\n\tfont-weight: 600;\n\tcolor: var(--theme--foreground);\n}\n.value[data-v-475a6a41] {\n\tfont-size: 13px;\n\tcolor: var(--theme--foreground);\n\ttext-align: right;\n}\n.track[data-v-475a6a41] {\n\theight: 8px;\n\tborder-radius: 999px;\n\tbackground: var(--theme--background-normal);\n\toverflow: hidden;\n}\n.fill[data-v-475a6a41] {\n\theight: 100%;\n\tborder-radius: inherit;\n\ttransition: width 200ms ease;\n}\n.fill.ok[data-v-475a6a41] {\n\tbackground: var(--theme--primary);\n}\n.fill.warning[data-v-475a6a41] {\n\tbackground: var(--theme--warning);\n}\n.fill.danger[data-v-475a6a41] {\n\tbackground: var(--theme--danger);\n}\n.secondary[data-v-475a6a41] {\n\tfont-size: 12px;\n\tcolor: var(--theme--foreground-subdued);\n}\n",{});var Re=ge(Te,[["__scopeId","data-v-475a6a41"]]);function qe(e){if("undefined"!=typeof document&&(document.querySelector(".root-split, .main-split")||document.querySelector("#navigation.module-bar")||document.querySelector("aside.module-nav:not(#navigation)")))return!1;const t=function(e){if("string"!=typeof e||!e)return null;const t=e.trim().replace(/^v/i,""),[a,n]=t.split("."),l=Number.parseInt(a||"",10),o=Number.parseInt(n||"",10);return Number.isFinite(l)?{major:l,minor:Number.isFinite(o)?o:0}:null}(e);return t?11===t.major&&t.minor<14:"undefined"!=typeof document&&Boolean(document.querySelector("#navigation:not(.module-bar)"))}function Ke(){const{useServerStore:e}=t(),a=e();return l(()=>{const e=["page"];return qe(a?.info?.version)&&e.push("page--flush-top"),e})}const Je="storage_manager",We="none",He="full_sync",Qe={image:"images",video:"videos",audio:"audio",text:"documents"},Ge="yyyy/MM",Ye=["none","folder","folder_id","type","date"],Xe=["full_sync","leave_old"];function Ze(e){const t=e&&"object"==typeof e?e:{};return{prefix_strategy:Ye.includes(t.prefix_strategy)?t.prefix_strategy:We,folder_sync_enabled:Boolean(t.folder_sync_enabled),folder_sync_rename:Xe.includes(t.folder_sync_rename)?t.folder_sync_rename:He,folder_sync_delete:"move_to_parent",date_format:"string"==typeof t.date_format&&t.date_format.trim()?t.date_format.trim():Ge,type_map:{...Qe,...t.type_map&&"object"==typeof t.type_map&&!Array.isArray(t.type_map)?t.type_map:{}}}}function et(e){if(!e||"object"!=typeof e)throw new Error("Invalid JSON: expected an object");const t=e,a=t.storage_manager&&"object"==typeof t.storage_manager?t.storage_manager:t;if(!a||"object"!=typeof a)throw new Error("Invalid config: expected storage_manager object");const n=a.locations;if(!n||"object"!=typeof n||Array.isArray(n))throw new Error("Invalid config: missing locations object");const l={};for(const[e,t]of Object.entries(n))e.trim()&&(l[e]=Ze(t));const o={locations:l};return"name_mirror_claims"in a&&(o.name_mirror_claims=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return{};const t={};for(const[a,n]of Object.entries(e))"string"==typeof a&&a&&"string"==typeof n&&n&&(t[a]=n);return t}(a.name_mirror_claims)),o}function tt(e){return e?{prefix_strategy:"folder",folder_sync_enabled:!0,folder_sync_rename:"full_sync"}:{prefix_strategy:"none",folder_sync_enabled:!1}}const at={key:0,class:"loading"},nt={class:"storage-grid"},lt={class:"card-head"},ot={class:"card-titles"},rt={class:"meta"},it={class:"tag"},st={key:0,class:"tag"},dt=["title"],ut={key:2,class:"tag tag-path"},ct={class:"card-strategy"},vt={class:"mirror-copy"};var ft=o({__name:"overview-view",setup(t){const a=T(),l=e(),o=Ke(),{storages:g,storagesError:y,loadStorages:k}=ae(),w=n(!0),x=M({});return h(async function(){w.value=!0;try{await k(!0)}finally{w.value=!1}}),(e,t)=>{const n=r("v-breadcrumb"),h=r("sidebar-detail"),k=r("v-progress-circular"),C=r("v-notice"),F=r("v-icon"),M=r("v-divider"),B=r("v-button"),I=r("v-checkbox"),D=r("private-view"),U=V("tooltip");return i(),s(D,{title:"Storage Manager",icon:"storage"},{headline:d(()=>[u(n,{items:[{name:"Storage Manager",to:"/storage-manager"}]})]),navigation:d(()=>[u(De)]),sidebar:d(()=>[u(h,{id:"about",icon:"info",title:"About"},{default:d(()=>[...t[0]||(t[0]=[_("p",{class:"sidebar-text"}," Move files between configured storage adapters and manage physical storage folders. Use Directus Folders view to materialize virtual folders into real storage paths. ",-1)])]),_:1})]),default:d(()=>[_("div",{class:$(S(o))},[w.value&&!S(g).length?(i(),c("div",at,[u(k,{indeterminate:""})])):S(y)?(i(),s(C,{key:1,type:"danger"},{default:d(()=>[p(m(S(y)),1)]),_:1})):(i(),c(v,{key:2},[u(M,{class:"section-divider",large:"","inline-title":!1,style:{"--v-divider-color":"var(--theme--border-color-subdued)"}},{icon:d(()=>[u(F,{name:"swap_horiz"})]),default:d(()=>[t[1]||(t[1]=p(" Storage Manager ",-1))]),_:1}),t[4]||(t[4]=_("p",{class:"page-intro"}," Browse, create, and move files and storage folders across your adapters. Use Materialize in Directus Folders view to convert virtual folder hierarchy into physical storage paths. ",-1)),_("div",nt,[(i(!0),c(v,null,f(S(g),e=>(i(),c("article",{key:e.location,class:"storage-card"},[_("div",lt,[u(F,{name:e.icon,large:""},null,8,["name"]),_("div",ot,[_("strong",null,m(e.location),1),_("span",null,m(e.label),1)]),u(B,{small:"",secondary:"",onClick:t=>{return n=e.location,void a.push(Ce(n));var n}},{default:d(()=>[...t[2]||(t[2]=[p("Browse",-1)])]),_:1},8,["onClick"])]),u(Re,{usage:e},null,8,["usage"]),_("div",rt,[_("span",it,m(e.file_count.toLocaleString())+" files",1),e.folder_count?(i(),c("span",st,m(e.folder_count.toLocaleString())+" folders",1)):b("v-if",!0),e.root?(i(),c("span",{key:1,class:"tag tag-path",title:e.root},m(e.root),9,dt)):e.bucket?(i(),c("span",ut,m(e.bucket),1)):b("v-if",!0)]),_("div",ct,[_("div",vt,[t[3]||(t[3]=_("strong",null,"Mirror Directus Folders",-1)),z(u(F,{name:"help_outline",small:""},null,512),[[U,"New uploads and folder rename/delete follow the Directus folder tree on this adapter.",void 0,{bottom:!0}]])]),u(I,{"model-value":e.mirror_directus_folders,disabled:Boolean(x[e.location]),"onUpdate:modelValue":t=>async function(e,t){const a=g.value.find(t=>t.location===e);if(!a||x[e])return;const n=Boolean(a.mirror_directus_folders);a.mirror_directus_folders=t,x[e]=!0;try{await l.patch("/storage-manager/settings",{locations:{[e]:tt(t)}})}catch{a.mirror_directus_folders=n,window.alert("Could not save Mirror Directus Folders.")}finally{x[e]=!1}}(e.location,t)},null,8,["model-value","disabled","onUpdate:modelValue"])])]))),128))])],64))],2)]),_:1})}}});me("\n.page[data-v-acfaa6b8] {\n\tpadding: var(--content-padding);\n\tpadding-block-end: var(--content-padding-bottom);\n\tmax-width: 1100px;\n}\n.page--flush-top[data-v-acfaa6b8] {\n\tpadding-block-start: 0;\n}\n.section-divider[data-v-acfaa6b8] {\n\tmargin-bottom: 12px;\n}\n.page-intro[data-v-acfaa6b8],\n.sidebar-text[data-v-acfaa6b8] {\n\tmargin: 0 0 24px;\n\tline-height: 1.55;\n\tcolor: var(--theme--foreground);\n}\n.sidebar-text code[data-v-acfaa6b8] {\n\tfont-family: var(--theme--fonts--monospace--font-family, monospace);\n\tfont-size: 0.9em;\n}\n.loading[data-v-acfaa6b8] {\n\tdisplay: flex;\n\tjustify-content: center;\n\tpadding: 48px 0;\n}\n.glossary-sidebar[data-v-acfaa6b8] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n}\n.glossary-scope[data-v-acfaa6b8] {\n\tmargin: 0;\n\tpadding: 10px 12px;\n\tfont-size: 12px;\n\tline-height: 1.45;\n\tcolor: var(--theme--foreground);\n\tbackground: var(--theme--background-normal);\n\tborder-radius: var(--theme--border-radius);\n\tborder: var(--theme--border-width) solid var(--theme--border-color-subdued);\n}\n.glossary-section[data-v-acfaa6b8] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n\tmargin-block-start: 8px;\n\tpadding: 14px 12px;\n\tborder-radius: var(--theme--border-radius);\n\tborder: var(--theme--border-width) solid var(--theme--border-color);\n\tborder-block-start-width: 2px;\n\tbackground: var(--theme--background-subdued);\n}\n.glossary-section-label[data-v-acfaa6b8] {\n\tdisplay: block;\n\tfont-size: 11px;\n\tfont-weight: 700;\n\tletter-spacing: 0.04em;\n\ttext-transform: uppercase;\n\tcolor: var(--theme--foreground);\n}\n.glossary-section-intro[data-v-acfaa6b8] {\n\tmargin: 0;\n\tfont-size: 12px;\n\tline-height: 1.4;\n\tcolor: var(--theme--foreground-subdued);\n}\n.glossary-section .glossary-item[data-v-acfaa6b8] {\n\tpadding-block-start: 10px;\n\tborder-block-start: var(--theme--border-width) solid var(--theme--border-color-subdued);\n}\n.glossary-sidebar .glossary-item strong[data-v-acfaa6b8] {\n\tdisplay: block;\n\tmargin-block-end: 4px;\n\tfont-size: 13px;\n}\n.glossary-sidebar .glossary-item p[data-v-acfaa6b8] {\n\tmargin: 0;\n\tfont-size: 12px;\n\tline-height: 1.4;\n\tcolor: var(--theme--foreground-subdued);\n}\n.storage-grid[data-v-acfaa6b8] {\n\tdisplay: grid;\n\tgrid-template-columns: repeat(2, minmax(0, 1fr));\n\tgap: 16px;\n}\n@media (max-width: 900px) {\n.storage-grid[data-v-acfaa6b8] {\n\t\tgrid-template-columns: 1fr;\n}\n}\n.storage-card[data-v-acfaa6b8] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 14px;\n\tmin-width: 0;\n\tpadding: 16px 18px;\n\tborder-radius: var(--theme--border-radius);\n\tborder: var(--theme--border-width) solid var(--theme--border-color);\n\tbackground: var(--theme--background);\n}\n.card-head[data-v-acfaa6b8] {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 12px;\n}\n.card-titles[data-v-acfaa6b8] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2px;\n\tmin-width: 0;\n\tflex: 1;\n}\n.card-titles strong[data-v-acfaa6b8] {\n\tfont-size: 15px;\n\tletter-spacing: 0.01em;\n}\n.card-titles span[data-v-acfaa6b8] {\n\tfont-size: 12px;\n\tcolor: var(--theme--foreground-subdued);\n}\n.meta[data-v-acfaa6b8] {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 6px;\n\talign-items: center;\n}\n.meta .tag[data-v-acfaa6b8] {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tmax-width: 100%;\n\tpadding: 3px 9px;\n\tborder-radius: 4px;\n\tfont-size: 12px;\n\tline-height: 1.35;\n\tcolor: var(--theme--foreground);\n\tbackground: var(--theme--background-normal);\n\tborder: var(--theme--border-width) solid var(--theme--border-color-subdued);\n}\n.meta .tag-path[data-v-acfaa6b8] {\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n\tfont-family: var(--theme--fonts--monospace--font-family, monospace);\n\tcolor: var(--theme--foreground-subdued);\n}\n.card-strategy[data-v-acfaa6b8] {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: 12px;\n\tpadding-block-start: 12px;\n\tborder-block-start: var(--theme--border-width) solid var(--theme--border-color-subdued);\n}\n.mirror-copy[data-v-acfaa6b8] {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 6px;\n\tmin-width: 0;\n\tflex: 1;\n}\n.mirror-copy strong[data-v-acfaa6b8] {\n\tfont-size: 13px;\n}\n.mirror-copy .v-icon[data-v-acfaa6b8] {\n\t--v-icon-color: var(--theme--foreground-subdued);\n\tcursor: pointer;\n}\n.strategy-label[data-v-acfaa6b8] {\n\tmin-width: 0;\n\tflex: 1;\n\toverflow: hidden;\n\tfont-size: 13px;\n\tfont-weight: 600;\n\tcolor: var(--theme--foreground);\n\twhite-space: nowrap;\n\ttext-overflow: ellipsis;\n}\n.strategy-prefix[data-v-acfaa6b8] {\n\tfont-weight: 500;\n\tcolor: var(--theme--foreground-subdued);\n}\n.strategy-dialog-card[data-v-acfaa6b8] {\n\twidth: min(480px, 92vw);\n\tmax-block-size: min(85vh, 720px);\n\toverflow: auto;\n}\n",{});var pt=ge(ft,[["__scopeId","data-v-acfaa6b8"]]);function mt(e){const t=n(0),a=n(0),l=new ResizeObserver(([e])=>{void 0!==e&&(t.value=e.contentRect.width,a.value=e.contentRect.height)});return h(()=>{const t=C(e)?e.value:e;null!=t&&l.observe(t)}),B(()=>{l.disconnect()}),{width:t,height:a}}const gt="wrapper",ht=["selection","layoutOptions","layoutQuery"];function bt(e){const{layouts:t}=function(){const e=I("extensions");if(!e)throw new Error("[useExtensions]: The extensions could not be found.");return e}(),a=l(()=>t.value.map(e=>function(e){return o({name:`${e.id}-${gt}`,props:{collection:{type:String,required:!0},selection:{type:Array,default:()=>[]},layoutOptions:{type:Object,default:()=>({})},layoutQuery:{type:Object,default:()=>({})},layoutProps:{type:Object,default:()=>({})},filter:{type:Object,default:null},filterUser:{type:Object,default:null},filterSystem:{type:Object,default:null},search:{type:String,default:null},showSelect:{type:String,default:"multiple"},selectMode:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},resetPreset:{type:Function,default:null},clearFilters:{type:Function,default:null}},emits:ht.map(e=>`update:${e}`),setup(t,{emit:a}){const n=M({...e.setup(t,{emit:a}),...D(t),sidebarShadow:e.sidebarShadow??!1});for(const e in n)n[`onUpdate:${e}`]=l=>{var o;o=e,ht.includes(o)?a(`update:${e}`,l):Object.keys(t).includes(e)||(n[e]=l)};return{state:n}},render:e=>void 0!==e.$slots.default?e.$slots.default({layoutState:e.state}):null})}(e)));return{layoutWrapper:l(()=>{const t=a.value.find(t=>t.name===`${e.value}-${gt}`);return void 0===t?a.value.find(e=>e.name===`tabular-${gt}`):t})}}const yt=["value","placeholder","tabindex","disabled"];var _t=o({__name:"search-input",props:{modelValue:{},disabled:{type:Boolean},showFilter:{type:Boolean,default:!0},collection:{},filter:{},autofocus:{type:Boolean},placeholder:{}},emits:["update:modelValue","update:filter"],setup(e,{emit:t}){const a=e,o=t,f=n(null),p=n(Boolean(a.autofocus)),m=n(!1),y=n(!1),k=I("main-element",void 0),S=n(),{width:C}=mt(k??n(void 0)),{width:F}=mt(S);g([C,F],()=>{if(!S.value)return;const e=k?.value?.firstElementChild,t=S.value.parentElement;if(!t)return;const a=t.offsetWidth-4;if(!e)return void(S.value.style.maxInlineSize="");const n=t.getBoundingClientRect().right-(e.getBoundingClientRect().left+Number(window.getComputedStyle(e).paddingInlineStart.replace("px","")));S.value.style.maxInlineSize=n>a?`${String(n)}px`:"0px"},{immediate:!0}),h(()=>{p.value&&f.value?.focus()});const M=l(()=>{if(!a.filter)return 0;const e=[];return function t(a){for(const[n,l]of Object.entries(a))"_and"===n||"_or"===n?l?.forEach?.(t):n.startsWith("_")?e.push(n):l&&"object"==typeof l&&t(l)}(a.filter),e.length});function B(e){return!(e.path||e.composedPath?.()||[]).some(e=>e?.classList?.contains("v-menu-content"))}function D(){p.value||f.value?.focus(),p.value=!0}function N(){m.value=!m.value,p.value=!0,m.value||f.value?.focus()}function A(){o("update:modelValue",null),p.value&&f.value?.focus()}function E(){p.value=!1,m.value=!1,f.value?.blur()}function L(e){if(m.value)return;const t=e.currentTarget?.closest(".search-input"),a=e.relatedTarget;a&&t?.contains(a)||E()}function P(){f.value&&o("update:modelValue",f.value.value||null)}return g(m,e=>{y.value=!!e}),(t,a)=>{const n=r("v-icon"),l=r("interface-system-filter"),o=r("v-badge"),g=V("tooltip"),h=V("click-outside");return i(),s(o,{bottom:"",right:"",class:$(["search-badge",{active:p.value,"filter-active":m.value}]),value:M.value,disabled:e.disabled||!M.value||m.value},{default:d(()=>[z((i(),c("div",{class:$(["search-input",{active:p.value,disabled:e.disabled,"filter-active":m.value,"has-content":!!e.modelValue,"filter-border":y.value,"show-filter":e.showFilter}]),role:"search",onClick:D},[u(n,{small:"",name:"search",class:"icon-search",disabled:e.disabled,clickable:!p.value,onClick:a[0]||(a[0]=e=>f.value?.focus())},null,8,["disabled","clickable"]),_("input",{ref_key:"input",ref:f,value:e.modelValue,placeholder:e.placeholder??"Search items…",type:"search",spellcheck:"false",autocapitalize:"off",autocorrect:"off",autocomplete:"off",tabindex:p.value||e.modelValue?void 0:-1,disabled:e.disabled,onInput:P,onPaste:P,onKeydown:w(E,["esc"]),onFocusin:D,onFocusout:L},null,40,yt),a[2]||(a[2]=_("div",{class:"spacer"},null,-1)),e.modelValue?z((i(),s(n,{key:0,small:"",clickable:"",class:"icon-clear",name:"close",disabled:e.disabled,onClick:x(A,["stop"])},null,8,["disabled"])),[[g,"Clear value",void 0,{bottom:!0}]]):b("v-if",!0),e.showFilter?(i(),c(v,{key:1},[z(u(n,{small:"",clickable:"",class:"icon-filter",name:"filter_list",disabled:e.disabled,onClick:N},null,8,["disabled"]),[[g,!e.disabled&&"Filter",void 0,{bottom:!0}]]),z(_("div",{ref_key:"filterElement",ref:S,class:$(["filter",{active:p.value}])},[u(l,{class:"filter-input",inline:"",value:e.filter,"collection-name":e.collection,onInput:a[1]||(a[1]=e=>t.$emit("update:filter",e))},null,8,["value","collection-name"])],2),[[U,m.value]])],64)):b("v-if",!0)],2)),[[h,{handler:E,middleware:B,disabled:!p.value}]])]),_:1},8,["class","value","disabled"])}}});me("\n/* Mirrors upstream search-input.vue styles (logical props → physical where needed). */\n.search-badge[data-v-576fbb1b] {\n\t--v-badge-background-color: var(--theme--primary);\n\t--v-badge-offset-y: 0.4375rem;\n\t--v-badge-offset-x: 0.4375rem;\n}\n@media (width <= 22.5rem) {\n.search-badge.active[data-v-576fbb1b],\n\t.search-badge.filter-active[data-v-576fbb1b] {\n\t\tposition: absolute;\n\t\tinset-inline: 0;\n\t\tz-index: 1;\n\t\tbackground-color: var(--theme--header--background);\n}\n}\n.search-badge[data-v-576fbb1b] .badge {\n\tpointer-events: none;\n}\n.search-input[data-v-576fbb1b] {\n\t--button-size: 2rem;\n\t--search-input-size: calc(var(--button-size) - var(--theme--border-width) * 2);\n\t--search-input-radius: calc(var(--button-size) / 2);\n\t--icon-size: 1rem;\n\t--icon-search-padding-left: 0.375rem;\n\t--icon-search-padding-right: 0.25rem;\n\t--icon-filter-margin-right: 0.4375rem;\n\n\tposition: relative;\n\tbox-sizing: content-box;\n\tdisplay: flex;\n\talign-items: center;\n\twidth: var(--search-input-size);\n\tmin-height: var(--search-input-size);\n\tmax-width: calc(100% - var(--theme--border-width) * 2);\n\toverflow: hidden;\n\tborder: var(--theme--border-width) solid var(--theme--form--field--input--border-color);\n\tborder-radius: var(--search-input-radius);\n\ttransition:\n\t\twidth var(--slow, 300ms) var(--transition, ease-in-out),\n\t\tborder-bottom-left-radius var(--fast, 125ms) var(--transition, ease-in-out),\n\t\tborder-bottom-right-radius var(--fast, 125ms) var(--transition, ease-in-out);\n}\n.search-input.show-filter[data-v-576fbb1b] {\n\twidth: calc(\n\t\tvar(--icon-size) * 2 + var(--icon-search-padding-left) + var(--icon-search-padding-right) +\n\t\t\tvar(--icon-filter-margin-right)\n\t);\n}\n.search-input input[data-v-576fbb1b] {\n\twidth: 0;\n\theight: 100%;\n\tmargin: 0;\n\tpadding: 0;\n\toverflow: hidden;\n\tcolor: var(--theme--foreground);\n\ttext-overflow: ellipsis;\n\tbackground-color: transparent;\n\tborder: none;\n\tborder-radius: 0;\n\tflex-grow: 1;\n\topacity: 0;\n\toutline: none;\n\tfont: inherit;\n}\n.search-input input[data-v-576fbb1b]::placeholder {\n\tcolor: var(--theme--foreground-subdued);\n}\n.search-input.disabled input[data-v-576fbb1b] {\n\tcolor: var(--theme--foreground-subdued);\n}\n.search-input .spacer[data-v-576fbb1b] {\n\twidth: 0.4375rem;\n}\n.search-input .icon-clear[data-v-576fbb1b] {\n\t--v-icon-color: var(--theme--foreground-subdued);\n\t--v-icon-color-hover: var(--theme--danger);\n\tmin-width: auto;\n\toverflow: hidden;\n}\n.search-input .icon-search[data-v-576fbb1b],\n.search-input .icon-filter[data-v-576fbb1b] {\n\t--v-icon-color-hover: var(--theme--primary);\n}\n.search-input.disabled .icon-search[data-v-576fbb1b],\n.search-input.disabled .icon-filter[data-v-576fbb1b] {\n\t--v-icon-color: var(--theme--foreground-subdued);\n}\n.search-input .icon-search[data-v-576fbb1b] {\n\tmargin-block: 0;\n\tmargin-inline: var(--icon-search-padding-left) var(--icon-search-padding-right);\n}\n.search-input .icon-filter[data-v-576fbb1b] {\n\tmargin-inline-end: var(--icon-filter-margin-right);\n}\n.search-input[data-v-576fbb1b]:focus-within,\n.search-input[data-v-576fbb1b]:not(.disabled):not(.active):hover {\n\tborder-color: var(--theme--form--field--input--border-color-hover);\n}\n.search-input.has-content[data-v-576fbb1b] {\n\twidth: 11.25rem;\n}\n.search-input.has-content .icon-clear[data-v-576fbb1b] {\n\tmargin-inline-end: 0.4375rem;\n}\n.search-input.has-content input[data-v-576fbb1b] {\n\topacity: 1;\n}\n.search-input.has-content.show-filter .icon-clear[data-v-576fbb1b] {\n\tmargin-inline-end: 0;\n}\n.search-input.active[data-v-576fbb1b] {\n\twidth: 100%;\n\tborder-color: var(--theme--form--field--input--border-color-focus);\n}\n@media (width > 22.5rem) {\n.search-input.active[data-v-576fbb1b] {\n\t\twidth: 8.4375rem;\n}\n}\n@media (width >= 48rem) {\n.search-input.active[data-v-576fbb1b] {\n\t\twidth: 11.25rem;\n}\n}\n.search-input.active input[data-v-576fbb1b] {\n\topacity: 1;\n}\n.search-input.filter-active[data-v-576fbb1b] {\n\twidth: 100%;\n}\n.search-input.filter-active .icon-filter[data-v-576fbb1b] {\n\t--v-icon-color: var(--theme--primary);\n}\n@media (width > 22.5rem) {\n.search-input.filter-active[data-v-576fbb1b] {\n\t\twidth: 8.4375rem;\n}\n}\n@media (width >= 48rem) {\n.search-input.filter-active[data-v-576fbb1b] {\n\t\twidth: 11.25rem;\n}\n}\n@media (width >= 54rem) {\n.search-input.filter-active[data-v-576fbb1b] {\n\t\twidth: 16.875rem;\n}\n}\n@media (width >= 70.875rem) {\n.search-input.filter-active[data-v-576fbb1b] {\n\t\twidth: 23.625rem;\n}\n}\n.search-input.filter-border[data-v-576fbb1b] {\n\tpadding-block-end: var(--theme--border-width);\n\tborder-block-end: none;\n\tborder-bottom-right-radius: 0;\n\tborder-bottom-left-radius: 0;\n\ttransition:\n\t\tborder-bottom-left-radius 0s,\n\t\tborder-bottom-right-radius 0s;\n}\n.search-input.filter-border[data-v-576fbb1b]::after {\n\tposition: absolute;\n\tinset-inline: var(--theme--border-width) var(--theme--border-width);\n\tbottom: calc(-1 * var(--theme--border-width));\n\twidth: auto;\n\theight: var(--theme--border-width);\n\tbackground-color: var(--theme--border-color-subdued);\n\tcontent: '';\n\tpointer-events: none;\n}\n\n/* Allow the absolute filter panel to paint below the collapsed pill (upstream uses TransitionExpand). */\n.search-input.filter-active[data-v-576fbb1b],\n.search-input.filter-border[data-v-576fbb1b] {\n\toverflow: visible;\n}\n.filter[data-v-576fbb1b] {\n\tposition: absolute;\n\ttop: 100%;\n\tright: 0;\n\tz-index: 10;\n\twidth: auto;\n\tmin-width: 100%;\n\tpadding: 0;\n\tbackground-color: var(--theme--background-subdued);\n\tborder: var(--theme--border-width) solid var(--theme--form--field--input--border-color);\n\tborder-top-right-radius: 0;\n\tborder-bottom-right-radius: var(--search-input-radius);\n\tborder-bottom-left-radius: var(--search-input-radius);\n}\n.filter.active[data-v-576fbb1b] {\n\tborder-color: var(--theme--form--field--input--border-color-focus);\n}\n.filter .filter-input[data-v-576fbb1b] {\n\tmargin: 0.5625rem 0.4375rem;\n}\n",{});var kt=ge(_t,[["__scopeId","data-v-576fbb1b"]]),wt=o({__name:"header-action-button",props:{icon:{},disabled:{type:Boolean},loading:{type:Boolean},secondary:{type:Boolean},outlined:{type:Boolean},to:{},active:{type:Boolean}},emits:["click"],setup:e=>(t,a)=>{const n=r("v-icon"),l=r("v-button");return i(),s(l,{disabled:e.disabled,active:e.active,loading:e.loading,secondary:e.secondary,outlined:e.outlined,to:e.to,icon:"",rounded:"",small:"",onClick:a[0]||(a[0]=e=>t.$emit("click"))},{default:d(()=>[u(n,{name:e.icon,small:""},null,8,["name"])]),_:1},8,["disabled","active","loading","secondary","outlined","to"])}});const xt={class:"layout-options"},St={class:"field"};var Ct=o({__name:"layout-sidebar-detail",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,n=t,o=l({get:()=>a.modelValue??"cards",set(e){n("update:modelValue",e)}}),c=[{text:"Cards",value:"cards",icon:"grid_view"},{text:"Table",value:"tabular",icon:"table_rows"}];return(e,t)=>{const a=r("v-select"),n=r("sidebar-detail");return i(),s(n,{id:"layout",icon:"layers",title:"Layout Options"},{default:d(()=>[_("div",xt,[_("div",St,[t[1]||(t[1]=_("div",{class:"type-label"},"Layout",-1)),u(a,{modelValue:o.value,"onUpdate:modelValue":t[0]||(t[0]=e=>o.value=e),items:c,"item-text":"text","item-value":"value","item-icon":"icon"},null,8,["modelValue"])]),N(e.$slots,"default",{},void 0,!0)])]),_:3})}}});me("\n.layout-options[data-v-65862970] {\n\t--theme--form--row-gap: 1.125rem;\n\tmargin-bottom: 0.25rem;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: var(--theme--form--row-gap);\n}\n.field[data-v-65862970] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n.type-label[data-v-65862970] {\n\tfont-weight: 600;\n\tfont-size: 13px;\n}\n",{});var $t=ge(Ct,[["__scopeId","data-v-65862970"]]);const Ft=n(!1),Mt=n(!1),Vt=n(null),zt=n(0),Bt=n("/storage-manager"),It=M({from:null,to:"",currentIndex:0,totalFiles:0,currentName:"",transferredBytes:0,totalBytes:0,elapsedMs:0,speedBps:0,succeeded:0,skipped:0,failed:0});let Dt=null,Ut=null,Nt={},At=null,Et=null,Lt=null;function Pt(){return Lt}function Ot(e){const t={"Content-Type":"application/json",Accept:"text/event-stream"},a=e?.defaults?.headers,n=a?.common?.Authorization||a?.Authorization||a?.common?.authorization||a?.authorization;return"string"==typeof n&&n&&(t.Authorization=n),t}function jt(e){"start"===e.type?(It.from=e.from||It.from,It.to=e.to,It.totalFiles=e.total,It.totalBytes=e.total_bytes,It.currentIndex=0,It.currentName="",It.transferredBytes=0,It.elapsedMs=0,It.speedBps=0,It.succeeded=0,It.skipped=0,It.failed=0):"file_start"===e.type?(It.currentIndex=e.index,It.totalFiles=e.total,It.currentName=e.name||e.filename_disk,It.from||(It.from=e.from),It.to=e.to):"file_bytes"===e.type?(It.currentIndex=e.index,It.transferredBytes=e.transferred_bytes,It.totalBytes=e.total_bytes||It.totalBytes,It.elapsedMs=e.elapsed_ms,It.speedBps=e.elapsed_ms>0?1e3*e.transferred_bytes/e.elapsed_ms:0):"file_done"===e.type?(It.currentIndex=e.index,It.totalFiles=e.total,It.currentName=e.name||e.result.filename_disk,It.succeeded=e.succeeded,It.skipped=e.skipped,It.failed=e.failed,It.transferredBytes=e.transferred_bytes,It.totalBytes=e.total_bytes||It.totalBytes,It.elapsedMs=e.elapsed_ms,It.speedBps=e.elapsed_ms>0?1e3*e.transferred_bytes/e.elapsed_ms:0):"done"===e.type&&(It.succeeded=e.data.succeeded,It.skipped=e.data.skipped,It.failed=e.data.failed,It.transferredBytes=e.data.transferred_bytes??It.transferredBytes,It.totalBytes=e.data.total_bytes??It.totalBytes,It.elapsedMs=e.data.elapsed_ms??It.elapsedMs,It.totalFiles=e.data.total,It.currentIndex=e.data.total,It.speedBps=It.elapsedMs>0?1e3*It.transferredBytes/It.elapsedMs:0),Nt.onProgress?.(e),Mt.value&&function(){if(!Ut)return;const e=Pt();if(!e)return;e.update(Ut,{title:Rt(),text:It.currentName?`${It.currentName} · click for details`:`${Ue(It.transferredBytes)}${It.totalBytes?` / ${Ue(It.totalBytes)}`:""} · click for details`,loading:0===It.totalFiles,progress:0===It.totalFiles?void 0:Tt(),type:"info",persist:!0,closeable:!0,alwaysShowText:!0,icon:"swap_horiz",dismissText:"Details",dismissIcon:"open_in_new",dismissAction:()=>{qt()}})}()}function Tt(){return It.totalBytes>0?Math.min(100,Math.round(It.transferredBytes/It.totalBytes*100)):It.totalFiles>0?Math.min(100,Math.round(It.currentIndex/It.totalFiles*100)):0}function Rt(){const e="copy"===At?.mode?"Copying":"Moving",t=It.to||At?.target_storage||"…",a=It.from?`${It.from} → `:"";if(!It.totalFiles)return`${e} files to ${t}…`;return`${e} ${Math.min(It.currentIndex||0,It.totalFiles)}/${It.totalFiles} · ${a}${t}`}function qt(){Ut=null,Mt.value=!1,zt.value+=1,Et?.()}function Kt(e,t,a){const n=Pt();n&&(Ut&&(n.remove(Ut),Ut=null),n.add({title:t,text:a,type:"warning"===e?"warning":e,icon:"success"===e?"check_circle":"warning"===e?"cancel":"error",persist:!1,closeable:!0}))}function Jt(){const a=e();if(!Lt)try{const{useNotificationsStore:e}=t();Lt=e?.()??null}catch{Lt=null}const n=l(()=>Ft.value);function o(){Nt={}}return{running:Ft,backgrounded:Mt,result:Vt,progress:It,reopenNonce:zt,returnToPath:Bt,activeMode:l(()=>At?.mode??null),activeTarget:l(()=>At?.target_storage??null),isBusy:n,start:async function(e,t){if(Ft.value)throw new Error("A migration is already running");At=e,Ft.value=!0,Mt.value=!1,Vt.value=null,Dt=new AbortController,t?.listener&&(Nt=t.listener),function(e="",t=0,a=0,n=null){It.from=n,It.to=e,It.currentIndex=0,It.totalFiles=t,It.currentName="",It.transferredBytes=0,It.totalBytes=a,It.elapsedMs=0,It.speedBps=0,It.succeeded=0,It.skipped=0,It.failed=0}(e.target_storage,t?.estimatedCount??e.file_ids?.length??0,t?.estimatedBytes||0,t?.sourceStorage||e.source_storage||null);try{const t=await fetch(function(e){const t=String(e?.defaults?.baseURL||"").replace(/\/$/,""),a="/storage-manager/migrate/stream";return t?`${t}${a}`:a}(a),{method:"POST",headers:Ot(a),body:JSON.stringify(e),credentials:"same-origin",signal:Dt.signal}),n=await async function(e,t){if(!e.ok){let t=`Move failed (${e.status})`;try{const a=await e.json();t=a?.errors?.[0]?.message||t}catch{}throw new Error(t)}if(!e.body)throw new Error("No response body for progress stream");const a=e.body.getReader(),n=new TextDecoder;let l="",o=null;for(;;){const{done:e,value:r}=await a.read();if(e)break;l+=n.decode(r,{stream:!0});const i=l.split("\n\n");l=i.pop()||"";for(const e of i)for(const a of e.split("\n")){const e=a.trim();if(!e.startsWith("data:"))continue;const n=e.slice(5).trim();if(!n)continue;let l;try{l=JSON.parse(n)}catch{continue}if(t(l),"done"===l.type&&(o=l.data),"error"===l.type)throw new Error(l.message||"Move failed")}}if(!o)throw new Error("Move stream ended without a result");return o}(t,jt);return Vt.value=n,Mt.value&&Kt(n.failed?"warning":"success",n.failed?`Move finished with ${n.failed} failure(s)`:`Move complete · ${n.succeeded} file(s)`,`${"copy"===e.mode?"Copied":"Moved"} to ${e.target_storage}`),Nt.onDone?.(n),n}catch(t){if("AbortError"===t?.name){const t=(n=e.mode,l=e.target_storage,{mode:n,target_storage:l,total:It.totalFiles,succeeded:It.succeeded,skipped:It.skipped,failed:It.failed,results:[],transferred_bytes:It.transferredBytes,total_bytes:It.totalBytes,elapsed_ms:It.elapsedMs,cancelled:!0});return Vt.value=t,Mt.value&&Kt("warning","Move cancelled",`${It.succeeded} file(s) completed before cancel`),Nt.onCancel?.(t),t}const a=t?.message||"Move failed";throw Mt.value&&Kt("error","Move failed",a),Nt.onError?.(t instanceof Error?t:new Error(a)),t}finally{if(Ft.value=!1,Mt.value=!1,Dt=null,At=null,Ut){const e=Pt();e?.remove(Ut),Ut=null}}var n,l},runInBackground:function(e){if(!Ft.value||Mt.value)return!1;Mt.value=!0,o(),e?.returnTo&&(Bt.value=e.returnTo),Et=e?.navigate||null;const t=Pt();return t&&!Ut&&(Ut=t.add({title:Rt(),text:"Click for details — move continues in the background.",type:"info",persist:!0,closeable:!0,alwaysShowText:!0,loading:0===It.totalFiles,progress:0===It.totalFiles?void 0:Tt(),icon:"swap_horiz",dismissText:"Details",dismissIcon:"open_in_new",dismissAction:()=>{qt()}})),!0},attachForeground:function(e){if(Mt.value=!1,e&&(Nt=e),Ut){const e=Pt();e?.remove(Ut),Ut=null}},cancel:function(){Dt?.abort()},clearLastResult:function(){Vt.value=null},setListeners:function(e){Nt=e},clearListeners:o}}const Wt={class:"progress-panel"},Ht={class:"route"},Qt={class:"adapter"},Gt={class:"adapter"},Yt={class:"file-line"},Xt={class:"file-count"},Zt=["title"],ea={class:"bar-wrap"},ta={class:"bar-track"},aa={class:"bar-meta"},na={class:"stats"},la={class:"stat"},oa={class:"stat-value"},ra={class:"stat"},ia={class:"stat-value"},sa={class:"stat"},da={class:"stat-value"},ua={class:"counts"},ca={class:"ok"},va={class:"skip"},fa={class:"fail"};var pa=o({__name:"migrate-progress",props:{storages:{},mode:{},from:{},to:{},currentIndex:{},totalFiles:{},currentName:{},transferredBytes:{},totalBytes:{},elapsedMs:{},speedBps:{},succeeded:{},skipped:{},failed:{},isDone:{type:Boolean},isCancelled:{type:Boolean}},setup(e){const t=e;function a(e){if(!e)return{short:"—",icon:"storage"};return t.storages.find(t=>t.location===e)||{short:e,icon:"storage",location:e}}const n=l(()=>a(t.from)),o=l(()=>a(t.to)),s=l(()=>t.from?`${t.from} (${n.value.short})`:"Mixed sources"),v=l(()=>`${t.to} (${o.value.short})`),f=l(()=>n.value.icon),g=l(()=>o.value.icon),h=l(()=>"copy"===t.mode?"Copy":"Move"),b=l(()=>t.totalBytes>0?Math.max(0,Math.min(100,t.transferredBytes/t.totalBytes*100)):t.totalFiles>0?Math.max(0,Math.min(100,t.currentIndex/t.totalFiles*100)):0),y=l(()=>Math.round(b.value)),k=l(()=>t.isDone?t.isCancelled?"Cancelled":t.failed>0?"Completed with errors":"Completed":"Moving");return(t,a)=>{const n=r("v-icon"),l=r("v-chip");return i(),c("div",Wt,[_("div",Ht,[_("div",Qt,[u(n,{name:f.value},null,8,["name"]),_("span",null,m(s.value),1)]),u(n,{class:"arrow",name:"arrow_forward"}),_("div",Gt,[u(n,{name:g.value},null,8,["name"]),_("span",null,m(v.value),1)]),u(l,{"x-small":"",class:"mode-chip"},{default:d(()=>[p(m(h.value),1)]),_:1})]),_("div",Yt,[_("span",Xt,"File "+m(e.currentIndex)+" / "+m(e.totalFiles),1),_("span",{class:"file-name",title:e.currentName},m(e.currentName||"Preparing…"),9,Zt)]),_("div",ea,[_("div",ta,[_("div",{class:"bar-fill",style:F({width:`${b.value}%`})},null,4)]),_("div",aa,[_("strong",null,m(y.value)+"%",1),_("span",null,m(S(Ue)(e.transferredBytes))+" / "+m(S(Ue)(e.totalBytes)),1)])]),_("div",na,[_("div",la,[a[0]||(a[0]=_("span",{class:"stat-label"},"Speed",-1)),_("span",oa,m(S(Ne)(e.speedBps)),1)]),_("div",ra,[a[1]||(a[1]=_("span",{class:"stat-label"},"Elapsed",-1)),_("span",ia,m(S(Ae)(e.elapsedMs)),1)]),_("div",sa,[a[2]||(a[2]=_("span",{class:"stat-label"},"Status",-1)),_("span",da,m(k.value),1)])]),_("div",ua,[_("span",ca,m(e.succeeded)+" Ok",1),_("span",va,m(e.skipped)+" Skipped",1),_("span",fa,m(e.failed)+" Failed",1)])])}}});me("\n.progress-panel[data-v-49e3abe7] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 14px;\n\tpadding: 16px;\n\tborder-radius: var(--theme--border-radius);\n\tborder: var(--theme--border-width) solid var(--theme--border-color);\n\tbackground: var(--theme--background-subdued);\n}\n.route[data-v-49e3abe7] {\n\tdisplay: flex;\n\talign-items: center;\n\tflex-wrap: wrap;\n\tgap: 10px;\n}\n.adapter[data-v-49e3abe7] {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 6px;\n\tfont-weight: 600;\n}\n.arrow[data-v-49e3abe7] {\n\tcolor: var(--theme--foreground-subdued);\n}\n.mode-chip[data-v-49e3abe7] {\n\tmargin-left: auto;\n}\n.file-line[data-v-49e3abe7] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n\tmin-width: 0;\n}\n.file-count[data-v-49e3abe7] {\n\tfont-size: 12px;\n\tfont-weight: 700;\n\tletter-spacing: 0.02em;\n\ttext-transform: uppercase;\n\tcolor: var(--theme--foreground-subdued);\n}\n.file-name[data-v-49e3abe7] {\n\tfont-size: 14px;\n\tfont-weight: 600;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n.bar-wrap[data-v-49e3abe7] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n}\n.bar-track[data-v-49e3abe7] {\n\theight: 10px;\n\tborder-radius: 999px;\n\tbackground: var(--theme--background-normal);\n\toverflow: hidden;\n}\n.bar-fill[data-v-49e3abe7] {\n\theight: 100%;\n\tborder-radius: inherit;\n\tbackground: var(--theme--primary);\n\ttransition: width 160ms ease;\n}\n.bar-meta[data-v-49e3abe7] {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\tgap: 12px;\n\tfont-size: 13px;\n}\n.stats[data-v-49e3abe7] {\n\tdisplay: grid;\n\tgrid-template-columns: repeat(3, minmax(0, 1fr));\n\tgap: 8px;\n}\n.stat[data-v-49e3abe7] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2px;\n\tpadding: 8px 10px;\n\tborder-radius: var(--theme--border-radius);\n\tbackground: var(--theme--background);\n}\n.stat-label[data-v-49e3abe7] {\n\tfont-size: 11px;\n\ttext-transform: uppercase;\n\tletter-spacing: 0.03em;\n\tcolor: var(--theme--foreground-subdued);\n}\n.stat-value[data-v-49e3abe7] {\n\tfont-weight: 700;\n\tfont-variant-numeric: tabular-nums;\n}\n.counts[data-v-49e3abe7] {\n\tdisplay: flex;\n\tgap: 12px;\n\tfont-size: 12px;\n\tcolor: var(--theme--foreground-subdued);\n}\n.counts .ok[data-v-49e3abe7] {\n\tcolor: var(--theme--success);\n}\n.counts .fail[data-v-49e3abe7] {\n\tcolor: var(--theme--danger);\n}\n",{});var ma=ge(pa,[["__scopeId","data-v-49e3abe7"]]);const ga={class:"drawer-body"},ha={class:"intro"},ba={key:0,class:"description"},ya={class:"field"},_a={key:0,class:"field"},ka={key:1,class:"field"},wa={class:"dry-run-row"},xa={key:0,class:"dry-run-result"},Sa={key:0},Ca={key:1,class:"dry-run-note"},$a={key:2},Fa={class:"dry-run-note"},Ma={key:1,class:"note"},Va={key:5,class:"background-actions"},za={key:6,class:"result"},Ba={key:0},Ia={key:2,class:"failures"};var Da=o({__name:"migrate-drawer",props:{modelValue:{type:Boolean},storages:{},sourceStorage:{},selectionKind:{},fileIds:{},folderId:{},sourcePath:{},estimatedCount:{},estimatedBytes:{}},emits:["update:modelValue","done"],setup(t,{emit:a}){const o=t,h=a,y=e(),k=R(),w=T(),{running:x,backgrounded:C,progress:$,result:F,activeMode:M,activeTarget:B,start:I,runInBackground:D,attachForeground:U,cancel:N,clearListeners:A,clearLastResult:E}=Jt(),L=n(null),P=n("move"),O=n(!0),j=n(!0),q=n(null),K=n(!1),J=n(null),W=n(!1),H=l(()=>x.value&&!W.value&&!C.value&&!o.modelValue),Q=l(()=>Boolean(L.value)&&!x.value);function G(e){q.value=e,W.value=!1,e.mode&&(P.value=e.mode),e.target_storage&&(L.value=e.target_storage)}async function Y(){if(L.value&&!K.value){K.value=!0,J.value=null;try{const e={target_storage:L.value,include_empty_folders:j.value};"files"===o.selectionKind?e.file_ids=o.fileIds||[]:"storage"===o.selectionKind?e.source_storage=o.sourceStorage||void 0:"storage_path"===o.selectionKind?(e.source_storage=o.sourceStorage||void 0,e.source_path=o.sourcePath||void 0,e.recursive=O.value):"folder"===o.selectionKind&&(e.folder_id=o.folderId??null,e.recursive=O.value,o.sourceStorage&&(e.source_storage=o.sourceStorage));const t=await y.post("/storage-manager/migrate/dry-run",e);J.value=t.data?.data??null}catch{}finally{K.value=!1}}}g(L,()=>{J.value=null}),g(()=>o.modelValue,e=>{if(e)return x.value?(U({onDone:e=>{q.value=e,W.value=!1,h("done",e)},onCancel:e=>{q.value=e,W.value=!1},onError:e=>{q.value={mode:M.value||P.value,target_storage:B.value||L.value||"",total:$.totalFiles,succeeded:$.succeeded,skipped:$.skipped,failed:Math.max(1,$.failed),results:[{id:"",filename_disk:"",from:$.from||"",to:B.value||L.value||"",status:"failed",error:e.message||"Move failed"}],transferred_bytes:$.transferredBytes,total_bytes:$.totalBytes,elapsed_ms:$.elapsedMs},W.value=!1}}),W.value=!0,M.value&&(P.value=M.value),B.value&&(L.value=B.value),void(F.value&&(q.value=F.value))):void(F.value?G(F.value):function(){q.value=null,J.value=null,W.value=!1;const e=o.storages.find(e=>e.location!==o.sourceStorage);L.value=e?.location||null,P.value="move",O.value=!0,j.value=!0}())}),g(F,e=>{o.modelValue&&e&&!x.value&&G(e)}),g(x,(e,t)=>{o.modelValue&&t&&!e&&F.value&&G(F.value)});const X=l(()=>o.storages.filter(e=>e.location!==o.sourceStorage).map(e=>({text:`${e.location} (${e.short})`,value:e.location}))),Z=l(()=>"Move"),ee=l(()=>{const e=q.value?.total??(x.value&&$.totalFiles>0?$.totalFiles:null)??o.estimatedCount??o.fileIds?.length??0,t=q.value?.total_bytes??(x.value&&$.totalBytes>0?$.totalBytes:null)??o.estimatedBytes,a=null!=t?` (${Ue(t)})`:"",n=Boolean(q.value);if("storage"===o.selectionKind)return n?`Moved ${e.toLocaleString()} files${a} from “${o.sourceStorage}”.`:`Move all ${e.toLocaleString()} files${a} on “${o.sourceStorage}”.`;if("storage_path"===o.selectionKind){const t=o.sourcePath||"this folder";return n?`Moved ${e.toLocaleString()} files${a} from “${t}”.`:null==o.estimatedCount?`Move all files in “${t}”${a}.`:`Move ${e.toLocaleString()} files${a} in “${t}”.`}if("folder"===o.selectionKind){const t=o.folderId?"in this folder":"at the root (files with no virtual folder)";return n?o.folderId?`Moved ${e.toLocaleString()} files${a} from this folder.`:`Moved ${e.toLocaleString()} root files${a}.`:null==o.estimatedCount?o.folderId?`Move all files ${t}${a}.`:`Move all root files${a} (files with no virtual folder).`:`Move ${e.toLocaleString()} files${a} ${t}.`}return n?`Moved ${e.toLocaleString()} selected file(s)${a}.`:`Move ${e.toLocaleString()} selected file(s)${a}.`}),te=l(()=>{if("storage"===o.selectionKind)return`Every file currently stored on "${o.sourceStorage}" will be moved to the target storage. The file record in Directus is updated to point to the new location — no data is lost. Generated thumbnails are moved as well. Physical files are deleted from "${o.sourceStorage}" once safely copied. Empty folders can be included so the destination tree matches the source.`;if("storage_path"===o.selectionKind){return`All files under "${o.sourcePath||"this path"}" on "${o.sourceStorage}" will be moved to the target storage. File records in Directus are updated automatically. Generated thumbnails are moved as well. Physical files are removed from the source path once copied.`}return"folder"===o.selectionKind?"Files in the selected Directus folder will be moved to the target storage. File records in Directus are updated automatically. Generated thumbnails are moved as well. Physical files are deleted from the source storage once copied.":"The selected files will be moved to the target storage. File records in Directus are updated automatically. Generated thumbnails are moved as well. Physical files are deleted from the source once copied."}),ae=l(()=>(q.value?.results||[]).filter(e=>"failed"===e.status));function ne(e){e||!x.value||!W.value||C.value?h("update:modelValue",e):ie()}function le(){x.value&&W.value&&!C.value?ie():h("update:modelValue",!1)}function oe(){N()}function re(){E(),q.value=null,h("update:modelValue",!1)}function ie(){const e=k.path.startsWith("/storage-manager")?k.path:"/storage-manager";D({returnTo:e,navigate:()=>{w.push({path:e,query:{...k.query,migrateJob:"1"}})}})&&(W.value=!1,h("update:modelValue",!1))}async function se(){if(!L.value||x.value)return;q.value=null,W.value=!0;const e={target_storage:L.value,mode:P.value,keep_source_file_on_disk:!1,concurrency:1,file_ids:void 0,source_storage:void 0,source_path:void 0,folder_id:void 0,recursive:void 0,include_empty_folders:j.value};"files"===o.selectionKind?e.file_ids=o.fileIds||[]:"storage"===o.selectionKind?e.source_storage=o.sourceStorage||void 0:"storage_path"===o.selectionKind?(e.source_storage=o.sourceStorage||void 0,e.source_path=o.sourcePath||void 0,e.recursive=O.value):"folder"===o.selectionKind&&(e.folder_id=o.folderId??null,e.recursive=O.value,o.sourceStorage&&(e.source_storage=o.sourceStorage));try{await I(e,{estimatedCount:o.estimatedCount||o.fileIds?.length||0,estimatedBytes:o.estimatedBytes,sourceStorage:o.sourceStorage,listener:{onDone:e=>{W.value&&(q.value=e,h("done",e))},onCancel:e=>{W.value&&(q.value=e)},onError:e=>{W.value&&(q.value={mode:P.value,target_storage:L.value,total:$.totalFiles,succeeded:$.succeeded,skipped:$.skipped,failed:Math.max(1,$.failed),results:[{id:"",filename_disk:"",from:$.from||"",to:L.value,status:"failed",error:e.message||"Move failed"}],transferred_bytes:$.transferredBytes,total_bytes:$.totalBytes,elapsed_ms:$.elapsedMs})}}})}catch{}finally{W.value=!1,A()}}return(e,a)=>{const n=r("v-icon"),l=r("v-button"),o=r("v-notice"),g=r("v-select"),h=r("v-checkbox"),y=r("v-drawer"),k=V("tooltip");return i(),s(y,{"model-value":t.modelValue,title:"Move Files",icon:"swap_horiz",persistent:"","onUpdate:modelValue":ne,onCancel:le},{actions:d(()=>[S(x)||q.value?b("v-if",!0):z((i(),s(l,{key:0,disabled:!Q.value,icon:"",rounded:"",onClick:se},{default:d(()=>[u(n,{name:"check"})]),_:1},8,["disabled"])),[[k,Z.value,void 0,{bottom:!0}]])]),default:d(()=>[_("div",ga,[_("p",ha,m(ee.value),1),S(x)||q.value?b("v-if",!0):(i(),c("p",ba,m(te.value),1)),S(x)&&S(C)?(i(),s(o,{key:1,type:"info"},{default:d(()=>[...a[3]||(a[3]=[p(" Move continues in the background. You can close this drawer and navigate elsewhere in Studio. ",-1)])]),_:1})):H.value?(i(),s(o,{key:2,type:"warning"},{default:d(()=>[...a[4]||(a[4]=[p(" Another move is already running in the background. Wait for it to finish or cancel it from the progress toast. ",-1)])]),_:1})):b("v-if",!0),S(x)||q.value?b("v-if",!0):(i(),c(v,{key:3},[_("div",ya,[a[5]||(a[5]=_("label",null,"Target Storage",-1)),u(g,{modelValue:L.value,"onUpdate:modelValue":a[0]||(a[0]=e=>L.value=e),items:X.value,"item-text":"text","item-value":"value",placeholder:"Select target…"},null,8,["modelValue","items"])]),"folder"===t.selectionKind&&t.folderId||"storage_path"===t.selectionKind?(i(),c("div",_a,[u(h,{modelValue:O.value,"onUpdate:modelValue":a[1]||(a[1]=e=>O.value=e),label:"Include files in subfolders"},null,8,["modelValue"])])):b("v-if",!0),"storage"===t.selectionKind||"storage_path"===t.selectionKind?(i(),c("div",ka,[u(h,{modelValue:j.value,"onUpdate:modelValue":a[2]||(a[2]=e=>j.value=e),label:"Include empty folders"},null,8,["modelValue"])])):b("v-if",!0),_("div",wa,[u(l,{secondary:"",loading:K.value,disabled:!Q.value,onClick:Y},{default:d(()=>[...a[6]||(a[6]=[p(" Dry Run ",-1)])]),_:1},8,["loading","disabled"]),u(l,{disabled:!Q.value,onClick:se},{default:d(()=>[...a[7]||(a[7]=[p("Run",-1)])]),_:1},8,["disabled"]),J.value?(i(),c("div",xa,[_("span",null,m(J.value.total_files.toLocaleString())+" files",1),J.value.total_folders?(i(),c("span",Sa," · "+m(J.value.total_folders.toLocaleString())+" "+m(1===J.value.total_folders?"folder":"folders"),1)):b("v-if",!0),J.value.empty_folders?(i(),c("span",Ca," ("+m(J.value.empty_folders.toLocaleString())+" empty"+m(j.value?"":", skipped")+") ",1)):b("v-if",!0),J.value.total_bytes?(i(),c("span",$a,"· "+m(S(Ue)(J.value.total_bytes)),1)):b("v-if",!0),_("span",Fa,"will be moved to "+m(L.value),1)])):(i(),c("p",Ma," Count files, folders, and total size without moving anything. "))])],64)),S(x)&&!S(C)||q.value?(i(),s(ma,{key:4,storages:t.storages,mode:P.value,from:S($).from,to:S($).to,"current-index":S($).currentIndex,"total-files":S($).totalFiles,"current-name":S($).currentName,"transferred-bytes":S($).transferredBytes,"total-bytes":S($).totalBytes,"elapsed-ms":S($).elapsedMs,"speed-bps":S($).speedBps,succeeded:S($).succeeded,skipped:S($).skipped,failed:S($).failed,"is-done":Boolean(q.value)&&!S(x),"is-cancelled":Boolean(q.value?.cancelled)},null,8,["storages","mode","from","to","current-index","total-files","current-name","transferred-bytes","total-bytes","elapsed-ms","speed-bps","succeeded","skipped","failed","is-done","is-cancelled"])):b("v-if",!0),S(x)&&!S(C)?(i(),c("div",Va,[u(l,{secondary:"",class:"background-btn",onClick:ie},{default:d(()=>[...a[8]||(a[8]=[p(" Run in Background ",-1)])]),_:1}),u(l,{kind:"danger",secondary:"",class:"background-btn",onClick:oe},{default:d(()=>[...a[9]||(a[9]=[p(" Cancel Move ",-1)])]),_:1}),a[10]||(a[10]=_("p",{class:"note"}," Closing this drawer also runs in the background. Click the progress toast anytime for details. ",-1))])):b("v-if",!0),q.value?(i(),c("div",za,[q.value.cancelled?(i(),s(o,{key:0,type:"warning",icon:"cancel"},{default:d(()=>[p(" Move cancelled. "+m(q.value.succeeded.toLocaleString())+" file(s) finished before stop ",1),q.value.total?(i(),c("span",Ba," (of "+m(q.value.total.toLocaleString())+" planned)",1)):b("v-if",!0),a[11]||(a[11]=p(". ",-1))]),_:1})):(i(),s(o,{key:1,type:q.value.failed?"danger":"success"},{default:d(()=>[p(m(q.value.succeeded)+" succeeded · "+m(q.value.skipped)+" skipped · "+m(q.value.failed)+" failed (of "+m(q.value.total)+") ",1)]),_:1},8,["type"])),!q.value.cancelled&&ae.value.length?(i(),c("div",Ia,[(i(!0),c(v,null,f(ae.value.slice(0,20),e=>(i(),c("div",{key:e.id,class:"fail-row"},[_("strong",null,m(e.filename_disk||e.id),1),_("span",null,m(e.error),1)]))),128))])):b("v-if",!0),u(l,{secondary:"",class:"background-btn",onClick:re},{default:d(()=>[...a[12]||(a[12]=[p("Done",-1)])]),_:1})])):b("v-if",!0)])]),_:1},8,["model-value"])}}});me("\n.drawer-body[data-v-38d7930e] {\n\tpadding: 20px 24px 32px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 18px;\n}\n.intro[data-v-38d7930e] {\n\tmargin: 0;\n\tcolor: var(--theme--foreground);\n}\n.description[data-v-38d7930e] {\n\tmargin: 0;\n\tfont-size: 14px;\n\tcolor: var(--theme--foreground-subdued);\n\tline-height: 1.5;\n}\n.field[data-v-38d7930e] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n.field label[data-v-38d7930e] {\n\tfont-weight: 600;\n}\n.mode-radios[data-v-38d7930e] {\n\tdisplay: grid;\n\tgrid-template-columns: 1fr 1fr;\n\tgap: 10px;\n}\n.mode-radios[data-v-38d7930e] .v-radio.block {\n\twidth: 100%;\n\tmargin: 0;\n}\n.note[data-v-38d7930e] {\n\tmargin: 0;\n\tfont-size: 12px;\n\tcolor: var(--theme--foreground-subdued);\n}\n.background-actions[data-v-38d7930e] {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tgap: 8px;\n}\n.background-actions .note[data-v-38d7930e] {\n\tflex: 1 1 100%;\n}\n.result .background-btn[data-v-38d7930e] {\n\talign-self: flex-start;\n}\n.dry-run-row[data-v-38d7930e] {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 12px;\n\tflex-wrap: wrap;\n}\n.dry-run-result[data-v-38d7930e] {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 6px;\n\tfont-size: 14px;\n\tfont-weight: 600;\n}\n.dry-run-note[data-v-38d7930e] {\n\tfont-weight: 400;\n\tcolor: var(--theme--foreground-subdued);\n}\n.result[data-v-38d7930e] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n}\n.failures[data-v-38d7930e] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n\tmax-height: 240px;\n\toverflow: auto;\n\tpadding: 8px 0;\n}\n.fail-row[data-v-38d7930e] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2px;\n\tfont-size: 12px;\n\tpadding: 8px 10px;\n\tbackground: var(--theme--background-subdued);\n\tborder-radius: var(--theme--border-radius);\n}\n.fail-row span[data-v-38d7930e] {\n\tcolor: var(--theme--danger);\n}\n",{});var Ua=ge(Da,[["__scopeId","data-v-38d7930e"]]);const Na={class:"body"},Aa={class:"intro"},Ea={class:"toolbar"},La={key:0,class:"meta"},Pa={key:1,class:"loading"},Oa={key:2,class:"error"},ja={key:3,class:"empty"},Ta={key:4,class:"table-wrap"},Ra={class:"check-col"},qa={class:"check-col"},Ka=["title"];var Ja=o({__name:"import-orphans-drawer",props:{modelValue:{type:Boolean},location:{},storagePath:{}},emits:["update:modelValue","imported"],setup(t,{emit:a}){const o=t,h=a,y=e(),k=n(!1),w=n(!1),x=n(!1),C=n(!1),F=n(!1),M=n(!1),B=n(null),I=n([]),D=n([]),U=n(null),N=n(null),A=n(null),E=l(()=>String(o.storagePath||"").replace(/\\/g,"/").replace(/^\/+|\/+$/g,"").replace(/\/+/g,"/")||""),L=l(()=>E.value?"Detect Files in this Folder":`Detect Files on ${o.location}`),P=l(()=>I.value.length>0&&D.value.length===I.value.length);function O(){C.value=!1,F.value=!1,h("update:modelValue",!1)}function j(e){D.value=e?I.value.map(e=>e.filename_disk):[]}function T(){!I.value.length||w.value||x.value||(C.value=!0)}function R(){!D.value.length||w.value||x.value||(F.value=!0)}async function q(){if(o.location){k.value=!0,B.value=null;try{const e=await y.get(`/storage-manager/storages/${encodeURIComponent(o.location)}/orphans`,{params:E.value?{path:E.value}:void 0});I.value=e.data?.data||[],U.value=e.data?.meta||null,M.value=!0,D.value=[]}catch(e){B.value=e?.response?.data?.errors?.[0]?.message||e?.message||String(e),I.value=[],U.value=null}finally{k.value=!1}}}async function K(){if(I.value.length){w.value=!0,B.value=null;try{const e=await y.post(`/storage-manager/storages/${encodeURIComponent(o.location)}/import-orphans`,{filename_disks:I.value.map(e=>e.filename_disk)}),t=e.data?.data;N.value={imported:Number(t?.imported||0),skipped:Number(t?.skipped||0),failed:Number(t?.failed||0)},C.value=!1,h("imported"),await q()}catch(e){B.value=e?.response?.data?.errors?.[0]?.message||e?.message||String(e),C.value=!1}finally{w.value=!1}}}async function J(){if(!D.value.length)return;x.value=!0,B.value=null;const e=[...D.value];try{const t=await y.post(`/storage-manager/storages/${encodeURIComponent(o.location)}/delete-orphans`,{filename_disks:e}),a=t.data?.data;A.value={deleted:Number(a?.deleted||0),skipped:Number(a?.skipped||0),failed:Number(a?.failed||0)},N.value=null,F.value=!1,h("imported"),await q()}catch(e){B.value=e?.response?.data?.errors?.[0]?.message||e?.message||String(e),F.value=!1}finally{x.value=!1}}return g(()=>o.modelValue,e=>{e&&(N.value=null,A.value=null,B.value=null,C.value=!1,F.value=!1,q())}),(e,a)=>{const n=r("v-icon"),l=r("v-button"),o=r("v-progress-circular"),g=r("v-checkbox"),h=r("v-drawer"),y=r("v-card-title"),W=r("v-card-text"),H=r("v-card-actions"),Q=r("v-card"),G=r("v-dialog"),Y=V("tooltip");return i(),c(v,null,[u(h,{"model-value":t.modelValue,title:L.value,icon:"folder_off","onUpdate:modelValue":a[0]||(a[0]=t=>e.$emit("update:modelValue",t)),onCancel:O},{actions:d(()=>[D.value.length?z((i(),s(l,{key:0,icon:"",rounded:"",secondary:"",disabled:x.value||k.value,loading:x.value,onClick:R},{default:d(()=>[u(n,{name:"delete"})]),_:1},8,["disabled","loading"])),[[Y,"Delete Selected from Storage",void 0,{bottom:!0}]]):b("v-if",!0),z((i(),s(l,{icon:"",rounded:"",disabled:!I.value.length||w.value||k.value||x.value,loading:w.value,onClick:T},{default:d(()=>[u(n,{name:"download"})]),_:1},8,["disabled","loading"])),[[Y,"Import All Unknown Files",void 0,{bottom:!0}]])]),default:d(()=>[_("div",Na,[_("p",Aa,[E.value?(i(),c(v,{key:0},[a[7]||(a[7]=p(" Finds files under ",-1)),_("strong",null,m(E.value),1),a[8]||(a[8]=p(" on ",-1)),_("strong",null,m(t.location),1),a[9]||(a[9]=p(" that aren’t registered in Directus yet. ",-1))],64)):(i(),c(v,{key:1},[a[10]||(a[10]=p(" Finds files on ",-1)),_("strong",null,m(t.location),1),a[11]||(a[11]=p(" that aren’t registered in Directus yet. ",-1))],64)),a[12]||(a[12]=p(" Import only creates database rows — nothing is copied. Titles come from the filename (underscores become spaces). You can delete selected unknown files from storage. Generated thumbnails are excluded. ",-1))]),_("div",Ea,[u(l,{secondary:"",loading:k.value,disabled:x.value,onClick:q},{default:d(()=>[u(n,{name:"radar",left:""}),p(" "+m(E.value?"Scan Folder":"Scan Storage"),1)]),_:1},8,["loading","disabled"]),u(l,{disabled:!I.value.length||w.value||k.value||x.value,loading:w.value,onClick:T},{default:d(()=>[p(" Import "+m(I.value.length||"")+" New File"+m(1===I.value.length?"":"s"),1)]),_:1},8,["disabled","loading"]),u(l,{secondary:"",disabled:!D.value.length||w.value||k.value||x.value,loading:x.value,onClick:R},{default:d(()=>[u(n,{name:"delete",left:""}),p(" Delete Selected ("+m(D.value.length)+") ",1)]),_:1},8,["disabled","loading"])]),U.value?(i(),c("p",La," Scanned "+m(U.value.scanned.toLocaleString())+" objects · "+m(U.value.known.toLocaleString())+" already in DB · "+m(U.value.orphan_count.toLocaleString())+" unknown ",1)):b("v-if",!0),k.value?(i(),c("div",Pa,[u(o,{indeterminate:""}),a[13]||(a[13]=_("span",null,"Listing storage…",-1))])):B.value?(i(),c("p",Oa,m(B.value),1)):M.value&&!I.value.length?(i(),c("p",ja,[E.value?(i(),c(v,{key:0},[p(" No unknown files in this folder. Everything here is already in the database. ")],64)):(i(),c(v,{key:1},[p(" No unknown files on this storage. Everything here is already in the database. ")],64))])):I.value.length?(i(),c("div",Ta,[_("table",null,[_("thead",null,[_("tr",null,[_("th",Ra,[u(g,{"model-value":P.value,"onUpdate:modelValue":j},null,8,["model-value"])]),a[14]||(a[14]=_("th",null,"filename_disk",-1)),a[15]||(a[15]=_("th",null,"Type",-1)),a[16]||(a[16]=_("th",null,"Size",-1))])]),_("tbody",null,[(i(!0),c(v,null,f(I.value,e=>(i(),c("tr",{key:e.filename_disk},[_("td",qa,[u(g,{"model-value":D.value.includes(e.filename_disk),"onUpdate:modelValue":t=>function(e,t){t?D.value.includes(e)||(D.value=[...D.value,e]):D.value=D.value.filter(t=>t!==e)}(e.filename_disk,t)},null,8,["model-value","onUpdate:modelValue"])]),_("td",{class:"name",title:e.filename_disk},m(e.filename_disk),9,Ka),_("td",null,m(e.type||"—"),1),_("td",null,m(S(Ue)(e.filesize)),1)]))),128))])])])):b("v-if",!0),A.value?(i(),c("div",{key:5,class:$(["result",A.value.failed?"has-fail":"ok"])}," Deleted "+m(A.value.deleted)+" · skipped "+m(A.value.skipped)+" · failed "+m(A.value.failed),3)):b("v-if",!0),N.value?(i(),c("div",{key:6,class:$(["result",N.value.failed?"has-fail":"ok"])}," Imported "+m(N.value.imported)+" · skipped "+m(N.value.skipped)+" · failed "+m(N.value.failed),3)):b("v-if",!0)])]),_:1},8,["model-value","title"]),u(G,{"model-value":C.value,"onUpdate:modelValue":a[2]||(a[2]=e=>C.value=e),onEsc:a[3]||(a[3]=e=>C.value=!1)},{default:d(()=>[u(Q,null,{default:d(()=>[u(y,null,{default:d(()=>[...a[17]||(a[17]=[p("Import new files?",-1)])]),_:1}),u(W,null,{default:d(()=>[a[18]||(a[18]=p(" Do you want to import ",-1)),_("strong",null,m(I.value.length.toLocaleString()),1),p(" new file"+m(1===I.value.length?"":"s")+" into storage ",1),_("strong",null,m(t.location),1),a[19]||(a[19]=p("? ",-1)),a[20]||(a[20]=_("br",null,null,-1)),a[21]||(a[21]=_("br",null,null,-1)),a[22]||(a[22]=p(" Each file keeps its exact ",-1)),a[23]||(a[23]=_("code",null,"filename_disk",-1)),a[24]||(a[24]=p(". Titles are generated from the filename with underscores replaced by spaces (extension stripped). Image width and height are read from the file so thumbnails can be generated. ",-1))]),_:1}),u(H,null,{default:d(()=>[u(l,{secondary:"",disabled:w.value,onClick:a[1]||(a[1]=e=>C.value=!1)},{default:d(()=>[...a[25]||(a[25]=[p("Cancel",-1)])]),_:1},8,["disabled"]),u(l,{loading:w.value,onClick:K},{default:d(()=>[p(" Import "+m(I.value.length.toLocaleString()),1)]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1},8,["model-value"]),u(G,{"model-value":F.value,"onUpdate:modelValue":a[5]||(a[5]=e=>F.value=e),onEsc:a[6]||(a[6]=e=>F.value=!1)},{default:d(()=>[u(Q,null,{default:d(()=>[u(y,null,{default:d(()=>[...a[26]||(a[26]=[p("Delete from Storage?",-1)])]),_:1}),u(W,null,{default:d(()=>[a[27]||(a[27]=p(" Permanently delete ",-1)),_("strong",null,m(D.value.length.toLocaleString()),1),p(" file"+m(1===D.value.length?"":"s")+" from storage ",1),_("strong",null,m(t.location),1),a[28]||(a[28]=p("? ",-1)),a[29]||(a[29]=_("br",null,null,-1)),a[30]||(a[30]=_("br",null,null,-1)),a[31]||(a[31]=p(" Only unregistered files are removed. Generated thumbnails are not deleted. ",-1))]),_:1}),u(H,null,{default:d(()=>[u(l,{secondary:"",disabled:x.value,onClick:a[4]||(a[4]=e=>F.value=!1)},{default:d(()=>[...a[32]||(a[32]=[p("Cancel",-1)])]),_:1},8,["disabled"]),u(l,{kind:"danger",loading:x.value,onClick:J},{default:d(()=>[p(" Delete "+m(D.value.length.toLocaleString()),1)]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1},8,["model-value"])],64)}}});me("\n.body[data-v-15d8b708] {\n\tpadding: 0 24px 24px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 14px;\n}\n.intro[data-v-15d8b708] {\n\tmargin: 0;\n\tline-height: 1.45;\n\tcolor: var(--theme--foreground);\n\tfont-size: 13px;\n}\n.intro code[data-v-15d8b708],\n.v-card-text code[data-v-15d8b708] {\n\tfont-size: 12px;\n}\n.toolbar[data-v-15d8b708] {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n}\n.meta[data-v-15d8b708],\n.empty[data-v-15d8b708] {\n\tmargin: 0;\n\tfont-size: 13px;\n\tcolor: var(--theme--foreground-subdued);\n}\n.loading[data-v-15d8b708] {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 10px;\n\tcolor: var(--theme--foreground-subdued);\n}\n.error[data-v-15d8b708] {\n\tmargin: 0;\n\tcolor: var(--theme--danger);\n\tfont-size: 13px;\n}\n.table-wrap[data-v-15d8b708] {\n\toverflow: auto;\n\tmax-height: 50vh;\n\tborder: var(--theme--border-width) solid var(--theme--border-color-subdued);\n\tborder-radius: var(--theme--border-radius);\n}\ntable[data-v-15d8b708] {\n\twidth: 100%;\n\tborder-collapse: collapse;\n\tfont-size: 13px;\n}\nth[data-v-15d8b708],\ntd[data-v-15d8b708] {\n\tpadding: 8px 10px;\n\ttext-align: left;\n\tborder-bottom: var(--theme--border-width) solid var(--theme--border-color-subdued);\n}\nth[data-v-15d8b708] {\n\tfont-weight: 700;\n\tbackground: var(--theme--background-subdued);\n\tposition: sticky;\n\ttop: 0;\n}\n.name[data-v-15d8b708] {\n\tfont-family: var(--theme--fonts--monospace--font-family, monospace);\n\tmax-width: 280px;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n.check-col[data-v-15d8b708] {\n\twidth: 36px;\n\tpadding-left: 8px;\n\tpadding-right: 4px;\n\tvertical-align: middle;\n}\n.check-col[data-v-15d8b708] .v-checkbox {\n\tmargin: 0;\n}\n.result[data-v-15d8b708] {\n\tpadding: 10px 12px;\n\tborder-radius: var(--theme--border-radius);\n\tfont-size: 13px;\n\tfont-weight: 600;\n}\n.result.ok[data-v-15d8b708] {\n\tbackground: color-mix(in srgb, var(--theme--success) 16%, transparent);\n\tcolor: var(--theme--success);\n}\n.result.has-fail[data-v-15d8b708] {\n\tbackground: color-mix(in srgb, var(--theme--warning) 16%, transparent);\n\tcolor: var(--theme--warning);\n}\n",{});var Wa=ge(Ja,[["__scopeId","data-v-15d8b708"]]),Ha=o({__name:"add-storage-folder",props:{location:{},parentPath:{}},emits:["created"],setup(t,{emit:a}){const l=t,o=a,c=e(),v=T(),f=n(!1),m=n(!1),g=n(null);async function h(){if(g.value?.trim()&&!m.value){m.value=!0;try{const e=await c.post(`/storage-manager/storages/${encodeURIComponent(l.location)}/folders`,{name:g.value.trim(),parent_path:l.parentPath||""}),t=String(e.data?.data?.path||"");f.value=!1,g.value=null,o("created",t),t&&v.push(Ce(l.location,t))}catch(e){const t=e?.response?.data?.errors?.[0]?.message||e?.message||"Could not create folder";window.alert(t)}finally{m.value=!1}}}return(e,t)=>{const a=r("v-card-title"),n=r("v-input"),l=r("v-card-text"),o=r("v-button"),c=r("v-card-actions"),v=r("v-card"),b=r("v-dialog"),y=V("tooltip");return i(),s(b,{modelValue:f.value,"onUpdate:modelValue":t[2]||(t[2]=e=>f.value=e),onEsc:t[3]||(t[3]=e=>f.value=!1),onApply:h},{activator:d(({on:e})=>[z(u(wt,{icon:"create_new_folder",secondary:"",onClick:e},null,8,["onClick"]),[[y,"Create Storage Folder",void 0,{bottom:!0}]])]),default:d(()=>[u(v,null,{default:d(()=>[u(a,null,{default:d(()=>[...t[4]||(t[4]=[p("Create Storage Folder",-1)])]),_:1}),u(l,null,{default:d(()=>[u(n,{modelValue:g.value,"onUpdate:modelValue":t[0]||(t[0]=e=>g.value=e),autofocus:"",placeholder:"Folder name",onKeydown:w(h,["enter"])},null,8,["modelValue"])]),_:1}),u(c,null,{default:d(()=>[u(o,{secondary:"",onClick:t[1]||(t[1]=e=>f.value=!1)},{default:d(()=>[...t[5]||(t[5]=[p("Cancel",-1)])]),_:1}),u(o,{disabled:!g.value?.trim(),loading:m.value,onClick:h},{default:d(()=>[...t[6]||(t[6]=[p("Save",-1)])]),_:1},8,["disabled","loading"])]),_:1})]),_:1})]),_:1},8,["modelValue"])}}});const Qa=["onClick","onKeydown","onContextmenu"],Ga={class:"header"},Ya={class:"title"};var Xa=o({__name:"storage-folder-section",props:k({location:{},folders:{},anyFileSelection:{type:Boolean}},{selection:{default:()=>[]},selectionModifiers:{}}),emits:k(["changed"],["update:selection"]),setup(e,{emit:t}){const a=e,o=t,s=y(e,"selection"),d=T(),p=n({}),g=l(()=>s.value.length>0||(a.anyFileSelection??!1));function h(e){s.value.includes(e)?s.value=s.value.filter(t=>t!==e):s.value=[...s.value,e]}function k(e){var t;g.value?h(e.path):(t=e.path,d.push(Ce(a.location,t)))}function S(){o("changed")}return(t,a)=>{const n=r("v-icon");return i(),c(v,null,[b("\n\t\tFragment of cards — must be direct children of layout-cards `.grid`\n\t\t(same as File Library FolderSection + Card), not a nested grid wrapper.\n\t"),(i(!0),c(v,null,f(e.folders,t=>{return i(),c("div",{key:t.path,class:$(["card folder-card",{selected:s.value.includes(t.path),"select-mode":g.value}]),tabindex:"0",onClick:e=>k(t),onKeydown:[w(x(e=>k(t),["self","prevent"]),["enter"]),w(x(e=>k(t),["self","prevent"]),["space"])],onContextmenu:x(e=>{return a=e,n=t.path,void p.value[n]?.open(a);var a,n},["prevent"])},[u(n,{class:"selector",name:(l=t.path,s.value.includes(l)?"check_circle":"radio_button_unchecked"),clickable:"",onClick:x(e=>h(t.path),["stop"])},null,8,["name","onClick"]),_("div",Ga,[a[0]||(a[0]=_("div",{class:"selection-fade"},null,-1)),u(n,{large:"",name:"folder"})]),_("div",Ya,m(t.name),1),u(Fe,{ref_for:!0,ref:e=>function(e,t){p.value[e]=t}(t.path,e),location:e.location,path:t.path,name:t.name,onChanged:S},null,8,["location","path","name"])],42,Qa);var l}),128))],2112)}}});me("\n/* Port of Directus layouts/cards/components/card.vue (folder-only subset) */\n.card[data-v-89b52992] {\n\tposition: relative;\n\tcursor: pointer;\n}\n.card[data-v-89b52992]:focus-visible {\n\toutline: none;\n}\n.card[data-v-89b52992]:focus-visible::after {\n\tposition: absolute;\n\tinset-block-start: 0;\n\tinset-inline-start: 0;\n\tz-index: 2;\n\tinline-size: 100%;\n\taspect-ratio: 1 / 1;\n\tborder-radius: var(--theme--border-radius);\n\toutline: var(--focus-ring-width) solid var(--focus-ring-color);\n\toutline-offset: var(--focus-ring-offset);\n\tcontent: '';\n\tpointer-events: none;\n}\n.header[data-v-89b52992] {\n\tposition: relative;\n\tz-index: 1;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tinline-size: 100%;\n\toverflow: hidden;\n\tbackground-color: var(--theme--background-normal);\n\tborder-color: var(--theme--primary-subdued);\n\tborder-style: solid;\n\tborder-width: 0;\n\tborder-radius: var(--theme--border-radius);\n\ttransition: border-width var(--fast) var(--transition);\n}\n.header[data-v-89b52992]::after {\n\tdisplay: block;\n\tpadding-block-end: 100%;\n\tcontent: '';\n}\n.header .v-icon[data-v-89b52992] {\n\t--v-icon-color: var(--theme--foreground-subdued);\n\tposition: absolute;\n}\n.selection-fade[data-v-89b52992] {\n\tposition: absolute;\n\tinset-block-start: 0;\n\tinset-inline-start: 0;\n\tz-index: 1;\n\tinline-size: 100%;\n\tblock-size: 2.6875rem;\n\topacity: 0;\n\ttransition: opacity var(--fast) var(--transition);\n}\n.selection-fade[data-v-89b52992]::before {\n\tposition: absolute;\n\tinset-block-start: 0;\n\tinset-inline-start: 0;\n\tinline-size: 100%;\n\tblock-size: 100%;\n\tbackground-image: linear-gradient(-180deg, rgb(38 50 56 / 0.1) 10%, rgb(38 50 56 / 0));\n\tcontent: '';\n}\n.card[data-v-89b52992]::before {\n\tposition: absolute;\n\tinset-block-start: 0.375rem;\n\tinset-inline-start: 0.375rem;\n\tz-index: 2;\n\tinline-size: 1rem;\n\tblock-size: 1rem;\n\tbackground-color: var(--theme--background);\n\tborder-radius: 1.375rem;\n\topacity: 0;\n\ttransition: opacity var(--fast) var(--transition);\n\tcontent: '';\n}\n.selector[data-v-89b52992] {\n\t--v-icon-color: var(--white);\n\t--v-icon-color-hover: var(--white);\n\t--focus-ring-offset: 0;\n\n\tposition: absolute;\n\tinset-block-start: 0;\n\tinset-inline-start: 0;\n\tz-index: 3;\n\tmargin: 0.25rem;\n\topacity: 0;\n\ttransition:\n\t\topacity var(--fast) var(--transition),\n\t\tcolor var(--fast) var(--transition);\n}\n.selector[data-v-89b52992]:focus-visible,\n.selector[data-v-89b52992]:hover {\n\topacity: 1 !important;\n}\n.card.select-mode .selector[data-v-89b52992] {\n\topacity: 0.5;\n}\n.card.select-mode .header .selection-fade[data-v-89b52992] {\n\topacity: 1;\n}\n.card.selected[data-v-89b52992]::before {\n\topacity: 1;\n}\n.card.selected .selector[data-v-89b52992] {\n\t--v-icon-color: var(--theme--primary);\n\t--v-icon-color-hover: var(--theme--primary);\n\topacity: 1;\n}\n.card.selected .header[data-v-89b52992] {\n\tborder-width: 12px;\n}\n.card.selected .header .selection-fade[data-v-89b52992] {\n\topacity: 1;\n}\n.card:hover .selector[data-v-89b52992] {\n\topacity: 0.5;\n}\n.card:hover .header .selection-fade[data-v-89b52992] {\n\topacity: 1;\n}\n.title[data-v-89b52992] {\n\tposition: relative;\n\tdisplay: flex;\n\talign-items: center;\n\tinline-size: 100%;\n\tblock-size: 1.4375rem;\n\tmargin-block-start: 0.125rem;\n\toverflow: hidden;\n\tline-height: 1.3;\n\twhite-space: nowrap;\n\ttext-overflow: ellipsis;\n}\n",{});var Za=ge(Xa,[["__scopeId","data-v-89b52992"]]);const en=["onClick","onKeydown"],tn={class:"header"},an={class:"title"};var nn=o({__name:"directus-folder-section",props:k({folders:{},anyFileSelection:{type:Boolean}},{selection:{default:()=>[]},selectionModifiers:{}}),emits:["update:selection"],setup(e){const t=e,a=y(e,"selection"),n=T(),o=l(()=>a.value.length>0||(t.anyFileSelection??!1));function s(e){a.value.includes(e)?a.value=a.value.filter(t=>t!==e):a.value=[...a.value,e]}function d(e){var t;o.value?s(e.id):(t=e.id,n.push(`/storage-manager/folders/${t}`))}return(t,n)=>{const l=r("v-icon");return i(),c(v,null,[b("\n\t\tFragment of cards for Directus virtual folders — same grid pattern as\n\t\tFile Library FolderSection / storage-folder-section.\n\t"),(i(!0),c(v,null,f(e.folders,e=>{return i(),c("div",{key:e.id,class:$(["card folder-card",{selected:a.value.includes(e.id),"select-mode":o.value}]),tabindex:"0",onClick:t=>d(e),onKeydown:[w(x(t=>d(e),["self","prevent"]),["enter"]),w(x(t=>d(e),["self","prevent"]),["space"])]},[u(l,{class:"selector",name:(t=e.id,a.value.includes(t)?"check_circle":"radio_button_unchecked"),clickable:"",onClick:x(t=>s(e.id),["stop"])},null,8,["name","onClick"]),_("div",tn,[n[0]||(n[0]=_("div",{class:"selection-fade"},null,-1)),u(l,{large:"",name:"folder",outline:""})]),_("div",an,m(e.name),1)],42,en);var t}),128))],2112)}}});me("\n/* Port of Directus layouts/cards/components/card.vue (folder-only subset) */\n.card[data-v-d206f12f] {\n\tposition: relative;\n\tcursor: pointer;\n}\n.card[data-v-d206f12f]:focus-visible {\n\toutline: none;\n}\n.card[data-v-d206f12f]:focus-visible::after {\n\tposition: absolute;\n\tinset-block-start: 0;\n\tinset-inline-start: 0;\n\tz-index: 2;\n\tinline-size: 100%;\n\taspect-ratio: 1 / 1;\n\tborder-radius: var(--theme--border-radius);\n\toutline: var(--focus-ring-width) solid var(--focus-ring-color);\n\toutline-offset: var(--focus-ring-offset);\n\tcontent: '';\n\tpointer-events: none;\n}\n.header[data-v-d206f12f] {\n\tposition: relative;\n\tz-index: 1;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tinline-size: 100%;\n\toverflow: hidden;\n\tbackground-color: var(--theme--background-normal);\n\tborder-color: var(--theme--primary-subdued);\n\tborder-style: solid;\n\tborder-width: 0;\n\tborder-radius: var(--theme--border-radius);\n\ttransition: border-width var(--fast) var(--transition);\n}\n.header[data-v-d206f12f]::after {\n\tdisplay: block;\n\tpadding-block-end: 100%;\n\tcontent: '';\n}\n.header .v-icon[data-v-d206f12f] {\n\t--v-icon-color: var(--theme--foreground-subdued);\n\tposition: absolute;\n}\n.selection-fade[data-v-d206f12f] {\n\tposition: absolute;\n\tinset-block-start: 0;\n\tinset-inline-start: 0;\n\tz-index: 1;\n\tinline-size: 100%;\n\tblock-size: 2.6875rem;\n\topacity: 0;\n\ttransition: opacity var(--fast) var(--transition);\n}\n.selection-fade[data-v-d206f12f]::before {\n\tposition: absolute;\n\tinset-block-start: 0;\n\tinset-inline-start: 0;\n\tinline-size: 100%;\n\tblock-size: 100%;\n\tbackground-image: linear-gradient(-180deg, rgb(38 50 56 / 0.1) 10%, rgb(38 50 56 / 0));\n\tcontent: '';\n}\n.card[data-v-d206f12f]::before {\n\tposition: absolute;\n\tinset-block-start: 0.375rem;\n\tinset-inline-start: 0.375rem;\n\tz-index: 2;\n\tinline-size: 1rem;\n\tblock-size: 1rem;\n\tbackground-color: var(--theme--background);\n\tborder-radius: 1.375rem;\n\topacity: 0;\n\ttransition: opacity var(--fast) var(--transition);\n\tcontent: '';\n}\n.selector[data-v-d206f12f] {\n\t--v-icon-color: var(--white);\n\t--v-icon-color-hover: var(--white);\n\t--focus-ring-offset: 0;\n\n\tposition: absolute;\n\tinset-block-start: 0;\n\tinset-inline-start: 0;\n\tz-index: 3;\n\tmargin: 0.25rem;\n\topacity: 0;\n\ttransition:\n\t\topacity var(--fast) var(--transition),\n\t\tcolor var(--fast) var(--transition);\n}\n.selector[data-v-d206f12f]:focus-visible,\n.selector[data-v-d206f12f]:hover {\n\topacity: 1 !important;\n}\n.card.select-mode .selector[data-v-d206f12f] {\n\topacity: 0.5;\n}\n.card.select-mode .header .selection-fade[data-v-d206f12f] {\n\topacity: 1;\n}\n.card.selected[data-v-d206f12f]::before {\n\topacity: 1;\n}\n.card.selected .selector[data-v-d206f12f] {\n\t--v-icon-color: var(--theme--primary);\n\t--v-icon-color-hover: var(--theme--primary);\n\topacity: 1;\n}\n.card.selected .header[data-v-d206f12f] {\n\tborder-width: 12px;\n}\n.card.selected .header .selection-fade[data-v-d206f12f] {\n\topacity: 1;\n}\n.card:hover .selector[data-v-d206f12f] {\n\topacity: 0.5;\n}\n.card:hover .header .selection-fade[data-v-d206f12f] {\n\topacity: 1;\n}\n.title[data-v-d206f12f] {\n\tposition: relative;\n\tdisplay: flex;\n\talign-items: center;\n\tinline-size: 100%;\n\tblock-size: 1.4375rem;\n\tmargin-block-start: 0.125rem;\n\toverflow: hidden;\n\tfont-weight: 600;\n\tline-height: 1.3;\n\twhite-space: nowrap;\n\ttext-overflow: ellipsis;\n}\n",{});var ln=ge(nn,[["__scopeId","data-v-d206f12f"]]);const on={key:1,class:"folder-picker"},rn={key:0,class:"empty"};var sn=o({__name:"storage-target-picker",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,o=t,{storages:y,loadStorages:_}=ae(),{trees:k,loading:w,loadTree:x}=re(),C=n([]),$=l(()=>y.value.map(e=>e.location)),F=l(()=>{const e=a.modelValue?.location||"",t=String(a.modelValue?.path||"").replace(/^\/+|\/+$/g,"");if(!e)return[];const n=[`@${e}`];if(!t)return n;const l=t.split("/").filter(Boolean);for(let t=1;t<=l.length;t++)n.push(`${e}::${l.slice(0,t).join("/")}`);return n});function M(e,t){o("update:modelValue",{location:e,path:t})}return g(F,e=>{const t=new Set(C.value);for(const a of e)t.add(a);C.value=Array.from(t)},{immediate:!0}),g(C,e=>{for(const t of e){if("string"!=typeof t||!t.startsWith("@"))continue;const e=t.slice(1);e&&void 0===k.value[e]&&x(e)}},{deep:!0}),h(()=>{!async function(){await _().catch(()=>{})}()}),(t,n)=>{const l=r("v-skeleton-loader"),o=r("v-icon"),g=r("v-list-item-icon"),h=r("v-list-item-content"),y=r("v-list-group"),_=r("v-item-group"),x=r("v-list");return S(w)&&!$.value.length?(i(),s(l,{key:0})):(i(),c("div",on,[u(x,null,{default:d(()=>[u(_,{modelValue:C.value,"onUpdate:modelValue":n[0]||(n[0]=e=>C.value=e),scope:"storage-target-picker",multiple:""},{default:d(()=>[(i(!0),c(v,null,f($.value,t=>{return i(),s(y,{key:t,"disable-groupable-parent":"",clickable:"",active:(n=t,l="",a.modelValue?.location===n&&(a.modelValue?.path||"")===l),scope:"storage-target-picker",value:`@${t}`,"arrow-placement":(S(k)[t]||[]).length>0&&"after",onClick:e=>M(t,"")},{activator:d(()=>[u(g,null,{default:d(()=>[u(o,{name:"storage"})]),_:1}),u(h,null,{default:d(()=>[p("Root ("+m(t)+")",1)]),_:2},1024)]),default:d(()=>[(i(!0),c(v,null,f(S(k)[t]||[],a=>(i(),s(de,{key:`${t}:${a.path}`,folder:a,"current-path":e.modelValue.location===t?e.modelValue.path:"__none__","click-handler":e=>M(t,e),scope:"storage-target-picker","value-prefix":`${t}::`},null,8,["folder","current-path","click-handler","value-prefix"]))),128))]),_:2},1032,["active","value","arrow-placement","onClick"]);var n,l}),128))]),_:1},8,["modelValue"])]),_:1}),$.value.length?b("v-if",!0):(i(),c("p",rn,"No storage adapters configured."))]))}}});me("\n.folder-picker[data-v-0cc7349b] {\n\t--v-list-item-background-color-hover: var(--theme--background-accent);\n\t--v-list-item-background-color-active: var(--theme--background-accent);\n\n\tpadding: 0.6875rem;\n\tbackground-color: var(--theme--background-normal);\n\tborder-radius: var(--theme--border-radius);\n\tmax-block-size: 17.5rem;\n\toverflow: auto;\n}\n.empty[data-v-0cc7349b] {\n\tmargin: 8px 12px 4px;\n\tfont-size: 13px;\n\tcolor: var(--theme--foreground-subdued);\n}\n",{});var dn=ge(sn,[["__scopeId","data-v-0cc7349b"]]),un=o({__name:"upload-files-dialog",props:{modelValue:{type:Boolean},title:{default:"Add File"},uploading:{type:Boolean,default:!1}},emits:["update:modelValue","files"],setup(e,{emit:t}){const a=t,l=n(null),o=n(!1);let f=0;function g(){a("update:modelValue",!1)}function h(e){a("update:modelValue",e),e||(o.value=!1,f=0)}function b(){l.value?.click()}function y(e){const t=Array.from(e||[]).filter(e=>Boolean(e.type)||e.size>0);t.length&&a("files",t)}function k(e){const t=e.target;y(t.files),t.value=""}function w(){f++,1===f&&(o.value=!0)}function S(){f--,f<=0&&(f=0,o.value=!1)}function C(e){f=0,o.value=!1,y(e.dataTransfer?.files)}return(t,a)=>{const n=r("v-card-title"),f=r("v-progress-circular"),y=r("v-icon"),F=r("v-card-text"),M=r("v-button"),V=r("v-card-actions"),z=r("v-card"),B=r("v-dialog");return i(),s(B,{"model-value":e.modelValue,"onUpdate:modelValue":h,onEsc:g},{default:d(()=>[u(z,null,{default:d(()=>[u(n,null,{default:d(()=>[p(m(e.title),1)]),_:1}),u(F,null,{default:d(()=>[_("div",{class:$(["upload-zone",{dragging:o.value,uploading:e.uploading}]),"data-dropzone":"",onClick:b,onDragenter:x(w,["prevent"]),onDragover:a[1]||(a[1]=x(()=>{},["prevent"])),onDragleave:x(S,["prevent"]),onDrop:x(C,["prevent","stop"])},[e.uploading?(i(),c(v,{key:0},[u(f,{indeterminate:""}),a[2]||(a[2]=_("p",null,"Uploading…",-1))],64)):(i(),c(v,{key:1},[u(y,{large:"",name:o.value?"file_download":"file_upload"},null,8,["name"]),_("p",null,m(o.value?"Drop files to upload":"Drag and drop files here"),1),a[3]||(a[3]=_("p",{class:"hint"},"or click to browse from your device",-1))],64)),_("input",{ref_key:"fileInput",ref:l,class:"hidden-input",type:"file",multiple:"",onChange:k,onClick:a[0]||(a[0]=x(()=>{},["stop"]))},null,544)],34)]),_:1}),u(V,null,{default:d(()=>[u(M,{onClick:g},{default:d(()=>[...a[4]||(a[4]=[p("Done",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["model-value"])}}});me("\n.upload-zone[data-v-63a4ef66] {\n\tposition: relative;\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tjustify-content: center;\n\tgap: 8px;\n\tmin-block-size: 12.5rem;\n\tpadding: 2rem 1.5rem;\n\tcolor: var(--theme--foreground-subdued);\n\ttext-align: center;\n\tcursor: pointer;\n\tbackground-color: var(--theme--background);\n\tborder: var(--theme--border-width) dashed var(--theme--form--field--input--border-color);\n\tborder-radius: var(--theme--border-radius);\n\ttransition:\n\t\tborder-color var(--fast) var(--transition),\n\t\tcolor var(--fast) var(--transition),\n\t\tbackground-color var(--fast) var(--transition);\n}\n.upload-zone[data-v-63a4ef66]:hover,\n.upload-zone.dragging[data-v-63a4ef66] {\n\tcolor: var(--theme--primary);\n\tbackground-color: var(--theme--primary-background);\n\tborder-color: var(--theme--primary);\n}\n.upload-zone.uploading[data-v-63a4ef66] {\n\tpointer-events: none;\n\tcursor: default;\n}\n.upload-zone p[data-v-63a4ef66] {\n\tmargin: 0;\n\tcolor: inherit;\n}\n.upload-zone .hint[data-v-63a4ef66] {\n\tfont-size: 13px;\n\topacity: 0.85;\n}\n.hidden-input[data-v-63a4ef66] {\n\tposition: absolute;\n\tinline-size: 0;\n\tblock-size: 0;\n\topacity: 0;\n\tpointer-events: none;\n}\n",{});var cn=ge(un,[["__scopeId","data-v-63a4ef66"]]);const vn={class:"drawer-body"},fn={class:"field"},pn={class:"mode-cards"},mn={class:"mode-card-header"},gn={class:"mode-card-header"},hn={key:0,class:"field"},bn={key:1,class:"field"},yn={class:"field"},_n={class:"actions"},kn={key:3,class:"result"},wn={key:0},xn={key:1},Sn={key:2,class:"note"},Cn={key:3,class:"by-storage"},$n={key:4,class:"empty-storage"},Fn={key:4,class:"result"};var Mn=o({__name:"materialize-drawer",props:{modelValue:{type:Boolean},storages:{},folderId:{}},emits:["update:modelValue","done"],setup(t,{emit:a}){const o=t,g=a,h=e(),y=n("preserve"),k=n(null),w=n(!1),x=n(!0),C=n(!1),F=n(!1),M=n(!1),V=n(null),z=n(null),B=n(null),I=n(null),D=n(0),U=n({from:null,to:"",currentIndex:0,totalFiles:0,currentName:"",transferredBytes:0,totalBytes:0,elapsedMs:0,speedBps:0,succeeded:0,skipped:0,failed:0}),N=l(()=>o.storages.map(e=>({text:`${e.location} (${e.short})`,value:e.location}))),A=l(()=>"merge"!==y.value||Boolean(k.value));async function E(){V.value=null,C.value=!0;try{const e=await h.post("/storage-manager/materialize/dry-run",{folder_id:o.folderId??null,mode:y.value,target_storage:"merge"===y.value?k.value:void 0,structure_only:w.value,recursive:x.value});z.value=e.data?.data||null}catch(e){V.value=e?.response?.data?.errors?.[0]?.message||e?.message||"Dry run failed"}finally{C.value=!1}}async function L(){if(A.value){V.value=null,F.value=!0,M.value=!1,D.value=Date.now(),U.value={from:null,to:"merge"===y.value?String(k.value||""):"preserve",currentIndex:0,totalFiles:z.value?.total_files||0,currentName:"",transferredBytes:0,totalBytes:z.value?.total_bytes||0,elapsedMs:0,speedBps:0,succeeded:0,skipped:0,failed:0};try{I.value=new AbortController;const e=await fetch("/storage-manager/materialize/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},credentials:"same-origin",signal:I.value.signal,body:JSON.stringify({folder_id:o.folderId??null,mode:y.value,target_storage:"merge"===y.value?k.value:void 0,structure_only:w.value,keep_source_file_on_disk:!1,recursive:x.value})});await async function(e,t){if(!e.ok){let t=`Materialize failed (${e.status})`;try{const a=await e.json();t=a?.errors?.[0]?.message||t}catch{}throw new Error(t)}if(!e.body)throw new Error("No response body for materialize stream");const a=e.body.getReader(),n=new TextDecoder;let l="";for(;;){const{done:e,value:o}=await a.read();if(e)break;l+=n.decode(o,{stream:!0});const r=l.split("\n\n");l=r.pop()||"";for(const e of r)for(const a of e.split("\n")){const e=a.trim();if(!e.startsWith("data:"))continue;const n=e.slice(5).trim();if(!n)continue;let l;try{l=JSON.parse(n)}catch{continue}if(t(l),"error"===l.type)throw new Error(l.message||"Materialize failed")}}}(e,O),g("done")}catch(e){"AbortError"===e?.name?M.value=!0:V.value=e?.response?.data?.errors?.[0]?.message||e?.message||"Materialize failed"}finally{F.value=!1,I.value=null}}}function P(){I.value?.abort()}function O(e){const t=Date.now()-D.value;return"start"===e.type?(U.value.from=e.from||null,U.value.to=e.to,U.value.totalFiles=e.total,void(U.value.totalBytes=e.total_bytes)):"file_start"===e.type?(U.value.currentIndex=e.index,void(U.value.currentName=e.name)):"file_done"===e.type?(U.value.currentIndex=e.index,U.value.currentName=e.name,U.value.succeeded=e.succeeded,U.value.skipped=e.skipped,U.value.failed=e.failed,U.value.transferredBytes=e.transferred_bytes,U.value.totalBytes=e.total_bytes,U.value.elapsedMs=e.elapsed_ms,void(U.value.speedBps=e.elapsed_ms>0?1e3*e.transferred_bytes/e.elapsed_ms:0)):void("done"===e.type&&(B.value={total:e.data.total,succeeded:e.data.succeeded,skipped:e.data.skipped,failed:e.data.failed},U.value.currentIndex=e.data.total,U.value.succeeded=e.data.succeeded,U.value.skipped=e.data.skipped,U.value.failed=e.data.failed,U.value.transferredBytes=e.data.transferred_bytes||U.value.transferredBytes,U.value.totalBytes=e.data.total_bytes||U.value.totalBytes,U.value.elapsedMs=e.data.elapsed_ms||t,U.value.speedBps=U.value.elapsedMs>0?1e3*U.value.transferredBytes/U.value.elapsedMs:0))}return(e,a)=>{const n=r("v-icon"),l=r("v-select"),o=r("v-checkbox"),h=r("v-button"),I=r("v-notice"),D=r("v-drawer");return i(),s(D,{"model-value":t.modelValue,title:"Materialize Folder",icon:"account_tree",persistent:F.value,"onUpdate:modelValue":a[5]||(a[5]=e=>g("update:modelValue",e)),onCancel:a[6]||(a[6]=e=>g("update:modelValue",!1))},{default:d(()=>[_("div",vn,[a[22]||(a[22]=_("p",{class:"intro"}," Materialize virtual Directus folders into real storage paths. ",-1)),_("div",fn,[a[13]||(a[13]=_("label",null,"Storage Mode",-1)),_("div",pn,[_("div",{class:$(["mode-card",{active:"preserve"===y.value}]),onClick:a[0]||(a[0]=e=>y.value="preserve")},[_("div",mn,[u(n,{name:"devices",small:""}),a[7]||(a[7]=_("strong",null,"Keep",-1))]),a[8]||(a[8]=_("p",{class:"mode-card-desc"},"Each file stays on its current storage. Only the folder path is created there.",-1)),a[9]||(a[9]=_("p",{class:"mode-card-example"},[_("em",null,"Example:"),p(" photo.jpg on "),_("code",null,"s3"),p(" → moved to "),_("code",null,"s3/travel/paris/photo.jpg"),p(". A file on "),_("code",null,"local"),p(" stays on "),_("code",null,"local"),p(". ")],-1))],2),_("div",{class:$(["mode-card",{active:"merge"===y.value}]),onClick:a[1]||(a[1]=e=>y.value="merge")},[_("div",gn,[u(n,{name:"merge",small:""}),a[10]||(a[10]=_("strong",null,"Merge",-1))]),a[11]||(a[11]=_("p",{class:"mode-card-desc"},"All files are moved into one target storage, placed at their virtual folder path.",-1)),a[12]||(a[12]=_("p",{class:"mode-card-example"},[_("em",null,"Example:"),p(" Files from both "),_("code",null,"s3"),p(" and "),_("code",null,"local"),p(" end up on "),_("code",null,"local2/travel/paris/"),p(". ")],-1))],2)])]),"merge"===y.value?(i(),c("div",hn,[a[14]||(a[14]=_("label",null,"Target Storage",-1)),u(l,{modelValue:k.value,"onUpdate:modelValue":a[2]||(a[2]=e=>k.value=e),items:N.value,"item-text":"text","item-value":"value"},null,8,["modelValue","items"])])):b("v-if",!0),"preserve"===y.value?(i(),c("div",bn,[u(o,{modelValue:w.value,"onUpdate:modelValue":a[3]||(a[3]=e=>w.value=e),label:"Build Storage Folder Structure only (don't move files)"},null,8,["modelValue"])])):b("v-if",!0),_("div",yn,[u(o,{modelValue:x.value,"onUpdate:modelValue":a[4]||(a[4]=e=>x.value=e),label:"Include subfolders"},null,8,["modelValue"])]),_("div",_n,[u(h,{secondary:"",loading:C.value,disabled:F.value,onClick:E},{default:d(()=>[...a[15]||(a[15]=[p("Dry Run",-1)])]),_:1},8,["loading","disabled"]),F.value?(i(),s(h,{key:1,kind:"danger",secondary:"",onClick:P},{default:d(()=>[...a[17]||(a[17]=[p("Cancel",-1)])]),_:1})):(i(),s(h,{key:0,disabled:!A.value,loading:F.value,onClick:L},{default:d(()=>[...a[16]||(a[16]=[p("Run",-1)])]),_:1},8,["disabled","loading"]))]),V.value?(i(),s(I,{key:2,type:"danger"},{default:d(()=>[p(m(V.value),1)]),_:1})):b("v-if",!0),z.value?(i(),c("div",kn,[_("p",null,[a[18]||(a[18]=_("strong",null,"Files:",-1)),p(" "+m(z.value.total_files.toLocaleString()),1)]),z.value.total_folders>0?(i(),c("p",wn,[a[19]||(a[19]=_("strong",null,"Folders:",-1)),p(" "+m(z.value.total_folders.toLocaleString()),1)])):b("v-if",!0),_("p",null,[a[20]||(a[20]=_("strong",null,"Total Size:",-1)),p(" "+m(S(Ue)(z.value.total_bytes||0)),1)]),z.value.conflicts>0?(i(),c("p",xn,[a[21]||(a[21]=_("strong",null,"Path conflicts:",-1)),p(" "+m(z.value.conflicts.toLocaleString()),1)])):b("v-if",!0),z.value.conflicts>0?(i(),c("p",Sn," A destination path already exists on disk, or two files would use the same path. ")):b("v-if",!0),_("p",null,[_("strong",null,m("merge"===z.value.mode?"Will be written to":"Stay on current storage")+":",1)]),z.value.by_storage.length?(i(),c("ul",Cn,[(i(!0),c(v,null,f(z.value.by_storage,e=>(i(),c("li",{key:e.storage},m(e.storage),1))),128))])):(i(),c("p",$n,"No files in this folder."))])):b("v-if",!0),B.value?(i(),c("div",Fn,[u(I,{type:B.value.failed?"danger":"success"},{default:d(()=>[p(m(B.value.succeeded)+" succeeded · "+m(B.value.skipped)+" skipped · "+m(B.value.failed)+" failed (of "+m(B.value.total)+") ",1)]),_:1},8,["type"])])):b("v-if",!0),F.value||B.value?(i(),s(ma,{key:5,storages:t.storages,mode:"move",from:U.value.from,to:U.value.to,"current-index":U.value.currentIndex,"total-files":U.value.totalFiles,"current-name":U.value.currentName,"transferred-bytes":U.value.transferredBytes,"total-bytes":U.value.totalBytes,"elapsed-ms":U.value.elapsedMs,"speed-bps":U.value.speedBps,succeeded:U.value.succeeded,skipped:U.value.skipped,failed:U.value.failed,"is-done":Boolean(B.value)&&!F.value,"is-cancelled":M.value},null,8,["storages","from","to","current-index","total-files","current-name","transferred-bytes","total-bytes","elapsed-ms","speed-bps","succeeded","skipped","failed","is-done","is-cancelled"])):b("v-if",!0)])]),_:1},8,["model-value","persistent"])}}});me("\n.drawer-body[data-v-cb0b2133] { padding: 20px 24px 32px; display: flex; flex-direction: column; gap: 14px;\n}\n.field[data-v-cb0b2133] { display: flex; flex-direction: column; gap: 8px;\n}\n.note[data-v-cb0b2133] { margin: 0; font-size: 12px; color: var(--theme--foreground-subdued);\n}\n.actions[data-v-cb0b2133] { display: flex; gap: 8px;\n}\n.result[data-v-cb0b2133] { padding: 10px; border-radius: var(--theme--border-radius); background: var(--theme--background-subdued);\n}\n.by-storage[data-v-cb0b2133] { margin: 4px 0 0; padding-left: 18px;\n}\n.empty-storage[data-v-cb0b2133] { margin: 4px 0 0; color: var(--theme--foreground-subdued);\n}\n.mode-cards[data-v-cb0b2133] {\n\tdisplay: grid;\n\tgrid-template-columns: 1fr 1fr;\n\tgap: 10px;\n}\n.mode-card[data-v-cb0b2133] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n\tpadding: 12px 14px;\n\tborder-radius: var(--theme--border-radius);\n\tborder: 2px solid var(--theme--border-color);\n\tcursor: pointer;\n\ttransition: border-color 0.15s, background 0.15s;\n}\n.mode-card[data-v-cb0b2133]:hover {\n\tborder-color: var(--theme--primary);\n}\n.mode-card.active[data-v-cb0b2133] {\n\tborder-color: var(--theme--primary);\n\tbackground: var(--theme--primary-background);\n}\n.mode-card-header[data-v-cb0b2133] {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 6px;\n}\n.mode-card-desc[data-v-cb0b2133] {\n\tmargin: 0;\n\tfont-size: 13px;\n\tcolor: var(--theme--foreground);\n}\n.mode-card-example[data-v-cb0b2133] {\n\tmargin: 0;\n\tfont-size: 12px;\n\tcolor: var(--theme--foreground-subdued);\n\tline-height: 1.4;\n}\n.mode-card-example code[data-v-cb0b2133] {\n\tfont-family: var(--theme--fonts--mono--font-family, monospace);\n\tfont-size: 11px;\n\tbackground: var(--theme--background-subdued);\n\tpadding: 1px 4px;\n\tborder-radius: 3px;\n}\n",{});var Vn=ge(Mn,[["__scopeId","data-v-cb0b2133"]]);function zn(a){const o=e(),{useNotificationsStore:r,useServerStore:i}=t(),s=r(),d=i?.(),u=n(!1),c=n(!1),v=n(0),f=l(()=>v.value>0);let p,m;function g(){u.value=!0,p=s.add({title:"Drop to upload",icon:"cloud_upload",type:"info",persist:!0,closeable:!1})}function b(){u.value=!1,p&&(s.remove(p),p=void 0)}function y(e){if(!e.dataTransfer)return;if(-1===e.dataTransfer.types.indexOf("Files"))return;e.preventDefault(),v.value++;const t=e.target&&""===e.target.getAttribute?.("data-dropzone");1===v.value&&!1===u.value&&!1===t&&g(),t&&(b(),v.value=0)}function _(e){e.dataTransfer&&-1!==e.dataTransfer.types.indexOf("Files")&&e.preventDefault()}function k(e){e.dataTransfer&&-1!==e.dataTransfer.types.indexOf("Files")&&(e.preventDefault(),v.value--,0===v.value&&b(),e.target&&""===e.target.getAttribute?.("data-dropzone")&&(g(),v.value=1))}async function w(e){if(!e.dataTransfer)return;if(-1===e.dataTransfer.types.indexOf("Files"))return;e.preventDefault(),u.value=!1,v.value=0,p&&(s.remove(p),p=void 0);const t=Array.from(e.dataTransfer.files).filter(e=>e.type);t.length&&await C(t)}async function x(e,t){const n=new FormData,l=S(a.preset);l.storage&&n.append("storage",l.storage),l.folder&&n.append("folder",l.folder),n.append("file",e);const r=await o.post("/files",n,{onUploadProgress:e=>{e.total&&t(Math.floor(100*e.loaded/e.total))}}),i=r?.data?.data?.id,s=l.storagePath?String(l.storagePath).replace(/^\/+|\/+$/g,""):"";i&&l.storage&&s&&await o.post(`/storage-manager/storages/${encodeURIComponent(l.storage)}/place-file`,{file_id:i,target_path:s})}async function C(e){if(!e.length||c.value)return;c.value=!0;const t=e.map(()=>0),n=Math.max(1,Number(d?.info?.uploads?.maxConcurrency)||2);m=s.add({title:`Uploading 0 of ${e.length}…`,type:"info",persist:!0,closeable:!1,loading:!0});const l=()=>{const a=t.filter(e=>100===e).length,n=t.reduce((e,t)=>e+t,0)/t.length;m&&s.update(m,{title:`Uploading ${a} of ${e.length}…`,loading:!1,progress:n})};let o=0,r=0;try{await Promise.all(Array.from({length:Math.min(n,e.length)},()=>async function(){for(;o<e.length;){const a=o++,n=e[a];try{await x(n,e=>{t[a]=e,l()}),t[a]=100,l()}catch(e){r++,t[a]=100,l();const o=e?.response?.data?.errors?.[0]?.message||e?.message||`Failed to upload ${n.name}`;s.add({title:o,type:"error",icon:"error"})}}}()))}finally{m&&(s.remove(m),m=void 0),c.value=!1,r<e.length&&(s.add({title:r?`Uploaded ${e.length-r} of ${e.length}`:"Upload complete",type:r?"warning":"success",icon:r?"warning":"check"}),await(a.onDone?.()))}}return h(()=>{window.addEventListener("dragenter",y),window.addEventListener("dragover",_),window.addEventListener("dragleave",k),window.addEventListener("drop",w)}),B(()=>{window.removeEventListener("dragenter",y),window.removeEventListener("dragover",_),window.removeEventListener("dragleave",k),window.removeEventListener("drop",w),b(),m&&s.remove(m)}),{dragging:f,showDropEffect:u,uploading:c,uploadFiles:C,onFileInputChange:function(e){const t=e.target,a=Array.from(t.files||[]).filter(e=>e.type);t.value="",a.length&&C(a)}}}const Bn="storage-manager-files-preset",In="cards",Dn={icon:"insert_drive_file",title:"{{ title }}",subtitle:"{{ type }} • {{ filesize }}",size:4,imageFit:"crop"},Un={sort:["-uploaded_on"],page:1,limit:25};function Nn(){const e=function(){try{const e=localStorage.getItem(Bn);return e?JSON.parse(e):{}}catch{return{}}}(),t=n(e.layout||In),a=n({...Dn,...e.layoutOptions||{}}),l=n({...Un,...e.layoutQuery||{},page:Math.max(1,Number(e.layoutQuery?.page)||1),limit:En(e.layoutQuery?.limit)}),o=n(null),r=n(null);return g([t,a,l],()=>{try{localStorage.setItem(Bn,JSON.stringify({layout:t.value,layoutOptions:a.value,layoutQuery:{...l.value,page:Math.max(1,Number(l.value.page)||1),limit:En(l.value.limit)}}))}catch{}},{deep:!0}),{layout:t,layoutOptions:a,layoutQuery:l,filter:o,search:r,resetPreset:function(){t.value=In,a.value={...Dn},l.value={...Un},o.value=null,r.value=null},resetPage:function(){1!==Number(l.value.page)&&(l.value={...l.value,page:1})}}}const An=[25,50,100,250,500,1e3];function En(e){const t=Number(e);return An.includes(t)?t:25}function Ln(e){const t={_and:[{type:{_nnull:!0}}]};return e?t._and.push({folder:{_eq:e}}):t._and.push({folder:{_null:!0}}),t}function Pn(e,t){return e?t?{_and:[e,t]}:e:t??null}const On={key:0,class:"move-hint"},jn={key:1,class:"move-destination-hint"},Tn={class:"move-dry-run"},Rn={key:0,class:"move-dry-result"},qn={key:1,class:"move-hint"},Kn={key:0,class:"move-hint"},Jn={key:1,class:"move-samples"},Wn={key:0},Hn={key:2,class:"move-hint"},Qn={class:"page-intro"},Gn={class:"sidebar-actions"},Yn={class:"sidebar-text storage-label"},Xn={class:"sidebar-text sidebar-note"},Zn="storage-location-badge";var el=o({__name:"collection-browser",props:{mode:{},folder:{},storage:{},storagePath:{}},setup(t){const a=t,o=e(),y=R(),k=T(),{folders:w}=Y(),{storages:x,loadStorages:F}=ae(),{refreshTree:M}=re(),{running:B,reopenNonce:I,start:D}=Jt(),U=Ke(),N=n(),J=n([]),W=n([]),H=n([]),Q=n(!1),G=n(!1),X=n(!1),Z=n({location:"",path:""}),ee=n(!1),te=n(!1),ne=n(!0),le=n(null),oe=n(!1),ie=n(!1),se=n(!1),de=n([]),{layout:ue,layoutOptions:ce,layoutQuery:ve,filter:fe,search:pe,resetPreset:me,resetPage:ge}=Nn(),{layoutWrapper:he}=bt(ue),be=l(()=>String(a.storagePath||"").replace(/\\/g,"/").replace(/^\/+|\/+$/g,"")),ye=l(()=>"storage"===a.mode&&a.storage?function(e,t,a=[]){const n=String(t||"").replace(/\\/g,"/").replace(/^\/+|\/+$/g,""),l=[{type:{_nnull:!0}},{storage:{_eq:e}}];if(n){l.push({filename_disk:{_starts_with:`${n}/`}});for(const e of a){const t=String(e||"").trim();t&&!t.includes("/")&&l.push({filename_disk:{_nstarts_with:`${n}/${t}/`}})}}else l.push({filename_disk:{_ncontains:"/"}});return{_and:l}}(a.storage,be.value,H.value.map(e=>e.name)):Ln(a.folder??null)),ke=l(()=>{if("storage"===a.mode){if(be.value){const e=be.value.split("/");return e[e.length-1]||a.storage||"Storage"}return a.storage||"Storage"}if(a.folder){const e=w.value?.find(e=>e.id===a.folder);return e?.name||"Folder"}return"Directus Folders"}),we=l(()=>"folders"===a.mode&&!a.folder&&!pe.value&&!fe.value),xe=l(()=>{if("folders"!==a.mode||!w.value)return[];const e=a.folder??null;return w.value.filter(t=>e?t.parent===e:null==t.parent).slice().sort((e,t)=>e.name.localeCompare(t.name))}),Se=l(()=>{const e=[{name:"Storage Manager",to:"/storage-manager"}];if("storage"===a.mode){if(e.push({name:a.storage||"Storage",to:`/storage-manager/storage/${a.storage}`}),be.value){const t=be.value.split("/").filter(Boolean);let n="";for(const l of t)n=n?`${n}/${l}`:l,e.push({name:l,to:Ce(a.storage,n)})}}else e.push({name:"Directus Folders",to:"/storage-manager/folders"}),a.folder&&e.push({name:ke.value,to:`/storage-manager/folders/${a.folder}`});return e}),$e=l(()=>"storage"===a.mode&&a.storage&&x.value.find(e=>e.location===a.storage)||null),Fe=n(!1),Me=n(!1),Ve=n("files"),ze=n([]);n(!1);const Be=l(()=>"files"===Ve.value?ze.value.length||J.value.length||void 0:"storage"===Ve.value?$e.value?.file_count??void 0:"folder"===Ve.value?Ne.value??void 0:void 0),Ie=l(()=>{if("storage"===Ve.value)return $e.value?.total_bytes}),Ne=n(null),Ae=l(()=>"folders"===a.mode&&de.value.length>1),Ee=l(()=>"folders"===a.mode),Le=["title","type","filesize","modified_on"],Pe=l({get(){const e={...ve.value};if(!Ee.value||"tabular"!==ue.value)return e;const t=[...e.fields?.length?e.fields:Le];return t.includes("storage")||t.push("storage"),{...e,fields:t}},set(e){ve.value=e}}),Oe=l(()=>{if(!Ae.value)return"";const e=de.value.join(", ");return`This ${a.folder?"folder":"root view"} has files on ${de.value.length} storages (${e}).`}),je=l(()=>"folders"===a.mode&&0===J.value.length&&0===W.value.length),Te=l(()=>"storage"===a.mode&&Boolean(a.storage)&&!be.value&&0===J.value.length&&0===W.value.length),qe=l(()=>be.value?"Detect Files in this Folder":`Detect Files on ${a.storage}`),Je=l(()=>0===J.value.length&&0===W.value.length),We=l(()=>J.value.length>0||"storage"===a.mode&&W.value.length>0||"storage"===a.mode&&Boolean(a.storage)&&!be.value&&0===J.value.length&&0===W.value.length||"folders"===a.mode&&0===J.value.length&&0===W.value.length&&(Ne.value??0)>0),He=l(()=>"storage"===a.mode&&Boolean(a.storage)&&!be.value&&0===J.value.length&&0===W.value.length),Qe=l(()=>He.value?`Moves every file and folder on “${a.storage}” into the destination you pick. Existing folders with the same name are merged. Files that already exist at the destination stay there.`:"storage"===a.mode&&W.value.length?1===W.value.length?"Moves the selected storage folder into the destination you pick. If that folder name already exists there, files are merged into it.":"Moves the selected storage folders into the destination you pick. Matching folder names are merged.":1===J.value.length?"Moves the selected file into the storage folder you pick.":J.value.length>1?`Moves ${J.value.length} selected files into the storage folder you pick.`:"folders"===a.mode?a.folder?"No files selected — moves all files in this Directus folder into the storage folder you pick.":"No files selected — moves all unfiled files into the storage folder you pick.":""),Ge=l(()=>"storage"===a.mode&&W.value.length?W.value.map(String):[]),Ye=l(()=>He.value?`Move all on ${a.storage}`:"Move to Storage Folder"),Xe=l(()=>{const e=Z.value.location;if(!e)return"";const t=Z.value.path?`${e}/${Z.value.path}/`:`${e}/`;if(He.value)return`Everything on “${a.storage}” will be merged into ${t}`;if(1===Ge.value.length){const e=String(Ge.value[0]).split("/").filter(Boolean).pop();return`Folder “${e}” will be merged into ${t}${e}/`}return Ge.value.length>1?`Selected folders will be merged into ${t}{folder-name}/`:`Files will be moved to ${t}`});l(()=>"storage"===a.mode&&W.value.length>0);const Ze=l(()=>J.value.length>0||"storage"===a.mode&&W.value.length>0);l(()=>W.value.length>0&&0===J.value.length?1===W.value.length?"Migrate Selected Folder":"Migrate Selected Folders":"Migrate Selected");const et=l(()=>{const e=J.value.length;return 1===e?"Are you sure you want to delete this item? This action cannot be undone.":`Are you sure you want to delete ${e} items? This action cannot be undone.`});function tt(){"storage"===a.mode&&W.value.length>0?ie.value=!0:oe.value=!0}async function at(){if("folders"===a.mode)try{const e=await o.get("/files",{params:{limit:0,meta:"filter_count",filter:JSON.stringify(Ln(a.folder??null))}});Ne.value=Number(e.data?.meta?.filter_count??0)}catch{Ne.value=0}else Ne.value=null}async function nt(){if("folders"===a.mode)try{const e=await o.get("/files",{params:{filter:JSON.stringify(Ln(a.folder??null)),fields:["storage"],limit:-1}}),t=new Set;for(const a of e.data?.data||[]){const e=String(a?.storage||"").trim();e&&t.add(e)}de.value=Array.from(t).sort((e,t)=>e.localeCompare(t))}catch{de.value=[]}else de.value=[]}function lt(e){const t=document.createElement("span");return t.className=Zn,t.textContent=e,t}function ot(){document.querySelectorAll(`.layout-cards .header .${Zn}`).forEach(e=>{e.remove()}),document.querySelectorAll(`.layout-tabular .${Zn}`).forEach(e=>{const t=e.parentElement,a=e.textContent||"";e.remove(),t&&!t.querySelector(`.${Zn}`)&&t.append(a)})}async function rt(e){if(ot(),!Ee.value)return;if(await j(),"tabular"===ue.value)return void function(){const e=document.querySelector(".layout-tabular thead tr");if(!e)return;const t=Array.from(e.children);let a=t.findIndex(e=>String(e.className||"").split(/\s+/).includes("storage")||"storage"===e.getAttribute("data-field"));a<0&&(a=t.findIndex(e=>"storage"===e.textContent?.trim().toLowerCase())),a<0||document.querySelectorAll(".layout-tabular tbody tr").forEach(e=>{const t=e.children[a];if(!t||t.querySelector(`.${Zn}`))return;const n=String(t.textContent||"").trim();n&&(t.textContent="",t.appendChild(lt(n)))})}();if("cards"!==ue.value||!e?.length)return;const t=document.querySelectorAll(".layout-cards .grid .card:not(.folder-card)");if(!t.length)return;const a="id",n=e.some(e=>null!=e[a]&&null==e.storage);let l={};if(n){const t=e.map(e=>e[a]).filter(Boolean);if(!t.length)return;try{const e=await o.get("/files",{params:{filter:JSON.stringify({id:{_in:t}}),fields:["id","storage"],limit:t.length}});for(const t of e.data?.data||[])l[String(t.id)]=String(t.storage||"")}catch{return}}t.forEach((t,n)=>{const o=e[n];if(!o)return;const r=String(o.storage??l[String(o[a])]??"").trim();if(!r)return;const i=t.querySelector(".header");i&&i.appendChild(lt(r))})}async function it(){await(N.value?.state?.refresh?.()),await F(!0).catch(()=>{}),await st(),await at().catch(()=>{}),await nt().catch(()=>{}),"storage"===a.mode&&a.storage&&await M(a.storage).catch(()=>{})}async function st(){if("storage"===a.mode&&a.storage){Q.value=!0;try{const e=await o.get(`/storage-manager/storages/${encodeURIComponent(a.storage)}/browse`,{params:{path:be.value||""}});H.value=e.data?.data?.folders||[]}catch{H.value=[]}finally{Q.value=!1}}else H.value=[]}function dt(){fe.value=null,pe.value=null}function ut(){Me.value=!0,"storage"===a.mode&&a.storage&&"1"!==String(y.query.detect||"")&&k.replace({path:y.path,query:{...y.query,detect:"1"}})}function ct(e){if(Me.value=e,!e&&"1"===String(y.query.detect||"")){const e={...y.query};delete e.detect,k.replace({path:y.path,query:e})}}async function vt(){J.value=[],W.value=[],ze.value=[],await it()}async function ft(){J.value=[],W.value=[],await it()}async function pt(){await it()}q((e,t)=>{e.path!==t.path&&(J.value=[],W.value=[],oe.value=!1,ie.value=!1,ot())}),K((e,t)=>{e.path!==t.path&&(J.value=[],W.value=[],oe.value=!1,ie.value=!1)}),g(()=>[a.folder,a.storage,a.mode,be.value],()=>{J.value=[],W.value=[],ge(),at(),nt(),ot()}),g(()=>[Ee.value,ue.value,ve.value.page,ve.value.limit,JSON.stringify(ve.value.sort??[]),N.value?.state?.loading,N.value?.state?.items],()=>{var e;N.value?.state?.loading||(e=N.value?.state?.items,rt(e).catch(()=>{}))},{deep:!0,flush:"post"}),g(()=>[a.storage,String(y.query.detect||"")],([e,t])=>{"storage"===a.mode&&e&&"1"===t&&(Me.value=!0)},{immediate:!0}),h(()=>{F().catch(()=>{}),st().catch(()=>{}),at().catch(()=>{}),nt().catch(()=>{})}),g(()=>[a.mode,a.storage,be.value],()=>{st()}),g(B,async(e,t)=>{t&&!e&&(J.value=[],await it())}),g(I,()=>{B.value&&(Fe.value=!0)}),g(()=>String(y.query.migrateJob||""),e=>{if("1"!==e)return;Fe.value=!0;const t={...y.query};delete t.migrateJob,k.replace({path:y.path,query:t})},{immediate:!0});const mt=l(()=>"storage"===a.mode?{storage:a.storage,storagePath:be.value||null}:{folder:a.folder??null}),gt=n(!1),{dragging:ht,showDropEffect:yt,uploading:_t,uploadFiles:xt}=zn({preset:mt,onDone:it}),St=l(()=>"storage"===a.mode&&a.storage?`Upload to ${a.storage}`:"Add File");function Ct(){gt.value=!0}async function Ft(e){await xt(e)}async function Mt(){if(!se.value&&J.value.length){se.value=!0;try{await o.delete("/files",{data:J.value}),J.value=[],oe.value=!1,await it()}catch(e){window.alert(e?.response?.data?.errors?.[0]?.message||e?.message||"Delete failed")}finally{se.value=!1}}}async function Vt(){try{J.value.length>0&&await o.delete("/files",{data:J.value})}catch(e){window.alert(e?.response?.data?.errors?.[0]?.message||e?.message||"Delete failed")}J.value=[],W.value=[],ie.value=!1,await it(),a.storage&&await M(a.storage).catch(()=>{})}async function zt(){if(Z.value.location&&!te.value){te.value=!0,le.value=null;try{const e=await async function(){const e=Z.value.location,t=Z.value.path||"",n=[...Ge.value],l={target_storage:e,target_path:t,preserve_paths:He.value,include_empty_folders:ne.value,source_folders:n};return He.value?l.source_storage=a.storage||void 0:"storage"===a.mode&&W.value.length?(l.source_storage=a.storage||void 0,J.value.length&&(l.file_ids=J.value.map(String))):"folders"===a.mode&&0===J.value.length?(l.folder_id=a.folder??null,l.recursive=!0):(l.file_ids=J.value.map(String),a.storage&&(l.source_storage=a.storage)),l}(),t=await o.post("/storage-manager/migrate/dry-run",e);le.value=t.data?.data??null}catch(e){window.alert(e?.response?.data?.errors?.[0]?.message||e?.message||"Dry run failed")}finally{te.value=!1}}}async function Bt(){const e=Z.value.location,t=Z.value.path||"";if(!e)return;ee.value=!0;const n=[...Ge.value],l=He.value;try{const r=He.value?((await o.get("/files",{params:{limit:-1,fields:["id"],filter:JSON.stringify({storage:{_eq:a.storage}})}})).data?.data||[]).map(e=>String(e.id)):await async function(){const e=new Set(J.value.map(String));if("folders"===a.mode&&0===e.size){try{const t=await o.get("/files",{params:{limit:-1,fields:["id"],filter:JSON.stringify(Ln(a.folder??null))}});for(const a of t.data?.data||[])e.add(String(a.id))}catch{}return Array.from(e)}if("storage"===a.mode&&a.storage&&W.value.length)for(const t of W.value){const n=String(t||"").replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");if(n)try{const t=await o.get("/files",{params:{limit:-1,fields:["id"],filter:JSON.stringify({_and:[{storage:{_eq:a.storage}},{filename_disk:{_starts_with:`${n}/`}}]})}});for(const a of t.data?.data||[])e.add(String(a.id))}catch{}}return Array.from(e)}();if(!r.length&&!n.length&&!He.value)return void window.alert("folders"===a.mode&&0===J.value.length?"This Directus folder has no files to move.":"No files selected.");if(!r.length&&(n.length||He.value)){const r=await o.post(`/storage-manager/storages/${encodeURIComponent(e)}/move-files`,{file_ids:[],target_path:t,source_folders:n,include_empty_folders:ne.value,source_storage:a.storage||void 0,preserve_paths:l});return It(r.data?.data?.skipped),G.value=!1,J.value=[],W.value=[],void await it()}const i=await o.get("/files",{params:{limit:-1,fields:["id","storage"],filter:JSON.stringify({id:{_in:r}})}}),s=i.data?.data||[],d=s.filter(t=>String(t.storage)!==e).map(e=>String(e.id));if(!d.length){const i=await o.post(`/storage-manager/storages/${encodeURIComponent(e)}/move-files`,{file_ids:r,target_path:t,source_folders:n,include_empty_folders:ne.value,source_storage:a.storage||void 0,preserve_paths:l});return It(i.data?.data?.skipped),G.value=!1,J.value=[],W.value=[],void await it()}G.value=!1,ee.value=!1;const u=D({file_ids:d,target_storage:e,mode:"move",target_path:t,source_folders:n,include_empty_folders:ne.value,source_storage:a.storage||void 0,preserve_paths:l},{estimatedCount:d.length});Fe.value=!0,await u;const c=s.filter(t=>String(t.storage)===e).map(e=>String(e.id));if(c.length){const a=await o.post(`/storage-manager/storages/${encodeURIComponent(e)}/move-files`,{file_ids:c,target_path:t,source_folders:n,include_empty_folders:ne.value,preserve_paths:l});It(a.data?.data?.skipped)}J.value=[],W.value=[],await it()}catch(e){window.alert(e?.response?.data?.errors?.[0]?.message||e?.message||"Move failed")}finally{ee.value=!1}}function It(e){const t=Number(e)||0;t>0&&window.alert(`${t.toLocaleString()} file${1===t?"":"s"} already exist at the destination and were left in place.`)}g(G,e=>{if(!e)return;le.value=null,ne.value=!0;const t=x.value.filter(e=>e.location!==a.storage),n=(He.value?t[0]?.location:null)||a.storage||x.value[0]?.location||"";Z.value={location:n,path:He.value?"":"storage"===a.mode&&be.value||""}}),g(()=>[Z.value.location,Z.value.path,ne.value],()=>{le.value=null});const Dt=l(()=>{const e=y.query.file;return"string"==typeof e&&e.length>0?e:null});function Ut(e){const t={...y.query,file:String(e)},a=new URLSearchParams;for(const[e,n]of Object.entries(t))if(null!=n&&""!==n)if(Array.isArray(n))for(const t of n)a.append(e,String(t));else a.set(e,String(n));const n=a.toString();return n?`${y.path}?${n}`:y.path}function Nt(e){e||(!function(){if(!("file"in y.query))return;const e={...y.query};delete e.file,k.replace({path:y.path,query:e})}(),it().catch(()=>{}))}function At(){"folders"!==a.mode?"storage"===a.mode&&(W.value=H.value.map(e=>e.path)):W.value=xe.value.map(e=>e.id)}function Et(e){const t=e.primaryKeyField?.field||"id",n="storage"===a.mode&&H.value.length>0&&!pe.value&&!fe.value;return{...e,hasPrependContent:n,selectMode:e.selectMode||W.value.length>0,getLinkForItem(e){const a=e?.[t];if(null!=a)return Ut(a)},onRowClick({item:e,event:a}){const n=e?.[t];if(null==n)return;if(J.value.length>0||W.value.length>0)return void(J.value.includes(n)?J.value=J.value.filter(e=>e!==n):J.value=J.value.concat(n));const l=Ut(n);a.ctrlKey||a.metaKey?window.open(k.resolve(l).href,"_blank"):k.push(l)}}}return(e,a)=>{const n=r("v-breadcrumb"),l=r("v-card-title"),o=r("v-checkbox"),g=r("v-button"),h=r("v-card-text"),y=r("v-card-actions"),k=r("v-card"),w=r("v-dialog"),F=r("v-icon"),M=r("v-divider"),B=r("v-notice"),I=r("v-info"),D=r("drawer-item"),j=r("sidebar-detail"),T=r("private-view"),R=V("tooltip");return i(),s(A(S(he)),{ref_key:"layoutRef",ref:N,selection:J.value,"onUpdate:selection":a[21]||(a[21]=e=>J.value=e),"layout-options":S(ce),"onUpdate:layoutOptions":a[22]||(a[22]=e=>C(ce)?ce.value=e:null),"layout-query":Pe.value,"onUpdate:layoutQuery":a[23]||(a[23]=e=>Pe.value=e),filter:S(Pn)(S(fe),ye.value),"filter-user":S(fe),"filter-system":ye.value,search:S(pe),collection:"directus_files","reset-preset":S(me)},{default:d(({layoutState:e})=>[u(T,{title:ke.value,icon:"storage"===t.mode?$e.value?.icon||"storage":"folder",class:$({dragging:S(ht)})},{headline:d(()=>[u(n,{items:Se.value},null,8,["items"])]),"actions:prepend":d(()=>[(i(),s(A(`layout-actions-${S(ue)}`),P(O(e)),null,16))]),actions:d(()=>[u(kt,{modelValue:S(pe),"onUpdate:modelValue":a[0]||(a[0]=e=>C(pe)?pe.value=e:null),filter:S(fe),"onUpdate:filter":a[1]||(a[1]=e=>C(fe)?fe.value=e:null),collection:"directus_files"},null,8,["modelValue","filter"]),"storage"===t.mode&&t.storage?(i(),s(Ha,{key:0,location:t.storage,"parent-path":be.value,onCreated:it},null,8,["location","parent-path"])):b("v-if",!0),We.value?(i(),s(w,{key:1,modelValue:G.value,"onUpdate:modelValue":a[5]||(a[5]=e=>G.value=e),onEsc:a[6]||(a[6]=e=>G.value=!1),onApply:Bt},{activator:d(({on:e})=>[z(u(wt,{icon:"folder_move",secondary:"",onClick:e},null,8,["onClick"]),[[R,Ye.value,void 0,{bottom:!0}]])]),default:d(()=>[u(k,null,{default:d(()=>[u(l,null,{default:d(()=>[p(m(Ye.value),1)]),_:1}),u(h,null,{default:d(()=>[Qe.value?(i(),c("p",On,m(Qe.value),1)):b("v-if",!0),u(dn,{modelValue:Z.value,"onUpdate:modelValue":a[2]||(a[2]=e=>Z.value=e)},null,8,["modelValue"]),Xe.value?(i(),c("p",jn,m(Xe.value),1)):b("v-if",!0),a[27]||(a[27]=_("p",{class:"move-destination-hint"}," Existing folders are merged. If another registered file already owns the destination path, the incoming file is skipped and stays on the source. ",-1)),He.value||Ge.value.length?(i(),s(o,{key:2,modelValue:ne.value,"onUpdate:modelValue":a[3]||(a[3]=e=>ne.value=e),label:"Include empty folders"},null,8,["modelValue"])):b("v-if",!0),_("div",Tn,[u(g,{secondary:"",loading:te.value,disabled:!Z.value.location,onClick:zt},{default:d(()=>[...a[24]||(a[24]=[p(" Dry Run ",-1)])]),_:1},8,["loading","disabled"]),le.value?(i(),c("div",Rn,[_("p",null,[_("strong",null,m(le.value.total_files.toLocaleString()),1),a[26]||(a[26]=p(" files ",-1)),le.value.total_folders?(i(),c(v,{key:0},[a[25]||(a[25]=p(" · ",-1)),_("strong",null,m(le.value.total_folders.toLocaleString()),1),p(" "+m(1===le.value.total_folders?"folder":"folders"),1)],64)):b("v-if",!0),le.value.empty_folders?(i(),c("span",qn," ("+m(le.value.empty_folders.toLocaleString())+" empty"+m(ne.value?"":", skipped")+") ",1)):b("v-if",!0),le.value.total_bytes?(i(),c(v,{key:2},[p(" · "+m(S(Ue)(le.value.total_bytes)),1)],64)):b("v-if",!0)]),le.value.skipped?(i(),c("p",Kn,m(le.value.skipped.toLocaleString())+" already at destination — skipped ",1)):b("v-if",!0),le.value.samples?.length?(i(),c("ul",Jn,[(i(!0),c(v,null,f(le.value.samples,(e,t)=>(i(),c("li",{key:t},[p(m(e.from)+" → "+m(e.to)+" ",1),e.skipped?(i(),c("span",Wn," (skipped)")):b("v-if",!0)]))),128))])):b("v-if",!0),le.value.samples?.length&&le.value.total_files>le.value.samples.length?(i(),c("p",Hn," Showing "+m(le.value.samples.length)+" of "+m(le.value.total_files.toLocaleString())+" files ",1)):b("v-if",!0)])):b("v-if",!0)])]),_:1}),u(y,null,{default:d(()=>[u(g,{secondary:"",onClick:a[4]||(a[4]=e=>G.value=!1)},{default:d(()=>[...a[28]||(a[28]=[p("Cancel",-1)])]),_:1}),u(g,{disabled:!Z.value.location,loading:ee.value,onClick:Bt},{default:d(()=>[...a[29]||(a[29]=[p(" Move ",-1)])]),_:1},8,["disabled","loading"])]),_:1})]),_:1})]),_:1},8,["modelValue"])):b("v-if",!0),Ze.value?z((i(),s(wt,{key:2,class:"action-delete",icon:"delete",secondary:"",disabled:se.value,onClick:tt},null,8,["disabled"])),[[R,"Delete",void 0,{bottom:!0}]]):b("v-if",!0),u(w,{modelValue:oe.value,"onUpdate:modelValue":a[8]||(a[8]=e=>oe.value=e),onEsc:a[9]||(a[9]=e=>oe.value=!1),onApply:Mt},{default:d(()=>[u(k,null,{default:d(()=>[u(l,null,{default:d(()=>[p("Delete "+m(1===J.value.length?"Item":"Items"),1)]),_:1}),u(h,null,{default:d(()=>[p(m(et.value),1)]),_:1}),u(y,null,{default:d(()=>[u(g,{secondary:"",onClick:a[7]||(a[7]=e=>oe.value=!1)},{default:d(()=>[...a[30]||(a[30]=[p("Cancel",-1)])]),_:1}),u(g,{kind:"danger",loading:se.value,onClick:Mt},{default:d(()=>[...a[31]||(a[31]=[p("Delete",-1)])]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1},8,["modelValue"]),"storage"===t.mode&&t.storage?(i(),s(_e,{key:3,modelValue:ie.value,"onUpdate:modelValue":a[10]||(a[10]=e=>ie.value=e),location:t.storage,paths:W.value,onDone:Vt},null,8,["modelValue","location","paths"])):b("v-if",!0),je.value?z((i(),s(wt,{key:4,icon:"account_tree",secondary:"",onClick:a[11]||(a[11]=e=>X.value=!0)},null,512)),[[R,t.folder?"Materialize This Folder":"Materialize Root Folders",void 0,{bottom:!0}]]):b("v-if",!0),z(u(wt,{icon:"add",loading:S(_t),onClick:Ct},null,8,["loading"]),[[R,"Upload File",void 0,{bottom:!0}]])]),navigation:d(()=>[u(De)]),sidebar:d(()=>[u($t,{modelValue:S(ue),"onUpdate:modelValue":a[15]||(a[15]=e=>C(ue)?ue.value=e:null)},{default:d(()=>[(i(),s(A(`layout-options-${S(ue)}`),P(O(e)),null,16))]),_:2},1032,["modelValue"]),(i(),s(A(`layout-sidebar-${S(ue)}`),P(O(e)),null,16)),u(j,{id:"actions",icon:"swap_horiz",title:"Actions"},{default:d(()=>[_("div",Gn,["storage"===t.mode&&Je.value?(i(),s(g,{key:0,secondary:"","full-width":"",class:"sidebar-btn",onClick:ut},{default:d(()=>[p(m(qe.value),1)]),_:1})):b("v-if",!0),Te.value?(i(),s(g,{key:1,"full-width":"",class:"sidebar-btn sidebar-btn-primary",onClick:a[16]||(a[16]=e=>G.value=!0)},{default:d(()=>[p(" Move all on "+m(t.storage),1)]),_:1})):b("v-if",!0),je.value?(i(),s(g,{key:2,"full-width":"",class:"sidebar-btn",onClick:a[17]||(a[17]=e=>X.value=!0)},{default:d(()=>[p(m(t.folder?"Materialize This Folder":"Materialize Root Folders"),1)]),_:1})):b("v-if",!0)])]),_:1}),"storage"===t.mode&&$e.value?(i(),s(j,{key:0,id:"storage-info",icon:"info",title:"Storage Info"},{default:d(()=>[_("p",Yn,m($e.value.label),1),u(Re,{usage:$e.value,compact:"",plain:""},null,8,["usage"])]),_:1})):(i(),s(j,{key:1,id:"directus-folders-info",icon:"info",title:"Directus Folders"},{default:d(()=>[_("p",Xn,m(S("A Directus folder is virtual — it organises files across any storage adapter. When Mirror Directus Folders is enabled on a storage, new uploads land on the matching physical path and folder renames or deletes are kept in sync on that adapter. Files on other adapters are unaffected.")),1),a[43]||(a[43]=_("p",{class:"sidebar-text"}," Use Move to Storage Folder to relocate files onto a physical path. Materialize builds storage folders from this virtual tree. At a storage root, Move all uses the same dialog. ",-1)),Ae.value?(i(),s(B,{key:0,type:"info",class:"sidebar-multi-notice"},{default:d(()=>[p(" Files on "+m(de.value.length)+" storages: ",1),_("strong",null,m(de.value.join(", ")),1)]),_:1})):b("v-if",!0)]),_:1}))]),default:d(()=>[S(yt)?(i(),c(v,{key:0},[a[32]||(a[32]=_("div",{class:"drop-border top"},null,-1)),a[33]||(a[33]=_("div",{class:"drop-border right"},null,-1)),a[34]||(a[34]=_("div",{class:"drop-border bottom"},null,-1)),a[35]||(a[35]=_("div",{class:"drop-border left"},null,-1))],64)):b("v-if",!0),we.value?(i(),c("div",{key:1,class:$(S(U))},[u(M,{class:"section-divider",large:"","inline-title":!1,style:{"--v-divider-color":"var(--theme--border-color-subdued)"}},{icon:d(()=>[u(F,{name:"folder_special"})]),default:d(()=>[a[36]||(a[36]=p(" Directus Folders ",-1))]),_:1}),_("p",Qn,m(S("Browse the Directus folder tree. Use Move to Storage Folder to place files on a physical path, or Materialize to build that folder tree on disk. The virtual structure in the File Library is never changed here.")),1)],2)):b("v-if",!0),Ae.value?(i(),s(B,{key:2,type:"info",class:"multi-storage-notice"},{default:d(()=>[p(m(Oe.value),1)]),_:1})):b("v-if",!0),(i(),s(A(`layout-${S(ue)}`),E(Et(e),{"extra-selection":W.value,"onUpdate:extraSelection":a[14]||(a[14]=e=>W.value=e),onSelectAll:At}),L({"no-results":d(()=>[S(fe)||S(pe)?(i(),s(I,{key:1,title:"No results",icon:"search",center:""},{append:d(()=>[u(g,{onClick:dt},{default:d(()=>[...a[39]||(a[39]=[p("Clear filters",-1)])]),_:1})]),default:d(()=>[a[40]||(a[40]=p(" No files match your search or filters. ",-1))]),_:1})):(i(),s(I,{key:0,title:"No files",icon:"folder",center:""},{append:d(()=>[u(g,{onClick:Ct},{default:d(()=>[...a[37]||(a[37]=[p("Add File",-1)])]),_:1})]),default:d(()=>[a[38]||(a[38]=p(" Drop files here to upload, or use the + button. ",-1))]),_:1}))]),"no-items":d(()=>[u(I,{title:"No files",icon:"folder",center:""},{append:d(()=>[u(g,{onClick:Ct},{default:d(()=>[...a[42]||(a[42]=[p("Add File",-1)])]),_:1})]),default:d(()=>[Q.value?(i(),c(v,{key:0},[p("Loading storage folders…")],64)):(i(),c(v,{key:1},[a[41]||(a[41]=p(" Drop files here to upload, or use the + button. ",-1)),"storage"===t.mode?(i(),c(v,{key:0},[p(" Create a storage folder with the folder icon. ")],64)):b("v-if",!0)],64))]),_:1})]),_:2},["storage"!==t.mode||!H.value.length||S(pe)||S(fe)?"folders"!==t.mode||!xe.value.length||S(pe)||S(fe)?void 0:{name:"prepend",fn:d(()=>[u(ln,{selection:W.value,"onUpdate:selection":a[13]||(a[13]=e=>W.value=e),folders:xe.value,"any-file-selection":J.value.length>0},null,8,["selection","folders","any-file-selection"])]),key:"1"}:{name:"prepend",fn:d(()=>[u(Za,{selection:W.value,"onUpdate:selection":a[12]||(a[12]=e=>W.value=e),location:t.storage,folders:H.value,"any-file-selection":J.value.length>0,onChanged:it},null,8,["selection","location","folders","any-file-selection"])]),key:"0"}]),1040,["extra-selection"])),Dt.value?(i(),s(D,{key:3,collection:"directus_files","primary-key":Dt.value,active:!0,"onUpdate:active":Nt},null,8,["primary-key"])):b("v-if",!0),u(cn,{modelValue:gt.value,"onUpdate:modelValue":a[18]||(a[18]=e=>gt.value=e),title:St.value,uploading:S(_t),onFiles:Ft},null,8,["modelValue","title","uploading"]),u(Ua,{modelValue:Fe.value,"onUpdate:modelValue":a[19]||(a[19]=e=>Fe.value=e),storages:S(x),"source-storage":"storage"===t.mode&&t.storage||null,"selection-kind":Ve.value,"file-ids":ze.value.length?ze.value:J.value,"folder-id":"folders"===t.mode?t.folder??null:null,"source-path":"storage"===t.mode&&be.value||null,"estimated-count":Be.value,"estimated-bytes":Ie.value,onDone:vt},null,8,["modelValue","storages","source-storage","selection-kind","file-ids","folder-id","source-path","estimated-count","estimated-bytes"]),"storage"===t.mode&&t.storage?(i(),s(Wa,{key:4,"model-value":Me.value,location:t.storage,"storage-path":be.value||null,"onUpdate:modelValue":ct,onImported:ft},null,8,["model-value","location","storage-path"])):b("v-if",!0),"folders"===t.mode?(i(),s(Vn,{key:5,modelValue:X.value,"onUpdate:modelValue":a[20]||(a[20]=e=>X.value=e),storages:S(x),"folder-id":t.folder??null,onDone:pt},null,8,["modelValue","storages","folder-id"])):b("v-if",!0)]),_:2},1032,["title","icon","class"])]),_:1},40,["selection","layout-options","layout-query","filter","filter-user","filter-system","search","reset-preset"])}}});me("\n.drop-border[data-v-745cf6ea] {\n\tposition: fixed;\n\tz-index: 500;\n\tbackground-color: var(--theme--primary);\n}\n.drop-border.top[data-v-745cf6ea],\n.drop-border.bottom[data-v-745cf6ea] {\n\tinline-size: 100%;\n\tblock-size: 0.25rem;\n}\n.drop-border.left[data-v-745cf6ea],\n.drop-border.right[data-v-745cf6ea] {\n\tinline-size: 0.25rem;\n\tblock-size: 100%;\n}\n.drop-border.top[data-v-745cf6ea] {\n\tinset-block-start: 0;\n\tinset-inline-start: 0;\n}\n.drop-border.right[data-v-745cf6ea] {\n\tinset-block-start: 0;\n\tinset-inline-end: 0;\n}\n.drop-border.bottom[data-v-745cf6ea] {\n\tinset-block-end: 0;\n\tinset-inline-start: 0;\n}\n.drop-border.left[data-v-745cf6ea] {\n\tinset-block-start: 0;\n\tinset-inline-start: 0;\n}\n.dragging[data-v-745cf6ea] * {\n\tpointer-events: none;\n}\n.dragging[data-v-745cf6ea] [data-dropzone] {\n\tpointer-events: all;\n}\n.sidebar-actions[data-v-745cf6ea] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n\n/* Sidebar panel bg often matches --theme--background-normal, so default\n secondary buttons look like plain text. Force a visible chip fill. */\n.sidebar-actions[data-v-745cf6ea] .sidebar-btn {\n\tdisplay: flex;\n\twidth: 100%;\n}\n.sidebar-actions[data-v-745cf6ea] .sidebar-btn .button {\n\twidth: 100%;\n\tjustify-content: center;\n\tcolor: var(--theme--foreground);\n\tbackground-color: var(--theme--background-accent);\n\tborder-color: var(--theme--background-accent);\n}\n.sidebar-actions[data-v-745cf6ea] .sidebar-btn .button:hover:not(:disabled) {\n\tbackground-color: var(--theme--background-normal);\n\tborder-color: var(--theme--background-normal);\n}\n\n/* Theme fill only when enabled — disabled stays gray like secondary */\n.sidebar-actions[data-v-745cf6ea] .sidebar-btn-primary .button:not(:disabled) {\n\tcolor: var(--foreground-inverted, var(--theme--primary-foreground, #fff));\n\tbackground-color: var(--theme--primary);\n\tborder-color: var(--theme--primary);\n}\n.sidebar-actions[data-v-745cf6ea] .sidebar-btn-primary .button:hover:not(:disabled) {\n\tbackground-color: var(--theme--primary-accent);\n\tborder-color: var(--theme--primary-accent);\n}\n.sidebar-actions[data-v-745cf6ea] .sidebar-btn .button:disabled {\n\tcolor: var(--theme--foreground-subdued);\n\tbackground-color: var(--theme--background-accent);\n\tborder-color: var(--theme--background-accent);\n\topacity: 0.65;\n\tcursor: not-allowed;\n}\n.sidebar-text[data-v-745cf6ea] {\n\tmargin: 0;\n\tline-height: 1.45;\n}\n.sidebar-note[data-v-745cf6ea] {\n\tmargin-block-end: 12px;\n\tpadding: 10px 12px;\n\tfont-size: 12px;\n\tline-height: 1.45;\n\tcolor: var(--theme--foreground);\n\tbackground: var(--theme--background-normal);\n\tborder-radius: var(--theme--border-radius);\n\tborder: var(--theme--border-width) solid var(--theme--border-color-subdued);\n}\n.page[data-v-745cf6ea] {\n\tpadding: var(--content-padding);\n\tpadding-block-end: 0;\n\tmax-width: 1100px;\n}\n.page--flush-top[data-v-745cf6ea] {\n\tpadding-block-start: 0;\n}\n.section-divider[data-v-745cf6ea] {\n\tmargin-bottom: 12px;\n}\n.page-intro[data-v-745cf6ea] {\n\tmargin: 0 0 24px;\n\tline-height: 1.55;\n\tcolor: var(--theme--foreground);\n}\n.move-hint[data-v-745cf6ea] {\n\tmargin: 0 0 12px;\n\tline-height: 1.45;\n\tcolor: var(--theme--foreground-subdued);\n}\n.move-destination-hint[data-v-745cf6ea] {\n\tmargin: 10px 0 0;\n\tfont-size: 13px;\n\tcolor: var(--theme--foreground-subdued);\n}\n.move-dry-run[data-v-745cf6ea] {\n\tmargin-top: 16px;\n}\n.move-dry-result[data-v-745cf6ea] {\n\tmargin-top: 12px;\n\tline-height: 1.5;\n}\n.move-samples[data-v-745cf6ea] {\n\tmargin: 8px 0 0;\n\tpadding-inline-start: 18px;\n\tmax-height: 180px;\n\toverflow: auto;\n\tfont-size: 12px;\n\tline-height: 1.45;\n\tcolor: var(--theme--foreground-subdued);\n}\n.multi-storage-notice[data-v-745cf6ea] {\n\tmargin: 12px var(--content-padding, 16px) 0;\n}\n.sidebar-multi-notice[data-v-745cf6ea] {\n\tmargin-block-start: 12px;\n}\n.action-delete[data-v-745cf6ea] {\n\t--v-button-background-color-hover: var(--theme--danger) !important;\n\t--v-button-color-hover: var(--white, #fff) !important;\n}\n.storage-label[data-v-745cf6ea] {\n\tmargin-bottom: 10px;\n\tfont-weight: 600;\n}\n",{});me("\n.storage-location-badge {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tmax-inline-size: 100%;\n\tpadding: 2px 8px;\n\toverflow: hidden;\n\tfont-size: 11px;\n\tfont-weight: 600;\n\tline-height: 1.35;\n\tcolor: var(--theme--primary-foreground, var(--white, #fff));\n\twhite-space: nowrap;\n\ttext-overflow: ellipsis;\n\tpointer-events: none;\n\tbackground: var(--theme--primary);\n\tborder: none;\n\tborder-radius: var(--theme--border-radius);\n}\n.layout-cards .header .storage-location-badge {\n\tposition: absolute;\n\tinset-block-end: 8px;\n\tinset-inline-start: 8px;\n\tz-index: 2;\n\tmax-inline-size: calc(100% - 16px);\n\tbox-shadow: 0 1px 3px rgb(38 50 56 / 0.2);\n}\n",{});var tl=ge(el,[["__scopeId","data-v-745cf6ea"]]),al=o({__name:"storage-view",setup(e){const t=R(),a=l(()=>String(t.params.location||"")),n=l(()=>{const e=t.params.storagePath;return Se(Array.isArray(e)?e.map(String).join("/"):String(e||""))});return(e,t)=>(i(),s(tl,{mode:"storage",storage:a.value,"storage-path":n.value},null,8,["storage","storage-path"]))}}),nl=o({__name:"folders-view",setup(e){const t=R(),a=l(()=>{const e=t.params.folderId;return e?String(e):null});return(e,t)=>(i(),s(tl,{mode:"folders",folder:a.value||void 0},null,8,["folder"]))}});function ll(){const a=e(),{useUserStore:l,useSettingsStore:o}=t(),r=l(),i=o(),s=n(!1),d=n(!1),u=n({locations:{}});let c=null;return{loading:s,cleaning:d,settings:u,ensureLoaded:async function(e=!1){return c&&!e||(c=(async()=>{s.value=!0;try{const t=await a.get("/storage-manager/settings");u.value=(e=t.data?.data??{locations:{}},et({locations:{},...e}))}finally{s.value=!1}var e})()),c},exportStorageManagerConfig:function(){const e={...u.value,storage_manager:u.value,exported_at:(new Date).toISOString(),extension:"directus-extension-storage-manager"},t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),a=URL.createObjectURL(t),n=document.createElement("a"),l=(new Date).toISOString().slice(0,19).replace(/[:T]/g,"-");n.href=a,n.download=`storage-manager-${l}.json`,n.click(),URL.revokeObjectURL(a)},importStorageManagerConfig:async function(e){if(!J(r.currentUser))throw new Error("Admin access required");const t=et(e);u.value=t,await a.patch("/storage-manager/settings",{locations:t.locations});try{await(i.hydrate?.())}catch{}c=null},cleanupExtensionData:async function(){if(!J(r.currentUser))throw new Error("Admin access required");d.value=!0;let e=!1,t=!1;try{try{await a.patch("/settings",{[Je]:null}),e=!0}catch(e){const t=e?.response?.status,a=String(e?.response?.data?.errors?.[0]?.message||e?.message||"");if(400!==t&&403!==t&&!/unknown|does not exist|forbidden/i.test(a))throw e}try{await a.delete(`/fields/directus_settings/${Je}`),t=!0}catch(e){const a=e?.response?.status;if(404!==a)throw e;t=!0}u.value={locations:{}},c=null;try{await(i.hydrate?.())}catch{}return{clearedValue:e,deletedField:t}}finally{d.value=!1}}}}const ol={class:"actions"},rl={key:0,class:"result"},il={class:"actions"},sl={key:1,class:"result"},dl={key:2,class:"result"},ul={key:3,class:"result"};var cl=o({__name:"settings-view",setup(t){const a=Ke(),o=e(),f=l(()=>"/admin/settings/marketplace/extension/88a7639e-db2a-4ade-a97f-94d2cc3836e7"),{loading:g,cleaning:y,ensureLoaded:k,cleanupExtensionData:w,exportStorageManagerConfig:x,importStorageManagerConfig:C}=ll(),F=n(!1),M=n(null),V=n(null),z=n(!1),B=n(null),I=n(null),D=n(!1),U=n(null),N=l(()=>U.value?U.value.error||U.value.has_update?"warning":"success":"info");function A(){B.value=null,x()}function E(){B.value=null,I.value?.click()}async function L(e){const t=e.target,a=t.files?.[0];if(t.value="",a){z.value=!0,B.value=null;try{const e=await a.text(),t=JSON.parse(e);await C(t),B.value={type:"success",text:"Config imported and saved to settings."}}catch(e){B.value={type:"danger",text:e?.response?.data?.errors?.[0]?.message||e?.message||"Import failed"}}finally{z.value=!1}}}async function P(){M.value=null,V.value=null,B.value=null;try{V.value=await w(),F.value=!1}catch(e){M.value=e?.response?.data?.errors?.[0]?.message||e?.message||"Cleanup failed"}}return h(()=>{k()}),(e,t)=>{const n=r("v-breadcrumb"),l=r("sidebar-detail"),h=r("v-icon"),k=r("v-divider"),w=r("v-button"),x=r("v-notice"),C=r("v-card-title"),O=r("v-card-text"),j=r("v-card-actions"),T=r("v-card"),R=r("v-dialog"),q=r("private-view");return i(),s(q,{title:"Settings",icon:"settings"},{headline:d(()=>[u(n,{items:[{name:"Storage Manager",to:"/storage-manager"}]})]),navigation:d(()=>[u(De)]),sidebar:d(()=>[u(l,{id:"about",icon:"info",title:"About"},{default:d(()=>[...t[5]||(t[5]=[_("p",{class:"sidebar-text"}," Export or import this extension’s JSON config, or remove the dedicated settings field before uninstalling. ",-1)])]),_:1})]),default:d(()=>[_("div",{class:$(S(a))},[u(k,{class:"section-divider",large:"","inline-title":!1,style:{"--v-divider-color":"var(--theme--border-color-subdued)"}},{icon:d(()=>[u(h,{name:"system_update"})]),default:d(()=>[t[6]||(t[6]=p(" Extension Updates ",-1))]),_:1}),t[18]||(t[18]=_("p",{class:"explain"}," Check npm for the latest published version and compare it with the installed extension version. ",-1)),_("div",ol,[u(w,{secondary:"",loading:D.value,onClick:t[0]||(t[0]=e=>async function(e){D.value=!0;try{const t=await o.get("/storage-manager/update-check",{params:{force:e?"1":void 0}});U.value=t.data?.data||null}catch(e){U.value={current_version:"unknown",latest_version:null,has_update:!1,checked_at:(new Date).toISOString(),error:e?.response?.data?.errors?.[0]?.message||e?.message||"Update check failed",links:{npm:"https://www.npmjs.com/package/directus-extension-storage-manager",github:"https://github.com/domdus/directus-extension-storage-manager",marketplace:f.value}}}finally{D.value=!1}}(!0))},{default:d(()=>[...t[7]||(t[7]=[p("Check now",-1)])]),_:1},8,["loading"]),U.value?.has_update&&f.value?(i(),s(w,{key:0,secondary:"",to:f.value},{default:d(()=>[...t[8]||(t[8]=[p(" Marketplace ",-1)])]),_:1},8,["to"])):b("v-if",!0)]),U.value?(i(),c("div",rl,[u(x,{type:N.value},{default:d(()=>[t[10]||(t[10]=p(" Current: ",-1)),_("strong",null,m(U.value.current_version),1),U.value.latest_version?(i(),c(v,{key:0},[t[9]||(t[9]=p(" · Latest: ",-1)),_("strong",null,m(U.value.latest_version),1)],64)):b("v-if",!0),U.value.error?(i(),c(v,{key:1},[p(" · "+m(U.value.error),1)],64)):U.value.has_update?(i(),c(v,{key:2},[p(" · Update available")],64)):(i(),c(v,{key:3},[p(" · Up to date")],64))]),_:1},8,["type"])])):b("v-if",!0),u(k,{class:"section-divider",large:"","inline-title":!1,style:{"--v-divider-color":"var(--theme--border-color-subdued)"}},{icon:d(()=>[u(h,{name:"import_export"})]),default:d(()=>[t[11]||(t[11]=p(" Export / Import ",-1))]),_:1}),t[19]||(t[19]=_("p",{class:"explain"},[p(" Back up or restore Mirror Directus Folders settings as JSON, or remove the dedicated "),_("code",null,"storage_manager"),p(" settings field before uninstalling. Per-location rules are stored in "),_("code",null,"directus_settings.storage_manager"),p(" only — other project settings are left untouched. ")],-1)),_("div",il,[u(w,{secondary:"",disabled:S(g)||S(y),onClick:A},{default:d(()=>[...t[12]||(t[12]=[p("Export JSON",-1)])]),_:1},8,["disabled"]),u(w,{secondary:"",disabled:S(g)||S(y)||z.value,loading:z.value,onClick:E},{default:d(()=>[...t[13]||(t[13]=[p(" Import JSON ",-1)])]),_:1},8,["disabled","loading"]),_("input",{ref_key:"fileInput",ref:I,type:"file",accept:"application/json,.json",class:"file-input",onChange:L},null,544)]),B.value?(i(),c("div",sl,[u(x,{type:B.value.type},{default:d(()=>[p(m(B.value.text),1)]),_:1},8,["type"])])):b("v-if",!0),u(k,{class:"section-divider add-margin-top",large:"","inline-title":!1,style:{"--v-divider-color":"var(--theme--border-color-subdued)"}},{icon:d(()=>[u(h,{name:"delete"})]),default:d(()=>[t[14]||(t[14]=p(" Remove extension data ",-1))]),_:1}),t[20]||(t[20]=_("p",{class:"explain"},[p(" Storage folder and sync settings live in a dedicated JSON field "),_("code",null,"directus_settings.storage_manager"),p(". Cleanup removes only that field and its value. If the extension stays installed, the next Directus restart may recreate an empty "),_("code",null,"storage_manager"),p(" field. ")],-1)),u(x,{type:"warning",class:"notice"},{default:d(()=>[...t[15]||(t[15]=[p(" Deleting extension data cannot be undone. Export first if you might need the config again. ",-1)])]),_:1}),V.value?(i(),c("div",dl,[u(x,{type:"success"},{default:d(()=>[t[16]||(t[16]=p(" Cleanup finished. ",-1)),V.value.clearedValue?(i(),c(v,{key:0},[p(" Value cleared.")],64)):b("v-if",!0),V.value.deletedField?(i(),c(v,{key:1},[p(" Field removed.")],64)):b("v-if",!0)]),_:1})])):b("v-if",!0),M.value?(i(),c("div",ul,[u(x,{type:"danger"},{default:d(()=>[p(m(M.value),1)]),_:1})])):b("v-if",!0),u(w,{kind:"danger",loading:S(y),disabled:S(y),onClick:t[1]||(t[1]=e=>F.value=!0)},{default:d(()=>[...t[17]||(t[17]=[p(" Delete storage_manager data ",-1)])]),_:1},8,["loading","disabled"])],2),u(R,{modelValue:F.value,"onUpdate:modelValue":t[3]||(t[3]=e=>F.value=e),onEsc:t[4]||(t[4]=e=>F.value=!1)},{default:d(()=>[u(T,null,{default:d(()=>[u(C,null,{default:d(()=>[...t[21]||(t[21]=[p("Delete storage_manager?",-1)])]),_:1}),u(O,null,{default:d(()=>[...t[22]||(t[22]=[p(" This removes only ",-1),_("code",null,"directus_settings.storage_manager",-1),p(" (the extension’s own JSON field). All other project settings stay as they are. ",-1)])]),_:1}),u(j,null,{default:d(()=>[u(w,{secondary:"",onClick:t[2]||(t[2]=e=>F.value=!1)},{default:d(()=>[...t[23]||(t[23]=[p("Cancel",-1)])]),_:1}),u(w,{kind:"danger",loading:S(y),onClick:P},{default:d(()=>[...t[24]||(t[24]=[p("Delete",-1)])]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})}}});me("\n.page[data-v-29c5fdc8] {\n\tpadding: var(--content-padding);\n\tpadding-block-end: var(--content-padding-bottom);\n\tmax-width: 720px;\n}\n.page--flush-top[data-v-29c5fdc8] {\n\tpadding-block-start: 0;\n}\n.section-divider[data-v-29c5fdc8] {\n\tmargin-bottom: 12px;\n}\n.section-divider.add-margin-top[data-v-29c5fdc8] {\n\tmargin-top: 40px;\n}\n.explain[data-v-29c5fdc8],\n.sidebar-text[data-v-29c5fdc8] {\n\tmargin: 0 0 16px;\n\tline-height: 1.55;\n\tcolor: var(--theme--foreground);\n}\n.explain code[data-v-29c5fdc8],\n.sidebar-text code[data-v-29c5fdc8],\n.v-card-text code[data-v-29c5fdc8] {\n\tfont-family: var(--theme--fonts--monospace--font-family, monospace);\n\tfont-size: 0.9em;\n}\n.actions[data-v-29c5fdc8] {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n\tmargin-bottom: 16px;\n}\n.file-input[data-v-29c5fdc8] {\n\tdisplay: none;\n}\n.notice[data-v-29c5fdc8],\n.result[data-v-29c5fdc8] {\n\tmargin-bottom: 16px;\n}\n",{});const vl=[],fl=[],pl=[],ml=[a({id:"storage-manager",name:"Storage Manager",icon:"storage",routes:[{path:"",component:pt},{path:"storage/:location",component:al},{path:"storage/:location/path/:storagePath(.*)",component:al},{path:"folders",component:nl},{path:"folders/:folderId",component:nl},{path:"settings",component:ge(cl,[["__scopeId","data-v-29c5fdc8"]])}],preRegisterCheck:e=>J(e)})],gl=[],hl=[],bl=[{id:"storage-manager-operation",name:"Storage Manager",icon:"swap_horiz",description:"Copy or move Directus files between storage adapters (same file id)",overview:({mode:e,target_storage:t,source_storage:a,folder_id:n})=>[{label:"Mode",text:String(e||"move")},{label:"Target",text:String(t||"")},{label:"Source",text:String(a||n||"file_ids")}],options:[{field:"mode",name:"Mode",type:"string",meta:{width:"half",interface:"select-dropdown",options:{choices:[{text:"Move (delete source after verify)",value:"move"},{text:"Copy (keep source)",value:"copy"}]},note:"Move only deletes the source object after the target is verified and the DB row is updated."},schema:{default_value:"move"}},{field:"target_storage",name:"Target Storage",type:"string",meta:{width:"half",interface:"input",options:{placeholder:"s3"},note:"Must match a configured STORAGE_LOCATIONS name."},schema:{required:!0}},{field:"file_ids",name:"File IDs",type:"json",meta:{width:"full",interface:"input-code",options:{language:"json",placeholder:'["uuid-1", "uuid-2"]'},note:"Optional JSON array of file UUIDs. Leave empty when using source storage or folder."}},{field:"source_storage",name:"Source Storage",type:"string",meta:{width:"half",interface:"input",options:{placeholder:"local"},note:"Migrate all files currently on this storage location."}},{field:"folder_id",name:"Folder ID",type:"uuid",meta:{width:"half",interface:"system-folder",note:"Migrate files in this folder (optional)."}},{field:"recursive",name:"Include Subfolders",type:"boolean",meta:{width:"half",interface:"boolean",note:"When a folder is selected, also migrate files in nested folders."},schema:{default_value:!0}}]}];export{fl as displays,vl as interfaces,pl as layouts,ml as modules,bl as operations,gl as panels,hl as themes};
|
|
1
|
+
import{useApi as e,useStores as t,defineModule as a}from"@directus/extensions-sdk";import{ref as n,computed as l,defineComponent as o,resolveComponent as r,openBlock as i,createBlock as s,withCtx as d,createVNode as u,createElementBlock as c,Fragment as v,renderList as f,createTextVNode as p,toDisplayString as m,watch as g,onMounted as h,createCommentVNode as b,useModel as y,createElementVNode as _,mergeModels as k,withKeys as w,withModifiers as x,unref as S,isRef as C,normalizeClass as $,normalizeStyle as F,reactive as M,resolveDirective as V,withDirectives as z,onUnmounted as B,inject as I,toRefs as D,vShow as U,renderSlot as N,resolveDynamicComponent as A,mergeProps as E,createSlots as L,normalizeProps as P,guardReactiveProps as O,nextTick as j}from"vue";import{useRouter as T,useRoute as R,onBeforeRouteLeave as q,onBeforeRouteUpdate as K}from"vue-router";function J(e){if(!e||"object"!=typeof e)return!1;const t=e;if(!0===t.admin_access)return!0;const a=t.role;return!(!a||"object"!=typeof a||!0!==a.admin_access)}const W=n(!1),H=n(null),Q=n(null),G=n([]);function Y(){const t=e(),a=l(()=>Q.value||null),n=l({get:()=>G.value,set(e){G.value=e}});return null===H.value&&o(),{loading:W,folders:H,nestedFolders:a,fetchFolders:o,openFolders:n};async function o(){if(!W.value){W.value=!0;try{const e=await t.get("/folders",{params:{sort:"name",limit:-1,fields:["id","name","parent"]}}),a=e.data?.data||[];H.value=a,Q.value=function(e){const t=new Map;for(const a of e)if(a.parent){const e=t.get(a.parent)||[];e.push(a),t.set(a.parent,e)}const a=e=>{const n=t.get(e.id)||[];return n.length>0?{...e,children:n.map(a)}:{...e}};return e.filter(e=>null===e.parent).map(a)}(a)}catch{H.value=[],Q.value=[]}finally{W.value=!1}}}}const X=n([]),Z=n(!1),ee=n(null);function te(e){const t={"Content-Type":"application/json",Accept:"text/event-stream"},a=e?.defaults?.headers,n=a?.common?.Authorization||a?.Authorization||a?.common?.authorization||a?.authorization;return"string"==typeof n&&n&&(t.Authorization=n),t}function ae(){const t=e();return{storages:X,storagesLoading:Z,storagesError:ee,loadStorages:async function(e=!1){if(X.value.length&&!e)return X.value;Z.value=!0,ee.value=null;try{const e=await t.get("/storage-manager/storages");return X.value=e.data?.data||[],X.value}catch(e){throw ee.value=e?.response?.data?.errors?.[0]?.message||e?.message||"Failed to load storages",e}finally{Z.value=!1}},loadFiles:async function(e){const a=await t.get("/storage-manager/files",{params:{storage:e.storage||void 0,folder:null===e.folder?"null":e.folder||void 0,search:e.search||void 0,filter:e.filter?JSON.stringify(e.filter):void 0,recursive:e.recursive?"true":void 0,page:e.page||1,limit:e.limit||50,sort:e.sort||"-uploaded_on"}});return{data:a.data?.data||[],meta:a.data?.meta}},loadFolders:async function(e={}){const a=await t.get("/storage-manager/folders",{params:{parent:null===e.parent?"null":e.parent||void 0,storage:e.storage||void 0}});return{data:a.data?.data||[],root_files:a.data?.meta?.root_files}},loadFolderPath:async function(e){const a=await t.get(`/storage-manager/folders/${e}/path`);return a.data?.data||[]},migrate:async function(e){const a=await t.post("/storage-manager/migrate",e);return a.data?.data},migrateWithProgress:async function(e,a,n){return async function(e,t){if(!e.ok){let t=`Migration failed (${e.status})`;try{const a=await e.json();t=a?.errors?.[0]?.message||t}catch{}throw new Error(t)}if(!e.body)throw new Error("No response body for progress stream");const a=e.body.getReader(),n=new TextDecoder;let l="",o=null;for(;;){const{done:e,value:r}=await a.read();if(e)break;l+=n.decode(r,{stream:!0});const i=l.split("\n\n");l=i.pop()||"";for(const e of i){const a=e.split("\n");for(const e of a){const a=e.trim();if(!a.startsWith("data:"))continue;const n=a.slice(5).trim();if(!n)continue;let l;try{l=JSON.parse(n)}catch{continue}if(t(l),"done"===l.type&&(o=l.data),"error"===l.type)throw new Error(l.message||"Migration failed")}}}if(!o)throw new Error("Migration stream ended without a result");return o}(await fetch(function(e){const t=String(e?.defaults?.baseURL||"").replace(/\/$/,""),a="/storage-manager/migrate/stream";return t?`${t}${a}`:a}(t),{method:"POST",headers:te(t),body:JSON.stringify(e),credentials:"same-origin",signal:n}),a)}}}const ne=n({}),le=n(!1),oe=n([]);function re(){const t=e();async function a(e){try{const a=await t.get(`/storage-manager/storages/${encodeURIComponent(e)}/folder-tree`);ne.value={...ne.value,[e]:a.data?.data||[]}}catch{ne.value={...ne.value,[e]:[]}}}return{trees:ne,loading:le,openFolders:oe,loadTree:a,loadTrees:async function(e){le.value=!0;try{await Promise.all(e.map(e=>a(e)))}finally{le.value=!1}},refreshTree:async function(e){await a(e)}}}var ie=o({name:"NavFolderItem",__name:"nav-folder-item",props:{folder:{},currentFolder:{},clickHandler:{type:Function}},setup:e=>(t,a)=>{const n=r("v-icon"),l=r("v-list-item-icon"),o=r("v-text-overflow"),p=r("v-list-item-content"),m=r("v-list-item"),g=r("nav-folder-item",!0),h=r("v-list-group");return e.folder.children&&0!==e.folder.children.length?(i(),s(h,{key:1,clickable:"",scope:"files-navigation",value:e.folder.id,active:e.currentFolder===e.folder.id,"arrow-placement":"after","disable-groupable-parent":"",onClick:a[1]||(a[1]=t=>e.clickHandler({folder:e.folder.id}))},{activator:d(()=>[u(l,null,{default:d(()=>[u(n,{name:"folder",outline:""})]),_:1}),u(p,null,{default:d(()=>[u(o,{text:e.folder.name},null,8,["text"])]),_:1})]),default:d(()=>[(i(!0),c(v,null,f(e.folder.children,t=>(i(),s(g,{key:t.id,folder:t,"current-folder":e.currentFolder,"click-handler":e.clickHandler},null,8,["folder","current-folder","click-handler"]))),128))]),_:1},8,["value","active"])):(i(),s(m,{key:0,clickable:"",active:e.currentFolder===e.folder.id,onClick:a[0]||(a[0]=t=>e.clickHandler({folder:e.folder.id}))},{default:d(()=>[u(l,null,{default:d(()=>[u(n,{name:"folder",outline:""})]),_:1}),u(p,null,{default:d(()=>[u(o,{text:e.folder.name},null,8,["text"])]),_:1})]),_:1},8,["active"]))}});const se={class:"folder-picker-list-item"};var de=o({name:"StorageFolderPickerItem",__name:"storage-folder-picker-item",props:{folder:{},currentPath:{},clickHandler:{},disabled:{type:Boolean},disabledPaths:{},scope:{default:"storage-folder-picker"},valuePrefix:{default:""}},setup(e){const t=e;function a(e){return(t.disabledPaths||[]).some(t=>e===t||e.startsWith(`${t}/`))}const n=l(()=>Boolean(t.disabled)||a(t.folder.path)),o=l(()=>`${t.valuePrefix}${t.folder.path}`);return(t,l)=>{const g=r("v-icon"),h=r("v-list-item-icon"),b=r("v-list-item-content"),y=r("v-list-item"),_=r("storage-folder-picker-item",!0),k=r("v-list-group");return i(),c("div",se,[e.folder.children?.length?(i(),s(k,{key:1,clickable:"",scope:e.scope,value:o.value,active:e.currentPath===e.folder.path,disabled:n.value,"disable-groupable-parent":"","arrow-placement":"after",onClick:l[1]||(l[1]=t=>e.clickHandler(e.folder.path))},{activator:d(()=>[u(h,null,{default:d(()=>[u(g,{name:e.currentPath===e.folder.path?"folder_open":"folder"},null,8,["name"])]),_:1}),u(b,null,{default:d(()=>[p(m(e.folder.name),1)]),_:1})]),default:d(()=>[(i(!0),c(v,null,f(e.folder.children,t=>(i(),s(_,{key:t.path,folder:t,"current-path":e.currentPath,"click-handler":e.clickHandler,disabled:a(t.path),"disabled-paths":e.disabledPaths,scope:e.scope,"value-prefix":e.valuePrefix},null,8,["folder","current-path","click-handler","disabled","disabled-paths","scope","value-prefix"]))),128))]),_:1},8,["scope","value","active","disabled"])):(i(),s(y,{key:0,clickable:"",active:e.currentPath===e.folder.path,disabled:n.value,onClick:l[0]||(l[0]=t=>e.clickHandler(e.folder.path))},{default:d(()=>[u(h,null,{default:d(()=>[u(g,{name:e.currentPath===e.folder.path?"folder_open":"folder"},null,8,["name"])]),_:1}),u(b,null,{default:d(()=>[p(m(e.folder.name),1)]),_:1})]),_:1},8,["active","disabled"]))])}}});const ue={key:1,class:"folder-picker"},ce={key:0,class:"empty"};var ve=o({__name:"storage-folder-picker",props:{location:{},modelValue:{},disabledPaths:{}},emits:["update:modelValue"],setup(t,{emit:a}){const o=t,y=a,_=e(),k=n(!1),w=n([]),x=n(["root"]),S=l(()=>{const e=String(o.modelValue||"").replace(/^\/+|\/+$/g,"");if(!e)return[];const t=e.split("/").filter(Boolean),a=[];for(let e=1;e<t.length;e++)a.push(t.slice(0,e).join("/"));return a});async function C(){k.value=!0;try{const e=await _.get(`/storage-manager/storages/${encodeURIComponent(o.location)}/folder-tree`);w.value=e.data?.data||[]}catch{w.value=[]}finally{k.value=!1}}function $(e){y("update:modelValue",e)}return g(S,e=>{const t=new Set(x.value);t.add("root");for(const a of e)t.add(a);x.value=Array.from(t)},{immediate:!0}),g(()=>o.location,()=>{C()}),h(()=>{C()}),(e,a)=>{const n=r("v-skeleton-loader"),l=r("v-icon"),o=r("v-list-item-icon"),g=r("v-list-item-content"),h=r("v-list-group"),y=r("v-item-group"),_=r("v-list");return k.value?(i(),s(n,{key:0})):(i(),c("div",ue,[u(_,null,{default:d(()=>[u(y,{modelValue:x.value,"onUpdate:modelValue":a[1]||(a[1]=e=>x.value=e),scope:"storage-folder-picker",multiple:""},{default:d(()=>[u(h,{"disable-groupable-parent":"",clickable:"",active:""===t.modelValue,scope:"storage-folder-picker",value:"root","arrow-placement":w.value.length>0&&"after",onClick:a[0]||(a[0]=e=>$(""))},{activator:d(()=>[u(o,null,{default:d(()=>[u(l,{name:"storage"})]),_:1}),u(g,null,{default:d(()=>[p("Root ("+m(t.location)+")",1)]),_:1})]),default:d(()=>[(i(!0),c(v,null,f(w.value,e=>(i(),s(de,{key:e.path,folder:e,"current-path":t.modelValue,"click-handler":$,disabled:t.disabledPaths?.includes(e.path),"disabled-paths":t.disabledPaths},null,8,["folder","current-path","disabled","disabled-paths"]))),128))]),_:1},8,["active","arrow-placement"])]),_:1},8,["modelValue"])]),_:1}),w.value.length?b("v-if",!0):(i(),c("p",ce,"No storage folders yet."))]))}}}),fe=[],pe=[];function me(e,t){if(e&&"undefined"!=typeof document){var a,n=!0===t.prepend?"prepend":"append",l=!0===t.singleTag,o="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(l){var r=fe.indexOf(o);-1===r&&(r=fe.push(o)-1,pe[r]={}),a=pe[r]&&pe[r][n]?pe[r][n]:pe[r][n]=i()}else a=i();65279===e.charCodeAt(0)&&(e=e.substring(1)),a.styleSheet?a.styleSheet.cssText+=e:a.appendChild(document.createTextNode(e))}function i(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),t.attributes)for(var a=Object.keys(t.attributes),l=0;l<a.length;l++)e.setAttribute(a[l],t.attributes[a[l]]);var r="prepend"===n?"afterbegin":"beforeend";return o.insertAdjacentElement(r,e),e}}me("\n.folder-picker[data-v-10885802] {\n\t--v-list-item-background-color-hover: var(--theme--background-accent);\n\t--v-list-item-background-color-active: var(--theme--background-accent);\n\n\tpadding: 0.6875rem;\n\tbackground-color: var(--theme--background-normal);\n\tborder-radius: var(--theme--border-radius);\n\tmax-block-size: 17.5rem;\n\toverflow: auto;\n}\n.empty[data-v-10885802] {\n\tmargin: 8px 12px 4px;\n\tfont-size: 13px;\n\tcolor: var(--theme--foreground-subdued);\n}\n",{});var ge=(e,t)=>{const a=e.__vccOpts||e;for(const[e,n]of t)a[e]=n;return a},he=ge(ve,[["__scopeId","data-v-10885802"]]);const be={class:"radio-options"};var ye=o({__name:"delete-storage-folder-dialog",props:k({location:{},paths:{},folderName:{}},{modelValue:{type:Boolean,required:!0},modelModifiers:{}}),emits:k(["done"],["update:modelValue"]),setup(t,{emit:a}){const l=y(t,"modelValue"),o=t,h=a,b=e(),k=n("move"),w=n(!1),x=[{value:"move",label:"Move content one level up"},{value:"delete",label:"Delete all content"}];async function S(){if(!w.value&&o.location&&o.paths.length){w.value=!0;try{const e=await b.delete(`/storage-manager/storages/${encodeURIComponent(o.location)}/folders`,{data:{paths:o.paths,mode:k.value}}),t=e.data?.data?.skipped||[];if(t.length)return void window.alert(t[0]?.error||"Folder could not be deleted");l.value=!1,h("done")}catch(e){window.alert(e?.response?.data?.errors?.[0]?.message||e?.message||"Delete failed")}finally{w.value=!1}}}return g(l,e=>{e&&(k.value="move")}),(e,a)=>{const n=r("v-card-title"),o=r("v-radio"),g=r("v-card-text"),h=r("v-button"),b=r("v-card-actions"),y=r("v-card"),C=r("v-dialog");return i(),s(C,{"model-value":l.value,persistent:"","onUpdate:modelValue":a[2]||(a[2]=e=>l.value=e),onEsc:a[3]||(a[3]=e=>l.value=!1),onApply:S},{default:d(()=>[u(y,null,{default:d(()=>[u(n,null,{default:d(()=>[...a[4]||(a[4]=[p("Delete Folder",-1)])]),_:1}),u(g,null,{default:d(()=>[_("p",null,[t.folderName&&1===t.paths.length?(i(),c(v,{key:0},[p(" What should happen to the contents of “"+m(t.folderName)+"”? ",1)],64)):1===t.paths.length?(i(),c(v,{key:1},[p("What should happen to the folder contents?")],64)):(i(),c(v,{key:2},[p("What should happen to the contents of "+m(t.paths.length)+" folders?",1)],64))]),_("div",be,[(i(),c(v,null,f(x,e=>u(o,{key:e.value,modelValue:k.value,"onUpdate:modelValue":a[0]||(a[0]=e=>k.value=e),value:e.value,label:e.label},null,8,["modelValue","value","label"])),64))])]),_:1}),u(b,null,{default:d(()=>[u(h,{secondary:"",disabled:w.value,onClick:a[1]||(a[1]=e=>l.value=!1)},{default:d(()=>[...a[5]||(a[5]=[p("Cancel",-1)])]),_:1},8,["disabled"]),u(h,{kind:"danger",loading:w.value,onClick:S},{default:d(()=>[...a[6]||(a[6]=[p("Delete",-1)])]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1},8,["model-value"])}}});me("\n.radio-options[data-v-3129fd6a] {\n\tmargin-block-start: 0.675rem;\n}\n.radio-options .v-radio + .v-radio[data-v-3129fd6a] {\n\tmargin-block-start: 0.45rem;\n}\n",{});var _e=ge(ye,[["__scopeId","data-v-3129fd6a"]]);function ke(e){return String(e||"").replace(/\\/g,"/").replace(/^\/+|\/+$/g,"")}function we(e){return String(e).replace(/_/g,"__").replace(/ /g,"_")}function xe(e){let t=String(e||"");try{t=decodeURIComponent(t)}catch{}return t.replace(/__/g,"\0").replace(/_/g," ").replace(/\0/g,"_")}function Se(e){return ke(e).split("/").filter(Boolean).map(xe).join("/")}function Ce(e,t){const a=`/storage-manager/storage/${encodeURIComponent(e)}`,n=function(e){return ke(e).split("/").filter(Boolean).map(we).join("/")}(t);return n?`${a}/path/${n}`:a}var $e=o({__name:"storage-folder-context-menu",props:{location:{},path:{},name:{}},emits:["changed"],setup(t,{expose:a,emit:o}){const s=t,f=o,m=e(),h=T(),{refreshTree:b}=re(),y=n(null),_=n(!1),k=n(s.name),x=n(!1),S=n(!1),C=n(""),$=n(!1),F=n(!1),M=l(()=>{const e=String(s.path||""),t=e.lastIndexOf("/");return-1===t?"":e.slice(0,t)}),V=l(()=>[s.path]),z=l(()=>[s.path]);function B(){if(!h.currentRoute.value.path.includes("/storage/"))return"";return Se(Array.isArray(h.currentRoute.value.params.storagePath)?h.currentRoute.value.params.storagePath.filter(Boolean).join("/"):String(h.currentRoute.value.params.storagePath||""))}function I(e){const t=B();if(t&&(t===s.path||t.startsWith(`${s.path}/`))){const a=t===s.path?"":t.slice(s.path.length+1);h.replace(Ce(s.location,a?`${e}/${a}`:e))}}async function D(e){await b(s.location).catch(()=>{}),f("changed",e)}async function U(){if(k.value?.trim()&&!x.value){x.value=!0;try{const e=await m.patch(`/storage-manager/storages/${encodeURIComponent(s.location)}/folders`,{path:s.path,name:k.value.trim()}),t=String(e.data?.data?.path||"");_.value=!1,t&&I(t),await D(t||void 0)}catch(e){window.alert(e?.response?.data?.errors?.[0]?.message||e?.message||"Rename failed")}finally{x.value=!1}}}async function N(){if(!$.value){$.value=!0;try{const e=await m.patch(`/storage-manager/storages/${encodeURIComponent(s.location)}/folders`,{path:s.path,parent_path:C.value||""}),t=String(e.data?.data?.path||"");S.value=!1,t&&I(t),await D(t||void 0)}catch(e){window.alert(e?.response?.data?.errors?.[0]?.message||e?.message||"Move failed")}finally{$.value=!1}}}async function A(){const e=B();(e===s.path||e.startsWith(`${s.path}/`))&&h.replace(Ce(s.location,M.value||void 0)),await D(M.value||void 0)}return g(()=>s.name,e=>{_.value||(k.value=e)}),g(_,e=>{e&&(k.value=s.name)}),g(S,e=>{e&&(C.value=M.value)}),a({open:function(e){y.value?.activate?.(e)}}),(e,a)=>{const n=r("v-icon"),l=r("v-list-item-icon"),o=r("v-list-item-content"),s=r("v-list-item"),f=r("v-list"),m=r("v-menu"),g=r("v-card-title"),h=r("v-input"),b=r("v-card-text"),M=r("v-button"),B=r("v-card-actions"),I=r("v-card"),D=r("v-dialog");return i(),c(v,null,[u(m,{ref_key:"contextMenu",ref:y,"show-arrow":"",placement:"bottom-start"},{default:d(()=>[u(f,null,{default:d(()=>[u(s,{clickable:"",onClick:a[0]||(a[0]=e=>_.value=!0)},{default:d(()=>[u(l,null,{default:d(()=>[u(n,{name:"edit",outline:""})]),_:1}),u(o,null,{default:d(()=>[...a[12]||(a[12]=[p("Rename Folder",-1)])]),_:1})]),_:1}),u(s,{clickable:"",onClick:a[1]||(a[1]=e=>S.value=!0)},{default:d(()=>[u(l,null,{default:d(()=>[u(n,{name:"folder_move",outline:""})]),_:1}),u(o,null,{default:d(()=>[...a[13]||(a[13]=[p("Move to Folder",-1)])]),_:1})]),_:1}),u(s,{class:"danger",clickable:"",onClick:a[2]||(a[2]=e=>F.value=!0)},{default:d(()=>[u(l,null,{default:d(()=>[u(n,{name:"delete",outline:""})]),_:1}),u(o,null,{default:d(()=>[...a[14]||(a[14]=[p("Delete Folder",-1)])]),_:1})]),_:1})]),_:1})]),_:1},512),u(D,{modelValue:_.value,"onUpdate:modelValue":a[5]||(a[5]=e=>_.value=e),persistent:"",onEsc:a[6]||(a[6]=e=>_.value=!1),onApply:U},{default:d(()=>[u(I,null,{default:d(()=>[u(g,null,{default:d(()=>[...a[15]||(a[15]=[p("Rename Folder",-1)])]),_:1}),u(b,null,{default:d(()=>[u(h,{modelValue:k.value,"onUpdate:modelValue":a[3]||(a[3]=e=>k.value=e),autofocus:"",onKeyup:w(U,["enter"])},null,8,["modelValue"])]),_:1}),u(B,null,{default:d(()=>[u(M,{secondary:"",onClick:a[4]||(a[4]=e=>_.value=!1)},{default:d(()=>[...a[16]||(a[16]=[p("Cancel",-1)])]),_:1}),u(M,{disabled:!k.value?.trim(),loading:x.value,onClick:U},{default:d(()=>[...a[17]||(a[17]=[p("Save",-1)])]),_:1},8,["disabled","loading"])]),_:1})]),_:1})]),_:1},8,["modelValue"]),u(D,{modelValue:S.value,"onUpdate:modelValue":a[9]||(a[9]=e=>S.value=e),persistent:"",onEsc:a[10]||(a[10]=e=>S.value=!1),onApply:N},{default:d(()=>[u(I,null,{default:d(()=>[u(g,null,{default:d(()=>[...a[18]||(a[18]=[p("Move to Folder",-1)])]),_:1}),u(b,null,{default:d(()=>[u(he,{modelValue:C.value,"onUpdate:modelValue":a[7]||(a[7]=e=>C.value=e),location:t.location,"disabled-paths":V.value},null,8,["modelValue","location","disabled-paths"])]),_:1}),u(B,null,{default:d(()=>[u(M,{secondary:"",onClick:a[8]||(a[8]=e=>S.value=!1)},{default:d(()=>[...a[19]||(a[19]=[p("Cancel",-1)])]),_:1}),u(M,{loading:$.value,onClick:N},{default:d(()=>[...a[20]||(a[20]=[p("Save",-1)])]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1},8,["modelValue"]),u(_e,{modelValue:F.value,"onUpdate:modelValue":a[11]||(a[11]=e=>F.value=e),location:t.location,paths:z.value,"folder-name":t.name,onDone:A},null,8,["modelValue","location","paths","folder-name"])],64)}}});me("\n.v-list-item.danger[data-v-73188cf0] {\n\t--v-list-item-color: var(--theme--danger);\n\t--v-list-item-color-hover: var(--theme--danger);\n\t--v-list-item-icon-color: var(--theme--danger);\n}\n",{});var Fe=ge($e,[["__scopeId","data-v-73188cf0"]]),Me=o({name:"NavStorageFolderItem",__name:"nav-storage-folder-item",props:{location:{},folder:{},currentLocation:{},currentPath:{},clickHandler:{type:Function}},emits:["changed"],setup(e,{emit:t}){const a=t,l=n(null);function o(e,t,a,n){return a===e&&(n||"")===t}function p(e){l.value?.open(e)}function m(){a("changed")}return(t,a)=>{const n=r("v-icon"),g=r("v-list-item-icon"),h=r("v-text-overflow"),b=r("v-list-item-content"),y=r("v-list-item"),_=r("nav-storage-folder-item",!0),k=r("v-list-group");return i(),c(v,null,[e.folder.children&&0!==e.folder.children.length?(i(),s(k,{key:1,clickable:"",scope:"storage-navigation",value:(w=e.location,S=e.folder.path,`${w}:${S}`),active:o(e.location,e.folder.path,e.currentLocation,e.currentPath),"arrow-placement":"after","disable-groupable-parent":"",onClick:a[1]||(a[1]=t=>e.clickHandler({location:e.location,path:e.folder.path})),onContextmenu:x(p,["prevent"])},{activator:d(()=>[u(g,null,{default:d(()=>[u(n,{name:"folder",outline:""})]),_:1}),u(b,null,{default:d(()=>[u(h,{text:e.folder.name},null,8,["text"])]),_:1})]),default:d(()=>[(i(!0),c(v,null,f(e.folder.children,t=>(i(),s(_,{key:t.path,location:e.location,folder:t,"current-location":e.currentLocation,"current-path":e.currentPath,"click-handler":e.clickHandler,onChanged:m},null,8,["location","folder","current-location","current-path","click-handler"]))),128))]),_:1},8,["value","active"])):(i(),s(y,{key:0,clickable:"",active:o(e.location,e.folder.path,e.currentLocation,e.currentPath),onClick:a[0]||(a[0]=t=>e.clickHandler({location:e.location,path:e.folder.path})),onContextmenu:x(p,["prevent"])},{default:d(()=>[u(g,null,{default:d(()=>[u(n,{name:"folder",outline:""})]),_:1}),u(b,null,{default:d(()=>[u(h,{text:e.folder.name},null,8,["text"])]),_:1})]),_:1},8,["active"])),u(Fe,{ref_key:"menu",ref:l,location:e.location,path:e.folder.path,name:e.folder.name,onChanged:m},null,8,["location","path","name"])],64);var w,S}}}),Ve=o({name:"NavStorageItem",__name:"nav-storage-item",props:{storage:{},folders:{},currentLocation:{},currentPath:{},clickHandler:{type:Function}},setup:e=>(t,a)=>{const n=r("v-icon"),l=r("v-list-item-icon"),o=r("v-text-overflow"),p=r("v-list-item-content"),m=r("v-list-item"),g=r("v-list-group");return e.folders.length?(i(),s(g,{key:1,clickable:"",scope:"storage-navigation",value:(h=e.storage.location,`@${h}`),active:e.currentLocation===e.storage.location,"arrow-placement":"after","disable-groupable-parent":"",onClick:a[1]||(a[1]=t=>e.clickHandler({location:e.storage.location}))},{activator:d(()=>[u(l,null,{default:d(()=>[u(n,{name:e.storage.icon},null,8,["name"])]),_:1}),u(p,null,{default:d(()=>[u(o,{text:e.storage.location},null,8,["text"])]),_:1})]),default:d(()=>[(i(!0),c(v,null,f(e.folders,t=>(i(),s(Me,{key:t.path,location:e.storage.location,folder:t,"current-location":e.currentLocation,"current-path":e.currentPath,"click-handler":e.clickHandler},null,8,["location","folder","current-location","current-path","click-handler"]))),128))]),_:1},8,["value","active"])):(i(),s(m,{key:0,clickable:"",active:e.currentLocation===e.storage.location&&!e.currentPath,onClick:a[0]||(a[0]=t=>e.clickHandler({location:e.storage.location}))},{default:d(()=>[u(l,null,{default:d(()=>[u(n,{name:e.storage.icon},null,8,["name"])]),_:1}),u(p,null,{default:d(()=>[u(o,{text:e.storage.location},null,8,["text"])]),_:1})]),_:1},8,["active"]));var h}});const ze={class:"storages"},Be={class:"folders"};var Ie=o({__name:"navigation",setup(e){const t=R(),a=T(),{nestedFolders:n,folders:o,loading:p,openFolders:m}=Y(),{storages:y,loadStorages:k}=ae(),{trees:w,openFolders:x}=re(),$=l(()=>{if(!t.path.startsWith("/storage-manager/folders"))return;const e=t.params.folderId;return e?String(e):void 0}),F=l(()=>{if(t.path.startsWith("/storage-manager/storage/"))return String(t.params.location||"")||void 0}),M=l(()=>{if(!F.value)return"";const e=t.params.storagePath;return Se(Array.isArray(e)?e.filter(Boolean).join("/"):e?String(e):"")}),V=l(()=>"/storage-manager/folders"===t.path||"/storage-manager/folders/"===t.path),z=l(()=>"/storage-manager"===t.path||"/storage-manager/"===t.path),B=l(()=>t.path.startsWith("/storage-manager/settings"));function I(e){e.folder?a.push(`/storage-manager/folders/${e.folder}`):a.push("/storage-manager/folders")}function D(e){a.push(Ce(e.location,e.path))}function U(){a.push("/storage-manager")}function N(){a.push("/storage-manager/settings")}return g([$,p,o],function(){if(!o.value||p.value)return;if(!m?.value)return;if(!$.value)return;const e=["root"],t=o.value.find(e=>e.id===$.value);t?.parent&&function t(a){if(!o.value)return;e.push(a);const n=o.value.find(e=>e.id===a);n?.parent&&t(n.parent)}(t.parent);const a=[...m.value];let n=!1;for(const t of e)a.includes(t)||(a.push(t),n=!0);n&&(m.value=a)},{immediate:!0}),g([F,M,w],function(){const e=F.value;if(!e)return;const t=[`@${e}`],a=M.value;if(a){const n=a.split("/").filter(Boolean);for(let a=1;a<=n.length;a++)t.push(`${e}:${n.slice(0,a).join("/")}`)}x.value=Array.from(new Set([...x.value,...t]))},{immediate:!0,deep:!0}),h(()=>{k().catch(()=>{})}),(e,t)=>{const a=r("v-icon"),l=r("v-list-item-icon"),o=r("v-text-overflow"),g=r("v-list-item-content"),h=r("v-list-item"),k=r("v-divider"),A=r("v-skeleton-loader"),E=r("v-item-group"),L=r("v-list-group"),P=r("v-list");return i(),s(P,{nav:""},{default:d(()=>[u(h,{clickable:"",active:z.value,onClick:U},{default:d(()=>[u(l,null,{default:d(()=>[u(a,{name:"dashboard"})]),_:1}),u(g,null,{default:d(()=>[u(o,{text:"Storage Manager"})]),_:1})]),_:1},8,["active"]),u(k),!S(p)||S(n)&&0!==S(n).length?b("v-if",!0):(i(),c(v,{key:0},f(4,e=>u(h,{key:e},{default:d(()=>[u(A,{type:"list-item-icon"})]),_:1})),64)),t[3]||(t[3]=_("div",{class:"section-label"},"Storage adapters",-1)),_("div",ze,[u(E,{modelValue:S(x),"onUpdate:modelValue":t[0]||(t[0]=e=>C(x)?x.value=e:null),scope:"storage-navigation",multiple:""},{default:d(()=>[(i(!0),c(v,null,f(S(y),e=>(i(),s(Ve,{key:e.location,storage:e,folders:S(w)[e.location]||[],"current-location":F.value,"current-path":M.value,"click-handler":D},null,8,["storage","folders","current-location","current-path"]))),128))]),_:1},8,["modelValue"])]),u(k),_("div",Be,[u(E,{modelValue:S(m),"onUpdate:modelValue":t[2]||(t[2]=e=>C(m)?m.value=e:null),scope:"files-navigation",multiple:""},{default:d(()=>[u(L,{clickable:"",active:V.value||Boolean($.value),value:"root",scope:"files-navigation",exact:"","disable-groupable-parent":"","arrow-placement":!!(S(n)&&S(n).length>0)&&"after",onClick:t[1]||(t[1]=e=>I({}))},{activator:d(()=>[u(l,null,{default:d(()=>[u(a,{name:"folder_special",outline:""})]),_:1}),u(g,null,{default:d(()=>[u(o,{text:"Directus Folders"})]),_:1})]),default:d(()=>[(i(!0),c(v,null,f(S(n)||[],e=>(i(),s(ie,{key:e.id,folder:e,"current-folder":$.value,"click-handler":I},null,8,["folder","current-folder"]))),128))]),_:1},8,["active","arrow-placement"])]),_:1},8,["modelValue"])]),u(h,{clickable:"",active:B.value,onClick:N},{default:d(()=>[u(l,null,{default:d(()=>[u(a,{name:"settings"})]),_:1}),u(g,null,{default:d(()=>[u(o,{text:"Settings"})]),_:1})]),_:1},8,["active"])]),_:1})}}});me("\n.v-skeleton-loader[data-v-7be226a3] {\n\t--v-skeleton-loader-background-color: var(--theme--background-accent);\n}\n.folders[data-v-7be226a3],\n.storages[data-v-7be226a3] {\n\twidth: 100%;\n\toverflow-x: hidden;\n}\n.folders[data-v-7be226a3] .v-list-item-content,\n.storages[data-v-7be226a3] .v-list-item-content {\n\toverflow: hidden;\n\twhite-space: nowrap;\n\ttext-overflow: ellipsis;\n}\n.section-label[data-v-7be226a3] {\n\tpadding: 4px 12px 4px;\n\tfont-size: 11px;\n\tfont-weight: 700;\n\tletter-spacing: 0.04em;\n\ttext-transform: uppercase;\n\tcolor: var(--theme--foreground-subdued);\n}\n",{});var De=ge(Ie,[["__scopeId","data-v-7be226a3"]]);function Ue(e){if(null==e||!Number.isFinite(e)||e<0)return"—";if(0===e)return"0 B";const t=["B","KB","MB","GB","TB","PB"],a=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),n=e/Math.pow(1024,a),l=n>=100||0===a?0:n>=10?1:2;return`${n.toFixed(l)} ${t[a]}`}function Ne(e){if(null==e||!Number.isFinite(e)||e<0)return"—";const t=8*e/1e6;return t<.1?`${t.toFixed(2)} Mbit/s`:t<10?`${t.toFixed(1)} Mbit/s`:`${Math.round(t)} Mbit/s`}function Ae(e){if(null==e||!Number.isFinite(e)||e<0)return"—";const t=Math.floor(e/1e3),a=Math.floor(t/3600),n=Math.floor(t%3600/60),l=t%60;return a>0?`${a}h ${n}m ${l}s`:n>0?`${n}m ${l}s`:`${l}s`}const Ee={class:"usage-top"},Le={class:"label"},Pe={class:"value"},Oe={key:0,class:"track"},je={key:1,class:"secondary"};var Te=o({__name:"usage-bar",props:{usage:{},label:{default:"Usage"},compact:{type:Boolean,default:!1},plain:{type:Boolean,default:!1}},setup(e){const t=e,a=l(()=>t.usage.disk_available&&null!=t.usage.disk_used_percent),n=l(()=>{const e=t.usage.disk_used_percent??0;return Math.max(0,Math.min(100,e))}),o=l(()=>{const e=n.value;return e>=90?"danger":e>=75?"warning":"ok"}),r=l(()=>{return a.value?`${e=t.usage.disk_used_percent,null!=e&&Number.isFinite(e)?`${Math.round(e)}%`:"—"} used · ${Ue(t.usage.disk_used_bytes)} / ${Ue(t.usage.disk_total_bytes)}`:`${t.usage.file_count.toLocaleString()} files · ${Ue(t.usage.total_bytes)}`;var e}),s=l(()=>a.value?`${t.usage.file_count.toLocaleString()} files in Directus · ${Ue(t.usage.total_bytes)} · ${Ue(t.usage.disk_free_bytes)} free`:"Cloud quota not available — showing Directus-tracked size");return(t,l)=>(i(),c("div",{class:$(["usage-bar",{compact:e.compact,plain:e.plain}])},[_("div",Ee,[_("span",Le,m(e.label),1),_("span",Pe,m(r.value),1)]),a.value?(i(),c("div",Oe,[_("div",{class:$(["fill",o.value]),style:F({width:`${n.value}%`})},null,6)])):b("v-if",!0),s.value?(i(),c("div",je,m(s.value),1)):b("v-if",!0)],2))}});me("\n.usage-bar[data-v-475a6a41] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n\tpadding: 12px 14px;\n\tbackground: var(--theme--background-subdued);\n\tborder-radius: var(--theme--border-radius);\n\tborder: var(--theme--border-width) solid var(--theme--border-color-subdued);\n}\n.usage-bar.compact[data-v-475a6a41] {\n\tpadding: 8px 10px;\n}\n.usage-bar.plain[data-v-475a6a41] {\n\tpadding: 0;\n\tbackground: transparent;\n\tborder: none;\n\tborder-radius: 0;\n}\n.usage-top[data-v-475a6a41] {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\tgap: 12px;\n\talign-items: baseline;\n}\n.label[data-v-475a6a41] {\n\tfont-weight: 600;\n\tcolor: var(--theme--foreground);\n}\n.value[data-v-475a6a41] {\n\tfont-size: 13px;\n\tcolor: var(--theme--foreground);\n\ttext-align: right;\n}\n.track[data-v-475a6a41] {\n\theight: 8px;\n\tborder-radius: 999px;\n\tbackground: var(--theme--background-normal);\n\toverflow: hidden;\n}\n.fill[data-v-475a6a41] {\n\theight: 100%;\n\tborder-radius: inherit;\n\ttransition: width 200ms ease;\n}\n.fill.ok[data-v-475a6a41] {\n\tbackground: var(--theme--primary);\n}\n.fill.warning[data-v-475a6a41] {\n\tbackground: var(--theme--warning);\n}\n.fill.danger[data-v-475a6a41] {\n\tbackground: var(--theme--danger);\n}\n.secondary[data-v-475a6a41] {\n\tfont-size: 12px;\n\tcolor: var(--theme--foreground-subdued);\n}\n",{});var Re=ge(Te,[["__scopeId","data-v-475a6a41"]]);function qe(e){if("undefined"!=typeof document&&(document.querySelector(".root-split, .main-split")||document.querySelector("#navigation.module-bar")||document.querySelector("aside.module-nav:not(#navigation)")))return!1;const t=function(e){if("string"!=typeof e||!e)return null;const t=e.trim().replace(/^v/i,""),[a,n]=t.split("."),l=Number.parseInt(a||"",10),o=Number.parseInt(n||"",10);return Number.isFinite(l)?{major:l,minor:Number.isFinite(o)?o:0}:null}(e);return t?11===t.major&&t.minor<14:"undefined"!=typeof document&&Boolean(document.querySelector("#navigation:not(.module-bar)"))}function Ke(){const{useServerStore:e}=t(),a=e();return l(()=>{const e=["page-container"];return qe(a?.info?.version)&&e.push("page-container--flush-top"),e})}const Je="storage_manager",We="none",He="full_sync",Qe={image:"images",video:"videos",audio:"audio",text:"documents"},Ge="yyyy/MM",Ye=["none","folder","folder_id","type","date"],Xe=["full_sync","leave_old"];function Ze(e){const t=e&&"object"==typeof e?e:{};return{prefix_strategy:Ye.includes(t.prefix_strategy)?t.prefix_strategy:We,folder_sync_enabled:Boolean(t.folder_sync_enabled),folder_sync_rename:Xe.includes(t.folder_sync_rename)?t.folder_sync_rename:He,folder_sync_delete:"move_to_parent",date_format:"string"==typeof t.date_format&&t.date_format.trim()?t.date_format.trim():Ge,type_map:{...Qe,...t.type_map&&"object"==typeof t.type_map&&!Array.isArray(t.type_map)?t.type_map:{}}}}function et(e){if(!e||"object"!=typeof e)throw new Error("Invalid JSON: expected an object");const t=e,a=t.storage_manager&&"object"==typeof t.storage_manager?t.storage_manager:t;if(!a||"object"!=typeof a)throw new Error("Invalid config: expected storage_manager object");const n=a.locations;if(!n||"object"!=typeof n||Array.isArray(n))throw new Error("Invalid config: missing locations object");const l={};for(const[e,t]of Object.entries(n))e.trim()&&(l[e]=Ze(t));const o={locations:l};return"name_mirror_claims"in a&&(o.name_mirror_claims=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return{};const t={};for(const[a,n]of Object.entries(e))"string"==typeof a&&a&&"string"==typeof n&&n&&(t[a]=n);return t}(a.name_mirror_claims)),o}function tt(e){return e?{prefix_strategy:"folder",folder_sync_enabled:!0,folder_sync_rename:"full_sync"}:{prefix_strategy:"none",folder_sync_enabled:!1}}const at={key:0,class:"loading"},nt={class:"storage-grid"},lt={class:"card-head"},ot={class:"card-titles"},rt={class:"meta"},it={class:"tag"},st={key:0,class:"tag"},dt=["title"],ut={key:2,class:"tag tag-path"},ct={class:"card-strategy"},vt={class:"mirror-copy"};var ft=o({__name:"overview-view",setup(t){const a=T(),l=e(),o=Ke(),{storages:g,storagesError:y,loadStorages:k}=ae(),w=n(!0),x=M({});return h(async function(){w.value=!0;try{await k(!0)}finally{w.value=!1}}),(e,t)=>{const n=r("v-breadcrumb"),h=r("sidebar-detail"),k=r("v-progress-circular"),C=r("v-notice"),F=r("v-icon"),M=r("v-divider"),B=r("v-button"),I=r("v-checkbox"),D=r("private-view"),U=V("tooltip");return i(),s(D,{title:"Storage Manager",icon:"storage"},{headline:d(()=>[u(n,{items:[{name:"Storage Manager",to:"/storage-manager"}]})]),navigation:d(()=>[u(De)]),sidebar:d(()=>[u(h,{id:"about",icon:"info",title:"About"},{default:d(()=>[...t[0]||(t[0]=[_("p",{class:"sidebar-text"}," Move files between configured storage adapters and manage physical storage folders. Use Directus Folders view to materialize virtual folders into real storage paths. ",-1)])]),_:1})]),default:d(()=>[_("div",{class:$(S(o))},[w.value&&!S(g).length?(i(),c("div",at,[u(k,{indeterminate:""})])):S(y)?(i(),s(C,{key:1,type:"danger"},{default:d(()=>[p(m(S(y)),1)]),_:1})):(i(),c(v,{key:2},[u(M,{class:"section-divider",large:"","inline-title":!1,style:{"--v-divider-color":"var(--theme--border-color-subdued)"}},{icon:d(()=>[u(F,{name:"swap_horiz"})]),default:d(()=>[t[1]||(t[1]=p(" Storage Manager ",-1))]),_:1}),t[4]||(t[4]=_("p",{class:"page-intro"}," Browse, create, and move files and storage folders across your adapters. Use Materialize in Directus Folders view to convert virtual folder hierarchy into physical storage paths. ",-1)),_("div",nt,[(i(!0),c(v,null,f(S(g),e=>(i(),c("article",{key:e.location,class:"storage-card"},[_("div",lt,[u(F,{name:e.icon,large:""},null,8,["name"]),_("div",ot,[_("strong",null,m(e.location),1),_("span",null,m(e.label),1)]),u(B,{small:"",secondary:"",onClick:t=>{return n=e.location,void a.push(Ce(n));var n}},{default:d(()=>[...t[2]||(t[2]=[p("Browse",-1)])]),_:1},8,["onClick"])]),u(Re,{usage:e},null,8,["usage"]),_("div",rt,[_("span",it,m(e.file_count.toLocaleString())+" files",1),e.folder_count?(i(),c("span",st,m(e.folder_count.toLocaleString())+" folders",1)):b("v-if",!0),e.root?(i(),c("span",{key:1,class:"tag tag-path",title:e.root},m(e.root),9,dt)):e.bucket?(i(),c("span",ut,m(e.bucket),1)):b("v-if",!0)]),_("div",ct,[_("div",vt,[t[3]||(t[3]=_("strong",null,"Mirror Directus Folders",-1)),z(u(F,{name:"help_outline",small:""},null,512),[[U,"New uploads and folder rename/delete follow the Directus folder tree on this adapter.",void 0,{bottom:!0}]])]),u(I,{"model-value":e.mirror_directus_folders,disabled:Boolean(x[e.location]),"onUpdate:modelValue":t=>async function(e,t){const a=g.value.find(t=>t.location===e);if(!a||x[e])return;const n=Boolean(a.mirror_directus_folders);a.mirror_directus_folders=t,x[e]=!0;try{await l.patch("/storage-manager/settings",{locations:{[e]:tt(t)}})}catch{a.mirror_directus_folders=n,window.alert("Could not save Mirror Directus Folders.")}finally{x[e]=!1}}(e.location,t)},null,8,["model-value","disabled","onUpdate:modelValue"])])]))),128))])],64))],2)]),_:1})}}});me("\n.page-container[data-v-4d4e4fc2] {\n\tpadding: var(--content-padding);\n\tpadding-block-end: var(--content-padding-bottom);\n\tmax-inline-size: 67.5rem;\n}\n.page-container--flush-top[data-v-4d4e4fc2] {\n\tpadding-block-start: 0;\n}\n.section-divider[data-v-4d4e4fc2] {\n\tmargin-bottom: 12px;\n}\n.page-intro[data-v-4d4e4fc2],\n.sidebar-text[data-v-4d4e4fc2] {\n\tmargin: 0 0 24px;\n\tline-height: 1.55;\n\tcolor: var(--theme--foreground);\n}\n.sidebar-text code[data-v-4d4e4fc2] {\n\tfont-family: var(--theme--fonts--monospace--font-family, monospace);\n\tfont-size: 0.9em;\n}\n.loading[data-v-4d4e4fc2] {\n\tdisplay: flex;\n\tjustify-content: center;\n\tpadding: 48px 0;\n}\n.glossary-sidebar[data-v-4d4e4fc2] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n}\n.glossary-scope[data-v-4d4e4fc2] {\n\tmargin: 0;\n\tpadding: 10px 12px;\n\tfont-size: 12px;\n\tline-height: 1.45;\n\tcolor: var(--theme--foreground);\n\tbackground: var(--theme--background-normal);\n\tborder-radius: var(--theme--border-radius);\n\tborder: var(--theme--border-width) solid var(--theme--border-color-subdued);\n}\n.glossary-section[data-v-4d4e4fc2] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n\tmargin-block-start: 8px;\n\tpadding: 14px 12px;\n\tborder-radius: var(--theme--border-radius);\n\tborder: var(--theme--border-width) solid var(--theme--border-color);\n\tborder-block-start-width: 2px;\n\tbackground: var(--theme--background-subdued);\n}\n.glossary-section-label[data-v-4d4e4fc2] {\n\tdisplay: block;\n\tfont-size: 11px;\n\tfont-weight: 700;\n\tletter-spacing: 0.04em;\n\ttext-transform: uppercase;\n\tcolor: var(--theme--foreground);\n}\n.glossary-section-intro[data-v-4d4e4fc2] {\n\tmargin: 0;\n\tfont-size: 12px;\n\tline-height: 1.4;\n\tcolor: var(--theme--foreground-subdued);\n}\n.glossary-section .glossary-item[data-v-4d4e4fc2] {\n\tpadding-block-start: 10px;\n\tborder-block-start: var(--theme--border-width) solid var(--theme--border-color-subdued);\n}\n.glossary-sidebar .glossary-item strong[data-v-4d4e4fc2] {\n\tdisplay: block;\n\tmargin-block-end: 4px;\n\tfont-size: 13px;\n}\n.glossary-sidebar .glossary-item p[data-v-4d4e4fc2] {\n\tmargin: 0;\n\tfont-size: 12px;\n\tline-height: 1.4;\n\tcolor: var(--theme--foreground-subdued);\n}\n.storage-grid[data-v-4d4e4fc2] {\n\tdisplay: grid;\n\tgrid-template-columns: repeat(2, minmax(0, 1fr));\n\tgap: 16px;\n}\n@media (max-width: 900px) {\n.storage-grid[data-v-4d4e4fc2] {\n\t\tgrid-template-columns: 1fr;\n}\n}\n.storage-card[data-v-4d4e4fc2] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 14px;\n\tmin-width: 0;\n\tpadding: 16px 18px;\n\tborder-radius: var(--theme--border-radius);\n\tborder: var(--theme--border-width) solid var(--theme--border-color);\n\tbackground: var(--theme--background);\n}\n.card-head[data-v-4d4e4fc2] {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 12px;\n}\n.card-titles[data-v-4d4e4fc2] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2px;\n\tmin-width: 0;\n\tflex: 1;\n}\n.card-titles strong[data-v-4d4e4fc2] {\n\tfont-size: 15px;\n\tletter-spacing: 0.01em;\n}\n.card-titles span[data-v-4d4e4fc2] {\n\tfont-size: 12px;\n\tcolor: var(--theme--foreground-subdued);\n}\n.meta[data-v-4d4e4fc2] {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 6px;\n\talign-items: center;\n}\n.meta .tag[data-v-4d4e4fc2] {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tmax-width: 100%;\n\tpadding: 3px 9px;\n\tborder-radius: 4px;\n\tfont-size: 12px;\n\tline-height: 1.35;\n\tcolor: var(--theme--foreground);\n\tbackground: var(--theme--background-normal);\n\tborder: var(--theme--border-width) solid var(--theme--border-color-subdued);\n}\n.meta .tag-path[data-v-4d4e4fc2] {\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n\tfont-family: var(--theme--fonts--monospace--font-family, monospace);\n\tcolor: var(--theme--foreground-subdued);\n}\n.card-strategy[data-v-4d4e4fc2] {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: 12px;\n\tpadding-block-start: 12px;\n\tborder-block-start: var(--theme--border-width) solid var(--theme--border-color-subdued);\n}\n.mirror-copy[data-v-4d4e4fc2] {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 6px;\n\tmin-width: 0;\n\tflex: 1;\n}\n.mirror-copy strong[data-v-4d4e4fc2] {\n\tfont-size: 13px;\n}\n.mirror-copy .v-icon[data-v-4d4e4fc2] {\n\t--v-icon-color: var(--theme--foreground-subdued);\n\tcursor: pointer;\n}\n.strategy-label[data-v-4d4e4fc2] {\n\tmin-width: 0;\n\tflex: 1;\n\toverflow: hidden;\n\tfont-size: 13px;\n\tfont-weight: 600;\n\tcolor: var(--theme--foreground);\n\twhite-space: nowrap;\n\ttext-overflow: ellipsis;\n}\n.strategy-prefix[data-v-4d4e4fc2] {\n\tfont-weight: 500;\n\tcolor: var(--theme--foreground-subdued);\n}\n.strategy-dialog-card[data-v-4d4e4fc2] {\n\twidth: min(480px, 92vw);\n\tmax-block-size: min(85vh, 720px);\n\toverflow: auto;\n}\n",{});var pt=ge(ft,[["__scopeId","data-v-4d4e4fc2"]]);function mt(e){const t=n(0),a=n(0),l=new ResizeObserver(([e])=>{void 0!==e&&(t.value=e.contentRect.width,a.value=e.contentRect.height)});return h(()=>{const t=C(e)?e.value:e;null!=t&&l.observe(t)}),B(()=>{l.disconnect()}),{width:t,height:a}}const gt="wrapper",ht=["selection","layoutOptions","layoutQuery"];function bt(e){const{layouts:t}=function(){const e=I("extensions");if(!e)throw new Error("[useExtensions]: The extensions could not be found.");return e}(),a=l(()=>t.value.map(e=>function(e){return o({name:`${e.id}-${gt}`,props:{collection:{type:String,required:!0},selection:{type:Array,default:()=>[]},layoutOptions:{type:Object,default:()=>({})},layoutQuery:{type:Object,default:()=>({})},layoutProps:{type:Object,default:()=>({})},filter:{type:Object,default:null},filterUser:{type:Object,default:null},filterSystem:{type:Object,default:null},search:{type:String,default:null},showSelect:{type:String,default:"multiple"},selectMode:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},resetPreset:{type:Function,default:null},clearFilters:{type:Function,default:null}},emits:ht.map(e=>`update:${e}`),setup(t,{emit:a}){const n=M({...e.setup(t,{emit:a}),...D(t),sidebarShadow:e.sidebarShadow??!1});for(const e in n)n[`onUpdate:${e}`]=l=>{var o;o=e,ht.includes(o)?a(`update:${e}`,l):Object.keys(t).includes(e)||(n[e]=l)};return{state:n}},render:e=>void 0!==e.$slots.default?e.$slots.default({layoutState:e.state}):null})}(e)));return{layoutWrapper:l(()=>{const t=a.value.find(t=>t.name===`${e.value}-${gt}`);return void 0===t?a.value.find(e=>e.name===`tabular-${gt}`):t})}}const yt=["value","placeholder","tabindex","disabled"];var _t=o({__name:"search-input",props:{modelValue:{},disabled:{type:Boolean},showFilter:{type:Boolean,default:!0},collection:{},filter:{},autofocus:{type:Boolean},placeholder:{}},emits:["update:modelValue","update:filter"],setup(e,{emit:t}){const a=e,o=t,f=n(null),p=n(Boolean(a.autofocus)),m=n(!1),y=n(!1),k=I("main-element",void 0),S=n(),{width:C}=mt(k??n(void 0)),{width:F}=mt(S);g([C,F],()=>{if(!S.value)return;const e=k?.value?.firstElementChild,t=S.value.parentElement;if(!t)return;const a=t.offsetWidth-4;if(!e)return void(S.value.style.maxInlineSize="");const n=t.getBoundingClientRect().right-(e.getBoundingClientRect().left+Number(window.getComputedStyle(e).paddingInlineStart.replace("px","")));S.value.style.maxInlineSize=n>a?`${String(n)}px`:"0px"},{immediate:!0}),h(()=>{p.value&&f.value?.focus()});const M=l(()=>{if(!a.filter)return 0;const e=[];return function t(a){for(const[n,l]of Object.entries(a))"_and"===n||"_or"===n?l?.forEach?.(t):n.startsWith("_")?e.push(n):l&&"object"==typeof l&&t(l)}(a.filter),e.length});function B(e){return!(e.path||e.composedPath?.()||[]).some(e=>e?.classList?.contains("v-menu-content"))}function D(){p.value||f.value?.focus(),p.value=!0}function N(){m.value=!m.value,p.value=!0,m.value||f.value?.focus()}function A(){o("update:modelValue",null),p.value&&f.value?.focus()}function E(){p.value=!1,m.value=!1,f.value?.blur()}function L(e){if(m.value)return;const t=e.currentTarget?.closest(".search-input"),a=e.relatedTarget;a&&t?.contains(a)||E()}function P(){f.value&&o("update:modelValue",f.value.value||null)}return g(m,e=>{y.value=!!e}),(t,a)=>{const n=r("v-icon"),l=r("interface-system-filter"),o=r("v-badge"),g=V("tooltip"),h=V("click-outside");return i(),s(o,{bottom:"",right:"",class:$(["search-badge",{active:p.value,"filter-active":m.value}]),value:M.value,disabled:e.disabled||!M.value||m.value},{default:d(()=>[z((i(),c("div",{class:$(["search-input",{active:p.value,disabled:e.disabled,"filter-active":m.value,"has-content":!!e.modelValue,"filter-border":y.value,"show-filter":e.showFilter}]),role:"search",onClick:D},[u(n,{small:"",name:"search",class:"icon-search",disabled:e.disabled,clickable:!p.value,onClick:a[0]||(a[0]=e=>f.value?.focus())},null,8,["disabled","clickable"]),_("input",{ref_key:"input",ref:f,value:e.modelValue,placeholder:e.placeholder??"Search items…",type:"search",spellcheck:"false",autocapitalize:"off",autocorrect:"off",autocomplete:"off",tabindex:p.value||e.modelValue?void 0:-1,disabled:e.disabled,onInput:P,onPaste:P,onKeydown:w(E,["esc"]),onFocusin:D,onFocusout:L},null,40,yt),a[2]||(a[2]=_("div",{class:"spacer"},null,-1)),e.modelValue?z((i(),s(n,{key:0,small:"",clickable:"",class:"icon-clear",name:"close",disabled:e.disabled,onClick:x(A,["stop"])},null,8,["disabled"])),[[g,"Clear value",void 0,{bottom:!0}]]):b("v-if",!0),e.showFilter?(i(),c(v,{key:1},[z(u(n,{small:"",clickable:"",class:"icon-filter",name:"filter_list",disabled:e.disabled,onClick:N},null,8,["disabled"]),[[g,!e.disabled&&"Filter",void 0,{bottom:!0}]]),z(_("div",{ref_key:"filterElement",ref:S,class:$(["filter",{active:p.value}])},[u(l,{class:"filter-input",inline:"",value:e.filter,"collection-name":e.collection,onInput:a[1]||(a[1]=e=>t.$emit("update:filter",e))},null,8,["value","collection-name"])],2),[[U,m.value]])],64)):b("v-if",!0)],2)),[[h,{handler:E,middleware:B,disabled:!p.value}]])]),_:1},8,["class","value","disabled"])}}});me("\n/* Mirrors upstream search-input.vue styles (logical props → physical where needed). */\n.search-badge[data-v-576fbb1b] {\n\t--v-badge-background-color: var(--theme--primary);\n\t--v-badge-offset-y: 0.4375rem;\n\t--v-badge-offset-x: 0.4375rem;\n}\n@media (width <= 22.5rem) {\n.search-badge.active[data-v-576fbb1b],\n\t.search-badge.filter-active[data-v-576fbb1b] {\n\t\tposition: absolute;\n\t\tinset-inline: 0;\n\t\tz-index: 1;\n\t\tbackground-color: var(--theme--header--background);\n}\n}\n.search-badge[data-v-576fbb1b] .badge {\n\tpointer-events: none;\n}\n.search-input[data-v-576fbb1b] {\n\t--button-size: 2rem;\n\t--search-input-size: calc(var(--button-size) - var(--theme--border-width) * 2);\n\t--search-input-radius: calc(var(--button-size) / 2);\n\t--icon-size: 1rem;\n\t--icon-search-padding-left: 0.375rem;\n\t--icon-search-padding-right: 0.25rem;\n\t--icon-filter-margin-right: 0.4375rem;\n\n\tposition: relative;\n\tbox-sizing: content-box;\n\tdisplay: flex;\n\talign-items: center;\n\twidth: var(--search-input-size);\n\tmin-height: var(--search-input-size);\n\tmax-width: calc(100% - var(--theme--border-width) * 2);\n\toverflow: hidden;\n\tborder: var(--theme--border-width) solid var(--theme--form--field--input--border-color);\n\tborder-radius: var(--search-input-radius);\n\ttransition:\n\t\twidth var(--slow, 300ms) var(--transition, ease-in-out),\n\t\tborder-bottom-left-radius var(--fast, 125ms) var(--transition, ease-in-out),\n\t\tborder-bottom-right-radius var(--fast, 125ms) var(--transition, ease-in-out);\n}\n.search-input.show-filter[data-v-576fbb1b] {\n\twidth: calc(\n\t\tvar(--icon-size) * 2 + var(--icon-search-padding-left) + var(--icon-search-padding-right) +\n\t\t\tvar(--icon-filter-margin-right)\n\t);\n}\n.search-input input[data-v-576fbb1b] {\n\twidth: 0;\n\theight: 100%;\n\tmargin: 0;\n\tpadding: 0;\n\toverflow: hidden;\n\tcolor: var(--theme--foreground);\n\ttext-overflow: ellipsis;\n\tbackground-color: transparent;\n\tborder: none;\n\tborder-radius: 0;\n\tflex-grow: 1;\n\topacity: 0;\n\toutline: none;\n\tfont: inherit;\n}\n.search-input input[data-v-576fbb1b]::placeholder {\n\tcolor: var(--theme--foreground-subdued);\n}\n.search-input.disabled input[data-v-576fbb1b] {\n\tcolor: var(--theme--foreground-subdued);\n}\n.search-input .spacer[data-v-576fbb1b] {\n\twidth: 0.4375rem;\n}\n.search-input .icon-clear[data-v-576fbb1b] {\n\t--v-icon-color: var(--theme--foreground-subdued);\n\t--v-icon-color-hover: var(--theme--danger);\n\tmin-width: auto;\n\toverflow: hidden;\n}\n.search-input .icon-search[data-v-576fbb1b],\n.search-input .icon-filter[data-v-576fbb1b] {\n\t--v-icon-color-hover: var(--theme--primary);\n}\n.search-input.disabled .icon-search[data-v-576fbb1b],\n.search-input.disabled .icon-filter[data-v-576fbb1b] {\n\t--v-icon-color: var(--theme--foreground-subdued);\n}\n.search-input .icon-search[data-v-576fbb1b] {\n\tmargin-block: 0;\n\tmargin-inline: var(--icon-search-padding-left) var(--icon-search-padding-right);\n}\n.search-input .icon-filter[data-v-576fbb1b] {\n\tmargin-inline-end: var(--icon-filter-margin-right);\n}\n.search-input[data-v-576fbb1b]:focus-within,\n.search-input[data-v-576fbb1b]:not(.disabled):not(.active):hover {\n\tborder-color: var(--theme--form--field--input--border-color-hover);\n}\n.search-input.has-content[data-v-576fbb1b] {\n\twidth: 11.25rem;\n}\n.search-input.has-content .icon-clear[data-v-576fbb1b] {\n\tmargin-inline-end: 0.4375rem;\n}\n.search-input.has-content input[data-v-576fbb1b] {\n\topacity: 1;\n}\n.search-input.has-content.show-filter .icon-clear[data-v-576fbb1b] {\n\tmargin-inline-end: 0;\n}\n.search-input.active[data-v-576fbb1b] {\n\twidth: 100%;\n\tborder-color: var(--theme--form--field--input--border-color-focus);\n}\n@media (width > 22.5rem) {\n.search-input.active[data-v-576fbb1b] {\n\t\twidth: 8.4375rem;\n}\n}\n@media (width >= 48rem) {\n.search-input.active[data-v-576fbb1b] {\n\t\twidth: 11.25rem;\n}\n}\n.search-input.active input[data-v-576fbb1b] {\n\topacity: 1;\n}\n.search-input.filter-active[data-v-576fbb1b] {\n\twidth: 100%;\n}\n.search-input.filter-active .icon-filter[data-v-576fbb1b] {\n\t--v-icon-color: var(--theme--primary);\n}\n@media (width > 22.5rem) {\n.search-input.filter-active[data-v-576fbb1b] {\n\t\twidth: 8.4375rem;\n}\n}\n@media (width >= 48rem) {\n.search-input.filter-active[data-v-576fbb1b] {\n\t\twidth: 11.25rem;\n}\n}\n@media (width >= 54rem) {\n.search-input.filter-active[data-v-576fbb1b] {\n\t\twidth: 16.875rem;\n}\n}\n@media (width >= 70.875rem) {\n.search-input.filter-active[data-v-576fbb1b] {\n\t\twidth: 23.625rem;\n}\n}\n.search-input.filter-border[data-v-576fbb1b] {\n\tpadding-block-end: var(--theme--border-width);\n\tborder-block-end: none;\n\tborder-bottom-right-radius: 0;\n\tborder-bottom-left-radius: 0;\n\ttransition:\n\t\tborder-bottom-left-radius 0s,\n\t\tborder-bottom-right-radius 0s;\n}\n.search-input.filter-border[data-v-576fbb1b]::after {\n\tposition: absolute;\n\tinset-inline: var(--theme--border-width) var(--theme--border-width);\n\tbottom: calc(-1 * var(--theme--border-width));\n\twidth: auto;\n\theight: var(--theme--border-width);\n\tbackground-color: var(--theme--border-color-subdued);\n\tcontent: '';\n\tpointer-events: none;\n}\n\n/* Allow the absolute filter panel to paint below the collapsed pill (upstream uses TransitionExpand). */\n.search-input.filter-active[data-v-576fbb1b],\n.search-input.filter-border[data-v-576fbb1b] {\n\toverflow: visible;\n}\n.filter[data-v-576fbb1b] {\n\tposition: absolute;\n\ttop: 100%;\n\tright: 0;\n\tz-index: 10;\n\twidth: auto;\n\tmin-width: 100%;\n\tpadding: 0;\n\tbackground-color: var(--theme--background-subdued);\n\tborder: var(--theme--border-width) solid var(--theme--form--field--input--border-color);\n\tborder-top-right-radius: 0;\n\tborder-bottom-right-radius: var(--search-input-radius);\n\tborder-bottom-left-radius: var(--search-input-radius);\n}\n.filter.active[data-v-576fbb1b] {\n\tborder-color: var(--theme--form--field--input--border-color-focus);\n}\n.filter .filter-input[data-v-576fbb1b] {\n\tmargin: 0.5625rem 0.4375rem;\n}\n",{});var kt=ge(_t,[["__scopeId","data-v-576fbb1b"]]),wt=o({__name:"header-action-button",props:{icon:{},disabled:{type:Boolean},loading:{type:Boolean},secondary:{type:Boolean},outlined:{type:Boolean},to:{},active:{type:Boolean}},emits:["click"],setup:e=>(t,a)=>{const n=r("v-icon"),l=r("v-button");return i(),s(l,{disabled:e.disabled,active:e.active,loading:e.loading,secondary:e.secondary,outlined:e.outlined,to:e.to,icon:"",rounded:"",small:"",onClick:a[0]||(a[0]=e=>t.$emit("click"))},{default:d(()=>[u(n,{name:e.icon,small:""},null,8,["name"])]),_:1},8,["disabled","active","loading","secondary","outlined","to"])}});const xt={class:"layout-options"},St={class:"field"};var Ct=o({__name:"layout-sidebar-detail",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,n=t,o=l({get:()=>a.modelValue??"cards",set(e){n("update:modelValue",e)}}),c=[{text:"Cards",value:"cards",icon:"grid_view"},{text:"Table",value:"tabular",icon:"table_rows"}];return(e,t)=>{const a=r("v-select"),n=r("sidebar-detail");return i(),s(n,{id:"layout",icon:"layers",title:"Layout Options"},{default:d(()=>[_("div",xt,[_("div",St,[t[1]||(t[1]=_("div",{class:"type-label"},"Layout",-1)),u(a,{modelValue:o.value,"onUpdate:modelValue":t[0]||(t[0]=e=>o.value=e),items:c,"item-text":"text","item-value":"value","item-icon":"icon"},null,8,["modelValue"])]),N(e.$slots,"default",{},void 0,!0)])]),_:3})}}});me("\n.layout-options[data-v-65862970] {\n\t--theme--form--row-gap: 1.125rem;\n\tmargin-bottom: 0.25rem;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: var(--theme--form--row-gap);\n}\n.field[data-v-65862970] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n.type-label[data-v-65862970] {\n\tfont-weight: 600;\n\tfont-size: 13px;\n}\n",{});var $t=ge(Ct,[["__scopeId","data-v-65862970"]]);const Ft=n(!1),Mt=n(!1),Vt=n(null),zt=n(0),Bt=n("/storage-manager"),It=M({from:null,to:"",currentIndex:0,totalFiles:0,currentName:"",transferredBytes:0,totalBytes:0,elapsedMs:0,speedBps:0,succeeded:0,skipped:0,failed:0});let Dt=null,Ut=null,Nt={},At=null,Et=null,Lt=null;function Pt(){return Lt}function Ot(e){const t={"Content-Type":"application/json",Accept:"text/event-stream"},a=e?.defaults?.headers,n=a?.common?.Authorization||a?.Authorization||a?.common?.authorization||a?.authorization;return"string"==typeof n&&n&&(t.Authorization=n),t}function jt(e){"start"===e.type?(It.from=e.from||It.from,It.to=e.to,It.totalFiles=e.total,It.totalBytes=e.total_bytes,It.currentIndex=0,It.currentName="",It.transferredBytes=0,It.elapsedMs=0,It.speedBps=0,It.succeeded=0,It.skipped=0,It.failed=0):"file_start"===e.type?(It.currentIndex=e.index,It.totalFiles=e.total,It.currentName=e.name||e.filename_disk,It.from||(It.from=e.from),It.to=e.to):"file_bytes"===e.type?(It.currentIndex=e.index,It.transferredBytes=e.transferred_bytes,It.totalBytes=e.total_bytes||It.totalBytes,It.elapsedMs=e.elapsed_ms,It.speedBps=e.elapsed_ms>0?1e3*e.transferred_bytes/e.elapsed_ms:0):"file_done"===e.type?(It.currentIndex=e.index,It.totalFiles=e.total,It.currentName=e.name||e.result.filename_disk,It.succeeded=e.succeeded,It.skipped=e.skipped,It.failed=e.failed,It.transferredBytes=e.transferred_bytes,It.totalBytes=e.total_bytes||It.totalBytes,It.elapsedMs=e.elapsed_ms,It.speedBps=e.elapsed_ms>0?1e3*e.transferred_bytes/e.elapsed_ms:0):"done"===e.type&&(It.succeeded=e.data.succeeded,It.skipped=e.data.skipped,It.failed=e.data.failed,It.transferredBytes=e.data.transferred_bytes??It.transferredBytes,It.totalBytes=e.data.total_bytes??It.totalBytes,It.elapsedMs=e.data.elapsed_ms??It.elapsedMs,It.totalFiles=e.data.total,It.currentIndex=e.data.total,It.speedBps=It.elapsedMs>0?1e3*It.transferredBytes/It.elapsedMs:0),Nt.onProgress?.(e),Mt.value&&function(){if(!Ut)return;const e=Pt();if(!e)return;e.update(Ut,{title:Rt(),text:It.currentName?`${It.currentName} · click for details`:`${Ue(It.transferredBytes)}${It.totalBytes?` / ${Ue(It.totalBytes)}`:""} · click for details`,loading:0===It.totalFiles,progress:0===It.totalFiles?void 0:Tt(),type:"info",persist:!0,closeable:!0,alwaysShowText:!0,icon:"swap_horiz",dismissText:"Details",dismissIcon:"open_in_new",dismissAction:()=>{qt()}})}()}function Tt(){return It.totalBytes>0?Math.min(100,Math.round(It.transferredBytes/It.totalBytes*100)):It.totalFiles>0?Math.min(100,Math.round(It.currentIndex/It.totalFiles*100)):0}function Rt(){const e="copy"===At?.mode?"Copying":"Moving",t=It.to||At?.target_storage||"…",a=It.from?`${It.from} → `:"";if(!It.totalFiles)return`${e} files to ${t}…`;return`${e} ${Math.min(It.currentIndex||0,It.totalFiles)}/${It.totalFiles} · ${a}${t}`}function qt(){Ut=null,Mt.value=!1,zt.value+=1,Et?.()}function Kt(e,t,a){const n=Pt();n&&(Ut&&(n.remove(Ut),Ut=null),n.add({title:t,text:a,type:"warning"===e?"warning":e,icon:"success"===e?"check_circle":"warning"===e?"cancel":"error",persist:!1,closeable:!0}))}function Jt(){const a=e();if(!Lt)try{const{useNotificationsStore:e}=t();Lt=e?.()??null}catch{Lt=null}const n=l(()=>Ft.value);function o(){Nt={}}return{running:Ft,backgrounded:Mt,result:Vt,progress:It,reopenNonce:zt,returnToPath:Bt,activeMode:l(()=>At?.mode??null),activeTarget:l(()=>At?.target_storage??null),isBusy:n,start:async function(e,t){if(Ft.value)throw new Error("A migration is already running");At=e,Ft.value=!0,Mt.value=!1,Vt.value=null,Dt=new AbortController,t?.listener&&(Nt=t.listener),function(e="",t=0,a=0,n=null){It.from=n,It.to=e,It.currentIndex=0,It.totalFiles=t,It.currentName="",It.transferredBytes=0,It.totalBytes=a,It.elapsedMs=0,It.speedBps=0,It.succeeded=0,It.skipped=0,It.failed=0}(e.target_storage,t?.estimatedCount??e.file_ids?.length??0,t?.estimatedBytes||0,t?.sourceStorage||e.source_storage||null);try{const t=await fetch(function(e){const t=String(e?.defaults?.baseURL||"").replace(/\/$/,""),a="/storage-manager/migrate/stream";return t?`${t}${a}`:a}(a),{method:"POST",headers:Ot(a),body:JSON.stringify(e),credentials:"same-origin",signal:Dt.signal}),n=await async function(e,t){if(!e.ok){let t=`Move failed (${e.status})`;try{const a=await e.json();t=a?.errors?.[0]?.message||t}catch{}throw new Error(t)}if(!e.body)throw new Error("No response body for progress stream");const a=e.body.getReader(),n=new TextDecoder;let l="",o=null;for(;;){const{done:e,value:r}=await a.read();if(e)break;l+=n.decode(r,{stream:!0});const i=l.split("\n\n");l=i.pop()||"";for(const e of i)for(const a of e.split("\n")){const e=a.trim();if(!e.startsWith("data:"))continue;const n=e.slice(5).trim();if(!n)continue;let l;try{l=JSON.parse(n)}catch{continue}if(t(l),"done"===l.type&&(o=l.data),"error"===l.type)throw new Error(l.message||"Move failed")}}if(!o)throw new Error("Move stream ended without a result");return o}(t,jt);return Vt.value=n,Mt.value&&Kt(n.failed?"warning":"success",n.failed?`Move finished with ${n.failed} failure(s)`:`Move complete · ${n.succeeded} file(s)`,`${"copy"===e.mode?"Copied":"Moved"} to ${e.target_storage}`),Nt.onDone?.(n),n}catch(t){if("AbortError"===t?.name){const t=(n=e.mode,l=e.target_storage,{mode:n,target_storage:l,total:It.totalFiles,succeeded:It.succeeded,skipped:It.skipped,failed:It.failed,results:[],transferred_bytes:It.transferredBytes,total_bytes:It.totalBytes,elapsed_ms:It.elapsedMs,cancelled:!0});return Vt.value=t,Mt.value&&Kt("warning","Move cancelled",`${It.succeeded} file(s) completed before cancel`),Nt.onCancel?.(t),t}const a=t?.message||"Move failed";throw Mt.value&&Kt("error","Move failed",a),Nt.onError?.(t instanceof Error?t:new Error(a)),t}finally{if(Ft.value=!1,Mt.value=!1,Dt=null,At=null,Ut){const e=Pt();e?.remove(Ut),Ut=null}}var n,l},runInBackground:function(e){if(!Ft.value||Mt.value)return!1;Mt.value=!0,o(),e?.returnTo&&(Bt.value=e.returnTo),Et=e?.navigate||null;const t=Pt();return t&&!Ut&&(Ut=t.add({title:Rt(),text:"Click for details — move continues in the background.",type:"info",persist:!0,closeable:!0,alwaysShowText:!0,loading:0===It.totalFiles,progress:0===It.totalFiles?void 0:Tt(),icon:"swap_horiz",dismissText:"Details",dismissIcon:"open_in_new",dismissAction:()=>{qt()}})),!0},attachForeground:function(e){if(Mt.value=!1,e&&(Nt=e),Ut){const e=Pt();e?.remove(Ut),Ut=null}},cancel:function(){Dt?.abort()},clearLastResult:function(){Vt.value=null},setListeners:function(e){Nt=e},clearListeners:o}}const Wt={class:"progress-panel"},Ht={class:"route"},Qt={class:"adapter"},Gt={class:"adapter"},Yt={class:"file-line"},Xt={class:"file-count"},Zt=["title"],ea={class:"bar-wrap"},ta={class:"bar-track"},aa={class:"bar-meta"},na={class:"stats"},la={class:"stat"},oa={class:"stat-value"},ra={class:"stat"},ia={class:"stat-value"},sa={class:"stat"},da={class:"stat-value"},ua={class:"counts"},ca={class:"ok"},va={class:"skip"},fa={class:"fail"};var pa=o({__name:"migrate-progress",props:{storages:{},mode:{},from:{},to:{},currentIndex:{},totalFiles:{},currentName:{},transferredBytes:{},totalBytes:{},elapsedMs:{},speedBps:{},succeeded:{},skipped:{},failed:{},isDone:{type:Boolean},isCancelled:{type:Boolean}},setup(e){const t=e;function a(e){if(!e)return{short:"—",icon:"storage"};return t.storages.find(t=>t.location===e)||{short:e,icon:"storage",location:e}}const n=l(()=>a(t.from)),o=l(()=>a(t.to)),s=l(()=>t.from?`${t.from} (${n.value.short})`:"Mixed sources"),v=l(()=>`${t.to} (${o.value.short})`),f=l(()=>n.value.icon),g=l(()=>o.value.icon),h=l(()=>"copy"===t.mode?"Copy":"Move"),b=l(()=>t.totalBytes>0?Math.max(0,Math.min(100,t.transferredBytes/t.totalBytes*100)):t.totalFiles>0?Math.max(0,Math.min(100,t.currentIndex/t.totalFiles*100)):0),y=l(()=>Math.round(b.value)),k=l(()=>t.isDone?t.isCancelled?"Cancelled":t.failed>0?"Completed with errors":"Completed":"Moving");return(t,a)=>{const n=r("v-icon"),l=r("v-chip");return i(),c("div",Wt,[_("div",Ht,[_("div",Qt,[u(n,{name:f.value},null,8,["name"]),_("span",null,m(s.value),1)]),u(n,{class:"arrow",name:"arrow_forward"}),_("div",Gt,[u(n,{name:g.value},null,8,["name"]),_("span",null,m(v.value),1)]),u(l,{"x-small":"",class:"mode-chip"},{default:d(()=>[p(m(h.value),1)]),_:1})]),_("div",Yt,[_("span",Xt,"File "+m(e.currentIndex)+" / "+m(e.totalFiles),1),_("span",{class:"file-name",title:e.currentName},m(e.currentName||"Preparing…"),9,Zt)]),_("div",ea,[_("div",ta,[_("div",{class:"bar-fill",style:F({width:`${b.value}%`})},null,4)]),_("div",aa,[_("strong",null,m(y.value)+"%",1),_("span",null,m(S(Ue)(e.transferredBytes))+" / "+m(S(Ue)(e.totalBytes)),1)])]),_("div",na,[_("div",la,[a[0]||(a[0]=_("span",{class:"stat-label"},"Speed",-1)),_("span",oa,m(S(Ne)(e.speedBps)),1)]),_("div",ra,[a[1]||(a[1]=_("span",{class:"stat-label"},"Elapsed",-1)),_("span",ia,m(S(Ae)(e.elapsedMs)),1)]),_("div",sa,[a[2]||(a[2]=_("span",{class:"stat-label"},"Status",-1)),_("span",da,m(k.value),1)])]),_("div",ua,[_("span",ca,m(e.succeeded)+" Ok",1),_("span",va,m(e.skipped)+" Skipped",1),_("span",fa,m(e.failed)+" Failed",1)])])}}});me("\n.progress-panel[data-v-49e3abe7] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 14px;\n\tpadding: 16px;\n\tborder-radius: var(--theme--border-radius);\n\tborder: var(--theme--border-width) solid var(--theme--border-color);\n\tbackground: var(--theme--background-subdued);\n}\n.route[data-v-49e3abe7] {\n\tdisplay: flex;\n\talign-items: center;\n\tflex-wrap: wrap;\n\tgap: 10px;\n}\n.adapter[data-v-49e3abe7] {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 6px;\n\tfont-weight: 600;\n}\n.arrow[data-v-49e3abe7] {\n\tcolor: var(--theme--foreground-subdued);\n}\n.mode-chip[data-v-49e3abe7] {\n\tmargin-left: auto;\n}\n.file-line[data-v-49e3abe7] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n\tmin-width: 0;\n}\n.file-count[data-v-49e3abe7] {\n\tfont-size: 12px;\n\tfont-weight: 700;\n\tletter-spacing: 0.02em;\n\ttext-transform: uppercase;\n\tcolor: var(--theme--foreground-subdued);\n}\n.file-name[data-v-49e3abe7] {\n\tfont-size: 14px;\n\tfont-weight: 600;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n.bar-wrap[data-v-49e3abe7] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n}\n.bar-track[data-v-49e3abe7] {\n\theight: 10px;\n\tborder-radius: 999px;\n\tbackground: var(--theme--background-normal);\n\toverflow: hidden;\n}\n.bar-fill[data-v-49e3abe7] {\n\theight: 100%;\n\tborder-radius: inherit;\n\tbackground: var(--theme--primary);\n\ttransition: width 160ms ease;\n}\n.bar-meta[data-v-49e3abe7] {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\tgap: 12px;\n\tfont-size: 13px;\n}\n.stats[data-v-49e3abe7] {\n\tdisplay: grid;\n\tgrid-template-columns: repeat(3, minmax(0, 1fr));\n\tgap: 8px;\n}\n.stat[data-v-49e3abe7] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2px;\n\tpadding: 8px 10px;\n\tborder-radius: var(--theme--border-radius);\n\tbackground: var(--theme--background);\n}\n.stat-label[data-v-49e3abe7] {\n\tfont-size: 11px;\n\ttext-transform: uppercase;\n\tletter-spacing: 0.03em;\n\tcolor: var(--theme--foreground-subdued);\n}\n.stat-value[data-v-49e3abe7] {\n\tfont-weight: 700;\n\tfont-variant-numeric: tabular-nums;\n}\n.counts[data-v-49e3abe7] {\n\tdisplay: flex;\n\tgap: 12px;\n\tfont-size: 12px;\n\tcolor: var(--theme--foreground-subdued);\n}\n.counts .ok[data-v-49e3abe7] {\n\tcolor: var(--theme--success);\n}\n.counts .fail[data-v-49e3abe7] {\n\tcolor: var(--theme--danger);\n}\n",{});var ma=ge(pa,[["__scopeId","data-v-49e3abe7"]]);const ga={class:"drawer-body"},ha={class:"intro"},ba={key:0,class:"description"},ya={class:"field"},_a={key:0,class:"field"},ka={key:1,class:"field"},wa={class:"dry-run-row"},xa={key:0,class:"dry-run-result"},Sa={key:0},Ca={key:1,class:"dry-run-note"},$a={key:2},Fa={class:"dry-run-note"},Ma={key:1,class:"note"},Va={key:5,class:"background-actions"},za={key:6,class:"result"},Ba={key:0},Ia={key:2,class:"failures"};var Da=o({__name:"migrate-drawer",props:{modelValue:{type:Boolean},storages:{},sourceStorage:{},selectionKind:{},fileIds:{},folderId:{},sourcePath:{},estimatedCount:{},estimatedBytes:{}},emits:["update:modelValue","done"],setup(t,{emit:a}){const o=t,h=a,y=e(),k=R(),w=T(),{running:x,backgrounded:C,progress:$,result:F,activeMode:M,activeTarget:B,start:I,runInBackground:D,attachForeground:U,cancel:N,clearListeners:A,clearLastResult:E}=Jt(),L=n(null),P=n("move"),O=n(!0),j=n(!0),q=n(null),K=n(!1),J=n(null),W=n(!1),H=l(()=>x.value&&!W.value&&!C.value&&!o.modelValue),Q=l(()=>Boolean(L.value)&&!x.value);function G(e){q.value=e,W.value=!1,e.mode&&(P.value=e.mode),e.target_storage&&(L.value=e.target_storage)}async function Y(){if(L.value&&!K.value){K.value=!0,J.value=null;try{const e={target_storage:L.value,include_empty_folders:j.value};"files"===o.selectionKind?e.file_ids=o.fileIds||[]:"storage"===o.selectionKind?e.source_storage=o.sourceStorage||void 0:"storage_path"===o.selectionKind?(e.source_storage=o.sourceStorage||void 0,e.source_path=o.sourcePath||void 0,e.recursive=O.value):"folder"===o.selectionKind&&(e.folder_id=o.folderId??null,e.recursive=O.value,o.sourceStorage&&(e.source_storage=o.sourceStorage));const t=await y.post("/storage-manager/migrate/dry-run",e);J.value=t.data?.data??null}catch{}finally{K.value=!1}}}g(L,()=>{J.value=null}),g(()=>o.modelValue,e=>{if(e)return x.value?(U({onDone:e=>{q.value=e,W.value=!1,h("done",e)},onCancel:e=>{q.value=e,W.value=!1},onError:e=>{q.value={mode:M.value||P.value,target_storage:B.value||L.value||"",total:$.totalFiles,succeeded:$.succeeded,skipped:$.skipped,failed:Math.max(1,$.failed),results:[{id:"",filename_disk:"",from:$.from||"",to:B.value||L.value||"",status:"failed",error:e.message||"Move failed"}],transferred_bytes:$.transferredBytes,total_bytes:$.totalBytes,elapsed_ms:$.elapsedMs},W.value=!1}}),W.value=!0,M.value&&(P.value=M.value),B.value&&(L.value=B.value),void(F.value&&(q.value=F.value))):void(F.value?G(F.value):function(){q.value=null,J.value=null,W.value=!1;const e=o.storages.find(e=>e.location!==o.sourceStorage);L.value=e?.location||null,P.value="move",O.value=!0,j.value=!0}())}),g(F,e=>{o.modelValue&&e&&!x.value&&G(e)}),g(x,(e,t)=>{o.modelValue&&t&&!e&&F.value&&G(F.value)});const X=l(()=>o.storages.filter(e=>e.location!==o.sourceStorage).map(e=>({text:`${e.location} (${e.short})`,value:e.location}))),Z=l(()=>"Move"),ee=l(()=>{const e=q.value?.total??(x.value&&$.totalFiles>0?$.totalFiles:null)??o.estimatedCount??o.fileIds?.length??0,t=q.value?.total_bytes??(x.value&&$.totalBytes>0?$.totalBytes:null)??o.estimatedBytes,a=null!=t?` (${Ue(t)})`:"",n=Boolean(q.value);if("storage"===o.selectionKind)return n?`Moved ${e.toLocaleString()} files${a} from “${o.sourceStorage}”.`:`Move all ${e.toLocaleString()} files${a} on “${o.sourceStorage}”.`;if("storage_path"===o.selectionKind){const t=o.sourcePath||"this folder";return n?`Moved ${e.toLocaleString()} files${a} from “${t}”.`:null==o.estimatedCount?`Move all files in “${t}”${a}.`:`Move ${e.toLocaleString()} files${a} in “${t}”.`}if("folder"===o.selectionKind){const t=o.folderId?"in this folder":"at the root (files with no virtual folder)";return n?o.folderId?`Moved ${e.toLocaleString()} files${a} from this folder.`:`Moved ${e.toLocaleString()} root files${a}.`:null==o.estimatedCount?o.folderId?`Move all files ${t}${a}.`:`Move all root files${a} (files with no virtual folder).`:`Move ${e.toLocaleString()} files${a} ${t}.`}return n?`Moved ${e.toLocaleString()} selected file(s)${a}.`:`Move ${e.toLocaleString()} selected file(s)${a}.`}),te=l(()=>{if("storage"===o.selectionKind)return`Every file currently stored on "${o.sourceStorage}" will be moved to the target storage. The file record in Directus is updated to point to the new location — no data is lost. Generated thumbnails are moved as well. Physical files are deleted from "${o.sourceStorage}" once safely copied. Empty folders can be included so the destination tree matches the source.`;if("storage_path"===o.selectionKind){return`All files under "${o.sourcePath||"this path"}" on "${o.sourceStorage}" will be moved to the target storage. File records in Directus are updated automatically. Generated thumbnails are moved as well. Physical files are removed from the source path once copied.`}return"folder"===o.selectionKind?"Files in the selected Directus folder will be moved to the target storage. File records in Directus are updated automatically. Generated thumbnails are moved as well. Physical files are deleted from the source storage once copied.":"The selected files will be moved to the target storage. File records in Directus are updated automatically. Generated thumbnails are moved as well. Physical files are deleted from the source once copied."}),ae=l(()=>(q.value?.results||[]).filter(e=>"failed"===e.status));function ne(e){e||!x.value||!W.value||C.value?h("update:modelValue",e):ie()}function le(){x.value&&W.value&&!C.value?ie():h("update:modelValue",!1)}function oe(){N()}function re(){E(),q.value=null,h("update:modelValue",!1)}function ie(){const e=k.path.startsWith("/storage-manager")?k.path:"/storage-manager";D({returnTo:e,navigate:()=>{w.push({path:e,query:{...k.query,migrateJob:"1"}})}})&&(W.value=!1,h("update:modelValue",!1))}async function se(){if(!L.value||x.value)return;q.value=null,W.value=!0;const e={target_storage:L.value,mode:P.value,keep_source_file_on_disk:!1,concurrency:1,file_ids:void 0,source_storage:void 0,source_path:void 0,folder_id:void 0,recursive:void 0,include_empty_folders:j.value};"files"===o.selectionKind?e.file_ids=o.fileIds||[]:"storage"===o.selectionKind?e.source_storage=o.sourceStorage||void 0:"storage_path"===o.selectionKind?(e.source_storage=o.sourceStorage||void 0,e.source_path=o.sourcePath||void 0,e.recursive=O.value):"folder"===o.selectionKind&&(e.folder_id=o.folderId??null,e.recursive=O.value,o.sourceStorage&&(e.source_storage=o.sourceStorage));try{await I(e,{estimatedCount:o.estimatedCount||o.fileIds?.length||0,estimatedBytes:o.estimatedBytes,sourceStorage:o.sourceStorage,listener:{onDone:e=>{W.value&&(q.value=e,h("done",e))},onCancel:e=>{W.value&&(q.value=e)},onError:e=>{W.value&&(q.value={mode:P.value,target_storage:L.value,total:$.totalFiles,succeeded:$.succeeded,skipped:$.skipped,failed:Math.max(1,$.failed),results:[{id:"",filename_disk:"",from:$.from||"",to:L.value,status:"failed",error:e.message||"Move failed"}],transferred_bytes:$.transferredBytes,total_bytes:$.totalBytes,elapsed_ms:$.elapsedMs})}}})}catch{}finally{W.value=!1,A()}}return(e,a)=>{const n=r("v-icon"),l=r("v-button"),o=r("v-notice"),g=r("v-select"),h=r("v-checkbox"),y=r("v-drawer"),k=V("tooltip");return i(),s(y,{"model-value":t.modelValue,title:"Move Files",icon:"swap_horiz",persistent:"","onUpdate:modelValue":ne,onCancel:le},{actions:d(()=>[S(x)||q.value?b("v-if",!0):z((i(),s(l,{key:0,disabled:!Q.value,icon:"",rounded:"",onClick:se},{default:d(()=>[u(n,{name:"check"})]),_:1},8,["disabled"])),[[k,Z.value,void 0,{bottom:!0}]])]),default:d(()=>[_("div",ga,[_("p",ha,m(ee.value),1),S(x)||q.value?b("v-if",!0):(i(),c("p",ba,m(te.value),1)),S(x)&&S(C)?(i(),s(o,{key:1,type:"info"},{default:d(()=>[...a[3]||(a[3]=[p(" Move continues in the background. You can close this drawer and navigate elsewhere in Studio. ",-1)])]),_:1})):H.value?(i(),s(o,{key:2,type:"warning"},{default:d(()=>[...a[4]||(a[4]=[p(" Another move is already running in the background. Wait for it to finish or cancel it from the progress toast. ",-1)])]),_:1})):b("v-if",!0),S(x)||q.value?b("v-if",!0):(i(),c(v,{key:3},[_("div",ya,[a[5]||(a[5]=_("label",null,"Target Storage",-1)),u(g,{modelValue:L.value,"onUpdate:modelValue":a[0]||(a[0]=e=>L.value=e),items:X.value,"item-text":"text","item-value":"value",placeholder:"Select target…"},null,8,["modelValue","items"])]),"folder"===t.selectionKind&&t.folderId||"storage_path"===t.selectionKind?(i(),c("div",_a,[u(h,{modelValue:O.value,"onUpdate:modelValue":a[1]||(a[1]=e=>O.value=e),label:"Include files in subfolders"},null,8,["modelValue"])])):b("v-if",!0),"storage"===t.selectionKind||"storage_path"===t.selectionKind?(i(),c("div",ka,[u(h,{modelValue:j.value,"onUpdate:modelValue":a[2]||(a[2]=e=>j.value=e),label:"Include empty folders"},null,8,["modelValue"])])):b("v-if",!0),_("div",wa,[u(l,{secondary:"",loading:K.value,disabled:!Q.value,onClick:Y},{default:d(()=>[...a[6]||(a[6]=[p(" Dry Run ",-1)])]),_:1},8,["loading","disabled"]),u(l,{disabled:!Q.value,onClick:se},{default:d(()=>[...a[7]||(a[7]=[p("Run",-1)])]),_:1},8,["disabled"]),J.value?(i(),c("div",xa,[_("span",null,m(J.value.total_files.toLocaleString())+" files",1),J.value.total_folders?(i(),c("span",Sa," · "+m(J.value.total_folders.toLocaleString())+" "+m(1===J.value.total_folders?"folder":"folders"),1)):b("v-if",!0),J.value.empty_folders?(i(),c("span",Ca," ("+m(J.value.empty_folders.toLocaleString())+" empty"+m(j.value?"":", skipped")+") ",1)):b("v-if",!0),J.value.total_bytes?(i(),c("span",$a,"· "+m(S(Ue)(J.value.total_bytes)),1)):b("v-if",!0),_("span",Fa,"will be moved to "+m(L.value),1)])):(i(),c("p",Ma," Count files, folders, and total size without moving anything. "))])],64)),S(x)&&!S(C)||q.value?(i(),s(ma,{key:4,storages:t.storages,mode:P.value,from:S($).from,to:S($).to,"current-index":S($).currentIndex,"total-files":S($).totalFiles,"current-name":S($).currentName,"transferred-bytes":S($).transferredBytes,"total-bytes":S($).totalBytes,"elapsed-ms":S($).elapsedMs,"speed-bps":S($).speedBps,succeeded:S($).succeeded,skipped:S($).skipped,failed:S($).failed,"is-done":Boolean(q.value)&&!S(x),"is-cancelled":Boolean(q.value?.cancelled)},null,8,["storages","mode","from","to","current-index","total-files","current-name","transferred-bytes","total-bytes","elapsed-ms","speed-bps","succeeded","skipped","failed","is-done","is-cancelled"])):b("v-if",!0),S(x)&&!S(C)?(i(),c("div",Va,[u(l,{secondary:"",class:"background-btn",onClick:ie},{default:d(()=>[...a[8]||(a[8]=[p(" Run in Background ",-1)])]),_:1}),u(l,{kind:"danger",secondary:"",class:"background-btn",onClick:oe},{default:d(()=>[...a[9]||(a[9]=[p(" Cancel Move ",-1)])]),_:1}),a[10]||(a[10]=_("p",{class:"note"}," Closing this drawer also runs in the background. Click the progress toast anytime for details. ",-1))])):b("v-if",!0),q.value?(i(),c("div",za,[q.value.cancelled?(i(),s(o,{key:0,type:"warning",icon:"cancel"},{default:d(()=>[p(" Move cancelled. "+m(q.value.succeeded.toLocaleString())+" file(s) finished before stop ",1),q.value.total?(i(),c("span",Ba," (of "+m(q.value.total.toLocaleString())+" planned)",1)):b("v-if",!0),a[11]||(a[11]=p(". ",-1))]),_:1})):(i(),s(o,{key:1,type:q.value.failed?"danger":"success"},{default:d(()=>[p(m(q.value.succeeded)+" succeeded · "+m(q.value.skipped)+" skipped · "+m(q.value.failed)+" failed (of "+m(q.value.total)+") ",1)]),_:1},8,["type"])),!q.value.cancelled&&ae.value.length?(i(),c("div",Ia,[(i(!0),c(v,null,f(ae.value.slice(0,20),e=>(i(),c("div",{key:e.id,class:"fail-row"},[_("strong",null,m(e.filename_disk||e.id),1),_("span",null,m(e.error),1)]))),128))])):b("v-if",!0),u(l,{secondary:"",class:"background-btn",onClick:re},{default:d(()=>[...a[12]||(a[12]=[p("Done",-1)])]),_:1})])):b("v-if",!0)])]),_:1},8,["model-value"])}}});me("\n.drawer-body[data-v-38d7930e] {\n\tpadding: 20px 24px 32px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 18px;\n}\n.intro[data-v-38d7930e] {\n\tmargin: 0;\n\tcolor: var(--theme--foreground);\n}\n.description[data-v-38d7930e] {\n\tmargin: 0;\n\tfont-size: 14px;\n\tcolor: var(--theme--foreground-subdued);\n\tline-height: 1.5;\n}\n.field[data-v-38d7930e] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n.field label[data-v-38d7930e] {\n\tfont-weight: 600;\n}\n.mode-radios[data-v-38d7930e] {\n\tdisplay: grid;\n\tgrid-template-columns: 1fr 1fr;\n\tgap: 10px;\n}\n.mode-radios[data-v-38d7930e] .v-radio.block {\n\twidth: 100%;\n\tmargin: 0;\n}\n.note[data-v-38d7930e] {\n\tmargin: 0;\n\tfont-size: 12px;\n\tcolor: var(--theme--foreground-subdued);\n}\n.background-actions[data-v-38d7930e] {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tgap: 8px;\n}\n.background-actions .note[data-v-38d7930e] {\n\tflex: 1 1 100%;\n}\n.result .background-btn[data-v-38d7930e] {\n\talign-self: flex-start;\n}\n.dry-run-row[data-v-38d7930e] {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 12px;\n\tflex-wrap: wrap;\n}\n.dry-run-result[data-v-38d7930e] {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 6px;\n\tfont-size: 14px;\n\tfont-weight: 600;\n}\n.dry-run-note[data-v-38d7930e] {\n\tfont-weight: 400;\n\tcolor: var(--theme--foreground-subdued);\n}\n.result[data-v-38d7930e] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n}\n.failures[data-v-38d7930e] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n\tmax-height: 240px;\n\toverflow: auto;\n\tpadding: 8px 0;\n}\n.fail-row[data-v-38d7930e] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2px;\n\tfont-size: 12px;\n\tpadding: 8px 10px;\n\tbackground: var(--theme--background-subdued);\n\tborder-radius: var(--theme--border-radius);\n}\n.fail-row span[data-v-38d7930e] {\n\tcolor: var(--theme--danger);\n}\n",{});var Ua=ge(Da,[["__scopeId","data-v-38d7930e"]]);const Na={class:"body"},Aa={class:"intro"},Ea={class:"toolbar"},La={key:0,class:"meta"},Pa={key:1,class:"loading"},Oa={key:2,class:"error"},ja={key:3,class:"empty"},Ta={key:4,class:"table-wrap"},Ra={class:"check-col"},qa={class:"check-col"},Ka=["title"];var Ja=o({__name:"import-orphans-drawer",props:{modelValue:{type:Boolean},location:{},storagePath:{}},emits:["update:modelValue","imported"],setup(t,{emit:a}){const o=t,h=a,y=e(),k=n(!1),w=n(!1),x=n(!1),C=n(!1),F=n(!1),M=n(!1),B=n(null),I=n([]),D=n([]),U=n(null),N=n(null),A=n(null),E=l(()=>String(o.storagePath||"").replace(/\\/g,"/").replace(/^\/+|\/+$/g,"").replace(/\/+/g,"/")||""),L=l(()=>E.value?"Detect Files in this Folder":`Detect Files on ${o.location}`),P=l(()=>I.value.length>0&&D.value.length===I.value.length);function O(){C.value=!1,F.value=!1,h("update:modelValue",!1)}function j(e){D.value=e?I.value.map(e=>e.filename_disk):[]}function T(){!I.value.length||w.value||x.value||(C.value=!0)}function R(){!D.value.length||w.value||x.value||(F.value=!0)}async function q(){if(o.location){k.value=!0,B.value=null;try{const e=await y.get(`/storage-manager/storages/${encodeURIComponent(o.location)}/orphans`,{params:E.value?{path:E.value}:void 0});I.value=e.data?.data||[],U.value=e.data?.meta||null,M.value=!0,D.value=[]}catch(e){B.value=e?.response?.data?.errors?.[0]?.message||e?.message||String(e),I.value=[],U.value=null}finally{k.value=!1}}}async function K(){if(I.value.length){w.value=!0,B.value=null;try{const e=await y.post(`/storage-manager/storages/${encodeURIComponent(o.location)}/import-orphans`,{filename_disks:I.value.map(e=>e.filename_disk)}),t=e.data?.data;N.value={imported:Number(t?.imported||0),skipped:Number(t?.skipped||0),failed:Number(t?.failed||0)},C.value=!1,h("imported"),await q()}catch(e){B.value=e?.response?.data?.errors?.[0]?.message||e?.message||String(e),C.value=!1}finally{w.value=!1}}}async function J(){if(!D.value.length)return;x.value=!0,B.value=null;const e=[...D.value];try{const t=await y.post(`/storage-manager/storages/${encodeURIComponent(o.location)}/delete-orphans`,{filename_disks:e}),a=t.data?.data;A.value={deleted:Number(a?.deleted||0),skipped:Number(a?.skipped||0),failed:Number(a?.failed||0)},N.value=null,F.value=!1,h("imported"),await q()}catch(e){B.value=e?.response?.data?.errors?.[0]?.message||e?.message||String(e),F.value=!1}finally{x.value=!1}}return g(()=>o.modelValue,e=>{e&&(N.value=null,A.value=null,B.value=null,C.value=!1,F.value=!1,q())}),(e,a)=>{const n=r("v-icon"),l=r("v-button"),o=r("v-progress-circular"),g=r("v-checkbox"),h=r("v-drawer"),y=r("v-card-title"),W=r("v-card-text"),H=r("v-card-actions"),Q=r("v-card"),G=r("v-dialog"),Y=V("tooltip");return i(),c(v,null,[u(h,{"model-value":t.modelValue,title:L.value,icon:"folder_off","onUpdate:modelValue":a[0]||(a[0]=t=>e.$emit("update:modelValue",t)),onCancel:O},{actions:d(()=>[D.value.length?z((i(),s(l,{key:0,icon:"",rounded:"",secondary:"",disabled:x.value||k.value,loading:x.value,onClick:R},{default:d(()=>[u(n,{name:"delete"})]),_:1},8,["disabled","loading"])),[[Y,"Delete Selected from Storage",void 0,{bottom:!0}]]):b("v-if",!0),z((i(),s(l,{icon:"",rounded:"",disabled:!I.value.length||w.value||k.value||x.value,loading:w.value,onClick:T},{default:d(()=>[u(n,{name:"download"})]),_:1},8,["disabled","loading"])),[[Y,"Import All Unknown Files",void 0,{bottom:!0}]])]),default:d(()=>[_("div",Na,[_("p",Aa,[E.value?(i(),c(v,{key:0},[a[7]||(a[7]=p(" Finds files under ",-1)),_("strong",null,m(E.value),1),a[8]||(a[8]=p(" on ",-1)),_("strong",null,m(t.location),1),a[9]||(a[9]=p(" that aren’t registered in Directus yet. ",-1))],64)):(i(),c(v,{key:1},[a[10]||(a[10]=p(" Finds files on ",-1)),_("strong",null,m(t.location),1),a[11]||(a[11]=p(" that aren’t registered in Directus yet. ",-1))],64)),a[12]||(a[12]=p(" Import only creates database rows — nothing is copied. Titles come from the filename (underscores become spaces). You can delete selected unknown files from storage. Generated thumbnails are excluded. ",-1))]),_("div",Ea,[u(l,{secondary:"",loading:k.value,disabled:x.value,onClick:q},{default:d(()=>[u(n,{name:"radar",left:""}),p(" "+m(E.value?"Scan Folder":"Scan Storage"),1)]),_:1},8,["loading","disabled"]),u(l,{disabled:!I.value.length||w.value||k.value||x.value,loading:w.value,onClick:T},{default:d(()=>[p(" Import "+m(I.value.length||"")+" New File"+m(1===I.value.length?"":"s"),1)]),_:1},8,["disabled","loading"]),u(l,{secondary:"",disabled:!D.value.length||w.value||k.value||x.value,loading:x.value,onClick:R},{default:d(()=>[u(n,{name:"delete",left:""}),p(" Delete Selected ("+m(D.value.length)+") ",1)]),_:1},8,["disabled","loading"])]),U.value?(i(),c("p",La," Scanned "+m(U.value.scanned.toLocaleString())+" objects · "+m(U.value.known.toLocaleString())+" already in DB · "+m(U.value.orphan_count.toLocaleString())+" unknown ",1)):b("v-if",!0),k.value?(i(),c("div",Pa,[u(o,{indeterminate:""}),a[13]||(a[13]=_("span",null,"Listing storage…",-1))])):B.value?(i(),c("p",Oa,m(B.value),1)):M.value&&!I.value.length?(i(),c("p",ja,[E.value?(i(),c(v,{key:0},[p(" No unknown files in this folder. Everything here is already in the database. ")],64)):(i(),c(v,{key:1},[p(" No unknown files on this storage. Everything here is already in the database. ")],64))])):I.value.length?(i(),c("div",Ta,[_("table",null,[_("thead",null,[_("tr",null,[_("th",Ra,[u(g,{"model-value":P.value,"onUpdate:modelValue":j},null,8,["model-value"])]),a[14]||(a[14]=_("th",null,"filename_disk",-1)),a[15]||(a[15]=_("th",null,"Type",-1)),a[16]||(a[16]=_("th",null,"Size",-1))])]),_("tbody",null,[(i(!0),c(v,null,f(I.value,e=>(i(),c("tr",{key:e.filename_disk},[_("td",qa,[u(g,{"model-value":D.value.includes(e.filename_disk),"onUpdate:modelValue":t=>function(e,t){t?D.value.includes(e)||(D.value=[...D.value,e]):D.value=D.value.filter(t=>t!==e)}(e.filename_disk,t)},null,8,["model-value","onUpdate:modelValue"])]),_("td",{class:"name",title:e.filename_disk},m(e.filename_disk),9,Ka),_("td",null,m(e.type||"—"),1),_("td",null,m(S(Ue)(e.filesize)),1)]))),128))])])])):b("v-if",!0),A.value?(i(),c("div",{key:5,class:$(["result",A.value.failed?"has-fail":"ok"])}," Deleted "+m(A.value.deleted)+" · skipped "+m(A.value.skipped)+" · failed "+m(A.value.failed),3)):b("v-if",!0),N.value?(i(),c("div",{key:6,class:$(["result",N.value.failed?"has-fail":"ok"])}," Imported "+m(N.value.imported)+" · skipped "+m(N.value.skipped)+" · failed "+m(N.value.failed),3)):b("v-if",!0)])]),_:1},8,["model-value","title"]),u(G,{"model-value":C.value,"onUpdate:modelValue":a[2]||(a[2]=e=>C.value=e),onEsc:a[3]||(a[3]=e=>C.value=!1)},{default:d(()=>[u(Q,null,{default:d(()=>[u(y,null,{default:d(()=>[...a[17]||(a[17]=[p("Import new files?",-1)])]),_:1}),u(W,null,{default:d(()=>[a[18]||(a[18]=p(" Do you want to import ",-1)),_("strong",null,m(I.value.length.toLocaleString()),1),p(" new file"+m(1===I.value.length?"":"s")+" into storage ",1),_("strong",null,m(t.location),1),a[19]||(a[19]=p("? ",-1)),a[20]||(a[20]=_("br",null,null,-1)),a[21]||(a[21]=_("br",null,null,-1)),a[22]||(a[22]=p(" Each file keeps its exact ",-1)),a[23]||(a[23]=_("code",null,"filename_disk",-1)),a[24]||(a[24]=p(". Titles are generated from the filename with underscores replaced by spaces (extension stripped). Image width and height are read from the file so thumbnails can be generated. ",-1))]),_:1}),u(H,null,{default:d(()=>[u(l,{secondary:"",disabled:w.value,onClick:a[1]||(a[1]=e=>C.value=!1)},{default:d(()=>[...a[25]||(a[25]=[p("Cancel",-1)])]),_:1},8,["disabled"]),u(l,{loading:w.value,onClick:K},{default:d(()=>[p(" Import "+m(I.value.length.toLocaleString()),1)]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1},8,["model-value"]),u(G,{"model-value":F.value,"onUpdate:modelValue":a[5]||(a[5]=e=>F.value=e),onEsc:a[6]||(a[6]=e=>F.value=!1)},{default:d(()=>[u(Q,null,{default:d(()=>[u(y,null,{default:d(()=>[...a[26]||(a[26]=[p("Delete from Storage?",-1)])]),_:1}),u(W,null,{default:d(()=>[a[27]||(a[27]=p(" Permanently delete ",-1)),_("strong",null,m(D.value.length.toLocaleString()),1),p(" file"+m(1===D.value.length?"":"s")+" from storage ",1),_("strong",null,m(t.location),1),a[28]||(a[28]=p("? ",-1)),a[29]||(a[29]=_("br",null,null,-1)),a[30]||(a[30]=_("br",null,null,-1)),a[31]||(a[31]=p(" Only unregistered files are removed. Generated thumbnails are not deleted. ",-1))]),_:1}),u(H,null,{default:d(()=>[u(l,{secondary:"",disabled:x.value,onClick:a[4]||(a[4]=e=>F.value=!1)},{default:d(()=>[...a[32]||(a[32]=[p("Cancel",-1)])]),_:1},8,["disabled"]),u(l,{kind:"danger",loading:x.value,onClick:J},{default:d(()=>[p(" Delete "+m(D.value.length.toLocaleString()),1)]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1},8,["model-value"])],64)}}});me("\n.body[data-v-15d8b708] {\n\tpadding: 0 24px 24px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 14px;\n}\n.intro[data-v-15d8b708] {\n\tmargin: 0;\n\tline-height: 1.45;\n\tcolor: var(--theme--foreground);\n\tfont-size: 13px;\n}\n.intro code[data-v-15d8b708],\n.v-card-text code[data-v-15d8b708] {\n\tfont-size: 12px;\n}\n.toolbar[data-v-15d8b708] {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n}\n.meta[data-v-15d8b708],\n.empty[data-v-15d8b708] {\n\tmargin: 0;\n\tfont-size: 13px;\n\tcolor: var(--theme--foreground-subdued);\n}\n.loading[data-v-15d8b708] {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 10px;\n\tcolor: var(--theme--foreground-subdued);\n}\n.error[data-v-15d8b708] {\n\tmargin: 0;\n\tcolor: var(--theme--danger);\n\tfont-size: 13px;\n}\n.table-wrap[data-v-15d8b708] {\n\toverflow: auto;\n\tmax-height: 50vh;\n\tborder: var(--theme--border-width) solid var(--theme--border-color-subdued);\n\tborder-radius: var(--theme--border-radius);\n}\ntable[data-v-15d8b708] {\n\twidth: 100%;\n\tborder-collapse: collapse;\n\tfont-size: 13px;\n}\nth[data-v-15d8b708],\ntd[data-v-15d8b708] {\n\tpadding: 8px 10px;\n\ttext-align: left;\n\tborder-bottom: var(--theme--border-width) solid var(--theme--border-color-subdued);\n}\nth[data-v-15d8b708] {\n\tfont-weight: 700;\n\tbackground: var(--theme--background-subdued);\n\tposition: sticky;\n\ttop: 0;\n}\n.name[data-v-15d8b708] {\n\tfont-family: var(--theme--fonts--monospace--font-family, monospace);\n\tmax-width: 280px;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n.check-col[data-v-15d8b708] {\n\twidth: 36px;\n\tpadding-left: 8px;\n\tpadding-right: 4px;\n\tvertical-align: middle;\n}\n.check-col[data-v-15d8b708] .v-checkbox {\n\tmargin: 0;\n}\n.result[data-v-15d8b708] {\n\tpadding: 10px 12px;\n\tborder-radius: var(--theme--border-radius);\n\tfont-size: 13px;\n\tfont-weight: 600;\n}\n.result.ok[data-v-15d8b708] {\n\tbackground: color-mix(in srgb, var(--theme--success) 16%, transparent);\n\tcolor: var(--theme--success);\n}\n.result.has-fail[data-v-15d8b708] {\n\tbackground: color-mix(in srgb, var(--theme--warning) 16%, transparent);\n\tcolor: var(--theme--warning);\n}\n",{});var Wa=ge(Ja,[["__scopeId","data-v-15d8b708"]]),Ha=o({__name:"add-storage-folder",props:{location:{},parentPath:{}},emits:["created"],setup(t,{emit:a}){const l=t,o=a,c=e(),v=T(),f=n(!1),m=n(!1),g=n(null);async function h(){if(g.value?.trim()&&!m.value){m.value=!0;try{const e=await c.post(`/storage-manager/storages/${encodeURIComponent(l.location)}/folders`,{name:g.value.trim(),parent_path:l.parentPath||""}),t=String(e.data?.data?.path||"");f.value=!1,g.value=null,o("created",t),t&&v.push(Ce(l.location,t))}catch(e){const t=e?.response?.data?.errors?.[0]?.message||e?.message||"Could not create folder";window.alert(t)}finally{m.value=!1}}}return(e,t)=>{const a=r("v-card-title"),n=r("v-input"),l=r("v-card-text"),o=r("v-button"),c=r("v-card-actions"),v=r("v-card"),b=r("v-dialog"),y=V("tooltip");return i(),s(b,{modelValue:f.value,"onUpdate:modelValue":t[2]||(t[2]=e=>f.value=e),onEsc:t[3]||(t[3]=e=>f.value=!1),onApply:h},{activator:d(({on:e})=>[z(u(wt,{icon:"create_new_folder",secondary:"",onClick:e},null,8,["onClick"]),[[y,"Create Storage Folder",void 0,{bottom:!0}]])]),default:d(()=>[u(v,null,{default:d(()=>[u(a,null,{default:d(()=>[...t[4]||(t[4]=[p("Create Storage Folder",-1)])]),_:1}),u(l,null,{default:d(()=>[u(n,{modelValue:g.value,"onUpdate:modelValue":t[0]||(t[0]=e=>g.value=e),autofocus:"",placeholder:"Folder name",onKeydown:w(h,["enter"])},null,8,["modelValue"])]),_:1}),u(c,null,{default:d(()=>[u(o,{secondary:"",onClick:t[1]||(t[1]=e=>f.value=!1)},{default:d(()=>[...t[5]||(t[5]=[p("Cancel",-1)])]),_:1}),u(o,{disabled:!g.value?.trim(),loading:m.value,onClick:h},{default:d(()=>[...t[6]||(t[6]=[p("Save",-1)])]),_:1},8,["disabled","loading"])]),_:1})]),_:1})]),_:1},8,["modelValue"])}}});const Qa=["onClick","onKeydown","onContextmenu"],Ga={class:"header"},Ya={class:"title"};var Xa=o({__name:"storage-folder-section",props:k({location:{},folders:{},anyFileSelection:{type:Boolean}},{selection:{default:()=>[]},selectionModifiers:{}}),emits:k(["changed"],["update:selection"]),setup(e,{emit:t}){const a=e,o=t,s=y(e,"selection"),d=T(),p=n({}),g=l(()=>s.value.length>0||(a.anyFileSelection??!1));function h(e){s.value.includes(e)?s.value=s.value.filter(t=>t!==e):s.value=[...s.value,e]}function k(e){var t;g.value?h(e.path):(t=e.path,d.push(Ce(a.location,t)))}function S(){o("changed")}return(t,a)=>{const n=r("v-icon");return i(),c(v,null,[b("\n\t\tFragment of cards — must be direct children of layout-cards `.grid`\n\t\t(same as File Library FolderSection + Card), not a nested grid wrapper.\n\t"),(i(!0),c(v,null,f(e.folders,t=>{return i(),c("div",{key:t.path,class:$(["card folder-card",{selected:s.value.includes(t.path),"select-mode":g.value}]),tabindex:"0",onClick:e=>k(t),onKeydown:[w(x(e=>k(t),["self","prevent"]),["enter"]),w(x(e=>k(t),["self","prevent"]),["space"])],onContextmenu:x(e=>{return a=e,n=t.path,void p.value[n]?.open(a);var a,n},["prevent"])},[u(n,{class:"selector",name:(l=t.path,s.value.includes(l)?"check_circle":"radio_button_unchecked"),clickable:"",onClick:x(e=>h(t.path),["stop"])},null,8,["name","onClick"]),_("div",Ga,[a[0]||(a[0]=_("div",{class:"selection-fade"},null,-1)),u(n,{large:"",name:"folder"})]),_("div",Ya,m(t.name),1),u(Fe,{ref_for:!0,ref:e=>function(e,t){p.value[e]=t}(t.path,e),location:e.location,path:t.path,name:t.name,onChanged:S},null,8,["location","path","name"])],42,Qa);var l}),128))],2112)}}});me("\n/* Port of Directus layouts/cards/components/card.vue (folder-only subset) */\n.card[data-v-89b52992] {\n\tposition: relative;\n\tcursor: pointer;\n}\n.card[data-v-89b52992]:focus-visible {\n\toutline: none;\n}\n.card[data-v-89b52992]:focus-visible::after {\n\tposition: absolute;\n\tinset-block-start: 0;\n\tinset-inline-start: 0;\n\tz-index: 2;\n\tinline-size: 100%;\n\taspect-ratio: 1 / 1;\n\tborder-radius: var(--theme--border-radius);\n\toutline: var(--focus-ring-width) solid var(--focus-ring-color);\n\toutline-offset: var(--focus-ring-offset);\n\tcontent: '';\n\tpointer-events: none;\n}\n.header[data-v-89b52992] {\n\tposition: relative;\n\tz-index: 1;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tinline-size: 100%;\n\toverflow: hidden;\n\tbackground-color: var(--theme--background-normal);\n\tborder-color: var(--theme--primary-subdued);\n\tborder-style: solid;\n\tborder-width: 0;\n\tborder-radius: var(--theme--border-radius);\n\ttransition: border-width var(--fast) var(--transition);\n}\n.header[data-v-89b52992]::after {\n\tdisplay: block;\n\tpadding-block-end: 100%;\n\tcontent: '';\n}\n.header .v-icon[data-v-89b52992] {\n\t--v-icon-color: var(--theme--foreground-subdued);\n\tposition: absolute;\n}\n.selection-fade[data-v-89b52992] {\n\tposition: absolute;\n\tinset-block-start: 0;\n\tinset-inline-start: 0;\n\tz-index: 1;\n\tinline-size: 100%;\n\tblock-size: 2.6875rem;\n\topacity: 0;\n\ttransition: opacity var(--fast) var(--transition);\n}\n.selection-fade[data-v-89b52992]::before {\n\tposition: absolute;\n\tinset-block-start: 0;\n\tinset-inline-start: 0;\n\tinline-size: 100%;\n\tblock-size: 100%;\n\tbackground-image: linear-gradient(-180deg, rgb(38 50 56 / 0.1) 10%, rgb(38 50 56 / 0));\n\tcontent: '';\n}\n.card[data-v-89b52992]::before {\n\tposition: absolute;\n\tinset-block-start: 0.375rem;\n\tinset-inline-start: 0.375rem;\n\tz-index: 2;\n\tinline-size: 1rem;\n\tblock-size: 1rem;\n\tbackground-color: var(--theme--background);\n\tborder-radius: 1.375rem;\n\topacity: 0;\n\ttransition: opacity var(--fast) var(--transition);\n\tcontent: '';\n}\n.selector[data-v-89b52992] {\n\t--v-icon-color: var(--white);\n\t--v-icon-color-hover: var(--white);\n\t--focus-ring-offset: 0;\n\n\tposition: absolute;\n\tinset-block-start: 0;\n\tinset-inline-start: 0;\n\tz-index: 3;\n\tmargin: 0.25rem;\n\topacity: 0;\n\ttransition:\n\t\topacity var(--fast) var(--transition),\n\t\tcolor var(--fast) var(--transition);\n}\n.selector[data-v-89b52992]:focus-visible,\n.selector[data-v-89b52992]:hover {\n\topacity: 1 !important;\n}\n.card.select-mode .selector[data-v-89b52992] {\n\topacity: 0.5;\n}\n.card.select-mode .header .selection-fade[data-v-89b52992] {\n\topacity: 1;\n}\n.card.selected[data-v-89b52992]::before {\n\topacity: 1;\n}\n.card.selected .selector[data-v-89b52992] {\n\t--v-icon-color: var(--theme--primary);\n\t--v-icon-color-hover: var(--theme--primary);\n\topacity: 1;\n}\n.card.selected .header[data-v-89b52992] {\n\tborder-width: 12px;\n}\n.card.selected .header .selection-fade[data-v-89b52992] {\n\topacity: 1;\n}\n.card:hover .selector[data-v-89b52992] {\n\topacity: 0.5;\n}\n.card:hover .header .selection-fade[data-v-89b52992] {\n\topacity: 1;\n}\n.title[data-v-89b52992] {\n\tposition: relative;\n\tdisplay: flex;\n\talign-items: center;\n\tinline-size: 100%;\n\tblock-size: 1.4375rem;\n\tmargin-block-start: 0.125rem;\n\toverflow: hidden;\n\tline-height: 1.3;\n\twhite-space: nowrap;\n\ttext-overflow: ellipsis;\n}\n",{});var Za=ge(Xa,[["__scopeId","data-v-89b52992"]]);const en=["onClick","onKeydown"],tn={class:"header"},an={class:"title"};var nn=o({__name:"directus-folder-section",props:k({folders:{},anyFileSelection:{type:Boolean}},{selection:{default:()=>[]},selectionModifiers:{}}),emits:["update:selection"],setup(e){const t=e,a=y(e,"selection"),n=T(),o=l(()=>a.value.length>0||(t.anyFileSelection??!1));function s(e){a.value.includes(e)?a.value=a.value.filter(t=>t!==e):a.value=[...a.value,e]}function d(e){var t;o.value?s(e.id):(t=e.id,n.push(`/storage-manager/folders/${t}`))}return(t,n)=>{const l=r("v-icon");return i(),c(v,null,[b("\n\t\tFragment of cards for Directus virtual folders — same grid pattern as\n\t\tFile Library FolderSection / storage-folder-section.\n\t"),(i(!0),c(v,null,f(e.folders,e=>{return i(),c("div",{key:e.id,class:$(["card folder-card",{selected:a.value.includes(e.id),"select-mode":o.value}]),tabindex:"0",onClick:t=>d(e),onKeydown:[w(x(t=>d(e),["self","prevent"]),["enter"]),w(x(t=>d(e),["self","prevent"]),["space"])]},[u(l,{class:"selector",name:(t=e.id,a.value.includes(t)?"check_circle":"radio_button_unchecked"),clickable:"",onClick:x(t=>s(e.id),["stop"])},null,8,["name","onClick"]),_("div",tn,[n[0]||(n[0]=_("div",{class:"selection-fade"},null,-1)),u(l,{large:"",name:"folder",outline:""})]),_("div",an,m(e.name),1)],42,en);var t}),128))],2112)}}});me("\n/* Port of Directus layouts/cards/components/card.vue (folder-only subset) */\n.card[data-v-d206f12f] {\n\tposition: relative;\n\tcursor: pointer;\n}\n.card[data-v-d206f12f]:focus-visible {\n\toutline: none;\n}\n.card[data-v-d206f12f]:focus-visible::after {\n\tposition: absolute;\n\tinset-block-start: 0;\n\tinset-inline-start: 0;\n\tz-index: 2;\n\tinline-size: 100%;\n\taspect-ratio: 1 / 1;\n\tborder-radius: var(--theme--border-radius);\n\toutline: var(--focus-ring-width) solid var(--focus-ring-color);\n\toutline-offset: var(--focus-ring-offset);\n\tcontent: '';\n\tpointer-events: none;\n}\n.header[data-v-d206f12f] {\n\tposition: relative;\n\tz-index: 1;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tinline-size: 100%;\n\toverflow: hidden;\n\tbackground-color: var(--theme--background-normal);\n\tborder-color: var(--theme--primary-subdued);\n\tborder-style: solid;\n\tborder-width: 0;\n\tborder-radius: var(--theme--border-radius);\n\ttransition: border-width var(--fast) var(--transition);\n}\n.header[data-v-d206f12f]::after {\n\tdisplay: block;\n\tpadding-block-end: 100%;\n\tcontent: '';\n}\n.header .v-icon[data-v-d206f12f] {\n\t--v-icon-color: var(--theme--foreground-subdued);\n\tposition: absolute;\n}\n.selection-fade[data-v-d206f12f] {\n\tposition: absolute;\n\tinset-block-start: 0;\n\tinset-inline-start: 0;\n\tz-index: 1;\n\tinline-size: 100%;\n\tblock-size: 2.6875rem;\n\topacity: 0;\n\ttransition: opacity var(--fast) var(--transition);\n}\n.selection-fade[data-v-d206f12f]::before {\n\tposition: absolute;\n\tinset-block-start: 0;\n\tinset-inline-start: 0;\n\tinline-size: 100%;\n\tblock-size: 100%;\n\tbackground-image: linear-gradient(-180deg, rgb(38 50 56 / 0.1) 10%, rgb(38 50 56 / 0));\n\tcontent: '';\n}\n.card[data-v-d206f12f]::before {\n\tposition: absolute;\n\tinset-block-start: 0.375rem;\n\tinset-inline-start: 0.375rem;\n\tz-index: 2;\n\tinline-size: 1rem;\n\tblock-size: 1rem;\n\tbackground-color: var(--theme--background);\n\tborder-radius: 1.375rem;\n\topacity: 0;\n\ttransition: opacity var(--fast) var(--transition);\n\tcontent: '';\n}\n.selector[data-v-d206f12f] {\n\t--v-icon-color: var(--white);\n\t--v-icon-color-hover: var(--white);\n\t--focus-ring-offset: 0;\n\n\tposition: absolute;\n\tinset-block-start: 0;\n\tinset-inline-start: 0;\n\tz-index: 3;\n\tmargin: 0.25rem;\n\topacity: 0;\n\ttransition:\n\t\topacity var(--fast) var(--transition),\n\t\tcolor var(--fast) var(--transition);\n}\n.selector[data-v-d206f12f]:focus-visible,\n.selector[data-v-d206f12f]:hover {\n\topacity: 1 !important;\n}\n.card.select-mode .selector[data-v-d206f12f] {\n\topacity: 0.5;\n}\n.card.select-mode .header .selection-fade[data-v-d206f12f] {\n\topacity: 1;\n}\n.card.selected[data-v-d206f12f]::before {\n\topacity: 1;\n}\n.card.selected .selector[data-v-d206f12f] {\n\t--v-icon-color: var(--theme--primary);\n\t--v-icon-color-hover: var(--theme--primary);\n\topacity: 1;\n}\n.card.selected .header[data-v-d206f12f] {\n\tborder-width: 12px;\n}\n.card.selected .header .selection-fade[data-v-d206f12f] {\n\topacity: 1;\n}\n.card:hover .selector[data-v-d206f12f] {\n\topacity: 0.5;\n}\n.card:hover .header .selection-fade[data-v-d206f12f] {\n\topacity: 1;\n}\n.title[data-v-d206f12f] {\n\tposition: relative;\n\tdisplay: flex;\n\talign-items: center;\n\tinline-size: 100%;\n\tblock-size: 1.4375rem;\n\tmargin-block-start: 0.125rem;\n\toverflow: hidden;\n\tfont-weight: 600;\n\tline-height: 1.3;\n\twhite-space: nowrap;\n\ttext-overflow: ellipsis;\n}\n",{});var ln=ge(nn,[["__scopeId","data-v-d206f12f"]]);const on={key:1,class:"folder-picker"},rn={key:0,class:"empty"};var sn=o({__name:"storage-target-picker",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,o=t,{storages:y,loadStorages:_}=ae(),{trees:k,loading:w,loadTree:x}=re(),C=n([]),$=l(()=>y.value.map(e=>e.location)),F=l(()=>{const e=a.modelValue?.location||"",t=String(a.modelValue?.path||"").replace(/^\/+|\/+$/g,"");if(!e)return[];const n=[`@${e}`];if(!t)return n;const l=t.split("/").filter(Boolean);for(let t=1;t<=l.length;t++)n.push(`${e}::${l.slice(0,t).join("/")}`);return n});function M(e,t){o("update:modelValue",{location:e,path:t})}return g(F,e=>{const t=new Set(C.value);for(const a of e)t.add(a);C.value=Array.from(t)},{immediate:!0}),g(C,e=>{for(const t of e){if("string"!=typeof t||!t.startsWith("@"))continue;const e=t.slice(1);e&&void 0===k.value[e]&&x(e)}},{deep:!0}),h(()=>{!async function(){await _().catch(()=>{})}()}),(t,n)=>{const l=r("v-skeleton-loader"),o=r("v-icon"),g=r("v-list-item-icon"),h=r("v-list-item-content"),y=r("v-list-group"),_=r("v-item-group"),x=r("v-list");return S(w)&&!$.value.length?(i(),s(l,{key:0})):(i(),c("div",on,[u(x,null,{default:d(()=>[u(_,{modelValue:C.value,"onUpdate:modelValue":n[0]||(n[0]=e=>C.value=e),scope:"storage-target-picker",multiple:""},{default:d(()=>[(i(!0),c(v,null,f($.value,t=>{return i(),s(y,{key:t,"disable-groupable-parent":"",clickable:"",active:(n=t,l="",a.modelValue?.location===n&&(a.modelValue?.path||"")===l),scope:"storage-target-picker",value:`@${t}`,"arrow-placement":(S(k)[t]||[]).length>0&&"after",onClick:e=>M(t,"")},{activator:d(()=>[u(g,null,{default:d(()=>[u(o,{name:"storage"})]),_:1}),u(h,null,{default:d(()=>[p("Root ("+m(t)+")",1)]),_:2},1024)]),default:d(()=>[(i(!0),c(v,null,f(S(k)[t]||[],a=>(i(),s(de,{key:`${t}:${a.path}`,folder:a,"current-path":e.modelValue.location===t?e.modelValue.path:"__none__","click-handler":e=>M(t,e),scope:"storage-target-picker","value-prefix":`${t}::`},null,8,["folder","current-path","click-handler","value-prefix"]))),128))]),_:2},1032,["active","value","arrow-placement","onClick"]);var n,l}),128))]),_:1},8,["modelValue"])]),_:1}),$.value.length?b("v-if",!0):(i(),c("p",rn,"No storage adapters configured."))]))}}});me("\n.folder-picker[data-v-0cc7349b] {\n\t--v-list-item-background-color-hover: var(--theme--background-accent);\n\t--v-list-item-background-color-active: var(--theme--background-accent);\n\n\tpadding: 0.6875rem;\n\tbackground-color: var(--theme--background-normal);\n\tborder-radius: var(--theme--border-radius);\n\tmax-block-size: 17.5rem;\n\toverflow: auto;\n}\n.empty[data-v-0cc7349b] {\n\tmargin: 8px 12px 4px;\n\tfont-size: 13px;\n\tcolor: var(--theme--foreground-subdued);\n}\n",{});var dn=ge(sn,[["__scopeId","data-v-0cc7349b"]]),un=o({__name:"upload-files-dialog",props:{modelValue:{type:Boolean},title:{default:"Add File"},uploading:{type:Boolean,default:!1}},emits:["update:modelValue","files"],setup(e,{emit:t}){const a=t,l=n(null),o=n(!1);let f=0;function g(){a("update:modelValue",!1)}function h(e){a("update:modelValue",e),e||(o.value=!1,f=0)}function b(){l.value?.click()}function y(e){const t=Array.from(e||[]).filter(e=>Boolean(e.type)||e.size>0);t.length&&a("files",t)}function k(e){const t=e.target;y(t.files),t.value=""}function w(){f++,1===f&&(o.value=!0)}function S(){f--,f<=0&&(f=0,o.value=!1)}function C(e){f=0,o.value=!1,y(e.dataTransfer?.files)}return(t,a)=>{const n=r("v-card-title"),f=r("v-progress-circular"),y=r("v-icon"),F=r("v-card-text"),M=r("v-button"),V=r("v-card-actions"),z=r("v-card"),B=r("v-dialog");return i(),s(B,{"model-value":e.modelValue,"onUpdate:modelValue":h,onEsc:g},{default:d(()=>[u(z,null,{default:d(()=>[u(n,null,{default:d(()=>[p(m(e.title),1)]),_:1}),u(F,null,{default:d(()=>[_("div",{class:$(["upload-zone",{dragging:o.value,uploading:e.uploading}]),"data-dropzone":"",onClick:b,onDragenter:x(w,["prevent"]),onDragover:a[1]||(a[1]=x(()=>{},["prevent"])),onDragleave:x(S,["prevent"]),onDrop:x(C,["prevent","stop"])},[e.uploading?(i(),c(v,{key:0},[u(f,{indeterminate:""}),a[2]||(a[2]=_("p",null,"Uploading…",-1))],64)):(i(),c(v,{key:1},[u(y,{large:"",name:o.value?"file_download":"file_upload"},null,8,["name"]),_("p",null,m(o.value?"Drop files to upload":"Drag and drop files here"),1),a[3]||(a[3]=_("p",{class:"hint"},"or click to browse from your device",-1))],64)),_("input",{ref_key:"fileInput",ref:l,class:"hidden-input",type:"file",multiple:"",onChange:k,onClick:a[0]||(a[0]=x(()=>{},["stop"]))},null,544)],34)]),_:1}),u(V,null,{default:d(()=>[u(M,{onClick:g},{default:d(()=>[...a[4]||(a[4]=[p("Done",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["model-value"])}}});me("\n.upload-zone[data-v-63a4ef66] {\n\tposition: relative;\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tjustify-content: center;\n\tgap: 8px;\n\tmin-block-size: 12.5rem;\n\tpadding: 2rem 1.5rem;\n\tcolor: var(--theme--foreground-subdued);\n\ttext-align: center;\n\tcursor: pointer;\n\tbackground-color: var(--theme--background);\n\tborder: var(--theme--border-width) dashed var(--theme--form--field--input--border-color);\n\tborder-radius: var(--theme--border-radius);\n\ttransition:\n\t\tborder-color var(--fast) var(--transition),\n\t\tcolor var(--fast) var(--transition),\n\t\tbackground-color var(--fast) var(--transition);\n}\n.upload-zone[data-v-63a4ef66]:hover,\n.upload-zone.dragging[data-v-63a4ef66] {\n\tcolor: var(--theme--primary);\n\tbackground-color: var(--theme--primary-background);\n\tborder-color: var(--theme--primary);\n}\n.upload-zone.uploading[data-v-63a4ef66] {\n\tpointer-events: none;\n\tcursor: default;\n}\n.upload-zone p[data-v-63a4ef66] {\n\tmargin: 0;\n\tcolor: inherit;\n}\n.upload-zone .hint[data-v-63a4ef66] {\n\tfont-size: 13px;\n\topacity: 0.85;\n}\n.hidden-input[data-v-63a4ef66] {\n\tposition: absolute;\n\tinline-size: 0;\n\tblock-size: 0;\n\topacity: 0;\n\tpointer-events: none;\n}\n",{});var cn=ge(un,[["__scopeId","data-v-63a4ef66"]]);const vn={class:"drawer-body"},fn={class:"field"},pn={class:"mode-cards"},mn={class:"mode-card-header"},gn={class:"mode-card-header"},hn={key:0,class:"field"},bn={key:1,class:"field"},yn={class:"field"},_n={class:"actions"},kn={key:3,class:"result"},wn={key:0},xn={key:1},Sn={key:2,class:"note"},Cn={key:3,class:"by-storage"},$n={key:4,class:"empty-storage"},Fn={key:4,class:"result"};var Mn=o({__name:"materialize-drawer",props:{modelValue:{type:Boolean},storages:{},folderId:{}},emits:["update:modelValue","done"],setup(t,{emit:a}){const o=t,g=a,h=e(),y=n("preserve"),k=n(null),w=n(!1),x=n(!0),C=n(!1),F=n(!1),M=n(!1),V=n(null),z=n(null),B=n(null),I=n(null),D=n(0),U=n({from:null,to:"",currentIndex:0,totalFiles:0,currentName:"",transferredBytes:0,totalBytes:0,elapsedMs:0,speedBps:0,succeeded:0,skipped:0,failed:0}),N=l(()=>o.storages.map(e=>({text:`${e.location} (${e.short})`,value:e.location}))),A=l(()=>"merge"!==y.value||Boolean(k.value));async function E(){V.value=null,C.value=!0;try{const e=await h.post("/storage-manager/materialize/dry-run",{folder_id:o.folderId??null,mode:y.value,target_storage:"merge"===y.value?k.value:void 0,structure_only:w.value,recursive:x.value});z.value=e.data?.data||null}catch(e){V.value=e?.response?.data?.errors?.[0]?.message||e?.message||"Dry run failed"}finally{C.value=!1}}async function L(){if(A.value){V.value=null,F.value=!0,M.value=!1,D.value=Date.now(),U.value={from:null,to:"merge"===y.value?String(k.value||""):"preserve",currentIndex:0,totalFiles:z.value?.total_files||0,currentName:"",transferredBytes:0,totalBytes:z.value?.total_bytes||0,elapsedMs:0,speedBps:0,succeeded:0,skipped:0,failed:0};try{I.value=new AbortController;const e=await fetch("/storage-manager/materialize/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},credentials:"same-origin",signal:I.value.signal,body:JSON.stringify({folder_id:o.folderId??null,mode:y.value,target_storage:"merge"===y.value?k.value:void 0,structure_only:w.value,keep_source_file_on_disk:!1,recursive:x.value})});await async function(e,t){if(!e.ok){let t=`Materialize failed (${e.status})`;try{const a=await e.json();t=a?.errors?.[0]?.message||t}catch{}throw new Error(t)}if(!e.body)throw new Error("No response body for materialize stream");const a=e.body.getReader(),n=new TextDecoder;let l="";for(;;){const{done:e,value:o}=await a.read();if(e)break;l+=n.decode(o,{stream:!0});const r=l.split("\n\n");l=r.pop()||"";for(const e of r)for(const a of e.split("\n")){const e=a.trim();if(!e.startsWith("data:"))continue;const n=e.slice(5).trim();if(!n)continue;let l;try{l=JSON.parse(n)}catch{continue}if(t(l),"error"===l.type)throw new Error(l.message||"Materialize failed")}}}(e,O),g("done")}catch(e){"AbortError"===e?.name?M.value=!0:V.value=e?.response?.data?.errors?.[0]?.message||e?.message||"Materialize failed"}finally{F.value=!1,I.value=null}}}function P(){I.value?.abort()}function O(e){const t=Date.now()-D.value;return"start"===e.type?(U.value.from=e.from||null,U.value.to=e.to,U.value.totalFiles=e.total,void(U.value.totalBytes=e.total_bytes)):"file_start"===e.type?(U.value.currentIndex=e.index,void(U.value.currentName=e.name)):"file_done"===e.type?(U.value.currentIndex=e.index,U.value.currentName=e.name,U.value.succeeded=e.succeeded,U.value.skipped=e.skipped,U.value.failed=e.failed,U.value.transferredBytes=e.transferred_bytes,U.value.totalBytes=e.total_bytes,U.value.elapsedMs=e.elapsed_ms,void(U.value.speedBps=e.elapsed_ms>0?1e3*e.transferred_bytes/e.elapsed_ms:0)):void("done"===e.type&&(B.value={total:e.data.total,succeeded:e.data.succeeded,skipped:e.data.skipped,failed:e.data.failed},U.value.currentIndex=e.data.total,U.value.succeeded=e.data.succeeded,U.value.skipped=e.data.skipped,U.value.failed=e.data.failed,U.value.transferredBytes=e.data.transferred_bytes||U.value.transferredBytes,U.value.totalBytes=e.data.total_bytes||U.value.totalBytes,U.value.elapsedMs=e.data.elapsed_ms||t,U.value.speedBps=U.value.elapsedMs>0?1e3*U.value.transferredBytes/U.value.elapsedMs:0))}return(e,a)=>{const n=r("v-icon"),l=r("v-select"),o=r("v-checkbox"),h=r("v-button"),I=r("v-notice"),D=r("v-drawer");return i(),s(D,{"model-value":t.modelValue,title:"Materialize Folder",icon:"account_tree",persistent:F.value,"onUpdate:modelValue":a[5]||(a[5]=e=>g("update:modelValue",e)),onCancel:a[6]||(a[6]=e=>g("update:modelValue",!1))},{default:d(()=>[_("div",vn,[a[22]||(a[22]=_("p",{class:"intro"}," Materialize virtual Directus folders into real storage paths. ",-1)),_("div",fn,[a[13]||(a[13]=_("label",null,"Storage Mode",-1)),_("div",pn,[_("div",{class:$(["mode-card",{active:"preserve"===y.value}]),onClick:a[0]||(a[0]=e=>y.value="preserve")},[_("div",mn,[u(n,{name:"devices",small:""}),a[7]||(a[7]=_("strong",null,"Keep",-1))]),a[8]||(a[8]=_("p",{class:"mode-card-desc"},"Each file stays on its current storage. Only the folder path is created there.",-1)),a[9]||(a[9]=_("p",{class:"mode-card-example"},[_("em",null,"Example:"),p(" photo.jpg on "),_("code",null,"s3"),p(" → moved to "),_("code",null,"s3/travel/paris/photo.jpg"),p(". A file on "),_("code",null,"local"),p(" stays on "),_("code",null,"local"),p(". ")],-1))],2),_("div",{class:$(["mode-card",{active:"merge"===y.value}]),onClick:a[1]||(a[1]=e=>y.value="merge")},[_("div",gn,[u(n,{name:"merge",small:""}),a[10]||(a[10]=_("strong",null,"Merge",-1))]),a[11]||(a[11]=_("p",{class:"mode-card-desc"},"All files are moved into one target storage, placed at their virtual folder path.",-1)),a[12]||(a[12]=_("p",{class:"mode-card-example"},[_("em",null,"Example:"),p(" Files from both "),_("code",null,"s3"),p(" and "),_("code",null,"local"),p(" end up on "),_("code",null,"local2/travel/paris/"),p(". ")],-1))],2)])]),"merge"===y.value?(i(),c("div",hn,[a[14]||(a[14]=_("label",null,"Target Storage",-1)),u(l,{modelValue:k.value,"onUpdate:modelValue":a[2]||(a[2]=e=>k.value=e),items:N.value,"item-text":"text","item-value":"value"},null,8,["modelValue","items"])])):b("v-if",!0),"preserve"===y.value?(i(),c("div",bn,[u(o,{modelValue:w.value,"onUpdate:modelValue":a[3]||(a[3]=e=>w.value=e),label:"Build Storage Folder Structure only (don't move files)"},null,8,["modelValue"])])):b("v-if",!0),_("div",yn,[u(o,{modelValue:x.value,"onUpdate:modelValue":a[4]||(a[4]=e=>x.value=e),label:"Include subfolders"},null,8,["modelValue"])]),_("div",_n,[u(h,{secondary:"",loading:C.value,disabled:F.value,onClick:E},{default:d(()=>[...a[15]||(a[15]=[p("Dry Run",-1)])]),_:1},8,["loading","disabled"]),F.value?(i(),s(h,{key:1,kind:"danger",secondary:"",onClick:P},{default:d(()=>[...a[17]||(a[17]=[p("Cancel",-1)])]),_:1})):(i(),s(h,{key:0,disabled:!A.value,loading:F.value,onClick:L},{default:d(()=>[...a[16]||(a[16]=[p("Run",-1)])]),_:1},8,["disabled","loading"]))]),V.value?(i(),s(I,{key:2,type:"danger"},{default:d(()=>[p(m(V.value),1)]),_:1})):b("v-if",!0),z.value?(i(),c("div",kn,[_("p",null,[a[18]||(a[18]=_("strong",null,"Files:",-1)),p(" "+m(z.value.total_files.toLocaleString()),1)]),z.value.total_folders>0?(i(),c("p",wn,[a[19]||(a[19]=_("strong",null,"Folders:",-1)),p(" "+m(z.value.total_folders.toLocaleString()),1)])):b("v-if",!0),_("p",null,[a[20]||(a[20]=_("strong",null,"Total Size:",-1)),p(" "+m(S(Ue)(z.value.total_bytes||0)),1)]),z.value.conflicts>0?(i(),c("p",xn,[a[21]||(a[21]=_("strong",null,"Path conflicts:",-1)),p(" "+m(z.value.conflicts.toLocaleString()),1)])):b("v-if",!0),z.value.conflicts>0?(i(),c("p",Sn," A destination path already exists on disk, or two files would use the same path. ")):b("v-if",!0),_("p",null,[_("strong",null,m("merge"===z.value.mode?"Will be written to":"Stay on current storage")+":",1)]),z.value.by_storage.length?(i(),c("ul",Cn,[(i(!0),c(v,null,f(z.value.by_storage,e=>(i(),c("li",{key:e.storage},m(e.storage),1))),128))])):(i(),c("p",$n,"No files in this folder."))])):b("v-if",!0),B.value?(i(),c("div",Fn,[u(I,{type:B.value.failed?"danger":"success"},{default:d(()=>[p(m(B.value.succeeded)+" succeeded · "+m(B.value.skipped)+" skipped · "+m(B.value.failed)+" failed (of "+m(B.value.total)+") ",1)]),_:1},8,["type"])])):b("v-if",!0),F.value||B.value?(i(),s(ma,{key:5,storages:t.storages,mode:"move",from:U.value.from,to:U.value.to,"current-index":U.value.currentIndex,"total-files":U.value.totalFiles,"current-name":U.value.currentName,"transferred-bytes":U.value.transferredBytes,"total-bytes":U.value.totalBytes,"elapsed-ms":U.value.elapsedMs,"speed-bps":U.value.speedBps,succeeded:U.value.succeeded,skipped:U.value.skipped,failed:U.value.failed,"is-done":Boolean(B.value)&&!F.value,"is-cancelled":M.value},null,8,["storages","from","to","current-index","total-files","current-name","transferred-bytes","total-bytes","elapsed-ms","speed-bps","succeeded","skipped","failed","is-done","is-cancelled"])):b("v-if",!0)])]),_:1},8,["model-value","persistent"])}}});me("\n.drawer-body[data-v-cb0b2133] { padding: 20px 24px 32px; display: flex; flex-direction: column; gap: 14px;\n}\n.field[data-v-cb0b2133] { display: flex; flex-direction: column; gap: 8px;\n}\n.note[data-v-cb0b2133] { margin: 0; font-size: 12px; color: var(--theme--foreground-subdued);\n}\n.actions[data-v-cb0b2133] { display: flex; gap: 8px;\n}\n.result[data-v-cb0b2133] { padding: 10px; border-radius: var(--theme--border-radius); background: var(--theme--background-subdued);\n}\n.by-storage[data-v-cb0b2133] { margin: 4px 0 0; padding-left: 18px;\n}\n.empty-storage[data-v-cb0b2133] { margin: 4px 0 0; color: var(--theme--foreground-subdued);\n}\n.mode-cards[data-v-cb0b2133] {\n\tdisplay: grid;\n\tgrid-template-columns: 1fr 1fr;\n\tgap: 10px;\n}\n.mode-card[data-v-cb0b2133] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n\tpadding: 12px 14px;\n\tborder-radius: var(--theme--border-radius);\n\tborder: 2px solid var(--theme--border-color);\n\tcursor: pointer;\n\ttransition: border-color 0.15s, background 0.15s;\n}\n.mode-card[data-v-cb0b2133]:hover {\n\tborder-color: var(--theme--primary);\n}\n.mode-card.active[data-v-cb0b2133] {\n\tborder-color: var(--theme--primary);\n\tbackground: var(--theme--primary-background);\n}\n.mode-card-header[data-v-cb0b2133] {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 6px;\n}\n.mode-card-desc[data-v-cb0b2133] {\n\tmargin: 0;\n\tfont-size: 13px;\n\tcolor: var(--theme--foreground);\n}\n.mode-card-example[data-v-cb0b2133] {\n\tmargin: 0;\n\tfont-size: 12px;\n\tcolor: var(--theme--foreground-subdued);\n\tline-height: 1.4;\n}\n.mode-card-example code[data-v-cb0b2133] {\n\tfont-family: var(--theme--fonts--mono--font-family, monospace);\n\tfont-size: 11px;\n\tbackground: var(--theme--background-subdued);\n\tpadding: 1px 4px;\n\tborder-radius: 3px;\n}\n",{});var Vn=ge(Mn,[["__scopeId","data-v-cb0b2133"]]);function zn(a){const o=e(),{useNotificationsStore:r,useServerStore:i}=t(),s=r(),d=i?.(),u=n(!1),c=n(!1),v=n(0),f=l(()=>v.value>0);let p,m;function g(){u.value=!0,p=s.add({title:"Drop to upload",icon:"cloud_upload",type:"info",persist:!0,closeable:!1})}function b(){u.value=!1,p&&(s.remove(p),p=void 0)}function y(e){if(!e.dataTransfer)return;if(-1===e.dataTransfer.types.indexOf("Files"))return;e.preventDefault(),v.value++;const t=e.target&&""===e.target.getAttribute?.("data-dropzone");1===v.value&&!1===u.value&&!1===t&&g(),t&&(b(),v.value=0)}function _(e){e.dataTransfer&&-1!==e.dataTransfer.types.indexOf("Files")&&e.preventDefault()}function k(e){e.dataTransfer&&-1!==e.dataTransfer.types.indexOf("Files")&&(e.preventDefault(),v.value--,0===v.value&&b(),e.target&&""===e.target.getAttribute?.("data-dropzone")&&(g(),v.value=1))}async function w(e){if(!e.dataTransfer)return;if(-1===e.dataTransfer.types.indexOf("Files"))return;e.preventDefault(),u.value=!1,v.value=0,p&&(s.remove(p),p=void 0);const t=Array.from(e.dataTransfer.files).filter(e=>e.type);t.length&&await C(t)}async function x(e,t){const n=new FormData,l=S(a.preset);l.storage&&n.append("storage",l.storage),l.folder&&n.append("folder",l.folder),n.append("file",e);const r=await o.post("/files",n,{onUploadProgress:e=>{e.total&&t(Math.floor(100*e.loaded/e.total))}}),i=r?.data?.data?.id,s=l.storagePath?String(l.storagePath).replace(/^\/+|\/+$/g,""):"";i&&l.storage&&s&&await o.post(`/storage-manager/storages/${encodeURIComponent(l.storage)}/place-file`,{file_id:i,target_path:s})}async function C(e){if(!e.length||c.value)return;c.value=!0;const t=e.map(()=>0),n=Math.max(1,Number(d?.info?.uploads?.maxConcurrency)||2);m=s.add({title:`Uploading 0 of ${e.length}…`,type:"info",persist:!0,closeable:!1,loading:!0});const l=()=>{const a=t.filter(e=>100===e).length,n=t.reduce((e,t)=>e+t,0)/t.length;m&&s.update(m,{title:`Uploading ${a} of ${e.length}…`,loading:!1,progress:n})};let o=0,r=0;try{await Promise.all(Array.from({length:Math.min(n,e.length)},()=>async function(){for(;o<e.length;){const a=o++,n=e[a];try{await x(n,e=>{t[a]=e,l()}),t[a]=100,l()}catch(e){r++,t[a]=100,l();const o=e?.response?.data?.errors?.[0]?.message||e?.message||`Failed to upload ${n.name}`;s.add({title:o,type:"error",icon:"error"})}}}()))}finally{m&&(s.remove(m),m=void 0),c.value=!1,r<e.length&&(s.add({title:r?`Uploaded ${e.length-r} of ${e.length}`:"Upload complete",type:r?"warning":"success",icon:r?"warning":"check"}),await(a.onDone?.()))}}return h(()=>{window.addEventListener("dragenter",y),window.addEventListener("dragover",_),window.addEventListener("dragleave",k),window.addEventListener("drop",w)}),B(()=>{window.removeEventListener("dragenter",y),window.removeEventListener("dragover",_),window.removeEventListener("dragleave",k),window.removeEventListener("drop",w),b(),m&&s.remove(m)}),{dragging:f,showDropEffect:u,uploading:c,uploadFiles:C,onFileInputChange:function(e){const t=e.target,a=Array.from(t.files||[]).filter(e=>e.type);t.value="",a.length&&C(a)}}}const Bn="storage-manager-files-preset",In="cards",Dn={icon:"insert_drive_file",title:"{{ title }}",subtitle:"{{ type }} • {{ filesize }}",size:4,imageFit:"crop"},Un={sort:["-uploaded_on"],page:1,limit:25};function Nn(){const e=function(){try{const e=localStorage.getItem(Bn);return e?JSON.parse(e):{}}catch{return{}}}(),t=n(e.layout||In),a=n({...Dn,...e.layoutOptions||{}}),l=n({...Un,...e.layoutQuery||{},page:Math.max(1,Number(e.layoutQuery?.page)||1),limit:En(e.layoutQuery?.limit)}),o=n(null),r=n(null);return g([t,a,l],()=>{try{localStorage.setItem(Bn,JSON.stringify({layout:t.value,layoutOptions:a.value,layoutQuery:{...l.value,page:Math.max(1,Number(l.value.page)||1),limit:En(l.value.limit)}}))}catch{}},{deep:!0}),{layout:t,layoutOptions:a,layoutQuery:l,filter:o,search:r,resetPreset:function(){t.value=In,a.value={...Dn},l.value={...Un},o.value=null,r.value=null},resetPage:function(){1!==Number(l.value.page)&&(l.value={...l.value,page:1})}}}const An=[25,50,100,250,500,1e3];function En(e){const t=Number(e);return An.includes(t)?t:25}function Ln(e){const t={_and:[{type:{_nnull:!0}}]};return e?t._and.push({folder:{_eq:e}}):t._and.push({folder:{_null:!0}}),t}function Pn(e,t){return e?t?{_and:[e,t]}:e:t??null}const On={key:0,class:"move-hint"},jn={key:1,class:"move-destination-hint"},Tn={class:"move-dry-run"},Rn={key:0,class:"move-dry-result"},qn={key:1,class:"move-hint"},Kn={key:0,class:"move-hint"},Jn={key:1,class:"move-samples"},Wn={key:0},Hn={key:2,class:"move-hint"},Qn={class:"page-intro"},Gn={class:"sidebar-actions"},Yn={class:"sidebar-text storage-label"},Xn={class:"sidebar-text sidebar-note"},Zn="storage-location-badge";var el=o({__name:"collection-browser",props:{mode:{},folder:{},storage:{},storagePath:{}},setup(t){const a=t,o=e(),y=R(),k=T(),{folders:w}=Y(),{storages:x,loadStorages:F}=ae(),{refreshTree:M}=re(),{running:B,reopenNonce:I,start:D}=Jt(),U=Ke(),N=n(),J=n([]),W=n([]),H=n([]),Q=n(!1),G=n(!1),X=n(!1),Z=n({location:"",path:""}),ee=n(!1),te=n(!1),ne=n(!0),le=n(null),oe=n(!1),ie=n(!1),se=n(!1),de=n([]),{layout:ue,layoutOptions:ce,layoutQuery:ve,filter:fe,search:pe,resetPreset:me,resetPage:ge}=Nn(),{layoutWrapper:he}=bt(ue),be=l(()=>String(a.storagePath||"").replace(/\\/g,"/").replace(/^\/+|\/+$/g,"")),ye=l(()=>"storage"===a.mode&&a.storage?function(e,t,a=[]){const n=String(t||"").replace(/\\/g,"/").replace(/^\/+|\/+$/g,""),l=[{type:{_nnull:!0}},{storage:{_eq:e}}];if(n){l.push({filename_disk:{_starts_with:`${n}/`}});for(const e of a){const t=String(e||"").trim();t&&!t.includes("/")&&l.push({filename_disk:{_nstarts_with:`${n}/${t}/`}})}}else l.push({filename_disk:{_ncontains:"/"}});return{_and:l}}(a.storage,be.value,H.value.map(e=>e.name)):Ln(a.folder??null)),ke=l(()=>{if("storage"===a.mode){if(be.value){const e=be.value.split("/");return e[e.length-1]||a.storage||"Storage"}return a.storage||"Storage"}if(a.folder){const e=w.value?.find(e=>e.id===a.folder);return e?.name||"Folder"}return"Directus Folders"}),we=l(()=>"folders"===a.mode&&!a.folder&&!pe.value&&!fe.value),xe=l(()=>{if("folders"!==a.mode||!w.value)return[];const e=a.folder??null;return w.value.filter(t=>e?t.parent===e:null==t.parent).slice().sort((e,t)=>e.name.localeCompare(t.name))}),Se=l(()=>{const e=[{name:"Storage Manager",to:"/storage-manager"}];if("storage"===a.mode){if(e.push({name:a.storage||"Storage",to:`/storage-manager/storage/${a.storage}`}),be.value){const t=be.value.split("/").filter(Boolean);let n="";for(const l of t)n=n?`${n}/${l}`:l,e.push({name:l,to:Ce(a.storage,n)})}}else e.push({name:"Directus Folders",to:"/storage-manager/folders"}),a.folder&&e.push({name:ke.value,to:`/storage-manager/folders/${a.folder}`});return e}),$e=l(()=>"storage"===a.mode&&a.storage&&x.value.find(e=>e.location===a.storage)||null),Fe=n(!1),Me=n(!1),Ve=n("files"),ze=n([]);n(!1);const Be=l(()=>"files"===Ve.value?ze.value.length||J.value.length||void 0:"storage"===Ve.value?$e.value?.file_count??void 0:"folder"===Ve.value?Ne.value??void 0:void 0),Ie=l(()=>{if("storage"===Ve.value)return $e.value?.total_bytes}),Ne=n(null),Ae=l(()=>"folders"===a.mode&&de.value.length>1),Ee=l(()=>"folders"===a.mode),Le=["title","type","filesize","modified_on"],Pe=l({get(){const e={...ve.value};if(!Ee.value||"tabular"!==ue.value)return e;const t=[...e.fields?.length?e.fields:Le];return t.includes("storage")||t.push("storage"),{...e,fields:t}},set(e){ve.value=e}}),Oe=l(()=>{if(!Ae.value)return"";const e=de.value.join(", ");return`This ${a.folder?"folder":"root view"} has files on ${de.value.length} storages (${e}).`}),je=l(()=>"folders"===a.mode&&0===J.value.length&&0===W.value.length),Te=l(()=>"storage"===a.mode&&Boolean(a.storage)&&!be.value&&0===J.value.length&&0===W.value.length),qe=l(()=>be.value?"Detect Files in this Folder":`Detect Files on ${a.storage}`),Je=l(()=>0===J.value.length&&0===W.value.length),We=l(()=>J.value.length>0||"storage"===a.mode&&W.value.length>0||"storage"===a.mode&&Boolean(a.storage)&&!be.value&&0===J.value.length&&0===W.value.length||"folders"===a.mode&&0===J.value.length&&0===W.value.length&&(Ne.value??0)>0),He=l(()=>"storage"===a.mode&&Boolean(a.storage)&&!be.value&&0===J.value.length&&0===W.value.length),Qe=l(()=>He.value?`Moves every file and folder on “${a.storage}” into the destination you pick. Existing folders with the same name are merged. Files that already exist at the destination stay there.`:"storage"===a.mode&&W.value.length?1===W.value.length?"Moves the selected storage folder into the destination you pick. If that folder name already exists there, files are merged into it.":"Moves the selected storage folders into the destination you pick. Matching folder names are merged.":1===J.value.length?"Moves the selected file into the storage folder you pick.":J.value.length>1?`Moves ${J.value.length} selected files into the storage folder you pick.`:"folders"===a.mode?a.folder?"No files selected — moves all files in this Directus folder into the storage folder you pick.":"No files selected — moves all unfiled files into the storage folder you pick.":""),Ge=l(()=>"storage"===a.mode&&W.value.length?W.value.map(String):[]),Ye=l(()=>He.value?`Move all on ${a.storage}`:"Move to Storage Folder"),Xe=l(()=>{const e=Z.value.location;if(!e)return"";const t=Z.value.path?`${e}/${Z.value.path}/`:`${e}/`;if(He.value)return`Everything on “${a.storage}” will be merged into ${t}`;if(1===Ge.value.length){const e=String(Ge.value[0]).split("/").filter(Boolean).pop();return`Folder “${e}” will be merged into ${t}${e}/`}return Ge.value.length>1?`Selected folders will be merged into ${t}{folder-name}/`:`Files will be moved to ${t}`});l(()=>"storage"===a.mode&&W.value.length>0);const Ze=l(()=>J.value.length>0||"storage"===a.mode&&W.value.length>0);l(()=>W.value.length>0&&0===J.value.length?1===W.value.length?"Migrate Selected Folder":"Migrate Selected Folders":"Migrate Selected");const et=l(()=>{const e=J.value.length;return 1===e?"Are you sure you want to delete this item? This action cannot be undone.":`Are you sure you want to delete ${e} items? This action cannot be undone.`});function tt(){"storage"===a.mode&&W.value.length>0?ie.value=!0:oe.value=!0}async function at(){if("folders"===a.mode)try{const e=await o.get("/files",{params:{limit:0,meta:"filter_count",filter:JSON.stringify(Ln(a.folder??null))}});Ne.value=Number(e.data?.meta?.filter_count??0)}catch{Ne.value=0}else Ne.value=null}async function nt(){if("folders"===a.mode)try{const e=await o.get("/files",{params:{filter:JSON.stringify(Ln(a.folder??null)),fields:["storage"],limit:-1}}),t=new Set;for(const a of e.data?.data||[]){const e=String(a?.storage||"").trim();e&&t.add(e)}de.value=Array.from(t).sort((e,t)=>e.localeCompare(t))}catch{de.value=[]}else de.value=[]}function lt(e){const t=document.createElement("span");return t.className=Zn,t.textContent=e,t}function ot(){document.querySelectorAll(`.layout-cards .header .${Zn}`).forEach(e=>{e.remove()}),document.querySelectorAll(`.layout-tabular .${Zn}`).forEach(e=>{const t=e.parentElement,a=e.textContent||"";e.remove(),t&&!t.querySelector(`.${Zn}`)&&t.append(a)})}async function rt(e){if(ot(),!Ee.value)return;if(await j(),"tabular"===ue.value)return void function(){const e=document.querySelector(".layout-tabular thead tr");if(!e)return;const t=Array.from(e.children);let a=t.findIndex(e=>String(e.className||"").split(/\s+/).includes("storage")||"storage"===e.getAttribute("data-field"));a<0&&(a=t.findIndex(e=>"storage"===e.textContent?.trim().toLowerCase())),a<0||document.querySelectorAll(".layout-tabular tbody tr").forEach(e=>{const t=e.children[a];if(!t||t.querySelector(`.${Zn}`))return;const n=String(t.textContent||"").trim();n&&(t.textContent="",t.appendChild(lt(n)))})}();if("cards"!==ue.value||!e?.length)return;const t=document.querySelectorAll(".layout-cards .grid .card:not(.folder-card)");if(!t.length)return;const a="id",n=e.some(e=>null!=e[a]&&null==e.storage);let l={};if(n){const t=e.map(e=>e[a]).filter(Boolean);if(!t.length)return;try{const e=await o.get("/files",{params:{filter:JSON.stringify({id:{_in:t}}),fields:["id","storage"],limit:t.length}});for(const t of e.data?.data||[])l[String(t.id)]=String(t.storage||"")}catch{return}}t.forEach((t,n)=>{const o=e[n];if(!o)return;const r=String(o.storage??l[String(o[a])]??"").trim();if(!r)return;const i=t.querySelector(".header");i&&i.appendChild(lt(r))})}async function it(){await(N.value?.state?.refresh?.()),await F(!0).catch(()=>{}),await st(),await at().catch(()=>{}),await nt().catch(()=>{}),"storage"===a.mode&&a.storage&&await M(a.storage).catch(()=>{})}async function st(){if("storage"===a.mode&&a.storage){Q.value=!0;try{const e=await o.get(`/storage-manager/storages/${encodeURIComponent(a.storage)}/browse`,{params:{path:be.value||""}});H.value=e.data?.data?.folders||[]}catch{H.value=[]}finally{Q.value=!1}}else H.value=[]}function dt(){fe.value=null,pe.value=null}function ut(){Me.value=!0,"storage"===a.mode&&a.storage&&"1"!==String(y.query.detect||"")&&k.replace({path:y.path,query:{...y.query,detect:"1"}})}function ct(e){if(Me.value=e,!e&&"1"===String(y.query.detect||"")){const e={...y.query};delete e.detect,k.replace({path:y.path,query:e})}}async function vt(){J.value=[],W.value=[],ze.value=[],await it()}async function ft(){J.value=[],W.value=[],await it()}async function pt(){await it()}q((e,t)=>{e.path!==t.path&&(J.value=[],W.value=[],oe.value=!1,ie.value=!1,ot())}),K((e,t)=>{e.path!==t.path&&(J.value=[],W.value=[],oe.value=!1,ie.value=!1)}),g(()=>[a.folder,a.storage,a.mode,be.value],()=>{J.value=[],W.value=[],ge(),at(),nt(),ot()}),g(()=>[Ee.value,ue.value,ve.value.page,ve.value.limit,JSON.stringify(ve.value.sort??[]),N.value?.state?.loading,N.value?.state?.items],()=>{var e;N.value?.state?.loading||(e=N.value?.state?.items,rt(e).catch(()=>{}))},{deep:!0,flush:"post"}),g(()=>[a.storage,String(y.query.detect||"")],([e,t])=>{"storage"===a.mode&&e&&"1"===t&&(Me.value=!0)},{immediate:!0}),h(()=>{F().catch(()=>{}),st().catch(()=>{}),at().catch(()=>{}),nt().catch(()=>{})}),g(()=>[a.mode,a.storage,be.value],()=>{st()}),g(B,async(e,t)=>{t&&!e&&(J.value=[],await it())}),g(I,()=>{B.value&&(Fe.value=!0)}),g(()=>String(y.query.migrateJob||""),e=>{if("1"!==e)return;Fe.value=!0;const t={...y.query};delete t.migrateJob,k.replace({path:y.path,query:t})},{immediate:!0});const mt=l(()=>"storage"===a.mode?{storage:a.storage,storagePath:be.value||null}:{folder:a.folder??null}),gt=n(!1),{dragging:ht,showDropEffect:yt,uploading:_t,uploadFiles:xt}=zn({preset:mt,onDone:it}),St=l(()=>"storage"===a.mode&&a.storage?`Upload to ${a.storage}`:"Add File");function Ct(){gt.value=!0}async function Ft(e){await xt(e)}async function Mt(){if(!se.value&&J.value.length){se.value=!0;try{await o.delete("/files",{data:J.value}),J.value=[],oe.value=!1,await it()}catch(e){window.alert(e?.response?.data?.errors?.[0]?.message||e?.message||"Delete failed")}finally{se.value=!1}}}async function Vt(){try{J.value.length>0&&await o.delete("/files",{data:J.value})}catch(e){window.alert(e?.response?.data?.errors?.[0]?.message||e?.message||"Delete failed")}J.value=[],W.value=[],ie.value=!1,await it(),a.storage&&await M(a.storage).catch(()=>{})}async function zt(){if(Z.value.location&&!te.value){te.value=!0,le.value=null;try{const e=await async function(){const e=Z.value.location,t=Z.value.path||"",n=[...Ge.value],l={target_storage:e,target_path:t,preserve_paths:He.value,include_empty_folders:ne.value,source_folders:n};return He.value?l.source_storage=a.storage||void 0:"storage"===a.mode&&W.value.length?(l.source_storage=a.storage||void 0,J.value.length&&(l.file_ids=J.value.map(String))):"folders"===a.mode&&0===J.value.length?(l.folder_id=a.folder??null,l.recursive=!0):(l.file_ids=J.value.map(String),a.storage&&(l.source_storage=a.storage)),l}(),t=await o.post("/storage-manager/migrate/dry-run",e);le.value=t.data?.data??null}catch(e){window.alert(e?.response?.data?.errors?.[0]?.message||e?.message||"Dry run failed")}finally{te.value=!1}}}async function Bt(){const e=Z.value.location,t=Z.value.path||"";if(!e)return;ee.value=!0;const n=[...Ge.value],l=He.value;try{const r=He.value?((await o.get("/files",{params:{limit:-1,fields:["id"],filter:JSON.stringify({storage:{_eq:a.storage}})}})).data?.data||[]).map(e=>String(e.id)):await async function(){const e=new Set(J.value.map(String));if("folders"===a.mode&&0===e.size){try{const t=await o.get("/files",{params:{limit:-1,fields:["id"],filter:JSON.stringify(Ln(a.folder??null))}});for(const a of t.data?.data||[])e.add(String(a.id))}catch{}return Array.from(e)}if("storage"===a.mode&&a.storage&&W.value.length)for(const t of W.value){const n=String(t||"").replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");if(n)try{const t=await o.get("/files",{params:{limit:-1,fields:["id"],filter:JSON.stringify({_and:[{storage:{_eq:a.storage}},{filename_disk:{_starts_with:`${n}/`}}]})}});for(const a of t.data?.data||[])e.add(String(a.id))}catch{}}return Array.from(e)}();if(!r.length&&!n.length&&!He.value)return void window.alert("folders"===a.mode&&0===J.value.length?"This Directus folder has no files to move.":"No files selected.");if(!r.length&&(n.length||He.value)){const r=await o.post(`/storage-manager/storages/${encodeURIComponent(e)}/move-files`,{file_ids:[],target_path:t,source_folders:n,include_empty_folders:ne.value,source_storage:a.storage||void 0,preserve_paths:l});return It(r.data?.data?.skipped),G.value=!1,J.value=[],W.value=[],void await it()}const i=await o.get("/files",{params:{limit:-1,fields:["id","storage"],filter:JSON.stringify({id:{_in:r}})}}),s=i.data?.data||[],d=s.filter(t=>String(t.storage)!==e).map(e=>String(e.id));if(!d.length){const i=await o.post(`/storage-manager/storages/${encodeURIComponent(e)}/move-files`,{file_ids:r,target_path:t,source_folders:n,include_empty_folders:ne.value,source_storage:a.storage||void 0,preserve_paths:l});return It(i.data?.data?.skipped),G.value=!1,J.value=[],W.value=[],void await it()}G.value=!1,ee.value=!1;const u=D({file_ids:d,target_storage:e,mode:"move",target_path:t,source_folders:n,include_empty_folders:ne.value,source_storage:a.storage||void 0,preserve_paths:l},{estimatedCount:d.length});Fe.value=!0,await u;const c=s.filter(t=>String(t.storage)===e).map(e=>String(e.id));if(c.length){const a=await o.post(`/storage-manager/storages/${encodeURIComponent(e)}/move-files`,{file_ids:c,target_path:t,source_folders:n,include_empty_folders:ne.value,preserve_paths:l});It(a.data?.data?.skipped)}J.value=[],W.value=[],await it()}catch(e){window.alert(e?.response?.data?.errors?.[0]?.message||e?.message||"Move failed")}finally{ee.value=!1}}function It(e){const t=Number(e)||0;t>0&&window.alert(`${t.toLocaleString()} file${1===t?"":"s"} already exist at the destination and were left in place.`)}g(G,e=>{if(!e)return;le.value=null,ne.value=!0;const t=x.value.filter(e=>e.location!==a.storage),n=(He.value?t[0]?.location:null)||a.storage||x.value[0]?.location||"";Z.value={location:n,path:He.value?"":"storage"===a.mode&&be.value||""}}),g(()=>[Z.value.location,Z.value.path,ne.value],()=>{le.value=null});const Dt=l(()=>{const e=y.query.file;return"string"==typeof e&&e.length>0?e:null});function Ut(e){const t={...y.query,file:String(e)},a=new URLSearchParams;for(const[e,n]of Object.entries(t))if(null!=n&&""!==n)if(Array.isArray(n))for(const t of n)a.append(e,String(t));else a.set(e,String(n));const n=a.toString();return n?`${y.path}?${n}`:y.path}function Nt(e){e||(!function(){if(!("file"in y.query))return;const e={...y.query};delete e.file,k.replace({path:y.path,query:e})}(),it().catch(()=>{}))}function At(){"folders"!==a.mode?"storage"===a.mode&&(W.value=H.value.map(e=>e.path)):W.value=xe.value.map(e=>e.id)}function Et(e){const t=e.primaryKeyField?.field||"id",n="storage"===a.mode&&H.value.length>0&&!pe.value&&!fe.value;return{...e,hasPrependContent:n,selectMode:e.selectMode||W.value.length>0,getLinkForItem(e){const a=e?.[t];if(null!=a)return Ut(a)},onRowClick({item:e,event:a}){const n=e?.[t];if(null==n)return;if(J.value.length>0||W.value.length>0)return void(J.value.includes(n)?J.value=J.value.filter(e=>e!==n):J.value=J.value.concat(n));const l=Ut(n);a.ctrlKey||a.metaKey?window.open(k.resolve(l).href,"_blank"):k.push(l)}}}return(e,a)=>{const n=r("v-breadcrumb"),l=r("v-card-title"),o=r("v-checkbox"),g=r("v-button"),h=r("v-card-text"),y=r("v-card-actions"),k=r("v-card"),w=r("v-dialog"),F=r("v-icon"),M=r("v-divider"),B=r("v-notice"),I=r("v-info"),D=r("drawer-item"),j=r("sidebar-detail"),T=r("private-view"),R=V("tooltip");return i(),s(A(S(he)),{ref_key:"layoutRef",ref:N,selection:J.value,"onUpdate:selection":a[21]||(a[21]=e=>J.value=e),"layout-options":S(ce),"onUpdate:layoutOptions":a[22]||(a[22]=e=>C(ce)?ce.value=e:null),"layout-query":Pe.value,"onUpdate:layoutQuery":a[23]||(a[23]=e=>Pe.value=e),filter:S(Pn)(S(fe),ye.value),"filter-user":S(fe),"filter-system":ye.value,search:S(pe),collection:"directus_files","reset-preset":S(me)},{default:d(({layoutState:e})=>[u(T,{title:ke.value,icon:"storage"===t.mode?$e.value?.icon||"storage":"folder",class:$({dragging:S(ht)})},{headline:d(()=>[u(n,{items:Se.value},null,8,["items"])]),"actions:prepend":d(()=>[(i(),s(A(`layout-actions-${S(ue)}`),P(O(e)),null,16))]),actions:d(()=>[u(kt,{modelValue:S(pe),"onUpdate:modelValue":a[0]||(a[0]=e=>C(pe)?pe.value=e:null),filter:S(fe),"onUpdate:filter":a[1]||(a[1]=e=>C(fe)?fe.value=e:null),collection:"directus_files"},null,8,["modelValue","filter"]),"storage"===t.mode&&t.storage?(i(),s(Ha,{key:0,location:t.storage,"parent-path":be.value,onCreated:it},null,8,["location","parent-path"])):b("v-if",!0),We.value?(i(),s(w,{key:1,modelValue:G.value,"onUpdate:modelValue":a[5]||(a[5]=e=>G.value=e),onEsc:a[6]||(a[6]=e=>G.value=!1),onApply:Bt},{activator:d(({on:e})=>[z(u(wt,{icon:"folder_move",secondary:"",onClick:e},null,8,["onClick"]),[[R,Ye.value,void 0,{bottom:!0}]])]),default:d(()=>[u(k,null,{default:d(()=>[u(l,null,{default:d(()=>[p(m(Ye.value),1)]),_:1}),u(h,null,{default:d(()=>[Qe.value?(i(),c("p",On,m(Qe.value),1)):b("v-if",!0),u(dn,{modelValue:Z.value,"onUpdate:modelValue":a[2]||(a[2]=e=>Z.value=e)},null,8,["modelValue"]),Xe.value?(i(),c("p",jn,m(Xe.value),1)):b("v-if",!0),a[27]||(a[27]=_("p",{class:"move-destination-hint"}," Existing folders are merged. If another registered file already owns the destination path, the incoming file is skipped and stays on the source. ",-1)),He.value||Ge.value.length?(i(),s(o,{key:2,modelValue:ne.value,"onUpdate:modelValue":a[3]||(a[3]=e=>ne.value=e),label:"Include empty folders"},null,8,["modelValue"])):b("v-if",!0),_("div",Tn,[u(g,{secondary:"",loading:te.value,disabled:!Z.value.location,onClick:zt},{default:d(()=>[...a[24]||(a[24]=[p(" Dry Run ",-1)])]),_:1},8,["loading","disabled"]),le.value?(i(),c("div",Rn,[_("p",null,[_("strong",null,m(le.value.total_files.toLocaleString()),1),a[26]||(a[26]=p(" files ",-1)),le.value.total_folders?(i(),c(v,{key:0},[a[25]||(a[25]=p(" · ",-1)),_("strong",null,m(le.value.total_folders.toLocaleString()),1),p(" "+m(1===le.value.total_folders?"folder":"folders"),1)],64)):b("v-if",!0),le.value.empty_folders?(i(),c("span",qn," ("+m(le.value.empty_folders.toLocaleString())+" empty"+m(ne.value?"":", skipped")+") ",1)):b("v-if",!0),le.value.total_bytes?(i(),c(v,{key:2},[p(" · "+m(S(Ue)(le.value.total_bytes)),1)],64)):b("v-if",!0)]),le.value.skipped?(i(),c("p",Kn,m(le.value.skipped.toLocaleString())+" already at destination — skipped ",1)):b("v-if",!0),le.value.samples?.length?(i(),c("ul",Jn,[(i(!0),c(v,null,f(le.value.samples,(e,t)=>(i(),c("li",{key:t},[p(m(e.from)+" → "+m(e.to)+" ",1),e.skipped?(i(),c("span",Wn," (skipped)")):b("v-if",!0)]))),128))])):b("v-if",!0),le.value.samples?.length&&le.value.total_files>le.value.samples.length?(i(),c("p",Hn," Showing "+m(le.value.samples.length)+" of "+m(le.value.total_files.toLocaleString())+" files ",1)):b("v-if",!0)])):b("v-if",!0)])]),_:1}),u(y,null,{default:d(()=>[u(g,{secondary:"",onClick:a[4]||(a[4]=e=>G.value=!1)},{default:d(()=>[...a[28]||(a[28]=[p("Cancel",-1)])]),_:1}),u(g,{disabled:!Z.value.location,loading:ee.value,onClick:Bt},{default:d(()=>[...a[29]||(a[29]=[p(" Move ",-1)])]),_:1},8,["disabled","loading"])]),_:1})]),_:1})]),_:1},8,["modelValue"])):b("v-if",!0),Ze.value?z((i(),s(wt,{key:2,class:"action-delete",icon:"delete",secondary:"",disabled:se.value,onClick:tt},null,8,["disabled"])),[[R,"Delete",void 0,{bottom:!0}]]):b("v-if",!0),u(w,{modelValue:oe.value,"onUpdate:modelValue":a[8]||(a[8]=e=>oe.value=e),onEsc:a[9]||(a[9]=e=>oe.value=!1),onApply:Mt},{default:d(()=>[u(k,null,{default:d(()=>[u(l,null,{default:d(()=>[p("Delete "+m(1===J.value.length?"Item":"Items"),1)]),_:1}),u(h,null,{default:d(()=>[p(m(et.value),1)]),_:1}),u(y,null,{default:d(()=>[u(g,{secondary:"",onClick:a[7]||(a[7]=e=>oe.value=!1)},{default:d(()=>[...a[30]||(a[30]=[p("Cancel",-1)])]),_:1}),u(g,{kind:"danger",loading:se.value,onClick:Mt},{default:d(()=>[...a[31]||(a[31]=[p("Delete",-1)])]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1},8,["modelValue"]),"storage"===t.mode&&t.storage?(i(),s(_e,{key:3,modelValue:ie.value,"onUpdate:modelValue":a[10]||(a[10]=e=>ie.value=e),location:t.storage,paths:W.value,onDone:Vt},null,8,["modelValue","location","paths"])):b("v-if",!0),je.value?z((i(),s(wt,{key:4,icon:"account_tree",secondary:"",onClick:a[11]||(a[11]=e=>X.value=!0)},null,512)),[[R,t.folder?"Materialize This Folder":"Materialize Root Folders",void 0,{bottom:!0}]]):b("v-if",!0),z(u(wt,{icon:"add",loading:S(_t),onClick:Ct},null,8,["loading"]),[[R,"Upload File",void 0,{bottom:!0}]])]),navigation:d(()=>[u(De)]),sidebar:d(()=>[u($t,{modelValue:S(ue),"onUpdate:modelValue":a[15]||(a[15]=e=>C(ue)?ue.value=e:null)},{default:d(()=>[(i(),s(A(`layout-options-${S(ue)}`),P(O(e)),null,16))]),_:2},1032,["modelValue"]),(i(),s(A(`layout-sidebar-${S(ue)}`),P(O(e)),null,16)),u(j,{id:"actions",icon:"swap_horiz",title:"Actions"},{default:d(()=>[_("div",Gn,["storage"===t.mode&&Je.value?(i(),s(g,{key:0,secondary:"","full-width":"",class:"sidebar-btn",onClick:ut},{default:d(()=>[p(m(qe.value),1)]),_:1})):b("v-if",!0),Te.value?(i(),s(g,{key:1,"full-width":"",class:"sidebar-btn sidebar-btn-primary",onClick:a[16]||(a[16]=e=>G.value=!0)},{default:d(()=>[p(" Move all on "+m(t.storage),1)]),_:1})):b("v-if",!0),je.value?(i(),s(g,{key:2,"full-width":"",class:"sidebar-btn",onClick:a[17]||(a[17]=e=>X.value=!0)},{default:d(()=>[p(m(t.folder?"Materialize This Folder":"Materialize Root Folders"),1)]),_:1})):b("v-if",!0)])]),_:1}),"storage"===t.mode&&$e.value?(i(),s(j,{key:0,id:"storage-info",icon:"info",title:"Storage Info"},{default:d(()=>[_("p",Yn,m($e.value.label),1),u(Re,{usage:$e.value,compact:"",plain:""},null,8,["usage"])]),_:1})):(i(),s(j,{key:1,id:"directus-folders-info",icon:"info",title:"Directus Folders"},{default:d(()=>[_("p",Xn,m(S("A Directus folder is virtual — it organises files across any storage adapter. When Mirror Directus Folders is enabled on a storage, new uploads land on the matching physical path and folder renames or deletes are kept in sync on that adapter. Files on other adapters are unaffected.")),1),a[43]||(a[43]=_("p",{class:"sidebar-text"}," Use Move to Storage Folder to relocate files onto a physical path. Materialize builds storage folders from this virtual tree. At a storage root, Move all uses the same dialog. ",-1)),Ae.value?(i(),s(B,{key:0,type:"info",class:"sidebar-multi-notice"},{default:d(()=>[p(" Files on "+m(de.value.length)+" storages: ",1),_("strong",null,m(de.value.join(", ")),1)]),_:1})):b("v-if",!0)]),_:1}))]),default:d(()=>[S(yt)?(i(),c(v,{key:0},[a[32]||(a[32]=_("div",{class:"drop-border top"},null,-1)),a[33]||(a[33]=_("div",{class:"drop-border right"},null,-1)),a[34]||(a[34]=_("div",{class:"drop-border bottom"},null,-1)),a[35]||(a[35]=_("div",{class:"drop-border left"},null,-1))],64)):b("v-if",!0),we.value?(i(),c("div",{key:1,class:$(S(U))},[u(M,{class:"section-divider",large:"","inline-title":!1,style:{"--v-divider-color":"var(--theme--border-color-subdued)"}},{icon:d(()=>[u(F,{name:"folder_special"})]),default:d(()=>[a[36]||(a[36]=p(" Directus Folders ",-1))]),_:1}),_("p",Qn,m(S("Browse the Directus folder tree. Use Move to Storage Folder to place files on a physical path, or Materialize to build that folder tree on disk. The virtual structure in the File Library is never changed here.")),1)],2)):b("v-if",!0),Ae.value?(i(),s(B,{key:2,type:"info",class:"multi-storage-notice"},{default:d(()=>[p(m(Oe.value),1)]),_:1})):b("v-if",!0),(i(),s(A(`layout-${S(ue)}`),E(Et(e),{"extra-selection":W.value,"onUpdate:extraSelection":a[14]||(a[14]=e=>W.value=e),onSelectAll:At}),L({"no-results":d(()=>[S(fe)||S(pe)?(i(),s(I,{key:1,title:"No results",icon:"search",center:""},{append:d(()=>[u(g,{onClick:dt},{default:d(()=>[...a[39]||(a[39]=[p("Clear filters",-1)])]),_:1})]),default:d(()=>[a[40]||(a[40]=p(" No files match your search or filters. ",-1))]),_:1})):(i(),s(I,{key:0,title:"No files",icon:"folder",center:""},{append:d(()=>[u(g,{onClick:Ct},{default:d(()=>[...a[37]||(a[37]=[p("Add File",-1)])]),_:1})]),default:d(()=>[a[38]||(a[38]=p(" Drop files here to upload, or use the + button. ",-1))]),_:1}))]),"no-items":d(()=>[u(I,{title:"No files",icon:"folder",center:""},{append:d(()=>[u(g,{onClick:Ct},{default:d(()=>[...a[42]||(a[42]=[p("Add File",-1)])]),_:1})]),default:d(()=>[Q.value?(i(),c(v,{key:0},[p("Loading storage folders…")],64)):(i(),c(v,{key:1},[a[41]||(a[41]=p(" Drop files here to upload, or use the + button. ",-1)),"storage"===t.mode?(i(),c(v,{key:0},[p(" Create a storage folder with the folder icon. ")],64)):b("v-if",!0)],64))]),_:1})]),_:2},["storage"!==t.mode||!H.value.length||S(pe)||S(fe)?"folders"!==t.mode||!xe.value.length||S(pe)||S(fe)?void 0:{name:"prepend",fn:d(()=>[u(ln,{selection:W.value,"onUpdate:selection":a[13]||(a[13]=e=>W.value=e),folders:xe.value,"any-file-selection":J.value.length>0},null,8,["selection","folders","any-file-selection"])]),key:"1"}:{name:"prepend",fn:d(()=>[u(Za,{selection:W.value,"onUpdate:selection":a[12]||(a[12]=e=>W.value=e),location:t.storage,folders:H.value,"any-file-selection":J.value.length>0,onChanged:it},null,8,["selection","location","folders","any-file-selection"])]),key:"0"}]),1040,["extra-selection"])),Dt.value?(i(),s(D,{key:3,collection:"directus_files","primary-key":Dt.value,active:!0,"onUpdate:active":Nt},null,8,["primary-key"])):b("v-if",!0),u(cn,{modelValue:gt.value,"onUpdate:modelValue":a[18]||(a[18]=e=>gt.value=e),title:St.value,uploading:S(_t),onFiles:Ft},null,8,["modelValue","title","uploading"]),u(Ua,{modelValue:Fe.value,"onUpdate:modelValue":a[19]||(a[19]=e=>Fe.value=e),storages:S(x),"source-storage":"storage"===t.mode&&t.storage||null,"selection-kind":Ve.value,"file-ids":ze.value.length?ze.value:J.value,"folder-id":"folders"===t.mode?t.folder??null:null,"source-path":"storage"===t.mode&&be.value||null,"estimated-count":Be.value,"estimated-bytes":Ie.value,onDone:vt},null,8,["modelValue","storages","source-storage","selection-kind","file-ids","folder-id","source-path","estimated-count","estimated-bytes"]),"storage"===t.mode&&t.storage?(i(),s(Wa,{key:4,"model-value":Me.value,location:t.storage,"storage-path":be.value||null,"onUpdate:modelValue":ct,onImported:ft},null,8,["model-value","location","storage-path"])):b("v-if",!0),"folders"===t.mode?(i(),s(Vn,{key:5,modelValue:X.value,"onUpdate:modelValue":a[20]||(a[20]=e=>X.value=e),storages:S(x),"folder-id":t.folder??null,onDone:pt},null,8,["modelValue","storages","folder-id"])):b("v-if",!0)]),_:2},1032,["title","icon","class"])]),_:1},40,["selection","layout-options","layout-query","filter","filter-user","filter-system","search","reset-preset"])}}});me("\n.drop-border[data-v-b7c1d87c] {\n\tposition: fixed;\n\tz-index: 500;\n\tbackground-color: var(--theme--primary);\n}\n.drop-border.top[data-v-b7c1d87c],\n.drop-border.bottom[data-v-b7c1d87c] {\n\tinline-size: 100%;\n\tblock-size: 0.25rem;\n}\n.drop-border.left[data-v-b7c1d87c],\n.drop-border.right[data-v-b7c1d87c] {\n\tinline-size: 0.25rem;\n\tblock-size: 100%;\n}\n.drop-border.top[data-v-b7c1d87c] {\n\tinset-block-start: 0;\n\tinset-inline-start: 0;\n}\n.drop-border.right[data-v-b7c1d87c] {\n\tinset-block-start: 0;\n\tinset-inline-end: 0;\n}\n.drop-border.bottom[data-v-b7c1d87c] {\n\tinset-block-end: 0;\n\tinset-inline-start: 0;\n}\n.drop-border.left[data-v-b7c1d87c] {\n\tinset-block-start: 0;\n\tinset-inline-start: 0;\n}\n.dragging[data-v-b7c1d87c] * {\n\tpointer-events: none;\n}\n.dragging[data-v-b7c1d87c] [data-dropzone] {\n\tpointer-events: all;\n}\n.sidebar-actions[data-v-b7c1d87c] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n\n/* Sidebar panel bg often matches --theme--background-normal, so default\n secondary buttons look like plain text. Force a visible chip fill. */\n.sidebar-actions[data-v-b7c1d87c] .sidebar-btn {\n\tdisplay: flex;\n\twidth: 100%;\n}\n.sidebar-actions[data-v-b7c1d87c] .sidebar-btn .button {\n\twidth: 100%;\n\tjustify-content: center;\n\tcolor: var(--theme--foreground);\n\tbackground-color: var(--theme--background-accent);\n\tborder-color: var(--theme--background-accent);\n}\n.sidebar-actions[data-v-b7c1d87c] .sidebar-btn .button:hover:not(:disabled) {\n\tbackground-color: var(--theme--background-normal);\n\tborder-color: var(--theme--background-normal);\n}\n\n/* Theme fill only when enabled — disabled stays gray like secondary */\n.sidebar-actions[data-v-b7c1d87c] .sidebar-btn-primary .button:not(:disabled) {\n\tcolor: var(--foreground-inverted, var(--theme--primary-foreground, #fff));\n\tbackground-color: var(--theme--primary);\n\tborder-color: var(--theme--primary);\n}\n.sidebar-actions[data-v-b7c1d87c] .sidebar-btn-primary .button:hover:not(:disabled) {\n\tbackground-color: var(--theme--primary-accent);\n\tborder-color: var(--theme--primary-accent);\n}\n.sidebar-actions[data-v-b7c1d87c] .sidebar-btn .button:disabled {\n\tcolor: var(--theme--foreground-subdued);\n\tbackground-color: var(--theme--background-accent);\n\tborder-color: var(--theme--background-accent);\n\topacity: 0.65;\n\tcursor: not-allowed;\n}\n.sidebar-text[data-v-b7c1d87c] {\n\tmargin: 0;\n\tline-height: 1.45;\n}\n.sidebar-note[data-v-b7c1d87c] {\n\tmargin-block-end: 12px;\n\tpadding: 10px 12px;\n\tfont-size: 12px;\n\tline-height: 1.45;\n\tcolor: var(--theme--foreground);\n\tbackground: var(--theme--background-normal);\n\tborder-radius: var(--theme--border-radius);\n\tborder: var(--theme--border-width) solid var(--theme--border-color-subdued);\n}\n.page-container[data-v-b7c1d87c] {\n\tpadding: var(--content-padding);\n\tpadding-block-end: 0;\n\tmax-inline-size: 67.5rem;\n}\n.page-container--flush-top[data-v-b7c1d87c] {\n\tpadding-block-start: 0;\n}\n.section-divider[data-v-b7c1d87c] {\n\tmargin-bottom: 12px;\n}\n.page-intro[data-v-b7c1d87c] {\n\tmargin: 0 0 24px;\n\tline-height: 1.55;\n\tcolor: var(--theme--foreground);\n}\n.move-hint[data-v-b7c1d87c] {\n\tmargin: 0 0 12px;\n\tline-height: 1.45;\n\tcolor: var(--theme--foreground-subdued);\n}\n.move-destination-hint[data-v-b7c1d87c] {\n\tmargin: 10px 0 0;\n\tfont-size: 13px;\n\tcolor: var(--theme--foreground-subdued);\n}\n.move-dry-run[data-v-b7c1d87c] {\n\tmargin-top: 16px;\n}\n.move-dry-result[data-v-b7c1d87c] {\n\tmargin-top: 12px;\n\tline-height: 1.5;\n}\n.move-samples[data-v-b7c1d87c] {\n\tmargin: 8px 0 0;\n\tpadding-inline-start: 18px;\n\tmax-height: 180px;\n\toverflow: auto;\n\tfont-size: 12px;\n\tline-height: 1.45;\n\tcolor: var(--theme--foreground-subdued);\n}\n.multi-storage-notice[data-v-b7c1d87c] {\n\tmargin: 12px var(--content-padding, 16px) 0;\n}\n.sidebar-multi-notice[data-v-b7c1d87c] {\n\tmargin-block-start: 12px;\n}\n.action-delete[data-v-b7c1d87c] {\n\t--v-button-background-color-hover: var(--theme--danger) !important;\n\t--v-button-color-hover: var(--white, #fff) !important;\n}\n.storage-label[data-v-b7c1d87c] {\n\tmargin-bottom: 10px;\n\tfont-weight: 600;\n}\n",{});me("\n.storage-location-badge {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tmax-inline-size: 100%;\n\tpadding: 2px 8px;\n\toverflow: hidden;\n\tfont-size: 11px;\n\tfont-weight: 600;\n\tline-height: 1.35;\n\tcolor: var(--theme--primary-foreground, var(--white, #fff));\n\twhite-space: nowrap;\n\ttext-overflow: ellipsis;\n\tpointer-events: none;\n\tbackground: var(--theme--primary);\n\tborder: none;\n\tborder-radius: var(--theme--border-radius);\n}\n.layout-cards .header .storage-location-badge {\n\tposition: absolute;\n\tinset-block-end: 8px;\n\tinset-inline-start: 8px;\n\tz-index: 2;\n\tmax-inline-size: calc(100% - 16px);\n\tbox-shadow: 0 1px 3px rgb(38 50 56 / 0.2);\n}\n",{});var tl=ge(el,[["__scopeId","data-v-b7c1d87c"]]),al=o({__name:"storage-view",setup(e){const t=R(),a=l(()=>String(t.params.location||"")),n=l(()=>{const e=t.params.storagePath;return Se(Array.isArray(e)?e.map(String).join("/"):String(e||""))});return(e,t)=>(i(),s(tl,{mode:"storage",storage:a.value,"storage-path":n.value},null,8,["storage","storage-path"]))}}),nl=o({__name:"folders-view",setup(e){const t=R(),a=l(()=>{const e=t.params.folderId;return e?String(e):null});return(e,t)=>(i(),s(tl,{mode:"folders",folder:a.value||void 0},null,8,["folder"]))}});function ll(){const a=e(),{useUserStore:l,useSettingsStore:o}=t(),r=l(),i=o(),s=n(!1),d=n(!1),u=n({locations:{}});let c=null;return{loading:s,cleaning:d,settings:u,ensureLoaded:async function(e=!1){return c&&!e||(c=(async()=>{s.value=!0;try{const t=await a.get("/storage-manager/settings");u.value=(e=t.data?.data??{locations:{}},et({locations:{},...e}))}finally{s.value=!1}var e})()),c},exportStorageManagerConfig:function(){const e={...u.value,storage_manager:u.value,exported_at:(new Date).toISOString(),extension:"directus-extension-storage-manager"},t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),a=URL.createObjectURL(t),n=document.createElement("a"),l=(new Date).toISOString().slice(0,19).replace(/[:T]/g,"-");n.href=a,n.download=`storage-manager-${l}.json`,n.click(),URL.revokeObjectURL(a)},importStorageManagerConfig:async function(e){if(!J(r.currentUser))throw new Error("Admin access required");const t=et(e);u.value=t,await a.patch("/storage-manager/settings",{locations:t.locations});try{await(i.hydrate?.())}catch{}c=null},cleanupExtensionData:async function(){if(!J(r.currentUser))throw new Error("Admin access required");d.value=!0;let e=!1,t=!1;try{try{await a.patch("/settings",{[Je]:null}),e=!0}catch(e){const t=e?.response?.status,a=String(e?.response?.data?.errors?.[0]?.message||e?.message||"");if(400!==t&&403!==t&&!/unknown|does not exist|forbidden/i.test(a))throw e}try{await a.delete(`/fields/directus_settings/${Je}`),t=!0}catch(e){const a=e?.response?.status;if(404!==a)throw e;t=!0}u.value={locations:{}},c=null;try{await(i.hydrate?.())}catch{}return{clearedValue:e,deletedField:t}}finally{d.value=!1}}}}const ol={class:"actions"},rl={key:0,class:"result"},il={class:"actions"},sl={key:1,class:"result"},dl={key:2,class:"result"},ul={key:3,class:"result"};var cl=o({__name:"settings-view",setup(t){const a=Ke(),o=e(),f=l(()=>"/admin/settings/marketplace/extension/88a7639e-db2a-4ade-a97f-94d2cc3836e7"),{loading:g,cleaning:y,ensureLoaded:k,cleanupExtensionData:w,exportStorageManagerConfig:x,importStorageManagerConfig:C}=ll(),F=n(!1),M=n(null),V=n(null),z=n(!1),B=n(null),I=n(null),D=n(!1),U=n(null),N=l(()=>U.value?U.value.error||U.value.has_update?"warning":"success":"info");function A(){B.value=null,x()}function E(){B.value=null,I.value?.click()}async function L(e){const t=e.target,a=t.files?.[0];if(t.value="",a){z.value=!0,B.value=null;try{const e=await a.text(),t=JSON.parse(e);await C(t),B.value={type:"success",text:"Config imported and saved to settings."}}catch(e){B.value={type:"danger",text:e?.response?.data?.errors?.[0]?.message||e?.message||"Import failed"}}finally{z.value=!1}}}async function P(){M.value=null,V.value=null,B.value=null;try{V.value=await w(),F.value=!1}catch(e){M.value=e?.response?.data?.errors?.[0]?.message||e?.message||"Cleanup failed"}}return h(()=>{k()}),(e,t)=>{const n=r("v-breadcrumb"),l=r("sidebar-detail"),h=r("v-icon"),k=r("v-divider"),w=r("v-button"),x=r("v-notice"),C=r("v-card-title"),O=r("v-card-text"),j=r("v-card-actions"),T=r("v-card"),R=r("v-dialog"),q=r("private-view");return i(),s(q,{title:"Settings",icon:"settings"},{headline:d(()=>[u(n,{items:[{name:"Storage Manager",to:"/storage-manager"}]})]),navigation:d(()=>[u(De)]),sidebar:d(()=>[u(l,{id:"about",icon:"info",title:"About"},{default:d(()=>[...t[5]||(t[5]=[_("p",{class:"sidebar-text"}," Export or import this extension’s JSON config, or remove the dedicated settings field before uninstalling. ",-1)])]),_:1})]),default:d(()=>[_("div",{class:$(S(a))},[u(k,{class:"section-divider",large:"","inline-title":!1,style:{"--v-divider-color":"var(--theme--border-color-subdued)"}},{icon:d(()=>[u(h,{name:"system_update"})]),default:d(()=>[t[6]||(t[6]=p(" Extension Updates ",-1))]),_:1}),t[18]||(t[18]=_("p",{class:"explain"}," Check npm for the latest published version and compare it with the installed extension version. ",-1)),_("div",ol,[u(w,{secondary:"",loading:D.value,onClick:t[0]||(t[0]=e=>async function(e){D.value=!0;try{const t=await o.get("/storage-manager/update-check",{params:{force:e?"1":void 0}});U.value=t.data?.data||null}catch(e){U.value={current_version:"unknown",latest_version:null,has_update:!1,checked_at:(new Date).toISOString(),error:e?.response?.data?.errors?.[0]?.message||e?.message||"Update check failed",links:{npm:"https://www.npmjs.com/package/directus-extension-storage-manager",github:"https://github.com/domdus/directus-extension-storage-manager",marketplace:f.value}}}finally{D.value=!1}}(!0))},{default:d(()=>[...t[7]||(t[7]=[p("Check now",-1)])]),_:1},8,["loading"]),U.value?.has_update&&f.value?(i(),s(w,{key:0,secondary:"",to:f.value},{default:d(()=>[...t[8]||(t[8]=[p(" Marketplace ",-1)])]),_:1},8,["to"])):b("v-if",!0)]),U.value?(i(),c("div",rl,[u(x,{type:N.value},{default:d(()=>[t[10]||(t[10]=p(" Current: ",-1)),_("strong",null,m(U.value.current_version),1),U.value.latest_version?(i(),c(v,{key:0},[t[9]||(t[9]=p(" · Latest: ",-1)),_("strong",null,m(U.value.latest_version),1)],64)):b("v-if",!0),U.value.error?(i(),c(v,{key:1},[p(" · "+m(U.value.error),1)],64)):U.value.has_update?(i(),c(v,{key:2},[p(" · Update available")],64)):(i(),c(v,{key:3},[p(" · Up to date")],64))]),_:1},8,["type"])])):b("v-if",!0),u(k,{class:"section-divider",large:"","inline-title":!1,style:{"--v-divider-color":"var(--theme--border-color-subdued)"}},{icon:d(()=>[u(h,{name:"import_export"})]),default:d(()=>[t[11]||(t[11]=p(" Export / Import ",-1))]),_:1}),t[19]||(t[19]=_("p",{class:"explain"},[p(" Back up or restore Mirror Directus Folders settings as JSON, or remove the dedicated "),_("code",null,"storage_manager"),p(" settings field before uninstalling. Per-location rules are stored in "),_("code",null,"directus_settings.storage_manager"),p(" only — other project settings are left untouched. ")],-1)),_("div",il,[u(w,{secondary:"",disabled:S(g)||S(y),onClick:A},{default:d(()=>[...t[12]||(t[12]=[p("Export JSON",-1)])]),_:1},8,["disabled"]),u(w,{secondary:"",disabled:S(g)||S(y)||z.value,loading:z.value,onClick:E},{default:d(()=>[...t[13]||(t[13]=[p(" Import JSON ",-1)])]),_:1},8,["disabled","loading"]),_("input",{ref_key:"fileInput",ref:I,type:"file",accept:"application/json,.json",class:"file-input",onChange:L},null,544)]),B.value?(i(),c("div",sl,[u(x,{type:B.value.type},{default:d(()=>[p(m(B.value.text),1)]),_:1},8,["type"])])):b("v-if",!0),u(k,{class:"section-divider add-margin-top",large:"","inline-title":!1,style:{"--v-divider-color":"var(--theme--border-color-subdued)"}},{icon:d(()=>[u(h,{name:"delete"})]),default:d(()=>[t[14]||(t[14]=p(" Remove extension data ",-1))]),_:1}),t[20]||(t[20]=_("p",{class:"explain"},[p(" Storage folder and sync settings live in a dedicated JSON field "),_("code",null,"directus_settings.storage_manager"),p(". Cleanup removes only that field and its value. If the extension stays installed, the next Directus restart may recreate an empty "),_("code",null,"storage_manager"),p(" field. ")],-1)),u(x,{type:"warning",class:"notice"},{default:d(()=>[...t[15]||(t[15]=[p(" Deleting extension data cannot be undone. Export first if you might need the config again. ",-1)])]),_:1}),V.value?(i(),c("div",dl,[u(x,{type:"success"},{default:d(()=>[t[16]||(t[16]=p(" Cleanup finished. ",-1)),V.value.clearedValue?(i(),c(v,{key:0},[p(" Value cleared.")],64)):b("v-if",!0),V.value.deletedField?(i(),c(v,{key:1},[p(" Field removed.")],64)):b("v-if",!0)]),_:1})])):b("v-if",!0),M.value?(i(),c("div",ul,[u(x,{type:"danger"},{default:d(()=>[p(m(M.value),1)]),_:1})])):b("v-if",!0),u(w,{kind:"danger",loading:S(y),disabled:S(y),onClick:t[1]||(t[1]=e=>F.value=!0)},{default:d(()=>[...t[17]||(t[17]=[p(" Delete storage_manager data ",-1)])]),_:1},8,["loading","disabled"])],2),u(R,{modelValue:F.value,"onUpdate:modelValue":t[3]||(t[3]=e=>F.value=e),onEsc:t[4]||(t[4]=e=>F.value=!1)},{default:d(()=>[u(T,null,{default:d(()=>[u(C,null,{default:d(()=>[...t[21]||(t[21]=[p("Delete storage_manager?",-1)])]),_:1}),u(O,null,{default:d(()=>[...t[22]||(t[22]=[p(" This removes only ",-1),_("code",null,"directus_settings.storage_manager",-1),p(" (the extension’s own JSON field). All other project settings stay as they are. ",-1)])]),_:1}),u(j,null,{default:d(()=>[u(w,{secondary:"",onClick:t[2]||(t[2]=e=>F.value=!1)},{default:d(()=>[...t[23]||(t[23]=[p("Cancel",-1)])]),_:1}),u(w,{kind:"danger",loading:S(y),onClick:P},{default:d(()=>[...t[24]||(t[24]=[p("Delete",-1)])]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})}}});me("\n.page-container[data-v-e3d57b64] {\n\tpadding: var(--content-padding);\n\tpadding-block-end: var(--content-padding-bottom);\n\tmax-inline-size: 67.5rem;\n}\n.page-container--flush-top[data-v-e3d57b64] {\n\tpadding-block-start: 0;\n}\n.section-divider[data-v-e3d57b64] {\n\tmargin-bottom: 12px;\n}\n.section-divider.add-margin-top[data-v-e3d57b64] {\n\tmargin-top: 40px;\n}\n.explain[data-v-e3d57b64],\n.sidebar-text[data-v-e3d57b64] {\n\tmargin: 0 0 16px;\n\tline-height: 1.55;\n\tcolor: var(--theme--foreground);\n}\n.explain code[data-v-e3d57b64],\n.sidebar-text code[data-v-e3d57b64],\n.v-card-text code[data-v-e3d57b64] {\n\tfont-family: var(--theme--fonts--monospace--font-family, monospace);\n\tfont-size: 0.9em;\n}\n.actions[data-v-e3d57b64] {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n\tmargin-bottom: 16px;\n}\n.file-input[data-v-e3d57b64] {\n\tdisplay: none;\n}\n.notice[data-v-e3d57b64],\n.result[data-v-e3d57b64] {\n\tmargin-bottom: 16px;\n}\n",{});const vl=[],fl=[],pl=[],ml=[a({id:"storage-manager",name:"Storage Manager",icon:"storage",routes:[{path:"",component:pt},{path:"storage/:location",component:al},{path:"storage/:location/path/:storagePath(.*)",component:al},{path:"folders",component:nl},{path:"folders/:folderId",component:nl},{path:"settings",component:ge(cl,[["__scopeId","data-v-e3d57b64"]])}],preRegisterCheck:e=>J(e)})],gl=[],hl=[],bl=[{id:"storage-manager-operation",name:"Storage Manager",icon:"swap_horiz",description:"Copy or move Directus files between storage adapters (same file id)",overview:({mode:e,target_storage:t,source_storage:a,folder_id:n})=>[{label:"Mode",text:String(e||"move")},{label:"Target",text:String(t||"")},{label:"Source",text:String(a||n||"file_ids")}],options:[{field:"mode",name:"Mode",type:"string",meta:{width:"half",interface:"select-dropdown",options:{choices:[{text:"Move (delete source after verify)",value:"move"},{text:"Copy (keep source)",value:"copy"}]},note:"Move only deletes the source object after the target is verified and the DB row is updated."},schema:{default_value:"move"}},{field:"target_storage",name:"Target Storage",type:"string",meta:{width:"half",interface:"input",options:{placeholder:"s3"},note:"Must match a configured STORAGE_LOCATIONS name."},schema:{required:!0}},{field:"file_ids",name:"File IDs",type:"json",meta:{width:"full",interface:"input-code",options:{language:"json",placeholder:'["uuid-1", "uuid-2"]'},note:"Optional JSON array of file UUIDs. Leave empty when using source storage or folder."}},{field:"source_storage",name:"Source Storage",type:"string",meta:{width:"half",interface:"input",options:{placeholder:"local"},note:"Migrate all files currently on this storage location."}},{field:"folder_id",name:"Folder ID",type:"uuid",meta:{width:"half",interface:"system-folder",note:"Migrate files in this folder (optional)."}},{field:"recursive",name:"Include Subfolders",type:"boolean",meta:{width:"half",interface:"boolean",note:"When a folder is selected, also migrate files in nested folders."},schema:{default_value:!0}}]}];export{fl as displays,vl as interfaces,pl as layouts,ml as modules,bl as operations,gl as panels,hl as themes};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "directus-extension-storage-manager",
|
|
3
3
|
"description": "Browse, upload, detect, materialize, and move Directus files across storage adapters (local, S3, GCS, Azure, and more)",
|
|
4
4
|
"icon": "storage",
|
|
5
|
-
"version": "1.2.
|
|
5
|
+
"version": "1.2.8",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"directus",
|