@augmentd-labs/canvas-web 2.26.37 → 2.26.39

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.
Files changed (75) hide show
  1. package/dist/assets/{CalendarApplet-BmrEfNPa.js → CalendarApplet-DVUCGIPB.js} +1 -1
  2. package/dist/assets/{FileForm-C35drQ_R.js → FileForm-CMuWZbUX.js} +1 -1
  3. package/dist/assets/{FiltersApplet-BuOfikkU.js → FiltersApplet-CvdFlyn1.js} +1 -1
  4. package/dist/assets/{HomeFab-DtUgQqjj.js → HomeFab-DRmbW2Uu.js} +1 -1
  5. package/dist/assets/{IdentityFields-DZRqtnIG.js → IdentityFields-C7sv9pMk.js} +1 -1
  6. package/dist/assets/{LensApplet-DWoA0AeK.js → LensApplet-gIiGSdLb.js} +1 -1
  7. package/dist/assets/{LinkToCard-BQ1yoFDr.js → LinkToCard-DGpvNE_V.js} +1 -1
  8. package/dist/assets/{NextShell-BfQHKEKO.js → NextShell-DiyMsTp5.js} +1 -1
  9. package/dist/assets/{NotesApplet-BnHiH-Vm.js → NotesApplet-BUXkez68.js} +1 -1
  10. package/dist/assets/ObjectPropertiesCard-pE3IL82x.js +8 -0
  11. package/dist/assets/{PathPickerField-B4yFUjgD.js → PathPickerField-D7SubxSh.js} +1 -1
  12. package/dist/assets/{PickDocumentsCard-CFDQL70e.js → PickDocumentsCard-BhJbPlxk.js} +1 -1
  13. package/dist/assets/{SketchApplet-14xrogy3.js → SketchApplet-CQexRECa.js} +1 -1
  14. package/dist/assets/{SketchEditor-B2LYe_MO.js → SketchEditor-DxIN-6wI.js} +1 -1
  15. package/dist/assets/{TerminalApplet-BNeLmNFF.js → TerminalApplet-D-F4-4Zt.js} +1 -1
  16. package/dist/assets/{TextDocumentEditor-CU5ersd_.js → TextDocumentEditor-YAeo69K7.js} +1 -1
  17. package/dist/assets/{TodosApplet-ASG9wXjL.js → TodosApplet-OBi0XUdm.js} +1 -1
  18. package/dist/assets/{TodosWidget-CYK5RbYD.js → TodosWidget-B_R-vHxf.js} +1 -1
  19. package/dist/assets/{UploadProgressList-Ci1akl_D.js → UploadProgressList-C9teR7r-.js} +1 -1
  20. package/dist/assets/{_agentId_-Cm8yJTqD.js → _agentId_-CYfkXrJk.js} +0 -0
  21. package/dist/assets/_contextId_-CkahAS5d.js +1 -0
  22. package/dist/assets/_workspaceName_--lNvJpY1.js +1 -0
  23. package/dist/assets/{about-aJJuQSFB.js → about-CCShKl-5.js} +1 -1
  24. package/dist/assets/{add-Ruml_x6t.js → add-G2dEzOng.js} +1 -1
  25. package/dist/assets/{agents-BWYACYNH.js → agents-vx49b2X5.js} +1 -1
  26. package/dist/assets/{appearance-CSvWylrJ.js → appearance-Dmzr0s9n.js} +1 -1
  27. package/dist/assets/{applet-target-I8w6EPj0.js → applet-target-DYrCD8BZ.js} +1 -1
  28. package/dist/assets/{apps-CdUhD9HG.js → apps-B6DG6ZpO.js} +1 -1
  29. package/dist/assets/{backend-sync-progress-tUU2XWtW.js → backend-sync-progress-m7wUKTJn.js} +1 -1
  30. package/dist/assets/{context-DZ1Hn7tt.js → context-1vR30CeC.js} +1 -1
  31. package/dist/assets/{contexts-Df-cWUlj2.js → contexts-DFYjIhsj2.js} +1 -1
  32. package/dist/assets/{date-time-picker-txVhlNO0.js → date-time-picker-C40sYmga.js} +1 -1
  33. package/dist/assets/{document-CTvT2Qa5.js → document-BiNwuf1n.js} +1 -1
  34. package/dist/assets/document-list-ASCemk7T.js +2 -0
  35. package/dist/assets/{home-DwSabq_0.js → home-B1ilyR89.js} +1 -1
  36. package/dist/assets/index-Bi5-zGgp.css +2 -0
  37. package/dist/assets/{index-AELn_vht.js → index-CXPA9Fj8.js} +6 -6
  38. package/dist/assets/{key-bindings-Cv7mVdte.js → key-bindings-DXepopri.js} +1 -1
  39. package/dist/assets/{offline-sNCjxnp-.js → offline-DonGsRsw.js} +1 -1
  40. package/dist/assets/{public-share-D5yz-Pmo.js → public-share-DLXh7Ie6.js} +1 -1
  41. package/dist/assets/{query-debug-CQ0I3cXX.js → query-debug-DhboV3qX.js} +1 -1
  42. package/dist/assets/{registry-D1CIT_aZ.js → registry-eFbDXN9w.js} +2 -2
  43. package/dist/assets/{roles-DoR2drD1.js → roles-DDiKiRii.js} +1 -1
  44. package/dist/assets/{settings-DaYH1KUc.js → settings-CcdxMKot.js} +1 -1
  45. package/dist/assets/{settings-MRGmsYtV.js → settings-CgjGE01m.js} +1 -1
  46. package/dist/assets/{settings-D8jDlO3y.js → settings-CwyGwKFU.js} +1 -1
  47. package/dist/assets/{settings-DnXGDMuM.js → settings-D-yPOLZk.js} +1 -1
  48. package/dist/assets/{share-target-vNEvk9Rt.js → share-target-BhGDitlj.js} +1 -1
  49. package/dist/assets/{shared-C0dVLLZX.js → shared-DimeKqW8.js} +1 -1
  50. package/dist/assets/{shared-BnpwVpxG.js → shared-XYVtCrC8.js} +1 -1
  51. package/dist/assets/{sketch-lazy-BbNgGbR3.js → sketch-lazy-6eEi8GIA.js} +2 -2
  52. package/dist/assets/{text-documents-BaXhu3ra.js → text-documents-DxVsu9zG.js} +1 -1
  53. package/dist/assets/{content-app-view-AUB8kjjJ.js → tree-folders-whK_PK4c.js} +1 -1
  54. package/dist/assets/{use-applet-docs-B2dk__vk.js → use-applet-docs-FqhvvOWx.js} +1 -1
  55. package/dist/assets/{use-applet-target-ffIGaAqT.js → use-applet-target-1DU4mgJH.js} +1 -1
  56. package/dist/assets/{use-canvas-pins-DkWN9oEd.js → use-canvas-pins-DqkSe_aU.js} +1 -1
  57. package/dist/assets/{use-workspace-identity-B8gOMGj4.js → use-workspace-identity-KEG0VpcX.js} +1 -1
  58. package/dist/assets/{useAddTarget-B3b6TyZr.js → useAddTarget-BEgKjqGj.js} +1 -1
  59. package/dist/assets/{useAgentModels-Dw4f4pZz.js → useAgentModels-CI7iZlUR.js} +1 -1
  60. package/dist/assets/{useDocumentThumbnail-wW0lSOEy.js → useDocumentThumbnail-DutrNFK3.js} +1 -1
  61. package/dist/assets/{useEditNoteFields-DXLTFEqL.js → useEditNoteFields-HAsbBak7.js} +1 -1
  62. package/dist/assets/{workspace-area-menu-BFw2yUHk.js → workspace-area-menu-CUqTxXmz.js} +1 -1
  63. package/dist/assets/{workspace-content-gate-NLuRPvbm.js → workspace-content-gate-B6T3nLfW.js} +1 -1
  64. package/dist/assets/workspace-cv6Hrfhh.js +1 -0
  65. package/dist/assets/{workspace-import-form-Bb6z42nw.js → workspace-import-form-D5qPcNFq.js} +1 -1
  66. package/dist/assets/{workspaces-Ban7--8l.js → workspaces-yHyufXqs.js} +1 -1
  67. package/dist/index.html +26 -26
  68. package/dist/sw.js +1 -1
  69. package/package.json +2 -2
  70. package/dist/assets/ObjectPropertiesCard-BTTwYnN9.js +0 -8
  71. package/dist/assets/_contextId_-LRp2S1tj.js +0 -1
  72. package/dist/assets/_workspaceName_-BC1W0_NU.js +0 -1
  73. package/dist/assets/document-list-CQ1_7Sja.js +0 -2
  74. package/dist/assets/index-BAeuh9Mu.css +0 -2
  75. package/dist/assets/workspace-BJELPCNs.js +0 -1
