@floless/app 0.167.0 → 0.169.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 (277) hide show
  1. package/autostart.mjs +169 -63
  2. package/cli-actions.mjs +8 -1
  3. package/desktop-shell.mjs +335 -0
  4. package/dist/floless-server.cjs +73121 -55759
  5. package/dist/schemas/steel.model.v2.schema.json +2 -1
  6. package/dist/skills/floless-app-onboarding/SKILL.md +13 -4
  7. package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +3 -0
  8. package/dist/skills/floless-app-rfi/SKILL.md +4 -2
  9. package/dist/skills/floless-app-steel-takeoff/SKILL.md +21 -2
  10. package/dist/skills/floless-app-ui/SKILL.md +2 -2
  11. package/dist/skills/floless-app-workflows/SKILL.md +2 -2
  12. package/dist/templates/college-phase-exporter.flo +7 -2
  13. package/dist/templates/trimble-list-projects.flo +10 -2
  14. package/dist/web/agent-steps.js +2 -2
  15. package/dist/web/agents.js +50 -14
  16. package/dist/web/app.css +209 -11
  17. package/dist/web/app.js +99 -16
  18. package/dist/web/aware-update-client.js +14 -6
  19. package/dist/web/aware.js +583 -69
  20. package/dist/web/chat.css +12 -1
  21. package/dist/web/chat.js +627 -96
  22. package/dist/web/commands-drawing-check.js +3 -0
  23. package/dist/web/commands-filter.js +5 -5
  24. package/dist/web/commands-shell.js +283 -14
  25. package/dist/web/commands-steel.js +9 -2
  26. package/dist/web/commands-vector.js +69 -0
  27. package/dist/web/desktop-window.js +435 -0
  28. package/dist/web/drawing-check-editor.html +10 -0
  29. package/dist/web/drawing-check-editor.js +515 -187
  30. package/dist/web/failure-copy.js +33 -2
  31. package/dist/web/flo-3d.js +310 -0
  32. package/dist/web/flo-card.js +72 -0
  33. package/dist/web/guide.js +78 -10
  34. package/dist/web/index.html +90 -10
  35. package/dist/web/instructor.js +4 -1
  36. package/dist/web/leave-guard.js +347 -14
  37. package/dist/web/model-editor-steel-adapter.js +41 -1
  38. package/dist/web/model-viewport-toolbar.js +11 -0
  39. package/dist/web/pages.js +21 -14
  40. package/dist/web/panels.js +5 -2
  41. package/dist/web/pdf-view.js +421 -0
  42. package/dist/web/project-history.js +3 -2
  43. package/dist/web/project-modules.js +5 -3
  44. package/dist/web/project-reconciliation.js +1 -1
  45. package/dist/web/project-rfis.js +4 -2
  46. package/dist/web/project-workflows.js +8 -4
  47. package/dist/web/reference-geometry-worker.js +11 -2
  48. package/dist/web/renderers.js +6 -0
  49. package/dist/web/report-csp.js +68 -0
  50. package/dist/web/revit-editor.html +1 -0
  51. package/dist/web/revit-editor.js +37 -8
  52. package/dist/web/run-history.js +2 -3
  53. package/dist/web/shared-prefs.js +364 -0
  54. package/dist/web/steel-3d-flo.js +309 -0
  55. package/dist/web/steel-3d-view.js +159 -0
  56. package/dist/web/steel-editor.html +329 -47
  57. package/dist/web/steel-filter-flo.js +74 -18
  58. package/dist/web/steel-filter.html +22 -6
  59. package/dist/web/tab-signal.js +36 -1
  60. package/dist/web/tekla-editor.html +1 -0
  61. package/dist/web/terminal-requests.js +78 -0
  62. package/dist/web/tool-updates.js +160 -38
  63. package/dist/web/vector-3d.html +14 -3
  64. package/dist/web/vector-editor.html +60 -10
  65. package/dist/web/vendor/README.md +23 -0
  66. package/dist/web/vendor/pdfjs/LICENSE +177 -0
  67. package/dist/web/vendor/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  68. package/dist/web/vendor/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  69. package/dist/web/vendor/pdfjs/cmaps/78-H.bcmap +0 -0
  70. package/dist/web/vendor/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  71. package/dist/web/vendor/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  72. package/dist/web/vendor/pdfjs/cmaps/78-V.bcmap +0 -0
  73. package/dist/web/vendor/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  74. package/dist/web/vendor/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  75. package/dist/web/vendor/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  76. package/dist/web/vendor/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  77. package/dist/web/vendor/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  78. package/dist/web/vendor/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  79. package/dist/web/vendor/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  80. package/dist/web/vendor/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  81. package/dist/web/vendor/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  82. package/dist/web/vendor/pdfjs/cmaps/Add-H.bcmap +0 -0
  83. package/dist/web/vendor/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  84. package/dist/web/vendor/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  85. package/dist/web/vendor/pdfjs/cmaps/Add-V.bcmap +0 -0
  86. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  87. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  88. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  89. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  90. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  91. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  92. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  93. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  94. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  95. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  96. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  97. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  98. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  99. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  100. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  101. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  102. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  103. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  104. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  105. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  106. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  107. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  108. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  109. package/dist/web/vendor/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  110. package/dist/web/vendor/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  111. package/dist/web/vendor/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  112. package/dist/web/vendor/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  113. package/dist/web/vendor/pdfjs/cmaps/B5-H.bcmap +0 -0
  114. package/dist/web/vendor/pdfjs/cmaps/B5-V.bcmap +0 -0
  115. package/dist/web/vendor/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  116. package/dist/web/vendor/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  117. package/dist/web/vendor/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  118. package/dist/web/vendor/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  119. package/dist/web/vendor/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  120. package/dist/web/vendor/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  121. package/dist/web/vendor/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  122. package/dist/web/vendor/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  123. package/dist/web/vendor/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  124. package/dist/web/vendor/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  125. package/dist/web/vendor/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  126. package/dist/web/vendor/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  127. package/dist/web/vendor/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  128. package/dist/web/vendor/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  129. package/dist/web/vendor/pdfjs/cmaps/EUC-H.bcmap +0 -0
  130. package/dist/web/vendor/pdfjs/cmaps/EUC-V.bcmap +0 -0
  131. package/dist/web/vendor/pdfjs/cmaps/Ext-H.bcmap +0 -0
  132. package/dist/web/vendor/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  133. package/dist/web/vendor/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  134. package/dist/web/vendor/pdfjs/cmaps/Ext-V.bcmap +0 -0
  135. package/dist/web/vendor/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  136. package/dist/web/vendor/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  137. package/dist/web/vendor/pdfjs/cmaps/GB-H.bcmap +4 -0
  138. package/dist/web/vendor/pdfjs/cmaps/GB-V.bcmap +0 -0
  139. package/dist/web/vendor/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  140. package/dist/web/vendor/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  141. package/dist/web/vendor/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  142. package/dist/web/vendor/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  143. package/dist/web/vendor/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  144. package/dist/web/vendor/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  145. package/dist/web/vendor/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  146. package/dist/web/vendor/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  147. package/dist/web/vendor/pdfjs/cmaps/GBT-H.bcmap +0 -0
  148. package/dist/web/vendor/pdfjs/cmaps/GBT-V.bcmap +0 -0
  149. package/dist/web/vendor/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  150. package/dist/web/vendor/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  151. package/dist/web/vendor/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  152. package/dist/web/vendor/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  153. package/dist/web/vendor/pdfjs/cmaps/H.bcmap +0 -0
  154. package/dist/web/vendor/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  155. package/dist/web/vendor/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  156. package/dist/web/vendor/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  157. package/dist/web/vendor/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  158. package/dist/web/vendor/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  159. package/dist/web/vendor/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  160. package/dist/web/vendor/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  161. package/dist/web/vendor/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  162. package/dist/web/vendor/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  163. package/dist/web/vendor/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  164. package/dist/web/vendor/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  165. package/dist/web/vendor/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  166. package/dist/web/vendor/pdfjs/cmaps/Hankaku.bcmap +0 -0
  167. package/dist/web/vendor/pdfjs/cmaps/Hiragana.bcmap +0 -0
  168. package/dist/web/vendor/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  169. package/dist/web/vendor/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  170. package/dist/web/vendor/pdfjs/cmaps/KSC-H.bcmap +0 -0
  171. package/dist/web/vendor/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  172. package/dist/web/vendor/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  173. package/dist/web/vendor/pdfjs/cmaps/KSC-V.bcmap +0 -0
  174. package/dist/web/vendor/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  175. package/dist/web/vendor/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  176. package/dist/web/vendor/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  177. package/dist/web/vendor/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  178. package/dist/web/vendor/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  179. package/dist/web/vendor/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  180. package/dist/web/vendor/pdfjs/cmaps/Katakana.bcmap +0 -0
  181. package/dist/web/vendor/pdfjs/cmaps/LICENSE +36 -0
  182. package/dist/web/vendor/pdfjs/cmaps/NWP-H.bcmap +0 -0
  183. package/dist/web/vendor/pdfjs/cmaps/NWP-V.bcmap +0 -0
  184. package/dist/web/vendor/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  185. package/dist/web/vendor/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  186. package/dist/web/vendor/pdfjs/cmaps/Roman.bcmap +0 -0
  187. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  188. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  189. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  190. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  191. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  192. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  193. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  194. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  195. package/dist/web/vendor/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  196. package/dist/web/vendor/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  197. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  198. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  199. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  200. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  201. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  202. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  203. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  204. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  205. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  206. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  207. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  208. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  209. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  210. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  211. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  212. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  213. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  214. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  215. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  216. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  217. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  218. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  219. package/dist/web/vendor/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  220. package/dist/web/vendor/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  221. package/dist/web/vendor/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  222. package/dist/web/vendor/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  223. package/dist/web/vendor/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  224. package/dist/web/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  225. package/dist/web/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  226. package/dist/web/vendor/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  227. package/dist/web/vendor/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  228. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  229. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  230. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  231. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  232. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  233. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  234. package/dist/web/vendor/pdfjs/cmaps/V.bcmap +0 -0
  235. package/dist/web/vendor/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  236. package/dist/web/vendor/pdfjs/iccs/CGATS001Compat-v2-micro.icc +0 -0
  237. package/dist/web/vendor/pdfjs/iccs/LICENSE +116 -0
  238. package/dist/web/vendor/pdfjs/pdf.min.mjs +28 -0
  239. package/dist/web/vendor/pdfjs/pdf.worker.mjs +64908 -0
  240. package/dist/web/vendor/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
  241. package/dist/web/vendor/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
  242. package/dist/web/vendor/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
  243. package/dist/web/vendor/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  244. package/dist/web/vendor/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
  245. package/dist/web/vendor/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
  246. package/dist/web/vendor/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
  247. package/dist/web/vendor/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  248. package/dist/web/vendor/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
  249. package/dist/web/vendor/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
  250. package/dist/web/vendor/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
  251. package/dist/web/vendor/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
  252. package/dist/web/vendor/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
  253. package/dist/web/vendor/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  254. package/dist/web/vendor/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
  255. package/dist/web/vendor/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
  256. package/dist/web/vendor/pdfjs/wasm/LICENSE_JBIG2 +196 -0
  257. package/dist/web/vendor/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
  258. package/dist/web/vendor/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
  259. package/dist/web/vendor/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
  260. package/dist/web/vendor/pdfjs/wasm/LICENSE_PDFJS_QCMS +19 -0
  261. package/dist/web/vendor/pdfjs/wasm/LICENSE_QCMS +21 -0
  262. package/dist/web/vendor/pdfjs/wasm/jbig2.wasm +0 -0
  263. package/dist/web/vendor/pdfjs/wasm/jbig2_nowasm_fallback.js +15 -0
  264. package/dist/web/vendor/pdfjs/wasm/openjpeg.wasm +0 -0
  265. package/dist/web/vendor/pdfjs/wasm/openjpeg_nowasm_fallback.js +17 -0
  266. package/dist/web/vendor/pdfjs/wasm/qcms_bg.wasm +0 -0
  267. package/dist/web/workspace-root-management.js +1 -1
  268. package/dist/web/workspaces.js +792 -165
  269. package/home-env.mjs +28 -0
  270. package/install-path.mjs +59 -3
  271. package/launch-starting-page.mjs +35 -15
  272. package/launch.mjs +363 -51
  273. package/package.json +9 -8
  274. package/pin-home.mjs +6 -0
  275. package/post-update-marker.mjs +14 -0
  276. package/preferences-file.mjs +289 -0
  277. package/supervisor-lock.mjs +195 -0
