@cyber-harbour/ui 2.1.2 → 2.1.3
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/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- 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/index.mjs
CHANGED
|
@@ -63,7 +63,7 @@ ${r?`
|
|
|
63
63
|
`:""}
|
|
64
64
|
|
|
65
65
|
min-width: 0;
|
|
66
|
-
`);var jt=a(({url:r})=>{let[o,c]=useState(1),[p,h]=useState(),b=Rt.useRef(null),f=Rt.useRef(null),P=a(()=>{c(E=>Math.min(E+.25,4));},"handleZoomIn");return jsxs("div",{ref:f,className:"h-full w-full flex flex-col",children:[jsxs("div",{className:"flex justify-center items-stretch p-5.5 gap-1 border-b border-gray-200 relative ",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"secondary",size:"small",icon:jsx(Pa,{style:{width:20,height:20}}),onClick:a(()=>{c(E=>Math.max(E-.25,.25));},"handleZoomOut"),disabled:o<=.25,p:5}),jsxs(ob,{py:5,px:8,children:[o*100,"%"]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"secondary",icon:jsx(ma,{style:{width:14,height:14}}),onClick:P,disabled:o>=4,p:8})]}),jsx("div",{className:"h-full w-full overflow-auto",children:jsx("img",{src:r,ref:b,alt:"image",className:"block w-auto max-w-none object-contain",style:{transition:"all 0.2s ease-in-out",marginInline:"auto",marginBlock:10,flexShrink:0,...p==="width"&&{width:`calc(${o*100}% - 20px)`},...p==="height"&&{height:`calc(${o*100}% - 20px)`}},onLoad:()=>{if(b.current&&f.current){let E=b.current.width,B=b.current.height,M=E<B?"height":"width";h(M);}}})})]})},"ImageDriver");var Ft=a(({url:r})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full p-5.5",children:jsx("audio",{controls:true,src:r,className:"w-full"})}),"AudioDriver");var Ue=a(({url:r})=>{let[o,c]=useState(null),[p,h]=useState(false),[b,f]=useState(true),[P,L]=useState(null);return useEffect(()=>{h(true);},[]),useEffect(()=>{if(!p)return;a(async()=>{try{let B=await import('./PdfDriver-3CHKFA4R.mjs');c(()=>B.PdfDriver),f(!1);}catch(B){console.error("Failed to load PDF driver:",B),L("Failed to load PDF viewer"),f(false);}},"loadPdfDriver")();},[p]),p?b?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500",children:"Loading PDF viewer..."})}):P||!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:P||"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 Ot=50,no=1e4,Ht=a(({url:r,blob:o})=>{let c=useRef(null),[p,h]=useState(null),[b,f]=useState(true);return useEffect(()=>{a(async()=>{if(c.current)try{if(f(!0),h(null),!o&&r&&(o=await(await fetch(r)).blob()),!o){h("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(o.size/(1024*1024)>Ot){h(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${Ot} \u041C\u0411)`);return}c.current.innerHTML="";let E=renderAsync(o,c.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0}),B=new Promise((M,C)=>setTimeout(()=>C(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")),no));await Promise.race([E,B]),f(!1);}catch(L){h(L?.message||"\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438 DOCX \u0444\u0430\u0439\u043B"),f(false);}},"renderDocument")();},[r,o]),jsxs(Fragment$1,{children:[!!p&&!b&&jsx("div",{className:"text-red-500 p-5",children:p}),b&&jsx("div",{className:"flex items-center justify-center p-5",children:"\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F..."}),jsx("div",{ref:c,className:"w-full h-full overflow-auto [&_table]:max-w-full! [&>div.docx-wrapper]:w-fit",style:{boxSizing:"border-box"}})]})},"DocxDriver");var bo=a(r=>({js:[javascript({jsx:false})],jsx:[javascript({jsx:true})],ts:[javascript({typescript:true,jsx:false})],tsx:[javascript({typescript:true,jsx:true})],json:[json()],html:[html()],css:[css()],scss:[css()],py:[python()],java:[java()],cpp:[cpp()],c:[cpp()],php:[php()],rs:[rust()],xml:[xml()],yaml:[yaml()],yml:[yaml()],md:[markdown()],sql:[sql()],sh:[markdown()],bash:[markdown()]})[r]||[],"getLanguageExtension"),Gt=a(({url:r,extension:o})=>{let[c,p]=useState(""),[h,b]=useState(true),[f,P]=useState(null),[L,E]=useState(0),B=useRef(null);if(useEffect(()=>{a(async()=>{try{b(!0),P(null);let $=await fetch(r);if(!$.ok)throw new Error(`Failed to load file: ${$.statusText}`);let t=await $.text();p(t);}catch($){P($ instanceof Error?$.message:"Failed to load text content");}finally{b(false);}},"loadTextContent")();},[r]),useEffect(()=>{let C=a(()=>{if(B.current){let $=B.current.clientHeight;E($);}},"updateHeight");return C(),window.addEventListener("resize",C),()=>{window.removeEventListener("resize",C);}},[h]),h)return jsx("div",{className:"flex items-center justify-center p-8",children:jsx("div",{className:"text-gray-500",children:"Loading text content..."})});if(f)return jsx("div",{className:"flex items-center justify-center p-8",children:jsxs("div",{className:"text-red-500",children:["Error: ",f]})});let M=bo(o);return jsx("div",{ref:B,className:"h-full w-full",children:L>0&&jsx(co,{value:c,theme:vscodeDark,extensions:M,editable:false,height:`${L}px`,basicSetup:{lineNumbers:true,highlightActiveLineGutter:false,highlightActiveLine:false,foldGutter:true,dropCursor:false,indentOnInput:false,syntaxHighlighting:true,bracketMatching:true,closeBrackets:false,autocompletion:false,rectangularSelection:false,crosshairCursor:false,highlightSelectionMatches:false,closeBracketsKeymap:false,searchKeymap:false,foldKeymap:true,completionKeymap:false,lintKeymap:false}})})},"TextDriver");var qt=a(({url:r})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full",children:jsx("video",{controls:true,src:r,className:"w-full max-h-full"})}),"VideoDriver");var Ut=memo(a(function({extension:o,blob:c,path:p,buffer:h,not_supported_message:b=" Sorry, this file type isn\u2019t supported yet."}){console.log("Driver props:",{extension:o,blob:c,path:p,buffer:h});let f=o.toLocaleLowerCase().trim(),P;if(p?P=p:c&&(P=URL.createObjectURL(c)),P){if(["jpeg","jpg","png","gif","bmp","webp"].includes(f))return jsx(jt,{url:P});if(["mp3","wav","ogg","flac"].includes(f))return jsx(Ft,{url:P});if(["mp4","webm"].includes(f))return jsx(qt,{url:P});if(o==="pdf")return jsx(Ue,{url:P});if(["txt","js","jsx","ts","tsx","json","html","css","scss","py","java","cpp","c","cs","php","rb","go","rs","swift","kt","xml","yaml","yml","md","sql","sh","bash"].includes(f))return jsx(Gt,{url:P,extension:f})}return f==="docx"?jsx(Ht,{url:P,blob:c}):jsx("div",{className:"h-full flex flex-col justify-center items-center",children:jsx(ob,{className:"mx-5",children:jsx(Ya,{variant:"h2",color:"text.light",weight:500,className:"text-center",children:b})})})},"Driver"));var Nc=a(r=>jsx("div",{className:"h-full w-full",children:jsx(Ut,{...r})}),"FileViewer");var Kt=250,Hc=a(({text:r,speed:o=50,onDone:c,markdown:p=false,markdownComponents:h={},className:b,...f})=>{let[P,L]=useState(""),E=useRef(null),B=useRef(null);return useEffect(()=>{let M=false;if(o>0){L(""),E.current=performance.now();let C=a($=>{if(M||!E.current)return;let t=$-E.current,O=t/o>Kt?o/2:o,U=t/o>Kt?1.5:1,x=Math.floor(t/O*U);if(x>=r.length){L(r),M=true,c?.();return}L(r.slice(0,x)),B.current=requestAnimationFrame(C);},"tick");B.current=requestAnimationFrame(C);}else L(r),c?.();return ()=>{B.current&&cancelAnimationFrame(B.current);}},[r,o,c]),p?jsx("div",{className:b,children:jsx(Po,{remarkPlugins:[So],components:h,...f,children:P})}):jsx(Ya,{className:b,...f,children:P})},"Typewriter");var Lo={timeout:2e3,message:"Copied!"},Jc=a(({text:r,children:o,format:c="text/plain",tooltip:p})=>{let[h,b]=useState(false),f=useRef(null),P={...Lo,...p},L=a(async()=>{"clipboard"in navigator?await navigator.clipboard.writeText(r):Mo(r,{format:c}),b(true),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>b(false),P.timeout);},"handleCopy");return useEffect(()=>()=>{f.current&&clearTimeout(f.current);},[]),jsx(Ab,{onMouseLeave:()=>b(false),className:h?"visible":"hidden",content:P.message,children:o({copy:L})})},"CopyToClipboard");var Qt=a(r=>new Date(r?Array.isArray(r)?r[1]||r[0]||new Date:r:new Date),"getInitValue"),$e=a((r,o)=>{let c;if(o){let h=parse(r||"",o,new Date);if(isValid(h)&&getYear(h)>=1970)return h}let p=new Date(r||"");return isNaN(p.getTime())?c:p},"parseDate"),$o=a((r,o)=>{let c=r?$e(r,o):void 0;return c&&o?format(c,o):r},"renderDate"),dl=a(({value:r,range:o,inline:c=false,minDate:p=new Date(getYear(new Date)-5,0,1),maxDate:h=new Date(getYear(new Date)+5,11,31),format:b="dd.MM.yyyy",onChange:f,...P})=>{let[L,E]=useState(getMonth(Qt(r))),[B,M]=useState(getYear(Qt(r))),C=useMemo(()=>{if(r){if(Array.isArray(r)){let t=$e(r[0],b),O=$e(r[1],b);return [t,O]}return $e(r,b)}},[r]),$=useCallback(t=>{if(o){let O=!!(C&&Array.isArray(C)&&C[0]),U=!!(C&&Array.isArray(C)&&C[1]);!O||O&&U?f?.([t.toString(),""]):O&&!U&&(t<C[0]?f?.([t.toString(),C[0].toString()]):f?.([C[0].toString(),t.toString()]));}else f?.(t.toString());},[o,C,f]);return c?jsx(er,{month:L,year:B,minDate:p,maxDate:h,selectedDate:C,onSelectDate:$,onChangeMonth:E,onChangeYear:M}):o?jsx(Oo,{range:true,value:r,onChange:f,...P}):jsx(Ho,{value:r,onChange:f,minDate:p,maxDate:h,month:L,year:B,selectedDate:C,onChangeMonth:E,onChangeYear:M,onSelectDate:$,formatStr:b,...P})},"DatePicker"),Oo=a(({minDate:r,maxDate:o,value:c,onChange:p})=>null,"DatePickerGroupInput"),Ho=a(({placeholder:r,value:o,onChange:c,inputProps:p,...h})=>{let[b,f]=useState(false),P=y();return jsx(Popover,{positions:["bottom","top","right","left"],align:"start",isOpen:b,onClickOutside:()=>f(false),content:jsx(ob,{children:jsx(er,{...h})}),containerStyle:{zIndex:`${P.zIndex.popover}`},children:jsx("div",{onClick:()=>f(true),children:jsx(kb,{...p,placeholder:r,value:$o(o,h.formatStr),onChange:L=>c?.(L.target.value)})})})},"DatePickerInput"),er=a(({month:r,year:o,selectedDate:c,minDate:p,maxDate:h,onSelectDate:b,onChangeMonth:f,onChangeYear:P})=>{let L=useMemo(()=>new Array(12).fill(null).map((x,R)=>{let S=new Date(0,R);return {value:R+1,inputDisplay:format(S,"MMMM")}}),[]),E=useMemo(()=>{let x=getYear(p),S=getYear(h)-x+1;return new Array(S).fill(null).map((k,Q)=>{let q=x+Q;return {value:q,inputDisplay:q.toString()}})},[p,h]),B=useMemo(()=>new Array(7).fill(null).map((x,R)=>{let S=startOfWeek(new Date,{weekStartsOn:R});return format(S,"EEE")}),[]),M=useMemo(()=>{let x=getWeeksInMonth(new Date(o,r)),R=startOfMonth(new Date(o,r)),S=previousMonday(R),k=differenceInDays(R,S);return new Array(x*7).fill(null).map((Q,q)=>new Date(o,r,q-k+1))},[r,o]),C=useCallback(()=>{r===0?(P(o-1),f(11)):f(r-1);},[r,o]),$=useCallback(()=>{r===11?(P(o+1),f(0)):f(r+1);},[r,o]),t=useMemo(()=>p?!(o<getYear(p)||o===getYear(p)&&r<=getMonth(p)):true,[r,o,p]),O=useMemo(()=>h?!(o>getYear(h)||o===getYear(h)&&r>=getMonth(h)):true,[r,o,h]),U=useCallback(x=>{x.stopPropagation();},[]);return jsxs("div",{className:"flex flex-col date-picker-calendar",onClick:U,children:[jsxs("div",{className:"flex justify-center items-center gap-2 pb-3",children:[t&&jsx(z,{size:"small",variant:"empty",icon:jsx(G,{}),onClick:C}),jsxs("div",{className:"flex-1 flex justify-center gap-1",children:[jsx(ib,{placeholder:"",hasBorder:false,selected:r+1,options:L,onSelect:x=>f(x-1),maxWidth:150,maxHeight:300}),jsx(ib,{placeholder:"",hasBorder:false,selected:o,options:E,onSelect:x=>P(x),maxWidth:100,maxHeight:300})]}),O&&jsx(z,{size:"small",variant:"empty",icon:jsx(H,{}),onClick:$})]}),jsx("div",{className:"grid grid-cols-7 gap-2",children:B.map(x=>jsx("div",{className:"text-center",children:x},x))}),jsx("div",{className:"grid grid-cols-7 gap-2 mt-2",children:M.map(x=>{let R=getMonth(x)===r,S=format(x,"yyyy-MM-dd")===format(new Date,"yyyy-MM-dd"),k=c&&(Array.isArray(c)&&(c[0]&&format(x,"yyyy-MM-dd")===format(c[0],"yyyy-MM-dd")||c[1]&&format(x,"yyyy-MM-dd")===format(c[1],"yyyy-MM-dd"))||!Array.isArray(c)&&format(x,"yyyy-MM-dd")===format(c,"yyyy-MM-dd")),Q=c&&Array.isArray(c)&&c[0]&&c[1]&&x>c[0]&&x<c[1],q=p&&differenceInDays(x,p)<0||h&&differenceInDays(x,h)>0||!R;return jsx(Wo,{date:x,isCurrentMonth:R,isCurrentDay:S,isSelected:!!k,isInRange:!!Q,isDisabled:!!q,onSelectDate:b},x.toISOString())})})]})},"DatePickerCalendar"),Wo=a(({date:r,isCurrentMonth:o,isCurrentDay:c,isSelected:p,isInRange:h,isDisabled:b,onSelectDate:f})=>jsx("div",{className:`text-center p-2 cursor-pointer rounded ${b?"text-gray-400 cursor-not-allowed":p?"bg-blue-500 text-white":h?"bg-blue-100":c?"text-blue-500":o?"text-black":"text-gray-400"} ${b?"":p?"hover:bg-blue-600":"hover:bg-gray-100"}`,onClick:a(L=>{b||f(r);},"handleClick"),children:format(r,"d")}),"CalendarDay");var _o=a(r=>{switch(r){case "primary":return "bg-blue-100 border-blue-200 dark:bg-blue-800/10 dark:border-blue-900";case "error":return "bg-red-100 border-red-200 dark:bg-red-800/10 dark:border-red-900";case "warning":return "bg-yellow-100 border-yellow-200 dark:bg-yellow-800/10 dark:border-yellow-900";case "success":return "bg-teal-100 border-teal-200 dark:bg-teal-800/10 dark:border-teal-900";case "default":default:return "bg-white border border-gray-200 dark:bg-neutral-800 dark:border-neutral-700"}},"getColorStyle"),Go=a(r=>{switch(r){case "primary":return "text-blue-800 dark:text-blue-500";case "error":return "text-red-800 dark:text-red-500";case "warning":return "text-yellow-800 dark:text-yellow-500";case "success":return "text-teal-800 dark:text-teal-500";case "default":default:return "text-gray-800 dark:text-white"}},"getTextColor"),Vo=a(r=>{switch(r){case "bottom":return "translate-y-4";case "top":default:return "-translate-y-4"}},"getTransitionStarting"),nr=a(({id:r,color:o="default",message:c,duration:p,transitionDirection:h,cancelable:b=true,onClose:f})=>{let[P,L]=useState(false),[E,B]=useState(false),M=useRef(null),C=useCallback(()=>{L(true),M.current=setTimeout(()=>{f(r);},300);},[r,f]);return useEffect(()=>{if(B(true),p&&p<1/0){let $=setTimeout(()=>{C();},p);return ()=>clearTimeout($)}},[p,C]),useEffect(()=>()=>{M.current&&clearTimeout(M.current);},[]),jsx("div",{className:`max-w-xs
|
|
66
|
+
`);var jt=a(({url:r})=>{let[o,c]=useState(1),[p,h]=useState(),b=Rt.useRef(null),f=Rt.useRef(null),P=a(()=>{c(E=>Math.min(E+.25,4));},"handleZoomIn");return jsxs("div",{ref:f,className:"h-full w-full flex flex-col",children:[jsxs("div",{className:"flex justify-center items-stretch p-5.5 gap-1 border-b border-gray-200 relative ",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"secondary",size:"small",icon:jsx(Pa,{style:{width:20,height:20}}),onClick:a(()=>{c(E=>Math.max(E-.25,.25));},"handleZoomOut"),disabled:o<=.25,p:5}),jsxs(ob,{py:5,px:8,children:[o*100,"%"]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"secondary",icon:jsx(ma,{style:{width:14,height:14}}),onClick:P,disabled:o>=4,p:8})]}),jsx("div",{className:"h-full w-full overflow-auto",children:jsx("img",{src:r,ref:b,alt:"image",className:"block w-auto max-w-none object-contain",style:{transition:"all 0.2s ease-in-out",marginInline:"auto",marginBlock:10,flexShrink:0,...p==="width"&&{width:`calc(${o*100}% - 20px)`},...p==="height"&&{height:`calc(${o*100}% - 20px)`}},onLoad:()=>{if(b.current&&f.current){let E=b.current.width,B=b.current.height,M=E<B?"height":"width";h(M);}}})})]})},"ImageDriver");var Ft=a(({url:r})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full p-5.5",children:jsx("audio",{controls:true,src:r,className:"w-full"})}),"AudioDriver");var Ue=a(({url:r})=>{let[o,c]=useState(null),[p,h]=useState(false),[b,f]=useState(true),[P,L]=useState(null);return useEffect(()=>{h(true);},[]),useEffect(()=>{if(!p)return;a(async()=>{try{let B=await import('./PdfDriver-3CHKFA4R.mjs');c(()=>B.PdfDriver),f(!1);}catch(B){console.error("Failed to load PDF driver:",B),L("Failed to load PDF viewer"),f(false);}},"loadPdfDriver")();},[p]),p?b?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500",children:"Loading PDF viewer..."})}):P||!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:P||"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 Ot=50,no=1e4,Ht=a(({url:r,blob:o})=>{let c=useRef(null),[p,h]=useState(null),[b,f]=useState(true);return useEffect(()=>{a(async()=>{if(c.current)try{if(f(!0),h(null),!o&&r&&(o=await(await fetch(r)).blob()),!o){h("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(o.size/(1024*1024)>Ot){h(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${Ot} \u041C\u0411)`);return}c.current.innerHTML="";let E=renderAsync(o,c.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0}),B=new Promise((M,C)=>setTimeout(()=>C(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")),no));await Promise.race([E,B]),f(!1);}catch(L){h(L?.message||"\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438 DOCX \u0444\u0430\u0439\u043B"),f(false);}},"renderDocument")();},[r,o]),jsxs(Fragment$1,{children:[!!p&&!b&&jsx("div",{className:"text-red-500 p-5",children:p}),b&&jsx("div",{className:"flex items-center justify-center p-5",children:"\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F..."}),jsx("div",{ref:c,className:"w-full h-full overflow-auto [&_table]:w-full! [&>div.docx-wrapper]:w-full [&>div.docx-wrapper]:min-w-fit [&>div.docx-wrapper>section]:w-full!",style:{boxSizing:"border-box"}})]})},"DocxDriver");var bo=a(r=>({js:[javascript({jsx:false})],jsx:[javascript({jsx:true})],ts:[javascript({typescript:true,jsx:false})],tsx:[javascript({typescript:true,jsx:true})],json:[json()],html:[html()],css:[css()],scss:[css()],py:[python()],java:[java()],cpp:[cpp()],c:[cpp()],php:[php()],rs:[rust()],xml:[xml()],yaml:[yaml()],yml:[yaml()],md:[markdown()],sql:[sql()],sh:[markdown()],bash:[markdown()]})[r]||[],"getLanguageExtension"),Gt=a(({url:r,extension:o})=>{let[c,p]=useState(""),[h,b]=useState(true),[f,P]=useState(null),[L,E]=useState(0),B=useRef(null);if(useEffect(()=>{a(async()=>{try{b(!0),P(null);let $=await fetch(r);if(!$.ok)throw new Error(`Failed to load file: ${$.statusText}`);let t=await $.text();p(t);}catch($){P($ instanceof Error?$.message:"Failed to load text content");}finally{b(false);}},"loadTextContent")();},[r]),useEffect(()=>{let C=a(()=>{if(B.current){let $=B.current.clientHeight;E($);}},"updateHeight");return C(),window.addEventListener("resize",C),()=>{window.removeEventListener("resize",C);}},[h]),h)return jsx("div",{className:"flex items-center justify-center p-8",children:jsx("div",{className:"text-gray-500",children:"Loading text content..."})});if(f)return jsx("div",{className:"flex items-center justify-center p-8",children:jsxs("div",{className:"text-red-500",children:["Error: ",f]})});let M=bo(o);return jsx("div",{ref:B,className:"h-full w-full",children:L>0&&jsx(co,{value:c,theme:vscodeDark,extensions:M,editable:false,height:`${L}px`,basicSetup:{lineNumbers:true,highlightActiveLineGutter:false,highlightActiveLine:false,foldGutter:true,dropCursor:false,indentOnInput:false,syntaxHighlighting:true,bracketMatching:true,closeBrackets:false,autocompletion:false,rectangularSelection:false,crosshairCursor:false,highlightSelectionMatches:false,closeBracketsKeymap:false,searchKeymap:false,foldKeymap:true,completionKeymap:false,lintKeymap:false}})})},"TextDriver");var qt=a(({url:r})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full",children:jsx("video",{controls:true,src:r,className:"w-full max-h-full"})}),"VideoDriver");var Ut=memo(a(function({extension:o,blob:c,path:p,buffer:h,not_supported_message:b=" Sorry, this file type isn\u2019t supported yet."}){console.log("Driver props:",{extension:o,blob:c,path:p,buffer:h});let f=o.toLocaleLowerCase().trim(),P;if(p?P=p:c&&(P=URL.createObjectURL(c)),P){if(["jpeg","jpg","png","gif","bmp","webp"].includes(f))return jsx(jt,{url:P});if(["mp3","wav","ogg","flac"].includes(f))return jsx(Ft,{url:P});if(["mp4","webm"].includes(f))return jsx(qt,{url:P});if(o==="pdf")return jsx(Ue,{url:P});if(["txt","js","jsx","ts","tsx","json","html","css","scss","py","java","cpp","c","cs","php","rb","go","rs","swift","kt","xml","yaml","yml","md","sql","sh","bash"].includes(f))return jsx(Gt,{url:P,extension:f})}return f==="docx"?jsx(Ht,{url:P,blob:c}):jsx("div",{className:"h-full flex flex-col justify-center items-center",children:jsx(ob,{className:"mx-5",children:jsx(Ya,{variant:"h2",color:"text.light",weight:500,className:"text-center",children:b})})})},"Driver"));var Nc=a(r=>jsx("div",{className:"h-full w-full",children:jsx(Ut,{...r})}),"FileViewer");var Kt=250,Hc=a(({text:r,speed:o=50,onDone:c,markdown:p=false,markdownComponents:h={},className:b,...f})=>{let[P,L]=useState(""),E=useRef(null),B=useRef(null);return useEffect(()=>{let M=false;if(o>0){L(""),E.current=performance.now();let C=a($=>{if(M||!E.current)return;let t=$-E.current,O=t/o>Kt?o/2:o,U=t/o>Kt?1.5:1,x=Math.floor(t/O*U);if(x>=r.length){L(r),M=true,c?.();return}L(r.slice(0,x)),B.current=requestAnimationFrame(C);},"tick");B.current=requestAnimationFrame(C);}else L(r),c?.();return ()=>{B.current&&cancelAnimationFrame(B.current);}},[r,o,c]),p?jsx("div",{className:b,children:jsx(Po,{remarkPlugins:[So],components:h,...f,children:P})}):jsx(Ya,{className:b,...f,children:P})},"Typewriter");var Lo={timeout:2e3,message:"Copied!"},Jc=a(({text:r,children:o,format:c="text/plain",tooltip:p})=>{let[h,b]=useState(false),f=useRef(null),P={...Lo,...p},L=a(async()=>{"clipboard"in navigator?await navigator.clipboard.writeText(r):Mo(r,{format:c}),b(true),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>b(false),P.timeout);},"handleCopy");return useEffect(()=>()=>{f.current&&clearTimeout(f.current);},[]),jsx(Ab,{onMouseLeave:()=>b(false),className:h?"visible":"hidden",content:P.message,children:o({copy:L})})},"CopyToClipboard");var Qt=a(r=>new Date(r?Array.isArray(r)?r[1]||r[0]||new Date:r:new Date),"getInitValue"),$e=a((r,o)=>{let c;if(o){let h=parse(r||"",o,new Date);if(isValid(h)&&getYear(h)>=1970)return h}let p=new Date(r||"");return isNaN(p.getTime())?c:p},"parseDate"),$o=a((r,o)=>{let c=r?$e(r,o):void 0;return c&&o?format(c,o):r},"renderDate"),dl=a(({value:r,range:o,inline:c=false,minDate:p=new Date(getYear(new Date)-5,0,1),maxDate:h=new Date(getYear(new Date)+5,11,31),format:b="dd.MM.yyyy",onChange:f,...P})=>{let[L,E]=useState(getMonth(Qt(r))),[B,M]=useState(getYear(Qt(r))),C=useMemo(()=>{if(r){if(Array.isArray(r)){let t=$e(r[0],b),O=$e(r[1],b);return [t,O]}return $e(r,b)}},[r]),$=useCallback(t=>{if(o){let O=!!(C&&Array.isArray(C)&&C[0]),U=!!(C&&Array.isArray(C)&&C[1]);!O||O&&U?f?.([t.toString(),""]):O&&!U&&(t<C[0]?f?.([t.toString(),C[0].toString()]):f?.([C[0].toString(),t.toString()]));}else f?.(t.toString());},[o,C,f]);return c?jsx(er,{month:L,year:B,minDate:p,maxDate:h,selectedDate:C,onSelectDate:$,onChangeMonth:E,onChangeYear:M}):o?jsx(Oo,{range:true,value:r,onChange:f,...P}):jsx(Ho,{value:r,onChange:f,minDate:p,maxDate:h,month:L,year:B,selectedDate:C,onChangeMonth:E,onChangeYear:M,onSelectDate:$,formatStr:b,...P})},"DatePicker"),Oo=a(({minDate:r,maxDate:o,value:c,onChange:p})=>null,"DatePickerGroupInput"),Ho=a(({placeholder:r,value:o,onChange:c,inputProps:p,...h})=>{let[b,f]=useState(false),P=y();return jsx(Popover,{positions:["bottom","top","right","left"],align:"start",isOpen:b,onClickOutside:()=>f(false),content:jsx(ob,{children:jsx(er,{...h})}),containerStyle:{zIndex:`${P.zIndex.popover}`},children:jsx("div",{onClick:()=>f(true),children:jsx(kb,{...p,placeholder:r,value:$o(o,h.formatStr),onChange:L=>c?.(L.target.value)})})})},"DatePickerInput"),er=a(({month:r,year:o,selectedDate:c,minDate:p,maxDate:h,onSelectDate:b,onChangeMonth:f,onChangeYear:P})=>{let L=useMemo(()=>new Array(12).fill(null).map((x,R)=>{let S=new Date(0,R);return {value:R+1,inputDisplay:format(S,"MMMM")}}),[]),E=useMemo(()=>{let x=getYear(p),S=getYear(h)-x+1;return new Array(S).fill(null).map((k,Q)=>{let q=x+Q;return {value:q,inputDisplay:q.toString()}})},[p,h]),B=useMemo(()=>new Array(7).fill(null).map((x,R)=>{let S=startOfWeek(new Date,{weekStartsOn:R});return format(S,"EEE")}),[]),M=useMemo(()=>{let x=getWeeksInMonth(new Date(o,r)),R=startOfMonth(new Date(o,r)),S=previousMonday(R),k=differenceInDays(R,S);return new Array(x*7).fill(null).map((Q,q)=>new Date(o,r,q-k+1))},[r,o]),C=useCallback(()=>{r===0?(P(o-1),f(11)):f(r-1);},[r,o]),$=useCallback(()=>{r===11?(P(o+1),f(0)):f(r+1);},[r,o]),t=useMemo(()=>p?!(o<getYear(p)||o===getYear(p)&&r<=getMonth(p)):true,[r,o,p]),O=useMemo(()=>h?!(o>getYear(h)||o===getYear(h)&&r>=getMonth(h)):true,[r,o,h]),U=useCallback(x=>{x.stopPropagation();},[]);return jsxs("div",{className:"flex flex-col date-picker-calendar",onClick:U,children:[jsxs("div",{className:"flex justify-center items-center gap-2 pb-3",children:[t&&jsx(z,{size:"small",variant:"empty",icon:jsx(G,{}),onClick:C}),jsxs("div",{className:"flex-1 flex justify-center gap-1",children:[jsx(ib,{placeholder:"",hasBorder:false,selected:r+1,options:L,onSelect:x=>f(x-1),maxWidth:150,maxHeight:300}),jsx(ib,{placeholder:"",hasBorder:false,selected:o,options:E,onSelect:x=>P(x),maxWidth:100,maxHeight:300})]}),O&&jsx(z,{size:"small",variant:"empty",icon:jsx(H,{}),onClick:$})]}),jsx("div",{className:"grid grid-cols-7 gap-2",children:B.map(x=>jsx("div",{className:"text-center",children:x},x))}),jsx("div",{className:"grid grid-cols-7 gap-2 mt-2",children:M.map(x=>{let R=getMonth(x)===r,S=format(x,"yyyy-MM-dd")===format(new Date,"yyyy-MM-dd"),k=c&&(Array.isArray(c)&&(c[0]&&format(x,"yyyy-MM-dd")===format(c[0],"yyyy-MM-dd")||c[1]&&format(x,"yyyy-MM-dd")===format(c[1],"yyyy-MM-dd"))||!Array.isArray(c)&&format(x,"yyyy-MM-dd")===format(c,"yyyy-MM-dd")),Q=c&&Array.isArray(c)&&c[0]&&c[1]&&x>c[0]&&x<c[1],q=p&&differenceInDays(x,p)<0||h&&differenceInDays(x,h)>0||!R;return jsx(Wo,{date:x,isCurrentMonth:R,isCurrentDay:S,isSelected:!!k,isInRange:!!Q,isDisabled:!!q,onSelectDate:b},x.toISOString())})})]})},"DatePickerCalendar"),Wo=a(({date:r,isCurrentMonth:o,isCurrentDay:c,isSelected:p,isInRange:h,isDisabled:b,onSelectDate:f})=>jsx("div",{className:`text-center p-2 cursor-pointer rounded ${b?"text-gray-400 cursor-not-allowed":p?"bg-blue-500 text-white":h?"bg-blue-100":c?"text-blue-500":o?"text-black":"text-gray-400"} ${b?"":p?"hover:bg-blue-600":"hover:bg-gray-100"}`,onClick:a(L=>{b||f(r);},"handleClick"),children:format(r,"d")}),"CalendarDay");var _o=a(r=>{switch(r){case "primary":return "bg-blue-100 border-blue-200 dark:bg-blue-800/10 dark:border-blue-900";case "error":return "bg-red-100 border-red-200 dark:bg-red-800/10 dark:border-red-900";case "warning":return "bg-yellow-100 border-yellow-200 dark:bg-yellow-800/10 dark:border-yellow-900";case "success":return "bg-teal-100 border-teal-200 dark:bg-teal-800/10 dark:border-teal-900";case "default":default:return "bg-white border border-gray-200 dark:bg-neutral-800 dark:border-neutral-700"}},"getColorStyle"),Go=a(r=>{switch(r){case "primary":return "text-blue-800 dark:text-blue-500";case "error":return "text-red-800 dark:text-red-500";case "warning":return "text-yellow-800 dark:text-yellow-500";case "success":return "text-teal-800 dark:text-teal-500";case "default":default:return "text-gray-800 dark:text-white"}},"getTextColor"),Vo=a(r=>{switch(r){case "bottom":return "translate-y-4";case "top":default:return "-translate-y-4"}},"getTransitionStarting"),nr=a(({id:r,color:o="default",message:c,duration:p,transitionDirection:h,cancelable:b=true,onClose:f})=>{let[P,L]=useState(false),[E,B]=useState(false),M=useRef(null),C=useCallback(()=>{L(true),M.current=setTimeout(()=>{f(r);},300);},[r,f]);return useEffect(()=>{if(B(true),p&&p<1/0){let $=setTimeout(()=>{C();},p);return ()=>clearTimeout($)}},[p,C]),useEffect(()=>()=>{M.current&&clearTimeout(M.current);},[]),jsx("div",{className:`max-w-xs
|
|
67
67
|
border
|
|
68
68
|
w-full
|
|
69
69
|
text-sm
|