@gientech/modual 2.2.22 → 2.2.25

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 (36) hide show
  1. package/assets/GientechStreamReader-Bmx4xCIT.js +151 -0
  2. package/assets/{circle-plus-P1B4Xn23.js → circle-plus-2ioHM-Sb.js} +1 -1
  3. package/assets/index-B2xoLI6Z.js +535 -0
  4. package/assets/index-BAXnOsup.js +157 -0
  5. package/assets/{x-cAgrXVQW.js → loader-circle-B52xZ7Tn.js} +2 -2
  6. package/assets/{plus-Dksaa79Q.js → plus-Cok3acFd.js} +1 -1
  7. package/assets/{search-DPX4n-TM.js → search-BfgWf2Me.js} +1 -1
  8. package/assets/style-_hD7QhoC.js +332 -0
  9. package/assets/{triangle-alert-DwIOmwma.js → triangle-alert-Dm0U8aST.js} +1 -1
  10. package/assets/x-CX-iE6EL.js +26 -0
  11. package/assistantConfig.js +1 -152
  12. package/chat.js +1 -1
  13. package/chatCompare.js +1 -1
  14. package/database.js +2 -2
  15. package/databaseId.js +16 -1
  16. package/databaseTable.js +2 -2
  17. package/index.js +1 -1
  18. package/modelManage.js +2 -2
  19. package/package.json +17 -1
  20. package/sensitive.js +30 -50
  21. package/sensitiveWords.js +1 -1
  22. package/streamFilesReader.js +1 -1
  23. package/assets/GientechStreamReader-CCAVgoU7.js +0 -449
  24. package/assets/LeftOutlined-6ZZOHHzZ.js +0 -1
  25. package/assets/index-AbRL5gZq.js +0 -27
  26. package/assets/index-BVGi9GLj.js +0 -6
  27. package/assets/index-CshF4ZrU.js +0 -1519
  28. package/assets/index-Cxdo0VA9.js +0 -16
  29. package/assets/index-DBBlFPQ7.js +0 -13
  30. package/assets/index-DBcQE2Ji.js +0 -1
  31. package/assets/index-DSsXFuyz.js +0 -943
  32. package/assets/index-DXFiVEll.js +0 -2177
  33. package/assets/index-D_Hj7QNz.js +0 -285
  34. package/assets/index-DgYjqte0.js +0 -745
  35. package/assets/index-VLFjDTvh.js +0 -1
  36. package/assets/style-403S9iLe.js +0 -196
