@cyber-harbour/ui 2.2.7 → 2.2.9-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PdfDriver-Y3356KN3.js → PdfDriver-FBZLULAL.js} +2 -2
- package/dist/{PdfDriver-Y3356KN3.js.map → PdfDriver-FBZLULAL.js.map} +1 -1
- package/dist/{PdfDriver-ZHGUHQV2.mjs → PdfDriver-ZDVOQI63.mjs} +2 -2
- package/dist/{PdfDriver-ZHGUHQV2.mjs.map → PdfDriver-ZDVOQI63.mjs.map} +1 -1
- package/dist/{chunk-FRUL75XR.mjs → chunk-K5OEK7KJ.mjs} +148 -148
- package/dist/chunk-K5OEK7KJ.mjs.map +1 -0
- package/dist/{chunk-WYSK7UOM.js → chunk-VNCKTJME.js} +152 -152
- package/dist/chunk-VNCKTJME.js.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +21 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/styles/tailwind.css +1 -1
- package/dist/styles/tailwind.css.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-FRUL75XR.mjs.map +0 -1
- package/dist/chunk-WYSK7UOM.js.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a,w,x,u,c,l,z,Pa,Ya,ma as ma$1,ra,pb,Cb,y,kb,G,ib,H,lb}from'./chunk-
|
|
1
|
+
import {a,w,x,u,c,l,z,Pa,Ya,ma as ma$1,ra,pb,Cb,y,kb,G,ib,H,lb}from'./chunk-K5OEK7KJ.mjs';export{tb as Alert,A as AlertIcon,za as AndroidIcon,B as ApiIcon,C as ArrowCircleTopRightIcon,D as ArrowRightIcon,ia as BallsMenu,pb as Box,q as BreakpointProvider,E as BugReportIcon,Na as BurgerMenuIcon,sa as BusIcon,z as Button,F as CalendarIcon,ta as CarIcon,Kb as ChatField,ja as CheckIcon,vb as Checkbox,ka as ChevronDownIcon,G as ChevronLeftIcon,H as ChevronRightIcon,la as ChevronUpIcon,Oa as ClockIcon,I as CloseCircleIcon,J as ClosedLockIcon,Db as ContentLoader,fb as ContextMenu,gb as ContextMenuDelimiter,qa as CrossIcon,K as DataSetsIcon,L as DeepSearchIcon,M as DisabledVisibleIcon,N as DocsIcon,O as DownloadIcon,yb as Drawer,Ab as DrawerBody,zb as DrawerHeader,P as EditUserIcon,rb as EmptyData,Q as EnableVisibleIcon,R as EnterArrowLeftIcon,Ra as FaceSearchIcon,mb as FileField,xa as FileIcon,S as FiltersIcon,Ia as FlashIcon,nb as FlexContainer,ob as FlexItem,Ba as FolderAlertIcon,Ja as FolderInfoIcon,ab as Header,bb as HeaderDelimeter,cb as HeaderSection,T as HomepageIcon,Qa as ImageIcon,oa as InfoCircleFilledIcon,U as InfoCircleIcon,kb as Input,ya as IosIcon,ub as Label,qb as Line,wb as LinerProgress,Za as ListMenu,_a as ListMenuItem,$a as ListMenuSection,V as MapRadarIcon,ra as MaximizeIcon,Sa as MessageAsteriskIcon,Aa as MicrosoftIcon,Pa as MinusIcon,Fb as Modal,Hb as ModalBody,Ib as ModalFooter,Gb as ModalHeader,W as MoonIcon,X as OpenLockIcon,Y as OrganizationIcon,Eb as Overlay,eb as Pagination,Ea as PassportIcon,Z as PasswordFinderIcon,Ga as PencilIcon,_ as PhonebookIcon,va as PlaneIcon,ma as PlusIcon,Fa as PointIcon,$ as PrintIcon,aa as Profiler2Icon,ba as ProfilerIcon,Lb as ProgressLoader,Ca as RelationIcon,Da as RelationPointsIcon,Ka as RotateLeftIcon,La as RotateRightIcon,jb as RowActionsMenu,ca as SandBoxIcon,da as SearchIcon,ib as Select,wa as ShipIcon,Ua as Sidebar,Ta as SidebarContext,Wa as SidebarDelimeter,Va as SidebarItem,Xa as SidebarSection,ea as StatisticIcon,Cb as StyledTooltipContent,fa as SunIcon,xb as Switch,db as Table,sb as Tag,Jb as TailwindExample,s as ThemeProvider,Bb as Tooltip,Ya as Typography,pa as UnfoldIcon,ga as UpRightArrowCircleIcon,Ma as UploadImageIcon,Ha as UserInCircleIcon,na as UsersIcon,ha as VectorIcon,ua 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,hb as useContextMenuControl,y as useTheme}from'./chunk-K5OEK7KJ.mjs';import xo,{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 Ro from'lodash.clonedeep';import {scaleOrdinal,schemeCategory10,forceSimulation,forceLink,forceManyBody,forceX,forceY,forceCenter,forceCollide}from'd3';import wo from'react-content-loader';import {renderAsync}from'docx-preview';import tn from'lodash.throttle';import nn from'@uiw/react-codemirror';import {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 mn from'react-markdown';import gn from'remark-gfm';import {TableVirtuoso}from'react-virtuoso';import Bt from'papaparse';import ta 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 Vs=a(({children:r,className:o})=>jsx(oo,{className:o,children:r}),"PageLayout"),oo=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 Go=[.1,.25,.5,.75,1,1.5,2,3,4,5],Ko=5,Jo=.1,Qo=140;function mt(r,o,n,a){return {x:r<n?(n-r)/2:0,y:o<a?(a-o)/2:0}}a(mt,"computePadding");var gr=a(({url:r,alt:o="image",naturalWidth:n,naturalHeight:a$1,zoomSteps:d=Go,maxZoom:i=Ko,minZoom:h=Jo,showMinimap:x=true,minimapWidth:k=Qo,className:R,onZoomChange:P})=>{let[m,E]=useState("adaptive"),[A,t]=useState(1),[F,S]=useState(false),p=useRef(false),[B,M]=useState(false),[T,$]=useState(false),[Y,ne]=useState({left:0,top:0}),re=useRef(0),[se,ye]=useState({width:0,height:0}),le=useRef({width:0,height:0}),we=useRef(null),ve=useRef(null),q=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),H=useRef(m),V=useRef(A),W=useRef(P);H.current=m,V.current=A,W.current=P;let Z=n||le.current.width,oe=a$1||le.current.height,ae=useMemo(()=>[...d].sort((y,C)=>y-C),[d]),X=useCallback(()=>se.width===0||Z===0?1:Math.min(se.width/Z,se.height/oe,1),[se,Z,oe]),Q=useCallback((y,C)=>{if(C==="in"){let I=ae.find(j=>j>y+.001);return I!==void 0?Math.min(I,i):y}let _=ae.findLast(I=>I<y-.001);return _!==void 0?Math.max(_,h):y},[ae,i,h]),de=useCallback(()=>H.current==="adaptive"?X():V.current,[X]),ce=useCallback(y=>{E("manual"),t(y),W.current?.(y,"manual");},[]),ue=useCallback(()=>{E("adaptive"),W.current?.(X(),"adaptive");},[X]),Se=useCallback(y=>{requestAnimationFrame(()=>{let C=ve.current;if(!C)return;let _=C.getBoundingClientRect(),I=Z*y,j=oe*y,v=mt(I,j,_.width,_.height);C.scrollLeft=I/2+v.x-_.width/2,C.scrollTop=j/2+v.y-_.height/2;});},[Z,oe]);useEffect(()=>{E("adaptive"),t(1),M(false),$(false),le.current={width:0,height:0};},[r]),useEffect(()=>{let y=ve.current;if(!y)return;let C=new ResizeObserver(_=>{let I=_[0];if(!I)return;let{width:j,height:v}=I.contentRect;ye(O=>O.width===j&&O.height===v?O:{width:j,height:v});});return C.observe(y),()=>C.disconnect()},[]),useEffect(()=>{let y=ve.current;if(!y)return;let C=a(()=>{cancelAnimationFrame(re.current),re.current=requestAnimationFrame(()=>{let _=y.scrollLeft,I=y.scrollTop;ne(j=>j.left===_&&j.top===I?j:{left:_,top:I});});},"handleScroll");return y.addEventListener("scroll",C,{passive:true}),()=>{y.removeEventListener("scroll",C),cancelAnimationFrame(re.current);}},[]),useEffect(()=>{let y=ve.current;if(!y||!B)return;let C=a(_=>{if(!(_.ctrlKey||_.metaKey))return;_.preventDefault();let I=de(),j=_.deltaY>0?"out":"in",v=Q(I,j),O=X();if(j==="out"&&v<=O){ue();return}let L=y.getBoundingClientRect(),G,K,ee=le.current.width||1,ge=le.current.height||1;if(H.current==="adaptive"){let pe=we.current;if(!pe)return;let he=pe.getBoundingClientRect();G=(_.clientX-he.left)/(he.width/ee),K=(_.clientY-he.top)/(he.height/ge);}else {let pe=ee*I,he=ge*I,He=mt(pe,he,L.width,L.height);G=(y.scrollLeft+_.clientX-L.left-He.x)/I,K=(y.scrollTop+_.clientY-L.top-He.y)/I;}ce(v),requestAnimationFrame(()=>{let pe=y.getBoundingClientRect(),he=mt(ee*v,ge*v,pe.width,pe.height);y.scrollLeft=G*v+he.x-(_.clientX-pe.left),y.scrollTop=K*v+he.y-(_.clientY-pe.top);});},"handleWheel");return y.addEventListener("wheel",C,{passive:false}),()=>y.removeEventListener("wheel",C)},[B,de,Q,X,ce,ue]),useEffect(()=>{if(m!=="manual")return;let y=ve.current;if(!y)return;let C=a(j=>{j.button===0&&(j.preventDefault(),p.current=true,S(true),q.current={x:j.clientX,y:j.clientY,scrollLeft:y.scrollLeft,scrollTop:y.scrollTop});},"handleMouseDown"),_=a(j=>{if(!p.current)return;let{x:v,y:O,scrollLeft:L,scrollTop:G}=q.current;y.scrollLeft=L-(j.clientX-v),y.scrollTop=G-(j.clientY-O);},"handleMouseMove"),I=a(()=>{p.current=false,S(false);},"handleMouseUp");return y.addEventListener("mousedown",C),window.addEventListener("mousemove",_),window.addEventListener("mouseup",I),()=>{y.removeEventListener("mousedown",C),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",I);}},[m]);let _e=useCallback(()=>{m==="manual"&&ue();},[m,ue]),qe=useCallback(()=>{let y=de(),C=Q(y,"in");C!==y&&(ce(C),Se(C));},[de,Q,ce,Se]),Ne=useCallback(()=>{let y=de(),C=Q(y,"out");if(C<=X()){ue();return}ce(C),Se(C);},[de,Q,X,ue,ce,Se]),Be=useCallback(()=>{ce(1),Se(1);},[ce,Se]),Ce=useCallback(()=>{let y=we.current;y&&(le.current={width:y.naturalWidth,height:y.naturalHeight},M(true),$(false));},[]),Pe=m==="adaptive"?X():A,Re=Z*Pe,Ue=oe*Pe,Fe=se.width,et=se.height,Oe=m==="manual"?mt(Re,Ue,Fe,et):{x:0,y:0},Lt=x&&m==="manual"&&(Re>Fe||Ue>et),e=Z>0?k/Z:0,l=oe*e,c=Fe>0?Fe/A*e:0,u=et>0?et/A*e:0,f=Math.max(0,Y.left-Oe.x)/A*e,w=Math.max(0,Y.top-Oe.y)/A*e,g=m==="adaptive"?"Fit":`${Math.round(A*100)}%`,b=Q(Pe,"in")!==Pe,D=m==="manual"||Pe>h,N=m==="adaptive"?{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}:{width:Re,height:Ue,maxWidth:"none",maxHeight:"none",marginLeft:Oe.x,marginTop:Oe.y,flexShrink:0},z$1={cursor:m==="manual"?F?"grabbing":"grab":"default"};return jsxs("div",{className:`h-full w-full flex flex-col min-h-0 min-w-0 overflow-hidden ${R??""}`,children:[jsxs("div",{className:"flex w-full items-center py-2 px-3 gap-1 border-b border-gray-200 shrink-0",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Pa,{style:{width:12,height:12}}),onClick:Ne,disabled:!D,p:8,className:"bg-white! hover:bg-blue-50! h-8!"}),jsx("button",{type:"button",onClick:m==="manual"?ue:void 0,className:"flex items-center justify-center bg-white h-8! min-w-16 px-3 select-none border border-gray-300 rounded-md","aria-label":g,children:jsx(Ya,{style:{fontSize:12,fontWeight:500},children:g})}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(ma$1,{style:{width:12,height:12}}),onClick:qe,disabled:!b,className:"bg-white! hover:bg-blue-50! h-8!",p:8}),jsx(z,{variant:"outlined","aria-label":"fit-to-container",size:"small",color:m==="adaptive"?"primary":"default",icon:jsx(ra,{style:{width:12,height:12}}),onClick:ue,className:`${m==="adaptive"?"bg-blue-50!":"bg-white! hover:bg-blue-50!"} h-8! ml-auto`,p:8}),jsx(z,{variant:"outlined","aria-label":"original-size",size:"small",color:m==="manual"&&A===1?"primary":"default",onClick:Be,className:`${m==="manual"&&A===1?"bg-blue-50!":"bg-white! hover:bg-blue-50!"} h-8!`,p:8,children:jsx(Ya,{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:ve,className:`h-full w-full ${m==="adaptive"?"flex items-center justify-center overflow-hidden":"overflow-auto"}`,style:z$1,onDoubleClick:_e,children:T?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx(Ya,{color:"text.lighter",children:"Failed to load image"})}):jsx("img",{ref:we,src:r,alt:o,draggable:false,className:"block select-none",style:N,onLoad:Ce,onError:()=>$(true)})}),Lt&&jsxs("div",{className:"absolute bottom-3 right-3 rounded-lg overflow-hidden shadow-lg pointer-events-none",style:{width:k,height:l,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(c,k),height:Math.min(u,l),left:Math.max(0,Math.min(f,k-c)),top:Math.max(0,Math.min(w,l-u)),background:"rgba(59,130,246,0.1)"}})]})]})]})},"ImageDriver");var vr=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 zt=a(({url:r})=>{let[o,n]=useState(null),[a$1,d]=useState(false),[i,h]=useState(true),[x,k]=useState(null);return useEffect(()=>{d(true);},[]),useEffect(()=>{if(!a$1)return;a(async()=>{try{let P=await import('./PdfDriver-ZHGUHQV2.mjs');n(()=>P.PdfDriver),h(!1);}catch(P){console.error("Failed to load PDF driver:",P),k("Failed to load PDF viewer"),h(false);}},"loadPdfDriver")();},[a$1]),a$1?i?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500",children:"Loading PDF viewer..."})}):x||!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:x||"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",children:"Loading PDF viewer..."})})},"PdfDriverWrapper");var xr=50,rn=1e4,kr=a(({url:r,blob:o})=>{let n=useRef(null),a$1=useRef(null),[d,i]=useState(null),[h,x]=useState(true),[k,R]=useState(1),P=useRef(false),[m,E]=useState({width:0,height:0}),A=useRef(0),t=a(()=>{P.current=true,R(S=>Math.min(S+.25,4));},"handleZoomIn"),F=a(()=>{P.current=true,R(S=>Math.max(S-.25,.25));},"handleZoomOut");return useEffect(()=>{a(async()=>{if(a$1.current)try{x(!0),i(null);let p=o;if(!p&&r&&(p=await(await fetch(r)).blob()),!p){i("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(p.size/(1024*1024)>xr){i(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${xr} \u041C\u0411)`);return}a$1.current.innerHTML="";let M=renderAsync(p,a$1.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0,breakPages:!0,ignoreLastRenderedPageBreak:!1}),T=new Promise((Y,ne)=>setTimeout(()=>ne(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")),rn));await Promise.race([M,T]),await new Promise(Y=>requestAnimationFrame(Y));let $=a$1.current.querySelector(".docx-wrapper");if($&&(A.current=$.offsetWidth,E({width:$.offsetWidth,height:$.offsetHeight})),n.current&&A.current>0){let Y=n.current.clientWidth,ne=Math.min(Y/A.current,1);R(ne);}x(!1);}catch(p){i(p?.message||"\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438 DOCX \u0444\u0430\u0439\u043B"),x(false);}},"renderDocument")();},[r,o]),useEffect(()=>{if(!n.current)return;let S=tn(B=>{if(!(P.current||A.current===0))for(let M of B){let T=M.contentRect.width,$=Math.min(T/A.current,1);R($);}},150),p=new ResizeObserver(S);return p.observe(n.current),()=>{p.disconnect(),S.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",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Pa,{style:{width:20,height:20}}),onClick:F,disabled:k<=.25,className:"bg-white! hover:bg-blue-50!",p:7}),jsxs(pb,{py:8,px:8,className:"flex items-center justify-between gap-1.5 min-w-21 rounded-[5px]!",children:[jsx(Ya,{color:"text.lighter",style:{fontSize:10},children:"Scale:"}),jsxs(Ya,{children:[Math.round(k*100),"%"]})]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(ma$1,{style:{width:14,height:14}}),onClick:t,disabled:k>=4,className:"bg-white! hover:bg-blue-50!",p:10})]}),!!d&&!h&&jsx("div",{className:"text-red-500 p-8",children:d}),h&&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 [&::-webkit-scrollbar-thumb]:bg-gray-100 [&::-webkit-scrollbar-track]:bg-[gray]",style:{backgroundColor:"gray",scrollbarGutter:"stable both-edges",scrollbarColor:"#f1f1f1 gray"},children:jsx("div",{style:{width:m.width>0?m.width*k:void 0,height:m.height>0?m.height*k:void 0,overflow:"hidden",margin:"0 auto"},children:jsx("div",{ref:a$1,className:`[&>div.docx-wrapper_table_*]:wrap-break-word!
|
|
66
|
+
`);var Go=[.1,.25,.5,.75,1,1.5,2,3,4,5],Ko=5,Jo=.1,Qo=140;function mt(r,o,n,a){return {x:r<n?(n-r)/2:0,y:o<a?(a-o)/2:0}}a(mt,"computePadding");var gr=a(({url:r,alt:o="image",naturalWidth:n,naturalHeight:a$1,zoomSteps:d=Go,maxZoom:i=Ko,minZoom:h=Jo,showMinimap:x=true,minimapWidth:k=Qo,className:R,onZoomChange:P})=>{let[m,E]=useState("adaptive"),[A,t]=useState(1),[F,S]=useState(false),p=useRef(false),[B,M]=useState(false),[T,$]=useState(false),[Y,ne]=useState({left:0,top:0}),re=useRef(0),[se,ye]=useState({width:0,height:0}),le=useRef({width:0,height:0}),we=useRef(null),ve=useRef(null),q=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),H=useRef(m),V=useRef(A),W=useRef(P);H.current=m,V.current=A,W.current=P;let Z=n||le.current.width,oe=a$1||le.current.height,ae=useMemo(()=>[...d].sort((y,C)=>y-C),[d]),X=useCallback(()=>se.width===0||Z===0?1:Math.min(se.width/Z,se.height/oe,1),[se,Z,oe]),Q=useCallback((y,C)=>{if(C==="in"){let I=ae.find(j=>j>y+.001);return I!==void 0?Math.min(I,i):y}let _=ae.findLast(I=>I<y-.001);return _!==void 0?Math.max(_,h):y},[ae,i,h]),de=useCallback(()=>H.current==="adaptive"?X():V.current,[X]),ce=useCallback(y=>{E("manual"),t(y),W.current?.(y,"manual");},[]),ue=useCallback(()=>{E("adaptive"),W.current?.(X(),"adaptive");},[X]),Se=useCallback(y=>{requestAnimationFrame(()=>{let C=ve.current;if(!C)return;let _=C.getBoundingClientRect(),I=Z*y,j=oe*y,v=mt(I,j,_.width,_.height);C.scrollLeft=I/2+v.x-_.width/2,C.scrollTop=j/2+v.y-_.height/2;});},[Z,oe]);useEffect(()=>{E("adaptive"),t(1),M(false),$(false),le.current={width:0,height:0};},[r]),useEffect(()=>{let y=ve.current;if(!y)return;let C=new ResizeObserver(_=>{let I=_[0];if(!I)return;let{width:j,height:v}=I.contentRect;ye(O=>O.width===j&&O.height===v?O:{width:j,height:v});});return C.observe(y),()=>C.disconnect()},[]),useEffect(()=>{let y=ve.current;if(!y)return;let C=a(()=>{cancelAnimationFrame(re.current),re.current=requestAnimationFrame(()=>{let _=y.scrollLeft,I=y.scrollTop;ne(j=>j.left===_&&j.top===I?j:{left:_,top:I});});},"handleScroll");return y.addEventListener("scroll",C,{passive:true}),()=>{y.removeEventListener("scroll",C),cancelAnimationFrame(re.current);}},[]),useEffect(()=>{let y=ve.current;if(!y||!B)return;let C=a(_=>{if(!(_.ctrlKey||_.metaKey))return;_.preventDefault();let I=de(),j=_.deltaY>0?"out":"in",v=Q(I,j),O=X();if(j==="out"&&v<=O){ue();return}let L=y.getBoundingClientRect(),G,K,ee=le.current.width||1,ge=le.current.height||1;if(H.current==="adaptive"){let pe=we.current;if(!pe)return;let he=pe.getBoundingClientRect();G=(_.clientX-he.left)/(he.width/ee),K=(_.clientY-he.top)/(he.height/ge);}else {let pe=ee*I,he=ge*I,He=mt(pe,he,L.width,L.height);G=(y.scrollLeft+_.clientX-L.left-He.x)/I,K=(y.scrollTop+_.clientY-L.top-He.y)/I;}ce(v),requestAnimationFrame(()=>{let pe=y.getBoundingClientRect(),he=mt(ee*v,ge*v,pe.width,pe.height);y.scrollLeft=G*v+he.x-(_.clientX-pe.left),y.scrollTop=K*v+he.y-(_.clientY-pe.top);});},"handleWheel");return y.addEventListener("wheel",C,{passive:false}),()=>y.removeEventListener("wheel",C)},[B,de,Q,X,ce,ue]),useEffect(()=>{if(m!=="manual")return;let y=ve.current;if(!y)return;let C=a(j=>{j.button===0&&(j.preventDefault(),p.current=true,S(true),q.current={x:j.clientX,y:j.clientY,scrollLeft:y.scrollLeft,scrollTop:y.scrollTop});},"handleMouseDown"),_=a(j=>{if(!p.current)return;let{x:v,y:O,scrollLeft:L,scrollTop:G}=q.current;y.scrollLeft=L-(j.clientX-v),y.scrollTop=G-(j.clientY-O);},"handleMouseMove"),I=a(()=>{p.current=false,S(false);},"handleMouseUp");return y.addEventListener("mousedown",C),window.addEventListener("mousemove",_),window.addEventListener("mouseup",I),()=>{y.removeEventListener("mousedown",C),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",I);}},[m]);let _e=useCallback(()=>{m==="manual"&&ue();},[m,ue]),qe=useCallback(()=>{let y=de(),C=Q(y,"in");C!==y&&(ce(C),Se(C));},[de,Q,ce,Se]),Ne=useCallback(()=>{let y=de(),C=Q(y,"out");if(C<=X()){ue();return}ce(C),Se(C);},[de,Q,X,ue,ce,Se]),Be=useCallback(()=>{ce(1),Se(1);},[ce,Se]),Ce=useCallback(()=>{let y=we.current;y&&(le.current={width:y.naturalWidth,height:y.naturalHeight},M(true),$(false));},[]),Pe=m==="adaptive"?X():A,Re=Z*Pe,Ue=oe*Pe,Fe=se.width,et=se.height,Oe=m==="manual"?mt(Re,Ue,Fe,et):{x:0,y:0},Lt=x&&m==="manual"&&(Re>Fe||Ue>et),e=Z>0?k/Z:0,l=oe*e,c=Fe>0?Fe/A*e:0,u=et>0?et/A*e:0,f=Math.max(0,Y.left-Oe.x)/A*e,w=Math.max(0,Y.top-Oe.y)/A*e,g=m==="adaptive"?"Fit":`${Math.round(A*100)}%`,b=Q(Pe,"in")!==Pe,D=m==="manual"||Pe>h,N=m==="adaptive"?{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}:{width:Re,height:Ue,maxWidth:"none",maxHeight:"none",marginLeft:Oe.x,marginTop:Oe.y,flexShrink:0},z$1={cursor:m==="manual"?F?"grabbing":"grab":"default"};return jsxs("div",{className:`h-full w-full flex flex-col min-h-0 min-w-0 overflow-hidden ${R??""}`,children:[jsxs("div",{className:"flex w-full items-center px-8.5 py-3 gap-1 shrink-0",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Pa,{style:{width:20,height:20}}),onClick:Ne,disabled:!D,p:7,className:"bg-white! hover:bg-blue-50! h-[38px]!"}),jsx("button",{type:"button",onClick:m==="manual"?ue:void 0,className:"flex items-center justify-center bg-white h-[38px] min-w-16 px-3 select-none border border-gray-300 rounded-md","aria-label":g,children:jsx(Ya,{style:{fontSize:12,fontWeight:500},children:g})}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(ma$1,{style:{width:14,height:14}}),onClick:qe,disabled:!b,className:"bg-white! hover:bg-blue-50! h-[38px]!",p:10}),jsx(z,{variant:"outlined","aria-label":"fit-to-container",size:"small",color:m==="adaptive"?"primary":"default",icon:jsx(ra,{style:{width:14,height:14}}),onClick:ue,className:`${m==="adaptive"?"bg-blue-50!":"bg-white! hover:bg-blue-50!"} ml-auto h-[38px]!`,p:10}),jsx(z,{variant:"outlined","aria-label":"original-size",size:"small",color:m==="manual"&&A===1?"primary":"default",onClick:Be,className:`${m==="manual"&&A===1?"bg-blue-50!":"bg-white! hover:bg-blue-50!"} h-[38px]!`,p:10,children:jsx(Ya,{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:ve,className:`h-full w-full ${m==="adaptive"?"flex items-center justify-center overflow-hidden":"overflow-auto"}`,style:z$1,onDoubleClick:_e,children:T?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx(Ya,{color:"text.lighter",children:"Failed to load image"})}):jsx("img",{ref:we,src:r,alt:o,draggable:false,className:"block select-none",style:N,onLoad:Ce,onError:()=>$(true)})}),Lt&&jsxs("div",{className:"absolute bottom-3 right-3 rounded-lg overflow-hidden shadow-lg pointer-events-none",style:{width:k,height:l,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(c,k),height:Math.min(u,l),left:Math.max(0,Math.min(f,k-c)),top:Math.max(0,Math.min(w,l-u)),background:"rgba(59,130,246,0.1)"}})]})]})]})},"ImageDriver");var vr=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 zt=a(({url:r})=>{let[o,n]=useState(null),[a$1,d]=useState(false),[i,h]=useState(true),[x,k]=useState(null);return useEffect(()=>{d(true);},[]),useEffect(()=>{if(!a$1)return;a(async()=>{try{let P=await import('./PdfDriver-ZDVOQI63.mjs');n(()=>P.PdfDriver),h(!1);}catch(P){console.error("Failed to load PDF driver:",P),k("Failed to load PDF viewer"),h(false);}},"loadPdfDriver")();},[a$1]),a$1?i?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500",children:"Loading PDF viewer..."})}):x||!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:x||"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",children:"Loading PDF viewer..."})})},"PdfDriverWrapper");var xr=50,rn=1e4,kr=a(({url:r,blob:o})=>{let n=useRef(null),a$1=useRef(null),[d,i]=useState(null),[h,x]=useState(true),[k,R]=useState(1),P=useRef(false),[m,E]=useState({width:0,height:0}),A=useRef(0),t=a(()=>{P.current=true,R(S=>Math.min(S+.25,4));},"handleZoomIn"),F=a(()=>{P.current=true,R(S=>Math.max(S-.25,.25));},"handleZoomOut");return useEffect(()=>{a(async()=>{if(a$1.current)try{x(!0),i(null);let p=o;if(!p&&r&&(p=await(await fetch(r)).blob()),!p){i("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(p.size/(1024*1024)>xr){i(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${xr} \u041C\u0411)`);return}a$1.current.innerHTML="";let M=renderAsync(p,a$1.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0,breakPages:!0,ignoreLastRenderedPageBreak:!1}),T=new Promise((Y,ne)=>setTimeout(()=>ne(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")),rn));await Promise.race([M,T]),await new Promise(Y=>requestAnimationFrame(Y));let $=a$1.current.querySelector(".docx-wrapper");if($&&(A.current=$.offsetWidth,E({width:$.offsetWidth,height:$.offsetHeight})),n.current&&A.current>0){let Y=n.current.clientWidth,ne=Math.min(Y/A.current,1);R(ne);}x(!1);}catch(p){i(p?.message||"\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438 DOCX \u0444\u0430\u0439\u043B"),x(false);}},"renderDocument")();},[r,o]),useEffect(()=>{if(!n.current)return;let S=tn(B=>{if(!(P.current||A.current===0))for(let M of B){let T=M.contentRect.width,$=Math.min(T/A.current,1);R($);}},150),p=new ResizeObserver(S);return p.observe(n.current),()=>{p.disconnect(),S.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",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Pa,{style:{width:20,height:20}}),onClick:F,disabled:k<=.25,className:"bg-white! hover:bg-blue-50!",p:7}),jsxs(pb,{py:8,px:8,className:"flex items-center justify-between gap-1.5 min-w-21 rounded-[5px]!",children:[jsx(Ya,{color:"text.lighter",style:{fontSize:10},children:"Scale:"}),jsxs(Ya,{children:[Math.round(k*100),"%"]})]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(ma$1,{style:{width:14,height:14}}),onClick:t,disabled:k>=4,className:"bg-white! hover:bg-blue-50!",p:10})]}),!!d&&!h&&jsx("div",{className:"text-red-500 p-8",children:d}),h&&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 [&::-webkit-scrollbar-thumb]:bg-gray-100 [&::-webkit-scrollbar-track]:bg-[gray]",style:{backgroundColor:"gray",scrollbarGutter:"stable both-edges",scrollbarColor:"#f1f1f1 gray"},children:jsx("div",{style:{width:m.width>0?m.width*k:void 0,height:m.height>0?m.height*k: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!
|