efficient-shell 13.6.1 → 13.9.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 (67) hide show
  1. package/README.md +6 -4
  2. package/dist/{Browser-T2K6P3YU.js → Browser-ATL2PGT2.js} +16 -16
  3. package/dist/Files-RHEICXXW.js +141 -0
  4. package/dist/{Notepad-2ULPEDIU.js → Notepad-QL5GJZNS.js} +7 -7
  5. package/dist/PomodoroTimer-2MFWO3KK.js +91 -0
  6. package/dist/{Preview-ZBTPZRMP.js → Preview-PP3XS7E7.js} +41 -41
  7. package/dist/{TimelineTrack-DfU_9eo6.d.ts → TimelineTrack-DCTqfW6Z.d.ts} +13 -0
  8. package/dist/Weather-377NKPA5.js +60 -0
  9. package/dist/WorldClock-M6AMXQY2.js +32 -0
  10. package/dist/ai/index.js +30 -30
  11. package/dist/apps/index.js +1 -1
  12. package/dist/bin/browser-check.js +1 -1
  13. package/dist/bin/media-host-check.js +1 -1
  14. package/dist/bin/ui-check.js +1 -1
  15. package/dist/brand.css +1 -1
  16. package/dist/charts/SpecChart.js +1 -1
  17. package/dist/{chunk-GXVWI3U5.js → chunk-5CFERCYW.js} +1 -1
  18. package/dist/{chunk-X4EJUQ6I.js → chunk-AEOCSYKL.js} +1 -1
  19. package/dist/chunk-AJMQ5SHI.js +1 -0
  20. package/dist/{chunk-PDIGCTZD.js → chunk-BKZOTBDP.js} +19 -19
  21. package/dist/{chunk-BRZ55H2G.js → chunk-F3G7S5HO.js} +50 -50
  22. package/dist/chunk-H7CIK74N.js +15 -0
  23. package/dist/chunk-HYHZEQMG.js +1 -0
  24. package/dist/{chunk-RI5QSLX3.js → chunk-IOZSLFGR.js} +1 -1
  25. package/dist/{chunk-H22D2PYM.js → chunk-LOFFHXZ4.js} +9 -9
  26. package/dist/chunk-NHKT5IH6.js +1 -0
  27. package/dist/chunk-OAKXWYZD.js +2 -0
  28. package/dist/{chunk-S6UJKSF3.js → chunk-OJI4ROSD.js} +1 -1
  29. package/dist/{chunk-7I5GD5IB.js → chunk-RK6X56ZC.js} +2 -2
  30. package/dist/{chunk-3MIIXPV6.js → chunk-SC3AQXJY.js} +8 -8
  31. package/dist/chunk-YJGA4LPG.js +2 -0
  32. package/dist/{chunk-ENCZRE3H.js → chunk-Z62HFEFS.js} +7 -7
  33. package/dist/{chunk-77HMTXDR.js → chunk-ZJ34FNRC.js} +1 -1
  34. package/dist/data/Gantt.js +1 -1
  35. package/dist/format/index.d.ts +1 -1
  36. package/dist/format/index.js +1 -1
  37. package/dist/forms/Calendar.js +1 -1
  38. package/dist/forms/DatePicker.js +1 -1
  39. package/dist/forms/DateRangePicker.js +1 -1
  40. package/dist/index.d.ts +2 -2
  41. package/dist/index.js +665 -665
  42. package/dist/shell/MilestoneTimeline.d.ts +1 -1
  43. package/dist/shell/MilestoneTimeline.js +1 -1
  44. package/dist/shell/ProductionTimeline.d.ts +23 -9
  45. package/dist/shell/ProductionTimeline.js +1 -1
  46. package/dist/shell/TimeAgo.js +1 -1
  47. package/dist/shell/TimelineTrack.d.ts +1 -1
  48. package/dist/shell/TimelineTrack.js +1 -1
  49. package/dist/shell/timelineDates.js +1 -1
  50. package/dist/telemetry/index.js +1 -1
  51. package/dist/ui/index.d.ts +2 -2
  52. package/dist/ui/index.js +1 -1
  53. package/dist/utils/date.d.ts +44 -5
  54. package/dist/utils/date.js +1 -1
  55. package/dist/utils/format.js +1 -1
  56. package/dist/version.js +1 -1
  57. package/package.json +1 -1
  58. package/dist/Files-ZFH4CV3R.js +0 -141
  59. package/dist/PomodoroTimer-57XARJRF.js +0 -91
  60. package/dist/Weather-Y4TMYOQB.js +0 -60
  61. package/dist/WorldClock-FY3UCIAW.js +0 -32
  62. package/dist/chunk-7K73G35Z.js +0 -2
  63. package/dist/chunk-COHFFGFE.js +0 -2
  64. package/dist/chunk-ECTLJTOE.js +0 -1
  65. package/dist/chunk-FBDZGO3V.js +0 -1
  66. package/dist/chunk-R3BLTWKE.js +0 -15
  67. package/dist/chunk-ZPJTLNKU.js +0 -1