@@ -0,0 +1 @@
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{vt as r}from"./react-BHzhHVTZ.js";import{t as i}from"./button-SeUZ_Pvi.js";import{t as a}from"./input-BOtCd4HP.js";import{c as o,l as s,t as c}from"./api-CA6WiiYM.js";import{a as l,c as u,i as ee,s as te,t as ne}from"./alert-dialog-CFeuDt0T.js";var re=`data/schema/note`,ie=`data/schema/link`,ae=`data/schema/tab`,oe=`data/schema/file`,se=`data/schema/drawing`,ce=`data/schema/message/email`,le=`data/schema/task`,ue=`data/schema/event/calendar`,d=`data/schema/identity`;function f(e,t){return e.startsWith(`${t}/`)?e.slice(t.length+1):``}var de={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,bmp:`image/bmp`,svg:`image/svg+xml`,avif:`image/avif`,heic:`image/heic`,heif:`image/heif`,mp3:`audio/mpeg`,wav:`audio/wav`,ogg:`audio/ogg`,oga:`audio/ogg`,m4a:`audio/mp4`,flac:`audio/flac`,aac:`audio/aac`,mp4:`video/mp4`,m4v:`video/mp4`,webm:`video/webm`,mov:`video/quicktime`,mkv:`video/x-matroska`,avi:`video/x-msvideo`,ogv:`video/ogg`,pdf:`application/pdf`,html:`text/html`,htm:`text/html`,xhtml:`application/xhtml+xml`,md:`text/markdown`,markdown:`text/markdown`,txt:`text/plain`,json:`application/json`,xml:`application/xml`,csv:`text/csv`,log:`text/plain`,yml:`text/yaml`,yaml:`text/yaml`};function fe(e){let t=/\.([a-z0-9]+)$/i.exec(e||``);return t?t[1].toLowerCase():``}function pe(e){return de[fe(e)]}function p(e){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:e.startsWith(`video/`)?`video`:e===`application/pdf`?`pdf`:e===`text/html`||e===`application/xhtml+xml`?`html`:e.startsWith(`text/`)||e.endsWith(`+json`)||e===`application/json`||e===`application/xml`?`text`:null}function me(e,t){if(e=e.split(`;`)[0].trim().toLowerCase(),e===`text/markdown`||/\.(md|markdown)$/i.test(t||``))return`markdown`;if(e&&e!==`application/octet-stream`){let t=p(e);if(t)return t}let n=pe(t);if(n){let e=p(n);if(e)return e}return`binary`}function he(e){if(!e)return null;try{let t=new URL(e),n=t.hostname.replace(/^www\.|^m\./,``);if(n===`youtu.be`)return t.pathname.slice(1).split(`/`)[0]||null;if(n===`youtube.com`||n===`youtube-nocookie.com`){if(t.pathname===`/watch`)return t.searchParams.get(`v`);let e=t.pathname.match(/^\/(shorts|embed|live)\/([^/]+)/);if(e)return e[2]}return null}catch{return null}}var ge=`data/schema/message/email`,_e=`data/schema/tab`,m=`data/schema/task`;function h(e,t){let n=String(e||``).replace(/\s+/g,` `).trim();return n?n.length>t?`${n.slice(0,t)}...`:n:``}function g(e){return String(e||``).replace(/```[\s\S]*?```/g,` `).replace(/`([^`]*)`/g,`$1`).replace(/!\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^#{1,6}\s+/gm,``).replace(/^\s*>\s?/gm,``).replace(/^\s*[-*+]\s+/gm,``).replace(/(\*\*|__|\*|_|~~)/g,``)}function _(e){if(!e)return``;if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(_).filter(Boolean).join(`, `);if(typeof e==`object`){let t=e,n=String(t.address||``).trim(),r=String(t.name||``).trim();return r&&n&&r!==n?`${r} <${n}>`:r||n}return``}function ve(e){let t=Array.isArray(e?.channels)?e.channels.length:0,n=Array.isArray(e?.identifiers)?e.identifiers.length:0,r=Array.isArray(e?.organizations)?e.organizations.length:0;return[t?`${t} channel${t===1?``:`s`}`:``,n?`${n} identifier${n===1?``:`s`}`:``,r?`${r} organization${r===1?``:`s`}`:``].filter(Boolean).join(` · `)}function ye(e){let t=String(e?.displayName||``).trim();if(t)return t;let n=e?.name;if(!n||typeof n!=`object`)return String(n||``).trim();let r=n;return[r.prefix,r.given,r.middle,r.family,r.suffix].map(e=>String(e||``).trim()).filter(Boolean).join(` `)}function be(e){let t=String(e?.primaryEmail||``).trim();if(t)return t;let n=Array.isArray(e?.channels)?e.channels:[],r=n.find(e=>e?.kind===`email`&&e?.primary)||n.find(e=>e?.kind===`email`);return String(r?.value||``).trim()}function xe(e){try{let t=new URL(e);return`${t.hostname}${t.pathname}`}catch{return e}}function Se(e){return e.schema===`data/schema/file`&&String(e.metadata?.contentType||``).startsWith(`image/`)}var Ce=/^(imaps?|pop3s?|mailto|graph|ews|news|nntp):/i;function we(e){if(!e||Ce.test(e))return``;let t=e.replace(/^[a-z][a-z0-9+.-]*:\/\//i,``),n=t.indexOf(`/`),r=(n>=0?t.slice(n+1):t).split(`/`).filter(Boolean).pop();if(!r)return``;let i;try{i=decodeURIComponent(r)}catch{i=r}return/^stored:\/\//i.test(e)&&!Te(i)?``:i}function Te(e){return e.length>0&&!/^[a-f0-9]{12,}$/i.test(e)&&!/^[a-f0-9]{16,}\.[A-Za-z0-9]{1,12}$/i.test(e)}function Ee(e){return typeof e.comment==`string`?e.comment.trim():``}function v(e){let t=String(e.metadata?.filename||``).trim();if(t)return t;let n=String(e.data?.filename||``).trim();if(n)return n;let r=(e.locations||[]).filter(Boolean),i=r.find(e=>/^stored:\/\/workspace:/i.test(e.url||``)),a=String(i?.metadata?.filename||``).trim();if(a)return a;let o=[...r].sort((e,t)=>String(e.url||``).localeCompare(String(t.url||``))),s=o.find(e=>String(e.metadata?.filename||``).trim());if(s)return String(s.metadata?.filename||``).trim();for(let e of o){let t=we(e.url);if(t)return t}return``}function De(e){let t=e.data;for(let e of[t.url,t.htmlUrl,t.htmlLink])if(typeof e==`string`&&/^https?:\/\//i.test(e))return e;for(let t of e.locations||[])if(typeof t?.url==`string`&&/^https?:\/\//i.test(t.url))return t.url;return null}function y(e){let t=e.schema===ge,n=e.schema===_e,r=e.schema.split(`/`).pop()||e.schema;if(t)return{title:h(e.data.title||e.data.name||e.data.subject,160)||`Email ${e.id}`,preview:h(e.data.bodyPreview||e.data.body||``,140),subtitle:h(_(e.data.from),120),icon:`mail`,isExternal:!1,schemaLabel:r};if(e.schema===`data/schema/message`){let t=e.data.sender,n=e.data.channel;return{title:h(e.data.text,160)||`Message`,preview:h(e.data.text,400),subtitle:[t?.name||t?.displayName||t?.username||t?.id,n?.name||n?.id].filter(Boolean).join(` · `),icon:`mail`,isExternal:!1,schemaLabel:r}}if(n||e.schema===`data/schema/link`){let t=String(e.data.title||e.data.name||e.data.label||``).trim(),n=String(e.data.url||e.data.uri||``).trim();return{title:t||xe(n)||`Document ${e.id}`,preview:h(e.data.description||e.data.summary||n,140),subtitle:n,icon:`globe`,isExternal:!!n,schemaLabel:r}}if(e.schema===m||e.schema.startsWith(`${m}/`)){let t=String(e.data.status||(e.data.completed?`completed`:`pending`)).trim(),n=e.data.dueDate?new Date(String(e.data.dueDate)):null,i=n&&!Number.isNaN(n.getTime())?n.toLocaleDateString(void 0,{month:`short`,day:`numeric`}):``;return{title:h(e.data.title||e.data.name,160)||`Task ${e.id}`,preview:h(g(e.data.description||e.data.summary),400),subtitle:[t,i?`due ${i}`:``].filter(Boolean).join(` · `),icon:`file`,isExternal:!1,schemaLabel:r}}if(e.schema===`data/schema/identity`||e.schema.startsWith(`data/schema/identity/`)){let t=be(e.data),n=f(e.schema,d);return{title:h(ye(e.data),160)||`Identity ${e.id}`,preview:h(ve(e.data),140),subtitle:[t,n].filter(Boolean).join(` · `),icon:t?`mail`:`file`,isExternal:!1,schemaLabel:r}}if(e.schema===`data/schema/file`){let t=v(e),n=String(e.metadata?.contentType||``).trim(),i=e.metadata?.size,a=[n,Number.isFinite(i)?`${i} bytes`:``].filter(Boolean);return{title:h(t||e.data.title||e.data.name,160)||`File ${e.id}`,preview:a.join(` · `),subtitle:t,icon:`file`,isExternal:!1,schemaLabel:r}}return{title:h(e.data.title||e.data.name||e.data.subject||v(e),160)||`Document ${e.id}`,preview:h(g(e.data.content||e.data.description||e.data.summary||e.data.bodyPreview||e.data.body),400),subtitle:``,icon:`file`,isExternal:!1,schemaLabel:r}}function b(e){return e===`alphabetical`||e===`type`}function x(e){return e.schema===`data/schema/file`?(/\.([^.]+)$/.exec(v(e))?.[1]||e.metadata?.contentType||`file`).toLowerCase():e.schema.split(`/`).pop()||e.schema}function S(e,t,n=`asc`){let r=n===`desc`?-1:1,i=(e,t)=>e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`}),a=e.map(e=>({document:e,title:y(e).title,type:x(e)}));return a.sort((e,n)=>((t===`type`?i(e.type,n.type):0)||i(e.title,n.title)||e.document.id-n.document.id)*r),a.map(({document:e})=>e)}async function C(e,t){let n=[],r=new Set,i,a=0,o=500;for(;i=await t({limit:o,offset:a,page:void 0}),a===0&&i.payload.length&&i.payload.length<o&&(i.totalCount==null||i.payload.length<i.totalCount)&&(o=i.payload.length,i=await t({limit:o,offset:a,page:void 0})),!(!i.payload.length&&(i.totalCount==null||a>=i.totalCount));){let e=0;for(let t of i.payload)r.has(t.id)||(r.add(t.id),n.push(t),e++);if(i.payload.length&&!e)throw Error(`Document pagination did not advance`);if(a+=o,i.totalCount!=null&&a>=i.totalCount)break}let s=S(n,e.sortBy,e.order),c=e.limit??50,l=Math.max(0,e.offset??((e.page??1)-1)*(c||100)),u=c===0?s:s.slice(l,l+c);return{...i,payload:u,count:u.length,totalCount:s.length}}var w=e(n(),1),Oe=r(),T=t();function ke(e){return new Promise((t,n)=>{let r=document.createElement(`div`);document.body.appendChild(r);let o=(0,Oe.createRoot)(r),s=e=>{o.unmount(),r.remove(),e?t(e):n(Error(`Workspace start cancelled`))};function c(){let[t,n]=(0,w.useState)(``);return(0,T.jsx)(ne,{open:!0,onOpenChange:e=>{e||s()},children:(0,T.jsxs)(ee,{children:[(0,T.jsxs)(te,{children:[(0,T.jsx)(u,{children:`Start protected workspace`}),(0,T.jsx)(l,{children:e===`workspace`?`Enter the workspace PIN/password or recovery key to start.`:`Unlock integrations, or start with authenticated integrations unavailable.`})]}),(0,T.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),s({passphrase:t})},children:[(0,T.jsxs)(`label`,{className:`space-y-2 block text-sm`,children:[`PIN/password or recovery key`,(0,T.jsx)(a,{autoFocus:!0,type:`password`,autoComplete:`current-password`,value:t,onChange:e=>n(e.target.value)})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,T.jsx)(i,{type:`submit`,disabled:!t,children:`Unlock and start`}),e===`secrets`&&(0,T.jsx)(i,{type:`button`,variant:`outline`,onClick:()=>s({withoutSecrets:!0}),children:`Start without integrations`}),(0,T.jsx)(i,{type:`button`,variant:`ghost`,onClick:()=>s(),children:`Cancel`})]})]})]})})}o.render((0,T.jsx)(c,{}))})}var Ae={gh:`GitHub`,slack:`Slack`,gcal:`Google Calendar`,caldav:`CalDAV`,msteams:`Microsoft Teams`};function je(e){for(let t of e.locations||[]){let e=t?.url;if(typeof e!=`string`)continue;let n=e.indexOf(`://`);if(n<=0)continue;let r=e.slice(0,n),i=Ae[r];if(i)return{scheme:r,label:i,url:e}}return null}var E=new Map,D=new Set;function O(){for(let e of D)e()}function Me(e){E.set(e,(E.get(e)||0)+1),O()}function Ne(e){let t=(E.get(e)||0)-1;t>0?E.set(e,t):E.delete(e),O()}function Pe(e){return D.add(e),()=>{D.delete(e)}}function Fe(e){let t=(0,w.useCallback)(()=>e!=null&&E.has(e),[e]);return(0,w.useSyncExternalStore)(Pe,t,()=>!1)}function Ie(e){let t=Fe(e.id),n=je(e),r=t&&n!=null;return{mirror:n,replicating:r,label:r?`Replicating to ${n.label}…`:``}}var k=`context`,A=e=>e===`directory`||e===`backends`?`directory`:`context`,j=`data/schema/identity`;function Le(e,t){if(!e||t===`/`)return null;let n=t.split(`/`).filter(Boolean),r=e;for(let e of n)if(r=r?.children?.find(t=>t.name===e),!r)return null;return r??null}var M=new Map,N=new Map;function P(e,t=`/`,n=k,r=`context`){e.append(`treeNameOrTreeId`,n),e.append(`treeType`,r),t&&e.append(`context`,t)}function F(e,t=[]){t.filter(Boolean).forEach(t=>e.append(`allOf`,t))}function Re(e,t=[]){t.filter(Boolean).forEach(t=>e.append(`anyOf`,t))}function ze(e,t=[]){t.filter(Boolean).forEach(t=>e.append(`noneOf`,t))}function Be(e,t=[]){t.filter(Boolean).forEach(t=>e.append(`filters`,t))}function Ve(e,t){for(let n of t??[])e.append(`ids`,String(n))}function He(e,t){for(let n of t??[]){let t=n.op===`allOf`?`+`:n.op===`noneOf`?`!`:``;e.append(`rel`,`${t}${n.p}:${n.of}:${n.dir??`out`}`)}}function I(e,t,n){let r=(t&&t.length?t:n?[n]:[]).map(e=>e.trim()).filter(Boolean);for(let t of r)e.append(`q`,t)}function Ue(e,t=k){return`${o.workspaces}/${e}/trees/${encodeURIComponent(t)}`}function L(e,t=k){return`${e}\0${t}`}function We(e){return String(e||`/`).split(`/`).filter(Boolean).map(encodeURIComponent).join(`/`)}function R(e,t,n){let r=We(n);return`${Ue(e,t)}/path/${r}`}async function Ge(e){let t=await c.get(`${o.workspaces}/${e}`);return t&&`workspace`in t?{...t.workspace,access:t.access}:t}async function Ke(e){return c.get(`${o.workspaces}/${e}/status`)}async function qe(){try{let e=await c.get(o.workspaces);return Array.isArray(e)?e:(console.warn(`listWorkspaces: response.payload is not an array:`,e),[])}catch(e){throw console.error(`Failed to list workspaces:`,e),e}}async function Je(){return c.post(`${o.workspaces}/scan`)}async function Ye(e){try{return await c.post(o.workspaces,e)}catch(e){throw console.error(`Failed to create workspace:`,e),e}}var Xe={resolving:`Resolving token on the remote server…`,exporting:`Remote server is packing the workspace…`,downloading:`Downloading archive…`,extracting:`Extracting…`,loading:`Validating and loading…`,done:`Done`};async function Ze(e){return c.get(`${o.workspaces}/import/jobs/${encodeURIComponent(e)}`)}async function z(e,t,{intervalMs:n=1500,signal:r}={}){for(;;){if(r?.aborted)throw Error(`Import tracking cancelled`);let i=await Ze(e);if(t?.(i),i.status===`done`){if(!i.result)throw Error(`Import finished without returning a workspace`);return i.result}if(i.status===`failed`)throw Error(i.error?.message||`Import failed`);await new Promise(e=>setTimeout(e,n))}}async function Qe(e,t,n,r={}){return z((await c.post(`${o.workspaces}/import`,{url:e,token:t,...r})).id,n)}async function $e(){return c.get(`${o.workspaces}/remotes`)}async function et(e,t,n){return c.post(`${o.workspaces}/remotes`,{url:e,token:t,...n?{label:n}:{}})}async function tt(e){await c.delete(`${o.workspaces}/remotes/${encodeURIComponent(e)}`)}async function nt(e,t={}){return c.post(`${o.workspaces}/${e}/export`,{stop:t.stop===!0})}async function rt(e){return c.get(`${o.workspaces}/${e}/exports`)}async function it(e){await c.delete(`${o.workspaces}/exports/${encodeURIComponent(e)}`)}async function at(e){await c.post(`${o.workspaces}/exports/ticket`);let t=`${o.workspaces}/exports/${encodeURIComponent(e)}`,n=document.createElement(`a`);n.href=t,n.download=e,document.body.appendChild(n),n.click(),n.remove()}async function ot(e,t,n,r={}){return z((await st(e,t,r)).id,n)}function st(e,t,n={}){let r=localStorage.getItem(`authToken`),i=new URLSearchParams({filename:e.name,...n}),a=`${o.workspaces}/import/upload?${i}`;return new Promise((n,i)=>{let o=new XMLHttpRequest;o.open(`POST`,a,!0),o.withCredentials=!0,r&&o.setRequestHeader(`Authorization`,`Bearer ${r}`),o.setRequestHeader(`Content-Type`,`application/octet-stream`),o.upload.onprogress=e=>{e.lengthComputable&&t&&t(e.loaded/e.total)},o.onload=()=>{let e=null;try{e=JSON.parse(o.responseText)}catch{}let t=e?.payload?.job;o.status>=200&&o.status<300&&t?n(t):i(Error(e?.message||`Import failed (HTTP ${o.status})`))},o.onerror=()=>i(Error(`Upload failed — the connection dropped`)),o.onabort=()=>i(Error(`Upload cancelled`)),o.send(e)})}async function ct(e,t,n){let r=await c.post(`${o.workspaces}/import`,{path:e,...t});return`phase`in r?z(r.id,n):r}async function lt(e,t){try{if(!t){let n=await c.get(`${o.workspaces}/${e}/status`),r=n.protection?.mode||`none`;t=n.status!==`active`&&r!==`none`?await ke(r):{}}let n=await c.post(`${o.workspaces}/${e}/start`,t);return window.dispatchEvent(new CustomEvent(`workspaces:refresh`)),n}catch(e){throw console.error(`Failed to start workspace:`,e),e}}async function ut(e){try{let t=await c.post(`${o.workspaces}/${e}/stop`);return V(e),window.dispatchEvent(new CustomEvent(`workspace:stopped`,{detail:{refs:[e]}})),window.dispatchEvent(new CustomEvent(`workspaces:refresh`)),t}catch(e){throw console.error(`Failed to stop workspace:`,e),e}}async function dt(e){try{return await c.delete(`${o.workspaces}/${e}`)}catch(e){throw console.error(`Failed to remove workspace:`,e),e}}async function ft(e){try{return await c.get(`${o.workspaces}/${e}/trees`)||[]}catch(t){throw console.error(`Failed to list workspace trees ${e}:`,t),t}}async function B(e,t){try{return await c.get(`${o.workspaces}/${e}/trees/${encodeURIComponent(t)}`)}catch(n){throw console.error(`Failed to get workspace tree ${e}/${t}:`,n),n}}function V(e,t){if(!e){M.clear(),N.clear();return}if(!t){let t=`${e}\0`;for(let e of M.keys())e.startsWith(t)&&M.delete(e);for(let e of N.keys())e.startsWith(t)&&N.delete(e);return}let n=L(e,t);M.delete(n),N.delete(n)}var pt=`.trash`;function mt(e){return e?Array.isArray(e.children)?{...e,children:e.children.filter(e=>e?.name!==pt)}:e:null}async function ht(e,t,n={}){let r=L(e,t);if(!n.force&&M.has(r))return M.get(r);if(!n.force&&N.has(r))return N.get(r);let i=B(e,t).then(e=>{let t=mt(e);return N.get(r)===i&&M.set(r,t),t}).finally(()=>{N.get(r)===i&&N.delete(r)});return N.set(r,i),i}function H(e,t,n){let r=new URLSearchParams;He(r,n.rel);let i=new URLSearchParams;return I(i,n.queries,n.q),{treeNameOrTreeId:n.treeName||`context`,...n.treeType?{treeType:n.treeType}:{},context:e||`/`,scope:n.scope??`path`,allOf:t.filter(Boolean),anyOf:(n.anyOf??[]).filter(Boolean),noneOf:(n.noneOf??[]).filter(Boolean),filters:(n.filters??[]).filter(Boolean),rel:r.getAll(`rel`),q:i.getAll(`q`),...n.ids?.length?{ids:[...n.ids]}:{},applyCanvasSpec:n.applyCanvasSpec!==!1,...n.layerId&&n.scope!==`workspace`?{layerId:n.layerId}:{}}}async function U(e,t=`/`,n=[],r={}){if(b(r.sortBy))return C(r,i=>U(e,t,n,{...r,...i,sortBy:void 0,order:`asc`}));try{let i=new URLSearchParams,a=H(t,n,r);for(let[e,t]of Object.entries(a))Array.isArray(t)?t.forEach(t=>i.append(e,String(t))):i.append(e,String(t));r.limit!==void 0&&i.append(`limit`,r.limit.toString()),r.offset!==void 0&&i.append(`offset`,r.offset.toString()),r.page!==void 0&&i.append(`page`,r.page.toString()),r.debug&&i.append(`debug`,`true`),r.debug&&r.debugLimit&&i.append(`debugLimit`,String(r.debugLimit)),r.sortBy&&i.append(`sortBy`,r.sortBy),r.order&&i.append(`order`,r.order);let s=i.toString(),l=`${o.workspaces}/${e}/documents${s?`?`+s:``}`;return await c.getEnvelope(l)}catch(t){throw console.error(`Failed to get workspace documents ${e}:`,t),t}}async function gt(e,t,n=k,r={}){return U(e,t,r.allOf||[],{treeName:n,treeType:A(n),limit:r.limit,page:r.page,offset:r.offset,q:r.q,queries:r.queries,anyOf:r.anyOf,noneOf:r.noneOf,filters:r.filters,ids:r.ids,sortBy:r.sortBy,order:r.order,applyCanvasSpec:r.applyCanvasSpec})}async function W(e,t,n,r={}){if(b(r.sortBy))return C(r,i=>W(e,t,n,{...r,...i,sortBy:void 0,order:`asc`}));try{let i=new URLSearchParams;r.limit!==void 0&&i.append(`limit`,r.limit.toString()),r.offset!==void 0&&i.append(`offset`,r.offset.toString()),r.page!==void 0&&i.append(`page`,r.page.toString()),I(i,r.queries,r.q),F(i,r.allOf),Re(i,r.anyOf),ze(i,r.noneOf),Be(i,r.filters),Ve(i,r.ids),r.sortBy&&i.append(`sortBy`,r.sortBy),r.order&&i.append(`order`,r.order);let a=i.toString(),s=`${o.workspaces}/${e}/trees/${encodeURIComponent(t)}/layers/${encodeURIComponent(n)}/documents${a?`?`+a:``}`;return await c.getEnvelope(s)}catch(r){throw console.error(`Failed to get workspace layer documents ${e}/${t}/${n}:`,r),r}}async function _t(e,t){try{return await c.patch(`${o.workspaces}/${e}`,t)}catch(e){throw console.error(`Failed to update workspace:`,e),e}}async function vt(e,t,n=!0,r=k,i=`context`){try{return await c.put(R(e,r,t),{type:i,autoCreateLayers:n}),!0}catch(e){throw console.error(`Failed to insert workspace path ${t}:`,e),e}}async function yt(e,t,n=k,r={}){try{return await c.put(R(e,n,t),{type:`canvas`,...r}),!0}catch(e){throw console.error(`Failed to create workspace canvas ${t}:`,e),e}}async function bt(e,t,n,r,i){let a={metadata:r};return i&&(a.querySpec=i),await c.patch(R(e,n,t),a),!0}async function xt(e,t,n=k){return await c.post(`${s}/pub/c`,{workspaceId:e,path:t,treeName:n})}async function St(e,t,n=k){let r=new URLSearchParams({workspaceId:e,path:t,treeName:n});return await c.get(`${s}/pub/c?${r.toString()}`)}async function Ct(e){return await c.delete(`${s}/pub/c/${encodeURIComponent(e)}`),!0}async function wt(e){let t=await c.get(`${o.workspaces}/${e}/shares`);return{publicCanvasShares:t?.publicCanvasShares||[],emailShares:t?.emailShares||[]}}async function Tt(e,t){return await c.delete(`${o.workspaces}/${e}/shares/public-canvas/${encodeURIComponent(t)}`),!0}async function Et(e,t,n,r=k){try{return await c.patch(R(e,r,t),n),!0}catch(e){throw console.error(`Failed to update workspace path ${t}:`,e),e}}async function Dt(e,t,n=!1,r=k,i=!1,a=!1){try{let o=new URLSearchParams({recursive:n.toString()});return i&&o.set(`purge`,`true`),a&&o.set(`destroy`,`true`),await c.delete(`${R(e,r,t)}?${o.toString()}`),!0}catch(e){throw console.error(`Failed to remove workspace path ${t}:`,e),e}}async function Ot(e,t,n,r=!1,i=k,a,o={}){try{return await c.patch(R(e,i,t),{to:n,recursive:r,...o.mergeDown?{mergeDown:!0}:{},...a&&a!==i?{targetTreeNameOrTreeId:a}:{}}),!0}catch(e){throw console.error(`Failed to move workspace path from ${t} to ${n}:`,e),e}}async function kt(e,t,n,r=!1,i=k,a){try{return await c.post(R(e,i,t),{to:n,recursive:r,...a&&a!==i?{targetTreeNameOrTreeId:a}:{}}),!0}catch(e){throw console.error(`Failed to copy workspace path from ${t} to ${n}:`,e),e}}async function At(e,t,n,r=k,i=`context`){try{let a=K(Array.isArray(n)?n:[n]),s=performance.now();return await c.post(`${o.workspaces}/${e}/documents`,{documentIds:a,treeNameOrTreeId:r,treeType:i,context:t}),console.info(`[paste] linked ${a.length} document(s) → ${r}:${t} in ${Math.round(performance.now()-s)} ms`),!0}catch(e){throw console.error(`Failed to paste documents to workspace path ${t}:`,e),e}}async function jt(e,t,n,r=k,i=`context`){try{let a=Array.isArray(n)?n:[n],s=await c.post(`${o.workspaces}/${e}/documents`,{documents:a,treeNameOrTreeId:r,treeType:i,context:t});return Array.isArray(s)?s:[]}catch(e){throw console.error(`Failed to import documents to workspace path ${t}:`,e),e}}var G=e=>`${o.workspaces}/${e}/pins`,Mt=(e,t)=>`${e}\0${t}`;async function Nt(e){let t=await c.get(G(e));return Array.isArray(t)?t:[]}async function Pt(e,t,n=k){return c.post(G(e),{path:t,tree:n})}async function Ft(e,t){await c.delete(`${G(e)}/${encodeURIComponent(t)}`)}async function It(e,t){let n=await c.patch(`${G(e)}/order`,{order:t});return Array.isArray(n)?n:[]}async function Lt(e,t=k){return await c.get(`${o.workspaces}/${e}/trees/${encodeURIComponent(t)}/layers`)||[]}async function Rt(e,t,n,r=k){return await c.patch(`${o.workspaces}/${e}/trees/${encodeURIComponent(r)}/layers/${t}`,{name:n})}async function zt(e,t,n,r=k){return await c.post(`${o.workspaces}/${e}/trees/${encodeURIComponent(r)}/layers/${t}/lock`,{lockBy:n}),!0}async function Bt(e,t,n,r=k){return await c.post(`${o.workspaces}/${e}/trees/${encodeURIComponent(r)}/layers/${t}/unlock`,{lockBy:n}),!0}async function Vt(e,t,n=k){return await c.delete(`${o.workspaces}/${e}/trees/${encodeURIComponent(n)}/layers/${t}`),!0}async function Ht(e,t,n,r=k){return await c.post(`${o.workspaces}/${e}/trees/${encodeURIComponent(r)}/layers/merge`,{layerId:t,targetLayers:n})}async function Ut(e,t,n=k){return(await c.post(`${o.workspaces}/${e}/trees/${encodeURIComponent(n)}/paths/merge-down`,{path:t}))?.data??null}async function Wt(e,t,n=k){return(await c.post(`${o.workspaces}/${e}/trees/${encodeURIComponent(n)}/paths/subtract-down`,{path:t}))?.data??null}async function Gt(e,t,n,r=k){return await c.post(`${o.workspaces}/${e}/trees/${encodeURIComponent(r)}/layers/subtract`,{layerId:t,targetLayers:n})}function K(e){let t=e.map(e=>typeof e==`number`?e:Number(e));if(t.some(e=>!Number.isFinite(e)))throw Error(`Invalid document ID(s): expected numbers (or numeric strings), got ${JSON.stringify(e)}`);return t}async function Kt(e,t,n=`/`,r=[],i=k,a=`context`,s={}){let l=new URLSearchParams;P(l,n,i,a),F(l,r),s.trashIfOrphaned&&l.append(`trashIfOrphaned`,`true`);let u=K(t);return await c.delete(`${o.workspaces}/${e}/documents/remove?${l.toString()}`,{headers:{"Content-Type":`application/json`},body:JSON.stringify(u)}),!0}async function qt(e,t,n=`/`,r=[],i=k,a=`context`){let s=new URLSearchParams;P(s,n,i,a),F(s,r);let l=K(t);return await c.delete(`${o.workspaces}/${e}/documents?${s.toString()}`,{headers:{"Content-Type":`application/json`},body:JSON.stringify(l)}),!0}async function Jt(e,t){Me(t.id);try{await c.put(`${o.workspaces}/${e}/documents`,{documents:[t]})}finally{Ne(t.id)}return!0}async function Yt(e,t,n={}){let r={documentIds:K(t)};return n.urls&&(r.urls=n.urls),n.keepDocument&&(r.keepDocument=!0),await c.delete(`${o.workspaces}/${e}/documents/destroy`,{headers:{"Content-Type":`application/json`},body:JSON.stringify(r)})}async function Xt(e,t,n){let r=n.folder?.trim().replace(/^\/+|\/+$/g,``),i=n.filename?.trim();return await c.post(`${o.workspaces}/${e}/documents/transfer`,{documentIds:K(t),to:n.to,mode:n.mode??`copy`,...n.deleteFrom?{deleteFrom:n.deleteFrom}:{},...n.keepDocument?{keepDocument:!0}:{},...r?{folder:r}:{},...i?{filename:i}:{},...n.onConflict?{onConflict:n.onConflict}:{}})}function Zt(e){return typeof e.capabilities?.paths==`boolean`?e.capabilities.paths:e.kind===`storage`&&e.driver!==`cacache`}async function Qt(e,t){return await c.get(`${o.workspaces}/${encodeURIComponent(e)}/documents/${t}`)}async function $t(e,t,n){return await c.get(`${o.workspaces}/${encodeURIComponent(e)}/documents/by-hash/${encodeURIComponent(t)}/${encodeURIComponent(n)}`)}async function en(e,t){return await c.get(`${o.workspaces}/${e}/documents/${t}/locations`)||[]}async function tn(e,t,n){let r=n?`?tree=${encodeURIComponent(n)}`:``;return(await c.get(`${o.workspaces}/${e}/documents/${t}/memberships${r}`))?.memberships||[]}async function nn(e,t,n=500){return(await U(e,`/`,[t?`${j}/${t}`:j],{scope:`workspace`,limit:n})).payload||[]}async function rn(e){return(await c.get(`${o.workspaces}/${encodeURIComponent(e)}/documents/relations/predicates`))?.predicates??[]}async function an(e,t,n={}){let r=new URLSearchParams;n.resolve===!1&&r.set(`resolve`,`false`),n.offset!==void 0&&r.set(`offset`,String(n.offset)),n.limit!==void 0&&r.set(`limit`,String(n.limit)),n.summary&&r.set(`summary`,`true`);let i=r.size?`?${r}`:``;return await c.get(`${o.workspaces}/${e}/documents/${t}/relations${i}`)??{documentId:Number(t),predicates:[],outgoing:[],incoming:[]}}async function on(e,t,n,r,i=`out`){return await c.post(`${o.workspaces}/${e}/documents/${t}/relations`,{p:n,to:Array.isArray(r)?K(r):r,dir:i}),!0}async function sn(e,t,n,r,i=`out`){return await c.delete(`${o.workspaces}/${e}/documents/${t}/relations`,{headers:{"Content-Type":`application/json`},body:JSON.stringify({p:n,to:r,dir:i})}),!0}function q(e,t,n={}){let r=new URLSearchParams;n.version&&r.set(`v`,n.version),n.download&&r.set(`download`,`1`),n.url&&r.set(`url`,n.url),n.format&&r.set(`format`,n.format);let i=r.toString();return`${o.workspaces}/${e}/documents/${t}/content${i?`?${i}`:``}`}async function cn(e,t,n=256,r){let i=localStorage.getItem(`authToken`),a=r?`&v=${encodeURIComponent(r)}`:``,s=await fetch(`${o.workspaces}/${e}/documents/${t}/thumbnail?size=${n}${a}`,{headers:i?{Authorization:`Bearer ${i}`}:{}});if(!s.ok)throw Error(`HTTP ${s.status}`);let c=s.headers.get(`content-type`)||`image/webp`;return{blob:await s.blob(),mime:c}}async function ln(e,t,n={}){let r=localStorage.getItem(`authToken`),i=await fetch(q(e,t,n),{signal:n.signal,headers:r?{Authorization:`Bearer ${r}`}:{}});if(!i.ok)throw Error(`HTTP ${i.status}`);let a=i.headers.get(`content-type`)||`application/octet-stream`;return{blob:await i.blob(),mime:a}}function un(e,t,n={}){return q(e,t,n)}async function dn(e,t){let n=localStorage.getItem(`authToken`);return(await fetch(`${o.workspaces}/${e}/documents/${t}/content-ticket`,{method:`POST`,headers:n?{Authorization:`Bearer ${n}`}:{},credentials:`include`})).ok}async function fn(e,t,n,r={}){let i=localStorage.getItem(`authToken`),a=await fetch(q(e,t,{download:!0,url:r.url}),{headers:i?{Authorization:`Bearer ${i}`}:{}});if(!a.ok)throw Error(`HTTP ${a.status}`);let o=await a.blob(),s=URL.createObjectURL(o),c=document.createElement(`a`);c.href=s,c.download=n,document.body.appendChild(c),c.click(),c.remove(),setTimeout(()=>URL.revokeObjectURL(s),3e4)}async function pn(e,t,n){return c.post(`${o.workspaces}/${e}/documents/purge`,{selection:t,expectedCount:n})}async function mn(e){try{return await c.get(`${o.workspaces}/${e}/services`)}catch(e){throw console.error(`Failed to get workspace services status:`,e),e}}async function hn(e,t){try{return await c.post(`${o.workspaces}/${e}/services/${t}/enable`)}catch(e){throw console.error(`Failed to enable ${t} service:`,e),e}}async function gn(e,t){try{return await c.post(`${o.workspaces}/${e}/services/${t}/disable`)}catch(e){throw console.error(`Failed to disable ${t} service:`,e),e}}var J=e=>`${o.workspaces}/${e}/backends`,Y=(e,t,n)=>`${J(e)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}`;async function _n(e,t){let n=t?`${J(e)}/${encodeURIComponent(t)}`:J(e);return await c.get(n)||[]}async function vn(e,t,n){return await c.get(Y(e,t,n))}async function yn(e,t,n){return await c.get(`${Y(e,t,n)}/usage`)}async function bn(e){return await c.delete(`${o.workspaces}/${e}/thumbnails`)}async function xn(e){return await c.get(`${o.workspaces}/${e}/usage`)}function Sn(e){if(e==null||!Number.isFinite(e))return`—`;if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=e,r=`B`;for(let e of t){if(n<1024)break;n/=1024,r=e}return`${n.toFixed(n>=100?0:1)} ${r}`}async function Cn(e,t,n){return await c.post(`${J(e)}/${encodeURIComponent(t)}`,n)}async function wn(e,t,n,r){return await c.patch(Y(e,t,n),r)}async function Tn(e,t,n){return await c.delete(Y(e,t,n))}async function En(e,t,n){return await c.post(`${Y(e,t,n)}/sync`)}async function Dn(e,t,n){return await c.post(`${Y(e,t,n)}/sync/cancel`)}async function On(e,t,n){return await c.post(`${Y(e,t,n)}/test`)}async function kn(e,t,n){return await c.get(`${Y(e,t,n)}/containers`)||[]}async function An(e,t,n,r,i){return await c.post(`${Y(e,t,n)}/containers/${encodeURIComponent(r)}/documents`,i)}async function jn(e,t,n,r){return await c.post(`${Y(e,t,n)}/containers/${encodeURIComponent(r)}/sync`)}function Mn(e){let t=String(e||``).split(`/`).filter(Boolean);return t[0]!==`imap`||t.length<3||t[t.length-1]===`attachments`?null:{address:t[1]}}async function Nn(e,t,n,r){return c.post(`${Y(e,`imap`,t)}/messages/move`,{documentIds:n,targetPath:r})}async function Pn(e,t,n){return await c.get(`${Y(e,t,n)}/containers?available=1`)||[]}async function Fn(e,t,n,r){return await c.post(`${Y(e,t,n)}/containers`,{folders:r})}async function In(e,t,n,r){return await c.delete(`${Y(e,t,n)}/containers/${encodeURIComponent(r)}`)}async function Ln(e,t,n,r,i){return await c.patch(`${Y(e,t,n)}/containers/${encodeURIComponent(r)}`,{name:i})}function X(e,t){if(!t?.length)return null;let n=`/`+String(e||``).split(`/`).filter(Boolean).join(`/`);for(let e of t)if(e.treePath){if(n===e.treePath)return{backend:e,key:``};if(n.startsWith(e.treePath+`/`))return{backend:e,key:n.slice(e.treePath.length+1)}}return null}function Rn(e,t){let n=X(e,t);if(n)return{driver:n.backend.driver,address:n.backend.address,key:n.key};let r=Z(e);return r?{...r,driver:t?.find(e=>e.address===r.address)?.driver||r.driver}:null}function Z(e,t){let n=X(e,t);if(n)return n.backend.driver===`file`?{driver:`file`,address:n.backend.address,key:n.key}:null;let r=String(e||``).split(`/`).filter(Boolean);return r[0]===`workspace`&&r[1]===`git`?null:r[0]===`workspace`&&r.length>=2?{driver:`file`,address:`workspace:${r[1]}`,key:r.slice(2).join(`/`)}:r[0]===`device`&&r.length>=3?{driver:`file`,address:r[2],key:r.slice(3).join(`/`)}:r[0]===`file`&&r.length>=2?{driver:`file`,address:r[1],key:r.slice(2).join(`/`)}:null}function zn(e,t){let n=X(e,t);if(n){let{backend:e,key:t}=n;return!t||![`file`,`gdrive`].includes(e.driver)||!e.enabled||!e.capabilities.mutableContainers||e.config?.readOnly===!0?null:{driver:e.driver,address:e.address,key:t}}if(t)return null;let r=String(e||``).split(`/`).filter(Boolean);if(r[0]===`gdrive`&&r.length>2)return{driver:`gdrive`,address:r[1],key:r.slice(2).join(`/`)};let i=Z(e);return i?.key?i:null}async function Bn(e,t,n,r={}){let i=new URLSearchParams;r.linked!==void 0&&i.append(`linked`,String(r.linked)),r.limit!==void 0&&i.append(`limit`,String(r.limit)),r.offset!==void 0&&i.append(`offset`,String(r.offset));let a=i.toString();return await c.getEnvelope(`${Y(e,t,n)}/documents${a?`?${a}`:``}`)}async function Vn(e,t,n){return await c.post(`${J(e)}/${encodeURIComponent(t)}/discover`,n)||[]}function Hn(e,t){let n=X(e,t);if(n)return{driver:n.backend.driver,address:n.backend.address};let r=String(e||``).split(`/`).filter(Boolean);return r.length<2||r[0]===`workspace`&&r[1]===`git`?null:r[0]===`workspace`?{driver:`file`,address:`workspace:${r[1]}`}:r[0]===`device`?r.length>=3?{driver:`file`,address:r[2]}:null:{driver:r[0],address:r[1]}}var Un=[`internal/`,`context/`,`vfs/`];async function Q(e){try{return(await c.get(`${o.workspaces}/${encodeURIComponent(e)}/bitmaps`)||[]).map(e=>typeof e==`string`?e:e.key??String(e)).filter(e=>e&&!Un.some(t=>e.startsWith(t)))}catch{return[]}}async function Wn(e){return(await Q(e)).filter(e=>e.startsWith(`tag/`)).map(e=>e.slice(4)).filter(Boolean).sort()}async function Gn(e,t){let n=t.replace(/^\/+|\/+$/g,``);if(!n)throw Error(`Bitmap key is required`);if(n.startsWith(`data/`)||n===`data`)throw Error(`data/* bitmaps are protected and cannot be deleted manually`);return await c.delete(`${o.workspaces}/${encodeURIComponent(e)}/bitmaps/${n.split(`/`).map(encodeURIComponent).join(`/`)}`),!0}async function Kn(e,t,n=!0){let r=t.replace(/^data\/dataset\//,``).replace(/^\/+|\/+$/g,``);if(!r)throw Error(`Dataset name is required`);if(r==="default")throw Error(`The "default" dataset is virtual and cannot be deleted`);return await c.delete(`${o.workspaces}/${encodeURIComponent(e)}/datasets/${r.split(`/`).map(encodeURIComponent).join(`/`)}?dropDocuments=${n}`)}function $(e){return`${o.workspaces}/${encodeURIComponent(e)}/timelines`}async function qn(e){try{return await c.get($(e))||[]}catch{return[]}}async function Jn(e){try{return await c.get(`${$(e)}?verbose=true`)||[]}catch{return[]}}async function Yn(e,t){return await c.post($(e),{name:t})}async function Xn(e,t){return await c.delete(`${$(e)}/${encodeURIComponent(t)}`),!0}async function Zn(e,t){return(await c.post(`${$(e)}/histogram`,t))?.buckets??[]}async function Qn(e,t){let n=t?`?workspaceId=${encodeURIComponent(t)}`:``;return await c.post(`${o.admin.inferd}/${e?`pause`:`resume`}${n}`)}async function $n(e){return await c.get(`${o.workspaces}/${e}/db/stats`)}async function er(e,t){return await c.put(`${o.workspaces}/${e}/db/tuning`,t)}async function tr(e){let t=await c.get(`${o.workspaces}/${e}/trash`);return Array.isArray(t)?t:[]}async function nr(e,t){return await c.post(`${o.workspaces}/${e}/trash/restore`,{documentIds:K(t)})}async function rr(e,t){return await c.delete(`${o.workspaces}/${e}/trash`,t?.length?{headers:{"Content-Type":`application/json`},body:JSON.stringify({documentIds:K(t)})}:{})}var ir=(e,t,n)=>`${o.workspaces}/${e}/members/${encodeURIComponent(`${t}:${n}`)}`;async function ar(e){return c.get(`${o.workspaces}/${e}/members`)}async function or(e,t,n,r){return c.post(`${o.workspaces}/${e}/members`,{...t,permissions:n,...r?{description:r}:{}})}async function sr(e,t,n,r){return c.put(ir(e,t,n),{permissions:r})}async function cr(e,t,n){await c.delete(ir(e,t,n))}async function lr(e,t,n){return c.post(`${o.workspaces}/${encodeURIComponent(e)}/documents/copy-to-workspace`,{documentId:t,...n})}async function ur(e,t){return c.post(`${o.workspaces}/${e}/documents/${t}/download`)}export{$n as $,nr as $t,Vn as A,y as An,qn as At,Zn as B,re as Bn,Pt as Bt,Kn as C,A as Cn,rt as Ct,Yt as D,b as Dn,Nt as Dt,Xn as E,C as En,ar as Et,rr as F,ce as Fn,Ut as Ft,ht as G,he as Gn,tt as Gt,Sn as H,le as Hn,Tn as Ht,hn as I,ue as In,Ht as It,tn as J,Dt as Jt,gt as K,dt as Kt,nt as L,oe as Ln,Nn as Lt,fn as M,v as Mn,ft as Mt,ur as N,Se as Nn,qe as Nt,Vt as O,S as On,wt as Ot,at as P,se as Pn,zt as Pt,Ge as Q,dn as Qt,ln as R,d as Rn,Ot as Rt,Gn as S,k as Sn,Q as St,it as T,x as Tn,Lt as Tt,vn as U,me as Un,In as Ut,Le as V,ae as Vn,pn as Vt,yn as W,f as Wn,sn as Wt,St as X,Rt as Xt,an as Y,Ln as Yt,rn as Z,It as Zt,xt as _,_t as _n,Bn as _t,Hn as a,er as an,mn as at,Yn as b,Et as bn,$e as bt,zn as c,Wt as cn,or as ct,Dn as d,jn as dn,ot as dt,cr as en,xn as et,bn as f,On as fn,ct as ft,on as g,wn as gn,kn as gt,An as h,Ft as hn,V as ht,et as i,Qn as in,W as it,un as j,De as jn,Jn as jt,gn as k,Ee as kn,Wn as kt,Rn as l,Gt as ln,Mn as lt,kt as m,Bt as mn,vt as mt,Cn as n,bt as nn,$t as nt,Z as o,lt as on,Ke as ot,lr as p,Xt as pn,Qe as pt,en as q,Kt as qt,Fn as r,Je as rn,U as rt,Zt as s,ut as sn,B as st,Xe as t,Tt as tn,Qt as tt,H as u,En as un,jt as ut,Ye as v,Jt as vn,Pn as vt,qt as w,Ie as wn,nn as wt,Ct as x,Mt as xn,tr as xt,yt as y,sr as yn,_n as yt,cn as z,ie as zn,At as zt};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{_t as r}from"./react-BHzhHVTZ.js";import{r as i}from"./chunk-62JRHF6Z-vspAGgtK.js";import{W as a,kt as o}from"./ui-CDoK3F3U.js";import{t as s}from"./button-SeUZ_Pvi.js";import{t as c}from"./input-BOtCd4HP.js";import{bn as l,dt as u,ft as d,ht as f,mt as p,rn as m,t as h}from"./workspace-BJELPCNs.js";import{i as g,u as _}from"./layer-style-Byl5LNFR.js";var v=e(n(),1),y=[`Home`,`Travel`,`Work`,`Books`,`Workouts`,`Beauty`,`Recipes`,`To Watch`,`To Read`,`Learning`,`Tech`,`Music`,`Finance`,`Shopping`,`Ideas`];async function b(e,t,n){let r=0,i=0,a=n===`directory`?`directory`:`context`;for(let n of t)try{await p(e,`/${n}`,!0,a);let t=_(`/${n}`);t&&await l(e,`/${n}`,t,a).catch(()=>{}),r+=1}catch{i+=1}return f(e),window.dispatchEvent(new CustomEvent(`workspace:tree:refresh`,{detail:{workspaceName:e,treeName:n}})),{ok:r,failed:i}}function x(){let[e,t]=(0,v.useState)(new Set),[n,r]=(0,v.useState)(`context`);return{selected:e,setSelected:t,tree:n,setTree:r,toggle:e=>{t(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}}}var S=t();function C({selected:e,onToggle:t,tree:n,onTreeChange:i,disabled:a=!1,idPrefix:o=`default-folders`,stacked:s=!1}){return(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,S.jsx)(`span`,{className:`text-muted-foreground`,children:`Create in:`}),[`context`,`directory`].map(e=>(0,S.jsxs)(`label`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(`input`,{type:`radio`,name:`${o}-tree`,checked:n===e,onChange:()=>i(e),disabled:a}),e,` tree`]},e))]}),(0,S.jsx)(`div`,{className:`mt-3 grid gap-1.5 ${s?`grid-cols-1`:`grid-cols-2 sm:grid-cols-3 md:grid-cols-4`}`,children:y.map(n=>{let i=g[n.toLowerCase()];return(0,S.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded border px-2 py-1.5 text-sm hover:bg-accent/50`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:e.has(n),onChange:()=>t(n),disabled:a}),i?.icon&&(0,S.jsx)(r,{icon:i.icon,width:16,height:16,color:i.color}),(0,S.jsx)(`span`,{className:`truncate`,children:n})]},n)})})]})}function w({disabled:e}){let[t,n]=(0,v.useState)(0),[r,a]=(0,v.useState)(!0),[c,l]=(0,v.useState)([]),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(``),h=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let e=!0;return h.current?.id!==t&&(h.current={id:t,promise:m()}),h.current.promise.then(t=>{if(!e)return;let n=[...t.discovered,...t.adopted];l(e=>[...new Map([...e,...n].map(e=>[e.id,e])).values()]),d(t)}).catch(t=>{e&&p(t instanceof Error?t.message:`Workspace scan failed`)}).finally(()=>{e&&a(!1)}),()=>{e=!1}},[t]),(0,S.jsxs)(`section`,{className:`space-y-2 rounded-md border p-3`,"aria-label":`Find workspace folders`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h3`,{className:`text-sm font-medium`,children:`Workspaces folder`}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Copied a workspace folder here? Scan to add it to your workspaces.`})]}),(0,S.jsxs)(s,{type:`button`,variant:`outline`,size:`sm`,disabled:e||r,onClick:()=>{a(!0),p(``),n(e=>e+1)},children:[(0,S.jsx)(o,{className:`mr-2 h-3.5 w-3.5 ${r?`animate-spin`:``}`}),r?`Scanning…`:`Rescan`]})]}),r&&(0,S.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Looking for workspace folders…`}),!r&&!f&&(0,S.jsx)(`p`,{role:`status`,className:`text-sm`,children:c.length?`Found ${c.length} ${c.length===1?`workspace`:`workspaces`}. Added to your workspace list.`:`No new workspace folders found.`}),c.length>0&&(0,S.jsx)(`ul`,{className:`space-y-2`,children:c.map(e=>(0,S.jsxs)(`li`,{children:[(0,S.jsx)(i,{className:`text-sm font-medium underline underline-offset-2`,to:`/workspaces/${encodeURIComponent(e.name)}`,children:e.label||e.name}),(0,S.jsx)(`p`,{className:`break-all text-xs text-muted-foreground`,children:e.dir})]},e.id))}),f&&(0,S.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:f}),!!u?.skipped.length&&(0,S.jsxs)(`details`,{className:`text-sm text-muted-foreground`,children:[(0,S.jsxs)(`summary`,{children:[u.skipped.length,` `,u.skipped.length===1?`folder could`:`folders could`,` not be added`]}),(0,S.jsx)(`ul`,{className:`mt-1 space-y-1`,children:u.skipped.map(e=>(0,S.jsxs)(`li`,{className:`break-all`,children:[e.dir,`: `,e.reason]},e.dir))})]})]})}function T({name:e,label:t,setName:n,setLabel:r,disabled:i=!1}){return(0,S.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,S.jsxs)(`label`,{className:`grid gap-1 text-sm`,children:[`Workspace name`,(0,S.jsx)(c,{required:!0,pattern:`[a-zA-Z0-9]([a-zA-Z0-9_]|-)*`,placeholder:`my-workspace`,value:e,onChange:e=>n(e.target.value),disabled:i}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Used in addresses. Archive imports also use it as the folder name.`})]}),(0,S.jsxs)(`label`,{className:`grid gap-1 text-sm`,children:[`Display label`,(0,S.jsx)(c,{required:!0,placeholder:`My Workspace`,value:t,onChange:e=>r(e.target.value),disabled:i})]})]})}function E({onImported:e,disabled:t=!1}){let[n,r]=(0,v.useState)(`upload`),[i,l]=(0,v.useState)(null),[f,p]=(0,v.useState)(``),[m,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(!1),[C,E]=(0,v.useState)(``),[D,O]=(0,v.useState)(``),[k,A]=(0,v.useState)(null),j=t||b,M=async t=>{t.preventDefault(),x(!0),O(``),A(null),E(`Starting…`);let r={name:m.trim(),label:_.trim()},a=e=>E(h[e.phase]||e.phase);try{let t=n===`upload`?await u(i,e=>E(e<1?`Uploading… ${Math.round(e*100)}%`:`Extracting…`),a,r):await d(f.trim(),r,a);A(t),window.dispatchEvent(new CustomEvent(`workspaces:refresh`)),e?.(t)}catch(e){O(e instanceof Error?e.message:`Workspace import failed`)}finally{x(!1)}};return(0,S.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>void M(e),children:[(0,S.jsx)(w,{disabled:j}),(0,S.jsxs)(`label`,{className:`grid gap-1 text-sm`,children:[`Import from`,(0,S.jsxs)(`select`,{value:n,disabled:j,onChange:e=>r(e.target.value),className:`rounded-md border bg-background p-2`,children:[(0,S.jsx)(`option`,{value:`upload`,children:`Upload an archive`}),(0,S.jsx)(`option`,{value:`path`,children:`Path on this server`})]})]}),n===`upload`?(0,S.jsxs)(`label`,{className:`grid gap-1 text-sm`,children:[`Workspace archive`,(0,S.jsx)(c,{required:!0,type:`file`,accept:`.tar.gz,.tgz,.tar.bz2,.tbz2,.tbz`,disabled:j,onChange:e=>l(e.target.files?.[0]||null)})]}):(0,S.jsxs)(`label`,{className:`grid gap-1 text-sm`,children:[`Server path`,(0,S.jsx)(c,{required:!0,placeholder:`/tmp/workspace.tar.gz`,value:f,disabled:j,onChange:e=>p(e.target.value)}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`An archive or workspace folder on the server. Archives are extracted into your Workspaces directory.`})]}),(0,S.jsx)(T,{name:m,label:_,setName:g,setLabel:y,disabled:j}),(0,S.jsxs)(s,{type:`submit`,disabled:j||!m.trim()||!_.trim()||(n===`upload`?!i:!f.trim()),children:[b?(0,S.jsx)(o,{className:`mr-2 h-4 w-4 animate-spin`}):(0,S.jsx)(a,{className:`mr-2 h-4 w-4`}),b?`Importing…`:`Import workspace`]}),b&&(0,S.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:C}),D&&(0,S.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:D}),k&&(0,S.jsxs)(`p`,{role:`status`,className:`text-sm`,children:[`Imported `,k.label||k.name,`.`]})]})}export{x as a,b as i,T as n,C as r,E as t};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{_t as r}from"./react-BHzhHVTZ.js";import{r as i}from"./chunk-62JRHF6Z-vspAGgtK.js";import{W as a,kt as o}from"./ui-CDoK3F3U.js";import{t as s}from"./button-SeUZ_Pvi.js";import{t as c}from"./input-BOtCd4HP.js";import{bn as l,dt as u,ft as d,ht as f,mt as p,rn as m,t as h}from"./workspace-cv6Hrfhh.js";import{i as g,u as _}from"./layer-style-Byl5LNFR.js";var v=e(n(),1),y=[`Home`,`Travel`,`Work`,`Books`,`Workouts`,`Beauty`,`Recipes`,`To Watch`,`To Read`,`Learning`,`Tech`,`Music`,`Finance`,`Shopping`,`Ideas`];async function b(e,t,n){let r=0,i=0,a=n===`directory`?`directory`:`context`;for(let n of t)try{await p(e,`/${n}`,!0,a);let t=_(`/${n}`);t&&await l(e,`/${n}`,t,a).catch(()=>{}),r+=1}catch{i+=1}return f(e),window.dispatchEvent(new CustomEvent(`workspace:tree:refresh`,{detail:{workspaceName:e,treeName:n}})),{ok:r,failed:i}}function x(){let[e,t]=(0,v.useState)(new Set),[n,r]=(0,v.useState)(`context`);return{selected:e,setSelected:t,tree:n,setTree:r,toggle:e=>{t(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}}}var S=t();function C({selected:e,onToggle:t,tree:n,onTreeChange:i,disabled:a=!1,idPrefix:o=`default-folders`,stacked:s=!1}){return(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,S.jsx)(`span`,{className:`text-muted-foreground`,children:`Create in:`}),[`context`,`directory`].map(e=>(0,S.jsxs)(`label`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(`input`,{type:`radio`,name:`${o}-tree`,checked:n===e,onChange:()=>i(e),disabled:a}),e,` tree`]},e))]}),(0,S.jsx)(`div`,{className:`mt-3 grid gap-1.5 ${s?`grid-cols-1`:`grid-cols-2 sm:grid-cols-3 md:grid-cols-4`}`,children:y.map(n=>{let i=g[n.toLowerCase()];return(0,S.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded border px-2 py-1.5 text-sm hover:bg-accent/50`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:e.has(n),onChange:()=>t(n),disabled:a}),i?.icon&&(0,S.jsx)(r,{icon:i.icon,width:16,height:16,color:i.color}),(0,S.jsx)(`span`,{className:`truncate`,children:n})]},n)})})]})}function w({disabled:e}){let[t,n]=(0,v.useState)(0),[r,a]=(0,v.useState)(!0),[c,l]=(0,v.useState)([]),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(``),h=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let e=!0;return h.current?.id!==t&&(h.current={id:t,promise:m()}),h.current.promise.then(t=>{if(!e)return;let n=[...t.discovered,...t.adopted];l(e=>[...new Map([...e,...n].map(e=>[e.id,e])).values()]),d(t)}).catch(t=>{e&&p(t instanceof Error?t.message:`Workspace scan failed`)}).finally(()=>{e&&a(!1)}),()=>{e=!1}},[t]),(0,S.jsxs)(`section`,{className:`space-y-2 rounded-md border p-3`,"aria-label":`Find workspace folders`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h3`,{className:`text-sm font-medium`,children:`Workspaces folder`}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Copied a workspace folder here? Scan to add it to your workspaces.`})]}),(0,S.jsxs)(s,{type:`button`,variant:`outline`,size:`sm`,disabled:e||r,onClick:()=>{a(!0),p(``),n(e=>e+1)},children:[(0,S.jsx)(o,{className:`mr-2 h-3.5 w-3.5 ${r?`animate-spin`:``}`}),r?`Scanning…`:`Rescan`]})]}),r&&(0,S.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Looking for workspace folders…`}),!r&&!f&&(0,S.jsx)(`p`,{role:`status`,className:`text-sm`,children:c.length?`Found ${c.length} ${c.length===1?`workspace`:`workspaces`}. Added to your workspace list.`:`No new workspace folders found.`}),c.length>0&&(0,S.jsx)(`ul`,{className:`space-y-2`,children:c.map(e=>(0,S.jsxs)(`li`,{children:[(0,S.jsx)(i,{className:`text-sm font-medium underline underline-offset-2`,to:`/workspaces/${encodeURIComponent(e.name)}`,children:e.label||e.name}),(0,S.jsx)(`p`,{className:`break-all text-xs text-muted-foreground`,children:e.dir})]},e.id))}),f&&(0,S.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:f}),!!u?.skipped.length&&(0,S.jsxs)(`details`,{className:`text-sm text-muted-foreground`,children:[(0,S.jsxs)(`summary`,{children:[u.skipped.length,` `,u.skipped.length===1?`folder could`:`folders could`,` not be added`]}),(0,S.jsx)(`ul`,{className:`mt-1 space-y-1`,children:u.skipped.map(e=>(0,S.jsxs)(`li`,{className:`break-all`,children:[e.dir,`: `,e.reason]},e.dir))})]})]})}function T({name:e,label:t,setName:n,setLabel:r,disabled:i=!1}){return(0,S.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,S.jsxs)(`label`,{className:`grid gap-1 text-sm`,children:[`Workspace name`,(0,S.jsx)(c,{required:!0,pattern:`[a-zA-Z0-9]([a-zA-Z0-9_]|-)*`,placeholder:`my-workspace`,value:e,onChange:e=>n(e.target.value),disabled:i}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Used in addresses. Archive imports also use it as the folder name.`})]}),(0,S.jsxs)(`label`,{className:`grid gap-1 text-sm`,children:[`Display label`,(0,S.jsx)(c,{required:!0,placeholder:`My Workspace`,value:t,onChange:e=>r(e.target.value),disabled:i})]})]})}function E({onImported:e,disabled:t=!1}){let[n,r]=(0,v.useState)(`upload`),[i,l]=(0,v.useState)(null),[f,p]=(0,v.useState)(``),[m,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(!1),[C,E]=(0,v.useState)(``),[D,O]=(0,v.useState)(``),[k,A]=(0,v.useState)(null),j=t||b,M=async t=>{t.preventDefault(),x(!0),O(``),A(null),E(`Starting…`);let r={name:m.trim(),label:_.trim()},a=e=>E(h[e.phase]||e.phase);try{let t=n===`upload`?await u(i,e=>E(e<1?`Uploading… ${Math.round(e*100)}%`:`Extracting…`),a,r):await d(f.trim(),r,a);A(t),window.dispatchEvent(new CustomEvent(`workspaces:refresh`)),e?.(t)}catch(e){O(e instanceof Error?e.message:`Workspace import failed`)}finally{x(!1)}};return(0,S.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>void M(e),children:[(0,S.jsx)(w,{disabled:j}),(0,S.jsxs)(`label`,{className:`grid gap-1 text-sm`,children:[`Import from`,(0,S.jsxs)(`select`,{value:n,disabled:j,onChange:e=>r(e.target.value),className:`rounded-md border bg-background p-2`,children:[(0,S.jsx)(`option`,{value:`upload`,children:`Upload an archive`}),(0,S.jsx)(`option`,{value:`path`,children:`Path on this server`})]})]}),n===`upload`?(0,S.jsxs)(`label`,{className:`grid gap-1 text-sm`,children:[`Workspace archive`,(0,S.jsx)(c,{required:!0,type:`file`,accept:`.tar.gz,.tgz,.tar.bz2,.tbz2,.tbz`,disabled:j,onChange:e=>l(e.target.files?.[0]||null)})]}):(0,S.jsxs)(`label`,{className:`grid gap-1 text-sm`,children:[`Server path`,(0,S.jsx)(c,{required:!0,placeholder:`/tmp/workspace.tar.gz`,value:f,disabled:j,onChange:e=>p(e.target.value)}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`An archive or workspace folder on the server. Archives are extracted into your Workspaces directory.`})]}),(0,S.jsx)(T,{name:m,label:_,setName:g,setLabel:y,disabled:j}),(0,S.jsxs)(s,{type:`submit`,disabled:j||!m.trim()||!_.trim()||(n===`upload`?!i:!f.trim()),children:[b?(0,S.jsx)(o,{className:`mr-2 h-4 w-4 animate-spin`}):(0,S.jsx)(a,{className:`mr-2 h-4 w-4`}),b?`Importing…`:`Import workspace`]}),b&&(0,S.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:C}),D&&(0,S.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:D}),k&&(0,S.jsxs)(`p`,{role:`status`,className:`text-sm`,children:[`Imported `,k.label||k.name,`.`]})]})}export{x as a,b as i,T as n,C as r,E as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{_t as r}from"./react-BHzhHVTZ.js";import{g as i}from"./chunk-62JRHF6Z-vspAGgtK.js";import{Bn as a,Hn as o,It as s,Pt as c,X as l,at as u,ht as d,qn as f,rt as p,yr as m}from"./ui-CDoK3F3U.js";import{t as h}from"./button-SeUZ_Pvi.js";import{t as g}from"./input-BOtCd4HP.js";import{t as _}from"./api-CA6WiiYM.js";import{n as v}from"./use-toast-BlLDqSUO.js";import{Gt as y,Kt as b,Nt as x,_n as S,bt as C,i as w,on as T,pt as E,sn as D,t as O,v as ee}from"./workspace-BJELPCNs.js";import{a as k,c as A,i as j,l as M,n as N,o as P,r as F,s as I,t as L}from"./alert-dialog-CFeuDt0T.js";import{t as R}from"./use-mobile-Db-vWu9Y.js";import"./layer-style-Byl5LNFR.js";import{i as z,r as te,t as B}from"./color-DFEH4BfK.js";import{t as V}from"./workspace-access-C9nZlBBZ.js";import{i as ne}from"./use-menu-DIP1zh7I.js";import{r as re}from"./last-path-BbXWC3b3.js";import{Dt as H,Et as ie,Ft as U,Mt as ae,Nt as oe,Ot as se,Pt as W,Tt as ce,jt as G,kt as le,mt as K,wt as ue}from"./index-AELn_vht.js";import{n as de}from"./page-header-DrDt1sQ2.js";import{t as q}from"./form-panel-3p-ncEVK.js";import{t as fe}from"./use-create-panel-DhSNIGtr.js";import{n as pe,t as me}from"./useSocketSubscription-ifW-vnlb.js";import{a as he,i as ge,n as _e,r as ve,t as ye}from"./workspace-import-form-Bb6z42nw.js";var J=e(n(),1),Y=t();function be({workspace:e,onStart:t,onStop:n,onEnter:r,onEdit:i,onSettings:a,onDestroy:o}){let[c,f]=(0,J.useState)(!1),g=e.status===`active`,_=e.type===`universe`||e.name===`universe`,v=e.status===`error`,y=e.status===`not_found`,b=e.isShared===!0||e.type===`shared`,x=e.ownerEmail||e.owner,S=typeof e.sharedVia==`object`&&e.sharedVia?e.sharedVia:null,C=S?.permissions||[],w=C.includes(`admin`)?`admin`:C.includes(`write`)?`read/write`:`read-only`,T=S?.type===`group`?`via group ${S.principal}`:S?.type===`user`?`shared with you`:``,E=e.origin===`remote`,D=e.status===`offline`,O=z(e.color),ee=O?``:`border-border`,R=O?{borderLeftColor:O,borderLeftWidth:`4px`}:{borderLeftWidth:`4px`};return(0,Y.jsx)(Y.Fragment,{children:(0,Y.jsxs)(G,{className:`relative ${ee}`,style:R,children:[(0,Y.jsx)(W,{children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 basis-40`,children:[(0,Y.jsx)(U,{className:`truncate`,children:e.label||e.name}),(0,Y.jsx)(oe,{children:b?`Shared from ${x}`:e.description||``})]}),(0,Y.jsxs)(`div`,{className:`flex w-full shrink-0 flex-wrap items-center gap-2 sm:w-auto`,children:[g?(0,Y.jsx)(h,{variant:`outline`,size:`icon`,onClick:()=>n(K(e)),title:`Stop Workspace`,disabled:v||y,children:(0,Y.jsx)(p,{className:`h-4 w-4`})}):(0,Y.jsx)(h,{variant:`outline`,size:`icon`,onClick:()=>t(K(e)),title:D?`Remote unreachable${e.statusMessage?`: ${e.statusMessage}`:``}`:`Start Workspace`,disabled:v||y||D,children:(0,Y.jsx)(s,{className:`h-4 w-4`})}),g&&(0,Y.jsx)(h,{variant:`outline`,size:`icon`,onClick:()=>r(K(e)),title:`Enter Workspace`,disabled:v||y,children:(0,Y.jsx)(m,{className:`h-4 w-4`})}),a&&(0,Y.jsx)(h,{variant:`outline`,size:`icon`,onClick:()=>a(e),title:V(e)?`Workspace settings`:`Workspace settings require admin access`,"aria-label":`Workspace settings`,disabled:y||!V(e),children:(0,Y.jsx)(d,{className:`h-4 w-4`})}),i&&!_&&!b&&(0,Y.jsx)(h,{variant:`outline`,size:`icon`,onClick:()=>i(e),title:`Edit Workspace`,disabled:v||y,children:(0,Y.jsx)(u,{className:`h-4 w-4`})}),o&&!_&&!b&&(0,Y.jsxs)(L,{open:c,onOpenChange:f,children:[(0,Y.jsx)(M,{asChild:!0,children:(0,Y.jsx)(h,{variant:`outline`,size:`icon`,title:E?`Remove remote workspace reference`:`Delete Workspace`,disabled:g&&!E,className:`text-destructive hover:text-destructive hover:bg-destructive/10`,children:(0,Y.jsx)(l,{className:`h-4 w-4`})})}),(0,Y.jsxs)(j,{children:[(0,Y.jsxs)(I,{children:[(0,Y.jsx)(A,{children:E?`Remove remote workspace`:`Delete Workspace`}),(0,Y.jsx)(k,{children:E?(0,Y.jsxs)(Y.Fragment,{children:[`Remove the reference to "`,e.label||e.name,`" from this server?`,(0,Y.jsx)(`br`,{}),(0,Y.jsx)(`br`,{}),`The workspace itself stays untouched on `,e.remote?.url||e.host,`; only the stored share token and the local cache entry are dropped.`]}):(0,Y.jsxs)(Y.Fragment,{children:[`Are you sure you want to delete the workspace "`,e.label||e.name,`"?`,(0,Y.jsx)(`br`,{}),(0,Y.jsx)(`br`,{}),(0,Y.jsx)(`strong`,{children:`This action cannot be undone.`}),` All data associated with this workspace, including documents, contexts, and configurations will be permanently removed.`]})})]}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{children:`Cancel`}),(0,Y.jsx)(N,{onClick:()=>{o(e),f(!1)},className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:E?`Remove reference`:`Delete Workspace`})]})]})]})]})]})}),(0,Y.jsx)(ae,{children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`div`,{className:`h-3 w-3 rounded-full ${(()=>{switch(e.status){case`active`:return`bg-success`;case`inactive`:case`available`:return`bg-muted-foreground`;case`error`:case`offline`:return`bg-destructive`;case`not_found`:return`bg-muted-foreground`;default:return`bg-accent`}})()}`}),(0,Y.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:(()=>{switch(e.status){case`active`:return`Active`;case`inactive`:return`Inactive`;case`error`:return`Error`;case`not_found`:return`Not Found`;case`available`:return`Available`;case`removed`:return`Removed`;case`destroyed`:return`Destroyed`;case`offline`:return`Offline`;default:return e.status}})()}),_&&(0,Y.jsx)(`span`,{className:`ml-2 rounded-full bg-primary/10 px-2 py-1 text-xs text-primary`,children:`Universe`}),E&&(0,Y.jsxs)(`span`,{className:`ml-2 rounded-full bg-info/10 px-2 py-1 text-xs text-info`,title:e.remote?.url?`${e.remote.url} (${(e.remote.permissions||[]).join(`, `)||`no permissions`})`:void 0,children:[`Remote · `,e.host]}),b&&(0,Y.jsxs)(`span`,{className:`ml-2 rounded-full bg-info/10 px-2 py-1 text-xs text-info`,title:[T,`${w} access`].filter(Boolean).join(` · `),children:[`Shared · `,w]})]})})]})})}var X=[{value:`full`,icon:f,title:`Standard`,blurb:`Everything in one folder: your files in home/, alongside db/, data/, git/.`,tree:[`workspace.json`,`home/ ← your files`,`db/ data/ cache/ Git/`]},{value:`home`,icon:a,title:`Roaming home`,blurb:`The workspace folder IS your drive. Mount it over WebDAV and it looks like a plain home directory. Canvas keeps its files in a hidden .workspace/.`,tree:[`your files, at the top level`,`.workspace/ ← hidden, ignored`]}];function xe({value:e,onChange:t,disabled:n=!1,idPrefix:r=`workspace-layout`,compact:i=!1}){return(0,Y.jsx)(`div`,{className:i?`space-y-1.5`:`grid gap-2 sm:grid-cols-2`,children:X.map(i=>{let a=e===i.value,o=i.icon;return(0,Y.jsxs)(`button`,{id:`${r}-${i.value}`,type:`button`,role:`radio`,"aria-checked":a,disabled:n,onClick:()=>t(i.value),className:`flex w-full gap-2 rounded-md border p-2.5 text-left transition-colors disabled:opacity-50 ${a?`border-primary bg-accent/40`:`hover:bg-accent/20`}`,children:[(0,Y.jsx)(o,{className:`mt-0.5 h-4 w-4 shrink-0 ${a?`text-primary`:`text-muted-foreground`}`}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block text-xs font-medium`,children:i.title}),(0,Y.jsx)(`span`,{className:`mt-0.5 block text-[11px] leading-snug text-muted-foreground`,children:i.blurb}),(0,Y.jsx)(`span`,{className:`mt-1 block font-mono text-[10px] leading-relaxed text-muted-foreground/80`,children:i.tree.map(e=>(0,Y.jsx)(`span`,{className:`block truncate`,children:e},e))})]})]},i.value)})})}function Se(){let[e,t]=(0,J.useState)(`full`),[n,r]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{let e=!0;return _.get(`/ping`,{skipAuth:!0}).then(r=>{let i=r?.defaults?.workspaceLayout;e&&!n&&(i===`home`||i===`full`)&&t(i)}).catch(()=>{}),()=>{e=!1}},[]),[e,e=>{r(!0),t(e)}]}function Ce(){let[e,t]=(0,J.useState)([]),[n,a]=(0,J.useState)(!0),[s,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(``),[m,_]=(0,J.useState)(B()),[y,C]=(0,J.useState)(null),[w,E]=(0,J.useState)(``),[O,k]=Se(),[A,j]=(0,J.useState)(null),[M,N]=(0,J.useState)(null),[P,F]=(0,J.useState)(!1),I=le(),[L,V]=fe(),U=he(),[ae,oe]=(0,J.useState)(!1),[W,G]=(0,J.useState)(!1),[_e,X]=(0,J.useState)(!1),[Ce,De]=(0,J.useState)(!1),[Z,Q]=(0,J.useState)(null),{showToast:$}=v(),Oe=i(),ke=R(),{openM2Drawer:Ae}=ne(),je=pe();me(je,`workspace`,{"workspace:status:changed":e=>t(t=>t.map(t=>t.id===e.workspaceId?{...t,status:e.status}:t)),"workspace:created":e=>t(t=>[...t,e.workspace]),"workspace:deleted":e=>t(t=>t.filter(t=>t.id!==e.workspaceId)),"workspaces.scanned":({report:e})=>{!e.discovered.length&&!e.adopted.length&&!e.updated.length&&!e.missing.length||x().then(e=>t(H(e))).catch(()=>{})}}),(0,J.useEffect)(()=>{let e=async()=>{try{a(!0);let e=await x();t(H(e)),l(null)}catch(e){console.error(`Workspace fetch error:`,e);let t=`Failed to fetch workspaces`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to fetch workspaces`}l(t),$({title:`Error`,description:t,variant:`destructive`})}finally{a(!1)}};e();let n=()=>{e()};return window.addEventListener(`workspaces:refresh`,n),()=>{window.removeEventListener(`workspaces:refresh`,n)}},[je,$]);let Me=async e=>{if(e.preventDefault(),u.trim()){F(!0);try{let e=await ee({name:u,description:f||void 0,color:m,icon:y,label:w||u,layout:O});if(t(t=>[...t,e]),window.dispatchEvent(new CustomEvent(`workspaces:refresh`)),U.selected.size>0){try{await T(e.name);let{ok:t,failed:n}=await ge(e.name,Array.from(U.selected),U.tree);n&&$({title:`Folders`,description:`${t} folder(s) created, ${n} failed`,variant:`destructive`})}catch(e){console.error(`Default folder creation failed:`,e),$({title:`Folders`,description:`Workspace created, but default folders failed`,variant:`destructive`})}U.setSelected(new Set)}d(``),p(``),_(B()),C(null),E(``),$({title:`Success`,description:`Workspace '${e.label||e.name}' created.`}),V(!1)}catch(e){console.error(`Workspace creation error:`,e);let t=`Failed to create workspace`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to create workspace`}$({title:`Error`,description:t,variant:`destructive`})}finally{F(!1)}}},Ne=async e=>{if(e.preventDefault(),Z)try{let e={label:Z.label,description:Z.description,color:Z.color,icon:Z.icon??null};await S(Z.name,e),t(t=>t.map(t=>t.id===Z.id?{...t,...e}:t)),window.dispatchEvent(new CustomEvent(`workspaces:refresh`)),$({title:`Success`,description:`Workspace '${Z.label}' details updated.`}),Q(null)}catch(e){let t=e instanceof Error?e.message:`Failed to update workspace`;$({title:`Error`,description:t,variant:`destructive`})}},Pe=e=>{Q(e)},Fe=async e=>{try{await b(e.name),t(t=>t.filter(t=>t.id!==e.id)),$({title:`Success`,description:`Workspace '${e.label||e.name}' has been destroyed.`})}catch(e){let t=e instanceof Error?e.message:`Failed to destroy workspace`;$({title:`Error`,description:t,variant:`destructive`})}},Ie=async e=>{try{let n=await T(e);t(e=>e.map(e=>e.id===n.id?{...e,...n}:e)),$({title:`Success`,description:`Workspace '${n.label||n.name}' started.`}),window.dispatchEvent(new CustomEvent(`workspaces:refresh`))}catch(e){console.error(`Workspace start error:`,e);let t=`Failed to start workspace`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to start workspace`}$({title:`Error`,description:t,variant:`destructive`})}},Le=async e=>{try{let n=await D(e);t(e=>e.map(e=>e.id===n.id?{...e,...n}:e)),$({title:`Success`,description:`Workspace '${n.label||n.name}' stopped.`}),window.dispatchEvent(new CustomEvent(`workspaces:refresh`))}catch(e){console.error(`Workspace stop error:`,e);let t=`Failed to stop workspace`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to stop workspace`}$({title:`Error`,description:t,variant:`destructive`})}},Re=e=>{Oe(re(e))},{rowProps:ze,handleProps:Be,draggingIndex:Ve,insertLineClass:He}=se((n,r)=>{let i=ce(e,n,r);t(i),ie(i,(e,t)=>S(K(e),{order:t})).then(({failed:e})=>{window.dispatchEvent(new CustomEvent(`workspaces:refresh`)),e&&$({title:`Partial reorder`,description:`${e} workspace(s) could not be reordered`,variant:`destructive`})})});return(0,Y.jsxs)(`div`,{className:`space-y-6`,children:[(0,Y.jsx)(de,{title:`Workspaces`,description:`Divide your Universe into self-contained workspaces`,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(h,{variant:`outline`,onClick:()=>oe(e=>!e),className:`max-sm:hidden`,children:`Open shared Workspace (local)…`}),(0,Y.jsx)(h,{variant:`outline`,onClick:()=>X(e=>!e),children:`Import workspace`}),(0,Y.jsx)(h,{variant:`outline`,onClick:()=>G(e=>!e),className:`max-sm:hidden`,children:`Import remote…`}),(0,Y.jsx)(h,{variant:`outline`,onClick:()=>De(e=>!e),className:`max-sm:hidden`,children:`Open remote…`}),!I.local&&!L&&(0,Y.jsxs)(h,{onClick:()=>V(!0),className:`max-sm:h-9 max-sm:w-9 max-sm:p-0`,"aria-label":`Create workspace`,title:`Create workspace`,children:[(0,Y.jsx)(c,{className:`h-4 w-4 sm:mr-2`}),(0,Y.jsx)(`span`,{className:`max-sm:hidden`,children:`Create Workspace`})]})]})}),!I.local&&L&&(0,Y.jsx)(q,{title:`Create New Workspace`,onClose:()=>V(!1),children:(0,Y.jsxs)(`form`,{onSubmit:Me,className:`space-y-4`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Y.jsx)(g,{value:u,onChange:e=>d(e.target.value),placeholder:`Workspace Name (e.g., 'my-project')`,disabled:P}),(0,Y.jsx)(g,{value:w,onChange:e=>E(e.target.value),placeholder:`Workspace Label (display name, optional)`,disabled:P})]}),(0,Y.jsx)(g,{value:f,onChange:e=>p(e.target.value),placeholder:`Description (optional)`,disabled:P}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`label`,{htmlFor:`workspace-color`,className:`text-sm font-medium`,children:`Icon & Color`}),(0,Y.jsx)(`button`,{type:`button`,title:`Pick icon & color`,disabled:P,onClick:e=>j({x:Math.min(e.clientX,window.innerWidth-290),y:Math.min(e.clientY,window.innerHeight-360)}),className:`flex h-10 w-10 items-center justify-center rounded-md border hover:bg-accent`,children:(0,Y.jsx)(r,{icon:y||`ph:stack-fill`,width:22,height:22,color:z(m)})}),(0,Y.jsx)(g,{id:`workspace-color`,type:`color`,value:m,onChange:e=>_(e.target.value),className:`h-10 w-16 p-1`,disabled:P}),(0,Y.jsx)(h,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>_(B()),disabled:P,children:`Randomize`})]}),A&&(0,Y.jsx)(ue,{x:A.x,y:A.y,current:{icon:y??void 0,color:m},onChange:e=>{`icon`in e&&C(e.icon??null),`color`in e&&e.color&&_(e.color)},onClose:()=>j(null)}),(0,Y.jsxs)(`div`,{className:`rounded-lg border p-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium`,children:`Folder structure`}),(0,Y.jsx)(`p`,{className:`mb-3 mt-0.5 text-xs text-muted-foreground`,children:`How the workspace directory is laid out on disk. Fixed once created.`}),(0,Y.jsx)(xe,{value:O,onChange:k,disabled:P,idPrefix:`create-workspace-layout`})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg border p-3`,children:[(0,Y.jsxs)(`p`,{className:`text-sm font-medium`,children:[`Default folders `,(0,Y.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`(optional)`})]}),(0,Y.jsx)(`p`,{className:`mb-3 mt-0.5 text-xs text-muted-foreground`,children:`Ticked folders are created right after the workspace, with matching icons and colors.`}),(0,Y.jsx)(ve,{selected:U.selected,onToggle:U.toggle,tree:U.tree,onTreeChange:U.setTree,disabled:P,idPrefix:`create-default-folders`})]}),(0,Y.jsxs)(h,{type:`submit`,disabled:P||!u.trim(),children:[(0,Y.jsx)(c,{className:`mr-2 h-4 w-4`}),`Create Workspace`]})]})}),ae&&(0,Y.jsx)(Te,{}),Ce&&(0,Y.jsx)(Ee,{onClose:()=>De(!1),onChanged:async()=>{try{t(H(await x()))}catch{}window.dispatchEvent(new CustomEvent(`workspaces:refresh`))}}),_e&&(0,Y.jsx)(q,{title:`Import workspace`,onClose:()=>X(!1),children:(0,Y.jsx)(ye,{onImported:()=>X(!1)})}),W&&(0,Y.jsx)(we,{onImported:e=>{t(t=>t.some(t=>t.id===e.id)?t:[...t,e]),window.dispatchEvent(new CustomEvent(`workspaces:refresh`)),G(!1)},onClose:()=>G(!1)}),(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Your Workspaces`}),n&&(0,Y.jsx)(`p`,{className:`text-center text-muted-foreground`,children:`Loading workspaces...`}),s&&(0,Y.jsx)(`div`,{className:`text-center text-destructive`,children:(0,Y.jsx)(`p`,{children:s})}),!n&&!s&&e.length===0&&(0,Y.jsx)(`p`,{className:`text-center text-muted-foreground`,children:`No workspaces found`}),e.length>0&&(0,Y.jsx)(`div`,{className:`grid gap-4`,children:e.map((t,n)=>{let r={...t,createdAt:t.createdAt,updatedAt:t.updatedAt,color:t.color===null?void 0:t.color},i=z(t.color);return(0,Y.jsxs)(`div`,{...ze(n),className:`flex items-stretch rounded-lg ${He(n,e.length)||``} ${Ve===n?`opacity-60`:``}`,children:[(0,Y.jsx)(`button`,{type:`button`,...Be(n),title:`Drag to reorder`,"aria-label":`Drag to reorder`,className:`hidden w-5 shrink-0 cursor-grab items-center justify-center rounded-l-lg active:cursor-grabbing md:flex ${i?``:`bg-muted`}`,style:i?{backgroundColor:i}:void 0,children:(0,Y.jsx)(o,{className:`h-4 w-4 ${te(i)}`})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsx)(be,{workspace:r,onStart:Ie,onStop:Le,onEnter:Re,onEdit:Pe,onSettings:e=>{ke?Ae(`workspaces`,`settings`,K(e)):Oe(`/workspaces/${K(e)}/settings/general`)},onDestroy:Fe})})]},t.id)})})]}),Z&&(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`h2`,{className:`text-xl font-semibold`,children:[`Edit Workspace: `,Z.label]}),(0,Y.jsxs)(`form`,{onSubmit:Ne,className:`space-y-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{htmlFor:`edit-label`,className:`text-sm font-medium`,children:`Label`}),(0,Y.jsx)(g,{id:`edit-label`,value:Z.label,onChange:e=>Q(t=>t?{...t,label:e.target.value}:null),placeholder:`Workspace Label`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{htmlFor:`edit-description`,className:`text-sm font-medium`,children:`Description`}),(0,Y.jsx)(g,{id:`edit-description`,value:Z.description||``,onChange:e=>Q(t=>t?{...t,description:e.target.value}:null),placeholder:`Description (optional)`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{htmlFor:`edit-color`,className:`text-sm font-medium`,children:`Icon & Color`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`button`,{type:`button`,title:`Pick icon & color`,onClick:e=>N({x:Math.min(e.clientX,window.innerWidth-290),y:Math.min(e.clientY,window.innerHeight-360)}),className:`flex h-10 w-10 items-center justify-center rounded-md border hover:bg-accent`,children:(0,Y.jsx)(r,{icon:Z.icon||`ph:stack-fill`,width:22,height:22,color:z(Z.color)})}),(0,Y.jsx)(g,{id:`edit-workspace-color`,type:`color`,value:Z.color||`#FFFFFF`,onChange:e=>Q(t=>t?{...t,color:e.target.value}:null),className:`h-10 w-16 p-1`}),(0,Y.jsx)(h,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>Q(e=>e?{...e,color:B()}:null),children:`Randomize Color`})]})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(h,{type:`submit`,disabled:!Z.label?.trim(),children:`Save Changes`}),(0,Y.jsx)(h,{type:`button`,variant:`outline`,onClick:()=>Q(null),children:`Cancel`})]})]}),M&&(0,Y.jsx)(ue,{x:M.x,y:M.y,current:{icon:Z.icon??void 0,color:Z.color??void 0},onChange:e=>{Q(t=>{if(!t)return null;let n={...t};return`icon`in e&&(n.icon=e.icon??null),`color`in e&&e.color&&(n.color=e.color),n})},onClose:()=>N(null)})]})]})}function we({onImported:e,onClose:t}){let{showToast:n}=v(),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(``);return(0,Y.jsx)(q,{title:`Import (pull) a remote Workspace`,onClose:t,children:(0,Y.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault();let i;try{i=new URL(r.trim()).origin}catch{n({title:`Error`,description:`Invalid server URL`,variant:`destructive`});return}if(!a.trim().startsWith(`canvas-`)){n({title:`Error`,description:`Invalid access token (expected canvas-...)`,variant:`destructive`});return}f(!0),m(`Starting…`);try{let t=await E(i,a.trim(),e=>{m(O[e.phase]||e.phase)},{name:s.trim(),label:l.trim()});n({title:`Success`,description:`Workspace '${t.label||t.name}' imported from ${i}.`}),e(t)}catch(e){let t=e,r=t?.message||t?.payload?.message||`Failed to import remote workspace`;n({title:`Error`,description:r,variant:`destructive`})}finally{f(!1),m(``)}},className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-3`,children:[(0,Y.jsx)(g,{placeholder:`Server URL (e.g., https://my.canvas-server.tld)`,value:r,onChange:e=>i(e.target.value),disabled:d}),(0,Y.jsx)(g,{placeholder:`Workspace share token (canvas-...)`,value:a,onChange:e=>o(e.target.value),disabled:d}),(0,Y.jsx)(h,{type:`submit`,disabled:d||!r.trim()||!a.trim()||!s.trim()||!l.trim(),children:d?`Importing…`:`Import Workspace`})]}),(0,Y.jsx)(_e,{name:s,label:l,setName:c,setLabel:u,disabled:d}),d&&p&&(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:p}),(0,Y.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Pulls a full `,(0,Y.jsx)(`strong`,{children:`copy`}),` of the workspace from the remote canvas-server into this one, where it then lives independently. The remote workspace is stopped while it is packed, and large workspaces can take several minutes — progress is shown above.`]})]})})}function Te(){let{showToast:e}=v(),[t,n]=(0,J.useState)(``),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(!1),s=e=>{try{return new URL(e)}catch{return null}};return(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Open shared Workspace (local)`}),(0,Y.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-3`,children:[(0,Y.jsx)(g,{placeholder:`Shared URL (e.g., https://host/rest/v2/pub/workspaces/ID)`,value:t,onChange:e=>n(e.target.value)}),(0,Y.jsx)(g,{placeholder:`Access token (canvas-...)`,value:r,onChange:e=>i(e.target.value)}),(0,Y.jsx)(h,{onClick:async()=>{if(!s(t.trim())){e({title:`Error`,description:`Invalid URL`,variant:`destructive`});return}if(!r.trim().startsWith(`canvas-`)){e({title:`Error`,description:`Invalid access token`,variant:`destructive`});return}o(!0);try{sessionStorage.setItem(`sharedToken:last`,r.trim());let e=new URLSearchParams({url:t.trim()}).toString();window.location.href=`/shared?${e}`}catch(t){e({title:`Error`,description:t instanceof Error?t.message:`Failed to open shared resource`,variant:`destructive`})}finally{o(!1)}},disabled:a||!t.trim()||!r.trim(),children:`Open`})]}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`We use your provided URL and token to fetch via the remote's public API.`})]})}function Ee({onClose:e,onChanged:t}){let{showToast:n}=v(),r=i(),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)([]),p=(0,J.useCallback)(async()=>{try{f(await C())}catch{f([])}},[]);(0,J.useEffect)(()=>{p()},[p]);let m=async e=>{e.preventDefault();let r;try{r=new URL(a.trim()).origin}catch{n({title:`Error`,description:`Invalid server URL`,variant:`destructive`});return}u(!0);try{let e=await w(r,s.trim());n({title:`Remote workspace added`,description:`'${e.label}' is available as ${e.address}.`}),o(``),c(``),await p(),t?.()}catch(e){let t=e;n({title:`Error`,description:t?.message||t?.payload?.message||`Failed to add remote workspace`,variant:`destructive`})}finally{u(!1)}},_=async e=>{try{await y(e.id),await p(),t?.()}catch(e){n({title:`Error`,description:e instanceof Error?e.message:`Failed to remove remote workspace`,variant:`destructive`})}};return(0,Y.jsxs)(q,{title:`Open a remote Workspace`,onClose:e,children:[(0,Y.jsxs)(`form`,{onSubmit:m,className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-3`,children:[(0,Y.jsx)(g,{placeholder:`Server URL (e.g., https://my.canvas-server.tld)`,value:a,onChange:e=>o(e.target.value),disabled:l}),(0,Y.jsx)(g,{placeholder:`Workspace share token (canvas-...)`,value:s,onChange:e=>c(e.target.value),disabled:l}),(0,Y.jsx)(h,{type:`submit`,disabled:l||!a.trim()||!s.trim(),children:l?`Checking…`:`Add Remote`})]}),(0,Y.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Keeps the workspace on its own server and registers it here as`,` `,(0,Y.jsx)(`code`,{className:`font-mono text-xs`,children:`name@host`}),` — nothing is copied. Every call you make to it is forwarded to the remote with the share token (its permissions apply); document content and thumbnails are cached locally so they stay readable when the remote is offline. Use “Import remote…” if you want an independent local copy instead.`]})]}),d.length>0&&(0,Y.jsx)(`ul`,{className:`mt-4 space-y-2 border-t pt-3`,children:d.map(e=>(0,Y.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-md border p-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`truncate text-sm font-medium`,children:[e.label,(0,Y.jsx)(`span`,{className:`ml-2 rounded bg-muted px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted-foreground`,children:`remote`})]}),(0,Y.jsxs)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-muted-foreground`,children:[e.address,` · `,e.remote.url]})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Y.jsx)(h,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>r(`/workspaces/${e.address}`),children:`Open`}),(0,Y.jsx)(h,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>_(e),className:`text-destructive hover:text-destructive`,children:`Remove`})]})]},e.id))})]})}export{Ce as default};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{_t as r}from"./react-BHzhHVTZ.js";import{g as i}from"./chunk-62JRHF6Z-vspAGgtK.js";import{Bn as a,Hn as o,It as s,Pt as c,X as l,at as u,ht as d,qn as f,rt as p,yr as m}from"./ui-CDoK3F3U.js";import{t as h}from"./button-SeUZ_Pvi.js";import{t as g}from"./input-BOtCd4HP.js";import{t as _}from"./api-CA6WiiYM.js";import{n as v}from"./use-toast-BlLDqSUO.js";import{Gt as y,Kt as b,Nt as x,_n as S,bt as C,i as w,on as T,pt as E,sn as D,t as O,v as ee}from"./workspace-cv6Hrfhh.js";import{a as k,c as A,i as j,l as M,n as N,o as P,r as F,s as I,t as L}from"./alert-dialog-CFeuDt0T.js";import{t as R}from"./use-mobile-Db-vWu9Y.js";import"./layer-style-Byl5LNFR.js";import{i as z,r as te,t as B}from"./color-DFEH4BfK.js";import{t as V}from"./workspace-access-C9nZlBBZ.js";import{i as ne}from"./use-menu-DIP1zh7I.js";import{r as re}from"./last-path-BbXWC3b3.js";import{Dt as H,Et as ie,Ft as U,Mt as ae,Nt as oe,Ot as se,Pt as W,Tt as ce,jt as G,kt as le,mt as K,wt as ue}from"./index-CXPA9Fj8.js";import{n as de}from"./page-header-DrDt1sQ2.js";import{t as q}from"./form-panel-3p-ncEVK.js";import{t as fe}from"./use-create-panel-DhSNIGtr.js";import{n as pe,t as me}from"./useSocketSubscription-ifW-vnlb.js";import{a as he,i as ge,n as _e,r as ve,t as ye}from"./workspace-import-form-D5qPcNFq.js";var J=e(n(),1),Y=t();function be({workspace:e,onStart:t,onStop:n,onEnter:r,onEdit:i,onSettings:a,onDestroy:o}){let[c,f]=(0,J.useState)(!1),g=e.status===`active`,_=e.type===`universe`||e.name===`universe`,v=e.status===`error`,y=e.status===`not_found`,b=e.isShared===!0||e.type===`shared`,x=e.ownerEmail||e.owner,S=typeof e.sharedVia==`object`&&e.sharedVia?e.sharedVia:null,C=S?.permissions||[],w=C.includes(`admin`)?`admin`:C.includes(`write`)?`read/write`:`read-only`,T=S?.type===`group`?`via group ${S.principal}`:S?.type===`user`?`shared with you`:``,E=e.origin===`remote`,D=e.status===`offline`,O=z(e.color),ee=O?``:`border-border`,R=O?{borderLeftColor:O,borderLeftWidth:`4px`}:{borderLeftWidth:`4px`};return(0,Y.jsx)(Y.Fragment,{children:(0,Y.jsxs)(G,{className:`relative ${ee}`,style:R,children:[(0,Y.jsx)(W,{children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 basis-40`,children:[(0,Y.jsx)(U,{className:`truncate`,children:e.label||e.name}),(0,Y.jsx)(oe,{children:b?`Shared from ${x}`:e.description||``})]}),(0,Y.jsxs)(`div`,{className:`flex w-full shrink-0 flex-wrap items-center gap-2 sm:w-auto`,children:[g?(0,Y.jsx)(h,{variant:`outline`,size:`icon`,onClick:()=>n(K(e)),title:`Stop Workspace`,disabled:v||y,children:(0,Y.jsx)(p,{className:`h-4 w-4`})}):(0,Y.jsx)(h,{variant:`outline`,size:`icon`,onClick:()=>t(K(e)),title:D?`Remote unreachable${e.statusMessage?`: ${e.statusMessage}`:``}`:`Start Workspace`,disabled:v||y||D,children:(0,Y.jsx)(s,{className:`h-4 w-4`})}),g&&(0,Y.jsx)(h,{variant:`outline`,size:`icon`,onClick:()=>r(K(e)),title:`Enter Workspace`,disabled:v||y,children:(0,Y.jsx)(m,{className:`h-4 w-4`})}),a&&(0,Y.jsx)(h,{variant:`outline`,size:`icon`,onClick:()=>a(e),title:V(e)?`Workspace settings`:`Workspace settings require admin access`,"aria-label":`Workspace settings`,disabled:y||!V(e),children:(0,Y.jsx)(d,{className:`h-4 w-4`})}),i&&!_&&!b&&(0,Y.jsx)(h,{variant:`outline`,size:`icon`,onClick:()=>i(e),title:`Edit Workspace`,disabled:v||y,children:(0,Y.jsx)(u,{className:`h-4 w-4`})}),o&&!_&&!b&&(0,Y.jsxs)(L,{open:c,onOpenChange:f,children:[(0,Y.jsx)(M,{asChild:!0,children:(0,Y.jsx)(h,{variant:`outline`,size:`icon`,title:E?`Remove remote workspace reference`:`Delete Workspace`,disabled:g&&!E,className:`text-destructive hover:text-destructive hover:bg-destructive/10`,children:(0,Y.jsx)(l,{className:`h-4 w-4`})})}),(0,Y.jsxs)(j,{children:[(0,Y.jsxs)(I,{children:[(0,Y.jsx)(A,{children:E?`Remove remote workspace`:`Delete Workspace`}),(0,Y.jsx)(k,{children:E?(0,Y.jsxs)(Y.Fragment,{children:[`Remove the reference to "`,e.label||e.name,`" from this server?`,(0,Y.jsx)(`br`,{}),(0,Y.jsx)(`br`,{}),`The workspace itself stays untouched on `,e.remote?.url||e.host,`; only the stored share token and the local cache entry are dropped.`]}):(0,Y.jsxs)(Y.Fragment,{children:[`Are you sure you want to delete the workspace "`,e.label||e.name,`"?`,(0,Y.jsx)(`br`,{}),(0,Y.jsx)(`br`,{}),(0,Y.jsx)(`strong`,{children:`This action cannot be undone.`}),` All data associated with this workspace, including documents, contexts, and configurations will be permanently removed.`]})})]}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{children:`Cancel`}),(0,Y.jsx)(N,{onClick:()=>{o(e),f(!1)},className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:E?`Remove reference`:`Delete Workspace`})]})]})]})]})]})}),(0,Y.jsx)(ae,{children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`div`,{className:`h-3 w-3 rounded-full ${(()=>{switch(e.status){case`active`:return`bg-success`;case`inactive`:case`available`:return`bg-muted-foreground`;case`error`:case`offline`:return`bg-destructive`;case`not_found`:return`bg-muted-foreground`;default:return`bg-accent`}})()}`}),(0,Y.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:(()=>{switch(e.status){case`active`:return`Active`;case`inactive`:return`Inactive`;case`error`:return`Error`;case`not_found`:return`Not Found`;case`available`:return`Available`;case`removed`:return`Removed`;case`destroyed`:return`Destroyed`;case`offline`:return`Offline`;default:return e.status}})()}),_&&(0,Y.jsx)(`span`,{className:`ml-2 rounded-full bg-primary/10 px-2 py-1 text-xs text-primary`,children:`Universe`}),E&&(0,Y.jsxs)(`span`,{className:`ml-2 rounded-full bg-info/10 px-2 py-1 text-xs text-info`,title:e.remote?.url?`${e.remote.url} (${(e.remote.permissions||[]).join(`, `)||`no permissions`})`:void 0,children:[`Remote · `,e.host]}),b&&(0,Y.jsxs)(`span`,{className:`ml-2 rounded-full bg-info/10 px-2 py-1 text-xs text-info`,title:[T,`${w} access`].filter(Boolean).join(` · `),children:[`Shared · `,w]})]})})]})})}var X=[{value:`full`,icon:f,title:`Standard`,blurb:`Everything in one folder: your files in home/, alongside db/, data/, git/.`,tree:[`workspace.json`,`home/ ← your files`,`db/ data/ cache/ Git/`]},{value:`home`,icon:a,title:`Roaming home`,blurb:`The workspace folder IS your drive. Mount it over WebDAV and it looks like a plain home directory. Canvas keeps its files in a hidden .workspace/.`,tree:[`your files, at the top level`,`.workspace/ ← hidden, ignored`]}];function xe({value:e,onChange:t,disabled:n=!1,idPrefix:r=`workspace-layout`,compact:i=!1}){return(0,Y.jsx)(`div`,{className:i?`space-y-1.5`:`grid gap-2 sm:grid-cols-2`,children:X.map(i=>{let a=e===i.value,o=i.icon;return(0,Y.jsxs)(`button`,{id:`${r}-${i.value}`,type:`button`,role:`radio`,"aria-checked":a,disabled:n,onClick:()=>t(i.value),className:`flex w-full gap-2 rounded-md border p-2.5 text-left transition-colors disabled:opacity-50 ${a?`border-primary bg-accent/40`:`hover:bg-accent/20`}`,children:[(0,Y.jsx)(o,{className:`mt-0.5 h-4 w-4 shrink-0 ${a?`text-primary`:`text-muted-foreground`}`}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block text-xs font-medium`,children:i.title}),(0,Y.jsx)(`span`,{className:`mt-0.5 block text-[11px] leading-snug text-muted-foreground`,children:i.blurb}),(0,Y.jsx)(`span`,{className:`mt-1 block font-mono text-[10px] leading-relaxed text-muted-foreground/80`,children:i.tree.map(e=>(0,Y.jsx)(`span`,{className:`block truncate`,children:e},e))})]})]},i.value)})})}function Se(){let[e,t]=(0,J.useState)(`full`),[n,r]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{let e=!0;return _.get(`/ping`,{skipAuth:!0}).then(r=>{let i=r?.defaults?.workspaceLayout;e&&!n&&(i===`home`||i===`full`)&&t(i)}).catch(()=>{}),()=>{e=!1}},[]),[e,e=>{r(!0),t(e)}]}function Ce(){let[e,t]=(0,J.useState)([]),[n,a]=(0,J.useState)(!0),[s,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(``),[m,_]=(0,J.useState)(B()),[y,C]=(0,J.useState)(null),[w,E]=(0,J.useState)(``),[O,k]=Se(),[A,j]=(0,J.useState)(null),[M,N]=(0,J.useState)(null),[P,F]=(0,J.useState)(!1),I=le(),[L,V]=fe(),U=he(),[ae,oe]=(0,J.useState)(!1),[W,G]=(0,J.useState)(!1),[_e,X]=(0,J.useState)(!1),[Ce,De]=(0,J.useState)(!1),[Z,Q]=(0,J.useState)(null),{showToast:$}=v(),Oe=i(),ke=R(),{openM2Drawer:Ae}=ne(),je=pe();me(je,`workspace`,{"workspace:status:changed":e=>t(t=>t.map(t=>t.id===e.workspaceId?{...t,status:e.status}:t)),"workspace:created":e=>t(t=>[...t,e.workspace]),"workspace:deleted":e=>t(t=>t.filter(t=>t.id!==e.workspaceId)),"workspaces.scanned":({report:e})=>{!e.discovered.length&&!e.adopted.length&&!e.updated.length&&!e.missing.length||x().then(e=>t(H(e))).catch(()=>{})}}),(0,J.useEffect)(()=>{let e=async()=>{try{a(!0);let e=await x();t(H(e)),l(null)}catch(e){console.error(`Workspace fetch error:`,e);let t=`Failed to fetch workspaces`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to fetch workspaces`}l(t),$({title:`Error`,description:t,variant:`destructive`})}finally{a(!1)}};e();let n=()=>{e()};return window.addEventListener(`workspaces:refresh`,n),()=>{window.removeEventListener(`workspaces:refresh`,n)}},[je,$]);let Me=async e=>{if(e.preventDefault(),u.trim()){F(!0);try{let e=await ee({name:u,description:f||void 0,color:m,icon:y,label:w||u,layout:O});if(t(t=>[...t,e]),window.dispatchEvent(new CustomEvent(`workspaces:refresh`)),U.selected.size>0){try{await T(e.name);let{ok:t,failed:n}=await ge(e.name,Array.from(U.selected),U.tree);n&&$({title:`Folders`,description:`${t} folder(s) created, ${n} failed`,variant:`destructive`})}catch(e){console.error(`Default folder creation failed:`,e),$({title:`Folders`,description:`Workspace created, but default folders failed`,variant:`destructive`})}U.setSelected(new Set)}d(``),p(``),_(B()),C(null),E(``),$({title:`Success`,description:`Workspace '${e.label||e.name}' created.`}),V(!1)}catch(e){console.error(`Workspace creation error:`,e);let t=`Failed to create workspace`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to create workspace`}$({title:`Error`,description:t,variant:`destructive`})}finally{F(!1)}}},Ne=async e=>{if(e.preventDefault(),Z)try{let e={label:Z.label,description:Z.description,color:Z.color,icon:Z.icon??null};await S(Z.name,e),t(t=>t.map(t=>t.id===Z.id?{...t,...e}:t)),window.dispatchEvent(new CustomEvent(`workspaces:refresh`)),$({title:`Success`,description:`Workspace '${Z.label}' details updated.`}),Q(null)}catch(e){let t=e instanceof Error?e.message:`Failed to update workspace`;$({title:`Error`,description:t,variant:`destructive`})}},Pe=e=>{Q(e)},Fe=async e=>{try{await b(e.name),t(t=>t.filter(t=>t.id!==e.id)),$({title:`Success`,description:`Workspace '${e.label||e.name}' has been destroyed.`})}catch(e){let t=e instanceof Error?e.message:`Failed to destroy workspace`;$({title:`Error`,description:t,variant:`destructive`})}},Ie=async e=>{try{let n=await T(e);t(e=>e.map(e=>e.id===n.id?{...e,...n}:e)),$({title:`Success`,description:`Workspace '${n.label||n.name}' started.`}),window.dispatchEvent(new CustomEvent(`workspaces:refresh`))}catch(e){console.error(`Workspace start error:`,e);let t=`Failed to start workspace`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to start workspace`}$({title:`Error`,description:t,variant:`destructive`})}},Le=async e=>{try{let n=await D(e);t(e=>e.map(e=>e.id===n.id?{...e,...n}:e)),$({title:`Success`,description:`Workspace '${n.label||n.name}' stopped.`}),window.dispatchEvent(new CustomEvent(`workspaces:refresh`))}catch(e){console.error(`Workspace stop error:`,e);let t=`Failed to stop workspace`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to stop workspace`}$({title:`Error`,description:t,variant:`destructive`})}},Re=e=>{Oe(re(e))},{rowProps:ze,handleProps:Be,draggingIndex:Ve,insertLineClass:He}=se((n,r)=>{let i=ce(e,n,r);t(i),ie(i,(e,t)=>S(K(e),{order:t})).then(({failed:e})=>{window.dispatchEvent(new CustomEvent(`workspaces:refresh`)),e&&$({title:`Partial reorder`,description:`${e} workspace(s) could not be reordered`,variant:`destructive`})})});return(0,Y.jsxs)(`div`,{className:`space-y-6`,children:[(0,Y.jsx)(de,{title:`Workspaces`,description:`Divide your Universe into self-contained workspaces`,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(h,{variant:`outline`,onClick:()=>oe(e=>!e),className:`max-sm:hidden`,children:`Open shared Workspace (local)…`}),(0,Y.jsx)(h,{variant:`outline`,onClick:()=>X(e=>!e),children:`Import workspace`}),(0,Y.jsx)(h,{variant:`outline`,onClick:()=>G(e=>!e),className:`max-sm:hidden`,children:`Import remote…`}),(0,Y.jsx)(h,{variant:`outline`,onClick:()=>De(e=>!e),className:`max-sm:hidden`,children:`Open remote…`}),!I.local&&!L&&(0,Y.jsxs)(h,{onClick:()=>V(!0),className:`max-sm:h-9 max-sm:w-9 max-sm:p-0`,"aria-label":`Create workspace`,title:`Create workspace`,children:[(0,Y.jsx)(c,{className:`h-4 w-4 sm:mr-2`}),(0,Y.jsx)(`span`,{className:`max-sm:hidden`,children:`Create Workspace`})]})]})}),!I.local&&L&&(0,Y.jsx)(q,{title:`Create New Workspace`,onClose:()=>V(!1),children:(0,Y.jsxs)(`form`,{onSubmit:Me,className:`space-y-4`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Y.jsx)(g,{value:u,onChange:e=>d(e.target.value),placeholder:`Workspace Name (e.g., 'my-project')`,disabled:P}),(0,Y.jsx)(g,{value:w,onChange:e=>E(e.target.value),placeholder:`Workspace Label (display name, optional)`,disabled:P})]}),(0,Y.jsx)(g,{value:f,onChange:e=>p(e.target.value),placeholder:`Description (optional)`,disabled:P}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`label`,{htmlFor:`workspace-color`,className:`text-sm font-medium`,children:`Icon & Color`}),(0,Y.jsx)(`button`,{type:`button`,title:`Pick icon & color`,disabled:P,onClick:e=>j({x:Math.min(e.clientX,window.innerWidth-290),y:Math.min(e.clientY,window.innerHeight-360)}),className:`flex h-10 w-10 items-center justify-center rounded-md border hover:bg-accent`,children:(0,Y.jsx)(r,{icon:y||`ph:stack-fill`,width:22,height:22,color:z(m)})}),(0,Y.jsx)(g,{id:`workspace-color`,type:`color`,value:m,onChange:e=>_(e.target.value),className:`h-10 w-16 p-1`,disabled:P}),(0,Y.jsx)(h,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>_(B()),disabled:P,children:`Randomize`})]}),A&&(0,Y.jsx)(ue,{x:A.x,y:A.y,current:{icon:y??void 0,color:m},onChange:e=>{`icon`in e&&C(e.icon??null),`color`in e&&e.color&&_(e.color)},onClose:()=>j(null)}),(0,Y.jsxs)(`div`,{className:`rounded-lg border p-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium`,children:`Folder structure`}),(0,Y.jsx)(`p`,{className:`mb-3 mt-0.5 text-xs text-muted-foreground`,children:`How the workspace directory is laid out on disk. Fixed once created.`}),(0,Y.jsx)(xe,{value:O,onChange:k,disabled:P,idPrefix:`create-workspace-layout`})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg border p-3`,children:[(0,Y.jsxs)(`p`,{className:`text-sm font-medium`,children:[`Default folders `,(0,Y.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`(optional)`})]}),(0,Y.jsx)(`p`,{className:`mb-3 mt-0.5 text-xs text-muted-foreground`,children:`Ticked folders are created right after the workspace, with matching icons and colors.`}),(0,Y.jsx)(ve,{selected:U.selected,onToggle:U.toggle,tree:U.tree,onTreeChange:U.setTree,disabled:P,idPrefix:`create-default-folders`})]}),(0,Y.jsxs)(h,{type:`submit`,disabled:P||!u.trim(),children:[(0,Y.jsx)(c,{className:`mr-2 h-4 w-4`}),`Create Workspace`]})]})}),ae&&(0,Y.jsx)(Te,{}),Ce&&(0,Y.jsx)(Ee,{onClose:()=>De(!1),onChanged:async()=>{try{t(H(await x()))}catch{}window.dispatchEvent(new CustomEvent(`workspaces:refresh`))}}),_e&&(0,Y.jsx)(q,{title:`Import workspace`,onClose:()=>X(!1),children:(0,Y.jsx)(ye,{onImported:()=>X(!1)})}),W&&(0,Y.jsx)(we,{onImported:e=>{t(t=>t.some(t=>t.id===e.id)?t:[...t,e]),window.dispatchEvent(new CustomEvent(`workspaces:refresh`)),G(!1)},onClose:()=>G(!1)}),(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Your Workspaces`}),n&&(0,Y.jsx)(`p`,{className:`text-center text-muted-foreground`,children:`Loading workspaces...`}),s&&(0,Y.jsx)(`div`,{className:`text-center text-destructive`,children:(0,Y.jsx)(`p`,{children:s})}),!n&&!s&&e.length===0&&(0,Y.jsx)(`p`,{className:`text-center text-muted-foreground`,children:`No workspaces found`}),e.length>0&&(0,Y.jsx)(`div`,{className:`grid gap-4`,children:e.map((t,n)=>{let r={...t,createdAt:t.createdAt,updatedAt:t.updatedAt,color:t.color===null?void 0:t.color},i=z(t.color);return(0,Y.jsxs)(`div`,{...ze(n),className:`flex items-stretch rounded-lg ${He(n,e.length)||``} ${Ve===n?`opacity-60`:``}`,children:[(0,Y.jsx)(`button`,{type:`button`,...Be(n),title:`Drag to reorder`,"aria-label":`Drag to reorder`,className:`hidden w-5 shrink-0 cursor-grab items-center justify-center rounded-l-lg active:cursor-grabbing md:flex ${i?``:`bg-muted`}`,style:i?{backgroundColor:i}:void 0,children:(0,Y.jsx)(o,{className:`h-4 w-4 ${te(i)}`})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsx)(be,{workspace:r,onStart:Ie,onStop:Le,onEnter:Re,onEdit:Pe,onSettings:e=>{ke?Ae(`workspaces`,`settings`,K(e)):Oe(`/workspaces/${K(e)}/settings/general`)},onDestroy:Fe})})]},t.id)})})]}),Z&&(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`h2`,{className:`text-xl font-semibold`,children:[`Edit Workspace: `,Z.label]}),(0,Y.jsxs)(`form`,{onSubmit:Ne,className:`space-y-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{htmlFor:`edit-label`,className:`text-sm font-medium`,children:`Label`}),(0,Y.jsx)(g,{id:`edit-label`,value:Z.label,onChange:e=>Q(t=>t?{...t,label:e.target.value}:null),placeholder:`Workspace Label`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{htmlFor:`edit-description`,className:`text-sm font-medium`,children:`Description`}),(0,Y.jsx)(g,{id:`edit-description`,value:Z.description||``,onChange:e=>Q(t=>t?{...t,description:e.target.value}:null),placeholder:`Description (optional)`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{htmlFor:`edit-color`,className:`text-sm font-medium`,children:`Icon & Color`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`button`,{type:`button`,title:`Pick icon & color`,onClick:e=>N({x:Math.min(e.clientX,window.innerWidth-290),y:Math.min(e.clientY,window.innerHeight-360)}),className:`flex h-10 w-10 items-center justify-center rounded-md border hover:bg-accent`,children:(0,Y.jsx)(r,{icon:Z.icon||`ph:stack-fill`,width:22,height:22,color:z(Z.color)})}),(0,Y.jsx)(g,{id:`edit-workspace-color`,type:`color`,value:Z.color||`#FFFFFF`,onChange:e=>Q(t=>t?{...t,color:e.target.value}:null),className:`h-10 w-16 p-1`}),(0,Y.jsx)(h,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>Q(e=>e?{...e,color:B()}:null),children:`Randomize Color`})]})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(h,{type:`submit`,disabled:!Z.label?.trim(),children:`Save Changes`}),(0,Y.jsx)(h,{type:`button`,variant:`outline`,onClick:()=>Q(null),children:`Cancel`})]})]}),M&&(0,Y.jsx)(ue,{x:M.x,y:M.y,current:{icon:Z.icon??void 0,color:Z.color??void 0},onChange:e=>{Q(t=>{if(!t)return null;let n={...t};return`icon`in e&&(n.icon=e.icon??null),`color`in e&&e.color&&(n.color=e.color),n})},onClose:()=>N(null)})]})]})}function we({onImported:e,onClose:t}){let{showToast:n}=v(),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(``);return(0,Y.jsx)(q,{title:`Import (pull) a remote Workspace`,onClose:t,children:(0,Y.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault();let i;try{i=new URL(r.trim()).origin}catch{n({title:`Error`,description:`Invalid server URL`,variant:`destructive`});return}if(!a.trim().startsWith(`canvas-`)){n({title:`Error`,description:`Invalid access token (expected canvas-...)`,variant:`destructive`});return}f(!0),m(`Starting…`);try{let t=await E(i,a.trim(),e=>{m(O[e.phase]||e.phase)},{name:s.trim(),label:l.trim()});n({title:`Success`,description:`Workspace '${t.label||t.name}' imported from ${i}.`}),e(t)}catch(e){let t=e,r=t?.message||t?.payload?.message||`Failed to import remote workspace`;n({title:`Error`,description:r,variant:`destructive`})}finally{f(!1),m(``)}},className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-3`,children:[(0,Y.jsx)(g,{placeholder:`Server URL (e.g., https://my.canvas-server.tld)`,value:r,onChange:e=>i(e.target.value),disabled:d}),(0,Y.jsx)(g,{placeholder:`Workspace share token (canvas-...)`,value:a,onChange:e=>o(e.target.value),disabled:d}),(0,Y.jsx)(h,{type:`submit`,disabled:d||!r.trim()||!a.trim()||!s.trim()||!l.trim(),children:d?`Importing…`:`Import Workspace`})]}),(0,Y.jsx)(_e,{name:s,label:l,setName:c,setLabel:u,disabled:d}),d&&p&&(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:p}),(0,Y.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Pulls a full `,(0,Y.jsx)(`strong`,{children:`copy`}),` of the workspace from the remote canvas-server into this one, where it then lives independently. The remote workspace is stopped while it is packed, and large workspaces can take several minutes — progress is shown above.`]})]})})}function Te(){let{showToast:e}=v(),[t,n]=(0,J.useState)(``),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(!1),s=e=>{try{return new URL(e)}catch{return null}};return(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Open shared Workspace (local)`}),(0,Y.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-3`,children:[(0,Y.jsx)(g,{placeholder:`Shared URL (e.g., https://host/rest/v2/pub/workspaces/ID)`,value:t,onChange:e=>n(e.target.value)}),(0,Y.jsx)(g,{placeholder:`Access token (canvas-...)`,value:r,onChange:e=>i(e.target.value)}),(0,Y.jsx)(h,{onClick:async()=>{if(!s(t.trim())){e({title:`Error`,description:`Invalid URL`,variant:`destructive`});return}if(!r.trim().startsWith(`canvas-`)){e({title:`Error`,description:`Invalid access token`,variant:`destructive`});return}o(!0);try{sessionStorage.setItem(`sharedToken:last`,r.trim());let e=new URLSearchParams({url:t.trim()}).toString();window.location.href=`/shared?${e}`}catch(t){e({title:`Error`,description:t instanceof Error?t.message:`Failed to open shared resource`,variant:`destructive`})}finally{o(!1)}},disabled:a||!t.trim()||!r.trim(),children:`Open`})]}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`We use your provided URL and token to fetch via the remote's public API.`})]})}function Ee({onClose:e,onChanged:t}){let{showToast:n}=v(),r=i(),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)([]),p=(0,J.useCallback)(async()=>{try{f(await C())}catch{f([])}},[]);(0,J.useEffect)(()=>{p()},[p]);let m=async e=>{e.preventDefault();let r;try{r=new URL(a.trim()).origin}catch{n({title:`Error`,description:`Invalid server URL`,variant:`destructive`});return}u(!0);try{let e=await w(r,s.trim());n({title:`Remote workspace added`,description:`'${e.label}' is available as ${e.address}.`}),o(``),c(``),await p(),t?.()}catch(e){let t=e;n({title:`Error`,description:t?.message||t?.payload?.message||`Failed to add remote workspace`,variant:`destructive`})}finally{u(!1)}},_=async e=>{try{await y(e.id),await p(),t?.()}catch(e){n({title:`Error`,description:e instanceof Error?e.message:`Failed to remove remote workspace`,variant:`destructive`})}};return(0,Y.jsxs)(q,{title:`Open a remote Workspace`,onClose:e,children:[(0,Y.jsxs)(`form`,{onSubmit:m,className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-3`,children:[(0,Y.jsx)(g,{placeholder:`Server URL (e.g., https://my.canvas-server.tld)`,value:a,onChange:e=>o(e.target.value),disabled:l}),(0,Y.jsx)(g,{placeholder:`Workspace share token (canvas-...)`,value:s,onChange:e=>c(e.target.value),disabled:l}),(0,Y.jsx)(h,{type:`submit`,disabled:l||!a.trim()||!s.trim(),children:l?`Checking…`:`Add Remote`})]}),(0,Y.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Keeps the workspace on its own server and registers it here as`,` `,(0,Y.jsx)(`code`,{className:`font-mono text-xs`,children:`name@host`}),` — nothing is copied. Every call you make to it is forwarded to the remote with the share token (its permissions apply); document content and thumbnails are cached locally so they stay readable when the remote is offline. Use “Import remote…” if you want an independent local copy instead.`]})]}),d.length>0&&(0,Y.jsx)(`ul`,{className:`mt-4 space-y-2 border-t pt-3`,children:d.map(e=>(0,Y.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-md border p-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`truncate text-sm font-medium`,children:[e.label,(0,Y.jsx)(`span`,{className:`ml-2 rounded bg-muted px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted-foreground`,children:`remote`})]}),(0,Y.jsxs)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-muted-foreground`,children:[e.address,` · `,e.remote.url]})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Y.jsx)(h,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>r(`/workspaces/${e.address}`),children:`Open`}),(0,Y.jsx)(h,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>_(e),className:`text-destructive hover:text-destructive`,children:`Remove`})]})]},e.id))})]})}export{Ce as default};
package/dist/index.html CHANGED
@@ -46,7 +46,7 @@
46
46
  }
47
47
  })()