package/dist/web/pages.js CHANGED
@@ -18,9 +18,15 @@
18
18
  await globalThis.flolessStartupAdmission?.admit(path, { method: opts?.method, signal: opts?.signal });
19
19
  const res = await fetch(path, { ...opts, headers: { 'Content-Type': 'application/json', ...(opts.headers || {}) } });
20
20
  const body = await res.json().catch(() => ({}));
21
- if (!res.ok || body.ok === false) { const err = new Error(body.error || `HTTP ${res.status}`); err.status = res.status; err.body = body; throw err; }
21
+ if (!res.ok || body.ok === false) {
22
+ // #3097: the server's own sentence when it wrote one, else the shared one; never "HTTP <status>".
23
+ const readOnly = /^(GET|HEAD)$/.test(String(opts.method || 'GET').toUpperCase());
24
+ const err = new Error(personText(body) || failureCopy({ status: res.status, body }, { retrySafe: readOnly }).text); err.status = res.status; err.body = body; throw err;
25
+ }
22
26
  return body;
23
27
  });
28
+ // #3097: a change that failed without a sentence for the person may still have gone through, so never "Try again".
29
+ const UNSURE_WRITE = 'FloLess can’t tell whether it went through, so check before trying again.';
24
30
  const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
25
31
  const toast = (msg, kind) => { if (typeof window.showToast === 'function') window.showToast(msg, kind); };
