athar-mcp 0.1.0 → 0.2.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 (196) hide show
  1. package/dashboard/.output/nitro.json +15 -0
  2. package/dashboard/.output/public/_fonts/31PZhXd_YTCmsoiPQZc-xVtAWAkLogRFRj5mWplmKFE-6WsTw05QKugcwLySGc_b9CIheG8j8LRyo47qPL430Mk.woff2 +0 -0
  3. package/dashboard/.output/public/_fonts/3e3wuf-V_7icWvlsSS3Ud6R1mFSymwsfz35VcqiVjOk-jnii4_jMs7YAJOhzZP3bGdrbXGt5dYv8_t_rhpHzpcQ.woff2 +0 -0
  4. package/dashboard/.output/public/_fonts/3mk1pEYaO7RuhctnlpKcyb7yjVLICedncSfY13ffbM8-vJidvBvYJRk77_zQIyVpja44ymm1FQTiYKUcM_aD5Sg.woff2 +0 -0
  5. package/dashboard/.output/public/_fonts/9FWLUGCSCYLRIRMtCzLrt4Go7DMFXOeN_pyCOJD_44Y-Yh2wNaqrq_e759vVlc3tX81lMwRu9ktkQJX_Svgs-VI.woff2 +0 -0
  6. package/dashboard/.output/public/_fonts/9IZYb3o3tpRXPqjzNd4r3vIIohLuRBC5-h_ByvqRowU-ZgMUMfi6FcHpaV_ucYIWcBvLG6geajFq70Smps0DAj0.woff2 +0 -0
  7. package/dashboard/.output/public/_fonts/AA0_6TP-Ed9gQINhOsvbweBE3xLQgxmg6pXqHmvCwsM-egZLwYC5qVnfGWql7G5NfYTIiMP1PB_tQWIq5f7S-0k.woff2 +0 -0
  8. package/dashboard/.output/public/_fonts/BQnDL9FFy0Q_jvURlmv87luvmXLSMbSuXsfZv_R2Rkk-y5MVrLtP4J_1al8rz8R-MDaUOMAHckAWCwDrKhw25fY.woff2 +0 -0
  9. package/dashboard/.output/public/_fonts/Df7M9JXECnQBPeMk0JlWv5oI4E80OSjKvG82PCAX-MI-aXpKyr1n0W6NWbCApKANrm9O50H_fjFMdBzwfTY75iM.woff2 +0 -0
  10. package/dashboard/.output/public/_fonts/F00Bxq4ciZESODR5suhK3xDWcsQ9RLj9SyZQEevpEsw-BLNEvb6wAcL3fpb4n4d3zVEKUoa2hsUKxxkf3YdvJKc.woff2 +0 -0
  11. package/dashboard/.output/public/_fonts/HsvEuay0nMOs_2ObxMGaCaFlKdRnnDmfWeFTeRbjAVE-UeGuS_NHKiKleun7gcayWaUNaV2zWnEeGUxJVueLYm0.woff +0 -0
  12. package/dashboard/.output/public/_fonts/JSrPAbQHsQEdUrIE5Ts6fIQ2ymsa4i7HhiCpui6ulCc-_AoyGWssOn06OMh3ZY_GddBBPRny4Igxin4fT_1K6F4.woff2 +0 -0
  13. package/dashboard/.output/public/_fonts/Jtqhy44WKYEjGWTSusP5YJfJv7Wf74QqgkBOI9u_77s-Rl_Bht5SvmaotE20bkavBEAJEEGEa0hcz3d_8yOeXmw.woff +0 -0
  14. package/dashboard/.output/public/_fonts/KOrIgK47CByspZJWjOLg8AL2ADg9uFcNjZd9W78jrmM-dU37DP77KwUzMqqldljJHhSe3lJpaSfI9HPfiVAxPOM.woff2 +0 -0
  15. package/dashboard/.output/public/_fonts/M-60tFLmAJxdPjHsK-2ILWom5zPbu37lb3Qex2waL14-A9y4QcXALPi_RvQsmRsSFUxrT3_J213W4zPFIXetlbw.woff2 +0 -0
  16. package/dashboard/.output/public/_fonts/NwLHmPccLrJlBVGp4QRXOLZaNI0M_K6XuSwyVjpr47g-jl4tqz8gcsgAJDPcbl5roY78zy31I6Rq51WBLpZngFg.woff2 +0 -0
  17. package/dashboard/.output/public/_fonts/T-ozk-QJ_Ck37B2RHPl2i-s_gAGGo7suFgagWoJ8bO4-maDXQ_nEXKAaLHm4Joud3DJR9EVzS7QXWMWK8YOTIcs.woff2 +0 -0
  18. package/dashboard/.output/public/_fonts/TTYbISAfwy-y4uVGS9AH32sK7b2xJsoCESo64ryf8LU-y87nRMqBGo42rUOW9tWZa06o4oTa0USJrAMMoKDamgs.woff2 +0 -0
  19. package/dashboard/.output/public/_fonts/Y_5DOsLit49q2i2tbcNxnyUen9__GPCX8mwAi03q1aA-pBCjVKDT5tBT3BJckh9uzNkfUWeUIBPz9Y8T55vcj8E.woff2 +0 -0
  20. package/dashboard/.output/public/_fonts/ZHaz3DhCHNWhsElqYfuM71rfBBDgjuU2sd34vaYJwQg-71NZaZSGjxzAGjCMnCc2zS5rS_EGA0xHKPGCggWuXik.woff +0 -0
  21. package/dashboard/.output/public/_fonts/_lyVj3lEzRng_G7gZNcCmL83BnMEos-Hf8bpHLMzGQI-zsVE1T2QbmkXlEbQhs2gb3j3VBOOGhzqyW_ZW_0s3F8.woff2 +0 -0
  22. package/dashboard/.output/public/_fonts/bUcXp2ExGsFoCjH4L_AiPGX0TLCAgnqR8nvW7SxSJYQ-kvm9UWc_MFZW_r85yX6uPdzXVmdcUOio_Wb1x_7QdXM.woff2 +0 -0
  23. package/dashboard/.output/public/_fonts/f3COenLcoezM74LmVz7-HHQTyPKopVoMY6x2syLMzQE-shPZYE7IAjZWz4okT_CWn96WfGzoLhasK43_mhj3CZI.woff2 +0 -0
  24. package/dashboard/.output/public/_fonts/h9PwCjip_BNPVO50hT4v29USWFv6H3ZlYx_IestfqgY-sYfLVuZXl9E1aYbn1S0pAr4zfdQ_WT7iBZhrgQY6N-4.woff2 +0 -0
  25. package/dashboard/.output/public/_fonts/l00UCz_-QvI_NO8AGcu7ooAcrFDlxYUdxCSCh6gBwd4-vPjTZ3ztgw27A2TnHeCycxPvUtXWEVpG33_97ra6su8.woff2 +0 -0
  26. package/dashboard/.output/public/_fonts/nuenOq7ZFSZ65QudJO7uQ0sOjDqow2WjfXrQh4S9gEc-uF81rxcswER5srfhzyLfPoGlKNAIt2C_BvkXFOc19rw.woff2 +0 -0
  27. package/dashboard/.output/public/_fonts/pWMvGwciZ-EfQsfR2ueelhC7Jnt5K-8Px8PjPK0mDII-eT9iD0iZ9WWhTJs6V5GxXr0iaUwx_WxgGGriOiGb81o.woff2 +0 -0
  28. package/dashboard/.output/public/_fonts/sqxfSu-14RfawvZSbzb3mPoBYaXxmTGIac1Kk0GVk_w-oe_5KiWXPVdvpURHWSiaIjA1N_zLqpjSzmfpwRHr7CQ.woff2 +0 -0
  29. package/dashboard/.output/public/_fonts/wMdBqIWtsuS5eTYXRFwACf6n6oW2h-j42f90vWIPIO8-vrVOc_lrScYZMKO0_R3igKLheJfV2qZ3c5qlWOY0LDQ.woff +0 -0
  30. package/dashboard/.output/public/_fonts/y3mP_zJcojQwJn30TpF_XxDzgeM6Nbk7MaRg1Ne0YcI-lFx13nqMCMgk_S70gRmwEHXlE5BLp1B4W82RpFihpMs.woff2 +0 -0
  31. package/dashboard/.output/public/_fonts/zr3WxpLd5PmlBr7e4PWGkhZv6XTg70Pi4sCbC-CEV0Q-v2yL98XOiD3FkbiYlYYeAeTSVSkgAckeOp55Q5kHJmU.woff2 +0 -0
  32. package/dashboard/.output/public/_nuxt/B0Bu7wg2.js +1 -0
  33. package/dashboard/.output/public/_nuxt/BNBS3IWx.js +1 -0
  34. package/dashboard/.output/public/_nuxt/Ba3u15ft.js +1 -0
  35. package/dashboard/.output/public/_nuxt/CH7yjz82.js +4 -0
  36. package/dashboard/.output/public/_nuxt/COkkU9In.js +1 -0
  37. package/dashboard/.output/public/_nuxt/C_XEhq4z.js +1 -0
  38. package/dashboard/.output/public/_nuxt/YOlRD-cU.js +1 -0
  39. package/dashboard/.output/public/_nuxt/_id_.Dz86UAW3.css +1 -0
  40. package/dashboard/.output/public/_nuxt/builds/latest.json +1 -0
  41. package/dashboard/.output/public/_nuxt/builds/meta/a6e303b2-379a-45a9-8bdf-906e96134fda.json +1 -0
  42. package/dashboard/.output/public/_nuxt/entry.D51cHmax.css +1 -0
  43. package/dashboard/.output/public/_nuxt/error-404.C3kT2QX-.css +1 -0
  44. package/dashboard/.output/public/_nuxt/error-500.BW0Y54Of.css +1 -0
  45. package/dashboard/.output/public/_nuxt/fpe_5SoV.js +1 -0
  46. package/dashboard/.output/server/chunks/_/db.mjs +27 -0
  47. package/dashboard/.output/server/chunks/_/db.mjs.map +1 -0
  48. package/dashboard/.output/server/chunks/_/error-500.mjs +19 -0
  49. package/dashboard/.output/server/chunks/_/error-500.mjs.map +1 -0
  50. package/dashboard/.output/server/chunks/build/_id_-CQaF66RF.mjs +139 -0
  51. package/dashboard/.output/server/chunks/build/_id_-CQaF66RF.mjs.map +1 -0
  52. package/dashboard/.output/server/chunks/build/_id_-styles.DKwggH1p.mjs +8 -0
  53. package/dashboard/.output/server/chunks/build/_id_-styles.DKwggH1p.mjs.map +1 -0
  54. package/dashboard/.output/server/chunks/build/app-styles.nHRnXOH3.mjs +25 -0
  55. package/dashboard/.output/server/chunks/build/app-styles.nHRnXOH3.mjs.map +1 -0
  56. package/dashboard/.output/server/chunks/build/client.precomputed.mjs +4 -0
  57. package/dashboard/.output/server/chunks/build/client.precomputed.mjs.map +1 -0
  58. package/dashboard/.output/server/chunks/build/composables-lps5heb5.mjs +23 -0
  59. package/dashboard/.output/server/chunks/build/composables-lps5heb5.mjs.map +1 -0
  60. package/dashboard/.output/server/chunks/build/error-404-D0Xi6cQ6.mjs +92 -0
  61. package/dashboard/.output/server/chunks/build/error-404-D0Xi6cQ6.mjs.map +1 -0
  62. package/dashboard/.output/server/chunks/build/error-404-styles.C8lgdT6t.mjs +8 -0
  63. package/dashboard/.output/server/chunks/build/error-404-styles.C8lgdT6t.mjs.map +1 -0
  64. package/dashboard/.output/server/chunks/build/error-500-DabQpmqy.mjs +75 -0
  65. package/dashboard/.output/server/chunks/build/error-500-DabQpmqy.mjs.map +1 -0
  66. package/dashboard/.output/server/chunks/build/error-500-styles.Ccrcwcfa.mjs +8 -0
  67. package/dashboard/.output/server/chunks/build/error-500-styles.Ccrcwcfa.mjs.map +1 -0
  68. package/dashboard/.output/server/chunks/build/fetch-BlczD9wj.mjs +503 -0
  69. package/dashboard/.output/server/chunks/build/fetch-BlczD9wj.mjs.map +1 -0
  70. package/dashboard/.output/server/chunks/build/index-C-zhU_b9.mjs +174 -0
  71. package/dashboard/.output/server/chunks/build/index-C-zhU_b9.mjs.map +1 -0
  72. package/dashboard/.output/server/chunks/build/index-Dnk7jknb.mjs +154 -0
  73. package/dashboard/.output/server/chunks/build/index-Dnk7jknb.mjs.map +1 -0
  74. package/dashboard/.output/server/chunks/build/server.mjs +1552 -0
  75. package/dashboard/.output/server/chunks/build/server.mjs.map +1 -0
  76. package/dashboard/.output/server/chunks/build/styles.mjs +10 -0
  77. package/dashboard/.output/server/chunks/build/styles.mjs.map +1 -0
  78. package/dashboard/.output/server/chunks/nitro/nitro.mjs +5497 -0
  79. package/dashboard/.output/server/chunks/nitro/nitro.mjs.map +1 -0
  80. package/dashboard/.output/server/chunks/routes/api/lessons/_id_.get.mjs +35 -0
  81. package/dashboard/.output/server/chunks/routes/api/lessons/_id_.get.mjs.map +1 -0
  82. package/dashboard/.output/server/chunks/routes/api/lessons.get.mjs +64 -0
  83. package/dashboard/.output/server/chunks/routes/api/lessons.get.mjs.map +1 -0
  84. package/dashboard/.output/server/chunks/routes/api/stats.get.mjs +59 -0
  85. package/dashboard/.output/server/chunks/routes/api/stats.get.mjs.map +1 -0
  86. package/dashboard/.output/server/chunks/routes/renderer.mjs +458 -0
  87. package/dashboard/.output/server/chunks/routes/renderer.mjs.map +1 -0
  88. package/dashboard/.output/server/chunks/virtual/_virtual_spa-template.mjs +4 -0
  89. package/dashboard/.output/server/chunks/virtual/_virtual_spa-template.mjs.map +1 -0
  90. package/dashboard/.output/server/index.mjs +10 -0
  91. package/dashboard/.output/server/index.mjs.map +1 -0
  92. package/dashboard/.output/server/node_modules/@babel/parser/lib/index.js +14599 -0
  93. package/dashboard/.output/server/node_modules/@babel/parser/package.json +50 -0
  94. package/dashboard/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6759 -0
  95. package/dashboard/.output/server/node_modules/@vue/compiler-core/package.json +58 -0
  96. package/dashboard/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +689 -0
  97. package/dashboard/.output/server/node_modules/@vue/compiler-dom/package.json +57 -0
  98. package/dashboard/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1413 -0
  99. package/dashboard/.output/server/node_modules/@vue/compiler-ssr/package.json +34 -0
  100. package/dashboard/.output/server/node_modules/@vue/devtools-api/lib/cjs/api/api.js +2 -0
  101. package/dashboard/.output/server/node_modules/@vue/devtools-api/lib/cjs/api/app.js +2 -0
  102. package/dashboard/.output/server/node_modules/@vue/devtools-api/lib/cjs/api/component.js +2 -0
  103. package/dashboard/.output/server/node_modules/@vue/devtools-api/lib/cjs/api/context.js +2 -0
  104. package/dashboard/.output/server/node_modules/@vue/devtools-api/lib/cjs/api/hooks.js +2 -0
  105. package/dashboard/.output/server/node_modules/@vue/devtools-api/lib/cjs/api/index.js +22 -0
  106. package/dashboard/.output/server/node_modules/@vue/devtools-api/lib/cjs/api/util.js +2 -0
  107. package/dashboard/.output/server/node_modules/@vue/devtools-api/lib/cjs/const.js +5 -0
  108. package/dashboard/.output/server/node_modules/@vue/devtools-api/lib/cjs/env.js +17 -0
  109. package/dashboard/.output/server/node_modules/@vue/devtools-api/lib/cjs/index.js +45 -0
  110. package/dashboard/.output/server/node_modules/@vue/devtools-api/lib/cjs/plugin.js +2 -0
  111. package/dashboard/.output/server/node_modules/@vue/devtools-api/lib/cjs/proxy.js +111 -0
  112. package/dashboard/.output/server/node_modules/@vue/devtools-api/lib/cjs/time.js +28 -0
  113. package/dashboard/.output/server/node_modules/@vue/devtools-api/package.json +37 -0
  114. package/dashboard/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1899 -0
  115. package/dashboard/.output/server/node_modules/@vue/reactivity/package.json +55 -0
  116. package/dashboard/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +6940 -0
  117. package/dashboard/.output/server/node_modules/@vue/runtime-core/package.json +52 -0
  118. package/dashboard/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1822 -0
  119. package/dashboard/.output/server/node_modules/@vue/runtime-dom/package.json +60 -0
  120. package/dashboard/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +896 -0
  121. package/dashboard/.output/server/node_modules/@vue/server-renderer/package.json +55 -0
  122. package/dashboard/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +604 -0
  123. package/dashboard/.output/server/node_modules/@vue/shared/package.json +47 -0
  124. package/dashboard/.output/server/node_modules/devalue/index.js +4 -0
  125. package/dashboard/.output/server/node_modules/devalue/package.json +40 -0
  126. package/dashboard/.output/server/node_modules/devalue/src/base64.js +60 -0
  127. package/dashboard/.output/server/node_modules/devalue/src/constants.js +12 -0
  128. package/dashboard/.output/server/node_modules/devalue/src/parse.js +283 -0
  129. package/dashboard/.output/server/node_modules/devalue/src/stringify.js +401 -0
  130. package/dashboard/.output/server/node_modules/devalue/src/uneval.js +552 -0
  131. package/dashboard/.output/server/node_modules/devalue/src/utils.js +160 -0
  132. package/dashboard/.output/server/node_modules/entities/dist/commonjs/decode-codepoint.js +77 -0
  133. package/dashboard/.output/server/node_modules/entities/dist/commonjs/decode.js +568 -0
  134. package/dashboard/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-html.js +7 -0
  135. package/dashboard/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +7 -0
  136. package/dashboard/.output/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js +21 -0
  137. package/dashboard/.output/server/node_modules/entities/dist/commonjs/internal/decode-shared.js +31 -0
  138. package/dashboard/.output/server/node_modules/entities/dist/commonjs/package.json +3 -0
  139. package/dashboard/.output/server/node_modules/entities/package.json +120 -0
  140. package/dashboard/.output/server/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
  141. package/dashboard/.output/server/node_modules/estree-walker/package.json +37 -0
  142. package/dashboard/.output/server/node_modules/hookable/dist/index.mjs +257 -0
  143. package/dashboard/.output/server/node_modules/hookable/package.json +53 -0
  144. package/dashboard/.output/server/node_modules/perfect-debounce/dist/index.mjs +89 -0
  145. package/dashboard/.output/server/node_modules/perfect-debounce/package.json +41 -0
  146. package/dashboard/.output/server/node_modules/source-map-js/lib/array-set.js +121 -0
  147. package/dashboard/.output/server/node_modules/source-map-js/lib/base64-vlq.js +140 -0
  148. package/dashboard/.output/server/node_modules/source-map-js/lib/base64.js +67 -0
  149. package/dashboard/.output/server/node_modules/source-map-js/lib/binary-search.js +111 -0
  150. package/dashboard/.output/server/node_modules/source-map-js/lib/mapping-list.js +79 -0
  151. package/dashboard/.output/server/node_modules/source-map-js/lib/quick-sort.js +132 -0
  152. package/dashboard/.output/server/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
  153. package/dashboard/.output/server/node_modules/source-map-js/lib/source-map-generator.js +444 -0
  154. package/dashboard/.output/server/node_modules/source-map-js/lib/source-node.js +413 -0
  155. package/dashboard/.output/server/node_modules/source-map-js/lib/util.js +594 -0
  156. package/dashboard/.output/server/node_modules/source-map-js/package.json +71 -0
  157. package/dashboard/.output/server/node_modules/source-map-js/source-map.js +8 -0
  158. package/dashboard/.output/server/node_modules/ufo/dist/index.mjs +645 -0
  159. package/dashboard/.output/server/node_modules/ufo/package.json +48 -0
  160. package/dashboard/.output/server/node_modules/unhead/dist/index.mjs +9 -0
  161. package/dashboard/.output/server/node_modules/unhead/dist/parser.mjs +508 -0
  162. package/dashboard/.output/server/node_modules/unhead/dist/plugins.mjs +101 -0
  163. package/dashboard/.output/server/node_modules/unhead/dist/scripts.mjs +30 -0
  164. package/dashboard/.output/server/node_modules/unhead/dist/server.mjs +180 -0
  165. package/dashboard/.output/server/node_modules/unhead/dist/shared/unhead.B3VbJo7Y.mjs +207 -0
  166. package/dashboard/.output/server/node_modules/unhead/dist/shared/unhead.BYvz9V1x.mjs +43 -0
  167. package/dashboard/.output/server/node_modules/unhead/dist/shared/unhead.BnoAbrHA.mjs +269 -0
  168. package/dashboard/.output/server/node_modules/unhead/dist/shared/unhead.CaI5ZD4O.mjs +182 -0
  169. package/dashboard/.output/server/node_modules/unhead/dist/shared/unhead.CbpEuj3y.mjs +71 -0
  170. package/dashboard/.output/server/node_modules/unhead/dist/shared/unhead.D4vSFytZ.mjs +236 -0
  171. package/dashboard/.output/server/node_modules/unhead/dist/shared/unhead.DQc16pHI.mjs +196 -0
  172. package/dashboard/.output/server/node_modules/unhead/dist/shared/unhead.Dh1cQCTe.mjs +44 -0
  173. package/dashboard/.output/server/node_modules/unhead/dist/shared/unhead.TxTMM7cM.mjs +166 -0
  174. package/dashboard/.output/server/node_modules/unhead/dist/shared/unhead.yem5I2v_.mjs +38 -0
  175. package/dashboard/.output/server/node_modules/unhead/dist/utils.mjs +5 -0
  176. package/dashboard/.output/server/node_modules/unhead/package.json +105 -0
  177. package/dashboard/.output/server/node_modules/vue/dist/vue.cjs.js +80 -0
  178. package/dashboard/.output/server/node_modules/vue/dist/vue.cjs.prod.js +66 -0
  179. package/dashboard/.output/server/node_modules/vue/index.js +7 -0
  180. package/dashboard/.output/server/node_modules/vue/index.mjs +1 -0
  181. package/dashboard/.output/server/node_modules/vue/package.json +112 -0
  182. package/dashboard/.output/server/node_modules/vue/server-renderer/index.mjs +1 -0
  183. package/dashboard/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +249 -0
  184. package/dashboard/.output/server/node_modules/vue-bundle-renderer/package.json +57 -0
  185. package/dashboard/.output/server/node_modules/vue-router/dist/devtools-EWN81iOl.mjs +1220 -0
  186. package/dashboard/.output/server/node_modules/vue-router/dist/vue-router.mjs +1557 -0
  187. package/dashboard/.output/server/node_modules/vue-router/package.json +153 -0
  188. package/dashboard/.output/server/node_modules/vue-router/vue-router.node.mjs +2 -0
  189. package/dashboard/.output/server/package.json +29 -0
  190. package/dist/cli/commands/dashboard.d.ts +2 -0
  191. package/dist/cli/commands/dashboard.d.ts.map +1 -0
  192. package/dist/cli/commands/dashboard.js +30 -0
  193. package/dist/cli/commands/dashboard.js.map +1 -0
  194. package/dist/cli/index.js +5 -0
  195. package/dist/cli/index.js.map +1 -1
  196. package/package.json +3 -2