48
48
  </script>
49
- <script type="module" crossorigin src="/assets/index-AELn_vht.js"></script>
49
+ <script type="module" crossorigin src="/assets/index-CXPA9Fj8.js"></script>
50
50
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-C0FnF6B9.js">
51
51
  <link rel="modulepreload" crossorigin href="/assets/code-editor-BOIngd5F.js">
52
52
  <link rel="modulepreload" crossorigin href="/assets/react-BHzhHVTZ.js">
@@ -64,26 +64,26 @@
64
64
  <link rel="modulepreload" crossorigin href="/assets/auth-Bx9fAZmz.js">
65
65
  <link rel="modulepreload" crossorigin href="/assets/use-toast-BlLDqSUO.js">
66
66
  <link rel="modulepreload" crossorigin href="/assets/alert-dialog-CFeuDt0T.js">
67
- <link rel="modulepreload" crossorigin href="/assets/workspace-BJELPCNs.js">
67
+ <link rel="modulepreload" crossorigin href="/assets/workspace-cv6Hrfhh.js">
68
68
  <link rel="modulepreload" crossorigin href="/assets/useEscapeClose-DR_xKT_k.js">
69
69
  <link rel="modulepreload" crossorigin href="/assets/useToastHelpers-CRrpIIdY.js">
