clipoox-render 0.4.6 → 0.4.8

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 (142) hide show
  1. package/package.json +2 -2
  2. package/scripts/render-local.mjs +2656 -1672
  3. package/shared/photocraft/LICENSE.txt +206 -0
  4. package/shared/photocraft/clipoox_photo.js +396 -0
  5. package/shared/photocraft/clipoox_photo_bg.wasm +0 -0
  6. package/web/assets/{FxEmbed-ROS6C_HI.js → FxEmbed-adbxHEBi.js} +1 -1
  7. package/web/assets/ImageStudio-CMxiT1jp.js +3 -0
  8. package/web/assets/ImageStudio-De_DCTrz.css +1 -0
  9. package/web/assets/{MotionEmbed-E2hCysi-.js → MotionEmbed-CDUIyjk0.js} +1 -1
  10. package/web/assets/{PluginStore-CwUSpwPp.js → PluginStore-By_pdOOg.js} +2 -2
  11. package/web/assets/ShotComposer-DcwWZ-eP.css +1 -0
  12. package/web/assets/ShotComposer-XIbJ4nNm.js +287 -0
  13. package/web/assets/{TemplateEmbed-qG1AXdtf.js → TemplateEmbed-a01nKECT.js} +1 -1
  14. package/web/assets/{TimelinePlugins-CB1b6-Cb.js → TimelinePlugins-CqLMVjuh.js} +4 -4
  15. package/web/assets/TimelineShotFx-QmkyCg31.js +2 -0
  16. package/web/assets/{TransitionEmbed-Dym9P7--.js → TransitionEmbed-Cbwlxfl2.js} +1 -1
  17. package/web/assets/{Whiteboard-BdGjJZXW.js → Whiteboard-ChYqIr3v.js} +1 -1
  18. package/web/assets/{aerial-yLD_gDzw.js → aerial-CZeCeacv.js} +2 -2
  19. package/web/assets/{agentTools-B7g6tXTR.js → agentTools-DW2ETnxE.js} +2 -2
  20. package/web/assets/{aiInbetween-6eKDYbYS.js → aiInbetween-De98iM4m.js} +2 -2
  21. package/web/assets/analyzerRun-D5-g-Vxe.js +1 -0
  22. package/web/assets/{analyzerSandbox-N92T6amg.js → analyzerSandbox-E3CdovIk.js} +1 -1
  23. package/web/assets/{api-Dnl2uaKO.js → api-CZoVJ9Fy.js} +87 -87
  24. package/web/assets/auraTrack-ClhHuqlf.js +1 -0
  25. package/web/assets/{breakthrough-DSiuVwEX.js → breakthrough-DTpiUIZd.js} +2 -2
  26. package/web/assets/{cameraPresets-Cfn7qhXK.js → cameraPresets-DD0WmxiI.js} +1 -1
  27. package/web/assets/{cameraTracker-DHdF8Zqx.js → cameraTracker-Df9jWmz6.js} +2 -2
  28. package/web/assets/{captionLayout-cckQ7p-t.js → captionLayout-eiu9QPJu.js} +1 -1
  29. package/web/assets/{clientExport-pkLbOmEF.js → clientExport-BXegTdNc.js} +1 -1
  30. package/web/assets/{clientJobs-CcsLDqFM.js → clientJobs-eB-lNyin.js} +2 -2
  31. package/web/assets/clipoox_photo_bg-BQ0aVNY0.wasm +0 -0
  32. package/web/assets/depthEstimate-CfwX-tXP.js +1 -0
  33. package/web/assets/{directorTools-DMsatulF.js → directorTools-ABbI8m0e.js} +1 -1
  34. package/web/assets/distortFrames-DMnZ8OYh.js +2 -0
  35. package/web/assets/distortGL-DQu0Df2c.js +18 -0
  36. package/web/assets/{domino-DBrinEUu.js → domino-trmDBvfH.js} +1 -1
  37. package/web/assets/{editTools-BNnAvCw-.js → editTools-DEFo9Ahv.js} +1 -1
  38. package/web/assets/{engine-Co-ivzlQ.js → engine-Y-GotDIy.js} +1 -1
  39. package/web/assets/exportGlb-BeLpJKJT.js +2 -0
  40. package/web/assets/{faceTracker-ClR-lS6Y.js → faceTracker-BeSFnLM8.js} +1 -1
  41. package/web/assets/{fightDirector-BlpVAURl.js → fightDirector-Dfz3vu5-.js} +1 -1
  42. package/web/assets/{fightDrama-BK0QidpM.js → fightDrama-CNVn69s0.js} +2 -2
  43. package/web/assets/{focusTool-sVOb2GGS.js → focusTool-Dd2UDkiO.js} +1 -1
  44. package/web/assets/{frameSink-CSRqCnwI.js → frameSink-Rj02YES5.js} +3 -3
  45. package/web/assets/{glTransitionSources.generated-q0H-ZbnZ.js → glTransitionSources.generated-Cs8lVRqs.js} +438 -2
  46. package/web/assets/{gpuCompose-B5bgbHdQ.js → gpuCompose-DkkKH1Ab.js} +1 -1
  47. package/web/assets/gpuExport-DwrXpVGF.js +199 -0
  48. package/web/assets/{handMatte-Dj2taFoC.js → handMatte-B5sUeqKi.js} +1 -1
  49. package/web/assets/{handTracker-c6_rvuwA.js → handTracker-CQV-D7va.js} +2 -2
  50. package/web/assets/i18n-ClNt3LKg.js +3 -0
  51. package/web/assets/{index-Ds_8isyf.js → index-D2u6mD-8.js} +1 -1
  52. package/web/assets/layer-worker-DP0N05Ua.js +5 -0
  53. package/web/assets/library-cb43ZEmy.js +1 -0
  54. package/web/assets/{lottieLayer-Cv8ub9f6.js → lottieLayer-DEw0c3to.js} +4 -4
  55. package/web/assets/main-C_XcvNyC.js +311 -0
  56. package/web/assets/{main-B_MAOvi6.css → main-DlzdW5C4.css} +1 -1
  57. package/web/assets/{mapBake-DtQboFIX.js → mapBake-BUWz0cSx.js} +1 -1
  58. package/web/assets/maskTrack-GYpJyKFw.js +1 -0
  59. package/web/assets/matteFixRun-BCVsuSxf.js +1 -0
  60. package/web/assets/{objectLocate-XuAcemlO.js → objectLocate-CjIlo_u0.js} +1 -1
  61. package/web/assets/{objectSegmenter-D66spD7o.js → objectSegmenter-C4T9qgUL.js} +1 -1
  62. package/web/assets/{objectTrack.worker-BZS6WZ6l.js → objectTrack.worker-BVvsDmR0.js} +1450 -908
  63. package/web/assets/{pathTracer-DykgPkkh.js → pathTracer-DgL1_83l.js} +2 -2
  64. package/web/assets/{pendingMatte-BWBIWajI.js → pendingMatte-DPTe6xoZ.js} +2 -2
  65. package/web/assets/peopleMatte-C1hruEM6.js +1 -0
  66. package/web/assets/{personAi-EhBknW6X.js → personAi-Cjg9KKeH.js} +2 -2
  67. package/web/assets/{personHq-Ca351o06.js → personHq-CBP8v_cw.js} +2 -2
  68. package/web/assets/photo.worker-DK_ulTzR.js +1 -0
  69. package/web/assets/photoRun-lZ2BdSEk.js +2 -0
  70. package/web/assets/photoTools-DmUh69Qk.js +1 -0
  71. package/web/assets/plateCamera-DLqlXhMp.js +1 -0
  72. package/web/assets/{plateCameraMatch-GPZl1fQQ.js → plateCameraMatch-4VUlUMi-.js} +2 -2
  73. package/web/assets/{plateFollow-CJUilsNV.js → plateFollow-D2rjnmZA.js} +2 -2
  74. package/web/assets/plateMatte-0tTG7oeO.js +2 -0
  75. package/web/assets/{pluginAutomation-DAPHWZPN.js → pluginAutomation-ClFdpcCR.js} +1 -1
  76. package/web/assets/popTools-B38V4wub.js +1 -0
  77. package/web/assets/{poseTracker-CzEKvJph.js → poseTracker-qtuytI-L.js} +1 -1
  78. package/web/assets/{productTools-ce-zyZO0.js → productTools-DlC5vWjx.js} +2 -2
  79. package/web/assets/remote-CpkPQOQH.js +989 -0
  80. package/web/assets/{rigTrack-DMyqb0pb.js → rigTrack-BbKqZGs7.js} +1 -1
  81. package/web/assets/{rotoMaskStore-pE1AIt3I.js → rotoMaskStore-BZBJLcCp.js} +1 -1
  82. package/web/assets/{rotoMatte-7b7Ow64f.js → rotoMatte-BI-vjjrv.js} +1 -1
  83. package/web/assets/rotoscope-DuNcCxQy.js +1 -0
  84. package/web/assets/{sceneTrack-DlAH5s74.js → sceneTrack-CO4fTjft.js} +1 -1
  85. package/web/assets/{sceneTrack-CA21MCOP.js → sceneTrack-_n6WKKQv.js} +1 -1
  86. package/web/assets/{sceneTrack.worker-COlhlHRe.js → sceneTrack.worker-f2d-WOzw.js} +1496 -954
  87. package/web/assets/{shot-worker-DL1ZoIym.js → shot-worker-BSmfIXHO.js} +1 -1
  88. package/web/assets/{shotFxAgent-DqngnGFb.js → shotFxAgent-L2GG88W3.js} +1 -1
  89. package/web/assets/{skin-xFScwS3T.js → skin-CirUiqcr.js} +1 -1
  90. package/web/assets/{spark.module-DjaIF6J1.js → spark.module-3Q8DniuL.js} +1 -1
  91. package/web/assets/{spellDuel-BYNtnE8f.js → spellDuel-2CDLbiLQ.js} +2 -2
  92. package/web/assets/{store-CpqHUcA2.js → store-D3Y663py.js} +1 -1
  93. package/web/assets/{surfaceLight-C7YI9SV8.js → surfaceLight--HQj7xhO.js} +1 -1
  94. package/web/assets/{surfacePin-CzpUj1Cw.js → surfacePin-BCmgw-40.js} +2 -2
  95. package/web/assets/{textAnimators-B9vO_hbP.js → textAnimators-C4eMnVRD.js} +1 -1
  96. package/web/assets/{thumb-BTFsBS1u.js → thumb-M9B_goj-.js} +1 -1
  97. package/web/assets/{timeline3d-DrFaMPPB.js → timeline3d-BcW68fQr.js} +2 -2
  98. package/web/assets/{timeline3dExport-Uo0S0CR0.js → timeline3dExport-DgnorHLm.js} +1 -1
  99. package/web/assets/timelineComp-Ciu9JCWJ.js +1 -0
  100. package/web/assets/timelineOps-f1WsVbgS.js +526 -0
  101. package/web/assets/{timelineProps-0v-s69pw.js → timelineProps-CE1R11Hx.js} +1 -1
  102. package/web/assets/{timelineText-DurRhyuh.js → timelineText-Cppd4KB7.js} +1 -1
  103. package/web/assets/{titleArt-CnC0A7x7.js → titleArt-D0YI5xT2.js} +3 -3
  104. package/web/assets/{titleFrameBudget-DsM0V482.js → titleFrameBudget-h4nOQ5u9.js} +1717 -1175
  105. package/web/assets/titleFrames-DnCzi_AI.js +1 -0
  106. package/web/assets/{tool-D1FpErrX.js → tool-tp6gat1J.js} +1 -1
  107. package/web/assets/{tools-DIvrRu-5.js → tools-C07G9KUM.js} +1 -1
  108. package/web/assets/{toonTools-D9MNdRty.js → toonTools-Cazx2CL7.js} +2 -2
  109. package/web/assets/{trackAnchor-XvUuvkWP.js → trackAnchor-DoqFDcJB.js} +1 -1
  110. package/web/assets/{userFonts-Djka6RJX.js → userFonts-BlVEJfDk.js} +1 -1
  111. package/web/assets/{vfxAlpha-B-JzzRI1.js → vfxAlpha-Bp6VgIGN.js} +1 -1
  112. package/web/assets/vfxBackground-BFq44Srn.js +2 -0
  113. package/web/assets/{videoExport-NN-QijHd.js → videoExport-Cz02XKtX.js} +1 -1
  114. package/web/assets/{views-RQBs4zva.js → views-CNF3Afse.js} +1 -1
  115. package/web/assets/{weaponDuel-DKAEYJjO.js → weaponDuel-ChqBQo_b.js} +1 -1
  116. package/web/assets/{windowFrames-DhhJLIs-.js → windowFrames-dBMXwGek.js} +1 -1
  117. package/web/layer-worker.html +3 -3
  118. package/web/shot-worker.html +24 -24
  119. package/web/assets/ShotComposer-DLxWpdYH.js +0 -287
  120. package/web/assets/ShotComposer-deLi4grZ.css +0 -1
  121. package/web/assets/TimelineShotFx-CyHTgJHj.js +0 -2
  122. package/web/assets/analyzerRun-Cr-_79RH.js +0 -1
  123. package/web/assets/auraTrack-C8eAEIWQ.js +0 -1
  124. package/web/assets/depthEstimate-Cav4MmQ1.js +0 -1
  125. package/web/assets/distortFrames-D_v-aSVO.js +0 -2
  126. package/web/assets/distortGL-vhnBRB59.js +0 -12
  127. package/web/assets/exportGlb-D3PrWUvi.js +0 -2
  128. package/web/assets/gpuExport-oA2mUsdm.js +0 -198
  129. package/web/assets/i18n-C9zFX25m.js +0 -3
  130. package/web/assets/layer-worker-ClVZG6ZW.js +0 -5
  131. package/web/assets/library-BK0QVG4O.js +0 -1
  132. package/web/assets/main-CwrkBJ63.js +0 -309
  133. package/web/assets/maskTrack-D4QZfMWc.js +0 -1
  134. package/web/assets/matteFixRun-CytaeRzS.js +0 -1
  135. package/web/assets/plateCamera-BcdXD1uI.js +0 -1
  136. package/web/assets/plateMatte-CoEoVjxZ.js +0 -2
  137. package/web/assets/remote-8XzEAnAJ.js +0 -974
  138. package/web/assets/rotoscope-BUqNTKLd.js +0 -1
  139. package/web/assets/timelineComp-i-zdaoB2.js +0 -1
  140. package/web/assets/timelineOps-DSSaDsU2.js +0 -525
  141. package/web/assets/titleFrames-C8kvflgT.js +0 -1
  142. package/web/assets/vfxBackground-b053ziDK.js +0 -2
