PageSourceSearch

https://notebook.link/assets/index-U_bvkydM.js

js notebook.link collected 2026-09-25 19:55:51 UTC 12,128 bytes, 16 lines download raw bytes

1import{c as P,r as i,O as te,t as o,j as e,a as w}from"./url-join-llZgLPnz.js";import{D as ae,U as re}from"./index-CDHd-m5N.js";import{p as ie,n as oe,u as V,S as le,g as R,ag as ce,ah as D,ai as U,D as I,i as _,C as ne,j as A,k as v,H as de,x as pe,I as H,z as ue,B as N,aj as S}from"./app-DS5ZJvgn.js";import{E as me}from"./Ellipsis-BuevOxkJ.js";import{a as xe,b as he,c as je,d as fe,e as ge,f as be}from"./dialog-BJQD1Xop.js";import{S as ye,L as ve}from"./StyledSwitch-Jezukk19.js";import{p as we}from"./projectTools-60DlNEpL.js";import{S as Ne}from"./StyledBreadcrumbs-C_KZSSmg.js";import{R as ke}from"./rocket-BA6gk4Yz.js";import{C as T}from"./copy-Bk-og1y6.js";import{D as E}from"./download-DhW1wCl0.js";import{T as B}from"./trash-D7uRoXMy.js";import"./env-ZgdMgo2D.js";/**
2 * @license lucide-react v0.530.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Ce=[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]],De=P("clipboard-paste",Ce);/**
7 * @license lucide-react v0.530.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Se=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],Pe=P("file",Se);/**
12 * @license lucide-react v0.530.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const Oe=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],$=P("pen-line",Oe),ze=d=>{const c=d.split("/");return c.map((r,f)=>c.slice(0,f+1).join("/"))};function Le(d){const c=i.useMemo(()=>[...Object.values(d.projectsList.owned),...Object.values(d.projectsList.shared)],[d.projectsList]),[r,f]=i.useState(c[0]??{name:"",uid:0}),[p,g]=i.useState(""),[q,G]=i.useState([]),[h,K]=i.useState("list"),[Y,n]=i.useState(!1),[b,u]=i.useState(!1),[Z,J]=i.useState(""),[k,O]=i.useState(),[y,j]=i.useState(),z=ie(),l=oe(),m=i.useCallback(async(t=!0)=>{const s=await l.project.listProjectContents(r.uid,p);G(s),t&&z(te.getUserProfileThunk(l))},[l,p,r,z]);i.useEffect(()=>{m(!1).catch(t=>{o({title:"Failed to retrieve project contents",description:t,variant:"destructive"})})},[r,p,m]);const Q=i.useCallback(async(t,s)=>{const a=await l.project.deleteContent(r.uid,t,s);a.error?o({title:"Failed to delete object",description:a.error.message,variant:"destructive"}):(o({title:"Succces",description:"Object deleted successfully!",className:"bg-surface-success-default text-text-default-caption",variant:null}),await m()),n(!1)},[l,m,r.uid]),W=async(t,s)=>{const a=await l.project.renameContent(r.uid,t,t.substring(0,t.lastIndexOf("/")+1)+Z,s);a.error?o({title:"Failed to rename object",description:a.error.message,variant:"destructive"}):(o({title:"Succces",description:"Object renamed successfully!",className:"bg-surface-success-default text-text-default-caption",variant:null}),await m()),u(!1),n(!1)},L=async t=>{const s=await l.project.downloadContent(r.uid,t);if(s.error)o({title:"Failed to download object",description:s.error.message,variant:"destructive"});else{const a=URL.createObjectURL(s.data),x=document.createElement("a");x.href=a,x.download=t,x.click(),URL.revokeObjectURL(a)}},X=async(t,s)=>{(await l.project.uploadContent(r.uid,t,s)).error?o({title:"Failed to upload object",description:"Please check storage usage",variant:"destructive"}):(o({title:"Succces",description:"Object uploaded successfully!",className:"bg-surface-success-default text-text-default-caption",variant:null}),await m())},ee=async(t,s,a,x,se)=>{(await l.project.copyContent(t,s,a,x,se)).error?o({title:"Failed to copy object",description:"Please check storage usage",variant:"destructive"}
16):(o({title:"Succces",description:"Object copied successfully!",className:"bg-surface-success-default text-text-default-caption",variant:null}),await m()),u(!1)},{maxStorage:F,userStorage:M}=V(t=>t.storage),C=i.useMemo(()=>[...c].sort(we("Name","ascending")),[c]);return e.jsxs(e.Fragment,{children:[e.jsx(xe,{open:Y,onOpenChange:n,children:e.jsx(he,{children:e.jsxs(je,{children:[e.jsx(fe,{children:b?"Rename Object":"Delete selected object?"}),e.jsx(ge,{children:b?e.jsx(le,{type:"text",name:"Rename",defaultValue:y.name,onChange:t=>J(t.target.value),className:"text-secondary-foreground"}):"This action cannot be undone. This will permanently delete the selected object."}),e.jsxs(be,{className:"gap-y-2",children:[e.jsx(R,{variant:"secondary",onClick:()=>{n(!1),u(!1)},children:"Keep object"}),e.jsx(R,{className:"bg-surface-error-default text-text-error-onColor hover:bg-surface-error-default-onHover hover:text-text-error-onColor-onHover",onClick:async()=>{b?await W(y.path,y.type==="directory"):await Q(y.path,y.type==="directory")},children:b?"Rename":"Yes, delete object"})]})]})})}),e.jsxs("div",{className:"relative h-full overflow-hidden w-full lg:grid lg:grid-cols-[280px_1fr]",children:[e.jsx("div",{className:"w-full lg:w-[280px] min-h-0",children:e.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[e.jsx("div",{className:"flex h-[60px] shrink-0 items-center border-b border-border-divider-2 px-6",children:e.jsx("div",{className:"px-6 lg:px-0 sm:col-span-4 w-full items-center justify-center",children:e.jsx(ce,{value:100*M/F,label:`${D(M)} used of ${D(F)}`,barClassName:"h-2"})})}),e.jsxs("div",{className:"flex flex-1 min-h-0 flex-col py-2",children:[e.jsx("div",{className:"h-[44px] shrink-0 w-full flex items-center border-b border-border-divider-2 px-6",children:e.jsxs("span",{className:"flex items-center gap-x-2 text-sm border-l border-border-divider-2",children:[e.jsx(U,{className:"h-5 w-5"}),"Projects"]})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx("nav",{className:"hidden lg:block text-sm",children:C.length>0?C.map(t=>{const s=r.uid===t.uid;return e.jsx("div",{role:"button",tabIndex:0,onClick:()=>{f(t),g("")},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),f(t),g(""))},className:w("w-full px-6 py-3","flex items-center gap-3","cursor-pointer","transition-colors","hover:bg-surface-pages-backgrounds-page-tertiary",s&&"bg-surface-pages-backgrounds-page-tertiary border-l border-border-divider-2"),children:e.jsx("span",{className:w("truncate",s?"font-medium":"text-information-onColor"),title:t.name,children:t.name})},t.uid)}):e.jsx("p",{className:"px-6 py-4 text-center text-text-default-caption",children:"No projects available. Create a new project to get started."})})}),e.jsx("div",{className:"block lg:hidden px-2 shrink-0",children:e.jsxs(I,{children:[e.jsx(_,{asChild:!0,className:"w-full outline-none py-0 px-4",children:e.jsxs("div",{className:"flex justify-between bg-background rounded-lg px-3 py-2 transition-all text-text-default-body mt-3",children:[e.jsx("p",{className:"flex items-center justify-start gap-x-2 text-sm",children:r.name}),e.jsx(ne,{})]})}),e.jsx(A,{className:"w-[var(--radix-dropdown-menu-trigger-width)]",children:Object.values(C).map(t=>e.jsx(v,{className:w("flex items-center justify-start gap-3","rounded-lg px-3 py-2 transition-all","hover:text-text-default-body","hover:bg-surface-pages-backgrounds-page-tertiary",r.uid===t.uid&&"bg-surface-pages-backgrounds-page-tertiary"),onClick:()=>{f(t),g("")},children:t.name},t.uid))})]})})]})]})}),e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("header",{className:"flex h-14 lg:h-[60px] items-center gap-4 border-b border-border-divider-2 px-6",children:[e.jsx("div",{className:"h-full overflow-y-auto flex items-center",children:e.jsx(Ne,{items:[{icon:e.jsx(de,{className:"h-4 w-4","data-testid":"breadcrumb-home-icon"}),href:"/launcher/home",ariaLabel:"Home"},{label:"User storage",href:"/launcher/userStorage"},{label:r.name,href:"/launcher/project/"+r.uid},...Object.entries(ze(p)).map(([,t],s,a)=>{const x=s===a.length-1;return{label:t.split("/")[t.split("/").length-1],onClick:x?void 0:()=>g(t)}})]})}),e.jsxs("div",{className:"flex items-center gap-2 md:gap-5 ml-auto",children:[e.jsx("div",{className:"md:flex hidden",children:e.jsx(ye,{leftIcon:{node:e.jsx(pe,{}),title:"Grid View",isActive:()=>h==="grid"},rightIcon:{node:e.jsx(ve,{}),title:"List View",isActive:()=>h==="list"},onClick:()=>K(h==="grid"?"list":"grid")})}),e.jsx(H,{variant:"primary",title:"Paste",disabled:!b,onClick:async()=>await ee(k.projectUid,k.path,p,r.uid,k.isDir),children:e.jsx(De,{})}),e.jsx(ae,{preventDropOnDocument:!0,noDrag:!0,multiple:!1,onDrop:t=>{const s=new FileReader;s.onload=async()=>{const a=s.result;await X((p?p+"/":"")+t[0].name,a)},s.onerror=()=>{var a;o({title:"Failed to upload object",description:(a=s.error)==null?void 0:a.message,variant:"destructive"})},s.readAsArrayBuffer(t[0])}
16,children:({getRootProps:t,getInputProps:s})=>e.jsxs(H,{...t(),title:"Upload Files",children:[e.jsx("input",{...s()}),e.jsx(re,{})]})}),e.jsx(ue,{to:`/project/${r.uid}/lab/`,target:"_blank",rel:"noopener noreferrer",title:"Open Project",variant:"icon",children:e.jsx(ke,{})})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto gap-4 p-4 md:gap-8 md:p-6 lg:bg-surface-pages-backgrounds-page-tertiary",children:e.jsx("div",{className:h==="grid"?"public card-grid-layout grid gap-2":"public card-list-layout grid gap-2",children:Object.entries(q).map(([t,s])=>e.jsxs("div",{className:"flex items-center gap-4 rounded-lg bg-surface-pages-backgrounds-page-primary p-3",onClick:()=>{s.type==="directory"&&g(s.path)},children:[s.type==="file"?e.jsx(Pe,{className:"h-8 w-8 text-icon-onPage-primary"}):e.jsx(U,{className:"h-8 w-8 text-icon-onPage-primary"}),e.jsxs("div",{className:"flex-1 w-0",children:[e.jsx("div",{className:"text-sm font-medium truncate overflow-hidden whitespace-nowrap",title:s.name,children:s.name}),s.type==="file"?e.jsx("div",{className:"text-xs text-text-default-body",children:D(s.size)}):e.jsx(e.Fragment,{})]}),h==="list"&&e.jsxs("div",{className:"hidden sm:flex items-center",children:[e.jsx(N,{variant:"ghost",size:"icon",title:"Copy",onClick:a=>{a.stopPropagation(),j(s),u(!0),O({projectUid:r.uid,path:s.path,isDir:s.type==="directory"})},children:e.jsx(T,{className:"size-sm"})}),e.jsx(N,{variant:"ghost",size:"icon",title:"Rename",onClick:a=>{a.stopPropagation(),j(s),u(!0),n(!0)},children:e.jsx($,{className:"size-sm"})}),s.type==="file"&&e.jsx(N,{variant:"ghost",size:"icon",title:"Download",onClick:async a=>{a.stopPropagation(),await L(s.path)},children:e.jsx(E,{className:"size-sm"})}),e.jsx(N,{variant:"ghost",size:"icon",title:"Delete",onClick:a=>{a.stopPropagation(),j(s),n(!0)},children:e.jsx(B,{className:"size-sm",color:"red"})})]}),e.jsx("div",{className:w("flex items-center gap-2",h==="grid"?"":"sm:hidden"),children:e.jsxs(I,{children:[e.jsx(_,{className:"focus-visible:outline-none hover:bg-surface-pages-backgrounds-page-primary rounded-full p-1.5",children:e.jsx(me,{})}),e.jsxs(A,{children:[e.jsxs(v,{onClick:a=>{a.stopPropagation(),u(!0),j(s),O({projectUid:r.uid,path:s.path,isDir:s.type==="directory"})},children:[e.jsx(T,{size:"1rem",className:"mr-3"}),"Copy"]}),e.jsx(S,{}),e.jsxs(v,{onClick:a=>{a.stopPropagation(),j(s),u(!0),n(!0)},children:[e.jsx($,{size:"1rem",className:"mr-3"}),"Rename"]}),s.type==="file"&&e.jsxs(e.Fragment,{children:[e.jsx(S,{}),e.jsxs(v,{onClick:async a=>{a.stopPropagation(),await L(s.path)},children:[e.jsx(E,{size:"1rem",className:"mr-3"}),"Download"]})]}),e.jsx(S,{}),e.jsxs(v,{onClick:a=>{a.stopPropagation(),j(s),n(!0)},children:[e.jsx(B,{size:"1rem",className:"mr-3",color:"red"}),"Delete"]})]})]})})]},t))})})]})]})]})}function Ge(){const{projects:d}=V(c=>({projects:c.projects}));return e.jsx(Le,{projectsList:d})}export{Ge as UserStoragePage};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.