70
70
  <link rel="modulepreload" crossorigin href="/assets/layer-style-Byl5LNFR.js">
71
71
  <link rel="modulepreload" crossorigin href="/assets/color-DFEH4BfK.js">
72
72
  <link rel="modulepreload" crossorigin href="/assets/DocumentIcon-9i1uCMQa.js">
73
- <link rel="modulepreload" crossorigin href="/assets/LinkToCard-BQ1yoFDr.js">
73
+ <link rel="modulepreload" crossorigin href="/assets/LinkToCard-DGpvNE_V.js">
74
74
  <link rel="modulepreload" crossorigin href="/assets/use-mobile-Db-vWu9Y.js">
75
75
  <link rel="modulepreload" crossorigin href="/assets/tags-YamdPoBK.js">
76
76
  <link rel="modulepreload" crossorigin href="/assets/use-toolbox-Ck_cLGgf.js">
77
- <link rel="modulepreload" crossorigin href="/assets/context-DZ1Hn7tt.js">
78
- <link rel="modulepreload" crossorigin href="/assets/useAddTarget-B3b6TyZr.js">
77
+ <link rel="modulepreload" crossorigin href="/assets/context-1vR30CeC.js">
78
+ <link rel="modulepreload" crossorigin href="/assets/useAddTarget-BEgKjqGj.js">
79
79
  <link rel="modulepreload" crossorigin href="/assets/relation-events-CKio19hE.js">
