@tarve/core 0.5.0 → 0.6.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 (109) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +54 -2
  3. package/dist/npm/build.js +714 -138
  4. package/dist/npm/cli.js +1013 -161
  5. package/dist/npm/embedded-assets.js +7 -2
  6. package/dist/npm/index.js +3096 -1084
  7. package/dist/npm/jsx-dev-runtime.js +1268 -0
  8. package/dist/npm/jsx-runtime.js +1268 -0
  9. package/dist/npm/native-runtime.json +3 -3
  10. package/dist/npm/node-build.js +299 -5
  11. package/dist/npm/protocol.js +1 -1
  12. package/dist/npm/txiki/fetch.ts +228 -0
  13. package/dist/npm/txiki/intl-data.ts +7 -0
  14. package/dist/npm/txiki/intl.test.ts +53 -0
  15. package/dist/npm/txiki/intl.ts +249 -0
  16. package/dist/npm/txiki/prelude.ts +132 -0
  17. package/dist/npm/txiki/runtime.ts +6 -0
  18. package/dist/npm/txiki/shims/buffer.ts +112 -0
  19. package/dist/npm/txiki/shims/child-process.ts +151 -0
  20. package/dist/npm/txiki/shims/crypto.ts +30 -0
  21. package/dist/npm/txiki/shims/events.ts +75 -0
  22. package/dist/npm/txiki/shims/fs-promises.ts +77 -0
  23. package/dist/npm/txiki/shims/fs.ts +231 -0
  24. package/dist/npm/txiki/shims/module.ts +8 -0
  25. package/dist/npm/txiki/shims/net.ts +69 -0
  26. package/dist/npm/txiki/shims/os.ts +72 -0
  27. package/dist/npm/txiki/shims/path.ts +4 -0
  28. package/dist/npm/txiki/shims/timers-promises.ts +9 -0
  29. package/dist/npm/txiki/shims/zlib.ts +9 -0
  30. package/dist/npm/txiki/tjs.d.ts +58 -0
  31. package/dist/npm/txiki/unavailable.ts +10 -0
  32. package/dist/types/core/build.d.ts +5 -2
  33. package/dist/types/core/jsx-compile.d.ts +7 -0
  34. package/dist/types/core/src/advanced-controls.d.ts +1 -1
  35. package/dist/types/core/src/app/element-events.d.ts +18 -0
  36. package/dist/types/core/src/app/media.d.ts +15 -0
  37. package/dist/types/core/src/app/requests.d.ts +25 -0
  38. package/dist/types/core/src/app/shadow.d.ts +7 -0
  39. package/dist/types/core/src/app/stats.d.ts +12 -0
  40. package/dist/types/core/src/app/tray.d.ts +40 -0
  41. package/dist/types/core/src/app-metadata.d.ts +2 -0
  42. package/dist/types/core/src/app.d.ts +29 -27
  43. package/dist/types/core/src/bridge/index.d.ts +1 -1
  44. package/dist/types/core/src/chat-controls.d.ts +2 -1
  45. package/dist/types/core/src/components/button.d.ts +1 -1
  46. package/dist/types/core/src/components/glass.d.ts +52 -0
  47. package/dist/types/core/src/components/icon.d.ts +1 -1
  48. package/dist/types/core/src/components/image.d.ts +1 -1
  49. package/dist/types/core/src/components/layout.d.ts +1 -1
  50. package/dist/types/core/src/components/pressable.d.ts +1 -1
  51. package/dist/types/core/src/components/rich-content.d.ts +1 -1
  52. package/dist/types/core/src/components/scroll.d.ts +2 -2
  53. package/dist/types/core/src/components/svg.d.ts +1 -1
  54. package/dist/types/core/src/components/titlebar.d.ts +15 -1
  55. package/dist/types/core/src/components/window.d.ts +21 -1
  56. package/dist/types/core/src/components.d.ts +2 -0
  57. package/dist/types/core/src/css-shadow.d.ts +1 -1
  58. package/dist/types/core/src/desktop-controls.d.ts +2 -2
  59. package/dist/types/core/src/embedded-assets.d.ts +3 -2
  60. package/dist/types/core/src/extra-controls.d.ts +1 -1
  61. package/dist/types/core/src/form-controls.d.ts +1 -1
  62. package/dist/types/core/src/index.d.ts +20 -11
  63. package/dist/types/core/src/inline-text.d.ts +7 -3
  64. package/dist/types/core/src/intrinsic-style.d.ts +1 -1
  65. package/dist/types/core/src/jsx-runtime.d.ts +10 -4
  66. package/dist/types/core/src/media-element.d.ts +3 -4
  67. package/dist/types/core/src/memo.d.ts +10 -0
  68. package/dist/types/core/src/motion.d.ts +1 -1
  69. package/dist/types/core/src/popups.d.ts +1 -1
  70. package/dist/types/core/src/protocol.d.ts +6 -0
  71. package/dist/types/core/src/reconciler/diff.d.ts +11 -0
  72. package/dist/types/core/src/reconciler/intrinsics.d.ts +24 -0
  73. package/dist/types/core/src/reconciler.d.ts +10 -11
  74. package/dist/types/core/src/render-scope.d.ts +8 -0
  75. package/dist/types/core/src/style.d.ts +1 -1
  76. package/dist/types/core/src/tailwind-palette.d.ts +1 -0
  77. package/dist/types/core/src/tailwind.d.ts +8 -0
  78. package/dist/types/core/src/test-renderer.d.ts +1 -1
  79. package/dist/types/core/src/text-search.d.ts +1 -1
  80. package/dist/types/core/src/theme.d.ts +8 -1
  81. package/dist/types/core/src/updates.d.ts +87 -0
  82. package/dist/types/core/src/virtual-list.d.ts +3 -1
  83. package/dist/types/core/txiki/fetch.d.ts +1 -0
  84. package/dist/types/core/txiki/intl-data.d.ts +6 -0
  85. package/dist/types/core/txiki/intl.d.ts +92 -0
  86. package/dist/types/core/txiki/prelude.d.ts +1 -0
  87. package/dist/types/core/txiki/runtime.d.ts +2 -0
  88. package/dist/types/core/txiki/shims/buffer.d.ts +37 -0
  89. package/dist/types/core/txiki/shims/child-process.d.ts +46 -0
  90. package/dist/types/core/txiki/shims/crypto.d.ts +16 -0
  91. package/dist/types/core/txiki/shims/events.d.ts +21 -0
  92. package/dist/types/core/txiki/shims/fs-promises.d.ts +41 -0
  93. package/dist/types/core/txiki/shims/fs.d.ts +44 -0
  94. package/dist/types/core/txiki/shims/module.d.ts +5 -0
  95. package/dist/types/core/txiki/shims/net.d.ts +22 -0
  96. package/dist/types/core/txiki/shims/os.d.ts +52 -0
  97. package/dist/types/core/txiki/shims/path.d.ts +3 -0
  98. package/dist/types/core/txiki/shims/timers-promises.d.ts +7 -0
  99. package/dist/types/core/txiki/shims/zlib.d.ts +11 -0
  100. package/dist/types/core/txiki/unavailable.d.ts +5 -0
  101. package/dist/types/core/txiki-build.d.ts +23 -0
  102. package/dist/types/core/updates-build.d.ts +35 -0
  103. package/dist/types/protocol/src/index.d.ts +159 -8
  104. package/native/linux-x64/libtarve_native.so +0 -0
  105. package/native/linux-x64/runtime.json +4 -4
  106. package/native/win32-x64/runtime.json +4 -4
  107. package/native/win32-x64/tarve_native.dll +0 -0
  108. package/package.json +3 -2
  109. /package/dist/types/core/{app-metadata.d.ts → package-metadata.d.ts} +0 -0