@@ -1 +0,0 @@
1
- var o={0:["Clear Sky","☀️","🌙","from-sky-400 to-blue-500","from-indigo-900 to-slate-950"],1:["Mainly Clear","🌤️","🌙","from-sky-400 to-blue-500","from-indigo-900 to-slate-950"],2:["Partly Cloudy","⛅","☁️","from-sky-400 to-blue-400","from-indigo-800 to-slate-900"],3:["Overcast","☁️","☁️","from-gray-400 to-gray-500","from-gray-700 to-slate-900"],45:["Foggy","🌫️","🌫️","from-gray-400 to-gray-500","from-gray-700 to-slate-800"],48:["Foggy","🌫️","🌫️","from-gray-400 to-gray-500","from-gray-700 to-slate-800"],51:["Light Drizzle","🌦️","🌧️","from-gray-400 to-blue-500","from-gray-700 to-indigo-900"],53:["Drizzle","🌧️","🌧️","from-gray-500 to-blue-600","from-gray-700 to-indigo-900"],55:["Heavy Drizzle","🌧️","🌧️","from-gray-500 to-blue-600","from-gray-700 to-indigo-900"],61:["Light Rain","🌦️","🌧️","from-gray-400 to-blue-500","from-gray-700 to-indigo-900"],63:["Rain","🌧️","🌧️","from-gray-500 to-blue-600","from-gray-700 to-indigo-900"],65:["Heavy Rain","🌧️","🌧️","from-gray-600 to-blue-700","from-gray-700 to-indigo-950"],71:["Light Snow","🌨️","🌨️","from-blue-200 to-blue-400","from-blue-800 to-slate-900"],73:["Snow","❄️","❄️","from-blue-300 to-blue-500","from-blue-800 to-slate-900"],75:["Heavy Snow","❄️","❄️","from-blue-400 to-blue-600","from-blue-800 to-slate-900"],80:["Rain Showers","🌧️","🌧️","from-gray-500 to-blue-600","from-gray-700 to-indigo-900"],82:["Heavy Showers","🌧️","🌧️","from-gray-600 to-blue-700","from-gray-700 to-indigo-950"],95:["Thunderstorm","⛈️","⛈️","from-gray-700 to-indigo-800","from-gray-800 to-indigo-950"],96:["Thunderstorm","⛈️","⛈️","from-gray-700 to-indigo-800","from-gray-800 to-indigo-950"],99:["Thunderstorm","⛈️","⛈️","from-gray-700 to-indigo-900","from-gray-800 to-indigo-950"]},t=(t,r=!0)=>{const a=o[t]||["Unknown","❓","❓","from-gray-400 to-gray-500","from-gray-700 to-slate-800"];return[a[0],r?a[1]:a[2],r?a[3]:a[4]]},r={Sydney:{lat:-33.8688,lon:151.2093,tz:"Australia/Sydney"},Melbourne:{lat:-37.8136,lon:144.9631,tz:"Australia/Melbourne"},Auckland:{lat:-36.8485,lon:174.7633,tz:"Pacific/Auckland"},Tokyo:{lat:35.6762,lon:139.6503,tz:"Asia/Tokyo"},Shanghai:{lat:31.2304,lon:121.4737,tz:"Asia/Shanghai"},"Hong Kong":{lat:22.3193,lon:114.1694,tz:"Asia/Hong_Kong"},Singapore:{lat:1.3521,lon:103.8198,tz:"Asia/Singapore"},Bangkok:{lat:13.7563,lon:100.5018,tz:"Asia/Bangkok"},Mumbai:{lat:19.076,lon:72.8777,tz:"Asia/Kolkata"},Dubai:{lat:25.2048,lon:55.2708,tz:"Asia/Dubai"},Berlin:{lat:52.52,lon:13.405,tz:"Europe/Berlin"},Paris:{lat:48.8566,lon:2.3522,tz:"Europe/Paris"},London:{lat:51.5074,lon:-.1278,tz:"Europe/London"},"New York":{lat:40.7128,lon:-74.006,tz:"America/New_York"},Miami:{lat:25.7617,lon:-80.1918,tz:"America/New_York"},Toronto:{lat:43.6532,lon:-79.3832,tz:"America/Toronto"},Chicago:{lat:41.8781,lon:-87.6298,tz:"America/Chicago"},"Los Angeles":{lat:34.0522,lon:-118.2437,tz:"America/Los_Angeles"}},a="weather_local_cache";function e(){try{return JSON.parse(localStorage.getItem(a)||"{}")}catch{return{}}}async function n(o,t=!1){const n=r[o];if(!n)return null;if(!t){const t=e()[o];if(t&&Date.now()-t.ts<18e5)return t.data}try{const t=await fetch(`https://api.open-meteo.com/v1/forecast?latitude=${n.lat}&longitude=${n.lon}&current=temperature_2m,weather_code,is_day&daily=temperature_2m_max,temperature_2m_min&forecast_days=1&timezone=auto`),r=await t.json(),l={city:o,temp:Math.round(r.current.temperature_2m),code:r.current.weather_code,high:Math.round(r.daily.temperature_2m_max[0]),low:Math.round(r.daily.temperature_2m_min[0]),isDay:1===r.current.is_day,timezone:r.timezone||"UTC"},i=e();return i[o]={data:l,ts:Date.now()},function(o){try{localStorage.setItem(a,JSON.stringify(o))}catch{}}(i),l}catch{return null}}var l=o=>Math.round(9*o/5+32);export{r as AVAILABLE_CITIES,n as fetchCityWeather,t as getCondition,l as toFahrenheit};
@@ -1,15 +0,0 @@
1
- import{TimelineCard as e}from"./chunk-S4Z657L6.js";import{TimelineGlyph as t,TimelineProgressIcon as r,TimelineTrack as n}from"./chunk-BRZ55H2G.js";import{toDayMs as a,fmtSliderDate as o}from"./chunk-GXVWI3U5.js";import{DAY_MS as i}from"./chunk-JRQMX4PK.js";import{Icon as s}from"./chunk-ISVODSRP.js";import{useBrowserValueOnce as l}from"./chunk-D65T4H6J.js";import{useShellStrings as c,useShellLocale as d,splitAround as p}from"./chunk-DEJIH3ZQ.js";import{useState as u,useEffect as m,useRef as g}from"react";import{jsxs as h,jsx as b,Fragment as y}from"react/jsx-runtime";var k=/* @__PURE__ */new Set(["finished","partial_shipped","shipped","completed","cancelled"]),f=[{key:"casting",label:"Casting",weight:.2},{key:"cnc",label:"CNC",weight:.2},{key:"painting",label:"Painting",weight:.5},{key:"packing",label:"Packing",weight:.1},{key:"finished_goods",label:"FG",weight:0},{key:"stock_qty",label:"Stock",weight:0}];function _(e){if(e.order_qty<=0)return 0;let t=0;for(const r of f)if(r.weight>0){t+=Math.min((e[r.key]||0)/e.order_qty,1)*r.weight}return 100*t}function v(e){const t=e?.items??[];return 0===t.length?0:t.reduce((e,t)=>e+_(t),0)/t.length}function M(e){const{reports:t,poProductionStartDate:r,poEstCompletionDate:n,poStatus:o,poNumber:s="",currentReportId:d,currentReportDate:p,msPerDayOfPlayback:h=500,markers:b=[]}=e,[y,f]=u(null),_=c().production;m(()=>{p?f(new Date(p).getTime()):t.length>0&&f(new Date(t[0].date).getTime())},[d]);const[v,M]=u(!1),w=g(null),N=()=>{null!=w.current&&(cancelAnimationFrame(w.current),w.current=null),M(!1)};m(()=>()=>N(),[]),m(()=>{N()},[d]);const S=t.map(e=>a(e.date)).filter(e=>null!=e),x=l(Date.now,null)??Math.max(0,...S,...b.map(e=>a(e.date)??0),a(r??null)??0,a(n??null)??0),P=S.length?Math.min(...S):x,D=S.length?Math.max(...S):x,R=a(r??null)??P,C=a(n??null)??0,O=k.has((o||"").toLowerCase()),q=b.reduce((e,t)=>{const r=a(t.date);return null!=r&&r>e?r:e},0),I=(()=>{const e=[C,D,q,R+i];return O||e.push(x),Math.max(...e)})(),T=Math.max(1,Math.round((I-R)/i)),j=a(p??null)??D??R,A=Math.min(Math.max(y??j,R),I),L=t.find(e=>{const t=a(e.date);return null!=t&&t<=A})??null;let $=null;for(let e=t.length-1;e>=0;e--){const r=a(t[e].date);if(null!=r&&r>A){$=t[e];break}}const F=(()=>{if(L||!$||0===t.length)return null;const e=(t[t.length-1].items??[]).map((e,t)=>({id:`zero-${e.part_number}-${t}`,part_number:e.part_number,description:e.description??"",order_qty:Number(e.order_qty||0),casting:0,cnc:0,painting:0,packing:0,finished_goods:0,stock_qty:0}));return{id:`zero-${s}`,progress_number:_.start,date:r||new Date(R).toISOString().slice(0,10),items:e,est_completion_date:n??null,created_by_name:"",notes:""}})(),G=L??F,H=L?a(L.date):F?R:null,J=$?a($.date):null,Z=!!(G&&$&&null!=H&&null!=J&&A>H&&A<J);let z,B;if(Z&&null!=H&&null!=J){const e=(A-H)/Math.max(J-H,1),t=(t,r)=>Math.round(t+(r-t)*e),r={};for(const e of G?.items??[])r[e.part_number]=e;const n={};for(const e of $?.items??[])n[e.part_number]=e;const o=Array.from(/* @__PURE__ */new Set([...Object.keys(r),...Object.keys(n)])).map((e,a)=>{const o=r[e]??{},i=n[e]??{},s=e=>Number(e)||0;return{id:`interp-${e}-${a}`,part_number:e,description:o.description??i.description??"",order_qty:s(o.order_qty??i.order_qty??0),casting:t(s(o.casting),s(i.casting)),cnc:t(s(o.cnc),s(i.cnc)),painting:t(s(o.painting),s(i.painting)),packing:t(s(o.packing),s(i.packing)),finished_goods:t(s(o.finished_goods),s(i.finished_goods)),stock_qty:t(s(o.stock_qty),s(i.stock_qty))}}),i=a(G?.est_completion_date),s=a($?.est_completion_date);let l;l=null!=i&&null!=s?new Date(Math.round(i+(s-i)*e)).toISOString().slice(0,10):G?.est_completion_date||$?.est_completion_date||null,z={id:`interp-${A}`,progress_number:_.estimated,date:new Date(A).toISOString().slice(0,10),created_by_name:"",est_completion_date:l,items:o,notes:""},B=G}else if(z=G??t[t.length-1]??null,z){const e=t.findIndex(e=>e.id===z.id);B=e>=0&&e<t.length-1?t[e+1]:null}else B=null;const E={};for(const e of B?.items??[])E[e.part_number]=e;const K=!(!d||z?.id===d),Q=d?Math.min(a(p??null)??I,I):I,V=d?t.find(e=>e.id===d)?.progress_number:void 0;return{startMs:R,endMs:I,totalLeadDays:T,scrubMs:A,setScrubMs:e=>{N(),f(e)},resetToCurrent:()=>{N(),p&&f(new Date(p).getTime())},scrubbedAway:K,beforeAnchor:G,nextAfter:$,displayed:z,prevReport:B,prevByPN:E,isInterpolated:Z,playing:v,startPlay:()=>{if(v)return void N();if(Q<=R)return void f(Q);M(!0),f(R);let e=performance.now(),t=R;const r=n=>{const a=n-e;if(e=n,t+=a/h*i,t>=Q)return f(Q),w.current=null,void M(!1);f(t),w.current=requestAnimationFrame(r)};w.current=requestAnimationFrame(r)},stopPlay:N,reports:t,markers:b,poNumber:s,currentReportId:d,currentReportProgressNumber:V,estCompletionMs:a(n??null)}}function w({startMs:e,endMs:t,reports:r,markers:a,valueMs:i,activeId:s,onChange:l,onPickReport:p,onOpenReport:u,onOpenMarker:m,onDragStart:g,renderReportPreview:h,reportLabel:y,playback:k,edgeCaptions:f,bare:_=!1,endMark:v=null}){const M=c().production,w=d(),N=r.map(e=>({report:e,ms:new Date(e.date).getTime()})).filter(({ms:e})=>Number.isFinite(e)).sort((e,t)=>e.ms-t.ms),S=N.map(({report:e,ms:t})=>({key:e.id,ms:t,kind:"report",label:y(e),preview:e.preview??h?.(e),onOpen:u?()=>u(e.id):void 0})),x=new Map(N.map(({report:e,ms:t})=>[e.id,t])),P=N.map(({ms:e})=>e),D=m?a.map(e=>({...e,onOpen:m})):a;/* @__PURE__ */
2
- return b("div",{className:"select-none",children:/* @__PURE__ */b(n,{axis:_?"spread":"linear",labels:_?"none":"active",endMark:_?v:null,items:S,markers:D,startMs:e,endMs:t,activeKey:s,onActivate:e=>{const t=x.get(e);null!=t&&l(t),p(e)},playback:k,edgeCaptions:f,thumb:{valueMs:i,onChange:l,onDragStart:g,stops:P,ariaLabel:M.scrub,valueText:e=>{const t=(e=>N.find(t=>t.ms===e)?.report)(e);return t?`${y(t)} · ${o(e,w)}`:o(e,w)}},ariaLabel:M.label(o(e,w),o(t,w))})})}function N({snapshot:n,onPickReport:i,onOpenReport:l,onOpenMarker:m,renderReportPreview:k,onScrubProgress:f,heading:_,edgeCaptions:M,reportLabel:N=e=>e.progress_number,resetLabel:S,variant:x="card",onPlayStart:P}){const{reports:D,markers:R,poNumber:C,startMs:O,endMs:q,totalLeadDays:I,scrubMs:T,setScrubMs:j,displayed:A,scrubbedAway:L,resetToCurrent:$,currentReportId:F,currentReportProgressNumber:G,estCompletionMs:H}=n,J=function(e,t,r){const[n,a]=u(!1),o=g(!1);return{playing:n,toggle:()=>{n?a(!1):0!==e.length&&(r?.(),o.current||(o.current=!0,t(e[0])),a(!0))},stop:()=>{o.current=!1,a(!1)}}}(D.map(e=>a(e.date)).filter(e=>null!=e).sort((e,t)=>e-t),j,P),Z=c().production,z=d(),B=_??Z.heading,E=e=>o(e,z);if(0===D.length&&0===R.length)return null;const K=R.filter(e=>"shipment"===e.kind),Q=R.filter(e=>"inspection"===e.kind),V=R.filter(e=>"invoice"===e.kind),X=(A?.items??[]).reduce((e,t)=>e+(Number(t.stock_qty)||0),0),U=A?v(A):0,W=D.find(e=>e.id===F),Y=W?N(W):G,ee=
3
- /* @__PURE__ */h("button",{type:"button",onClick:J.toggle,"aria-pressed":J.playing,title:J.playing?Z.pause:Z.playTitle,className:"rosh-tl-play text-gray-700 border-gray-300 hover:text-blue-600 hover:border-blue-600",children:[J.playing?/* @__PURE__ */b(s,{name:"pause","aria-hidden":"true"}):/* @__PURE__ */b(s,{name:"play","aria-hidden":"true"}),
4
- /* @__PURE__ */b("span",{children:J.playing?Z.pause:Z.play})]}),te=L&&(S??Y)?/* @__PURE__ */b("button",{type:"button",onClick:()=>{J.stop(),$()},className:"text-xs text-blue-600 underline-offset-4 hover:underline font-medium",children:S??Z.backTo(String(Y))}):null,[re,ne]=p(Z.showing),ae=e=>/* @__PURE__ */b("p",{className:"rosh-tl-status text-gray-800",children:A?/* @__PURE__ */h(y,{children:[e&&re,
5
- /* @__PURE__ */b("b",{className:"font-medium",children:N(A)}),e&&ne,
6
- /* @__PURE__ */h("span",{className:"text-gray-500",children:[" · ",E(new Date(A.date).getTime())," · ",Z.overall(Math.round(U))," · ",Z.inStock(X)]})]}):/* @__PURE__ */b("span",{className:"text-gray-500",children:Z.noReport})});if("rail"===x){const e=null!=H&&H>=q&&q>O,t=e?{key:"__estimate__",label:Z.estimatedCompletion,dateText:E(H)}:null;/* @__PURE__ */
7
- return h("div",{className:"shrink-0","data-timeline-variant":"rail",children:[
8
- /* @__PURE__ */b(w,{bare:!0,endMark:t,startMs:O,endMs:q,reports:D,markers:R,valueMs:T,activeId:A?.id??"",onChange:j,onPickReport:i,onOpenReport:l,onOpenMarker:m,renderReportPreview:k,reportLabel:N,edgeCaptions:{start:M?.start??Z.start,end:M?.end??(e?Z.estDone:void 0)},onDragStart:J.stop,playback:{playing:J.playing,onArrive:(e,t)=>j(t),onProgress:f,onStop:J.stop}}),
9
- /* @__PURE__ */h("div",{className:"rosh-tl-railrow","data-timeline-part":"rail-row",children:[ee,te,ae(!1)]})]})}/* @__PURE__ */
10
- return b("div",{className:"shrink-0",children:/* @__PURE__ */b(e,{icon:/* @__PURE__ */b(r,{}),heading:B,subject:C,meta:[`${E(O)} → ${E(q)}`,Z.leadTime(I)],actions:/* @__PURE__ */h(y,{children:[te,ee]}),footer:/* @__PURE__ */h(y,{children:[ae(!0),
11
- /* @__PURE__ */h("div",{className:"rosh-tl-legend",children:[D.length>0&&/* @__PURE__ */h("span",{className:"border-gray-200 text-gray-500",children:[
12
- /* @__PURE__ */b("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-ring border-blue-600"}),Z.report]}),K.length>0&&/* @__PURE__ */h("span",{className:"border-gray-200 text-gray-500",children:[
13
- /* @__PURE__ */b("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-diamond",style:{background:"var(--tl-shipment)",color:"var(--tl-on-kind)"},children:/* @__PURE__ */b(t,{name:"truck"})}),Z.shipment]}),Q.length>0&&/* @__PURE__ */h("span",{className:"border-gray-200 text-gray-500",children:[
14
- /* @__PURE__ */b("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-disc",style:{background:"var(--tl-inspection)",color:"var(--tl-on-kind)"},children:/* @__PURE__ */b(t,{name:"flask"})}),Z.inspection]}),V.length>0&&/* @__PURE__ */h("span",{className:"border-gray-200 text-gray-500",children:[
15
- /* @__PURE__ */b("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-disc",style:{background:"var(--tl-invoice)",color:"var(--tl-on-kind)"},children:/* @__PURE__ */b(t,{name:"receipt"})}),Z.invoice]})]})]}),children:/* @__PURE__ */b(w,{startMs:O,endMs:q,reports:D,markers:R,valueMs:T,activeId:A?.id??"",onChange:j,onPickReport:i,onOpenReport:l,onOpenMarker:m,renderReportPreview:k,reportLabel:N,edgeCaptions:M,onDragStart:J.stop,playback:{playing:J.playing,onArrive:(e,t)=>j(t),onProgress:f,onStop:J.stop}})})})}export{k as POST_PRODUCTION_STATUSES,N as ProductionTimeline,f as STAGES,_ as calcOverall,v as calcReportOverall,M as useProductionTimeline};
@@ -1 +0,0 @@
1
- import{EMPTY_VALUE as e}from"./chunk-36BRD5J3.js";import{fromDateKey as t,DAY_MS as r}from"./chunk-JRQMX4PK.js";import{pad2 as n}from"./chunk-LF27WIN2.js";var o=[{key:"DD/MM/YYYY",example:"24/04/2026"},{key:"MM/DD/YYYY",example:"04/24/2026"},{key:"YYYY-MM-DD",example:"2026-04-24"},{key:"DD-MM-YYYY",example:"24-04-2026"},{key:"MM-DD-YYYY",example:"04-24-2026"},{key:"DD.MM.YYYY",example:"24.04.2026"},{key:"YYYY.MM.DD",example:"2026.04.24"},{key:"YYYY/MM/DD",example:"2026/04/24"},{key:"DD/MM/YY",example:"24/04/26"},{key:"MM/DD/YY",example:"04/24/26"},{key:"DD/MMM/YYYY",example:"24/Apr/2026"},{key:"DD/MMM/YY",example:"24/Apr/26"},{key:"DD MMM YYYY",example:"24 Apr 2026"},{key:"MMM DD, YYYY",example:"Apr 24, 2026"},{key:"DD MMMM YYYY",example:"24 April 2026"},{key:"MMMM DD, YYYY",example:"April 24, 2026"}],a=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],u=["January","February","March","April","May","June","July","August","September","October","November","December"];function Y(e){return a[parseInt(e,10)-1]??e}function m(e){return u[parseInt(e,10)-1]??e}function i(){if("undefined"==typeof window)return"DD/MM/YYYY";try{return localStorage.getItem("user_date_format")||"DD/MM/YYYY"}catch{return"DD/MM/YYYY"}}function c(e){localStorage.setItem("user_date_format",e)}var l="user_timezone",M="auto";function D(){if("undefined"!=typeof window)try{const e=localStorage.getItem(l);return e&&e!==M?e:void 0}catch{return}}function s(e){e&&e!==M?localStorage.setItem(l,e):localStorage.removeItem(l)}function f(e){e&&localStorage.setItem(l,e)}var y={dateStyle:"medium"},$=/* @__PURE__ */new Map;function d(e,t){const r=`${e}|${JSON.stringify(t)}`;let n=$.get(r);return n||(n=new Intl.DateTimeFormat(e,{...t,timeZone:"UTC",calendar:"gregory"}),$.set(r,n)),n}var h=/* @__PURE__ */new Map;function g(e){const t=e??"";let r=h.get(t);if(void 0===r){try{r=new Intl.DateTimeFormat("en-GB",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23",calendar:"gregory",timeZone:e})}catch{r=null}h.set(t,r)}return r}var p=e=>null!==g(e);function w(e,t){const r=function(e){return g(e)??g(void 0)}(t).formatToParts(e),n=e=>r.find(t=>t.type===e)?.value??"";return{y:n("year"),m:n("month"),d:n("day"),hh:n("hour"),mm:n("minute")}}var k=/^(\d{4})-(\d{1,2})-(\d{1,2})$/;function S(e,t){if(!e)return null;const r=k.exec(e);if(r){const[e,t,o]=r.slice(1).map(Number);return t<1||t>12||o<1||o>31?null:{y:String(e),m:n(t),d:n(o)}}const o=new Date(e);return Number.isNaN(o.getTime())?null:w(o,t)}function N(t,r){const n=S(t,r?.timeZone||D());return n?r?.locale?d(r.locale,r.style??y).format(new Date(Date.UTC(Number(n.y),Number(n.m)-1,Number(n.d)))):function(e,t,r){switch(i()){case"MM/DD/YYYY":return`${t}/${r}/${e}`;case"YYYY-MM-DD":return`${e}-${t}-${r}`;case"DD-MM-YYYY":return`${r}-${t}-${e}`;case"MM-DD-YYYY":return`${t}-${r}-${e}`;case"DD.MM.YYYY":return`${r}.${t}.${e}`;case"YYYY.MM.DD":return`${e}.${t}.${r}`;case"YYYY/MM/DD":return`${e}/${t}/${r}`;case"DD/MM/YY":return`${r}/${t}/${e.slice(-2)}`;case"MM/DD/YY":return`${t}/${r}/${e.slice(-2)}`;case"DD/MMM/YYYY":return`${r}/${Y(t)}/${e}`;case"DD/MMM/YY":return`${r}/${Y(t)}/${e.slice(-2)}`;case"DD MMM YYYY":return`${r} ${Y(t)} ${e}`;case"MMM DD, YYYY":return`${Y(t)} ${r}, ${e}`;case"DD MMMM YYYY":return`${r} ${m(t)} ${e}`;case"MMMM DD, YYYY":return`${m(t)} ${r}, ${e}`;default:return`${r}/${t}/${e}`}}(n.y,n.m,n.d):e}function b(e){if(e)return p(e)?e:null;const t=D();return t&&p(t)?t:"undefined"==typeof window?null:void 0}function I(e,r){if(!e)return null;if(t(e))return e;if(k.test(e))return null;const n=b(r);if(null===n)return null;const o=S(e,n);return o?`${o.y}-${o.m}-${o.d}`:null}function v(e=/* @__PURE__ */new Date,t){return Number.isNaN(e.getTime())?null:I(e.toISOString(),t)}function x(e,t){const r=w(new Date(e),t);return Date.UTC(Number(r.y),Number(r.m)-1,Number(r.d),Number(r.hh),Number(r.mm))-6e4*Math.floor(e/6e4)}var T=(e,t)=>Number.isInteger(e)&&e>=0&&e<=t;function A(e,n){const o=t(e),a=n?.hour??12,u=n?.minute??0;if(!o||!T(a,23)||!T(u,59))return null;const Y=Date.UTC(o.getFullYear(),o.getMonth(),o.getDate(),a,u),m=b(n?.timeZone);if(null===m)return null;const i=Y-x(Y-r,m),c=Y-x(Y+r,m),l=e=>e+x(e,m)===Y,M=l(i)?i:l(c)?c:I(new Date(i).toISOString(),m)===e?i:c;return new Date(M).toISOString()}function J(t,r){if(!t||k.test(t))return e;const n=new Date(t);if(Number.isNaN(n.getTime()))return e;const o=r?.timeZone||D();if(r?.locale)return function(e,t,r){const n={hour:"numeric",minute:"2-digit"};try{return e.toLocaleTimeString(t,{...n,timeZone:r})}catch{return e.toLocaleTimeString(t,n)}}(n,r.locale,o);const{hh:a,mm:u}=w(n,o);return function(e,t){const r=Number(e);return`${r%12||12}:${t} ${r<12?"am":"pm"}`}(a,u)}function F(t,r){const n=J(t,r);return n===e?e:`${N(t,r)}, ${n}`}var C={months:u,monthsShort:a,weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Su","Mo","Tu","We","Th","Fr","Sa"],monthYear:(e,t)=>`${u[t]} ${e}`,shortMonthYear:(e,t)=>`${a[t]} ${e}`,longDate:(e,t,r)=>`${r} ${u[t]} ${e}`},O=/* @__PURE__ */new Map;function Z(e){if(!e)return C;const t=O.get(e);if(t)return t;const r=t=>d(e,t),n=(e,t,r=1)=>new Date(Date.UTC(e,t,r)),o=r({month:"long"}),a=r({month:"short"}),u=r({weekday:"long"}),Y=r({weekday:"short"}),m=r({month:"long",year:"numeric"}),i=r({month:"short",year:"numeric"}),c=r({day:"numeric",month:"long",year:"numeric"}),l=Array.from({length:12},(e,t)=>t),M=Array.from({length:7},(e,t)=>t),D={months:l.map(e=>o.format(n(2e3,e))),monthsShort:l.map(e=>a.format(n(2e3,e))),weekdays:M.map(e=>u.format(n(2e3,0,2+e))),weekdaysShort:M.map(e=>Y.format(n(2e3,0,2+e))),monthYear:(e,t)=>m.format(n(e,t)),shortMonthYear:(e,t)=>i.format(n(e,t)),longDate:(e,t,r)=>c.format(n(e,t,r))};return O.set(e,D),D}var U=/* @__PURE__ */new Map;function W(e){if(!e)return 0;let t=U.get(e);if(void 0===t){t=0;try{const r=new Intl.Locale(e),n="function"==typeof r.getWeekInfo?r.getWeekInfo():r.weekInfo;1===n?.firstDay&&(t=1)}catch{}U.set(e,t)}return t}export{o as DATE_FORMAT_OPTIONS,M as TZ_AUTO,Z as calendarNames,I as dayKeyInZone,W as firstDayOfWeek,N as formatDate,F as formatDateTime,J as formatTime,i as getUserDateFormat,D as getUserTimezone,A as instantOnDayKey,c as setUserDateFormat,s as setUserTimezone,f as syncTimezoneFromProfile,v as userToday};