80
- <link rel="modulepreload" crossorigin href="/assets/date-time-picker-txVhlNO0.js">
80
+ <link rel="modulepreload" crossorigin href="/assets/date-time-picker-C40sYmga.js">
81
81
  <link rel="modulepreload" crossorigin href="/assets/map-BxCwdK0d.js">
82
- <link rel="modulepreload" crossorigin href="/assets/IdentityFields-DZRqtnIG.js">
83
- <link rel="modulepreload" crossorigin href="/assets/public-share-D5yz-Pmo.js">
82
+ <link rel="modulepreload" crossorigin href="/assets/IdentityFields-C7sv9pMk.js">
83
+ <link rel="modulepreload" crossorigin href="/assets/public-share-DLXh7Ie6.js">
84
84
  <link rel="modulepreload" crossorigin href="/assets/blobs-WiXP9QRi.js">
85
- <link rel="modulepreload" crossorigin href="/assets/text-documents-BaXhu3ra.js">
86
- <link rel="modulepreload" crossorigin href="/assets/useDocumentThumbnail-wW0lSOEy.js">
85
+ <link rel="modulepreload" crossorigin href="/assets/text-documents-DxVsu9zG.js">
86
+ <link rel="modulepreload" crossorigin href="/assets/useDocumentThumbnail-DutrNFK3.js">
87
87
  <link rel="modulepreload" crossorigin href="/assets/markdown-view-BBBZtNSR.js">
