efficient-shell 4.175.0 → 4.179.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.
Files changed (70) hide show
  1. package/README.md +426 -6
  2. package/dist/{Browser-PZIVSYLM.js → Browser-LZMLL4CZ.js} +14 -14
  3. package/dist/Calculator-R5OEHQ67.js +29 -0
  4. package/dist/ConfirmDialog-CMNQZQA3.js +1 -0
  5. package/dist/{CurrencyConverter-4RZZ5STO.js → CurrencyConverter-AMXUOQR2.js} +7 -7
  6. package/dist/{Documents-ERSFDOCV.js → Documents-M4HKZAPJ.js} +12 -12
  7. package/dist/{Files-3J2DW6ET.js → Files-OY5GKCXA.js} +24 -24
  8. package/dist/Notepad-JLDNTMVB.js +25 -0
  9. package/dist/PdfViewer-3SC3LE4U.js +1 -0
  10. package/dist/{PomodoroTimer-D6VQJICB.js → PomodoroTimer-LE6J2KUU.js} +24 -24
  11. package/dist/Preview-2KHLL6NP.js +188 -0
  12. package/dist/{Sidebar-2BZJ2MEI.js → Sidebar-BQ4P5LBI.js} +25 -25
  13. package/dist/Spreadsheet-B5Z5MSX4.js +37 -0
  14. package/dist/{Stock-KRPM6NSB.js → Stock-GWVG2INU.js} +4 -4
  15. package/dist/{Weather-HRH4JHTF.js → Weather-APBCG4TO.js} +13 -13
  16. package/dist/{WorldClock-OUSV52XM.js → WorldClock-2LMZYKWR.js} +7 -7
  17. package/dist/apps/index.d.ts +4 -2
  18. package/dist/apps/index.js +1 -1
  19. package/dist/bin/ui-check.js +1 -1
  20. package/dist/{chunk-L3U2R7DH.js → chunk-3DGTIWZP.js} +1 -1
  21. package/dist/{chunk-6BZCJQCT.js → chunk-47VJNVB6.js} +643 -643
  22. package/dist/{chunk-KS7OSQ3Y.js → chunk-5ZDM6WIC.js} +11 -11
  23. package/dist/{chunk-E2D54MVV.js → chunk-6CFBF543.js} +2 -2
  24. package/dist/{chunk-LCTSBQBJ.js → chunk-7WZEFHPS.js} +1 -1
  25. package/dist/{chunk-PGVUO7GB.js → chunk-AA4TMQOS.js} +3 -3
  26. package/dist/chunk-AZURXTRB.js +1 -0
  27. package/dist/chunk-C3QOHMR6.js +1 -0
  28. package/dist/{chunk-YJRC6IKD.js → chunk-CIXQKCFA.js} +4 -4
  29. package/dist/chunk-CZK2VKIO.js +9 -0
  30. package/dist/{chunk-KG4NRNFS.js → chunk-FORN7LG7.js} +1 -1
  31. package/dist/chunk-J3LIIIHJ.js +1 -0
  32. package/dist/chunk-KDRAU4XQ.js +27 -0
  33. package/dist/{chunk-ZOPYAOUP.js → chunk-KVOFUFPP.js} +1 -1
  34. package/dist/{chunk-KDHXRJIX.js → chunk-LK7V32MR.js} +1 -1
  35. package/dist/{chunk-GCO3A63X.js → chunk-N6STBYXR.js} +111 -111
  36. package/dist/{chunk-54OP3M3K.js → chunk-NHIGOEZF.js} +1 -1
  37. package/dist/{chunk-EXXHI5DO.js → chunk-OGXU7QFW.js} +2 -2
  38. package/dist/{chunk-JOOXVX4A.js → chunk-PE4F4MJE.js} +4 -4
  39. package/dist/chunk-R7EBJKN2.js +69 -0
  40. package/dist/{chunk-TMQEH7WA.js → chunk-SVO3ES2E.js} +1 -1
  41. package/dist/{chunk-RKR5V4QR.js → chunk-T4CFSGSL.js} +6 -6
  42. package/dist/{chunk-D3UQLWIZ.js → chunk-UAIVAA5X.js} +11 -11
  43. package/dist/{chunk-REXHKIIJ.js → chunk-WNEO7TSP.js} +1 -1
  44. package/dist/{chunk-XJYXKO7K.js → chunk-ZAE6ROV7.js} +15 -15
  45. package/dist/file-intake/index.js +1 -1
  46. package/dist/i18n/index.d.ts +79 -0
  47. package/dist/i18n/index.js +2 -0
  48. package/dist/{index-DIaav9a1.d.ts → index-DcUj0nXY.d.ts} +39 -927
  49. package/dist/index.d.ts +3 -2
  50. package/dist/index.js +656 -656
  51. package/dist/locales/zh-Hans.d.ts +59 -0
  52. package/dist/locales/zh-Hans.js +1 -0
  53. package/dist/map/index.js +3 -3
  54. package/dist/page-tabs/index.js +5 -5
  55. package/dist/pdf/index.js +1 -1
  56. package/dist/strings-ZbotP_I6.d.ts +1292 -0
  57. package/dist/ui/index.d.ts +2 -1
  58. package/dist/ui/index.js +1 -1
  59. package/package.json +21 -1
  60. package/dist/Calculator-6BJVESFN.js +0 -29
  61. package/dist/ConfirmDialog-6PVUVYXZ.js +0 -1
  62. package/dist/Notepad-MVMFJE2F.js +0 -25
  63. package/dist/PdfViewer-RKRGO7Q2.js +0 -1
  64. package/dist/Preview-VIHMVC7B.js +0 -187
  65. package/dist/Spreadsheet-KTB6JLBV.js +0 -37
  66. package/dist/chunk-3YTHR7IC.js +0 -1
  67. package/dist/chunk-7LAPNAKS.js +0 -1
  68. package/dist/chunk-FEK5ELXS.js +0 -27
  69. package/dist/chunk-VIIBZ6DE.js +0 -69
  70. package/dist/chunk-VRLHUZSC.js +0 -9