26
32
  const AI_TIP = 'Made by AI. FloLess doesn’t check its figures or statements — check them before you rely on it or share it.';
@@ -161,7 +167,7 @@
161
167
  if (container.dataset.pagesToken !== token) return;
162
168
  // A failed list is said out loud, on the landing too: an empty-looking section would read as "no Pages".
163
169
  console.warn('Pages list could not be read', err);
164
- container.innerHTML = `${opts.headHtml || ''}<p class="pg-empty">FloLess couldn’t read this list of Pages. ${esc(err?.body?.error || 'Try opening it again in a moment.')}</p>`;
170
+ container.innerHTML = `${opts.headHtml || ''}<p class="pg-empty">FloLess couldn’t read this list of Pages. ${esc(personText(err?.body) || 'Try opening it again in a moment.')}</p>`;
165
171
  return;
166
172
  }
167
173
  if (container.dataset.pagesToken !== token) return;
@@ -351,7 +357,7 @@
351
357
  announceDeleted(home, id);
352
358
  toast('Page deleted.', 'ok');
353
359
  } catch (err) {
354
- toast(`FloLess couldn’t delete it. ${err?.body?.error || 'Try again in a moment.'}`, 'warn');
360
+ toast(`FloLess couldn’t delete it. ${personText(err?.body) || UNSURE_WRITE}`, 'warn');
355
361
  }
356
362
  refreshLists();
357
363
  }
@@ -382,7 +388,7 @@
382
388
  } else toast('Page deleted.', 'ok');
383
389
  }
384
390
  } catch (err) {
385
- toast(`FloLess couldn’t ${act === 'cancel' ? 'cancel publishing' : 'delete it'}. ${err?.body?.error || 'Try again in a moment.'}`, 'warn');
391
+ toast(`FloLess couldn’t ${act === 'cancel' ? 'cancel publishing' : 'delete it'}. ${personText(err?.body) || UNSURE_WRITE}`, 'warn');
386
392
  }
387
393
  refreshLists();
388
394
  }
@@ -511,7 +517,7 @@
511
517
  : `Version ${n} isn't in this Page's history any more, so you're now seeing the latest.`;
512
518
  }
513
519
  function failedNote(n, err) {
514
- return `FloLess couldn’t load version ${n}, so you're seeing the latest. ${err?.body?.error || 'The Page could not be read just now.'} Choose the version again from the list to retry.`;
520
+ return `FloLess couldn’t load version ${n}, so you're seeing the latest. ${personText(err?.body) || 'The Page could not be read just now.'} Choose the version again from the list to retry.`;
515
521
  }
516
522
 
