@stacksjs/stx 0.2.635 → 0.2.636

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 (198) hide show
  1. package/dist/{chunk-7m5xrqnj.js → chunk-0bptz1km.js} +163 -163
  2. package/dist/{chunk-3td99hnc.js → chunk-0ergsswn.js} +3 -3
  3. package/dist/{chunk-y5b25eks.js → chunk-0j9f54wv.js} +4 -4
  4. package/dist/{chunk-6w1ngwsd.js → chunk-104xw4ps.js} +2 -2
  5. package/dist/chunk-1071avjd.js +2 -0
  6. package/dist/{chunk-6gwrmn3w.js → chunk-17x6e5mm.js} +6 -6
  7. package/dist/chunk-1ejpz9gv.js +2 -0
  8. package/dist/{chunk-j79f6syh.js → chunk-1m5cjrpw.js} +4 -4
  9. package/dist/chunk-1p6yd17s.js +2 -0
  10. package/dist/{chunk-qa58qdz8.js → chunk-1s02ff6n.js} +2 -2
  11. package/dist/{chunk-fm80xpxn.js → chunk-215fsx0k.js} +4 -4
  12. package/dist/{chunk-yp8tk3v3.js → chunk-26g3m2mg.js} +5 -5
  13. package/dist/{chunk-4vkpgz28.js → chunk-26gr5d4w.js} +5 -5
  14. package/dist/chunk-2kppq4pg.js +18 -0
  15. package/dist/chunk-2yvdnffe.js +2 -0
  16. package/dist/chunk-3hkp5hym.js +2 -0
  17. package/dist/chunk-444pz8yk.js +2 -0
  18. package/dist/{chunk-ymntav9f.js → chunk-45xhjrha.js} +1 -1
  19. package/dist/{chunk-camd8j1q.js → chunk-48yja477.js} +3 -3
  20. package/dist/chunk-4a4zc8yd.js +2 -0
  21. package/dist/chunk-4b5f28te.js +2 -0
  22. package/dist/chunk-4mm9ttc7.js +2 -0
  23. package/dist/chunk-4p4qp5ka.js +2 -0
  24. package/dist/{chunk-cw9pc5yx.js → chunk-51ea655x.js} +13 -13
  25. package/dist/{chunk-e0nq8g9j.js → chunk-5e063mgs.js} +1 -1
  26. package/dist/{chunk-npn3h566.js → chunk-5pyv9gjh.js} +2 -2
  27. package/dist/{chunk-cjr8cpb7.js → chunk-60azcvwr.js} +3 -3
  28. package/dist/{chunk-hbzk179w.js → chunk-69n2ty1n.js} +3 -3
  29. package/dist/{chunk-0tm9ep8b.js → chunk-6avpd901.js} +2 -2
  30. package/dist/chunk-6g4kd71m.js +2 -0
  31. package/dist/chunk-6pewcgfq.js +2 -0
  32. package/dist/chunk-6vjg5xf3.js +2 -0
  33. package/dist/chunk-6vqk6yfm.js +2 -0
  34. package/dist/{chunk-839m1t8t.js → chunk-77pj0xem.js} +1 -1
  35. package/dist/{chunk-1d25z8q2.js → chunk-7ftn9ber.js} +2 -2
  36. package/dist/{chunk-a6hv03yw.js → chunk-7jp0w5j8.js} +3 -3
  37. package/dist/{chunk-shcn4wve.js → chunk-7mkw98cr.js} +2 -2
  38. package/dist/{chunk-3e2v2fdh.js → chunk-7p8kyf4z.js} +3 -3
  39. package/dist/chunk-7z6ryf20.js +2 -0
  40. package/dist/chunk-87kza2ez.js +2 -0
  41. package/dist/{chunk-g9sdjgfw.js → chunk-88p10v0w.js} +5 -5
  42. package/dist/chunk-8cqx63aw.js +3 -0
  43. package/dist/chunk-8scndwf6.js +2 -0
  44. package/dist/{chunk-bysyrwfa.js → chunk-95ygdn0n.js} +3 -3
  45. package/dist/{chunk-g9dz0mx9.js → chunk-9hqjezhx.js} +2 -2
  46. package/dist/chunk-9ny6xzw0.js +2 -0
  47. package/dist/chunk-9r538d93.js +2 -0
  48. package/dist/{chunk-kr14jt4m.js → chunk-9yk5rasj.js} +2 -2
  49. package/dist/{chunk-fwawm5r3.js → chunk-a0ygyftk.js} +2 -2
  50. package/dist/{chunk-1wb98s7b.js → chunk-arrvcn7c.js} +7 -7
  51. package/dist/{chunk-sn0a8cjd.js → chunk-aztp8r80.js} +5 -5
  52. package/dist/chunk-b2teprjf.js +2 -0
  53. package/dist/{chunk-ry1w4ghk.js → chunk-b2v6v7w8.js} +1 -1
  54. package/dist/{chunk-b7hv69ty.js → chunk-b4j5bpec.js} +2 -2
  55. package/dist/{chunk-cdab66xt.js → chunk-bx3ar1wz.js} +2 -2
  56. package/dist/{chunk-jtr30kkz.js → chunk-c06b0akz.js} +1 -1
  57. package/dist/{chunk-q0kbn64j.js → chunk-c858mepd.js} +5 -5
  58. package/dist/chunk-cd76dwdn.js +2 -0
  59. package/dist/{chunk-psranzfr.js → chunk-cwvd8dc3.js} +2 -2
  60. package/dist/{chunk-baw176ay.js → chunk-drrczm0b.js} +6 -6
  61. package/dist/{chunk-mvt5n2q4.js → chunk-dtg82vm2.js} +1 -1
  62. package/dist/chunk-e21q08vs.js +2 -0
  63. package/dist/chunk-e2p8ytdd.js +2 -0
  64. package/dist/chunk-e7bd4vxb.js +2 -0
  65. package/dist/{chunk-a7s1j320.js → chunk-eeqw8jkw.js} +5 -5
  66. package/dist/{chunk-8y3mff5c.js → chunk-eyy6zmdk.js} +2 -2
  67. package/dist/chunk-fdxyj3pk.js +2 -0
  68. package/dist/chunk-ffjvqjyh.js +2 -0
  69. package/dist/{chunk-c4ysk7x2.js → chunk-fk79x8ns.js} +4 -4
  70. package/dist/{chunk-kwwrrasa.js → chunk-fqg0espy.js} +2 -2
  71. package/dist/chunk-ft6gfbr5.js +2 -0
  72. package/dist/{chunk-pak6ngv0.js → chunk-fwdptew6.js} +6 -6
  73. package/dist/{chunk-7vdcsr14.js → chunk-fztvkacg.js} +2 -2
  74. package/dist/chunk-g14mwhqz.js +2 -0
  75. package/dist/{chunk-kk6tq07c.js → chunk-g1ae3haw.js} +2 -2
  76. package/dist/chunk-g1mp4e7h.js +2 -0
  77. package/dist/{chunk-mpb0ezee.js → chunk-gqz26wza.js} +3 -3
  78. package/dist/chunk-h0d5vg33.js +2 -0
  79. package/dist/{chunk-ptv5f34x.js → chunk-hjtym7d9.js} +5 -5
  80. package/dist/chunk-j0jz4mfm.js +2 -0
  81. package/dist/chunk-j37720vw.js +2 -0
  82. package/dist/{chunk-bk9bx2ns.js → chunk-jdx4za9p.js} +2 -2
  83. package/dist/chunk-jmdrhpy7.js +2 -0
  84. package/dist/chunk-jp3vgscy.js +2 -0
  85. package/dist/chunk-jshv1ye7.js +2 -0
  86. package/dist/chunk-jtvrfwd8.js +2 -0
  87. package/dist/{chunk-qjfgdcck.js → chunk-k4xytaq3.js} +4 -4
  88. package/dist/chunk-k5pm9bex.js +2 -0
  89. package/dist/{chunk-vyjdzpb8.js → chunk-kjspmegt.js} +2 -2
  90. package/dist/{chunk-m56ee2tw.js → chunk-kmzc09w6.js} +5 -5
  91. package/dist/chunk-krchxt50.js +2 -0
  92. package/dist/chunk-kztnn301.js +2 -0
  93. package/dist/chunk-mbqqc20a.js +2 -0
  94. package/dist/{chunk-qczse5w4.js → chunk-mcs3wbs4.js} +29 -29
  95. package/dist/{chunk-kjtvdqb9.js → chunk-mek121wh.js} +25 -25
  96. package/dist/chunk-ms4121x1.js +2 -0
  97. package/dist/{chunk-emcbmr0r.js → chunk-mwqas1qk.js} +3 -3
  98. package/dist/chunk-n708h31w.js +2 -0
  99. package/dist/{chunk-954tcahb.js → chunk-nxn7gnpq.js} +2 -2
  100. package/dist/{chunk-ycz5th6b.js → chunk-pf5s5gjp.js} +1 -1
  101. package/dist/{chunk-ytv0k9gy.js → chunk-phqtp1b4.js} +10 -10
  102. package/dist/chunk-pn719qwa.js +2 -0
  103. package/dist/{chunk-ym0e374a.js → chunk-pvfx0dgz.js} +2 -2
  104. package/dist/chunk-pwn2keqq.js +2 -0
  105. package/dist/{chunk-14yjt309.js → chunk-qy11cp1v.js} +4 -4
  106. package/dist/chunk-r0s7vdha.js +2 -0
  107. package/dist/chunk-rwjr5bmd.js +2 -0
  108. package/dist/chunk-ryj2m6fk.js +2 -0
  109. package/dist/chunk-s15nte19.js +2 -0
  110. package/dist/chunk-spz80xnc.js +2 -0
  111. package/dist/{chunk-x7g0946r.js → chunk-tvs9a3vk.js} +1 -1
  112. package/dist/{chunk-zpzk4wd2.js → chunk-tw10tgz8.js} +9 -9
  113. package/dist/chunk-vvgs62za.js +2 -0
  114. package/dist/chunk-vvseb46a.js +2 -0
  115. package/dist/{chunk-zfrpss8y.js → chunk-w41kp60h.js} +4 -4
  116. package/dist/{chunk-9gx5p7zh.js → chunk-wjq1wqn6.js} +2 -2
  117. package/dist/chunk-wywkr0rt.js +2 -0
  118. package/dist/{chunk-2efrxnnt.js → chunk-xdqwq7a6.js} +2 -2
  119. package/dist/chunk-xekmvpha.js +2 -0
  120. package/dist/{chunk-xdwpbqzz.js → chunk-xgd6xgvz.js} +4 -4
  121. package/dist/chunk-xj5rk4pj.js +2 -0
  122. package/dist/chunk-xqtzk9wr.js +2 -0
  123. package/dist/chunk-y1j13dha.js +2 -0
  124. package/dist/{chunk-f30t1g74.js → chunk-y255yybn.js} +2 -2
  125. package/dist/chunk-z5ewms99.js +2 -0
  126. package/dist/{chunk-3f4xy76k.js → chunk-z8ftsz64.js} +6 -6
  127. package/dist/{chunk-f3agc1a3.js → chunk-zsq0754x.js} +3 -3
  128. package/dist/cli.js +19 -19
  129. package/dist/craft-bridge.js +2 -2
  130. package/dist/craft-entry.js +2 -2
  131. package/dist/craft.js +2 -2
  132. package/dist/native-build.d.ts +1 -0
  133. package/dist/native-build.js +5 -3
  134. package/dist/process.d.ts +1 -0
  135. package/dist/process.js +1 -1
  136. package/dist/pwa.js +3 -3
  137. package/dist/render.js +3 -3
  138. package/dist/ssg.js +3 -3
  139. package/package.json +5 -5
  140. package/dist/chunk-0d7dqt4d.js +0 -2
  141. package/dist/chunk-0grt24vd.js +0 -2
  142. package/dist/chunk-2vzfn6vy.js +0 -2
  143. package/dist/chunk-3bsz101e.js +0 -2
  144. package/dist/chunk-3jwjesb5.js +0 -2
  145. package/dist/chunk-4b4es5wg.js +0 -2
  146. package/dist/chunk-4xeafdr6.js +0 -2
  147. package/dist/chunk-4xkqdfqd.js +0 -2
  148. package/dist/chunk-5k989nr4.js +0 -2
  149. package/dist/chunk-5v95x083.js +0 -3
  150. package/dist/chunk-5yf9yzkp.js +0 -2
  151. package/dist/chunk-7mtdjjbt.js +0 -2
  152. package/dist/chunk-88dxeynx.js +0 -2
  153. package/dist/chunk-8er7jc3c.js +0 -2
  154. package/dist/chunk-8phbb8wj.js +0 -2
  155. package/dist/chunk-97zrn4wb.js +0 -18
  156. package/dist/chunk-a83r1xx9.js +0 -2
  157. package/dist/chunk-abpeac2d.js +0 -2
  158. package/dist/chunk-adzsqsjt.js +0 -2
  159. package/dist/chunk-b1ndskw9.js +0 -2
  160. package/dist/chunk-b7fp3zta.js +0 -2
  161. package/dist/chunk-bgfkbesj.js +0 -2
  162. package/dist/chunk-cy83yfy9.js +0 -2
  163. package/dist/chunk-dbqb1a51.js +0 -2
  164. package/dist/chunk-e8t64hxk.js +0 -2
  165. package/dist/chunk-e943xk88.js +0 -2
  166. package/dist/chunk-g039c67x.js +0 -2
  167. package/dist/chunk-ghfxfcr9.js +0 -2
  168. package/dist/chunk-gvyq9xt6.js +0 -2
  169. package/dist/chunk-h30y9k44.js +0 -2
  170. package/dist/chunk-hwp3m8a8.js +0 -2
  171. package/dist/chunk-jarptkbv.js +0 -2
  172. package/dist/chunk-km4xp898.js +0 -2
  173. package/dist/chunk-meze7k8v.js +0 -2
  174. package/dist/chunk-mfwrxz9z.js +0 -2
  175. package/dist/chunk-mmpm1awz.js +0 -2
  176. package/dist/chunk-n7vetrt4.js +0 -2
  177. package/dist/chunk-nd716zha.js +0 -2
  178. package/dist/chunk-ptjz4f2e.js +0 -2
  179. package/dist/chunk-q4hmgj72.js +0 -2
  180. package/dist/chunk-q841b6x4.js +0 -2
  181. package/dist/chunk-qnh5x7vv.js +0 -2
  182. package/dist/chunk-qxjfvkjt.js +0 -2
  183. package/dist/chunk-rhhwz7e9.js +0 -2
  184. package/dist/chunk-rpbe5h6v.js +0 -2
  185. package/dist/chunk-rrdn4qnn.js +0 -2
  186. package/dist/chunk-s7c9kb53.js +0 -2
  187. package/dist/chunk-sfj84n72.js +0 -2
  188. package/dist/chunk-sgr2hhsc.js +0 -2
  189. package/dist/chunk-taztcvv3.js +0 -2
  190. package/dist/chunk-vczt5k2j.js +0 -2
  191. package/dist/chunk-wn1s8af8.js +0 -2
  192. package/dist/chunk-y3jyk5bj.js +0 -2
  193. package/dist/chunk-ytxzy6eg.js +0 -2
  194. package/dist/chunk-ywf319rp.js +0 -2
  195. package/dist/chunk-yww6c9we.js +0 -2
  196. package/dist/chunk-yy43hxb7.js +0 -2
  197. package/dist/chunk-z42jb949.js +0 -2
  198. package/dist/chunk-zw20a7q4.js +0 -2
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- function Bo(e){return e}class a{plugins=new Map;sortedPlugins=[];initialized=!1;async register(e,t){if(this.plugins.has(e.name))throw Error(`Plugin "${e.name}" is already registered`);if(e.dependencies){for(let r of e.dependencies)if(!this.plugins.has(r))throw Error(`Plugin "${e.name}" depends on "${r}" which is not registered`)}if(this.plugins.set(e.name,e),e.onRegister)await e.onRegister(t);this.sortPlugins()}async unregister(e){let t=this.plugins.get(e);if(!t)return!1;for(let[r,i]of this.plugins)if(i.dependencies?.includes(e))throw Error(`Cannot unregister "${e}" because "${r}" depends on it`);if(t.onUnregister)await t.onUnregister();return this.plugins.delete(e),this.sortPlugins(),!0}get(e){return this.plugins.get(e)}has(e){return this.plugins.has(e)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let e=[];for(let t of this.sortedPlugins)if(t.registerDirectives)e.push(...t.registerDirectives());return e}getAllFilters(){let e={};for(let t of this.sortedPlugins)if(t.registerFilters)Object.assign(e,t.registerFilters());return e}async runBeforeProcess(e){return this.runHooks("beforeProcess",e)}async runAfterParse(e){return this.runHooks("afterParse",e)}async runBeforeDirective(e,t){return this.runDirectiveHooks("beforeDirective",e,t)}async runAfterDirective(e,t){return this.runDirectiveHooks("afterDirective",e,t)}async runBeforeRender(e){return this.runHooks("beforeRender",e)}async runAfterRender(e){return this.runHooks("afterRender",e)}async runOnError(e){for(let t of this.sortedPlugins)if(t.onError)try{let r=await t.onError(e);if(r){if(r.template!==void 0)e.template=r.template;if(r.context)e.context={...e.context,...r.context};if(r.metadata)e.metadata={...e.metadata,...r.metadata};if(r.skip)return e}}catch(r){console.error(`Error in plugin "${t.name}" onError hook:`,r)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}async runHooks(e,t){let r={...t};for(let i of this.sortedPlugins){let s=i[e];if(s)try{let n=await s(r);if(n){if(n.template!==void 0)r.template=n.template;if(n.context)r.context={...r.context,...n.context};if(n.metadata)r.metadata={...r.metadata,...n.metadata};if(n.skip)break}}catch(n){console.error(`Error in plugin "${i.name}" ${e} hook:`,n)}}return r}async runDirectiveHooks(e,t,r){let i={...r};for(let s of this.sortedPlugins){let n=s[e];if(n)try{let o=await n(t,i);if(o){if(o.template!==void 0)i.template=o.template;if(o.context)i.context={...i.context,...o.context};if(o.metadata)i.metadata={...i.metadata,...o.metadata};if(o.skip)break}}catch(o){console.error(`Error in plugin "${s.name}" ${e} hook:`,o)}}return i}}var Ul=new a;var u=Bo({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(e){console.log("[stx-debug] beforeProcess:",e.filePath)},afterParse(e){console.log("[stx-debug] afterParse:",e.template.length,"chars")},beforeDirective(e,t){console.log("[stx-debug] beforeDirective:",e)},afterDirective(e,t){console.log("[stx-debug] afterDirective:",e)},beforeRender(e){console.log("[stx-debug] beforeRender")},afterRender(e){console.log("[stx-debug] afterRender:",e.template.length,"chars")},onError(e){console.error("[stx-debug] onError:",e.error.message,"in phase:",e.phase)}}),l=Bo({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(e){e.metadata.startTime=performance.now()},afterRender(e){let t=e.metadata.startTime;if(t){let r=performance.now()-t;console.log(`[stx-timing] Processing took ${r.toFixed(2)}ms`)}}});export{Bo,Ul};
2
+ function Fo(e){return e}class a{plugins=new Map;sortedPlugins=[];initialized=!1;async register(e,t){if(this.plugins.has(e.name))throw Error(`Plugin "${e.name}" is already registered`);if(e.dependencies){for(let r of e.dependencies)if(!this.plugins.has(r))throw Error(`Plugin "${e.name}" depends on "${r}" which is not registered`)}if(this.plugins.set(e.name,e),e.onRegister)await e.onRegister(t);this.sortPlugins()}async unregister(e){let t=this.plugins.get(e);if(!t)return!1;for(let[r,i]of this.plugins)if(i.dependencies?.includes(e))throw Error(`Cannot unregister "${e}" because "${r}" depends on it`);if(t.onUnregister)await t.onUnregister();return this.plugins.delete(e),this.sortPlugins(),!0}get(e){return this.plugins.get(e)}has(e){return this.plugins.has(e)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let e=[];for(let t of this.sortedPlugins)if(t.registerDirectives)e.push(...t.registerDirectives());return e}getAllFilters(){let e={};for(let t of this.sortedPlugins)if(t.registerFilters)Object.assign(e,t.registerFilters());return e}async runBeforeProcess(e){return this.runHooks("beforeProcess",e)}async runAfterParse(e){return this.runHooks("afterParse",e)}async runBeforeDirective(e,t){return this.runDirectiveHooks("beforeDirective",e,t)}async runAfterDirective(e,t){return this.runDirectiveHooks("afterDirective",e,t)}async runBeforeRender(e){return this.runHooks("beforeRender",e)}async runAfterRender(e){return this.runHooks("afterRender",e)}async runOnError(e){for(let t of this.sortedPlugins)if(t.onError)try{let r=await t.onError(e);if(r){if(r.template!==void 0)e.template=r.template;if(r.context)e.context={...e.context,...r.context};if(r.metadata)e.metadata={...e.metadata,...r.metadata};if(r.skip)return e}}catch(r){console.error(`Error in plugin "${t.name}" onError hook:`,r)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}async runHooks(e,t){let r={...t};for(let i of this.sortedPlugins){let s=i[e];if(s)try{let n=await s(r);if(n){if(n.template!==void 0)r.template=n.template;if(n.context)r.context={...r.context,...n.context};if(n.metadata)r.metadata={...r.metadata,...n.metadata};if(n.skip)break}}catch(n){console.error(`Error in plugin "${i.name}" ${e} hook:`,n)}}return r}async runDirectiveHooks(e,t,r){let i={...r};for(let s of this.sortedPlugins){let n=s[e];if(n)try{let o=await n(t,i);if(o){if(o.template!==void 0)i.template=o.template;if(o.context)i.context={...i.context,...o.context};if(o.metadata)i.metadata={...i.metadata,...o.metadata};if(o.skip)break}}catch(o){console.error(`Error in plugin "${s.name}" ${e} hook:`,o)}}return i}}var Wl=new a;var u=Fo({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(e){console.log("[stx-debug] beforeProcess:",e.filePath)},afterParse(e){console.log("[stx-debug] afterParse:",e.template.length,"chars")},beforeDirective(e,t){console.log("[stx-debug] beforeDirective:",e)},afterDirective(e,t){console.log("[stx-debug] afterDirective:",e)},beforeRender(e){console.log("[stx-debug] beforeRender")},afterRender(e){console.log("[stx-debug] afterRender:",e.template.length,"chars")},onError(e){console.error("[stx-debug] onError:",e.error.message,"in phase:",e.phase)}}),l=Fo({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(e){e.metadata.startTime=performance.now()},afterRender(e){let t=e.metadata.startTime;if(t){let r=performance.now()-t;console.log(`[stx-timing] Processing took ${r.toFixed(2)}ms`)}}});export{Fo,Wl};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{R,k,sn,on,an}from"./chunk-4n24jbfs.js";import{resolve as Q,basename as J,extname as K,join as Y}from"path";import{mkdir as Z}from"fs/promises";var N={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0};class Zr{config;constructor(t={}){this.config={...N,...t}}async get(t,e){return sn(t,e,"video",this.config)}async set(t,e,a){return on(t,e,a,"video",this.config)}async clear(){return an("video",this.config)}updateConfig(t){this.config={...this.config,...t}}}var v=null;function B(t){if(!v)v=new Zr(t);else if(t)v.updateConfig(t);return v}async function Qr(t,e,a){let c=a?{directory:`${a.outputDir}/../.cache`}:{};return B(c).get(t,e)}async function es(t,e,a,c){let r=c?{directory:`${c.outputDir}/../.cache`}:{};return B(r).set(t,e,a)}async function Fa(){return B().clear()}import{resolve as _,basename as D,extname as A,join as H}from"path";import{mkdir as M}from"fs/promises";async function L(){try{return await import("ts-videos")}catch{return null}}async function ts(t,e,a,c){let r=await L();if(!r)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let n=_(t);if(!await k(n))return null;await M(a,{recursive:!0});let i=await R(n),s=D(t,A(t)),o=e.format||"webp",h=e.timestamp||0,y=`${s}-poster-${i}.${o}`,u=H(a,y),m=await r.extractThumbnails(n,{timestamps:[h],width:e.width||1280,height:e.height,format:o,quality:e.quality||85,outputDir:a,outputPattern:y.replace(`.${o}`,"")});if(m&&m.length>0){let d=m[0];return{path:u,url:`${c}/${y}`,width:d.width||e.width||1280,height:d.height||720,timestamp:h,size:d.size||0}}return null}catch(n){return console.warn(`[stx-media] Failed to generate poster: ${n}`),null}}async function ns(t,e,a,c){let r=await L();if(!r)return[];try{let n=_(t);if(!await k(n))return[];await M(a,{recursive:!0});let i=await R(n),s=D(t,A(t)),o=e.format||"webp",u=(await new r.Input(n).getInfo()).duration||60,m=e.count||10,d=e.interval||u/m,g=[];for(let f=0;f<m&&f*d<u;f++)g.push(f*d);let l=await r.extractThumbnails(n,{timestamps:g,width:e.width||320,format:o,quality:e.quality||80,outputDir:a,outputPattern:`${s}-thumb-${i}`});if(l&&l.length>0)return l.map((f,b)=>({path:f.path||H(a,`${s}-thumb-${i}-${b}.${o}`),url:`${c}/${s}-thumb-${i}-${b}.${o}`,width:f.width||e.width||320,height:f.height||180,timestamp:g[b],size:f.size||0}));return[]}catch(n){return console.warn(`[stx-media] Failed to generate thumbnails: ${n}`),[]}}async function za(t,e,a,c){let r=await L();if(!r)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let n=_(t);if(!await k(n))return null;await M(a,{recursive:!0});let i=await R(n),s=D(t,A(t)),y=(await new r.Input(n).getInfo()).duration||60,u=e.columns||10,m=e.interval||5,d=e.thumbnailWidth||160,g=e.thumbnailHeight||90,l=e.format||"jpeg",f=Math.ceil(y/m),b=Math.ceil(f/u),S=`${s}-sprite-${i}.${l}`,w=H(a,S),C=[];for(let P=0;P<f;P++)C.push(P*m);let p=await r.extractThumbnails(n,{timestamps:C,width:d,height:g,format:l,quality:e.quality||70,outputDir:H(a,".temp")});if(!p||p.length===0)return null;try{let P=await import("ts-images"),x=u*d,ie=b*g,re=await P.createSprite({images:p.map((U)=>U.path),columns:u,padding:0,outputPath:w,format:l,quality:e.quality||70});return{url:`${c}/${S}`,path:w,columns:u,rows:b,thumbnailWidth:d,thumbnailHeight:g,interval:m,totalFrames:f}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(n){return console.warn(`[stx-media] Failed to generate sprite sheet: ${n}`),null}}import{resolve as E,basename as F,extname as W,join as V}from"path";import{mkdir as T,writeFile as q}from"fs/promises";async function z(){try{return await import("ts-videos")}catch{return null}}var j=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}];async function rs(t,e,a,c,r){let n=await z();if(!n)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let i=E(t);if(!await k(i))return null;let s=await R(i),o=F(t,W(t)),h=V(a,`${o}-${s}-hls`);await T(h,{recursive:!0});let y=e.length>0?e:j,u=r?.segmentDuration||6,g=(await new n.Input(i).getInfo()).duration||0,l=[],f=0;for(let w of y){let C=V(h,w.label);await T(C,{recursive:!0});let p=`${w.label}.m3u8`,P=V(C,p);try{let x=await n.generateHLS(i,{outputDir:C,segmentDuration:u,width:w.width,height:w.height,videoBitrate:w.bitrate,audioBitrate:w.audioBitrate,playlistName:w.label});if(x)l.push({quality:w,url:`${c}/${o}-${s}-hls/${w.label}/${p}`,path:P}),f+=x.segmentCount||Math.ceil(g/u)}catch(x){console.warn(`[stx-media] Failed to generate HLS for ${w.label}: ${x}`)}}if(l.length===0)return null;let b=V(h,"master.m3u8"),S=X(l,c,o,s);return await q(b,S),{manifestUrl:`${c}/${o}-${s}-hls/master.m3u8`,manifestPath:b,playlists:l,segmentCount:f,duration:g}}catch(i){return console.warn(`[stx-media] Failed to generate HLS manifest: ${i}`),null}}function X(t,e,a,c){let r=["#EXTM3U","#EXT-X-VERSION:3"];for(let n of t){let{quality:i}=n,s=i.bitrate+(i.audioBitrate||128000),o=`${i.width}x${i.height||Math.round(i.width*9/16)}`;r.push(`#EXT-X-STREAM-INF:BANDWIDTH=${s},RESOLUTION=${o},NAME="${i.label}"`,`${i.label}/${i.label}.m3u8`)}return r.join(`
3
- `)}async function ss(t,e,a,c,r){let n=await z();if(!n)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let i=E(t);if(!await k(i))return null;let s=await R(i),o=F(t,W(t)),h=V(a,`${o}-${s}-dash`);await T(h,{recursive:!0});let y=e.length>0?e:j,u=r?.segmentDuration||4,m=r?.minBufferTime||2,l=(await new n.Input(i).getInfo()).duration||0,f=[],b=[];for(let p of y){let P=V(h,p.label);await T(P,{recursive:!0});try{if(await n.generateDASH(i,{outputDir:P,segmentDuration:u,width:p.width,height:p.height,videoBitrate:p.bitrate,audioBitrate:p.audioBitrate})){if(f.push({bandwidth:p.bitrate,width:p.width,height:p.height||Math.round(p.width*9/16),url:`${c}/${o}-${s}-dash/${p.label}/video`}),p.audioBitrate)b.push({bandwidth:p.audioBitrate,url:`${c}/${o}-${s}-dash/${p.label}/audio`})}}catch(x){console.warn(`[stx-media] Failed to generate DASH for ${p.label}: ${x}`)}}if(f.length===0)return null;let S=V(h,"manifest.mpd"),w=G(f,b,l,u,m);await q(S,w);let C=[{type:"video",representations:f}];if(b.length>0)C.push({type:"audio",representations:b});return{manifestUrl:`${c}/${o}-${s}-dash/manifest.mpd`,manifestPath:S,adaptationSets:C,duration:l}}catch(i){return console.warn(`[stx-media] Failed to generate DASH manifest: ${i}`),null}}function G(t,e,a,c,r){let n=I(a),i=I(r),s=`<?xml version="1.0" encoding="UTF-8"?>
2
+ import{R,k,sn,on,an}from"./chunk-4n24jbfs.js";import{resolve as Q,basename as J,extname as K,join as Y}from"path";import{mkdir as Z}from"fs/promises";var N={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0};class Qr{config;constructor(t={}){this.config={...N,...t}}async get(t,e){return sn(t,e,"video",this.config)}async set(t,e,a){return on(t,e,a,"video",this.config)}async clear(){return an("video",this.config)}updateConfig(t){this.config={...this.config,...t}}}var v=null;function B(t){if(!v)v=new Qr(t);else if(t)v.updateConfig(t);return v}async function es(t,e,a){let c=a?{directory:`${a.outputDir}/../.cache`}:{};return B(c).get(t,e)}async function ts(t,e,a,c){let r=c?{directory:`${c.outputDir}/../.cache`}:{};return B(r).set(t,e,a)}async function za(){return B().clear()}import{resolve as _,basename as D,extname as A,join as H}from"path";import{mkdir as M}from"fs/promises";async function L(){try{return await import("ts-videos")}catch{return null}}async function ns(t,e,a,c){let r=await L();if(!r)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let n=_(t);if(!await k(n))return null;await M(a,{recursive:!0});let i=await R(n),s=D(t,A(t)),o=e.format||"webp",h=e.timestamp||0,y=`${s}-poster-${i}.${o}`,u=H(a,y),m=await r.extractThumbnails(n,{timestamps:[h],width:e.width||1280,height:e.height,format:o,quality:e.quality||85,outputDir:a,outputPattern:y.replace(`.${o}`,"")});if(m&&m.length>0){let d=m[0];return{path:u,url:`${c}/${y}`,width:d.width||e.width||1280,height:d.height||720,timestamp:h,size:d.size||0}}return null}catch(n){return console.warn(`[stx-media] Failed to generate poster: ${n}`),null}}async function rs(t,e,a,c){let r=await L();if(!r)return[];try{let n=_(t);if(!await k(n))return[];await M(a,{recursive:!0});let i=await R(n),s=D(t,A(t)),o=e.format||"webp",u=(await new r.Input(n).getInfo()).duration||60,m=e.count||10,d=e.interval||u/m,g=[];for(let f=0;f<m&&f*d<u;f++)g.push(f*d);let l=await r.extractThumbnails(n,{timestamps:g,width:e.width||320,format:o,quality:e.quality||80,outputDir:a,outputPattern:`${s}-thumb-${i}`});if(l&&l.length>0)return l.map((f,b)=>({path:f.path||H(a,`${s}-thumb-${i}-${b}.${o}`),url:`${c}/${s}-thumb-${i}-${b}.${o}`,width:f.width||e.width||320,height:f.height||180,timestamp:g[b],size:f.size||0}));return[]}catch(n){return console.warn(`[stx-media] Failed to generate thumbnails: ${n}`),[]}}async function Ha(t,e,a,c){let r=await L();if(!r)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let n=_(t);if(!await k(n))return null;await M(a,{recursive:!0});let i=await R(n),s=D(t,A(t)),y=(await new r.Input(n).getInfo()).duration||60,u=e.columns||10,m=e.interval||5,d=e.thumbnailWidth||160,g=e.thumbnailHeight||90,l=e.format||"jpeg",f=Math.ceil(y/m),b=Math.ceil(f/u),S=`${s}-sprite-${i}.${l}`,w=H(a,S),C=[];for(let P=0;P<f;P++)C.push(P*m);let p=await r.extractThumbnails(n,{timestamps:C,width:d,height:g,format:l,quality:e.quality||70,outputDir:H(a,".temp")});if(!p||p.length===0)return null;try{let P=await import("ts-images"),x=u*d,ie=b*g,re=await P.createSprite({images:p.map((U)=>U.path),columns:u,padding:0,outputPath:w,format:l,quality:e.quality||70});return{url:`${c}/${S}`,path:w,columns:u,rows:b,thumbnailWidth:d,thumbnailHeight:g,interval:m,totalFrames:f}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(n){return console.warn(`[stx-media] Failed to generate sprite sheet: ${n}`),null}}import{resolve as E,basename as F,extname as W,join as V}from"path";import{mkdir as T,writeFile as q}from"fs/promises";async function z(){try{return await import("ts-videos")}catch{return null}}var j=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}];async function ss(t,e,a,c,r){let n=await z();if(!n)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let i=E(t);if(!await k(i))return null;let s=await R(i),o=F(t,W(t)),h=V(a,`${o}-${s}-hls`);await T(h,{recursive:!0});let y=e.length>0?e:j,u=r?.segmentDuration||6,g=(await new n.Input(i).getInfo()).duration||0,l=[],f=0;for(let w of y){let C=V(h,w.label);await T(C,{recursive:!0});let p=`${w.label}.m3u8`,P=V(C,p);try{let x=await n.generateHLS(i,{outputDir:C,segmentDuration:u,width:w.width,height:w.height,videoBitrate:w.bitrate,audioBitrate:w.audioBitrate,playlistName:w.label});if(x)l.push({quality:w,url:`${c}/${o}-${s}-hls/${w.label}/${p}`,path:P}),f+=x.segmentCount||Math.ceil(g/u)}catch(x){console.warn(`[stx-media] Failed to generate HLS for ${w.label}: ${x}`)}}if(l.length===0)return null;let b=V(h,"master.m3u8"),S=X(l,c,o,s);return await q(b,S),{manifestUrl:`${c}/${o}-${s}-hls/master.m3u8`,manifestPath:b,playlists:l,segmentCount:f,duration:g}}catch(i){return console.warn(`[stx-media] Failed to generate HLS manifest: ${i}`),null}}function X(t,e,a,c){let r=["#EXTM3U","#EXT-X-VERSION:3"];for(let n of t){let{quality:i}=n,s=i.bitrate+(i.audioBitrate||128000),o=`${i.width}x${i.height||Math.round(i.width*9/16)}`;r.push(`#EXT-X-STREAM-INF:BANDWIDTH=${s},RESOLUTION=${o},NAME="${i.label}"`,`${i.label}/${i.label}.m3u8`)}return r.join(`
3
+ `)}async function os(t,e,a,c,r){let n=await z();if(!n)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let i=E(t);if(!await k(i))return null;let s=await R(i),o=F(t,W(t)),h=V(a,`${o}-${s}-dash`);await T(h,{recursive:!0});let y=e.length>0?e:j,u=r?.segmentDuration||4,m=r?.minBufferTime||2,l=(await new n.Input(i).getInfo()).duration||0,f=[],b=[];for(let p of y){let P=V(h,p.label);await T(P,{recursive:!0});try{if(await n.generateDASH(i,{outputDir:P,segmentDuration:u,width:p.width,height:p.height,videoBitrate:p.bitrate,audioBitrate:p.audioBitrate})){if(f.push({bandwidth:p.bitrate,width:p.width,height:p.height||Math.round(p.width*9/16),url:`${c}/${o}-${s}-dash/${p.label}/video`}),p.audioBitrate)b.push({bandwidth:p.audioBitrate,url:`${c}/${o}-${s}-dash/${p.label}/audio`})}}catch(x){console.warn(`[stx-media] Failed to generate DASH for ${p.label}: ${x}`)}}if(f.length===0)return null;let S=V(h,"manifest.mpd"),w=G(f,b,l,u,m);await q(S,w);let C=[{type:"video",representations:f}];if(b.length>0)C.push({type:"audio",representations:b});return{manifestUrl:`${c}/${o}-${s}-dash/manifest.mpd`,manifestPath:S,adaptationSets:C,duration:l}}catch(i){return console.warn(`[stx-media] Failed to generate DASH manifest: ${i}`),null}}function G(t,e,a,c,r){let n=I(a),i=I(r),s=`<?xml version="1.0" encoding="UTF-8"?>
4
4
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
5
5
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6
6
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -26,4 +26,4 @@ import{R,k,sn,on,an}from"./chunk-4n24jbfs.js";import{resolve as Q,basename as J,
26
26
  </Representation>
27
27
  `}s+=` </AdaptationSet>
28
28
  `}return s+=` </Period>
29
- </MPD>`,s}function I(t){let e=Math.floor(t/3600),a=Math.floor(t%3600/60),c=Math.floor(t%60),r="PT";if(e>0)r+=`${e}H`;if(a>0)r+=`${a}M`;return r+=`${c}S`,r}async function O(){try{return await import("ts-videos")}catch{return null}}function ee(t){switch(t){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function te(t){switch(t){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function zo(t){let e=await O();if(!e)return null;try{let a=Q(t),r=await new e.Input(a).getInfo();return{duration:r.duration||0,width:r.width||0,height:r.height||0,frameRate:r.frameRate||0,bitrate:r.bitrate||0,codec:r.videoCodec||"",audioCodec:r.audioCodec}}catch(a){return console.warn(`[stx-media] Failed to analyze video: ${a}`),null}}async function Ha(t,e,a,c){let r=await O();if(!r)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:t,processed:!1};let n=await Qr(t,e,a);if(n)return n;try{let i=Q(t);if(!await k(i))return{src:t,processed:!1,errors:[`Source file not found: ${t}`]};let s=a.outputDir||"dist/videos",o=a.baseUrl||"/videos";await Z(s,{recursive:!0});let h=await R(i),y=J(t,K(t)),u={src:t,processed:!0,hash:h};c?.({percentage:5,stage:"analyzing"}),u.metadata=await zo(i)||void 0;let m={};if(e.quality)m.bitrate=ee(e.quality);if(e.platform)Object.assign(m,te(e.platform));if(e.transcode)Object.assign(m,e.transcode);if(Object.keys(m).length>0||e.process){c?.({percentage:10,stage:"transcoding"});let d=`${y}-${h}.mp4`,g=Y(s,d);try{let l=await ae(i,g,m,r,(f)=>c?.({percentage:10+f*0.5,stage:"transcoding"}));if(l)u.transcoded={path:g,url:`${o}/${d}`,duration:l.duration,size:l.size,video:{codec:m.codec||"h264",width:l.width,height:l.height,bitrate:l.bitrate,frameRate:l.frameRate},audio:l.audioCodec?{codec:m.audioCodec||"aac",bitrate:m.audioBitrate||128000,sampleRate:m.sampleRate||48000,channels:m.channels||2}:void 0}}catch(l){u.errors=u.errors||[],u.errors.push(`Transcoding failed: ${l}`)}}if(e.generatePoster){c?.({percentage:65,stage:"generating-poster"});let d=typeof e.generatePoster==="object"?e.generatePoster:{timestamp:0},g=await ts(i,d,s,o);if(g)u.poster=g}if(a.thumbnails?.enabled){c?.({percentage:70,stage:"generating-thumbnails"});let d=await ns(i,a.thumbnails,s,o);if(d.length>0)u.thumbnails=d}if(e.streaming){c?.({percentage:80,stage:"generating-manifests"});let d=typeof e.streaming==="object"?e.streaming:a.streaming||{format:"hls"};if(d.format==="hls"||d.format===void 0){let g=await rs(i,d.qualities||a.streaming?.defaultQualities||[],s,o);if(g)u.streaming={...u.streaming,hls:g}}if(d.format==="dash"){let g=await ss(i,d.qualities||a.streaming?.defaultQualities||[],s,o);if(g)u.streaming={...u.streaming,dash:g}}}if(e.spriteSheet)c?.({percentage:90,stage:"generating-sprite-sheet"});return c?.({percentage:100,stage:"complete"}),await es(t,e,u,a),u}catch(i){return{src:t,processed:!1,errors:[`Processing failed: ${i}`]}}}async function ae(t,e,a,c,r){try{let i=await new c.Conversion(t,e,{videoCodec:a.codec,videoBitrate:a.bitrate,width:a.maxWidth,height:a.maxHeight,frameRate:a.frameRate,audioCodec:a.audioCodec,audioBitrate:a.audioBitrate,sampleRate:a.sampleRate,channels:a.channels}).run((s)=>{r?.(s.percentage/100)});return{duration:i.duration||0,size:i.size||0,width:i.width||a.maxWidth||0,height:i.height||a.maxHeight||0,bitrate:i.bitrate||a.bitrate||0,frameRate:i.frameRate||a.frameRate||30,audioCodec:i.audioCodec}}catch(n){return console.error(`[stx-media] Transcoding failed: ${n}`),null}}export{Zr,Qr,es,Fa,ts,ns,za,rs,ss,zo,Ha};
29
+ </MPD>`,s}function I(t){let e=Math.floor(t/3600),a=Math.floor(t%3600/60),c=Math.floor(t%60),r="PT";if(e>0)r+=`${e}H`;if(a>0)r+=`${a}M`;return r+=`${c}S`,r}async function O(){try{return await import("ts-videos")}catch{return null}}function ee(t){switch(t){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function te(t){switch(t){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function Ho(t){let e=await O();if(!e)return null;try{let a=Q(t),r=await new e.Input(a).getInfo();return{duration:r.duration||0,width:r.width||0,height:r.height||0,frameRate:r.frameRate||0,bitrate:r.bitrate||0,codec:r.videoCodec||"",audioCodec:r.audioCodec}}catch(a){return console.warn(`[stx-media] Failed to analyze video: ${a}`),null}}async function Va(t,e,a,c){let r=await O();if(!r)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:t,processed:!1};let n=await es(t,e,a);if(n)return n;try{let i=Q(t);if(!await k(i))return{src:t,processed:!1,errors:[`Source file not found: ${t}`]};let s=a.outputDir||"dist/videos",o=a.baseUrl||"/videos";await Z(s,{recursive:!0});let h=await R(i),y=J(t,K(t)),u={src:t,processed:!0,hash:h};c?.({percentage:5,stage:"analyzing"}),u.metadata=await Ho(i)||void 0;let m={};if(e.quality)m.bitrate=ee(e.quality);if(e.platform)Object.assign(m,te(e.platform));if(e.transcode)Object.assign(m,e.transcode);if(Object.keys(m).length>0||e.process){c?.({percentage:10,stage:"transcoding"});let d=`${y}-${h}.mp4`,g=Y(s,d);try{let l=await ae(i,g,m,r,(f)=>c?.({percentage:10+f*0.5,stage:"transcoding"}));if(l)u.transcoded={path:g,url:`${o}/${d}`,duration:l.duration,size:l.size,video:{codec:m.codec||"h264",width:l.width,height:l.height,bitrate:l.bitrate,frameRate:l.frameRate},audio:l.audioCodec?{codec:m.audioCodec||"aac",bitrate:m.audioBitrate||128000,sampleRate:m.sampleRate||48000,channels:m.channels||2}:void 0}}catch(l){u.errors=u.errors||[],u.errors.push(`Transcoding failed: ${l}`)}}if(e.generatePoster){c?.({percentage:65,stage:"generating-poster"});let d=typeof e.generatePoster==="object"?e.generatePoster:{timestamp:0},g=await ns(i,d,s,o);if(g)u.poster=g}if(a.thumbnails?.enabled){c?.({percentage:70,stage:"generating-thumbnails"});let d=await rs(i,a.thumbnails,s,o);if(d.length>0)u.thumbnails=d}if(e.streaming){c?.({percentage:80,stage:"generating-manifests"});let d=typeof e.streaming==="object"?e.streaming:a.streaming||{format:"hls"};if(d.format==="hls"||d.format===void 0){let g=await ss(i,d.qualities||a.streaming?.defaultQualities||[],s,o);if(g)u.streaming={...u.streaming,hls:g}}if(d.format==="dash"){let g=await os(i,d.qualities||a.streaming?.defaultQualities||[],s,o);if(g)u.streaming={...u.streaming,dash:g}}}if(e.spriteSheet)c?.({percentage:90,stage:"generating-sprite-sheet"});return c?.({percentage:100,stage:"complete"}),await ts(t,e,u,a),u}catch(i){return{src:t,processed:!1,errors:[`Processing failed: ${i}`]}}}async function ae(t,e,a,c,r){try{let i=await new c.Conversion(t,e,{videoCodec:a.codec,videoBitrate:a.bitrate,width:a.maxWidth,height:a.maxHeight,frameRate:a.frameRate,audioCodec:a.audioCodec,audioBitrate:a.audioBitrate,sampleRate:a.sampleRate,channels:a.channels}).run((s)=>{r?.(s.percentage/100)});return{duration:i.duration||0,size:i.size||0,width:i.width||a.maxWidth||0,height:i.height||a.maxHeight||0,bitrate:i.bitrate||a.bitrate||0,frameRate:i.frameRate||a.frameRate||30,audioCodec:i.audioCodec}}catch(n){return console.error(`[stx-media] Transcoding failed: ${n}`),null}}export{Qr,es,ts,za,ns,rs,Ha,ss,os,Ho,Va};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ke,Oc,ad,cd,ld,ud,Nc,Dc,dd,pd,bi,fd,xn,Sn,ur}from"./chunk-0bptz1km.js";import"./chunk-95ygdn0n.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-jdx4za9p.js";import"./chunk-a0ygyftk.js";import"./chunk-arrvcn7c.js";import"./chunk-tw10tgz8.js";import"./chunk-hjtym7d9.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-fk79x8ns.js";import"./chunk-pvfx0dgz.js";export{ud as __setSignalsGeneratorsForTest,Ke as cacheEngineFingerprint,Sn as cacheTemplate,xn as checkCache,fd as clearDevCaches,Dc as getCachedRouterScript,Nc as getCachedSignalsRuntime,dd as getServeClientAsset,bi as getServeModuleBundle,ur as hashFilePath,cd as invalidateFileCache,ld as invalidateFileCacheByDir,ad as readFileCached,pd as registerServeModuleBundle,Oc as templateCache};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{us,ei,ti,Zu}from"./chunk-0ergsswn.js";export{us as NATIVE_COMPONENTS,ei as compileToNative,ti as createHotReloadServer,Zu as default};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ve,Vt,xr,Xs,C,at}from"./chunk-a0ygyftk.js";export{Vt as currentRuntimeConfig,at as injectRuntimeConfig,C as resolveRuntimeConfig,Xs as useRuntimeConfig,xr as useServerRuntimeConfig,ve as withRuntimeConfig};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{bc,vc,pe,wc,di,$t,Rt,Qu,pi,At,yn,xc,Sc,kc,gs,Pt,Cc,It,_c}from"./chunk-215fsx0k.js";import"./chunk-26g3m2mg.js";import"./chunk-bsts9pr5.js";import"./chunk-0bptz1km.js";import"./chunk-95ygdn0n.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-jdx4za9p.js";import"./chunk-a0ygyftk.js";import"./chunk-arrvcn7c.js";import"./chunk-tw10tgz8.js";import"./chunk-hjtym7d9.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-fk79x8ns.js";import"./chunk-pvfx0dgz.js";export{yn as MODULE_SPECIFIER_PREFIX,bc as bundleCacheDir,vc as bundleCacheEntryLimit,It as bundleClientScript,Rt as clearBundleFailures,pe as clientBundleDependencies,$t as getBundleFailures,At as hasUserImports,Pt as moduleSubstitutionKey,Sc as normalizeRegistrySpecifiers,Cc as queueClientBundleBuild,di as recordBundleFailure,xc as registryIdForPath,pi as resolveBundlerFallback,kc as rewriteRegistryImports,Qu as setBundlerFallbackMode,wc as shouldLogBundlerDiagnostics,_c as tempBuildName,gs as withModuleSubstitutes};