@@ -1,4 +1,4 @@
1
- import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-TMQEH7WA.js";import{subscribePomo as a,getPomoSnapshot as o,setPomoDurations as r,setPomoAlarm as n,setPomoAlarmConfig as l,setPomoBehaviour as s,setPomoFocusSound as i,useTodoTasks as c,migratePomodoroTasksOnce as d,pomoSwitchMode as u,pomoPause as m,pomoStart as h,ALARM_OPTIONS as p,playAlarm as g,FOCUS_SOUND_OPTIONS as f,previewFocusSound as b}from"./chunk-E2D54MVV.js";import{useWidgetSettings as x}from"./chunk-GCO3A63X.js";import"./chunk-DSSLOQDW.js";import"./chunk-ZOPYAOUP.js";import"./chunk-L3U2R7DH.js";import{useShellPrefs as k}from"./chunk-YJRC6IKD.js";import"./chunk-5A7MWTXX.js";import"./chunk-EXXHI5DO.js";import"./chunk-PGVUO7GB.js";import"./chunk-HZZNJHRH.js";import"./chunk-D65T4H6J.js";import"./chunk-XJYXKO7K.js";import"./chunk-AFYQTVZO.js";import"./chunk-X4FJ54PP.js";import"./chunk-3YTHR7IC.js";import"./chunk-YKZHOXI4.js";import{useSyncExternalStore as v,useEffect as y,useMemo as N,useState as w,useRef as C,useCallback as S}from"react";import{jsxs as B,Fragment as M,jsx as T}from"react/jsx-runtime";var j="pomodoro_appearance",P="pomodoro_active_task_id",I={focus:"Pomodoro",short:"Short Break",long:"Long Break"},A={focus:"#0f172a",short:"#508a52",long:"#5b7898"};var D=25,L=5,$=15,V=!1,O=!1,R=4,_=!0,E=!0,H="bell",W=100,X=1,F="none",J=50,K=(e,t,a,o)=>"number"==typeof e&&isFinite(e)?Math.max(t,Math.min(a,Math.round(e))):o;function Y(){const t=v(a,o,o),{prefs:g,save:b}=k(),Y=function(e){const t=e&&"object"==typeof e?e:{};return{focusMinutes:K(t.focusMinutes,1,120,D),shortBreakMinutes:K(t.shortBreakMinutes,1,120,L),longBreakMinutes:K(t.longBreakMinutes,1,120,$),autoStartBreaks:"boolean"==typeof t.autoStartBreaks?t.autoStartBreaks:V,autoStartPomodoros:"boolean"==typeof t.autoStartPomodoros?t.autoStartPomodoros:O,longBreakInterval:K(t.longBreakInterval,1,20,R),autoCheckTasks:"boolean"==typeof t.autoCheckTasks?t.autoCheckTasks:_,checkToBottom:"boolean"==typeof t.checkToBottom?t.checkToBottom:E,alarmSound:p.some(e=>e.id===t.alarmSound)?t.alarmSound:H,alarmVolume:K(t.alarmVolume,0,100,W),alarmRepeat:K(t.alarmRepeat,1,5,X),focusSound:f.some(e=>e.id===t.focusSound)?t.focusSound:F,focusVolume:K(t.focusVolume,0,100,J)}}(g.pomodoro_settings);y(()=>{r({focus:60*Y.focusMinutes,short:60*Y.shortBreakMinutes,long:60*Y.longBreakMinutes})},[Y.focusMinutes,Y.shortBreakMinutes,Y.longBreakMinutes]),y(()=>{n(Y.alarmSound),l(Y.alarmVolume,Y.alarmRepeat)},[Y.alarmSound,Y.alarmVolume,Y.alarmRepeat]),y(()=>{s({autoStartBreaks:Y.autoStartBreaks,autoStartPomodoros:Y.autoStartPomodoros,longBreakInterval:Y.longBreakInterval})},[Y.autoStartBreaks,Y.autoStartPomodoros,Y.longBreakInterval]),y(()=>{i(Y.focusSound,Y.focusVolume)},[Y.focusSound,Y.focusVolume]),y(()=>{if("undefined"!=typeof Notification&&"default"===Notification.permission)try{Notification.requestPermission()}catch{}},[]);const U=c(),Z=U.tasks,G=N(()=>/* @__PURE__ */(new Date).toISOString().slice(0,10),[]),Q=function(e,t){return N(()=>t?(e=>{const t=[],a=[];for(const o of e)(o.done?a:t).push(o);return[...t,...a]})(e):e,[e,t])}(N(()=>Z.filter(e=>!!e.dueDate&&(e.dueDate===G||e.dueDate<G&&!e.done)),[Z,G]),Y.checkToBottom),[q,ee]=w(()=>localStorage.getItem(P)),[te,ae]=w(!1),[oe,re]=w(null),ne=C(!1);y(()=>{ne.current||(ne.current=!0,d(Z,U.setAllTasks))},[]),y(()=>{try{q?localStorage.setItem(P,q):localStorage.removeItem(P)}catch{}},[q]),y(()=>{if(!oe)return;const e=()=>re(null),t=setTimeout(()=>document.addEventListener("click",e),0);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[oe]);const se=C(t.streak);y(()=>{if(t.streak>se.current&&q){const e=Z.find(e=>e.id===q);if(e){const t=(e.completed??0)+1,a=e.estimated??0,o=Y.autoCheckTasks&&a>0&&t>=a;U.updateTask(q,{completed:t,done:e.done||o})}}se.current=t.streak},[t.streak,q,Y.autoCheckTasks,Z,U]);const ie=Q.reduce((e,t)=>e+(t.completed??0),0),ce=Q.reduce((e,t)=>e+Math.max(t.estimated??0,t.completed??0),0),de=Q.reduce((e,t)=>t.done?e:e+Math.max(0,(t.estimated??0)-(t.completed??0)),0),ue=t.running&&"focus"===t.mode?t.remaining:0,me=de*Y.focusMinutes*60+ue,he=new Date(Date.now()+1e3*me).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),pe=(me/3600).toFixed(1),ge=q?Z.find(e=>e.id===q)??null:null,fe=String(Math.floor(t.remaining/60)).padStart(2,"0"),be=String(t.remaining%60).padStart(2,"0"),[xe,ke]=w(()=>e(j)),[ve,ye]=w(!1),[Ne,we]=w(xe),[Ce,Se]=w(Y);x(S(()=>{we({...xe}),Se({...Y}),ye(!0)},[xe,Y]));const Be="focus"!==t.mode,Me=A[t.mode],Te=Be?(je=Me,Pe=xe.activeOpacity/100,`rgba(${parseInt(je.slice(1,3),16)}, ${parseInt(je.slice(3,5),16)}, ${parseInt(je.slice(5,7),16)}, ${Pe})`):`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${xe.activeOpacity/100})`;var je,Pe;const Ie={primary:Be?"text-white":"text-gray-900",secondary:Be?"text-white/85":"text-gray-700",muted:Be?"text-white/65":"text-gray-500",tabActive:Be?"bg-white/15 text-white":"bg-gray-200 text-gray-900",tabInactive:Be?"text-white/75 hover:bg-white/10":"text-gray-500 hover:bg-gray-200",divider:Be?"border-white/30":"border-gray-200",softDivider:Be?"border-white/20":"border-gray-200",iconBtn:Be?"bg-black/15 hover:bg-black/25 text-white/85":"bg-gray-200 hover:bg-gray-300 text-gray-600",addTaskBtn:Be?"border-white/45 text-white/90 hover:bg-white/[0.06]":"border-gray-300 text-gray-500 hover:bg-gray-200/50"},Ae=Be?Me:"#0f172a";/* @__PURE__ */
1
+ import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-SVO3ES2E.js";import{subscribePomo as a,getPomoSnapshot as o,setPomoDurations as r,setPomoAlarm as n,setPomoAlarmConfig as l,setPomoBehaviour as s,setPomoFocusSound as i,useTodoTasks as c,migratePomodoroTasksOnce as d,pomoSwitchMode as u,pomoPause as m,pomoStart as h,ALARM_OPTIONS as p,playAlarm as g,FOCUS_SOUND_OPTIONS as f,previewFocusSound as b}from"./chunk-6CFBF543.js";import{useWidgetSettings as x}from"./chunk-N6STBYXR.js";import"./chunk-DSSLOQDW.js";import"./chunk-KVOFUFPP.js";import"./chunk-3DGTIWZP.js";import{useShellPrefs as k}from"./chunk-CIXQKCFA.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-ZAE6ROV7.js";import"./chunk-AA4TMQOS.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import"./chunk-YKZHOXI4.js";import{useSyncExternalStore as v,useEffect as y,useMemo as N,useState as w,useRef as C,useCallback as S}from"react";import{jsxs as B,Fragment as M,jsx as T}from"react/jsx-runtime";var j="pomodoro_appearance",P="pomodoro_active_task_id",I={focus:"Pomodoro",short:"Short Break",long:"Long Break"},A={focus:"#0f172a",short:"#508a52",long:"#5b7898"};var L=25,$=5,V=15,D=!1,F=!1,O=4,R=!0,_=!0,W="bell",E=100,H=1,X="none",J=50,Q=(e,t,a,o)=>"number"==typeof e&&isFinite(e)?Math.max(t,Math.min(a,Math.round(e))):o;function Z(){const t=v(a,o,o),{prefs:g,save:b}=k(),Z=function(e){const t=e&&"object"==typeof e?e:{};return{focusMinutes:Q(t.focusMinutes,1,120,L),shortBreakMinutes:Q(t.shortBreakMinutes,1,120,$),longBreakMinutes:Q(t.longBreakMinutes,1,120,V),autoStartBreaks:"boolean"==typeof t.autoStartBreaks?t.autoStartBreaks:D,autoStartPomodoros:"boolean"==typeof t.autoStartPomodoros?t.autoStartPomodoros:F,longBreakInterval:Q(t.longBreakInterval,1,20,O),autoCheckTasks:"boolean"==typeof t.autoCheckTasks?t.autoCheckTasks:R,checkToBottom:"boolean"==typeof t.checkToBottom?t.checkToBottom:_,alarmSound:p.some(e=>e.id===t.alarmSound)?t.alarmSound:W,alarmVolume:Q(t.alarmVolume,0,100,E),alarmRepeat:Q(t.alarmRepeat,1,5,H),focusSound:f.some(e=>e.id===t.focusSound)?t.focusSound:X,focusVolume:Q(t.focusVolume,0,100,J)}}(g.pomodoro_settings);y(()=>{r({focus:60*Z.focusMinutes,short:60*Z.shortBreakMinutes,long:60*Z.longBreakMinutes})},[Z.focusMinutes,Z.shortBreakMinutes,Z.longBreakMinutes]),y(()=>{n(Z.alarmSound),l(Z.alarmVolume,Z.alarmRepeat)},[Z.alarmSound,Z.alarmVolume,Z.alarmRepeat]),y(()=>{s({autoStartBreaks:Z.autoStartBreaks,autoStartPomodoros:Z.autoStartPomodoros,longBreakInterval:Z.longBreakInterval})},[Z.autoStartBreaks,Z.autoStartPomodoros,Z.longBreakInterval]),y(()=>{i(Z.focusSound,Z.focusVolume)},[Z.focusSound,Z.focusVolume]),y(()=>{if("undefined"!=typeof Notification&&"default"===Notification.permission)try{Notification.requestPermission()}catch{}},[]);const K=c(),U=K.tasks,Y=N(()=>/* @__PURE__ */(new Date).toISOString().slice(0,10),[]),G=function(e,t){return N(()=>t?(e=>{const t=[],a=[];for(const o of e)(o.done?a:t).push(o);return[...t,...a]})(e):e,[e,t])}(N(()=>U.filter(e=>!!e.dueDate&&(e.dueDate===Y||e.dueDate<Y&&!e.done)),[U,Y]),Z.checkToBottom),[q,ee]=w(()=>localStorage.getItem(P)),[te,ae]=w(!1),[oe,re]=w(null),ne=C(!1);y(()=>{ne.current||(ne.current=!0,d(U,K.setAllTasks))},[]),y(()=>{try{q?localStorage.setItem(P,q):localStorage.removeItem(P)}catch{}},[q]),y(()=>{if(!oe)return;const e=()=>re(null),t=setTimeout(()=>document.addEventListener("click",e),0);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[oe]);const se=C(t.streak);y(()=>{if(t.streak>se.current&&q){const e=U.find(e=>e.id===q);if(e){const t=(e.completed??0)+1,a=e.estimated??0,o=Z.autoCheckTasks&&a>0&&t>=a;K.updateTask(q,{completed:t,done:e.done||o})}}se.current=t.streak},[t.streak,q,Z.autoCheckTasks,U,K]);const ie=G.reduce((e,t)=>e+(t.completed??0),0),ce=G.reduce((e,t)=>e+Math.max(t.estimated??0,t.completed??0),0),de=G.reduce((e,t)=>t.done?e:e+Math.max(0,(t.estimated??0)-(t.completed??0)),0),ue=t.running&&"focus"===t.mode?t.remaining:0,me=de*Z.focusMinutes*60+ue,he=new Date(Date.now()+1e3*me).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),pe=(me/3600).toFixed(1),ge=q?U.find(e=>e.id===q)??null:null,fe=String(Math.floor(t.remaining/60)).padStart(2,"0"),be=String(t.remaining%60).padStart(2,"0"),[xe,ke]=w(()=>e(j)),[ve,ye]=w(!1),[Ne,we]=w(xe),[Ce,Se]=w(Z);x(S(()=>{we({...xe}),Se({...Z}),ye(!0)},[xe,Z]));const Be="focus"!==t.mode,Me=A[t.mode],Te=Be?(je=Me,Pe=xe.activeOpacity/100,`rgba(${parseInt(je.slice(1,3),16)}, ${parseInt(je.slice(3,5),16)}, ${parseInt(je.slice(5,7),16)}, ${Pe})`):`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${xe.activeOpacity/100})`;var je,Pe;const Ie={primary:Be?"text-white":"text-gray-900",secondary:Be?"text-white/85":"text-gray-700",muted:Be?"text-white/65":"text-gray-500",tabActive:Be?"bg-white/15 text-white":"bg-gray-200 text-gray-900",tabInactive:Be?"text-white/75 hover:bg-white/10":"text-gray-500 hover:bg-gray-200",divider:Be?"border-white/30":"border-gray-200",softDivider:Be?"border-white/20":"border-gray-200",iconBtn:Be?"bg-black/15 hover:bg-black/25 text-white/85":"bg-gray-200 hover:bg-gray-300 text-gray-600",addTaskBtn:Be?"border-white/45 text-white/90 hover:bg-white/[0.06]":"border-gray-300 text-gray-500 hover:bg-gray-200/50"},Ae=Be?Me:"#0f172a";/* @__PURE__ */
2
2
  return B(M,{children:[
3
3
  /* @__PURE__ */B("div",{className:`flex flex-col h-full select-none transition-colors duration-300 ${Ie.primary}`,style:{backgroundColor:Te,backdropFilter:xe.activeBlur>0?`blur(${xe.activeBlur}px)`:void 0},children:[
4
4
  /* @__PURE__ */T("div",{className:"px-3 pt-3 flex justify-center gap-1.5",children:["focus","short","long"].map(e=>/* @__PURE__ */T("button",{onClick:()=>u(e),className:`px-2.5 py-1 text-[13px] font-bold rounded transition-colors ${t.mode===e?Ie.tabActive:Ie.tabInactive}`,children:I[e]},e))}),
@@ -14,9 +14,9 @@ return B(M,{children:[
14
14
  /* @__PURE__ */T("circle",{cx:"12",cy:"12",r:"1.4"}),
15
15
  /* @__PURE__ */T("circle",{cx:"12",cy:"19",r:"1.4"})]})})]}),
16
16
  /* @__PURE__ */T("div",{className:`border-t mx-3 mt-2 ${Ie.divider}`}),
17
- /* @__PURE__ */B("div",{className:"flex-1 px-3 py-3 space-y-2 overflow-y-auto",children:[Q.map(e=>{const t=e.id===q;/* @__PURE__ */
17
+ /* @__PURE__ */B("div",{className:"flex-1 px-3 py-3 space-y-2 overflow-y-auto",children:[G.map(e=>{const t=e.id===q;/* @__PURE__ */
18
18
  return B("div",{onClick:()=>ee(e.id),className:"bg-white text-gray-800 rounded-md flex items-center pr-2 py-2.5 shadow-sm cursor-pointer transition-shadow hover:shadow-md "+(t?"border-l-4 border-gray-700 pl-2":"pl-3 border-l-4 border-transparent"),children:[
19
- /* @__PURE__ */T("button",{onClick:t=>{var a;t.stopPropagation(),a=e.id,U.toggleDone(a)},className:"shrink-0",children:e.done?/* @__PURE__ */T("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",style:{color:Ae},children:/* @__PURE__ */T("path",{d:"M10 0a10 10 0 100 20 10 10 0 000-20zm-1 14.5l-4.5-4.5 1.4-1.4 3.1 3.1 6.1-6.1 1.4 1.4z"})}):/* @__PURE__ */T("svg",{className:"h-5 w-5 text-gray-300",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:/* @__PURE__ */T("circle",{cx:"12",cy:"12",r:"10"})})}),
19
+ /* @__PURE__ */T("button",{onClick:t=>{var a;t.stopPropagation(),a=e.id,K.toggleDone(a)},className:"shrink-0",children:e.done?/* @__PURE__ */T("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",style:{color:Ae},children:/* @__PURE__ */T("path",{d:"M10 0a10 10 0 100 20 10 10 0 000-20zm-1 14.5l-4.5-4.5 1.4-1.4 3.1 3.1 6.1-6.1 1.4 1.4z"})}):/* @__PURE__ */T("svg",{className:"h-5 w-5 text-gray-300",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:/* @__PURE__ */T("circle",{cx:"12",cy:"12",r:"10"})})}),
20
20
  /* @__PURE__ */T("span",{className:"ml-3 flex-1 font-semibold truncate "+(e.done?"line-through text-gray-400":"text-gray-800"),children:e.name}),
21
21
  /* @__PURE__ */B("span",{className:"text-sm tabular-nums mr-1.5 shrink-0",children:[
22
22
  /* @__PURE__ */T("span",{className:"font-bold text-gray-500",children:e.completed??0}),
@@ -26,7 +26,7 @@ return B("div",{onClick:()=>ee(e.id),className:"bg-white text-gray-800 rounded-m
26
26
  /* @__PURE__ */T("button",{onClick:t=>{t.stopPropagation(),re(oe===e.id?null:e.id)},className:"rounded p-1 bg-gray-100 hover:bg-gray-200",children:/* @__PURE__ */B("svg",{className:"h-4 w-4 text-gray-500",viewBox:"0 0 24 24",fill:"currentColor",children:[
27
27
  /* @__PURE__ */T("circle",{cx:"12",cy:"5",r:"1.4"}),
28
28
  /* @__PURE__ */T("circle",{cx:"12",cy:"12",r:"1.4"}),
29
- /* @__PURE__ */T("circle",{cx:"12",cy:"19",r:"1.4"})]})}),oe===e.id&&/* @__PURE__ */T("div",{className:"absolute right-0 top-full mt-1 bg-white text-gray-800 rounded shadow-lg border border-gray-200 z-10 min-w-[110px] overflow-hidden",onClick:e=>e.stopPropagation(),children:/* @__PURE__ */T("button",{onClick:t=>{var a;t.stopPropagation(),a=e.id,U.removeTask(a),q===a&&ee(null),re(null)},className:"block w-full px-3 py-1.5 text-sm text-left hover:bg-red-50 text-red-600",children:"Delete"})})]})]},e.id)}),te?/* @__PURE__ */T(le,{onSubmit:(e,t)=>{const a=e.trim();if(!a)return;const o=U.addTask({name:a,estimated:t,completed:0,dueDate:G});q||ee(o),ae(!1)},onCancel:()=>ae(!1),accentColor:Ae}):/* @__PURE__ */B("button",{onClick:()=>ae(!0),className:`w-full border-2 border-dashed rounded-md py-3 font-semibold flex items-center justify-center gap-2 transition-colors ${Ie.addTaskBtn}`,children:[
29
+ /* @__PURE__ */T("circle",{cx:"12",cy:"19",r:"1.4"})]})}),oe===e.id&&/* @__PURE__ */T("div",{className:"absolute right-0 top-full mt-1 bg-white text-gray-800 rounded shadow-lg border border-gray-200 z-10 min-w-[110px] overflow-hidden",onClick:e=>e.stopPropagation(),children:/* @__PURE__ */T("button",{onClick:t=>{var a;t.stopPropagation(),a=e.id,K.removeTask(a),q===a&&ee(null),re(null)},className:"block w-full px-3 py-1.5 text-sm text-left hover:bg-red-50 text-red-600",children:"Delete"})})]})]},e.id)}),te?/* @__PURE__ */T(le,{onSubmit:(e,t)=>{const a=e.trim();if(!a)return;const o=K.addTask({name:a,estimated:t,completed:0,dueDate:Y});q||ee(o),ae(!1)},onCancel:()=>ae(!1),accentColor:Ae}):/* @__PURE__ */B("button",{onClick:()=>ae(!0),className:`w-full border-2 border-dashed rounded-md py-3 font-semibold flex items-center justify-center gap-2 transition-colors ${Ie.addTaskBtn}`,children:[
30
30
  /* @__PURE__ */B("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
31
31
  /* @__PURE__ */T("circle",{cx:"12",cy:"12",r:"10"}),
32
32
  /* @__PURE__ */T("path",{strokeLinecap:"round",d:"M8 12h8M12 8v8"})]}),"Add Task"]})]}),
@@ -39,38 +39,38 @@ return B("div",{onClick:()=>ee(e.id),className:"bg-white text-gray-800 rounded-m
39
39
  /* @__PURE__ */B("span",{className:Ie.muted,children:[" (",pe,"h)"]})]})]})]}),
