texlite 0.9.4 → 0.10.0

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 (38) hide show
  1. package/README.md +64 -40
  2. package/README.zh-CN.md +56 -34
  3. package/dist/client/assets/{AdminUsers-B12FJUMy.js → AdminUsers-C7oU_1Y_.js} +1 -1
  4. package/dist/client/assets/{CitationLibraryDialog-BTmnCP4V.js → CitationLibraryDialog-CU2b0xtm.js} +1 -1
  5. package/dist/client/assets/{Dashboard-JA5_M3TK.js → Dashboard-BB4RO4x2.js} +2 -2
  6. package/dist/client/assets/{GitDialog--MoUIW0n.js → GitDialog-C2Np1i8v.js} +1 -1
  7. package/dist/client/assets/{HistoryDialog-LgKbjsTZ.js → HistoryDialog-CdoYeLyX.js} +1 -1
  8. package/dist/client/assets/{LatexEditor-Dj2zIaQm.js → LatexEditor-Dmy6_gqt.js} +1 -1
  9. package/dist/client/assets/{PdfPreview-C_W7w360.js → PdfPreview-fDxKh6hP.js} +1 -1
  10. package/dist/client/assets/{ProjectIconPickerDialog-GzRuM0oQ.js → ProjectIconPickerDialog-CsjMKq7h.js} +1 -1
  11. package/dist/client/assets/{ProjectNavigationDialogs-BiArHmQ9.js → ProjectNavigationDialogs-_JY0yVob.js} +1 -1
  12. package/dist/client/assets/{ProjectSettings-DgJohWUv.js → ProjectSettings-DXGA-lmB.js} +1 -1
  13. package/dist/client/assets/{ProjectWorkspace-C6sYiBF2.js → ProjectWorkspace-mCYjyc6e.js} +20 -20
  14. package/dist/client/assets/{SelectionHistoryDialog-Bpv6nvrC.js → SelectionHistoryDialog-D8CeqjLD.js} +1 -1
  15. package/dist/client/assets/{SystemMetricsDialog-hJQATmd4.js → SystemMetricsDialog-BZx7ZMQt.js} +1 -1
  16. package/dist/client/assets/{TagManagementDialog-BHC8qULq.js → TagManagementDialog-4R1Gs43j.js} +1 -1
  17. package/dist/client/assets/{WordCountDialog-DZhhO94k.js → WordCountDialog-C-MCscAu.js} +1 -1
  18. package/dist/client/assets/check-Jf8WBxDX.js +1 -0
  19. package/dist/client/assets/{hard-drive-BWZnOgnm.js → hard-drive-Bsk-RETn.js} +1 -1
  20. package/dist/client/assets/{index-p1NHkGGG.js → index-B6rP7QsM.js} +2 -2
  21. package/dist/client/assets/{index-kTamGfTl.js → index-Csp5J5aI.js} +1 -1
  22. package/dist/client/assets/index-DGZNAyxW.css +1 -0
  23. package/dist/client/assets/{key-round-CoDwyVJc.js → key-round-DqptHHKC.js} +1 -1
  24. package/dist/client/assets/{minimize-2-D100opW2.js → minimize-2-92UqFWI9.js} +1 -1
  25. package/dist/client/assets/{minus-DDTYB-Oz.js → minus-bx4ZLZnb.js} +1 -1
  26. package/dist/client/assets/{plus-BVXOlQXP.js → plus-DQg_bV50.js} +1 -1
  27. package/dist/client/assets/{refresh-cw-LtwnqlWh.js → refresh-cw-BoMEkk5J.js} +1 -1
  28. package/dist/client/assets/{search-DXo_aAp0.js → search-UZspmceH.js} +1 -1
  29. package/dist/client/assets/{sigma-BgvHGPto.js → sigma-C0IvFdKV.js} +1 -1
  30. package/dist/client/assets/{spellCheck-BtRppKcC.js → spellCheck-DyKIHf5C.js} +1 -1
  31. package/dist/client/assets/{tags-m9kppdi0.js → tags-BTUtvaAc.js} +1 -1
  32. package/dist/client/assets/{type-YO4aprqE.js → type-XvvfEJRs.js} +1 -1
  33. package/dist/client/assets/{user-plus-MRmKeDtX.js → user-plus-Chr9T97G.js} +1 -1
  34. package/dist/client/assets/{x-eisRQJv_.js → x-DlFXD9Vl.js} +1 -1
  35. package/dist/client/index.html +2 -2
  36. package/package.json +1 -1
  37. package/dist/client/assets/check-C1db8iNn.js +0 -1
  38. package/dist/client/assets/index-BiwJj0Np.css +0 -1