@@ -0,0 +1,180 @@
1
+ import { a as createUnhead } from './shared/unhead.CaI5ZD4O.mjs';
2
+ import { T as TagsWithInnerContent, S as SelfClosingTags } from './shared/unhead.yem5I2v_.mjs';
3
+ import { parseHtmlForUnheadExtraction, applyHeadToHtml, parseHtmlForIndexes } from './parser.mjs';
4
+ import 'hookable';
5
+ import './shared/unhead.B3VbJo7Y.mjs';
6
+ import './shared/unhead.CbpEuj3y.mjs';
7
+
8
+ // @__NO_SIDE_EFFECTS__
9
+ function createHead(options = {}) {
10
+ const unhead = createUnhead({
11
+ ...options,
12
+ // @ts-expect-error untyped
13
+ document: false,
14
+ propResolvers: [
15
+ ...options.propResolvers || [],
16
+ (k, v) => {
17
+ if (k && k.startsWith("on") && typeof v === "function") {
18
+ return `this.dataset.${k}fired = true`;
19
+ }
20
+ return v;
21
+ }
22
+ ],
23
+ init: [
24
+ options.disableDefaults ? void 0 : {
25
+ htmlAttrs: {
26
+ lang: "en"
27
+ },
28
+ meta: [
29
+ {
30
+ charset: "utf-8"
31
+ },
32
+ {
33
+ name: "viewport",
34
+ content: "width=device-width, initial-scale=1"
35
+ }
36
+ ]
37
+ },
38
+ ...options.init || []
39
+ ]
40
+ });
41
+ unhead._ssrPayload = {};
42
+ unhead.use({
43
+ key: "server",
44
+ hooks: {
45
+ "tags:resolve": function(ctx) {
46
+ const title = ctx.tagMap.get("title");
47
+ const titleTemplate = ctx.tagMap.get("titleTemplate");
48
+ let payload = {
49
+ title: title?.mode === "server" ? unhead._title : void 0,
50
+ titleTemplate: titleTemplate?.mode === "server" ? unhead._titleTemplate : void 0
51
+ };
52
+ if (Object.keys(unhead._ssrPayload || {}).length > 0) {
53
+ payload = {
54
+ ...unhead._ssrPayload,
55
+ ...payload
56
+ };
57
+ }
58
+ if (Object.values(payload).some(Boolean)) {
59
+ ctx.tags.push({
60
+ tag: "script",
61
+ innerHTML: JSON.stringify(payload),
62
+ props: { id: "unhead:payload", type: "application/json" }
63
+ });
64
+ }
65
+ }
66
+ }
67
+ });
68
+ return unhead;
69
+ }
70
+
71
+ function extractUnheadInputFromHtml(html) {
72
+ return parseHtmlForUnheadExtraction(html);
73
+ }
74
+
75
+ function encodeAttribute(value) {
76
+ return String(value).replace(/"/g, """);
77
+ }
78
+ function propsToString(props) {
79
+ let attrs = "";
80
+ for (const key in props) {
81
+ if (!Object.hasOwn(props, key))
82
+ continue;
83
+ let value = props[key];
84
+ if ((key === "class" || key === "style") && typeof value !== "string") {
85
+ value = key === "class" ? Array.from(value).join(" ") : Array.from(value).map(([k, v]) => `${k}:${v}`).join(";");
86
+ }
87
+ if (value !== false && value !== null) {
88
+ attrs += value === true ? ` ${key}` : ` ${key}="${encodeAttribute(value)}"`;
89
+ }
90
+ }
91
+ return attrs;
92
+ }
93
+
94
+ function escapeHtml(str) {
95
+ return str.replace(/[&<>"'/]/g, (char) => {
96
+ switch (char) {
97
+ case "&":
98
+ return "&amp;";
99
+ case "<":
100
+ return "&lt;";
101
+ case ">":
102
+ return "&gt;";
103
+ case '"':
104
+ return "&quot;";
105
+ case "'":
106
+ return "&#x27;";
107
+ case "/":
108
+ return "&#x2F;";
109
+ default:
110
+ return char;
111
+ }
112
+ });
113
+ }
114
+ function tagToString(tag) {
115
+ const attrs = propsToString(tag.props);
116
+ const openTag = `<${tag.tag}${attrs}>`;
117
+ if (!TagsWithInnerContent.has(tag.tag))
118
+ return SelfClosingTags.has(tag.tag) ? openTag : `${openTag}</${tag.tag}>`;
119
+ let content = String(tag.textContent || tag.innerHTML || "");
120
+ content = tag.tag === "title" ? escapeHtml(content) : content.replace(new RegExp(`</${tag.tag}`, "gi"), `<\\/${tag.tag}`);
121
+ return SelfClosingTags.has(tag.tag) ? openTag : `${openTag}${content}</${tag.tag}>`;
122
+ }
123
+
124
+ function ssrRenderTags(tags, options) {
125
+ const schema = { htmlAttrs: {}, bodyAttrs: {}, tags: { head: "", bodyClose: "", bodyOpen: "" } };
126
+ const lineBreaks = !options?.omitLineBreaks ? "\n" : "";
127
+ for (const tag of tags) {
128
+ if (tag.tag === "htmlAttrs" || tag.tag === "bodyAttrs") {
129
+ Object.assign(schema[tag.tag], tag.props);
130
+ continue;
131
+ }
132
+ const s = tagToString(tag);
133
+ const tagPosition = tag.tagPosition || "head";
134
+ schema.tags[tagPosition] += schema.tags[tagPosition] ? `${lineBreaks}${s}` : s;
135
+ }
136
+ return {
137
+ headTags: schema.tags.head,
138
+ bodyTags: schema.tags.bodyClose,
139
+ bodyTagsOpen: schema.tags.bodyOpen,
140
+ htmlAttrs: propsToString(schema.htmlAttrs),
141
+ bodyAttrs: propsToString(schema.bodyAttrs)
142
+ };
143
+ }
144
+
145
+ // @__NO_SIDE_EFFECTS__
146
+ async function renderSSRHead(head, options) {
147
+ const beforeRenderCtx = { shouldRender: true };
148
+ await head.hooks.callHook("ssr:beforeRender", beforeRenderCtx);
149
+ if (!beforeRenderCtx.shouldRender) {
150
+ return {
151
+ headTags: "",
152
+ bodyTags: "",
153
+ bodyTagsOpen: "",
154
+ htmlAttrs: "",
155
+ bodyAttrs: ""
156
+ };
157
+ }
158
+ const ctx = { tags: options?.resolvedTags || await head.resolveTags() };
159
+ await head.hooks.callHook("ssr:render", ctx);
160
+ const html = ssrRenderTags(ctx.tags, options);
161
+ const renderCtx = { tags: ctx.tags, html };
162
+ await head.hooks.callHook("ssr:rendered", renderCtx);
163
+ return renderCtx.html;
164
+ }
165
+
166
+ // @__NO_SIDE_EFFECTS__
167
+ async function transformHtmlTemplate(head, html, options) {
168
+ const template = parseHtmlForUnheadExtraction(html);
169
+ head.push(template.input, { _index: 0 });
170
+ const headHtml = await renderSSRHead(head, options);
171
+ return applyHeadToHtml(template, headHtml);
172
+ }
173
+ // @__NO_SIDE_EFFECTS__
174
+ async function transformHtmlTemplateRaw(head, html, options) {
175
+ const headHtml = await renderSSRHead(head, options);
176
+ const template = parseHtmlForIndexes(html);
177
+ return applyHeadToHtml(template, headHtml);
178
+ }
179
+
180
+ export { createHead, escapeHtml, extractUnheadInputFromHtml, propsToString, renderSSRHead, ssrRenderTags, tagToString, transformHtmlTemplate, transformHtmlTemplateRaw };
@@ -0,0 +1,207 @@
1
+ import { U as UniqueTags, T as TagsWithInnerContent, M as MetaTagsArrayable, H as HasElementTags, a as TagConfigKeys, D as DupeableTags } from './unhead.yem5I2v_.mjs';
2
+
3
+ const allowedMetaProperties = ["name", "property", "http-equiv"];
4
+ const StandardSingleMetaTags = /* @__PURE__ */ new Set([
5
+ "viewport",
6
+ "description",
7
+ "keywords",
8
+ "robots"
9
+ ]);
10
+ function isMetaArrayDupeKey(v) {
11
+ const parts = v.split(":");
12
+ if (!parts.length)
13
+ return false;
14
+ return MetaTagsArrayable.has(parts[1]);
15
+ }
16
+ function dedupeKey(tag) {
17
+ const { props, tag: name } = tag;
18
+ if (UniqueTags.has(name))
19
+ return name;
20
+ if (name === "link" && props.rel === "canonical")
21
+ return "canonical";
22
+ if (name === "link" && props.rel === "alternate") {
23
+ if (props.hreflang)
24
+ return `alternate:${props.hreflang}`;
25
+ if (props.type)
26
+ return `alternate:${props.type}:${props.href || ""}`;
27
+ }
28
+ if (props.charset)
29
+ return "charset";
30
+ if (tag.tag === "meta") {
31
+ for (const n of allowedMetaProperties) {
32
+ if (props[n] !== void 0) {
33
+ const propValue = props[n];
34
+ const isStructured = propValue && typeof propValue === "string" && propValue.includes(":");
35
+ const isStandardSingle = propValue && StandardSingleMetaTags.has(propValue);
36
+ const shouldAlwaysDedupe = isStructured || isStandardSingle;
37
+ const keyPart = !shouldAlwaysDedupe && tag.key ? `:key:${tag.key}` : "";
38
+ return `${name}:${propValue}${keyPart}`;
39
+ }
40
+ }
41
+ }
42
+ if (tag.key) {
43
+ return `${name}:key:${tag.key}`;
44
+ }
45
+ if (props.id) {
46
+ return `${name}:id:${props.id}`;
47
+ }
48
+ if (name === "link" && props.rel === "alternate") {
49
+ return `alternate:${props.href || ""}`;
50
+ }
51
+ if (TagsWithInnerContent.has(name)) {
52
+ const v = tag.textContent || tag.innerHTML;
53
+ if (v) {
54
+ return `${name}:content:${v}`;
55
+ }
56
+ }
57
+ }
58
+ function hashTag(tag) {
59
+ const dedupe = tag._h || tag._d;
60
+ if (dedupe)
61
+ return dedupe;
62
+ const inner = tag.textContent || tag.innerHTML;
63
+ if (inner)
64
+ return inner;
65
+ return `${tag.tag}:${Object.entries(tag.props).map(([k, v]) => `${k}:${String(v)}`).join(",")}`;
66
+ }
67
+
68
+ function walkResolver(val, resolve, key) {
69
+ const type = typeof val;
70
+ if (type === "function") {
71
+ if (!key || key !== "titleTemplate" && !(key[0] === "o" && key[1] === "n")) {
72
+ val = val();
73
+ }
74
+ }
75
+ const v = resolve ? resolve(key, val) : val;
76
+ if (Array.isArray(v)) {
77
+ return v.map((r) => walkResolver(r, resolve));
78
+ }
79
+ if (v?.constructor === Object) {
80
+ const next = {};
81
+ for (const k of Object.keys(v)) {
82
+ next[k] = walkResolver(v[k], resolve, k);
83
+ }
84
+ return next;
85
+ }
86
+ return v;
87
+ }
88
+
89
+ function normalizeStyleClassProps(key, value) {
90
+ const store = key === "style" ? /* @__PURE__ */ new Map() : /* @__PURE__ */ new Set();
91
+ function processValue(rawValue) {
92
+ if (rawValue == null || rawValue === void 0)
93
+ return;
94
+ const value2 = String(rawValue).trim();
95
+ if (!value2)
96
+ return;
97
+ if (key === "style") {
98
+ const [k, ...v] = value2.split(":").map((s) => s ? s.trim() : "");
99
+ if (k && v.length)
100
+ store.set(k, v.join(":"));
101
+ } else {
102
+ value2.split(" ").filter(Boolean).forEach((c) => store.add(c));
103
+ }
104
+ }
105
+ if (typeof value === "string") {
106
+ key === "style" ? value.split(";").forEach(processValue) : processValue(value);
107
+ } else if (Array.isArray(value)) {
108
+ value.forEach((item) => processValue(item));
109
+ } else if (value && typeof value === "object") {
110
+ Object.entries(value).forEach(([k, v]) => {
111
+ if (v && v !== "false") {
112
+ key === "style" ? store.set(String(k).trim(), String(v)) : processValue(k);
113
+ }
114
+ });
115
+ }
116
+ return store;
117
+ }
118
+ function normalizeProps(tag, input) {
119
+ tag.props = tag.props || {};
120
+ if (!input) {
121
+ return tag;
122
+ }
123
+ if (tag.tag === "templateParams") {
124
+ tag.props = input;
125
+ return tag;
126
+ }
127
+ const isHtmlTag = HasElementTags.has(tag.tag) || tag.tag === "htmlAttrs" || tag.tag === "bodyAttrs";
128
+ Object.entries(input).forEach(([prop, value]) => {
129
+ if (prop === "__proto__" || prop === "constructor" || prop === "prototype")
130
+ return;
131
+ if (value === null) {
132
+ tag.props[prop] = null;
133
+ return;
134
+ }
135
+ if (prop === "class" || prop === "style") {
136
+ tag.props[prop] = normalizeStyleClassProps(prop, value);
137
+ return;
138
+ }
139
+ if (TagConfigKeys.has(prop)) {
140
+ if ((prop === "textContent" || prop === "innerHTML") && typeof value === "object") {
141
+ let type = input.type;
142
+ if (!input.type) {
143
+ type = "application/json";
144
+ }
145
+ if (!type?.endsWith("json") && type !== "speculationrules") {
146
+ return;
147
+ }
148
+ input.type = type;
149
+ tag.props.type = type;
150
+ tag[prop] = JSON.stringify(value);
151
+ } else {
152
+ tag[prop] = value;
153
+ }
154
+ return;
155
+ }
156
+ const isDataKey = prop.startsWith("data-");
157
+ const key = isHtmlTag && !isDataKey ? prop.toLowerCase() : prop;
158
+ const strValue = String(value);
159
+ const isMetaContentKey = tag.tag === "meta" && key === "content";
160
+ if (strValue === "true" || strValue === "") {
161
+ tag.props[key] = isDataKey || isMetaContentKey ? strValue : true;
162
+ } else if (!value && isDataKey && strValue === "false") {
163
+ tag.props[key] = "false";
164
+ } else if (value !== void 0) {
165
+ tag.props[key] = value;
166
+ }
167
+ });
168
+ return tag;
169
+ }
170
+ function normalizeTag(tagName, _input) {
171
+ const input = typeof _input === "object" && typeof _input !== "function" ? _input : { [tagName === "script" || tagName === "noscript" || tagName === "style" ? "innerHTML" : "textContent"]: _input };
172
+ const tag = normalizeProps({ tag: tagName, props: {} }, input);
173
+ if (tag.key && DupeableTags.has(tag.tag)) {
174
+ tag.props["data-hid"] = tag._h = tag.key;
175
+ }
176
+ if (tag.tag === "script" && typeof tag.innerHTML === "object") {
177
+ tag.innerHTML = JSON.stringify(tag.innerHTML);
178
+ tag.props.type = tag.props.type || "application/json";
179
+ }
180
+ return Array.isArray(tag.props.content) ? tag.props.content.map((v) => ({ ...tag, props: { ...tag.props, content: v } })) : tag;
181
+ }
182
+ function normalizeEntryToTags(input, propResolvers) {
183
+ if (!input) {
184
+ return [];
185
+ }
186
+ if (typeof input === "function") {
187
+ input = input();
188
+ }
189
+ const resolvers = (key, val) => {
190
+ for (let i = 0; i < propResolvers.length; i++) {
191
+ val = propResolvers[i](key, val);
192
+ }
193
+ return val;
194
+ };
195
+ input = resolvers(void 0, input);
196
+ const tags = [];
197
+ input = walkResolver(input, resolvers);
198
+ Object.entries(input || {}).forEach(([key, value]) => {
199
+ if (value === void 0)
200
+ return;
201
+ for (const v of Array.isArray(value) ? value : [value])
202
+ tags.push(normalizeTag(key, v));
203
+ });
204
+ return tags.flat();
205
+ }
206
+
207
+ export { normalizeProps as a, dedupeKey as d, hashTag as h, isMetaArrayDupeKey as i, normalizeEntryToTags as n, walkResolver as w };
@@ -0,0 +1,43 @@
1
+ const SepSub = "%separator";
2
+ function sub(p, token, isJson = false) {
3
+ let val;
4
+ if (token === "s" || token === "pageTitle") {
5
+ val = p.pageTitle;
6
+ } else if (token.includes(".")) {
7
+ const dotIndex = token.indexOf(".");
8
+ val = p[token.substring(0, dotIndex)]?.[token.substring(dotIndex + 1)];
9
+ } else {
10
+ val = p[token];
11
+ }
12
+ if (val !== void 0) {
13
+ return isJson ? (val || "").replace(/\\/g, "\\\\").replace(/</g, "\\u003C").replace(/"/g, '\\"') : val || "";
14
+ }
15
+ return void 0;
16
+ }
17
+ function processTemplateParams(s, p, sep, isJson = false) {
18
+ if (typeof s !== "string" || !s.includes("%"))
19
+ return s;
20
+ let decoded = s;
21
+ try {
22
+ decoded = decodeURI(s);
23
+ } catch {
24
+ }
25
+ const tokens = decoded.match(/%\w+(?:\.\w+)?/g);
26
+ if (!tokens) {
27
+ return s;
28
+ }
29
+ const hasSepSub = s.includes(SepSub);
30
+ s = s.replace(/%\w+(?:\.\w+)?/g, (token) => {
31
+ if (token === SepSub || !tokens.includes(token)) {
32
+ return token;
33
+ }
34
+ const re = sub(p, token.slice(1), isJson);
35
+ return re !== void 0 ? re : token;
36
+ }).trim();
37
+ if (hasSepSub) {
38
+ s = s.split(SepSub).map((part) => part.trim()).filter((part) => part !== "").join(sep ? ` ${sep} ` : " ");
39
+ }
40
+ return s;
41
+ }
42
+
43
+ export { processTemplateParams as p };
@@ -0,0 +1,269 @@
1
+ import { b as ScriptNetworkEvents } from './unhead.yem5I2v_.mjs';
2
+
3
+ function createNoopedRecordingProxy(instance = {}) {
4
+ const stack = [];
5
+ let stackIdx = -1;
6
+ const handler = (reuseStack = false) => ({
7
+ get(_, prop, receiver) {
8
+ if (!reuseStack) {
9
+ const v = Reflect.get(_, prop, receiver);
10
+ if (typeof v !== "undefined") {
11
+ return v;
12
+ }
13
+ stackIdx++;
14
+ stack[stackIdx] = [];
15
+ }
16
+ stack[stackIdx].push({ type: "get", key: prop });
17
+ return new Proxy(() => {
18
+ }, handler(true));
19
+ },
20
+ apply(_, __, args) {
21
+ stack[stackIdx].push({ type: "apply", key: "", args });
22
+ return void 0;
23
+ }
24
+ });
25
+ return {
26
+ proxy: new Proxy(instance || {}, handler()),
27
+ stack
28
+ };
29
+ }
30
+ function createForwardingProxy(target) {
31
+ const handler = {
32
+ get(_, prop, receiver) {
33
+ const v = Reflect.get(_, prop, receiver);
34
+ if (typeof v === "object") {
35
+ return new Proxy(v, handler);
36
+ }
37
+ return v;
38
+ },
39
+ apply(_, __, args) {
40
+ Reflect.apply(_, __, args);
41
+ return void 0;
42
+ }
43
+ };
44
+ return new Proxy(target, handler);
45
+ }
46
+ function replayProxyRecordings(target, stack) {
47
+ stack.forEach((recordings) => {
48
+ let context = target;
49
+ let prevContext = target;
50
+ recordings.forEach(({ type, key, args }) => {
51
+ if (type === "get") {
52
+ prevContext = context;
53
+ context = context[key];
54
+ } else if (type === "apply") {
55
+ context = context.call(prevContext, ...args);
56
+ }
57
+ });
58
+ });
59
+ }
60
+
61
+ function resolveScriptKey(input) {
62
+ return input.key || input.src || (typeof input.innerHTML === "string" ? input.innerHTML : "");
63
+ }
64
+ const PreconnectServerModes = ["preconnect", "dns-prefetch"];
65
+ function useScript(head, _input, _options) {
66
+ const input = typeof _input === "string" ? { src: _input } : _input;
67
+ const options = _options || {};
68
+ const id = resolveScriptKey(input);
69
+ const prevScript = head._scripts?.[id];
70
+ if (prevScript) {
71
+ prevScript.setupTriggerHandler(options.trigger);
72
+ return prevScript;
73
+ }
74
+ options.beforeInit?.();
75
+ const syncStatus = (s) => {
76
+ script.status = s;
77
+ head.hooks.callHook(`script:updated`, hookCtx);
78
+ };
79
+ ScriptNetworkEvents.forEach((fn) => {
80
+ const k = fn;
81
+ const _fn = typeof input[k] === "function" ? input[k].bind(options.eventContext) : null;
82
+ input[k] = (e) => {
83
+ syncStatus(fn === "onload" ? "loaded" : fn === "onerror" ? "error" : "loading");
84
+ _fn?.(e);
85
+ };
86
+ });
87
+ const _cbs = { loaded: [], error: [] };
88
+ const _uniqueCbs = /* @__PURE__ */ new Set();
89
+ const _registerCb = (key, cb, options2) => {
90
+ if (head.ssr) {
91
+ return;
92
+ }
93
+ if (options2?.key) {
94
+ const key2 = `${options2?.key}:${options2.key}`;
95
+ if (_uniqueCbs.has(key2)) {
96
+ return;
97
+ }
98
+ _uniqueCbs.add(key2);
99
+ }
100
+ if (_cbs[key]) {
101
+ const i = _cbs[key].push(cb);
102
+ return () => _cbs[key]?.splice(i - 1, 1);
103
+ }
104
+ cb(script.instance);
105
+ return () => {
106
+ };
107
+ };
108
+ const loadPromise = new Promise((resolve) => {
109
+ if (head.ssr)
110
+ return;
111
+ const emit = (api) => requestAnimationFrame(() => resolve(api));
112
+ const _ = head.hooks.hook("script:updated", ({ script: script2 }) => {
113
+ const status = script2.status;
114
+ if (script2.id === id && (status === "loaded" || status === "error")) {
115
+ if (status === "loaded") {
116
+ if (typeof options.use === "function") {
117
+ const api = options.use();
118
+ if (api) {
119
+ emit(api);
120
+ }
121
+ } else {
122
+ emit({});
123
+ }
124
+ } else if (status === "error") {
125
+ resolve(false);
126
+ }
127
+ _();
128
+ }
129
+ });
130
+ });
131
+ const script = {
132
+ _loadPromise: loadPromise,
133
+ instance: !head.ssr && options?.use?.() || null,
134
+ proxy: null,
135
+ id,
136
+ status: "awaitingLoad",
137
+ remove() {
138
+ script._triggerAbortControllers?.forEach((ac) => ac.abort());
139
+ script._triggerAbortControllers?.clear();
140
+ script._triggerPromises = [];
141
+ script._warmupEl?.dispose();
142
+ if (script.entry) {
143
+ script.entry.dispose();
144
+ script.entry = void 0;
145
+ syncStatus("removed");
146
+ delete head._scripts?.[id];
147
+ return true;
148
+ }
149
+ return false;
150
+ },
151
+ warmup(rel) {
152
+ const { src } = input;
153
+ const isCrossOrigin = !src.startsWith("/") || src.startsWith("//");
154
+ const isPreconnect = rel && PreconnectServerModes.includes(rel);
155
+ let href = src;
156
+ if (!rel || isPreconnect && !isCrossOrigin) {
157
+ return;
158
+ }
159
+ if (isPreconnect) {
160
+ const $url = new URL(src);
161
+ href = `${$url.protocol}//${$url.host}`;
162
+ }
163
+ const link = {
164
+ href,
165
+ rel,
166
+ crossorigin: typeof input.crossorigin !== "undefined" ? input.crossorigin : isCrossOrigin ? "anonymous" : void 0,
167
+ referrerpolicy: typeof input.referrerpolicy !== "undefined" ? input.referrerpolicy : isCrossOrigin ? "no-referrer" : void 0,
168
+ fetchpriority: typeof input.fetchpriority !== "undefined" ? input.fetchpriority : "low",
169
+ integrity: input.integrity,
170
+ as: rel === "preload" ? "script" : void 0
171
+ };
172
+ script._warmupEl = head.push({ link: [link] }, { head, tagPriority: "high" });
173
+ return script._warmupEl;
174
+ },
175
+ load(cb) {
176
+ script._triggerAbortControllers?.forEach((ac) => ac.abort());
177
+ script._triggerAbortControllers?.clear();
178
+ script._triggerPromises = [];
179
+ if (!script.entry) {
180
+ syncStatus("loading");
181
+ const defaults = {
182
+ defer: true,
183
+ fetchpriority: "low"
184
+ };
185
+ if (input.src && (input.src.startsWith("http") || input.src.startsWith("//"))) {
186
+ defaults.crossorigin = "anonymous";
187
+ defaults.referrerpolicy = "no-referrer";
188
+ }
189
+ script.entry = head.push({
190
+ script: [{ ...defaults, ...input }]
191
+ }, options);
192
+ }
193
+ if (cb)
194
+ _registerCb("loaded", cb);
195
+ return loadPromise;
196
+ },
197
+ onLoaded(cb, options2) {
198
+ return _registerCb("loaded", cb, options2);
199
+ },
200
+ onError(cb, options2) {
201
+ return _registerCb("error", cb, options2);
202
+ },
203
+ setupTriggerHandler(trigger) {
204
+ if (script.status !== "awaitingLoad") {
205
+ return;
206
+ }
207
+ if ((typeof trigger === "undefined" || trigger === "client") && !head.ssr || trigger === "server") {
208
+ script.load();
209
+ } else if (trigger instanceof Promise) {
210
+ if (head.ssr) {
211
+ return;
212
+ }
213
+ const abortController = new AbortController();
214
+ script._triggerAbortControllers = script._triggerAbortControllers || /* @__PURE__ */ new Set();
215
+ script._triggerAbortControllers.add(abortController);
216
+ const abortPromise = new Promise((resolve) => {
217
+ abortController.signal.addEventListener("abort", () => {
218
+ script._triggerAbortControllers?.delete(abortController);
219
+ resolve();
220
+ });
221
+ });
222
+ script._triggerAbortController = abortController;
223
+ script._triggerPromises = script._triggerPromises || [];
224
+ const idx = script._triggerPromises.push(Promise.race([
225
+ trigger.then((v) => typeof v === "undefined" || v ? script.load : void 0),
226
+ abortPromise
227
+ ]).catch(() => {
228
+ }).then((res) => {
229
+ res?.();
230
+ }).finally(() => {
231
+ script._triggerPromises?.splice(idx, 1);
232
+ }));
233
+ } else if (typeof trigger === "function") {
234
+ trigger(script.load);
235
+ }
236
+ },
237
+ _cbs
238
+ };
239
+ loadPromise.then((api) => {
240
+ if (api !== false) {
241
+ script.instance = api;
242
+ _cbs.loaded?.forEach((cb) => cb(api));
243
+ _cbs.loaded = null;
244
+ } else {
245
+ _cbs.error?.forEach((cb) => cb());
246
+ _cbs.error = null;
247
+ }
248
+ });
249
+ const hookCtx = { script };
250
+ script.setupTriggerHandler(options.trigger);
251
+ if (options.use) {
252
+ const { proxy, stack } = createNoopedRecordingProxy(head.ssr ? {} : options.use() || {});
253
+ script.proxy = proxy;
254
+ script.onLoaded((instance) => {
255
+ replayProxyRecordings(instance, stack);
256
+ script.proxy = createForwardingProxy(instance);
257
+ });
258
+ }
259
+ if (!options.warmupStrategy && (typeof options.trigger === "undefined" || options.trigger === "client")) {
260
+ options.warmupStrategy = "preload";
261
+ }
262
+ if (options.warmupStrategy) {
263
+ script.warmup(options.warmupStrategy);
264
+ }
265
+ head._scripts = Object.assign(head._scripts || {}, { [id]: script });
266
+ return script;
267
+ }
268
+
269
+ export { resolveScriptKey as r, useScript as u };