88
88
  <link rel="modulepreload" crossorigin href="/assets/sanitize-DrVcFY1Q.js">
89
89
  <link rel="modulepreload" crossorigin href="/assets/punycode.es6-ZbLrB_Dn.js">
@@ -92,40 +92,40 @@
92
92
  <link rel="modulepreload" crossorigin href="/assets/MessageComposerDialog-CdPp-3GR.js">
93
93
  <link rel="modulepreload" crossorigin href="/assets/LinkToSidePanel-eCy3nW4R.js">
94
94
  <link rel="modulepreload" crossorigin href="/assets/note-save-status-DPz4VzL6.js">
95
- <link rel="modulepreload" crossorigin href="/assets/useEditNoteFields-DXLTFEqL.js">
95
+ <link rel="modulepreload" crossorigin href="/assets/useEditNoteFields-HAsbBak7.js">
96
96
  <link rel="modulepreload" crossorigin href="/assets/DocumentBodyEditor-CVO5KPCs.js">
97
97
  <link rel="modulepreload" crossorigin href="/assets/use-document-modal-PG8bQyIB.js">
98
- <link rel="modulepreload" crossorigin href="/assets/sketch-lazy-BbNgGbR3.js">
98
+ <link rel="modulepreload" crossorigin href="/assets/sketch-lazy-6eEi8GIA.js">
99
99
  <link rel="modulepreload" crossorigin href="/assets/geo-CZfs0E-x.js">