@@ -1,3 +1,3 @@
1
- import{u as oe,r as a,j as t}from"./react-BVUjbTTn.js";import{c as re,g as A,M as ae,C as le,d as ce}from"./index-p1NHkGGG.js";import{d as de,C as ue}from"./index-kTamGfTl.js";import{B as fe}from"./ProjectWorkspace-C6sYiBF2.js";import"./check-C1db8iNn.js";import"./x-eisRQJv_.js";import"./search-DXo_aAp0.js";import"./user-plus-MRmKeDtX.js";import"./refresh-cw-LtwnqlWh.js";const he=re("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]),O=96,R=48;function me(e,s){const o=e.replace(/\r\n/g,`
1
+ import{u as oe,r as a,j as t}from"./react-BVUjbTTn.js";import{c as re,g as A,M as ae,C as le,d as ce}from"./index-B6rP7QsM.js";import{d as de,C as ue}from"./index-Csp5J5aI.js";import{B as fe}from"./ProjectWorkspace-mCYjyc6e.js";import"./check-Jf8WBxDX.js";import"./x-DlFXD9Vl.js";import"./search-UZspmceH.js";import"./user-plus-Chr9T97G.js";import"./refresh-cw-BoMEkk5J.js";const he=re("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]),O=96,R=48;function me(e,s){const o=e.replace(/\r\n/g,`
2
2
  `),r=s.replace(/\r\n/g,`
3
3
  `);if(o===r)return{previous:[],current:[],additions:0,deletions:0,hasChanges:!1};const d=new de,p=d.diff_main(o,r,!1);d.diff_cleanupSemantic(p);const n=[],g=[];let f=0,c=0;for(let h=0;h<p.length;h+=1){const[y,u]=p[h];if(u)if(y===0){const v=pe(u,h,p.length);E(n,v),E(g,v)}else y<0?(c+=u.length,E(n,{kind:"deletion",text:u})):(f+=u.length,E(g,{kind:"addition",text:u}))}return{previous:n,current:g,additions:f,deletions:c,hasChanges:f>0||c>0}}function pe(e,s,o){const r=s===0,d=s===o-1;return(r||d)&&e.length<=O?{kind:"equal",text:e}:!r&&!d&&e.length<=R*2?{kind:"equal",text:e}:r?{kind:"omitted",text:`…${I(e,O)}`}:d?{kind:"omitted",text:`${q(e,O)}…`}:{kind:"omitted",text:`${q(e,R)}…${I(e,R)}`}}function q(e,s){if(e.length<=s)return e;const o=ye(e,s);return e.slice(0,o)}function I(e,s){if(e.length<=s)return e;const o=ge(e,e.length-s);return e.slice(o)}function ye(e,s){const o=Math.min(e.length,s+24);for(let r=s;r<o;r+=1)if(J(e[r]))return r+1;return s}function ge(e,s){const o=Math.max(0,s-24);for(let r=s;r>o;r-=1)if(J(e[r-1]))return r;return s}function J(e){return/\s|[.,;:!?)}\]]/.test(e)}function E(e,s){const o=e.at(-1);o?.kind===s.kind?o.text+=s.text:e.push({...s})}function we({open:e,project:s,filePath:o,selection:r,currentSource:d,onOpenChange:p}){const{t:n,i18n:g}=oe(),[{filePath:f,selection:c,source:h}]=a.useState(()=>({filePath:o,selection:r,source:d})),[y,u]=a.useState([]),[v,k]=a.useState(null),[K,T]=a.useState(!1),[Q,$]=a.useState(!0),[U,w]=a.useState(!1),[D,C]=a.useState(""),[b,P]=a.useState(null),[W,L]=a.useState(!1),[H,z]=a.useState(!1),[Y,M]=a.useState(""),[Z,ee]=a.useState(0);a.useEffect(()=>{if(P(null),!e||s.permission!=="owner")return;const i=new AbortController;return A(`/api/projects/${s.id}/edit-history/stats`,{signal:i.signal}).then(m=>{i.signal.aborted||P(m)}).catch(m=>{!i.signal.aborted&&!G(m)&&C(_(m))}),()=>i.abort()},[e,s.id,s.permission,Z]);const te=async()=>{if(!H){z(!0),M("");try{await A(`/api/projects/${s.id}/edit-history`,{method:"DELETE"}),u([]),k(null),T(!1),$(!0),ee(i=>i+1),L(!1)}catch(i){M(_(i))}finally{z(!1)}}},[se,B]=a.useState({}),N=Math.max(0,c.endOffset-c.startOffset);a.useEffect(()=>{if(!e||!f||N<=0)return;const i=new AbortController;if(w(!0),C(""),u([]),$(!0),B({}),k(null),T(!1),h.slice(c.startOffset,c.endOffset)!==c.selectedText){C(n("selectionHistory.sourceChanged")),w(!1);return}const m=new URLSearchParams({path:f,start:String(c.startOffset),end:String(c.endOffset),sourceHash:fe(h)});return A(`/api/projects/${s.id}/edit-history?${m}`,{signal:i.signal}).then(l=>{u(l.entries),$(l.chainComplete),k(l.baseline),T(l.hasMore)}).catch(l=>{G(l)||C(_(l))}).finally(()=>{i.signal.aborted||w(!1)}),()=>i.abort()},[e,s.id,f,c,N,h,n]);const ne=a.useMemo(()=>n("selectionHistory.description",{path:f,count:N}),[n,f,N]);return t.jsx(ae,{open:e,wide:!0,draggable:!0,className:"selection-history-modal",title:n("selectionHistory.title"),description:ne,onOpenChange:p,footer:t.jsx("button",{onClick:()=>p(!1),children:n("common.close")}),children:t.jsxs("div",{className:"selection-history-dialog",children:[s.permission==="owner"&&b&&t.jsxs("div",{className:"history-stats",children:[t.jsx("strong",{children:n("selectionHistory.storageUsage",{used:(b.payloadBytes/1048576).toFixed(2),limit:(b.maxStorageBytes/1048576).toFixed(0),count:b.segmentCount})}),t.jsx("small",{children:n("selectionHistory.storageDescription")}),t.jsx("button",{type:"button",className:"danger-text",disabled:U||H||b.segmentCount===0,onClick:()=>{M(""),L(!0)},children:n("selectionHistory.clearAll")})]}),t.jsx(le,{open:W,title:n("selectionHistory.clearAll"),description:n("selectionHistory.clearDescription"),confirmLabel:n("common.delete"),danger:!0,busy:H,error:Y,onConfirm:()=>{te()},onCancel:()=>{H||L(!1)}}),D&&t.jsx("p",{className:"error selection-history-message",children:D}),U?t.jsxs("div",{className:"selection-history-loading",children:[t.jsx(ce,{className:"spin",size:22}),n("common.loading")]}):t.jsxs(t.Fragment,{children:[!Q&&t.jsx("p",{className:"selection-history-boundary",children:n("selectionHistory.boundary")}),K&&t.jsx("p",{className:"selection-history-boundary",children:n("selectionHistory.limited",{count:y.length})}),y.length===0&&!D?t.jsxs("div",{className:"selection-history-empty",children:[t.jsx(ue,{size:28}),t.jsx("strong",{children:n("selectionHistory.emptyTitle")}),t.jsx("span",{children:n("selectionHistory.emptyDescription")})]}):t.jsx("ol",{className:"selection-history-list",children:y.map((i,m)=>{const l=se[i.id]||"content",j=y[m+1]||v,F=!!(j&&i.content!==null&&j.content!==null&&!i.contentTruncated&&!j.contentTruncated),S=l==="diff"&&F?me(j.content,i.content):null,V=j?F?S&&!S.hasChanges?n("selectionHistory.noDiff"):null:n("selectionHistory.diffUnavailable"):n("selectionHistory.noPrevious");return t.jsx("li",{children:t.jsxs("article",{className:"selection-history-entry",children:[t.jsxs("header",{children:[t.jsx("time",{title:new Date(i.updatedAt).toLocaleString(g.resolvedLanguage),children:je(i.updatedAt,g.resolvedLanguage)}),t.jsxs("span",{className:"selection-history-authors",children:[t.jsx(he,{size:14}),t.jsx("span",{children:n("selectionHistory.changedBy")}),t.jsx("span",{className:"selection-history-author-list",children:i.authors.map((x,ie)=>t.jsx("span",{children:xe(x,n("editor.deletedUser"))},x.id||`deleted-${ie}`))})]})]}),t.jsxs("div",{className:"selection-history-tabs",role:"tablist","aria-label":n("selectionHistory.view"),children:[t.jsx("button",{type:"button",className:l==="content"?"active":"",role:"tab","aria-selected":l==="content","aria-controls":`selection-history-content-${i.id}`,onClick:()=>B(x=>({...x,[i.id]:"content"})),children:n("selectionHistory.contentTab")}),t.jsx("button",{type:"button",className:l==="diff"?"active":"",role:"tab","aria-selected":l==="diff","aria-controls":`selection-history-diff-${i.id}`,onClick:()=>B(x=>({...x,[i.id]:"diff"})),children:n("selectionHistory.diffTab")})]}),l==="content"?t.jsxs("div",{className:"selection-history-content",id:`selection-history-content-${i.id}`,role:"tabpanel",children:[i.content===null?t.jsx("p",{className:"selection-history-content-unavailable",children:n("selectionHistory.contentUnavailable")}):t.jsx("pre",{children:i.content||"∅"}),i.contentTruncated&&t.jsx("small",{children:n("selectionHistory.contentTruncated")})]}):t.jsx("div",{className:"selection-history-content",id:`selection-history-diff-${i.id}`,role:"tabpanel",children:V?t.jsx("p",{className:"selection-history-content-unavailable",children:V}):S&&t.jsx(be,{diff:S,previousLabel:n("selectionHistory.previousVersion"),currentLabel:n("selectionHistory.currentVersion")})})]})},i.id)})})]})]})})}function xe(e,s){return!e.name&&!e.username?s:e.name&&e.username?`${e.name} (@${e.username})`:e.name||`@${e.username}`}function be({diff:e,previousLabel:s,currentLabel:o}){return t.jsxs("div",{className:"selection-history-semantic-diff",children:[t.jsx(X,{label:s,pieces:e.previous,variant:"previous"}),t.jsx(X,{label:o,pieces:e.current,variant:"current"})]})}function X({label:e,pieces:s,variant:o}){return t.jsxs("section",{className:`selection-history-diff-side ${o}`,children:[t.jsx("header",{children:e}),t.jsx("pre",{children:s.length?s.map((r,d)=>t.jsx("span",{className:r.kind,children:r.text},`${d}-${r.kind}`)):"∅"})]})}function je(e,s){const o=new Date(e);return Number.isNaN(o.getTime())?e:o.toLocaleString(s,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})}function G(e){return e instanceof Error&&e.name==="AbortError"}function _(e){return e instanceof Error?e.message:String(e)}export{we as SelectionHistoryDialog};
@@ -1 +1 @@
1
- import{u as f,r as n,j as e}from"./react-BVUjbTTn.js";import{g as y,M as b}from"./index-p1NHkGGG.js";import{A as M}from"./Dashboard-JA5_M3TK.js";import{R as $}from"./refresh-cw-LtwnqlWh.js";import"./hard-drive-BWZnOgnm.js";import"./x-eisRQJv_.js";import"./sigma-BgvHGPto.js";import"./tags-m9kppdi0.js";function Q({open:t,onOpenChange:c}){const{t:s}=f(),[r,p]=n.useState(null),[u,x]=n.useState(!1),[d,j]=n.useState(""),a=n.useCallback(async()=>{x(!0);try{p(await y("/api/health/metrics")),j("")}catch(i){j(i instanceof Error?i.message:s("errors.generic"))}finally{x(!1)}},[s]);return n.useEffect(()=>{if(!t)return;a();const i=window.setInterval(()=>{a()},5e3);return()=>window.clearInterval(i)},[t,a]),e.jsxs(b,{open:t,onOpenChange:c,wide:!0,title:s("metrics.title"),description:s("metrics.description"),footer:e.jsxs("button",{onClick:()=>{a()},disabled:u,children:[e.jsx($,{size:14,className:u?"spin":""}),s("metrics.refresh")]}),children:[d&&e.jsx("p",{className:"error",children:d}),!r&&!d&&e.jsx("p",{className:"muted",children:s("common.loading")}),r&&e.jsxs("div",{className:"system-metrics",children:[e.jsxs("div",{className:"metric-summary-grid",children:[e.jsx(l,{label:s("metrics.uptime"),value:g(r.uptimeSeconds)}),e.jsx(l,{label:s("metrics.memory"),value:`${h(r.memory.rssBytes)} RSS`,detail:`${h(r.memory.heapUsedBytes)} / ${h(r.memory.heapTotalBytes)} ${s("metrics.heap")}`}),e.jsx(l,{label:s("metrics.compileQueue"),value:`${r.compileQueue.running} / ${r.compileQueue.concurrency}`,detail:s("metrics.pending",{count:r.compileQueue.pending})}),e.jsx(l,{label:s("metrics.collaboration"),value:s("metrics.sessions",{count:r.collaboration.sessions}),detail:s("metrics.roomsAndDirty",{rooms:r.collaboration.rooms,dirty:r.collaboration.dirtyFiles})})]}),e.jsxs("section",{className:"metric-section",children:[e.jsxs("h3",{children:[e.jsx(M,{size:15}),s("metrics.eventLoop")]}),e.jsx("p",{children:s("metrics.latencySummary",r.eventLoopDelay)})]}),e.jsxs("section",{className:"metric-section",children:[e.jsx("h3",{children:s("metrics.operationDurations")}),Object.keys(r.durationsMs).length===0?e.jsx("p",{className:"muted",children:s("metrics.noSamples")}):e.jsx("div",{className:"metric-table-wrap",children:e.jsxs("table",{className:"metric-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:s("metrics.operation")}),e.jsx("th",{children:s("metrics.samples")}),e.jsx("th",{children:s("metrics.last")}),e.jsx("th",{children:"P50"}),e.jsx("th",{children:"P95"}),e.jsx("th",{children:s("metrics.max")})]})}),e.jsx("tbody",{children:Object.entries(r.durationsMs).sort(([i],[o])=>i.localeCompare(o)).map(([i,o])=>e.jsxs("tr",{children:[e.jsx("td",{children:v(i,s)}),e.jsx("td",{children:o.count}),e.jsx("td",{children:m(o.last)}),e.jsx("td",{children:m(o.p50)}),e.jsx("td",{children:m(o.p95)}),e.jsx("td",{children:m(o.max)})]},i))})]})})]})]})]})}function l({label:t,value:c,detail:s}){return e.jsxs("article",{className:"metric-card",children:[e.jsx("span",{children:t}),e.jsx("strong",{children:c}),s&&e.jsx("small",{children:s})]})}function h(t){return`${Math.round(t/1024/1024*10)/10} MB`}function g(t){const c=Math.floor(t/86400),s=Math.floor(t%86400/3600),r=Math.floor(t%3600/60);return c?`${c}d ${s}h`:s?`${s}h ${r}m`:`${r}m`}function m(t){return t>=1e3?`${Math.round(t/100)/10}s`:`${Math.round(t*10)/10}ms`}function v(t,c){return c(`metrics.operations.${t}`,{defaultValue:t})}export{Q as SystemMetricsDialog};
1
+ import{u as f,r as n,j as e}from"./react-BVUjbTTn.js";import{g as y,M as b}from"./index-B6rP7QsM.js";import{A as M}from"./Dashboard-BB4RO4x2.js";import{R as $}from"./refresh-cw-BoMEkk5J.js";import"./hard-drive-Bsk-RETn.js";import"./x-DlFXD9Vl.js";import"./sigma-C0IvFdKV.js";import"./tags-BTUtvaAc.js";function Q({open:t,onOpenChange:c}){const{t:s}=f(),[r,p]=n.useState(null),[u,x]=n.useState(!1),[d,j]=n.useState(""),a=n.useCallback(async()=>{x(!0);try{p(await y("/api/health/metrics")),j("")}catch(i){j(i instanceof Error?i.message:s("errors.generic"))}finally{x(!1)}},[s]);return n.useEffect(()=>{if(!t)return;a();const i=window.setInterval(()=>{a()},5e3);return()=>window.clearInterval(i)},[t,a]),e.jsxs(b,{open:t,onOpenChange:c,wide:!0,title:s("metrics.title"),description:s("metrics.description"),footer:e.jsxs("button",{onClick:()=>{a()},disabled:u,children:[e.jsx($,{size:14,className:u?"spin":""}),s("metrics.refresh")]}),children:[d&&e.jsx("p",{className:"error",children:d}),!r&&!d&&e.jsx("p",{className:"muted",children:s("common.loading")}),r&&e.jsxs("div",{className:"system-metrics",children:[e.jsxs("div",{className:"metric-summary-grid",children:[e.jsx(l,{label:s("metrics.uptime"),value:g(r.uptimeSeconds)}),e.jsx(l,{label:s("metrics.memory"),value:`${h(r.memory.rssBytes)} RSS`,detail:`${h(r.memory.heapUsedBytes)} / ${h(r.memory.heapTotalBytes)} ${s("metrics.heap")}`}),e.jsx(l,{label:s("metrics.compileQueue"),value:`${r.compileQueue.running} / ${r.compileQueue.concurrency}`,detail:s("metrics.pending",{count:r.compileQueue.pending})}),e.jsx(l,{label:s("metrics.collaboration"),value:s("metrics.sessions",{count:r.collaboration.sessions}),detail:s("metrics.roomsAndDirty",{rooms:r.collaboration.rooms,dirty:r.collaboration.dirtyFiles})})]}),e.jsxs("section",{className:"metric-section",children:[e.jsxs("h3",{children:[e.jsx(M,{size:15}),s("metrics.eventLoop")]}),e.jsx("p",{children:s("metrics.latencySummary",r.eventLoopDelay)})]}),e.jsxs("section",{className:"metric-section",children:[e.jsx("h3",{children:s("metrics.operationDurations")}),Object.keys(r.durationsMs).length===0?e.jsx("p",{className:"muted",children:s("metrics.noSamples")}):e.jsx("div",{className:"metric-table-wrap",children:e.jsxs("table",{className:"metric-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:s("metrics.operation")}),e.jsx("th",{children:s("metrics.samples")}),e.jsx("th",{children:s("metrics.last")}),e.jsx("th",{children:"P50"}),e.jsx("th",{children:"P95"}),e.jsx("th",{children:s("metrics.max")})]})}),e.jsx("tbody",{children:Object.entries(r.durationsMs).sort(([i],[o])=>i.localeCompare(o)).map(([i,o])=>e.jsxs("tr",{children:[e.jsx("td",{children:v(i,s)}),e.jsx("td",{children:o.count}),e.jsx("td",{children:m(o.last)}),e.jsx("td",{children:m(o.p50)}),e.jsx("td",{children:m(o.p95)}),e.jsx("td",{children:m(o.max)})]},i))})]})})]})]})]})}function l({label:t,value:c,detail:s}){return e.jsxs("article",{className:"metric-card",children:[e.jsx("span",{children:t}),e.jsx("strong",{children:c}),s&&e.jsx("small",{children:s})]})}function h(t){return`${Math.round(t/1024/1024*10)/10} MB`}function g(t){const c=Math.floor(t/86400),s=Math.floor(t%86400/3600),r=Math.floor(t%3600/60);return c?`${c}d ${s}h`:s?`${s}h ${r}m`:`${r}m`}function m(t){return t>=1e3?`${Math.round(t/100)/10}s`:`${Math.round(t*10)/10}ms`}function v(t,c){return c(`metrics.operations.${t}`,{defaultValue:t})}export{Q as SystemMetricsDialog};
@@ -1 +1 @@
1
- import{u as W,r as s,j as a}from"./react-BVUjbTTn.js";import{g as f,h as b,M as Y,d as E,C as Z}from"./index-p1NHkGGG.js";import{P as _}from"./plus-BVXOlQXP.js";import{P as ee,T as ae,X as te}from"./x-eisRQJv_.js";import{C as ne}from"./check-C1db8iNn.js";const H=["red","orange","yellow","green","blue","purple","gray"];function S(l){return[...l].sort((C,y)=>C.name.localeCompare(y.name))}function se(l){return l instanceof Error&&l.name==="AbortError"}function de({open:l,onOpenChange:C,onTagCreated:y,onTagUpdated:R,onTagDeleted:X}){const{t}=W(),[T,h]=s.useState([]),[G,w]=s.useState(!1),[D,i]=s.useState(""),[p,k]=s.useState(""),[z,L]=s.useState("blue"),[d,P]=s.useState(!1),[$,m]=s.useState(null),[j,I]=s.useState(""),[M,A]=s.useState("blue"),[N,O]=s.useState(null),[o,v]=s.useState(null),[Q,g]=s.useState(""),[u,q]=s.useState(!1);s.useEffect(()=>{if(!l)return;const e=new AbortController;return w(!0),i(""),f("/api/tags/management",{signal:e.signal}).then(n=>h(S(n.tags))).catch(n=>{se(n)||i(b(n))}).finally(()=>{e.signal.aborted||w(!1)}),()=>e.abort()},[l]);const F=async()=>{if(!(!p.trim()||d)){P(!0),i("");try{const e=await f("/api/tags",{method:"POST",body:JSON.stringify({name:p,color:z})});h(n=>S([...n,{...e.tag,projectCount:0}])),y(e.tag),k(""),L("blue")}catch(e){i(b(e))}finally{P(!1)}}},U=e=>{m(e.id),I(e.name),A(e.color),i("")},J=async e=>{if(!(!j.trim()||N)){O(e.id),i("");try{const n=await f(`/api/tags/${e.id}`,{method:"PATCH",body:JSON.stringify({name:j,color:M})}),c={...n.tag,projectCount:e.projectCount};h(r=>S(r.map(B=>B.id===e.id?c:B))),R(n.tag),m(null)}catch(n){i(b(n))}finally{O(null)}}},V=async()=>{if(!(!o||u)){q(!0),g("");try{await f(`/api/tags/${o.id}`,{method:"DELETE"}),h(e=>e.filter(n=>n.id!==o.id)),X(o.id),v(null),$===o.id&&m(null)}catch(e){g(b(e))}finally{q(!1)}}},x=d||N!==null||u,K=e=>{!e&&x||(e||(i(""),g(""),m(null)),C(e))};return a.jsxs(a.Fragment,{children:[a.jsx(Y,{open:l,title:t("tags.manage"),description:t("tags.manageDescription"),wide:!0,className:"tag-management-modal",onOpenChange:K,footer:a.jsx("button",{onClick:()=>K(!1),disabled:x,children:t("common.close")}),children:a.jsxs("div",{className:"tag-management",children:[D&&a.jsx("p",{className:"error dialog-error",role:"alert",children:D}),a.jsxs("div",{className:"tag-management-create",children:[a.jsxs("label",{className:"tag-management-field",children:[a.jsx("span",{children:t("tags.name")}),a.jsx("input",{autoFocus:!0,value:p,maxLength:32,placeholder:t("tags.name"),onChange:e=>{k(e.target.value),i("")},onKeyDown:e=>{e.key==="Enter"&&(e.preventDefault(),F())}})]}),a.jsxs("label",{className:"tag-management-field tag-management-color",children:[a.jsx("span",{children:t("tags.color")}),a.jsx("select",{value:z,onChange:e=>L(e.target.value),children:H.map(e=>a.jsx("option",{value:e,children:t(`tags.${e}`)},e))})]}),a.jsxs("button",{type:"button",className:"primary",disabled:!p.trim()||d,"aria-busy":d,onClick:()=>{F()},children:[d?a.jsx(E,{className:"spin",size:14}):a.jsx(_,{"aria-hidden":!0,size:14}),t("tags.createInManager")]})]}),G?a.jsxs("div",{className:"tag-management-loading",children:[a.jsx(E,{className:"spin",size:16}),t("common.loading")]}):T.length===0?a.jsx("p",{className:"tag-management-empty",children:t("tags.noTags")}):a.jsx("div",{className:"tag-management-list",children:T.map(e=>{const n=$===e.id,c=N===e.id;return a.jsxs("article",{className:`tag-management-item${n?" editing":""}`,children:[a.jsxs("div",{className:"tag-management-item-main",children:[a.jsx("span",{className:`tag-dot tag-${e.color}`,"aria-hidden":"true"}),a.jsxs("div",{children:[a.jsx("strong",{title:e.name,children:e.name}),a.jsx("small",{children:t("tags.projectCount",{count:e.projectCount})})]})]}),a.jsxs("div",{className:"tag-management-item-actions",children:[a.jsx("button",{type:"button",title:t("tags.edit"),"aria-label":t("tags.edit"),disabled:x&&!n,onClick:()=>U(e),children:a.jsx(ee,{"aria-hidden":!0,size:14})}),a.jsx("button",{type:"button",className:"danger-text",title:t("common.delete"),"aria-label":t("common.delete"),disabled:x,onClick:()=>{v(e),g("")},children:a.jsx(ae,{"aria-hidden":!0,size:14})})]}),n&&a.jsxs("div",{className:"tag-management-edit",children:[a.jsxs("label",{className:"tag-management-field",children:[a.jsx("span",{children:t("tags.rename")}),a.jsx("input",{value:j,maxLength:32,onChange:r=>{I(r.target.value),i("")},onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),J(e))}})]}),a.jsxs("label",{className:"tag-management-field tag-management-color",children:[a.jsx("span",{children:t("tags.color")}),a.jsx("select",{value:M,onChange:r=>{A(r.target.value),i("")},children:H.map(r=>a.jsx("option",{value:r,children:t(`tags.${r}`)},r))})]}),a.jsxs("div",{className:"tag-management-edit-actions",children:[a.jsxs("button",{type:"button",disabled:c,onClick:()=>{m(null),i("")},children:[a.jsx(te,{"aria-hidden":!0,size:14}),t("common.cancel")]}),a.jsxs("button",{type:"button",className:"primary",disabled:!j.trim()||c,"aria-busy":c,onClick:()=>{J(e)},children:[c?a.jsx(E,{className:"spin",size:14}):a.jsx(ne,{"aria-hidden":!0,size:14}),t("common.save")]})]})]})]},e.id)})})]})}),a.jsx(Z,{open:!!o,title:t("tags.deleteTitle"),description:t("tags.deleteDescription",{tag:o?.name??"",count:o?.projectCount??0}),confirmLabel:t(u?"common.loading":"common.delete"),danger:!0,busy:u,error:Q,onCancel:()=>{u||(v(null),g(""))},onConfirm:()=>{V()}})]})}export{de as TagManagementDialog};
1
+ import{u as W,r as s,j as a}from"./react-BVUjbTTn.js";import{g as f,h as b,M as Y,d as E,C as Z}from"./index-B6rP7QsM.js";import{P as _}from"./plus-DQg_bV50.js";import{P as ee,T as ae,X as te}from"./x-DlFXD9Vl.js";import{C as ne}from"./check-Jf8WBxDX.js";const H=["red","orange","yellow","green","blue","purple","gray"];function S(l){return[...l].sort((C,y)=>C.name.localeCompare(y.name))}function se(l){return l instanceof Error&&l.name==="AbortError"}function de({open:l,onOpenChange:C,onTagCreated:y,onTagUpdated:R,onTagDeleted:X}){const{t}=W(),[T,h]=s.useState([]),[G,w]=s.useState(!1),[D,i]=s.useState(""),[p,k]=s.useState(""),[z,L]=s.useState("blue"),[d,P]=s.useState(!1),[$,m]=s.useState(null),[j,I]=s.useState(""),[M,A]=s.useState("blue"),[N,O]=s.useState(null),[o,v]=s.useState(null),[Q,g]=s.useState(""),[u,q]=s.useState(!1);s.useEffect(()=>{if(!l)return;const e=new AbortController;return w(!0),i(""),f("/api/tags/management",{signal:e.signal}).then(n=>h(S(n.tags))).catch(n=>{se(n)||i(b(n))}).finally(()=>{e.signal.aborted||w(!1)}),()=>e.abort()},[l]);const F=async()=>{if(!(!p.trim()||d)){P(!0),i("");try{const e=await f("/api/tags",{method:"POST",body:JSON.stringify({name:p,color:z})});h(n=>S([...n,{...e.tag,projectCount:0}])),y(e.tag),k(""),L("blue")}catch(e){i(b(e))}finally{P(!1)}}},U=e=>{m(e.id),I(e.name),A(e.color),i("")},J=async e=>{if(!(!j.trim()||N)){O(e.id),i("");try{const n=await f(`/api/tags/${e.id}`,{method:"PATCH",body:JSON.stringify({name:j,color:M})}),c={...n.tag,projectCount:e.projectCount};h(r=>S(r.map(B=>B.id===e.id?c:B))),R(n.tag),m(null)}catch(n){i(b(n))}finally{O(null)}}},V=async()=>{if(!(!o||u)){q(!0),g("");try{await f(`/api/tags/${o.id}`,{method:"DELETE"}),h(e=>e.filter(n=>n.id!==o.id)),X(o.id),v(null),$===o.id&&m(null)}catch(e){g(b(e))}finally{q(!1)}}},x=d||N!==null||u,K=e=>{!e&&x||(e||(i(""),g(""),m(null)),C(e))};return a.jsxs(a.Fragment,{children:[a.jsx(Y,{open:l,title:t("tags.manage"),description:t("tags.manageDescription"),wide:!0,className:"tag-management-modal",onOpenChange:K,footer:a.jsx("button",{onClick:()=>K(!1),disabled:x,children:t("common.close")}),children:a.jsxs("div",{className:"tag-management",children:[D&&a.jsx("p",{className:"error dialog-error",role:"alert",children:D}),a.jsxs("div",{className:"tag-management-create",children:[a.jsxs("label",{className:"tag-management-field",children:[a.jsx("span",{children:t("tags.name")}),a.jsx("input",{autoFocus:!0,value:p,maxLength:32,placeholder:t("tags.name"),onChange:e=>{k(e.target.value),i("")},onKeyDown:e=>{e.key==="Enter"&&(e.preventDefault(),F())}})]}),a.jsxs("label",{className:"tag-management-field tag-management-color",children:[a.jsx("span",{children:t("tags.color")}),a.jsx("select",{value:z,onChange:e=>L(e.target.value),children:H.map(e=>a.jsx("option",{value:e,children:t(`tags.${e}`)},e))})]}),a.jsxs("button",{type:"button",className:"primary",disabled:!p.trim()||d,"aria-busy":d,onClick:()=>{F()},children:[d?a.jsx(E,{className:"spin",size:14}):a.jsx(_,{"aria-hidden":!0,size:14}),t("tags.createInManager")]})]}),G?a.jsxs("div",{className:"tag-management-loading",children:[a.jsx(E,{className:"spin",size:16}),t("common.loading")]}):T.length===0?a.jsx("p",{className:"tag-management-empty",children:t("tags.noTags")}):a.jsx("div",{className:"tag-management-list",children:T.map(e=>{const n=$===e.id,c=N===e.id;return a.jsxs("article",{className:`tag-management-item${n?" editing":""}`,children:[a.jsxs("div",{className:"tag-management-item-main",children:[a.jsx("span",{className:`tag-dot tag-${e.color}`,"aria-hidden":"true"}),a.jsxs("div",{children:[a.jsx("strong",{title:e.name,children:e.name}),a.jsx("small",{children:t("tags.projectCount",{count:e.projectCount})})]})]}),a.jsxs("div",{className:"tag-management-item-actions",children:[a.jsx("button",{type:"button",title:t("tags.edit"),"aria-label":t("tags.edit"),disabled:x&&!n,onClick:()=>U(e),children:a.jsx(ee,{"aria-hidden":!0,size:14})}),a.jsx("button",{type:"button",className:"danger-text",title:t("common.delete"),"aria-label":t("common.delete"),disabled:x,onClick:()=>{v(e),g("")},children:a.jsx(ae,{"aria-hidden":!0,size:14})})]}),n&&a.jsxs("div",{className:"tag-management-edit",children:[a.jsxs("label",{className:"tag-management-field",children:[a.jsx("span",{children:t("tags.rename")}),a.jsx("input",{value:j,maxLength:32,onChange:r=>{I(r.target.value),i("")},onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),J(e))}})]}),a.jsxs("label",{className:"tag-management-field tag-management-color",children:[a.jsx("span",{children:t("tags.color")}),a.jsx("select",{value:M,onChange:r=>{A(r.target.value),i("")},children:H.map(r=>a.jsx("option",{value:r,children:t(`tags.${r}`)},r))})]}),a.jsxs("div",{className:"tag-management-edit-actions",children:[a.jsxs("button",{type:"button",disabled:c,onClick:()=>{m(null),i("")},children:[a.jsx(te,{"aria-hidden":!0,size:14}),t("common.cancel")]}),a.jsxs("button",{type:"button",className:"primary",disabled:!j.trim()||c,"aria-busy":c,onClick:()=>{J(e)},children:[c?a.jsx(E,{className:"spin",size:14}):a.jsx(ne,{"aria-hidden":!0,size:14}),t("common.save")]})]})]})]},e.id)})})]})}),a.jsx(Z,{open:!!o,title:t("tags.deleteTitle"),description:t("tags.deleteDescription",{tag:o?.name??"",count:o?.projectCount??0}),confirmLabel:t(u?"common.loading":"common.delete"),danger:!0,busy:u,error:Q,onCancel:()=>{u||(v(null),g(""))},onConfirm:()=>{V()}})]})}export{de as TagManagementDialog};
@@ -1 +1 @@
1
- import{u as c,j as o}from"./react-BVUjbTTn.js";import{M as x,d as h}from"./index-p1NHkGGG.js";import{H as j}from"./ProjectWorkspace-C6sYiBF2.js";import{T as u}from"./type-YO4aprqE.js";import{k as m}from"./x-eisRQJv_.js";import"./check-C1db8iNn.js";import"./search-DXo_aAp0.js";import"./user-plus-MRmKeDtX.js";import"./refresh-cw-LtwnqlWh.js";function T({open:l,mode:t,path:s,busy:i,error:e,result:d,onOpenChange:n}){const{t:r}=c(),a=r(t==="full"?"editor.wordCountFullHint":"editor.wordCountSelectionHint");return o.jsxs(x,{open:l,title:r("editor.wordCountTitle"),description:a,onOpenChange:n,footer:o.jsx("button",{type:"button",onClick:()=>n(!1),children:r("common.close")}),children:[s&&o.jsxs("p",{className:"word-count-source",children:[r(t==="full"?"editor.wordCountFull":"editor.wordCountSelection")," · ",o.jsx("code",{children:s}),o.jsx("a",{href:"https://app.uio.no/ifi/texcount/",target:"_blank",rel:"noreferrer",children:r("editor.wordCountHelp")})]}),o.jsx("p",{className:"word-count-template-note",children:r("editor.wordCountTemplateNote")}),i&&o.jsxs("div",{className:"word-count-loading",role:"status","aria-live":"polite",children:[o.jsx(h,{className:"spin",size:22}),o.jsx("span",{children:r("editor.wordCountLoading")})]}),e&&o.jsx("p",{className:"error dialog-error",children:e}),d&&!i&&o.jsxs("div",{className:"word-count-result","aria-live":"polite",children:[o.jsxs("div",{className:"word-count-totals",children:[o.jsxs("div",{className:"word-count-total",children:[o.jsx(j,{size:20}),o.jsx("strong",{children:d.totalWords.toLocaleString()}),o.jsx("span",{children:r("editor.wordCountTotal")})]}),o.jsxs("div",{className:"word-count-total word-count-characters",children:[o.jsx(u,{size:20}),o.jsx("strong",{children:d.totalCharacters.toLocaleString()}),o.jsxs("span",{children:[r("editor.wordCountCharacters"),o.jsx("small",{children:r("editor.wordCountCharactersHint")})]})]})]}),o.jsxs("dl",{className:"word-count-breakdown",children:[o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountText")}),o.jsxs("dd",{children:[d.textWords.toLocaleString(),o.jsx("small",{children:r("editor.wordCountWordsUnit")})]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountHeaders")}),o.jsxs("dd",{children:[d.headerWords.toLocaleString(),o.jsx("small",{children:r("editor.wordCountWordsUnit")})]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountCaptions")}),o.jsxs("dd",{children:[d.captionWords.toLocaleString(),o.jsx("small",{children:r("editor.wordCountWordsUnit")})]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountFloats")}),o.jsxs("dd",{children:[d.floats.toLocaleString(),o.jsx("small",{children:r("editor.wordCountItemsUnit")})]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountInlineMath")}),o.jsxs("dd",{children:[d.inlineMath.toLocaleString(),o.jsx("small",{children:r("editor.wordCountExpressionsUnit")})]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountDisplayMath")}),o.jsxs("dd",{children:[d.displayMath.toLocaleString(),o.jsx("small",{children:r("editor.wordCountExpressionsUnit")})]})]}),d.files!==null&&o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountFiles")}),o.jsxs("dd",{children:[d.files.toLocaleString(),o.jsx("small",{children:r("editor.wordCountItemsUnit")})]})]})]}),d.parserErrors>0&&o.jsxs("p",{className:"warning word-count-warning",children:[o.jsx(m,{size:14}),r("editor.wordCountParserErrors",{count:d.parserErrors})]})]})]})}export{T as WordCountDialog};
1
+ import{u as c,j as o}from"./react-BVUjbTTn.js";import{M as x,d as h}from"./index-B6rP7QsM.js";import{H as j}from"./ProjectWorkspace-mCYjyc6e.js";import{T as u}from"./type-XvvfEJRs.js";import{k as m}from"./x-DlFXD9Vl.js";import"./check-Jf8WBxDX.js";import"./search-UZspmceH.js";import"./user-plus-Chr9T97G.js";import"./refresh-cw-BoMEkk5J.js";function T({open:l,mode:t,path:s,busy:i,error:e,result:d,onOpenChange:n}){const{t:r}=c(),a=r(t==="full"?"editor.wordCountFullHint":"editor.wordCountSelectionHint");return o.jsxs(x,{open:l,title:r("editor.wordCountTitle"),description:a,onOpenChange:n,footer:o.jsx("button",{type:"button",onClick:()=>n(!1),children:r("common.close")}),children:[s&&o.jsxs("p",{className:"word-count-source",children:[r(t==="full"?"editor.wordCountFull":"editor.wordCountSelection")," · ",o.jsx("code",{children:s}),o.jsx("a",{href:"https://app.uio.no/ifi/texcount/",target:"_blank",rel:"noreferrer",children:r("editor.wordCountHelp")})]}),o.jsx("p",{className:"word-count-template-note",children:r("editor.wordCountTemplateNote")}),i&&o.jsxs("div",{className:"word-count-loading",role:"status","aria-live":"polite",children:[o.jsx(h,{className:"spin",size:22}),o.jsx("span",{children:r("editor.wordCountLoading")})]}),e&&o.jsx("p",{className:"error dialog-error",children:e}),d&&!i&&o.jsxs("div",{className:"word-count-result","aria-live":"polite",children:[o.jsxs("div",{className:"word-count-totals",children:[o.jsxs("div",{className:"word-count-total",children:[o.jsx(j,{size:20}),o.jsx("strong",{children:d.totalWords.toLocaleString()}),o.jsx("span",{children:r("editor.wordCountTotal")})]}),o.jsxs("div",{className:"word-count-total word-count-characters",children:[o.jsx(u,{size:20}),o.jsx("strong",{children:d.totalCharacters.toLocaleString()}),o.jsxs("span",{children:[r("editor.wordCountCharacters"),o.jsx("small",{children:r("editor.wordCountCharactersHint")})]})]})]}),o.jsxs("dl",{className:"word-count-breakdown",children:[o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountText")}),o.jsxs("dd",{children:[d.textWords.toLocaleString(),o.jsx("small",{children:r("editor.wordCountWordsUnit")})]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountHeaders")}),o.jsxs("dd",{children:[d.headerWords.toLocaleString(),o.jsx("small",{children:r("editor.wordCountWordsUnit")})]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountCaptions")}),o.jsxs("dd",{children:[d.captionWords.toLocaleString(),o.jsx("small",{children:r("editor.wordCountWordsUnit")})]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountFloats")}),o.jsxs("dd",{children:[d.floats.toLocaleString(),o.jsx("small",{children:r("editor.wordCountItemsUnit")})]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountInlineMath")}),o.jsxs("dd",{children:[d.inlineMath.toLocaleString(),o.jsx("small",{children:r("editor.wordCountExpressionsUnit")})]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountDisplayMath")}),o.jsxs("dd",{children:[d.displayMath.toLocaleString(),o.jsx("small",{children:r("editor.wordCountExpressionsUnit")})]})]}),d.files!==null&&o.jsxs("div",{children:[o.jsx("dt",{children:r("editor.wordCountFiles")}),o.jsxs("dd",{children:[d.files.toLocaleString(),o.jsx("small",{children:r("editor.wordCountItemsUnit")})]})]})]}),d.parserErrors>0&&o.jsxs("p",{className:"warning word-count-warning",children:[o.jsx(m,{size:14}),r("editor.wordCountParserErrors",{count:d.parserErrors})]})]})]})}export{T as WordCountDialog};
@@ -0,0 +1 @@
1
+ import{c}from"./index-B6rP7QsM.js";const o=c("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);export{o as C};
@@ -1 +1 @@
1
- import{c as e}from"./index-p1NHkGGG.js";const a=e("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);export{a as H};
1
+ import{c as e}from"./index-B6rP7QsM.js";const a=e("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);export{a as H};