@cyber-harbour/ui 2.2.18 → 2.2.19
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/dist/{PdfDriver-MYEDFGO3.mjs → PdfDriver-MGKDGHEQ.mjs} +2 -2
- package/dist/{PdfDriver-MYEDFGO3.mjs.map → PdfDriver-MGKDGHEQ.mjs.map} +1 -1
- package/dist/{PdfDriver-FZC4EDGW.js → PdfDriver-QVSVI5RP.js} +2 -2
- package/dist/{PdfDriver-FZC4EDGW.js.map → PdfDriver-QVSVI5RP.js.map} +1 -1
- package/dist/{chunk-72BA4VF6.js → chunk-CHKXYQZ5.js} +3 -3
- package/dist/chunk-CHKXYQZ5.js.map +1 -0
- package/dist/{chunk-4AIWL7CV.mjs → chunk-DTPQDD44.mjs} +3 -3
- package/dist/chunk-DTPQDD44.mjs.map +1 -0
- package/dist/index.js +21 -21
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-4AIWL7CV.mjs.map +0 -1
- package/dist/chunk-72BA4VF6.js.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a,w,x,u,c,l,z,Ra,_a,na,Na,sa,rb,Eb,y,mb,G,kb,H,nb}from'./chunk-
|
|
1
|
+
import {a,w,x,u,c,l,z,Ra,_a,na,Na,sa,rb,Eb,y,mb,G,kb,H,nb}from'./chunk-DTPQDD44.mjs';export{vb as Alert,A as AlertIcon,Ba as AndroidIcon,B as ApiIcon,C as ArrowCircleTopRightIcon,D as ArrowRightIcon,ja as BallsMenu,rb as Box,q as BreakpointProvider,E as BugReportIcon,Pa as BurgerMenuIcon,ta as BusIcon,z as Button,F as CalendarIcon,ua as CarIcon,Mb as ChatField,ka as CheckIcon,xb as Checkbox,la as ChevronDownIcon,G as ChevronLeftIcon,H as ChevronRightIcon,ma as ChevronUpIcon,Qa as ClockIcon,I as CloseCircleIcon,J as ClosedLockIcon,Fb as ContentLoader,hb as ContextMenu,ib as ContextMenuDelimiter,ra as CrossIcon,K as DataSetsIcon,L as DeepSearchIcon,M as DisabledVisibleIcon,N as DocsIcon,O as DownloadIcon,Ab as Drawer,Cb as DrawerBody,Bb as DrawerHeader,P as EditUserIcon,tb as EmptyData,Q as EnableVisibleIcon,R as EnterArrowLeftIcon,Ta as FaceSearchIcon,za as File2Icon,ob as FileField,ya as FileIcon,S as FiltersIcon,Ka as FlashIcon,pb as FlexContainer,qb as FlexItem,Da as FolderAlertIcon,T as FolderIcon,La as FolderInfoIcon,cb as Header,db as HeaderDelimeter,eb as HeaderSection,U as HomepageIcon,Sa as ImageIcon,pa as InfoCircleFilledIcon,V as InfoCircleIcon,mb as Input,Aa as IosIcon,wb as Label,sb as Line,yb as LinerProgress,$a as ListMenu,ab as ListMenuItem,bb as ListMenuSection,W as MapRadarIcon,sa as MaximizeIcon,Ua as MessageAsteriskIcon,Ca as MicrosoftIcon,Ra as MinusIcon,Hb as Modal,Jb as ModalBody,Kb as ModalFooter,Ib as ModalHeader,X as MoonIcon,Y as OpenLockIcon,Z as OrganizationIcon,Gb as Overlay,gb as Pagination,Ga as PassportIcon,_ as PasswordFinderIcon,Ia as PencilIcon,$ as PhonebookIcon,wa as PlaneIcon,na as PlusIcon,Ha as PointIcon,aa as PrintIcon,ba as Profiler2Icon,ca as ProfilerIcon,Nb as ProgressLoader,Ea as RelationIcon,Fa as RelationPointsIcon,Ma as RotateLeftIcon,Na as RotateRightIcon,lb as RowActionsMenu,da as SandBoxIcon,ea as SearchIcon,kb as Select,xa as ShipIcon,Wa as Sidebar,Va as SidebarContext,Ya as SidebarDelimeter,Xa as SidebarItem,Za as SidebarSection,fa as StatisticIcon,Eb as StyledTooltipContent,ga as SunIcon,zb as Switch,fb as Table,ub as Tag,Lb as TailwindExample,s as ThemeProvider,Db as Tooltip,_a as Typography,qa as UnfoldIcon,ha as UpRightArrowCircleIcon,Oa as UploadImageIcon,Ja as UserInCircleIcon,oa as UsersIcon,ia as VectorIcon,va as WayIcon,f as convertPaletteToRem,w as createComponent,x as createStyledComponent,p as darkTheme,o as darkThemePx,t as destructSpaceProps,u as generatePropertySpaceStyle,k as getBreakpoint,h as getButtonSizeStyles,g as getButtonStyles,i as getInputStyles,v as getResponsiveProps,j as getTypographyStyles,l as hexToRgba,n as lightTheme,m as lightThemePx,e as propToRem,c as pxToRem,d as remToPx,b as resolveThemeColor,r as useBreakpoint,jb as useContextMenuControl,y as useTheme}from'./chunk-DTPQDD44.mjs';import ko,{styled,useTheme,keyframes,css as css$1}from'styled-components';export{ServerStyleSheet,StyleSheetManager}from'styled-components';import {jsx,jsxs}from'react/jsx-runtime';import {useState,useRef,useCallback,useEffect,Fragment,forwardRef,useMemo,useImperativeHandle,useLayoutEffect,memo}from'react';import Eo from'lodash.clonedeep';import {scaleOrdinal,schemeCategory10,forceSimulation,forceLink,forceManyBody,forceX,forceY,forceCenter,forceCollide}from'd3';import xo from'react-content-loader';import {renderAsync}from'docx-preview';import rn from'lodash.throttle';import an from'@uiw/react-codemirror';import {vscodeDark,vscodeLight}from'@uiw/codemirror-theme-vscode';import {javascript}from'@codemirror/lang-javascript';import {json}from'@codemirror/lang-json';import {html}from'@codemirror/lang-html';import {css}from'@codemirror/lang-css';import {python}from'@codemirror/lang-python';import {java}from'@codemirror/lang-java';import {cpp}from'@codemirror/lang-cpp';import {php}from'@codemirror/lang-php';import {rust}from'@codemirror/lang-rust';import {xml}from'@codemirror/lang-xml';import {yaml}from'@codemirror/lang-yaml';import {markdown}from'@codemirror/lang-markdown';import {sql}from'@codemirror/lang-sql';import bn from'react-markdown';import vn from'remark-gfm';import {TableVirtuoso}from'react-virtuoso';import Ht from'papaparse';import na$1 from'copy-to-clipboard';import {Popover}from'react-tiny-popover';import {parse,isValid,getYear,format,getMonth,startOfWeek,startOfMonth,endOfMonth,getDay,previousSunday,nextSaturday,differenceInDays}from'date-fns';import {createPortal}from'react-dom';var Qs=a(({children:r,className:o})=>jsx(no,{className:o,children:r}),"PageLayout"),no=styled.div`
|
|
2
2
|
display: grid;
|
|
3
3
|
min-height: 100dvh;
|
|
4
4
|
position: relative;
|
|
@@ -63,7 +63,7 @@ ${r?`
|
|
|
63
63
|
`:""}
|
|
64
64
|
|
|
65
65
|
min-width: 0;
|
|
66
|
-
`);var Ko=[.1,.25,.5,.75,1,1.5,2,3,4,5],Jo=5,Qo=.1,en=140;function wt(r,o,n,a){return {x:r<n?(n-r)/2:0,y:o<a?(a-o)/2:0}}a(wt,"computePadding");var vr=a(({url:r,alt:o="image",naturalWidth:n,naturalHeight:a$1,zoomSteps:u=Ko,maxZoom:s=Jo,minZoom:g=Qo,showMinimap:w=true,minimapWidth:x=en,className:L,onZoomChange:R})=>{let[f,z$1]=useState("adaptive"),[j,t]=useState(1),[I,k]=useState(0),[N,C]=useState(false),M=useRef(false),[D,W]=useState(false),[Y,Z]=useState(false),[oe,me]=useState({left:0,top:0}),be=useRef(0),[de,Re]=useState({width:0,height:0}),ve=useRef({width:0,height:0}),$=useRef(null),A=useRef(null),K=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),B=useRef(f),Q=useRef(j),ae=useRef(R);B.current=f,Q.current=j,ae.current=R;let ee=n||ve.current.width,q=a$1||ve.current.height,ne=useMemo(()=>[...u].sort((v,p)=>v-p),[u]),ie=useCallback(()=>de.width===0||ee===0?1:Math.min(de.width/ee,de.height/q,1),[de,ee,q]),ue=useCallback((v,p)=>{if(p==="in"){let S=ne.find(F=>F>v+.001);return S!==void 0?Math.min(S,s):v}let P=ne.findLast(S=>S<v-.001);return P!==void 0?Math.max(P,g):v},[ne,s,g]),ye=useCallback(()=>B.current==="adaptive"?ie():Q.current,[ie]),we=useCallback(v=>{z$1("manual"),t(v),ae.current?.(v,"manual");},[]),fe=useCallback(()=>{z$1("adaptive"),ae.current?.(ie(),"adaptive");},[ie]),De=useCallback(v=>{requestAnimationFrame(()=>{let p=A.current;if(!p)return;let P=p.getBoundingClientRect(),S=ee*v,F=q*v,O=wt(S,F,P.width,P.height);p.scrollLeft=S/2+O.x-P.width/2,p.scrollTop=F/2+O.y-P.height/2;});},[ee,q]);useEffect(()=>{z$1("adaptive"),t(1),k(0),W(false),Z(false),ve.current={width:0,height:0};},[r]),useEffect(()=>{let v=A.current;if(!v)return;let p=new ResizeObserver(P=>{let S=P[0];if(!S)return;let{width:F,height:O}=S.contentRect;Re(G=>G.width===F&&G.height===O?G:{width:F,height:O});});return p.observe(v),()=>p.disconnect()},[]),useEffect(()=>{let v=A.current;if(!v)return;let p=a(()=>{cancelAnimationFrame(be.current),be.current=requestAnimationFrame(()=>{let P=v.scrollLeft,S=v.scrollTop;me(F=>F.left===P&&F.top===S?F:{left:P,top:S});});},"handleScroll");return v.addEventListener("scroll",p,{passive:true}),()=>{v.removeEventListener("scroll",p),cancelAnimationFrame(be.current);}},[]),useEffect(()=>{let v=A.current;if(!v||!D)return;let p=a(P=>{if(!(P.ctrlKey||P.metaKey))return;P.preventDefault();let S=ye(),F=P.deltaY>0?"out":"in",O=ue(S,F),G=ie();if(F==="out"&&O<=G){fe();return}let se=v.getBoundingClientRect(),ke,Ee,Be=ve.current.width||1,Ce=ve.current.height||1;if(B.current==="adaptive"){let pe=$.current;if(!pe)return;let Me=pe.getBoundingClientRect();ke=(P.clientX-Me.left)/(Me.width/Be),Ee=(P.clientY-Me.top)/(Me.height/Ce);}else {let pe=Be*S,Me=Ce*S,at=wt(pe,Me,se.width,se.height);ke=(v.scrollLeft+P.clientX-se.left-at.x)/S,Ee=(v.scrollTop+P.clientY-se.top-at.y)/S;}we(O),requestAnimationFrame(()=>{let pe=v.getBoundingClientRect(),Me=wt(Be*O,Ce*O,pe.width,pe.height);v.scrollLeft=ke*O+Me.x-(P.clientX-pe.left),v.scrollTop=Ee*O+Me.y-(P.clientY-pe.top);});},"handleWheel");return v.addEventListener("wheel",p,{passive:false}),()=>v.removeEventListener("wheel",p)},[D,ye,ue,ie,we,fe]),useEffect(()=>{if(f!=="manual")return;let v=A.current;if(!v)return;let p=a(F=>{F.button===0&&(F.preventDefault(),M.current=true,C(true),K.current={x:F.clientX,y:F.clientY,scrollLeft:v.scrollLeft,scrollTop:v.scrollTop});},"handleMouseDown"),P=a(F=>{if(!M.current)return;let{x:O,y:G,scrollLeft:se,scrollTop:ke}=K.current;v.scrollLeft=se-(F.clientX-O),v.scrollTop=ke-(F.clientY-G);},"handleMouseMove"),S=a(()=>{M.current=false,C(false);},"handleMouseUp");return v.addEventListener("mousedown",p),window.addEventListener("mousemove",P),window.addEventListener("mouseup",S),()=>{v.removeEventListener("mousedown",p),window.removeEventListener("mousemove",P),window.removeEventListener("mouseup",S);}},[f]);let Ie=useCallback(()=>{f==="manual"&&fe();},[f,fe]),We=useCallback(()=>{let v=ye(),p=ue(v,"in");p!==v&&(we(p),De(p));},[ye,ue,we,De]),Ne=useCallback(()=>{let v=ye(),p=ue(v,"out");if(p<=ie()){fe();return}we(p),De(p);},[ye,ue,ie,fe,we,De]),Ze=useCallback(()=>{we(1),De(1);},[we,De]),$e=useCallback(()=>{k(v=>(v+90)%360);},[]),ot=useCallback(()=>{let v=$.current;v&&(ve.current={width:v.naturalWidth,height:v.naturalHeight},W(true),Z(false));},[]),Fe=f==="adaptive"?ie():j,nt=ee*Fe,Ve=q*Fe,et=de.width,e=de.height,c=f==="manual"?wt(nt,Ve,et,e):{x:0,y:0},d=w&&f==="manual"&&(nt>et||Ve>e),l=ee>0?x/ee:0,h=q*l,y=et>0?et/j*l:0,m=e>0?e/j*l:0,b=Math.max(0,oe.left-c.x)/j*l,T=Math.max(0,oe.top-c.y)/j*l,E=f==="adaptive"?"Fit":`${Math.round(j*100)}%`,_=ue(Fe,"in")!==Fe,U=f==="manual"||Fe>g,H=I!==0?{transform:`rotate(${I}deg)`}:{},re=f==="adaptive"?{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",...H}:{width:nt,height:Ve,maxWidth:"none",maxHeight:"none",marginLeft:c.x,marginTop:c.y,flexShrink:0,...H},V={cursor:f==="manual"?N?"grabbing":"grab":"default"};return jsxs("div",{className:`h-full w-full flex flex-col min-h-0 min-w-0 overflow-hidden ${L??""}`,children:[jsxs("div",{className:"flex w-full items-center px-8.5 py-3 gap-1 shrink-0 flex-wrap",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Ra,{style:{width:20,height:20}}),onClick:Ne,disabled:!U,p:7,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700! h-[38px]!"}),jsx("button",{type:"button",onClick:f==="manual"?fe:void 0,className:"flex items-center justify-center bg-white dark:bg-neutral-800 h-[38px] min-w-16 px-3 select-none border border-gray-300 dark:border-neutral-600 rounded-md","aria-label":E,children:jsx(_a,{style:{fontSize:12,fontWeight:500},children:E})}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(na,{style:{width:14,height:14}}),onClick:We,disabled:!_,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700! h-[38px]!",p:10}),jsx(z,{variant:"outlined","aria-label":"rotate-right",size:"small",color:"default",icon:jsx(Na,{style:{width:16,height:16}}),onClick:$e,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700! h-[38px]! ml-auto",p:10}),jsx(z,{variant:"outlined","aria-label":"fit-to-container",size:"small",color:f==="adaptive"?"primary":"default",icon:jsx(sa,{style:{width:14,height:14}}),onClick:fe,className:`${f==="adaptive"?"bg-blue-50!":"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!"} h-[38px]!`,p:10}),jsx(z,{variant:"outlined","aria-label":"original-size",size:"small",color:f==="manual"&&j===1?"primary":"default",onClick:Ze,className:`${f==="manual"&&j===1?"bg-blue-50!":"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!"} h-[38px]!`,py:10,px:11,children:jsx(_a,{style:{fontSize:12,fontWeight:500,lineHeight:1},children:"1:1"})})]}),jsxs("div",{className:"flex-1 min-h-0 min-w-0 relative",children:[jsx("div",{ref:A,className:`h-full w-full ${f==="adaptive"?"flex items-center justify-center overflow-hidden":"overflow-auto"}`,style:V,onDoubleClick:Ie,children:Y?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx(_a,{color:"text.lighter",children:"Failed to load image"})}):jsx("img",{ref:$,src:r,alt:o,draggable:false,className:"block select-none",style:re,onLoad:ot,onError:()=>Z(true)})}),d&&jsxs("div",{className:"absolute bottom-3 right-3 rounded-lg overflow-hidden shadow-lg pointer-events-none",style:{width:x,height:h,backdropFilter:"blur(8px)",background:"rgba(255,255,255,0.75)"},children:[jsx("img",{src:r,alt:"",draggable:false,className:"block w-full h-full object-contain"}),jsx("div",{className:"absolute border-2 border-blue-500 rounded-sm",style:{width:Math.min(y,x),height:Math.min(m,h),left:Math.max(0,Math.min(b,x-y)),top:Math.max(0,Math.min(T,h-m)),background:"rgba(59,130,246,0.1)"}})]})]})]})},"ImageDriver");var wr=a(({url:r})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full py-5.5 px-8.5",children:jsx("audio",{controls:true,src:r,className:"w-full"})}),"AudioDriver");var At=a(({url:r})=>{let[o,n]=useState(null),[a$1,u]=useState(false),[s,g]=useState(true),[w,x]=useState(null);return useEffect(()=>{u(true);},[]),useEffect(()=>{if(!a$1)return;a(async()=>{try{let R=await import('./PdfDriver-MYEDFGO3.mjs');n(()=>R.PdfDriver),g(!1);}catch(R){console.error("Failed to load PDF driver:",R),x("Failed to load PDF viewer"),g(false);}},"loadPdfDriver")();},[a$1]),a$1?s?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading PDF viewer..."})}):w||!o?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-red-500 text-center",children:jsx("p",{children:w||"PDF viewer unavailable"})})}):jsx(o,{url:r}):jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading PDF viewer..."})})},"PdfDriverWrapper");var Sr=50,on=1e4,Dr=a(({url:r,blob:o})=>{let n=useRef(null),a$1=useRef(null),[u,s]=useState(null),[g,w]=useState(true),[x,L]=useState(1),R=useRef(false),[f,z$1]=useState({width:0,height:0}),j=useRef(0),t=a(()=>{R.current=true,L(k=>Math.min(k+.25,4));},"handleZoomIn"),I=a(()=>{R.current=true,L(k=>Math.max(k-.25,.25));},"handleZoomOut");return useEffect(()=>{a(async()=>{if(a$1.current)try{w(!0),s(null);let N=o;if(!N&&r&&(N=await(await fetch(r)).blob()),!N){s("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(N.size/(1024*1024)>Sr){s(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${Sr} \u041C\u0411)`);return}a$1.current.innerHTML="";let M=renderAsync(N,a$1.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0,breakPages:!0,ignoreLastRenderedPageBreak:!1}),D=new Promise((Y,Z)=>setTimeout(()=>Z(new Error("\u0420\u0435\u043D\u0434\u0435\u0440\u0438\u043D\u0433 DOCX \u0437\u0430\u0439\u043D\u044F\u0432 \u043D\u0430\u0434\u0442\u043E \u0431\u0430\u0433\u0430\u0442\u043E \u0447\u0430\u0441\u0443")),on));await Promise.race([M,D]),await new Promise(Y=>requestAnimationFrame(Y));let W=a$1.current.querySelector(".docx-wrapper");if(W&&(j.current=W.offsetWidth,z$1({width:W.offsetWidth,height:W.offsetHeight})),n.current&&j.current>0){let Y=n.current.clientWidth,Z=Math.min(Y/j.current,1);L(Z);}w(!1);}catch(N){s(N?.message||"\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438 DOCX \u0444\u0430\u0439\u043B"),w(false);}},"renderDocument")();},[r,o]),useEffect(()=>{if(!n.current)return;let k=rn(C=>{if(!(R.current||j.current===0))for(let M of C){let D=M.contentRect.width,W=Math.min(D/j.current,1);L(W);}},150),N=new ResizeObserver(k);return N.observe(n.current),()=>{N.disconnect(),k.cancel();}},[]),jsxs("div",{className:"h-full w-full flex flex-col px-0.5",children:[jsxs("div",{className:"flex justify-center items-stretch px-8 py-3 gap-1 border-b border-gray-200 dark:border-neutral-700",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Ra,{style:{width:20,height:20}}),onClick:I,disabled:x<=.25,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!",p:7}),jsxs(rb,{py:8,px:8,className:"flex items-center justify-between gap-1.5 min-w-21 rounded-[5px]!",children:[jsx(_a,{color:"text.lighter",style:{fontSize:10},children:"Scale:"}),jsxs(_a,{children:[Math.round(x*100),"%"]})]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(na,{style:{width:14,height:14}}),onClick:t,disabled:x>=4,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!",p:10})]}),!!u&&!g&&jsx("div",{className:"text-red-500 p-8",children:u}),g&&jsx("div",{className:"flex items-center justify-center p-8",children:"\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F..."}),jsx("div",{ref:n,className:"w-full h-full overflow-auto bg-gray-400 dark:bg-neutral-700 [&::-webkit-scrollbar-thumb]:bg-gray-100 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-600 [&::-webkit-scrollbar-track]:bg-gray-400 dark:[&::-webkit-scrollbar-track]:bg-neutral-700",style:{scrollbarGutter:"stable both-edges"},children:jsx("div",{style:{width:f.width>0?f.width*x:void 0,height:f.height>0?f.height*x:void 0,overflow:"hidden",margin:"0 auto"},children:jsx("div",{ref:a$1,className:`[&>div.docx-wrapper_table_*]:wrap-break-word!
|
|
66
|
+
`);var Ko=[.1,.25,.5,.75,1,1.5,2,3,4,5],Jo=5,Qo=.1,en=140;function wt(r,o,n,a){return {x:r<n?(n-r)/2:0,y:o<a?(a-o)/2:0}}a(wt,"computePadding");var vr=a(({url:r,alt:o="image",naturalWidth:n,naturalHeight:a$1,zoomSteps:u=Ko,maxZoom:s=Jo,minZoom:g=Qo,showMinimap:w=true,minimapWidth:x=en,className:L,onZoomChange:R})=>{let[f,z$1]=useState("adaptive"),[j,t]=useState(1),[I,k]=useState(0),[N,C]=useState(false),M=useRef(false),[D,W]=useState(false),[Y,Z]=useState(false),[oe,me]=useState({left:0,top:0}),be=useRef(0),[de,Re]=useState({width:0,height:0}),ve=useRef({width:0,height:0}),$=useRef(null),A=useRef(null),K=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),B=useRef(f),Q=useRef(j),ae=useRef(R);B.current=f,Q.current=j,ae.current=R;let ee=n||ve.current.width,q=a$1||ve.current.height,ne=useMemo(()=>[...u].sort((v,p)=>v-p),[u]),ie=useCallback(()=>de.width===0||ee===0?1:Math.min(de.width/ee,de.height/q,1),[de,ee,q]),ue=useCallback((v,p)=>{if(p==="in"){let S=ne.find(F=>F>v+.001);return S!==void 0?Math.min(S,s):v}let P=ne.findLast(S=>S<v-.001);return P!==void 0?Math.max(P,g):v},[ne,s,g]),ye=useCallback(()=>B.current==="adaptive"?ie():Q.current,[ie]),we=useCallback(v=>{z$1("manual"),t(v),ae.current?.(v,"manual");},[]),fe=useCallback(()=>{z$1("adaptive"),ae.current?.(ie(),"adaptive");},[ie]),De=useCallback(v=>{requestAnimationFrame(()=>{let p=A.current;if(!p)return;let P=p.getBoundingClientRect(),S=ee*v,F=q*v,O=wt(S,F,P.width,P.height);p.scrollLeft=S/2+O.x-P.width/2,p.scrollTop=F/2+O.y-P.height/2;});},[ee,q]);useEffect(()=>{z$1("adaptive"),t(1),k(0),W(false),Z(false),ve.current={width:0,height:0};},[r]),useEffect(()=>{let v=A.current;if(!v)return;let p=new ResizeObserver(P=>{let S=P[0];if(!S)return;let{width:F,height:O}=S.contentRect;Re(G=>G.width===F&&G.height===O?G:{width:F,height:O});});return p.observe(v),()=>p.disconnect()},[]),useEffect(()=>{let v=A.current;if(!v)return;let p=a(()=>{cancelAnimationFrame(be.current),be.current=requestAnimationFrame(()=>{let P=v.scrollLeft,S=v.scrollTop;me(F=>F.left===P&&F.top===S?F:{left:P,top:S});});},"handleScroll");return v.addEventListener("scroll",p,{passive:true}),()=>{v.removeEventListener("scroll",p),cancelAnimationFrame(be.current);}},[]),useEffect(()=>{let v=A.current;if(!v||!D)return;let p=a(P=>{if(!(P.ctrlKey||P.metaKey))return;P.preventDefault();let S=ye(),F=P.deltaY>0?"out":"in",O=ue(S,F),G=ie();if(F==="out"&&O<=G){fe();return}let se=v.getBoundingClientRect(),ke,Ee,Be=ve.current.width||1,Ce=ve.current.height||1;if(B.current==="adaptive"){let pe=$.current;if(!pe)return;let Me=pe.getBoundingClientRect();ke=(P.clientX-Me.left)/(Me.width/Be),Ee=(P.clientY-Me.top)/(Me.height/Ce);}else {let pe=Be*S,Me=Ce*S,at=wt(pe,Me,se.width,se.height);ke=(v.scrollLeft+P.clientX-se.left-at.x)/S,Ee=(v.scrollTop+P.clientY-se.top-at.y)/S;}we(O),requestAnimationFrame(()=>{let pe=v.getBoundingClientRect(),Me=wt(Be*O,Ce*O,pe.width,pe.height);v.scrollLeft=ke*O+Me.x-(P.clientX-pe.left),v.scrollTop=Ee*O+Me.y-(P.clientY-pe.top);});},"handleWheel");return v.addEventListener("wheel",p,{passive:false}),()=>v.removeEventListener("wheel",p)},[D,ye,ue,ie,we,fe]),useEffect(()=>{if(f!=="manual")return;let v=A.current;if(!v)return;let p=a(F=>{F.button===0&&(F.preventDefault(),M.current=true,C(true),K.current={x:F.clientX,y:F.clientY,scrollLeft:v.scrollLeft,scrollTop:v.scrollTop});},"handleMouseDown"),P=a(F=>{if(!M.current)return;let{x:O,y:G,scrollLeft:se,scrollTop:ke}=K.current;v.scrollLeft=se-(F.clientX-O),v.scrollTop=ke-(F.clientY-G);},"handleMouseMove"),S=a(()=>{M.current=false,C(false);},"handleMouseUp");return v.addEventListener("mousedown",p),window.addEventListener("mousemove",P),window.addEventListener("mouseup",S),()=>{v.removeEventListener("mousedown",p),window.removeEventListener("mousemove",P),window.removeEventListener("mouseup",S);}},[f]);let Ie=useCallback(()=>{f==="manual"&&fe();},[f,fe]),We=useCallback(()=>{let v=ye(),p=ue(v,"in");p!==v&&(we(p),De(p));},[ye,ue,we,De]),Ne=useCallback(()=>{let v=ye(),p=ue(v,"out");if(p<=ie()){fe();return}we(p),De(p);},[ye,ue,ie,fe,we,De]),Ze=useCallback(()=>{we(1),De(1);},[we,De]),$e=useCallback(()=>{k(v=>(v+90)%360);},[]),ot=useCallback(()=>{let v=$.current;v&&(ve.current={width:v.naturalWidth,height:v.naturalHeight},W(true),Z(false));},[]),Fe=f==="adaptive"?ie():j,nt=ee*Fe,Ve=q*Fe,et=de.width,e=de.height,c=f==="manual"?wt(nt,Ve,et,e):{x:0,y:0},d=w&&f==="manual"&&(nt>et||Ve>e),l=ee>0?x/ee:0,h=q*l,y=et>0?et/j*l:0,m=e>0?e/j*l:0,b=Math.max(0,oe.left-c.x)/j*l,T=Math.max(0,oe.top-c.y)/j*l,E=f==="adaptive"?"Fit":`${Math.round(j*100)}%`,_=ue(Fe,"in")!==Fe,U=f==="manual"||Fe>g,H=I!==0?{transform:`rotate(${I}deg)`}:{},re=f==="adaptive"?{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",...H}:{width:nt,height:Ve,maxWidth:"none",maxHeight:"none",marginLeft:c.x,marginTop:c.y,flexShrink:0,...H},V={cursor:f==="manual"?N?"grabbing":"grab":"default"};return jsxs("div",{className:`h-full w-full flex flex-col min-h-0 min-w-0 overflow-hidden ${L??""}`,children:[jsxs("div",{className:"flex w-full items-center px-8.5 py-3 gap-1 shrink-0 flex-wrap",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Ra,{style:{width:20,height:20}}),onClick:Ne,disabled:!U,p:7,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700! h-[38px]!"}),jsx("button",{type:"button",onClick:f==="manual"?fe:void 0,className:"flex items-center justify-center bg-white dark:bg-neutral-800 h-[38px] min-w-16 px-3 select-none border border-gray-300 dark:border-neutral-600 rounded-md","aria-label":E,children:jsx(_a,{style:{fontSize:12,fontWeight:500},children:E})}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(na,{style:{width:14,height:14}}),onClick:We,disabled:!_,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700! h-[38px]!",p:10}),jsx(z,{variant:"outlined","aria-label":"rotate-right",size:"small",color:"default",icon:jsx(Na,{style:{width:16,height:16}}),onClick:$e,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700! h-[38px]! ml-auto",p:10}),jsx(z,{variant:"outlined","aria-label":"fit-to-container",size:"small",color:f==="adaptive"?"primary":"default",icon:jsx(sa,{style:{width:14,height:14}}),onClick:fe,className:`${f==="adaptive"?"bg-blue-50!":"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!"} h-[38px]!`,p:10}),jsx(z,{variant:"outlined","aria-label":"original-size",size:"small",color:f==="manual"&&j===1?"primary":"default",onClick:Ze,className:`${f==="manual"&&j===1?"bg-blue-50!":"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!"} h-[38px]!`,py:10,px:11,children:jsx(_a,{style:{fontSize:12,fontWeight:500,lineHeight:1},children:"1:1"})})]}),jsxs("div",{className:"flex-1 min-h-0 min-w-0 relative",children:[jsx("div",{ref:A,className:`h-full w-full ${f==="adaptive"?"flex items-center justify-center overflow-hidden":"overflow-auto"}`,style:V,onDoubleClick:Ie,children:Y?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx(_a,{color:"text.lighter",children:"Failed to load image"})}):jsx("img",{ref:$,src:r,alt:o,draggable:false,className:"block select-none",style:re,onLoad:ot,onError:()=>Z(true)})}),d&&jsxs("div",{className:"absolute bottom-3 right-3 rounded-lg overflow-hidden shadow-lg pointer-events-none",style:{width:x,height:h,backdropFilter:"blur(8px)",background:"rgba(255,255,255,0.75)"},children:[jsx("img",{src:r,alt:"",draggable:false,className:"block w-full h-full object-contain"}),jsx("div",{className:"absolute border-2 border-blue-500 rounded-sm",style:{width:Math.min(y,x),height:Math.min(m,h),left:Math.max(0,Math.min(b,x-y)),top:Math.max(0,Math.min(T,h-m)),background:"rgba(59,130,246,0.1)"}})]})]})]})},"ImageDriver");var wr=a(({url:r})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full py-5.5 px-8.5",children:jsx("audio",{controls:true,src:r,className:"w-full"})}),"AudioDriver");var At=a(({url:r})=>{let[o,n]=useState(null),[a$1,u]=useState(false),[s,g]=useState(true),[w,x]=useState(null);return useEffect(()=>{u(true);},[]),useEffect(()=>{if(!a$1)return;a(async()=>{try{let R=await import('./PdfDriver-MGKDGHEQ.mjs');n(()=>R.PdfDriver),g(!1);}catch(R){console.error("Failed to load PDF driver:",R),x("Failed to load PDF viewer"),g(false);}},"loadPdfDriver")();},[a$1]),a$1?s?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading PDF viewer..."})}):w||!o?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-red-500 text-center",children:jsx("p",{children:w||"PDF viewer unavailable"})})}):jsx(o,{url:r}):jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading PDF viewer..."})})},"PdfDriverWrapper");var Sr=50,on=1e4,Dr=a(({url:r,blob:o})=>{let n=useRef(null),a$1=useRef(null),[u,s]=useState(null),[g,w]=useState(true),[x,L]=useState(1),R=useRef(false),[f,z$1]=useState({width:0,height:0}),j=useRef(0),t=a(()=>{R.current=true,L(k=>Math.min(k+.25,4));},"handleZoomIn"),I=a(()=>{R.current=true,L(k=>Math.max(k-.25,.25));},"handleZoomOut");return useEffect(()=>{a(async()=>{if(a$1.current)try{w(!0),s(null);let N=o;if(!N&&r&&(N=await(await fetch(r)).blob()),!N){s("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(N.size/(1024*1024)>Sr){s(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${Sr} \u041C\u0411)`);return}a$1.current.innerHTML="";let M=renderAsync(N,a$1.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0,breakPages:!0,ignoreLastRenderedPageBreak:!1}),D=new Promise((Y,Z)=>setTimeout(()=>Z(new Error("\u0420\u0435\u043D\u0434\u0435\u0440\u0438\u043D\u0433 DOCX \u0437\u0430\u0439\u043D\u044F\u0432 \u043D\u0430\u0434\u0442\u043E \u0431\u0430\u0433\u0430\u0442\u043E \u0447\u0430\u0441\u0443")),on));await Promise.race([M,D]),await new Promise(Y=>requestAnimationFrame(Y));let W=a$1.current.querySelector(".docx-wrapper");if(W&&(j.current=W.offsetWidth,z$1({width:W.offsetWidth,height:W.offsetHeight})),n.current&&j.current>0){let Y=n.current.clientWidth,Z=Math.min(Y/j.current,1);L(Z);}w(!1);}catch(N){s(N?.message||"\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438 DOCX \u0444\u0430\u0439\u043B"),w(false);}},"renderDocument")();},[r,o]),useEffect(()=>{if(!n.current)return;let k=rn(C=>{if(!(R.current||j.current===0))for(let M of C){let D=M.contentRect.width,W=Math.min(D/j.current,1);L(W);}},150),N=new ResizeObserver(k);return N.observe(n.current),()=>{N.disconnect(),k.cancel();}},[]),jsxs("div",{className:"h-full w-full flex flex-col px-0.5",children:[jsxs("div",{className:"flex justify-center items-stretch px-8 py-3 gap-1 border-b border-gray-200 dark:border-neutral-700",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Ra,{style:{width:20,height:20}}),onClick:I,disabled:x<=.25,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!",p:7}),jsxs(rb,{py:8,px:8,className:"flex items-center justify-between gap-1.5 min-w-21 rounded-[5px]!",children:[jsx(_a,{color:"text.lighter",style:{fontSize:10},children:"Scale:"}),jsxs(_a,{children:[Math.round(x*100),"%"]})]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(na,{style:{width:14,height:14}}),onClick:t,disabled:x>=4,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!",p:10})]}),!!u&&!g&&jsx("div",{className:"text-red-500 p-8",children:u}),g&&jsx("div",{className:"flex items-center justify-center p-8",children:"\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F..."}),jsx("div",{ref:n,className:"w-full h-full overflow-auto bg-gray-400 dark:bg-neutral-700 [&::-webkit-scrollbar-thumb]:bg-gray-100 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-600 [&::-webkit-scrollbar-track]:bg-gray-400 dark:[&::-webkit-scrollbar-track]:bg-neutral-700",style:{scrollbarGutter:"stable both-edges"},children:jsx("div",{style:{width:f.width>0?f.width*x:void 0,height:f.height>0?f.height*x:void 0,overflow:"hidden",margin:"0 auto"},children:jsx("div",{ref:a$1,className:`[&>div.docx-wrapper_table_*]:wrap-break-word!
|
|
67
67
|
[&>div.docx-wrapper_table]:table-fixed!
|
|
68
68
|
[&>div.docx-wrapper_table_td]:w-fit!
|
|
69
69
|
[&>div.docx-wrapper_table_col]:w-fit!
|