@nodaro/shared 3.67.0 → 3.69.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 (202) hide show
  1. package/dist/{chunk-T4GIHHXY.cjs → chunk-25C2E2GI.cjs} +6 -6
  2. package/dist/{chunk-T4GIHHXY.cjs.map → chunk-25C2E2GI.cjs.map} +1 -1
  3. package/dist/{chunk-OXTF4Y3P.cjs → chunk-3AB3YIFM.cjs} +6 -6
  4. package/dist/{chunk-OXTF4Y3P.cjs.map → chunk-3AB3YIFM.cjs.map} +1 -1
  5. package/dist/{chunk-23IKLMRL.cjs → chunk-3OHRFSQL.cjs} +53 -51
  6. package/dist/{chunk-23IKLMRL.cjs.map → chunk-3OHRFSQL.cjs.map} +1 -1
  7. package/dist/{chunk-GNLA5NTT.cjs → chunk-4IMEJQVQ.cjs} +4 -4
  8. package/dist/{chunk-GNLA5NTT.cjs.map → chunk-4IMEJQVQ.cjs.map} +1 -1
  9. package/dist/{chunk-JTYCJ5OL.cjs → chunk-54E2JO4E.cjs} +100 -33
  10. package/dist/chunk-54E2JO4E.cjs.map +1 -0
  11. package/dist/{chunk-HTDKEYMY.cjs → chunk-5EQRIUGI.cjs} +139 -91
  12. package/dist/chunk-5EQRIUGI.cjs.map +1 -0
  13. package/dist/{chunk-AT53ZQUC.js → chunk-5WHU7CYE.js} +3 -3
  14. package/dist/{chunk-AT53ZQUC.js.map → chunk-5WHU7CYE.js.map} +1 -1
  15. package/dist/{chunk-BNR5FKL5.js → chunk-5ZCZL73I.js} +3 -3
  16. package/dist/{chunk-BNR5FKL5.js.map → chunk-5ZCZL73I.js.map} +1 -1
  17. package/dist/{chunk-6FQBKI2A.cjs → chunk-6JSYNKFL.cjs} +4 -4
  18. package/dist/{chunk-6FQBKI2A.cjs.map → chunk-6JSYNKFL.cjs.map} +1 -1
  19. package/dist/{chunk-WZG6GZIL.cjs → chunk-6QJHSN6J.cjs} +4 -4
  20. package/dist/{chunk-WZG6GZIL.cjs.map → chunk-6QJHSN6J.cjs.map} +1 -1
  21. package/dist/{chunk-OFQ6CU6S.js → chunk-7EQJIGVT.js} +3 -3
  22. package/dist/{chunk-OFQ6CU6S.js.map → chunk-7EQJIGVT.js.map} +1 -1
  23. package/dist/{chunk-XEPKONJC.js → chunk-7OSUEYZ4.js} +3 -3
  24. package/dist/{chunk-XEPKONJC.js.map → chunk-7OSUEYZ4.js.map} +1 -1
  25. package/dist/{chunk-3L7GMQ4M.cjs → chunk-7PC2YHBN.cjs} +54 -49
  26. package/dist/chunk-7PC2YHBN.cjs.map +1 -0
  27. package/dist/{chunk-BMDOPJBP.cjs → chunk-AGIG5HUU.cjs} +17 -17
  28. package/dist/{chunk-BMDOPJBP.cjs.map → chunk-AGIG5HUU.cjs.map} +1 -1
  29. package/dist/{chunk-5LWYX4GV.js → chunk-AH6OQXLW.js} +3 -3
  30. package/dist/{chunk-5LWYX4GV.js.map → chunk-AH6OQXLW.js.map} +1 -1
  31. package/dist/{chunk-RVQW623D.js → chunk-BDW25A7Y.js} +72 -18
  32. package/dist/chunk-BDW25A7Y.js.map +1 -0
  33. package/dist/{chunk-5J2LIQYU.js → chunk-DE55SA2X.js} +5 -5
  34. package/dist/{chunk-5J2LIQYU.js.map → chunk-DE55SA2X.js.map} +1 -1
  35. package/dist/{chunk-VBP4DH37.js → chunk-DNWFFVC6.js} +130 -15
  36. package/dist/chunk-DNWFFVC6.js.map +1 -0
  37. package/dist/{chunk-CLAKSLXF.js → chunk-E3PU7YC6.js} +3 -3
  38. package/dist/{chunk-CLAKSLXF.js.map → chunk-E3PU7YC6.js.map} +1 -1
  39. package/dist/{chunk-MVXZP6VB.js → chunk-FUYBUT65.js} +97 -2
  40. package/dist/chunk-FUYBUT65.js.map +1 -0
  41. package/dist/{chunk-SW5ZD7BO.js → chunk-G6AOKNAY.js} +3 -3
  42. package/dist/{chunk-SW5ZD7BO.js.map → chunk-G6AOKNAY.js.map} +1 -1
  43. package/dist/{chunk-EFYWV2V5.cjs → chunk-I6TBKTW3.cjs} +61 -61
  44. package/dist/{chunk-EFYWV2V5.cjs.map → chunk-I6TBKTW3.cjs.map} +1 -1
  45. package/dist/{chunk-3YWZ5SOZ.js → chunk-KLEKJUQI.js} +5 -5
  46. package/dist/{chunk-3YWZ5SOZ.js.map → chunk-KLEKJUQI.js.map} +1 -1
  47. package/dist/{chunk-OXBU5AGH.js → chunk-LSX2OFNB.js} +3 -3
  48. package/dist/{chunk-OXBU5AGH.js.map → chunk-LSX2OFNB.js.map} +1 -1
  49. package/dist/{chunk-66QSUUB4.cjs → chunk-LY6IR5LL.cjs} +12 -12
  50. package/dist/{chunk-66QSUUB4.cjs.map → chunk-LY6IR5LL.cjs.map} +1 -1
  51. package/dist/{chunk-5GG4CG4Y.js → chunk-LZPG4XHT.js} +3 -3
  52. package/dist/{chunk-5GG4CG4Y.js.map → chunk-LZPG4XHT.js.map} +1 -1
  53. package/dist/{chunk-PGDR7CO3.cjs → chunk-MGSGLRHZ.cjs} +8 -8
  54. package/dist/{chunk-PGDR7CO3.cjs.map → chunk-MGSGLRHZ.cjs.map} +1 -1
  55. package/dist/{chunk-Z77M7Q2R.js → chunk-ML55U7WM.js} +3 -3
  56. package/dist/{chunk-Z77M7Q2R.js.map → chunk-ML55U7WM.js.map} +1 -1
  57. package/dist/{chunk-ALRXY4QH.cjs → chunk-N7ZJD4CK.cjs} +6 -2
  58. package/dist/chunk-N7ZJD4CK.cjs.map +1 -0
  59. package/dist/{chunk-O2QOBA6Q.js → chunk-NPGP6FMU.js} +43 -3
  60. package/dist/chunk-NPGP6FMU.js.map +1 -0
  61. package/dist/{chunk-IWUW3YPM.cjs → chunk-NTCSXKZ3.cjs} +5 -5
  62. package/dist/{chunk-IWUW3YPM.cjs.map → chunk-NTCSXKZ3.cjs.map} +1 -1
  63. package/dist/chunk-NWNRATS3.js +13 -0
  64. package/dist/chunk-NWNRATS3.js.map +1 -0
  65. package/dist/{chunk-SCDE676D.js → chunk-OEOOXL3F.js} +65 -23
  66. package/dist/chunk-OEOOXL3F.js.map +1 -0
  67. package/dist/{chunk-GF7ZA26H.js → chunk-OOUJZR4K.js} +4 -4
  68. package/dist/{chunk-GF7ZA26H.js.map → chunk-OOUJZR4K.js.map} +1 -1
  69. package/dist/{chunk-5IZHECUP.js → chunk-OZA4DE23.js} +3 -3
  70. package/dist/{chunk-5IZHECUP.js.map → chunk-OZA4DE23.js.map} +1 -1
  71. package/dist/{chunk-GTBW2KAY.js → chunk-PHQVAPSD.js} +8 -6
  72. package/dist/{chunk-GTBW2KAY.js.map → chunk-PHQVAPSD.js.map} +1 -1
  73. package/dist/{chunk-5NVGKXJV.cjs → chunk-PLANUXQL.cjs} +89 -3
  74. package/dist/chunk-PLANUXQL.cjs.map +1 -0
  75. package/dist/{chunk-ZQ2BHOFH.cjs → chunk-Q2LEJXLZ.cjs} +6 -6
  76. package/dist/{chunk-ZQ2BHOFH.cjs.map → chunk-Q2LEJXLZ.cjs.map} +1 -1
  77. package/dist/{chunk-PJAJCFLP.cjs → chunk-QNPYYSLT.cjs} +168 -44
  78. package/dist/chunk-QNPYYSLT.cjs.map +1 -0
  79. package/dist/{chunk-G2G7XGFU.cjs → chunk-RURPG6IS.cjs} +7 -7
  80. package/dist/{chunk-G2G7XGFU.cjs.map → chunk-RURPG6IS.cjs.map} +1 -1
  81. package/dist/{chunk-PAUWEWTY.js → chunk-TDU45K6Z.js} +12 -7
  82. package/dist/chunk-TDU45K6Z.js.map +1 -0
  83. package/dist/{chunk-X2YHKP4D.cjs → chunk-TWUFC32F.cjs} +8 -8
  84. package/dist/{chunk-X2YHKP4D.cjs.map → chunk-TWUFC32F.cjs.map} +1 -1
  85. package/dist/{chunk-O6TBB4IF.cjs → chunk-TZWXZDSX.cjs} +48 -2
  86. package/dist/chunk-TZWXZDSX.cjs.map +1 -0
  87. package/dist/{chunk-F6XIH3TZ.cjs → chunk-UJREE6EQ.cjs} +9 -9
  88. package/dist/{chunk-F6XIH3TZ.cjs.map → chunk-UJREE6EQ.cjs.map} +1 -1
  89. package/dist/{chunk-CFTXW3ZL.js → chunk-UVUHVY7F.js} +3 -3
  90. package/dist/{chunk-CFTXW3ZL.js.map → chunk-UVUHVY7F.js.map} +1 -1
  91. package/dist/{chunk-37ZSFS6A.cjs → chunk-WML66SUV.cjs} +9 -9
  92. package/dist/{chunk-37ZSFS6A.cjs.map → chunk-WML66SUV.cjs.map} +1 -1
  93. package/dist/{chunk-M5QY464F.cjs → chunk-XZYZYWKG.cjs} +21 -21
  94. package/dist/{chunk-M5QY464F.cjs.map → chunk-XZYZYWKG.cjs.map} +1 -1
  95. package/dist/{chunk-3QJ3UR5Z.js → chunk-YT4ZTJVC.js} +9 -9
  96. package/dist/{chunk-3QJ3UR5Z.js.map → chunk-YT4ZTJVC.js.map} +1 -1
  97. package/dist/{chunk-V6OXSXIX.js → chunk-YVQFYW2U.js} +86 -4
  98. package/dist/chunk-YVQFYW2U.js.map +1 -0
  99. package/dist/{chunk-E62W5I6A.cjs → chunk-ZWEVRMFN.cjs} +97 -2
  100. package/dist/chunk-ZWEVRMFN.cjs.map +1 -0
  101. package/dist/entries/apps.cjs +42 -42
  102. package/dist/entries/apps.js +7 -7
  103. package/dist/entries/credits.cjs +295 -219
  104. package/dist/entries/credits.d.cts +233 -70
  105. package/dist/entries/credits.d.ts +233 -70
  106. package/dist/entries/credits.js +11 -11
  107. package/dist/entries/llm-models.cjs +84 -68
  108. package/dist/entries/llm-models.d.cts +36 -3
  109. package/dist/entries/llm-models.d.ts +36 -3
  110. package/dist/entries/llm-models.js +2 -2
  111. package/dist/entries/media.cjs +111 -107
  112. package/dist/entries/media.d.cts +17 -2
  113. package/dist/entries/media.d.ts +17 -2
  114. package/dist/entries/media.js +3 -3
  115. package/dist/entries/model-catalog.cjs +133 -133
  116. package/dist/entries/model-catalog.js +4 -4
  117. package/dist/entries/models.cjs +433 -397
  118. package/dist/entries/models.d.cts +2 -2
  119. package/dist/entries/models.d.ts +2 -2
  120. package/dist/entries/models.js +8 -8
  121. package/dist/entries/nodes.cjs +212 -212
  122. package/dist/entries/nodes.js +8 -8
  123. package/dist/entries/pipeline.cjs +153 -153
  124. package/dist/entries/pipeline.d.cts +1 -1
  125. package/dist/entries/pipeline.d.ts +1 -1
  126. package/dist/entries/pipeline.js +3 -3
  127. package/dist/entries/runtime-config.cjs +53 -29
  128. package/dist/entries/runtime-config.d.cts +53 -1
  129. package/dist/entries/runtime-config.d.ts +53 -1
  130. package/dist/entries/runtime-config.js +1 -1
  131. package/dist/entries/social.cjs +177 -177
  132. package/dist/entries/social.js +2 -2
  133. package/dist/entries/types.d.cts +12 -5
  134. package/dist/entries/types.d.ts +12 -5
  135. package/dist/entries/ugc.cjs +71 -71
  136. package/dist/entries/ugc.js +4 -4
  137. package/dist/entries/video.cjs +152 -152
  138. package/dist/entries/video.d.cts +2 -1
  139. package/dist/entries/video.d.ts +2 -1
  140. package/dist/entries/video.js +6 -6
  141. package/dist/index.cjs +1882 -1726
  142. package/dist/index.d.cts +5 -5
  143. package/dist/index.d.ts +5 -5
  144. package/dist/index.js +25 -25
  145. package/dist/{model-constants-DZ3tPGFO.d.ts → model-constants-B5DNHIP8.d.ts} +156 -12
  146. package/dist/{model-constants-BstsUup6.d.cts → model-constants-CQr_d3Kw.d.cts} +156 -12
  147. package/package.json +1 -1
  148. package/src/__tests__/add-captions-nemotron-pricing.test.ts +13 -1
  149. package/src/__tests__/extend-providers.test.ts +43 -6
  150. package/src/__tests__/fixtures/measured-input-quote-parity.json +2352 -1
  151. package/src/__tests__/fixtures/planned-length-quote-parity.json +100 -10
  152. package/src/__tests__/fixtures/probed-node-quote-parity.json +132 -0
  153. package/src/__tests__/fixtures/video-utility-quote-parity.json +945 -38
  154. package/src/__tests__/gemini-omni-extend.test.ts +110 -0
  155. package/src/__tests__/gvp-supported-providers.test.ts +3 -0
  156. package/src/__tests__/llm-models.test.ts +116 -2
  157. package/src/__tests__/llm-price-key.test.ts +2 -0
  158. package/src/__tests__/nemotron-transcribe-pricing.test.ts +32 -0
  159. package/src/__tests__/runtime-config-lists.test.ts +92 -0
  160. package/src/__tests__/seedance-2-5-flash-catalog.test.ts +194 -0
  161. package/src/__tests__/video-character-refs.test.ts +48 -0
  162. package/src/catalog-projection.ts +12 -5
  163. package/src/credit-estimators/add-captions-nemotron.ts +11 -1
  164. package/src/credit-estimators/index.ts +6 -1
  165. package/src/credit-estimators/nemotron-transcribe.ts +35 -3
  166. package/src/credit-estimators/pitch-tempo.ts +14 -0
  167. package/src/credit-estimators/video-sfx.ts +15 -0
  168. package/src/credit-estimators/video-utils.ts +48 -12
  169. package/src/credit-identifiers.ts +51 -32
  170. package/src/entries/credits.ts +18 -0
  171. package/src/entries/llm-models.ts +4 -0
  172. package/src/entries/models.ts +11 -0
  173. package/src/entries/runtime-config.ts +10 -1
  174. package/src/gemini-omni-extend-quote.ts +76 -0
  175. package/src/lip-sync-pricing.ts +16 -1
  176. package/src/llm-models.ts +117 -2
  177. package/src/model-catalog.ts +95 -0
  178. package/src/model-constants.ts +274 -11
  179. package/src/node-default-mappings.ts +2 -0
  180. package/src/priced-clip-seconds.ts +19 -1
  181. package/src/runtime-config/lists.ts +87 -0
  182. package/src/runtime-config/worlds.ts +10 -0
  183. package/src/seedance-extend-rate.ts +83 -20
  184. package/src/seedance-lip-sync.ts +68 -0
  185. package/src/video-character-refs.ts +26 -6
  186. package/dist/chunk-3L7GMQ4M.cjs.map +0 -1
  187. package/dist/chunk-5NVGKXJV.cjs.map +0 -1
  188. package/dist/chunk-ALRXY4QH.cjs.map +0 -1
  189. package/dist/chunk-E62W5I6A.cjs.map +0 -1
  190. package/dist/chunk-HTDKEYMY.cjs.map +0 -1
  191. package/dist/chunk-JTYCJ5OL.cjs.map +0 -1
  192. package/dist/chunk-MVXZP6VB.js.map +0 -1
  193. package/dist/chunk-O2QOBA6Q.js.map +0 -1
  194. package/dist/chunk-O6TBB4IF.cjs.map +0 -1
  195. package/dist/chunk-PAUWEWTY.js.map +0 -1
  196. package/dist/chunk-PJAJCFLP.cjs.map +0 -1
  197. package/dist/chunk-RVQW623D.js.map +0 -1
  198. package/dist/chunk-SCDE676D.js.map +0 -1
  199. package/dist/chunk-SMOO5FAH.js +0 -10
  200. package/dist/chunk-SMOO5FAH.js.map +0 -1
  201. package/dist/chunk-V6OXSXIX.js.map +0 -1
  202. package/dist/chunk-VBP4DH37.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/runtime-config/worlds.ts","../src/runtime-config/contract.ts"],"names":["strings"],"mappings":";AAaO,IAAM,SAAA,GAAY,MAAA,CAAO,MAAA,CAAO,CAAC,SAAA,EAAW,OAAA,EAAS,OAAA,EAAS,OAAA,EAAS,QAAA,EAAU,QAAA,EAAU,OAAA,EAAS,KAAA,EAAO,QAAQ,CAAU;AAIpI,IAAM,YAAA,GAAoC,IAAI,GAAA,CAAI,SAAS,CAAA;AAEpD,SAAS,UAAU,KAAA,EAAkC;AAC1D,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,YAAA,CAAa,IAAI,KAAK,CAAA;AAC5D;AAiBO,IAAM,yBAAA,GAA0E,OAAO,MAAA,CAAO;AAAA,EACnG,OAAA,EAAS,MAAA,CAAO,MAAA,CAAO,EAAE,CAAA;AAAA,EACzB,KAAA,EAAO,MAAA,CAAO,MAAA,CAAO,CAAC,gBAAgB,CAAC,CAAA;AAAA,EACvC,OAAO,MAAA,CAAO,MAAA,CAAO,CAAC,gBAAA,EAAkB,eAAe,CAAC,CAAA;AAAA,EACxD,KAAA,EAAO,MAAA,CAAO,MAAA,CAAO,CAAC,eAAe,CAAC,CAAA;AAAA,EACtC,MAAA,EAAQ,MAAA,CAAO,MAAA,CAAO,CAAC,WAAW,CAAC,CAAA;AAAA,EACnC,MAAA,EAAQ,MAAA,CAAO,MAAA,CAAO,CAAC,WAAW,CAAC,CAAA;AAAA,EACnC,KAAA,EAAO,MAAA,CAAO,MAAA,CAAO,CAAC,mBAAmB,CAAC,CAAA;AAAA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cAAc,GAAA,CAAI,WAAA;AAC1D,EAAA,IAAI,cAAc,GAAA,CAAI,YAAY,CAAA,EAAG,GAAA,CAAI,eAAe,GAAA,CAAI,YAAA;AAC5D,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,GAAA,CAAI,aAAa,CAAA,EAAG;AACpC,IAAA,MAAM,KAAA,GAAQ,GAAA,CAAI,aAAA,CAAc,MAAA,CAAO,cAAc,CAAA;AACrD,IAAA,IAAI,KAAA,CAAM,MAAA,GAAS,CAAA,EAAG,GAAA,CAAI,aAAA,GAAgB,KAAA;AAAA,EAC5C;AACA,EAAA,IAAI,cAAc,GAAA,CAAI,UAAU,CAAA,EAAG,GAAA,CAAI,aAAa,GAAA,CAAI,UAAA;AACxD,EAAA,OAAO,GAAA;AACT;AAGO,SAAS,iBAAA,CAAkB,QAAiB,UAAA,EAAiC;AAClF,EAAA,IAAI;AACF,IAAA,OAAO,kBAAA,CAAmB,QAAA,CAAS,KAAK,CAAA,IAAK,OAAO,UAAU,UAAA,GAAc,KAAA,CAAc,qBAAqB,CAAA,GAAI,KAAA,CAAS,CAAA;AAAA,EAC9H,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAC;AAAA,EACV;AACF","file":"chunk-O2QOBA6Q.js","sourcesContent":["/**\n * The worlds a Nodaro deployment can offer — the tabs of the shared site\n * header, in its canonical display order — and the node types each one runs.\n *\n * A world is offered to a viewer when the deployment's profile allows it\n * (`surface.worlds.allow`, when set) AND every node type it runs is available\n * to that viewer. The platform's `GET /v1/surface/availability` answers both\n * per viewer; this table is the one copy that answer and every client read,\n * so a world is never shown where its runs would be refused.\n *\n * Structural vocabulary only (ids and node-type names), no content.\n */\n\nexport const WORLD_IDS = Object.freeze([\"explore\", \"image\", \"video\", \"music\", \"trends\", \"motion\", \"voice\", \"app\", \"studio\"] as const)\n\nexport type WorldId = (typeof WORLD_IDS)[number]\n\nconst WORLD_ID_SET: ReadonlySet<string> = new Set(WORLD_IDS)\n\nexport function isWorldId(value: unknown): value is WorldId {\n return typeof value === \"string\" && WORLD_ID_SET.has(value)\n}\n\n/**\n * The node types each world runs: a world is offered only while every one of\n * them is available to the viewer. A world with none runs no node of its own\n * and is gated by the allowlist alone: Explore is a showcase, App is the\n * workflow editor (whose nodes are gated one by one inside it), Studio is its\n * own product.\n *\n * - `image`: Generate Image (`POST /v1/generate-image`).\n * - `video`: Generate Video and Text to Video — the world's two routes\n * (`/v1/generate-video` from a start frame, `/v1/text-to-video` from a\n * prompt). The canvas's Image to Video node is not one of them.\n * - `music`: Suno Create Music (`/v1/suno/generate`).\n * - `trends`, `motion`: Cast Swap (`/v1/cast-swap`), the run both worlds start.\n * - `voice`: Voice Changer Pro (`/v1/voice-changer-pro`).\n */\nexport const WORLD_REQUIRED_NODE_TYPES: Readonly<Record<WorldId, readonly string[]>> = Object.freeze({\n explore: Object.freeze([]),\n image: Object.freeze([\"generate-image\"]),\n video: Object.freeze([\"generate-video\", \"text-to-video\"]),\n music: Object.freeze([\"suno-generate\"]),\n trends: Object.freeze([\"cast-swap\"]),\n motion: Object.freeze([\"cast-swap\"]),\n voice: Object.freeze([\"voice-changer-pro\"]),\n app: Object.freeze([]),\n studio: Object.freeze([]),\n})\n\n/** The worlds part of a deployment's surface profile. */\nexport interface SurfaceWorlds {\n /**\n * When PRESENT, exactly these worlds are offered (`[]` offers none). Absent:\n * every world is, subject to its node types. Unlike the profile's other\n * lists, presence is what narrows, so a list whose ids are all unknown\n * offers nothing instead of everything.\n */\n readonly allow?: readonly string[]\n /** The world a visit to the site's root lands on. Always one `allow` lets through. */\n readonly home?: WorldId\n /** Display order; worlds it leaves out follow in canonical order. */\n readonly order?: readonly WorldId[]\n}\n\n/** Does the profile's allowlist let this world through? (Node availability is checked separately.) */\nexport function worldAllowed(worlds: SurfaceWorlds | undefined, id: string): boolean {\n return worlds?.allow === undefined || worlds.allow.includes(id)\n}\n\n/** Every world, `order`'s known ids first (each once), then the rest in canonical order. */\nexport function orderWorlds(order?: readonly string[]): WorldId[] {\n const out: WorldId[] = []\n for (const id of order ?? []) if (isWorldId(id) && !out.includes(id)) out.push(id)\n for (const id of WORLD_IDS) if (!out.includes(id)) out.push(id)\n return out\n}\n","import { isWorldId, type SurfaceWorlds, type WorldId } from \"./worlds.js\"\n\n/**\n * The deployment runtime config — the object a Nodaro platform container\n * writes to `/config.js` at boot as `window.__NODARO_RUNTIME__`, and that every\n * product served from the same site reads before its app starts. One published\n * build then serves any deployment without a rebuild.\n *\n * This module is the contract between that writer and its readers: the key\n * names, their shapes, and a lenient parser. Structural vocabulary only: no\n * content, no prices, nothing about any one deployment. The platform's own\n * schema stays the authority on what a deployment may set. What reaches the\n * page has already been validated there and stripped of every server-only\n * value; this parser only refuses to hand a reader a value of the wrong type.\n */\n\n/** The global `/config.js` assigns. */\nexport const RUNTIME_CONFIG_GLOBAL = \"__NODARO_RUNTIME__\"\n\n/** Every top-level key `/config.js` can carry. */\nexport const RUNTIME_CONFIG_KEYS = Object.freeze([\n \"apiUrl\",\n \"supabaseUrl\",\n \"supabaseAnonKey\",\n \"freecutUrl\",\n \"audiomassUrl\",\n \"defaultLocale\",\n \"surface\",\n \"moderation\",\n \"previewStopRule\",\n \"mediaOrigin\",\n \"flowUiOrigin\",\n \"legacyUiHosts\",\n \"linkOrigin\",\n] as const)\nexport type RuntimeConfigKey = (typeof RUNTIME_CONFIG_KEYS)[number]\n\nexport const SURFACE_HEADER_MODES = Object.freeze([\"default\", \"white-label\"] as const)\n/** `white-label`: the deployment's own header, with no platform links or art. */\nexport type SurfaceHeaderMode = (typeof SURFACE_HEADER_MODES)[number]\n\nexport const SURFACE_CATALOG_IMAGES = Object.freeze([\"default\", \"none\", \"own\"] as const)\n/** Pictures on picker options: the platform's (`default`), none, or the deployment's own (`own`). */\nexport type SurfaceCatalogImages = (typeof SURFACE_CATALOG_IMAGES)[number]\n\nexport interface RuntimeSurfaceSibling {\n readonly label: string\n readonly url: string\n readonly urlByHost?: Readonly<Record<string, string>>\n}\n\nexport interface RuntimeSurfaceBrand {\n readonly productName: string\n readonly description?: string\n readonly wordmark?: string\n readonly platformLinks?: boolean\n /** A same-site path (`/brand/logo.svg`) or an https URL. */\n readonly logo?: string\n /** The page's icons, each a path on this site (`/brand/favicon.svg`): see `isSameSitePath`. */\n readonly favicon?: readonly string[]\n}\n\n/**\n * Overrides of a product's UI strings, `product → locale id → message key →\n * text`. Each product reads only its own namespace (`UI_STRING_PRODUCTS`). The\n * platform checks every entry against that product's dictionary before it\n * reaches a page: the key exists, the locale is one the deployment offers, the\n * text is plain and keeps the base string's `{placeholders}`.\n */\nexport type RuntimeSurfaceStrings = Readonly<Record<string, Readonly<Record<string, Readonly<Record<string, string>>>>>>\n\n/** The display side of billing. The server-only billing keys never reach a page. */\nexport interface RuntimeSurfaceBilling {\n readonly costTab: \"inherit\" | \"hidden\"\n readonly sidebarCard: \"inherit\" | \"hidden\"\n readonly selfServe: boolean\n readonly unitLabel?: string\n readonly unitRate?: number\n readonly unitDecimals?: number\n /**\n * The unit's word per interface language, beside the single `unitLabel`: a\n * language the deployment gives no word for uses `unitLabel`. Read with\n * `surfaceUnitLabel`.\n */\n readonly unitLabels?: Readonly<Record<string, string>>\n}\n\n/**\n * The deployment's surface profile as a page receives it, with every default\n * applied. Lists that are empty keep the product's own default, except\n * `worlds.allow` (see `SurfaceWorlds`).\n */\nexport interface RuntimeSurface {\n readonly nav: { readonly hide: readonly string[] }\n readonly features: { readonly hide: readonly string[] }\n readonly dashboard: { readonly tabs: readonly string[] }\n readonly nodes: { readonly deny: readonly string[]; readonly allow: readonly string[] }\n readonly models: { readonly deny: readonly string[]; readonly allow: readonly string[] }\n /** `requireSignIn`: no guest visits. When the deployment does not say, true exactly when sign-in is SSO-only. */\n readonly auth: { readonly methods: readonly string[]; readonly ssoLabel?: string; readonly requireSignIn: boolean }\n readonly siblings: { readonly apps: readonly RuntimeSurfaceSibling[] }\n readonly brand: RuntimeSurfaceBrand\n /** `offered`: the languages a visitor may pick from; absent = every language the product ships. */\n readonly locale: { readonly default?: string; readonly picker: boolean; readonly offered?: readonly string[] }\n readonly outputs: { readonly allowPublic: boolean }\n readonly voice: { readonly allowedGenders: readonly string[] }\n readonly billing: RuntimeSurfaceBilling\n readonly catalogs: { readonly required: boolean; readonly factoryPresets: boolean; readonly images: SurfaceCatalogImages }\n /** `links`: whether media may be imported from a link to another site. */\n readonly imports: { readonly links: boolean }\n readonly header: SurfaceHeaderMode\n readonly worlds: SurfaceWorlds\n /** The deployment's own wording for UI strings; `{}` = none. Read with `surfaceStringOverride`. */\n readonly strings: RuntimeSurfaceStrings\n /** Carried as given; no reader acts on it. */\n readonly catalogPolicy?: unknown\n}\n\nexport interface NodaroRuntimeConfig {\n /** The API base. `\"/\"` means this page's own origin: see `resolveRuntimeApiBase`. */\n readonly apiUrl?: string\n /** The Supabase URL. `\"/supabase\"` means this page's own origin: see `resolveRuntimeSupabaseUrl`. */\n readonly supabaseUrl?: string\n readonly supabaseAnonKey?: string\n /** The platform editor's embedded video editor. */\n readonly freecutUrl?: string\n /** The platform editor's embedded audio editor. */\n readonly audiomassUrl?: string\n /** The language a first-time visitor starts in. */\n readonly defaultLocale?: string\n /** Present only when the deployment configured a surface profile. */\n readonly surface?: RuntimeSurface\n /** The platform editor's upload-moderation capability. */\n readonly moderation?: { readonly uploadImage?: boolean }\n /** A platform editor rollout flag. */\n readonly previewStopRule?: boolean\n /**\n * The https origin this deployment serves user media from\n * (`https://media.example.com`). Present only on a white-label deployment\n * whose public media URL is https; absent, a reader trusts no media host\n * beyond its own site.\n */\n readonly mediaOrigin?: string\n /**\n * The https origin of the app's pages' own host, when this deployment gives\n * them one. Alone (with `linkOrigin`), every host keeps serving the pages\n * and only a browser's saved settings carry over to it. With\n * `legacyUiHosts` too, the pages have moved there, and a page on it calls\n * the API same-origin. Absent: the deployment has one host.\n */\n readonly flowUiOrigin?: string\n /** The hosts the app's pages moved away from (with `flowUiOrigin`): a navigation on one goes to the page's home. Absent: nothing moved. */\n readonly legacyUiHosts?: readonly string[]\n /**\n * The https origin the API keeps, with `flowUiOrigin`: where a browser's\n * saved settings are carried over from and, once the pages have moved\n * (`legacyUiHosts`), the origin developer-facing links name (published\n * apps, embeds, API examples). Absent: the page's own origin, as ever.\n */\n readonly linkOrigin?: string\n}\n\n// ── Rules shared by the platform and its readers ─────────────────────────────\n\n/** Sign-in is SSO-only when SSO is the one method offered. */\nexport function isSsoOnly(methods: readonly unknown[]): boolean {\n return methods.length > 0 && methods.every((m) => m === \"sso\")\n}\n\n/** An explicit `requireSignIn` wins; otherwise a deployment requires sign-in exactly when it is SSO-only. */\nexport function surfaceRequiresSignIn(auth: { readonly methods?: unknown; readonly requireSignIn?: unknown } | undefined): boolean {\n if (typeof auth?.requireSignIn === \"boolean\") return auth.requireSignIn\n return isSsoOnly(strings(auth?.methods))\n}\n\n// Whitespace, control characters and backslashes never belong in a logo\n// reference, and a browser reads `/\\host` as `//host`: another site.\nconst UNSAFE_REF_CHARS = /[\\s\\u0000-\\u001f\\u007f\\\\]/\nconst PROBE_ORIGIN = \"https://origin.invalid\"\n\n/**\n * A brand logo reference a page may load: a path on the page's own site\n * (`/brand/logo.svg`), or an https URL without credentials. A protocol-relative\n * `//host/…`, any other scheme (`http:`, `data:`, `javascript:`) and anything\n * with whitespace or a backslash is not one.\n */\nexport function isBrandLogoRef(value: unknown): value is string {\n if (typeof value !== \"string\" || value.length === 0 || UNSAFE_REF_CHARS.test(value)) return false\n try {\n if (value.startsWith(\"/\")) return !value.startsWith(\"//\") && new URL(value, PROBE_ORIGIN).origin === PROBE_ORIGIN\n const url = new URL(value)\n return url.protocol === \"https:\" && url.hostname.length > 0 && !url.username && !url.password\n } catch {\n return false\n }\n}\n\n// Quotes, angle brackets and backticks would end an HTML attribute that holds\n// the path, and none belongs in a path anyway.\nconst HTML_SPECIAL_CHARS = /[\"'<>`]/\n\n/**\n * A path on the page's own site (`/brand/favicon.svg`, `/icon.png?v=2`): what\n * `brand.favicon` holds, written into the page's `<head>` as a link. Stricter\n * than `isBrandLogoRef`: no URL to another site at all, and no character that\n * could end an HTML attribute.\n */\nexport function isSameSitePath(value: unknown): value is string {\n return typeof value === \"string\" && value.startsWith(\"/\") && !HTML_SPECIAL_CHARS.test(value) && isBrandLogoRef(value)\n}\n\n/**\n * The products whose UI strings a deployment may override, each keyed in\n * `surface.strings` by its id and checked against that product's own\n * dictionary. `flow`: the platform's workflow editor; `tools`: the tools app;\n * `voice`: the voice app. One profile words them all. A product adopts the\n * overrides by adding its id here and giving the platform its key manifest\n * (`uiStringManifestFile`), which a deployment composing the app into one\n * image copies next to Flow's own.\n */\nexport const UI_STRING_PRODUCTS = Object.freeze([\"flow\", \"tools\", \"voice\"] as const)\nexport type UiStringProduct = (typeof UI_STRING_PRODUCTS)[number]\n\n/**\n * What a product's build emits beside its output so the platform can check a\n * deployment's overrides at boot: every key of its base (English) dictionary\n * with the placeholder names that key's text uses, and the locales the product\n * offers. Keys and names only, never the text.\n */\nexport interface UiStringManifest {\n /** The `surface.strings` namespace the dictionary answers to (`UI_STRING_PRODUCTS`). */\n readonly product: string\n /** The locales overrides may target when the deployment sets no `locale.offered`. */\n readonly locales: readonly string[]\n /** Every key a deployment may override → the placeholder names its base text uses, sorted. */\n readonly keys: Readonly<Record<string, readonly string[]>>\n}\n\n/** The manifest's file name, at the root of the product's build output. */\nexport function uiStringManifestFile(product: string): string {\n return `ui-strings-manifest.${product}.json`\n}\n\n// `{name}`: anything else in braces (`{{now}}`, `{image:1}`, `{ variables`) is\n// text, the same way the dictionaries' interpolation reads it.\nconst UI_STRING_PLACEHOLDER = /\\{(\\w+)\\}/g\n\n/** The placeholder names `text` uses, each once, sorted. */\nexport function uiStringPlaceholders(text: string): string[] {\n return [...new Set(Array.from(text.matchAll(UI_STRING_PLACEHOLDER), (m) => m[1]))].sort()\n}\n\n/**\n * The manifest of a base dictionary. A key whose base text is blank is left\n * out: it is grammar data (a word's grammatical gender, the gap between two\n * joined fragments), not wording, and overriding it would only break the\n * sentences built from it.\n */\nexport function buildUiStringManifest(product: string, dict: Readonly<Record<string, string>>, locales: readonly string[]): UiStringManifest {\n const keys = Object.entries(dict)\n .filter(([, text]) => text.trim() !== \"\")\n .map(([key, text]): [string, string[]] => [key, uiStringPlaceholders(text)])\n return { product, locales: [...locales], keys: Object.fromEntries(keys) }\n}\n\n/** The deployment's text for `key` in `locale` of `product`, or undefined. */\nexport function surfaceStringOverride(strings: RuntimeSurfaceStrings | undefined, product: string, locale: string, key: string): string | undefined {\n const byLocale = strings && Object.hasOwn(strings, product) ? strings[product] : undefined\n const texts = byLocale && Object.hasOwn(byLocale, locale) ? byLocale[locale] : undefined\n const text = texts && Object.hasOwn(texts, key) ? texts[key] : undefined\n return typeof text === \"string\" ? text : undefined\n}\n\n/**\n * The deployment's word for its unit in `locale`: the `billing.unitLabels`\n * entry for that language, else its single `unitLabel` (`single`). `labels` is\n * the map as it arrives, on the surface or on a `display` object beside its\n * `unit`.\n */\nexport function surfaceUnitLabel(labels: Readonly<Record<string, string>> | undefined, locale: string | undefined, single: string): string {\n const word = labels && locale !== undefined && Object.hasOwn(labels, locale) ? labels[locale] : undefined\n return typeof word === \"string\" && word.length > 0 ? word : single\n}\n\n/**\n * A host the app's pages move away from, on a deployment that moved them to a\n * host of their own (`LEGACY_UI_HOSTS`, `legacyUiHosts`): a bare host name in\n * lower case, with no scheme, port, path or space. The one rule for it: the\n * server refuses to start on an entry that is not one, and a reader of\n * /config.js drops it.\n */\nexport function isLegacyUiHost(value: unknown): value is string {\n return typeof value === \"string\" && /^[a-z0-9.-]+$/.test(value)\n}\n\n/**\n * An https origin, spelled exactly as a browser spells one\n * (`https://media.example.com`, a port only when it is not 443): what\n * `new URL(src).origin` is compared with, so a path, a trailing slash,\n * credentials, another letter case or any other scheme could never match, and\n * is not one.\n */\nexport function isHttpsOrigin(value: unknown): value is string {\n if (typeof value !== \"string\") return false\n try {\n const url = new URL(value)\n return url.protocol === \"https:\" && url.origin === value\n } catch {\n return false\n }\n}\n\n/**\n * The base a client builds API URLs on. `\"/\"` is the same-origin sentinel (a\n * site answering on more than one hostname cannot name one) and resolves to\n * `\"\"`: build every URL relative to the page. `undefined` when the config names\n * none, so the app keeps its own build-time value. It never makes up a URL.\n */\nexport function resolveRuntimeApiBase(cfg: Pick<NodaroRuntimeConfig, \"apiUrl\"> | undefined): string | undefined {\n const value = typeof cfg?.apiUrl === \"string\" ? cfg.apiUrl.trim() : \"\"\n if (!value) return undefined\n return value === \"/\" ? \"\" : value\n}\n\n/**\n * The Supabase URL a browser client uses. supabase-js needs an absolute URL, so\n * the same-origin sentinel `\"/supabase\"` resolves against `origin`, the page's\n * own (`location.origin`). `undefined` when the config names none.\n */\nexport function resolveRuntimeSupabaseUrl(cfg: Pick<NodaroRuntimeConfig, \"supabaseUrl\"> | undefined, origin: string): string | undefined {\n const value = typeof cfg?.supabaseUrl === \"string\" ? cfg.supabaseUrl.trim() : \"\"\n if (!value) return undefined\n return value === \"/supabase\" ? `${origin.replace(/\\/+$/, \"\")}/supabase` : value\n}\n\n// ── The parser ───────────────────────────────────────────────────────────────\n\ntype Rec = Readonly<Record<string, unknown>>\n\nfunction isRecord(value: unknown): value is Rec {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\nconst record = (value: unknown): Rec => (isRecord(value) ? value : {})\nfunction strings(value: unknown): string[] {\n return Array.isArray(value) ? value.filter((x): x is string => typeof x === \"string\") : []\n}\nconst optional = <K extends string, V>(key: K, value: V | undefined): { [P in K]?: V } =>\n (value === undefined ? {} : { [key]: value }) as { [P in K]?: V }\nconst asString = (value: unknown): string | undefined => (typeof value === \"string\" ? value : undefined)\nconst asBoolean = (value: unknown): boolean | undefined => (typeof value === \"boolean\" ? value : undefined)\n\nfunction siblingApps(value: unknown): RuntimeSurfaceSibling[] {\n if (!Array.isArray(value)) return []\n return value.flatMap((raw) => {\n if (!isRecord(raw) || typeof raw.label !== \"string\" || typeof raw.url !== \"string\") return []\n const byHost = isRecord(raw.urlByHost)\n ? Object.fromEntries(Object.entries(raw.urlByHost).filter((e): e is [string, string] => typeof e[1] === \"string\"))\n : {}\n return [{ label: raw.label, url: raw.url, ...optional(\"urlByHost\", Object.keys(byHost).length ? byHost : undefined) }]\n })\n}\n\nfunction faviconsOf(value: unknown): string[] | undefined {\n const paths = (Array.isArray(value) ? value : [value]).filter(isSameSitePath)\n return paths.length ? [...new Set(paths)] : undefined\n}\n\nfunction brandOf(value: unknown): RuntimeSurfaceBrand {\n const b = record(value)\n return {\n productName: typeof b.productName === \"string\" && b.productName ? b.productName : \"Nodaro\",\n ...optional(\"description\", asString(b.description)),\n ...optional(\"wordmark\", asString(b.wordmark)),\n ...optional(\"platformLinks\", asBoolean(b.platformLinks)),\n ...optional(\"logo\", isBrandLogoRef(b.logo) ? b.logo : undefined),\n ...optional(\"favicon\", faviconsOf(b.favicon)),\n }\n}\n\n/**\n * `surface.strings`, keeping only text: a product, locale or key whose value\n * has the wrong type is left out, and an emptied level with it. Built from\n * entries, so a `\"__proto__\"` key stays an ordinary key. Never throws.\n */\nexport function parseRuntimeStrings(raw: unknown): RuntimeSurfaceStrings {\n const products: [string, Record<string, Record<string, string>>][] = []\n for (const [product, byLocale] of Object.entries(record(raw))) {\n const locales: [string, Record<string, string>][] = []\n for (const [locale, texts] of Object.entries(record(byLocale))) {\n const kept = Object.entries(record(texts)).filter((e): e is [string, string] => typeof e[1] === \"string\")\n if (kept.length) locales.push([locale, Object.fromEntries(kept)])\n }\n if (locales.length) products.push([product, Object.fromEntries(locales)])\n }\n return Object.fromEntries(products)\n}\n\nfunction localeOf(value: unknown): RuntimeSurface[\"locale\"] {\n const l = record(value)\n return {\n ...optional(\"default\", asString(l.default)),\n picker: l.picker !== false,\n ...optional(\"offered\", Array.isArray(l.offered) ? strings(l.offered) : undefined),\n }\n}\n\n/** Text words only, built from entries so a `\"__proto__\"` key stays an ordinary key; nothing usable leaves the key out. */\nfunction unitLabelsOf(value: unknown): Readonly<Record<string, string>> | undefined {\n const words = Object.entries(record(value)).filter((e): e is [string, string] => typeof e[1] === \"string\" && e[1].length > 0)\n return words.length ? Object.fromEntries(words) : undefined\n}\n\nfunction billingOf(value: unknown): RuntimeSurfaceBilling {\n const b = record(value)\n // Both or neither: a label without a rate (or the reverse) would put one\n // unit's name on another unit's numbers. The per-language words stand beside\n // the label, so they live and fall with it.\n const coherent = typeof b.unitLabel === \"string\" && b.unitLabel.length > 0 && typeof b.unitRate === \"number\" && Number.isFinite(b.unitRate) && b.unitRate > 0\n const decimals = typeof b.unitDecimals === \"number\" && Number.isInteger(b.unitDecimals) && b.unitDecimals >= 0 && b.unitDecimals <= 4 ? b.unitDecimals : undefined\n return {\n costTab: b.costTab === \"hidden\" ? \"hidden\" : \"inherit\",\n sidebarCard: b.sidebarCard === \"hidden\" ? \"hidden\" : \"inherit\",\n selfServe: b.selfServe !== false,\n ...(coherent\n ? { unitLabel: b.unitLabel as string, unitRate: b.unitRate as number, ...optional(\"unitDecimals\", decimals), ...optional(\"unitLabels\", unitLabelsOf(b.unitLabels)) }\n : {}),\n }\n}\n\n/** A value outside the known set reads as the restrictive one: a reader older than its platform must not show more. */\nfunction catalogImagesOf(value: unknown): SurfaceCatalogImages {\n if (value === undefined) return \"default\"\n return (SURFACE_CATALOG_IMAGES as readonly unknown[]).includes(value) ? (value as SurfaceCatalogImages) : \"none\"\n}\n\nfunction linksAllowed(value: unknown): boolean {\n if (value === undefined) return true\n if (!isRecord(value)) return false\n return value.links === undefined ? true : value.links === true\n}\n\nfunction headerModeOf(value: unknown): SurfaceHeaderMode {\n return value === undefined || value === \"default\" ? \"default\" : \"white-label\"\n}\n\nfunction worldsOf(value: unknown): SurfaceWorlds {\n if (value === undefined) return {}\n // Present but not an object: offer none rather than everything.\n if (!isRecord(value)) return { allow: [] }\n const allow = value.allow === undefined ? undefined : strings(value.allow)\n const order = Array.isArray(value.order) ? [...new Set(value.order.filter(isWorldId))] : []\n const home: WorldId | undefined = isWorldId(value.home) && (allow === undefined || allow.includes(value.home)) ? value.home : undefined\n return { ...optional(\"allow\", allow), ...optional(\"home\", home), ...optional(\"order\", order.length ? order : undefined) }\n}\n\n/** The surface block of `/config.js`, every default applied. Never throws. */\nexport function parseRuntimeSurface(raw: unknown): RuntimeSurface {\n const s = record(raw)\n const auth = record(s.auth)\n const methods = strings(auth.methods)\n const allowDeny = (v: unknown) => ({ deny: strings(record(v).deny), allow: strings(record(v).allow) })\n const catalogs = record(s.catalogs)\n return {\n nav: { hide: strings(record(s.nav).hide) },\n features: { hide: strings(record(s.features).hide) },\n dashboard: { tabs: strings(record(s.dashboard).tabs) },\n nodes: allowDeny(s.nodes),\n models: allowDeny(s.models),\n auth: { methods, ...optional(\"ssoLabel\", asString(auth.ssoLabel)), requireSignIn: surfaceRequiresSignIn({ methods, requireSignIn: auth.requireSignIn }) },\n siblings: { apps: siblingApps(record(s.siblings).apps) },\n brand: brandOf(s.brand),\n locale: localeOf(s.locale),\n outputs: { allowPublic: record(s.outputs).allowPublic !== false },\n voice: { allowedGenders: strings(record(s.voice).allowedGenders) },\n billing: billingOf(s.billing),\n catalogs: { required: catalogs.required === true, factoryPresets: catalogs.factoryPresets !== false, images: catalogImagesOf(catalogs.images) },\n imports: { links: linksAllowed(s.imports) },\n header: headerModeOf(s.header),\n worlds: worldsOf(s.worlds),\n strings: parseRuntimeStrings(s.strings),\n ...optional(\"catalogPolicy\", s.catalogPolicy),\n }\n}\n\nfunction deepFreeze<T>(value: T): T {\n if (typeof value === \"object\" && value !== null) {\n for (const child of Object.values(value)) deepFreeze(child)\n Object.freeze(value)\n }\n return value\n}\n\n/** The surface a deployment that configured none renders. */\nexport const RUNTIME_SURFACE_DEFAULT: RuntimeSurface = deepFreeze(parseRuntimeSurface(undefined))\n\nconst STRING_KEYS = [\"apiUrl\", \"supabaseUrl\", \"supabaseAnonKey\", \"freecutUrl\", \"audiomassUrl\", \"defaultLocale\"] as const\n\n/**\n * `/config.js`'s object, typed. Keeps each key only when it has the expected\n * type; a blank string is no value. Never throws.\n */\nexport function parseRuntimeConfig(raw: unknown): NodaroRuntimeConfig {\n if (!isRecord(raw)) return {}\n const out: { -readonly [K in keyof NodaroRuntimeConfig]: NodaroRuntimeConfig[K] } = {}\n for (const key of STRING_KEYS) {\n const value = raw[key]\n if (typeof value === \"string\" && value.trim()) out[key] = value.trim()\n }\n if (isRecord(raw.surface)) out.surface = parseRuntimeSurface(raw.surface)\n if (isRecord(raw.moderation) && raw.moderation.uploadImage === true) out.moderation = { uploadImage: true }\n if (raw.previewStopRule === true) out.previewStopRule = true\n if (isHttpsOrigin(raw.mediaOrigin)) out.mediaOrigin = raw.mediaOrigin\n if (isHttpsOrigin(raw.flowUiOrigin)) out.flowUiOrigin = raw.flowUiOrigin\n if (Array.isArray(raw.legacyUiHosts)) {\n const hosts = raw.legacyUiHosts.filter(isLegacyUiHost)\n if (hosts.length > 0) out.legacyUiHosts = hosts\n }\n if (isHttpsOrigin(raw.linkOrigin)) out.linkOrigin = raw.linkOrigin\n return out\n}\n\n/** Read and parse the runtime config `/config.js` set on `scope` (default: the global object). */\nexport function readRuntimeConfig(scope: unknown = globalThis): NodaroRuntimeConfig {\n try {\n return parseRuntimeConfig(isRecord(scope) || typeof scope === \"function\" ? (scope as Rec)[RUNTIME_CONFIG_GLOBAL] : undefined)\n } catch {\n return {}\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/runtime-config/worlds.ts","../src/runtime-config/contract.ts"],"names":["strings"],"mappings":";;;AAaO,IAAM,SAAA,GAAY,MAAA,CAAO,MAAA,CAAO,CAAC,SAAA,EAAW,OAAA,EAAS,OAAA,EAAS,OAAA,EAAS,QAAA,EAAU,QAAA,EAAU,OAAA,EAAS,KAAA,EAAO,QAAQ,CAAU;AAIpI,IAAM,YAAA,GAAoC,IAAI,GAAA,CAAI,SAAS,CAAA;AAEpD,SAAS,UAAU,KAAA,EAAkC;AAC1D,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,YAAA,CAAa,IAAI,KAAK,CAAA;AAC5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AAA,CAAS,CAAA;AAAA,EAC9H,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAC;AAAA,EACV;AACF","file":"chunk-O6TBB4IF.cjs","sourcesContent":["/**\n * The worlds a Nodaro deployment can offer — the tabs of the shared site\n * header, in its canonical display order — and the node types each one runs.\n *\n * A world is offered to a viewer when the deployment's profile allows it\n * (`surface.worlds.allow`, when set) AND every node type it runs is available\n * to that viewer. The platform's `GET /v1/surface/availability` answers both\n * per viewer; this table is the one copy that answer and every client read,\n * so a world is never shown where its runs would be refused.\n *\n * Structural vocabulary only (ids and node-type names), no content.\n */\n\nexport const WORLD_IDS = Object.freeze([\"explore\", \"image\", \"video\", \"music\", \"trends\", \"motion\", \"voice\", \"app\", \"studio\"] as const)\n\nexport type WorldId = (typeof WORLD_IDS)[number]\n\nconst WORLD_ID_SET: ReadonlySet<string> = new Set(WORLD_IDS)\n\nexport function isWorldId(value: unknown): value is WorldId {\n return typeof value === \"string\" && WORLD_ID_SET.has(value)\n}\n\n/**\n * The node types each world runs: a world is offered only while every one of\n * them is available to the viewer. A world with none runs no node of its own\n * and is gated by the allowlist alone: Explore is a showcase, App is the\n * workflow editor (whose nodes are gated one by one inside it), Studio is its\n * own product.\n *\n * - `image`: Generate Image (`POST /v1/generate-image`).\n * - `video`: Generate Video and Text to Video — the world's two routes\n * (`/v1/generate-video` from a start frame, `/v1/text-to-video` from a\n * prompt). The canvas's Image to Video node is not one of them.\n * - `music`: Suno Create Music (`/v1/suno/generate`).\n * - `trends`, `motion`: Cast Swap (`/v1/cast-swap`), the run both worlds start.\n * - `voice`: Voice Changer Pro (`/v1/voice-changer-pro`).\n */\nexport const WORLD_REQUIRED_NODE_TYPES: Readonly<Record<WorldId, readonly string[]>> = Object.freeze({\n explore: Object.freeze([]),\n image: Object.freeze([\"generate-image\"]),\n video: Object.freeze([\"generate-video\", \"text-to-video\"]),\n music: Object.freeze([\"suno-generate\"]),\n trends: Object.freeze([\"cast-swap\"]),\n motion: Object.freeze([\"cast-swap\"]),\n voice: Object.freeze([\"voice-changer-pro\"]),\n app: Object.freeze([]),\n studio: Object.freeze([]),\n})\n\n/** The worlds part of a deployment's surface profile. */\nexport interface SurfaceWorlds {\n /**\n * When PRESENT, exactly these worlds are offered (`[]` offers none). Absent:\n * every world is, subject to its node types. Unlike the profile's other\n * lists, presence is what narrows, so a list whose ids are all unknown\n * offers nothing instead of everything.\n */\n readonly allow?: readonly string[]\n /** The world a visit to the site's root lands on. Always one `allow` lets through. */\n readonly home?: WorldId\n /** Display order; worlds it leaves out follow in canonical order. */\n readonly order?: readonly WorldId[]\n}\n\n/** Does the profile's allowlist let this world through? (Node availability is checked separately.) */\nexport function worldAllowed(worlds: SurfaceWorlds | undefined, id: string): boolean {\n return worlds?.allow === undefined || worlds.allow.includes(id)\n}\n\n/** Every world, `order`'s known ids first (each once), then the rest in canonical order. */\nexport function orderWorlds(order?: readonly string[]): WorldId[] {\n const out: WorldId[] = []\n for (const id of order ?? []) if (isWorldId(id) && !out.includes(id)) out.push(id)\n for (const id of WORLD_IDS) if (!out.includes(id)) out.push(id)\n return out\n}\n","import { isWorldId, type SurfaceWorlds, type WorldId } from \"./worlds.js\"\n\n/**\n * The deployment runtime config — the object a Nodaro platform container\n * writes to `/config.js` at boot as `window.__NODARO_RUNTIME__`, and that every\n * product served from the same site reads before its app starts. One published\n * build then serves any deployment without a rebuild.\n *\n * This module is the contract between that writer and its readers: the key\n * names, their shapes, and a lenient parser. Structural vocabulary only: no\n * content, no prices, nothing about any one deployment. The platform's own\n * schema stays the authority on what a deployment may set. What reaches the\n * page has already been validated there and stripped of every server-only\n * value; this parser only refuses to hand a reader a value of the wrong type.\n */\n\n/** The global `/config.js` assigns. */\nexport const RUNTIME_CONFIG_GLOBAL = \"__NODARO_RUNTIME__\"\n\n/** Every top-level key `/config.js` can carry. */\nexport const RUNTIME_CONFIG_KEYS = Object.freeze([\n \"apiUrl\",\n \"supabaseUrl\",\n \"supabaseAnonKey\",\n \"freecutUrl\",\n \"audiomassUrl\",\n \"defaultLocale\",\n \"surface\",\n \"moderation\",\n \"previewStopRule\",\n \"mediaOrigin\",\n \"flowUiOrigin\",\n \"legacyUiHosts\",\n \"linkOrigin\",\n] as const)\nexport type RuntimeConfigKey = (typeof RUNTIME_CONFIG_KEYS)[number]\n\nexport const SURFACE_HEADER_MODES = Object.freeze([\"default\", \"white-label\"] as const)\n/** `white-label`: the deployment's own header, with no platform links or art. */\nexport type SurfaceHeaderMode = (typeof SURFACE_HEADER_MODES)[number]\n\nexport const SURFACE_CATALOG_IMAGES = Object.freeze([\"default\", \"none\", \"own\"] as const)\n/** Pictures on picker options: the platform's (`default`), none, or the deployment's own (`own`). */\nexport type SurfaceCatalogImages = (typeof SURFACE_CATALOG_IMAGES)[number]\n\nexport interface RuntimeSurfaceSibling {\n readonly label: string\n readonly url: string\n readonly urlByHost?: Readonly<Record<string, string>>\n}\n\nexport interface RuntimeSurfaceBrand {\n readonly productName: string\n readonly description?: string\n readonly wordmark?: string\n readonly platformLinks?: boolean\n /** A same-site path (`/brand/logo.svg`) or an https URL. */\n readonly logo?: string\n /** The page's icons, each a path on this site (`/brand/favicon.svg`): see `isSameSitePath`. */\n readonly favicon?: readonly string[]\n}\n\n/**\n * Overrides of a product's UI strings, `product → locale id → message key →\n * text`. Each product reads only its own namespace (`UI_STRING_PRODUCTS`). The\n * platform checks every entry against that product's dictionary before it\n * reaches a page: the key exists, the locale is one the deployment offers, the\n * text is plain and keeps the base string's `{placeholders}`.\n */\nexport type RuntimeSurfaceStrings = Readonly<Record<string, Readonly<Record<string, Readonly<Record<string, string>>>>>>\n\n/** The display side of billing. The server-only billing keys never reach a page. */\nexport interface RuntimeSurfaceBilling {\n readonly costTab: \"inherit\" | \"hidden\"\n readonly sidebarCard: \"inherit\" | \"hidden\"\n readonly selfServe: boolean\n readonly unitLabel?: string\n readonly unitRate?: number\n readonly unitDecimals?: number\n /**\n * The unit's word per interface language, beside the single `unitLabel`: a\n * language the deployment gives no word for uses `unitLabel`. Read with\n * `surfaceUnitLabel`.\n */\n readonly unitLabels?: Readonly<Record<string, string>>\n}\n\n/**\n * The deployment's surface profile as a page receives it, with every default\n * applied. Lists that are empty keep the product's own default, except\n * `worlds.allow` (see `SurfaceWorlds`).\n */\nexport interface RuntimeSurface {\n readonly nav: { readonly hide: readonly string[] }\n readonly features: { readonly hide: readonly string[] }\n readonly dashboard: { readonly tabs: readonly string[] }\n readonly nodes: { readonly deny: readonly string[]; readonly allow: readonly string[] }\n readonly models: { readonly deny: readonly string[]; readonly allow: readonly string[] }\n /** `requireSignIn`: no guest visits. When the deployment does not say, true exactly when sign-in is SSO-only. */\n readonly auth: { readonly methods: readonly string[]; readonly ssoLabel?: string; readonly requireSignIn: boolean }\n readonly siblings: { readonly apps: readonly RuntimeSurfaceSibling[] }\n readonly brand: RuntimeSurfaceBrand\n /** `offered`: the languages a visitor may pick from; absent = every language the product ships. */\n readonly locale: { readonly default?: string; readonly picker: boolean; readonly offered?: readonly string[] }\n readonly outputs: { readonly allowPublic: boolean }\n readonly voice: { readonly allowedGenders: readonly string[] }\n readonly billing: RuntimeSurfaceBilling\n readonly catalogs: { readonly required: boolean; readonly factoryPresets: boolean; readonly images: SurfaceCatalogImages }\n /** `links`: whether media may be imported from a link to another site. */\n readonly imports: { readonly links: boolean }\n readonly header: SurfaceHeaderMode\n readonly worlds: SurfaceWorlds\n /** The deployment's own wording for UI strings; `{}` = none. Read with `surfaceStringOverride`. */\n readonly strings: RuntimeSurfaceStrings\n /** Carried as given; no reader acts on it. */\n readonly catalogPolicy?: unknown\n}\n\nexport interface NodaroRuntimeConfig {\n /** The API base. `\"/\"` means this page's own origin: see `resolveRuntimeApiBase`. */\n readonly apiUrl?: string\n /** The Supabase URL. `\"/supabase\"` means this page's own origin: see `resolveRuntimeSupabaseUrl`. */\n readonly supabaseUrl?: string\n readonly supabaseAnonKey?: string\n /** The platform editor's embedded video editor. */\n readonly freecutUrl?: string\n /** The platform editor's embedded audio editor. */\n readonly audiomassUrl?: string\n /** The language a first-time visitor starts in. */\n readonly defaultLocale?: string\n /** Present only when the deployment configured a surface profile. */\n readonly surface?: RuntimeSurface\n /** The platform editor's upload-moderation capability. */\n readonly moderation?: { readonly uploadImage?: boolean }\n /** A platform editor rollout flag. */\n readonly previewStopRule?: boolean\n /**\n * The https origin this deployment serves user media from\n * (`https://media.example.com`). Present only on a white-label deployment\n * whose public media URL is https; absent, a reader trusts no media host\n * beyond its own site.\n */\n readonly mediaOrigin?: string\n /**\n * The https origin of the app's pages' own host, when this deployment gives\n * them one. Alone (with `linkOrigin`), every host keeps serving the pages\n * and only a browser's saved settings carry over to it. With\n * `legacyUiHosts` too, the pages have moved there, and a page on it calls\n * the API same-origin. Absent: the deployment has one host.\n */\n readonly flowUiOrigin?: string\n /** The hosts the app's pages moved away from (with `flowUiOrigin`): a navigation on one goes to the page's home. Absent: nothing moved. */\n readonly legacyUiHosts?: readonly string[]\n /**\n * The https origin the API keeps, with `flowUiOrigin`: where a browser's\n * saved settings are carried over from and, once the pages have moved\n * (`legacyUiHosts`), the origin developer-facing links name (published\n * apps, embeds, API examples). Absent: the page's own origin, as ever.\n */\n readonly linkOrigin?: string\n}\n\n// ── Rules shared by the platform and its readers ─────────────────────────────\n\n/** Sign-in is SSO-only when SSO is the one method offered. */\nexport function isSsoOnly(methods: readonly unknown[]): boolean {\n return methods.length > 0 && methods.every((m) => m === \"sso\")\n}\n\n/** An explicit `requireSignIn` wins; otherwise a deployment requires sign-in exactly when it is SSO-only. */\nexport function surfaceRequiresSignIn(auth: { readonly methods?: unknown; readonly requireSignIn?: unknown } | undefined): boolean {\n if (typeof auth?.requireSignIn === \"boolean\") return auth.requireSignIn\n return isSsoOnly(strings(auth?.methods))\n}\n\n// Whitespace, control characters and backslashes never belong in a logo\n// reference, and a browser reads `/\\host` as `//host`: another site.\nconst UNSAFE_REF_CHARS = /[\\s\\u0000-\\u001f\\u007f\\\\]/\nconst PROBE_ORIGIN = \"https://origin.invalid\"\n\n/**\n * A brand logo reference a page may load: a path on the page's own site\n * (`/brand/logo.svg`), or an https URL without credentials. A protocol-relative\n * `//host/…`, any other scheme (`http:`, `data:`, `javascript:`) and anything\n * with whitespace or a backslash is not one.\n */\nexport function isBrandLogoRef(value: unknown): value is string {\n if (typeof value !== \"string\" || value.length === 0 || UNSAFE_REF_CHARS.test(value)) return false\n try {\n if (value.startsWith(\"/\")) return !value.startsWith(\"//\") && new URL(value, PROBE_ORIGIN).origin === PROBE_ORIGIN\n const url = new URL(value)\n return url.protocol === \"https:\" && url.hostname.length > 0 && !url.username && !url.password\n } catch {\n return false\n }\n}\n\n// Quotes, angle brackets and backticks would end an HTML attribute that holds\n// the path, and none belongs in a path anyway.\nconst HTML_SPECIAL_CHARS = /[\"'<>`]/\n\n/**\n * A path on the page's own site (`/brand/favicon.svg`, `/icon.png?v=2`): what\n * `brand.favicon` holds, written into the page's `<head>` as a link. Stricter\n * than `isBrandLogoRef`: no URL to another site at all, and no character that\n * could end an HTML attribute.\n */\nexport function isSameSitePath(value: unknown): value is string {\n return typeof value === \"string\" && value.startsWith(\"/\") && !HTML_SPECIAL_CHARS.test(value) && isBrandLogoRef(value)\n}\n\n/**\n * The products whose UI strings a deployment may override, each keyed in\n * `surface.strings` by its id and checked against that product's own\n * dictionary. `flow`: the platform's workflow editor; `tools`: the tools app;\n * `voice`: the voice app. One profile words them all. A product adopts the\n * overrides by adding its id here and giving the platform its key manifest\n * (`uiStringManifestFile`), which a deployment composing the app into one\n * image copies next to Flow's own.\n */\nexport const UI_STRING_PRODUCTS = Object.freeze([\"flow\", \"tools\", \"voice\"] as const)\nexport type UiStringProduct = (typeof UI_STRING_PRODUCTS)[number]\n\n/**\n * What a product's build emits beside its output so the platform can check a\n * deployment's overrides at boot: every key of its base (English) dictionary\n * with the placeholder names that key's text uses, and the locales the product\n * offers. Keys and names only, never the text.\n */\nexport interface UiStringManifest {\n /** The `surface.strings` namespace the dictionary answers to (`UI_STRING_PRODUCTS`). */\n readonly product: string\n /** The locales overrides may target when the deployment sets no `locale.offered`. */\n readonly locales: readonly string[]\n /** Every key a deployment may override → the placeholder names its base text uses, sorted. */\n readonly keys: Readonly<Record<string, readonly string[]>>\n}\n\n/** The manifest's file name, at the root of the product's build output. */\nexport function uiStringManifestFile(product: string): string {\n return `ui-strings-manifest.${product}.json`\n}\n\n// `{name}`: anything else in braces (`{{now}}`, `{image:1}`, `{ variables`) is\n// text, the same way the dictionaries' interpolation reads it.\nconst UI_STRING_PLACEHOLDER = /\\{(\\w+)\\}/g\n\n/** The placeholder names `text` uses, each once, sorted. */\nexport function uiStringPlaceholders(text: string): string[] {\n return [...new Set(Array.from(text.matchAll(UI_STRING_PLACEHOLDER), (m) => m[1]))].sort()\n}\n\n/**\n * The manifest of a base dictionary. A key whose base text is blank is left\n * out: it is grammar data (a word's grammatical gender, the gap between two\n * joined fragments), not wording, and overriding it would only break the\n * sentences built from it.\n */\nexport function buildUiStringManifest(product: string, dict: Readonly<Record<string, string>>, locales: readonly string[]): UiStringManifest {\n const keys = Object.entries(dict)\n .filter(([, text]) => text.trim() !== \"\")\n .map(([key, text]): [string, string[]] => [key, uiStringPlaceholders(text)])\n return { product, locales: [...locales], keys: Object.fromEntries(keys) }\n}\n\n/** The deployment's text for `key` in `locale` of `product`, or undefined. */\nexport function surfaceStringOverride(strings: RuntimeSurfaceStrings | undefined, product: string, locale: string, key: string): string | undefined {\n const byLocale = strings && Object.hasOwn(strings, product) ? strings[product] : undefined\n const texts = byLocale && Object.hasOwn(byLocale, locale) ? byLocale[locale] : undefined\n const text = texts && Object.hasOwn(texts, key) ? texts[key] : undefined\n return typeof text === \"string\" ? text : undefined\n}\n\n/**\n * The deployment's word for its unit in `locale`: the `billing.unitLabels`\n * entry for that language, else its single `unitLabel` (`single`). `labels` is\n * the map as it arrives, on the surface or on a `display` object beside its\n * `unit`.\n */\nexport function surfaceUnitLabel(labels: Readonly<Record<string, string>> | undefined, locale: string | undefined, single: string): string {\n const word = labels && locale !== undefined && Object.hasOwn(labels, locale) ? labels[locale] : undefined\n return typeof word === \"string\" && word.length > 0 ? word : single\n}\n\n/**\n * A host the app's pages move away from, on a deployment that moved them to a\n * host of their own (`LEGACY_UI_HOSTS`, `legacyUiHosts`): a bare host name in\n * lower case, with no scheme, port, path or space. The one rule for it: the\n * server refuses to start on an entry that is not one, and a reader of\n * /config.js drops it.\n */\nexport function isLegacyUiHost(value: unknown): value is string {\n return typeof value === \"string\" && /^[a-z0-9.-]+$/.test(value)\n}\n\n/**\n * An https origin, spelled exactly as a browser spells one\n * (`https://media.example.com`, a port only when it is not 443): what\n * `new URL(src).origin` is compared with, so a path, a trailing slash,\n * credentials, another letter case or any other scheme could never match, and\n * is not one.\n */\nexport function isHttpsOrigin(value: unknown): value is string {\n if (typeof value !== \"string\") return false\n try {\n const url = new URL(value)\n return url.protocol === \"https:\" && url.origin === value\n } catch {\n return false\n }\n}\n\n/**\n * The base a client builds API URLs on. `\"/\"` is the same-origin sentinel (a\n * site answering on more than one hostname cannot name one) and resolves to\n * `\"\"`: build every URL relative to the page. `undefined` when the config names\n * none, so the app keeps its own build-time value. It never makes up a URL.\n */\nexport function resolveRuntimeApiBase(cfg: Pick<NodaroRuntimeConfig, \"apiUrl\"> | undefined): string | undefined {\n const value = typeof cfg?.apiUrl === \"string\" ? cfg.apiUrl.trim() : \"\"\n if (!value) return undefined\n return value === \"/\" ? \"\" : value\n}\n\n/**\n * The Supabase URL a browser client uses. supabase-js needs an absolute URL, so\n * the same-origin sentinel `\"/supabase\"` resolves against `origin`, the page's\n * own (`location.origin`). `undefined` when the config names none.\n */\nexport function resolveRuntimeSupabaseUrl(cfg: Pick<NodaroRuntimeConfig, \"supabaseUrl\"> | undefined, origin: string): string | undefined {\n const value = typeof cfg?.supabaseUrl === \"string\" ? cfg.supabaseUrl.trim() : \"\"\n if (!value) return undefined\n return value === \"/supabase\" ? `${origin.replace(/\\/+$/, \"\")}/supabase` : value\n}\n\n// ── The parser ───────────────────────────────────────────────────────────────\n\ntype Rec = Readonly<Record<string, unknown>>\n\nfunction isRecord(value: unknown): value is Rec {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\nconst record = (value: unknown): Rec => (isRecord(value) ? value : {})\nfunction strings(value: unknown): string[] {\n return Array.isArray(value) ? value.filter((x): x is string => typeof x === \"string\") : []\n}\nconst optional = <K extends string, V>(key: K, value: V | undefined): { [P in K]?: V } =>\n (value === undefined ? {} : { [key]: value }) as { [P in K]?: V }\nconst asString = (value: unknown): string | undefined => (typeof value === \"string\" ? value : undefined)\nconst asBoolean = (value: unknown): boolean | undefined => (typeof value === \"boolean\" ? value : undefined)\n\nfunction siblingApps(value: unknown): RuntimeSurfaceSibling[] {\n if (!Array.isArray(value)) return []\n return value.flatMap((raw) => {\n if (!isRecord(raw) || typeof raw.label !== \"string\" || typeof raw.url !== \"string\") return []\n const byHost = isRecord(raw.urlByHost)\n ? Object.fromEntries(Object.entries(raw.urlByHost).filter((e): e is [string, string] => typeof e[1] === \"string\"))\n : {}\n return [{ label: raw.label, url: raw.url, ...optional(\"urlByHost\", Object.keys(byHost).length ? byHost : undefined) }]\n })\n}\n\nfunction faviconsOf(value: unknown): string[] | undefined {\n const paths = (Array.isArray(value) ? value : [value]).filter(isSameSitePath)\n return paths.length ? [...new Set(paths)] : undefined\n}\n\nfunction brandOf(value: unknown): RuntimeSurfaceBrand {\n const b = record(value)\n return {\n productName: typeof b.productName === \"string\" && b.productName ? b.productName : \"Nodaro\",\n ...optional(\"description\", asString(b.description)),\n ...optional(\"wordmark\", asString(b.wordmark)),\n ...optional(\"platformLinks\", asBoolean(b.platformLinks)),\n ...optional(\"logo\", isBrandLogoRef(b.logo) ? b.logo : undefined),\n ...optional(\"favicon\", faviconsOf(b.favicon)),\n }\n}\n\n/**\n * `surface.strings`, keeping only text: a product, locale or key whose value\n * has the wrong type is left out, and an emptied level with it. Built from\n * entries, so a `\"__proto__\"` key stays an ordinary key. Never throws.\n */\nexport function parseRuntimeStrings(raw: unknown): RuntimeSurfaceStrings {\n const products: [string, Record<string, Record<string, string>>][] = []\n for (const [product, byLocale] of Object.entries(record(raw))) {\n const locales: [string, Record<string, string>][] = []\n for (const [locale, texts] of Object.entries(record(byLocale))) {\n const kept = Object.entries(record(texts)).filter((e): e is [string, string] => typeof e[1] === \"string\")\n if (kept.length) locales.push([locale, Object.fromEntries(kept)])\n }\n if (locales.length) products.push([product, Object.fromEntries(locales)])\n }\n return Object.fromEntries(products)\n}\n\nfunction localeOf(value: unknown): RuntimeSurface[\"locale\"] {\n const l = record(value)\n return {\n ...optional(\"default\", asString(l.default)),\n picker: l.picker !== false,\n ...optional(\"offered\", Array.isArray(l.offered) ? strings(l.offered) : undefined),\n }\n}\n\n/** Text words only, built from entries so a `\"__proto__\"` key stays an ordinary key; nothing usable leaves the key out. */\nfunction unitLabelsOf(value: unknown): Readonly<Record<string, string>> | undefined {\n const words = Object.entries(record(value)).filter((e): e is [string, string] => typeof e[1] === \"string\" && e[1].length > 0)\n return words.length ? Object.fromEntries(words) : undefined\n}\n\nfunction billingOf(value: unknown): RuntimeSurfaceBilling {\n const b = record(value)\n // Both or neither: a label without a rate (or the reverse) would put one\n // unit's name on another unit's numbers. The per-language words stand beside\n // the label, so they live and fall with it.\n const coherent = typeof b.unitLabel === \"string\" && b.unitLabel.length > 0 && typeof b.unitRate === \"number\" && Number.isFinite(b.unitRate) && b.unitRate > 0\n const decimals = typeof b.unitDecimals === \"number\" && Number.isInteger(b.unitDecimals) && b.unitDecimals >= 0 && b.unitDecimals <= 4 ? b.unitDecimals : undefined\n return {\n costTab: b.costTab === \"hidden\" ? \"hidden\" : \"inherit\",\n sidebarCard: b.sidebarCard === \"hidden\" ? \"hidden\" : \"inherit\",\n selfServe: b.selfServe !== false,\n ...(coherent\n ? { unitLabel: b.unitLabel as string, unitRate: b.unitRate as number, ...optional(\"unitDecimals\", decimals), ...optional(\"unitLabels\", unitLabelsOf(b.unitLabels)) }\n : {}),\n }\n}\n\n/** A value outside the known set reads as the restrictive one: a reader older than its platform must not show more. */\nfunction catalogImagesOf(value: unknown): SurfaceCatalogImages {\n if (value === undefined) return \"default\"\n return (SURFACE_CATALOG_IMAGES as readonly unknown[]).includes(value) ? (value as SurfaceCatalogImages) : \"none\"\n}\n\nfunction linksAllowed(value: unknown): boolean {\n if (value === undefined) return true\n if (!isRecord(value)) return false\n return value.links === undefined ? true : value.links === true\n}\n\nfunction headerModeOf(value: unknown): SurfaceHeaderMode {\n return value === undefined || value === \"default\" ? \"default\" : \"white-label\"\n}\n\nfunction worldsOf(value: unknown): SurfaceWorlds {\n if (value === undefined) return {}\n // Present but not an object: offer none rather than everything.\n if (!isRecord(value)) return { allow: [] }\n const allow = value.allow === undefined ? undefined : strings(value.allow)\n const order = Array.isArray(value.order) ? [...new Set(value.order.filter(isWorldId))] : []\n const home: WorldId | undefined = isWorldId(value.home) && (allow === undefined || allow.includes(value.home)) ? value.home : undefined\n return { ...optional(\"allow\", allow), ...optional(\"home\", home), ...optional(\"order\", order.length ? order : undefined) }\n}\n\n/** The surface block of `/config.js`, every default applied. Never throws. */\nexport function parseRuntimeSurface(raw: unknown): RuntimeSurface {\n const s = record(raw)\n const auth = record(s.auth)\n const methods = strings(auth.methods)\n const allowDeny = (v: unknown) => ({ deny: strings(record(v).deny), allow: strings(record(v).allow) })\n const catalogs = record(s.catalogs)\n return {\n nav: { hide: strings(record(s.nav).hide) },\n features: { hide: strings(record(s.features).hide) },\n dashboard: { tabs: strings(record(s.dashboard).tabs) },\n nodes: allowDeny(s.nodes),\n models: allowDeny(s.models),\n auth: { methods, ...optional(\"ssoLabel\", asString(auth.ssoLabel)), requireSignIn: surfaceRequiresSignIn({ methods, requireSignIn: auth.requireSignIn }) },\n siblings: { apps: siblingApps(record(s.siblings).apps) },\n brand: brandOf(s.brand),\n locale: localeOf(s.locale),\n outputs: { allowPublic: record(s.outputs).allowPublic !== false },\n voice: { allowedGenders: strings(record(s.voice).allowedGenders) },\n billing: billingOf(s.billing),\n catalogs: { required: catalogs.required === true, factoryPresets: catalogs.factoryPresets !== false, images: catalogImagesOf(catalogs.images) },\n imports: { links: linksAllowed(s.imports) },\n header: headerModeOf(s.header),\n worlds: worldsOf(s.worlds),\n strings: parseRuntimeStrings(s.strings),\n ...optional(\"catalogPolicy\", s.catalogPolicy),\n }\n}\n\nfunction deepFreeze<T>(value: T): T {\n if (typeof value === \"object\" && value !== null) {\n for (const child of Object.values(value)) deepFreeze(child)\n Object.freeze(value)\n }\n return value\n}\n\n/** The surface a deployment that configured none renders. */\nexport const RUNTIME_SURFACE_DEFAULT: RuntimeSurface = deepFreeze(parseRuntimeSurface(undefined))\n\nconst STRING_KEYS = [\"apiUrl\", \"supabaseUrl\", \"supabaseAnonKey\", \"freecutUrl\", \"audiomassUrl\", \"defaultLocale\"] as const\n\n/**\n * `/config.js`'s object, typed. Keeps each key only when it has the expected\n * type; a blank string is no value. Never throws.\n */\nexport function parseRuntimeConfig(raw: unknown): NodaroRuntimeConfig {\n if (!isRecord(raw)) return {}\n const out: { -readonly [K in keyof NodaroRuntimeConfig]: NodaroRuntimeConfig[K] } = {}\n for (const key of STRING_KEYS) {\n const value = raw[key]\n if (typeof value === \"string\" && value.trim()) out[key] = value.trim()\n }\n if (isRecord(raw.surface)) out.surface = parseRuntimeSurface(raw.surface)\n if (isRecord(raw.moderation) && raw.moderation.uploadImage === true) out.moderation = { uploadImage: true }\n if (raw.previewStopRule === true) out.previewStopRule = true\n if (isHttpsOrigin(raw.mediaOrigin)) out.mediaOrigin = raw.mediaOrigin\n if (isHttpsOrigin(raw.flowUiOrigin)) out.flowUiOrigin = raw.flowUiOrigin\n if (Array.isArray(raw.legacyUiHosts)) {\n const hosts = raw.legacyUiHosts.filter(isLegacyUiHost)\n if (hosts.length > 0) out.legacyUiHosts = hosts\n }\n if (isHttpsOrigin(raw.linkOrigin)) out.linkOrigin = raw.linkOrigin\n return out\n}\n\n/** Read and parse the runtime config `/config.js` set on `scope` (default: the global object). */\nexport function readRuntimeConfig(scope: unknown = globalThis): NodaroRuntimeConfig {\n try {\n return parseRuntimeConfig(isRecord(scope) || typeof scope === \"function\" ? (scope as Rec)[RUNTIME_CONFIG_GLOBAL] : undefined)\n } catch {\n return {}\n }\n}\n"]}