517
523
  /** A response replaced the record (a site change, a refresh): keep the person's version selected and its labels —
@@ -625,7 +631,7 @@
625
631
  if (typeof window.flolessWorkspaces?.openPagesHome === 'function' && await window.flolessWorkspaces.openPagesHome(home, id, closeViewer)) return true;
626
632
  return false;
627
633
  }
628
- toast(`FloLess couldn’t open this Page. ${err?.body?.error || 'Try again in a moment.'}`, 'warn');
634
+ toast(`FloLess couldn’t open this Page. ${personText(err?.body) || 'Try again in a moment.'}`, 'warn');
629
635
  return false;
630
636
  }
631
637
  // Another Page: a share action still out for the previous one no longer owns the Share button.
@@ -799,7 +805,7 @@
799
805
  let found;
800
806
  try { found = await ensureKnown(Math.max(1, before - 200)); }
801
807
  catch (err) {
802
- toast(`FloLess couldn’t show older versions. ${err?.body?.error || 'Try again in a moment.'}`, 'warn');
808
+ toast(`FloLess couldn’t show older versions. ${personText(err?.body) || 'Try again in a moment.'}`, 'warn');
803
809
  if (!$versionPop.hidden) openVersionPicker();
804
810
  return;
805
811
  } finally { view.pagingOlder = false; }
@@ -874,7 +880,7 @@
874
880
  loadFrame();
875
881
  return true;
876
882
  } catch (err) {
877
- toast(`FloLess couldn’t change that. ${err?.body?.error || 'Try again in a moment.'}`, 'warn');
883
+ toast(`FloLess couldn’t change that. ${personText(err?.body) || UNSURE_WRITE}`, 'warn');
878
884
  return false;
879
885
  }
880
886
  }
@@ -1059,7 +1065,7 @@
1059
1065
  const body = await api(`/api/pages/${encodeURIComponent(view.home)}/${encodeURIComponent(p.id)}`, { method: 'DELETE' });
1060
1066
  revokePending = body?.revokePending === true;
1061
1067
  } catch (err) {
1062
- toast(`FloLess couldn’t delete this Page. ${err?.body?.error || 'Try again in a moment.'}`, 'warn');
1068
+ toast(`FloLess couldn’t delete this Page. ${personText(err?.body) || UNSURE_WRITE}`, 'warn');
1063
1069
  return;
1064
1070
  }
1065
1071
  announceDeleted(view.home, p.id);
@@ -1231,7 +1237,7 @@
1231
1237
  if (seq !== view.openSeq || shareSeq !== view.shareSeq) return;
1232
1238
  // Said, not swallowed: the Page's own record still shows its link, and the banner says why the rest is missing.
1233
1239
  view.share = { share: view.page?.share ?? null, eligibility: null,
1234
- error: { code: err?.body?.code || 'offline', message: err?.body?.error || 'FloLess couldn’t check this Page’s link just now. Close the Page and open it again to retry.', path: null } };
1240
+ error: { code: err?.body?.code || 'offline', message: personText(err?.body) || 'FloLess couldn’t check this Page’s link just now. Close the Page and open it again to retry.', path: null } };
1235
1241
  }
1236
1242
  paintShareButton();
1237
1243
  // Painted while closed too: the Instructor reaches Revoke, Copy and the rest by opening this menu (data-reveal-by).
@@ -1318,7 +1324,8 @@
1318
1324
  const code = err?.body?.code || 'offline';
1319
1325
  view.shareQuota = err?.body?.quota || null;
1320
1326
  const path = code === 'share-too-large' && (payload?.version ?? latestN()) === latestN() ? view.share?.eligibility?.path || null : null;
1321
- view.share = { ...(view.share || {}), error: { code, message: err?.body?.error || outcomeSentence('offline'), path } };
1327
+ // A server that answered without a sentence for the person is not "offline": say it can't tell (UNSURE_WRITE).
1328
+ view.share = { ...(view.share || {}), error: { code, message: personText(err?.body) || (err?.status ? UNSURE_WRITE : outcomeSentence('offline')), path } };
1322
1329
  return null;
1323
1330
  } finally {
1324
1331
  // Only the newest action owns the busy mark (even after the viewer moved to another Page, so nothing is left busy),
@@ -1469,7 +1476,7 @@
1469
1476
  const path = view.share?.error?.path;
1470
1477
  if (!path) return;
1471
1478
  try { await api('/api/reveal', { method: 'POST', body: JSON.stringify({ path }) }); }
1472
- catch (err) { toast(`FloLess couldn’t show the file. ${err?.body?.error || 'Try again in a moment.'}`, 'warn'); }
1479
+ catch (err) { toast(`FloLess couldn’t show the file. ${personText(err?.body) || 'Try again in a moment.'}`, 'warn'); }
1473
1480
  return;
1474
1481
  }
1475
1482
  if (act === 'dismiss') { view.share = { ...(view.share || {}), error: null }; view.shareBannerDismissed = true; paintBanner(); $frame.focus(); return; }
@@ -1602,7 +1609,7 @@
1602
1609
  if (gen !== sl.gen) return;
1603
1610
  slPaintUsage(null);
1604
1611
  $slNote.hidden = false;
1605
- $slNote.textContent = `FloLess couldn’t list your shared links. ${err?.body?.error || 'Try again in a moment.'}`;
1612
+ $slNote.textContent = `FloLess couldn’t list your shared links. ${personText(err?.body) || 'Try again in a moment.'}`;
1606
1613
  } finally {
1607
1614
  if (gen === sl.gen) {
1608
1615
  sl.loading = false;
@@ -1667,7 +1674,7 @@
1667
1674
  else if (body.outcome === 'revoke-pending') toast('FloLess will revoke the link as soon as it can reach floless.io.', 'warn');
1668
1675
  else toast(outcomeSentence(body.outcome) || 'FloLess couldn’t revoke the link just now. Try again in a moment.', 'warn');
1669
1676
  } catch (err) {
1670
- toast(`FloLess couldn’t revoke the link. ${err?.body?.error || 'Try again in a moment.'}`, 'warn');
1677
+ toast(`FloLess couldn’t revoke the link. ${personText(err?.body) || UNSURE_WRITE}`, 'warn');
1671
1678
  }
1672
1679
  await slLoad(false);
1673
1680
  // The Pages lists' chips and an open viewer's Share button read the same link: repaint them too.
@@ -20,10 +20,13 @@
20
20
  const { timeoutMs, ...requestOptions } = opts;
21
21
  if (!requestOptions.signal && Number.isFinite(timeoutMs)) requestOptions.signal = AbortSignal.timeout(timeoutMs);
22
22
  const res = await fetch(path, { headers: { 'content-type': 'application/json' }, ...requestOptions });
23
- const body = await res.json().catch(() => ({ ok: false, error: `HTTP ${res.status}` }));
23
+ const body = await res.json().catch(() => ({ ok: false, code: 'response-unreadable' }));
24
24
  if (!res.ok || body.ok === false) {
25
- const err = new Error(body.error || `HTTP ${res.status}`);
25
+ // #3097: the server's own sentence when it wrote one, else the shared one; never "HTTP <status>".
26
+ const readOnly = /^(GET|HEAD)$/.test(String(requestOptions.method || 'GET').toUpperCase());
27
+ const err = new Error(personText(body) || failureCopy({ status: res.status, body }, { retrySafe: readOnly }).text);
26
28
  err.body = body;
29
+ err.status = res.status;
27
30
  throw err;
28
31
  }
29
32
  return body;
@@ -0,0 +1,421 @@
1
+ // FloLess's own PDF viewer (#3018). A PDF used to be put in an <iframe>, so the browser's own viewer drew it: a separate
2
+ // page FloLess's CSS cannot reach, with a light OS scrollbar and the blob's random id as its title in the dark theme. This
3
+ // draws the pages itself with the vendored pdf.js (web/vendor/pdfjs/, loaded only when a PDF first opens), inside a
4
+ // themed toolbar and scroll area, in both themes.
5
+ //
6
+ // It draws ONLY the bytes it is handed. The caller passes the bytes its own route verified (#3002) and nothing here
7
+ // fetches the PDF again, by path or URL: pdf.js gets `data`, never `url`, and Download saves those same bytes.
8
+ //
9
+ // mount(host, { bytes, name, showName, library }) → { el, ready, destroy } — the one entry point. `library` stands in for
10
+ // pdf.js in a test; FloLess itself never passes it.
11
+ // A plain script (no import/export); its one global is `flolessPdfView`.
12
+
13
+ (function () {
14
+ const VENDOR = new URL('vendor/pdfjs/', document.currentScript?.src || document.baseURI).href;
15
+ // 100% is the page at its real size: one PDF point is 96/72 CSS pixels.
16
+ const PT = 96 / 72;
17
+ const MIN_ZOOM = 0.25;
18
+ const FIT_MIN = 0.05; // Fit width may go below MIN_ZOOM: a large sheet in a narrow preview must still fit
19
+ const MAX_ZOOM = 5;
20
+ const STEPS = [0.25, 0.33, 0.5, 0.67, 0.75, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5];
21
+ // Pages this far outside the visible area are drawn ahead of the scroll, and dropped again further out.
22
+ const AHEAD = '600px 0px';
23
+ // The most pixels one page's picture may hold (about 64 MB of RGBA). Only visible pages hold one at all.
24
+ const MAX_PIXELS = 16_000_000;
25
+
26
+ let library = null;
27
+ function loadLibrary() {
28
+ if (!library) {
29
+ library = import(`${VENDOR}pdf.min.mjs`).then((lib) => {
30
+ lib.GlobalWorkerOptions.workerSrc = `${VENDOR}pdf.worker.mjs`;
31
+ return lib;
32
+ });
33
+ library.catch(() => { library = null; });
34
+ }
35
+ return library;
36
+ }
37
+
38
+ function el(tag, className, props) {
39
+ const node = document.createElement(tag);
40
+ if (className) node.className = className;
41
+ if (props) Object.assign(node, props);
42
+ return node;
43
+ }
44
+ function control(label, commandId, tip, className = '') {
45
+ const node = el('button', `pdf-view-btn ${className}`.trim(), { type: 'button', textContent: label });
46
+ node.dataset.commandId = commandId;
47
+ if (tip) node.dataset.tip = tip;
48
+ return node;
49
+ }
50
+ const clamp = (n, lo, hi) => Math.min(hi, Math.max(lo, n));
51
+
52
+ /** What a failure to draw is, in words for the person. Download stays offered whatever it is. */
53
+ function failureWords(error) {
54
+ const name = error && error.name;
55
+ if (name === 'PasswordException') return 'This PDF is locked with a password, so FloLess cannot show it here. Download it and open it with the password.';
56
+ if (name === 'InvalidPDFException') return 'FloLess could not draw this PDF: the file is not a readable PDF. You can still download it.';
57
+ return 'FloLess could not draw this PDF. You can still download it.';
58
+ }
59
+
60
+ function mount(host, options) {
61
+ const bytes = options.bytes instanceof Uint8Array ? options.bytes : new Uint8Array(options.bytes);
62
+ const name = String(options.name || 'document.pdf');
63
+ let destroyed = false;
64
+ let doc = null;
65
+ let task = null;
66
+ let scale = 1;
67
+ let fitting = true; // re-fit on resize until the person zooms themselves
68
+ let current = 1;
69
+ let pages = []; // { box, canvas, text, base: {w,h} | null, drawn: scale | 0, render, layer }
70
+ let downloadUrl = null;
71
+ let pdfLib = null;
72
+
73
+ const root = el('div', 'pdf-view');
74
+ root.dataset.state = 'loading';
75
+ const bar = el('div', 'pdf-view-bar');
76
+ bar.setAttribute('role', 'toolbar');
77
+ bar.setAttribute('aria-label', `${name} — pages, zoom and download`);
78
+ const title = el('span', 'pdf-view-name', { textContent: name });
79
+ if (options.showName === false) title.hidden = true;
80
+
81
+ const nav = el('div', 'pdf-view-group pdf-view-nav');
82
+ nav.setAttribute('role', 'group'); nav.setAttribute('aria-label', 'Pages');
83
+ const prev = control('‹', 'shell.pdf-view-prev', 'Previous page (Page Up)');
84
+ prev.setAttribute('aria-label', 'Previous page');
85
+ const pageField = el('input', 'pdf-view-page', { type: 'text', inputMode: 'numeric', autocomplete: 'off', value: '1' });
86
+ pageField.setAttribute('aria-label', 'Page number');
87
+ pageField.dataset.commandId = 'shell.pdf-view-page';
88
+ pageField.dataset.tip = 'Type a page number and press Enter to go to it';
89
+ const total = el('span', 'pdf-view-total', { textContent: 'of –' });
90
+ const next = control('›', 'shell.pdf-view-next', 'Next page (Page Down)');
91
+ next.setAttribute('aria-label', 'Next page');
92
+ nav.append(prev, pageField, total, next);
93
+
94
+ const zoom = el('div', 'pdf-view-group pdf-view-zoom');
95
+ zoom.setAttribute('role', 'group'); zoom.setAttribute('aria-label', 'Zoom');
96
+ const zoomOut = control('−', 'shell.pdf-view-zoom-out', 'Zoom out (or press -)');
97
+ zoomOut.setAttribute('aria-label', 'Zoom out');
98
+ const level = el('span', 'pdf-view-level', { textContent: '100%' });
99
+ level.setAttribute('aria-hidden', 'true');
100
+ const zoomIn = control('+', 'shell.pdf-view-zoom-in', 'Zoom in (or press +, or Ctrl and scroll)');
101
+ zoomIn.setAttribute('aria-label', 'Zoom in');
102
+ const fit = control('Fit width', 'shell.pdf-view-fit', 'Fit the page to the width of the viewer (or press 0)', 'pdf-view-fit');
103
+ zoom.append(zoomOut, level, zoomIn, fit);
104
+
105
+ downloadUrl = URL.createObjectURL(new Blob([bytes], { type: 'application/pdf' }));
106
+ const download = el('a', 'pdf-view-btn pdf-view-download', { href: downloadUrl, download: name, textContent: 'Download' });
107
+ download.dataset.commandId = 'shell.pdf-view-download';
108
+ download.dataset.tip = `Save ${name} as it is shown here`;
109
+
110
+ bar.append(title, nav, zoom, download);
111
+ const stage = el('div', 'pdf-view-stage');
112
+ stage.tabIndex = 0;
113
+ stage.setAttribute('role', 'document');
114
+ stage.setAttribute('aria-label', `${name}`);
115
+ const status = el('p', 'pdf-view-status', { textContent: 'Opening the PDF…' });
116
+ status.setAttribute('role', 'status');
117
+ const live = el('span', 'pdf-view-live');
118
+ live.setAttribute('aria-live', 'polite');
119
+ stage.append(status);
120
+ root.append(bar, stage, live);
121
+ host.append(root);
122
+
123
+ const showControls = (on) => { nav.hidden = !on || !doc || doc.numPages < 2; zoom.hidden = !on; };
124
+ showControls(false);
125
+
126
+ function setLevel() {
127
+ level.textContent = `${Math.round(scale * 100)}%`;
128
+ zoomOut.disabled = scale <= MIN_ZOOM + 1e-9;
129
+ zoomIn.disabled = scale >= MAX_ZOOM - 1e-9;
130
+ fit.setAttribute('aria-pressed', String(fitting));
131
+ }
132
+ function setCurrent(n, announce) {
133
+ if (!doc) return;
134
+ current = clamp(n, 1, doc.numPages);
135
+ pageField.value = String(current);
136
+ prev.disabled = current <= 1;
137
+ next.disabled = current >= doc.numPages;
138
+ stage.setAttribute('aria-label', `${name}, page ${current} of ${doc.numPages}`);
139
+ if (announce) live.textContent = `Page ${current} of ${doc.numPages}`;
140
+ }
141
+
142
+ // ── drawing ────────────────────────────────────────────────────────────────
143
+ const first = () => pages.find((p) => p.base)?.base;
144
+ function sizeBox(page) {
145
+ const base = page.base || first();
146
+ if (!base) return;
147
+ page.box.style.width = `${Math.floor(base.w * scale * PT)}px`;
148
+ page.box.style.height = `${Math.floor(base.h * scale * PT)}px`;
149
+ }
150
+ /** Drop a page's picture and text, and make any drawing of it still on its way stale, so it never fills a picture
151
+ * for a page that has left the view. */
152
+ function forget(page) {
153
+ page.ticket += 1;
154
+ if (page.render) { page.render.cancel(); page.render = null; }
155
+ if (page.layer) { page.layer.cancel?.(); page.layer = null; }
156
+ page.canvas.width = 0; page.canvas.height = 0;
157
+ page.text.replaceChildren();
158
+ page.drawn = 0;
159
+ }
160
+ /** A page pdf.js could not draw says so on the page itself, and is not tried again until the zoom changes. */
161
+ function failPage(page, error) {
162
+ page.failed = true;
163
+ page.box.dataset.failed = 'true';
164
+ forget(page);
165
+ if (!page.box.querySelector('.pdf-view-sheet-failed')) {
166
+ const note = el('p', 'pdf-view-sheet-failed', { textContent: `FloLess could not draw page ${page.number}. The other pages are not affected, and Download still saves the whole PDF.` });
167
+ note.setAttribute('role', 'note');
168
+ page.box.append(note);
169
+ }
170
+ console.warn(`[pdf-view] page ${page.number} of ${name} could not be drawn`, error);
171
+ }
172
+ /** A page that has left the view gives back what pdf.js holds for it too (its drawing instructions and decoded
173
+ * images), not only its picture. pdf.js defers that until a drawing still running has stopped. */
174
+ function release(page) {
175
+ forget(page);
176
+ page.proxy?.cleanup();
177
+ }
178
+ function unfail(page) {
179
+ page.failed = false;
180
+ delete page.box.dataset.failed;
181
+ page.box.querySelector('.pdf-view-sheet-failed')?.remove();
182
+ }
183
+ async function draw(page) {
184
+ if (destroyed || !doc || !page.visible || page.failed || page.drawn === scale || page.busy) return;
185
+ page.busy = true;
186
+ const at = scale;
187
+ const ticket = page.ticket;
188
+ // Scrolled away, zoomed, or closed since this drawing began: it stops, and paints nothing.
189
+ const stale = () => destroyed || at !== scale || ticket !== page.ticket || !page.visible;
190
+ let failure = null;
191
+ try {
192
+ const pdfPage = await doc.getPage(page.number);
193
+ page.proxy = pdfPage;
194
+ if (stale()) return;
195
+ const one = pdfPage.getViewport({ scale: 1 });
196
+ page.base = { w: one.width, h: one.height };
197
+ sizeBox(page);
198
+ const viewport = pdfPage.getViewport({ scale: at * PT });
199
+ // A large sheet zoomed in on a high-density screen is drawn sharper only up to MAX_PIXELS; past it, a little softer.
200
+ const dpr = window.devicePixelRatio || 1;
201
+ const ratio = Math.min(dpr, Math.sqrt(MAX_PIXELS / Math.max(1, viewport.width * viewport.height)));
202
+ const canvas = page.canvas;
203
+ canvas.width = Math.floor(viewport.width * ratio);
204
+ canvas.height = Math.floor(viewport.height * ratio);
205
+ canvas.style.width = `${Math.floor(viewport.width)}px`;
206
+ canvas.style.height = `${Math.floor(viewport.height)}px`;
207
+ page.render = pdfPage.render({ canvas, viewport, transform: ratio !== 1 ? [ratio, 0, 0, ratio, 0, 0] : undefined });
208
+ await page.render.promise;
209
+ page.render = null;
210
+ if (stale()) return;
211
+ page.box.style.setProperty('--total-scale-factor', String(viewport.scale));
212
+ page.text.replaceChildren();
213
+ page.layer = new pdfLib.TextLayer({ textContentSource: pdfPage.streamTextContent(), container: page.text, viewport });
214
+ await page.layer.render();
215
+ page.layer = null;
216
+ if (stale()) return;
217
+ page.drawn = at;
218
+ } catch (error) {
219
+ // A drawing stopped on purpose (scrolled away, zoomed, closed) rejects with pdf.js's cancellation error; each of
220
+ // those goes through forget() or destroy(), so it is stale, and only an error on live work is a failure.
221
+ if (!stale()) failure = error;
222
+ } finally {
223
+ page.busy = false;
224
+ if (failure) failPage(page, failure);
225
+ // Zoomed while this page was being drawn: draw it again at the new size if it is still in view.
226
+ else if (!destroyed && page.visible && page.drawn !== scale) void draw(page);
227
+ }
228
+ }
229
+
230
+ let observer = null;
231
+ let tracker = null;
232
+ function watch() {
233
+ observer = new IntersectionObserver((entries) => {
234
+ for (const entry of entries) {
235
+ const page = pages[Number(entry.target.dataset.page) - 1];
236
+ if (!page) continue;
237
+ page.visible = entry.isIntersecting;
238
+ if (entry.isIntersecting) void draw(page); else release(page);
239
+ }
240
+ }, { root: stage, rootMargin: AHEAD });
241
+ for (const page of pages) observer.observe(page.box);
242
+ stage.addEventListener('scroll', track, { passive: true });
243
+ }
244
+ function track() {
245
+ if (tracker) return;
246
+ tracker = requestAnimationFrame(() => {
247
+ tracker = null;
248
+ const middle = stage.scrollTop + stage.clientHeight / 3;
249
+ let n = 1;
250
+ for (const page of pages) { if (page.box.offsetTop <= middle) n = page.number; else break; }
251
+ if (n !== current) setCurrent(n, false);
252
+ });
253
+ }
254
+
255
+ function fitScale() {
256
+ const base = first();
257
+ if (!base) return 1;
258
+ const room = stage.clientWidth - 24 - 2;
259
+ // A stage not laid out yet has no width to fit: 100% until it has (the resize watcher fits it then).
260
+ if (!(room > 0)) return 1;
261
+ return clamp(room / (base.w * PT), FIT_MIN, MAX_ZOOM);
262
+ }
263
+ function rescale(nextScale, manual) {
264
+ // A zoom that is not a number would make every drawing stale forever, and draw() would retry it without end.
265
+ if (!doc || !Number.isFinite(nextScale)) return;
266
+ if (manual) fitting = false;
267
+ // A manual zoom stops at MIN_ZOOM, and never jumps up to it from a smaller fitted size; Fit width goes to FIT_MIN.
268
+ nextScale = clamp(nextScale, manual ? Math.min(MIN_ZOOM, scale) : FIT_MIN, MAX_ZOOM);
269
+ // Keep the same place on the same page in view.
270
+ const page = pages[current - 1];
271
+ const into = page ? (stage.scrollTop - page.box.offsetTop) / Math.max(1, page.box.offsetHeight) : 0;
272
+ scale = nextScale;
273
+ // Every picture is redrawn at the new size, any drawing still running is stopped, and a page that failed is tried again.
274
+ for (const p of pages) { sizeBox(p); unfail(p); if (p.drawn || p.busy) forget(p); }
275
+ if (page) stage.scrollTop = page.box.offsetTop + into * page.box.offsetHeight;
276
+ setLevel();
277
+ for (const p of pages) if (p.visible) void draw(p);
278
+ }
279
+ const step = (dir) => {
280
+ if (dir < 0 && scale <= MIN_ZOOM + 1e-9) return; // already at (or fitted below) the smallest zoom
281
+ const near = dir > 0 ? STEPS.find((s) => s > scale + 1e-6) : [...STEPS].reverse().find((s) => s < scale - 1e-6);
282
+ rescale(near ?? (dir > 0 ? MAX_ZOOM : MIN_ZOOM), true);
283
+ };
284
+ function goTo(n) {
285
+ if (!doc) return;
286
+ setCurrent(n, true);
287
+ const page = pages[current - 1];
288
+ if (page) stage.scrollTop = page.box.offsetTop - 12;
289
+ }
290
+
291
+ prev.addEventListener('click', () => goTo(current - 1));
292
+ next.addEventListener('click', () => goTo(current + 1));
293
+ pageField.addEventListener('keydown', (event) => {
294
+ if (event.key !== 'Enter') return;
295
+ event.preventDefault();
296
+ const n = Number.parseInt(pageField.value, 10);
297
+ goTo(Number.isFinite(n) ? n : current); // out of range goes to the nearest page, never an error
298
+ });
299
+ pageField.addEventListener('blur', () => { pageField.value = String(current); });
300
+ zoomOut.addEventListener('click', () => step(-1));
301
+ zoomIn.addEventListener('click', () => step(1));
302
+ fit.addEventListener('click', () => { fitting = true; rescale(fitScale(), false); });
303
+ stage.addEventListener('wheel', (event) => {
304
+ if (!event.ctrlKey || !doc) return; // a plain wheel scrolls the document
305
+ event.preventDefault();
306
+ rescale(scale * (event.deltaY < 0 ? 1.1 : 1 / 1.1), true);
307
+ }, { passive: false });
308
+ stage.addEventListener('keydown', (event) => {
309
+ if (!doc || event.altKey || event.metaKey || (event.ctrlKey && !['+', '=', '-', '0'].includes(event.key))) return;
310
+ const keys = {
311
+ PageDown: () => goTo(current + 1), PageUp: () => goTo(current - 1),
312
+ Home: () => goTo(1), End: () => goTo(doc.numPages),
313
+ '+': () => step(1), '=': () => step(1), '-': () => step(-1),
314
+ '0': () => { fitting = true; rescale(fitScale(), false); },
315
+ };
316
+ const act = keys[event.key];
317
+ if (!act) return;
318
+ event.preventDefault();
319
+ act();
320
+ });
321
+ const resized = new ResizeObserver(() => { if (fitting && doc) rescale(fitScale(), false); });
322
+
323
+ let passwordForm = null;
324
+ function askPassword(answer, wrong) {
325
+ if (destroyed) return;
326
+ passwordForm?.remove();
327
+ status.textContent = wrong
328
+ ? 'That password did not open this PDF. Try again, or download it.'
329
+ : 'This PDF is locked with a password. Type it to open the PDF here, or download it.';
330
+ passwordForm = el('form', 'pdf-view-password');
331
+ const field = el('input', 'pdf-view-password-field', { type: 'password', autocomplete: 'off' });
332
+ field.setAttribute('aria-label', `Password for ${name}`);
333
+ field.dataset.commandId = 'shell.pdf-view-password';
334
+ field.dataset.tip = 'The password of this PDF. FloLess uses it to open the PDF here and does not keep it';
335
+ const submit = el('button', 'pdf-view-btn', { type: 'submit', textContent: 'Open' });
336
+ submit.dataset.commandId = 'shell.pdf-view-password-open';
337
+ submit.dataset.tip = 'Open the PDF with this password';
338
+ passwordForm.append(field, submit);
339
+ passwordForm.addEventListener('submit', (event) => {
340
+ event.preventDefault();
341
+ status.textContent = 'Opening the PDF…';
342
+ passwordForm.hidden = true;
343
+ answer(field.value);
344
+ });
345
+ status.after(passwordForm);
346
+ field.focus({ preventScroll: true });
347
+ }
348
+
349
+ async function open() {
350
+ const lib = pdfLib = options.library || await loadLibrary();
351
+ if (destroyed) return;
352
+ // `data` is a copy: pdf.js hands its buffer to the worker, and Download keeps the original.
353
+ task = lib.getDocument({
354
+ data: bytes.slice(),
355
+ cMapUrl: `${VENDOR}cmaps/`, cMapPacked: true,
356
+ standardFontDataUrl: `${VENDOR}standard_fonts/`,
357
+ wasmUrl: `${VENDOR}wasm/`, iccUrl: `${VENDOR}iccs/`,
358
+ enableXfa: false,
359
+ stopAtErrors: false,
360
+ });
361
+ // A locked PDF asks for its password here, and asks again when it was wrong. The password goes to pdf.js only, for
362
+ // this viewer, and is never kept or sent anywhere.
363
+ task.onPassword = (answer, reason) => askPassword(answer, reason === lib.PasswordResponses.INCORRECT_PASSWORD);
364
+ doc = await task.promise;
365
+ if (destroyed) return; // destroy() has already ended the loading task, and the document with it
366
+ passwordForm?.remove();
367
+ if (!doc.numPages) { status.textContent = 'This PDF has no pages to show.'; root.dataset.state = 'empty'; return; }
368
+ status.remove();
369
+ const firstPage = await doc.getPage(1);
370
+ if (destroyed) return;
371
+ const one = firstPage.getViewport({ scale: 1 });
372
+ for (let n = 1; n <= doc.numPages; n += 1) {
373
+ const box = el('div', 'pdf-view-sheet');
374
+ box.dataset.page = String(n);
375
+ const canvas = el('canvas', 'pdf-view-canvas');
376
+ canvas.setAttribute('aria-hidden', 'true');
377
+ const text = el('div', 'textLayer pdf-view-text');
378
+ box.append(canvas, text);
379
+ stage.append(box);
380
+ pages.push({ number: n, box, canvas, text, base: n === 1 ? { w: one.width, h: one.height } : null, drawn: 0, render: null, layer: null, visible: false, busy: false, ticket: 0, failed: false, proxy: null });
381
+ }
382
+ total.textContent = `of ${doc.numPages}`;
383
+ root.dataset.state = 'ready';
384
+ showControls(true);
385
+ scale = fitScale();
386
+ for (const page of pages) sizeBox(page);
387
+ setLevel();
388
+ setCurrent(1, false);
389
+ watch();
390
+ resized.observe(stage);
391
+ }
392
+
393
+ const ready = open().catch((error) => {
394
+ if (destroyed) return;
395
+ root.dataset.state = 'failed';
396
+ showControls(false);
397
+ passwordForm?.remove();
398
+ status.textContent = failureWords(error);
399
+ status.setAttribute('role', 'alert');
400
+ if (!status.isConnected) stage.prepend(status);
401
+ });
402
+
403
+ function destroy() {
404
+ if (destroyed) return;
405
+ destroyed = true;
406
+ observer?.disconnect();
407
+ resized.disconnect();
408
+ if (tracker) cancelAnimationFrame(tracker);
409
+ for (const page of pages) forget(page);
410
+ // pdf.js 6 releases a document through its loading task: that ends the worker and every page with it.
411
+ if (task) void task.destroy();
412
+ if (downloadUrl) URL.revokeObjectURL(downloadUrl);
413
+ downloadUrl = null;
414
+ root.remove();
415
+ }
416
+
417
+ return { el: root, ready, destroy };
418
+ }
419
+
420
+ window.flolessPdfView = { mount };
421
+ })();
@@ -11,7 +11,8 @@
11
11
  if (typeof bridge().api === 'function') return bridge().api(path);
