@nuxt/devtools
Version:
The Nuxt DevTools gives you insights and transparency about your Nuxt App.
17 lines (16 loc) • 21.5 kB
JavaScript
import{G as ee,H as X,_ as te,I as ne,J as R,K as ce,L as pe,M as me,r as J,E as W,v as se,N as ve,O as fe,c as le,A as ge,a as he,w as _e,P as xe,Q as be,R as we,S as ye,T as $e,g as ke,U as Ce}from"./kbaft34e.js";import{_ as Ve}from"./ncheckbox.vue-iynvr0dq.js";import{_ as Pe}from"./ndropdown.vue-gv9hrgf2.js";import{_ as Ae}from"./nnavbar.vue-bpb24x03.js";import{p as Z,k as T,ai as oe,J as i,a3 as o,Z as H,u as m,ac as K,a5 as d,S as t,ab as D,F as z,ag as G,V,U as S,a4 as h,q as U,X as ae,aa as N,W as De,j as Ne,at as Fe,Y as Se}from"./vendor/json-editor-vue-pb6xqf2y.js";import{_ as Ue}from"./nsection-block-fo7lswlq.js";import{_ as Ie}from"./filepath-item.vue-iqnkpprc.js";import{_ as Te}from"./code-snippets.vue-mo9b1dqm.js";import{_ as je}from"./ndrawer.vue-cpy3f9je.js";import{D as Ee}from"./constants-b32h69zq.js";import"./vendor/unocss-k776m6tm.js";import"./vendor/shiki-hjqm7vcp.js";import"./nicon-title.vue-d27ih16g.js";import"./ncode-block.vue-lge6rogf.js";import"./client-jlcyzfwz.js";const Be={key:0,"h-full":"","w-full":"",flex:"","items-center":"","justify-center":""},Le={for:"drop-zone-input","text-3xl":"",hover:"text-green cursor-pointer","transition-all":""},ze={key:1,relative:"","h-full":"","w-full":"",grid:"~ rows-[max-content_1fr_max-content]"},Oe={grid:"~ cols-minmax-8rem gap-8","overflow-auto":"",p6:""},Re={flex:"","items-center":"","justify-center":"","of-hidden":"",rounded:"","rounded-t-lg":"","bg-active":"","object-cover":"",class:"aspect-1/1",border:"~ base"},Me=["src"],Ke={flex:"~ gap1","items-center":""},qe={flex:"~ gap-2","items-center":"","justify-center":"",p8:""},Ge=Z({__name:"AssetDropZone",props:{modelValue:{type:Boolean,required:!0},folder:{type:String,required:!0}},setup(L){const l=L,f=ee(l,"modelValue"),C=T(),n=T([]);function v(s){C.value=s.target,f.value=!0}function x(s){s.target===C.value&&(f.value=!1)}function j(s){s.preventDefault()}function P(s){s.preventDefault(),_(s.dataTransfer.files)}function _(s){const c=Array.from(s||[]);if(c.length){const g=[],w=n.value.map(u=>u.name);for(const u of c)if(w.includes(u.name)){let A=1;const[y,B]=u.name.split(".");for(;w.includes(`${y} (${A}).${B}`);)A++;const M=`${y}-${A}.${B}`,a=new Blob([u],{type:u.type}),e=new File([a],M,{lastModified:Date.now()});g.push(e),w.push(M)}else u.type===""&&R({message:"Folders are not supported yet",icon:"carbon:face-dissatisfied",classes:"text-orange"}),g.push(u);n.value=[...n.value,...g]}}async function E(){if(ce.value||pe.value)return;me("assets:upload");const s=[];for(const c of n.value){const g=new FileReader;g.readAsDataURL(c);const u=(await new Promise(A=>{g.onload=()=>A(g.result)})).split(";base64,").pop();s.push({path:c.name,encoding:"base64",content:u})}await J.writeStaticAssets(await W(),[...s],l.folder).then(()=>{p(),R({message:"Files uploaded successfully!",icon:"i-carbon:checkmark"})}).catch(c=>{p(),R({message:`Error uploading files: ${c?.message??"unknown"}`,icon:"i-carbon-warning",classes:"text-red"})}),f.value=!1}function q(s){n.value?.splice(s,1)}function O(s){return URL.createObjectURL(s)}function b(s,c){const[g,w]=s.name.split("."),u=c.replace(/\.\w+$/,""),A=`${u}.${w}`;return u.length===0?(alert("File name must be at least 1 characters long"),g):(Object.defineProperty(s,"name",{value:A,writable:!1}),n.value.splice(n.value.indexOf(s),1,s),s)}function r(){n.value=[]}function p(){f.value=!1,r()}return X("dragenter",v),X("dragleave",x),X("dragover",j),X("drop",P),(s,c)=>{const g=te,w=ne,u=se,A=oe("tooltip");return o(),i("div",{fixed:"","bottom-0":"","left-13":"","right-0":"","top-0":"","z-10":"","backdrop-blur-20":"","transition-all":"",class:H(m(f)?"opacity-100 visible":"opacity-0 invisible")},[K(d(g,{icon:"carbon-close",title:"Close",absolute:"","right-5":"","top-5":"","z-20":"","text-xl":"",border:!1,onClick:p},null,512),[[A,"Close",void 0,{"bottom-end":!0}]]),n.value?.length?(o(),i("div",ze,[c[4]||(c[4]=t("div",{px6:"",py6:""},[t("h1",{"text-2xl":""}," Upload "),t("p",{"text-sm":"",op50:""}," Drag and drop files to upload ")],-1)),t("div",Oe,[(o(!0),i(z,null,G(n.value,(y,B)=>(o(),i("div",{key:y.name,flex:"~ col gap-2",relative:"","h-50":"","w-40":"","items-center":""},[t("div",Re,[t("img",{"h-full":"","w-full":"","rounded-t-lg":"","object-cover":"",src:O(y)},null,8,Me)]),t("div",Ke,[d(u,{n:"xs","h-full":"","flex-auto":"","model-value":y.name,"onUpdate:modelValue":M=>b(y,M.target.value)},null,8,["model-value","onUpdate:modelValue"]),d(g,{n:"red",icon:"carbon-trash-can","h-full":"","flex-none":"",title:"Remove file",onClick:M=>q(B)},null,8,["onClick"])])]))),128))]),t("div",qe,[n.value.length?(o(),V(g,{key:0,n:"red",onClick:r},{default:h(()=>[d(w,{icon:"carbon-clean"}),c[2]||(c[2]=D(" Clear "))]),_:1,__:[2]})):S("",!0),d(g,{disabled:!n.value.length,n:"primary solid",onClick:E},{default:h(()=>[d(w,{icon:"carbon-cloud-upload"}),c[3]||(c[3]=D(" Upload "))]),_:1,__:[3]},8,["disabled"])])])):(o(),i("div",Be,[t("label",Le,[d(w,{icon:"carbon-cloud-upload","mr-2":""}),c[1]||(c[1]=D(" Drop files here or click to select "))]),t("input",{id:"drop-zone-input",type:"file",multiple:"",hidden:"",onChange:c[0]||(c[0]=y=>_(y.target.files))},null,32)]))],2)}}}),Ze=Z({__name:"AssetFontPreview",props:{asset:{}},setup(L){const l=L,f=U(()=>`devtools-assets-${ve(l.asset)}`);return fe(U(()=>`
@font-face {
font-family: '${f.value}';
src: url('${l.asset.publicPath}');
}
`)),(C,n)=>(o(),i("div",{"of-hidden":"",style:ae({fontFamily:`'${f.value}'`})}," Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz ",4))}}),Je={flex:"","items-center":"","justify-center":"","of-hidden":"","bg-active":"","object-cover":"",p1:""},We=["src"],Xe={key:2,"i-carbon-document":"","text-3xl":"",op20:""},He={key:3,"w-full":"","self-start":"",p4:""},Qe=["textContent"],Ye={key:4},et=["src","autoplay","controls"],tt={key:5},nt={key:0,"i-carbon-volume-up":"","text-3xl":"",op20:""},ot=["src"],lt={key:6,"i-carbon-help":"","text-3xl":"",op20:""},ie=Z({__name:"AssetPreview",props:{asset:{},textContent:{},detail:{type:Boolean}},setup(L){return(l,f)=>{const C=Ze;return o(),i("div",Je,[l.asset.type==="image"?(o(),i("img",{key:0,src:l.asset.publicPath},null,8,We)):l.asset.type==="font"?(o(),V(C,{key:l.asset.publicPath,asset:l.asset,"self-stretch":"",p2:"","text-2xl":""},null,8,["asset"])):l.asset.type==="text"&&!l.textContent?(o(),i("div",Xe)):l.asset.type==="text"&&l.textContent?(o(),i("div",He,[t("pre",{"max-h-10rem":"","of-hidden":"","text-xs":"","font-mono":"",textContent:N(l.textContent)},null,8,Qe)])):l.asset.type==="video"?(o(),i("div",Ye,[t("video",{src:l.asset.publicPath,autoplay:l.detail,controls:l.detail},null,8,et)])):l.asset.type==="audio"?(o(),i("div",tt,[l.detail?(o(),i("audio",{key:1,src:l.asset.publicPath,controls:""},null,8,ot)):(o(),i("div",nt))])):(o(),i("div",lt))])}}}),st={relative:"",flex:"~ col gap-1",hover:"bg-active","items-center":"","of-hidden":"",rounded:"",p2:""},at={"w-full":"","of-hidden":"",truncate:"","ws-nowrap":"","text-center":"","text-xs":""},it=Z({__name:"AssetGridItem",props:{asset:{},folder:{}},setup(L){const l=L,f=U(()=>l.folder&&l.asset.path.startsWith(l.folder)?l.asset.path.slice(l.folder.length):l.asset.path);return(C,n)=>{const v=ne,x=ie;return o(),i("button",st,[C.asset.layer?(o(),V(v,{key:0,icon:"i-carbon-layers",absolute:"","right-4":"","top-4":"","bg-primary":""})):S("",!0),d(x,{"h-30":"","w-30":"",rounded:"",border:"~ base",asset:C.asset},null,8,["asset"]),t("div",at,N(f.value),1)])}}}),re=Z({__name:"AssetListItem",props:{item:{},index:{default:0},modelValue:{}},setup(L,{emit:l}){const f=L,n=ee(f,"modelValue",l,{passive:!0}),v=U(()=>f.item?.children?.length),x=T(!0),j=U(()=>v.value?"i-carbon-folder":f.item.type==="image"?"i-carbon-image":f.item.type==="video"?"i-carbon-video":f.item.type==="audio"?"i-carbon-volume-up":f.item.type==="font"?"i-carbon-text-small-caps":f.item.type==="text"?"i-carbon-document":f.item.type==="json"?"i-carbon-json":"i-carbon-document-blank");return(P,_)=>{const E=ne,q=re;return o(),i("div",null,[t("button",{flex:"~ gap-2","w-full":"","items-center":"",hover:"bg-active",px4:"",py1:"",style:ae({paddingLeft:`calc(1rem + ${P.index*1.5}em)`}),class:H({"bg-active":!v.value&&m(n)?.filePath===P.item?.filePath}),border:"b base",onClick:_[0]||(_[0]=O=>v.value?x.value=!x.value:n.value=P.item)},[t("div",{class:H(j.value)},null,2),t("span",{class:H({"flex items-center":v.value}),"flex-auto":"","text-start":"","text-sm":"","font-mono":""},[D(N(P.item.path)+" ",1),P.item.layer?(o(),V(E,{key:0,icon:"i-carbon-layers","bg-primary":""})):S("",!0)],2),v.value?(o(),V(E,{key:0,icon:"carbon:chevron-right","transform-rotate":x.value?90:0,transition:""},null,8,["transform-rotate"])):S("",!0)],6),x.value?De(P.$slots,"default",{key:0},()=>[(o(!0),i(z,null,G(P.item?.children,O=>(o(),V(q,{key:O.filepath,modelValue:m(n),"onUpdate:modelValue":_[1]||(_[1]=b=>Ne(n)?n.value=b:null),item:O,index:P.index+1},null,8,["modelValue","item","index"]))),128))]):S("",!0)])}}}),rt={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p4:""},ut={flex:"~","items-center":"","justify-center":""},dt={"max-w-full":"","w-full":"","table-fixed":""},ct={flex:"~ gap-1","w-full":"","items-center":""},pt={flex:"~ gap-1","w-full":"","items-center":"","of-hidden":""},mt={"flex-auto":"","of-hidden":"",truncate:"","ws-pre":"","font-mono":""},vt={capitalize:""},ft={key:0},gt={op70:""},ht={flex:"~ gap2 wrap"},_t={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p8:""},xt={flex:"~ gap2 wrap justify-center"},bt={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p8:""},wt={flex:"~ gap2 wrap justify-center"},yt={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p4:""},$t={flex:"","justify-end":"","gap-4":""},kt=Z({__name:"AssetDetails",props:{modelValue:{}},setup(L,{emit:l}){const n=ee(L,"modelValue",l,{passive:!0}),v=le(async()=>{if(n.value.type==="image")return J.getImageMeta(await W(),n.value.filePath)}),x=T(!1),j=T(),P=T(0),_=le(async()=>{if(n.value.type!=="text")return;P.value;const a=await J.getTextAssetContent(await W(),n.value.filePath);return j.value=a,a});async function E(){if(_.value!==j.value)try{await J.writeStaticAssets(await W(),[{path:n.value.path,content:j.value,override:!0}],""),x.value=!1,P.value++,R({message:"Updated",icon:"i-carbon-checkmark",classes:"text-green"})}catch(a){console.error(a),R({message:"Something went wrong!",icon:"i-carbon-warning",classes:"text-red"})}}const q=ge(),O=U(()=>(q.value?._installedModules||[]).some(e=>e.meta?.name==="@nuxt/image"||e.meta?.name==="@nuxt/image-edge"||e.meta?.name==="@nuxt/image-nightly")),b=U(()=>{const a=[];if(n.value.type==="image"){const e=v.value?.width?`
width="${v.value.width}"
height="${v.value.height}" `:" ";return a.push({lang:"vue-html",code:`<img${e}
src="${n.value.publicPath}"
/>`,name:"Plain Image"}),O.value&&a.push({lang:"vue-html",code:`<NuxtImg${e}
src="${n.value.publicPath}"
/>`,name:"Nuxt Img",docs:"https://image.nuxt.com/usage/nuxt-img"},{lang:"vue-html",code:`<NuxtPicture${e}
src="${n.value.publicPath}"
/>`,name:"Nuxt Picture",docs:"https://image.nuxt.com/usage/nuxt-picture"}),a}return a.push({lang:"html",code:`<a download href="${n.value.publicPath}">
Download ${n.value.path.split("/").slice(-1)[0]}
</a>`,name:"Download link"}),a}),r=he(),p=_e(),s=xe(()=>n.value.mtime),c=U(()=>{const a=n.value.size;return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(2)} KB`:`${(a/1024/1024).toFixed(2)} MB`}),g=U(()=>{if(!v.value?.width||!v.value?.height)return"";const a=($,I)=>I?a(I,$%I):$,e=a(v.value.width,v.value.height);return e>3?`${v.value.width/e}:${v.value.height/e}`:""}),w=U(()=>["image","text","video","audio","font"].includes(n.value.type)),u=T(!1);async function A(){try{await J.deleteStaticAsset(await W(),n.value.filePath),n.value=void 0,u.value=!1,R({message:"Asset deleted",icon:"i-carbon-checkmark",classes:"text-green"})}catch(a){console.error(a),R({message:"Something went wrong!",icon:"i-carbon-warning",classes:"text-red"})}}const y=T(!1),B=T("");async function M(){const a=n.value.filePath.split("/"),e=a.slice(-1)[0].split(".").slice(0,-1).join(".");if(!B.value||B.value===e)return R({message:"Please enter a new name",icon:"i-carbon-warning",classes:"text-orange"});try{const $=a.slice(-1)[0].split(".").slice(-1)[0],I=`${a.slice(0,-1).join("/")}/${B.value}.${$}`;await J.renameStaticAsset(await W(),n.value.filePath,I),n.value=void 0,y.value=!1,R({message:"Asset renamed",icon:"i-carbon-checkmark",classes:"text-green"})}catch($){console.error($),R({message:"Something went wrong!",icon:"i-carbon-warning",classes:"text-red"})}}return(a,e)=>{const $=ie,I=Ie,F=te,ue=Te,Q=be,de=se,Y=oe("tooltip");return o(),i(z,null,[t("div",rt,[w.value?(o(),i(z,{key:0},[e[13]||(e[13]=t("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[t("div",{"x-divider":""}),t("div",{"flex-none":""}," Preview "),t("div",{"x-divider":""})],-1)),t("div",ut,[d($,{detail:"","max-h-80":"","min-h-20":"","min-w-20":"","w-auto":"",rounded:"",border:"~ base",asset:m(n),"text-content":m(_)},null,8,["asset","text-content"])])],64)):S("",!0),e[25]||(e[25]=t("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[t("div",{"x-divider":""}),t("div",{"flex-none":""}," Details "),t("div",{"x-divider":""})],-1)),t("table",dt,[t("tbody",null,[t("tr",null,[e[14]||(e[14]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Filepath ",-1)),t("td",null,[t("div",ct,[d(I,{filepath:m(n).filePath,"text-left":""},null,8,["filepath"]),K(d(F,{"flex-none":"",title:"Open in Editor",icon:"carbon-launch",border:!1,onClick:e[0]||(e[0]=k=>m(p)(m(n).filePath))},null,512),[[Y,"Open in Editor"]])])])]),t("tr",null,[e[15]||(e[15]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Public Path ",-1)),t("td",null,[t("div",pt,[t("div",mt,N(m(n).publicPath),1),K(d(F,{"flex-none":"",title:"Copy public path",icon:"carbon-copy",border:!1,onClick:e[1]||(e[1]=k=>m(r)(m(n).publicPath,"assets-public-path"))},null,512),[[Y,"Copy public path"]]),K(d(F,{"flex-none":"",to:m(n).publicPath,icon:"carbon-launch",target:"_blank",border:!1,title:"Open in browser"},null,8,["to"]),[[Y,"Open in browser"]])])])]),t("tr",null,[e[16]||(e[16]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Type ",-1)),t("td",vt,N(m(n).type),1)]),m(v)?.width?(o(),i(z,{key:0},[t("tr",null,[e[17]||(e[17]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Image Size ",-1)),t("td",null,N(m(v).width)+" x "+N(m(v).height),1)]),g.value?(o(),i("tr",ft,[e[18]||(e[18]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Aspect Ratio ",-1)),t("td",null,N(g.value),1)])):S("",!0)],64)):S("",!0),t("tr",null,[e[19]||(e[19]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," File size ",-1)),t("td",null,N(c.value),1)]),t("tr",null,[e[20]||(e[20]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Last modified ",-1)),t("td",null,[D(N(new Date(m(n).mtime).toLocaleString())+" ",1),t("span",gt,"("+N(m(s))+")",1)])])])]),e[26]||(e[26]=t("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[t("div",{"x-divider":""}),t("div",{"flex-none":""}," Actions "),t("div",{"x-divider":""})],-1)),t("div",ht,[d(F,{to:m(n).publicPath,download:"",target:"_blank",icon:"carbon-download",n:"green"},{default:h(()=>e[21]||(e[21]=[D(" Download ")])),_:1,__:[21]},8,["to"]),m(n).type==="text"?(o(),V(F,{key:0,icon:"carbon-edit",n:"cyan",onClick:e[2]||(e[2]=k=>x.value=!x.value)},{default:h(()=>e[22]||(e[22]=[D(" Edit ")])),_:1,__:[22]})):S("",!0),d(F,{icon:"carbon-text-annotation-toggle",n:"blue",onClick:e[3]||(e[3]=k=>y.value=!y.value)},{default:h(()=>e[23]||(e[23]=[D(" Rename ")])),_:1,__:[23]}),d(F,{icon:"carbon-delete",n:"red",onClick:e[4]||(e[4]=k=>u.value=!u.value)},{default:h(()=>e[24]||(e[24]=[D(" Delete ")])),_:1,__:[24]})]),e[27]||(e[27]=t("div",{"flex-auto":""},null,-1)),b.value.length?(o(),V(ue,{key:1,border:"t base","mx--4":"","mb--4":"","code-snippets":b.value},null,8,["code-snippets"])):S("",!0)]),d(Q,{modelValue:u.value,"onUpdate:modelValue":e[6]||(e[6]=k=>u.value=k)},{default:h(()=>[t("div",_t,[e[30]||(e[30]=t("span",null," Are you sure you want to delete this asset? ",-1)),t("div",xt,[d(F,{icon:"carbon-close",onClick:e[5]||(e[5]=k=>u.value=!1)},{default:h(()=>e[28]||(e[28]=[D(" Cancel ")])),_:1,__:[28]}),d(F,{icon:"carbon-delete",n:"red",onClick:A},{default:h(()=>e[29]||(e[29]=[D(" Delete ")])),_:1,__:[29]})])])]),_:1},8,["modelValue"]),d(Q,{modelValue:y.value,"onUpdate:modelValue":e[9]||(e[9]=k=>y.value=k)},{default:h(()=>[t("div",bt,[d(de,{modelValue:B.value,"onUpdate:modelValue":e[7]||(e[7]=k=>B.value=k),placeholder:"New name",n:"blue"},null,8,["modelValue"]),t("div",wt,[d(F,{icon:"carbon-close",onClick:e[8]||(e[8]=k=>y.value=!1)},{default:h(()=>e[31]||(e[31]=[D(" Cancel ")])),_:1,__:[31]}),d(F,{icon:"carbon-text-annotation-toggle",n:"blue",onClick:M},{default:h(()=>e[32]||(e[32]=[D(" Rename ")])),_:1,__:[32]})])])]),_:1},8,["modelValue"]),m(n).type==="text"?(o(),V(Q,{key:0,modelValue:x.value,"onUpdate:modelValue":e[12]||(e[12]=k=>x.value=k)},{default:h(()=>[t("div",yt,[K(t("textarea",{"onUpdate:modelValue":e[10]||(e[10]=k=>j.value=k),placeholder:"Item value...",class:"h-lg w-xl of-auto rounded-lg p-4 text-sm font-mono outline-none",onKeydown:Se(E,["enter"])},null,544),[[Fe,j.value]]),t("div",$t,[d(F,{icon:"carbon-close",onClick:e[11]||(e[11]=k=>x.value=!1)},{default:h(()=>e[33]||(e[33]=[D(" Cancel ")])),_:1,__:[33]}),d(F,{icon:"carbon:save",n:"primary",onClick:E},{default:h(()=>e[34]||(e[34]=[D(" save ")])),_:1,__:[34]})])])]),_:1},8,["modelValue"])):S("",!0)],64)}}}),Ct={"h-full":"","of-auto":""},Vt={"flex-none":"",flex:"~ gap2 items-center","text-lg":""},Pt={flex:"~ items-center justify-center",absolute:"","bottom--1":"","right--1":"","h-4":"","w-4":"","rounded-full":"","bg-primary:30":"","text-8px":""},At={flex:"~ col","w-30":"","of-auto":""},Dt={"text-xs":"",op75:""},Nt={op50:""},Ft={key:0},St={"mt--4":"",px2:"",grid:"~ cols-minmax-8rem"},Ut={key:1,p2:"",grid:"~ cols-minmax-8rem"},It={key:1},Xt=Z({__name:"assets",setup(L){const l=we(),f=T(!1),C=T(""),n=U(()=>new ye(l.value||[],{keys:["path"]})),v=$e(()=>{const b=[];for(const r of l.value||[]){const p=r.path.split(".").pop();p&&!b.find(s=>s.name===p)&&b.push({name:p,value:!0})}return b}),x=U(()=>(C.value?n.value.search(C.value).map(r=>r.item):l.value||[]).filter(r=>{const p=r.path.split(".").pop();return!p||v.some(s=>s.name===p&&s.value)})),j=U(()=>{const b={};for(const r of x.value){const p=`${r.path.split("/").slice(0,-1).join("/")}/`;b[p]||(b[p]=[]),b[p].push(r)}return Object.entries(b).sort(([r],[p])=>r.localeCompare(p))}),P=U(()=>{const b={children:[]},r=(p,s,c)=>{const[g,...w]=s;let u=p.children.find(A=>A.path===g);u||(u={...c,path:g,children:[]},p.children.push(u)),w.length>1?r(u,w,c):w.length===1&&u.children.push({...c,path:w[0]})};return x.value.forEach(p=>{const s=p.path.split("/").filter(c=>c!=="");r(b,s,p)}),b.children}),_=T(),{view:E}=ke("assets");function q(){E.value=E.value==="list"?"grid":"list"}Ce("Escape",()=>{_.value=void 0});const O=T();return(b,r)=>{const p=te,s=Ve,c=Pe,g=Ae,w=Ge,u=it,A=Ue,y=re,B=kt,M=je,a=oe("tooltip");return o(),i("div",Ct,[d(g,{ref_key:"navbar",ref:O,search:C.value,"onUpdate:search":r[1]||(r[1]=e=>C.value=e),pb2:""},{actions:h(()=>[t("div",Vt,[K(d(p,{icon:"carbon:cloud-upload",title:"File Upload",border:!1,onClick:r[0]||(r[0]=e=>f.value=!f.value)},null,512),[[a,"File Upload",void 0,{"bottom-end":!0}]]),m(v).length?(o(),V(c,{key:0,direction:"end",n:"sm primary"},{trigger:h(({click:e})=>[K(d(p,{icon:"carbon-filter",border:!1,title:"Filter",p3:"","text-lg":"",onClick:$=>e()},null,8,["onClick"]),[[a,"Filter",void 0,{"bottom-end":!0}]]),t("span",Pt,N(m(v).length),1)]),default:h(()=>[t("div",At,[(o(!0),i(z,null,G(m(v),e=>(o(),V(s,{key:e.name,modelValue:e.value,"onUpdate:modelValue":$=>e.value=$,flex:"~ gap-2",rounded:"",px2:"",py2:""},{default:h(()=>[t("span",Dt,N(e.name),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]))),128))])]),_:1})):S("",!0),K(d(p,{"text-lg":"",border:!1,icon:m(E)==="grid"?"i-carbon-list":"i-carbon-grid",title:"Toggle view",onClick:q},null,8,["icon"]),[[a,"Toggle View",void 0,{"bottom-end":!0}]])])]),default:h(()=>[t("div",Nt,[C.value?(o(),i("span",Ft,N(x.value.length)+" matched · ",1)):S("",!0),t("span",null,N(m(l)?.length)+" assets in total",1)])]),_:1},8,["search"]),d(w,{modelValue:f.value,"onUpdate:modelValue":r[2]||(r[2]=e=>f.value=e),folder:"/"},null,8,["modelValue"]),m(E)==="grid"?(o(),i(z,{key:0},[j.value.length>1?(o(!0),i(z,{key:0},G(j.value,([e,$])=>(o(),V(A,{key:e,text:e,description:`${$.length} items`,open:$.length<=m(Ee),padding:!1},{default:h(()=>[t("div",St,[(o(!0),i(z,null,G($,I=>(o(),V(u,{key:I.path,asset:I,folder:e,onClick:F=>_.value=I},null,8,["asset","folder","onClick"]))),128))])]),_:2},1032,["text","description","open"]))),128)):(o(),i("div",Ut,[(o(!0),i(z,null,G(x.value,e=>(o(),V(u,{key:e.path,asset:e,onClick:$=>_.value=e},null,8,["asset","onClick"]))),128))]))],64)):(o(),i("div",It,[(o(!0),i(z,null,G(P.value,(e,$)=>(o(),V(y,{key:$,modelValue:_.value,"onUpdate:modelValue":r[3]||(r[3]=I=>_.value=I),item:e},null,8,["modelValue","item"]))),128))])),d(M,{"model-value":!!_.value,"auto-close":"","w-120":"",top:O.value,onClose:r[5]||(r[5]=e=>_.value=void 0)},{default:h(()=>[_.value?(o(),V(B,{key:0,modelValue:_.value,"onUpdate:modelValue":r[4]||(r[4]=e=>_.value=e)},null,8,["modelValue"])):S("",!0)]),_:1},8,["model-value","top"])])}}});export{Xt as default};