@@ -1,4 +1,4 @@
1
- import{bI as P,bJ as R}from"./api-Dnl2uaKO.js";import{j8 as M,j9 as N,hs as U,ht as H,ja as j,ai as O,iY as G}from"./titleFrameBudget-DsM0V482.js";const x=Object.freeze({fisheye:.45,dispersion:.018,burst:.5,streak:.32,taps:8,anamorphic:.09,heat:.012,dirBlur:.045,shatter:.032}),W=e=>[1+2.2*e,.88+1.8*e,.55+.9*e].map(t=>+t.toFixed(4)),ee=e=>[.55+.95*e,.85+1.45*e,1.15+2.1*e].map(t=>+t.toFixed(4));function q(e,t,o){const n=Math.max(e,Math.trunc(e*o/2)*2),a=Math.max(t,Math.trunc(t*o/2)*2);return{sw:n,sh:a,ox:Math.trunc((n-e)/2),oy:Math.trunc((a-t)/2)}}const ne=(e,t)=>({w:Math.max(2,Math.trunc(e/4)*2),h:Math.max(2,Math.trunc(t/4)*2)}),B=(e,t=x.taps)=>Array.from({length:t},(o,n)=>1+e*n/(t-1));function _(e){const t=+(x.fisheye*e).toFixed(4);let o=1+t;for(let n=0;n<20;n++)o-=(o*o*o-o*o-t)/(3*o*o-2*o);return{K:t,m:+o.toFixed(4)}}function b(e,t,o,n,a,v){const m=Math.max(0,Math.min(t-1.001,n)),l=Math.max(0,Math.min(o-1.001,a)),h=m|0,g=l|0,c=m-h,r=l-g,d=(g*t+h)*4+v,f=d+4,s=d+t*4,i=s+4;return(e[d]*(1-c)+e[f]*c)*(1-r)+(e[s]*(1-c)+e[i]*c)*r}const C=(e,t,o,n,a)=>[(n+e.ox+.5)*t/e.sw-.5,(a+e.oy+.5)*o/e.sh-.5];function V(e,t,o,n){const a=B(n).map(l=>q(t,o,l)),v=new Uint8ClampedArray(e.length),m=a.length;for(let l=0;l<o;l++)for(let h=0;h<t;h++){const g=(l*t+h)*4,c=[0,0,0,0];for(const r of a){const[d,f]=C(r,t,o,h,l);for(let s=0;s<4;s++)c[s]+=b(e,t,o,d,f,s)}for(let r=0;r<4;r++)v[g+r]=Math.round(c[r]/m)}return v}function te(e,t,o,n,a,v=0){if(!(t>.001))return!1;const m=new Uint8ClampedArray(o);if(e==="fisheye"){const{K:l,m:h}=_(t),g=q(n,a,h),c=n/2,r=a/2,d=4/(n*n+a*a),f=new Uint8ClampedArray(m.length);for(let s=0;s<a;s++)for(let i=0;i<n;i++){const p=i-c,w=s-r,u=1+l*(p*p+w*w)*d,y=(s*n+i)*4,A=c+p*u+.5,I=r+w*u+.5;if(A>=0&&I>=0&&A<=n-1&&I<=a-1)for(let T=0;T<4;T++)f[y+T]=b(m,n,a,A,I,T)}for(let s=0;s<a;s++)for(let i=0;i<n;i++){const[p,w]=C(g,n,a,i,s),u=(s*n+i)*4;for(let y=0;y<4;y++)o[u+y]=b(f,n,a,p,w,y)}return!0}if(e==="dispersion"){const l=x.dispersion*t,h=q(n,a,1+2*l),g=q(n,a,1+l);for(let c=0;c<a;c++)for(let r=0;r<n;r++){const d=(c*n+r)*4,[f,s]=C(h,n,a,r,c),[i,p]=C(g,n,a,r,c);o[d]=b(m,n,a,f,s,0),o[d+1]=b(m,n,a,i,p,1)}return!0}if(e==="zoom-streak")return o.set(V(m,n,a,x.streak*t)),!0;if(e==="heat-haze"){const l=n*x.heat*t,h=a*x.heat*t*.45,g=v*7.5,c=v*5.5,r=.045*(1080/Math.max(1,a)),d=.032*(1920/Math.max(1,n));for(let f=0;f<a;f++){const s=l*Math.sin(f*r-g);for(let i=0;i<n;i++){const p=h*Math.cos(i*d-c),w=(f*n+i)*4;for(let u=0;u<3;u++)o[w+u]=b(m,n,a,i+s,f+p,u)}}return!0}if(e==="prism-shatter"){const l=n*x.shatter*t,h=a*x.shatter*t*.35,g=9,c=Math.max(1,a/g);for(let r=0;r<a;r++){const d=Math.floor(r/c),f=(d%2===0?1:-1)*(.45+.55*(d*37%10)/10)*l*.65;for(let s=0;s<n;s++){const i=(r*n+s)*4;o[i]=b(m,n,a,s+f-l,r-h,0),o[i+1]=b(m,n,a,s+f,r,1),o[i+2]=b(m,n,a,s+f+l,r+h,2)}}return!0}return!1}const z=new Map,F=new Map,E=new Map,L=new Set;async function oe(e){if(e.size>4e7)throw Error("File LUT tối đa 40 MB");const t=U(H(await e.text())),o=(t.title||e.name.replace(/\.cube$/i,"")).slice(0,80),n=await R({name:o,...j(t)});return z.set(n.id,t),L.forEach(a=>a()),n}function K(e){if(z.has(e))return Promise.resolve(z.get(e));let t=F.get(e);return t||(t=P(e).then(o=>{const n=M(o);return z.set(e,n),L.forEach(a=>a()),n}).finally(()=>F.delete(e)),F.set(e,t)),t}function X(e){const t=z.get(e.id);if(!t)return K(e.id).catch(()=>{}),null;const o=`${e.id}:${e.mix??1}`;let n=E.get(o);return n||(n=N(t,e.mix??1),E.set(o,n)),n}const k=new Map;function ae(e){if(!e)return null;const t=e.lut?X(e.lut):null;if(e.lut&&!t)return null;if(!O(e.mixer))return t;const o=`${e.lut?`${e.lut.id}:${e.lut.mix??1}`:"-"}|${JSON.stringify(e.mixer)}`;let n=k.get(o);return n||(n=G(e.mixer,t),k.set(o,n),k.size>24&&k.delete(k.keys().next().value)),n}const S=Object.freeze({codec:"h264",quality:"recommended",container:"mp4"}),D={h264:{low:4,recommended:8,high:16},hevc:{low:2.5,recommended:5,high:10}};function Y(e,{width:t,height:o,fps:n}){const a=e??S,v=t*o/(1920*1080)*(n/30);return Math.round(D[a.codec][a.quality]*1e6*Math.max(.2,v))}const re=(e,t,o)=>Math.round((Y(e,t)+16e4)*Math.max(0,o)/8),Z={low:.5,recommended:1,high:2};function se(e,{width:t,height:o,fps:n},a){const v=e??S;return Math.round(Math.min(4e7,Math.max(5e5,a(t,o,n)*Z[v.quality]*(v.codec==="hevc"?D.hevc.recommended/D.h264.recommended:1))))}const ie=Object.freeze({cube:`// Author: gre
1
+ import{bM as E,bN as R}from"./api-CZoVJ9Fy.js";import{jc as M,jd as N,hv as H,hw as B,je as U,ai as G,j0 as j}from"./titleFrameBudget-h4nOQ5u9.js";const x=Object.freeze({fisheye:.45,dispersion:.018,burst:.5,streak:.32,taps:8,anamorphic:.09,heat:.012,dirBlur:.045,shatter:.032}),W=e=>[1+2.2*e,.88+1.8*e,.55+.9*e].map(t=>+t.toFixed(4)),ee=e=>[.55+.95*e,.85+1.45*e,1.15+2.1*e].map(t=>+t.toFixed(4));function C(e,t,o){const n=Math.max(e,Math.trunc(e*o/2)*2),a=Math.max(t,Math.trunc(t*o/2)*2);return{sw:n,sh:a,ox:Math.trunc((n-e)/2),oy:Math.trunc((a-t)/2)}}const ne=(e,t)=>({w:Math.max(2,Math.trunc(e/4)*2),h:Math.max(2,Math.trunc(t/4)*2)}),O=(e,t=x.taps)=>Array.from({length:t},(o,n)=>1+e*n/(t-1));function V(e){const t=+(x.fisheye*e).toFixed(4);let o=1+t;for(let n=0;n<20;n++)o-=(o*o*o-o*o-t)/(3*o*o-2*o);return{K:t,m:+o.toFixed(4)}}function b(e,t,o,n,a,m){const d=Math.max(0,Math.min(t-1.001,n)),l=Math.max(0,Math.min(o-1.001,a)),h=d|0,g=l|0,c=d-h,r=l-g,v=(g*t+h)*4+m,f=v+4,s=v+t*4,i=s+4;return(e[v]*(1-c)+e[f]*c)*(1-r)+(e[s]*(1-c)+e[i]*c)*r}const q=(e,t,o,n,a)=>[(n+e.ox+.5)*t/e.sw-.5,(a+e.oy+.5)*o/e.sh-.5];function _(e,t,o,n){const a=O(n).map(l=>C(t,o,l)),m=new Uint8ClampedArray(e.length),d=a.length;for(let l=0;l<o;l++)for(let h=0;h<t;h++){const g=(l*t+h)*4,c=[0,0,0,0];for(const r of a){const[v,f]=q(r,t,o,h,l);for(let s=0;s<4;s++)c[s]+=b(e,t,o,v,f,s)}for(let r=0;r<4;r++)m[g+r]=Math.round(c[r]/d)}return m}function te(e,t,o,n,a,m=0){if(!(t>.001))return!1;const d=new Uint8ClampedArray(o);if(e==="fisheye"){const{K:l,m:h}=V(t),g=C(n,a,h),c=n/2,r=a/2,v=4/(n*n+a*a),f=new Uint8ClampedArray(d.length);for(let s=0;s<a;s++)for(let i=0;i<n;i++){const p=i-c,w=s-r,u=1+l*(p*p+w*w)*v,y=(s*n+i)*4,A=c+p*u+.5,I=r+w*u+.5;if(A>=0&&I>=0&&A<=n-1&&I<=a-1)for(let z=0;z<4;z++)f[y+z]=b(d,n,a,A,I,z)}for(let s=0;s<a;s++)for(let i=0;i<n;i++){const[p,w]=q(g,n,a,i,s),u=(s*n+i)*4;for(let y=0;y<4;y++)o[u+y]=b(f,n,a,p,w,y)}return!0}if(e==="dispersion"){const l=x.dispersion*t,h=C(n,a,1+2*l),g=C(n,a,1+l);for(let c=0;c<a;c++)for(let r=0;r<n;r++){const v=(c*n+r)*4,[f,s]=q(h,n,a,r,c),[i,p]=q(g,n,a,r,c);o[v]=b(d,n,a,f,s,0),o[v+1]=b(d,n,a,i,p,1)}return!0}if(e==="zoom-streak")return o.set(_(d,n,a,x.streak*t)),!0;if(e==="heat-haze"){const l=n*x.heat*t,h=a*x.heat*t*.45,g=m*7.5,c=m*5.5,r=.045*(1080/Math.max(1,a)),v=.032*(1920/Math.max(1,n));for(let f=0;f<a;f++){const s=l*Math.sin(f*r-g);for(let i=0;i<n;i++){const p=h*Math.cos(i*v-c),w=(f*n+i)*4;for(let u=0;u<3;u++)o[w+u]=b(d,n,a,i+s,f+p,u)}}return!0}if(e==="prism-shatter"){const l=n*x.shatter*t,h=a*x.shatter*t*.35,g=9,c=Math.max(1,a/g);for(let r=0;r<a;r++){const v=Math.floor(r/c),f=(v%2===0?1:-1)*(.45+.55*(v*37%10)/10)*l*.65;for(let s=0;s<n;s++){const i=(r*n+s)*4;o[i]=b(d,n,a,s+f-l,r-h,0),o[i+1]=b(d,n,a,s+f,r,1),o[i+2]=b(d,n,a,s+f+l,r+h,2)}}return!0}return!1}const T=new Map,S=new Map,D=new Map,L=new Set;async function oe(e){if(e.size>4e7)throw Error("File LUT tối đa 40 MB");const t=H(B(await e.text())),o=(t.title||e.name.replace(/\.cube$/i,"")).slice(0,80),n=await R({name:o,...U(t)});return T.set(n.id,t),L.forEach(a=>a()),n}function K(e){if(T.has(e))return Promise.resolve(T.get(e));let t=S.get(e);return t||(t=E(e).then(o=>{const n=M(o);return T.set(e,n),L.forEach(a=>a()),n}).finally(()=>S.delete(e)),S.set(e,t)),t}function X(e){const t=T.get(e.id);if(!t)return K(e.id).catch(()=>{}),null;const o=`${e.id}:${e.mix??1}`;let n=D.get(o);return n||(n=N(t,e.mix??1),D.set(o,n)),n}const k=new Map;function ae(e){if(!e)return null;const t=e.lut?X(e.lut):null;if(e.lut&&!t)return null;if(!G(e.mixer))return t;const o=`${e.lut?`${e.lut.id}:${e.lut.mix??1}`:"-"}|${JSON.stringify(e.mixer)}`;let n=k.get(o);return n||(n=j(e.mixer,t),k.set(o,n),k.size>24&&k.delete(k.keys().next().value)),n}const P=Object.freeze({codec:"h264",quality:"recommended",container:"mp4"}),F={h264:{low:4,recommended:8,high:16},hevc:{low:2.5,recommended:5,high:10}};function Y(e,{width:t,height:o,fps:n}){const a=e??P,m=t*o/(1920*1080)*(n/30);return Math.round(F[a.codec][a.quality]*1e6*Math.max(.2,m))}const re=(e,t,o)=>Math.round((Y(e,t)+16e4)*Math.max(0,o)/8),Z={low:.5,recommended:1,high:2};function se(e,{width:t,height:o,fps:n},a){const m=e??P;return Math.round(Math.min(4e7,Math.max(5e5,a(t,o,n)*Z[m.quality]*(m.codec==="hevc"?F.hevc.recommended/F.h264.recommended:1))))}const ie=Object.freeze({cube:`// Author: gre
2
2
  // License: MIT
3
3
  // Description: The two images are faces of a box that turns a quarter turn in perspective, the outgoing face darkening as it turns away, above a reflective floor
4
4
  // Tags: 3d, cube, rotate, reflection
@@ -3692,4 +3692,440 @@ vec4 transition(vec2 uv) {
3692
3692
  // mixed premultiplied, so transparent images do not bleed their color
3693
3693
  vec4 c = mix(vec4(a.rgb * a.a, a.a), vec4(b.rgb * b.a, b.a), m);
3694
3694
  return c.a > 0.0 ? vec4(c.rgb / c.a, c.a) : vec4(0.0);
3695
- }`});export{S as D,ie as G,x as L,te as a,ee as b,W as c,ne as d,q as e,re as f,ae as g,se as h,oe as i,K as j,X as l,B as z};
3695
+ }`,"speedflow-tunnel":`// Author: Clipoox Labs
3696
+ // License: MIT
3697
+ // Description: Cinema TVC Speedflow hyperspace tunnel transition: exponential radial velocity warp with chromatic RGB dispersion and crimson-silver speed streaks rushing past the center
3698
+ // Tags: tvc, speedflow, tunnel, warp, radial, sports, commercial
3699
+
3700
+ const vec2 center = vec2(0.5, 0.5);
3701
+ const float strength = 0.72;
3702
+ const float chroma = 0.032;
3703
+
3704
+ const float PI = 3.141592653589793;
3705
+ const int TAPS = 16;
3706
+
3707
+ float sfHash(vec2 p) {
3708
+ vec3 p3 = fract(vec3(p.xyx) * 0.1031);
3709
+ p3 += dot(p3, p3.yzx + 33.33);
3710
+ return fract((p3.x + p3.y) * p3.z);
3711
+ }
3712
+
3713
+ float speedLines(vec2 uv, float peak) {
3714
+ vec2 d = uv - center;
3715
+ float r = length(d);
3716
+ float a = (atan(d.y, d.x) + PI) / (2.0 * PI);
3717
+ float acc = 0.0;
3718
+ for (int l = 0; l < 2; l++) {
3719
+ float n = l == 0 ? 96.0 : 148.0;
3720
+ float cell = floor(a * n);
3721
+ float f = fract(a * n);
3722
+ float h1 = sfHash(vec2(cell, float(l) * 19.0 + 3.0));
3723
+ float h2 = sfHash(vec2(cell, float(l) * 37.0 + 11.0));
3724
+ float streak = smoothstep(0.08, 0.55, r) * exp(-pow((f - 0.5) * (5.5 + 4.0 * h2), 2.0));
3725
+ float gate = step(0.42, h1);
3726
+ acc += streak * gate * (0.35 + 0.65 * h2);
3727
+ }
3728
+ return acc * peak;
3729
+ }
3730
+
3731
+ vec4 radialSample(vec2 uv, float blurAmt, float zoom, float ca, bool toSide) {
3732
+ vec2 d = uv - center;
3733
+ vec4 acc = vec4(0.0);
3734
+ float wSum = 0.0;
3735
+ for (int i = 0; i < TAPS; i++) {
3736
+ float t = float(i) / float(TAPS - 1);
3737
+ float s = zoom * (1.0 - blurAmt * t);
3738
+ float w = 1.0 - 0.55 * t;
3739
+ vec2 qR = clamp(center + d * (s * (1.0 + ca)), 0.001, 0.999);
3740
+ vec2 qG = clamp(center + d * s, 0.001, 0.999);
3741
+ vec2 qB = clamp(center + d * (s * (1.0 - ca)), 0.001, 0.999);
3742
+ vec4 cR = toSide ? getToColor(qR) : getFromColor(qR);
3743
+ vec4 cG = toSide ? getToColor(qG) : getFromColor(qG);
3744
+ vec4 cB = toSide ? getToColor(qB) : getFromColor(qB);
3745
+ acc += vec4(cR.r, cG.g, cB.b, cG.a) * w;
3746
+ wSum += w;
3747
+ }
3748
+ return acc / max(wSum, 1e-4);
3749
+ }
3750
+
3751
+ vec4 transition(vec2 uv) {
3752
+ float p = progress;
3753
+ float peak = sin(p * PI);
3754
+ float peak2 = peak * peak;
3755
+ float mixT = smoothstep(0.32, 0.68, p);
3756
+
3757
+ float zoomA = 1.0 - 0.42 * pow(p, 1.5);
3758
+ float zoomB = 1.0 + 0.52 * pow(1.0 - p, 1.5);
3759
+ float blur = strength * peak2 * 0.68;
3760
+ float ca = chroma * peak2;
3761
+
3762
+ vec4 cA = radialSample(uv, blur, zoomA, ca, false);
3763
+ vec4 cB = radialSample(uv, blur, zoomB, ca, true);
3764
+ vec4 col = mix(cA, cB, mixT);
3765
+
3766
+ // Signature Speedflow crimson-white-cyan velocity streaks around edges
3767
+ float lines = speedLines(uv, peak2);
3768
+ float r = length(uv - center);
3769
+ vec3 streakCol = mix(vec3(0.95, 0.16, 0.24), vec3(0.98, 0.96, 1.0), smoothstep(0.18, 0.62, r));
3770
+ col.rgb += streakCol * lines * 0.42;
3771
+
3772
+ // Subtle center optical punch bloom at apex
3773
+ float flash = exp(-r * r * 7.5) * pow(peak, 3.0) * 0.55;
3774
+ col.rgb += vec3(1.0, 0.92, 0.90) * flash;
3775
+ return clamp(col, 0.0, 1.0);
3776
+ }`,"diagonal-speed-whip":`// Author: Clipoox Labs
3777
+ // License: MIT
3778
+ // Description: Cinema TVC 30-degree diagonal high-velocity speed whip with specular crimson-silver velocity ribbons and chromatic edge separation
3779
+ // Tags: tvc, whip, diagonal, speed, motion-blur, commercial
3780
+
3781
+ const float angleDeg = 28.0;
3782
+ const float blurStrength = 0.22;
3783
+ const float chroma = 0.018;
3784
+
3785
+ const float PI = 3.141592653589793;
3786
+ const int TAPS = 16;
3787
+
3788
+ vec4 dirSmear(vec2 uv, vec2 dir, float amt, float ca, bool toSide) {
3789
+ vec4 acc = vec4(0.0);
3790
+ float wSum = 0.0;
3791
+ for (int i = 0; i < TAPS; i++) {
3792
+ float t = (float(i) / float(TAPS - 1)) - 0.5;
3793
+ float w = exp(-t * t * 3.8);
3794
+ vec2 off = dir * (t * amt);
3795
+ vec2 qR = clamp(uv + off + dir * ca, 0.001, 0.999);
3796
+ vec2 qG = clamp(uv + off, 0.001, 0.999);
3797
+ vec2 qB = clamp(uv + off - dir * ca, 0.001, 0.999);
3798
+ vec4 cR = toSide ? getToColor(qR) : getFromColor(qR);
3799
+ vec4 cG = toSide ? getToColor(qG) : getFromColor(qG);
3800
+ vec4 cB = toSide ? getToColor(qB) : getFromColor(qB);
3801
+ acc += vec4(cR.r, cG.g, cB.b, cG.a) * w;
3802
+ wSum += w;
3803
+ }
3804
+ return acc / max(wSum, 1e-4);
3805
+ }
3806
+
3807
+ vec4 transition(vec2 uv) {
3808
+ float p = progress;
3809
+ float peak = sin(p * PI);
3810
+ float peak2 = peak * peak;
3811
+ float rad = angleDeg * PI / 180.0;
3812
+ vec2 dir = vec2(cos(rad), sin(rad));
3813
+ vec2 perp = vec2(-dir.y, dir.x);
3814
+
3815
+ // High-velocity slide along diagonal axis
3816
+ float slide = (p < 0.5) ? (2.0 * p * p) : (1.0 - 2.0 * (1.0 - p) * (1.0 - p));
3817
+ vec2 uvA = uv - dir * (slide * 0.45);
3818
+ vec2 uvB = uv + dir * ((1.0 - slide) * 0.45);
3819
+
3820
+ float amt = blurStrength * peak2;
3821
+ float ca = chroma * peak2;
3822
+
3823
+ vec4 cA = dirSmear(uvA, dir, amt, ca, false);
3824
+ vec4 cB = dirSmear(uvB, dir, amt, ca, true);
3825
+
3826
+ // Soft diagonal wipe boundary riding the motion wave
3827
+ float proj = dot(uv - vec2(0.5), dir) + 0.5;
3828
+ float wipe = smoothstep(proj - 0.24, proj + 0.24, slide * 1.25 - 0.12);
3829
+ // the wipe front reaches the frame corners early / late: pin the blend to exact A at 0 and exact B at 1
3830
+ float m = mix(wipe, smoothstep(0.35, 0.65, p), 0.45) * smoothstep(0.0, 0.15, p);
3831
+ m = mix(m, 1.0, smoothstep(0.85, 1.0, p));
3832
+ vec4 col = mix(cA, cB, m);
3833
+
3834
+ // Layered glossy crimson/silver/cyan speed ribbons sweeping diagonally
3835
+ float lane = dot(uv, perp);
3836
+ float r1 = exp(-pow(sin(lane * 26.0 + p * 8.0), 2.0) * 14.0);
3837
+ float r2 = exp(-pow(sin(lane * 44.0 - p * 11.0 + 1.3), 2.0) * 20.0);
3838
+ vec3 ribCol = mix(vec3(0.92, 0.18, 0.28), vec3(0.85, 0.96, 1.0), r2);
3839
+ col.rgb += ribCol * (0.24 * r1 + 0.28 * r2) * peak2;
3840
+ return clamp(col, 0.0, 1.0);
3841
+ }`,"prism-lens-sweep":`// Author: Clipoox Labs
3842
+ // License: MIT
3843
+ // Description: Cinema TVC optical glass prism diopter sweep: soft edge refraction blur and 6-band spectral rainbow dispersion gliding across the lens
3844
+ // Tags: tvc, prism, optical, dispersion, rainbow, lens, commercial
3845
+
3846
+ const float sweepWidth = 0.42;
3847
+ const float dispersion = 0.036;
3848
+
3849
+ const float PI = 3.141592653589793;
3850
+
3851
+ vec3 spectrumWeight(float t) {
3852
+ vec3 c = clamp(abs(mod(t * 6.0 + vec3(0.0, 4.0, 2.0), 6.0) - 3.0) - 1.0, 0.0, 1.0);
3853
+ return c * c * (3.0 - 2.0 * c);
3854
+ }
3855
+
3856
+ vec4 prismSample(vec2 uv, vec2 dir, float amt, bool toSide) {
3857
+ if (amt < 0.0005) return toSide ? getToColor(uv) : getFromColor(uv);
3858
+ vec3 rgb = vec3(0.0);
3859
+ vec3 wTot = vec3(0.0);
3860
+ float alpha = 0.0;
3861
+ for (int i = 0; i < 6; i++) {
3862
+ float t = float(i) / 5.0;
3863
+ vec3 w = spectrumWeight(t * 0.78);
3864
+ vec2 q = clamp(uv + dir * ((t - 0.5) * amt), 0.001, 0.999);
3865
+ vec4 s = toSide ? getToColor(q) : getFromColor(q);
3866
+ rgb += s.rgb * w;
3867
+ wTot += w;
3868
+ alpha += s.a;
3869
+ }
3870
+ return vec4(rgb / max(wTot, vec3(1e-4)), alpha / 6.0);
3871
+ }
3872
+
3873
+ vec4 transition(vec2 uv) {
3874
+ float p = progress;
3875
+ float peak = sin(p * PI);
3876
+ // Diagonal glass prism bar sweeping smoothly left-to-right across the lens
3877
+ float axis = uv.x * 0.88 + uv.y * 0.22;
3878
+ float front = mix(-0.25, 1.35, p);
3879
+ float dist = axis - front;
3880
+ float band = exp(-(dist * dist) / max(sweepWidth * sweepWidth * 0.28, 0.004));
3881
+
3882
+ // Glass refraction displacement + edge diopter smear
3883
+ vec2 refractDir = normalize(vec2(0.85, 0.35) + (uv - 0.5) * 0.6);
3884
+ vec2 offset = refractDir * (sin(dist * 7.0) * 0.022 * band * peak);
3885
+ float dispAmt = dispersion * (0.35 + 1.45 * band) * peak;
3886
+
3887
+ vec4 cA = prismSample(uv + offset, refractDir, dispAmt, false);
3888
+ vec4 cB = prismSample(uv - offset * 0.7, refractDir, dispAmt, true);
3889
+
3890
+ float reveal = smoothstep(front + sweepWidth * 0.35, front - sweepWidth * 0.35, axis);
3891
+ vec4 col = mix(cA, cB, reveal);
3892
+
3893
+ // Subtle iridescent optical glass caustic sheen inside the prism band
3894
+ float sheen = pow(band, 2.2) * peak;
3895
+ vec3 caustic = mix(vec3(0.45, 0.82, 1.0), vec3(1.0, 0.84, 0.58), smoothstep(0.0, 1.0, uv.y));
3896
+ col.rgb += caustic * sheen * 0.22;
3897
+ return clamp(col, 0.0, 1.0);
3898
+ }`,"starburst-implosion":`// Author: Clipoox Labs
3899
+ // License: MIT
3900
+ // Description: Cinema TVC optical starburst implosion flash: white-hot central filament burst, crimson-violet nebula haze, and rainbow chromatic bokeh flares
3901
+ // Tags: tvc, starburst, flash, bokeh, optical, energy, commercial
3902
+
3903
+ const vec2 center = vec2(0.5, 0.5);
3904
+ const float intensity = 1.0;
3905
+
3906
+ const float PI = 3.141592653589793;
3907
+
3908
+ float sbHash(vec2 p) {
3909
+ p = fract(p * vec2(123.34, 456.21));
3910
+ p += dot(p, p + 45.32);
3911
+ return fract(p.x * p.y);
3912
+ }
3913
+
3914
+ float sbNoise(vec2 p) {
3915
+ vec2 i = floor(p);
3916
+ vec2 f = fract(p);
3917
+ f = f * f * (3.0 - 2.0 * f);
3918
+ return mix(
3919
+ mix(sbHash(i), sbHash(i + vec2(1.0, 0.0)), f.x),
3920
+ mix(sbHash(i + vec2(0.0, 1.0)), sbHash(i + vec2(1.0, 1.0)), f.x),
3921
+ f.y
3922
+ );
3923
+ }
3924
+
3925
+ vec4 transition(vec2 uv) {
3926
+ float p = progress;
3927
+ float peak = sin(p * PI);
3928
+ float burst = pow(peak, 1.7) * intensity;
3929
+
3930
+ vec2 d = uv - center;
3931
+ float r = length(d);
3932
+ float a = atan(d.y, d.x);
3933
+
3934
+ // Subtle radial pull into the core then release
3935
+ float pull = 1.0 - 0.18 * peak * exp(-r * 2.2);
3936
+ vec2 q = clamp(center + d * pull, 0.001, 0.999);
3937
+ vec4 cA = getFromColor(q);
3938
+ vec4 cB = getToColor(q);
3939
+ vec4 col = mix(cA, cB, smoothstep(0.36, 0.64, p));
3940
+
3941
+ // Fine radial plasma starburst rays
3942
+ float ray1 = sbNoise(vec2(a * 14.0, r * 3.5 - p * 4.0));
3943
+ float ray2 = sbNoise(vec2(a * 32.0 + 3.1, r * 6.0 - p * 7.0));
3944
+ float rays = pow(clamp(ray1 * 0.65 + ray2 * 0.55, 0.0, 1.0), 2.2);
3945
+ float core = exp(-r * r * 18.0);
3946
+ float halo = exp(-r * 3.4) * (0.45 + 1.35 * rays);
3947
+
3948
+ // Crimson-violet volumetric haze + white-hot core
3949
+ vec3 nebula = mix(vec3(0.68, 0.08, 0.18), vec3(0.32, 0.14, 0.55), smoothstep(0.15, 0.7, r));
3950
+ vec3 starCol = nebula * halo * 1.15 + vec3(1.0, 0.95, 0.92) * (core * 1.45 + halo * rays * 0.75);
3951
+
3952
+ // Chromatic bokeh orbs flying outward from center
3953
+ vec3 bokeh = vec3(0.0);
3954
+ for (int i = 0; i < 8; i++) {
3955
+ float fi = float(i);
3956
+ float ang = fi * 0.785398 + 0.35;
3957
+ float dist = (0.14 + 0.52 * fract(p * 1.15 + fi * 0.17));
3958
+ vec2 bp = center + vec2(cos(ang), sin(ang) * 0.75) * dist;
3959
+ float br = length(uv - bp);
3960
+ float orb = smoothstep(0.048, 0.008, br);
3961
+ vec3 bc = vec3(
3962
+ smoothstep(0.052, 0.010, length(uv - (bp + vec2(0.006, 0.0)))),
3963
+ orb,
3964
+ smoothstep(0.052, 0.010, length(uv - (bp - vec2(0.006, 0.0))))
3965
+ );
3966
+ bokeh += bc * vec3(1.0, 0.65, 0.45) * (1.0 - dist * 0.8);
3967
+ }
3968
+
3969
+ col.rgb += (starCol + bokeh * 0.48) * burst;
3970
+ return clamp(col, 0.0, 1.0);
3971
+ }`,"synapse-electric-ring":`// Author: Clipoox Labs
3972
+ // License: MIT
3973
+ // Description: Cinema TVC bio-electric synapse ring transition: crackling cyan-white lightning ring expanding with optical shockwave refraction
3974
+ // Tags: tvc, electric, lightning, synapse, ring, shockwave, commercial
3975
+
3976
+ const vec2 center = vec2(0.5, 0.5);
3977
+ const float glow = 1.0;
3978
+
3979
+ const float PI = 3.141592653589793;
3980
+
3981
+ float elHash(vec2 p) {
3982
+ p = fract(p * vec2(234.34, 435.345));
3983
+ p += dot(p, p + 34.23);
3984
+ return fract(p.x * p.y);
3985
+ }
3986
+
3987
+ float elNoise(vec2 p) {
3988
+ vec2 i = floor(p);
3989
+ vec2 f = fract(p);
3990
+ f = f * f * (3.0 - 2.0 * f);
3991
+ return mix(
3992
+ mix(elHash(i), elHash(i + vec2(1.0, 0.0)), f.x),
3993
+ mix(elHash(i + vec2(0.0, 1.0)), elHash(i + vec2(1.0, 1.0)), f.x),
3994
+ f.y
3995
+ );
3996
+ }
3997
+
3998
+ float elFbm(vec2 p) {
3999
+ float v = 0.0;
4000
+ float a = 0.5;
4001
+ for (int i = 0; i < 4; i++) {
4002
+ v += a * elNoise(p);
4003
+ p *= 2.1;
4004
+ a *= 0.5;
4005
+ }
4006
+ return v;
4007
+ }
4008
+
4009
+ vec4 transition(vec2 uv) {
4010
+ float p = progress;
4011
+ float peak = sin(p * PI);
4012
+ vec2 d = uv - center;
4013
+ vec2 da = vec2(d.x * 1.45, d.y);
4014
+ float r = length(da);
4015
+ float a = atan(da.y, da.x);
4016
+
4017
+ // Expanding shockwave ring radius
4018
+ float ringR = mix(0.06, 0.92, pow(p, 0.85));
4019
+ float jitter = (elFbm(vec2(a * 4.5 + p * 6.0, p * 9.0)) - 0.5) * 0.16;
4020
+ float jitter2 = (elFbm(vec2(a * 9.0 - p * 10.0, p * 14.0 + 5.0)) - 0.5) * 0.09;
4021
+
4022
+ float dist1 = abs(r - (ringR + jitter));
4023
+ float dist2 = abs(r - (ringR * 0.84 + jitter2));
4024
+
4025
+ // Optical shockwave refraction across the ring boundary
4026
+ vec2 dir = normalize(d + vec2(1e-4));
4027
+ float wave = exp(-dist1 * 18.0) * peak;
4028
+ vec2 qR = clamp(uv + dir * (wave * 0.026), 0.001, 0.999);
4029
+ vec2 qG = clamp(uv + dir * (wave * 0.016), 0.001, 0.999);
4030
+ vec2 qB = clamp(uv + dir * (wave * 0.006), 0.001, 0.999);
4031
+
4032
+ float mask = smoothstep(ringR + jitter + 0.06, ringR + jitter - 0.06, r);
4033
+ // the ring starts with a radius (B shows inside it at 0) and its jitter reaches past the corners: pin exact A at 0, exact B at 1
4034
+ mask = mix(mask * smoothstep(0.0, 0.12, p), 1.0, smoothstep(0.88, 1.0, p));
4035
+ vec4 cA = vec4(getFromColor(qR).r, getFromColor(qG).g, getFromColor(qB).b, getFromColor(qG).a);
4036
+ vec4 cB = vec4(getToColor(qR).r, getToColor(qG).g, getToColor(qB).b, getToColor(qG).a);
4037
+ vec4 col = mix(cA, cB, mask);
4038
+
4039
+ // Crisp crackling cyan-white electric arcs
4040
+ float arc1 = 0.0065 / (dist1 + 0.0045);
4041
+ float arc2 = 0.0045 / (dist2 + 0.0055);
4042
+ float arcs = (arc1 + arc2 * 0.75) * peak * glow;
4043
+ vec3 elecCol = mix(vec3(0.14, 0.78, 1.0), vec3(0.95, 0.99, 1.0), clamp(arcs * 0.45, 0.0, 1.0));
4044
+ col.rgb += elecCol * min(arcs, 2.2) * 0.65;
4045
+ return clamp(col, 0.0, 1.0);
4046
+ }`,"cloud-fly":`// Author: Clipoox Labs
4047
+ // License: MIT
4048
+ // Description: Fly through the clouds: the outgoing image zooms toward the camera as soft lit clouds rush past and close the frame, then part around the incoming image as it settles back to its frame (event recap / drone / map intro)
4049
+ // Tags: clouds, sky, fly, zoom, drone, map
4050
+
4051
+ // @range(1, 8) Size of the cloud billows: more, smaller ones with a larger value
4052
+ const float scale = 3.0;
4053
+ // @range(0, 1) How far each picture zooms while the clouds pass
4054
+ const float zoom = 0.45;
4055
+
4056
+ const vec2 center = vec2(0.5, 0.5);
4057
+ const float PI = 3.141592653589793;
4058
+
4059
+ float cfHash(vec2 p) { vec3 p3 = fract(vec3(p.xyx) * 0.1031); p3 += dot(p3, p3.yzx + 33.33); return fract((p3.x + p3.y) * p3.z); }
4060
+ float cfNoise(vec2 p) {
4061
+ vec2 i = floor(p), f = fract(p);
4062
+ vec2 u = f * f * (3.0 - 2.0 * f);
4063
+ return mix(mix(cfHash(i), cfHash(i + vec2(1.0, 0.0)), u.x), mix(cfHash(i + vec2(0.0, 1.0)), cfHash(i + vec2(1.0, 1.0)), u.x), u.y);
4064
+ }
4065
+ float cfFbm(vec2 p) {
4066
+ float v = 0.0, a = 0.5;
4067
+ for (int i = 0; i < 5; i++) { v += a * cfNoise(p); p = p * 2.03 + vec2(17.1, 9.2); a *= 0.5; }
4068
+ return v;
4069
+ }
4070
+
4071
+ vec4 transition(vec2 uv) {
4072
+ float p = progress;
4073
+ float peak = sin(p * PI);
4074
+ // the camera flies forward: the clouds grow from the centre outward
4075
+ vec2 d = (uv - center) * vec2(ratio, 1.0);
4076
+ float fly = 1.0 / (1.0 + 2.2 * p);
4077
+ vec2 q = center + d * fly * scale;
4078
+ float dens = cfFbm(q + vec2(0.0, p * 1.5));
4079
+ float dens2 = cfFbm(q * 1.7 + vec2(4.2, -p * 2.0));
4080
+ // the clouds close the frame by the middle and open again; nothing at the two ends
4081
+ float th = 1.05 - 1.6 * peak;
4082
+ float cover = smoothstep(th - 0.18, th + 0.18, dens) * smoothstep(0.0, 0.12, peak);
4083
+ // each picture zooms toward the camera (A out, B settling in)
4084
+ vec2 qa = center + (uv - center) / (1.0 + zoom * p * p);
4085
+ vec2 qb = center + (uv - center) / (1.0 + zoom * (1.0 - p) * (1.0 - p));
4086
+ vec4 a = getFromColor(qa), b = getToColor(qb);
4087
+ vec4 pic = mix(a, b, smoothstep(0.42, 0.58, p));
4088
+ // lit tops, cool grey folds, a little haze over the picture as the clouds thicken
4089
+ vec3 cloud = mix(vec3(0.70, 0.76, 0.84), vec3(1.0, 1.0, 0.99), smoothstep(0.25, 0.75, dens2));
4090
+ vec3 haze = mix(pic.rgb, vec3(0.92, 0.95, 1.0), 0.35 * peak * peak);
4091
+ return vec4(mix(haze, cloud, cover), mix(pic.a, 1.0, cover));
4092
+ }`,"echo-trail":`// Author: Clipoox Labs
4093
+ // License: MIT
4094
+ // Description: Echo trail across the cut: the outgoing image smears into bright ghost copies that stretch toward the camera, the incoming image arrives out of its own ghosts and they settle into one sharp frame (concert / dance recap)
4095
+ // Tags: echo, ghost, trail, blend, music, dance
4096
+
4097
+ // @range(0, 0.4) How far apart the ghost copies are, at the middle of the transition
4098
+ const float spread = 0.16;
4099
+ // Direction the ghosts drift toward, in frame heights
4100
+ const vec2 drift = vec2(0.06, 0.0);
4101
+
4102
+ const vec2 center = vec2(0.5, 0.5);
4103
+ const float PI = 3.141592653589793;
4104
+ const int COPIES = 7;
4105
+
4106
+ vec4 echo(vec2 uv, float amt, bool toSide) {
4107
+ vec4 acc = vec4(0.0);
4108
+ vec3 bright = vec3(0.0);
4109
+ float wSum = 0.0;
4110
+ for (int i = 0; i < COPIES; i++) {
4111
+ float k = float(i) / float(COPIES - 1);
4112
+ vec2 q = center + (uv - center) / (1.0 + spread * amt * k * 1.6) - drift * amt * k;
4113
+ vec4 c = toSide ? getToColor(clamp(q, 0.001, 0.999)) : getFromColor(clamp(q, 0.001, 0.999));
4114
+ float w = pow(1.0 - 0.62 * k, 2.0);
4115
+ acc += c * w; wSum += w;
4116
+ bright = max(bright, c.rgb * (1.0 - 0.45 * k));
4117
+ }
4118
+ vec4 avg = acc / max(wSum, 1e-4);
4119
+ // the ghosts are light (a lighten blend over the average): bright parts leave trails, dark parts don't smear into mud
4120
+ return vec4(mix(avg.rgb, max(avg.rgb, bright), 0.65 * amt), avg.a);
4121
+ }
4122
+
4123
+ vec4 transition(vec2 uv) {
4124
+ float p = progress;
4125
+ float peak = sin(p * PI);
4126
+ vec4 a = echo(uv, peak, false);
4127
+ vec4 b = echo(uv, peak, true);
4128
+ vec4 col = mix(a, b, smoothstep(0.3, 0.7, p));
4129
+ col.rgb += vec3(0.06) * peak * peak;
4130
+ return clamp(col, 0.0, 1.0);
4131
+ }`});export{P as D,ie as G,x as L,te as a,ee as b,W as c,ne as d,C as e,re as f,ae as g,se as h,oe as i,K as j,X as l,O as z};
@@ -1 +1 @@
1
- import{nx as T,j3 as U,bO as V,bR as Z,bT as R,bS as H,ny as W,nz as J}from"./titleFrameBudget-DsM0V482.js";const rt=(n,a,e)=>Math.round(Math.min(4e7,Math.max(2e6,n*a*e*.16)));function at(n,a,e,t,o,r){const i=n.crop||{left:0,right:0,top:0,bottom:0},m=Math.max(2,Math.floor(a*(1-i.left-i.right)/2)*2),c=Math.max(2,Math.floor(e*(1-i.top-i.bottom)/2)*2);let h=i.left,y=i.top,s=m/a,l=c/e,w=0,u=0,f=t,x=o;const d=T(n,t,o);if(d){const b=Math.max(d.w/m,d.h/c),v=d.w/b/a,z=d.h/b/e;h+=(s-v)/2,y+=(l-z)/2,s=v,l=z,w=d.x,u=d.y,f=d.w,x=d.h}else if(n.fit==="cover"){const b=Math.max(t/m,o/c),v=t/b/a,z=o/b/e;h+=(s-v)/2,y+=(l-z)/2,s=v,l=z}else{const b=Math.min(t/m,o/c);f=Math.round(m*b),x=Math.round(c*b),w=(t-f)/2,u=(o-x)/2}n.flipX&&(h+=s,s=-s),n.flipY&&(y+=l,l=-l);const M=Math.max(2,Math.trunc(t*r.zoom*(r.sx??1)/2)*2),p=Math.max(2,Math.trunc(o*r.zoom*(r.sy??1)/2)*2),k=Math.trunc((t-M)/2+r.x*t),g=Math.trunc((o-p)/2+r.y*o);return{dst:[(k+w*M/t)/t,(g+u*p/o)/o,f*M/t/t,x*p/o/o],src:[h,y,s,l]}}function et(n,a){const e=Math.min(n.visualFadeIn||0,n.duration),t=Math.min(n.visualFadeOut||0,n.duration);return e>a+1e-5?{k:Math.min(1,Math.max(0,a/e)),white:n.fadeInColor==="white"}:t>0&&a>n.duration-t+1e-5?{k:Math.min(1,Math.max(0,(n.duration-a)/t)),white:n.fadeOutColor==="white"}:{k:1,white:!1}}function tt(n,a=48e3,e=.95){const t=n[0].length,o=Math.round(a*.005),r=Math.exp(-1/(a*.05)),i=new Float32Array(t);for(let h=0;h<t;h++){let y=0;for(const s of n)y=Math.max(y,Math.abs(s[h]));i[h]=y>e?e/y:1}let m=1;const c=[];for(let h=0;h<t+o;h++){if(h<t){for(;c.length&&i[c[c.length-1]]>=i[h];)c.pop();c.push(h)}const y=h-o;if(y<0)continue;for(;c.length&&c[0]<y;)c.shift();const s=c.length?i[c[0]]:1;m=Math.min(s,1-(1-m)*r);for(const l of n)l[y]*=m}}function st(n){if(n.colorBypass)return null;const a=(n.brightness??1)*2**(n.exposure??0),e=n.contrast??1,t=n.saturation??1,o=n.hue??0;if(a===1&&e===1&&t===1&&o===0)return null;const{sat:r,rot:i}=U(t,o);return{bright:a,contrast:e,sat:r,rot:i}}function it(n,a){const e=-J*255/(255-J);return(Array.isArray(n.effects)?n.effects:[]).filter(t=>!t.off&&t.amount>.001).flatMap(t=>{if(t.type==="blur")return[{type:"blur",sigma:V(t.amount,a)}];if(t.type==="glow")return[{type:"glow",sigma:Z(a),lo:e/255,k:(255-e)/255,amount:+t.amount.toFixed(4)}];if(t.type==="rgb-split")return[{type:"shift",px:R(t.amount,a)}];if(t.type==="light-burst")return[{type:"burst",amount:t.amount,lo:e/255,k:(255-e)/255}];if(t.type==="pixelate"){const r=H(t.amount,a);return r>1?[{type:"pixel",block:r}]:[]}const o=W(t.type,t.amount);return o?[{type:"colour",m:o.m,lut:o.lut,key:`${t.type}:${t.amount}`}]:[]})}function ht(n,a,e=48e3){const t=n[0]?.length??0,o=Math.max(1,Math.round(t/a));if(Math.abs(a-1)<1e-9||t<2)return n.map(u=>u.slice(0,o));const r=2*Math.round(e*.02),i=r/2,m=Math.round(e*.01),c=4,h=new Float32Array(r);for(let u=0;u<r;u++)h[u]=.5-.5*Math.cos(2*Math.PI*u/r);const y=new Float32Array(t);for(const u of n)for(let f=0;f<t;f++)y[f]+=u[f]/n.length;const s=n.map(()=>new Float32Array(o+r)),l=new Float32Array(o+r);let w=0;for(let u=0;u*i<o;u++){const f=u*i,x=Math.min(t-1,Math.round(f*a));let d=x;if(u>0){const M=w+i;let p=-1/0;for(let k=-m;k<=m;k+=2){const g=x+k;if(g<0||g+i>t||M+i>t)continue;let F=0;for(let b=0;b<i;b+=c)F+=y[g+b]*y[M+b];F>p&&(p=F,d=g)}}for(let M=0;M<n.length;M++){const p=n[M],k=s[M];for(let g=0;g<r&&d+g<t;g++)k[f+g]+=p[d+g]*h[g]}for(let M=0;M<r&&d+M<t;M++)l[f+M]+=h[M];w=d}return s.map(u=>{const f=new Float32Array(o);for(let x=0;x<o;x++)f[x]=l[x]>.001?u[x]/l[x]:u[x];return f})}function ot(n,a=48e3){if(a!==48e3)throw Error("integratedLoudness: 48 kHz only");const e=n[0].length,t=n.map(s=>{const l=new Float64Array(e),w=new Float64Array(e);let u=0,f=0,x=0,d=0;for(let M=0;M<e;M++){const p=1.53512485958697*s[M]-2.69169618940638*u+1.19839281085285*f+1.69065929318241*x-.73248077421585*d;f=u,u=s[M],d=x,x=p,l[M]=p}u=0,f=0,x=0,d=0;for(let M=0;M<e;M++){const p=l[M]-2*u+f+1.99004745483398*x-.99007225036621*d;f=u,u=l[M],d=x,x=p,w[M]=p*p}return w}),o=.4*a,r=.1*a,i=[];for(let s=0;s+o<=e;s+=r){let l=0;for(const w of t){let u=0;for(let f=s;f<s+o;f++)u+=w[f];l+=u/o}i.push(l)}const m=s=>-.691+10*Math.log10(s),c=i.filter(s=>m(s)>-70);if(!c.length)return-1/0;const h=m(c.reduce((s,l)=>s+l,0)/c.length)-10,y=c.filter(s=>m(s)>h);return m(y.reduce((s,l)=>s+l,0)/y.length)}function ct(n,a,e=48e3){const t=ot(n,e);if(!Number.isFinite(t))return t;const o=10**((a-t)/20);for(const r of n)for(let i=0;i<r.length;i++)r[i]*=o;return tt(n,e,10**(-1.5/20)),t}function ut([n,a,e,t],o,r){return[(2+n*(o-4))/o,(2+a*(r-4))/r,e*(o-4)/o,t*(r-4)/r]}function ft(n,a,e){const[[t,o],[r,i],[m,c],[h,y]]=n,s=t-r+h-m,l=o-i+y-c;let w,u,f,x,d,M,p,k;if(Math.abs(s)<1e-9&&Math.abs(l)<1e-9)w=r-t,u=h-r,f=t,x=i-o,d=y-i,M=o,p=0,k=0;else{const K=r-h,N=m-h,Q=i-y,_=c-y,$=K*_-N*Q;p=(s*_-N*l)/$,k=(K*l-s*Q)/$,w=r-t+p*r,u=m-t+k*m,f=t,x=i-o+p*i,d=c-o+k*c,M=o}const g=[w/a,u/e,f,x/a,d/e,M,p/a,k/e,1],[F,b,v,z,O,P,I,B,C]=g,S=O*C-P*B,G=-(b*C-v*B),j=b*P-v*O,L=-(z*C-P*I),X=F*C-v*I,q=-(F*P-v*z),E=z*B-O*I,Y=-(F*B-b*I),D=F*O-b*z,A=F*S+b*L+v*E;return[S/A,G/A,j/A,L/A,X/A,q/A,E/A,Y/A,D/A]}function lt(n,a,e){const t=n.crop||{left:0,right:0,top:0,bottom:0},o=Math.max(2,Math.floor(a*(1-t.left-t.right)/2)*2),r=Math.max(2,Math.floor(e*(1-t.top-t.bottom)/2)*2);let i=t.left,m=t.top,c=o/a,h=r/e;return n.flipX&&(i+=c,c=-c),n.flipY&&(m+=h,h=-h),[i,m,c,h]}function Mt(n,a,e,t,o,r,i){const m=n.crop||{left:0,right:0,top:0,bottom:0},c=Math.max(2,Math.floor(a*(1-m.left-m.right)/2)*2),h=Math.max(2,Math.floor(e*(1-m.top-m.bottom)/2)*2),y=(r.rot||0)*Math.PI/180,s=Math.cos(y),l=Math.sin(y),w=X=>Math.ceil(X/2)*2,u=w(Math.hypot(c,h)),f=i?u:w(c*Math.abs(s)+h*Math.abs(l)),x=i?u:w(c*Math.abs(l)+h*Math.abs(s)),d=Math.round(o*f/x),M=Math.round(t*x/f),p=n.fit==="cover",k=p?Math.max(d,t):Math.min(d,t),g=p?Math.max(M,o):Math.min(M,o),F=p?-Math.trunc((k-t)/2):Math.trunc((t-k)/2),b=p?-Math.trunc((g-o)/2):Math.trunc((o-g)/2),v=k/f,z=g/x,O=F+k/2,P=b+g/2,I=Math.max(2,Math.trunc(t*r.zoom*(r.sx??1)/2)*2),B=Math.max(2,Math.trunc(o*r.zoom*(r.sy??1)/2)*2),C=Math.trunc((t-I)/2+r.x*t),S=Math.trunc((o-B)/2+r.y*o),G=I/t,j=B/o,L=(X,q)=>{const E=(X-2)/(t-4)*c-c/2,Y=(q-2)/(o-4)*h-h/2,D=O+(E*s-Y*l)*v,A=P+(E*l+Y*s)*z;return[C+D*G,S+A*j]};return{quad:[L(0,0),L(t,0),L(0,o),L(t,o)],clip:p?[C,S,I,B]:null}}function mt(n,a,e,t){const o=t*Math.PI/180,r=Math.cos(o),i=Math.sin(o),m=a/2,c=e/2,h=(y,s)=>{const l=(y-2)/(a-4),w=(s-2)/(e-4),u=(n[0]+l*n[2])*a-m,f=(n[1]+w*n[3])*e-c;return[m+u*r-f*i,c+u*i+f*r]};return[h(0,0),h(a,0),h(0,e),h(a,e)]}export{at as a,it as b,ht as c,tt as d,et as f,rt as g,st as l,ct as n,ut as p,Mt as r,lt as s,mt as t,ft as w};
1
+ import{nE as T,j7 as U,bO as V,bR as Z,bT as R,bS as H,nF as W,nG as J}from"./titleFrameBudget-h4nOQ5u9.js";const rt=(n,a,e)=>Math.round(Math.min(4e7,Math.max(2e6,n*a*e*.16)));function at(n,a,e,t,o,r){const i=n.crop||{left:0,right:0,top:0,bottom:0},m=Math.max(2,Math.floor(a*(1-i.left-i.right)/2)*2),c=Math.max(2,Math.floor(e*(1-i.top-i.bottom)/2)*2);let h=i.left,y=i.top,s=m/a,l=c/e,w=0,u=0,f=t,x=o;const d=T(n,t,o);if(d){const b=Math.max(d.w/m,d.h/c),v=d.w/b/a,z=d.h/b/e;h+=(s-v)/2,y+=(l-z)/2,s=v,l=z,w=d.x,u=d.y,f=d.w,x=d.h}else if(n.fit==="cover"){const b=Math.max(t/m,o/c),v=t/b/a,z=o/b/e;h+=(s-v)/2,y+=(l-z)/2,s=v,l=z}else{const b=Math.min(t/m,o/c);f=Math.round(m*b),x=Math.round(c*b),w=(t-f)/2,u=(o-x)/2}n.flipX&&(h+=s,s=-s),n.flipY&&(y+=l,l=-l);const M=Math.max(2,Math.trunc(t*r.zoom*(r.sx??1)/2)*2),p=Math.max(2,Math.trunc(o*r.zoom*(r.sy??1)/2)*2),k=Math.trunc((t-M)/2+r.x*t),g=Math.trunc((o-p)/2+r.y*o);return{dst:[(k+w*M/t)/t,(g+u*p/o)/o,f*M/t/t,x*p/o/o],src:[h,y,s,l]}}function et(n,a){const e=Math.min(n.visualFadeIn||0,n.duration),t=Math.min(n.visualFadeOut||0,n.duration);return e>a+1e-5?{k:Math.min(1,Math.max(0,a/e)),white:n.fadeInColor==="white"}:t>0&&a>n.duration-t+1e-5?{k:Math.min(1,Math.max(0,(n.duration-a)/t)),white:n.fadeOutColor==="white"}:{k:1,white:!1}}function tt(n,a=48e3,e=.95){const t=n[0].length,o=Math.round(a*.005),r=Math.exp(-1/(a*.05)),i=new Float32Array(t);for(let h=0;h<t;h++){let y=0;for(const s of n)y=Math.max(y,Math.abs(s[h]));i[h]=y>e?e/y:1}let m=1;const c=[];for(let h=0;h<t+o;h++){if(h<t){for(;c.length&&i[c[c.length-1]]>=i[h];)c.pop();c.push(h)}const y=h-o;if(y<0)continue;for(;c.length&&c[0]<y;)c.shift();const s=c.length?i[c[0]]:1;m=Math.min(s,1-(1-m)*r);for(const l of n)l[y]*=m}}function st(n){if(n.colorBypass)return null;const a=(n.brightness??1)*2**(n.exposure??0),e=n.contrast??1,t=n.saturation??1,o=n.hue??0;if(a===1&&e===1&&t===1&&o===0)return null;const{sat:r,rot:i}=U(t,o);return{bright:a,contrast:e,sat:r,rot:i}}function it(n,a){const e=-J*255/(255-J);return(Array.isArray(n.effects)?n.effects:[]).filter(t=>!t.off&&t.amount>.001).flatMap(t=>{if(t.type==="blur")return[{type:"blur",sigma:V(t.amount,a)}];if(t.type==="glow")return[{type:"glow",sigma:Z(a),lo:e/255,k:(255-e)/255,amount:+t.amount.toFixed(4)}];if(t.type==="rgb-split")return[{type:"shift",px:R(t.amount,a)}];if(t.type==="light-burst")return[{type:"burst",amount:t.amount,lo:e/255,k:(255-e)/255}];if(t.type==="pixelate"){const r=H(t.amount,a);return r>1?[{type:"pixel",block:r}]:[]}const o=W(t.type,t.amount);return o?[{type:"colour",m:o.m,lut:o.lut,key:`${t.type}:${t.amount}`}]:[]})}function ht(n,a,e=48e3){const t=n[0]?.length??0,o=Math.max(1,Math.round(t/a));if(Math.abs(a-1)<1e-9||t<2)return n.map(u=>u.slice(0,o));const r=2*Math.round(e*.02),i=r/2,m=Math.round(e*.01),c=4,h=new Float32Array(r);for(let u=0;u<r;u++)h[u]=.5-.5*Math.cos(2*Math.PI*u/r);const y=new Float32Array(t);for(const u of n)for(let f=0;f<t;f++)y[f]+=u[f]/n.length;const s=n.map(()=>new Float32Array(o+r)),l=new Float32Array(o+r);let w=0;for(let u=0;u*i<o;u++){const f=u*i,x=Math.min(t-1,Math.round(f*a));let d=x;if(u>0){const M=w+i;let p=-1/0;for(let k=-m;k<=m;k+=2){const g=x+k;if(g<0||g+i>t||M+i>t)continue;let F=0;for(let b=0;b<i;b+=c)F+=y[g+b]*y[M+b];F>p&&(p=F,d=g)}}for(let M=0;M<n.length;M++){const p=n[M],k=s[M];for(let g=0;g<r&&d+g<t;g++)k[f+g]+=p[d+g]*h[g]}for(let M=0;M<r&&d+M<t;M++)l[f+M]+=h[M];w=d}return s.map(u=>{const f=new Float32Array(o);for(let x=0;x<o;x++)f[x]=l[x]>.001?u[x]/l[x]:u[x];return f})}function ot(n,a=48e3){if(a!==48e3)throw Error("integratedLoudness: 48 kHz only");const e=n[0].length,t=n.map(s=>{const l=new Float64Array(e),w=new Float64Array(e);let u=0,f=0,x=0,d=0;for(let M=0;M<e;M++){const p=1.53512485958697*s[M]-2.69169618940638*u+1.19839281085285*f+1.69065929318241*x-.73248077421585*d;f=u,u=s[M],d=x,x=p,l[M]=p}u=0,f=0,x=0,d=0;for(let M=0;M<e;M++){const p=l[M]-2*u+f+1.99004745483398*x-.99007225036621*d;f=u,u=l[M],d=x,x=p,w[M]=p*p}return w}),o=.4*a,r=.1*a,i=[];for(let s=0;s+o<=e;s+=r){let l=0;for(const w of t){let u=0;for(let f=s;f<s+o;f++)u+=w[f];l+=u/o}i.push(l)}const m=s=>-.691+10*Math.log10(s),c=i.filter(s=>m(s)>-70);if(!c.length)return-1/0;const h=m(c.reduce((s,l)=>s+l,0)/c.length)-10,y=c.filter(s=>m(s)>h);return m(y.reduce((s,l)=>s+l,0)/y.length)}function ct(n,a,e=48e3){const t=ot(n,e);if(!Number.isFinite(t))return t;const o=10**((a-t)/20);for(const r of n)for(let i=0;i<r.length;i++)r[i]*=o;return tt(n,e,10**(-1.5/20)),t}function ut([n,a,e,t],o,r){return[(2+n*(o-4))/o,(2+a*(r-4))/r,e*(o-4)/o,t*(r-4)/r]}function ft(n,a,e){const[[t,o],[r,i],[m,c],[h,y]]=n,s=t-r+h-m,l=o-i+y-c;let w,u,f,x,d,M,p,k;if(Math.abs(s)<1e-9&&Math.abs(l)<1e-9)w=r-t,u=h-r,f=t,x=i-o,d=y-i,M=o,p=0,k=0;else{const K=r-h,N=m-h,Q=i-y,_=c-y,$=K*_-N*Q;p=(s*_-N*l)/$,k=(K*l-s*Q)/$,w=r-t+p*r,u=m-t+k*m,f=t,x=i-o+p*i,d=c-o+k*c,M=o}const g=[w/a,u/e,f,x/a,d/e,M,p/a,k/e,1],[F,b,v,z,L,O,I,B,C]=g,P=L*C-O*B,Y=-(b*C-v*B),j=b*O-v*L,E=-(z*C-O*I),S=F*C-v*I,q=-(F*O-v*z),X=z*B-L*I,G=-(F*B-b*I),D=F*L-b*z,A=F*P+b*E+v*X;return[P/A,Y/A,j/A,E/A,S/A,q/A,X/A,G/A,D/A]}function lt(n,a,e){const t=n.crop||{left:0,right:0,top:0,bottom:0},o=Math.max(2,Math.floor(a*(1-t.left-t.right)/2)*2),r=Math.max(2,Math.floor(e*(1-t.top-t.bottom)/2)*2);let i=t.left,m=t.top,c=o/a,h=r/e;return n.flipX&&(i+=c,c=-c),n.flipY&&(m+=h,h=-h),[i,m,c,h]}function Mt(n,a,e,t,o,r,i){const m=n.crop||{left:0,right:0,top:0,bottom:0},c=Math.max(2,Math.floor(a*(1-m.left-m.right)/2)*2),h=Math.max(2,Math.floor(e*(1-m.top-m.bottom)/2)*2),y=(r.rot||0)*Math.PI/180,s=Math.cos(y),l=Math.sin(y),w=S=>Math.ceil(S/2)*2,u=w(Math.hypot(c,h)),f=i?u:w(c*Math.abs(s)+h*Math.abs(l)),x=i?u:w(c*Math.abs(l)+h*Math.abs(s)),d=Math.round(o*f/x),M=Math.round(t*x/f),p=n.fit==="cover",k=p?Math.max(d,t):Math.min(d,t),g=p?Math.max(M,o):Math.min(M,o),F=p?-Math.trunc((k-t)/2):Math.trunc((t-k)/2),b=p?-Math.trunc((g-o)/2):Math.trunc((o-g)/2),v=k/f,z=g/x,L=F+k/2,O=b+g/2,I=Math.max(2,Math.trunc(t*r.zoom*(r.sx??1)/2)*2),B=Math.max(2,Math.trunc(o*r.zoom*(r.sy??1)/2)*2),C=Math.trunc((t-I)/2+r.x*t),P=Math.trunc((o-B)/2+r.y*o),Y=I/t,j=B/o,E=(S,q)=>{const X=(S-2)/(t-4)*c-c/2,G=(q-2)/(o-4)*h-h/2,D=L+(X*s-G*l)*v,A=O+(X*l+G*s)*z;return[C+D*Y,P+A*j]};return{quad:[E(0,0),E(t,0),E(0,o),E(t,o)],clip:p?[C,P,I,B]:null}}function mt(n,a,e,t){const o=t*Math.PI/180,r=Math.cos(o),i=Math.sin(o),m=a/2,c=e/2,h=(y,s)=>{const l=(y-2)/(a-4),w=(s-2)/(e-4),u=(n[0]+l*n[2])*a-m,f=(n[1]+w*n[3])*e-c;return[m+u*r-f*i,c+u*i+f*r]};return[h(0,0),h(a,0),h(0,e),h(a,e)]}export{at as a,it as b,ht as c,tt as d,et as f,rt as g,st as l,ct as n,ut as p,Mt as r,lt as s,mt as t,ft as w};