12
12
  return fetch(path).then(async (res) => {
13
13
  const body = await res.json().catch(() => ({}));
14
- if (!res.ok || body.ok === false) { const err = new Error(body.error || `HTTP ${res.status}`); err.status = res.status; err.body = body; throw err; }
14
+ // #3097: the server's own sentence when it wrote one, else the shared one (this only reads); never "HTTP <status>".
15
+ if (!res.ok || body.ok === false) { const err = new Error(personText(body) || failureCopy({ status: res.status, body }, { retrySafe: true }).text); err.status = res.status; err.body = body; throw err; }
15
16
  return body;
16
17
  });
17
18
  };
@@ -344,7 +345,7 @@
344
345
  // Keep what is shown, and say it may be out of date.
345
346
  if (st.loaded && !st.unavailable) { st.stale = true; paint(pane); return; }
346
347
  st.loaded = false;
347
- st.error = typeof err?.body?.error === 'string' && err.body.error ? err.body.error : VARIANTS[st.variant].failed;
348
+ st.error = personText(err?.body) || VARIANTS[st.variant].failed;
348
349
  paint(pane);
349
350
  return;
350
351
  }
@@ -15,15 +15,17 @@
15
15
  if (typeof bridge().api === 'function') return bridge().api(path, init);
16
16
  return fetch(path, { headers: { 'Content-Type': 'application/json' }, ...init }).then(async (res) => {
17
17
  const body = await res.json().catch(() => ({}));
18
- if (!res.ok || body.ok === false) { const err = new Error(body.error || `HTTP ${res.status}`); err.status = res.status; err.body = body; throw err; }
18
+ // #3097: the server's own sentence when it wrote one, else the shared one; never "HTTP <status>".
19
+ const readOnly = /^(GET|HEAD)$/.test(String(init?.method || 'GET').toUpperCase());
20
+ if (!res.ok || body.ok === false) { const err = new Error(personText(body) || failureCopy({ status: res.status, body }, { retrySafe: readOnly }).text); err.status = res.status; err.body = body; throw err; }
19
21
  return body;
20
22
  });