40
40
  /* @__PURE__ */T(z,{open:ve,onClose:()=>ye(!1),onSave:()=>{ke(Ne),localStorage.setItem(j,JSON.stringify(Ne)),b({pomodoro_settings:Ce}),ye(!1)},configAppearance:Ne,setConfigAppearance:we,configPrefs:Ce,setConfigPrefs:Se})]})}function z({open:e,onClose:a,onSave:o,configAppearance:r,setConfigAppearance:n,configPrefs:l,setConfigPrefs:s}){const i=(e,t)=>s(a=>({...a,[e]:t}));/* @__PURE__ */
41
41
  return B(t,{open:e,onClose:a,title:"Pomodoro Settings",appearance:r,onAppearanceChange:n,onSave:o,children:[
42
- /* @__PURE__ */B(U,{icon:/* @__PURE__ */T(oe,{}),label:"TIMER",children:[
42
+ /* @__PURE__ */B(K,{icon:/* @__PURE__ */T(oe,{}),label:"TIMER",children:[
43
43
  /* @__PURE__ */B("div",{children:[
44
44
  /* @__PURE__ */T("p",{className:"text-sm font-bold text-gray-800 mb-2",children:"Time (minutes)"}),
45
45
  /* @__PURE__ */B("div",{className:"grid grid-cols-3 gap-3",children:[
46
- /* @__PURE__ */T(Q,{label:"Pomodoro",value:l.focusMinutes,onChange:e=>i("focusMinutes",e),max:120}),
47
- /* @__PURE__ */T(Q,{label:"Short Break",value:l.shortBreakMinutes,onChange:e=>i("shortBreakMinutes",e),max:120}),
48
- /* @__PURE__ */T(Q,{label:"Long Break",value:l.longBreakMinutes,onChange:e=>i("longBreakMinutes",e),max:120})]})]}),
49
- /* @__PURE__ */T(Z,{label:"Auto Start Breaks",children:/* @__PURE__ */T(te,{checked:l.autoStartBreaks,onChange:e=>i("autoStartBreaks",e)})}),
50
- /* @__PURE__ */T(Z,{label:"Auto Start Pomodoros",children:/* @__PURE__ */T(te,{checked:l.autoStartPomodoros,onChange:e=>i("autoStartPomodoros",e)})}),
51
- /* @__PURE__ */T(Z,{label:"Long Break interval",children:/* @__PURE__ */T(q,{value:l.longBreakInterval,onChange:e=>i("longBreakInterval",e),min:1,max:20,className:"w-14 text-center"})})]}),
52
- /* @__PURE__ */B(U,{icon:/* @__PURE__ */T(re,{}),label:"TASK",children:[
53
- /* @__PURE__ */T(Z,{label:"Auto Check Tasks",info:'If you enable "Auto Check Tasks", the active task will be automatically checked when the actual pomodoro count reaches the estimated count.',children:/* @__PURE__ */T(te,{checked:l.autoCheckTasks,onChange:e=>i("autoCheckTasks",e)})}),
54
- /* @__PURE__ */T(Z,{label:"Check to Bottom",info:'If you enable "Check to Bottom", the checked task will be automatically moved to the bottom of the task list.',children:/* @__PURE__ */T(te,{checked:l.checkToBottom,onChange:e=>i("checkToBottom",e)})})]}),
55
- /* @__PURE__ */B(U,{icon:/* @__PURE__ */T(ne,{}),label:"SOUND",children:[
56
- /* @__PURE__ */T(Z,{label:"Alarm Sound",children:/* @__PURE__ */B("div",{className:"flex items-center gap-2",children:[
46
+ /* @__PURE__ */T(G,{label:"Pomodoro",value:l.focusMinutes,onChange:e=>i("focusMinutes",e),max:120}),
47
+ /* @__PURE__ */T(G,{label:"Short Break",value:l.shortBreakMinutes,onChange:e=>i("shortBreakMinutes",e),max:120}),
48
+ /* @__PURE__ */T(G,{label:"Long Break",value:l.longBreakMinutes,onChange:e=>i("longBreakMinutes",e),max:120})]})]}),
49
+ /* @__PURE__ */T(U,{label:"Auto Start Breaks",children:/* @__PURE__ */T(te,{checked:l.autoStartBreaks,onChange:e=>i("autoStartBreaks",e)})}),
50
+ /* @__PURE__ */T(U,{label:"Auto Start Pomodoros",children:/* @__PURE__ */T(te,{checked:l.autoStartPomodoros,onChange:e=>i("autoStartPomodoros",e)})}),
51
+ /* @__PURE__ */T(U,{label:"Long Break interval",children:/* @__PURE__ */T(q,{value:l.longBreakInterval,onChange:e=>i("longBreakInterval",e),min:1,max:20,className:"w-14 text-center"})})]}),
52
+ /* @__PURE__ */B(K,{icon:/* @__PURE__ */T(re,{}),label:"TASK",children:[
53
+ /* @__PURE__ */T(U,{label:"Auto Check Tasks",info:'If you enable "Auto Check Tasks", the active task will be automatically checked when the actual pomodoro count reaches the estimated count.',children:/* @__PURE__ */T(te,{checked:l.autoCheckTasks,onChange:e=>i("autoCheckTasks",e)})}),
54
+ /* @__PURE__ */T(U,{label:"Check to Bottom",info:'If you enable "Check to Bottom", the checked task will be automatically moved to the bottom of the task list.',children:/* @__PURE__ */T(te,{checked:l.checkToBottom,onChange:e=>i("checkToBottom",e)})})]}),
55
+ /* @__PURE__ */B(K,{icon:/* @__PURE__ */T(ne,{}),label:"SOUND",children:[
56
+ /* @__PURE__ */T(U,{label:"Alarm Sound",children:/* @__PURE__ */B("div",{className:"flex items-center gap-2",children:[
57
57
  /* @__PURE__ */T(ee,{value:l.alarmSound,onChange:e=>i("alarmSound",e),options:p.map(e=>({id:e.id,label:e.label}))}),"off"!==l.alarmSound&&/* @__PURE__ */T("button",{type:"button",onClick:()=>g(l.alarmSound,{volume:l.alarmVolume,repeat:1}),className:"px-2 py-1 text-[11px] rounded border border-gray-300 text-gray-600 hover:bg-gray-100",children:"Play"})]})}),
58
- /* @__PURE__ */T(G,{value:l.alarmVolume,onChange:e=>i("alarmVolume",e)}),
59
- /* @__PURE__ */T(Z,{label:"repeat",children:/* @__PURE__ */T(q,{value:l.alarmRepeat,onChange:e=>i("alarmRepeat",e),min:1,max:5,className:"w-14 text-center"})}),
60
- /* @__PURE__ */T(Z,{label:"Focus Sound",children:/* @__PURE__ */B("div",{className:"flex items-center gap-2",children:[
58
+ /* @__PURE__ */T(Y,{value:l.alarmVolume,onChange:e=>i("alarmVolume",e)}),
59
+ /* @__PURE__ */T(U,{label:"repeat",children:/* @__PURE__ */T(q,{value:l.alarmRepeat,onChange:e=>i("alarmRepeat",e),min:1,max:5,className:"w-14 text-center"})}),
60
+ /* @__PURE__ */T(U,{label:"Focus Sound",children:/* @__PURE__ */B("div",{className:"flex items-center gap-2",children:[
61
61
  /* @__PURE__ */T(ee,{value:l.focusSound,onChange:e=>i("focusSound",e),options:f}),"none"!==l.focusSound&&/* @__PURE__ */T("button",{type:"button",onClick:()=>b(l.focusSound,l.focusVolume),className:"px-2 py-1 text-[11px] rounded border border-gray-300 text-gray-600 hover:bg-gray-100",children:"Play"})]})}),
62
- /* @__PURE__ */T(G,{value:l.focusVolume,onChange:e=>i("focusVolume",e)})]})]})}function U({icon:e,label:t,children:a}){/* @__PURE__ */
62
+ /* @__PURE__ */T(Y,{value:l.focusVolume,onChange:e=>i("focusVolume",e)})]})]})}function K({icon:e,label:t,children:a}){/* @__PURE__ */
63
63
  return B("div",{className:"border-t border-gray-200 pt-3 first:border-0 first:pt-0",children:[
64
64
  /* @__PURE__ */B("div",{className:"flex items-center gap-1.5 mb-3 text-gray-400",children:[e,
65
65
  /* @__PURE__ */T("span",{className:"text-xs font-bold tracking-[0.15em]",children:t})]}),
66
- /* @__PURE__ */T("div",{className:"space-y-3",children:a})]})}function Z({label:e,info:t,children:a}){/* @__PURE__ */
66
+ /* @__PURE__ */T("div",{className:"space-y-3",children:a})]})}function U({label:e,info:t,children:a}){/* @__PURE__ */
67
67
  return B("div",{className:"flex items-center justify-between gap-3",children:[
68
68
  /* @__PURE__ */B("div",{className:"flex items-center gap-1.5 min-w-0",children:[
69
69
  /* @__PURE__ */T("span",{className:"text-sm font-semibold text-gray-800",children:e}),t&&/* @__PURE__ */T(ae,{title:t})]}),
70
- /* @__PURE__ */T("div",{className:"shrink-0",children:a})]})}function G({value:e,onChange:t}){/* @__PURE__ */
70
+ /* @__PURE__ */T("div",{className:"shrink-0",children:a})]})}function Y({value:e,onChange:t}){/* @__PURE__ */
71
71
  return B("div",{className:"flex items-center justify-end gap-3",children:[
72
72
  /* @__PURE__ */T("span",{className:"text-xs text-gray-400 w-7 text-right tabular-nums",children:e}),
73
- /* @__PURE__ */T("input",{type:"range",min:0,max:100,value:e,onChange:e=>t(parseInt(e.target.value,10)),className:"w-40 accent-blue-500"})]})}function Q({label:e,value:t,onChange:a,min:o=1,max:r=99}){/* @__PURE__ */
73
+ /* @__PURE__ */T("input",{type:"range",min:0,max:100,value:e,onChange:e=>t(parseInt(e.target.value,10)),className:"w-40 accent-blue-500"})]})}function G({label:e,value:t,onChange:a,min:o=1,max:r=99}){/* @__PURE__ */
74
74
  return B("label",{className:"flex flex-col",children:[
75
75
  /* @__PURE__ */T("span",{className:"text-xs font-semibold text-gray-500 mb-1",children:e}),
76
76
  /* @__PURE__ */T(q,{value:t,onChange:a,min:o,max:r})]})}function q({value:e,onChange:t,min:a=1,max:o=99,className:r=""}){/* @__PURE__ */
@@ -96,4 +96,4 @@ return B("div",{className:"bg-white text-gray-800 rounded-md p-3 shadow-md",chil
96
96
  /* @__PURE__ */T("input",{type:"number",min:1,max:20,value:n,onChange:e=>l(Math.max(1,Math.min(20,parseInt(e.target.value,10)||1))),className:"w-16 bg-gray-100 rounded px-2 py-1 text-sm text-right border-0 focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),
97
97
  /* @__PURE__ */B("div",{className:"flex gap-2 mt-3 justify-end",children:[
98
98
  /* @__PURE__ */T("button",{onClick:t,className:"px-3 py-1 text-sm text-gray-500 hover:bg-gray-100 rounded",children:"Cancel"}),
99
- /* @__PURE__ */T("button",{onClick:s,className:"px-4 py-1 text-sm font-semibold text-white rounded shadow-sm",style:{backgroundColor:a},children:"Save"})]})]})}export{Y as default};
99
+ /* @__PURE__ */T("button",{onClick:s,className:"px-4 py-1 text-sm font-semibold text-white rounded shadow-sm",style:{backgroundColor:a},children:"Save"})]})]})}export{Z as default};
@@ -0,0 +1,188 @@
1
+ import{PdfViewer as e,ToolbarSlotContext as t,PanelActions as n}from"./chunk-5ZDM6WIC.js";import{ImageAnnotator_default as r}from"./chunk-R7EBJKN2.js";import{AboutApp as i}from"./chunk-CZK2VKIO.js";import{peekPdfPreviewStage as o,claimPdfPreviewStage as s,PDF_PREVIEW_UPDATE_EVENT as a}from"./chunk-ESL5TDNA.js";import{WindowTitle as l,getActiveModalId as c}from"./chunk-N6STBYXR.js";import"./chunk-DSSLOQDW.js";import"./chunk-KVOFUFPP.js";import"./chunk-AZURXTRB.js";import{toast_default as d}from"./chunk-3DGTIWZP.js";import"./chunk-CIXQKCFA.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-ZAE6ROV7.js";import"./chunk-AA4TMQOS.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import{registerModalEscapeInterceptor as u}from"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{useShellStrings as p,splitAround as m}from"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import"./chunk-YKZHOXI4.js";import{useRef as h,useState as x,useEffect as y}from"react";import{jsxs as f,jsx as g,Fragment as b}from"react/jsx-runtime";var w=!1;function v(e,t){return e?.url&&e.url!==t.url&&e.url.startsWith("blob:")&&URL.revokeObjectURL(e.url),t}function k(){const n=h(void 0);void 0===n.current&&(n.current=o());const[r,u]=x(n.current?.data??null);y(()=>{const e=n.current;null!=e&&(s(e),u(t=>t===e.data?t:v(t,e.data)))},[]),y(()=>{const e=n.current?.token;if(null==e)return;const t=t=>{const n=t.detail;n&&n.token===e&&u(e=>v(e,n.data))};return window.addEventListener(a,t),()=>window.removeEventListener(a,t)},[]);const w=h(void 0);y(()=>{w.current=r?.url},[r?.url]);const k=h(null);y(()=>(null!==k.current&&(clearTimeout(k.current),k.current=null),()=>{const e=w.current;e?.startsWith("blob:")&&(k.current=setTimeout(()=>URL.revokeObjectURL(e),0))}),[]);const L=p().preview,C=r?.filename?(M=r.filename).length>24?`${M.slice(0,23)}…`:M:L.untitled;var M;const E=h(null),S=h(null),[z,j]=x(null),[D,F]=x(!1),H=h(0),B=()=>E.current?.click(),O=()=>{H.current=0,F(!1)},I=e=>{const t=e.closest("[data-modal-id]");return!t||c()===t.dataset.modalId};y(()=>{const e=()=>O(),t=()=>O(),n=e=>{"Escape"===e.key&&O()};return window.addEventListener("dragend",e),window.addEventListener("drop",t),window.addEventListener("keydown",n),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",t),window.removeEventListener("keydown",n)}},[]);const P=e=>{const t=(e.name.split(".").pop()||"").toLowerCase(),n="pdf"===t?"pdf":"dxf"===t?"dxf":["jpg","jpeg","png","gif","webp","svg","avif","bmp"].includes(t)?"image":["stp","step","stl","obj","gltf","glb","3mf","iges","igs","ply","fbx"].includes(t)?"3d":void 0;if(!n)return void("dwg"===t?d.error(L.dwgUnsupported):d.error(L.unsupportedType(t)));const r=URL.createObjectURL(e);u(t=>(t?.url?.startsWith("blob:")&&t.url!==r&&URL.revokeObjectURL(t.url),{url:r,filename:e.name,kind:n}))},W=/* @__PURE__ */f("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
2
+ /* @__PURE__ */g("input",{ref:E,type:"file",accept:".pdf,.dxf,.jpg,.jpeg,.png,.gif,.webp,.svg,.avif,.bmp,.stp,.step,.stl,.obj,.gltf,.glb,.3mf,.iges,.igs,.ply,.fbx",onChange:e=>{const t=e.target.files?.[0];t&&P(t),E.current&&(E.current.value="")},className:"hidden"}),
3
+ /* @__PURE__ */f("button",{onClick:B,className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors flex items-center gap-1",children:[
4
+ /* @__PURE__ */g("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 00-1.883 2.542l.857 6a2.25 2.25 0 002.227 1.932H19.05a2.25 2.25 0 002.227-1.932l.857-6a2.25 2.25 0 00-1.883-2.542m-16.5 0V6A2.25 2.25 0 016 3.75h3.879a1.5 1.5 0 011.06.44l2.122 2.12a1.5 1.5 0 001.06.44H18A2.25 2.25 0 0120.25 9v.776"})}),L.open]}),
5
+ /* @__PURE__ */g("span",{className:"text-[10px] text-gray-400 ml-1",children:L.formats}),r?.filename&&/* @__PURE__ */f(b,{children:[
6
+ /* @__PURE__ */g("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
7
+ /* @__PURE__ */g("span",{className:"text-xs font-medium text-gray-700 truncate max-w-[200px]",title:r.filename,children:r.filename})]}),
8
+ /* @__PURE__ */g("div",{ref:j,className:"ml-auto flex items-center gap-1 text-xs"})]});let V;if(r)V=r.converting||!r.url?/* @__PURE__ */g(N,{filename:r.filename,message:r.convertingMessage}):"dxf"===r.kind?/* @__PURE__ */g(A,{url:r.url,filename:r.filename,onDownload:r.onDownload,onEmail:r.onEmail},r.url):"3d"===r.kind?/* @__PURE__ */g(T,{url:r.url,filename:r.filename,onDownload:r.onDownload,onEmail:r.onEmail},r.url):"image"===r.kind?/* @__PURE__ */g(R,{url:r.url,filename:r.filename,onDownload:r.onDownload,onEmail:r.onEmail},r.url):/* @__PURE__ */g(e,{url:r.url,filename:r.filename,onDownload:r.onDownload,onEmail:r.onEmail},r.url);else{const[e,t]=m(L.dropHere),[n,r]=m(L.formatDxf),[i,o]=m(L.format3d);V=/* @__PURE__ */f("div",{className:"flex flex-1 flex-col items-center justify-center text-gray-500 text-sm gap-3 p-8 text-center",children:[
9
+ /* @__PURE__ */g("svg",{className:"h-12 w-12 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),
10
+ /* @__PURE__ */f("p",{className:"font-medium text-gray-700",children:[e,
11
+ /* @__PURE__ */g("button",{onClick:B,className:"text-blue-600 hover:underline",children:L.open}),t]}),
12
+ /* @__PURE__ */f("div",{className:"text-xs text-gray-500 max-w-sm",children:[
13
+ /* @__PURE__ */g("p",{className:"font-semibold uppercase tracking-wide text-[10px] text-gray-400 mb-1",children:L.supportedFormats}),
14
+ /* @__PURE__ */f("ul",{className:"space-y-0.5",children:[
15
+ /* @__PURE__ */f("li",{children:[
16
+ /* @__PURE__ */g("span",{className:"font-mono text-gray-700",children:".pdf"})," — ",L.formatPdf]}),
17
+ /* @__PURE__ */f("li",{children:[
18
+ /* @__PURE__ */g("span",{className:"font-mono text-gray-700",children:".dxf"})," — ",n,
19
+ /* @__PURE__ */g("span",{className:"font-mono",children:"dxf-viewer"}),r]}),
20
+ /* @__PURE__ */f("li",{children:[
21
+ /* @__PURE__ */g("span",{className:"font-mono text-gray-700",children:".stp .step .stl .obj .gltf .glb .3mf .iges"})," — ",i,
22
+ /* @__PURE__ */g("span",{className:"font-mono",children:"online-3d-viewer"}),o]}),
23
+ /* @__PURE__ */f("li",{children:[
24
+ /* @__PURE__ */g("span",{className:"font-mono text-gray-700",children:".jpg .jpeg .png .gif .webp .svg .avif .bmp"})," — ",L.formatImage]})]}),
25
+ /* @__PURE__ */g("p",{className:"mt-2 text-[11px] text-gray-400 italic",children:L.dwgNote})]})]})}/* @__PURE__ */
26
+ return f("div",{className:"relative flex flex-col h-full",ref:S,onDragEnter:e=>{e.dataTransfer?.types?.includes?.("Files")&&I(e.currentTarget)&&(e.preventDefault(),H.current++,D||F(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&I(e.currentTarget)&&e.preventDefault()},onDragLeave:()=>{H.current>0&&H.current--,0===H.current&&F(!1)},onDrop:e=>{I(e.currentTarget)?(e=>{e.preventDefault(),O();const t=e.dataTransfer.files?.[0];t&&P(t)})(e):O()},children:[
27
+ /* @__PURE__ */g(l,{title:L.windowTitle(C)}),
28
+ /* @__PURE__ */g(i,{app:"preview"}),W,
29
+ /* @__PURE__ */g(t.Provider,{value:z,children:/* @__PURE__ */g("div",{className:"flex-1 min-h-0",children:V})}),D&&/* @__PURE__ */g("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */g("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:L.dropToOpen})})]})}function N({filename:e,message:t}){const n=p().preview;/* @__PURE__ */
30
+ return f("div",{className:"flex flex-col items-center justify-center h-full bg-gray-100 gap-4 px-8",children:[
31
+ /* @__PURE__ */f("div",{className:"flex flex-col items-center gap-3",children:[
32
+ /* @__PURE__ */f("svg",{className:"h-12 w-12 text-blue-500 animate-spin",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
33
+ /* @__PURE__ */g("circle",{cx:"12",cy:"12",r:"10",strokeOpacity:"0.2"}),
34
+ /* @__PURE__ */g("path",{d:"M22 12a10 10 0 0 1-10 10",strokeLinecap:"round"})]}),
35
+ /* @__PURE__ */g("div",{className:"text-base font-semibold tracking-wide text-gray-700 uppercase",children:t||n.converting}),
36
+ /* @__PURE__ */g("div",{className:"text-xs text-gray-400 truncate max-w-md",children:e})]}),
37
+ /* @__PURE__ */g("div",{className:"w-72 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:/* @__PURE__ */g("div",{className:"h-full w-1/3 bg-blue-500 rounded-full animate-pulse",style:{animation:"preview-bar 1.4s ease-in-out infinite"}})}),
38
+ /* @__PURE__ */g("style",{children:"@keyframes preview-bar { 0% { transform: translateX(-110%); } 100% { transform: translateX(310%); } }"})]})}var L=["https://cdn.jsdelivr.net/gh/vagran/dxf-viewer-example-src@master/src/assets/fonts/Roboto-LightItalic.ttf","https://cdn.jsdelivr.net/gh/vagran/dxf-viewer-example-src@master/src/assets/fonts/NotoSansDisplay-SemiCondensedLightItalic.ttf","https://cdn.jsdelivr.net/gh/vagran/dxf-viewer-example-src@master/src/assets/fonts/NanumGothic-Regular.ttf"],C={l:"LINE",line:"LINE",pl:"PLINE",pline:"PLINE",ex:"EXTEND",extend:"EXTEND",tr:"TRIM",trim:"TRIM",e:"ERASE",erase:"ERASE",m:"MOVE",move:"MOVE",co:"COPY",cp:"COPY",copy:"COPY",o:"OFFSET",offset:"OFFSET",f:"FILLET",fillet:"FILLET",cha:"CHAMFER",chamfer:"CHAMFER",x:"EXPLODE",explode:"EXPLODE",mi:"MIRROR",mirror:"MIRROR",ro:"ROTATE",rotate:"ROTATE",sc:"SCALE",scale:"SCALE",s:"STRETCH",stretch:"STRETCH",ar:"ARRAY",array:"ARRAY",rec:"RECTANG",rectang:"RECTANG",rectangle:"RECTANG",c:"CIRCLE",circle:"CIRCLE",a:"ARC",arc:"ARC",el:"ELLIPSE",ellipse:"ELLIPSE",t:"MTEXT",mt:"MTEXT",mtext:"MTEXT",text:"TEXT",b:"BLOCK",block:"BLOCK",i:"INSERT",insert:"INSERT",ha:"HATCH",hatch:"HATCH"};function A({url:e,filename:t,onDownload:r,onEmail:i}){const o=h(null),s=h(null),[a,l]=x(!0),[d,w]=x(null),[v,k]=x([]),[N,A]=x(!1),[M,E]=x(!0),S=p(),z=S.drawing,T=S.preview,R=h(z);R.current=z;const[D,F]=x(!1),[H,B]=x("auto"),[O,I]=x(null),[P,W]=x(null),[V,X]=x(null),[_,U]=x(""),G=h(H),Y=h(V);y(()=>{G.current=H},[H]),y(()=>{Y.current=V},[V]);const $=h(null),Z=h(null),q=h(null),[K,J]=x(""),[Q,ee]=x(null),te=h(""),ne=h(null),re=h(null),ie=h(null);y(()=>{let t=!1,n=null;return l(!0),w(null),k([]),(async()=>{let r;try{r=(await(import("dxf-viewer"))).DxfViewer}catch(e){return void(t||(w(R.current.notInstalled),l(!1)))}if(!t&&o.current)try{if(await new Promise(e=>{const t=()=>{const n=o.current?.getBoundingClientRect();n&&n.width>4&&n.height>4?e():requestAnimationFrame(t)};t()}),t||!o.current)return;const i={autoResize:!0},a=r.DefaultOptions?.clearColor;"function"==typeof a?.clone&&(i.clearColor=a.clone().setHex(16777215)),n=new r(o.current,i),s.current=n;const c="undefined"!=typeof window&&window.__REACT_OS_SHELL_DXF_FONTS__||L;if(await n.Load({url:e,fonts:c,workerFactory:null}),t)return;try{const e=n.GetLayers?.()??[];Array.isArray(e)&&k(e.map(e=>({name:e.name,displayName:e.displayName??e.name,color:"number"==typeof e.color?e.color:void 0,visible:!0})))}catch{}const d=()=>{try{const e=o.current?.getBoundingClientRect();e&&e.width>0&&e.height>0&&n.SetSize?.(Math.round(e.width),Math.round(e.height));const t=n.GetBounds?.(),r=n.GetOrigin?.();t&&r&&n.FitView(t.minX-r.x,t.maxX-r.x,t.minY-r.y,t.maxY-r.y),n.Render?.()}catch(e){console.warn("[Preview] DXF refit failed",e)}};d(),requestAnimationFrame(d),l(!1)}catch(e){t||(w(e?.message||R.current.renderFailed),l(!1))}})(),()=>{t=!0;try{n?.Destroy?.()}catch{}s.current=null}},[e]),y(()=>{if(!M||a)return;const e=setTimeout(()=>E(!1),5e3);return()=>clearTimeout(e)},[M,a]);const oe=v.map(e=>e.visible?"1":"0").join("");y(()=>{const e=s.current;if(a||d||!e)return;const t=e.GetScene?.(),n=e.GetCamera?.(),r=e.GetCanvas?.();if(!(t&&n&&r&&o.current))return;const i=()=>{const e=ie.current;e&&(e.overlay&&e.overlay.parentElement&&e.overlay.parentElement.removeChild(e.overlay),ie.current=null)};if(!D)return i(),I(null),void W(null);const l=document.createElement("div");l.style.cssText="position:absolute;inset:0;pointer-events:none;z-index:5;",o.current.appendChild(l);const c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("style","position:absolute;inset:0;width:100%;height:100%;pointer-events:none;");const u=document.createElementNS("http://www.w3.org/2000/svg","defs"),p=document.createElementNS("http://www.w3.org/2000/svg","marker");p.setAttribute("id","dxf-measure-arrow"),p.setAttribute("viewBox","0 0 10 10"),p.setAttribute("refX","9"),p.setAttribute("refY","5"),p.setAttribute("markerWidth","6"),p.setAttribute("markerHeight","6"),p.setAttribute("orient","auto-start-reverse");const m=document.createElementNS("http://www.w3.org/2000/svg","path");m.setAttribute("d","M 0 0 L 10 5 L 0 10 z"),m.setAttribute("fill","#ff8800"),p.appendChild(m),u.appendChild(p),c.appendChild(u),l.appendChild(c);const h=()=>{const e=document.createElementNS("http://www.w3.org/2000/svg","line");return e.setAttribute("stroke","#ff8800"),e.setAttribute("stroke-width","1"),e.setAttribute("stroke-dasharray","6,4"),e.setAttribute("opacity","0.55"),e.style.display="none",c.appendChild(e),e},x=h(),y=h(),f=document.createElementNS("http://www.w3.org/2000/svg","line");f.setAttribute("stroke","#ff8800"),f.setAttribute("stroke-width","1"),f.setAttribute("opacity","0.85"),f.style.display="none",c.appendChild(f);const g=document.createElementNS("http://www.w3.org/2000/svg","line");g.setAttribute("stroke","#ff8800"),g.setAttribute("stroke-width","1"),g.setAttribute("opacity","0.85"),g.style.display="none",c.appendChild(g);const b=document.createElementNS("http://www.w3.org/2000/svg","line");b.setAttribute("stroke","#ff8800"),b.setAttribute("stroke-width","1.5"),b.setAttribute("stroke-linecap","round"),b.style.display="none",c.appendChild(b);const w=document.createElementNS("http://www.w3.org/2000/svg","line");w.setAttribute("stroke","#ff8800"),w.setAttribute("stroke-width","1.5"),w.setAttribute("stroke-linecap","round"),w.style.display="none",c.appendChild(w);const v=document.createElement("div");v.style.cssText="position:absolute;transform:translate(-50%,-50%);pointer-events:none;display:none;";const k="http://www.w3.org/2000/svg",N=document.createElementNS(k,"svg");N.setAttribute("width","22"),N.setAttribute("height","22"),N.setAttribute("viewBox","0 0 22 22"),N.setAttribute("style","overflow:visible;display:block"),v.appendChild(N);const L=e=>{const t=document.createElementNS(k,"g");return e(t),t.style.display="none",N.appendChild(t),t},C=L(e=>{const t=document.createElementNS(k,"rect");t.setAttribute("x","4"),t.setAttribute("y","4"),t.setAttribute("width","14"),t.setAttribute("height","14"),t.setAttribute("fill","rgba(255,255,255,0.9)"),t.setAttribute("stroke","#ff8800"),t.setAttribute("stroke-width","1.8"),e.appendChild(t)}),A=L(e=>{const t=(e,t,n,r)=>{const i=document.createElementNS(k,"line");return i.setAttribute("x1",String(e)),i.setAttribute("y1",String(t)),i.setAttribute("x2",String(n)),i.setAttribute("y2",String(r)),i.setAttribute("stroke","#ff8800"),i.setAttribute("stroke-width","2.2"),i.setAttribute("stroke-linecap","round"),i};e.appendChild(t(4,4,18,18)),e.appendChild(t(18,4,4,18))}),M=L(e=>{const t=document.createElementNS(k,"polygon");t.setAttribute("points","4,4 18,4 4,18 18,18"),t.setAttribute("fill","rgba(255,255,255,0.9)"),t.setAttribute("stroke","#ff8800"),t.setAttribute("stroke-width","1.8"),t.setAttribute("stroke-linejoin","round"),e.appendChild(t)}),E=L(e=>{const t=document.createElementNS(k,"polygon");t.setAttribute("points","11,3 19,18 3,18"),t.setAttribute("fill","rgba(255,255,255,0.9)"),t.setAttribute("stroke","#ff8800"),t.setAttribute("stroke-width","1.8"),t.setAttribute("stroke-linejoin","round"),e.appendChild(t)}),S=L(e=>{const t=document.createElementNS(k,"circle");t.setAttribute("cx","11"),t.setAttribute("cy","11"),t.setAttribute("r","7"),t.setAttribute("fill","rgba(255,255,255,0.9)"),t.setAttribute("stroke","#ff8800"),t.setAttribute("stroke-width","1.8"),e.appendChild(t);const n=(e,t,n,r)=>{const i=document.createElementNS(k,"line");return i.setAttribute("x1",String(e)),i.setAttribute("y1",String(t)),i.setAttribute("x2",String(n)),i.setAttribute("y2",String(r)),i.setAttribute("stroke","#ff8800"),i.setAttribute("stroke-width","1.6"),i.setAttribute("stroke-linecap","round"),i};e.appendChild(n(6.5,6.5,15.5,15.5)),e.appendChild(n(15.5,6.5,6.5,15.5))});l.appendChild(v),ie.current={picks:[],rawSecondClick:null,overlay:l,svg:c,line:b,fixedLine:w,fixedLabel:null,refLine:x,refLineV:y,extLineA:f,extLineB:g,markers:[],label:null,snap:v,segs:null,nodes:null};const z=n?.position?.constructor??t?.position?.constructor??null;let T=!1;const H=(e,t)=>{if(!z)return{x:0,y:0};const i=new z(e,t,0).project(n),o=r.clientWidth,s=r.clientHeight;return{x:(i.x+1)/2*o,y:(1-i.y)/2*s}};(()=>{try{const e=ie.current;if(!e)return;const n=[],r=[];let i=!1;const o=e=>{const t=e?.attributes?.instanceTransform0,n=e?.attributes?.instanceTransform1;if(t&&n){const e=[],r=Math.min(t.count,n.count);for(let i=0;i<r;i++)e.push([t.getX(i),t.getY(i),t.getZ(i),n.getX(i),n.getY(i),n.getZ(i)]);return e}const r=e?.attributes?.instanceTransform;if(r){const e=[];for(let t=0;t<r.count;t++)e.push([1,0,r.getX(t),0,1,r.getY(t)]);return e}return[[1,0,0,0,1,0]]},s=e=>{const t=!!e?.isLineSegments;if(!t&&!!!e?.isPoints)return;const s=e.geometry,a=s?.attributes?.position;if(!a)return;const l=o(s);if(t){const e=s.index,t=Math.floor((e?e.count:a.count)/2);for(let r=0;r<t;r++){const t=e?e.getX(2*r):2*r,o=e?e.getX(2*r+1):2*r+1,s=a.getX(t),c=a.getY(t),d=a.getX(o),u=a.getY(o);if(Number.isFinite(s+c+d+u))for(const e of l){if(n.length>=16e5)return void(i=!0);const t=e[0]*s+e[1]*c+e[2],r=e[3]*s+e[4]*c+e[5],o=e[0]*d+e[1]*u+e[2],a=e[3]*d+e[4]*u+e[5];t===o&&r===a||n.push(t,r,o,a)}}}else for(let e=0;e<a.count;e++){const t=a.getX(e),n=a.getY(e);if(Number.isFinite(t+n))for(const e of l)r.push(e[0]*t+e[1]*n+e[2],e[3]*t+e[4]*n+e[5])}};"function"==typeof t.traverseVisible?t.traverseVisible(s):t.traverse(s),e.segs=new Float64Array(n),e.nodes=new Float64Array(r),i&&console.warn("[Preview] DXF snap cache truncated at 400000 segments — snapping may miss some geometry."),T=!0}catch{}})();const B=(e,t,n,r,i,o,s,a)=>{const l=(n-e)*(a-o)-(r-t)*(s-i);if(Math.abs(l)<1e-9)return null;const c=((i-e)*(a-o)-(o-t)*(s-i))/l,d=((i-e)*(r-t)-(o-t)*(n-e))/l,u=1e-4;return c<-u||c>1+u||d<-u||d>1+u?null:{px:e+c*(n-e),py:t+c*(r-t),t:c}},O=()=>{const e=document.createElement("div");return e.style.cssText="position:absolute;width:10px;height:10px;border-radius:50%;background:#ff8800;border:2px solid #fff;box-shadow:0 0 0 1px rgba(0,0,0,0.25);transform:translate(-50%,-50%);pointer-events:none;",l.appendChild(e),e},P=(e,t,n)=>{const r=H(t,n);e.style.left=`${r.x}px`,e.style.top=`${r.y}px`},V=()=>{const e=ie.current;if(!e||!e.rawSecondClick||e.picks.length<2)return;const t=e.picks[0],n=e.rawSecondClick,r=Y.current,i=G.current;if(null===r||!Number.isFinite(r)||"horizontal"!==i&&"vertical"!==i)e.picks[1]={x:n.x,y:n.y};else if("horizontal"===i){const i=n.x>=t.x?1:-1;e.picks[1]={x:t.x+i*Math.abs(r),y:n.y}}else{const i=n.y>=t.y?1:-1;e.picks[1]={x:n.x,y:t.y+i*Math.abs(r)}}},X=(e,t)=>{const n=G.current;return"auto"!==n?n:e&&t?Math.abs(t.x-e.x)>=Math.abs(t.y-e.y)?"horizontal":"vertical":"horizontal"},_=()=>{const e=ie.current;if(!e)return;V();const t=G.current,n=Y.current,i=null!==n&&Number.isFinite(n)&&("horizontal"===t||"vertical"===t);e.markers[0]&&P(e.markers[0],e.picks[0].x,e.picks[0].y),e.markers[1]&&P(e.markers[1],e.picks[1].x,e.picks[1].y);const o=(t,n,i)=>{if(!t)return;if(!i||e.picks.length<1)return void(t.style.display="none");const o=e.picks[0],s=r.clientWidth,a=r.clientHeight,l=4*Math.hypot(s,a),c=H(o.x,o.y),d=H(o.x+n.dx,o.y+n.dy),u=l/(Math.hypot(d.x-c.x,d.y-c.y)||1),p=H(o.x-n.dx*u,o.y-n.dy*u),m=H(o.x+n.dx*u,o.y+n.dy*u);t.setAttribute("x1",String(p.x)),t.setAttribute("y1",String(p.y)),t.setAttribute("x2",String(m.x)),t.setAttribute("y2",String(m.y)),t.style.display=""};let s="horizontal"===t,a="vertical"===t;if("auto"===t)if(e.picks.length>=2){const t=X(e.picks[0],e.picks[1]);s="horizontal"===t,a="vertical"===t}else s=!0,a=!0;if(o(e.refLine,{dx:1,dy:0},s),o(e.refLineV,{dx:0,dy:1},a),2===e.picks.length){const t=e.picks[0],o=e.picks[1],s=X(t,o),a=(()=>{const e=ie.current,t=e.picks[0],n=e.picks[1],r=X(t,n),i=G.current,o=Y.current;return null!==o&&Number.isFinite(o)&&"horizontal"===i?{from:{x:n.x,y:t.y},to:{x:n.x,y:n.y}}:null!==o&&Number.isFinite(o)&&"vertical"===i?{from:{x:t.x,y:n.y},to:{x:n.x,y:n.y}}:"horizontal"===r?{from:t,to:{x:n.x,y:t.y}}:"vertical"===r?{from:t,to:{x:t.x,y:n.y}}:{from:t,to:n}})(),l=H(a.from.x,a.from.y),c=H(a.to.x,a.to.y);e.line.setAttribute("x1",String(l.x)),e.line.setAttribute("y1",String(l.y)),e.line.setAttribute("x2",String(c.x)),e.line.setAttribute("y2",String(c.y)),e.line.setAttribute("marker-start","url(#dxf-measure-arrow)"),e.line.setAttribute("marker-end","url(#dxf-measure-arrow)");const d=Math.hypot(c.x-l.x,c.y-l.y);if(e.line.style.display=d>.5?"":"none",i&&e.fixedLine){const i="horizontal"===s?{x:o.x,y:t.y}:{x:t.x,y:o.y},a=H(t.x,t.y),l=H(i.x,i.y);e.fixedLine.setAttribute("x1",String(a.x)),e.fixedLine.setAttribute("y1",String(a.y)),e.fixedLine.setAttribute("x2",String(l.x)),e.fixedLine.setAttribute("y2",String(l.y)),e.fixedLine.setAttribute("marker-start","url(#dxf-measure-arrow)"),e.fixedLine.setAttribute("marker-end","url(#dxf-measure-arrow)"),e.fixedLine.style.display="";const c=U();c.textContent=j(Math.abs(n));const d=(a.x+l.x)/2,u=(a.y+l.y)/2;c.style.left=`${d}px`,c.style.top=`${u}px`;const p=r.clientWidth,m=r.clientHeight;c.style.display=d<0||u<0||d>p||u>m?"none":""}else e.fixedLine&&(e.fixedLine.style.display="none"),e.fixedLabel&&(e.fixedLabel.style.display="none");const u=e.extLineA,p=e.extLineB;if(!i&&"horizontal"===s&&Math.abs(o.y-t.y)>1e-9){const e=H(o.x,t.y),n=H(o.x,o.y);p.setAttribute("x1",String(e.x)),p.setAttribute("y1",String(e.y)),p.setAttribute("x2",String(n.x)),p.setAttribute("y2",String(n.y)),p.style.display="",u.style.display="none"}else if(!i&&"vertical"===s&&Math.abs(o.x-t.x)>1e-9){const e=H(t.x,o.y),n=H(o.x,o.y);p.setAttribute("x1",String(e.x)),p.setAttribute("y1",String(e.y)),p.setAttribute("x2",String(n.x)),p.setAttribute("y2",String(n.y)),p.style.display="",u.style.display="none"}else u.style.display="none",p.style.display="none";if(e.label){const t=(l.x+c.x)/2,n=(l.y+c.y)/2;e.label.style.left=`${t}px`,e.label.style.top=`${n}px`;const i=r.clientWidth,o=r.clientHeight;e.label.style.display=t<0||n<0||t>i||n>o?"none":"",d<=.5&&(e.label.style.display="none")}}else e.line.style.display="none",e.fixedLine&&(e.fixedLine.style.display="none"),e.fixedLabel&&(e.fixedLabel.style.display="none"),e.extLineA&&(e.extLineA.style.display="none"),e.extLineB&&(e.extLineB.style.display="none")},U=()=>{const e=ie.current;if(e.fixedLabel)return e.fixedLabel;const t=document.createElement("div");return t.style.cssText="position:absolute;left:-9999px;top:-9999px;transform:translate(-50%,-50%);padding:2px 6px;font-size:11px;font-weight:600;font-family:system-ui,-apple-system,sans-serif;background:rgba(255,136,0,0.75);color:#fff;border-radius:4px;white-space:nowrap;box-shadow:0 1px 4px rgba(0,0,0,0.25);pointer-events:none;",l.appendChild(t),e.fixedLabel=t,t};let K=0,J=0,Q=0,te=!1,ne=!1,re=null;const oe=e=>{const t=e?.detail;t&&0===t.domEvent?.button&&(K=t.canvasCoord.x,J=t.canvasCoord.y,Q=performance.now(),ne=!1,te=!0)},se=e=>{const t=r.getBoundingClientRect(),n=e.clientX-t.left,i=e.clientY-t.top;te&&(n-K)**2+(i-J)**2>16&&(ne=!0);const o=ie.current;var s;if(o&&o.snap)if(te&&ne)o.snap.style.display="none";else if(re=((e,t)=>{const n=ie.current;if(!n||!T||!n.segs)return null;const r=H(0,0),i=H(1,0),o=H(0,1),s=i.x-r.x,a=i.y-r.y,l=o.x-r.x,c=o.y-r.y,d=s*c-l*a;if(!d)return null;const u=((e-r.x)*c-(t-r.y)*l)/d,p=((t-r.y)*s-(e-r.x)*a)/d,m=18/(Math.hypot(s,a)||1),h=18/(Math.hypot(l,c)||1),x=u-m,y=u+m,f=p-h,g=p+h,b=324;let w=null,v=b,k=null,N=b,L=null,C=b,A=null,M=b;const E=[],S=n.segs;for(let n=0;n<S.length;n+=4){const i=S[n],o=S[n+1],d=S[n+2],u=S[n+3];if(i<x&&d<x||i>y&&d>y||o<f&&u<f||o>g&&u>g)continue;const p=r.x+s*i+l*o,m=r.y+a*i+c*o,h=r.x+s*d+l*u,A=r.y+a*d+c*u;let M=!1,z=e-p,j=t-m,T=z*z+j*j;T<b&&(M=!0,T<v&&(v=T,w={sx:i,sy:o,type:"endpoint"})),z=e-h,j=t-A,T=z*z+j*j,T<b&&(M=!0,T<v&&(v=T,w={sx:d,sy:u,type:"endpoint"})),z=e-(p+h)/2,j=t-(m+A)/2,T=z*z+j*j,T<b&&(M=!0,T<N&&(N=T,k={sx:(i+d)/2,sy:(o+u)/2,type:"midpoint"}));const R=h-p,D=A-m,F=R*R+D*D;if(F>0){const n=((e-p)*R+(t-m)*D)/F;n>0&&n<1&&(z=e-(p+n*R),j=t-(m+n*D),T=z*z+j*j,T<b&&(M=!0,T<C&&(C=T,L={sx:i+n*(d-i),sy:o+n*(u-o),type:"line"})))}M&&E.push({ax:i,ay:o,bx:d,by:u,apx:p,apy:m,bpx:h,bpy:A})}const z=n.nodes;if(z)for(let n=0;n<z.length;n+=2){const i=z[n],o=z[n+1];if(i<x||i>y||o<f||o>g)continue;const d=e-(r.x+s*i+l*o),u=t-(r.y+a*i+c*o),p=d*d+u*u;p<v&&(v=p,w={sx:i,sy:o,type:"node"})}for(let n=0;n<E.length;n++){const r=E[n];for(let i=n+1;i<E.length;i++){const n=E[i],o=B(r.apx,r.apy,r.bpx,r.bpy,n.apx,n.apy,n.bpx,n.bpy);if(!o)continue;const s=e-o.px,a=t-o.py,l=s*s+a*a;l>=b||l>=M||(M=l,A={sx:r.ax+o.t*(r.bx-r.ax),sy:r.ay+o.t*(r.by-r.ay),type:"intersection"})}}return(A&&w?M<v-1?A:w:A??w)??k??L})(n,i),re){const e=H(re.sx,re.sy);o.snap.style.left=`${e.x}px`,o.snap.style.top=`${e.y}px`,o.snap.style.display="",s=re.type,C.style.display="endpoint"===s?"":"none",A.style.display="intersection"===s?"":"none",M.style.display="line"===s?"":"none",E.style.display="midpoint"===s?"":"none",S.style.display="node"===s?"":"none"}else o.snap.style.display="none"},ae=e=>{if(!te)return;te=!1;const t=performance.now()-Q;if(ne||t>350)return;const n=e?.detail?.position;if(!n)return;const r=re?{x:re.sx,y:re.sy}:{x:n.x,y:n.y};ue(r)},le=()=>{const e=ie.current;if(!e||2!==e.picks.length)return;V();const t=e.picks[0],n=e.picks[1],r=G.current,i=X(t,n),o=Y.current,s=null!==o&&Number.isFinite(o)&&("horizontal"===r||"vertical"===r);let a,c,d="",u=i;const p=Math.abs(n.x-t.x),m=Math.abs(n.y-t.y);if(s&&"horizontal"===r?(a=m,d=" ↕",u="vertical",c=R.current.echoLocked("ΔY",j(m),"ΔX",j(Math.abs(o)))):s&&"vertical"===r?(a=p,d=" ↔",u="horizontal",c=R.current.echoLocked("ΔX",j(p),"ΔY",j(Math.abs(o)))):"horizontal"===i?(a=p,d=" ↔",c=R.current.echoLinear(j(p),"ΔX")):"vertical"===i?(a=m,d=" ↕",c=R.current.echoLinear(j(m),"ΔY")):(a=Math.hypot(n.x-t.x,n.y-t.y),c=R.current.echoDistance(j(a),j(p),j(m))),!Number.isFinite(a))return I(null),W(null),void(e.label&&(e.label.style.opacity="0"));I(a),W(u),ee(c);const h=(()=>{const e=ie.current;if(e.label)return e.label;const t=document.createElement("div");return t.style.cssText="position:absolute;left:-9999px;top:-9999px;transform:translate(-50%,-50%);padding:2px 6px;font-size:11px;font-weight:600;font-family:system-ui,-apple-system,sans-serif;background:rgba(255,136,0,0.95);color:#fff;border-radius:4px;white-space:nowrap;box-shadow:0 1px 4px rgba(0,0,0,0.25);pointer-events:none;",l.appendChild(t),e.label=t,t})();h.style.opacity="1",h.textContent=`${j(a)}${d}`};$.current=()=>{le(),_()};const ce=e=>{e.line.style.display="none",e.fixedLine&&(e.fixedLine.style.display="none"),e.fixedLabel&&(e.fixedLabel.style.display="none"),e.extLineA&&(e.extLineA.style.display="none"),e.extLineB&&(e.extLineB.style.display="none"),e.label&&(e.label.style.opacity="0"),I(null),W(null)},de=()=>{const e=ie.current;if(e){for(const t of e.markers)t.parentElement?.removeChild(t);e.markers=[],e.picks=[],e.rawSecondClick=null,e.refLine&&(e.refLine.style.display="none"),e.refLineV&&(e.refLineV.style.display="none"),ce(e)}};Z.current=de,q.current=()=>{const e=ie.current;if(!e||0===e.picks.length)return;e.picks.pop();const t=e.markers.pop();t?.parentElement?.removeChild(t),e.rawSecondClick=null,ce(e),_()};const ue=e=>{const t=ie.current;t&&(2===t.picks.length&&de(),0===t.picks.length?(t.picks.push({x:e.x,y:e.y}),t.markers.push(O())):(t.rawSecondClick={x:e.x,y:e.y},t.picks.push({x:e.x,y:e.y}),t.markers.push(O()),le()),_())},pe=e=>{"Escape"===e.key&&F(!1)};r.style.cursor="crosshair";try{e.Subscribe?.("pointerdown",oe)}catch{}try{e.Subscribe?.("pointerup",ae)}catch{}try{e.Subscribe?.("viewChanged",_)}catch{}return r.addEventListener("pointermove",se),window.addEventListener("keydown",pe),()=>{r.style.cursor="";try{e.Unsubscribe?.("pointerdown",oe)}catch{}try{e.Unsubscribe?.("pointerup",ae)}catch{}try{e.Unsubscribe?.("viewChanged",_)}catch{}r.removeEventListener("pointermove",se),window.removeEventListener("keydown",pe),$.current=null,Z.current=null,q.current=null,i(),I(null),W(null)}},[D,a,d,oe]),y(()=>{$.current?.()},[H,V]);const se=e=>{k(t=>t.map(t=>{if(t.visible===e)return t;try{s.current?.ShowLayer?.(t.name,e)}catch{}return{...t,visible:e}}))},ae=()=>{try{const e=s.current,t=e?.GetBounds?.(),n=e?.GetOrigin?.();t&&n?e.FitView(t.minX-n.x,t.maxX-n.x,t.minY-n.y,t.maxY-n.y):e?.FitView?.(),e?.Render?.()}catch{}};y(()=>{const e=e=>{if(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey)return;if(1!==e.key.length||" "===e.key)return;const t=e.target;if(t&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable))return;const n=re.current;if(!n)return;const r=n.closest("[data-modal-id]");r&&c()!==r.dataset.modalId||ne.current?.focus()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]);const le=h(K),ce=h(D);y(()=>{le.current=K},[K]),y(()=>{ce.current=D},[D]),y(()=>u(()=>{const e=re.current;if(!e)return!1;const t=e.closest("[data-modal-id]");return!(!t||c()!==t.dataset.modalId)&&(le.current?(J(""),ee(R.current.cancelled),!0):!!ce.current&&(F(!1),ee(R.current.measureOff),!0))}),[]);const de="px-2 py-1 rounded hover:bg-gray-200 transition-colors text-gray-600 flex items-center gap-1",[ue,pe]=m(z.typeToMeasure);/* @__PURE__ */
39
+ return f("div",{ref:re,className:"flex flex-col h-full",children:[
40
+ /* @__PURE__ */f(n,{children:[
41
+ /* @__PURE__ */f("button",{onClick:()=>A(e=>!e),className:de+(N?" bg-gray-200":""),title:z.layersHint,disabled:0===v.length,children:[
42
+ /* @__PURE__ */g("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.429 9.75L2.25 12l4.179 2.25m0-4.5l5.571 3 5.571-3m-11.142 0L2.25 7.5 12 2.25l9.75 5.25-4.179 2.25m0 0L21.75 12l-4.179 2.25m0 0l4.179 2.25L12 21.75 2.25 16.5l4.179-2.25m11.142 0l-5.571 3-5.571-3"})}),z.layers," ",v.length>0&&/* @__PURE__ */f("span",{className:"text-gray-400",children:["(",v.filter(e=>e.visible).length,"/",v.length,")"]})]}),
43
+ /* @__PURE__ */g("button",{onClick:()=>E(e=>!e),className:de,title:T.howToNavigate,children:/* @__PURE__ */g("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})}),
44
+ /* @__PURE__ */f("button",{onClick:()=>F(e=>!e),className:de+(D?" bg-gray-200":""),title:D?T.stopMeasuring:z.measureHint,children:[
45
+ /* @__PURE__ */f("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[
46
+ /* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 14.25l6-6 6 6 4.5-4.5M9.75 8.25v3M12.75 11.25v3M15.75 14.25v3"}),
47
+ /* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 18.75h19.5"})]}),z.measure]}),D&&/* @__PURE__ */f(b,{children:[
48
+ /* @__PURE__ */f("div",{className:"flex items-stretch h-7 rounded border border-gray-200 overflow-hidden text-[11px] font-semibold",children:[
49
+ /* @__PURE__ */g("button",{onClick:()=>B("auto"),className:"px-2 transition-colors "+("auto"===H?"bg-orange-500 text-white":"bg-white text-gray-600 hover:bg-gray-50"),title:z.autoHint,children:z.auto}),
50
+ /* @__PURE__ */g("button",{onClick:()=>B("horizontal"),className:"px-2 transition-colors "+("horizontal"===H?"bg-orange-500 text-white":"bg-white text-gray-600 hover:bg-gray-50"),title:z.horizontalHint,children:"H"}),
51
+ /* @__PURE__ */g("button",{onClick:()=>B("vertical"),className:"px-2 transition-colors "+("vertical"===H?"bg-orange-500 text-white":"bg-white text-gray-600 hover:bg-gray-50"),title:z.verticalHint,children:"V"}),
52
+ /* @__PURE__ */g("button",{onClick:()=>B("point"),className:"px-2 transition-colors "+("point"===H?"bg-orange-500 text-white":"bg-white text-gray-600 hover:bg-gray-50"),title:z.pointHint,children:z.point})]}),("horizontal"===H||"vertical"===H)&&/* @__PURE__ */f("div",{className:"flex items-center gap-1",children:[
53
+ /* @__PURE__ */g("input",{type:"number",inputMode:"decimal",step:"any",value:_,placeholder:"horizontal"===H?z.fixX:z.fixY,onChange:e=>{const t=e.target.value;if(U(t),""===t.trim())X(null);else{const e=parseFloat(t);X(Number.isFinite(e)&&0!==e?e:null)}},className:"h-7 w-20 px-1.5 text-[11px] font-mono rounded border border-gray-200 bg-white text-gray-700 focus:outline-none focus:border-orange-400",title:z.fixHint}),null!==V&&/* @__PURE__ */g("button",{onClick:()=>{X(null),U("")},className:"text-gray-400 hover:text-gray-600 text-[11px] px-1",title:z.clearFixed,children:"×"})]})]}),D&&null!==O&&/* @__PURE__ */f("div",{className:"px-2 py-1 text-[11px] font-mono font-semibold text-orange-600 bg-orange-50 border border-orange-200 rounded whitespace-nowrap",title:"horizontal"===P?z.horizontalDistance("auto"===H):"vertical"===P?z.verticalDistance("auto"===H):z.straightDistance,children:[j(O),"horizontal"===P?" ↔":"vertical"===P?" ↕":""]}),
54
+ /* @__PURE__ */g("button",{onClick:ae,className:de,title:z.fitHint,children:z.fit}),
55
+ /* @__PURE__ */f("button",{onClick:r??(()=>{const n=document.createElement("a");n.href=e,n.download=t,n.click()}),className:de,children:[
56
+ /* @__PURE__ */g("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),T.download]}),i&&/* @__PURE__ */f("button",{onClick:i,className:de,children:[
57
+ /* @__PURE__ */g("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25h-15a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75"})}),T.email]})]}),
58
+ /* @__PURE__ */f("div",{className:"relative flex-1 bg-white min-h-0",children:[
59
+ /* @__PURE__ */g("div",{ref:o,style:{width:"100%",height:"100%"}}),N&&v.length>0&&/* @__PURE__ */f("div",{className:"absolute top-2 right-2 w-64 max-h-[70%] flex flex-col bg-white/95 backdrop-blur border border-gray-200 rounded-md shadow-xl z-10 text-xs",children:[
60
+ /* @__PURE__ */f("div",{className:"flex items-center justify-between px-2 py-1.5 border-b border-gray-200 bg-gray-50",children:[
61
+ /* @__PURE__ */g("span",{className:"font-medium text-gray-700",children:z.layers}),
62
+ /* @__PURE__ */f("div",{className:"flex items-center gap-1",children:[
63
+ /* @__PURE__ */g("button",{onClick:()=>se(!0),className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-600",children:z.allLayers}),
64
+ /* @__PURE__ */g("button",{onClick:()=>se(!1),className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-600",children:z.noLayers}),
65
+ /* @__PURE__ */g("button",{onClick:()=>A(!1),className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-600",title:T.closePanel,children:"×"})]})]}),
66
+ /* @__PURE__ */g("div",{className:"overflow-y-auto py-1",children:v.map(e=>{/* @__PURE__ */return f("label",{className:"flex items-center gap-2 px-2 py-1 hover:bg-gray-100 cursor-pointer",children:[
67
+ /* @__PURE__ */g("input",{type:"checkbox",checked:e.visible,onChange:()=>{return t=e.name,void k(e=>e.map(e=>{if(e.name!==t)return e;const n=!e.visible;try{s.current?.ShowLayer?.(t,n)}catch{}return{...e,visible:n}}));var t},className:"h-3.5 w-3.5"}),
68
+ /* @__PURE__ */g("span",{className:"inline-block h-3 w-3 rounded-sm border border-gray-300 shrink-0",style:{background:(t=e.color,"number"!=typeof t?"#999":"#"+t.toString(16).padStart(6,"0"))}}),
69
+ /* @__PURE__ */g("span",{className:"truncate text-gray-700",title:e.displayName,children:e.displayName||e.name})]},e.name);var t})})]}),M&&!a&&!d&&/* @__PURE__ */f("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 bg-gray-900/85 text-white text-[11px] px-3 py-1.5 rounded-full shadow-lg flex items-center gap-3 z-10 pointer-events-none",children:[
70
+ /* @__PURE__ */f("span",{className:"flex items-center gap-1",children:[
71
+ /* @__PURE__ */g("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 15l-2 5L9 9l11 4-5 2zm0 0l5 5M7.188 2.239l.777 2.897M5.136 7.965l-2.898-.777M13.95 4.05l-2.122 2.122m-5.657 5.656l-2.12 2.122"})}),z.dragToPan]}),
72
+ /* @__PURE__ */g("span",{className:"text-white/40",children:"•"}),
73
+ /* @__PURE__ */f("span",{className:"flex items-center gap-1",children:[
74
+ /* @__PURE__ */g("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607zM10.5 7.5v6m3-3h-6"})}),T.scrollToZoom]}),
75
+ /* @__PURE__ */g("span",{className:"text-white/40",children:"•"}),
76
+ /* @__PURE__ */g("span",{children:z.fitToReset}),
77
+ /* @__PURE__ */g("span",{className:"text-white/40",children:"•"}),
78
+ /* @__PURE__ */f("span",{children:[ue,
79
+ /* @__PURE__ */g("span",{className:"font-mono font-semibold",children:"DI"})," / ",
80
+ /* @__PURE__ */g("span",{className:"font-mono font-semibold",children:"DIM"}),pe]})]}),a&&/* @__PURE__ */g("div",{className:"absolute inset-0 flex items-center justify-center bg-white/80 text-sm text-gray-500",children:z.loading}),d&&/* @__PURE__ */g("div",{className:"absolute inset-0 flex items-center justify-center text-sm text-red-600 px-6 text-center",children:d})]}),
81
+ /* @__PURE__ */f("div",{className:"shrink-0 border-t border-gray-200 bg-gray-50",children:[Q&&/* @__PURE__ */g("div",{className:"px-2.5 pt-1 text-[11px] font-mono text-gray-500 truncate",title:Q,children:Q}),
82
+ /* @__PURE__ */f("div",{className:"flex items-center gap-1.5 px-2.5 h-7",children:[
83
+ /* @__PURE__ */g("span",{className:"text-[11px] font-mono font-semibold text-gray-400 select-none",children:">"}),
84
+ /* @__PURE__ */g("input",{ref:ne,value:K,onChange:e=>J(e.target.value),onKeyDown:e=>{"Enter"===e.key||" "===e.key?(e.preventDefault(),(e=>{const t=e.trim()||te.current;if(J(""),!t)return;const n=t.toLowerCase().split(/\s+/)[0],r=()=>{te.current=t},i=(e,t)=>{F(!0),B(e),Z.current?.(),ee(t),r()};if(/^-?(\d+\.?\d*|\.\d+)$/.test(n))if(!D||"horizontal"!==H&&"vertical"!==H)ee(z.fixedNeedsAxis);else{const e=parseFloat(n);e?(U(n),X(e),ee(z.axisLocked("horizontal"===H?"ΔX":"ΔY",j(Math.abs(e))))):(U(""),X(null),ee(z.fixedCleared))}else switch(n){case"di":case"dist":case"mea":case"measuregeom":i("point",z.echoDist);break;case"dim":case"dli":case"dimlin":case"dimlinear":i("auto",z.echoDimLinear);break;case"h":case"hor":case"horizontal":F(!0),B("horizontal"),ee(z.echoHorizontal),r();break;case"v":case"ver":case"vertical":F(!0),B("vertical"),ee(z.echoVertical),r();break;case"au":case"auto":F(!0),B("auto"),ee(z.echoAuto),r();break;case"measure":F(!D),ee(D?z.measureOff:z.measureOn),r();break;case"u":case"undo":q.current?.(),ee(z.pickRemoved),r();break;case"z":case"ze":case"zoom":case"fit":case"zoomextents":ae(),ee(z.zoomExtents),r();break;case"la":case"layer":case"layers":A(e=>!e),ee(z.layersToggled),r();break;case"off":case"clear":X(null),U(""),Z.current?.(),ee(z.measurementCleared),r();break;case"?":case"help":ee(z.commandHelp);break;default:{const e=C[n];ee(e?z.readOnly(e):z.unknownCommand(n.toUpperCase()))}}})(K)):"Escape"===e.key&&(K?(e.stopPropagation(),J(""),ee(z.cancelled)):e.target.blur())},placeholder:z.commandPlaceholder,spellCheck:!1,autoComplete:"off",className:"flex-1 min-w-0 bg-transparent text-[11px] font-mono text-gray-700 focus:outline-none placeholder:text-gray-300"})]})]})]})}var M="https://cdn.jsdelivr.net/npm/online-3d-viewer@0.18.0/libs/";function E(e,t,n=0){return{id:e.GetId?.()??0,name:e.GetName?.()||(0===n?t.root:t.node),isMeshNode:!!e.IsMeshNode?.(),meshIndices:e.GetMeshIndices?.()??[],children:(e.GetChildNodes?.()??[]).map(e=>E(e,t,n+1))}}function S(e,t){t.add(e.id);for(const n of e.children)S(n,t)}function z(e,t){const n=/^#?([0-9a-f]{6})$/i.exec(t),r=n?parseInt(n[1],16):0;return new e.RGBColor(r>>16&255,r>>8&255,255&r)}function j(e){return e>=1e3?`${(e/1e3).toFixed(3)} m`:`${e.toFixed(2)} mm`}function T({url:e,filename:t,onDownload:r,onEmail:i}){const o=h(null),s=h(null),a=h(null),[l,c]=x(!0),[d,u]=x(null),[m,b]=x(!0),v=p(),k=v.model,N=v.preview,L=h(k);L.current=k;const[C,A]=x(null),[T,R]=x({}),[D,F]=x(/* @__PURE__ */new Set),[H,B]=x("#f5f6f8"),[O,I]=x(!0),[P,W]=x("#000000"),[V,X]=x(1),[_,U]=x(!1),[G,Y]=x(!1),[$,Z]=x(!1),[q,K]=x(!1),[J,Q]=x("x"),[ee,te]=x(!1),[ne,re]=x(.5),[ie,oe]=x(0),[se,ae]=x(!1),[le,ce]=x("point"),[de,ue]=x(null),pe=h(null),me=h(null);y(()=>{let n=!1,r=null,i=null;return c(!0),u(null),A(null),R({}),F(/* @__PURE__ */new Set),(async()=>{let l;try{l=await(import("online-3d-viewer"))}catch{return void(n||(u(L.current.notInstalled),c(!1)))}if(a.current=l,!n&&o.current&&(await new Promise(e=>{const t=()=>{const n=o.current?.getBoundingClientRect();n&&n.width>4&&n.height>4?e():requestAnimationFrame(t)};t()}),!n&&o.current))try{const a="undefined"!=typeof window&&window.__REACT_OS_SHELL_O3DV_LIBS__||M;l.SetExternalLibLocation?.(a),function(){if(w)return;if("undefined"==typeof HTMLCanvasElement)return;w=!0;const e=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(t,n){return"webgl"!==t&&"webgl2"!==t&&"experimental-webgl"!==t||(n={...n||{},stencil:!0}),e.call(this,t,n)},console.info("[Preview] section: canvas getContext patched (force stencil=true)")}(),r=new l.EmbeddedViewer(o.current,{backgroundColor:new l.RGBAColor(245,246,248,255),defaultColor:new l.RGBColor(180,188,200),edgeSettings:new l.EdgeSettings(!0,new l.RGBColor(0,0,0),1),onModelLoaded:()=>{if(!n){try{const e=r.GetModel?.(),t=e?.GetRootNode?.();if(t){const e=E(t,{root:L.current.rootNode,node:L.current.node});A(e);const n={[e.id]:!0};for(const t of e.children)n[t.id]=!0;R(n)}}catch(e){console.warn("[Preview] mesh tree extraction failed",e)}c(!1)}},onModelLoadFailed:()=>{n||(u(L.current.loadFailed),c(!1))}}),s.current=r;const d=new l.InputFile(t,l.FileSource.Url,e);r.LoadModelFromInputFiles([d]),o.current&&"undefined"!=typeof ResizeObserver&&(i=new ResizeObserver(()=>{try{const e=s.current;e?.Resize?e.Resize():e?.viewer?.Resize&&e.viewer.Resize(),e?.viewer?.Render?.()}catch{}}),i.observe(o.current))}catch(e){n||(u(e?.message||L.current.loadFailed),c(!1))}})(),()=>{n=!0;try{i?.disconnect()}catch{}try{r?.Destroy?.()}catch{}s.current=null}},[e,t]),y(()=>{const e=s.current;if(e?.viewer)try{const t=e=>{if(e.userData?.__sectionHelper)return;const t=e.userData?.originalMeshInstance??e.userData,n=t?.id?.nodeId??t?.nodeId;"number"==typeof n&&(e.visible=!D.has(n))};e.viewer.mainModel?.EnumerateMeshesAndLines?.(t),e.viewer.mainModel?.EnumerateEdges?.(t),e.viewer.Render?.()}catch(e){console.warn("[Preview] visibility update failed",e)}},[D,C]),y(()=>{const e=a.current,t=s.current;if(e&&t?.viewer)try{t.viewer.SetEdgeSettings(new e.EdgeSettings(O,z(e,P),V));const n=me.current;if(n){const e=[];t.viewer.mainModel?.EnumerateEdges?.(t=>{t.userData?.__sectionHelper&&e.push(t)});for(const t of e)t.parent?.remove(t),t.geometry?.dispose?.(),t.material?.dispose?.();const r=n.plane,i=e=>{e&&!n.materialState.has(e)&&(n.materialState.set(e,{clippingPlanes:e.clippingPlanes,clipShadows:e.clipShadows}),e.clippingPlanes=[r],e.clipShadows=!0,e.needsUpdate=!0)};t.viewer.mainModel?.EnumerateEdges?.(e=>{const t=e.material;if(Array.isArray(t))for(const e of t)i(e);else i(t)})}t.viewer.Render?.()}catch{}},[O,P,V]),y(()=>{const e=a.current,t=s.current;if(e&&t?.viewer)try{const n=z(e,H);t.viewer.SetBackgroundColor(new e.RGBAColor(n.r,n.g,n.b,255)),t.viewer.Render?.()}catch{}},[H]),y(()=>{const e=s.current;if(!e?.viewer||l)return;const t=e.viewer.renderer,n=e.viewer.scene;if(!t||!n)return;if(me.current){const e=me.current;for(const[t,n]of e.materialState.entries())t.clippingPlanes=n.clippingPlanes,t.clipShadows=n.clipShadows,t.needsUpdate=!0;for(const t of e.helpers)t.parent?.remove(t),t.material?.dispose?.();e.capMesh&&(n.remove(e.capMesh),e.capMesh.geometry?.dispose?.(),e.capMesh.material?.dispose?.()),me.current=null}if(!q)return t.localClippingEnabled=!1,void e.viewer.Render?.();const r=e.viewer.GetBoundingBox?.(()=>!0);if(!r)return;const i=[];if(e.viewer.mainModel?.EnumerateMeshes?.(e=>{e.userData?.__sectionHelper||i.push(e)}),!i.length)return t.localClippingEnabled=!1,void e.viewer.Render?.();const o=i[0],a=o.constructor,c=o.material?.constructor,d=o.geometry?.constructor,u=o.geometry?.attributes?.position?.constructor;a&&c&&d&&u||console.warn("[Preview] section: missing THREE constructors, falling back to no cap");const p=7681;let m=!0;try{const e=t.getContext?.(),n=e?.getContextAttributes?.();m=!1!==n?.stencil,t.autoClearStencil=!0,console.info("[Preview] section: stencil buffer =",m,"targets =",i.length)}catch{}t.localClippingEnabled=!0;const h={normal:{x:0,y:0,z:-1},constant:0,clone:function e(){const t={normal:{x:this.normal.x,y:this.normal.y,z:this.normal.z},constant:this.constant};return t.clone=e,t}},x=[],y=/* @__PURE__ */new Map,f=e=>{e&&!y.has(e)&&(y.set(e,{clippingPlanes:e.clippingPlanes,clipShadows:e.clipShadows}),e.clippingPlanes=[h],e.clipShadows=!0,e.needsUpdate=!0)};for(const e of i){const t=e.material;if(Array.isArray(t))for(const e of t)f(e);else f(t);const n=Array.isArray(t)?t[0]:t;if(a&&m&&n?.clone){const t=(t,r)=>{const i=n.clone();i.depthWrite=!1,i.depthTest=!1,i.colorWrite=!1,i.stencilWrite=!0,i.stencilFunc=519,i.stencilFail=r,i.stencilZFail=r,i.stencilZPass=r,i.side=t,i.transparent=!1,i.clippingPlanes=[h],i.clipShadows=!0,i.needsUpdate=!0;const o=new a(e.geometry,i);o.matrixAutoUpdate=!1,o.renderOrder=1,o.userData.__sectionHelper=!0,e.add(o),x.push(o)};t(1,7682),t(0,7683)}}e.viewer.mainModel?.EnumerateEdges?.(e=>{const t=e.material;if(Array.isArray(t))for(const e of t)f(e);else f(t)});let g=null;const b=i[0]?.material&&(Array.isArray(i[0].material)?i[0].material[0]:i[0].material);if(m&&a&&d&&u&&b?.clone){const e=r.max.x-r.min.x,t=r.max.y-r.min.y,i=r.max.z-r.min.z,o=2*Math.max(e,t,i,1)/2,s=new d,l=new Float32Array([-o,-o,0,o,-o,0,o,o,0,-o,o,0]),c=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1]);s.setAttribute("position",new u(l,3)),s.setAttribute("normal",new u(c,3)),s.setIndex([0,1,2,0,2,3]);const m=b.clone(),h=b.color?.getHex?.()??11844808;m.emissive?.setHex?.(h),"emissiveIntensity"in m&&(m.emissiveIntensity=.25),m.side=2,m.transparent=!1,m.opacity=1,m.stencilWrite=!0,m.stencilRef=0,m.stencilFunc=517,m.stencilFail=p,m.stencilZFail=p,m.stencilZPass=p,m.clippingPlanes=[],m.polygonOffset=!0,m.polygonOffsetFactor=-1,m.polygonOffsetUnits=-1,m.needsUpdate=!0,g=new a(s,m),g.renderOrder=2,g.userData.__sectionHelper=!0,n.add(g)}me.current={plane:h,capMesh:g,helpers:x,materialState:y,bbox:r},console.info("[Preview] section: helpers =",x.length,"cap =",!!g),e.viewer.Render?.()},[q,l,C]),y(()=>{const e=s.current,t=me.current;if(e?.viewer&&t&&q)try{const n=t.bbox,r="x"===J?0:"y"===J?1:2,i=[n.min.x,n.min.y,n.min.z][r],o=i+([n.max.x,n.max.y,n.max.z][r]-i)*ne,s=ie*Math.PI/180,a=Math.cos(s),l=Math.sin(s),c=ee?-1:1;let d=0,u=0,p=0;"x"===J?(d=c*a,p=c*l):"y"===J?(u=c*a,d=c*l):(p=c*a,u=c*l);const m={x:(n.min.x+n.max.x)/2,y:(n.min.y+n.max.y)/2,z:(n.min.z+n.max.z)/2},h="x"===J?o:m.x,x="y"===J?o:m.y,y="z"===J?o:m.z;if(t.plane.normal.x=d,t.plane.normal.y=u,t.plane.normal.z=p,t.plane.constant=-(d*h+u*x+p*y),t.capMesh){const e=m.x,n=m.y,r=m.z,i=d*e+u*n+p*r+t.plane.constant,o=e-d*i,s=n-u*i,a=r-p*i;t.capMesh.position.set(o,s,a),t.capMesh.lookAt?.(o+d,s+u,a+p)}e.viewer.Render?.()}catch(e){console.warn("[Preview] section update failed",e)}},[q,J,ee,ne,ie]),y(()=>{const e=s.current;if(!e?.viewer||l||!o.current)return;const t=e.viewer.renderer,n=e.viewer.scene,r=t?.domElement;if(!t||!n||!r)return;let i=null;if(e.viewer.mainModel?.EnumerateMeshes?.(e=>{i||e.userData?.__sectionHelper||e.userData?.__measureHelper||(i=e)}),!i)return;const c=i.position.constructor,d=i.constructor,u=(Array.isArray(i.material)?i.material[0]:i.material)?.constructor,p=i.geometry.constructor,m=i.geometry.attributes?.position?.constructor;if(!(c&&d&&u&&p&&m))return;let h=null,x=null;n.traverse(e=>{if(h&&x)return;if(!e?.isLineSegments)return;h=e.constructor;const t=Array.isArray(e.material)?e.material[0]:e.material;t?.constructor&&(x=t.constructor)});const y=()=>{const t=pe.current;if(t){null!==t.rafId&&cancelAnimationFrame(t.rafId);for(const e of t.markers)n.remove(e),e.geometry?.dispose?.(),e.material?.dispose?.();t.line&&(n.remove(t.line),t.line.geometry?.dispose?.(),t.line.material?.dispose?.()),t.label&&t.label.parentElement&&t.label.parentElement.removeChild(t.label),pe.current=null,e.viewer.Render?.()}};if(!se)return y(),void ue(null);pe.current={points:[],normals:[],markers:[],line:null,label:null,rafId:null};const f=a.current,g=f?.IntersectionMode?.MeshOnly??1,b=e.viewer.GetBoundingBox?.(()=>!0),w=b?Math.sqrt((b.max.x-b.min.x)**2+(b.max.y-b.min.y)**2+(b.max.z-b.min.z)**2):100,v=Math.max(.005*w,.2),k=e=>{const t=[],r=[];for(let e=0;e<=12;e++){const n=e/12*Math.PI;for(let e=0;e<=16;e++){const r=e/16*Math.PI*2;t.push(v*Math.sin(n)*Math.cos(r),v*Math.cos(n),v*Math.sin(n)*Math.sin(r))}}for(let e=0;e<12;e++)for(let t=0;t<16;t++){const n=17*e+t,i=n+16+1;r.push(n,i,n+1,i,i+1,n+1)}const i=new p;i.setAttribute("position",new m(new Float32Array(t),3)),i.setIndex(r),i.computeVertexNormals?.();const o=new u;o.color?.setHex?.(16746496),o.depthTest=!1,o.depthWrite=!1,o.transparent=!0,o.opacity=.95;const s=new d(i,o);return s.position.copy(e),s.renderOrder=9999,s.userData.__measureHelper=!0,n.add(s),s},N=()=>{const t=pe.current;t&&((()=>{const t=pe.current;if(!t||t.points.length<2||!t.label)return;const n=e.viewer.camera;if(!n)return;const i=t.points[0],o=t.points[1],s=new c((i.x+o.x)/2,(i.y+o.y)/2,(i.z+o.z)/2).clone();s.project?.(n);const a=r.getBoundingClientRect(),l=(s.x+1)/2*a.width,d=(1-s.y)/2*a.height;t.label.style.left=`${l}px`,t.label.style.top=`${d}px`;const u=l<0||d<0||l>a.width||d>a.height;t.label.style.opacity=s.z>1||u?"0":"1"})(),t.rafId=requestAnimationFrame(N))};pe.current.rafId=requestAnimationFrame(N);let L=0,C=0,A=0,M=!1,E=!1;const S=t=>{if(!e.viewer.camera)return;const i=r.getBoundingClientRect(),s={x:t.clientX-i.left,y:t.clientY-i.top},a=e.viewer.GetMeshIntersectionUnderMouse?.(g,s);if(!a)return;const l=pe.current,y=new c(a.point.x,a.point.y,a.point.z),f=(e=>{const t=e?.face?.normal,n=e?.object;if(!t||!n)return null;try{const e=new c(t.x,t.y,t.z);return e.transformDirection?.(n.matrixWorld),{x:e.x,y:e.y,z:e.z}}catch{return{x:t.x,y:t.y,z:t.z}}})(a);if(2===l.points.length){for(const e of l.markers)n.remove(e),e.geometry?.dispose?.(),e.material?.dispose?.();l.line&&(n.remove(l.line),l.line.geometry?.dispose?.(),l.line.material?.dispose?.()),l.label&&(l.label.style.opacity="0"),l.points=[],l.markers=[],l.line=null,l.normals=[],ue(null)}if(l.points.push(y),l.normals.push(f),"perp"===le){const e=((e,t)=>{const r=e?.geometry,i=r?.attributes?.position;if(!r||!i||!t?.face?.normal)return null;const o=i.array,s=r.index?r.index.array:null,a=new c(t.point.x,t.point.y,t.point.z);e.worldToLocal?.(a);const l=t.face.normal,h=-(l.x*a.x+l.y*a.y+l.z*a.z);r.computeBoundingBox?.();const x=r.boundingBox,y=x?Math.sqrt((x.max.x-x.min.x)**2+(x.max.y-x.min.y)**2+(x.max.z-x.min.z)**2):100,f=Math.max(.001*y,.005),g=s?s.length/3:i.count/3,b=[],w=new c;for(let t=0;t<g;t++){const n=s?s[3*t]:3*t,r=s?s[3*t+1]:3*t+1,i=s?s[3*t+2]:3*t+2,a=o[3*n],c=o[3*n+1],d=o[3*n+2],u=o[3*r],p=o[3*r+1],m=o[3*r+2],x=o[3*i],y=o[3*i+1],g=o[3*i+2],v=u-a,k=p-c,N=m-d,L=x-a,C=y-c,A=g-d;let M=k*A-N*C,E=N*L-v*A,S=v*C-k*L;const z=Math.sqrt(M*M+E*E+S*S);if(0===z)continue;if(M/=z,E/=z,S/=z,M*l.x+E*l.y+S*l.z<.9995)continue;const j=(a+u+x)/3,T=(c+p+y)/3,R=(d+m+g)/3;if(!(Math.abs(l.x*j+l.y*T+l.z*R+h)>f))for(const[t,n,r]of[[a,c,d],[u,p,m],[x,y,g]])w.set?.(t,n,r),e.localToWorld?.(w),b.push(w.x,w.y,w.z)}if(0===b.length)return null;const v=new p;v.setAttribute("position",new m(new Float32Array(b),3)),v.computeVertexNormals?.();const k=new u;k.color?.setHex?.(16746496),k.transparent=!0,k.opacity=.45,k.depthWrite=!1,k.polygonOffset=!0,k.polygonOffsetFactor=-2,k.polygonOffsetUnits=-2;const N=new d(v,k);return N.renderOrder=9998,N.userData.__measureHelper=!0,n.add(N),N})(a.object,a);l.markers.push(e??k(y))}else l.markers.push(k(y));if(2===l.points.length){const e=l.points[0];let t,r=l.points[1],i="";if("perp"===le){const n=l.normals[0]??l.normals[1];if(n){const o=Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z)||1,s=n.x/o,a=n.y/o,d=n.z/o,u=(r.x-e.x)*s+(r.y-e.y)*a+(r.z-e.z)*d,p=new c(e.x+s*u,e.y+a*u,e.z+d*u);l.points[1]=p,r=p,t=Math.abs(u),i=" ⊥"}else{const n=r.x-e.x,i=r.y-e.y,o=r.z-e.z;t=Math.sqrt(n*n+i*i+o*o)}}else{const n=r.x-e.x,i=r.y-e.y,o=r.z-e.z;t=Math.sqrt(n*n+i*i+o*o)}l.line=((e,t)=>{const r=new p;r.setAttribute("position",new m(new Float32Array([e.x,e.y,e.z,t.x,t.y,t.z]),3));const i=new(h??d)(r,new(x??u)({color:16746496,depthTest:!1,depthWrite:!1,transparent:!0,opacity:.95}));return i.renderOrder=9998,i.userData.__measureHelper=!0,n.add(i),i})(e,r),ue(t);const s=(()=>{const e=pe.current;if(e.label)return e.label;const t=document.createElement("div");return t.style.position="absolute",t.style.left="-9999px",t.style.top="-9999px",t.style.transform="translate(-50%, -50%)",t.style.padding="2px 6px",t.style.fontSize="11px",t.style.fontWeight="600",t.style.fontFamily="system-ui, -apple-system, sans-serif",t.style.background="rgba(255, 136, 0, 0.95)",t.style.color="#fff",t.style.borderRadius="4px",t.style.pointerEvents="none",t.style.whiteSpace="nowrap",t.style.boxShadow="0 1px 4px rgba(0,0,0,0.25)",t.style.zIndex="5",o.current.appendChild(t),e.label=t,t})();s.textContent=`${j(t)}${i}`}e.viewer.Render?.()},z=e=>{0===e.button&&(L=e.clientX,C=e.clientY,A=performance.now(),M=!1,E=!0)},T=e=>{if(!E)return;const t=e.clientX-L,n=e.clientY-C;t*t+n*n>16&&(M=!0)},R=e=>{if(0!==e.button||!E)return;const t=performance.now()-A;E=!1,!M&&t<350&&S(e)},D=e=>{"Escape"===e.key&&ae(!1)};return r.style.cursor="crosshair",r.addEventListener("pointerdown",z),r.addEventListener("pointermove",T),r.addEventListener("pointerup",R),r.addEventListener("pointercancel",R),window.addEventListener("keydown",D),()=>{r.style.cursor="",r.removeEventListener("pointerdown",z),r.removeEventListener("pointermove",T),r.removeEventListener("pointerup",R),r.removeEventListener("pointercancel",R),window.removeEventListener("keydown",D),y(),ue(null)}},[se,le,l,C]),y(()=>{if(!m||l)return;const e=setTimeout(()=>b(!1),5e3);return()=>clearTimeout(e)},[m,l]);const he=e=>{const t=/* @__PURE__ */new Set;S(e,t),F(e=>{const n=new Set(e),r=[...t].some(e=>!n.has(e));for(const e of t)r?n.add(e):n.delete(e);return n})},xe=()=>{try{const e=s.current,t=e?.viewer?.GetBoundingSphere?.(()=>!0);t&&e.viewer.FitSphereToWindow(t,!0),e?.viewer?.Render?.()}catch{}};y(()=>{const e=a.current,t=s.current;if(e&&t?.viewer&&!l)try{t.viewer.SetProjectionMode($?e.ProjectionMode.Perspective:e.ProjectionMode.Orthographic)}catch{}},[$,l]);const ye=e=>{const t=a.current,n=s.current;if(t&&n?.viewer)try{const r=n.viewer.GetBoundingSphere?.(()=>!0);if(!r)return;const i=r.center,o=3*(r.radius||1),s=i.x??0,a=i.y??0,l=i.z??0;let c,d;switch(e){case"top":c=new t.Coord3D(s,a,l+o),d=new t.Coord3D(0,1,0);break;case"front":c=new t.Coord3D(s,a-o,l),d=new t.Coord3D(0,0,1);break;case"side":c=new t.Coord3D(s+o,a,l),d=new t.Coord3D(0,0,1);break;default:{const e=o/Math.sqrt(3);c=new t.Coord3D(s+e,a-e,l+e),d=new t.Coord3D(0,0,1);break}}const u=new t.Coord3D(s,a,l),p=new t.Camera(c,u,d,45);n.viewer.SetCamera(p),n.viewer.AdjustClippingPlanesToSphere?.(r),n.viewer.Render?.()}catch{}},fe=(t.split(".").pop()||"").toUpperCase(),ge=(e,t=0)=>{const n=e.children.length>0,r=!1!==T[e.id],i=!D.has(e.id);/* @__PURE__ */
85
+ return f("div",{children:[
86
+ /* @__PURE__ */f("div",{className:"group flex items-center gap-1 px-1.5 py-1 hover:bg-gray-100 cursor-default text-[12px] text-gray-700",style:{paddingLeft:12*t+6+"px"},children:[n?/* @__PURE__ */g("button",{onClick:()=>{return t=e.id,void R(e=>({...e,[t]:!e[t]}));var t},className:"h-4 w-4 shrink-0 flex items-center justify-center text-gray-500 hover:text-gray-900",title:r?k.collapse:k.expand,children:/* @__PURE__ */g("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:r?"M19.5 8.25l-7.5 7.5-7.5-7.5":"M8.25 4.5l7.5 7.5-7.5 7.5"})})}):/* @__PURE__ */g("span",{className:"h-4 w-4 shrink-0 flex items-center justify-center",children:/* @__PURE__ */g("span",{className:"h-1 w-1 rounded-full bg-gray-400"})}),
87
+ /* @__PURE__ */g("span",{className:"flex-1 truncate "+(i?"":"opacity-40"),title:e.name,children:e.name}),
88
+ /* @__PURE__ */g("button",{onClick:()=>{xe()},className:"h-4 w-4 shrink-0 text-gray-400 hover:text-gray-900 opacity-0 group-hover:opacity-100 transition-opacity",title:k.fitToView,children:/* @__PURE__ */g("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})})}),
89
+ /* @__PURE__ */g("button",{onClick:()=>he(e),className:"h-4 w-4 shrink-0 text-gray-500 hover:text-gray-900",title:i?k.hide:k.show,children:i?/* @__PURE__ */f("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[
90
+ /* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),
91
+ /* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}):/* @__PURE__ */g("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})})})]}),r&&n&&/* @__PURE__ */g("div",{children:e.children.map(e=>ge(e,t+1))})]},e.id)},be="h-8 w-8 shrink-0 flex items-center justify-center rounded text-gray-600 hover:bg-gray-200 hover:text-gray-900 transition-colors",we="h-8 w-8 shrink-0 flex items-center justify-center rounded bg-gray-200 text-gray-900",ve="h-5 w-px bg-gray-300 mx-1";/* @__PURE__ */
92
+ return f("div",{className:"flex flex-col h-full bg-white",children:[
93
+ /* @__PURE__ */f(n,{children:[
94
+ /* @__PURE__ */g("button",{onClick:xe,className:be,title:k.fitToView,children:/* @__PURE__ */g("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})})}),
95
+ /* @__PURE__ */g("div",{className:ve}),
96
+ /* @__PURE__ */g("button",{onClick:()=>ye("iso"),className:be,title:k.isometricView,children:/* @__PURE__ */g("span",{className:"text-[10px] font-semibold",children:k.isometric})}),
97
+ /* @__PURE__ */g("button",{onClick:()=>ye("top"),className:be,title:k.topView,children:/* @__PURE__ */g("span",{className:"text-[10px] font-semibold",children:k.top})}),
98
+ /* @__PURE__ */g("button",{onClick:()=>ye("front"),className:be,title:k.frontView,children:/* @__PURE__ */g("span",{className:"text-[10px] font-semibold",children:k.front})}),
99
+ /* @__PURE__ */g("button",{onClick:()=>ye("side"),className:be,title:k.sideView,children:/* @__PURE__ */g("span",{className:"text-[10px] font-semibold",children:k.side})}),
100
+ /* @__PURE__ */g("button",{onClick:()=>Z(e=>!e),className:$?"h-8 shrink-0 flex items-center justify-center px-2 rounded bg-gray-200 text-gray-900":"h-8 shrink-0 flex items-center justify-center px-2 rounded text-gray-600 hover:bg-gray-200 hover:text-gray-900 transition-colors",title:$?k.toOrthographic:k.toPerspective,children:/* @__PURE__ */g("span",{className:"text-[11px] font-semibold whitespace-nowrap",children:$?k.perspective:k.orthographic})}),
101
+ /* @__PURE__ */g("div",{className:ve}),
102
+ /* @__PURE__ */g("button",{onClick:()=>{try{const e=s.current,n=e?.viewer?.GetCanvasSize?.()??{width:1280,height:720},r=e?.viewer?.GetImageAsDataUrl?.(n.width,n.height,!1);if(!r)return;const i=document.createElement("a");i.href=r,i.download=`${t.replace(/\.[^.]+$/,"")}-snapshot.png`,i.click()}catch{}},className:be,title:k.snapshot,children:/* @__PURE__ */f("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[
103
+ /* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.827 6.175A2.31 2.31 0 015.186 7.23c-.38.054-.757.112-1.134.175C2.999 7.58 2.25 8.507 2.25 9.574V18a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9.574c0-1.067-.75-1.994-1.802-2.169a47.865 47.865 0 00-1.134-.175 2.31 2.31 0 01-1.64-1.055l-.822-1.316a2.192 2.192 0 00-1.736-1.039 48.774 48.774 0 00-5.232 0 2.192 2.192 0 00-1.736 1.039l-.821 1.316z"}),
104
+ /* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 12.75a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0zM18.75 10.5h.008v.008h-.008V10.5z"})]})}),
105
+ /* @__PURE__ */g("button",{onClick:()=>b(e=>!e),className:be,title:N.howToNavigate,children:/* @__PURE__ */g("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})}),
106
+ /* @__PURE__ */g("button",{onClick:()=>ae(e=>!e),className:se?we:be,title:se?N.stopMeasuring:k.measureHint,children:/* @__PURE__ */f("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[
107
+ /* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 14.25l6-6 6 6 4.5-4.5M9.75 8.25v3M12.75 11.25v3M15.75 14.25v3"}),
108
+ /* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 18.75h19.5"})]})}),se&&/* @__PURE__ */f("div",{className:"flex items-stretch h-8 rounded border border-gray-200 overflow-hidden",children:[
109
+ /* @__PURE__ */g("button",{onClick:()=>ce("point"),className:"px-2 text-[11px] font-semibold transition-colors "+("point"===le?"bg-orange-500 text-white":"bg-white text-gray-600 hover:bg-gray-50"),title:k.pointHint,children:k.point}),
110
+ /* @__PURE__ */g("button",{onClick:()=>ce("perp"),className:"px-2 text-[12px] font-semibold transition-colors "+("perp"===le?"bg-orange-500 text-white":"bg-white text-gray-600 hover:bg-gray-50"),title:k.perpendicularHint,children:"⊥"})]}),se&&null!==de&&/* @__PURE__ */f("div",{className:"px-2 py-1 text-[11px] font-mono font-semibold text-orange-600 bg-orange-50 border border-orange-200 rounded whitespace-nowrap",title:"perp"===le?k.perpendicularDistance:k.straightDistance,children:[j(de),"perp"===le?" ⊥":""]}),
111
+ /* @__PURE__ */g("div",{className:ve}),
112
+ /* @__PURE__ */g("button",{onClick:()=>U(e=>!e),className:_?we:be,title:k.meshesHint,children:/* @__PURE__ */g("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"})})}),
113
+ /* @__PURE__ */g("button",{onClick:()=>Y(e=>!e),className:G?we:be,title:k.displayHint,children:/* @__PURE__ */f("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[
114
+ /* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z"}),
115
+ /* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),
116
+ /* @__PURE__ */g("button",{onClick:r??(()=>{const n=document.createElement("a");n.href=e,n.download=t,n.click()}),className:be,title:k.downloadOriginal,children:/* @__PURE__ */g("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})})}),i&&/* @__PURE__ */g("button",{onClick:i,className:be,title:N.email,children:/* @__PURE__ */g("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25h-15a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75"})})})]}),
117
+ /* @__PURE__ */g("div",{className:"flex-1 flex min-h-0",children:/* @__PURE__ */f("div",{className:"relative flex-1 min-w-0",style:{background:H},children:[
118
+ /* @__PURE__ */g("div",{ref:o,style:{width:"100%",height:"100%"}}),_&&/* @__PURE__ */f("div",{className:"absolute top-2 left-2 w-64 max-h-[80%] flex flex-col bg-white/95 backdrop-blur border border-gray-200 rounded-md shadow-xl z-10 text-xs",children:[
119
+ /* @__PURE__ */f("div",{className:"flex items-center justify-between px-2 py-1.5 border-b border-gray-200 bg-gray-50",children:[
120
+ /* @__PURE__ */g("span",{className:"font-medium text-gray-700",children:k.meshes}),
121
+ /* @__PURE__ */g("button",{onClick:()=>U(!1),className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-600",title:N.closePanel,children:"×"})]}),
122
+ /* @__PURE__ */g("div",{className:"flex-1 overflow-y-auto py-1",children:C?ge(C):/* @__PURE__ */g("div",{className:"px-3 py-3 text-[11px] text-gray-500 italic",children:l?k.readingModel:k.noStructure})}),C&&/* @__PURE__ */g("div",{className:"px-3 py-1.5 text-[10px] text-gray-500 border-t border-gray-200",children:0===D.size?k.allVisible:k.hiddenCount(D.size)})]}),m&&!l&&!d&&/* @__PURE__ */f("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 bg-gray-900/85 text-white text-[11px] px-3 py-1.5 rounded-full shadow-lg flex items-center gap-3 z-10 pointer-events-none",children:[
123
+ /* @__PURE__ */g("span",{children:k.dragToRotate}),
124
+ /* @__PURE__ */g("span",{className:"text-white/40",children:"•"}),
125
+ /* @__PURE__ */g("span",{children:k.rightDragToPan}),
126
+ /* @__PURE__ */g("span",{className:"text-white/40",children:"•"}),
127
+ /* @__PURE__ */g("span",{children:N.scrollToZoom})]}),l&&/* @__PURE__ */f("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-white/85 text-sm text-gray-600 gap-2",children:[
128
+ /* @__PURE__ */f("svg",{className:"h-6 w-6 text-blue-500 animate-spin",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
129
+ /* @__PURE__ */g("circle",{cx:"12",cy:"12",r:"10",strokeOpacity:"0.2"}),
130
+ /* @__PURE__ */g("path",{d:"M22 12a10 10 0 0 1-10 10",strokeLinecap:"round"})]}),
131
+ /* @__PURE__ */g("span",{children:k.loading}),"STP"===fe||"STEP"===fe?/* @__PURE__ */g("span",{className:"text-[10px] text-gray-400",children:k.stepNote}):null]}),d&&/* @__PURE__ */g("div",{className:"absolute inset-0 flex items-center justify-center text-sm text-red-600 px-6 text-center bg-white/85",children:d}),G&&/* @__PURE__ */f("div",{className:"absolute top-2 right-2 w-64 max-h-[80%] flex flex-col bg-white/95 backdrop-blur border border-gray-200 rounded-md shadow-xl z-10 text-xs",children:[
132
+ /* @__PURE__ */f("div",{className:"flex items-center justify-between px-2 py-1.5 border-b border-gray-200 bg-gray-50",children:[
133
+ /* @__PURE__ */g("span",{className:"font-medium text-gray-700",children:k.display}),
134
+ /* @__PURE__ */g("button",{onClick:()=>Y(!1),className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-600",title:N.closePanel,children:"×"})]}),
135
+ /* @__PURE__ */f("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-3 text-[12px] text-gray-700",children:[
136
+ /* @__PURE__ */f("label",{className:"flex items-center justify-between gap-2",children:[
137
+ /* @__PURE__ */g("span",{children:k.backgroundColor}),
138
+ /* @__PURE__ */g("input",{type:"color",value:H,onChange:e=>B(e.target.value),className:"h-6 w-10 rounded border border-gray-300 bg-white"})]}),
139
+ /* @__PURE__ */f("label",{className:"flex items-center justify-between gap-2",children:[
140
+ /* @__PURE__ */g("span",{children:k.showEdges}),
141
+ /* @__PURE__ */g("button",{onClick:()=>I(e=>!e),role:"switch","aria-checked":O,className:"relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors "+(O?"bg-blue-500":"bg-gray-300"),children:/* @__PURE__ */g("span",{className:"inline-block h-4 w-4 rounded-full bg-white shadow-sm transition-transform "+(O?"translate-x-[18px]":"translate-x-0.5")})})]}),
142
+ /* @__PURE__ */f("label",{className:"flex items-center justify-between gap-2",children:[
143
+ /* @__PURE__ */g("span",{className:O?"":"opacity-40",children:k.edgeColor}),
144
+ /* @__PURE__ */g("input",{type:"color",value:P,onChange:e=>W(e.target.value),disabled:!O,className:"h-6 w-10 rounded border border-gray-300 bg-white disabled:opacity-40"})]}),
145
+ /* @__PURE__ */f("div",{className:O?"":"opacity-40 pointer-events-none",children:[
146
+ /* @__PURE__ */f("div",{className:"flex items-center justify-between gap-2 mb-1",children:[
147
+ /* @__PURE__ */g("span",{children:k.edgeThreshold}),
148
+ /* @__PURE__ */f("span",{className:"text-gray-500 tabular-nums",children:[V,"°"]})]}),
149
+ /* @__PURE__ */g("input",{type:"range",min:0,max:45,step:1,value:V,onChange:e=>X(Number(e.target.value)),className:"w-full accent-blue-500"})]}),
150
+ /* @__PURE__ */f("div",{className:"border-t border-gray-200 -mx-3 px-3 pt-3 mt-1",children:[
151
+ /* @__PURE__ */f("label",{className:"flex items-center justify-between gap-2",children:[
152
+ /* @__PURE__ */g("span",{className:"font-medium",children:k.sectionView}),
153
+ /* @__PURE__ */g("button",{onClick:()=>K(e=>!e),role:"switch","aria-checked":q,className:"relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors "+(q?"bg-blue-500":"bg-gray-300"),children:/* @__PURE__ */g("span",{className:"inline-block h-4 w-4 rounded-full bg-white shadow-sm transition-transform "+(q?"translate-x-[18px]":"translate-x-0.5")})})]}),
154
+ /* @__PURE__ */f("div",{className:q?"mt-2 space-y-2":"mt-2 space-y-2 opacity-40 pointer-events-none",children:[
155
+ /* @__PURE__ */f("div",{children:[
156
+ /* @__PURE__ */f("div",{className:"flex items-center justify-between gap-2 mb-1",children:[
157
+ /* @__PURE__ */g("span",{children:k.angle}),
158
+ /* @__PURE__ */f("span",{className:"text-gray-500 tabular-nums",children:[ie,"°"]})]}),
159
+ /* @__PURE__ */g("input",{type:"range",min:0,max:180,step:1,value:ie,onChange:e=>oe(Number(e.target.value)),className:"w-full accent-blue-500"})]}),
160
+ /* @__PURE__ */f("div",{children:[
161
+ /* @__PURE__ */f("div",{className:"flex items-center justify-between gap-2 mb-1",children:[
162
+ /* @__PURE__ */g("span",{children:k.axis}),
163
+ /* @__PURE__ */g("button",{onClick:()=>te(e=>!e),className:"text-[10px] text-gray-600 hover:text-gray-900 px-1.5 py-0.5 rounded bg-gray-100 hover:bg-gray-200",title:k.flipHint,children:ee?k.flipped:k.flip})]}),
164
+ /* @__PURE__ */g("div",{className:"grid grid-cols-3 gap-1",children:["x","y","z"].map(e=>/* @__PURE__ */g("button",{onClick:()=>Q(e),className:"py-1 rounded text-[11px] font-semibold "+(J===e?"bg-blue-500 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:e.toUpperCase()},e))})]}),
165
+ /* @__PURE__ */f("div",{children:[
166
+ /* @__PURE__ */f("div",{className:"flex items-center justify-between gap-2 mb-1",children:[
167
+ /* @__PURE__ */g("span",{children:k.position}),
168
+ /* @__PURE__ */f("span",{className:"text-gray-500 tabular-nums",children:[Math.round(100*ne),"%"]})]}),
169
+ /* @__PURE__ */g("input",{type:"range",min:0,max:1,step:.01,value:ne,onChange:e=>re(Number(e.target.value)),className:"w-full accent-blue-500"})]})]})]})]}),
170
+ /* @__PURE__ */g("div",{className:"px-3 py-2 border-t border-gray-200",children:/* @__PURE__ */g("button",{onClick:()=>{B("#f5f6f8"),I(!0),W("#000000"),X(1),K(!1),Q("x"),te(!1),re(.5),oe(0)},className:"w-full text-[11px] text-gray-700 bg-gray-100 hover:bg-gray-200 rounded py-1.5 transition-colors",children:k.resetDisplay})})]})]})})]})}function R({url:e,filename:t,onDownload:i,onEmail:o}){const[s,a]=x(1),[l,c]=x(!1),[u,m]=x(!1),y=h(null),w=p().preview,v="px-2 py-1 rounded hover:bg-gray-200 transition-colors text-gray-600 flex items-center gap-1";/* @__PURE__ */
171
+ return f("div",{className:"flex flex-col h-full",children:[
172
+ /* @__PURE__ */f(n,{children:[!u&&/* @__PURE__ */f(b,{children:[
173
+ /* @__PURE__ */g("button",{onClick:()=>a(e=>Math.max(.1,Math.round(100*(e-.25))/100)),className:v,children:"−"}),
174
+ /* @__PURE__ */f("span",{className:"text-gray-500 w-12 text-center tabular-nums",children:[Math.round(100*s),"%"]}),
175
+ /* @__PURE__ */g("button",{onClick:()=>a(e=>Math.min(8,Math.round(100*(e+.25))/100)),className:v,children:"+"}),
176
+ /* @__PURE__ */g("button",{onClick:()=>a(1),className:v,children:"1:1"}),
177
+ /* @__PURE__ */g("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
178
+ /* @__PURE__ */f("button",{onClick:()=>m(!0),className:v,title:w.annotateHint,children:[
179
+ /* @__PURE__ */g("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L6.832 19.82a4.5 4.5 0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 011.13-1.897L16.863 4.487zm0 0L19.5 7.125"})}),w.annotate]})]}),u&&/* @__PURE__ */f(b,{children:[
180
+ /* @__PURE__ */f("button",{onClick:()=>m(!1),className:v,title:w.viewHint,children:[
181
+ /* @__PURE__ */g("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5L8.25 12l7.5-7.5"})}),w.view]}),
182
+ /* @__PURE__ */f("button",{onClick:()=>y.current?.copy(),className:v,children:[
183
+ /* @__PURE__ */g("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75"})}),w.copy]}),
184
+ /* @__PURE__ */f("button",{onClick:()=>y.current?.save(),className:v,children:[
185
+ /* @__PURE__ */g("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),w.save]})]}),
186
+ /* @__PURE__ */f("button",{onClick:i??(async()=>{if(e.startsWith("blob:")||e.startsWith("data:")){const n=document.createElement("a");return n.href=e,n.download=t,void n.click()}const n=async t=>{const n=await fetch(e,t);if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.blob()};try{let e;try{e=await n({credentials:"include"})}catch{e=await n({credentials:"omit"})}const r=URL.createObjectURL(e),i=document.createElement("a");i.href=r,i.download=t,i.click(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}catch{d.error(w.downloadFailed)}}),className:v,children:[
187
+ /* @__PURE__ */g("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),w.download]}),o&&/* @__PURE__ */f("button",{onClick:o,className:v,children:[
188
+ /* @__PURE__ */g("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25h-15a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75"})}),w.email]})]}),u?/* @__PURE__ */g(r,{ref:y,src:e,filename:t}):/* @__PURE__ */g("div",{className:"flex-1 overflow-auto bg-gray-100 flex items-center justify-center p-4",children:l?/* @__PURE__ */g("div",{className:"text-sm text-red-600",children:w.imageFailed}):/* @__PURE__ */g("img",{src:e,alt:t,onError:()=>c(!0),style:{transform:`scale(${s})`,transformOrigin:"center center",transition:"transform 120ms ease"},className:"max-w-full max-h-full shadow-lg rounded bg-white"})})]})}export{k as default};