@@ -0,0 +1,151 @@
1
+ import{jsxs as x,jsx as s,Fragment as gu}from"react/jsx-runtime";import zu,{useState as $,useRef as S,useEffect as ou,useCallback as d,useMemo as Tu}from"react";import M from"styled-components";import du from"axios";import{parseFile as Cu,Fviewer as Fu}from"@mxmweb/fviewer";import{c as K,X as uo}from"./x-CX-iE6EL.js";/**
2
+ * @license lucide-react v0.456.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const oo=K("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
7
+ * @license lucide-react v0.456.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const eo=K("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
12
+ * @license lucide-react v0.456.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const to=K("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
17
+ * @license lucide-react v0.456.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const no=K("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
22
+ * @license lucide-react v0.456.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const ro=K("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
27
+ * @license lucide-react v0.456.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const ao=K("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
32
+ * @license lucide-react v0.456.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const so=K("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/**
37
+ * @license lucide-react v0.456.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */const co=K("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),lo=M.div`
42
+ display: flex;
43
+ align-items: center;
44
+ padding: 0px 12px;
45
+ justify-content: space-between;
46
+ padding: ${t=>t.$theme.space.padding};
47
+ border-bottom: 1px solid ${t=>t.$theme.colors.border};
48
+ background: ${t=>t.$theme.colors.background};
49
+ min-height: 52px;
50
+ `,Fo=M.div`
51
+ display: flex;
52
+ align-items: center;
53
+ gap: 8px;
54
+ flex: 1;
55
+ min-width: 0;
56
+ `,io=M.div`
57
+ font-size: 14px;
58
+ font-weight: 500;
59
+ color: ${t=>t.$theme.colors.text};
60
+ white-space: nowrap;
61
+ overflow: hidden;
62
+ text-overflow: ellipsis;
63
+ `,Do=M.div`
64
+ font-size: 12px;
65
+ color: ${t=>t.$theme.colors.disabledText};
66
+ white-space: nowrap;
67
+ `,ho=M.div`
68
+ display: flex;
69
+ align-items: center;
70
+ gap: 4px;
71
+ `,j=M.button`
72
+ display: flex;
73
+ align-items: center;
74
+ justify-content: center;
75
+ width: 32px;
76
+ height: 32px;
77
+ border: none;
78
+ border-radius: ${t=>t.$theme.space.radius};
79
+ background: ${t=>t.$active?t.$theme.colors.primary+"20":"transparent"};
80
+ color: ${t=>t.$active?t.$theme.colors.primary:t.$theme.colors.text};
81
+ cursor: pointer;
82
+ transition: all 0.2s ease;
83
+
84
+ &:hover {
85
+ background: ${t=>t.$theme.colors.primary+"10"};
86
+ color: ${t=>t.$theme.colors.primary};
87
+ }
88
+
89
+ &:disabled {
90
+ opacity: 0.5;
91
+ cursor: not-allowed;
92
+ }
93
+ `,go=M.div`
94
+ font-size: 12px;
95
+ color: ${t=>t.$theme.colors.disabledText};
96
+ min-width: 40px;
97
+ text-align: center;
98
+ `,Co={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"md",size:"md",radius:"md",padding:"md",margin:"md",shadow:"md",lineHeight:"md"}},Lu=zu.memo(({fileName:t="\u672A\u77E5\u6587\u4EF6",currentPage:l=1,totalPage:e=0,tools:g={annotation:!0,download:!0,zoom:!0,close:!0,navigation:!0,rotate:!0},styles:b,onPrevPage:eu,onNextPage:h,onZoomIn:U,onZoomOut:C,onAnnotationToggle:P,onDownload:D,onRotateLeft:c,onRotateRight:N,onClose:p,scale:B=1,isAnnotating:W=!1,className:tu})=>{const F=(b==null?void 0:b.theme)||Co;return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:",l,"totalPage:",e),x(lo,{$theme:F,className:tu,children:[s(Fo,{$theme:F,children:s(io,{$theme:F,children:t})}),x(ho,{$theme:F,children:[g.navigation&&x(gu,{children:[s(j,{$theme:F,onClick:eu,disabled:l<=1,title:"\u4E0A\u4E00\u9875",children:s(oo,{size:16})}),e>0&&x(Do,{$theme:F,children:[l," / ",e]}),s(j,{$theme:F,onClick:h,disabled:!e||l>=e,title:"\u4E0B\u4E00\u9875",children:s(eo,{size:16})})]}),g.zoom&&x(gu,{children:[s(j,{$theme:F,onClick:C,disabled:B<=.3,title:"\u7F29\u5C0F",children:s(co,{size:16})}),x(go,{$theme:F,children:[Math.round(B*100),"%"]}),s(j,{$theme:F,onClick:U,disabled:B>=3,title:"\u653E\u5927",children:s(so,{size:16})})]}),g.annotation&&s(j,{$theme:F,$active:W,onClick:P,title:W?"\u9000\u51FA\u6807\u6CE8":"\u5F00\u59CB\u6807\u6CE8",children:s(no,{size:16})}),g.download&&s(j,{$theme:F,onClick:D,title:"\u4E0B\u8F7D",children:s(to,{size:16})}),g.rotate&&x(gu,{children:[s(j,{$theme:F,onClick:c,title:"\u5411\u5DE6\u65CB\u8F6C",children:s(ro,{size:16})}),s(j,{$theme:F,onClick:N,title:"\u5411\u53F3\u65CB\u8F6C",children:s(ao,{size:16})})]}),g.close&&s(j,{$theme:F,onClick:p,title:"\u5173\u95ED",children:s(uo,{size:16})})]})]})}),fu=M.div`
99
+ display: flex;
100
+ flex-direction: column;
101
+ height: 100%;
102
+ width: 100%;
103
+ background: ${t=>t.$theme.colors.background};
104
+ border: 1px solid ${t=>t.$theme.colors.border};
105
+ border-radius: ${t=>t.$theme.space.radius};
106
+ overflow: hidden;
107
+ min-height: 0;
108
+ position: relative; // 添加相对定位,用于loading遮罩的绝对定位
109
+
110
+ /* 添加动画样式 */
111
+ @keyframes spin {
112
+ 0% {
113
+ transform: rotate(0deg);
114
+ }
115
+ 100% {
116
+ transform: rotate(360deg);
117
+ }
118
+ }
119
+ `,fo=({status:t,theme:l})=>x("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:"40px",background:l.colors.background},children:[x("div",{style:{position:"relative",width:"80px",height:"80px",marginBottom:"24px"},children:[s("div",{style:{width:"60px",height:"80px",background:l.colors.primary,borderRadius:"8px 8px 0 0",position:"relative",margin:"0 auto"},children:s("div",{style:{position:"absolute",top:"0",right:"0",width:"0",height:"0",borderStyle:"solid",borderWidth:"0 20px 20px 0",borderColor:`transparent ${l.colors.background} transparent transparent`}})}),s("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"20px",height:"20px",borderRadius:"50%",background:l.colors.background,animation:"pulse 1.5s ease-in-out infinite"}})]}),s("div",{style:{fontSize:"16px",fontWeight:"500",color:l.colors.text,marginBottom:"8px",textAlign:"center"},children:t}),s("div",{style:{width:"200px",height:"4px",background:l.colors.border,borderRadius:"2px",overflow:"hidden",position:"relative"},children:s("div",{style:{width:"30%",height:"100%",background:l.colors.primary,borderRadius:"2px",animation:"loading-progress 2s ease-in-out infinite"}})}),s("style",{children:`
120
+ @keyframes pulse {
121
+ 0%, 100% {
122
+ opacity: 1;
123
+ transform: translate(-50%, -50%) scale(1);
124
+ }
125
+ 50% {
126
+ opacity: 0.5;
127
+ transform: translate(-50%, -50%) scale(1.1);
128
+ }
129
+ }
130
+
131
+ @keyframes loading-progress {
132
+ 0% {
133
+ transform: translateX(-100%);
134
+ }
135
+ 50% {
136
+ transform: translateX(0%);
137
+ }
138
+ 100% {
139
+ transform: translateX(100%);
140
+ }
141
+ }
142
+ `})]}),mo=M.div`
143
+ display: flex;
144
+ flex-direction: column;
145
+ align-items: center;
146
+ justify-content: center;
147
+ height: 100%;
148
+ color: ${t=>t.$theme.colors.error};
149
+ text-align: center;
150
+ padding: 20px;
151
+ `,Bo="http://10.15.12.13:9005/proxy/index/knowledgeBase/file/stream",A=300*1e3,Eo={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"12px",size:"12px",radius:"4px",padding:"8px 12px",margin:"4px",shadow:"0 2px 4px rgba(0,0,0,0.1)",lineHeight:"1.5"}};function Su(t){const l=new TextDecoder("utf-8",{fatal:!1}).decode(t),e=(l.match(/\uFFFD/g)||[]).length;if(e===0||l.length<20)return l;try{const g=new TextDecoder("gb18030",{fatal:!1}).decode(t);return(g.match(/\uFFFD/g)||[]).length<e?g:l}catch{return l}}const Ro=({convertedFilePath:t,fileName:l,fileType:e,csrfToken:g,initialPage:b=1,initialZoom:eu=1,totalPages:h,annotations:U=[],pageSize:C=5,streamApiUrl:P=Bo,authorization:D,eventsEmit:c=()=>{},tools:N,styles:p,customComponents:B,className:W,headerClass:tu,contentClass:F})=>{const[nu,f]=$(!0),[mu,m]=$("\u6B63\u5728\u52A0\u8F7D\u6587\u6863..."),[ru,v]=$(null),[R,X]=$(b),[E,Y]=$(h||0),[y,Bu]=$(eu),[z,iu]=$(0),[Ku,Eu]=$(null),[wu,ku]=$(null),[q,$u]=$(""),[xu,au]=$(null),[pu,Au]=$(null),[Du,su]=$({}),J=S(!1),T=S(!1),Q=S({}),_=S({}),V=S(null),Xu=S(null),Z=S(b),bu=S(0);bu.current+=1,console.log("[GientechStreamReader] render count:",bu.current),console.log("[GientechStreamReader] props snapshot (early):",{fileType:e,currentPage:R,totalPages:E,hasMarkdown:!!q,hasImage:!!wu,hasText:!!xu,hasHtml:!!pu,isLoading:nu,error:ru});const G=(p==null?void 0:p.theme)||Eo;ou(()=>{J.current=!1,T.current=!1},[e,t]);const H=d(()=>{const u={annotation:!0,download:!0,zoom:!0,close:!0,navigation:!0,rotate:!1};let o;switch(e){case"pdf":case"pdf_slides":o={...u,annotation:!1,download:!1,navigation:!0,rotate:!1};break;case"image":o={...u,annotation:!1,download:!1,navigation:!1,rotate:!0,zoom:!0};break;case"markdown":case"markdown_table":o={...u,annotation:!1,download:!1,navigation:!1,rotate:!1,zoom:!1};break;case"text":case"html":case"unknown":o={...u,annotation:!1,download:!1,navigation:!1,rotate:!1,zoom:!1};break;default:o=u}return N?{...o,...N}:o},[e,N])(),L=d((u,o)=>{const r=Math.floor((u-1)/o)*o+1;return`${r}-${r+o-1}`},[]),Pu=d(async u=>{var w;if(!(e==="pdf"||e==="pdf_slides"))return console.log(`\u6587\u4EF6\u7C7B\u578B ${e} \u4E0D\u662FPDF\uFF0C\u8DF3\u8FC7\u7F13\u5B58\u68C0\u67E5`),null;console.log(`\u68C0\u67E5\u9875\u9762 ${u} \u662F\u5426\u5728\u7F13\u5B58\u4E2D`);const r=Q.current[u];if(r&&Date.now()-r.timestamp<A)return console.log(`\u4F7F\u7528\u5355\u4E2A\u9875\u9762\u7F13\u5B58: ${u}`),r.pdfDocument?(console.log(`\u76F4\u63A5\u8FD4\u56DE\u7F13\u5B58\u7684PDF\u6587\u6863: ${u}`),r.pdfDocument):null;const n=L(u,C),a=_.current[n];if(console.log(`\u68C0\u67E5chunk\u7F13\u5B58: ${n}, \u5B58\u5728: ${!!a}, \u5305\u542B\u9875\u9762: ${((w=a==null?void 0:a.pages)==null?void 0:w.join(", "))||"\u65E0"}`),a&&Date.now()-a.timestamp<A){if(a.pages.includes(u))return console.log(`\u4F7F\u7528chunk\u7F13\u5B58: ${u} (chunk: ${n})`),a.pdfDocument?(console.log(`\u76F4\u63A5\u8FD4\u56DE\u7F13\u5B58\u7684PDF\u6587\u6863: ${u}`),a.pdfDocument):null;console.log(`\u9875\u9762 ${u} \u4E0D\u5728chunk ${n} \u4E2D\uFF0Cchunk\u5305\u542B: ${a.pages.join(", ")}`)}return console.log(`\u9875\u9762 ${u} \u4E0D\u5728\u4EFB\u4F55\u7F13\u5B58\u4E2D\uFF0C\u9700\u8981\u91CD\u65B0\u8BF7\u6C42`),null},[C,L,e]),Ru=d(async u=>{var o;try{if(!(e==="pdf"||e==="pdf_slides"))throw console.log(`\u6587\u4EF6\u7C7B\u578B ${e} \u4E0D\u9700\u8981\u5206\u9875\u53C2\u6570\uFF0C\u83B7\u53D6\u5B8C\u6574\u5185\u5BB9`),new Error(`\u6587\u4EF6\u7C7B\u578B ${e} \u4E0D\u652F\u6301\u5206\u9875\u52A0\u8F7D`);const n=Math.floor((u-1)/C)*C+1,a=L(u,C);console.log(`\u8BF7\u6C42PDF chunk\u6570\u636E: ${n} (\u5305\u542B\u9875\u9762 ${n}-${n+C-1})`);const w={"Content-Type":"application/json"};D&&(w.Authorization=D),g&&(w["X-CSRF-TOKEN-IN"]=g);const k={convertedFilePath:t,pageNo:n,pageSize:C},i=await du.post(P,k,{headers:w,responseType:"arraybuffer"}),O=i.headers["x-csrf-token-out"]||i.headers["X-CSRF-TOKEN-OUT"];O&&(console.log("\u83B7\u53D6\u5230\u54CD\u5E94\u5934\u4E2D\u7684CSRF Token:",O),c("request_finish",O));const uu=Array.from({length:C},(ko,Nu)=>n+Nu);return _.current[a]={data:i.data,pages:uu,timestamp:Date.now(),totalPages:h},console.log(`\u7F13\u5B58PDF chunk\u6570\u636E: ${a}, \u5305\u542B\u9875\u9762: ${uu.join(", ")}, \u8BF7\u6C42\u7684\u9875\u9762: ${u}`),console.log("\u5F53\u524D\u6240\u6709\u7F13\u5B58:",Object.keys(_.current)),i.data}catch(r){throw console.error("\u83B7\u53D6PDF stream\u6570\u636E\u5931\u8D25:",r),new Error(`PDF\u8BF7\u6C42\u5931\u8D25: ${((o=r.response)==null?void 0:o.status)||"\u7F51\u7EDC\u9519\u8BEF"}`)}},[P,t,C,D,L,h,E,e,c]),hu=d(async(u,o=!1)=>{var n;if(!u)return;if(!(e==="pdf"||e==="pdf_slides"))return console.log(`\u6587\u4EF6\u7C7B\u578B ${e} \u4E0D\u662FPDF\uFF0C\u8DF3\u8FC7PDF\u52A0\u8F7D\u903B\u8F91`),null;try{o?(f(!0),m("\u6B63\u5728\u52A0\u8F7DPDF\u6587\u6863...")):(f(!0),m(`\u6B63\u5728\u52A0\u8F7D\u7B2C ${u} \u9875...`)),v(null),console.log(`\u5F00\u59CB\u52A0\u8F7DPDF\u9875\u9762: ${u}, \u521D\u59CB\u52A0\u8F7D: ${o}`);const a=await Pu(u);if(a)return console.log(`\u4F7F\u7528\u7F13\u5B58\u7684PDF\u6587\u6863: ${u}`),Eu(a),f(!1),m(""),console.log(`\u9875\u9762 ${u} \u52A0\u8F7D\u5B8C\u6210\uFF08\u4F7F\u7528\u7F13\u5B58\uFF09`),a;const w=await Ru(u),k=await Cu(w,{fileName:l||"Stream\u6587\u6863",fileType:"pdf",token:D});if(k.error)throw new Error(k.error);if(k.type!=="pdf"||!((n=k.content)!=null&&n.document))throw new Error("\u89E3\u6790\u7ED3\u679C\u4E0D\u662F\u6709\u6548\u7684PDF\u6587\u6863");const i=k.content.document;console.log("\u8BBE\u7F6EPDF\u6587\u6863:",i),console.log("PDF\u6587\u6863\u7C7B\u578B:",typeof i),console.log("PDF\u6587\u6863\u65B9\u6CD5:",i?Object.getOwnPropertyNames(Object.getPrototypeOf(i)):"\u65E0\u6587\u6863"),console.log("PDF\u6587\u6863\u9875\u6570:",i?i.numPages:"\u65E0\u9875\u6570"),console.log("\u5F53\u524D\u8BF7\u6C42\u7684\u9875\u9762:",u),console.log("PDF\u6587\u6863\u5305\u542B\u7684\u9875\u9762\u8303\u56F4:",i?`1-${i.numPages}`:"\u65E0\u9875\u6570"),Eu(i);const O=L(u,C);if(_.current[O]&&(_.current[O].pdfDocument=i,console.log(`\u7F13\u5B58PDF\u6587\u6863\u5230chunk: ${O}`)),h)console.log(`\u4F7F\u7528\u7528\u6237\u4F20\u5165\u7684\u603B\u9875\u6570: ${h}`),Y(h);else if(i&&i.numPages){const uu=i.numPages;console.log(`\u7528\u6237\u672A\u4F20\u5165\u603B\u9875\u6570\uFF0C\u4ECEPDF\u6587\u6863\u83B7\u53D6\u5B9E\u9645\u603B\u9875\u6570: ${uu}`),Y(uu)}return f(!1),m(""),console.log(`\u9875\u9762 ${u} \u52A0\u8F7D\u5B8C\u6210`),i}catch(a){throw console.error("PDF\u52A0\u8F7D\u5931\u8D25:",a),v(a.message||"PDF\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),f(!1),m(""),a}},[Ru,l,D,E,Pu,L,C,e]),yu=d(u=>{if(!(e==="pdf"||e==="pdf_slides"))return!1;const r=Q.current[u];if(r&&Date.now()-r.timestamp<A)return!!r.pdfDocument;const n=L(u,C),a=_.current[n];return a&&Date.now()-a.timestamp<A?a.pages.includes(u)&&!!a.pdfDocument:!1},[C,L,e]),_u=d(()=>{console.log("\u68C0\u67E5markdown\u5185\u5BB9\u662F\u5426\u5728\u7F13\u5B58\u4E2D");const u=V.current;return u&&Date.now()-u.timestamp<A?(console.log("\u4F7F\u7528markdown\u5185\u5BB9\u7F13\u5B58"),u.data):(console.log("markdown\u5185\u5BB9\u4E0D\u5728\u7F13\u5B58\u4E2D\uFF0C\u9700\u8981\u91CD\u65B0\u8BF7\u6C42"),null)},[]),Iu=d(async()=>{var u;try{console.log("\u8BF7\u6C42\u5B8C\u6574markdown\u6570\u636E");const o={"Content-Type":"application/json"};D&&(o.Authorization=D),g&&(o["X-CSRF-TOKEN-IN"]=g);const r={convertedFilePath:t};console.log("\u53D1\u9001markdown\u8BF7\u6C42:",r);const n=await du.post(P,r,{headers:o,responseType:"text"}),a=n.headers["x-csrf-token-out"]||n.headers["X-CSRF-TOKEN-OUT"];return a&&(console.log("\u83B7\u53D6\u5230\u54CD\u5E94\u5934\u4E2D\u7684CSRF Token:",a),c("request_finish",a)),console.log("markdown\u54CD\u5E94\u72B6\u6001:",n.status),console.log("markdown\u54CD\u5E94\u6570\u636E\u957F\u5EA6:",((u=n.data)==null?void 0:u.length)||0),n.data}catch(o){throw console.error("\u83B7\u53D6markdown\u6570\u636E\u5931\u8D25:",o),new Error(`\u83B7\u53D6markdown\u6570\u636E\u5931\u8D25: ${o.message}`)}},[t,D,P,c]),qu=d(async()=>{try{f(!0),m("\u6B63\u5728\u52A0\u8F7Dmarkdown\u6587\u6863..."),v(null),console.log("\u5F00\u59CB\u52A0\u8F7D\u5B8C\u6574markdown\u6587\u6863");const u=_u();if(u)return console.log("\u4F7F\u7528\u7F13\u5B58\u7684markdown\u5185\u5BB9"),$u(u),f(!1),m(""),u;const o=await Iu();return V.current={data:o,timestamp:Date.now()},$u(o),f(!1),m(""),console.log("\u5B8C\u6574markdown\u6587\u6863\u52A0\u8F7D\u5B8C\u6210"),o}catch(u){throw console.error("markdown\u52A0\u8F7D\u5931\u8D25:",u),v(u.message||"markdown\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),f(!1),m(""),u}},[Iu,_u]),vu=d(async()=>{try{const u={"Content-Type":"application/json"};D&&(u.Authorization=D),g&&(u["X-CSRF-TOKEN-IN"]=g);const o={convertedFilePath:t},r=await du.post(P,o,{headers:u,responseType:"arraybuffer"}),n=r.headers["x-csrf-token-out"]||r.headers["X-CSRF-TOKEN-OUT"];return n&&(console.log("\u83B7\u53D6\u5230\u54CD\u5E94\u5934\u4E2D\u7684CSRF Token:",n),c("request_finish",n)),r.data}catch(u){throw console.error("\u83B7\u53D6\u56FE\u7247\u6570\u636E\u5931\u8D25:",u),new Error(`\u83B7\u53D6\u56FE\u7247\u6570\u636E\u5931\u8D25: ${u.message}`)}},[t,D,P,c]),Zu=d(async()=>{try{f(!0),m("\u6B63\u5728\u52A0\u8F7D\u56FE\u7247..."),v(null);const u=await vu(),o=await Cu(u,{fileName:l||"\u56FE\u7247",fileType:"image",token:D});if(o.error)throw new Error(o.error);if(o.type!=="image"||!o.content)throw new Error("\u89E3\u6790\u7ED3\u679C\u4E0D\u662F\u6709\u6548\u7684\u56FE\u7247");return ku(o.content),f(!1),m(""),o.content}catch(u){throw console.error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25:",u),v(u.message||"\u56FE\u7247\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),f(!1),m(""),u}},[D,l,vu]),Ou=d(async()=>{var u;try{console.log(`\u8BF7\u6C42\u901A\u7528\u6587\u4EF6\u6570\u636E\uFF0C\u6587\u4EF6\u7C7B\u578B: ${e}`);const o={"Content-Type":"application/json"};D&&(o.Authorization=D),g&&(o["X-CSRF-TOKEN-IN"]=g);const r={convertedFilePath:t};console.log("\u53D1\u9001\u901A\u7528\u6587\u4EF6\u8BF7\u6C42:",r);const n=await du.post(P,r,{headers:o,responseType:"arraybuffer"}),a=n.headers["x-csrf-token-out"]||n.headers["X-CSRF-TOKEN-OUT"];return a&&(console.log("\u83B7\u53D6\u5230\u54CD\u5E94\u5934\u4E2D\u7684CSRF Token:",a),c("request_finish",a)),console.log("\u901A\u7528\u6587\u4EF6\u54CD\u5E94\u72B6\u6001:",n.status),console.log("\u901A\u7528\u6587\u4EF6\u54CD\u5E94\u6570\u636E\u957F\u5EA6:",((u=n.data)==null?void 0:u.byteLength)||0),n.data}catch(o){throw console.error("\u83B7\u53D6\u901A\u7528\u6587\u4EF6\u6570\u636E\u5931\u8D25:",o),new Error(`\u83B7\u53D6\u901A\u7528\u6587\u4EF6\u6570\u636E\u5931\u8D25: ${o.message}`)}},[t,D,P,c]),Gu=d(async()=>{try{if(console.log("=== loadGenericDocument \u88AB\u8C03\u7528 ==="),console.log("\u8C03\u7528\u6808:",new Error().stack),console.log("\u5F53\u524D\u65F6\u95F4:",new Date().toISOString()),J.current){console.log(`\u901A\u7528\u6587\u6863\u6B63\u5728\u52A0\u8F7D\u4E2D\uFF0C\u5FFD\u7565\u91CD\u590D\u8BF7\u6C42\uFF0C\u6587\u4EF6\u7C7B\u578B: ${e}`);return}if(T.current){console.log(`\u901A\u7528\u6587\u6863\u5DF2\u7ECF\u52A0\u8F7D\u8FC7\uFF0C\u5FFD\u7565\u91CD\u590D\u8BF7\u6C42\uFF0C\u6587\u4EF6\u7C7B\u578B: ${e}`);return}const u=`${e}_${t}`,o=Du[u];if(console.log(`\u68C0\u67E5\u901A\u7528\u6587\u6863\u7F13\u5B58\uFF0Ckey: ${u}, \u7F13\u5B58\u5B58\u5728: ${!!o}, \u7F13\u5B58\u65F6\u95F4: ${o?Date.now()-o.timestamp:"N/A"}ms`),o&&Date.now()-o.timestamp<A)return console.log(`\u4F7F\u7528\u7F13\u5B58\u7684\u901A\u7528\u6587\u6863\u5185\u5BB9\uFF0C\u6587\u4EF6\u7C7B\u578B: ${e}`),e==="text"&&o.content?au(o.content):e==="html"&&o.content&&Au(o.content),X(1),Y(h||1),f(!1),m(""),o.content;J.current=!0,f(!0),m(`\u6B63\u5728\u52A0\u8F7D${e}\u6587\u6863...`),v(null),console.log(`\u5F00\u59CB\u52A0\u8F7D\u901A\u7528\u6587\u6863\uFF0C\u6587\u4EF6\u7C7B\u578B: ${e}`);const r=await Ou();if(e==="text"){const k={type:"text",content:Su(r)};au(k);const i=`text_${t}`;return su(O=>({...O,[i]:{content:k,timestamp:Date.now()}})),f(!1),m(""),J.current=!1,T.current=!0,console.log(`\u901A\u7528\u6587\u6863\u52A0\u8F7D\u5B8C\u6210\uFF08text \u76F4\u89E3\uFF09\uFF0C\u6587\u4EF6\u7C7B\u578B: ${e}`),k}const n=await Cu(r,{fileName:l||`${e}\u6587\u6863`,fileType:e,token:D});if(n.error)throw new Error(n.error);let a=null;if(n.type==="text"&&n.content)au(n.content),a=n.content;else if(n.type==="html"&&n.content)Au(n.content),a=n.content;else if(n.type==="image"&&n.content)ku(n.content),a=n.content;else{const w=Su(r);au({type:"text",content:w}),a={type:"text",content:w}}if(a){const w=`${e}_${t}`,k={...Du,[w]:{content:a,timestamp:Date.now()}};su(k),console.log(`\u901A\u7528\u6587\u6863\u5185\u5BB9\u5DF2\u7F13\u5B58\uFF0C\u6587\u4EF6\u7C7B\u578B: ${e}, \u7F13\u5B58\u952E: ${w}`),console.log("\u5F53\u524D\u7F13\u5B58\u72B6\u6001:",k)}return f(!1),m(""),J.current=!1,T.current=!0,console.log(`\u901A\u7528\u6587\u6863\u52A0\u8F7D\u5B8C\u6210\uFF0C\u6587\u4EF6\u7C7B\u578B: ${e}`),n}catch(u){throw console.error("\u901A\u7528\u6587\u6863\u52A0\u8F7D\u5931\u8D25:",u),v(u.message||"\u901A\u7528\u6587\u6863\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),f(!1),m(""),J.current=!1,T.current=!0,u}},[Ou,l,D,e,t,Du,h]),cu=d(async u=>{if(u===Z.current)return;if(nu){console.log("\u9875\u9762\u6B63\u5728\u52A0\u8F7D\u4E2D\uFF0C\u5FFD\u7565\u7FFB\u9875\u8BF7\u6C42");return}if(!(e==="pdf"||e==="pdf_slides")){console.log(`\u6587\u4EF6\u7C7B\u578B ${e} \u4E0D\u652F\u6301\u7FFB\u9875\uFF0C\u5FFD\u7565\u7FFB\u9875\u8BF7\u6C42`);return}console.log("PDF\u9875\u9762\u53D8\u5316:",u,"\u5F53\u524D\u9875:",Z.current),console.log(`\u9875\u9762 ${u} \u662F\u5426\u5728\u7F13\u5B58\u4E2D:`,yu(u)),Z.current=u,X(u);try{await hu(u,!1),c("pageChange",{pageNumber:u,totalPages:h||E})}catch(r){console.error("PDF\u9875\u9762\u52A0\u8F7D\u5931\u8D25:",r);const n=Z.current;X(n)}},[hu,E,c,yu,nu,e]);ou(()=>{Z.current=R,console.log("\u5F53\u524D\u9875\u72B6\u6001\u66F4\u65B0:",R)},[R]);const lu=d(u=>{Bu(u),c("zoomChange",{scale:u})},[c]),ju=d(()=>{c("viewer:close")},[c]),Hu=d(()=>{const u=Math.min(3,y+.1);lu(u)},[y,lu]),Uu=d(()=>{const u=Math.max(.3,y-.1);lu(u)},[y,lu]),Wu=d(()=>{const u=(z-90+360)%360;iu(u),c("rotateChange",{rotation:u})},[z,c]),Yu=d(()=>{const u=(z+90)%360;iu(u),c("rotateChange",{rotation:u})},[z,c]),Ju=d(()=>{if(!(e==="pdf"||e==="pdf_slides")){console.log(`\u6587\u4EF6\u7C7B\u578B ${e} \u4E0D\u652F\u6301\u7FFB\u9875\uFF0C\u5FFD\u7565\u7FFB\u9875\u8BF7\u6C42`);return}const o=Z.current-1;o>=1&&cu(o)},[cu,e]),Qu=d(()=>{if(!(e==="pdf"||e==="pdf_slides")){console.log(`\u6587\u4EF6\u7C7B\u578B ${e} \u4E0D\u652F\u6301\u7FFB\u9875\uFF0C\u5FFD\u7565\u7FFB\u9875\u8BF7\u6C42`);return}const o=Z.current+1,r=h||E;r&&o<=r&&cu(o)},[E,cu,e]),Mu=d(()=>{const u=Date.now();Object.keys(Q.current).forEach(o=>{const r=Q.current[parseInt(o)];u-r.timestamp>A&&(delete Q.current[parseInt(o)],console.log(`\u6E05\u7406\u8FC7\u671F\u9875\u9762\u7F13\u5B58: ${o}`))}),Object.keys(_.current).forEach(o=>{const r=_.current[o];u-r.timestamp>A&&(delete _.current[o],console.log(`\u6E05\u7406\u8FC7\u671Fchunk\u7F13\u5B58: ${o}`))}),V.current&&u-V.current.timestamp>A&&(V.current=null,console.log("\u6E05\u7406\u8FC7\u671Fmarkdown\u5185\u5BB9\u7F13\u5B58")),su(o=>{const r={...o};return Object.keys(r).forEach(n=>{u-r[n].timestamp>A&&(delete r[n],console.log(`\u6E05\u7406\u8FC7\u671F\u901A\u7528\u6587\u4EF6\u7F13\u5B58: ${n}`))}),r})},[]),I=d(()=>{if(l)return l;try{const u=new URL(t);return decodeURIComponent(u.pathname.split("/").pop()||"")||"Stream\u6587\u6863"}catch{const u=t.split("/");return decodeURIComponent(u[u.length-1])||"Stream\u6587\u6863"}},[t,l]);ou(()=>{const u=setInterval(Mu,A);return()=>clearInterval(u)},[Mu]),ou(()=>()=>{Q.current={},_.current={},V.current=null,su({}),console.log("\u7EC4\u4EF6\u5378\u8F7D\uFF0C\u6E05\u7406\u6240\u6709\u7F13\u5B58")},[]),ou(()=>{console.log("=== useEffect \u88AB\u89E6\u53D1 ==="),console.log("\u89E6\u53D1\u65F6\u95F4:",new Date().toISOString()),console.log("\u89E6\u53D1\u539F\u56E0:",{initialPage:b,fileType:e}),(async()=>{try{const o=e==="pdf"||e==="pdf_slides",r=o&&b||1;console.log("\u5F00\u59CB\u521D\u59CB\u52A0\u8F7D\uFF0C\u6587\u4EF6\u7C7B\u578B:",e,"\u6709\u6548\u9875\u7801:",r,"\u662F\u5426PDF:",o),e==="markdown"||e==="markdown_table"?(await qu(),X(1),Y(h||1),c("pageChange",{pageNumber:1,totalPages:h||1})):e==="image"?(await Zu(),X(1),Y(h||1),iu(0),c("pageChange",{pageNumber:1,totalPages:h||1})):o?(await hu(r,!0),X(r),setTimeout(()=>{c("pageChange",{pageNumber:r,totalPages:h||E})},0)):(console.log("=== \u521D\u59CB\u52A0\u8F7D\uFF1A\u4F7F\u7528\u901A\u7528\u52A0\u8F7D\u51FD\u6570\u5904\u7406\u6587\u4EF6\u7C7B\u578B ===",e),await Gu(),X(1),Y(h||1),c("pageChange",{pageNumber:1,totalPages:h||1}))}catch(o){console.error("\u521D\u59CB\u52A0\u8F7D\u5931\u8D25:",o),v((o==null?void 0:o.message)||"\u6587\u4EF6\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),f(!1),m("")}})()},[b,e,t]);const Vu=Tu(()=>Math.floor((R-1)/C)*C+1,[R,C]);return ru?s(fu,{$theme:G,className:W,children:B!=null&&B.ErrorComponent?s(B.ErrorComponent,{error:ru,theme:G}):x(mo,{$theme:G,children:[s("div",{children:"\u52A0\u8F7D\u5931\u8D25"}),s("div",{style:{fontSize:"12px",marginTop:"8px"},children:ru})]})}):nu?x(fu,{$theme:G,className:W,children:[s(Lu,{fileName:I(),currentPage:R,totalPage:E,scale:y,isAnnotating:!1,tools:H,styles:p,onPrevPage:()=>{},onNextPage:()=>{},onZoomIn:()=>{},onZoomOut:()=>{},onAnnotationToggle:()=>{},onDownload:()=>{},onClose:ju,className:tu}),B!=null&&B.LoadingComponent?s(B.LoadingComponent,{status:mu,theme:G}):s(fo,{status:mu,theme:G})]}):x(fu,{$theme:G,className:W,children:[s(Lu,{fileName:I(),currentPage:R,totalPage:E,scale:y,isAnnotating:!1,tools:{...H,navigation:e==="pdf"||e==="pdf_slides"?H.navigation:!1,rotate:e==="image"},styles:p,onPrevPage:Ju,onNextPage:Qu,onZoomIn:Hu,onZoomOut:Uu,onRotateLeft:e==="image"?Wu:void 0,onRotateRight:e==="image"?Yu:void 0,onAnnotationToggle:()=>{},onDownload:()=>{},onClose:ju,className:tu}),e==="markdown"||e==="markdown_table"?x("div",{ref:Xu,style:{flex:1,overflow:"auto",position:"relative"},className:F,children:[s(Fu,{data:{content:q,...I()&&{fileName:I()},...e&&{fileType:e},...E&&{totalPages:E}},annotationData:U,totalPage:E,currentPage:R,scale:y,eventsEmit:(u,o)=>{console.log("Fviewer\u4E8B\u4EF6:",u,o),c(u==="md_annotation_add"?"md_annotation_add":u==="table_annotation_add"?"table_annotation_add":u,o)},styles:p,tools:H,customComponents:B,contentClass:F}),(console.log("=== \u4F20\u9012\u7ED9Fviewer\u7684markdown\u5185\u5BB9 ==="),console.log("markdownContent:",q),console.log("markdownContent\u957F\u5EA6:",q.length),console.log("markdownContent\u524D100\u5B57\u7B26:",q.substring(0,100)),console.log("markdownContent\u540E100\u5B57\u7B26:",q.substring(q.length-100)),null)]}):e==="image"?s(Fu,{data:{content:wu,...I()&&{fileName:I()},...e&&{fileType:e}},annotationData:U,totalPage:1,currentPage:1,scale:y,rotation:z,eventsEmit:c,styles:p,tools:{...H,navigation:!1,rotate:!0},customComponents:B,contentClass:F}):e==="pdf"||e==="pdf_slides"?s(Fu,{data:{content:{document:Ku},...I()&&{fileName:I()},...e&&{fileType:e},...E&&{totalPages:E},pdfStartPage:Vu},annotationData:U,totalPage:E,currentPage:R,scale:y,initialZoom:eu,eventsEmit:(u,o)=>{console.log("Fviewer\u4E8B\u4EF6:",u,o),u==="scaleChange"&&console.log("\u6536\u5230\u7F29\u653E\u53D8\u5316\u4E8B\u4EF6:",o),c(u,o)},styles:p,tools:H,customComponents:B,contentClass:F,setScale:Bu}):s(Fu,{data:{content:xu||pu||{type:"text",content:"\u6587\u4EF6\u5185\u5BB9\u52A0\u8F7D\u4E2D..."},...I()&&{fileName:I()},...e&&{fileType:e}},annotationData:U,totalPage:1,currentPage:1,scale:y,eventsEmit:c,styles:p,tools:{...H,navigation:!1},customComponents:B,contentClass:F})]})};export{eo as C,Ro as G,oo as a};
@@ -1,4 +1,4 @@
1
- import{c}from"./index-D_Hj7QNz.js";/**
1
+ import{c}from"./x-CX-iE6EL.js";/**
2
2
  * @license lucide-react v0.456.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.