filecat 7.32.0 → 7.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/1852.16cec79aa004d7d496ee.js +1 -0
- package/build/dist/2515.df3393e66df975984e10.js +1 -0
- package/build/dist/26.63fd77a3075a6e071bc8.js +1 -0
- package/build/dist/3187.03c9284e30214b476487.js +1 -0
- package/build/dist/3322.36f73d119334675d9bc4.js +1 -0
- package/build/dist/4350.7412b41befe12857677f.js +1 -0
- package/build/dist/{4935.d07d9ef7e03632dcb51c.js → 4935.72f92a4a0e80fd72c68d.js} +1 -1
- package/build/dist/{6439.f3ddea3c0ef57dcbf23c.js → 6439.b1b588626009af7ba7cb.js} +1 -1
- package/build/dist/index.html +1 -1
- package/build/dist/main.6e543784024f3ed07f70.js +2 -0
- package/build/main.js +1 -1
- package/package.json +1 -1
- package/build/dist/2091.8324e03dcf28985539eb.js +0 -1
- package/build/dist/3187.67ad7348b6b7231e657d.js +0 -1
- package/build/dist/4350.799e1d3b7382a15d295b.js +0 -1
- package/build/dist/7212.a825bc171875985e1aab.js +0 -1
- package/build/dist/main.b0bcf1b153b849530789.js +0 -2
- /package/build/dist/{main.b0bcf1b153b849530789.js.LICENSE.txt → main.6e543784024f3ed07f70.js.LICENSE.txt} +0 -0
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2091],{22091(e,t,n){n.r(t),n.d(t,{default:()=>b});var o=n(96540),r=n(34843),c=n(82893),i=n(42562),s=n(39290),a=n(33036);const l=15;function d(e){const t=e.getBoundingClientRect().top,n=[],o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r=null;for(;o.nextNode();){const e=o.currentNode,c=e.textContent??"";if(!c.trim())continue;const i=document.createRange();for(let o=0;o<c.length;o++){i.setStart(e,o),i.setEnd(e,o+1);const c=i.getBoundingClientRect();0!==c.height&&((null===r||Math.abs(c.top-r)>1)&&(null!==r&&n.push(c.top-t),r=c.top))}}return null!==r&&n.push(e.offsetHeight),0===n.length&&n.push(e.offsetHeight),n}var u=n(74848);function f(e){const t=(0,s.OE)(e);if(!t)throw new Error(`docx 命令不存在: ${e}`);return t}function h(e){const{model:t,on_change:n,bind_save:r}=e,c=(0,o.useRef)(null),i=(0,o.useRef)([]),h=(0,o.useRef)(),p=(0,o.useRef)(new Map),m=(0,o.useRef)(""),g=(0,o.useCallback)(()=>{const e=c.current,n=t.selection?.focus;if(!e||!n)return;const o=e.querySelector(`[data-wk-block="${n.block}"]`);if(!o)return;let r=o;if(void 0!==n.inline){const e=o.querySelector(`[data-wk-inline="${n.inline}"]`);e&&(r=e)}const i=r.firstChild;if(!i)return;const s=document.createRange(),a=Math.min(n.offset??0,i.textContent?.length??0);s.setStart(i,a),s.collapse(!0);const l=window.getSelection();l?.removeAllRanges(),l?.addRange(s)},[t]),v=(0,o.useCallback)((e=!1)=>{const n=c.current;if(!n)return;let o=-1;const r=window.getSelection();if(r&&r.anchorNode&&n.contains(r.anchorNode)){const e=1===r.anchorNode.nodeType?r.anchorNode:r.anchorNode.parentElement,t=e?.closest("[data-wk-block]");t&&(o=Number(t.getAttribute("data-wk-block")))}const a=document.createElement("div");a.innerHTML=(0,s.j7)(t.document);const d=Array.from(a.children).map(e=>e.outerHTML),u=i.current;if(e||u.length!==d.length)n.innerHTML=a.innerHTML,p.current.clear(),Array.from(n.children).forEach(e=>{const t=e,n=Number(t.getAttribute("data-wk-block"));Number.isNaN(n)||p.current.set(n,t)});else for(let e=0;e<d.length;e++){if(u[e]===d[e])continue;const t=p.current.get(e);if(t)if(e===o)t.innerHTML=a.children[e].innerHTML;else{t.outerHTML=d[e];const o=n.querySelector(`[data-wk-block="${e}"]`);o&&p.current.set(e,o)}}i.current=d,h.current??=function(e){const t=(0,s.yj)(e);return{width:t.width/l,height:t.height/l,top:t.top/l,right:t.right/l,bottom:t.bottom/l,left:t.left/l,body_height:(t.height-t.top-t.bottom)/l}}(t.document);const f=h.current,{heights:m,lines:g}=b(d.length,f),v=function(e,t,n,o){const r=(0,s.Bv)(e),c=(0,s.w$)(e),i=r.map((e,o)=>{const r=t[o]??0;return{height:r,section:0,lines:()=>n[o]??[r]}}),a=c.map(()=>({start:"continuous",columns:1,titlePage:!1,vAlign:"top",bodyHeight:()=>o.body_height}));return(0,s.En)(i,a,{evenAndOddHeaders:!1,noteSeparatorHeight:0}).map(e=>{const n=[];for(const o of e.regions)for(const e of o.columns)for(const o of e.fragments)"block"===o.kind?n.push({block:o.block,from:0,to:t[o.block]??o.height}):"slice"===o.kind&&n.push({block:o.block,from:o.from,to:o.to});return{fragments:n,number:e.number}})}(t.document,m,g,f);y(n,v,f)},[t]),b=(0,o.useCallback)((e,t)=>{const n=document.createElement("div");n.className="docx-page",n.style.cssText=[`width:${t.width}px`,`padding:${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`,"position:absolute","left:-99999px","top:0","visibility:hidden","pointer-events:none"].join(";");const o=document.createElement("div");o.className="docx-page__body",n.appendChild(o),document.body.appendChild(n);const r=[];for(let t=0;t<e;t++){const e=p.current.get(t);if(!e){const e=document.createElement("div");o.appendChild(e),r.push(e);continue}o.appendChild(e),r.push(e)}const c=[],i=[],s=o.scrollHeight;for(let e=0;e<r.length;e++){const t=r[e],n=t.offsetTop,o=e+1<r.length?r[e+1].offsetTop:s;let a=Math.max(0,o-n);e===r.length-1&&(a+=parseFloat(getComputedStyle(t).marginBottom)||0),c[e]=a,i[e]=d(t)}return n.remove(),{heights:c,lines:i}},[]),y=(0,o.useCallback)((e,t,n)=>{const o=t.map(e=>e.fragments.map(e=>e.block).join(",")).join("|");if(m.current!==o){m.current=o,e.innerHTML="";for(const o of t){const t=document.createElement("div");t.className="docx-page",t.style.width=`${n.width}px`,t.style.height=`${n.height}px`,t.style.padding=`${n.top}px ${n.right}px ${n.bottom}px ${n.left}px`;const r=document.createElement("div");r.className="docx-page__body",t.appendChild(r);const c=document.createElement("div");c.className="docx-page__number",c.textContent=String(o.number),t.appendChild(c);for(const e of o.fragments){const t=p.current.get(e.block);if(!t)continue;if(0===e.from&&e.to>=t.offsetHeight-1){r.appendChild(t);continue}const n=document.createElement("div");n.className="docx-page__slice",n.style.height=e.to-e.from+"px",n.style.overflow="hidden";const o=t.cloneNode(!0);o.style.marginTop=-e.from+"px",n.appendChild(o),r.appendChild(n)}e.appendChild(t)}e.querySelectorAll(".docx-page__body").forEach(e=>{e.setAttribute("contenteditable","true"),e.setAttribute("suppresscontenteditablewarning","true")})}},[]);(0,o.useEffect)(()=>{v(!0);const e=t.subscribe(()=>{const e=c.current,t=window.getSelection(),o=!!(e&&t&&t.anchorNode&&e.contains(t.anchorNode));v(!1),o&&g(),n?.(!0)});return()=>{e()}},[t,v,g,n]),(0,o.useEffect)(()=>{r?.(()=>function(e){return(0,a.FoA)(e.document)}(t))},[t,r]);const x=(0,o.useCallback)(()=>{const e=(0,s.Ff)(document);if(!e)return!1;const n=t.selection;return n&&JSON.stringify(n.anchor)===JSON.stringify(e.anchor)&&JSON.stringify(n.focus)===JSON.stringify(e.focus)||t.setSelection(e),!0},[t]),k=(0,o.useCallback)((e,n)=>{x(),(0,s.d1)(t,f(e),n)},[t,x]),_=(0,o.useCallback)(()=>{(0,s.d1)(t,f("structure.insertText"),{text:""})},[t]),N=(0,o.useCallback)(e=>{if(!x())return;const n=t.selection;if(!n)return;const{anchor:o,focus:r}=n;if(o.block!==r.block||o.inline!==r.inline||o.offset!==r.offset)return void _();const c=o.offset;if(e&&c<=0)return void(0,s.d1)(t,f("structure.mergeBack"),void 0);const i=e?c-1:c,a=e?c:c+1,l={block:o.block,para:o.para,cell:o.cell,inline:o.inline};t.setSelection({anchor:(0,s.zf)({...l,offset:i}).anchor,focus:(0,s.zf)({...l,offset:a}).anchor}),_()},[t,x,_]),w=(0,o.useCallback)(e=>{x(),(0,s.d1)(t,f("structure.insertText"),{text:e})},[t,x]);return(0,o.useEffect)(()=>{const e=c.current;if(!e)return;const n=n=>{const o=window.getSelection();if(o&&o.anchorNode&&e.contains(o.anchorNode)){if(n.ctrlKey||n.metaKey){const e=n.key.toLowerCase();return n.shiftKey||"b"!==e&&"i"!==e&&"u"!==e?"z"===e?(n.preventDefault(),void((n.shiftKey?t.canRedo():t.canUndo())&&(n.shiftKey?t.redo():t.undo()))):void 0:(n.preventDefault(),void k("b"===e?"text.bold":"i"===e?"text.italic":"text.underline"))}return"Enter"===n.key?(n.preventDefault(),void k("structure.insertParagraph")):"Backspace"===n.key?(n.preventDefault(),void N(!0)):"Delete"===n.key?(n.preventDefault(),void N(!1)):void(1!==n.key.length||n.altKey||(n.preventDefault(),w(n.key)))}},o=t=>{const n=window.getSelection();n&&n.anchorNode&&e.contains(n.anchorNode)&&t.data&&w(t.data)},r=t=>{const n=window.getSelection();if(!n||!n.anchorNode||!e.contains(n.anchorNode))return;t.preventDefault();const o=t.clipboardData?.getData("text/plain");o&&w(o)};return e.addEventListener("keydown",n),e.addEventListener("compositionend",o),e.addEventListener("paste",r),()=>{e.removeEventListener("keydown",n),e.removeEventListener("compositionend",o),e.removeEventListener("paste",r)}},[t,k,N,w]),(0,u.jsx)("div",{className:"docx-body",children:(0,u.jsx)("div",{className:"docx-pages",ref:c})})}var p=n(99018);function m(e){const{url:t,save_path:n,on_dirty:r,bind_save:c}=e,[i,a]=(0,o.useState)(),[l,d]=(0,o.useState)(""),[f,m]=(0,o.useState)(!0),[g,v]=(0,o.useState)(!1),b=(0,o.useRef)();return(0,o.useEffect)(()=>{if(!t)return;let e=!0;return m(!0),d(""),v(!1),a(void 0),(0,p.PQ)(t).then(t=>{e&&a(function(e){return(0,s.k3)(e)}(t))}).catch(t=>e&&d(String(t?.message??t))).finally(()=>e&&m(!1)),()=>{e=!1}},[t]),(0,o.useEffect)(()=>{r?.(g)},[g,r]),(0,o.useEffect)(()=>{c?.(async()=>{if(!b.current)return!1;const e=await(0,p.GB)(n,b.current());return e&&v(!1),e})},[n,c]),l?(0,u.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:l}):f||!i?(0,u.jsx)("div",{className:"office-editor__tip",children:"读取中…"}):(0,u.jsx)(h,{model:i,on_change:v,bind_save:e=>b.current=e})}var g=n(93245),v=n(23430);function b(){const[e,t]=(0,r.fp)(c.AG.docx_editor),[n,s]=(0,o.useState)(!1),[a,l]=(0,o.useState)(!1),d=(0,o.useRef)(),f=async()=>{if(!d.current)return!1;l(!0);try{return await d.current()}finally{l(!1)}},h=(0,o.useRef)(n);return h.current=n,(0,g.a)(v.nE.docx,()=>h.current,()=>f()),(0,u.jsx)(i.A,{name:e.name,dirty:n,loading:!1,error:"",saving:a,on_save:f,on_close:()=>{const n=e.close;t({}),n?.()},children:e.url&&(0,u.jsx)(m,{url:e.url,save_path:(0,p.Vi)(e.name??""),on_dirty:s,bind_save:e=>d.current=e})})}},42562(e,t,n){n.d(t,{A:()=>s});var o=n(96540),r=n(85997),c=n(45907),i=n(74848);function s(e){const{name:t,dirty:n,loading:s,error:a,saving:l,on_save:d,on_close:u,children:f,extra:h}=e,p=(0,c.y)(),m=(0,o.useRef)(u),g=(0,o.useRef)(d),v=(0,o.useRef)(n);m.current=u,g.current=d,v.current=n;const b=()=>{v.current?p({title:"关闭",sub_title:"有未保存的修改,确定关闭吗?",confirm_fun:()=>m.current?.()}):m.current?.()};return(0,o.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key.toLowerCase()?(e.preventDefault(),e.stopPropagation(),g.current?.()):"Escape"===e.key&&b()};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[]),(0,i.jsxs)("div",{className:"office-editor",children:[(0,i.jsxs)("div",{className:"office-editor__topbar",children:[(0,i.jsxs)("div",{className:"office-editor__name",children:[t,n&&(0,i.jsx)("span",{className:"office-editor__dirty",title:"有未保存的修改"})]}),(0,i.jsxs)("div",{className:"office-editor__ops",children:[h,l&&(0,i.jsx)("span",{className:"office-editor__saving",children:"保存中…"}),d&&(0,i.jsx)(r.rA,{icon:"save",title:"保存 (Ctrl+S)",onClick:()=>d()}),(0,i.jsx)(r.rA,{icon:"close",title:"关闭 (Esc)",onClick:b})]})]}),(0,i.jsxs)("div",{className:"office-editor__body",children:[s&&(0,i.jsx)("div",{className:"office-editor__tip",children:"加载中…"}),!s&&a&&(0,i.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:a}),!s&&!a&&f]})]})}},99018(e,t,n){n.d(t,{GB:()=>l,PQ:()=>a,Vi:()=>s});var o=n(14284),r=n(57889),c=n(34289),i=n(62042);function s(e){return`${encodeURIComponent((0,c.GG)("file",(0,c.vX)()))}${e}`}async function a(e){return r.l.get_bytes_url(e)}function l(e,t){return async function(e,t){const n=await o.$M.post(`save_bin/${e}`,{base64:d(t)});return 0===n.code||((0,i.zN)(n.message??"保存失败"),!1)}(function(e){const t=e.lastIndexOf("/");return t<0?encodeURIComponent(e):encodeURIComponent(e.slice(0,t))+e.slice(t)}(e),t)}function d(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3187,4935],{42562(e,t,n){n.d(t,{A:()=>c});var r=n(96540),s=n(85997),l=n(45907),o=n(74848);function c(e){const{name:t,dirty:n,loading:c,error:a,saving:i,on_save:u,on_close:f,children:d,extra:h}=e,m=(0,l.y)(),g=(0,r.useRef)(f),x=(0,r.useRef)(u),p=(0,r.useRef)(n);g.current=f,x.current=u,p.current=n;const y=()=>{p.current?m({title:"关闭",sub_title:"有未保存的修改,确定关闭吗?",confirm_fun:()=>g.current?.()}):g.current?.()};return(0,r.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key.toLowerCase()?(e.preventDefault(),e.stopPropagation(),x.current?.()):"Escape"===e.key&&y()};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[]),(0,o.jsxs)("div",{className:"office-editor",children:[(0,o.jsxs)("div",{className:"office-editor__topbar",children:[(0,o.jsxs)("div",{className:"office-editor__name",children:[t,n&&(0,o.jsx)("span",{className:"office-editor__dirty",title:"有未保存的修改"})]}),(0,o.jsxs)("div",{className:"office-editor__ops",children:[h,i&&(0,o.jsx)("span",{className:"office-editor__saving",children:"保存中…"}),u&&(0,o.jsx)(s.rA,{icon:"save",title:"保存 (Ctrl+S)",onClick:()=>u()}),(0,o.jsx)(s.rA,{icon:"close",title:"关闭 (Esc)",onClick:y})]})]}),(0,o.jsxs)("div",{className:"office-editor__body",children:[c&&(0,o.jsx)("div",{className:"office-editor__tip",children:"加载中…"}),!c&&a&&(0,o.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:a}),!c&&!a&&d]})]})}},43187(e,t,n){n.r(t),n.d(t,{default:()=>d});var r=n(96540),s=n(34843),l=n(82893),o=n(42562),c=n(24935),a=n(99018),i=n(93245),u=n(23430),f=n(74848);function d(){const[e,t]=(0,s.fp)(l.AG.excel_editor),[n,d]=(0,r.useState)(!1),[h,m]=(0,r.useState)(!1),g=(0,r.useRef)(),x=async()=>{if(!g.current)return!1;m(!0);try{return await g.current()}finally{m(!1)}},p=(0,r.useRef)(n);return p.current=n,(0,i.a)(u.nE.excel,()=>p.current,()=>x()),(0,f.jsx)(o.A,{name:e.name,dirty:n,loading:!1,error:"",saving:h,on_save:x,on_close:()=>{const n=e.close;t({}),n?.()},children:e.url&&(0,f.jsx)(c.default,{url:e.url,save_path:(0,a.Vi)(e.name??""),on_dirty:d,bind_save:e=>g.current=e})})}},24935(e,t,n){n.r(t),n.d(t,{default:()=>b});var r=n(96540),s=n(47049),l=n(8890);const o=e=>Math.round(7*e+5),c=e=>Math.round(4*e/3);function a(e){return{toBytes:async()=>e}}function i(e,t){if(e){if(e.rgb){const t=String(e.rgb);return"#"+(8===t.length?t.slice(2):t)}return void 0!==e.theme&&t[e.theme]?"#"+function(e,t){if(!t)return e;const n=parseInt(e,16);return[n>>16&255,n>>8&255,255&n].map(e=>{const n=t<0?e*(1+t):e*(1-t)+255*t;return Math.round(n).toString(16).padStart(2,"0")}).join("").toUpperCase()}(t[e.theme],e.tint??0):void 0}}function u(e){const t=Math.round(864e5*(e-25569));return new Date(t)}function f(e,t){const n=e=>String(e).padStart(2,"0"),r=e.getUTCFullYear(),s=r%100,l=e.getUTCMonth()+1,o=e.getUTCDate(),c="日一二三四五六"[e.getUTCDay()];return t.replace(/;.*$/,"").replace(/\[[^\]]*\]/g,"").replace(/"[^"]*"/g,e=>e.slice(1,-1)).replace(/\\/g,"").replace(/yyyy/g,String(r)).replace(/yy/g,n(s)).replace(/(?<!m)m(?!m)/g,String(l)).replace(/mm/g,n(l)).replace(/d(?!d)/g,String(o)).replace(/dd/g,n(o)).replace(/aaaa/g,`星期${c}`)}const d=e=>!!e&&/[ymd]/i.test(e.replace(/"[^"]*"/g,""))&&!/[#0]/.test(e.replace(/"[^"]*"/g,""));function h(e,t,n){const r=e?.value;if(null==r)return{text:null};if("object"==typeof r){if(Array.isArray(r.runs)){const e=r.runs.map(e=>({text:e.text??"",color:i(e.font?.color,t)}));return{text:e.map(e=>e.text).join("")||null,runs:e.some(e=>e.color)?e:void 0}}if("string"==typeof r.text)return{text:r.text};const e=r.cachedValue??r.result;return void 0!==e?"number"==typeof e&&d(n)?{text:f(u(e),n)}:{text:String(e)}:{text:null}}return"number"==typeof r&&d(n)?{text:f(u(r),n)}:{text:String(r)}}function m(e,t,n){const r=e?.styleId;if(void 0===r)return;const s=t.cellXfs?.[r];if(!s)return;const l=t.fills?.[s.fillId],o=t.fonts?.[s.fontId],c={};"solid"===l?.patternType&&(c.bg=i(l.fgColor,n)),c.color=i(o?.color,n),o?.bold&&(c.bold=!0),o?.italic&&(c.italic=!0),o?.size&&(c.fontSize=o.size),o?.name&&(c.fontFamily=o.name),o?.underline&&(c.underline=!0),o?.strike&&(c.strike=!0);const a=s.alignment;return a?.horizontal&&["left","center","right"].includes(a.horizontal)&&(c.align=a.horizontal),a?.vertical&&(c.valign="center"===a.vertical?"middle":a.vertical),a?.wrapText&&(c.wrap=!0),a?.indent&&(c.indent=a.indent),Object.keys(c).length?c:void 0}function g(e,t){const n=e?.styleId;if(void 0===n)return;const r=t.cellXfs?.[n];if(!r)return;const s=r.numFmtId;if(void 0===s||0===s)return;const l={14:"m/d/yy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"m/d/yy h:mm",27:'yyyy"年"m"月"',28:'m"月"d"日"',29:'m"月"d"日"',30:"m-d-yy",31:'yyyy"年"m"月"d"日"',32:'h"时"mm"分"',33:'h"时"mm"分"ss"秒"',34:'上午/下午h"时"mm"分"',35:'上午/下午h"时"mm"分"ss"秒"',36:'yyyy"年"m"月"'};if(l[s])return l[s];const o=t.numFmts;return o instanceof Map?o.get(s):void 0}async function x(e){const t=await(0,s.a)(a(e)),n=function(e){const t=["FFFFFF","000000","EEECE1","1F497D","4F81BD","C0504D","9BBB59","8064A2","4BACC6","F79646"];if(!e)return t;const n="string"==typeof e?e:(new TextDecoder).decode(e),r=/<a:clrScheme[\s\S]*?<\/a:clrScheme>/.exec(n)?.[0];if(!r)return t;const s=[],l=/<a:(dk1|lt1|dk2|lt2|accent[1-6]|hlink|folHlink)>([\s\S]*?)<\/a:\1>/g,o=new Map;let c;for(;c=l.exec(r);){const e=/(?:lastClr|val)="([0-9A-Fa-f]{6})"/.exec(c[2])?.[1];e&&o.set(c[1],e.toUpperCase())}return["lt1","dk1","lt2","dk2","accent1","accent2","accent3","accent4","accent5","accent6"].forEach((e,n)=>s[n]=o.get(e)??t[n]),s}(t.themeXml);return t.sheets.map(e=>{const r=e.sheet,s=t.styles;let l=0,a=0;r.rows.forEach((e,t)=>{e.size&&(l=Math.max(l,t),e.forEach((e,t)=>{a=Math.max(a,t)}))});const i=[],u=new Map;for(let e=1;e<=l;e++){const t=[],l=r.rows.get(e);for(let r=1;r<=a;r++){const o=l?.get(r),c=h(o,n,g(o,s));t.push(c.text);const a=m(o,s,n);c.runs&&(a?a.runs=c.runs:u.set(`${e-1}_${r-1}`,{runs:c.runs})),a&&u.set(`${e-1}_${r-1}`,a)}i.push(t)}const f=o(r.defaultColumnWidth??8.43),d=new Array(a).fill(f);r.columnDimensions?.forEach(e=>{const t=o(e.width??8.43);for(let n=e.min;n<=e.max;n++)n-1<d.length&&(d[n-1]=t)});const x=c(r.defaultRowHeight??15),p=new Array(l).fill(x),y=new Set;r.rowDimensions?.forEach((e,t)=>{t-1<p.length&&e.height&&(p[t-1]=c(e.height)),e.hidden&&t-1<l&&y.add(t-1)});const _=(r.mergedCells??[]).map(e=>[(e.minRow??e.start?.row??1)-1,(e.minCol??e.start?.col??1)-1,(e.maxRow??e.end?.row??1)-1,(e.maxCol??e.end?.col??1)-1]);return{title:r.title,values:i,styles:u,col_widths:d,row_heights:p,hidden_rows:y,merges:_}})}var p=n(74848);function y(e){const{bytes:t,on_change:n,bind_save:o}=e,[c,i]=(0,r.useState)([]),[u,f]=(0,r.useState)(0),[,d]=(0,r.useState)(0),[h,m]=(0,r.useState)(""),g=(0,r.useRef)(!1),y=(0,r.useRef)(null),[w,b]=(0,r.useState)({r0:0,r1:40,c0:0,c1:20});(0,r.useEffect)(()=>{let e=!0;return m(""),x(t).then(t=>e&&i(t)).catch(t=>e&&m(String(t?.message??t))),()=>{e=!1}},[t]);const S=(0,r.useCallback)(()=>{g.current||(g.current=!0,n(!0))},[n]);(0,r.useEffect)(()=>{o(async()=>{const e=await async function(e,t){const n=await(0,s.a)(a(e));return t.forEach((e,t)=>{const r=n.sheets[t];if(!r)return;const s=r.sheet;e.values.forEach((e,t)=>{e.forEach((e,n)=>{const r=t+1,l=n+1;let o=s.rows.get(r);o||(o=new Map,s.rows.set(r,o));const c=o.get(l);null!==e&&""!==e?c?c.value=e:o.set(l,{row:r,col:l,value:e}):c&&(c.value=null)})})}),await(0,l.n)(n)}(t,c);return g.current=!1,n(!1),e})},[c,t,o,n]),(0,r.useEffect)(()=>{e.bind_view?.({get_state:()=>({sheet:u,scroll_left:y.current?.scrollLeft??0,scroll_top:y.current?.scrollTop??0}),set_state:e=>{"number"==typeof e.sheet&&e.sheet>=0&&e.sheet<c.length&&f(e.sheet);const t=y.current;t&&(t.scrollLeft=e.scroll_left??0,t.scrollTop=e.scroll_top??0)}})},[u,c.length,e.bind_view]);const C=c[u],{col_x:j,row_y:E,total_w:k,total_h:M}=r.useMemo(()=>{const e=C?.col_widths??[],t=C?.row_heights??[],n=[0];e.forEach((e,t)=>n.push(n[t]+(C?.hidden_rows.has(t)?0:e)));const r=[0];return t.forEach((e,t)=>r.push(r[t]+e)),{col_x:n,row_y:r,total_w:n[n.length-1]??0,total_h:r[r.length-1]??0}},[C]),N=(e,t)=>{let n=0,r=e.length-1;for(;n<r;){const s=n+r>>1;e[s]<t?n=s+1:r=s}return n},$=(0,r.useCallback)(()=>{const e=y.current;if(!e||!j.length)return;const t=Math.max(0,N(j,e.scrollLeft)-1),n=Math.max(0,N(E,e.scrollTop)-1);b({c0:t,c1:Math.min(j.length-1,N(j,e.scrollLeft+e.clientWidth)+2),r0:n,r1:Math.min(E.length-1,N(E,e.scrollTop+e.clientHeight)+2)})},[j,E]);(0,r.useEffect)(()=>{$()},[C,$]);if(h)return(0,p.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:h});if(!c.length)return(0,p.jsx)("div",{className:"office-editor__tip",children:"解析中…"});const F=C?.values??[],A=(E.length,j.length,new Set);C.merges.forEach(([e,t,n,r])=>{for(let s=e;s<=n;s++)for(let n=t;n<=r;n++)s===e&&n===t||A.add(`${s}_${n}`)});const D=(e,t)=>{const n=F[e]?.[t];return(null==n||""===n)&&!C.styles.get(`${e}_${t}`)?.bg};return(0,p.jsxs)("div",{className:"xlsx-body",children:[(0,p.jsx)("div",{className:"xlsx-tabs",children:c.map((e,t)=>(0,p.jsx)("div",{className:"xlsx-tab "+(t===u?"xlsx-tab--active":""),onClick:()=>{f(t),y.current&&(y.current.scrollTop=0,y.current.scrollLeft=0)},children:e.title},e.title+t))}),(0,p.jsx)("div",{className:"xlsx-scroll",ref:y,onScroll:$,children:(0,p.jsxs)("div",{className:"xlsx-grid",style:{width:46+k,height:24+M},children:[Array.from({length:Math.max(0,w.c1-w.c0)}).map((e,t)=>{const n=w.c0+t;return(0,p.jsx)("div",{className:"xlsx-head",style:{left:46+j[n],top:0,width:j[n+1]-j[n],height:24},children:v(n)},"ch"+n)}),Array.from({length:Math.max(0,w.r1-w.r0)}).map((e,t)=>{const n=w.r0+t;return(0,p.jsxs)(r.Fragment,{children:[(0,p.jsx)("div",{className:"xlsx-head xlsx-head--row",style:{left:0,top:24+E[n],width:46,height:E[n+1]-E[n]},children:n+1}),Array.from({length:Math.max(0,w.c1-w.c0)}).map((e,t)=>{const r=w.c0+t;if(A.has(`${n}_${r}`))return null;const s=C.merges.find(e=>e[0]===n&&e[1]===r),l=s?j[s[3]+1]-j[s[1]]:j[r+1]-j[r],o=s?E[s[2]+1]-E[s[0]]:E[n+1]-E[n];return(0,p.jsx)(_,{value:F[n]?.[r]??"",cell_style:C.styles.get(`${n}_${r}`),spillable:D(n,r+1),style:{left:46+j[r],top:24+E[n],width:l,height:o,zIndex:s?2:1},on_change:e=>((e,t,n)=>{const r=c[u];r&&(r.values[e][t]=""===n?null:n,S(),d(e=>e+1))})(n,r,e)},r)})]},n)})]})})]})}function _(e){const{value:t,cell_style:n,style:s,spillable:l,on_change:o}=e,[c,a]=(0,r.useState)(!1),[i,u]=(0,r.useState)(""),f=(0,r.useRef)(null);(0,r.useEffect)(()=>{c&&f.current&&(f.current.focus(),f.current.select())},[c]);const d=()=>{a(!1),i!==(t??"")&&o(i)},h={};return n?.bg&&(h.backgroundColor=n.bg),n?.color&&(h.color=n.color),n?.bold&&(h.fontWeight=600),n?.italic&&(h.fontStyle="italic"),n?.fontSize&&(h.fontSize=Math.round(4*n.fontSize/3*10)/10+"px"),n?.fontFamily&&(h.fontFamily=`"${n.fontFamily}", "PingFang SC", sans-serif`),n?.underline&&(h.textDecoration="underline"),n?.strike&&(h.textDecoration=h.textDecoration?`${h.textDecoration} line-through`:"line-through"),n?.align&&(h.textAlign=n.align,h.justifyContent="center"===n.align?"center":"right"===n.align?"flex-end":"flex-start"),n?.valign&&(h.alignItems="middle"===n.valign?"center":"bottom"===n.valign?"flex-end":"flex-start"),n?.wrap&&(h.whiteSpace="pre-wrap"),n?.indent&&(h.paddingLeft=.35+1.4*n.indent+"em"),(0,p.jsx)("div",{className:`xlsx-cell ${n?.wrap?"xlsx-cell--wrap":""} ${l?"xlsx-cell--spill":""}`,style:{...s,...h,"--cell-h":n?.wrap?"1.4":s.height-1+"px"},onDoubleClick:()=>{u(t??""),a(!0)},children:c?(0,p.jsx)("textarea",{ref:f,className:"xlsx-cell__input",value:i,onChange:e=>u(e.target.value),onBlur:d,onKeyDown:e=>{"Enter"!==e.key||e.shiftKey?"Escape"===e.key&&a(!1):(e.preventDefault(),d())}}):n?.runs?(0,p.jsx)("span",{children:n.runs.map((e,t)=>(0,p.jsx)("span",{style:e.color?{color:e.color}:void 0,children:e.text},t))}):t})}function v(e){let t="",n=e+1;for(;n>0;){const e=(n-1)%26;t=String.fromCharCode(65+e)+t,n=Math.floor((n-1)/26)}return t}var w=n(99018);function b(e){const{url:t,save_path:n,on_dirty:s,bind_save:l}=e,[o,c]=(0,r.useState)(),[a,i]=(0,r.useState)(""),[u,f]=(0,r.useState)(!0),[d,h]=(0,r.useState)(!1),m=(0,r.useRef)();return(0,r.useEffect)(()=>{if(!t)return;let e=!0;return f(!0),i(""),h(!1),c(void 0),(0,w.PQ)(t).then(t=>e&&c(t)).catch(t=>e&&i(String(t?.message??t))).finally(()=>e&&f(!1)),()=>{e=!1}},[t]),(0,r.useEffect)(()=>{s?.(d)},[d,s]),(0,r.useEffect)(()=>{l?.(async()=>{if(!m.current)return!1;const e=await m.current(),t=await(0,w.GB)(n,e);return t&&(c(e),h(!1)),t})},[n,l]),a?(0,p.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:a}):u||!o?(0,p.jsx)("div",{className:"office-editor__tip",children:"读取中…"}):(0,p.jsx)(y,{bytes:o,on_change:h,bind_save:e=>m.current=e,bind_view:e.bind_view})}},99018(e,t,n){n.d(t,{GB:()=>i,PQ:()=>a,Vi:()=>c});var r=n(14284),s=n(57889),l=n(34289),o=n(62042);function c(e){return`${encodeURIComponent((0,l.GG)("file",(0,l.vX)()))}${e}`}async function a(e){return s.l.get_bytes_url(e)}function i(e,t){return async function(e,t){const n=await r.$M.post(`save_bin/${e}`,{base64:u(t)});return 0===n.code||((0,o.zN)(n.message??"保存失败"),!1)}(function(e){const t=e.lastIndexOf("/");return t<0?encodeURIComponent(e):encodeURIComponent(e.slice(0,t))+e.slice(t)}(e),t)}function u(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[4350],{34350(e,t,n){n.r(t),n.d(t,{default:()=>T});var s=n(96540),o=n(82893),i=n(34843),l=n(85997),a=n(57952),r=n(3198),c=n(14284),d=n(34289),u=n(53459),m=n(32768),p=n(78247),h=n(62042),f=n(2543),_=n(34251),v=n(78150),x=n(22022),w=n(88815),y=n(52671),g=n(23430),j=n(87361),k=n(99214);const S="filecat_studio_view_state";function C(e,t){return`${e}::${t}`}function b(){try{const e=localStorage.getItem(S);if(!e)return{};const t=JSON.parse(e);return t&&"object"==typeof t?t:{}}catch(e){return{}}}function R(e){try{localStorage.setItem(S,JSON.stringify(e))}catch(e){}}function A(e,t){if(t)return b()[C(e,t)]}function $(e,t,n){if(!t)return;const s=b();s[C(e,t)]=n,R(s)}var I=n(72458),N=n(74848);const E=s.lazy(()=>Promise.all([n.e(122),n.e(4091)]).then(n.bind(n,84091))),M=s.lazy(()=>Promise.all([n.e(1384),n.e(1075),n.e(1142)]).then(n.bind(n,71142))),P=s.lazy(()=>n.e(4877).then(n.bind(n,64877))),U=s.lazy(()=>Promise.all([n.e(3277),n.e(9345)]).then(n.bind(n,49345))),z=s.lazy(()=>Promise.all([n.e(3140),n.e(5744)]).then(n.bind(n,16575))),D=s.lazy(()=>Promise.all([n.e(8725),n.e(2728),n.e(2130),n.e(5602),n.e(8781),n.e(6404)]).then(n.bind(n,35304))),F=s.lazy(()=>Promise.resolve().then(n.bind(n,20892))),L=s.lazy(()=>Promise.all([n.e(9861),n.e(1922),n.e(4935)]).then(n.bind(n,24935)));function G(e){return(0,_.uL)(e)===m.Iw.md}function K(e){return(0,_.uL)(e)===m.Iw.excalidraw}function W(e){return(0,_.uL)(e)===m.Iw.mind}function B(e){return(0,_.uL)(e)===m.Iw.timeline}function J(e){return(0,_.uL)(e)===m.Iw.excel}function T(e){const[t,n]=(0,s.useState)([]),[C,b]=(0,s.useState)(""),[R,T]=(0,s.useState)(!1),[X,H]=(0,s.useState)({path:"",name:""}),[O,V]=(0,s.useState)(0),[Y,Z]=(0,s.useState)([]),[q,Q]=(0,s.useState)(""),ee=(0,s.useRef)(""),te=(0,s.useRef)({path:"",name:""}),[ne,se]=(0,i.fp)(o.AG.confirm),[oe,ie]=(0,s.useState)(!1),[le,ae]=(0,i.fp)(o.AG.fileShellShow),[re,ce]=(0,i.fp)(o.AG.file_shell_hidden),de=(0,k.Cf)(),ue=(0,s.useRef)(null),me=(0,s.useRef)(null),[pe,he]=(0,s.useState)(!1),[fe,_e]=(0,s.useState)(16),[ve,xe]=(0,i.fp)(o.AG.showPrompt),{t:we}=(0,x.Bd)(),ye=(0,y.Zp)(),ge=G(X.name),je=K(X.name),ke=W(X.name),Se=B(X.name),Ce=J(X.name),be=(0,s.useRef)(null),Re=(0,s.useRef)(null),Ae=(0,s.useRef)(null),$e=(0,s.useRef)(null),Ie=(0,s.useRef)(null),Ne=(0,s.useRef)(null),Ee=(0,s.useRef)(null),[Me,Pe]=(0,s.useState)([]),[Ue,ze]=(0,s.useState)(-1),De=(0,s.useCallback)(()=>{const e=ee.current,t=te.current.name;if(!e)return;let n="ace";G(t)?n="md":K(t)?n="draw":W(t)?n="mind":B(t)?n="timeline":J(t)&&(n="excel");const s="ace"===n?Re.current:"draw"===n?Ae.current:"mind"===n?$e.current:"timeline"===n?Ie.current:"md"===n?be.current?{get_view_state:()=>({scroll:be.current?.get_scroll()??0})}:null:"excel"===n?Ee.current:null,o=s?.get_view_state?.();o&&$(n,e,o)},[]),[Fe,Le]=(0,s.useState)("folder"),[Ge,Ke]=(0,s.useState)(!0),We=(0,k.oT)(),[Be]=(0,y.ok)(),Je="1"===Be.get("chat_open"),[Te,Xe]=(0,i.fp)(o.AG.studio_chat_width),He=(0,s.useRef)(null),[Oe,Ve]=(0,s.useState)(!1),[Ye,Ze]=(0,s.useState)(void 0),[qe,Qe]=(0,i.fp)(o.AG.ai_chat_session_by_cwd),et=(0,y.zy)(),tt=(()=>{const e=`${j.o.studio_page}/`,t=et.pathname.startsWith(e)?et.pathname.slice(e.length):"",n=(0,d.GG)("file",decodeURIComponent(t));return n.endsWith("/")?n:`${n}/`})(),{check_user_auth:nt}=(0,p.MH)(),[st]=(0,i.fp)(o.AG.user_base_info),ot=nt(g.oV.ai_agent_page);(0,s.useEffect)(()=>{st?.user_data&&Je&&!ot&&We("chat_open",null)},[Je,ot,st]);const it=(0,I.Jn)(g.nM.get_now_dir(st),tt);(0,k.rJ)(it);const lt=async()=>{const e=tt;b(e);const t=await c.$M.post("studio/get/item",{path:e});if(t.code===u.m.Success){const e=[],s=[];for(const n of t.data.list)"folder"===n.type?e.push(n):"file"===n.type&&s.push(n);n([...e,...s])}},at=(e,t)=>e===t||e.startsWith(t+"/");(0,s.useEffect)(()=>{ie(!1),H({path:"",name:""}),Q(""),p.xK.set_value_temp(""),Z([]),lt()},[et]);const rt=async(e,t)=>{if(De(),p.xK.set_value_temp(""),!J(e)){const e=await c.$M.get(`${encodeURIComponent(t)}`);p.xK.set_value_temp(e.data)}H({path:t,name:e}),Q(t),ee.current=t,te.current={path:t,name:e},Le("folder"),ie(!1)},ct=(e,t)=>{e.size>w.o5?se({open:!0,handle:()=>{rt(e.name,t),se({open:!1,handle:null}),ie(!1)},title:"超过20MB了还要打开吗?"}):rt(e.name,t)};function dt(){Re.current?.save()}const ut=e=>{if(e.ctrlKey&&"s"===e.key){if(e.preventDefault(),ge||je||ke||Se||Ce)return;oe&&dt()}};(0,s.useEffect)(()=>(document.addEventListener("keydown",ut),()=>{document.removeEventListener("keydown",ut)}),[oe,ge,je,ke,Se,Ce]);const mt=(0,s.useCallback)(f.throttle(e=>{const t=parseFloat(getComputedStyle(me.current).fontSize),n=window.innerWidth/t-4,s=e.clientX/t,o=2.25+ue.current.offsetWidth/t;s<=n&&s>=o&&_e(parseFloat(s.toFixed(2)))},32),[]),pt=()=>{he(!1),me.current.removeEventListener("pointermove",mt)},ht=(0,s.useCallback)(f.throttle(e=>{const t=He.current;if(!t)return;const n=parseFloat(getComputedStyle(t).fontSize),s=t.parentElement.getBoundingClientRect().right-e.clientX,o=Math.min(Math.max(s,0),t.parentElement.getBoundingClientRect().width);Xe(parseFloat((o/n).toFixed(2)))},32),[]),ft=()=>{Ve(!1),document.removeEventListener("pointermove",ht)},_t=[{r:we("创建文件"),v:"创建文件"},{r:we("创建目录"),v:"创建目录"},{r:we("重命名"),v:"重命名"},{r:we("删除"),v:"删除"}],vt=[{r:we("重命名"),v:"重命名"},{r:we("删除"),v:"删除"}],xt=(e,t,n,s,o)=>{e.preventDefault();const i=new _.ik;i.path=n,i.filename=t,i.x=e.clientX,i.y=e.clientY,i.items=s?_t:vt,o===lt&&(i.items=i.items.slice(0,2)),i.type=s?m.Iw.studio_folder:m.Iw.studio_file;const l=e=>{o(e)};i.textClick=e=>{switch(e){case"创建文件":xe({show:!0,type:v.PromptEnum.FileNew,overlay:!0,data:{dir:n,call:l}});break;case"创建目录":xe({show:!0,type:v.PromptEnum.DirNew,overlay:!0,data:{dir:n,call:l}});break;case"删除":if(oe&&(X.path===n||X.path.includes(n))){const e=()=>{l(s),ie(!1),H({}),p.xK.set_value_temp("")};xe({show:!0,type:v.PromptEnum.FilesDelete,overlay:!0,data:{path:n,call:e,filename:t}});break}xe({show:!0,type:v.PromptEnum.FilesDelete,overlay:!0,data:{path:n,filename:t,call:s?()=>{l(!0)}:l}});break;case"重命名":xe({show:!0,type:v.PromptEnum.FileRename,overlay:!0,data:{path:n,dir:(0,d.Yp)(n),call:(e,t)=>{((e,t)=>{if(q&&at(q,e)){const n=t+q.slice(e.length);Q(n),H({path:n,name:(0,d.mH)(n)})}const n=(0,d.oW)(tt);if(at(n,e)){const s=t+n.slice(e.length);return void ye(`${j.o.studio_page}/${encodeURIComponent(`/file/${s}`)}`,{replace:!0})}V(e=>e+1),lt()})(e,t)},filename:t}})}},xe({show:!0,type:v.PromptEnum.FileMenu,overlay:!1,data:i})};const wt=ge&&"outline"===Fe;return(0,N.jsxs)("div",{className:"studio studio--file",children:[(0,N.jsxs)(a.A,{ignore_tags:!0,left_children:[(0,N.jsx)(l.rA,{title:"取消",icon:"close",onClick:()=>{De(),function(){try{localStorage.removeItem(S)}catch(e){}}(),ae({show:!1,path:""}),ce(void 0),ye(-1)}},1),(0,N.jsx)("div",{children:X.name},2)],children:[(0,N.jsx)("title",{children:X.name}),(0,N.jsx)(l.rA,{title:"侧边栏",icon:"list",onClick:()=>Ke(e=>!e),selected:Ge}),ge&&[(0,N.jsx)(l.rA,{icon:"source"===be.current?.mode()?"edit":"code",title:"source"===be.current?.mode()?we("实时编辑模式"):we("源码模式"),onClick:()=>be.current?.toggle_mode()},"mode"),(0,N.jsx)(l.rA,{title:we("导出PDF"),icon:"print",onClick:()=>be.current?.export_pdf()},"pdf")],!ge&&(0,_.zr)(X.name)&&(0,N.jsx)(l.rA,{title:"格式化",icon:"data_object",onClick:function(){p.xK.get_editor()?.formatCode()}}),de.can_terminal&&(0,N.jsx)(l.rA,{icon:"terminal",title:"shell",onClick:function(){!0!==re&&!1!==re?le.show?ae({show:!1,path:""}):(ae({show:!0,path:tt}),ce(!1)):ce(!re)}}),nt(g.oV.ai_agent_page)&&de.ai_chat_available&&(0,N.jsx)(l.rA,{title:we("AI 聊天"),icon:"smart_toy",selected:Je,onClick:()=>We("chat_open",!Je?"1":null)}),oe&&(ge?(0,N.jsx)(l.rA,{title:we("保存"),icon:"save",onClick:()=>be.current?.save()}):je?(0,N.jsx)(l.rA,{title:we("保存"),icon:"save",onClick:()=>Ae.current?.save()}):ke?(0,N.jsx)(l.rA,{title:we("保存"),icon:"save",onClick:()=>$e.current?.save()}):Se?(0,N.jsx)(l.rA,{title:we("保存"),icon:"save",onClick:()=>Ie.current?.save()}):Ce?(0,N.jsx)(l.rA,{title:we("保存"),icon:"save",onClick:()=>Ne.current?.save()}):(0,N.jsx)(l.rA,{title:we("保存"),icon:"save",onClick:dt}))]}),(0,N.jsxs)("div",{className:"studio-body",ref:me,children:[(0,N.jsxs)("div",{className:"studio-nav",style:{display:Ge?void 0:"none",width:fe-1+"em"},onContextMenu:e=>{xt(e,X.name,tt,!0,lt)},children:[(0,N.jsx)("div",{className:"studio-nav-outline",style:{display:wt?void 0:"none"},children:(0,N.jsx)(P,{items:Me,active_pos:Ue,on_click:e=>be.current?.goto_heading(e)})}),(0,N.jsx)("div",{className:"studio-nav-folder",style:{display:wt?"none":void 0},children:(0,N.jsx)(s.Fragment,{children:(0,N.jsx)(r.z,{pre_path:C,list:t,click:async(e,t,n)=>{if("folder"===e.type){Z(e=>e.includes(n)?e:[...e,n]);const e=await c.$M.post("studio/get/item",{path:`${n}`});if(e.code===u.m.Success){const n=[],s=[];for(const t of e.data.list)"folder"===t.type?n.push(t):"file"===t.type&&s.push(t);t([...n,...s])}}else{if(oe)return void se({open:!0,handle:()=>{se({open:!1,handle:null}),ie(!1),ct(e,n)},title:"确定不保存就切换吗?"});ct(e,n)}},active_path:q,expand_paths:Y,handleContextMenu:xt,fatherNowToggleExpansion:lt})},O)}),ge&&(0,N.jsx)("div",{className:"studio-nav-switch",children:(0,N.jsx)(l.rA,{icon:wt?"folder":"list",title:we(wt?"文件目录":"大纲"),onClick:()=>Le(wt?"folder":"outline")})})]}),Ge&&(0,N.jsx)("div",{className:"studio__divider",ref:ue,onPointerDown:()=>{he(!0),me.current.addEventListener("pointermove",mt)},onPointerUp:pt}),pe&&(0,N.jsx)("div",{className:"shell__overlay",onPointerUp:pt}),ge?(0,N.jsx)("div",{className:"studio-editor studio-editor--md",children:(0,N.jsx)(s.Suspense,{fallback:null,children:(0,N.jsx)(M,{pane:{path:q,url:c.$M.getDownloadUrl(encodeURIComponent(q)),name:X.name,on_dirty:ie,on_outline:(e,t)=>{Pe(e),ze(t)},register:e=>{be.current=e;const t=A("md",q);if(!t?.scroll)return;const n=t.scroll;let s=0;const o=()=>{++s>40||(e.set_scroll(n),e.get_scroll()!==n&&window.setTimeout(o,50))};window.setTimeout(o,50)}}})})},q):je?(0,N.jsx)("div",{className:"studio-editor studio-editor--draw",children:(0,N.jsx)(s.Suspense,{fallback:null,children:(0,N.jsx)(z,{reset_key:q,view_state:A("draw",q),url:c.$M.getDownloadUrl(encodeURIComponent(q)),save_path:q,on_dirty:ie,on_saved:()=>ie(!1),register:e=>{Ae.current=e}})})},q):ke?(0,N.jsx)("div",{className:"studio-editor studio-editor--mind",children:(0,N.jsx)(s.Suspense,{fallback:null,children:(0,N.jsx)(D,{reset_key:q,view_state:A("mind",q),url:c.$M.getDownloadUrl(encodeURIComponent(q)),on_dirty:ie,on_saved:()=>ie(!1),register:e=>{$e.current=e},on_save:async e=>(await c.$M.post(`save/${encodeURIComponent(q)}`,{context:e})).code===u.m.Success})})},q):Se?(0,N.jsx)("div",{className:"studio-editor studio-editor--timeline",children:(0,N.jsx)(s.Suspense,{fallback:null,children:(0,N.jsx)(F,{reset_key:q,view_state:A("timeline",q),url:c.$M.getDownloadUrl(encodeURIComponent(q)),on_dirty:ie,register:e=>{Ie.current=e},on_save:async e=>(await c.$M.post(`save/${encodeURIComponent(q)}`,{context:e})).code===u.m.Success})})},q):Ce?(0,N.jsx)("div",{className:"studio-editor studio-editor--excel",children:(0,N.jsx)(s.Suspense,{fallback:null,children:(0,N.jsx)(L,{url:c.$M.getDownloadUrl(encodeURIComponent(q)),save_path:q,on_dirty:ie,bind_save:e=>{Ne.current={save:e}},bind_view:e=>{const t=A("excel",q);Ee.current={get_view_state:()=>{const t=e.get_state();return{sheet:t.sheet,scroll_x:t.scroll_left,scroll_y:t.scroll_top}}},t&&e.set_state({sheet:t.sheet,scroll_left:t.scroll_x,scroll_top:t.scroll_y})}})})},q):(0,N.jsx)("div",{className:"studio-editor",children:X.name&&(0,N.jsx)(s.Suspense,{fallback:null,children:(0,N.jsx)(E,{name:X.name,on_dirty:ie,view_state:A("ace",q),on_view_state:e=>$("ace",q,e),register:e=>{Re.current=e},save:async e=>{const t={context:p.xK.get_editor_value()},n=await c.$M.post(`save/${encodeURIComponent(q)}`,t);return n.code===u.m.Success||e||(0,h.zN)(we("保存失败")),n.code===u.m.Success}})})},q),Je&&(0,N.jsxs)(s.Fragment,{children:[(0,N.jsx)("div",{className:"studio__divider studio__divider--chat",ref:He,onPointerDown:e=>{e.preventDefault(),Ve(!0),document.addEventListener("pointermove",ht),document.addEventListener("pointerup",ft,{once:!0})}}),(0,N.jsx)("div",{className:"studio-chat-panel",style:{width:`${Te}em`},children:(0,N.jsx)(s.Suspense,{fallback:null,children:(0,N.jsx)(U,{inline_header:!0,sync_url:!1,file_cwd_path:it,session_id:Ye??(yt=it,o.AG.get_ai_chat_session(qe,yt)),on_session_change:e=>{Ze(e),((e,t)=>{Qe({...qe,[e]:t})})(it,e)}})})})]})]})]});var yt}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[7212],{42562(e,t,r){r.d(t,{A:()=>a});var n=r(96540),s=r(85997),i=r(45907),c=r(74848);function a(e){const{name:t,dirty:r,loading:a,error:o,saving:u,on_save:f,on_close:l,children:d,extra:_}=e,p=(0,i.y)(),v=(0,n.useRef)(l),m=(0,n.useRef)(f),y=(0,n.useRef)(r);v.current=l,m.current=f,y.current=r;const h=()=>{y.current?p({title:"关闭",sub_title:"有未保存的修改,确定关闭吗?",confirm_fun:()=>v.current?.()}):v.current?.()};return(0,n.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key.toLowerCase()?(e.preventDefault(),e.stopPropagation(),m.current?.()):"Escape"===e.key&&h()};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[]),(0,c.jsxs)("div",{className:"office-editor",children:[(0,c.jsxs)("div",{className:"office-editor__topbar",children:[(0,c.jsxs)("div",{className:"office-editor__name",children:[t,r&&(0,c.jsx)("span",{className:"office-editor__dirty",title:"有未保存的修改"})]}),(0,c.jsxs)("div",{className:"office-editor__ops",children:[_,u&&(0,c.jsx)("span",{className:"office-editor__saving",children:"保存中…"}),f&&(0,c.jsx)(s.rA,{icon:"save",title:"保存 (Ctrl+S)",onClick:()=>f()}),(0,c.jsx)(s.rA,{icon:"close",title:"关闭 (Esc)",onClick:h})]})]}),(0,c.jsxs)("div",{className:"office-editor__body",children:[a&&(0,c.jsx)("div",{className:"office-editor__tip",children:"加载中…"}),!a&&o&&(0,c.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:o}),!a&&!o&&d]})]})}},47212(e,t,r){r.r(t),r.d(t,{default:()=>_});var n=r(96540),s=r(34843),i=r(82893),c=r(42562),a=r(50610),o=r(99018),u=r(74848);function f(e){const{url:t,save_path:r,file_name:s,on_dirty:i,bind_save:c}=e,f=(0,n.useRef)(null),l=(0,n.useRef)(),[d,_]=(0,n.useState)(""),[p,v]=(0,n.useState)(!0);return(0,n.useEffect)(()=>{if(!t)return;const e=f.current;if(!e)return;let n,i=!0;return v(!0),_(""),(0,o.PQ)(t).then(t=>{i&&(n=(0,a.t)(e,{source:t,fileName:s,onSave:async e=>await(0,o.GB)(r,e),autoSave:!0,compact:!0}))}).catch(e=>{i&&_(String(e?.message??e))}).finally(()=>i&&v(!1)),()=>{i=!1,n?.destroy(),l.current=void 0}},[t,s,r]),(0,n.useEffect)(()=>{c?.(async()=>{const e=l.current;return!!e&&(await e.save(),!e.dirty)})},[c]),(0,u.jsxs)("div",{className:"pptx-pane",children:[d&&(0,u.jsx)("div",{className:"office-editor__tip office-editor__tip--error",children:d}),p&&!d&&(0,u.jsx)("div",{className:"office-editor__tip",children:"读取中…"}),(0,u.jsx)("div",{className:"pptx-pane__host",ref:f})]})}var l=r(93245),d=r(23430);function _(){const[e,t]=(0,s.fp)(i.AG.pptx_editor),[r,a]=(0,n.useState)(!1),[_,p]=(0,n.useState)(!1),v=(0,n.useRef)(),m=async()=>{if(!v.current)return!1;p(!0);try{return await v.current()}finally{p(!1)}},y=(0,n.useRef)(r);return y.current=r,(0,l.a)(d.nE.pptx,()=>y.current,()=>m()),(0,u.jsx)(c.A,{name:e.name,dirty:r,loading:!1,error:"",saving:_,on_save:m,on_close:()=>{const r=e.close;t({}),r?.()},children:e.url&&(0,u.jsx)(f,{url:e.url,file_name:e.name??"",save_path:(0,o.Vi)(e.name??""),on_dirty:a,bind_save:e=>v.current=e})})}},99018(e,t,r){r.d(t,{GB:()=>u,PQ:()=>o,Vi:()=>a});var n=r(14284),s=r(57889),i=r(34289),c=r(62042);function a(e){return`${encodeURIComponent((0,i.GG)("file",(0,i.vX)()))}${e}`}async function o(e){return s.l.get_bytes_url(e)}function u(e,t){return async function(e,t){const r=await n.$M.post(`save_bin/${e}`,{base64:f(t)});return 0===r.code||((0,c.zN)(r.message??"保存失败"),!1)}(function(e){const t=e.lastIndexOf("/");return t<0?encodeURIComponent(e):encodeURIComponent(e.slice(0,t))+e.slice(t)}(e),t)}function f(e){let t="";for(let r=0;r<e.length;r+=32768)t+=String.fromCharCode(...e.subarray(r,r+32768));return btoa(t)}}}]);
|