@@ -0,0 +1,7 @@
1
+ // Generated by scripts/generate-txiki-intl.ts from ICU 78.3 (Bun 1.4.3). Do not edit.
2
+ /** [group, decimal, minimum grouping digits, secondary group size, percent pattern, minus sign, date formats per DATE_OPTIONS]. */
3
+ export type LocaleData = [string, string, number, number, string, string, number[][]];
4
+ export const DATE_KEYS: string[] = ["","hour=2-digit,minute=2-digit","hour=numeric,minute=2-digit","hour=numeric,minute=2-digit,second=2-digit","hour=2-digit,minute=2-digit,second=2-digit","hour=2-digit,hour12=false,minute=2-digit","hour=2-digit,hour12=true,minute=2-digit","hour=numeric,hour12=false,minute=2-digit","hour=numeric,hour12=true,minute=2-digit","hour=numeric,hour12=false,minute=2-digit,second=2-digit","hour=numeric,hour12=true,minute=2-digit,second=2-digit","day=numeric,month=short,weekday=short","day=numeric,month=long,weekday=long","day=numeric,month=short","day=numeric,month=long","day=numeric,month=short,year=numeric","day=numeric,month=long,year=numeric","day=numeric,month=long,weekday=long,year=numeric","day=numeric,month=short,weekday=short,year=numeric","day=numeric,month=numeric,year=numeric","day=2-digit,month=2-digit,year=numeric","month=long,year=numeric","month=short,year=numeric","weekday=short","weekday=long","month=short","month=long","day=numeric,hour=numeric,minute=2-digit,month=numeric,second=2-digit,year=numeric","day=numeric,hour=numeric,minute=2-digit,month=short,year=numeric","dateStyle=full","dateStyle=long","dateStyle=medium","dateStyle=short","timeStyle=short","timeStyle=medium","dateStyle=medium,timeStyle=short","dateStyle=short,timeStyle=short"];
5
+ export const TEMPLATES: string[] = ["{M0}/{d0}/{y0}","{h1}:{m1} {a0}{c12}","{h0}:{m1} {a0}{c12}","{h0}:{m1}:{s1} {a0}{c12}","{h1}:{m1}:{s1} {a0}{c12}","{h1}:{m1}{c23}","{h1}:{m1}:{s1}{c23}","{w0}, {M0} {d0}","{M0} {d0}","{M0} {d0}, {y0}","{w0}, {M0} {d0}, {y0}","{M1}/{d1}/{y0}","{M0} {y0}","{w0}","{M0}","{M0}/{d0}/{y0}, {h0}:{m1}:{s1} {a0}{c12}","{M0} {d0}, {y0}, {h0}:{m1} {a0}{c12}","{M0}/{d0}/{y1}","{M0}/{d0}/{y1}, {h0}:{m1} {a0}{c12}","{d1}/{M1}/{y0}","{h0}:{m1}{c23}","{h0}:{m1}:{s1}{c23}","{w0} {d0} {M0}","{d0} {M0}","{d0} {M0} {y0}","{w0}, {d0} {M0} {y0}","{d1}/{M1}/{y0}, {h0}:{m1}:{s1}{c23}","{d0} {M0} {y0}, {h0}:{m1}{c23}","{d0} {M0} {y0}, {h1}:{m1}{c23}","{d1}/{M1}/{y0}, {h1}:{m1}{c23}","{d0}/{M0}/{y0}","{w0}, {d0} {M0}","{w0}, {d0} {M0}, {y0}","{d0}/{M0}/{y0}, {h0}:{m1}:{s1} {a0}{c12}","{d0} {M0} {y0}, {h0}:{m1} {a0}{c12}","{d1}/{M1}/{y1}","{d1}/{M1}/{y1}, {h0}:{m1} {a0}{c12}","{y0}-{M1}-{d1}","{y0}-{M1}-{d1}, {h0}:{m1}:{s1} {a0}{c12}","{y0}-{M1}-{d1}, {h0}:{m1} {a0}{c12}","{w0} {d0} {M0} {y0}","{d1}/{M1}/{y0}, {h0}:{m1}:{s1} {a0}{c12}","{d0}/{M0}/{y1}","{d0}/{M0}/{y1}, {h0}:{m1} {a0}{c12}","{w0}, {d0} de {M0}","{d0} de {M0}","{d0} de {M0} de {y0}","{w0}, {d0} de {M0} de {y0}","{M0} de {y0}","{d0} de {M0} de {y0}, {h0}:{m1}{c23}","{d0} de {M0} de {y0}, {h1}:{m1}{c23}","{w0}, {d0}/{M1}","{d0}/{M1}","{d0}/{M1}/{y0}","{w0}, {d0}/{M1}/{y0}","{M1}/{y0}","{d0}/{M1}/{y0}, {h0}:{m1}{c23}","{d1}/{M1}/{y1}, {h1}:{m1}{c23}","{d0}/{M0}/{y0}, {h0}:{m1}:{s1}{c23}","{d0}/{M0}/{y1}, {h0}:{m1}{c23}","{w0} {d0} de {M0}","{d0} de {M0} de {y0}, {h0}:{m1} {a0}{c12}","{d1}/{M1}/{y0} {h0}:{m1}:{s1}{c23}","{d1}/{M1}/{y0} {h1}:{m1}{c23}","{h1} h {m1}{c23}","{h0} h {m1}{c23}","{h0} h {m1} min {s1} s{c23}","{h1} h {m1} min {s1} s{c23}","{h1} h {m1} {a0}{c12}","{h0} h {m1} {a0}{c12}","{h0} h {m1} min {s1} s {a0}{c12}","{y0}-{M1}-{d1} {h0} h {m1} min {s1} s{c23}","{d0} {M0} {y0}, {h0} h {m1}{c23}","{d0} {M0} {y0}, {h1} h {m1}{c23}","{y0}-{M1}-{d1} {h1} h {m1}{c23}","{d0}.{M0}.{y0}","{w0}, {d0}. {M0}","{d0}. {M0}","{d0}. {M0} {y0}","{w0}, {d0}. {M0} {y0}","{d1}.{M1}.{y0}","{d0}.{M0}.{y0}, {h0}:{m1}:{s1}{c23}","{d0}. {M0} {y0}, {h0}:{m1}{c23}","{d1}.{M1}.{y1}","{d1}.{M1}.{y0}, {h1}:{m1}{c23}","{d1}.{M1}.{y1}, {h1}:{m1}{c23}","{d0}-{M0}-{y0}","{d1}-{M1}-{y0}","{d0}-{M0}-{y0}, {h0}:{m1}:{s1}{c23}","{d1}-{M1}-{y0}, {h1}:{m1}{c23}","{y0}-{M1}-{d1} {h0}:{m1}:{s1}{c23}","{d0} {M0} {y0} {h0}:{m1}{c23}","{d0} {M0} {y0} {h1}:{m1}{c23}","{y0}-{M1}-{d1} {h1}:{m1}{c23}","{w0} {d0}. {M0}","{w0} {d0}. {M0} {y0}","{d0}. {M0} {y0}, {h1}:{m1}{c23}","{h1}.{m1}{c23}","{h0}.{m1}{c23}","{h0}.{m1}.{s1}{c23}","{h1}.{m1}.{s1}{c23}","{h1}.{m1} {a0}{c12}","{h0}.{m1} {a0}{c12}","{h0}.{m1}.{s1} {a0}{c12}","{w0} den {d0}. {M0} {y0}","{d0}.{M0}.{y0}, {h0}.{m1}.{s1}{c23}","{d0}. {M0} {y0}, {h0}.{m1}{c23}","{d0}. {M0} {y0}, {h1}.{m1}{c23}","{d1}.{M1}.{y0}, {h1}.{m1}{c23}","{w0} {d0}.{M0}.","{d0}.{M0}.","{w0} {d0}.{M0}.{y0}","{d0}.{M0}.{y0} klo {h0}.{m1}.{s1}{c23}","{d0}.{M0}.{y0} klo {h0}.{m1}{c23}","{d0}.{M1}.{y0}","{d0}.{M1}.{y0}, {h0}:{m1}:{s1}{c23}","{d0}.{M1}.{y0}, {h1}:{m1}{c23}","{d0}. {M0}. {y0}","{w0} {d0}. {M0}.","{d0}. {M0}.","{w0} {d0}. {M0}. {y0}","{d1}. {M1}. {y0}","{d0}. {M0}. {y0} {h0}:{m1}:{s1}{c23}","{d0}. {M0}. {y0} {h0}:{m1}{c23}","{d1}.{M1}.{y1} {h0}:{m1}{c23}","{d0} {M0} {y0} г.","{w0}, {d0} {M0} {y0} г.","{M0} {y0} г.","{d1}.{M1}.{y0}, {h0}:{m1}:{s1}{c23}","{d0} {M0} {y0} г., {h0}:{m1}{c23}","{d0} {M0} {y0} г., {h1}:{m1}{c23}","{d0} {M0} {y0} р.","{w0}, {d0} {M0} {y0} р.","{M0} {y0} р.","{d0} {M0} {y0} р., {h0}:{m1}{c23}","{d0} {M0} {y0} р., {h1}:{m1}{c23}","{a0} {h1}:{m1}{c12}","{a0} {h0}:{m1}{c12}","{a0} {h0}:{m1}:{s1}{c12}","{d0} {M0} {w0}","{d0} {M0} {y0} {w0}","{d1}.{M1}.{y0} {h0}:{m1}:{s1}{c23}","{d0}.{M1}.{y0} {h1}:{m1}{c23}","{y0}/{M0}/{d0}","{a0}{h1}:{m1}{c11}","{a0}{h0}:{m1}{c11}","{a0}{h0}:{m1}:{s1}{c11}","{M0}月{d0}日({w0})","{M0}月{d0}日{w0}","{M0}月{d0}日","{y0}年{M0}月{d0}日","{y0}年{M0}月{d0}日{w0}","{y0}年{M0}月{d0}日({w0})","{y0}/{M1}/{d1}","{y0}年{M0}月","{M0}月","{y0}/{M0}/{d0} {h0}:{m1}:{s1}{c23}","{y0}年{M0}月{d0}日 {h0}:{m1}{c23}","{y0}/{M1}/{d1} {h0}:{m1}{c23}","{a0}{h1}:{m1}{c12}","{a0}{h0}:{m1}{c12}","{a0}{h0}:{m1}:{s1}{c12}","{y0}年{M0}月{d0}日 {h1}:{m1}{c23}","{y0}/{M0}/{d0} {h1}:{m1}{c23}","{a0}{h1}:{m1}:{s1}{c12}","{y0}/{M0}/{d0} {a0}{h0}:{m1}:{s1}{c12}","{y0}年{M0}月{d0}日 {a0}{h0}:{m1}{c12}","{y0}年{M0}月{d0}日 {w0}","{y0}/{M0}/{d0} {a0}{h0}:{m1}{c12}","{y0}. {M0}. {d0}.","{a0} {h1}:{m1}:{s1}{c12}","{M0} {d0}일 ({w0})","{M0} {d0}일 {w0}","{M0} {d0}일","{y0}년 {M0} {d0}일","{y0}년 {M0} {d0}일 {w0}","{y0}년 {M0} {d0}일 ({w0})","{y0}. {M1}. {d1}.","{y0}년 {M0}","{y0}. {M0}. {d0}. {a0} {h0}:{m1}:{s1}{c12}","{y0}년 {M0} {d0}일 {a0} {h0}:{m1}{c12}","{y1}. {M0}. {d0}.","{y0}. {M0}. {d0}. {a0} {h0}:{m1}{c12}","{y1}. {M0}. {d0}. {a0} {h0}:{m1}{c12}","{d0}/{M0}/{y0}, {h0}.{m1}.{s1}{c23}","{d0} {M0} {y0}, {h0}.{m1}{c23}","{w0}, {d1} {M0} {y0}","{d0} {M0} {y0}, {h1}.{m1}{c23}","{d1}/{M1}/{y1}, {h1}.{m1}{c23}","{d0} {M0}, {y0}","{M0} năm {y0}","{h0}:{m1}:{s1} {d0}/{M0}/{y0}{c23}","{h0}:{m1} {d0} {M0}, {y0}{c23}","{h1}:{m1} {d0} {M0}, {y0}{c23}","{h1}:{m1} {d0}/{M0}/{y1}{c23}","{w0}, {d0} ב{M0}","{d0} ב{M0}","{d0} ב{M0} {y0}","{w0}, {d0} ב{M0} {y0}","{d0} ב{M0} {y0}, {h0}:{m1}{c23}","{d0}.{M0}.{y0}, {h0}:{m1}{c23}"];
6
+ export const NAMES: string[][] = [["AM","AM","AM","AM","AM","AM","AM","AM","AM","AM","AM","AM","PM","PM","PM","PM","PM","PM","PM","PM","PM","PM","PM","PM"],["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],["January","February","March","April","May","June","July","August","September","October","November","December"],["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],["am","am","am","am","am","am","am","am","am","am","am","am","pm","pm","pm","pm","pm","pm","pm","pm","pm","pm","pm","pm"],["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec"],["a.m.","a.m.","a.m.","a.m.","a.m.","a.m.","a.m.","a.m.","a.m.","a.m.","a.m.","a.m.","p.m.","p.m.","p.m.","p.m.","p.m.","p.m.","p.m.","p.m.","p.m.","p.m.","p.m.","p.m."],["Jan","Feb","Mar","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec"],["jan.","fev.","mar.","abr.","mai.","jun.","jul.","ago.","set.","out.","nov.","dez."],["dom.","seg.","ter.","qua.","qui.","sex.","sáb."],["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"],["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"],["domingo","segunda","terça","quarta","quinta","sexta","sábado"],["a. m.","a. m.","a. m.","a. m.","a. m.","a. m.","a. m.","a. m.","a. m.","a. m.","a. m.","a. m.","p. m.","p. m.","p. m.","p. m.","p. m.","p. m.","p. m.","p. m.","p. m.","p. m.","p. m.","p. m."],["ene","feb","mar","abr","may","jun","jul","ago","sept","oct","nov","dic"],["dom","lun","mar","mié","jue","vie","sáb"],["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],["domingo","lunes","martes","miércoles","jueves","viernes","sábado"],["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],["janv.","févr.","mars","avr.","mai","juin","juill.","août","sept.","oct.","nov.","déc."],["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sept.","Okt.","Nov.","Dez."],["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."],["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],["So","Mo","Di","Mi","Do","Fr","Sa"],["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],["Jän.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sep.","Okt.","Nov.","Dez."],["Jänner","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],["Jän","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],["gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic"],["dom","lun","mar","mer","gio","ven","sab"],["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"],["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"],["jan","feb","mrt","apr","mei","jun","jul","aug","sep","okt","nov","dec"],["zo","ma","di","wo","do","vr","za"],["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"],["fm","fm","fm","fm","fm","fm","fm","fm","fm","fm","fm","fm","em","em","em","em","em","em","em","em","em","em","em","em"],["jan.","feb.","mars","apr.","maj","juni","juli","aug.","sep.","okt.","nov.","dec."],["sön","mån","tis","ons","tors","fre","lör"],["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"],["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"],["jan.","feb.","mars","apr.","mai","juni","juli","aug.","sep.","okt.","nov.","des."],["søn.","man.","tir.","ons.","tor.","fre.","lør."],["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"],["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],["jan","feb","mar","apr","mai","jun","jul","aug","sep","okt","nov","des"],["jan.","feb.","mar.","apr.","maj","jun.","jul.","aug.","sep.","okt.","nov.","dec."],["søn.","man.","tirs.","ons.","tors.","fre.","lør."],["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"],["ap.","ap.","ap.","ap.","ap.","ap.","ap.","ap.","ap.","ap.","ap.","ap.","ip.","ip.","ip.","ip.","ip.","ip.","ip.","ip.","ip.","ip.","ip.","ip."],["su","ma","ti","ke","to","pe","la"],["tammikuuta","helmikuuta","maaliskuuta","huhtikuuta","toukokuuta","kesäkuuta","heinäkuuta","elokuuta","syyskuuta","lokakuuta","marraskuuta","joulukuuta"],["sunnuntai","maanantai","tiistai","keskiviikko","torstai","perjantai","lauantai"],["sunnuntaina","maanantaina","tiistaina","keskiviikkona","torstaina","perjantaina","lauantaina"],["tammikuu","helmikuu","maaliskuu","huhtikuu","toukokuu","kesäkuu","heinäkuu","elokuu","syyskuu","lokakuu","marraskuu","joulukuu"],["tammi","helmi","maalis","huhti","touko","kesä","heinä","elo","syys","loka","marras","joulu"],["sty","lut","mar","kwi","maj","cze","lip","sie","wrz","paź","lis","gru"],["niedz.","pon.","wt.","śr.","czw.","pt.","sob."],["stycznia","lutego","marca","kwietnia","maja","czerwca","lipca","sierpnia","września","października","listopada","grudnia"],["niedziela","poniedziałek","wtorek","środa","czwartek","piątek","sobota"],["styczeń","luty","marzec","kwiecień","maj","czerwiec","lipiec","sierpień","wrzesień","październik","listopad","grudzień"],["dop.","dop.","dop.","dop.","dop.","dop.","dop.","dop.","dop.","dop.","dop.","dop.","odp.","odp.","odp.","odp.","odp.","odp.","odp.","odp.","odp.","odp.","odp.","odp."],["ne","po","út","st","čt","pá","so"],["ledna","února","března","dubna","května","června","července","srpna","září","října","listopadu","prosince"],["neděle","pondělí","úterý","středa","čtvrtek","pátek","sobota"],["leden","únor","březen","duben","květen","červen","červenec","srpen","září","říjen","listopad","prosinec"],["led","úno","bře","dub","kvě","čvn","čvc","srp","zář","říj","lis","pro"],["янв.","февр.","мар.","апр.","мая","июн.","июл.","авг.","сент.","окт.","нояб.","дек."],["вс","пн","вт","ср","чт","пт","сб"],["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"],["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],["январь","февраль","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь"],["янв.","февр.","март","апр.","май","июнь","июль","авг.","сент.","окт.","нояб.","дек."],["дп","дп","дп","дп","дп","дп","дп","дп","дп","дп","дп","дп","пп","пп","пп","пп","пп","пп","пп","пп","пп","пп","пп","пп"],["січ.","лют.","бер.","квіт.","трав.","черв.","лип.","серп.","вер.","жовт.","лист.","груд."],["нд","пн","вт","ср","чт","пт","сб"],["січня","лютого","березня","квітня","травня","червня","липня","серпня","вересня","жовтня","листопада","грудня"],["неділя","понеділок","вівторок","середа","четвер","пʼятниця","субота"],["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],["ÖÖ","ÖÖ","ÖÖ","ÖÖ","ÖÖ","ÖÖ","ÖÖ","ÖÖ","ÖÖ","ÖÖ","ÖÖ","ÖÖ","ÖS","ÖS","ÖS","ÖS","ÖS","ÖS","ÖS","ÖS","ÖS","ÖS","ÖS","ÖS"],["Oca","Şub","Mar","Nis","May","Haz","Tem","Ağu","Eyl","Eki","Kas","Ara"],["Paz","Pzt","Sal","Çar","Per","Cum","Cmt"],["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"],["午前","午前","午前","午前","午前","午前","午前","午前","午前","午前","午前","午前","午後","午後","午後","午後","午後","午後","午後","午後","午後","午後","午後","午後"],["日","月","火","水","木","金","土"],["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],["上午","上午","上午","上午","上午","上午","上午","上午","上午","上午","上午","上午","下午","下午","下午","下午","下午","下午","下午","下午","下午","下午","下午","下午"],["周日","周一","周二","周三","周四","周五","周六"],["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],["週日","週一","週二","週三","週四","週五","週六"],["凌晨","凌晨","凌晨","凌晨","凌晨","清晨","清晨","清晨","上午","上午","上午","上午","中午","下午","下午","下午","下午","下午","下午","晚上","晚上","晚上","晚上","晚上"],["오전","오전","오전","오전","오전","오전","오전","오전","오전","오전","오전","오전","오후","오후","오후","오후","오후","오후","오후","오후","오후","오후","오후","오후"],["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],["일","월","화","수","목","금","토"],["일요일","월요일","화요일","수요일","목요일","금요일","토요일"],["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agu","Sep","Okt","Nov","Des"],["Min","Sen","Sel","Rab","Kam","Jum","Sab"],["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"],["SA","SA","SA","SA","SA","SA","SA","SA","SA","SA","SA","SA","CH","CH","CH","CH","CH","CH","CH","CH","CH","CH","CH","CH"],["thg 1","thg 2","thg 3","thg 4","thg 5","thg 6","thg 7","thg 8","thg 9","thg 10","thg 11","thg 12"],["CN","Thứ 2","Thứ 3","Thứ 4","Thứ 5","Thứ 6","Thứ 7"],["tháng 1","tháng 2","tháng 3","tháng 4","tháng 5","tháng 6","tháng 7","tháng 8","tháng 9","tháng 10","tháng 11","tháng 12"],["Chủ Nhật","Thứ Hai","Thứ Ba","Thứ Tư","Thứ Năm","Thứ Sáu","Thứ Bảy"],["Tháng 1","Tháng 2","Tháng 3","Tháng 4","Tháng 5","Tháng 6","Tháng 7","Tháng 8","Tháng 9","Tháng 10","Tháng 11","Tháng 12"],["ינו׳","פבר׳","מרץ","אפר׳","מאי","יוני","יולי","אוג׳","ספט׳","אוק׳","נוב׳","דצמ׳"],["יום א׳","יום ב׳","יום ג׳","יום ד׳","יום ה׳","יום ו׳","שבת"],["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"],["יום ראשון","יום שני","יום שלישי","יום רביעי","יום חמישי","יום שישי","יום שבת"]];
7
+ export const LOCALES: Record<string, LocaleData> = {"en-US":[",",".",1,3,"{n}%","-",[[0,-1,-1,-1],[1,-1,-1,0],[2,-1,-1,0],[3,-1,-1,0],[4,-1,-1,0],[5,-1,-1,-1],[1,-1,-1,0],[5,-1,-1,-1],[2,-1,-1,0],[6,-1,-1,-1],[3,-1,-1,0],[7,1,2,-1],[7,3,4,-1],[8,1,-1,-1],[8,3,-1,-1],[9,1,-1,-1],[9,3,-1,-1],[10,3,4,-1],[10,1,2,-1],[0,-1,-1,-1],[11,-1,-1,-1],[12,3,-1,-1],[12,1,-1,-1],[13,-1,2,-1],[13,-1,4,-1],[14,1,-1,-1],[14,3,-1,-1],[15,-1,-1,0],[16,1,-1,0],[10,3,4,-1],[9,3,-1,-1],[9,1,-1,-1],[17,-1,-1,-1],[2,-1,-1,0],[3,-1,-1,0],[16,1,-1,0],[18,-1,-1,0]]],"en-GB":[",",".",1,3,"{n}%","-",[[19,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[1,-1,-1,5],[20,-1,-1,-1],[2,-1,-1,5],[21,-1,-1,-1],[3,-1,-1,5],[22,6,2,-1],[22,3,4,-1],[23,6,-1,-1],[23,3,-1,-1],[24,6,-1,-1],[24,3,-1,-1],[25,3,4,-1],[25,6,2,-1],[19,-1,-1,-1],[19,-1,-1,-1],[12,3,-1,-1],[12,6,-1,-1],[13,-1,2,-1],[13,-1,4,-1],[14,6,-1,-1],[14,3,-1,-1],[26,-1,-1,-1],[27,6,-1,-1],[25,3,4,-1],[24,3,-1,-1],[24,6,-1,-1],[19,-1,-1,-1],[5,-1,-1,-1],[6,-1,-1,-1],[28,6,-1,-1],[29,-1,-1,-1]]],"en-IN":[",",".",1,2,"{n}%","-",[[30,-1,-1,-1],[1,-1,-1,5],[2,-1,-1,5],[3,-1,-1,5],[4,-1,-1,5],[5,-1,-1,-1],[1,-1,-1,5],[5,-1,-1,-1],[2,-1,-1,5],[6,-1,-1,-1],[3,-1,-1,5],[31,6,2,-1],[31,3,4,-1],[23,6,-1,-1],[23,3,-1,-1],[24,6,-1,-1],[24,3,-1,-1],[25,3,4,-1],[32,6,2,-1],[30,-1,-1,-1],[19,-1,-1,-1],[12,3,-1,-1],[12,6,-1,-1],[13,-1,2,-1],[13,-1,4,-1],[14,6,-1,-1],[14,3,-1,-1],[33,-1,-1,5],[34,6,-1,5],[25,3,4,-1],[24,3,-1,-1],[24,6,-1,-1],[35,-1,-1,-1],[2,-1,-1,5],[3,-1,-1,5],[34,6,-1,5],[36,-1,-1,5]]],"en-CA":[",",".",1,3,"{n}%","-",[[37,-1,-1,-1],[1,-1,-1,7],[2,-1,-1,7],[3,-1,-1,7],[4,-1,-1,7],[5,-1,-1,-1],[1,-1,-1,7],[5,-1,-1,-1],[2,-1,-1,7],[6,-1,-1,-1],[3,-1,-1,7],[7,1,2,-1],[7,3,4,-1],[8,1,-1,-1],[8,3,-1,-1],[9,1,-1,-1],[9,3,-1,-1],[10,3,4,-1],[10,1,2,-1],[37,-1,-1,-1],[37,-1,-1,-1],[12,3,-1,-1],[12,1,-1,-1],[13,-1,2,-1],[13,-1,4,-1],[14,1,-1,-1],[14,3,-1,-1],[38,-1,-1,7],[16,1,-1,7],[10,3,4,-1],[9,3,-1,-1],[9,1,-1,-1],[37,-1,-1,-1],[2,-1,-1,7],[3,-1,-1,7],[16,1,-1,7],[39,-1,-1,7]]],"en-AU":[",",".",1,3,"{n}%","-",[[19,-1,-1,-1],[1,-1,-1,5],[2,-1,-1,5],[3,-1,-1,5],[4,-1,-1,5],[5,-1,-1,-1],[1,-1,-1,5],[5,-1,-1,-1],[2,-1,-1,5],[6,-1,-1,-1],[3,-1,-1,5],[31,8,2,-1],[22,3,4,-1],[23,8,-1,-1],[23,3,-1,-1],[24,8,-1,-1],[24,3,-1,-1],[40,3,4,-1],[25,8,2,-1],[19,-1,-1,-1],[19,-1,-1,-1],[12,3,-1,-1],[12,8,-1,-1],[13,-1,2,-1],[13,-1,4,-1],[14,6,-1,-1],[14,3,-1,-1],[41,-1,-1,5],[34,8,-1,5],[25,3,4,-1],[24,3,-1,-1],[24,8,-1,-1],[42,-1,-1,-1],[2,-1,-1,5],[3,-1,-1,5],[34,8,-1,5],[43,-1,-1,5]]],"pt-BR":[".",",",1,3,"{n}%","-",[[19,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[1,-1,-1,0],[20,-1,-1,-1],[2,-1,-1,0],[21,-1,-1,-1],[3,-1,-1,0],[44,9,10,-1],[44,11,12,-1],[45,9,-1,-1],[45,11,-1,-1],[46,9,-1,-1],[46,11,-1,-1],[47,11,12,-1],[47,9,10,-1],[19,-1,-1,-1],[19,-1,-1,-1],[48,11,-1,-1],[48,9,-1,-1],[13,-1,10,-1],[13,-1,12,-1],[14,9,-1,-1],[14,11,-1,-1],[26,-1,-1,-1],[49,9,-1,-1],[47,11,12,-1],[46,11,-1,-1],[46,9,-1,-1],[19,-1,-1,-1],[5,-1,-1,-1],[6,-1,-1,-1],[50,9,-1,-1],[29,-1,-1,-1]]],"pt-PT":[" ",",",2,3,"{n}%","-",[[19,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[1,-1,-1,7],[20,-1,-1,-1],[2,-1,-1,7],[21,-1,-1,-1],[3,-1,-1,7],[51,-1,13,-1],[44,11,12,-1],[52,-1,-1,-1],[45,11,-1,-1],[53,-1,-1,-1],[46,11,-1,-1],[47,11,12,-1],[54,-1,13,-1],[19,-1,-1,-1],[19,-1,-1,-1],[48,11,-1,-1],[55,-1,-1,-1],[13,-1,13,-1],[13,-1,12,-1],[14,9,-1,-1],[14,11,-1,-1],[26,-1,-1,-1],[56,-1,-1,-1],[47,11,12,-1],[46,11,-1,-1],[19,-1,-1,-1],[35,-1,-1,-1],[5,-1,-1,-1],[6,-1,-1,-1],[29,-1,-1,-1],[57,-1,-1,-1]]],"es-ES":[".",",",2,3,"{n} %","-",[[30,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[1,-1,-1,14],[20,-1,-1,-1],[2,-1,-1,14],[21,-1,-1,-1],[3,-1,-1,14],[31,15,16,-1],[44,17,18,-1],[23,15,-1,-1],[45,17,-1,-1],[24,15,-1,-1],[46,17,-1,-1],[47,17,18,-1],[25,15,16,-1],[30,-1,-1,-1],[19,-1,-1,-1],[48,17,-1,-1],[12,15,-1,-1],[13,-1,16,-1],[13,-1,18,-1],[14,15,-1,-1],[14,17,-1,-1],[58,-1,-1,-1],[27,15,-1,-1],[47,17,18,-1],[46,17,-1,-1],[24,15,-1,-1],[42,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[27,15,-1,-1],[59,-1,-1,-1]]],"es-MX":[",",".",1,3,"{n}%","-",[[30,-1,-1,-1],[1,-1,-1,7],[2,-1,-1,7],[3,-1,-1,7],[4,-1,-1,7],[5,-1,-1,-1],[1,-1,-1,7],[5,-1,-1,-1],[2,-1,-1,7],[6,-1,-1,-1],[3,-1,-1,7],[60,19,16,-1],[44,17,18,-1],[23,19,-1,-1],[45,17,-1,-1],[24,19,-1,-1],[46,17,-1,-1],[47,17,18,-1],[47,19,16,-1],[30,-1,-1,-1],[19,-1,-1,-1],[48,17,-1,-1],[12,19,-1,-1],[13,-1,16,-1],[13,-1,18,-1],[14,19,-1,-1],[14,17,-1,-1],[33,-1,-1,7],[34,19,-1,7],[47,17,18,-1],[46,17,-1,-1],[24,19,-1,-1],[35,-1,-1,-1],[2,-1,-1,7],[3,-1,-1,7],[34,19,-1,7],[36,-1,-1,7]]],"es-AR":[".",",",1,3,"{n}%","-",[[30,-1,-1,-1],[1,-1,-1,14],[2,-1,-1,14],[3,-1,-1,14],[4,-1,-1,14],[5,-1,-1,-1],[1,-1,-1,14],[5,-1,-1,-1],[2,-1,-1,14],[6,-1,-1,-1],[3,-1,-1,14],[31,15,16,-1],[44,17,18,-1],[23,15,-1,-1],[45,17,-1,-1],[46,15,-1,-1],[46,17,-1,-1],[47,17,18,-1],[25,15,16,-1],[30,-1,-1,-1],[19,-1,-1,-1],[48,17,-1,-1],[12,15,-1,-1],[13,-1,16,-1],[13,-1,18,-1],[14,15,-1,-1],[14,17,-1,-1],[33,-1,-1,14],[61,15,-1,14],[47,17,18,-1],[46,17,-1,-1],[24,15,-1,-1],[42,-1,-1,-1],[2,-1,-1,14],[3,-1,-1,14],[34,15,-1,14],[43,-1,-1,14]]],"fr-FR":[" ",",",1,3,"{n} %","-",[[19,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[1,-1,-1,0],[20,-1,-1,-1],[2,-1,-1,0],[21,-1,-1,-1],[3,-1,-1,0],[22,20,21,-1],[22,22,23,-1],[23,20,-1,-1],[23,22,-1,-1],[24,20,-1,-1],[24,22,-1,-1],[40,22,23,-1],[40,20,21,-1],[19,-1,-1,-1],[19,-1,-1,-1],[12,22,-1,-1],[12,20,-1,-1],[13,-1,21,-1],[13,-1,23,-1],[14,20,-1,-1],[14,22,-1,-1],[62,-1,-1,-1],[27,20,-1,-1],[40,22,23,-1],[24,22,-1,-1],[24,20,-1,-1],[19,-1,-1,-1],[5,-1,-1,-1],[6,-1,-1,-1],[28,20,-1,-1],[63,-1,-1,-1]]],"fr-CA":[" ",",",1,3,"{n} %","-",[[37,-1,-1,-1],[64,-1,-1,-1],[65,-1,-1,-1],[66,-1,-1,-1],[67,-1,-1,-1],[64,-1,-1,-1],[68,-1,-1,7],[65,-1,-1,-1],[69,-1,-1,7],[66,-1,-1,-1],[70,-1,-1,7],[22,24,21,-1],[22,22,23,-1],[23,24,-1,-1],[23,22,-1,-1],[24,24,-1,-1],[24,22,-1,-1],[40,22,23,-1],[40,24,21,-1],[37,-1,-1,-1],[37,-1,-1,-1],[12,22,-1,-1],[12,24,-1,-1],[13,-1,21,-1],[13,-1,23,-1],[14,24,-1,-1],[14,22,-1,-1],[71,-1,-1,-1],[72,24,-1,-1],[40,22,23,-1],[24,22,-1,-1],[24,24,-1,-1],[37,-1,-1,-1],[64,-1,-1,-1],[67,-1,-1,-1],[73,24,-1,-1],[74,-1,-1,-1]]],"de-DE":[".",",",1,3,"{n} %","-",[[75,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[1,-1,-1,0],[20,-1,-1,-1],[2,-1,-1,0],[21,-1,-1,-1],[3,-1,-1,0],[76,25,26,-1],[76,27,28,-1],[77,25,-1,-1],[77,27,-1,-1],[78,25,-1,-1],[78,27,-1,-1],[79,27,28,-1],[79,25,26,-1],[75,-1,-1,-1],[80,-1,-1,-1],[12,27,-1,-1],[12,25,-1,-1],[13,-1,29,-1],[13,-1,28,-1],[14,30,-1,-1],[14,27,-1,-1],[81,-1,-1,-1],[82,25,-1,-1],[79,27,28,-1],[78,27,-1,-1],[80,-1,-1,-1],[83,-1,-1,-1],[5,-1,-1,-1],[6,-1,-1,-1],[84,-1,-1,-1],[85,-1,-1,-1]]],"de-CH":["'",".",1,3,"{n}%","-",[[75,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[1,-1,-1,0],[20,-1,-1,-1],[2,-1,-1,0],[21,-1,-1,-1],[3,-1,-1,0],[76,25,26,-1],[76,27,28,-1],[77,25,-1,-1],[77,27,-1,-1],[78,25,-1,-1],[78,27,-1,-1],[79,27,28,-1],[79,25,26,-1],[75,-1,-1,-1],[80,-1,-1,-1],[12,27,-1,-1],[12,25,-1,-1],[13,-1,29,-1],[13,-1,28,-1],[14,30,-1,-1],[14,27,-1,-1],[81,-1,-1,-1],[82,25,-1,-1],[79,27,28,-1],[78,27,-1,-1],[80,-1,-1,-1],[83,-1,-1,-1],[5,-1,-1,-1],[6,-1,-1,-1],[84,-1,-1,-1],[85,-1,-1,-1]]],"de-AT":[" ",",",1,3,"{n} %","-",[[75,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[1,-1,-1,0],[20,-1,-1,-1],[2,-1,-1,0],[21,-1,-1,-1],[3,-1,-1,0],[76,31,26,-1],[76,32,28,-1],[77,31,-1,-1],[77,32,-1,-1],[78,31,-1,-1],[78,32,-1,-1],[79,32,28,-1],[79,31,26,-1],[75,-1,-1,-1],[80,-1,-1,-1],[12,32,-1,-1],[12,31,-1,-1],[13,-1,29,-1],[13,-1,28,-1],[14,33,-1,-1],[14,32,-1,-1],[81,-1,-1,-1],[82,31,-1,-1],[79,32,28,-1],[78,32,-1,-1],[80,-1,-1,-1],[83,-1,-1,-1],[5,-1,-1,-1],[6,-1,-1,-1],[84,-1,-1,-1],[85,-1,-1,-1]]],"it-IT":[".",",",2,3,"{n}%","-",[[19,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[1,-1,-1,0],[20,-1,-1,-1],[2,-1,-1,0],[21,-1,-1,-1],[3,-1,-1,0],[22,34,35,-1],[22,36,37,-1],[23,34,-1,-1],[23,36,-1,-1],[24,34,-1,-1],[24,36,-1,-1],[40,36,37,-1],[40,34,35,-1],[19,-1,-1,-1],[19,-1,-1,-1],[12,36,-1,-1],[12,34,-1,-1],[13,-1,35,-1],[13,-1,37,-1],[14,34,-1,-1],[14,36,-1,-1],[26,-1,-1,-1],[27,34,-1,-1],[40,36,37,-1],[24,36,-1,-1],[24,34,-1,-1],[35,-1,-1,-1],[5,-1,-1,-1],[6,-1,-1,-1],[28,34,-1,-1],[57,-1,-1,-1]]],"nl-NL":[".",",",1,3,"{n}%","-",[[86,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[1,-1,-1,7],[20,-1,-1,-1],[2,-1,-1,7],[21,-1,-1,-1],[3,-1,-1,7],[22,38,39,-1],[22,40,41,-1],[23,38,-1,-1],[23,40,-1,-1],[24,38,-1,-1],[24,40,-1,-1],[40,40,41,-1],[40,38,39,-1],[86,-1,-1,-1],[87,-1,-1,-1],[12,40,-1,-1],[12,38,-1,-1],[13,-1,39,-1],[13,-1,41,-1],[14,38,-1,-1],[14,40,-1,-1],[88,-1,-1,-1],[27,38,-1,-1],[40,40,41,-1],[24,40,-1,-1],[24,38,-1,-1],[87,-1,-1,-1],[5,-1,-1,-1],[6,-1,-1,-1],[28,38,-1,-1],[89,-1,-1,-1]]],"sv-SE":[" ",",",1,3,"{n} %","−",[[37,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[1,-1,-1,42],[20,-1,-1,-1],[2,-1,-1,42],[21,-1,-1,-1],[3,-1,-1,42],[22,43,44,-1],[22,45,46,-1],[23,43,-1,-1],[23,45,-1,-1],[24,43,-1,-1],[24,45,-1,-1],[40,45,46,-1],[40,43,44,-1],[37,-1,-1,-1],[37,-1,-1,-1],[12,45,-1,-1],[12,43,-1,-1],[13,-1,44,-1],[13,-1,46,-1],[14,43,-1,-1],[14,45,-1,-1],[90,-1,-1,-1],[91,43,-1,-1],[40,45,46,-1],[24,45,-1,-1],[24,43,-1,-1],[37,-1,-1,-1],[5,-1,-1,-1],[6,-1,-1,-1],[92,43,-1,-1],[93,-1,-1,-1]]],"nb-NO":[" ",",",1,3,"{n} %","−",[[75,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[1,-1,-1,7],[20,-1,-1,-1],[2,-1,-1,7],[21,-1,-1,-1],[3,-1,-1,7],[94,47,48,-1],[94,49,50,-1],[77,47,-1,-1],[77,49,-1,-1],[78,47,-1,-1],[78,49,-1,-1],[95,49,50,-1],[95,47,48,-1],[75,-1,-1,-1],[80,-1,-1,-1],[12,49,-1,-1],[12,47,-1,-1],[13,-1,48,-1],[13,-1,50,-1],[14,51,-1,-1],[14,49,-1,-1],[81,-1,-1,-1],[82,47,-1,-1],[95,49,50,-1],[78,49,-1,-1],[78,47,-1,-1],[80,-1,-1,-1],[5,-1,-1,-1],[6,-1,-1,-1],[96,47,-1,-1],[84,-1,-1,-1]]],"da-DK":[".",",",1,3,"{n} %","-",[[75,-1,-1,-1],[97,-1,-1,-1],[98,-1,-1,-1],[99,-1,-1,-1],[100,-1,-1,-1],[97,-1,-1,-1],[101,-1,-1,0],[98,-1,-1,-1],[102,-1,-1,0],[99,-1,-1,-1],[103,-1,-1,0],[94,52,53,-1],[94,54,50,-1],[77,52,-1,-1],[77,54,-1,-1],[78,52,-1,-1],[78,54,-1,-1],[104,54,50,-1],[95,52,53,-1],[75,-1,-1,-1],[80,-1,-1,-1],[12,54,-1,-1],[12,52,-1,-1],[13,-1,53,-1],[13,-1,50,-1],[14,52,-1,-1],[14,54,-1,-1],[105,-1,-1,-1],[106,52,-1,-1],[104,54,50,-1],[78,54,-1,-1],[78,52,-1,-1],[80,-1,-1,-1],[97,-1,-1,-1],[100,-1,-1,-1],[107,52,-1,-1],[108,-1,-1,-1]]],"fi-FI":[" ",",",1,3,"{n} %","−",[[75,-1,-1,-1],[97,-1,-1,-1],[98,-1,-1,-1],[99,-1,-1,-1],[100,-1,-1,-1],[97,-1,-1,-1],[101,-1,-1,55],[98,-1,-1,-1],[102,-1,-1,55],[99,-1,-1,-1],[103,-1,-1,55],[109,-1,56,-1],[94,57,58,-1],[110,-1,-1,-1],[77,57,-1,-1],[75,-1,-1,-1],[78,57,-1,-1],[95,57,59,-1],[111,-1,56,-1],[75,-1,-1,-1],[80,-1,-1,-1],[12,60,-1,-1],[12,61,-1,-1],[13,-1,56,-1],[13,-1,58,-1],[14,61,-1,-1],[14,60,-1,-1],[112,-1,-1,-1],[113,-1,-1,-1],[95,57,58,-1],[78,57,-1,-1],[75,-1,-1,-1],[75,-1,-1,-1],[98,-1,-1,-1],[99,-1,-1,-1],[113,-1,-1,-1],[113,-1,-1,-1]]],"pl-PL":[" ",",",2,3,"{n}%","-",[[114,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[1,-1,-1,0],[20,-1,-1,-1],[2,-1,-1,0],[21,-1,-1,-1],[3,-1,-1,0],[31,62,63,-1],[31,64,65,-1],[23,62,-1,-1],[23,64,-1,-1],[24,62,-1,-1],[24,64,-1,-1],[25,64,65,-1],[25,62,63,-1],[114,-1,-1,-1],[80,-1,-1,-1],[12,66,-1,-1],[12,62,-1,-1],[13,-1,63,-1],[13,-1,65,-1],[14,62,-1,-1],[14,66,-1,-1],[115,-1,-1,-1],[27,62,-1,-1],[25,64,65,-1],[24,64,-1,-1],[24,62,-1,-1],[114,-1,-1,-1],[5,-1,-1,-1],[6,-1,-1,-1],[28,62,-1,-1],[116,-1,-1,-1]]],"cs-CZ":[" ",",",1,3,"{n} %","-",[[117,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[1,-1,-1,67],[20,-1,-1,-1],[2,-1,-1,67],[21,-1,-1,-1],[3,-1,-1,67],[118,-1,68,-1],[94,69,70,-1],[119,-1,-1,-1],[77,69,-1,-1],[117,-1,-1,-1],[78,69,-1,-1],[95,69,70,-1],[120,-1,68,-1],[117,-1,-1,-1],[121,-1,-1,-1],[12,71,-1,-1],[12,71,-1,-1],[13,-1,68,-1],[13,-1,70,-1],[14,72,-1,-1],[14,71,-1,-1],[122,-1,-1,-1],[123,-1,-1,-1],[95,69,70,-1],[78,69,-1,-1],[117,-1,-1,-1],[83,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[123,-1,-1,-1],[124,-1,-1,-1]]],"ru-RU":[" ",",",1,3,"{n} %","-",[[80,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[1,-1,-1,0],[20,-1,-1,-1],[2,-1,-1,0],[21,-1,-1,-1],[3,-1,-1,0],[31,73,74,-1],[31,75,76,-1],[23,73,-1,-1],[23,75,-1,-1],[125,73,-1,-1],[125,75,-1,-1],[126,75,76,-1],[126,73,74,-1],[80,-1,-1,-1],[80,-1,-1,-1],[127,77,-1,-1],[127,78,-1,-1],[13,-1,74,-1],[13,-1,76,-1],[14,78,-1,-1],[14,77,-1,-1],[128,-1,-1,-1],[129,73,-1,-1],[126,75,76,-1],[125,75,-1,-1],[125,73,-1,-1],[80,-1,-1,-1],[5,-1,-1,-1],[6,-1,-1,-1],[130,73,-1,-1],[84,-1,-1,-1]]],"uk-UA":[" ",",",1,3,"{n}%","-",[[80,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[1,-1,-1,79],[20,-1,-1,-1],[2,-1,-1,79],[21,-1,-1,-1],[3,-1,-1,79],[31,80,81,-1],[31,82,83,-1],[23,80,-1,-1],[23,82,-1,-1],[131,80,-1,-1],[131,82,-1,-1],[132,82,83,-1],[132,80,81,-1],[80,-1,-1,-1],[80,-1,-1,-1],[133,84,-1,-1],[133,80,-1,-1],[13,-1,81,-1],[13,-1,83,-1],[14,80,-1,-1],[14,84,-1,-1],[128,-1,-1,-1],[134,80,-1,-1],[132,82,83,-1],[131,82,-1,-1],[131,80,-1,-1],[83,-1,-1,-1],[5,-1,-1,-1],[6,-1,-1,-1],[135,80,-1,-1],[85,-1,-1,-1]]],"tr-TR":[".",",",1,3,"%{n}","-",[[80,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[136,-1,-1,85],[20,-1,-1,-1],[137,-1,-1,85],[21,-1,-1,-1],[138,-1,-1,85],[139,86,87,-1],[139,88,89,-1],[23,86,-1,-1],[23,88,-1,-1],[24,86,-1,-1],[24,88,-1,-1],[140,88,89,-1],[140,86,87,-1],[80,-1,-1,-1],[80,-1,-1,-1],[12,88,-1,-1],[12,86,-1,-1],[13,-1,87,-1],[13,-1,89,-1],[14,86,-1,-1],[14,88,-1,-1],[141,-1,-1,-1],[91,86,-1,-1],[140,88,89,-1],[24,88,-1,-1],[24,86,-1,-1],[114,-1,-1,-1],[5,-1,-1,-1],[6,-1,-1,-1],[92,86,-1,-1],[142,-1,-1,-1]]],"ja-JP":[",",".",1,3,"{n}%","-",[[143,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[144,-1,-1,90],[20,-1,-1,-1],[145,-1,-1,90],[21,-1,-1,-1],[146,-1,-1,90],[147,-1,91,-1],[148,-1,92,-1],[149,-1,-1,-1],[149,-1,-1,-1],[150,-1,-1,-1],[150,-1,-1,-1],[151,-1,92,-1],[152,-1,91,-1],[143,-1,-1,-1],[153,-1,-1,-1],[154,-1,-1,-1],[154,-1,-1,-1],[13,-1,91,-1],[13,-1,92,-1],[155,-1,-1,-1],[155,-1,-1,-1],[156,-1,-1,-1],[157,-1,-1,-1],[151,-1,92,-1],[150,-1,-1,-1],[153,-1,-1,-1],[153,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[158,-1,-1,-1],[158,-1,-1,-1]]],"zh-CN":[",",".",1,3,"{n}%","-",[[143,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[159,-1,-1,93],[20,-1,-1,-1],[160,-1,-1,93],[21,-1,-1,-1],[161,-1,-1,93],[148,-1,94,-1],[148,-1,95,-1],[149,-1,-1,-1],[149,-1,-1,-1],[150,-1,-1,-1],[150,-1,-1,-1],[151,-1,95,-1],[151,-1,94,-1],[143,-1,-1,-1],[153,-1,-1,-1],[154,-1,-1,-1],[154,-1,-1,-1],[13,-1,94,-1],[13,-1,95,-1],[14,96,-1,-1],[14,97,-1,-1],[156,-1,-1,-1],[157,-1,-1,-1],[151,-1,95,-1],[150,-1,-1,-1],[150,-1,-1,-1],[143,-1,-1,-1],[5,-1,-1,-1],[6,-1,-1,-1],[162,-1,-1,-1],[163,-1,-1,-1]]],"zh-TW":[",",".",1,3,"{n}%","-",[[143,-1,-1,-1],[159,-1,-1,93],[160,-1,-1,93],[161,-1,-1,93],[164,-1,-1,93],[5,-1,-1,-1],[159,-1,-1,93],[5,-1,-1,-1],[160,-1,-1,93],[6,-1,-1,-1],[161,-1,-1,93],[148,-1,98,-1],[148,-1,95,-1],[149,-1,-1,-1],[149,-1,-1,-1],[150,-1,-1,-1],[150,-1,-1,-1],[151,-1,95,-1],[151,-1,98,-1],[143,-1,-1,-1],[153,-1,-1,-1],[154,-1,-1,-1],[154,-1,-1,-1],[13,-1,98,-1],[13,-1,95,-1],[14,96,-1,-1],[14,96,-1,-1],[165,-1,-1,93],[166,-1,-1,93],[167,-1,95,-1],[150,-1,-1,-1],[150,-1,-1,-1],[143,-1,-1,-1],[160,-1,-1,99],[161,-1,-1,99],[166,-1,-1,99],[168,-1,-1,99]]],"ko-KR":[",",".",1,3,"{n}%","-",[[169,-1,-1,-1],[136,-1,-1,100],[137,-1,-1,100],[138,-1,-1,100],[170,-1,-1,100],[5,-1,-1,-1],[136,-1,-1,100],[5,-1,-1,-1],[137,-1,-1,100],[21,-1,-1,-1],[138,-1,-1,100],[171,101,102,-1],[172,101,103,-1],[173,101,-1,-1],[173,101,-1,-1],[174,101,-1,-1],[174,101,-1,-1],[175,101,103,-1],[176,101,102,-1],[169,-1,-1,-1],[177,-1,-1,-1],[178,101,-1,-1],[178,101,-1,-1],[13,-1,102,-1],[13,-1,103,-1],[14,101,-1,-1],[14,101,-1,-1],[179,-1,-1,100],[180,101,-1,100],[175,101,103,-1],[174,101,-1,-1],[169,-1,-1,-1],[181,-1,-1,-1],[137,-1,-1,100],[138,-1,-1,100],[182,-1,-1,100],[183,-1,-1,100]]],"id-ID":[".",",",1,3,"{n}%","-",[[30,-1,-1,-1],[97,-1,-1,-1],[98,-1,-1,-1],[99,-1,-1,-1],[100,-1,-1,-1],[97,-1,-1,-1],[101,-1,-1,0],[98,-1,-1,-1],[102,-1,-1,0],[99,-1,-1,-1],[103,-1,-1,0],[31,104,105,-1],[31,106,107,-1],[23,104,-1,-1],[23,106,-1,-1],[24,104,-1,-1],[24,106,-1,-1],[25,106,107,-1],[25,104,105,-1],[30,-1,-1,-1],[19,-1,-1,-1],[12,106,-1,-1],[12,104,-1,-1],[13,-1,105,-1],[13,-1,107,-1],[14,104,-1,-1],[14,106,-1,-1],[184,-1,-1,-1],[185,104,-1,-1],[186,106,107,-1],[24,106,-1,-1],[24,104,-1,-1],[35,-1,-1,-1],[97,-1,-1,-1],[100,-1,-1,-1],[187,104,-1,-1],[188,-1,-1,-1]]],"vi-VN":[".",",",1,3,"{n}%","-",[[30,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[1,-1,-1,108],[20,-1,-1,-1],[2,-1,-1,108],[21,-1,-1,-1],[3,-1,-1,108],[31,109,110,-1],[31,111,112,-1],[23,109,-1,-1],[23,111,-1,-1],[189,109,-1,-1],[189,111,-1,-1],[32,111,112,-1],[32,109,110,-1],[30,-1,-1,-1],[19,-1,-1,-1],[190,111,-1,-1],[12,109,-1,-1],[13,-1,110,-1],[13,-1,112,-1],[14,113,-1,-1],[14,113,-1,-1],[191,-1,-1,-1],[192,109,-1,-1],[32,111,112,-1],[189,111,-1,-1],[189,109,-1,-1],[42,-1,-1,-1],[5,-1,-1,-1],[6,-1,-1,-1],[193,109,-1,-1],[194,-1,-1,-1]]],"he-IL":[",",".",1,3,"{n}%","‎-",[[75,-1,-1,-1],[5,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[6,-1,-1,-1],[5,-1,-1,-1],[1,-1,-1,0],[20,-1,-1,-1],[2,-1,-1,0],[21,-1,-1,-1],[3,-1,-1,0],[195,114,115,-1],[195,116,117,-1],[196,114,-1,-1],[196,116,-1,-1],[197,114,-1,-1],[197,116,-1,-1],[198,116,117,-1],[198,114,115,-1],[75,-1,-1,-1],[80,-1,-1,-1],[12,116,-1,-1],[12,114,-1,-1],[13,-1,115,-1],[13,-1,117,-1],[14,114,-1,-1],[14,116,-1,-1],[81,-1,-1,-1],[199,114,-1,-1],[198,116,117,-1],[197,116,-1,-1],[197,114,-1,-1],[75,-1,-1,-1],[20,-1,-1,-1],[21,-1,-1,-1],[199,114,-1,-1],[200,-1,-1,-1]]]};
@@ -0,0 +1,53 @@
1
+ import { expect, mock, test } from "bun:test";
2
+ import { DATE_OPTIONS, LOCALES, data } from "../../../scripts/generate-txiki-intl";
3
+ import * as committed from "./intl-data";
4
+
5
+ // intl.ts runs inside txiki.js: stand in for its globals.
6
+ mock.module("tjs:ffi", () => ({ dlopen: () => { throw new Error("no ffi in tests"); } }));
7
+ Object.assign(globalThis, { TARVE_TXIKI_PLATFORM: "linux", tjs: { env: { LANG: "pt_BR.UTF-8" } } });
8
+ const { txikiIntl } = await import("./intl");
9
+
10
+ // The shim formats with the committed data; comparing it with this host's Intl only
11
+ // means something where the host's ICU produces that data (not, for one, a Windows
12
+ // machine whose regional settings change ICU's output). The Linux gate always does.
13
+ const hostMatches = JSON.stringify(data.locales) === JSON.stringify(committed.LOCALES)
14
+ && JSON.stringify(data.templatePool) === JSON.stringify(committed.TEMPLATES)
15
+ && JSON.stringify(data.pool) === JSON.stringify(committed.NAMES);
16
+ if (!hostMatches) console.log("txiki Intl: this host's ICU differs from intl-data.ts; ICU comparisons skipped");
17
+
18
+ const dates = [Date.UTC(2026, 9, 15, 8, 5, 9), Date.UTC(2024, 0, 1, 0, 0, 0), Date.UTC(2025, 11, 31, 23, 59, 59), Date.UTC(2026, 5, 7, 12, 30, 0), Date.UTC(2026, 1, 28, 13, 7, 3)];
19
+ const numbers = [0, 7, 1234, 1234.5, -9876.54321, 12345678.9, 0.256, 1e9, -0.004, 999.9999];
20
+
21
+ test.skipIf(!hostMatches)("txiki.js Intl numbers match ICU for every bundled locale", () => {
22
+ const mismatches: string[] = [];
23
+ for (const locale of LOCALES) {
24
+ for (const value of numbers) {
25
+ for (const options of [{}, { style: "percent" }, { maximumFractionDigits: 1 }, { minimumFractionDigits: 2 }, { useGrouping: false }] as Intl.NumberFormatOptions[]) {
26
+ const expected = new Intl.NumberFormat(locale, options).format(value);
27
+ const actual = new txikiIntl.NumberFormat(locale, options as never).format(value);
28
+ if (actual !== expected) mismatches.push(`${locale} ${value} ${JSON.stringify(options)}: ${JSON.stringify(actual)} != ${JSON.stringify(expected)}`);
29
+ }
30
+ }
31
+ }
32
+ expect(mismatches.slice(0, 10)).toEqual([]);
33
+ });
34
+
35
+ test.skipIf(!hostMatches)("txiki.js Intl dates match ICU for every bundled locale and option set", () => {
36
+ const mismatches: string[] = [];
37
+ for (const locale of LOCALES) {
38
+ for (const options of DATE_OPTIONS) {
39
+ for (const date of dates) {
40
+ const expected = new Intl.DateTimeFormat(locale, { ...options, timeZone: "UTC" }).format(date);
41
+ const actual = new txikiIntl.DateTimeFormat(locale, { ...options, timeZone: "UTC" } as never).format(date);
42
+ if (actual !== expected) mismatches.push(`${locale} ${JSON.stringify(options)}: ${JSON.stringify(actual)} != ${JSON.stringify(expected)}`);
43
+ }
44
+ }
45
+ }
46
+ expect(mismatches.slice(0, 10)).toEqual([]);
47
+ });
48
+
49
+ test("the default locale comes from the system and unknown locales fall back by language", () => {
50
+ expect(new txikiIntl.NumberFormat().format(50000)).toBe("50.000");
51
+ expect(new txikiIntl.NumberFormat("pt-AO").resolvedOptions().locale).toBe("pt-BR");
52
+ expect(new txikiIntl.NumberFormat("xx").format(1234.5)).toBe("1,234.5");
53
+ });
@@ -0,0 +1,249 @@
1
+ /**
2
+ * Intl for txiki.js: QuickJS-ng has none. Numbers and the common date and time
3
+ * formats follow ICU (as Bun and Node format them) for the locales in intl-data.ts,
4
+ * generated from ICU by scripts/generate-txiki-intl.ts. Other locales use the
5
+ * closest one (same language, else en-US); unusual date option sets fall back to
6
+ * an en-US style composition.
7
+ */
8
+ import { dlopen } from "tjs:ffi";
9
+ import { DATE_KEYS, LOCALES, NAMES, TEMPLATES, type LocaleData } from "./intl-data";
10
+
11
+ declare const TARVE_TXIKI_PLATFORM: "win32" | "linux";
12
+
13
+ let systemLocale: string | undefined;
14
+ function defaultLocale(): string {
15
+ if (systemLocale) return systemLocale;
16
+ let found: string | undefined;
17
+ try {
18
+ if (TARVE_TXIKI_PLATFORM === "win32") {
19
+ const buffer = new Uint8Array(85 * 2);
20
+ const length = dlopen("kernel32.dll", { GetUserDefaultLocaleName: { args: ["buffer", "i32"], returns: "i32" } }).symbols.GetUserDefaultLocaleName(buffer, 85);
21
+ if (length > 1) found = String.fromCharCode(...new Uint16Array(buffer.buffer, 0, length - 1));
22
+ } else {
23
+ found = (tjs.env.LC_ALL || tjs.env.LC_NUMERIC || tjs.env.LANG || "").split(".")[0];
24
+ }
25
+ } catch { /* en-US */ }
26
+ return systemLocale = resolveLocale(found || "en-US");
27
+ }
28
+
29
+ const LOCALE_NAMES = Object.keys(LOCALES);
30
+ function resolveLocale(requested: string | readonly string[] | undefined): string {
31
+ const list = requested === undefined ? [] : typeof requested === "string" ? [requested] : requested;
32
+ for (const item of list) {
33
+ const tag = String(item).replace(/_/g, "-").toLowerCase();
34
+ const exact = LOCALE_NAMES.find(name => name.toLowerCase() === tag);
35
+ if (exact) return exact;
36
+ const language = LOCALE_NAMES.find(name => name.split("-")[0]!.toLowerCase() === tag.split("-")[0]);
37
+ if (language) return language;
38
+ }
39
+ return list.length ? "en-US" : defaultLocale();
40
+ }
41
+
42
+ interface NumberOptions {
43
+ style?: "decimal" | "percent" | "unit" | "currency";
44
+ minimumFractionDigits?: number;
45
+ maximumFractionDigits?: number;
46
+ useGrouping?: boolean;
47
+ unit?: string;
48
+ currency?: string;
49
+ }
50
+
51
+ function groupDigits(whole: string, data: LocaleData): string {
52
+ const [group, , minGroup, secondary] = data;
53
+ if (!group || whole.length < 3 + minGroup) return whole;
54
+ let out = whole.slice(-3);
55
+ let rest = whole.slice(0, -3);
56
+ while (rest.length > secondary) {
57
+ out = rest.slice(-secondary) + group + out;
58
+ rest = rest.slice(0, -secondary);
59
+ }
60
+ return rest ? rest + group + out : out;
61
+ }
62
+
63
+ class NumberFormat {
64
+ private readonly locale: string;
65
+ private readonly data: LocaleData;
66
+
67
+ constructor(locales?: string | string[], private readonly options: NumberOptions = {}) {
68
+ this.locale = resolveLocale(locales);
69
+ this.data = LOCALES[this.locale]!;
70
+ }
71
+
72
+ format(input: number | bigint): string {
73
+ let value = Number(input);
74
+ const o = this.options;
75
+ const [, decimal, , , percent, minus] = this.data;
76
+ if (Number.isNaN(value)) return "NaN";
77
+ if (o.style === "percent") value *= 100;
78
+ const maximum = o.maximumFractionDigits ?? Math.max(o.minimumFractionDigits ?? 0, o.style === "percent" ? 0 : o.style === "currency" ? 2 : 3);
79
+ const minimum = Math.min(o.minimumFractionDigits ?? (o.style === "currency" ? 2 : 0), maximum);
80
+ let digits: string;
81
+ if (!Number.isFinite(value)) digits = "∞";
82
+ else {
83
+ let [whole, fraction = ""] = Math.abs(value).toFixed(maximum).split(".") as [string, string?];
84
+ while (fraction.length > minimum && fraction.endsWith("0")) fraction = fraction.slice(0, -1);
85
+ if (o.useGrouping !== false) whole = groupDigits(whole, this.data);
86
+ digits = fraction ? whole + decimal + fraction : whole;
87
+ }
88
+ // ICU keeps the sign of a negative value that rounds to zero ("-0").
89
+ const negative = value < 0 || Object.is(value, -0);
90
+ const sign = negative ? minus : "";
91
+ if (o.style === "percent") return sign + percent.replace("{n}", digits);
92
+ if (o.style === "currency") return `${sign}${o.currency === "USD" || !o.currency ? "$" : `${o.currency} `}${digits}`;
93
+ if (o.style === "unit" && o.unit) return `${sign}${digits} ${o.unit}`;
94
+ return sign + digits;
95
+ }
96
+
97
+ formatToParts(input: number | bigint) {
98
+ return [{ type: "literal", value: this.format(input) }];
99
+ }
100
+
101
+ resolvedOptions() {
102
+ return { locale: this.locale, numberingSystem: "latn", ...this.options };
103
+ }
104
+
105
+ static supportedLocalesOf(locales: string | string[]): string[] {
106
+ return (typeof locales === "string" ? [locales] : locales).filter(locale => LOCALE_NAMES.includes(resolveLocale(locale)));
107
+ }
108
+ }
109
+
110
+ type Width = "numeric" | "2-digit" | "short" | "long" | "narrow";
111
+ interface DateTimeOptions {
112
+ weekday?: Width; era?: Width; year?: Width; month?: Width; day?: Width;
113
+ hour?: Width; minute?: Width; second?: Width; hour12?: boolean; timeZone?: string;
114
+ dateStyle?: "full" | "long" | "medium" | "short"; timeStyle?: "full" | "long" | "medium" | "short";
115
+ }
116
+ const DATE_FIELDS = ["weekday", "year", "month", "day", "hour", "minute", "second", "hour12", "dateStyle", "timeStyle"] as const;
117
+
118
+ function dateKey(options: DateTimeOptions): string {
119
+ const picked: Record<string, unknown> = {};
120
+ for (const field of DATE_FIELDS) {
121
+ let value = options[field];
122
+ // ICU always pads minutes and seconds.
123
+ if ((field === "minute" || field === "second") && value === "numeric") value = "2-digit";
124
+ if (value !== undefined) picked[field] = value;
125
+ }
126
+ return Object.keys(picked).sort().map(key => key + "=" + String(picked[key])).join(",");
127
+ }
128
+
129
+ const pad2 = (value: number) => String(value).padStart(2, "0");
130
+ const WEEKDAYS = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
131
+ const MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
132
+
133
+ class DateTimeFormat {
134
+ private readonly locale: string;
135
+ private readonly options: DateTimeOptions;
136
+ private readonly entry: number[] | undefined;
137
+
138
+ constructor(locales?: string | string[], options: DateTimeOptions = {}) {
139
+ this.locale = resolveLocale(locales);
140
+ this.options = { ...options };
141
+ const index = DATE_KEYS.indexOf(dateKey(options));
142
+ this.entry = index >= 0 ? LOCALES[this.locale]![6][index] : undefined;
143
+ }
144
+
145
+ format(value: Date | number = Date.now()): string {
146
+ const date = value instanceof Date ? value : new Date(value);
147
+ if (Number.isNaN(date.getTime())) return "Invalid Date";
148
+ const utc = this.options.timeZone === "UTC";
149
+ const fields = {
150
+ year: utc ? date.getUTCFullYear() : date.getFullYear(), month: utc ? date.getUTCMonth() : date.getMonth(),
151
+ day: utc ? date.getUTCDate() : date.getDate(), weekday: utc ? date.getUTCDay() : date.getDay(),
152
+ hour: utc ? date.getUTCHours() : date.getHours(), minute: utc ? date.getUTCMinutes() : date.getMinutes(), second: utc ? date.getUTCSeconds() : date.getSeconds(),
153
+ };
154
+ if (!this.entry) return this.fallback(fields);
155
+ const [template, months, weekdays, periods] = this.entry as [number, number, number, number];
156
+ const source = TEMPLATES[template]!;
157
+ const cycle = Number(/\{c(\d+)\}/.exec(source)?.[1] ?? 23);
158
+ return source.replace(/\{([wMdyhmsaGc])(\d+)\}/g, (_, token: string, flag: string) => {
159
+ const padded = flag === "1";
160
+ switch (token) {
161
+ case "w": return NAMES[weekdays]![fields.weekday]!;
162
+ case "M": return months >= 0 ? NAMES[months]![fields.month]! : padded ? pad2(fields.month + 1) : String(fields.month + 1);
163
+ case "d": return padded ? pad2(fields.day) : String(fields.day);
164
+ case "y": return padded ? pad2(fields.year % 100) : String(fields.year);
165
+ case "h": {
166
+ const hour = cycle === 23 ? fields.hour : cycle === 24 ? fields.hour || 24 : cycle === 11 ? fields.hour % 12 : fields.hour % 12 || 12;
167
+ return padded ? pad2(hour) : String(hour);
168
+ }
169
+ case "m": return pad2(fields.minute);
170
+ case "s": return pad2(fields.second);
171
+ case "a": return NAMES[periods]![fields.hour]!;
172
+ default: return "";
173
+ }
174
+ });
175
+ }
176
+
177
+ /** en-US composition for option sets intl-data.ts does not carry. */
178
+ private fallback(f: { year: number; month: number; day: number; weekday: number; hour: number; minute: number; second: number }): string {
179
+ const o = this.options;
180
+ const name = (names: string[], index: number, width?: Width) => width === "long" ? names[index]! : width === "narrow" ? names[index]![0]! : names[index]!.slice(0, 3);
181
+ const any = o.weekday || o.year || o.month || o.day || o.hour || o.minute || o.second;
182
+ const d = any ? o : { year: "numeric", month: "numeric", day: "numeric" } as DateTimeOptions;
183
+ const numeric = d.month === "numeric" || d.month === "2-digit";
184
+ const day = numeric
185
+ ? [d.month && String(f.month + 1), d.day && String(f.day), d.year && String(f.year)].filter(Boolean).join("/")
186
+ : [[d.month && name(MONTHS, f.month, d.month), d.day && String(f.day)].filter(Boolean).join(" "), d.year && String(f.year)].filter(Boolean).join(", ");
187
+ let time = "";
188
+ if (d.hour || d.minute || d.second) {
189
+ const twelve = d.hour12 ?? true;
190
+ time = [d.hour && String(twelve ? f.hour % 12 || 12 : f.hour), d.minute && pad2(f.minute), d.second && pad2(f.second)].filter(Boolean).join(":");
191
+ if (twelve && d.hour) time += f.hour < 12 ? " AM" : " PM";
192
+ }
193
+ return [[d.weekday ? name(WEEKDAYS, f.weekday, d.weekday) : "", day].filter(Boolean).join(", "), time].filter(Boolean).join(", ");
194
+ }
195
+
196
+ formatToParts(value?: Date | number) {
197
+ return [{ type: "literal", value: this.format(value) }];
198
+ }
199
+
200
+ resolvedOptions() {
201
+ return { locale: this.locale, calendar: "gregory", numberingSystem: "latn", timeZone: this.options.timeZone ?? "UTC", ...this.options };
202
+ }
203
+
204
+ static supportedLocalesOf(locales: string | string[]): string[] {
205
+ return NumberFormat.supportedLocalesOf(locales);
206
+ }
207
+ }
208
+
209
+ class Collator {
210
+ constructor(_locales?: string | string[], private readonly options: { numeric?: boolean; sensitivity?: string } = {}) {}
211
+
212
+ compare = (left: string, right: string): number => {
213
+ const fold = (value: string) => this.options.sensitivity === "base" || this.options.sensitivity === "accent" ? value.toLowerCase() : value;
214
+ if (this.options.numeric) {
215
+ const a = fold(left).split(/(\d+)/);
216
+ const b = fold(right).split(/(\d+)/);
217
+ for (let index = 0; index < Math.min(a.length, b.length); index++) {
218
+ const order = index % 2 ? Number(a[index]) - Number(b[index]) : a[index]!.localeCompare(b[index]!);
219
+ if (order) return Math.sign(order);
220
+ }
221
+ return a.length - b.length;
222
+ }
223
+ return fold(left).localeCompare(fold(right));
224
+ };
225
+ }
226
+
227
+ export function installIntl(): void {
228
+ if (typeof globalThis.Intl !== "undefined") return;
229
+ (globalThis as Record<string, unknown>).Intl = {
230
+ DateTimeFormat, NumberFormat, Collator,
231
+ getCanonicalLocales: (locales?: string | string[]) => (locales === undefined ? [] : typeof locales === "string" ? [locales] : locales).map(resolveLocale),
232
+ };
233
+ // QuickJS's own toLocale* ignore the locale (no grouping, English dates).
234
+ Number.prototype.toLocaleString = function (this: number, locales?: string | string[], options?: NumberOptions) {
235
+ return new NumberFormat(locales, options).format(Number(this));
236
+ };
237
+ Date.prototype.toLocaleString = function (this: Date, locales?: string | string[], options?: DateTimeOptions) {
238
+ return new DateTimeFormat(locales, options && dateKey(options) ? options : { year: "numeric", month: "numeric", day: "numeric", hour: "numeric", minute: "2-digit", second: "2-digit", ...options }).format(this);
239
+ };
240
+ Date.prototype.toLocaleDateString = function (this: Date, locales?: string | string[], options?: DateTimeOptions) {
241
+ return new DateTimeFormat(locales, options && dateKey(options) ? options : { year: "numeric", month: "numeric", day: "numeric", ...options }).format(this);
242
+ };
243
+ Date.prototype.toLocaleTimeString = function (this: Date, locales?: string | string[], options?: DateTimeOptions) {
244
+ return new DateTimeFormat(locales, options && dateKey(options) ? options : { hour: "numeric", minute: "2-digit", second: "2-digit", ...options }).format(this);
245
+ };
246
+ }
247
+
248
+ /** For tests: the shim's classes, without installing them. */
249
+ export const txikiIntl = { DateTimeFormat, NumberFormat, Collator };
@@ -0,0 +1,132 @@
1
+ /**
2
+ * First module of a Tarve txiki.js executable. It gives the core the Node globals it
3
+ * expects, then extracts the native library and assets embedded in the executable into
4
+ * the shared asset cache, before any app module runs (the bundle keeps this order, and
5
+ * the top-level await holds the modules after it).
6
+ */
7
+ import * as ffi from "tjs:ffi";
8
+ import { createHash } from "tjs:hashing";
9
+ import path from "tjs:path";
10
+ import { createFetch } from "./fetch";
11
+ import { installIntl } from "./intl";
12
+ import { Buffer } from "./shims/buffer";
13
+
14
+ declare const TARVE_TXIKI_PLATFORM: "win32" | "linux";
15
+ declare const TARVE_TXIKI_NATIVE_NAME: string;
16
+
17
+ /** One file of the blob txiki-build.ts places before the txiki.js payload. */
18
+ interface EmbeddedFile {
19
+ name: string;
20
+ offset: number;
21
+ length: number;
22
+ size: number;
23
+ sha256: string;
24
+ gzip: boolean;
25
+ }
26
+
27
+ const TXIKI_MAGIC = "tx1k1.js";
28
+ const BLOB_MAGIC = "TARVEBLB";
29
+ const decoder = new TextDecoder();
30
+ const globals = globalThis as Record<string, unknown>;
31
+
32
+ installIntl();
33
+ globals.fetch = createFetch(globalThis.fetch.bind(globalThis));
34
+ globals.Buffer = Buffer;
35
+ globals.__tarveTxikiFfi = ffi;
36
+ globals.__tarveDirname = path.dirname(tjs.exePath);
37
+ globals.setImmediate ??= (callback: (...args: unknown[]) => void, ...args: unknown[]) => setTimeout(callback, 0, ...args);
38
+ const process = {
39
+ platform: TARVE_TXIKI_PLATFORM,
40
+ arch: "x64",
41
+ env: tjs.env,
42
+ // A compiled app: [exe, ...args]. `tjs run app.js ...args` (debugging a bundle): [tjs, "run", app.js, ...args].
43
+ argv: tjs.args[1] === "run" ? [tjs.exePath, ...tjs.args.slice(2)] : [tjs.exePath, tjs.exePath, ...tjs.args.slice(1)],
44
+ execArgv: [],
45
+ execPath: tjs.exePath,
46
+ versions: { tjs: tjs.version, quickjs: String(tjs.engine.versions.quickjs) },
47
+ exitCode: undefined as number | undefined,
48
+ exit(code?: number): never {
49
+ return tjs.exit(code ?? this.exitCode ?? 0);
50
+ },
51
+ cwd: () => tjs.cwd,
52
+ chdir: (directory: string) => tjs.chdir(directory),
53
+ memoryUsage: () => ({ rss: 0, heapTotal: 0, heapUsed: 0, external: 0, arrayBuffers: 0 }),
54
+ nextTick: (callback: (...args: unknown[]) => void, ...args: unknown[]) => queueMicrotask(() => callback(...args)),
55
+ on() { return this; },
56
+ once() { return this; },
57
+ off() { return this; },
58
+ };
59
+ globals.process = process;
60
+
61
+ async function readAt(file: TjsFileHandle, position: number, length: number): Promise<Uint8Array> {
62
+ const bytes = new Uint8Array(length);
63
+ let read = 0;
64
+ while (read < length) {
65
+ const count = await file.read(bytes.subarray(read), position + read);
66
+ if (!count) throw new Error("The executable is truncated: rebuild it.");
67
+ read += count;
68
+ }
69
+ return bytes;
70
+ }
71
+
72
+ function uint32(bytes: Uint8Array, offset: number): number {
73
+ return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getUint32(offset, true);
74
+ }
75
+
76
+ async function embeddedFiles(): Promise<{ files: EmbeddedFile[]; read(file: EmbeddedFile): Promise<Uint8Array>; close(): Promise<void> }> {
77
+ const exe = await tjs.open(tjs.exePath, "r");
78
+ const blob = { read: (file: EmbeddedFile) => readAt(exe, file.offset, file.length), close: () => exe.close() };
79
+ const { size } = await exe.stat();
80
+ const trailer = await readAt(exe, size - 12, 12);
81
+ if (decoder.decode(trailer.subarray(0, 8)) !== TXIKI_MAGIC) return { files: [], ...blob };
82
+ const payload = uint32(trailer, 8);
83
+ const header = await readAt(exe, payload - 16, 16);
84
+ if (decoder.decode(header.subarray(8)) !== BLOB_MAGIC) return { files: [], ...blob };
85
+ const indexLength = uint32(header, 0);
86
+ const index = await readAt(exe, payload - 16 - indexLength, indexLength);
87
+ return { files: JSON.parse(decoder.decode(index)) as EmbeddedFile[], ...blob };
88
+ }
89
+
90
+ async function gunzip(bytes: Uint8Array): Promise<Uint8Array> {
91
+ const stream = new Blob([bytes as Uint8Array<ArrayBuffer>]).stream().pipeThrough(new DecompressionStream("gzip"));
92
+ return new Uint8Array(await new Response(stream).arrayBuffer());
93
+ }
94
+
95
+ async function sizeOf(file: string): Promise<number | undefined> {
96
+ try { return (await tjs.stat(file)).size; } catch { return undefined; }
97
+ }
98
+
99
+ /** Same cache layout as materializeAsset: <tmp>/tarve-assets/<sha256>/<name>, written once. */
100
+ async function materialize(file: EmbeddedFile, read: (file: EmbeddedFile) => Promise<Uint8Array>): Promise<string> {
101
+ const directory = path.join(tjs.tmpDir, "tarve-assets", file.sha256);
102
+ const target = path.join(directory, file.name);
103
+ if (await sizeOf(target) === file.size) return target;
104
+ const stored = await read(file);
105
+ const bytes = file.gzip ? await gunzip(stored) : stored;
106
+ const hash = createHash("sha256");
107
+ hash.update(bytes);
108
+ if (bytes.length !== file.size || hash.digest("hex") !== file.sha256) {
109
+ throw new Error(`Embedded file ${file.name} does not match its build-time digest; rebuild the executable.`);
110
+ }
111
+ await tjs.makeDir(directory, { recursive: true });
112
+ const temporary = `${target}.${crypto.randomUUID()}.tmp`;
113
+ await tjs.writeFile(temporary, bytes);
114
+ try {
115
+ await tjs.rename(temporary, target);
116
+ } catch (error) {
117
+ // A simultaneous launch published it first (Windows refuses to replace a loaded DLL).
118
+ await tjs.remove(temporary).catch(() => {});
119
+ if (await sizeOf(target) !== file.size) throw error;
120
+ }
121
+ return target;
122
+ }
123
+
124
+ const blob = await embeddedFiles();
125
+ try {
126
+ const paths: Record<string, string> = {};
127
+ for (const file of blob.files) paths[file.name] = await materialize(file, blob.read);
128
+ globals.__tarveAssets = paths;
129
+ globals.__tarveNativePath = paths[TARVE_TXIKI_NATIVE_NAME] ?? tjs.env.TARVE_NATIVE;
130
+ } finally {
131
+ await blob.close();
132
+ }
@@ -0,0 +1,6 @@
1
+ /** #tarve/runtime in a txiki.js executable: the prelude extracted the native library. */
2
+ export function nativePath(): string {
3
+ const path = (globalThis as { __tarveNativePath?: string }).__tarveNativePath;
4
+ if (!path) throw new Error("Tarve native library is not available: this txiki.js executable carries no runtime and TARVE_NATIVE is unset.");
5
+ return path;
6
+ }