21
23
  };
22
24
  const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
23
25
  const toast = (msg, kind, options) => (typeof window.showToast === 'function' ? window.showToast(msg, kind, options) : null);
24
26
  // A sentence the server wrote for the person is shown as written; anything else gets the fixed line.
25
- const said = (error, fallback) => (typeof error?.body?.error === 'string' && error.body.error ? error.body.error
26
- : !error?.status && typeof error?.message === 'string' && /^FloLess /.test(error.message) ? error.message : fallback);
27
+ const said = (error, fallback) => (personText(error?.body)
28
+ || (!error?.status && typeof error?.message === 'string' && /^FloLess /.test(error.message) ? error.message : fallback));
27
29
 
28
30
  /** The module names a person knows, by template id (LINKABLE_APPS on the server). */
29
31
  const MODULE_NAMES = {
@@ -59,7 +59,7 @@
59
59
  ...(body === undefined ? {} : { method: 'POST', body: JSON.stringify(body) }) });
60
60
  const result = await response.json();
61
61
  if (!response.ok || result.ok === false) {
62
- const message = [result.userMessage, result.message, result.error].find((value) => typeof value === 'string' && value.trim());
62
+ const message = [result.userMessage, result.message, personText(result)].find((value) => typeof value === 'string' && value.trim());
63
63
  throw new Error(message || 'FloLess could not finish this folder review. Check the folder and try again.');
64
64
  }