100
- <link rel="modulepreload" crossorigin href="/assets/ObjectPropertiesCard-BTTwYnN9.js">
101
- <link rel="modulepreload" crossorigin href="/assets/TodosWidget-CYK5RbYD.js">
100
+ <link rel="modulepreload" crossorigin href="/assets/ObjectPropertiesCard-pE3IL82x.js">
101
+ <link rel="modulepreload" crossorigin href="/assets/TodosWidget-B_R-vHxf.js">
102
102
  <link rel="modulepreload" crossorigin href="/assets/document-open-mode-DoImW-xs.js">
103
- <link rel="modulepreload" crossorigin href="/assets/PickDocumentsCard-CFDQL70e.js">
104
- <link rel="modulepreload" crossorigin href="/assets/PathPickerField-B4yFUjgD.js">
105
- <link rel="modulepreload" crossorigin href="/assets/backend-sync-progress-tUU2XWtW.js">
103
+ <link rel="modulepreload" crossorigin href="/assets/PickDocumentsCard-BhJbPlxk.js">
104
+ <link rel="modulepreload" crossorigin href="/assets/PathPickerField-D7SubxSh.js">
105
+ <link rel="modulepreload" crossorigin href="/assets/backend-sync-progress-m7wUKTJn.js">
106
106
  <link rel="modulepreload" crossorigin href="/assets/workspace-access-C9nZlBBZ.js">