65
65
  return result;
@@ -19,13 +19,15 @@
19
19
  if (typeof bridge().api === 'function') return bridge().api(path, init);
20
20
  return fetch(path, { headers: { 'Content-Type': 'application/json' }, ...init }).then(async (res) => {
21
21
  const body = await res.json().catch(() => ({}));
22
- if (!res.ok || body.ok === false) { const err = new Error(body.error || `HTTP ${res.status}`); err.status = res.status; err.body = body; throw err; }
22
+ // #3097: the server's own sentence when it wrote one, else the shared one; never "HTTP <status>".
23
+ const readOnly = /^(GET|HEAD)$/.test(String(init?.method || 'GET').toUpperCase());
24
+ if (!res.ok || body.ok === false) { const err = new Error(personText(body) || failureCopy({ status: res.status, body }, { retrySafe: readOnly }).text); err.status = res.status; err.body = body; throw err; }
23
25
  return body;
24
26
  });
25
27
  };
26
28
  const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
27
29
  const toast = (msg, kind, options) => (typeof window.showToast === 'function' ? window.showToast(msg, kind, options) : null);
28
- const said = (error, fallback) => (typeof error?.body?.error === 'string' && error.body.error ? error.body.error : fallback);
30
+ const said = (error, fallback) => (personText(error?.body) || fallback);
29
31
  /** A refusal the server wrote (a 4xx with a sentence) — as opposed to an outcome nobody confirmed. */
30
32
  const refused = (error) => !!error?.status && error.status >= 400 && error.status < 500 && typeof error?.body?.error === 'string';
31
33
  const newKey = () => `rfi-${crypto.randomUUID()}`;