107
107
  <link rel="modulepreload" crossorigin href="/assets/search-COMZIxA7.js">
108
108
  <link rel="modulepreload" crossorigin href="/assets/use-sortable-data-BBKmqs79.js">
109
109
  <link rel="modulepreload" crossorigin href="/assets/workspace-BydSRtST.js">
110
- <link rel="modulepreload" crossorigin href="/assets/document-list-CQ1_7Sja.js">
110
+ <link rel="modulepreload" crossorigin href="/assets/document-list-ASCemk7T.js">
111
111
  <link rel="modulepreload" crossorigin href="/assets/url-params-n7kU_WZ-.js">
112
- <link rel="modulepreload" crossorigin href="/assets/use-canvas-pins-DkWN9oEd.js">
112
+ <link rel="modulepreload" crossorigin href="/assets/use-canvas-pins-DqkSe_aU.js">
113
113
  <link rel="modulepreload" crossorigin href="/assets/use-menu-DIP1zh7I.js">
114
- <link rel="modulepreload" crossorigin href="/assets/registry-D1CIT_aZ.js">
115
- <link rel="modulepreload" crossorigin href="/assets/use-applet-target-ffIGaAqT.js">
114
+ <link rel="modulepreload" crossorigin href="/assets/registry-eFbDXN9w.js">
115
+ <link rel="modulepreload" crossorigin href="/assets/use-applet-target-1DU4mgJH.js">
116
116
  <link rel="modulepreload" crossorigin href="/assets/last-path-BbXWC3b3.js">
117
- <link rel="modulepreload" crossorigin href="/assets/workspace-area-menu-BFw2yUHk.js">
118
- <link rel="modulepreload" crossorigin href="/assets/workspace-content-gate-NLuRPvbm.js">
117
+ <link rel="modulepreload" crossorigin href="/assets/workspace-area-menu-CUqTxXmz.js">
118
+ <link rel="modulepreload" crossorigin href="/assets/workspace-content-gate-B6T3nLfW.js">
119
119
  <link rel="modulepreload" crossorigin href="/assets/sha256-65KIjGvZ.js">
120
- <link rel="modulepreload" crossorigin href="/assets/UploadProgressList-Ci1akl_D.js">
121
- <link rel="modulepreload" crossorigin href="/assets/FileForm-C35drQ_R.js">
120
+ <link rel="modulepreload" crossorigin href="/assets/UploadProgressList-C9teR7r-.js">
121
+ <link rel="modulepreload" crossorigin href="/assets/FileForm-CMuWZbUX.js">
122
122
  <link rel="modulepreload" crossorigin href="/assets/use-theme-DaxpiICf.js">
123
123
  <link rel="stylesheet" crossorigin href="/assets/map-BcsP_QXj.css">
124
124
  <link rel="stylesheet" crossorigin href="/assets/ObjectPropertiesCard-Docu7O5V.css">
125
125
  <link rel="stylesheet" crossorigin href="/assets/backend-sync-progress-DU-e9TWi.css">
126
126
  <link rel="stylesheet" crossorigin href="/assets/document-list-DAYdk5vh.css">
127
127
  <link rel="stylesheet" crossorigin href="/assets/use-canvas-pins-C57Vbkrq.css">
128
- <link rel="stylesheet" crossorigin href="/assets/index-BAeuh9Mu.css">
128
+ <link rel="stylesheet" crossorigin href="/assets/index-Bi5-zGgp.css">
129
129
  <link rel="manifest" href="/manifest.webmanifest"></head>
130
130
  <body>
131
131
  <div id="root"></div>