hyperframes 0.8.91 → 0.8.92

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 (150) hide show
  1. package/dist/{add-LM5QLN3C.js → add-GCLS5XT7.js} +16 -16
  2. package/dist/{animatedGifPrep-K4JXNDVB.js → animatedGifPrep-VMFM2PBA.js} +6 -6
  3. package/dist/{asset-N2ZCF3TF.js → asset-NFBCQ2QB.js} +2 -2
  4. package/dist/{assetCataloger-CDEJC5QV.js → assetCataloger-27YXPNX2.js} +2 -2
  5. package/dist/{auth-M6RIGSOA.js → auth-J6MHERMA.js} +2 -2
  6. package/dist/{autoUpdate-HPWJQCEJ.js → autoUpdate-D7RMTMHF.js} +2 -2
  7. package/dist/{backgroundChecks-7FNAVAWS.js → backgroundChecks-ZUXDCYTJ.js} +3 -3
  8. package/dist/backgroundChecksWorker.js +3 -3
  9. package/dist/{batchRender-OWCX3WI4.js → batchRender-DCN2X35X.js} +3 -3
  10. package/dist/{beats-TBRZUL5C.js → beats-5FEJVZZY.js} +10 -10
  11. package/dist/{benchmark-4RGMJGVD.js → benchmark-ZBDA5GFV.js} +12 -12
  12. package/dist/{browser-4MZ5CLY7.js → browser-EAGFAPYB.js} +9 -9
  13. package/dist/{bundleWithLocalizedFonts-6FJV5ME2.js → bundleWithLocalizedFonts-W7JJ23TN.js} +2 -2
  14. package/dist/{capture-QM2JRH7T.js → capture-27ZCA6CP.js} +7 -7
  15. package/dist/{capture-ZMZFCHW4.js → capture-W5XUURVP.js} +2 -2
  16. package/dist/{catalog-LWYAH2MC.js → catalog-SPPSMRB5.js} +16 -16
  17. package/dist/{check-5CTGRHDC.js → check-NV3OKYHO.js} +30 -30
  18. package/dist/{checkBrowser-LPKPYD4J.js → checkBrowser-KL4V257E.js} +29 -29
  19. package/dist/{chunk-6TNEX275.js → chunk-2A6FVDIZ.js} +1 -1
  20. package/dist/{chunk-325EA5ST.js → chunk-2E4WZU4S.js} +3 -3
  21. package/dist/{chunk-CXPRQS6R.js → chunk-2RWYPLRR.js} +2 -2
  22. package/dist/{chunk-DHD3AEXF.js → chunk-6WIXZ3HB.js} +3 -3
  23. package/dist/{chunk-MISDKW56.js → chunk-7AGI2TLZ.js} +2 -2
  24. package/dist/{chunk-UNZOL3UD.js → chunk-AIW6VOK6.js} +3 -3
  25. package/dist/{chunk-TJB5VU5L.js → chunk-BMQLA6GZ.js} +35 -42
  26. package/dist/{chunk-FFPYON3V.js → chunk-CU2N7HZD.js} +1 -1
  27. package/dist/{chunk-Z6Z7KGEU.js → chunk-DKTP377I.js} +1 -1
  28. package/dist/{chunk-AWMMV65H.js → chunk-DU2IMZTI.js} +2 -2
  29. package/dist/{chunk-4MQQI2II.js → chunk-E3UXLITA.js} +1 -1
  30. package/dist/{chunk-WA7RZY3S.js → chunk-ENV2LB4E.js} +3 -3
  31. package/dist/{chunk-CPDR5AI7.js → chunk-FLGA3ZUU.js} +5 -5
  32. package/dist/{chunk-2QTVED47.js → chunk-FWLRQHMF.js} +1 -1
  33. package/dist/{chunk-CC5HTRDE.js → chunk-GXIHEX7Z.js} +1 -1
  34. package/dist/{chunk-HSGHPWA2.js → chunk-J7PWGYI3.js} +3 -3
  35. package/dist/{chunk-MFXTKG6F.js → chunk-JYEIGPLH.js} +4 -4
  36. package/dist/{chunk-LXRB4VUU.js → chunk-JZP473HH.js} +9 -9
  37. package/dist/{chunk-U24VGXGA.js → chunk-KVA65K7M.js} +39 -10
  38. package/dist/{chunk-SNHAPE52.js → chunk-LNYBSC5Z.js} +114 -62
  39. package/dist/{chunk-G5CORT4V.js → chunk-MCR5L5H5.js} +1 -1
  40. package/dist/{chunk-CWAZA6DG.js → chunk-MWVZQN2E.js} +1 -1
  41. package/dist/{chunk-S6YCUTNM.js → chunk-NRAXUJQS.js} +3 -3
  42. package/dist/{chunk-BYZZCZ2K.js → chunk-NRQLS4HO.js} +4 -4
  43. package/dist/{chunk-J5LICYQR.js → chunk-NZVRTDVW.js} +1 -1
  44. package/dist/{chunk-RZYPG4LH.js → chunk-O63VBAED.js} +1 -1
  45. package/dist/{chunk-P67KXZGX.js → chunk-QOJZKPIC.js} +4 -4
  46. package/dist/{chunk-DJD2XA6I.js → chunk-QVOBDLUO.js} +3 -3
  47. package/dist/{chunk-UMBXSPYI.js → chunk-R7RHFXEK.js} +1 -1
  48. package/dist/{chunk-VDLFGW4J.js → chunk-RP6O7QFB.js} +74 -63
  49. package/dist/{chunk-V5Z3QGG2.js → chunk-RZC26MUU.js} +1 -1
  50. package/dist/{chunk-HEMH55SZ.js → chunk-SSAULSQM.js} +8 -8
  51. package/dist/{chunk-AUGLU6WA.js → chunk-SVQIWXWC.js} +2 -2
  52. package/dist/{chunk-BP3M6JPK.js → chunk-TDMX5OUY.js} +1 -1
  53. package/dist/{chunk-SSMNR7NU.js → chunk-TXN5R33Q.js} +2 -2
  54. package/dist/{chunk-CALFK3EB.js → chunk-UURZ5VB2.js} +1 -1
  55. package/dist/{chunk-NAAXO3N5.js → chunk-WBASC4GU.js} +3 -3
  56. package/dist/chunk-WNYPPH3Y.js +3528 -0
  57. package/dist/{chunk-PRPE3JNB.js → chunk-WRN74OOR.js} +1 -1
  58. package/dist/{chunk-E2FAYCAL.js → chunk-XGVMRQ6N.js} +8 -8
  59. package/dist/{chunk-SZ2NP7UV.js → chunk-YB7OWCJ7.js} +1 -1
  60. package/dist/{chunk-SUYIGLDN.js → chunk-Z44U3GMN.js} +1 -1
  61. package/dist/{chunk-RGHVO2UZ.js → chunk-ZOF426FA.js} +1 -1
  62. package/dist/{clean-Z3SYXU27.js → clean-CKYQK575.js} +14 -14
  63. package/dist/cli.js +50 -50
  64. package/dist/{cloud-DN2FSGEN.js → cloud-HRH5HUBL.js} +4 -4
  65. package/dist/{cloudrun-XRZZV4QW.js → cloudrun-HSHBRCS4.js} +3 -3
  66. package/dist/{compare-SXN42PJF.js → compare-45VBPJBR.js} +24 -24
  67. package/dist/{compiler-JKWKLSX6.js → compiler-HBDJ2FCK.js} +13 -3
  68. package/dist/{component-WK3MMT5D.js → component-IOAEAQSN.js} +3 -3
  69. package/dist/{compositions-XRJ2DDV3.js → compositions-VECXWCML.js} +17 -15
  70. package/dist/{delete-AM732KQJ.js → delete-ESBMF3XA.js} +2 -2
  71. package/dist/{dist-GFYJLCSU.js → dist-COKVABAK.js} +2 -2
  72. package/dist/{dist-5Q62YHZI.js → dist-HJFL4ZN5.js} +1 -1
  73. package/dist/{doctor-YQDGYTQM.js → doctor-AGIH65QA.js} +10 -10
  74. package/dist/{events-APLXVZ3I.js → events-EAINIMXE.js} +9 -9
  75. package/dist/{events-HKIWOY7W.js → events-INGDO67S.js} +8 -8
  76. package/dist/{feedback-JNJURFQW.js → feedback-XISLH3UL.js} +10 -10
  77. package/dist/{figma-WLQBX4IF.js → figma-O36BE6S7.js} +3 -3
  78. package/dist/fontLocalizeCli.js +8 -8
  79. package/dist/{get-EZ5QWZNN.js → get-2TBRXWDH.js} +2 -2
  80. package/dist/{gpuPolicy-HQG5D4W4.js → gpuPolicy-FDXLHK7O.js} +6 -6
  81. package/dist/{grade-compare-CNJBF5FD.js → grade-compare-3AH3U2UM.js} +24 -24
  82. package/dist/{help-GOIEXCCA.js → help-AQHVWZ7U.js} +1 -1
  83. package/dist/{history-XRSETYAE.js → history-YUY6U7VJ.js} +14 -14
  84. package/dist/hyperframe-runtime.js +43 -43
  85. package/dist/hyperframe.manifest.json +1 -1
  86. package/dist/hyperframe.runtime.iife.js +43 -43
  87. package/dist/hyperframes-player.global.js +1 -1
  88. package/dist/{info-3XSV2EFP.js → info-CG74OV3N.js} +11 -11
  89. package/dist/{init-B6524UHY.js → init-BSRRUJTN.js} +21 -21
  90. package/dist/{inspect-CQX6K5ET.js → inspect-T6XSKC5K.js} +25 -25
  91. package/dist/{installer-QU2LANZ7.js → installer-EGIOS5UQ.js} +5 -5
  92. package/dist/{keyframes-HRCYZ6R2.js → keyframes-HBASU3QG.js} +22 -17
  93. package/dist/{lambda-RIEGJXBT.js → lambda-64LK5VBR.js} +4 -4
  94. package/dist/{layout-7ZNC3OWA.js → layout-QVKBBOF5.js} +25 -25
  95. package/dist/{lint-IAKBWR3G.js → lint-GQPGCGYW.js} +12 -12
  96. package/dist/{lintProject-OUOTD5DS.js → lintProject-ESEUOGXF.js} +1 -1
  97. package/dist/{list-NSVU5YDL.js → list-MFG3CWUG.js} +2 -2
  98. package/dist/{login-Q76SF3KL.js → login-UY5HMZ63.js} +4 -4
  99. package/dist/{media-treatment-F5GZ4KOP.js → media-treatment-PLRQ4NJB.js} +12 -12
  100. package/dist/{models-4SDFED6C.js → models-VK3NR4ZI.js} +7 -7
  101. package/dist/{motionShot-SY4RU6U5.js → motionShot-VNNW6WV6.js} +10 -10
  102. package/dist/{normalize-audio-7HUEZIUZ.js → normalize-audio-LWC5EDG4.js} +10 -10
  103. package/dist/{pipeline-2HIV4Y7G.js → pipeline-S24AZTNK.js} +6 -6
  104. package/dist/{play-4YRL4KOS.js → play-WOGMI4FU.js} +20 -20
  105. package/dist/{preflight-IY4NAUE4.js → preflight-O7TG2WSZ.js} +7 -7
  106. package/dist/{present-6MFRVEM6.js → present-NK4CEHVO.js} +15 -15
  107. package/dist/{preview-AHQURXOT.js → preview-6IFZAPIL.js} +18 -18
  108. package/dist/{producer-QCLJ24EY.js → producer-ULL2HNOC.js} +1 -1
  109. package/dist/{projectConfig-EJV3KBCO.js → projectConfig-6DIB7H7E.js} +7 -7
  110. package/dist/{publication-4MXCWAAF.js → publication-OAGIQJHU.js} +3 -3
  111. package/dist/{publish-Y5XULKT3.js → publish-XRUKN32V.js} +9 -9
  112. package/dist/{remove-background-MZLVZJDP.js → remove-background-P2W275SH.js} +7 -7
  113. package/dist/{render-I6BBYGK4.js → render-APAOFW2G.js} +3 -3
  114. package/dist/{render-3SPC22N3.js → render-BQ55H4P5.js} +22 -22
  115. package/dist/{render-FMD7UKEI.js → render-W5KZWLFB.js} +12 -12
  116. package/dist/{render-batch-YOLPHNBE.js → render-batch-WPWPY5UA.js} +3 -3
  117. package/dist/{renderCancellation-OKZ2OSKI.js → renderCancellation-LN37WZR4.js} +6 -6
  118. package/dist/renderSetupWorker.js +1 -1
  119. package/dist/{resolver-4MDVOI4J.js → resolver-DMRC6NBN.js} +5 -5
  120. package/dist/{sherpa-XU2H4MTL.js → sherpa-7DHFDVXD.js} +7 -7
  121. package/dist/{skills-XOUE2DXY.js → skills-P42VIJ2S.js} +11 -11
  122. package/dist/{skillsUpdateCheck-J43BUUXQ.js → skillsUpdateCheck-MV4HDYO7.js} +3 -3
  123. package/dist/{snapshot-EMF7KGSM.js → snapshot-OFUU3SMV.js} +25 -25
  124. package/dist/{src-5V3MJNPC.js → src-6CP5D2JF.js} +5 -5
  125. package/dist/{src-SPJS4DVA.js → src-YUWEFLV4.js} +7 -7
  126. package/dist/{staticProjectServer-LKMDZ2DQ.js → staticProjectServer-FPLN4VJQ.js} +14 -14
  127. package/dist/{status-BIF2WXFE.js → status-Z3CRKR35.js} +6 -6
  128. package/dist/studio/assets/{hyperframes-player-zT2Bdx_l.js → hyperframes-player-DKJPDHUp.js} +1 -1
  129. package/dist/studio/assets/{index-V-0rfhe6.js → index-C5_j5-3u.js} +153 -153
  130. package/dist/studio/assets/{index-DSOLcE8X.js → index-CHZ4kFWm.js} +1 -1
  131. package/dist/studio/assets/{index-DV-z19zB.js → index-DpzpqJ_j.js} +1 -1
  132. package/dist/studio/index.d.ts +6 -11
  133. package/dist/studio/index.html +1 -1
  134. package/dist/studio/index.js +8770 -8791
  135. package/dist/studio/index.js.map +1 -1
  136. package/dist/{studio-api-UT3W5AA6.js → studio-api-4FHIU7WA.js} +7 -7
  137. package/dist/{studioServer-Y3RJUIQM.js → studioServer-PIPRPNH2.js} +38 -38
  138. package/dist/{system-5ALLLQFH.js → system-47NPBMGC.js} +6 -6
  139. package/dist/{telemetry-LTGWUJJT.js → telemetry-AH7RMCZ5.js} +9 -9
  140. package/dist/{timeline-AA3LL6DL.js → timeline-E7QT5JZZ.js} +14 -14
  141. package/dist/{tokens-ROIWLZRY.js → tokens-OJWP37XP.js} +2 -2
  142. package/dist/{transcribe-MWG54RBB.js → transcribe-AZ3MXBCY.js} +7 -7
  143. package/dist/{transcribe-TMWKDHAI.js → transcribe-ZUVU222E.js} +12 -12
  144. package/dist/{updateCheck-HF7VV7W4.js → updateCheck-B57VMFQ3.js} +2 -2
  145. package/dist/{upgrade-3OAEBAEA.js → upgrade-P67KFD64.js} +2 -2
  146. package/dist/{urlDownloader-YNKW5OUO.js → urlDownloader-3LDWI4UF.js} +5 -5
  147. package/dist/{validate-ULWT5J56.js → validate-I7W4ERNH.js} +15 -15
  148. package/dist/{video-2IYAAHHK.js → video-X4WQOX3E.js} +6 -6
  149. package/package.json +1 -1
  150. package/dist/chunk-275NJDC5.js +0 -3528
@@ -0,0 +1,3528 @@
1
+ import { createRequire as __hf_createRequire } from "node:module";
2
+ import { fileURLToPath as __hf_fileURLToPath } from "node:url";
3
+ import { dirname as __hf_dirname } from "node:path";
4
+ var require = __hf_createRequire(import.meta.url);
5
+ var __filename = __hf_fileURLToPath(import.meta.url);
6
+ var __dirname = __hf_dirname(__filename);
7
+ import {
8
+ COLOR_GRADING_ADJUST_KEYS,
9
+ COLOR_GRADING_ADVANCED_LIMITS,
10
+ COLOR_GRADING_COLOR_SPACE,
11
+ COLOR_GRADING_CONTRACT_VERSION,
12
+ COLOR_GRADING_CURVE_KEYS,
13
+ COLOR_GRADING_DETAIL_KEYS,
14
+ COLOR_GRADING_EFFECT_KEYS,
15
+ COLOR_GRADING_HUE_CURVE_KEYS,
16
+ COLOR_GRADING_LUT_KEYS,
17
+ COLOR_GRADING_MAX_CURVE_POINTS,
18
+ COLOR_GRADING_MAX_SECONDARIES,
19
+ COLOR_GRADING_TOP_LEVEL_KEYS,
20
+ COLOR_GRADING_WHEEL_KEYS,
21
+ MAX_PLAYBACK_RATE,
22
+ MIN_PLAYBACK_RATE,
23
+ clampPlaybackRate,
24
+ parseNumeric,
25
+ readAuthoredDurationSeconds,
26
+ readMediaOffsetSeconds,
27
+ readPlaybackRate,
28
+ resolveMediaDuration,
29
+ resolveNaturalDurationSeconds
30
+ } from "./chunk-TQFG7HTI.js";
31
+ import {
32
+ parseHTML
33
+ } from "./chunk-GK4AIFIH.js";
34
+
35
+ // ../core/dist/compiler/timingResolver.js
36
+ function resolveTimings(input) {
37
+ const { elements, wordTimings, anchors } = input;
38
+ const anchorMap = /* @__PURE__ */ new Map();
39
+ for (const anchor of anchors) {
40
+ anchorMap.set(anchor.hfId, anchor);
41
+ }
42
+ const wordMap = /* @__PURE__ */ new Map();
43
+ for (const wt of wordTimings) {
44
+ wordMap.set(wt.index, wt);
45
+ }
46
+ const result = {};
47
+ for (const el of elements) {
48
+ const anchor = anchorMap.get(el.hfId);
49
+ if (anchor === void 0) {
50
+ result[el.hfId] = {
51
+ enterAt: el.start,
52
+ exitAt: el.start + el.duration,
53
+ holdDuration: 0
54
+ };
55
+ continue;
56
+ }
57
+ const word = wordMap.get(anchor.wordIndex);
58
+ const wordStart = word !== void 0 ? word.start : 0;
59
+ const enterOffset = anchor.enterOffset ?? 0;
60
+ const enterAt = wordStart + enterOffset;
61
+ const holdDuration = Math.max(0, anchor.slotEnd - (enterAt + anchor.enterDuration + anchor.exitDuration));
62
+ const exitAt = enterAt + anchor.enterDuration + holdDuration + anchor.exitDuration;
63
+ result[el.hfId] = { enterAt, exitAt, holdDuration };
64
+ }
65
+ return result;
66
+ }
67
+
68
+ // ../core/dist/audioGain.js
69
+ var MAX_AUDIO_GAIN_DB = 12;
70
+ function audioDbToGain(db) {
71
+ return 10 ** (db / 20);
72
+ }
73
+ var MAX_AUDIO_GAIN = audioDbToGain(MAX_AUDIO_GAIN_DB);
74
+ function clampAudioGain(value) {
75
+ if (!Number.isFinite(value))
76
+ return 1;
77
+ return Math.max(0, Math.min(MAX_AUDIO_GAIN, value));
78
+ }
79
+ function formatAudioGain(gain) {
80
+ return clampAudioGain(gain).toFixed(6).replace(/\.?0+$/, "");
81
+ }
82
+
83
+ // ../core/dist/audioFx.js
84
+ var HF_AUDIO_FX_ATTR = "data-fx-chain";
85
+ var HF_AUDIO_FX_DATA_KEY = HF_AUDIO_FX_ATTR.slice("data-".length);
86
+ var HF_AUDIO_FX_CHAIN_VERSION = 1;
87
+ var freq = (key = "frequency", label = "Frequency", def = 1e3, min = 20, max = 2e4) => ({
88
+ kind: "number",
89
+ key,
90
+ label,
91
+ unit: "Hz",
92
+ min,
93
+ max,
94
+ step: 1,
95
+ default: def,
96
+ scale: "log",
97
+ automatable: true
98
+ });
99
+ var qParam = (def = 0.707, hint = "Bandwidth \u2014 higher is narrower.") => ({
100
+ kind: "number",
101
+ key: "q",
102
+ label: "Q",
103
+ unit: "",
104
+ min: 0.1,
105
+ max: 20,
106
+ step: 0.01,
107
+ default: def,
108
+ scale: "log",
109
+ automatable: true,
110
+ hint
111
+ });
112
+ var gainDb = (min = -40, max = 40, def = 0) => ({
113
+ kind: "number",
114
+ key: "gain",
115
+ label: "Gain",
116
+ unit: "dB",
117
+ min,
118
+ max,
119
+ step: 0.1,
120
+ default: def,
121
+ automatable: true
122
+ });
123
+ var poles = {
124
+ kind: "enum",
125
+ key: "poles",
126
+ label: "Slope",
127
+ options: [
128
+ { value: "1", label: "6 dB/oct" },
129
+ { value: "2", label: "12 dB/oct" }
130
+ ],
131
+ default: "2",
132
+ hint: "Two poles is the usual biquad; one pole is gentler."
133
+ };
134
+ var HF_AUDIO_FX = [
135
+ {
136
+ id: "gain",
137
+ label: "Gain",
138
+ group: "dynamics",
139
+ description: "Raise or lower the whole signal. Automate it to duck under something else.",
140
+ // Cuts go deep, boosts stay modest: this is a level stage for making room,
141
+ // and a chain that can add 40 dB clips long before it is useful.
142
+ params: [gainDb(-60, 12, 0)],
143
+ web: "gain-node"
144
+ },
145
+ {
146
+ id: "peaking",
147
+ label: "Peaking EQ",
148
+ group: "filter",
149
+ description: "Boost or cut a band, leaving everything either side alone.",
150
+ params: [freq("frequency", "Frequency", 1e3), gainDb(-40, 40, 0), qParam(1)],
151
+ web: "biquad-peaking"
152
+ },
153
+ {
154
+ id: "lowshelf",
155
+ label: "Low Shelf",
156
+ group: "filter",
157
+ description: "Lift or drop everything below the corner frequency.",
158
+ // No Q: the Web Audio spec leaves it unused for shelving filters, so the
159
+ // control moved nothing — and being automatable, a lane drawn on it would
160
+ // have been silently inert.
161
+ params: [freq("frequency", "Frequency", 200, 20, 2e3), gainDb(-40, 40, 0)],
162
+ web: "biquad-lowshelf"
163
+ },
164
+ {
165
+ id: "highshelf",
166
+ label: "High Shelf",
167
+ group: "filter",
168
+ description: "Lift or drop everything above the corner frequency.",
169
+ params: [freq("frequency", "Frequency", 4e3, 500, 2e4), gainDb(-40, 40, 0)],
170
+ web: "biquad-highshelf"
171
+ },
172
+ {
173
+ id: "highpass",
174
+ label: "High-pass",
175
+ group: "filter",
176
+ description: "Remove low frequencies \u2014 the usual fix for rumble on a voice.",
177
+ params: [freq("frequency", "Cutoff", 300, 20, 2e4), qParam(0.707), poles],
178
+ web: "biquad-highpass"
179
+ },
180
+ {
181
+ id: "lowpass",
182
+ label: "Low-pass",
183
+ group: "filter",
184
+ description: "Remove high frequencies \u2014 darkens or muffles a track.",
185
+ params: [freq("frequency", "Cutoff", 8e3, 100, 2e4), qParam(0.707), poles],
186
+ web: "biquad-lowpass"
187
+ },
188
+ {
189
+ id: "compressor",
190
+ label: "Compressor",
191
+ group: "dynamics",
192
+ description: "Pull loud parts down so the quiet ones can come up.",
193
+ params: [
194
+ {
195
+ kind: "number",
196
+ key: "threshold",
197
+ label: "Threshold",
198
+ unit: "dB",
199
+ min: -60,
200
+ max: 0,
201
+ step: 0.5,
202
+ default: -24,
203
+ hint: "Level above which the compressor starts working."
204
+ },
205
+ {
206
+ kind: "number",
207
+ key: "ratio",
208
+ label: "Ratio",
209
+ unit: ":1",
210
+ min: 1,
211
+ max: 20,
212
+ step: 0.1,
213
+ default: 4
214
+ },
215
+ {
216
+ kind: "number",
217
+ key: "attack",
218
+ label: "Attack",
219
+ unit: "ms",
220
+ min: 0.01,
221
+ max: 2e3,
222
+ step: 0.1,
223
+ default: 20,
224
+ scale: "log"
225
+ },
226
+ {
227
+ kind: "number",
228
+ key: "release",
229
+ label: "Release",
230
+ unit: "ms",
231
+ min: 0.01,
232
+ max: 9e3,
233
+ step: 1,
234
+ default: 250,
235
+ scale: "log"
236
+ },
237
+ {
238
+ kind: "number",
239
+ key: "knee",
240
+ label: "Knee",
241
+ unit: "",
242
+ min: 1,
243
+ max: 8,
244
+ step: 0.01,
245
+ default: 2.83,
246
+ hint: "1 is a hard corner; higher eases into it."
247
+ },
248
+ {
249
+ kind: "number",
250
+ key: "makeup",
251
+ label: "Makeup",
252
+ unit: "dB",
253
+ min: 0,
254
+ max: 36,
255
+ step: 0.1,
256
+ default: 0
257
+ },
258
+ {
259
+ kind: "number",
260
+ key: "mix",
261
+ label: "Mix",
262
+ unit: "",
263
+ min: 0,
264
+ max: 1,
265
+ step: 0.01,
266
+ default: 1,
267
+ hint: "Below 1 blends the dry signal back in."
268
+ }
269
+ ],
270
+ web: "worklet-compressor"
271
+ },
272
+ {
273
+ id: "limiter",
274
+ label: "Limiter",
275
+ group: "dynamics",
276
+ description: "Hard ceiling \u2014 nothing gets past the limit.",
277
+ params: [
278
+ {
279
+ kind: "number",
280
+ key: "limit",
281
+ label: "Ceiling",
282
+ unit: "dB",
283
+ min: -24,
284
+ max: 0,
285
+ step: 0.1,
286
+ default: -1
287
+ },
288
+ {
289
+ kind: "number",
290
+ key: "attack",
291
+ label: "Attack",
292
+ unit: "ms",
293
+ min: 0.1,
294
+ max: 80,
295
+ step: 0.1,
296
+ default: 5
297
+ },
298
+ {
299
+ kind: "number",
300
+ key: "release",
301
+ label: "Release",
302
+ unit: "ms",
303
+ min: 1,
304
+ max: 8e3,
305
+ step: 1,
306
+ default: 50,
307
+ scale: "log"
308
+ },
309
+ {
310
+ kind: "number",
311
+ key: "level_out",
312
+ label: "Output",
313
+ unit: "dB",
314
+ min: -24,
315
+ max: 24,
316
+ step: 0.1,
317
+ default: 0
318
+ }
319
+ ],
320
+ web: "worklet-limiter"
321
+ },
322
+ {
323
+ id: "gate",
324
+ label: "Noise Gate",
325
+ group: "dynamics",
326
+ description: "Silence the track when it drops below the threshold.",
327
+ params: [
328
+ {
329
+ kind: "number",
330
+ key: "threshold",
331
+ label: "Threshold",
332
+ unit: "dB",
333
+ min: -80,
334
+ max: 0,
335
+ step: 0.5,
336
+ default: -35
337
+ },
338
+ {
339
+ kind: "number",
340
+ key: "range",
341
+ label: "Range",
342
+ unit: "dB",
343
+ min: -80,
344
+ max: 0,
345
+ step: 0.5,
346
+ default: -24,
347
+ hint: "How far down the gate pulls when closed."
348
+ },
349
+ {
350
+ kind: "number",
351
+ key: "ratio",
352
+ label: "Ratio",
353
+ unit: ":1",
354
+ min: 1,
355
+ max: 20,
356
+ step: 0.1,
357
+ default: 10
358
+ },
359
+ {
360
+ kind: "number",
361
+ key: "attack",
362
+ label: "Attack",
363
+ unit: "ms",
364
+ min: 0.01,
365
+ max: 9e3,
366
+ step: 0.1,
367
+ default: 1,
368
+ scale: "log"
369
+ },
370
+ {
371
+ kind: "number",
372
+ key: "release",
373
+ label: "Release",
374
+ unit: "ms",
375
+ min: 0.01,
376
+ max: 9e3,
377
+ step: 1,
378
+ default: 100,
379
+ scale: "log"
380
+ },
381
+ {
382
+ kind: "number",
383
+ key: "knee",
384
+ label: "Knee",
385
+ unit: "",
386
+ min: 1,
387
+ max: 8,
388
+ step: 0.01,
389
+ default: 2.83
390
+ }
391
+ ],
392
+ web: "worklet-gate"
393
+ },
394
+ {
395
+ id: "saturate",
396
+ label: "Saturation",
397
+ group: "nonlinear",
398
+ description: "Soft-clip the waveform for warmth or outright distortion.",
399
+ params: [
400
+ {
401
+ kind: "enum",
402
+ key: "type",
403
+ label: "Curve",
404
+ options: [
405
+ { value: "tanh", label: "Tanh" },
406
+ { value: "atan", label: "Arctan" },
407
+ { value: "cubic", label: "Cubic" },
408
+ { value: "exp", label: "Exponential" },
409
+ { value: "alg", label: "Algebraic" },
410
+ { value: "quintic", label: "Quintic" },
411
+ { value: "sin", label: "Sine" },
412
+ { value: "erf", label: "Error function" },
413
+ { value: "hard", label: "Hard clip" }
414
+ ],
415
+ default: "tanh"
416
+ },
417
+ {
418
+ kind: "number",
419
+ key: "threshold",
420
+ label: "Threshold",
421
+ unit: "dB",
422
+ min: -40,
423
+ max: 0,
424
+ step: 0.1,
425
+ default: -6
426
+ },
427
+ {
428
+ kind: "number",
429
+ key: "output",
430
+ automatable: true,
431
+ label: "Output",
432
+ unit: "dB",
433
+ min: -24,
434
+ max: 24,
435
+ step: 0.1,
436
+ default: 0
437
+ },
438
+ {
439
+ kind: "number",
440
+ key: "oversample",
441
+ label: "Oversample",
442
+ unit: "x",
443
+ min: 1,
444
+ max: 8,
445
+ step: 1,
446
+ default: 4,
447
+ hint: "Higher costs more but keeps aliasing down."
448
+ }
449
+ ],
450
+ web: "waveshaper"
451
+ },
452
+ {
453
+ id: "bitcrush",
454
+ label: "Bitcrush",
455
+ group: "nonlinear",
456
+ description: "Drop bit depth and sample rate for a lo-fi, digital sound.",
457
+ params: [
458
+ {
459
+ kind: "number",
460
+ key: "bits",
461
+ label: "Bit depth",
462
+ unit: "bit",
463
+ min: 1,
464
+ max: 32,
465
+ step: 0.1,
466
+ default: 8
467
+ },
468
+ {
469
+ kind: "number",
470
+ key: "samples",
471
+ label: "Sample hold",
472
+ unit: "x",
473
+ min: 1,
474
+ max: 250,
475
+ step: 1,
476
+ default: 1,
477
+ hint: "Repeats each sample N times \u2014 a crude downsample."
478
+ },
479
+ {
480
+ kind: "number",
481
+ key: "mix",
482
+ label: "Mix",
483
+ unit: "",
484
+ min: 0,
485
+ max: 1,
486
+ step: 0.01,
487
+ default: 1
488
+ }
489
+ ],
490
+ web: "worklet-bitcrush"
491
+ },
492
+ {
493
+ id: "pitchshift",
494
+ label: "Pitch shift",
495
+ group: "time",
496
+ // The granular algorithm reads from a 100 ms grain, so its output runs a
497
+ // constant ~50 ms behind its input and nothing in the graph subtracts that
498
+ // — there is no latency/pre-roll concept here yet. It is inaudible on its
499
+ // own and audible against picture or against an unshifted track, so it is
500
+ // stated rather than hidden. `semitones: 0` bypasses the node entirely.
501
+ description: "Shifts pitch up or down without changing playback speed. Adds ~50 ms of latency.",
502
+ params: [
503
+ {
504
+ kind: "number",
505
+ key: "semitones",
506
+ label: "Semitones",
507
+ unit: "st",
508
+ min: -12,
509
+ max: 12,
510
+ step: 1,
511
+ default: 0
512
+ },
513
+ {
514
+ kind: "number",
515
+ key: "mix",
516
+ label: "Mix",
517
+ unit: "",
518
+ min: 0,
519
+ max: 1,
520
+ step: 0.01,
521
+ default: 1
522
+ }
523
+ ],
524
+ web: "worklet-pitchshift"
525
+ },
526
+ {
527
+ id: "delay",
528
+ label: "Delay",
529
+ group: "time",
530
+ description: "Repeating echoes behind the dry signal.",
531
+ params: [
532
+ {
533
+ kind: "number",
534
+ key: "time",
535
+ automatable: true,
536
+ label: "Time",
537
+ unit: "ms",
538
+ min: 1,
539
+ max: 5e3,
540
+ step: 1,
541
+ default: 250,
542
+ scale: "log"
543
+ },
544
+ // aecho rejects a decay of exactly 0 ("out of allowed range: (0, 1]"),
545
+ // so the floor is a hair above silence rather than at it.
546
+ {
547
+ kind: "number",
548
+ key: "feedback",
549
+ automatable: true,
550
+ label: "Feedback",
551
+ unit: "",
552
+ min: 0.01,
553
+ max: 0.95,
554
+ step: 0.01,
555
+ default: 0.35
556
+ },
557
+ {
558
+ kind: "number",
559
+ key: "mix",
560
+ automatable: true,
561
+ label: "Mix",
562
+ unit: "",
563
+ min: 0,
564
+ max: 1,
565
+ step: 0.01,
566
+ default: 0.4
567
+ }
568
+ ],
569
+ web: "delay-feedback"
570
+ },
571
+ {
572
+ id: "chorus",
573
+ label: "Chorus",
574
+ group: "time",
575
+ description: "Detuned copies of the signal for width and thickness.",
576
+ params: [
577
+ {
578
+ kind: "number",
579
+ key: "delay",
580
+ automatable: true,
581
+ label: "Delay",
582
+ unit: "ms",
583
+ min: 1,
584
+ max: 100,
585
+ step: 0.1,
586
+ default: 7
587
+ },
588
+ {
589
+ kind: "number",
590
+ key: "depth",
591
+ automatable: true,
592
+ label: "Depth",
593
+ unit: "ms",
594
+ min: 0,
595
+ max: 10,
596
+ step: 0.01,
597
+ default: 2
598
+ },
599
+ {
600
+ kind: "number",
601
+ key: "speed",
602
+ automatable: true,
603
+ label: "Rate",
604
+ unit: "Hz",
605
+ min: 0.01,
606
+ max: 10,
607
+ step: 0.01,
608
+ default: 1
609
+ },
610
+ {
611
+ kind: "number",
612
+ key: "mix",
613
+ automatable: true,
614
+ label: "Mix",
615
+ unit: "",
616
+ min: 0,
617
+ max: 1,
618
+ step: 0.01,
619
+ default: 0.5
620
+ }
621
+ ],
622
+ web: "chorus-lfo"
623
+ },
624
+ {
625
+ id: "phaser",
626
+ label: "Phaser",
627
+ group: "time",
628
+ description: "Sweeping notches moving through the spectrum.",
629
+ params: [
630
+ {
631
+ kind: "number",
632
+ key: "in_gain",
633
+ automatable: true,
634
+ label: "Input",
635
+ unit: "",
636
+ min: 0,
637
+ max: 1,
638
+ step: 0.01,
639
+ default: 0.4
640
+ },
641
+ {
642
+ kind: "number",
643
+ key: "out_gain",
644
+ automatable: true,
645
+ label: "Output",
646
+ unit: "",
647
+ min: 0,
648
+ max: 2,
649
+ step: 0.01,
650
+ default: 0.74
651
+ },
652
+ // aphaser advertises a delay range starting at 0 but rejects it at
653
+ // runtime with "delay is too small"; 0.1 ms is the real floor.
654
+ {
655
+ kind: "number",
656
+ key: "delay",
657
+ label: "Delay",
658
+ unit: "ms",
659
+ min: 0.1,
660
+ max: 5,
661
+ step: 0.1,
662
+ default: 3
663
+ },
664
+ {
665
+ kind: "number",
666
+ key: "decay",
667
+ label: "Decay",
668
+ unit: "",
669
+ min: 0,
670
+ max: 0.99,
671
+ step: 0.01,
672
+ default: 0.4
673
+ },
674
+ {
675
+ kind: "number",
676
+ key: "speed",
677
+ automatable: true,
678
+ label: "Rate",
679
+ unit: "Hz",
680
+ min: 0.1,
681
+ max: 2,
682
+ step: 0.01,
683
+ default: 0.5
684
+ },
685
+ {
686
+ kind: "enum",
687
+ key: "type",
688
+ label: "Waveform",
689
+ options: [
690
+ { value: "0", label: "Triangular" },
691
+ { value: "1", label: "Sinusoidal" }
692
+ ],
693
+ default: "0"
694
+ }
695
+ ],
696
+ web: "allpass-phaser"
697
+ },
698
+ {
699
+ id: "reverb",
700
+ label: "Reverb",
701
+ group: "time",
702
+ description: "Room tail. Both ends convolve the same generated impulse, so preview matches render.",
703
+ params: [
704
+ {
705
+ kind: "number",
706
+ key: "size",
707
+ label: "Room size",
708
+ unit: "",
709
+ min: 0.05,
710
+ max: 1,
711
+ step: 0.01,
712
+ default: 0.7
713
+ },
714
+ {
715
+ kind: "number",
716
+ key: "damping",
717
+ label: "Damping",
718
+ unit: "",
719
+ min: 0,
720
+ max: 1,
721
+ step: 0.01,
722
+ default: 0.5,
723
+ hint: "Higher rolls the top off the tail faster."
724
+ },
725
+ {
726
+ kind: "number",
727
+ key: "wet",
728
+ automatable: true,
729
+ label: "Wet",
730
+ unit: "",
731
+ min: 0,
732
+ max: 1,
733
+ step: 0.01,
734
+ default: 0.35
735
+ },
736
+ {
737
+ kind: "number",
738
+ key: "dry",
739
+ automatable: true,
740
+ label: "Dry",
741
+ unit: "",
742
+ min: 0,
743
+ max: 1,
744
+ step: 0.01,
745
+ default: 0.7
746
+ }
747
+ ],
748
+ web: "convolver"
749
+ }
750
+ ];
751
+ var BY_ID = new Map(HF_AUDIO_FX.map((d) => [d.id, d]));
752
+ function getAudioFxDef(id) {
753
+ return BY_ID.get(id);
754
+ }
755
+ var HF_AUDIO_FX_IDS = HF_AUDIO_FX.map((d) => d.id);
756
+ function normalizeAudioFxParams(id, values) {
757
+ const def = BY_ID.get(id);
758
+ if (!def)
759
+ return {};
760
+ const out = {};
761
+ for (const p of def.params) {
762
+ const raw = values?.[p.key];
763
+ if (p.kind === "enum") {
764
+ const ok = p.options.some((o) => o.value === raw);
765
+ out[p.key] = ok ? raw : p.default;
766
+ continue;
767
+ }
768
+ const n = typeof raw === "number" ? raw : typeof raw === "string" && raw.trim() !== "" ? Number(raw) : Number.NaN;
769
+ out[p.key] = Number.isFinite(n) ? Math.min(p.max, Math.max(p.min, n)) : p.default;
770
+ }
771
+ return out;
772
+ }
773
+ var AudioFxChainError = class extends Error {
774
+ constructor(message) {
775
+ super(message);
776
+ this.name = "AudioFxChainError";
777
+ }
778
+ };
779
+ function parseAudioFxChain(json) {
780
+ let raw;
781
+ try {
782
+ raw = JSON.parse(json);
783
+ } catch (err) {
784
+ throw new AudioFxChainError(`Chain file is not valid JSON: ${err.message}`);
785
+ }
786
+ if (typeof raw !== "object" || raw === null) {
787
+ throw new AudioFxChainError("Chain file must be a JSON object.");
788
+ }
789
+ const obj = raw;
790
+ if (obj.version !== HF_AUDIO_FX_CHAIN_VERSION) {
791
+ throw new AudioFxChainError(`Unsupported chain version: ${String(obj.version)}`);
792
+ }
793
+ if (!Array.isArray(obj.nodes)) {
794
+ throw new AudioFxChainError("Chain file is missing a `nodes` array.");
795
+ }
796
+ const nodes = obj.nodes.map(parseAudioFxNode);
797
+ return { version: HF_AUDIO_FX_CHAIN_VERSION, nodes };
798
+ }
799
+ function enabledAudioFxNodes(chain) {
800
+ return chain.nodes.filter((n) => n.enabled !== false);
801
+ }
802
+ function parseAudioFxNode(n, i) {
803
+ if (typeof n !== "object" || n === null) {
804
+ throw new AudioFxChainError(`Node ${i} is not an object.`);
805
+ }
806
+ const node = n;
807
+ if (typeof node.type !== "string" || !BY_ID.has(node.type)) {
808
+ throw new AudioFxChainError(`Node ${i} has unknown effect type: ${String(node.type)}`);
809
+ }
810
+ return withoutUndefined({
811
+ type: node.type,
812
+ id: nonEmptyString(node.id),
813
+ fromCarve: onlyTrue(node.fromCarve),
814
+ // fromPreset and label both survive the round trip or a preset stops being
815
+ // able to find its own nodes after a reload: re-applying would stack a
816
+ // second copy and the rack would lose the grouping it braces them with.
817
+ fromPreset: nonEmptyString(node.fromPreset),
818
+ label: nonEmptyString(node.label),
819
+ fromEq: nonEmptyString(node.fromEq),
820
+ fromLeveller: onlyTrue(node.fromLeveller),
821
+ presetAmount: clampedPresetAmount(node.presetAmount),
822
+ enabled: node.enabled !== false,
823
+ params: normalizeAudioFxParams(node.type, node.params ?? void 0)
824
+ });
825
+ }
826
+ function nonEmptyString(value) {
827
+ return typeof value === "string" && value ? value : void 0;
828
+ }
829
+ function onlyTrue(value) {
830
+ return value === true ? true : void 0;
831
+ }
832
+ function clampedPresetAmount(value) {
833
+ if (typeof value !== "number" || !Number.isFinite(value))
834
+ return void 0;
835
+ return Math.min(1, Math.max(0, value));
836
+ }
837
+ function withoutUndefined(obj) {
838
+ for (const key of Object.keys(obj)) {
839
+ if (obj[key] === void 0)
840
+ delete obj[key];
841
+ }
842
+ return obj;
843
+ }
844
+
845
+ // ../core/dist/audioAutomation.js
846
+ var HF_AUDIO_AUTOMATION_ATTR = "data-automation";
847
+ var HF_AUDIO_AUTOMATION_DATA_KEY = HF_AUDIO_AUTOMATION_ATTR.slice("data-".length);
848
+ var HF_AUDIO_AUTOMATION_VERSION = 1;
849
+ var MAX_AUTOMATION_POINTS = 512;
850
+ var AudioAutomationError = class extends Error {
851
+ constructor(message) {
852
+ super(message);
853
+ this.name = "AudioAutomationError";
854
+ }
855
+ };
856
+ var VOLUME_TARGET = "volume";
857
+ var RATE_TARGET = "rate";
858
+ function parseAutomationTarget(target) {
859
+ if (target === VOLUME_TARGET)
860
+ return { kind: "volume" };
861
+ if (target === RATE_TARGET)
862
+ return { kind: "rate" };
863
+ const parts = target.split(".");
864
+ if (parts.length === 3 && parts[0] === "fx" && parts[1] === PRESET_TARGET_KEY) {
865
+ const presetId = parts[2];
866
+ return presetId ? { kind: "preset", presetId } : null;
867
+ }
868
+ if (parts.length !== 3 || parts[0] !== "fx")
869
+ return null;
870
+ const [, nodeId, param] = parts;
871
+ if (!nodeId || !param)
872
+ return null;
873
+ return { kind: "fx", nodeId, param };
874
+ }
875
+ function fxAutomationTarget(nodeId, param) {
876
+ return `fx.${nodeId}.${param}`;
877
+ }
878
+ var PRESET_TARGET_KEY = "preset";
879
+ var PRESET_RANGE = {
880
+ min: 0,
881
+ max: 1,
882
+ step: 0.01,
883
+ unit: "",
884
+ label: "Amount",
885
+ scale: "linear",
886
+ default: 1
887
+ };
888
+ var VOLUME_RANGE = {
889
+ min: 0,
890
+ max: MAX_AUDIO_GAIN,
891
+ step: 0.01,
892
+ unit: "",
893
+ label: "Volume",
894
+ scale: "linear",
895
+ default: 1
896
+ };
897
+ var RATE_RANGE = {
898
+ min: MIN_PLAYBACK_RATE,
899
+ max: MAX_PLAYBACK_RATE,
900
+ step: 0.05,
901
+ unit: "x",
902
+ label: "Speed",
903
+ scale: "log",
904
+ default: 1
905
+ };
906
+ function resolveAutomationRange(target, chain) {
907
+ const parsed = parseAutomationTarget(target);
908
+ if (!parsed)
909
+ return null;
910
+ if (parsed.kind === "volume")
911
+ return VOLUME_RANGE;
912
+ if (parsed.kind === "rate")
913
+ return RATE_RANGE;
914
+ if (parsed.kind === "preset") {
915
+ const present = chain?.nodes.some((n) => n.fromPreset === parsed.presetId);
916
+ return present ? { ...PRESET_RANGE, label: `${parsed.presetId} \xB7 Amount` } : null;
917
+ }
918
+ const node = chain?.nodes.find((n) => n.id === parsed.nodeId);
919
+ if (!node)
920
+ return null;
921
+ const def = getAudioFxDef(node.type);
922
+ const param = def?.params.find((p) => p.key === parsed.param);
923
+ if (!param || param.kind !== "number")
924
+ return null;
925
+ return {
926
+ min: param.min,
927
+ max: param.max,
928
+ step: param.step,
929
+ unit: param.unit,
930
+ label: `${def?.label ?? node.type} \xB7 ${param.label}`,
931
+ scale: param.scale === "log" && param.min > 0 ? "log" : "linear",
932
+ default: param.default
933
+ };
934
+ }
935
+ function numberOrNull(raw) {
936
+ if (typeof raw === "number")
937
+ return Number.isFinite(raw) ? raw : null;
938
+ if (typeof raw === "string" && raw.trim() !== "") {
939
+ const n = Number(raw);
940
+ return Number.isFinite(n) ? n : null;
941
+ }
942
+ return null;
943
+ }
944
+ function clampCurve(v) {
945
+ const n = numberOrNull(v);
946
+ if (n === null || n === 0)
947
+ return 0;
948
+ return Math.min(1, Math.max(-1, n));
949
+ }
950
+ function clampVia(rawX, rawY) {
951
+ const x = numberOrNull(rawX);
952
+ const y = numberOrNull(rawY);
953
+ if (x === null || y === null)
954
+ return null;
955
+ const inside = (n) => Math.min(0.999, Math.max(1e-3, n));
956
+ const cx = inside(x);
957
+ const cy = inside(y);
958
+ if (Math.abs(cx - cy) < 1e-6)
959
+ return null;
960
+ return { x: cx, y: cy };
961
+ }
962
+ function shapeFields(p) {
963
+ const curve = clampCurve(p?.curve);
964
+ const via = clampVia(p?.viaX, p?.viaY);
965
+ return {
966
+ ...curve ? { curve } : {},
967
+ ...via ? { viaX: via.x, viaY: via.y } : {}
968
+ };
969
+ }
970
+ function cleanPoint(p, range) {
971
+ const t = numberOrNull(p?.t);
972
+ const v = numberOrNull(p?.v);
973
+ if (t === null || v === null)
974
+ return null;
975
+ const clamped = range ? Math.min(range.max, Math.max(range.min, v)) : v;
976
+ return { t: Math.max(0, t), v: clamped, ...shapeFields(p) };
977
+ }
978
+ function normalizePoints(points, range) {
979
+ const clean = points.map((p) => cleanPoint(p, range)).filter((p) => p !== null).sort((a, b) => a.t - b.t);
980
+ const out = [];
981
+ for (const p of clean) {
982
+ if (out.length > 0 && out[out.length - 1].t === p.t)
983
+ out[out.length - 1] = p;
984
+ else
985
+ out.push(p);
986
+ }
987
+ return out.slice(0, MAX_AUTOMATION_POINTS);
988
+ }
989
+ function normalizeAutomation(automation) {
990
+ const lanes = [];
991
+ for (const lane of automation.lanes) {
992
+ if (!parseAutomationTarget(lane.target))
993
+ continue;
994
+ const range = lane.target === VOLUME_TARGET ? VOLUME_RANGE : lane.target === RATE_TARGET ? RATE_RANGE : null;
995
+ const points = normalizePoints(lane.points ?? [], range);
996
+ if (points.length > 0)
997
+ lanes.push({ target: lane.target, points });
998
+ }
999
+ return { version: HF_AUDIO_AUTOMATION_VERSION, lanes };
1000
+ }
1001
+ function resolveAutomation(automation, chain) {
1002
+ const lanes = [];
1003
+ for (const lane of automation.lanes) {
1004
+ const range = resolveAutomationRange(lane.target, chain);
1005
+ if (!range)
1006
+ continue;
1007
+ const points = normalizePoints(lane.points, range);
1008
+ if (points.length > 0)
1009
+ lanes.push({ target: lane.target, points });
1010
+ }
1011
+ return { version: HF_AUDIO_AUTOMATION_VERSION, lanes };
1012
+ }
1013
+ function parseAutomation(json) {
1014
+ let raw;
1015
+ try {
1016
+ raw = JSON.parse(json);
1017
+ } catch (err) {
1018
+ throw new AudioAutomationError(`Automation is not valid JSON: ${err.message}`);
1019
+ }
1020
+ if (typeof raw !== "object" || raw === null) {
1021
+ throw new AudioAutomationError("Automation must be a JSON object.");
1022
+ }
1023
+ const obj = raw;
1024
+ if (obj.version !== HF_AUDIO_AUTOMATION_VERSION) {
1025
+ throw new AudioAutomationError(`Unsupported automation version: ${String(obj.version)}`);
1026
+ }
1027
+ if (!Array.isArray(obj.lanes)) {
1028
+ throw new AudioAutomationError("Automation is missing a `lanes` array.");
1029
+ }
1030
+ const lanes = obj.lanes.map((l, i) => {
1031
+ if (typeof l !== "object" || l === null) {
1032
+ throw new AudioAutomationError(`Lane ${i} is not an object.`);
1033
+ }
1034
+ const lane = l;
1035
+ if (typeof lane.target !== "string" || !parseAutomationTarget(lane.target)) {
1036
+ throw new AudioAutomationError(`Lane ${i} has an unreadable target: ${String(lane.target)}`);
1037
+ }
1038
+ if (!Array.isArray(lane.points)) {
1039
+ throw new AudioAutomationError(`Lane ${i} is missing a \`points\` array.`);
1040
+ }
1041
+ return { target: lane.target, points: lane.points };
1042
+ });
1043
+ return normalizeAutomation({ version: HF_AUDIO_AUTOMATION_VERSION, lanes });
1044
+ }
1045
+ function serializeAutomation(automation) {
1046
+ return JSON.stringify({
1047
+ version: HF_AUDIO_AUTOMATION_VERSION,
1048
+ lanes: automation.lanes.map((lane) => ({
1049
+ target: lane.target,
1050
+ points: lane.points.map((p) => ({
1051
+ t: p.t,
1052
+ v: p.v,
1053
+ ...p.curve ? { curve: p.curve } : {},
1054
+ ...p.viaX !== void 0 && p.viaY !== void 0 ? { viaX: p.viaX, viaY: p.viaY } : {}
1055
+ }))
1056
+ }))
1057
+ });
1058
+ }
1059
+ function applyCurve(x, curve) {
1060
+ if (!curve)
1061
+ return x;
1062
+ return Math.pow(x, Math.pow(2, 2 * curve));
1063
+ }
1064
+ function viaConic(viaX, viaY) {
1065
+ const dx = viaX - 0.5;
1066
+ const dy = viaY - 0.5;
1067
+ const edge = 0.999;
1068
+ const MAX_WEIGHT = 1e6;
1069
+ const needX = dx > 0 ? dx / (edge - viaX) : dx < 0 ? -dx / (viaX - (1 - edge)) : 0;
1070
+ const needY = dy > 0 ? dy / (edge - viaY) : dy < 0 ? -dy / (viaY - (1 - edge)) : 0;
1071
+ const w = Math.min(MAX_WEIGHT, Math.max(1, needX, needY));
1072
+ return { cx: viaX + dx / w, cy: viaY + dy / w, w };
1073
+ }
1074
+ function shapeVia(x, viaX, viaY) {
1075
+ const { cx, cy, w } = viaConic(viaX, viaY);
1076
+ const spread = 2 - 2 * w;
1077
+ const a = x * spread - 1 + 2 * w * cx;
1078
+ const b = -x * spread - 2 * w * cx;
1079
+ const t = conicParam(a, b, x);
1080
+ const rest = 1 - t;
1081
+ const denominator = rest * rest + 2 * w * t * rest + t * t;
1082
+ if (!(denominator > 0))
1083
+ return x;
1084
+ return (2 * w * cy * t * rest + t * t) / denominator;
1085
+ }
1086
+ function conicParam(a, b, c) {
1087
+ if (Math.abs(a) < 1e-12)
1088
+ return Math.abs(b) < 1e-12 ? c : -c / b;
1089
+ const root = Math.sqrt(Math.max(0, b * b - 4 * a * c));
1090
+ const first = (-b + root) / (2 * a);
1091
+ const second = (-b - root) / (2 * a);
1092
+ const onArc = (t) => t >= -1e-9 && t <= 1 + 1e-9;
1093
+ if (onArc(first))
1094
+ return Math.min(1, Math.max(0, first));
1095
+ if (onArc(second))
1096
+ return Math.min(1, Math.max(0, second));
1097
+ return c;
1098
+ }
1099
+ function shapeProgress(x, point) {
1100
+ const via = clampVia(point.viaX, point.viaY);
1101
+ if (via)
1102
+ return shapeVia(Math.min(1, Math.max(0, x)), via.x, via.y);
1103
+ return applyCurve(x, point.curve);
1104
+ }
1105
+ function lerpValue(a, b, x, scale) {
1106
+ if (scale === "log" && a > 0 && b > 0) {
1107
+ return Math.exp(Math.log(a) + (Math.log(b) - Math.log(a)) * x);
1108
+ }
1109
+ return a + (b - a) * x;
1110
+ }
1111
+ function sampleAutomationLane(lane, t, scale = "linear") {
1112
+ const pts = lane.points;
1113
+ if (pts.length === 0)
1114
+ return 0;
1115
+ const first = pts[0];
1116
+ if (t <= first.t)
1117
+ return first.v;
1118
+ const last = pts[pts.length - 1];
1119
+ if (t >= last.t)
1120
+ return last.v;
1121
+ let lo = 0;
1122
+ let hi = pts.length - 1;
1123
+ while (hi - lo > 1) {
1124
+ const mid = lo + hi >> 1;
1125
+ if (pts[mid].t <= t)
1126
+ lo = mid;
1127
+ else
1128
+ hi = mid;
1129
+ }
1130
+ const a = pts[lo];
1131
+ const b = pts[hi];
1132
+ const span = b.t - a.t;
1133
+ if (span <= 0)
1134
+ return b.v;
1135
+ return lerpValue(a.v, b.v, shapeProgress((t - a.t) / span, a), scale);
1136
+ }
1137
+
1138
+ // ../core/dist/runtime/audioAutomationVolume.js
1139
+ var cache = /* @__PURE__ */ new Map();
1140
+ var CACHE_LIMIT = 64;
1141
+ function laneFromAttr(raw, target = VOLUME_TARGET) {
1142
+ const key = `${target}\0${raw}`;
1143
+ const hit = cache.get(key);
1144
+ if (hit !== void 0)
1145
+ return hit;
1146
+ let lane = null;
1147
+ try {
1148
+ lane = parseAutomation(raw).lanes.find((l) => l.target === target) ?? null;
1149
+ } catch {
1150
+ lane = null;
1151
+ }
1152
+ if (cache.size > CACHE_LIMIT)
1153
+ cache.clear();
1154
+ cache.set(key, lane);
1155
+ return lane;
1156
+ }
1157
+
1158
+ // ../core/dist/speedRamp.js
1159
+ var SHIFT_RESAMPLES = 16;
1160
+ function shiftRateLane(spec, dt) {
1161
+ if (typeof spec === "number" || dt === 0)
1162
+ return spec;
1163
+ const next = spec.points.findIndex((p) => p.t > dt);
1164
+ const later = next < 0 ? [] : spec.points.slice(next).map((p) => ({ ...p, t: p.t - dt }));
1165
+ const left = next > 0 ? spec.points[next - 1] : void 0;
1166
+ const shaped = left !== void 0 && (left.curve || left.viaX !== void 0);
1167
+ const cut = shaped && next > 0 ? spec.points[next].t - dt : 0;
1168
+ const samples = Array.from({ length: shaped ? SHIFT_RESAMPLES - 1 : 0 }, (_, k) => {
1169
+ const t = (k + 1) * cut / SHIFT_RESAMPLES;
1170
+ return { t, v: rateAt(spec, dt + t) };
1171
+ });
1172
+ return { ...spec, points: [{ t: 0, v: rateAt(spec, dt) }, ...samples, ...later] };
1173
+ }
1174
+ var CELLS_PER_SEGMENT = 48;
1175
+ var tables = /* @__PURE__ */ new WeakMap();
1176
+ function buildTable(lane) {
1177
+ const pts = lane.points;
1178
+ const firstRate = pts[0].v;
1179
+ const lastRate = pts[pts.length - 1].v;
1180
+ const ts = [0];
1181
+ const ss = [0];
1182
+ const push = (t) => {
1183
+ const prevT = ts[ts.length - 1];
1184
+ if (t <= prevT)
1185
+ return;
1186
+ const prevRate = sampleAutomationLane(lane, prevT, "log");
1187
+ ts.push(t);
1188
+ ss.push(ss[ss.length - 1] + (prevRate + sampleAutomationLane(lane, t, "log")) / 2 * (t - prevT));
1189
+ };
1190
+ const first = Math.max(0, pts[0].t);
1191
+ push(first);
1192
+ for (let i = 1; i < pts.length; i += 1) {
1193
+ const a = pts[i - 1].t;
1194
+ const b = pts[i].t;
1195
+ if (b <= 0)
1196
+ continue;
1197
+ for (let k = 1; k <= CELLS_PER_SEGMENT; k += 1)
1198
+ push(Math.max(a, 0) + (b - a) * k / CELLS_PER_SEGMENT);
1199
+ }
1200
+ return { ts: Float64Array.from(ts), ss: Float64Array.from(ss), firstRate, lastRate };
1201
+ }
1202
+ function tableFor(lane) {
1203
+ let table = tables.get(lane);
1204
+ if (!table) {
1205
+ table = buildTable(lane);
1206
+ tables.set(lane, table);
1207
+ }
1208
+ return table;
1209
+ }
1210
+ function usable(spec) {
1211
+ return typeof spec !== "number" && spec.points.length > 0;
1212
+ }
1213
+ function rateAt(spec, t) {
1214
+ if (typeof spec === "number")
1215
+ return spec;
1216
+ return usable(spec) ? sampleAutomationLane(spec, t, "log") : 1;
1217
+ }
1218
+ function interpolate(xs, ys, x) {
1219
+ let lo = 0;
1220
+ let hi = xs.length - 1;
1221
+ while (hi - lo > 1) {
1222
+ const mid = lo + hi >> 1;
1223
+ if (xs[mid] <= x)
1224
+ lo = mid;
1225
+ else
1226
+ hi = mid;
1227
+ }
1228
+ return ys[lo] + (ys[hi] - ys[lo]) * (x - xs[lo]) / (xs[hi] - xs[lo]);
1229
+ }
1230
+ function sourceTimeAt(spec, t) {
1231
+ if (typeof spec === "number")
1232
+ return t * spec;
1233
+ if (!usable(spec))
1234
+ return t;
1235
+ const { ts, ss, firstRate, lastRate } = tableFor(spec);
1236
+ const last = ts.length - 1;
1237
+ if (t <= 0)
1238
+ return t * firstRate;
1239
+ if (t >= ts[last])
1240
+ return ss[last] + (t - ts[last]) * lastRate;
1241
+ return interpolate(ts, ss, t);
1242
+ }
1243
+ function timeAtSourceTime(spec, source) {
1244
+ if (typeof spec === "number")
1245
+ return source / spec;
1246
+ if (!usable(spec))
1247
+ return source;
1248
+ const { ts, ss, firstRate, lastRate } = tableFor(spec);
1249
+ const last = ts.length - 1;
1250
+ if (source <= 0)
1251
+ return source / firstRate;
1252
+ if (source >= ss[last])
1253
+ return ts[last] + (source - ss[last]) / lastRate;
1254
+ return interpolate(ss, ts, source);
1255
+ }
1256
+ function parseRateLane(raw) {
1257
+ return raw ? laneFromAttr(raw, RATE_TARGET) : null;
1258
+ }
1259
+ function resolveRateSpec(automationAttr, constant) {
1260
+ return parseRateLane(automationAttr) ?? constant;
1261
+ }
1262
+
1263
+ // ../core/dist/runtime/domRealm.js
1264
+ var XHTML_NS = "http://www.w3.org/1999/xhtml";
1265
+ function isElementNode(value) {
1266
+ return value != null && value.nodeType === 1;
1267
+ }
1268
+ function isHtmlElement(value) {
1269
+ return isElementNode(value) && value.namespaceURI === XHTML_NS;
1270
+ }
1271
+ function isHtmlTag(value, tag) {
1272
+ return isHtmlElement(value) && value.localName === tag;
1273
+ }
1274
+ function isVideoElement(value) {
1275
+ return isHtmlTag(value, "video");
1276
+ }
1277
+ function isAudioElement(value) {
1278
+ return isHtmlTag(value, "audio");
1279
+ }
1280
+ function isMediaElement(value) {
1281
+ return isVideoElement(value) || isAudioElement(value);
1282
+ }
1283
+ function isImageElement(value) {
1284
+ return isHtmlTag(value, "img");
1285
+ }
1286
+
1287
+ // ../core/dist/runtime/playbackRate.js
1288
+ var normalizePlaybackRate = clampPlaybackRate;
1289
+ function parseStrictFiniteTimingNumber(raw) {
1290
+ return parseNumeric(raw);
1291
+ }
1292
+ function readElementPlaybackRate(el) {
1293
+ return readPlaybackRate((name) => el.getAttribute(name), isMediaElement(el) ? el.defaultPlaybackRate : 1);
1294
+ }
1295
+ function normalizeRateSpec(spec) {
1296
+ return typeof spec === "object" ? spec : normalizePlaybackRate(spec ?? 1);
1297
+ }
1298
+ function readElementRateSpec(el) {
1299
+ return resolveRateSpec(el.getAttribute("data-automation"), readElementPlaybackRate(el));
1300
+ }
1301
+ function readMediaStart(el) {
1302
+ return readMediaOffsetSeconds((name) => el.getAttribute(name));
1303
+ }
1304
+ function resolveNaturalMediaTimelineDuration(el, sourceDuration) {
1305
+ return resolveNaturalMediaTimelineDurationFromValues(sourceDuration, readMediaStart(el), readElementRateSpec(el));
1306
+ }
1307
+ function resolveTimedImageDurationSeconds(el, startSeconds = 0) {
1308
+ if (!isImageElement(el))
1309
+ return null;
1310
+ if (!el.hasAttribute("data-start") && !el.hasAttribute("data-track-index"))
1311
+ return null;
1312
+ return resolveMediaDuration({
1313
+ tag: "img",
1314
+ authoredDurationSeconds: readAuthoredDurationSeconds((name) => el.getAttribute(name), startSeconds),
1315
+ sourceDurationSeconds: null,
1316
+ mediaStartSeconds: 0,
1317
+ playbackRate: 1
1318
+ }).seconds;
1319
+ }
1320
+ function resolveNaturalMediaTimelineDurationFromValues(sourceDuration, mediaStart, playbackRate) {
1321
+ if (typeof playbackRate === "number") {
1322
+ return resolveNaturalDurationSeconds(sourceDuration, mediaStart, playbackRate);
1323
+ }
1324
+ if (!Number.isFinite(sourceDuration))
1325
+ return null;
1326
+ return timeAtSourceTime(playbackRate, Math.max(0, sourceDuration - mediaStart));
1327
+ }
1328
+
1329
+ // ../core/dist/compiler/timingCompiler.js
1330
+ var MEDIA_DURATION_CLAMP_EPSILON_SECONDS = 0.05;
1331
+ function shouldClampMediaDuration(declaredDuration, maxDuration) {
1332
+ return declaredDuration > maxDuration + MEDIA_DURATION_CLAMP_EPSILON_SECONDS;
1333
+ }
1334
+ function shouldClampResolvedMediaDuration(tagName, declaredDuration, maxDuration) {
1335
+ return tagName === "audio" && shouldClampMediaDuration(declaredDuration, maxDuration);
1336
+ }
1337
+ function getAttr(tag, attr) {
1338
+ const match = tag.match(new RegExp(`(?<![\\w-])${attr}=(?:"([^"]+)"|'([^']+)')`));
1339
+ return match ? match[1] ?? match[2] ?? null : null;
1340
+ }
1341
+ function tagAttrReader(tag) {
1342
+ return {
1343
+ getAttribute: (name) => {
1344
+ const raw = getAttr(tag, name);
1345
+ return raw && name === "data-automation" ? raw.replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&") : raw;
1346
+ }
1347
+ };
1348
+ }
1349
+ function hasAttr(tag, attr) {
1350
+ return new RegExp(`\\s${attr}(?:\\s|=|>|/)`).test(tag);
1351
+ }
1352
+ function injectAttr(tag, attr, value) {
1353
+ return tag.replace(/>$/, ` ${attr}="${value}">`);
1354
+ }
1355
+ function setAttr(tag, attr, value) {
1356
+ if (!hasAttr(tag, attr))
1357
+ return injectAttr(tag, attr, value);
1358
+ return tag.replace(new RegExp(`(${attr}=["'])[^"']*(["'])`), `$1${value}$2`);
1359
+ }
1360
+ function maskInertRegions(html) {
1361
+ const stash = [];
1362
+ const parts = [];
1363
+ const opening = /<!--|<script\b|<style\b/gi;
1364
+ const closings = /* @__PURE__ */ new Map([
1365
+ ["<!--", /--!?>/g],
1366
+ ["<script", /<\/script\s*>/gi],
1367
+ ["<style", /<\/style\s*>/gi]
1368
+ ]);
1369
+ let cursor = 0;
1370
+ let match;
1371
+ while ((match = opening.exec(html)) !== null) {
1372
+ const kind = match[0].toLowerCase();
1373
+ const closing = closings.get(kind);
1374
+ if (!closing)
1375
+ continue;
1376
+ closing.lastIndex = opening.lastIndex;
1377
+ const end = closing.exec(html) ? closing.lastIndex : -1;
1378
+ if (end < 0) {
1379
+ closings.delete(kind);
1380
+ continue;
1381
+ }
1382
+ const token = `\0HFMASK${stash.length}\0`;
1383
+ parts.push(html.slice(cursor, match.index), token);
1384
+ stash.push(html.slice(match.index, end));
1385
+ cursor = end;
1386
+ opening.lastIndex = cursor;
1387
+ }
1388
+ parts.push(html.slice(cursor));
1389
+ const masked = parts.join("");
1390
+ const restore = (s) => (
1391
+ // oxlint-disable-next-line no-control-regex -- NUL cannot appear in HTML, which is what makes it a safe mask delimiter
1392
+ s.replace(/\u0000HFMASK(\d+)\u0000/g, (_, i) => stash[Number(i)] ?? "")
1393
+ );
1394
+ return { masked, restore };
1395
+ }
1396
+ function* iterateOpeningTags(html, prefix) {
1397
+ let match;
1398
+ while ((match = prefix.exec(html)) !== null) {
1399
+ const closing = html.indexOf(">", prefix.lastIndex);
1400
+ if (closing < 0)
1401
+ break;
1402
+ const end = closing + 1;
1403
+ yield { tag: html.slice(match.index, end), index: match.index, end };
1404
+ prefix.lastIndex = end;
1405
+ }
1406
+ }
1407
+ function replaceOpeningTags(html, prefix, replace) {
1408
+ const parts = [];
1409
+ let cursor = 0;
1410
+ for (const { tag, index, end } of iterateOpeningTags(html, prefix)) {
1411
+ parts.push(html.slice(cursor, index), replace(tag));
1412
+ cursor = end;
1413
+ }
1414
+ parts.push(html.slice(cursor));
1415
+ return parts.join("");
1416
+ }
1417
+ function replaceIdTags(html, id, replace) {
1418
+ const idPattern = new RegExp(`id=["']${escapeRegex(id)}["']`, "gi");
1419
+ const lastClosing = html.lastIndexOf(">");
1420
+ const parts = [];
1421
+ let cursor = 0;
1422
+ let candidate = idPattern.exec(html);
1423
+ for (const { index, end } of iterateOpeningTags(html, /</g)) {
1424
+ if (index < cursor)
1425
+ continue;
1426
+ let targetEnd = -1;
1427
+ while (candidate && candidate.index < end) {
1428
+ const candidateEnd = candidate.index + candidate[0].length;
1429
+ if (candidate.index > index && candidateEnd <= lastClosing)
1430
+ targetEnd = candidateEnd;
1431
+ idPattern.lastIndex = candidate.index + 1;
1432
+ candidate = idPattern.exec(html);
1433
+ }
1434
+ if (targetEnd < 0)
1435
+ continue;
1436
+ const closing = html.indexOf(">", targetEnd) + 1;
1437
+ parts.push(html.slice(cursor, index), replace(html.slice(index, closing)));
1438
+ cursor = closing;
1439
+ }
1440
+ parts.push(html.slice(cursor));
1441
+ return parts.join("");
1442
+ }
1443
+ function compileTag(tag, isVideo, generateId) {
1444
+ let result = tag;
1445
+ let unresolved = null;
1446
+ let id = getAttr(result, "id");
1447
+ if (!id) {
1448
+ id = `${isVideo ? "hf-video" : "hf-audio"}-${generateId()}`;
1449
+ result = injectAttr(result, "id", id);
1450
+ }
1451
+ let startStr = getAttr(result, "data-start");
1452
+ if (startStr === null) {
1453
+ result = injectAttr(result, "data-start", "0");
1454
+ result = injectAttr(result, "data-hf-auto-start", "");
1455
+ startStr = "0";
1456
+ }
1457
+ const start = parseNumeric(startStr);
1458
+ const attrReader = tagAttrReader(result);
1459
+ const mediaStart = readMediaStart(attrReader);
1460
+ const playbackRate = readElementRateSpec(attrReader);
1461
+ if (!hasAttr(result, "data-end")) {
1462
+ const durationStr = getAttr(result, "data-duration");
1463
+ const duration = parseStrictFiniteTimingNumber(durationStr);
1464
+ if (duration != null) {
1465
+ if (start != null) {
1466
+ result = injectAttr(result, "data-end", String(start + duration));
1467
+ }
1468
+ } else if (id) {
1469
+ unresolved = {
1470
+ id,
1471
+ tagName: isVideo ? "video" : "audio",
1472
+ src: getAttr(result, "src") ?? void 0,
1473
+ start: start ?? 0,
1474
+ mediaStart,
1475
+ playbackRate
1476
+ };
1477
+ }
1478
+ }
1479
+ if (isVideo && !hasAttr(result, "data-has-audio")) {
1480
+ result = injectAttr(result, "data-has-audio", hasAttr(result, "muted") ? "false" : "true");
1481
+ }
1482
+ return { tag: result, unresolved };
1483
+ }
1484
+ function compileTimingAttrs(html) {
1485
+ const unresolved = [];
1486
+ let nextVideoId = 0;
1487
+ let nextAudioId = 0;
1488
+ const { masked, restore } = maskInertRegions(html);
1489
+ html = masked;
1490
+ html = replaceOpeningTags(html, /<video/gi, (match) => {
1491
+ const { tag, unresolved: u } = compileTag(match, true, () => nextVideoId++);
1492
+ if (u)
1493
+ unresolved.push(u);
1494
+ return tag;
1495
+ });
1496
+ html = replaceOpeningTags(html, /<audio/gi, (match) => {
1497
+ const { tag, unresolved: u } = compileTag(match, false, () => nextAudioId++);
1498
+ if (u)
1499
+ unresolved.push(u);
1500
+ return tag;
1501
+ });
1502
+ for (const { tag: match } of iterateOpeningTags(html, /<(?:div|section)/gi)) {
1503
+ if (!hasAttr(match, "data-start"))
1504
+ continue;
1505
+ if (hasAttr(match, "data-end") || hasAttr(match, "data-duration"))
1506
+ continue;
1507
+ const id = getAttr(match, "id");
1508
+ const compositionSrc = getAttr(match, "data-composition-src");
1509
+ if (id) {
1510
+ const startStr = getAttr(match, "data-start");
1511
+ unresolved.push({
1512
+ id,
1513
+ tagName: "div",
1514
+ start: parseNumeric(startStr) ?? 0,
1515
+ mediaStart: 0,
1516
+ playbackRate: 1,
1517
+ compositionSrc: compositionSrc ?? void 0
1518
+ });
1519
+ }
1520
+ }
1521
+ return { html: restore(html), unresolved };
1522
+ }
1523
+ function injectDurations(html, resolutions) {
1524
+ for (const { id, duration } of resolutions) {
1525
+ html = replaceIdTags(html, id, (tag) => {
1526
+ let result = tag;
1527
+ if (parseStrictFiniteTimingNumber(getAttr(result, "data-duration")) == null) {
1528
+ result = setAttr(result, "data-duration", String(duration));
1529
+ }
1530
+ if (!hasAttr(result, "data-end")) {
1531
+ const start = parseNumeric(getAttr(result, "data-start"));
1532
+ if (start != null) {
1533
+ result = injectAttr(result, "data-end", String(start + duration));
1534
+ }
1535
+ }
1536
+ return result;
1537
+ });
1538
+ }
1539
+ return html;
1540
+ }
1541
+ function escapeRegex(str) {
1542
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1543
+ }
1544
+ function extractResolvedMedia(html) {
1545
+ const resolved = [];
1546
+ html = maskInertRegions(html).masked;
1547
+ for (const { tag } of iterateOpeningTags(html, /<(?:video|audio)/gi)) {
1548
+ const id = getAttr(tag, "id");
1549
+ const durationStr = getAttr(tag, "data-duration");
1550
+ if (!id || durationStr === null)
1551
+ continue;
1552
+ const duration = parseStrictFiniteTimingNumber(durationStr);
1553
+ if (duration == null || duration <= 0)
1554
+ continue;
1555
+ const isVideo = /^<video/i.test(tag);
1556
+ const startStr = getAttr(tag, "data-start");
1557
+ const attrReader = tagAttrReader(tag);
1558
+ resolved.push({
1559
+ id,
1560
+ tagName: isVideo ? "video" : "audio",
1561
+ src: getAttr(tag, "src") ?? void 0,
1562
+ start: parseNumeric(startStr) ?? 0,
1563
+ duration,
1564
+ mediaStart: readMediaStart(attrReader),
1565
+ playbackRate: readElementRateSpec(attrReader),
1566
+ loop: hasAttr(tag, "loop")
1567
+ });
1568
+ }
1569
+ return resolved;
1570
+ }
1571
+ function clampDurations(html, clamps) {
1572
+ for (const { id, duration } of clamps) {
1573
+ html = replaceIdTags(html, id, (tag) => {
1574
+ tag = tag.replace(/data-duration=["'][^"']*["']/, `data-duration="${duration}"`);
1575
+ const start = parseNumeric(getAttr(tag, "data-start"));
1576
+ if (start != null) {
1577
+ tag = tag.replace(/data-end=["'][^"']*["']/, `data-end="${start + duration}"`);
1578
+ }
1579
+ return tag;
1580
+ });
1581
+ }
1582
+ return html;
1583
+ }
1584
+
1585
+ // ../core/dist/compiler/mediaRenderIds.js
1586
+ var MEDIA_RENDER_ID_ATTR = "data-hf-render-id";
1587
+ var AUDIO_GROUP_RENDER_ID_ATTR = "data-hf-group-render-id";
1588
+ var MEDIA_SELECTOR = "video, audio, img[src]";
1589
+ var AUDIO_GROUP_SELECTOR = "hf-audio-group[id]";
1590
+ function uniqueRenderId(baseId, taken) {
1591
+ if (!taken.has(baseId))
1592
+ return baseId;
1593
+ let suffix = 2;
1594
+ while (taken.has(`${baseId}__hf${suffix}`))
1595
+ suffix += 1;
1596
+ return `${baseId}__hf${suffix}`;
1597
+ }
1598
+ function assignMediaRenderIds(document2) {
1599
+ const taken = /* @__PURE__ */ new Set();
1600
+ const pending = [];
1601
+ for (const el of document2.querySelectorAll(MEDIA_SELECTOR)) {
1602
+ const existing = el.getAttribute(MEDIA_RENDER_ID_ATTR);
1603
+ if (existing) {
1604
+ taken.add(existing);
1605
+ continue;
1606
+ }
1607
+ pending.push(el);
1608
+ }
1609
+ for (const el of pending) {
1610
+ const baseId = el.getAttribute("id");
1611
+ const renderId = uniqueRenderId(baseId || `hf-media-${taken.size}`, taken);
1612
+ taken.add(renderId);
1613
+ el.setAttribute(MEDIA_RENDER_ID_ATTR, renderId);
1614
+ }
1615
+ assignAudioGroupRenderIds(document2, taken);
1616
+ }
1617
+ function assignAudioGroupRenderIds(document2, taken) {
1618
+ const busesById = stampAudioGroupBuses(document2, taken);
1619
+ if (busesById.size === 0)
1620
+ return;
1621
+ for (const member of document2.querySelectorAll("audio[data-audio-group]")) {
1622
+ const groupId = member.getAttribute("data-audio-group");
1623
+ const buses = groupId ? busesById.get(groupId) : void 0;
1624
+ if (!groupId || !buses?.length)
1625
+ continue;
1626
+ const renderId = busForMember(member, groupId, buses)?.getAttribute(MEDIA_RENDER_ID_ATTR);
1627
+ if (renderId)
1628
+ member.setAttribute(AUDIO_GROUP_RENDER_ID_ATTR, renderId);
1629
+ }
1630
+ }
1631
+ function stampAudioGroupBuses(document2, taken) {
1632
+ const busesById = /* @__PURE__ */ new Map();
1633
+ for (const bus of document2.querySelectorAll(AUDIO_GROUP_SELECTOR)) {
1634
+ const id = bus.getAttribute("id");
1635
+ if (!id)
1636
+ continue;
1637
+ const renderId = bus.getAttribute(MEDIA_RENDER_ID_ATTR) ?? uniqueRenderId(id, taken);
1638
+ taken.add(renderId);
1639
+ bus.setAttribute(MEDIA_RENDER_ID_ATTR, renderId);
1640
+ const existing = busesById.get(id);
1641
+ if (existing)
1642
+ existing.push(bus);
1643
+ else
1644
+ busesById.set(id, [bus]);
1645
+ }
1646
+ return busesById;
1647
+ }
1648
+ function busForMember(member, groupId, buses) {
1649
+ if (buses.length === 1)
1650
+ return buses[0];
1651
+ const scope = member.closest?.("[data-composition-id]");
1652
+ if (!scope)
1653
+ return buses[0];
1654
+ return buses.find((candidate) => candidate.getAttribute("id") === groupId && candidate.closest?.("[data-composition-id]") === scope) ?? buses[0];
1655
+ }
1656
+
1657
+ // ../core/dist/compiler/htmlDocument.js
1658
+ var RUNTIME_BOOTSTRAP_ATTR = "data-hyperframes-preview-runtime";
1659
+ var RUNTIME_SRC_MARKERS = [
1660
+ "hyperframe.runtime.iife.js",
1661
+ "hyperframes-runtime.modular.inline.js",
1662
+ "hyperframe-runtime.modular-runtime.inline.js",
1663
+ RUNTIME_BOOTSTRAP_ATTR
1664
+ ];
1665
+ var RUNTIME_INLINE_MARKERS = [
1666
+ "__hyperframeRuntimeBootstrapped",
1667
+ "__hyperframeRuntime",
1668
+ "__hyperframeRuntimeTeardown",
1669
+ "__HF_EXPORT_RENDER_SEEK_CONFIG",
1670
+ "window.__player ="
1671
+ ];
1672
+ var SIMPLE_RUNTIME_FLAG_ASSIGNMENTS = [
1673
+ /^window\.__playerReady\s*=\s*(?:true|false)\s*;?$/,
1674
+ /^window\.__renderReady\s*=\s*(?:true|false)\s*;?$/
1675
+ ];
1676
+ var LEADING_COMMENTS = /^(?:\s|<!--(?:>|->|[\s\S]*?-->))*/;
1677
+ function isFullHtmlDocument(html) {
1678
+ return /^(?:<!doctype|<html[\s>/])/i.test(html.replace(LEADING_COMMENTS, ""));
1679
+ }
1680
+ function parseHTMLContent(html) {
1681
+ if (isFullHtmlDocument(html)) {
1682
+ return parseHTML(html).document;
1683
+ }
1684
+ return parseHTML(`<!DOCTYPE html><html><head></head><body>${html}</body></html>`).document;
1685
+ }
1686
+ function lowerAscii(text) {
1687
+ return text.replace(/[A-Z]+/g, (letters) => letters.toLowerCase());
1688
+ }
1689
+ function stripEmbeddedRuntimeScripts(html) {
1690
+ if (!html)
1691
+ return html;
1692
+ const loweredHtml = lowerAscii(html);
1693
+ let output = "";
1694
+ let cursor = 0;
1695
+ while (cursor < html.length) {
1696
+ const scriptStart = findScriptStart(loweredHtml, cursor);
1697
+ if (scriptStart === -1) {
1698
+ output += html.slice(cursor);
1699
+ break;
1700
+ }
1701
+ output += html.slice(cursor, scriptStart);
1702
+ const startTagEnd = findTagEnd(html, scriptStart + 1);
1703
+ if (startTagEnd === -1) {
1704
+ output += html.slice(scriptStart);
1705
+ break;
1706
+ }
1707
+ const closeTagEnd = findScriptCloseTagEnd(loweredHtml, startTagEnd + 1);
1708
+ const scriptEnd = closeTagEnd === -1 ? html.length : closeTagEnd;
1709
+ const block = html.slice(scriptStart, scriptEnd);
1710
+ if (!shouldStripRuntimeScriptBlock(block)) {
1711
+ output += block;
1712
+ }
1713
+ cursor = scriptEnd;
1714
+ }
1715
+ return output;
1716
+ }
1717
+ function findScriptStart(loweredHtml, from) {
1718
+ let index = loweredHtml.indexOf("<script", from);
1719
+ while (index !== -1) {
1720
+ const next = loweredHtml[index + "<script".length] ?? "";
1721
+ if (isTagBoundary(next))
1722
+ return index;
1723
+ index = loweredHtml.indexOf("<script", index + 1);
1724
+ }
1725
+ return -1;
1726
+ }
1727
+ function findTagEnd(html, from) {
1728
+ let quote;
1729
+ let state = "tagName";
1730
+ for (let index = from; index < html.length; index += 1) {
1731
+ const char = html.charAt(index);
1732
+ if (quote) {
1733
+ quote = char === quote ? void 0 : quote;
1734
+ continue;
1735
+ }
1736
+ if (char === ">")
1737
+ return index;
1738
+ if (state === "equals" && (char === '"' || char === "'")) {
1739
+ quote = char;
1740
+ state = "between";
1741
+ continue;
1742
+ }
1743
+ state = nextTagState(state, char, index === from);
1744
+ }
1745
+ return -1;
1746
+ }
1747
+ function nextTagState(state, char, first) {
1748
+ if (isHtmlWhitespace(char))
1749
+ return stateAfterWhitespace(state);
1750
+ if (char === "/" && !first)
1751
+ return stateAfterSlash(state);
1752
+ if (char === "=" && state === "name")
1753
+ return "equals";
1754
+ if (state === "equals")
1755
+ return "value";
1756
+ return state === "between" ? "name" : state;
1757
+ }
1758
+ function stateAfterWhitespace(state) {
1759
+ return state === "tagName" || state === "value" ? "between" : state;
1760
+ }
1761
+ function stateAfterSlash(state) {
1762
+ return state === "equals" || state === "value" ? "value" : "between";
1763
+ }
1764
+ function findScriptCloseTagEnd(loweredHtml, from) {
1765
+ let index = loweredHtml.indexOf("</script", from);
1766
+ while (index !== -1) {
1767
+ const closeTagEnd = findScriptCloseTagBoundary(loweredHtml, index + "</script".length);
1768
+ if (closeTagEnd !== -1)
1769
+ return closeTagEnd;
1770
+ index = loweredHtml.indexOf("</script", index + 1);
1771
+ }
1772
+ return -1;
1773
+ }
1774
+ function findScriptCloseTagBoundary(loweredHtml, from) {
1775
+ let cursor = from;
1776
+ while (cursor < loweredHtml.length && isHtmlWhitespace(loweredHtml[cursor] ?? "")) {
1777
+ cursor += 1;
1778
+ }
1779
+ return loweredHtml[cursor] === ">" ? cursor + 1 : -1;
1780
+ }
1781
+ function shouldStripRuntimeScriptBlock(block) {
1782
+ const lowered = block.toLowerCase();
1783
+ for (const marker of RUNTIME_SRC_MARKERS) {
1784
+ if (lowered.includes(marker.toLowerCase()))
1785
+ return true;
1786
+ }
1787
+ for (const marker of RUNTIME_INLINE_MARKERS) {
1788
+ if (block.includes(marker))
1789
+ return true;
1790
+ }
1791
+ const scriptSource = getScriptSource(block).trim();
1792
+ for (const pattern of SIMPLE_RUNTIME_FLAG_ASSIGNMENTS) {
1793
+ if (pattern.test(scriptSource))
1794
+ return true;
1795
+ }
1796
+ return false;
1797
+ }
1798
+ function getScriptSource(block) {
1799
+ const startTagEnd = findTagEnd(block, 1);
1800
+ if (startTagEnd === -1)
1801
+ return "";
1802
+ const loweredBlock = lowerAscii(block);
1803
+ const closeTagStart = loweredBlock.lastIndexOf("</script");
1804
+ const end = closeTagStart === -1 ? block.length : closeTagStart;
1805
+ return block.slice(startTagEnd + 1, end);
1806
+ }
1807
+ function isTagBoundary(char) {
1808
+ return char === "" || char === ">" || char === "/" || isHtmlWhitespace(char);
1809
+ }
1810
+ function isHtmlWhitespace(char) {
1811
+ return char === " " || char === "\n" || char === " " || char === "\r" || char === "\f";
1812
+ }
1813
+ function escapeInlineScriptSource(source) {
1814
+ return escapeCaseInsensitiveToken(escapeCaseInsensitiveToken(source, "</script", "<\\/script"), "<!--", "<\\!--");
1815
+ }
1816
+ function escapeCaseInsensitiveToken(source, token, replacement) {
1817
+ const loweredSource = lowerAscii(source);
1818
+ const loweredToken = lowerAscii(token);
1819
+ let output = "";
1820
+ let cursor = 0;
1821
+ while (cursor < source.length) {
1822
+ const tokenStart = loweredSource.indexOf(loweredToken, cursor);
1823
+ if (tokenStart === -1) {
1824
+ output += source.slice(cursor);
1825
+ break;
1826
+ }
1827
+ output += source.slice(cursor, tokenStart) + replacement;
1828
+ cursor = tokenStart + token.length;
1829
+ }
1830
+ return output;
1831
+ }
1832
+ function inlineScriptTags(scripts) {
1833
+ return scripts.map((source) => `<script>${escapeInlineScriptSource(source)}</script>`).join("\n");
1834
+ }
1835
+ var RAW_TEXT_TAGS = ["script", "style", "title", "textarea"];
1836
+ var COMMENT_END = /--!?>/g;
1837
+ function* markupStarts(lowered) {
1838
+ const unclosedRawText = /* @__PURE__ */ new Set();
1839
+ let cursor = 0;
1840
+ while (cursor !== -1) {
1841
+ const open = lowered.indexOf("<", cursor);
1842
+ if (open === -1)
1843
+ return;
1844
+ yield open;
1845
+ cursor = skipMarkup(lowered, open, unclosedRawText);
1846
+ }
1847
+ }
1848
+ function findDocumentTag(html, tag) {
1849
+ const lowered = lowerAscii(html);
1850
+ for (const open of markupStarts(lowered)) {
1851
+ if (isTagAt(lowered, open, tag))
1852
+ return open;
1853
+ }
1854
+ return -1;
1855
+ }
1856
+ function findStartTags(html, name) {
1857
+ const lowered = lowerAscii(html);
1858
+ const token = `<${lowerAscii(name)}`;
1859
+ const starts = [];
1860
+ let templateDepth = 0;
1861
+ for (const open of markupStarts(lowered)) {
1862
+ if (templateDepth === 0 && isTagAt(lowered, open, token))
1863
+ starts.push(open);
1864
+ if (isTagAt(lowered, open, "<template"))
1865
+ templateDepth++;
1866
+ else if (templateDepth > 0 && isTagAt(lowered, open, "</template"))
1867
+ templateDepth--;
1868
+ }
1869
+ return starts;
1870
+ }
1871
+ function isTagAt(lowered, at, token) {
1872
+ return lowered.startsWith(token, at) && isTagBoundary(lowered.charAt(at + token.length));
1873
+ }
1874
+ function skipMarkup(lowered, open, unclosedRawText) {
1875
+ if (lowered.startsWith("<!--", open))
1876
+ return skipComment(lowered, open);
1877
+ const next = lowered.charAt(open + 1);
1878
+ if (next === "/" && !/[a-z]/.test(lowered.charAt(open + 2))) {
1879
+ const bogusEnd = lowered.indexOf(">", open);
1880
+ return bogusEnd === -1 ? -1 : bogusEnd + 1;
1881
+ }
1882
+ if (!/[a-z/]/.test(next))
1883
+ return open + 1;
1884
+ const tagEnd = findTagEnd(lowered, open + 1);
1885
+ return tagEnd === -1 ? -1 : skipRawText(lowered, open, tagEnd, unclosedRawText);
1886
+ }
1887
+ function skipComment(lowered, open) {
1888
+ if (lowered.startsWith("<!-->", open) || lowered.startsWith("<!--->", open)) {
1889
+ return lowered.indexOf(">", open) + 1;
1890
+ }
1891
+ COMMENT_END.lastIndex = open + 4;
1892
+ const end = COMMENT_END.exec(lowered);
1893
+ return end ? end.index + end[0].length : -1;
1894
+ }
1895
+ function skipRawText(lowered, open, tagEnd, unclosedRawText) {
1896
+ const rawText = RAW_TEXT_TAGS.find((name) => isTagAt(lowered, open, `<${name}`));
1897
+ if (!rawText)
1898
+ return tagEnd + 1;
1899
+ const close = unclosedRawText.has(rawText) ? -1 : findRawTextClose(lowered, rawText, tagEnd + 1);
1900
+ if (close !== -1)
1901
+ return close;
1902
+ unclosedRawText.add(rawText);
1903
+ return lowered.charAt(tagEnd - 1) === "/" ? tagEnd + 1 : -1;
1904
+ }
1905
+ function findRawTextClose(lowered, name, from) {
1906
+ const close = `</${name}`;
1907
+ for (let at = lowered.indexOf(close, from); at !== -1; at = lowered.indexOf(close, at + 1)) {
1908
+ if (isTagAt(lowered, at, close))
1909
+ return at;
1910
+ }
1911
+ return -1;
1912
+ }
1913
+ function insertBeforeDocumentTag(html, tag, markup) {
1914
+ const at = findDocumentTag(html, tag);
1915
+ return at === -1 ? null : html.slice(0, at) + markup + html.slice(at);
1916
+ }
1917
+ function insertBeforeCloseTag(html, name, markup) {
1918
+ return insertBeforeDocumentTag(html, `</${name}`, markup);
1919
+ }
1920
+ function injectTagsAtHeadStart(html, tags) {
1921
+ const headOpen = findDocumentTag(html, "<head");
1922
+ const headOpenEnd = headOpen === -1 ? -1 : findTagEnd(html, headOpen + 1);
1923
+ if (headOpenEnd !== -1) {
1924
+ return `${html.slice(0, headOpenEnd + 1)}
1925
+ ${tags}${html.slice(headOpenEnd + 1)}`;
1926
+ }
1927
+ return insertBeforeDocumentTag(html, "<body", `${tags}
1928
+ `) ?? `${tags}
1929
+ ${html}`;
1930
+ }
1931
+ function injectScriptsAtHeadStart(html, scripts) {
1932
+ if (scripts.length === 0)
1933
+ return html;
1934
+ return injectTagsAtHeadStart(html, inlineScriptTags(scripts));
1935
+ }
1936
+ function injectScriptsIntoHtml(html, headScripts, bodyScripts, stripEmbeddedRuntime = true) {
1937
+ if (stripEmbeddedRuntime) {
1938
+ html = stripEmbeddedRuntimeScripts(html);
1939
+ }
1940
+ if (headScripts.length > 0) {
1941
+ const headTags = inlineScriptTags(headScripts);
1942
+ const withHead = insertBeforeCloseTag(html, "head", `${headTags}
1943
+ `);
1944
+ html = withHead ?? insertBeforeDocumentTag(html, "<body", `${headTags}
1945
+ `) ?? `${headTags}
1946
+ ${html}`;
1947
+ }
1948
+ if (bodyScripts.length > 0) {
1949
+ const bodyTags = inlineScriptTags(bodyScripts);
1950
+ html = insertBeforeCloseTag(html, "body", `${bodyTags}
1951
+ `) ?? `${html}
1952
+ ${bodyTags}`;
1953
+ }
1954
+ return html;
1955
+ }
1956
+
1957
+ // ../core/dist/utils/cssSelector.js
1958
+ function queryByAttr(root, attr, value, tag) {
1959
+ const selector = tag ? `${tag}[${attr}]` : `[${attr}]`;
1960
+ for (const el of root.querySelectorAll(selector)) {
1961
+ if (el.getAttribute(attr) === value)
1962
+ return el;
1963
+ }
1964
+ return null;
1965
+ }
1966
+
1967
+ // ../core/dist/colorLuts.js
1968
+ var CubeLutParseError = class extends Error {
1969
+ lineNumber;
1970
+ constructor(message, lineNumber = null) {
1971
+ super(lineNumber == null ? message : `${message} at line ${lineNumber}`);
1972
+ this.name = "CubeLutParseError";
1973
+ this.lineNumber = lineNumber;
1974
+ }
1975
+ };
1976
+ var DEFAULT_DOMAIN_MIN = [0, 0, 0];
1977
+ var DEFAULT_DOMAIN_MAX = [1, 1, 1];
1978
+ var DEFAULT_MAX_CUBE_LUT_SIZE = 64;
1979
+ function stripComment(line) {
1980
+ let inQuote = false;
1981
+ for (let i = 0; i < line.length; i++) {
1982
+ const char = line[i];
1983
+ if (char === '"')
1984
+ inQuote = !inQuote;
1985
+ if (char === "#" && !inQuote)
1986
+ return line.slice(0, i);
1987
+ }
1988
+ return line;
1989
+ }
1990
+ function parseFiniteNumber(value, lineNumber) {
1991
+ const parsed = Number(value);
1992
+ if (!Number.isFinite(parsed)) {
1993
+ throw new CubeLutParseError(`Invalid number "${value}"`, lineNumber);
1994
+ }
1995
+ return parsed;
1996
+ }
1997
+ function parseVec3(parts, keyword, lineNumber) {
1998
+ if (parts.length !== 3) {
1999
+ throw new CubeLutParseError(`${keyword} expects three numbers`, lineNumber);
2000
+ }
2001
+ return [
2002
+ parseFiniteNumber(parts[0], lineNumber),
2003
+ parseFiniteNumber(parts[1], lineNumber),
2004
+ parseFiniteNumber(parts[2], lineNumber)
2005
+ ];
2006
+ }
2007
+ function parseSize(value, keyword, lineNumber) {
2008
+ if (!value)
2009
+ throw new CubeLutParseError(`${keyword} expects a size`, lineNumber);
2010
+ const parsed = Number(value);
2011
+ if (!Number.isInteger(parsed) || parsed < 2) {
2012
+ throw new CubeLutParseError(`${keyword} must be an integer greater than 1`, lineNumber);
2013
+ }
2014
+ return parsed;
2015
+ }
2016
+ function validateDomain(domainMin, domainMax) {
2017
+ if (domainMax[0] <= domainMin[0] || domainMax[1] <= domainMin[1] || domainMax[2] <= domainMin[2]) {
2018
+ throw new CubeLutParseError("DOMAIN_MAX values must be greater than DOMAIN_MIN values");
2019
+ }
2020
+ }
2021
+ function parseTitle(line) {
2022
+ const quoted = /^TITLE\s+"([^"]*)"\s*$/i.exec(line);
2023
+ if (quoted)
2024
+ return quoted[1] ?? null;
2025
+ const bare = /^TITLE\s+(.+)\s*$/i.exec(line);
2026
+ return bare ? (bare[1] ?? "").trim() || null : null;
2027
+ }
2028
+ function isNumericDataLine(token) {
2029
+ return /^[+-]?(?:\d|\.\d)/.test(token);
2030
+ }
2031
+ function parseCubeLut(input, options = {}) {
2032
+ const maxSize = options.maxSize ?? DEFAULT_MAX_CUBE_LUT_SIZE;
2033
+ let title = null;
2034
+ let domainMin = DEFAULT_DOMAIN_MIN;
2035
+ let domainMax = DEFAULT_DOMAIN_MAX;
2036
+ let lut1dSize = null;
2037
+ let lut3dSize = null;
2038
+ const rows = [];
2039
+ const lines = input.replace(/^\uFEFF/, "").split(/\r?\n/);
2040
+ for (let i = 0; i < lines.length; i++) {
2041
+ const lineNumber = i + 1;
2042
+ const line = stripComment(lines[i] ?? "").trim();
2043
+ if (!line)
2044
+ continue;
2045
+ const parts = line.split(/\s+/);
2046
+ const keyword = (parts[0] ?? "").toUpperCase();
2047
+ const rest = parts.slice(1);
2048
+ if (keyword === "TITLE") {
2049
+ title = parseTitle(line);
2050
+ continue;
2051
+ }
2052
+ if (keyword === "DOMAIN_MIN") {
2053
+ domainMin = parseVec3(rest, keyword, lineNumber);
2054
+ continue;
2055
+ }
2056
+ if (keyword === "DOMAIN_MAX") {
2057
+ domainMax = parseVec3(rest, keyword, lineNumber);
2058
+ continue;
2059
+ }
2060
+ if (keyword === "LUT_3D_INPUT_RANGE") {
2061
+ if (rest.length !== 2) {
2062
+ throw new CubeLutParseError(`${keyword} expects two numbers`, lineNumber);
2063
+ }
2064
+ const min = parseFiniteNumber(rest[0], lineNumber);
2065
+ const max = parseFiniteNumber(rest[1], lineNumber);
2066
+ if (max <= min) {
2067
+ throw new CubeLutParseError("LUT_3D_INPUT_RANGE max must exceed min", lineNumber);
2068
+ }
2069
+ domainMin = [min, min, min];
2070
+ domainMax = [max, max, max];
2071
+ continue;
2072
+ }
2073
+ if (keyword === "LUT_1D_SIZE") {
2074
+ lut1dSize = parseSize(rest[0], keyword, lineNumber);
2075
+ continue;
2076
+ }
2077
+ if (keyword === "LUT_3D_SIZE") {
2078
+ lut3dSize = parseSize(rest[0], keyword, lineNumber);
2079
+ if (lut3dSize > maxSize) {
2080
+ throw new CubeLutParseError(`LUT_3D_SIZE ${lut3dSize} exceeds max ${maxSize}`, lineNumber);
2081
+ }
2082
+ continue;
2083
+ }
2084
+ if (!isNumericDataLine(keyword)) {
2085
+ if (keyword.startsWith("LUT_")) {
2086
+ throw new CubeLutParseError(`Unsupported cube keyword ${keyword}`, lineNumber);
2087
+ }
2088
+ continue;
2089
+ }
2090
+ if (!lut3dSize) {
2091
+ if (lut1dSize) {
2092
+ throw new CubeLutParseError("1D cube LUTs are not supported yet", lineNumber);
2093
+ }
2094
+ throw new CubeLutParseError("LUT data appears before LUT_3D_SIZE", lineNumber);
2095
+ }
2096
+ if (parts.length !== 3) {
2097
+ throw new CubeLutParseError("LUT data rows must contain three numbers", lineNumber);
2098
+ }
2099
+ rows.push(parseFiniteNumber(parts[0], lineNumber), parseFiniteNumber(parts[1], lineNumber), parseFiniteNumber(parts[2], lineNumber));
2100
+ }
2101
+ if (lut1dSize && lut3dSize) {
2102
+ throw new CubeLutParseError("Mixed 1D and 3D cube LUTs are not supported yet");
2103
+ }
2104
+ if (!lut3dSize) {
2105
+ if (lut1dSize)
2106
+ throw new CubeLutParseError("1D cube LUTs are not supported yet");
2107
+ throw new CubeLutParseError("Missing LUT_3D_SIZE");
2108
+ }
2109
+ validateDomain(domainMin, domainMax);
2110
+ const expectedRows = lut3dSize * lut3dSize * lut3dSize;
2111
+ if (rows.length !== expectedRows * 3) {
2112
+ throw new CubeLutParseError(`Expected ${expectedRows} LUT rows for size ${lut3dSize}, found ${rows.length / 3}`);
2113
+ }
2114
+ return {
2115
+ title,
2116
+ size: lut3dSize,
2117
+ domainMin,
2118
+ domainMax,
2119
+ data: new Float32Array(rows)
2120
+ };
2121
+ }
2122
+
2123
+ // ../core/dist/colorGrading.js
2124
+ var HF_COLOR_GRADING_ATTR = "data-color-grading";
2125
+ var COLOR_GRADING_SOURCE_HIDDEN_ATTR = "data-hf-color-grading-source-hidden";
2126
+ var HF_COLOR_GRADING_CANVAS_ID_PREFIX = "__hf_color_grading_";
2127
+ var HF_COLOR_GRADING_COLOR_SPACE = COLOR_GRADING_COLOR_SPACE;
2128
+ var ADJUST_ZERO = {
2129
+ exposure: 0,
2130
+ contrast: 0,
2131
+ highlights: 0,
2132
+ shadows: 0,
2133
+ whites: 0,
2134
+ blacks: 0,
2135
+ temperature: 0,
2136
+ tint: 0,
2137
+ vibrance: 0,
2138
+ saturation: 0
2139
+ };
2140
+ var DETAIL_DEFAULTS = {
2141
+ vignette: 0,
2142
+ vignetteMidpoint: 0.5,
2143
+ vignetteRoundness: 0,
2144
+ vignetteFeather: 0.65,
2145
+ grain: 0,
2146
+ grainSize: 0.25,
2147
+ grainRoughness: 0.5
2148
+ };
2149
+ var EFFECT_DEFAULTS = {
2150
+ blur: 0,
2151
+ pixelate: 0,
2152
+ chromaBleed: 0,
2153
+ tapeDamage: 0,
2154
+ tapeTracking: 0,
2155
+ tapeNoise: 1,
2156
+ tapeSpeed: 0.5,
2157
+ filmArtifacts: 0,
2158
+ halftone: 0,
2159
+ halftoneSize: 0,
2160
+ twoInkPrint: 0,
2161
+ twoInkPrintSize: 0,
2162
+ ascii: 0,
2163
+ asciiSize: 5 / 76,
2164
+ asciiInvert: 0,
2165
+ asciiStyle: 0,
2166
+ asciiColor: 1,
2167
+ asciiRotation: 0,
2168
+ dither: 0,
2169
+ ditherSize: 0,
2170
+ bloom: 0,
2171
+ bloomRadius: 8,
2172
+ monoScreen: 0,
2173
+ monoScreenSize: 0,
2174
+ monoScreenAngle: 0,
2175
+ monoScreenSpread: 0,
2176
+ monoScreenShape: 0,
2177
+ monoScreenInvert: 0,
2178
+ scanlines: 0,
2179
+ scanlineCount: 0,
2180
+ scanlineSoftness: 0,
2181
+ chromaticAberration: 0,
2182
+ chromaticAngle: 0,
2183
+ crtCurvature: 0,
2184
+ digitalGlitch: 0,
2185
+ digitalGlitchColorSplit: 0,
2186
+ digitalGlitchLineTear: 0,
2187
+ digitalGlitchPixelate: 0,
2188
+ digitalGlitchBlockAmount: 0,
2189
+ digitalGlitchBlockDisplacement: 0,
2190
+ digitalGlitchBlockOpacity: 0,
2191
+ digitalGlitchSpeed: 0,
2192
+ engraving: 0,
2193
+ engravingSpacing: 7 / 17,
2194
+ engravingMinThickness: 0.2,
2195
+ engravingMaxThickness: 3.2 / 7,
2196
+ engravingAngle: 0.25,
2197
+ engravingContrast: 7 / 15,
2198
+ engravingSharpness: 0.59,
2199
+ engravingWave: 0.2,
2200
+ engravingWaveFrequency: 2 / 9,
2201
+ crosshatch: 0,
2202
+ crosshatchSpacing: 7 / 25,
2203
+ crosshatchThickness: 0.25,
2204
+ crosshatchAngle: 0.25,
2205
+ crosshatchContrast: 1 / 3,
2206
+ crosshatchEdges: 0.5,
2207
+ crosshatchLineWeight: 0,
2208
+ crosshatchWave: 0.33,
2209
+ crosshatchWaveFrequency: 2 / 9,
2210
+ kuwahara: 0,
2211
+ kuwaharaRadius: 1 / 7,
2212
+ kuwaharaSharpness: 5 / 16,
2213
+ kuwaharaSaturation: 0.5
2214
+ };
2215
+ var HF_COLOR_GRADING_TOP_LEVEL_KEYS = COLOR_GRADING_TOP_LEVEL_KEYS;
2216
+ var HF_COLOR_GRADING_LUT_KEYS = COLOR_GRADING_LUT_KEYS;
2217
+ var HF_COLOR_GRADING_PALETTES = [
2218
+ { id: "noir", label: "Noir", group: "Classic", colors: ["#000000", "#ffffff"] },
2219
+ {
2220
+ id: "ink-paper",
2221
+ label: "Ink & Paper",
2222
+ group: "Classic",
2223
+ colors: ["#1a1a2e", "#f5f5dc"]
2224
+ },
2225
+ {
2226
+ id: "terminal",
2227
+ label: "Terminal",
2228
+ group: "Classic",
2229
+ colors: ["#001100", "#00ff00"]
2230
+ },
2231
+ {
2232
+ id: "amber-glow",
2233
+ label: "Amber Glow",
2234
+ group: "Classic",
2235
+ colors: ["#1a0f00", "#ffcc00"]
2236
+ },
2237
+ {
2238
+ id: "handheld-green",
2239
+ label: "Handheld Green",
2240
+ group: "Classic",
2241
+ colors: ["#0f380f", "#306230", "#8bac0f", "#9bbc0f"]
2242
+ },
2243
+ {
2244
+ id: "golden-hour",
2245
+ label: "Golden Hour",
2246
+ group: "Mood",
2247
+ colors: ["#1a1205", "#4a3510", "#8b6914", "#d4a017", "#fff8dc"]
2248
+ },
2249
+ {
2250
+ id: "deep-sea",
2251
+ label: "Deep Sea",
2252
+ group: "Mood",
2253
+ colors: ["#0a1628", "#1a3a5c", "#2d6187", "#5ba4c9", "#a8dce8"]
2254
+ },
2255
+ {
2256
+ id: "arctic-night",
2257
+ label: "Arctic Night",
2258
+ group: "Mood",
2259
+ colors: ["#0a0a14", "#1a2a4a", "#3a5a8a", "#6a9aca", "#cae8ff"]
2260
+ },
2261
+ {
2262
+ id: "synthwave",
2263
+ label: "Synthwave",
2264
+ group: "Mood",
2265
+ colors: ["#120458", "#7b2cbf", "#e040fb", "#ff6ec7", "#fff59d"]
2266
+ },
2267
+ {
2268
+ id: "vaporwave",
2269
+ label: "Vaporwave",
2270
+ group: "Mood",
2271
+ colors: ["#1a0a2e", "#3d1a5c", "#ff71ce", "#01cdfe", "#fffb96"]
2272
+ },
2273
+ {
2274
+ id: "forest",
2275
+ label: "Forest",
2276
+ group: "Mood",
2277
+ colors: ["#1a2e1a", "#2d4a2d", "#4a7c4a", "#7ab37a", "#c8e6c8"]
2278
+ },
2279
+ {
2280
+ id: "sepia",
2281
+ label: "Sepia",
2282
+ group: "Mono",
2283
+ colors: ["#1a1610", "#3d3020", "#6b5a40", "#a89070", "#e8dcc8"]
2284
+ },
2285
+ {
2286
+ id: "blueprint",
2287
+ label: "Blueprint",
2288
+ group: "Mono",
2289
+ colors: ["#001830", "#003060", "#0050a0", "#0080e0", "#e0f0ff"]
2290
+ },
2291
+ {
2292
+ id: "warm-print",
2293
+ label: "Warm Print",
2294
+ group: "HyperFrames",
2295
+ colors: ["#17121a", "#824c50", "#e09873", "#f7ddb1"]
2296
+ },
2297
+ {
2298
+ id: "electric-ink",
2299
+ label: "Electric Ink",
2300
+ group: "HyperFrames",
2301
+ colors: ["#080717", "#3c185f", "#7e2278", "#d9339f", "#ff6b66", "#aafae0"]
2302
+ }
2303
+ ];
2304
+ var HF_COLOR_GRADING_ADJUST_KEYS = COLOR_GRADING_ADJUST_KEYS;
2305
+ var HF_COLOR_GRADING_WHEEL_KEYS = COLOR_GRADING_WHEEL_KEYS;
2306
+ var HF_COLOR_GRADING_CURVE_KEYS = COLOR_GRADING_CURVE_KEYS;
2307
+ var HF_COLOR_GRADING_HUE_CURVE_KEYS = COLOR_GRADING_HUE_CURVE_KEYS;
2308
+ var HF_COLOR_GRADING_DETAIL_KEYS = COLOR_GRADING_DETAIL_KEYS;
2309
+ var HF_COLOR_GRADING_EFFECT_KEYS = COLOR_GRADING_EFFECT_KEYS;
2310
+ var VINTAGE_WASH_ADJUST = {
2311
+ exposure: 0.03,
2312
+ contrast: -0.12,
2313
+ highlights: -0.1,
2314
+ shadows: 0.16,
2315
+ whites: -0.04,
2316
+ blacks: 0.08,
2317
+ temperature: 0.13,
2318
+ vibrance: -0.08,
2319
+ saturation: -0.08
2320
+ };
2321
+ var VINTAGE_WASH_DETAILS = { vignette: 0.18 };
2322
+ function preset(id, label, adjust = {}, details = {}, effects = {}, intensity = 1) {
2323
+ return {
2324
+ id,
2325
+ label,
2326
+ intensity,
2327
+ adjust: { ...ADJUST_ZERO, ...adjust },
2328
+ details: { ...DETAIL_DEFAULTS, ...details },
2329
+ effects: { ...EFFECT_DEFAULTS, ...effects }
2330
+ };
2331
+ }
2332
+ var HF_COLOR_GRADING_PRESETS = [
2333
+ preset("neutral", "Neutral"),
2334
+ preset("warm-daylight", "Warm Daylight", {
2335
+ exposure: 0.06,
2336
+ contrast: 0.07,
2337
+ highlights: -0.06,
2338
+ shadows: 0.08,
2339
+ temperature: 0.18,
2340
+ saturation: 0.08
2341
+ }),
2342
+ preset("clean-studio", "Clean Studio", {
2343
+ contrast: 0.08,
2344
+ highlights: -0.08,
2345
+ shadows: 0.06,
2346
+ temperature: -0.08,
2347
+ tint: 0.03,
2348
+ saturation: 0.04
2349
+ }),
2350
+ preset("skin-soft", "Skin Soft", {
2351
+ exposure: 0.04,
2352
+ contrast: -0.03,
2353
+ highlights: -0.12,
2354
+ shadows: 0.12,
2355
+ temperature: 0.08,
2356
+ tint: 0.02,
2357
+ saturation: 0.04
2358
+ }),
2359
+ preset("food-pop", "Food Pop", {
2360
+ exposure: 0.06,
2361
+ contrast: 0.1,
2362
+ shadows: 0.06,
2363
+ temperature: 0.14,
2364
+ vibrance: 0.1,
2365
+ saturation: 0.18
2366
+ }),
2367
+ preset("night-lift", "Night Lift", {
2368
+ exposure: 0.08,
2369
+ contrast: 0.08,
2370
+ highlights: -0.18,
2371
+ shadows: 0.2,
2372
+ blacks: -0.08,
2373
+ saturation: 0.04
2374
+ }, {
2375
+ vignette: 0.12
2376
+ }),
2377
+ preset("muted-editorial", "Muted Editorial", {
2378
+ exposure: -0.02,
2379
+ contrast: 0.08,
2380
+ highlights: -0.08,
2381
+ shadows: 0.06,
2382
+ blacks: -0.05,
2383
+ temperature: -0.03,
2384
+ saturation: -0.12
2385
+ }, {
2386
+ vignette: 0.1
2387
+ }),
2388
+ preset("vintage-wash", "Vintage Wash", VINTAGE_WASH_ADJUST, VINTAGE_WASH_DETAILS),
2389
+ preset("mono-clean", "Mono Clean", {
2390
+ contrast: 0.12,
2391
+ highlights: -0.04,
2392
+ shadows: 0.04,
2393
+ blacks: -0.08,
2394
+ saturation: -1
2395
+ }),
2396
+ preset("mono-fade", "Mono Fade", {
2397
+ contrast: -0.04,
2398
+ highlights: -0.06,
2399
+ shadows: 0.1,
2400
+ blacks: 0.12,
2401
+ saturation: -1
2402
+ }, {
2403
+ vignette: 0.08
2404
+ }),
2405
+ preset("soft-boost", "Soft Boost", {
2406
+ exposure: 0.06,
2407
+ contrast: -0.04,
2408
+ highlights: -0.14,
2409
+ shadows: 0.16,
2410
+ vibrance: 0.08,
2411
+ saturation: 0.1
2412
+ }),
2413
+ preset("bright-pop", "Bright Pop", {
2414
+ exposure: 0.12,
2415
+ contrast: 0.12,
2416
+ whites: 0.08,
2417
+ blacks: -0.04,
2418
+ vibrance: 0.08,
2419
+ saturation: 0.14
2420
+ }),
2421
+ preset("deep-contrast", "Deep Contrast", {
2422
+ exposure: -0.03,
2423
+ contrast: 0.2,
2424
+ highlights: -0.08,
2425
+ shadows: -0.08,
2426
+ blacks: -0.12,
2427
+ saturation: 0.06
2428
+ }),
2429
+ preset("creator-camcorder", "Creator Camcorder", {
2430
+ contrast: 0.08,
2431
+ highlights: -0.05,
2432
+ shadows: 0.02,
2433
+ whites: 0.03,
2434
+ blacks: -0.04,
2435
+ temperature: -0.03,
2436
+ tint: -0.015,
2437
+ vibrance: -0.03,
2438
+ saturation: -0.06
2439
+ }, { vignette: 0.06, grain: 0.08, grainSize: 0.18, grainRoughness: 0.58 }, { chromaBleed: 0.55 }, 0.72),
2440
+ preset("vhs-playback", "VHS Playback", { contrast: -0.04, saturation: -0.08 }, { grain: 0.16, grainSize: 0.12, grainRoughness: 0.72 }, {
2441
+ tapeDamage: 0.82,
2442
+ tapeTracking: 0.85,
2443
+ tapeNoise: 0.3,
2444
+ tapeSpeed: 0.5,
2445
+ chromaBleed: 0.5,
2446
+ chromaticAberration: 0.18,
2447
+ scanlines: 0.35,
2448
+ scanlineCount: 0.17,
2449
+ scanlineSoftness: 1,
2450
+ digitalGlitch: 0.32,
2451
+ digitalGlitchLineTear: 0.08,
2452
+ digitalGlitchSpeed: 0.5
2453
+ }),
2454
+ preset("home-movie-8mm", "8mm Home Movie", VINTAGE_WASH_ADJUST, {
2455
+ ...VINTAGE_WASH_DETAILS,
2456
+ vignette: 0.28,
2457
+ vignetteMidpoint: 0.54,
2458
+ vignetteFeather: 0.72,
2459
+ grain: 0.34,
2460
+ grainSize: 0.18,
2461
+ grainRoughness: 0.72
2462
+ }, { filmArtifacts: 0.62 }, 0.72),
2463
+ preset("editorial-halftone", "Editorial Halftone", { contrast: 0.04, saturation: 0.04 }, {}, { halftone: 0.94, halftoneSize: 0.36 }),
2464
+ preset("two-ink-print", "Two-Ink Print", { contrast: 0.08, highlights: -0.06, shadows: 0.04 }, {}, { twoInkPrint: 1, twoInkPrintSize: 0.42 })
2465
+ ];
2466
+ var PRESETS_BY_ID = new Map(HF_COLOR_GRADING_PRESETS.map((preset2) => [preset2.id, preset2]));
2467
+ var VARIABLE_REF_RE = /^\$(?:\{([A-Za-z0-9_.:-]+)\}|([A-Za-z0-9_.:-]+))$/;
2468
+ var ADJUST_LIMITS = {
2469
+ exposure: { min: -2, max: 2 },
2470
+ contrast: { min: -1, max: 1 },
2471
+ highlights: { min: -1, max: 1 },
2472
+ shadows: { min: -1, max: 1 },
2473
+ whites: { min: -1, max: 1 },
2474
+ blacks: { min: -1, max: 1 },
2475
+ temperature: { min: -1, max: 1 },
2476
+ tint: { min: -1, max: 1 },
2477
+ vibrance: { min: -1, max: 1 },
2478
+ saturation: { min: -1, max: 1 }
2479
+ };
2480
+ var TONAL_WHEEL_DEFAULT = {
2481
+ hue: 0,
2482
+ amount: 0,
2483
+ level: 0
2484
+ };
2485
+ var WHEEL_LIMITS = {
2486
+ amount: COLOR_GRADING_ADVANCED_LIMITS.unit,
2487
+ level: COLOR_GRADING_ADVANCED_LIMITS.signedUnit
2488
+ };
2489
+ var RGB_CURVE_IDENTITY = [
2490
+ [0, 0],
2491
+ [1, 1]
2492
+ ];
2493
+ var HUE_CURVE_IDENTITY = [];
2494
+ var HUE_CURVE_LIMITS = {
2495
+ hueVsHue: COLOR_GRADING_ADVANCED_LIMITS.secondaryHueShift,
2496
+ hueVsSaturation: COLOR_GRADING_ADVANCED_LIMITS.signedUnit,
2497
+ hueVsLuma: COLOR_GRADING_ADVANCED_LIMITS.signedUnit
2498
+ };
2499
+ var SECONDARY_HUE_DEFAULT = {
2500
+ center: 0,
2501
+ range: 180,
2502
+ softness: 0
2503
+ };
2504
+ var SECONDARY_SOFT_RANGE_DEFAULT = {
2505
+ min: 0,
2506
+ max: 1,
2507
+ softness: 0.05
2508
+ };
2509
+ var DETAIL_LIMITS = {
2510
+ vignette: COLOR_GRADING_ADVANCED_LIMITS.unit,
2511
+ vignetteMidpoint: COLOR_GRADING_ADVANCED_LIMITS.unit,
2512
+ vignetteRoundness: COLOR_GRADING_ADVANCED_LIMITS.signedUnit,
2513
+ vignetteFeather: COLOR_GRADING_ADVANCED_LIMITS.unit,
2514
+ grain: COLOR_GRADING_ADVANCED_LIMITS.unit,
2515
+ grainSize: COLOR_GRADING_ADVANCED_LIMITS.unit,
2516
+ grainRoughness: COLOR_GRADING_ADVANCED_LIMITS.unit
2517
+ };
2518
+ var UNIT_LIMIT = COLOR_GRADING_ADVANCED_LIMITS.unit;
2519
+ var EFFECT_LIMIT_OVERRIDES = COLOR_GRADING_ADVANCED_LIMITS.effects;
2520
+ var HF_COLOR_GRADING_ACTIVE_EFFECT_KEYS = [
2521
+ "blur",
2522
+ "pixelate",
2523
+ "chromaBleed",
2524
+ "tapeDamage",
2525
+ "filmArtifacts",
2526
+ "halftone",
2527
+ "twoInkPrint",
2528
+ "ascii",
2529
+ "dither",
2530
+ "bloom",
2531
+ "monoScreen",
2532
+ "scanlines",
2533
+ "chromaticAberration",
2534
+ "crtCurvature",
2535
+ "digitalGlitch",
2536
+ "engraving",
2537
+ "crosshatch",
2538
+ "kuwahara"
2539
+ ];
2540
+ var EFFECT_FAMILIES = [
2541
+ {
2542
+ id: "essentials",
2543
+ label: "Essentials",
2544
+ description: "Common optical, focus, and privacy-oriented primitives."
2545
+ },
2546
+ {
2547
+ id: "retro-glitch",
2548
+ label: "Retro & Glitch",
2549
+ description: "Tape, film, CRT, channel separation, and digital disruption."
2550
+ },
2551
+ {
2552
+ id: "print",
2553
+ label: "Print",
2554
+ description: "Halftone, limited-ink, dither, and screen-print rendering."
2555
+ },
2556
+ {
2557
+ id: "art",
2558
+ label: "Art",
2559
+ description: "ASCII, engraved, crosshatched, and painterly rendering."
2560
+ }
2561
+ ];
2562
+ var EFFECT_METADATA = {
2563
+ blur: {
2564
+ family: "essentials",
2565
+ label: "Blur",
2566
+ description: "Defocus or soften a full media layer."
2567
+ },
2568
+ pixelate: {
2569
+ family: "essentials",
2570
+ label: "Pixelate",
2571
+ description: "Turn a media layer into a block mosaic."
2572
+ },
2573
+ bloom: {
2574
+ family: "essentials",
2575
+ label: "Bloom",
2576
+ description: "Add thresholded glow around bright image regions."
2577
+ },
2578
+ chromaBleed: {
2579
+ family: "retro-glitch",
2580
+ label: "Chroma Softening",
2581
+ description: "Smear color like low-bandwidth video."
2582
+ },
2583
+ tapeDamage: {
2584
+ family: "retro-glitch",
2585
+ label: "Tape Damage",
2586
+ description: "Add moving tracking errors and tape noise."
2587
+ },
2588
+ filmArtifacts: {
2589
+ family: "retro-glitch",
2590
+ label: "Film Artifacts",
2591
+ description: "Add deterministic dust and film wear."
2592
+ },
2593
+ scanlines: {
2594
+ family: "retro-glitch",
2595
+ label: "Scanlines",
2596
+ description: "Overlay configurable horizontal display lines."
2597
+ },
2598
+ crtCurvature: {
2599
+ family: "retro-glitch",
2600
+ label: "CRT Curvature",
2601
+ description: "Warp media toward curved CRT geometry."
2602
+ },
2603
+ chromaticAberration: {
2604
+ family: "retro-glitch",
2605
+ label: "Channel Separation",
2606
+ description: "Offset color channels by angle."
2607
+ },
2608
+ digitalGlitch: {
2609
+ family: "retro-glitch",
2610
+ label: "Digital Glitch",
2611
+ description: "Compose tears, blocks, and color splits."
2612
+ },
2613
+ halftone: {
2614
+ family: "print",
2615
+ label: "Halftone",
2616
+ description: "Render source color through a print-dot raster."
2617
+ },
2618
+ twoInkPrint: {
2619
+ family: "print",
2620
+ label: "Two-Ink Print",
2621
+ description: "Reduce media to a two-ink print treatment."
2622
+ },
2623
+ dither: {
2624
+ family: "print",
2625
+ label: "Ordered Dither",
2626
+ description: "Quantize media into an ordered limited palette."
2627
+ },
2628
+ monoScreen: {
2629
+ family: "print",
2630
+ label: "Mono Screen",
2631
+ description: "Build monochrome dot, shape, or line artwork."
2632
+ },
2633
+ ascii: {
2634
+ family: "art",
2635
+ label: "ASCII",
2636
+ description: "Render media as configurable procedural glyph cells."
2637
+ },
2638
+ engraving: {
2639
+ family: "art",
2640
+ label: "Engraving",
2641
+ description: "Translate luminance into directional engraved lines."
2642
+ },
2643
+ crosshatch: {
2644
+ family: "art",
2645
+ label: "Crosshatch",
2646
+ description: "Translate media into layered hand-hatched lines."
2647
+ },
2648
+ kuwahara: {
2649
+ family: "art",
2650
+ label: "Kuwahara Paint",
2651
+ description: "Apply edge-preserving painterly smoothing."
2652
+ }
2653
+ };
2654
+ var HF_COLOR_GRADING_EFFECT_PRESETS = HF_COLOR_GRADING_PRESETS.filter((preset2) => HF_COLOR_GRADING_ACTIVE_EFFECT_KEYS.some((key) => preset2.effects[key] > 1e-4));
2655
+ var HF_COLOR_GRADING_GRADE_PRESETS = HF_COLOR_GRADING_PRESETS.filter((preset2) => !HF_COLOR_GRADING_EFFECT_PRESETS.includes(preset2));
2656
+ var HF_COLOR_GRADING_EFFECT_APPLY_DEFAULTS = {
2657
+ blur: { blur: 0.45 },
2658
+ pixelate: { pixelate: 0.55 },
2659
+ bloom: { bloom: 0.55, bloomRadius: 8 },
2660
+ chromaBleed: { chromaBleed: 0.55 },
2661
+ tapeDamage: {
2662
+ tapeDamage: 0.65,
2663
+ tapeTracking: 0.55,
2664
+ tapeNoise: 0.25,
2665
+ tapeSpeed: 0.5
2666
+ },
2667
+ filmArtifacts: { filmArtifacts: 0.55 },
2668
+ scanlines: { scanlines: 0.35, scanlineCount: 0.17, scanlineSoftness: 1 },
2669
+ chromaticAberration: { chromaticAberration: 0.15, chromaticAngle: 0 },
2670
+ crtCurvature: { crtCurvature: 0.2 },
2671
+ digitalGlitch: {
2672
+ digitalGlitch: 0.55,
2673
+ digitalGlitchColorSplit: 0.25,
2674
+ digitalGlitchLineTear: 0.25,
2675
+ digitalGlitchPixelate: 0.15,
2676
+ digitalGlitchBlockAmount: 0.5,
2677
+ digitalGlitchBlockDisplacement: 0.25,
2678
+ digitalGlitchBlockOpacity: 0,
2679
+ digitalGlitchSpeed: 0.5
2680
+ },
2681
+ halftone: { halftone: 0.94, halftoneSize: 0.36 },
2682
+ twoInkPrint: { twoInkPrint: 1, twoInkPrintSize: 0.42 },
2683
+ ascii: {
2684
+ ascii: 1,
2685
+ asciiSize: 5 / 76,
2686
+ asciiInvert: 0,
2687
+ asciiStyle: 0,
2688
+ asciiColor: 1,
2689
+ asciiRotation: 0
2690
+ },
2691
+ dither: { dither: 1, ditherSize: 0.5 },
2692
+ monoScreen: {
2693
+ monoScreen: 1,
2694
+ monoScreenSize: 0.35,
2695
+ monoScreenAngle: 0.25,
2696
+ monoScreenSpread: 0.3,
2697
+ monoScreenShape: 0,
2698
+ monoScreenInvert: 0
2699
+ },
2700
+ engraving: {
2701
+ engraving: 1,
2702
+ engravingSpacing: 7 / 17,
2703
+ engravingMinThickness: 0.2,
2704
+ engravingMaxThickness: 3.2 / 7,
2705
+ engravingAngle: 0.25,
2706
+ engravingContrast: 7 / 15,
2707
+ engravingSharpness: 0.59,
2708
+ engravingWave: 0.2,
2709
+ engravingWaveFrequency: 2 / 9
2710
+ },
2711
+ crosshatch: {
2712
+ crosshatch: 1,
2713
+ crosshatchSpacing: 7 / 25,
2714
+ crosshatchThickness: 0.25,
2715
+ crosshatchAngle: 0.25,
2716
+ crosshatchContrast: 1 / 3,
2717
+ crosshatchEdges: 0.5,
2718
+ crosshatchLineWeight: 0,
2719
+ crosshatchWave: 0.33,
2720
+ crosshatchWaveFrequency: 2 / 9
2721
+ },
2722
+ kuwahara: {
2723
+ kuwahara: 1,
2724
+ kuwaharaRadius: 1 / 7,
2725
+ kuwaharaSharpness: 5 / 16,
2726
+ kuwaharaSaturation: 0.5
2727
+ }
2728
+ };
2729
+ var HF_COLOR_GRADING_ANIMATABLE_PROPERTIES = [
2730
+ { path: "intensity", name: "--hf-color-grading-intensity", min: 0, max: 1 },
2731
+ { path: "lut.intensity", name: "--hf-color-grading-lut-intensity", min: 0, max: 1 },
2732
+ { path: "adjust.exposure", name: "--hf-color-grading-exposure", min: -2, max: 2 },
2733
+ { path: "effects.blur", name: "--hf-color-grading-blur", min: 0, max: 1 },
2734
+ { path: "effects.bloom", name: "--hf-color-grading-bloom", min: 0, max: 3 },
2735
+ { path: "effects.kuwahara", name: "--hf-color-grading-kuwahara", min: 0, max: 1 },
2736
+ { path: "effects.pixelate", name: "--hf-color-grading-pixelate", min: 0, max: 1 },
2737
+ { path: "effects.ascii", name: "--hf-color-grading-ascii", min: 0, max: 1 },
2738
+ { path: "effects.dither", name: "--hf-color-grading-dither", min: 0, max: 1 }
2739
+ ];
2740
+ function effectLimit(key) {
2741
+ return EFFECT_LIMIT_OVERRIDES[key] ?? UNIT_LIMIT;
2742
+ }
2743
+ var PALETTE_EFFECT_KEYS = /* @__PURE__ */ new Set([
2744
+ "ascii",
2745
+ "dither",
2746
+ "monoScreen",
2747
+ "engraving",
2748
+ "crosshatch"
2749
+ ]);
2750
+ var MULTIPASS_EFFECT_KEYS = /* @__PURE__ */ new Set(["blur", "bloom", "kuwahara"]);
2751
+ function getHfColorGradingCapabilities() {
2752
+ return {
2753
+ version: COLOR_GRADING_CONTRACT_VERSION,
2754
+ targetTags: ["img", "video"],
2755
+ colorSpace: HF_COLOR_GRADING_COLOR_SPACE,
2756
+ intensity: { identity: 1, min: 0, max: 1 },
2757
+ palette: { minColors: 2, maxColors: 6, colorFormat: "#rrggbb" },
2758
+ lut: {
2759
+ format: "3d-cube",
2760
+ maxCubeSize: DEFAULT_MAX_CUBE_LUT_SIZE,
2761
+ intensity: { ...UNIT_LIMIT }
2762
+ },
2763
+ presets: [...HF_COLOR_GRADING_GRADE_PRESETS, ...HF_COLOR_GRADING_EFFECT_PRESETS].map((preset2) => ({
2764
+ id: preset2.id,
2765
+ label: preset2.label,
2766
+ intensity: preset2.intensity
2767
+ })),
2768
+ adjustments: HF_COLOR_GRADING_ADJUST_KEYS.map((key) => ({
2769
+ key,
2770
+ identity: ADJUST_ZERO[key],
2771
+ ...ADJUST_LIMITS[key]
2772
+ })),
2773
+ wheels: {
2774
+ zones: HF_COLOR_GRADING_WHEEL_KEYS,
2775
+ controls: {
2776
+ hue: {
2777
+ identity: 0,
2778
+ unit: "degrees",
2779
+ wrap: true,
2780
+ min: COLOR_GRADING_ADVANCED_LIMITS.hueDegrees.min,
2781
+ maxExclusive: COLOR_GRADING_ADVANCED_LIMITS.hueDegrees.max
2782
+ },
2783
+ amount: { identity: 0, ...WHEEL_LIMITS.amount },
2784
+ level: { identity: 0, ...WHEEL_LIMITS.level }
2785
+ }
2786
+ },
2787
+ curves: {
2788
+ channels: HF_COLOR_GRADING_CURVE_KEYS,
2789
+ input: { min: 0, max: 1 },
2790
+ output: { min: 0, max: 1 },
2791
+ minPoints: 2,
2792
+ maxPoints: COLOR_GRADING_MAX_CURVE_POINTS,
2793
+ implicitEndpoints: true,
2794
+ endpointsCountTowardMax: true
2795
+ },
2796
+ hueCurves: {
2797
+ channels: HF_COLOR_GRADING_HUE_CURVE_KEYS.map((key) => ({
2798
+ key,
2799
+ input: { min: 0, maxExclusive: 360, unit: "degrees", wrap: true },
2800
+ output: HUE_CURVE_LIMITS[key]
2801
+ })),
2802
+ minPoints: 3,
2803
+ maxPoints: COLOR_GRADING_MAX_CURVE_POINTS
2804
+ },
2805
+ secondaries: {
2806
+ max: COLOR_GRADING_MAX_SECONDARIES,
2807
+ hue: {
2808
+ center: {
2809
+ min: COLOR_GRADING_ADVANCED_LIMITS.hueDegrees.min,
2810
+ maxExclusive: COLOR_GRADING_ADVANCED_LIMITS.hueDegrees.max,
2811
+ unit: "degrees",
2812
+ wrap: true
2813
+ },
2814
+ range: { ...COLOR_GRADING_ADVANCED_LIMITS.secondaryHueRange, unit: "degrees" },
2815
+ softness: { ...COLOR_GRADING_ADVANCED_LIMITS.secondaryHueSoftness, unit: "degrees" },
2816
+ rangePlusSoftnessMax: COLOR_GRADING_ADVANCED_LIMITS.secondaryHueCombinedMax
2817
+ },
2818
+ saturation: {
2819
+ min: { ...UNIT_LIMIT },
2820
+ max: { ...UNIT_LIMIT },
2821
+ relation: "min < max",
2822
+ softness: { ...COLOR_GRADING_ADVANCED_LIMITS.secondarySoftRangeSoftness }
2823
+ },
2824
+ luma: {
2825
+ min: { ...UNIT_LIMIT },
2826
+ max: { ...UNIT_LIMIT },
2827
+ relation: "min < max",
2828
+ softness: { ...COLOR_GRADING_ADVANCED_LIMITS.secondarySoftRangeSoftness }
2829
+ },
2830
+ correction: {
2831
+ hueShift: { ...COLOR_GRADING_ADVANCED_LIMITS.secondaryHueShift, unit: "degrees" },
2832
+ saturation: { ...COLOR_GRADING_ADVANCED_LIMITS.signedUnit },
2833
+ luma: { ...COLOR_GRADING_ADVANCED_LIMITS.signedUnit },
2834
+ temperature: { ...COLOR_GRADING_ADVANCED_LIMITS.signedUnit },
2835
+ tint: { ...COLOR_GRADING_ADVANCED_LIMITS.signedUnit }
2836
+ }
2837
+ },
2838
+ effectFamilies: EFFECT_FAMILIES,
2839
+ finishing: HF_COLOR_GRADING_DETAIL_KEYS.map((key) => ({
2840
+ key,
2841
+ identity: DETAIL_DEFAULTS[key],
2842
+ ...DETAIL_LIMITS[key]
2843
+ })),
2844
+ effects: HF_COLOR_GRADING_ACTIVE_EFFECT_KEYS.map((key) => {
2845
+ const apply = HF_COLOR_GRADING_EFFECT_APPLY_DEFAULTS[key];
2846
+ return {
2847
+ key,
2848
+ ...EFFECT_METADATA[key],
2849
+ apply: { ...apply },
2850
+ supportsPalette: PALETTE_EFFECT_KEYS.has(key),
2851
+ renderLane: MULTIPASS_EFFECT_KEYS.has(key) ? "multipass" : "single-pass",
2852
+ controls: HF_COLOR_GRADING_EFFECT_KEYS.filter((control) => Object.hasOwn(apply, control)).map((control) => ({
2853
+ key: control,
2854
+ identity: EFFECT_DEFAULTS[control],
2855
+ recommended: apply[control] ?? EFFECT_DEFAULTS[control],
2856
+ ...effectLimit(control)
2857
+ }))
2858
+ };
2859
+ }),
2860
+ palettes: HF_COLOR_GRADING_PALETTES.map(({ id, label, group, colors }) => ({
2861
+ id,
2862
+ label,
2863
+ group,
2864
+ colors
2865
+ })),
2866
+ animatable: HF_COLOR_GRADING_ANIMATABLE_PROPERTIES
2867
+ };
2868
+ }
2869
+ var EFFECT_PALETTE_COLOR = /^#[0-9a-f]{6}$/i;
2870
+ function normalizePalette(value) {
2871
+ if (!Array.isArray(value) || value.length < 2 || value.length > 6)
2872
+ return null;
2873
+ if (!value.every((color) => typeof color === "string" && EFFECT_PALETTE_COLOR.test(color))) {
2874
+ return null;
2875
+ }
2876
+ return value.map((color) => color.toLowerCase());
2877
+ }
2878
+ function isRecord(value) {
2879
+ return typeof value === "object" && value !== null && !Array.isArray(value);
2880
+ }
2881
+ function clamp(value, min, max) {
2882
+ if (!Number.isFinite(value))
2883
+ return 0;
2884
+ return Math.min(max, Math.max(min, value));
2885
+ }
2886
+ function clampUnit(value, fallback) {
2887
+ const parsed = typeof value === "number" ? value : Number(value);
2888
+ if (!Number.isFinite(parsed))
2889
+ return fallback;
2890
+ return Math.min(1, Math.max(0, parsed));
2891
+ }
2892
+ function readLimitedValue(value, limit) {
2893
+ const parsed = typeof value === "number" ? value : Number(value);
2894
+ if (!Number.isFinite(parsed))
2895
+ return 0;
2896
+ return clamp(parsed, limit.min, limit.max);
2897
+ }
2898
+ function wrapDegrees(value, fallback = 0) {
2899
+ const parsed = typeof value === "number" ? value : Number(value);
2900
+ if (!Number.isFinite(parsed))
2901
+ return fallback;
2902
+ return (parsed % 360 + 360) % 360;
2903
+ }
2904
+ function normalizeWheels(value) {
2905
+ const wheels = isRecord(value) ? value : {};
2906
+ return HF_COLOR_GRADING_WHEEL_KEYS.reduce((result, key) => {
2907
+ const wheel = isRecord(wheels[key]) ? wheels[key] : {};
2908
+ result[key] = {
2909
+ hue: wrapDegrees(wheel.hue, TONAL_WHEEL_DEFAULT.hue),
2910
+ amount: readLimitedValue(wheel.amount ?? TONAL_WHEEL_DEFAULT.amount, WHEEL_LIMITS.amount),
2911
+ level: readLimitedValue(wheel.level ?? TONAL_WHEEL_DEFAULT.level, WHEEL_LIMITS.level)
2912
+ };
2913
+ return result;
2914
+ }, {
2915
+ shadows: { ...TONAL_WHEEL_DEFAULT },
2916
+ midtones: { ...TONAL_WHEEL_DEFAULT },
2917
+ highlights: { ...TONAL_WHEEL_DEFAULT }
2918
+ });
2919
+ }
2920
+ function normalizeCurvePoint(value) {
2921
+ if (!Array.isArray(value) || value.length !== 2)
2922
+ return null;
2923
+ const input = Number(value[0]);
2924
+ const output = Number(value[1]);
2925
+ return Number.isFinite(input) && Number.isFinite(output) ? [clamp(input, 0, 1), clamp(output, 0, 1)] : null;
2926
+ }
2927
+ function hasDuplicateCurveInputs(points) {
2928
+ return points.some((point, index) => index > 0 && point[0] === points[index - 1]?.[0]);
2929
+ }
2930
+ function completeCurveEndpoints(points) {
2931
+ if ((points[0]?.[0] ?? 0) > 0)
2932
+ points.unshift([0, 0]);
2933
+ if ((points.at(-1)?.[0] ?? 1) < 1)
2934
+ points.push([1, 1]);
2935
+ }
2936
+ function normalizeCurve(value) {
2937
+ if (!Array.isArray(value) || value.length < 2)
2938
+ return RGB_CURVE_IDENTITY;
2939
+ const points = [];
2940
+ for (const valuePoint of value) {
2941
+ const point = normalizeCurvePoint(valuePoint);
2942
+ if (!point)
2943
+ return RGB_CURVE_IDENTITY;
2944
+ points.push(point);
2945
+ }
2946
+ points.sort((a, b) => a[0] - b[0]);
2947
+ if (hasDuplicateCurveInputs(points))
2948
+ return RGB_CURVE_IDENTITY;
2949
+ completeCurveEndpoints(points);
2950
+ if (points.length > COLOR_GRADING_MAX_CURVE_POINTS)
2951
+ return RGB_CURVE_IDENTITY;
2952
+ return points;
2953
+ }
2954
+ function normalizeCurves(value) {
2955
+ const curves = isRecord(value) ? value : {};
2956
+ return HF_COLOR_GRADING_CURVE_KEYS.reduce((result, key) => {
2957
+ result[key] = normalizeCurve(curves[key]);
2958
+ return result;
2959
+ }, {
2960
+ master: RGB_CURVE_IDENTITY,
2961
+ red: RGB_CURVE_IDENTITY,
2962
+ green: RGB_CURVE_IDENTITY,
2963
+ blue: RGB_CURVE_IDENTITY
2964
+ });
2965
+ }
2966
+ function normalizeHueCurvePoint(value, limit) {
2967
+ if (!Array.isArray(value) || value.length !== 2)
2968
+ return null;
2969
+ const hue = Number(value[0]);
2970
+ const delta = Number(value[1]);
2971
+ return Number.isFinite(hue) && Number.isFinite(delta) ? [wrapDegrees(hue), clamp(delta, limit.min, limit.max)] : null;
2972
+ }
2973
+ function normalizeHueCurve(value, limit) {
2974
+ if (!Array.isArray(value) || value.length < 3 || value.length > COLOR_GRADING_MAX_CURVE_POINTS) {
2975
+ return HUE_CURVE_IDENTITY;
2976
+ }
2977
+ const points = [];
2978
+ for (const candidate of value) {
2979
+ const point = normalizeHueCurvePoint(candidate, limit);
2980
+ if (!point)
2981
+ return HUE_CURVE_IDENTITY;
2982
+ points.push(point);
2983
+ }
2984
+ points.sort((a, b) => a[0] - b[0]);
2985
+ return hasDuplicateCurveInputs(points) ? HUE_CURVE_IDENTITY : points;
2986
+ }
2987
+ function normalizeHueCurves(value) {
2988
+ const curves = isRecord(value) ? value : {};
2989
+ return HF_COLOR_GRADING_HUE_CURVE_KEYS.reduce((result, key) => {
2990
+ result[key] = normalizeHueCurve(curves[key], HUE_CURVE_LIMITS[key]);
2991
+ return result;
2992
+ }, {
2993
+ hueVsHue: HUE_CURVE_IDENTITY,
2994
+ hueVsSaturation: HUE_CURVE_IDENTITY,
2995
+ hueVsLuma: HUE_CURVE_IDENTITY
2996
+ });
2997
+ }
2998
+ function normalizeSoftRange(value) {
2999
+ const range = isRecord(value) ? value : {};
3000
+ const first = readLimitedValue(range.min ?? SECONDARY_SOFT_RANGE_DEFAULT.min, UNIT_LIMIT);
3001
+ const second = readLimitedValue(range.max ?? SECONDARY_SOFT_RANGE_DEFAULT.max, UNIT_LIMIT);
3002
+ return {
3003
+ min: Math.min(first, second),
3004
+ max: Math.max(first, second),
3005
+ softness: readLimitedValue(range.softness ?? SECONDARY_SOFT_RANGE_DEFAULT.softness, COLOR_GRADING_ADVANCED_LIMITS.secondarySoftRangeSoftness)
3006
+ };
3007
+ }
3008
+ function normalizeSecondaryHue(value) {
3009
+ const hue = isRecord(value) ? value : {};
3010
+ const range = readLimitedValue(hue.range ?? SECONDARY_HUE_DEFAULT.range, COLOR_GRADING_ADVANCED_LIMITS.secondaryHueRange);
3011
+ return {
3012
+ center: wrapDegrees(hue.center, SECONDARY_HUE_DEFAULT.center),
3013
+ range,
3014
+ softness: readLimitedValue(hue.softness ?? SECONDARY_HUE_DEFAULT.softness, {
3015
+ min: COLOR_GRADING_ADVANCED_LIMITS.secondaryHueSoftness.min,
3016
+ max: COLOR_GRADING_ADVANCED_LIMITS.secondaryHueCombinedMax - range
3017
+ })
3018
+ };
3019
+ }
3020
+ function normalizeSecondaryCorrection(value) {
3021
+ return {
3022
+ hueShift: readLimitedValue(value.hueShift ?? 0, COLOR_GRADING_ADVANCED_LIMITS.secondaryHueShift),
3023
+ saturation: readLimitedValue(value.saturation ?? 0, COLOR_GRADING_ADVANCED_LIMITS.signedUnit),
3024
+ luma: readLimitedValue(value.luma ?? 0, COLOR_GRADING_ADVANCED_LIMITS.signedUnit),
3025
+ temperature: readLimitedValue(value.temperature ?? 0, COLOR_GRADING_ADVANCED_LIMITS.signedUnit),
3026
+ tint: readLimitedValue(value.tint ?? 0, COLOR_GRADING_ADVANCED_LIMITS.signedUnit)
3027
+ };
3028
+ }
3029
+ function normalizeSecondary(value) {
3030
+ if (!isRecord(value) || !isRecord(value.key) || !isRecord(value.correction))
3031
+ return null;
3032
+ return {
3033
+ enabled: value.enabled !== false,
3034
+ key: {
3035
+ hue: normalizeSecondaryHue(value.key.hue),
3036
+ saturation: normalizeSoftRange(value.key.saturation),
3037
+ luma: normalizeSoftRange(value.key.luma)
3038
+ },
3039
+ correction: normalizeSecondaryCorrection(value.correction)
3040
+ };
3041
+ }
3042
+ function normalizeSecondaries(value) {
3043
+ if (!Array.isArray(value))
3044
+ return [];
3045
+ const result = [];
3046
+ for (const candidate of value.slice(0, COLOR_GRADING_MAX_SECONDARIES)) {
3047
+ const secondary = normalizeSecondary(candidate);
3048
+ if (secondary)
3049
+ result.push(secondary);
3050
+ }
3051
+ return result;
3052
+ }
3053
+ function normalizePresetId(value) {
3054
+ if (value == null)
3055
+ return null;
3056
+ const preset2 = String(value).trim();
3057
+ return preset2 ? preset2 : null;
3058
+ }
3059
+ function normalizeLut(value) {
3060
+ if (value == null)
3061
+ return null;
3062
+ if (typeof value === "string") {
3063
+ const src = value.trim();
3064
+ return src ? { src, intensity: 1 } : null;
3065
+ }
3066
+ if (!isRecord(value))
3067
+ return null;
3068
+ const rawSrc = value.src;
3069
+ if (typeof rawSrc !== "string" || rawSrc.trim() === "")
3070
+ return null;
3071
+ return {
3072
+ src: rawSrc.trim(),
3073
+ intensity: clampUnit(value.intensity, 1)
3074
+ };
3075
+ }
3076
+ function readColorGradingObject(raw) {
3077
+ if (typeof raw === "string") {
3078
+ const trimmed = raw.trim();
3079
+ if (!trimmed)
3080
+ return null;
3081
+ if (trimmed.startsWith("{")) {
3082
+ try {
3083
+ const parsed = JSON.parse(trimmed);
3084
+ return isRecord(parsed) ? parsed : null;
3085
+ } catch {
3086
+ return null;
3087
+ }
3088
+ }
3089
+ return { preset: trimmed };
3090
+ }
3091
+ return isRecord(raw) ? raw : null;
3092
+ }
3093
+ function resolveStringVariableRef(value, variables) {
3094
+ const match = value.trim().match(VARIABLE_REF_RE);
3095
+ if (!match)
3096
+ return value;
3097
+ const key = match[1] ?? match[2] ?? "";
3098
+ return key && Object.hasOwn(variables, key) ? variables[key] : value;
3099
+ }
3100
+ function resolveHfColorGradingVariables(raw, variables) {
3101
+ if (typeof raw === "string") {
3102
+ const direct = resolveStringVariableRef(raw, variables);
3103
+ if (direct !== raw)
3104
+ return direct;
3105
+ const trimmed = raw.trim();
3106
+ if (!trimmed.startsWith("{"))
3107
+ return raw;
3108
+ try {
3109
+ return resolveHfColorGradingVariables(JSON.parse(trimmed), variables);
3110
+ } catch {
3111
+ return raw;
3112
+ }
3113
+ }
3114
+ if (Array.isArray(raw)) {
3115
+ return raw.map((value) => resolveHfColorGradingVariables(value, variables));
3116
+ }
3117
+ if (!isRecord(raw))
3118
+ return raw;
3119
+ const resolved = {};
3120
+ for (const [key, value] of Object.entries(raw)) {
3121
+ resolved[key] = resolveHfColorGradingVariables(value, variables);
3122
+ }
3123
+ return resolved;
3124
+ }
3125
+ function getHfColorGradingPreset(id) {
3126
+ if (!id)
3127
+ return null;
3128
+ return PRESETS_BY_ID.get(id) ?? null;
3129
+ }
3130
+ function normalizeHfColorGrading(raw) {
3131
+ const grading = readColorGradingObject(raw);
3132
+ if (!grading)
3133
+ return null;
3134
+ if (grading.enabled === false)
3135
+ return null;
3136
+ const presetId = normalizePresetId(grading.preset);
3137
+ const preset2 = getHfColorGradingPreset(presetId);
3138
+ const presetAdjust = preset2?.adjust ?? ADJUST_ZERO;
3139
+ const presetDetails = preset2?.details ?? DETAIL_DEFAULTS;
3140
+ const presetEffects = preset2?.effects ?? EFFECT_DEFAULTS;
3141
+ const rawAdjust = isRecord(grading.adjust) ? grading.adjust : {};
3142
+ const rawDetails = isRecord(grading.details) ? grading.details : {};
3143
+ const rawEffects = isRecord(grading.effects) ? grading.effects : {};
3144
+ const adjust = HF_COLOR_GRADING_ADJUST_KEYS.reduce((result, key) => {
3145
+ result[key] = readLimitedValue(rawAdjust[key] ?? presetAdjust[key], ADJUST_LIMITS[key]);
3146
+ return result;
3147
+ }, { ...ADJUST_ZERO });
3148
+ const details = HF_COLOR_GRADING_DETAIL_KEYS.reduce((result, key) => {
3149
+ result[key] = readLimitedValue(rawDetails[key] ?? presetDetails[key], DETAIL_LIMITS[key]);
3150
+ return result;
3151
+ }, { ...DETAIL_DEFAULTS });
3152
+ const effects = HF_COLOR_GRADING_EFFECT_KEYS.reduce((result, key) => {
3153
+ result[key] = readLimitedValue(rawEffects[key] ?? presetEffects[key], EFFECT_LIMIT_OVERRIDES[key] ?? UNIT_LIMIT);
3154
+ return result;
3155
+ }, { ...EFFECT_DEFAULTS });
3156
+ return {
3157
+ enabled: true,
3158
+ preset: presetId,
3159
+ intensity: clampUnit(grading.intensity, preset2?.intensity ?? 1),
3160
+ adjust,
3161
+ wheels: normalizeWheels(grading.wheels),
3162
+ curves: normalizeCurves(grading.curves),
3163
+ hueCurves: normalizeHueCurves(grading.hueCurves),
3164
+ secondaries: normalizeSecondaries(grading.secondaries),
3165
+ details,
3166
+ effects,
3167
+ palette: normalizePalette(grading.palette),
3168
+ lut: normalizeLut(grading.lut),
3169
+ colorSpace: typeof grading.colorSpace === "string" && grading.colorSpace.trim() ? grading.colorSpace.trim() : HF_COLOR_GRADING_COLOR_SPACE
3170
+ };
3171
+ }
3172
+ function normalizeHfColorGradingWithVariables(raw, variables) {
3173
+ return normalizeHfColorGrading(resolveHfColorGradingVariables(raw, variables));
3174
+ }
3175
+ function hasWheelGrade(wheels) {
3176
+ return HF_COLOR_GRADING_WHEEL_KEYS.some((key) => Math.abs(wheels[key].amount) > 1e-4 || Math.abs(wheels[key].level) > 1e-4);
3177
+ }
3178
+ function hasHfColorGradingRgbCurveValues(curves) {
3179
+ return HF_COLOR_GRADING_CURVE_KEYS.some((key) => curves[key].some(([input, output]) => Math.abs(input - output) > 1e-4));
3180
+ }
3181
+ function hasHfColorGradingHueCurveValues(curves) {
3182
+ return HF_COLOR_GRADING_HUE_CURVE_KEYS.some((key) => curves[key].some(([, delta]) => Math.abs(delta) > 1e-4));
3183
+ }
3184
+ function hasHfColorGradingSecondaryValues(secondaries) {
3185
+ return secondaries.some((secondary) => secondary.enabled && Object.values(secondary.correction).some((value) => Math.abs(value) > 1e-4));
3186
+ }
3187
+ function serializeHfColorGrading(grading) {
3188
+ const normalized = normalizeHfColorGrading(grading);
3189
+ if (!normalized)
3190
+ return "";
3191
+ const { enabled: _enabled, wheels, curves, hueCurves, secondaries, palette, ...serializable } = normalized;
3192
+ return JSON.stringify({
3193
+ ...serializable,
3194
+ ...hasWheelGrade(wheels) ? { wheels } : {},
3195
+ ...hasHfColorGradingRgbCurveValues(curves) ? { curves } : {},
3196
+ ...hasHfColorGradingHueCurveValues(hueCurves) ? { hueCurves } : {},
3197
+ // Preserve a keyed secondary even before it changes pixels so Studio and
3198
+ // CLI can author its qualifier and correction in separate transactions.
3199
+ ...secondaries.length > 0 ? { secondaries } : {},
3200
+ ...palette ? { palette } : {}
3201
+ });
3202
+ }
3203
+ function isHfColorGradingActive(grading) {
3204
+ if (!grading?.enabled)
3205
+ return false;
3206
+ const hasIndependentTreatment = Math.abs(grading.details.vignette) > 1e-4 || Math.abs(grading.details.grain) > 1e-4 || HF_COLOR_GRADING_ACTIVE_EFFECT_KEYS.some((key) => Math.abs(grading.effects[key]) > 1e-4);
3207
+ if (hasIndependentTreatment)
3208
+ return true;
3209
+ if (grading.intensity === 0)
3210
+ return false;
3211
+ if (grading.lut && grading.lut.intensity !== 0)
3212
+ return true;
3213
+ return HF_COLOR_GRADING_ADJUST_KEYS.some((key) => Math.abs(grading.adjust[key]) > 1e-4) || (grading.wheels ? hasWheelGrade(grading.wheels) : false) || (grading.curves ? hasHfColorGradingRgbCurveValues(grading.curves) : false) || (grading.hueCurves ? hasHfColorGradingHueCurveValues(grading.hueCurves) : false) || (grading.secondaries ? hasHfColorGradingSecondaryValues(grading.secondaries) : false);
3214
+ }
3215
+ function hasHfColorGradingAuthoredValues(grading) {
3216
+ if (!grading)
3217
+ return false;
3218
+ if (grading.secondaries?.length)
3219
+ return true;
3220
+ return isHfColorGradingActive(grading);
3221
+ }
3222
+
3223
+ // ../core/dist/generated/runtime-inline.js
3224
+ var RUNTIME_IIFE = '"use strict";(()=>{var yx=Object.create;var La=Object.defineProperty;var Sx=Object.getOwnPropertyDescriptor;var vx=Object.getOwnPropertyNames;var Ex=Object.getPrototypeOf,Ax=Object.prototype.hasOwnProperty;var _x=(e,t,n)=>t in e?La(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var fe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var wx=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of vx(t))!Ax.call(e,i)&&i!==n&&La(e,i,{get:()=>t[i],enumerable:!(r=Sx(t,i))||r.enumerable});return e};var Cx=(e,t,n)=>(n=e!=null?yx(Ex(e)):{},wx(t||!e||!e.__esModule?La(n,"default",{value:e,enumerable:!0}):n,e));var ue=(e,t,n)=>_x(e,typeof t!="symbol"?t+"":t,n);var Cm=fe((bN,Qs)=>{var oe=String,wm=function(){return{isColorSupported:!1,reset:oe,bold:oe,dim:oe,italic:oe,underline:oe,inverse:oe,hidden:oe,strikethrough:oe,black:oe,red:oe,green:oe,yellow:oe,blue:oe,magenta:oe,cyan:oe,white:oe,gray:oe,bgBlack:oe,bgRed:oe,bgGreen:oe,bgYellow:oe,bgBlue:oe,bgMagenta:oe,bgCyan:oe,bgWhite:oe,blackBright:oe,redBright:oe,greenBright:oe,yellowBright:oe,blueBright:oe,magentaBright:oe,cyanBright:oe,whiteBright:oe,bgBlackBright:oe,bgRedBright:oe,bgGreenBright:oe,bgYellowBright:oe,bgBlueBright:oe,bgMagentaBright:oe,bgCyanBright:oe,bgWhiteBright:oe}};Qs.exports=wm();Qs.exports.createColors=wm});var Zs=fe(()=>{});var vo=fe((SN,km)=>{"use strict";var Tm=Cm(),Rm=Zs(),Gr=class e extends Error{constructor(t,n,r,i,o,a){super(t),this.name="CssSyntaxError",this.reason=t,o&&(this.file=o),i&&(this.source=i),a&&(this.plugin=a),typeof n<"u"&&typeof r<"u"&&(typeof n=="number"?(this.line=n,this.column=r):(this.line=n.line,this.column=n.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,e)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(t){if(!this.source)return"";let n=this.source;t==null&&(t=Tm.isColorSupported);let r=d=>d,i=d=>d,o=d=>d;if(t){let{bold:d,gray:m,red:f}=Tm.createColors(!0);i=b=>d(f(b)),r=b=>m(b),Rm&&(o=b=>Rm(b))}let a=n.split(/\\r?\\n/),l=Math.max(this.line-3,0),s=Math.min(this.line+2,a.length),u=String(s).length;return a.slice(l,s).map((d,m)=>{let f=l+1+m,b=" "+(" "+f).slice(-u)+" | ";if(f===this.line){if(d.length>160){let y=20,x=Math.max(0,this.column-y),v=Math.max(this.column+y,this.endColumn+y),_=d.slice(x,v),w=r(b.replace(/\\d/g," "))+d.slice(0,Math.min(this.column-1,y-1)).replace(/[^\\t]/g," ");return i(">")+r(b)+o(_)+`\n `+w+i("^")}let p=r(b.replace(/\\d/g," "))+d.slice(0,this.column-1).replace(/[^\\t]/g," ");return i(">")+r(b)+o(d)+`\n `+p+i("^")}return" "+r(b)+o(d)}).join(`\n`)}toString(){let t=this.showSourceCode();return t&&(t=`\n\n`+t+`\n`),this.name+": "+this.message+t}};km.exports=Gr;Gr.default=Gr});var el=fe((vN,Dm)=>{"use strict";var hv=/(<)(\\/?style\\b)/gi,gv=/(<)(!--)/g,bv=/[\\t\\n\\f\\r "#\'()/;[\\\\\\]{}]/;function it(e){return typeof e!="string"||!e.includes("<")?e:e.replace(hv,"\\\\3c $2").replace(gv,"\\\\3c $2")}var Mm={after:`\n`,beforeClose:`\n`,beforeComment:`\n`,beforeDecl:`\n`,beforeOpen:" ",beforeRule:`\n`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function xv(e){return e[0].toUpperCase()+e.slice(1)}function Nm(e,t){let n="@"+t.name,r=t.params?e.rawValue(t,"params"):"",i=t.raws.afterName;return typeof i>"u"?i=r?" ":"":i===""&&r&&!bv.test(r[0])&&(i=" "),n+i+r}function yv(e){if(!e.prop.startsWith("--"))return!1;let t=e.raws.before;return typeof t>"u"||!/\\S$/.test(t)}function Fm(e,t,n){let r=n.nodes,i=r.length-1;for(;i>0&&r[i].type==="comment";)i-=1;let o=e.raw(n,"semicolon"),a=n.type==="document";for(let l=r.length-1;l>=0;l--){let s=r[l],u=i!==l||o;!u&&l<r.length-1&&(s.type==="atrule"&&!s.nodes||s.type==="decl"&&yv(s))&&(u=!0),t.push({document:a,node:s,semicolon:u})}}function Lm(e,t,n,r){let i=e.raw(n,"between","beforeOpen");e.builder(it(r+i)+"{",n,"start");let o=n.nodes&&n.nodes.length,a=()=>{let l=o?e.raw(n,"after"):e.raw(n,"after","emptyBody");l&&e.builder(it(l)),e.builder("}",n,"end"),n.type==="rule"&&n.raws.ownSemicolon&&e.builder(it(n.raws.ownSemicolon),n,"end")};o?(t.push(a),Fm(e,t,n)):a()}var Br=class e{constructor(t){this.builder=t}atrule(t,n){let r=Nm(this,t);if(t.nodes)this.block(t,r);else{let i=(t.raws.between||"")+(n?";":"");this.builder(it(r+i),t)}}beforeAfter(t,n){let r;t.type==="decl"?r=this.raw(t,null,"beforeDecl"):t.type==="comment"?r=this.raw(t,null,"beforeComment"):n==="before"?r=this.raw(t,null,"beforeRule"):r=this.raw(t,null,"beforeClose");let i=t.parent,o=0;for(;i&&i.type!=="root";)o+=1,i=i.parent;if(r.includes(`\n`)){let a=this.raw(t,null,"indent");if(a.length)for(let l=0;l<o;l++)r+=a}return r}block(t,n){let r=this.raw(t,"between","beforeOpen");this.builder(it(n+r)+"{",t,"start");let i;t.nodes&&t.nodes.length?(this.body(t),i=this.raw(t,"after")):i=this.raw(t,"after","emptyBody"),i&&this.builder(it(i)),this.builder("}",t,"end")}body(t){let n=e.prototype,r=["atrule","block","body","rule","stringify"].every(o=>this[o]===n[o]),i=[];for(Fm(this,i,t);i.length>0;){let o=i.pop();if(typeof o=="function"){o();continue}let a=o.node,l=this.raw(a,"before");l&&this.builder(o.document?l:it(l)),r&&a.type==="rule"?Lm(this,i,a,this.rawValue(a,"selector")):r&&a.type==="atrule"&&a.nodes?Lm(this,i,a,Nm(this,a)):this.stringify(a,o.semicolon)}}comment(t){let n=this.raw(t,"left","commentLeft"),r=this.raw(t,"right","commentRight");this.builder(it("/*"+n+t.text+r+"*/"),t)}decl(t,n){let r=t.raws,i=this.raw(t,"between","colon"),o=t.prop+i+this.rawValue(t,"value");t.important&&(o+=r.important||" !important"),n&&(o+=";"),this.builder(it(o),t)}document(t){this.body(t)}raw(t,n,r){let i;if(r||(r=n),n&&(i=t.raws[n],typeof i<"u"))return i;let o=t.parent;if(r==="before"&&(!o||o.type==="root"&&o.first===t||o&&o.type==="document"))return"";if(!o)return Mm[r];let a=t.root(),l=a.rawCache||(a.rawCache={});if(typeof l[r]<"u")return l[r];if(r==="before"||r==="after")return this.beforeAfter(t,r);{let s="raw"+xv(r);this[s]?i=this[s](a,t):a.walk(u=>{if(i=u.raws[n],typeof i<"u")return!1})}return typeof i>"u"&&(i=Mm[r]),l[r]=i,i}rawBeforeClose(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return n=r.raws.after,n.includes(`\n`)&&(n=n.replace(/[^\\n]+$/,"")),!1}),n&&(n=n.replace(/\\S/g,"")),n}rawBeforeComment(t,n){let r;return t.walkComments(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`\n`)&&(r=r.replace(/[^\\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(n,null,"beforeDecl"):r&&(r=r.replace(/\\S/g,"")),r}rawBeforeDecl(t,n){let r;return t.walkDecls(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`\n`)&&(r=r.replace(/[^\\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(n,null,"beforeRule"):r&&(r=r.replace(/\\S/g,"")),r}rawBeforeOpen(t){let n;return t.walk(r=>{if(r.type!=="decl"&&(n=r.raws.between,typeof n<"u"))return!1}),n}rawBeforeRule(t){let n;return t.walk(r=>{if(r.nodes&&(r.parent!==t||t.first!==r)&&typeof r.raws.before<"u")return n=r.raws.before,n.includes(`\n`)&&(n=n.replace(/[^\\n]+$/,"")),!1}),n&&(n=n.replace(/\\S/g,"")),n}rawColon(t){let n;return t.walkDecls(r=>{if(typeof r.raws.between<"u")return n=r.raws.between.replace(/[^\\s:]/g,""),!1}),n}rawEmptyBody(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length===0&&(n=r.raws.after,typeof n<"u"))return!1}),n}rawIndent(t){if(t.raws.indent)return t.raws.indent;let n;return t.walk(r=>{let i=r.parent;if(i&&i!==t&&i.parent&&i.parent===t&&typeof r.raws.before<"u"){let o=r.raws.before.split(`\n`);return n=o[o.length-1],n=n.replace(/\\S/g,""),!1}}),n}rawSemicolon(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(n=r.raws.semicolon,typeof n<"u"))return!1}),n}rawValue(t,n){let r=t[n],i=t.raws[n];return i&&i.value===r?i.raw:r}root(t){if(t.source&&t.source.input.hasBOM&&this.builder("\\uFEFF",t,"start"),this.body(t),t.raws.after){let n=t.raws.after,r=t.parent&&t.parent.type==="document";this.builder(r?n:it(n))}}rule(t){this.block(t,this.rawValue(t,"selector")),t.raws.ownSemicolon&&this.builder(it(t.raws.ownSemicolon),t,"end")}stringify(t,n){if(!this[t.type])throw new Error("Unknown AST node type "+t.type+". Maybe you need to change PostCSS stringifier.");this[t.type](t,n)}};Dm.exports=Br;Br.default=Br});var Ur=fe((EN,Im)=>{"use strict";var Sv=el();function tl(e,t){new Sv(t).stringify(e)}Im.exports=tl;tl.default=tl});var Wr=fe((AN,nl)=>{"use strict";nl.exports.isClean=Symbol("isClean");nl.exports.my=Symbol("my")});var zr=fe((_N,Pm)=>{"use strict";var vv=vo(),Ev=el(),Av=Ur(),{isClean:Vr,my:_v}=Wr();function wv(e,t){let n=new e.constructor,r=[[e,n,t]];for(;r.length>0;){let[i,o,a]=r.pop();for(let l in i){if(!Object.prototype.hasOwnProperty.call(i,l)||l==="proxyCache")continue;let s=i[l],u=typeof s;if(l==="parent"&&u==="object")a&&(o[l]=a);else if(l==="source")o[l]=s;else if(Array.isArray(s)){let d=[];o[l]=d;for(let m of s){let f=new m.constructor;d.push(f),r.push([m,f,o])}}else{if(u==="object"&&s!==null){let d=new s.constructor;r.push([s,d,void 0]),s=d}o[l]=s}}}return n}function bt(e,t){if(t&&typeof t.offset<"u")return t.offset;let n=1,r=1,i=0;for(let o=0;o<e.length;o++){if(r===t.line&&n===t.column){i=o;break}e[o]===`\n`?(n=1,r+=1):n+=1}return i}var $r=class e{get proxyOf(){return this}constructor(t={}){this.raws={},this[Vr]=!1,this[_v]=!0;for(let n of Object.keys(t))if(n!=="__proto__")if(n==="nodes"){this.nodes=[];for(let r of t[n])typeof r.clone=="function"&&r.parent?this.append(r.clone()):this.append(r)}else this[n]=t[n]}addToError(t){if(t.postcssNode=this,t.stack&&this.source&&/\\n\\s{4}at /.test(t.stack)){let n=this.source;t.stack=t.stack.replace(/\\n\\s{4}at /,`$&${n.input.from}:${n.start.line}:${n.start.column}$&`)}return t}after(t){return this.parent.insertAfter(this,t),this}assign(t={}){for(let n in t)this[n]=t[n];return this}before(t){return this.parent.insertBefore(this,t),this}cleanRaws(t){delete this.raws.before,delete this.raws.after,t||delete this.raws.between}clone(t={}){let n=wv(this);for(let r in t)n[r]=t[r];return n}cloneAfter(t={}){let n=this.clone(t);return this.parent.insertAfter(this,n),n}cloneBefore(t={}){let n=this.clone(t);return this.parent.insertBefore(this,n),n}error(t,n={}){if(this.source){let{end:r,start:i}=this.rangeBy(n);return this.source.input.error(t,{column:i.column,line:i.line},{column:r.column,line:r.line},n)}return new vv(t)}getProxyProcessor(){return{get(t,n){return n==="proxyOf"?t:n==="root"?()=>t.root().toProxy():t[n]},set(t,n,r){return t[n]===r||(t[n]=r,(n==="prop"||n==="value"||n==="name"||n==="params"||n==="important"||n==="text")&&t.markDirty()),!0}}}markClean(){this[Vr]=!0}markDirty(){if(this[Vr]){this[Vr]=!1;let t=this;for(;t=t.parent;)t[Vr]=!1}}next(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t+1]}positionBy(t={}){let n="document"in this.source.input?this.source.input.document:this.source.input.css,r={column:this.source.start.column,line:this.source.start.line,offset:bt(n,this.source.start)};if(t.index)r=this.positionInside(t.index);else if(t.word){let o=n.slice(bt(n,this.source.start),bt(n,this.source.end)).indexOf(t.word);o!==-1&&(r=this.positionInside(o))}return r}positionInside(t){let n=this.source.start.column,r=this.source.start.line,i="document"in this.source.input?this.source.input.document:this.source.input.css,o=bt(i,this.source.start),a=o+t;for(let l=o;l<a;l++)i[l]===`\n`?(n=1,r+=1):n+=1;return{column:n,line:r,offset:a}}prev(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t-1]}rangeBy(t={}){let n="document"in this.source.input?this.source.input.document:this.source.input.css,r={column:this.source.start.column,line:this.source.start.line,offset:bt(n,this.source.start)},i=this.source.end?{column:this.source.end.column+1,line:this.source.end.line,offset:typeof this.source.end.offset=="number"?this.source.end.offset:bt(n,this.source.end)+1}:{column:r.column+1,line:r.line,offset:r.offset+1};if(t.word){let a=n.slice(bt(n,this.source.start),bt(n,this.source.end)).indexOf(t.word);a!==-1&&(r=this.positionInside(a),i=this.positionInside(a+t.word.length))}else t.start?r={column:t.start.column,line:t.start.line,offset:bt(n,t.start)}:typeof t.index=="number"&&(r=this.positionInside(t.index)),t.end?i={column:t.end.column,line:t.end.line,offset:bt(n,t.end)}:typeof t.endIndex=="number"?i=this.positionInside(t.endIndex):typeof t.index=="number"&&(i=this.positionInside(t.index+1));return(i.line<r.line||i.line===r.line&&i.column<=r.column)&&(i={column:r.column+1,line:r.line,offset:r.offset+1}),{end:i,start:r}}raw(t,n){return new Ev().raw(this,t,n)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...t){if(this.parent){let n=this,r=!1;for(let i of t)i===this?r=!0:r?(this.parent.insertAfter(n,i),n=i):this.parent.insertBefore(n,i);r||this.remove()}return this}root(){let t=this;for(;t.parent&&t.parent.type!=="document";)t=t.parent;return t}toJSON(t,n){let r=n==null;n=n||new Map;let i=[],o=[[this,i,0]];for(let l=0;l<o.length;l++){let[s,u,d]=o[l],m={};u[d]=m;for(let f in s){if(!Object.prototype.hasOwnProperty.call(s,f)||f==="parent"||f==="proxyCache")continue;let b=s[f];if(Array.isArray(b)){let p=[];m[f]=p;for(let y=0;y<b.length;y++){let x=b[y];typeof x=="object"&&x.toJSON?x.toJSON===e.prototype.toJSON?o.push([x,p,y]):p[y]=x.toJSON(null,n):p[y]=x}}else if(typeof b=="object"&&b.toJSON)b.toJSON===e.prototype.toJSON?o.push([b,m,f]):m[f]=b.toJSON(null,n);else if(f==="source"){if(b==null)continue;let p=n.get(b.input);p==null&&(p=n.size,n.set(b.input,p)),m[f]={end:b.end,inputId:p,start:b.start}}else m[f]=b}}let a=i[0];return r&&(a.inputs=[...n.keys()].map(l=>l.toJSON())),a}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=Av){t.stringify&&(t=t.stringify);let n="";return t(this,r=>{n+=r}),n}warn(t,n,r={}){let i={node:this};for(let o in r)i[o]=r[o];return t.warn(n,i)}};Pm.exports=$r;$r.default=$r});var jr=fe((wN,Om)=>{"use strict";var Cv=zr(),qr=class extends Cv{constructor(t){super(t),this.type="comment"}};Om.exports=qr;qr.default=qr});var Xr=fe((CN,Hm)=>{"use strict";var Tv=zr(),Kr=class extends Tv{get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}constructor(t){t&&typeof t.value<"u"&&typeof t.value!="string"&&(t={...t,value:String(t.value)}),super(t),this.type="decl"}};Hm.exports=Kr;Kr.default=Kr});var Mt=fe((TN,qm)=>{"use strict";var Bm=jr(),Um=Xr(),Gm=zr(),{isClean:Wm,my:Vm}=Wr(),rl,$m,zm,il;function Rv(e){let t=e.slice();for(;t.length>0;){let n=t.pop();if(delete n.source,n.nodes){n.nodes=n.nodes.slice();for(let r of n.nodes)t.push(r)}}return e.slice()}function kv(e){let t=[e];for(;t.length>0;){let n=t.pop();if(n[Wm]=!1,n.proxyOf.nodes)for(let r of n.proxyOf.nodes)t.push(r)}}var xt=class e extends Gm{get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}append(...t){for(let n of t){let r=this.normalize(n,this.last);for(let i of r)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(t){let n=[this];for(;n.length>0;){let r=n.pop();if(r!==this&&r.cleanRaws!==e.prototype.cleanRaws){r.cleanRaws(t);continue}if(Gm.prototype.cleanRaws.call(r,t),r.nodes)for(let i of r.nodes)n.push(i)}}each(t){if(!this.proxyOf.nodes)return;let n=this.getIterator(),r,i;for(;this.indexes[n]<this.proxyOf.nodes.length&&(r=this.indexes[n],i=t(this.proxyOf.nodes[r],r),i!==!1);)this.indexes[n]+=1;return delete this.indexes[n],i}every(t){return this.nodes.every(t)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let t=this.lastEach;return this.indexes[t]=0,t}getProxyProcessor(){return{get(t,n){return n==="proxyOf"?t:t[n]?n==="each"||typeof n=="string"&&n.startsWith("walk")?(...r)=>t[n](...r.map(i=>typeof i=="function"?(o,a)=>i(o.toProxy(),a):i)):n==="every"||n==="some"?r=>t[n]((i,...o)=>r(i.toProxy(),...o)):n==="root"?()=>t.root().toProxy():n==="nodes"?t.nodes.map(r=>r.toProxy()):n==="first"||n==="last"?t[n].toProxy():t[n]:t[n]},set(t,n,r){return t[n]===r||(t[n]=r,(n==="name"||n==="params"||n==="selector")&&t.markDirty()),!0}}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,n){let r=this.index(t),i=this.normalize(n,this.proxyOf.nodes[r]).reverse();r=this.index(t);for(let a of i)this.proxyOf.nodes.splice(r+1,0,a);let o;for(let a in this.indexes)o=this.indexes[a],r<o&&(this.indexes[a]=o+i.length);return this.markDirty(),this}insertBefore(t,n){let r=this.index(t),i=r===0?"prepend":!1,o=this.normalize(n,this.proxyOf.nodes[r],i).reverse();r=this.index(t);for(let l of o)this.proxyOf.nodes.splice(r,0,l);let a;for(let l in this.indexes)a=this.indexes[l],r<=a&&(this.indexes[l]=a+o.length);return this.markDirty(),this}normalize(t,n){if(typeof t=="string")t=Rv($m(t).nodes);else if(typeof t>"u")t=[];else if(Array.isArray(t)){t=t.slice(0);for(let i of t)i.parent&&i.parent.removeChild(i,"ignore")}else if(t.type==="root"&&this.type!=="document"){t=t.nodes.slice(0);for(let i of t)i.parent&&i.parent.removeChild(i,"ignore")}else if(t.type)t=[t];else if(t.prop){if(typeof t.value>"u")throw new Error("Value field is missed in node creation");typeof t.value!="string"&&(t.value=String(t.value)),t=[new Um(t)]}else if(t.selector||t.selectors)t=[new il(t)];else if(t.name)t=[new rl(t)];else if(t.text)t=[new Bm(t)];else throw new Error("Unknown node type in node creation");return t.map(i=>(i[Vm]||e.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[Wm]&&kv(i),i.raws||(i.raws={}),typeof i.raws.before>"u"&&n&&typeof n.raws.before<"u"&&(i.raws.before=n.raws.before.replace(/\\S/g,"")),i.parent=this.proxyOf,i))}prepend(...t){t=t.reverse();for(let n of t){let r=this.normalize(n,this.first,"prepend").reverse();for(let i of r)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+r.length}return this.markDirty(),this}push(t){return t.parent=this,this.proxyOf.nodes.push(t),this}removeAll(){for(let t of this.proxyOf.nodes)t.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(t){t=this.index(t),this.proxyOf.nodes[t].parent=void 0,this.proxyOf.nodes.splice(t,1);let n;for(let r in this.indexes)n=this.indexes[r],n>=t&&(this.indexes[r]=n-1);return this.markDirty(),this}replaceValues(t,n,r){return r||(r=n,n={}),this.walkDecls(i=>{n.props&&!n.props.includes(i.prop)||n.fast&&!i.value.includes(n.fast)||(i.value=i.value.replace(t,r))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){if(!this.proxyOf.nodes)return;let n=[{iterator:this.getIterator(),node:this.proxyOf}];for(;n.length>0;){let{iterator:r,node:i}=n[n.length-1],o=i.indexes[r];if(o>=i.proxyOf.nodes.length){delete i.indexes[r],n.pop();let s=n[n.length-1];s&&(s.node.indexes[s.iterator]+=1);continue}let a=i.proxyOf.nodes[o],l;try{l=t(a,o)}catch(s){throw a.addToError(s)}if(l===!1){for(let s of n)delete s.node.indexes[s.iterator];return!1}a.walk&&a.proxyOf.nodes?n.push({iterator:a.getIterator(),node:a}):i.indexes[r]+=1}}walkAtRules(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="atrule"&&t.test(r.name))return n(r,i)}):this.walk((r,i)=>{if(r.type==="atrule"&&r.name===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="atrule")return n(r,i)}))}walkComments(t){return this.walk((n,r)=>{if(n.type==="comment")return t(n,r)})}walkDecls(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="decl"&&t.test(r.prop))return n(r,i)}):this.walk((r,i)=>{if(r.type==="decl"&&r.prop===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="decl")return n(r,i)}))}walkRules(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="rule"&&t.test(r.selector))return n(r,i)}):this.walk((r,i)=>{if(r.type==="rule"&&r.selector===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="rule")return n(r,i)}))}};xt.registerParse=e=>{$m=e};xt.registerRule=e=>{il=e};xt.registerAtRule=e=>{rl=e};xt.registerRoot=e=>{zm=e};qm.exports=xt;xt.default=xt;xt.rebuild=e=>{let t=[e];for(;t.length>0;){let n=t.pop();if(n.type==="atrule"?Object.setPrototypeOf(n,rl.prototype):n.type==="rule"?Object.setPrototypeOf(n,il.prototype):n.type==="decl"?Object.setPrototypeOf(n,Um.prototype):n.type==="comment"?Object.setPrototypeOf(n,Bm.prototype):n.type==="root"&&Object.setPrototypeOf(n,zm.prototype),n[Vm]=!0,n.nodes)for(let r of n.nodes)t.push(r)}}});var Eo=fe((RN,Km)=>{"use strict";var jm=Mt(),Wn=class extends jm{constructor(t){super(t),this.type="atrule"}append(...t){return this.proxyOf.nodes||(this.nodes=[]),super.append(...t)}prepend(...t){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...t)}};Km.exports=Wn;Wn.default=Wn;jm.registerAtRule(Wn)});var Ao=fe((kN,Jm)=>{"use strict";var Mv=Mt(),Xm,Ym,gn=class extends Mv{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new Xm(new Ym,this,t).stringify()}};gn.registerLazyResult=e=>{Xm=e};gn.registerProcessor=e=>{Ym=e};Jm.exports=gn;gn.default=gn});var Zm=fe((MN,Qm)=>{var Nv="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Lv=(e,t=21)=>(n=t)=>{let r="",i=n|0;for(;i-- >0;)r+=e[Math.random()*e.length|0];return r},Fv=(e=21)=>{let t="",n=e|0;for(;n-- >0;)t+=Nv[Math.random()*64|0];return t};Qm.exports={nanoid:Fv,customAlphabet:Lv}});var _o=fe(()=>{});var wo=fe(()=>{});var ol=fe(()=>{});var ep=fe(()=>{});var al=fe((GN,ip)=>{"use strict";var{existsSync:Dv,readFileSync:Iv,realpathSync:Pv}=ep(),{dirname:Co,isAbsolute:Ov,join:Hv,relative:Gv,sep:Bv}=_o(),{SourceMapConsumer:tp,SourceMapGenerator:np}=wo();function rp(e){try{return Pv(e)}catch{return e}}function Uv(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var Yr=class{constructor(t,n){if(n.map===!1)return;n.unsafeMap&&(this.unsafeMap=!0),this.loadAnnotation(t),this.inline=this.startWith(this.annotation,"data:");let r=n.map?n.map.prev:void 0,i=this.loadMap(n.from,r);!this.mapFile&&n.from&&(this.mapFile=n.from),this.mapFile&&(this.root=Co(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new tp(this.json||this.text)),this.consumerCache}decodeInline(t){let n=/^data:application\\/json;charset=utf-?8;base64,/,r=/^data:application\\/json;base64,/,i=/^data:application\\/json;charset=utf-?8,/,o=/^data:application\\/json,/,a=t.match(i)||t.match(o);if(a)return decodeURIComponent(t.substr(a[0].length));let l=t.match(n)||t.match(r);if(l)return Uv(t.substr(l[0].length));let s=t.slice(22);throw s=s.slice(0,s.indexOf(",")),new Error("Unsupported source map encoding "+s)}getAnnotationURL(t){return t.replace(/^\\/\\*\\s*# sourceMappingURL=/,"").trim()}isMap(t){return typeof t!="object"?!1:typeof t.mappings=="string"||typeof t._mappings=="string"||Array.isArray(t.sections)}loadAnnotation(t){let n=t.match(/\\/\\*\\s*# sourceMappingURL=/g);if(!n)return;let r=t.lastIndexOf(n.pop()),i=t.indexOf("*/",r);r>-1&&i>-1&&(this.annotation=this.getAnnotationURL(t.substring(r,i)))}loadFile(t,n,r){if(!r&&!this.unsafeMap){if(!/\\.map$/i.test(t)||!n)return;let i=Gv(rp(Co(n)),rp(t));if(i===".."||i.startsWith(".."+Bv)||Ov(i))return}if(this.root=Co(t),Dv(t))return this.mapFile=t,Iv(t,"utf-8").toString().trim()}loadMap(t,n){if(n===!1)return!1;if(n){if(typeof n=="string")return n;if(typeof n=="function"){let r=n(t);if(r){let i=this.loadFile(r,t,!0);if(!i)throw new Error("Unable to load previous source map: "+r.toString());return i}}else{if(n instanceof tp)return np.fromSourceMap(n).toString();if(n instanceof np)return n.toString();if(this.isMap(n))return JSON.stringify(n);throw new Error("Unsupported previous source map format: "+n.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;t&&(r=Hv(Co(t),r));let i=this.loadFile(r,t,!1);if(i)try{this.json=JSON.parse(i.replace(/^\\)]}\'[^\\n]*\\n/,""))}catch{return}return i}}}startWith(t,n){return t?t.substr(0,n.length)===n:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};ip.exports=Yr;Yr.default=Yr});var Jr=fe((BN,up)=>{"use strict";var{nanoid:Wv}=Zm(),{isAbsolute:ul,resolve:cl}=_o(),{SourceMapConsumer:Vv,SourceMapGenerator:$v}=wo(),{fileURLToPath:op,pathToFileURL:To}=ol(),ap=vo(),zv=al(),sl=Zs(),ll=Symbol("lineToIndexCache"),qv=!!(Vv&&$v),sp=!!(cl&&ul);function lp(e){if(e[ll])return e[ll];let t=e.css.split(`\n`),n=new Array(t.length),r=0;for(let i=0,o=t.length;i<o;i++)n[i]=r,r+=t[i].length+1;return e[ll]=n,n}var Vn=class{get from(){return this.file||this.id}constructor(t,n={}){if(t===null||typeof t>"u"||typeof t=="object"&&!t.toString)throw new Error(`PostCSS received ${t} instead of CSS string`);if(this.css=t.toString(),this.css[0]==="\\uFEFF"||this.css[0]==="\\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,this.document=this.css,n.document&&(this.document=n.document.toString()),n.from&&(!sp||/^\\w+:\\/\\//.test(n.from)||ul(n.from)?this.file=n.from:this.file=cl(n.from)),sp&&qv){let r=new zv(this.css,n);if(r.text){this.map=r;let i=r.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+Wv(6)+">"),this.map&&(this.map.file=this.from)}error(t,n,r,i={}){let o,a,l,s,u;if(n&&typeof n=="object"){let m=n,f=r;if(typeof m.offset=="number"){s=m.offset;let b=this.fromOffset(s);n=b.line,r=b.col}else n=m.line,r=m.column,s=this.fromLineAndColumn(n,r);if(typeof f.offset=="number"){l=f.offset;let b=this.fromOffset(l);a=b.line,o=b.col}else a=f.line,o=f.column,l=this.fromLineAndColumn(f.line,f.column)}else if(r)s=this.fromLineAndColumn(n,r);else{s=n;let m=this.fromOffset(s);n=m.line,r=m.col}let d=this.origin(n,r,a,o);return d?u=new ap(t,d.endLine===void 0?d.line:{column:d.column,line:d.line},d.endLine===void 0?d.column:{column:d.endColumn,line:d.endLine},d.source,d.file,i.plugin):u=new ap(t,a===void 0?n:{column:r,line:n},a===void 0?r:{column:o,line:a},this.css,this.file,i.plugin),u.input={column:r,endColumn:o,endLine:a,endOffset:l,line:n,offset:s,source:this.css},this.file&&(To&&(u.input.url=To(this.file).toString()),u.input.file=this.file),u}fromLineAndColumn(t,n){return lp(this)[t-1]+n-1}fromOffset(t){let n=lp(this),r=n[n.length-1],i=0;if(t>=r)i=n.length-1;else{let o=n.length-2,a;for(;i<o;)if(a=i+(o-i>>1),t<n[a])o=a-1;else if(t>=n[a+1])i=a+1;else{i=a;break}}return{col:t-n[i]+1,line:i+1}}mapResolve(t){return/^\\w+:\\/\\//.test(t)?t:cl(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,n,r,i){if(!this.map)return!1;let o=this.map.consumer(),a=o.originalPositionFor({column:n-1,line:t});if(!a.source)return!1;let l;if(typeof r=="number"){let m=o.originalPositionFor({column:i-1,line:r});m.source&&(l=m)}let s;ul(a.source)?s=To(a.source):s=new URL(a.source,this.map.consumer().sourceRoot||To(this.map.mapFile));let u={column:a.column+1,endColumn:l&&l.column+1,endLine:l&&l.line,line:a.line,url:s.toString()};if(s.protocol==="file:")if(op)u.file=op(s);else throw new Error("file: protocol is not available in this PostCSS build");let d=o.sourceContentFor(a.source);return d&&(u.source=d),u}toJSON(){let t={};for(let n of["hasBOM","css","file","id"])this[n]!=null&&(t[n]=this[n]);return this.map&&(t.map={...this.map},t.map.consumerCache&&(t.map.consumerCache=void 0)),t}};up.exports=Vn;Vn.default=Vn;sl&&sl.registerInput&&sl.registerInput(Vn)});var $n=fe((UN,mp)=>{"use strict";var cp=Mt(),dp,fp,qt=class extends cp{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,n,r){let i=new Set;for(let a of Array.isArray(t)?t:[t])a&&typeof a=="object"&&!a.parent&&a.raws&&typeof a.raws.before<"u"&&i.add(a.raws);let o=super.normalize(t);if(n){if(r==="prepend")this.nodes.length>1?n.raws.before=this.nodes[1].raws.before:delete n.raws.before;else if(this.first!==n)for(let a of o)i.has(a.raws)||(a.raws.before=n.raws.before)}return o}removeChild(t,n){let r=this.index(t);return!n&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(t)}toResult(t={}){return new dp(new fp,this,t).stringify()}};qt.registerLazyResult=e=>{dp=e};qt.registerProcessor=e=>{fp=e};mp.exports=qt;qt.default=qt;cp.registerRoot(qt)});var dl=fe((WN,pp)=>{"use strict";var Qr={comma(e){return Qr.split(e,[","],!0)},space(e){let t=[" ",`\n`," "];return Qr.split(e,t)},split(e,t,n){if(typeof e!="string")return[];let r=[],i="",o=!1,a=0,l=!1,s="",u=!1;for(let m of e)if(u?u=!1:m==="\\\\"?u=!0:l?m===s&&(l=!1):m===\'"\'||m==="\'"?(l=!0,s=m):m==="("?a+=1:m===")"?a>0&&(a-=1):a===0&&t.includes(m)&&(o=!0),o){let f=i.trim();(n||f!=="")&&r.push(f),i="",o=!1}else i+=m;let d=i.trim();return(n||d!=="")&&r.push(d),r}};pp.exports=Qr;Qr.default=Qr});var Ro=fe((VN,gp)=>{"use strict";var hp=Mt(),jv=dl(),zn=class extends hp{get selectors(){return jv.comma(this.selector)}set selectors(t){let n=this.selector?this.selector.match(/,\\s*/):null,r=n?n[0]:","+this.raw("between","beforeOpen");this.selector=t.join(r)}constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}};gp.exports=zn;zn.default=zn;hp.registerRule(zn)});var yp=fe(($N,xp)=>{"use strict";var Kv=Eo(),Xv=jr(),Yv=Xr(),Jv=Jr(),Qv=al(),Zv=$n(),eE=Ro();function bp(e,t){return e.inputs?e.inputs.map(n=>{let r={...n,__proto__:Jv.prototype};return r.map&&(r.map={...r.map,__proto__:Qv.prototype}),r}):t}function tE(e,t,n){let r={...e};if(delete r.inputs,delete r.nodes,r.source){let{inputId:o,...a}=r.source;r.source=a,o!=null&&(r.source.input=t[o])}let i;if(r.type==="root")i=new Zv(r);else if(r.type==="decl")i=new Yv(r);else if(r.type==="rule")i=new eE(r);else if(r.type==="comment")i=new Xv(r);else if(r.type==="atrule")i=new Kv(r);else throw new Error("Unknown node type: "+e.type);if(n){i.nodes=n;for(let o of n)o.parent=i}return i}function ko(e,t){if(Array.isArray(e))return e.map(i=>ko(i));let n,r=[{childIndex:0,children:[],inputs:bp(e,t),json:e}];for(;r.length>0;){let i=r[r.length-1],o=i.json.nodes;if(o&&i.childIndex<o.length){let l=o[i.childIndex];i.childIndex+=1,r.push({childIndex:0,children:[],inputs:bp(l,i.inputs),json:l});continue}r.pop();let a=tE(i.json,i.inputs,o?i.children:void 0);r.length>0?r[r.length-1].children.push(a):n=a}return n}xp.exports=ko;ko.default=ko});var ml=fe((zN,wp)=>{"use strict";var{dirname:Mo,relative:vp,resolve:Ep,sep:Ap}=_o(),{SourceMapConsumer:_p,SourceMapGenerator:No}=wo(),{pathToFileURL:Sp}=ol(),nE=Jr(),rE=!!(_p&&No),iE=!!(Mo&&Ep&&vp&&Ap),fl=class{constructor(t,n,r,i){this.stringify=t,this.mapOpts=r.map||{},this.root=n,this.opts=r,this.css=i,this.originalCSS=i,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let t;this.isInline()?t="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?t=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?t=this.mapOpts.annotation(this.opts.to,this.root):t=this.outputFile()+".map";let n=`\n`;this.css.includes(`\\r\n`)&&(n=`\\r\n`),this.css+=n+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let n=this.toUrl(this.path(t.file)),r=t.root||Mo(t.file),i;this.mapOpts.sourcesContent===!1?(i=new _p(t.text),i.sourcesContent&&(i.sourcesContent=null)):i=t.consumer(),this.map.applySourceMap(i,n,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1){if(this.root){let t;for(let n=this.root.nodes.length-1;n>=0;n--)t=this.root.nodes[n],t.type==="comment"&&t.text.startsWith("# sourceMappingURL=")&&this.root.removeChild(n)}else if(this.css){let t="/*# sourceMappingURL=",n;for(;(n=this.css.lastIndexOf(t))!==-1;){let r=this.css.indexOf("*/",n+t.length);if(r===-1)break;for(;n>0&&this.css[n-1]===`\n`;)n--;this.css=this.css.slice(0,n)+this.css.slice(r+2)}}}}generate(){if(this.clearAnnotation(),iE&&rE&&this.isMap())return this.generateMap();{let t="";return this.stringify(this.root,n=>{t+=n}),[t]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let t=this.previous()[0].consumer();t.file=this.outputFile(),this.map=No.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new No({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new No({file:this.outputFile(),ignoreInvalidMapping:!0});let t=1,n=1,r="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""},o,a;this.stringify(this.root,(l,s,u)=>{if(this.css+=l,s&&u!=="end"&&(i.generated.line=t,i.generated.column=n-1,s.source&&s.source.start?(i.source=this.sourcePath(s),i.original.line=s.source.start.line,i.original.column=s.source.start.column-1,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,this.map.addMapping(i))),a=l.match(/\\n/g),a?(t+=a.length,o=l.lastIndexOf(`\n`),n=l.length-o):n+=l.length,s&&u!=="start"){let d=s.parent||{raws:{}};(!(s.type==="decl"||s.type==="atrule"&&!s.nodes)||s!==d.last||d.raws.semicolon)&&(s.source&&s.source.end?(i.source=this.sourcePath(s),i.original.line=s.source.end.line,i.original.column=s.source.end.column-1,i.generated.line=t,i.generated.column=n-2,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,i.generated.line=t,i.generated.column=n-1,this.map.addMapping(i)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(t=>t.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let t=this.mapOpts.annotation;return typeof t<"u"&&t!==!0?!1:this.previous().length?this.previous().some(n=>n.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(t=>t.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(t){if(this.mapOpts.absolute||t.charCodeAt(0)===60||/^\\w+:\\/\\//.test(t))return t;let n=this.memoizedPaths.get(t);if(n)return n;let r=this.opts.to?Mo(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=Mo(Ep(r,this.mapOpts.annotation)));let i=vp(r,t);return this.memoizedPaths.set(t,i),i}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(t=>{if(t.source&&t.source.input.map){let n=t.source.input.map;this.previousMaps.includes(n)||this.previousMaps.push(n)}});else{let t=new nE(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk(n=>{if(n.source){let r=n.source.input.from;if(r&&!t[r]){t[r]=!0;let i=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(i,n.source.input.css)}}});else if(this.css){let n=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(n,this.css)}}sourcePath(t){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(t.source.input.from):this.toUrl(this.path(t.source.input.from))}toBase64(t){return Buffer?Buffer.from(t).toString("base64"):window.btoa(unescape(encodeURIComponent(t)))}toFileUrl(t){let n=this.memoizedFileURLs.get(t);if(n)return n;if(Sp){let r=Sp(t).toString();return this.memoizedFileURLs.set(t,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let n=this.memoizedURLs.get(t);if(n)return n;Ap==="\\\\"&&(t=t.replace(/\\\\/g,"/"));let r=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,r),r}};wp.exports=fl});var Rp=fe((qN,Tp)=>{"use strict";var Lo=/[\\t\\n\\f\\r "#\'()/;[\\\\\\]{}]/g,Fo=/[\\t\\n\\f\\r !"#\'():;@[\\\\\\]{}]|\\/(?=\\*)/g,oE=/.[\\r\\n"\'(/\\\\]/,Cp=/[\\da-f]/i;Tp.exports=function(t,n={}){let r=t.css.valueOf(),i=n.ignoreErrors,o,a,l,s,u,d,m,f,b,p,y=r.length,x=0,v=[],_=[],w=-1;function I(){return x}function D(M){throw t.error("Unclosed "+M,x)}function F(){return _.length===0&&x>=y}function O(M){if(_.length)return _.pop();if(x>=y)return;let R=M?M.ignoreUnclosed:!1;switch(o=r.charCodeAt(x),o){case 10:case 32:case 9:case 13:case 12:{s=x;do s+=1,o=r.charCodeAt(s);while(o===32||o===10||o===9||o===13||o===12);d=["space",r.slice(x,s)],x=s-1;break}case 91:case 93:case 123:case 125:case 58:case 59:case 41:{let U=String.fromCharCode(o);d=[U,U,x];break}case 40:{if(p=v.length?v.pop()[1]:"",b=r.charCodeAt(x+1),p==="url"&&b!==39&&b!==34&&b!==32&&b!==10&&b!==9&&b!==12&&b!==13){s=x;do{if(m=!1,s=r.indexOf(")",s+1),s===-1)if(i||R){s=x;break}else D("bracket");for(f=s;r.charCodeAt(f-1)===92;)f-=1,m=!m}while(m);d=["brackets",r.slice(x,s+1),x,s],x=s}else x<=w?d=["(","(",x]:(s=r.indexOf(")",x+1),a=r.slice(x,s+1),s===-1||oE.test(a)?(w=s===-1?y:s,d=["(","(",x]):(d=["brackets",a,x,s],x=s));break}case 39:case 34:{u=o===39?"\'":\'"\',s=x;do{if(m=!1,s=r.indexOf(u,s+1),s===-1)if(i||R){s=x+1;break}else D("string");for(f=s;r.charCodeAt(f-1)===92;)f-=1,m=!m}while(m);d=["string",r.slice(x,s+1),x,s],x=s;break}case 64:{Lo.lastIndex=x+1,Lo.test(r),Lo.lastIndex===0?s=r.length-1:s=Lo.lastIndex-2,d=["at-word",r.slice(x,s+1),x,s],x=s;break}case 92:{for(s=x,l=!0;r.charCodeAt(s+1)===92;)s+=1,l=!l;if(o=r.charCodeAt(s+1),l&&o!==47&&o!==32&&o!==10&&o!==9&&o!==13&&o!==12&&(s+=1,Cp.test(r.charAt(s)))){for(;Cp.test(r.charAt(s+1));)s+=1;r.charCodeAt(s+1)===32&&(s+=1)}d=["word",r.slice(x,s+1),x,s],x=s;break}default:{o===47&&r.charCodeAt(x+1)===42?(s=r.indexOf("*/",x+2)+1,s===0&&(i||R?s=r.length:D("comment")),d=["comment",r.slice(x,s+1),x,s],x=s):(Fo.lastIndex=x+1,Fo.test(r),Fo.lastIndex===0?s=r.length-1:s=Fo.lastIndex-2,d=["word",r.slice(x,s+1),x,s],v.push(d),x=s);break}}return x++,d}function T(M){_.push(M)}return{back:T,endOfFile:F,nextToken:O,position:I}}});var Lp=fe((jN,Np)=>{"use strict";var aE=Eo(),sE=jr(),lE=Xr(),uE=$n(),kp=Ro(),cE=Rp(),Mp={empty:!0,space:!0};function dE(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}function pl(e,t,n){let r="";for(let i=t;i<n;i++)r+=e[i][1];return r}var hl=class{constructor(t){this.input=t,this.root=new uE,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:t,start:{column:1,line:1,offset:0}}}atrule(t){let n=new aE;n.name=t[1].slice(1),n.name===""&&this.unnamedAtrule(n,t),this.init(n,t[2]);let r,i,o,a=!1,l=!1,s=[],u=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),r=t[0],r==="("||r==="["?u.push(r==="("?")":"]"):r==="{"&&u.length>0?u.push("}"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===";"){n.source.end=this.getPosition(t[2]),n.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){l=!0;break}else if(r==="}"){if(s.length>0){for(o=s.length-1,i=s[o];i&&i[0]==="space";)i=s[--o];i&&(n.source.end=this.getPosition(i[3]||i[2]),n.source.end.offset++)}this.end(t);break}else s.push(t);else s.push(t);if(this.tokenizer.endOfFile()){a=!0;break}}n.raws.between=this.spacesAndCommentsFromEnd(s),s.length?(n.raws.afterName=this.spacesAndCommentsFromStart(s),this.raw(n,"params",s),a&&(t=s[s.length-1],n.source.end=this.getPosition(t[3]||t[2]),n.source.end.offset++,this.spaces=n.raws.between,n.raws.between="")):(n.raws.afterName="",n.params=""),l&&(n.nodes=[],this.current=n)}checkMissedSemicolon(t){let n=this.colon(t);if(n===!1)return;let r=0,i;for(let o=n-1;o>=0&&(i=t[o],!(i[0]!=="space"&&(r+=1,r===2)));o--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(t){let n=0,r,i,o;for(let[a,l]of t.entries()){if(i=l,o=i[0],o==="("&&(n+=1),o===")"&&(n-=1),n===0&&o===":")if(!r)this.doubleColon(i);else{if(r[0]==="word"&&r[1]==="progid")continue;return a}r=i}return!1}comment(t){let n=new sE;this.init(n,t[2]),n.source.end=this.getPosition(t[3]||t[2]),n.source.end.offset++;let r=t[1].slice(2,-2);if(!r.trim())n.text="",n.raws.left=r,n.raws.right="";else{let i=r.match(/^(\\s*)([^]*\\S)(\\s*)$/);n.text=i[2],n.raws.left=i[1],n.raws.right=i[3]}}createTokenizer(){this.tokenizer=cE(this.input)}decl(t,n){let r=new lE;this.init(r,t[0][2]);let i=t[t.length-1];i[0]===";"&&(this.semicolon=!0,t.pop()),r.source.end=this.getPosition(i[3]||i[2]||dE(t)),r.source.end.offset++;let o=0;for(;t[o][0]!=="word";)o===t.length-1&&this.unknownWord([t[o]]),o++;r.raws.before+=pl(t,0,o),r.source.start=this.getPosition(t[o][2]);let a=o;for(;o<t.length;){let f=t[o][0];if(f===":"||f==="space"||f==="comment")break;o++}r.prop=pl(t,a,o);let l=o,s;for(;o<t.length&&(s=t[o],o++,s[0]!==":");)s[0]==="word"&&/\\w/.test(s[1])&&this.unknownWord([s]);r.raws.between=pl(t,l,o),(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let u=o;for(;o<t.length;){let f=t[o][0];if(f!=="space"&&f!=="comment")break;o++}let d=t.slice(u,o);t=t.slice(o),this.precheckMissedSemicolon(t);for(let f=t.length-1;f>=0;f--){if(s=t[f],s[1].toLowerCase()==="!important"){r.important=!0;let b=this.stringFrom(t,f);b=this.spacesFromEnd(t)+b,b!==" !important"&&(r.raws.important=b);break}else if(s[1].toLowerCase()==="important"){let b=t.slice(0),p="";for(let y=f;y>0;y--){let x=b[y][0];if(p.trim().startsWith("!")&&x!=="space")break;p=b.pop()[1]+p}p.trim().startsWith("!")&&(r.important=!0,r.raws.important=p,t=b)}if(s[0]!=="space"&&s[0]!=="comment")break}t.some(f=>f[0]!=="space"&&f[0]!=="comment")&&(r.raws.between+=d.map(f=>f[1]).join(""),d=[]),this.raw(r,"value",d.concat(t),n),r.value.includes(":")&&!n&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let n=new kp;this.init(n,t[2]),n.selector="",n.raws.between="",this.current=n}end(t){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(t[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(t)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(t){if(this.spaces+=t[1],this.current.nodes){let n=this.current.nodes[this.current.nodes.length-1];n&&n.type==="rule"&&!n.raws.ownSemicolon&&(n.raws.ownSemicolon=this.spaces,this.spaces="",n.source.end=this.getPosition(t[2]),n.source.end.offset++)}}getPosition(t){let n=this.input.fromOffset(t);return{column:n.col,line:n.line,offset:t}}init(t,n){this.current.push(t),t.source={input:this.input,start:this.getPosition(n)},t.raws.before=this.spaces,this.spaces="",t.type!=="comment"&&(this.semicolon=!1)}other(t){let n=!1,r=null,i=!1,o=null,a=[],l=t[1].startsWith("--"),s=[],u=t;for(;u;){if(r=u[0],s.push(u),r==="("||r==="[")o||(o=u),a.push(r==="("?")":"]");else if(l&&i&&r==="{")o||(o=u),a.push("}");else if(a.length===0)if(r===";")if(i){this.decl(s,l);return}else break;else if(r==="{"){this.rule(s);return}else if(r==="}"){this.tokenizer.back(s.pop()),n=!0;break}else r===":"&&(i=!0);else r===a[a.length-1]&&(a.pop(),a.length===0&&(o=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(n=!0),a.length>0&&this.unclosedBracket(o),n&&i){if(!l)for(;s.length&&(u=s[s.length-1][0],!(u!=="space"&&u!=="comment"));)this.tokenizer.back(s.pop());this.decl(s,l)}else this.unknownWord(s)}parse(){let t;for(;!this.tokenizer.endOfFile();)switch(t=this.tokenizer.nextToken(),t[0]){case"space":this.spaces+=t[1];break;case";":this.freeSemicolon(t);break;case"}":this.end(t);break;case"comment":this.comment(t);break;case"at-word":this.atrule(t);break;case"{":this.emptyRule(t);break;default:this.other(t);break}this.endFile()}precheckMissedSemicolon(){}raw(t,n,r,i){let o,a,l=r.length,s="",u=!0,d,m;for(let f=0;f<l;f+=1)o=r[f],a=o[0],a==="space"&&f===l-1&&!i?u=!1:a==="comment"?(m=r[f-1]?r[f-1][0]:"empty",d=r[f+1]?r[f+1][0]:"empty",!Mp[m]&&!Mp[d]?s.slice(-1)===","?u=!1:s+=o[1]:u=!1):s+=o[1];if(!u){let f=r.reduce((b,p)=>b+p[1],"");t.raws[n]={raw:f,value:s}}t[n]=s}rule(t){t.pop();let n=new kp;this.init(n,t[0][2]),n.raws.between=this.spacesAndCommentsFromEnd(t),this.raw(n,"selector",t),this.current=n}spacesAndCommentsFromEnd(t){let n,r="";for(;t.length&&(n=t[t.length-1][0],!(n!=="space"&&n!=="comment"));)r=t.pop()[1]+r;return r}spacesAndCommentsFromStart(t){let n,r="";for(;t.length&&(n=t[0][0],!(n!=="space"&&n!=="comment"));)r+=t.shift()[1];return r}spacesFromEnd(t){let n,r="";for(;t.length&&(n=t[t.length-1][0],n==="space");)r=t.pop()[1]+r;return r}stringFrom(t,n){let r="";for(let i=n;i<t.length;i++)r+=t[i][1];return t.splice(n,t.length-n),r}unclosedBlock(){let t=this.current.source.start;throw this.input.error("Unclosed block",t.line,t.column)}unclosedBracket(t){throw this.input.error("Unclosed bracket",{offset:t[2]},{offset:t[2]+1})}unexpectedClose(t){throw this.input.error("Unexpected }",{offset:t[2]},{offset:t[2]+1})}unknownWord(t){throw this.input.error("Unknown word "+t[0][1],{offset:t[0][2]},{offset:t[0][2]+t[0][1].length})}unnamedAtrule(t,n){throw this.input.error("At-rule without name",{offset:n[2]},{offset:n[2]+n[1].length})}};Np.exports=hl});var Io=fe((KN,Fp)=>{"use strict";var fE=Mt(),mE=Jr(),pE=Lp();function Do(e,t){let n=new mE(e,t),r=new pE(n);try{r.parse()}catch(i){throw i}return r.root}Fp.exports=Do;Do.default=Do;fE.registerParse(Do)});var gl=fe((XN,Dp)=>{"use strict";var hE=Mt(),{my:gE}=Wr(),Zr=class{constructor(t,n={}){if(this.type="warning",this.text=t,n.node&&n.node.source){n.node[gE]||hE.rebuild(n.node);let r=n.node.rangeBy(n);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in n)this[r]=n[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}};Dp.exports=Zr;Zr.default=Zr});var Po=fe((YN,Ip)=>{"use strict";var bE=gl(),ei=class{get content(){return this.css}constructor(t,n,r){this.processor=t,this.messages=[],this.root=n,this.opts=r,this.css="",this.map=void 0}toString(){return this.css}warn(t,n={}){n.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(n.plugin=this.lastPlugin.postcssPlugin);let r=new bE(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(t=>t.type==="warning")}};Ip.exports=ei;ei.default=ei});var bl=fe((JN,Op)=>{"use strict";var Pp={};Op.exports=function(t){Pp[t]||(Pp[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))}});var Sl=fe((ZN,Up)=>{"use strict";var xE=Mt(),yE=Ao(),SE=ml(),vE=Io(),Hp=Po(),EE=$n(),AE=Ur(),{isClean:ot,my:_E}=Wr(),QN=bl(),wE={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},CE={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},TE={Once:!0,postcssPlugin:!0,prepare:!0},qn=0;function ti(e){return typeof e=="object"&&typeof e.then=="function"}function xl(e){let t=!1,n=wE[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,qn,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,qn,n+"Exit"]:[n,n+"Exit"]}function Gp(e){let t;return e.type==="document"?t=["Document",qn,"DocumentExit"]:e.type==="root"?t=["Root",qn,"RootExit"]:t=xl(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Bp(e){let t=[e];for(;t.length>0;){let n=t.pop();if(n[ot]=!1,n.nodes)for(let r of n.nodes)t.push(r)}return e}var yl={},jt=class e{get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}constructor(t,n,r){this.stringified=!1,this.processed=!1;let i;if(typeof n=="object"&&n!==null&&(n.type==="root"||n.type==="document"))i=Bp(n);else if(n instanceof e||n instanceof Hp)i=Bp(n.root),n.map&&(typeof r.map>"u"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=n.map);else{let o=vE;r.syntax&&(o=r.syntax.parse),r.parser&&(o=r.parser),o.parse&&(o=o.parse);try{i=o(n,r)}catch(a){this.processed=!0,this.error=a}i&&!i[_E]&&xE.rebuild(i)}this.result=new Hp(t,i,r),this.helpers={...yl,postcss:yl,result:this.result},this.plugins=this.processor.plugins.map(o=>typeof o=="object"&&o.prepare?{...o,...o.prepare(this.result)}:o)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(t,n){let r=this.result.lastPlugin;try{n&&n.addToError(t),this.error=t,t.name==="CssSyntaxError"&&!t.plugin?(t.plugin=r.postcssPlugin,t.setMessage()):r.postcssVersion}catch(i){console&&console.error&&console.error(i)}return t}prepareVisitors(){this.listeners={};let t=(n,r,i)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([n,i])};for(let n of this.plugins)if(typeof n=="object")for(let r in n){if(!CE[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${n.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!TE[r])if(typeof n[r]=="object")for(let i in n[r])i==="*"?t(n,r,n[r][i]):t(n,r+"-"+i.toLowerCase(),n[r][i]);else typeof n[r]=="function"&&t(n,r,n[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t<this.plugins.length;t++){let n=this.plugins[t],r=this.runOnRoot(n);if(ti(r))try{await r}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[ot];){t[ot]=!0;let n=[Gp(t)];for(;n.length>0;){let r=this.visitTick(n);if(ti(r))try{await r}catch(i){let o=n[n.length-1].node;throw this.handleError(i,o)}}}if(this.listeners.OnceExit)for(let[n,r]of this.listeners.OnceExit){this.result.lastPlugin=n;try{if(t.type==="document"){let i=t.nodes.map(o=>r(o,this.helpers));await Promise.all(i)}else await r(t,this.helpers)}catch(i){throw this.handleError(i)}}}return this.processed=!0,this.stringify()}runOnRoot(t){this.result.lastPlugin=t;try{if(typeof t=="object"&&t.Once){if(this.result.root.type==="document"){let n=this.result.root.nodes.map(r=>t.Once(r,this.helpers));return ti(n[0])?Promise.all(n):n}return t.Once(this.result.root,this.helpers)}else if(typeof t=="function")return t(this.result.root,this.result)}catch(n){throw this.handleError(n)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,n=AE;t.syntax&&(n=t.syntax.stringify),t.stringifier&&(n=t.stringifier),n.stringify&&(n=n.stringify);let r=this.result.root.source;if(t.map===void 0&&!(r&&r.input&&r.input.map)){let a="";return n(this.result.root,l=>{a+=l}),this.result.css=a,this.result}let o=new SE(n,this.result.root,this.result.opts).generate();return this.result.css=o[0],this.result.map=o[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let t of this.plugins){let n=this.runOnRoot(t);if(ti(n))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[ot];)t[ot]=!0,this.walkSync(t);if(this.listeners.OnceExit)if(t.type==="document")for(let n of t.nodes)this.visitSync(this.listeners.OnceExit,n);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,n){return this.async().then(t,n)}toString(){return this.css}visitSync(t,n){for(let[r,i]of t){this.result.lastPlugin=r;let o;try{o=i(n,this.helpers)}catch(a){throw this.handleError(a,n.proxyOf)}if(n.type!=="root"&&n.type!=="document"&&!n.parent)return!0;if(ti(o))throw this.getAsyncError()}}visitTick(t){let n=t[t.length-1],{node:r,visitors:i}=n;if(r.type!=="root"&&r.type!=="document"&&!r.parent){t.pop();return}if(i.length>0&&n.visitorIndex<i.length){let[a,l]=i[n.visitorIndex];n.visitorIndex+=1,n.visitorIndex===i.length&&(n.visitors=[],n.visitorIndex=0),this.result.lastPlugin=a;try{return l(r.toProxy(),this.helpers)}catch(s){throw this.handleError(s,r)}}if(n.iterator!==0){let a=n.iterator;n.descending&&(n.descending=!1,r.indexes[a]+=1);let l;for(;l=r.nodes[r.indexes[a]];){if(!l[ot]){l[ot]=!0,n.descending=!0,t.push(Gp(l));return}r.indexes[a]+=1}n.iterator=0,delete r.indexes[a]}let o=n.events;for(;n.eventIndex<o.length;){let a=o[n.eventIndex];if(n.eventIndex+=1,a===qn){r.nodes&&r.nodes.length&&(r[ot]=!0,n.iterator=r.getIterator());return}else if(this.listeners[a]){n.visitors=this.listeners[a];return}}t.pop()}walkSync(t){t[ot]=!0;let n=[{eventIndex:0,events:xl(t),iterator:0,node:t}];for(;n.length>0;){let r=n[n.length-1],i=r.node;if(r.iterator!==0){let o=r.iterator;r.descending&&(r.descending=!1,i.indexes[o]+=1);let a,l=!1;for(;a=i.nodes[i.indexes[o]];){if(!a[ot]){a[ot]=!0,r.descending=!0,n.push({eventIndex:0,events:xl(a),iterator:0,node:a}),l=!0;break}i.indexes[o]+=1}if(l)continue;r.iterator=0,delete i.indexes[o]}if(r.eventIndex<r.events.length){let o=r.events[r.eventIndex];if(r.eventIndex+=1,o===qn)i.nodes&&i.nodes.length&&(r.iterator=i.getIterator());else{let a=this.listeners[o];a&&this.visitSync(a,i.toProxy())&&n.pop()}continue}n.pop()}}warnings(){return this.sync().warnings()}};jt.registerPostcss=e=>{yl=e};Up.exports=jt;jt.default=jt;EE.registerLazyResult(jt);yE.registerLazyResult(jt)});var Vp=fe((tL,Wp)=>{"use strict";var RE=ml(),kE=Io(),ME=Po(),NE=Ur(),eL=bl(),ni=class{get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let t,n=kE;try{t=n(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=t,t}get[Symbol.toStringTag](){return"NoWorkResult"}constructor(t,n,r){n=n.toString(),this.stringified=!1,this._processor=t,this._css=n,this._opts=r,this._map=void 0;let i=NE;this.result=new ME(this._processor,void 0,this._opts),this.result.css=n;let o=this;Object.defineProperty(this.result,"root",{get(){return o.root}});let a=new RE(i,void 0,this._opts,n);if(a.isMap()){let[l,s]=a.generate();l&&(this.result.css=l),s&&(this.result.map=s)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}sync(){if(this.error)throw this.error;return this.result}then(t,n){return this.async().then(t,n)}toString(){return this._css}warnings(){return[]}};Wp.exports=ni;ni.default=ni});var zp=fe((nL,$p)=>{"use strict";var LE=Ao(),FE=Sl(),DE=Vp(),IE=$n(),bn=class{constructor(t=[]){this.version="8.5.28",this.plugins=this.normalize(t)}normalize(t){let n=[];for(let r of t)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))n=n.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)n.push(r);else if(typeof r=="function")n.push(r);else if(!(typeof r=="object"&&(r.parse||r.stringify)))throw new Error(r+" is not a PostCSS plugin");return n}process(t,n={}){return!this.plugins.length&&!n.parser&&!n.stringifier&&!n.syntax?new DE(this,t,n):new FE(this,t,n)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}};$p.exports=bn;bn.default=bn;IE.registerProcessor(bn);LE.registerProcessor(bn)});var Zp=fe((rL,Qp)=>{"use strict";var qp=Eo(),jp=jr(),PE=Mt(),OE=vo(),Kp=Xr(),Xp=Ao(),HE=yp(),GE=Jr(),BE=Sl(),UE=dl(),WE=zr(),VE=Io(),vl=zp(),$E=Po(),Yp=$n(),Jp=Ro(),zE=Ur(),qE=gl();function Se(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new vl(e)}Se.plugin=function(t,n){let r=!1;function i(...a){console&&console.warn&&!r&&(r=!0,console.warn(t+`: postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("zh")&&console.warn(t+`: \\u91CC\\u9762 postcss.plugin \\u88AB\\u5F03\\u7528. \\u8FC1\\u79FB\\u6307\\u5357:\nhttps://www.w3ctech.com/topic/2226`));let l=n(...a);return l.postcssPlugin=t,l.postcssVersion=new vl().version,l}let o;return Object.defineProperty(i,"postcss",{get(){return o||(o=i()),o}}),i.process=function(a,l,s){return Se([i(s)]).process(a,l)},i};Se.stringify=zE;Se.parse=VE;Se.fromJSON=HE;Se.list=UE;Se.comment=e=>new jp(e);Se.atRule=e=>new qp(e);Se.decl=e=>new Kp(e);Se.rule=e=>new Jp(e);Se.root=e=>new Yp(e);Se.document=e=>new Xp(e);Se.CssSyntaxError=OE;Se.Declaration=Kp;Se.Container=PE;Se.Processor=vl;Se.Document=Xp;Se.Comment=jp;Se.Warning=qE;Se.AtRule=qp;Se.Result=$E;Se.Input=GE;Se.Rule=Jp;Se.Root=Yp;Se.Node=WE;BE.registerPostcss(Se);Qp.exports=Se;Se.default=Se});function Hc(e){e.preload!=="auto"&&(e.preload="auto");let t=e.tagName==="VIDEO"&&e.networkState===2;e.readyState<3&&!t&&e.load()}function Pi(){return globalThis}function P(e,t){if(typeof window>"u")return;let n=Pi(),r=n.__hf?.onSwallowed;if(r)try{r({label:e,error:t})}catch(i){}(n.__hfDebug||n.__HYPERFRAMES_DEBUG)&&console.debug(`[hyperframes] ${e} swallowed:`,t)}var Tx=["seconds-time","rational-fps","seek-keep-playing","composition-manifest-v1","runtime-data","play-range"];function Rx(e,t){let n=Math.abs(e),r=Math.abs(t);for(;r!==0;){let i=n%r;n=r,r=i}return n||1}function kx(e){let t=Number.isFinite(e)&&e>0?e:30,n=Number.isInteger(t)?1:1e6,r=Math.round(t*n),i=Rx(r,n);return{numerator:r/i,denominator:n/i}}function Gc(e,t,n){return Math.max(e,(Math.ceil(t*n-1e-6)-1)/n)}function Fa(e){if(typeof e!="object"||e===null)return null;let t=e;return!Number.isFinite(t.numerator)||!Number.isFinite(t.denominator)||(t.numerator??0)<=0||(t.denominator??0)<=0?null:Number(t.numerator)/Number(t.denominator)}function Oi(e){return{protocolVersion:1,capabilities:Tx,fps:kx(e)}}function Mx(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function Bc(e,t=30){if(typeof e!="object"||e===null)return{status:"legacy",fps:t};let n=e;if(n.protocolVersion===void 0)return{status:"legacy",fps:t};if(n.protocolVersion!==1)return{status:"unsupported",code:"unsupported_protocol_version",receivedVersion:n.protocolVersion};let r=Fa(n.fps);return r===null||!Mx(n.capabilities)?{status:"unsupported",code:"invalid_protocol_metadata",receivedVersion:n.protocolVersion}:{status:"supported",fps:r,metadata:n}}var Uc=30;function Wc(e){Uc=Number.isFinite(e)&&e>0?e:30}function we(e){try{window.parent.postMessage({...e,...Oi(Uc)},"*")}catch(t){P("bridge.postMessage",t)}}var Nx=new Map(Object.entries({play:(e,t)=>t.onPlay(),pause:(e,t)=>t.onPause(),"stop-media":(e,t)=>t.onStopMedia(),seek:(e,t)=>t.onSeek(Lx(e,t),e.seekMode??"commit"),tick:(e,t)=>t.onTick(),"set-muted":(e,t)=>t.onSetMuted(!!e.muted),"set-volume":(e,t)=>t.onSetVolume(Math.max(0,Math.min(1,Number(e.volume??1)))),"set-media-output-muted":(e,t)=>t.onSetMediaOutputMuted(!!e.muted),"set-native-media-sync-disabled":(e,t)=>t.onSetNativeMediaSyncDisabled(!!e.disabled),"set-web-audio-media-disabled":(e,t)=>t.onSetWebAudioMediaDisabled(!!e.disabled),"set-playback-rate":(e,t)=>t.onSetPlaybackRate(Number(e.playbackRate??1)),"set-idle-heartbeat":(e,t)=>t.onSetIdleHeartbeat(!!e.slow),"set-root-duration":(e,t)=>t.onSetRootDuration(Number(e.durationSeconds??0)),"set-play-range":(e,t)=>t.onSetPlayRange(Number(e.startSeconds??0),e.endSeconds==null?null:Number(e.endSeconds)),"set-color-grading":(e,t)=>t.onSetColorGrading(e.target??null,e.grading??null),"set-color-grading-compare":(e,t)=>t.onSetColorGradingCompare(e.target??null,e.compare??null),"enable-pick-mode":(e,t)=>t.onEnablePickMode(),"disable-pick-mode":(e,t)=>t.onDisablePickMode(),"flash-elements":e=>Dx(e),"set-runtime-data":(e,t)=>{typeof e.channel=="string"&&t.onSetRuntimeData?.(e.channel,e.payload,e.requestId)},"clear-runtime-data":(e,t)=>{typeof e.channel=="string"&&t.onClearRuntimeData?.(e.channel,e.requestId)}}));function Lx(e,t){let n=Number(e.timeSeconds);if(Number.isFinite(n))return Math.max(0,n);let i=Fa(e.fps)??t.getCanonicalFps();return Math.max(0,Number(e.frame??0))/i}function Fx(e){let t=Bc(e);return t.status!=="unsupported"?!1:(we({source:"hf-preview",type:"diagnostic",code:`runtime.protocol.${t.code}`,details:{receivedVersion:typeof t.receivedVersion=="string"||typeof t.receivedVersion=="number"?t.receivedVersion:null}}),!0)}function Dx(e){let t=e.selectors,n=e.duration||800;t&&Ix(t,n)}function Vc(e){let t=n=>{if(n.source!==window.parent&&n.source!==window)return;let r=n.data;if(!r||r.source!=="hf-parent"||r.type!=="control"||Fx(r))return;let i=r.action;if(typeof i!="string")return;let o=Nx.get(i);o&&o(r,e)};return window.addEventListener("message",t),we({source:"hf-preview",type:"ready"}),t}function Ix(e,t){if(!document.getElementById("__hf-flash-styles")){let n=document.createElement("style");n.id="__hf-flash-styles",n.textContent=`\n .__hf-flash {\n outline: 2px solid rgba(59, 130, 246, 0.6) !important;\n outline-offset: 2px !important;\n animation: __hf-flash-pulse ${t}ms ease-out forwards !important;\n }\n @keyframes __hf-flash-pulse {\n 0% { outline-color: rgba(59, 130, 246, 0.8); }\n 100% { outline-color: transparent; }\n }\n `,document.head.appendChild(n)}for(let n of e)try{document.querySelectorAll(n).forEach(i=>{i.classList.add("__hf-flash"),setTimeout(()=>i.classList.remove("__hf-flash"),t)})}catch(r){P("bridge.flashElements.querySelector",r)}}var Da=e=>4*Number.EPSILON*Math.max(1,Math.abs(e));function cr(e,t){return!Number.isFinite(e)||!Number.isFinite(t)?e===t:Math.abs(e-t)<=Da(Math.max(Math.abs(e),Math.abs(t)))}var $c=(e,t)=>e>=t||cr(e,t),Ot=(e,t,n)=>$c(e,t)&&e<n&&!cr(e,n),Px=1e-6,Hi=(e,t,n,r)=>Ot(e,t,n)||$c(e,t)&&r>0&&n>=r-Px;var zc="hyperframes-studio-preview",dr="data-hf-upcoming",qc="data-hf-preview-lazy";var Xc="data-hf-first-pass-hide",jc="[data-start]:not(video, audio, img) { visibility: hidden !important; }",Ox=\'img[loading="lazy"] { display: none !important; }\',Yc="data-hf-skip-hidden-images",fr=`[data-start]:not(video, audio, img, [${dr}])[style*="visibility: hidden"]`,Hx=`${fr} img { display: none !important; }`,Gx=`meta[name="${zc}"]`;function Kc(e,t,n){let r=document.createElement("style");r.setAttribute(t,""),r.textContent=n,e.appendChild(r)}function Ia(){return document.querySelector(`style[${Yc}]`)!==null}function Jc(){if(typeof document>"u")return;let e=document.head??document.documentElement;if(!e)return;let t=document.querySelector(Gx)!==null;t&&!Ia()&&Kc(e,Yc,Hx);let n=window;if(n.__hfFirstPassHidden||n.__hyperframeRuntimeBootstrapped)return;let r=t?`${jc} ${Ox}`:jc;Kc(e,Xc,r),n.__hfFirstPassHidden=!0}function Qc(){let e=window;if(!e.__hfFirstPassHidden)return!1;e.__hfFirstPassHidden=!1;for(let t of document.querySelectorAll(`style[${Xc}]`))t.remove();return!0}var Pa=null;function Zc(e){Pa=e}function Ye(e,t){if(Pa)try{Pa({source:"hf-preview",type:"analytics",event:e,properties:t??{}})}catch(n){P("runtime.analytics.site1",n)}}function Bx(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-"),n=0,r=t.length;for(;n<r&&t[n]==="-";)n++;for(;r>n&&t[r-1]==="-";)r--;let i=t.slice(n,r);return i.length>0?i:"node"}function Tn(e){return`--${Bx(e)}`}function ed(e){let t=new Map;for(let n of e){let r=Tn(n),i=t.get(r);i?i.includes(n)||i.push(n):t.set(r,[n])}return[...t.values()].filter(n=>n.length>1)}function nd(){if(typeof document>"u")return{};let e=new Set;document.documentElement?.hasAttribute("data-composition-variables")&&e.add(document.documentElement);for(let i of Array.from(document.querySelectorAll("[data-composition-variables]")))e.add(i);let t={};for(let i of e)Object.assign(t,mr(i));let n=Bi(),r={...t,...n};for(let i of e)Ha(i,r);return r}var td=new Set;function rd(e){let t=e?.getAttribute("data-composition-variables");if(!t)return[];let n;try{n=JSON.parse(t)}catch{return[]}return Array.isArray(n)?n.filter(r=>!!r&&typeof r=="object"):[]}function Ux(e,t){return t?.trim()||e.getAttribute("data-composition-id")?.trim()||e.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")?.trim()||"composition"}function Wx(e){return Array.isArray(e.options)?e.options.map(t=>t&&typeof t=="object"?t.value:t).filter(t=>typeof t=="string"||typeof t=="number"):[]}function Vx(e,t){if(typeof e.id!="string")return null;let n=t[e.id];if(n==null||"default"in e&&String(n)===String(e.default))return null;let r=Wx(e);return r.length===0||r.some(i=>String(i)===String(n))?null:{id:e.id,value:n,allowed:r}}function Ha(e,t,n){if(!e)return;let r=rd(e);if(r.length===0)return;let i=Ux(e,n);for(let o of r){let a=Vx(o,t);if(!a)continue;let l=`${i}|${a.id}|${String(a.value)}`;if(td.has(l))continue;td.add(l);let s="default"in o?JSON.stringify(o.default):"the composition default";console.warn(`[hyperframes] runtime_unknown_enum_value: ${i} variable "${a.id}" got ${JSON.stringify(a.value)}, which is not a declared option (${a.allowed.join(", ")}). Rendering ${s} instead.`)}}function mr(e){let t={};for(let n of rd(e))typeof n.id!="string"||!("default"in n)||(t[n.id]=n.default);return t}var Oa="data-hf-css-vars";function Gi(e){return"style"in e&&typeof e.style?.setProperty=="function"}function Ga(e,t){if(!Gi(e))return;let n=[];for(let[r,i]of Object.entries(t))if(typeof i=="string"&&i!==""||typeof i=="number"){let o=Tn(r);e.style.setProperty(o,String(i)),n.push(o)}n.length>0&&e.setAttribute(Oa,n.join(" "))}function id(e,t,n){let r={};for(let[i,o]of Object.entries(t)){let a=Tn(i);((Gi(e)?e.style.getPropertyValue(a):"")||(n?n.getComputedStyle(e).getPropertyValue(a):"")).trim()===""&&(r[i]=o)}return r}function od(e){if(!Gi(e))return;let t=e.getAttribute(Oa);if(t){for(let n of t.split(" "))n.startsWith("--")&&e.style.removeProperty(n);e.removeAttribute(Oa)}}function ad(e){let t=new Set;e.documentElement?.hasAttribute("data-composition-variables")&&t.add(e.documentElement);for(let i of Array.from(e.querySelectorAll("[data-composition-variables]")))t.add(i);let n=Bi(),r=[];for(let i of t)r.push(...$x(i,n,e.defaultView));for(let i of ed(r))console.warn(`composition variables ${i.join(", ")} collapse to the same CSS property ${Tn(i[0]??"")} \\u2014 rename one to avoid cross-talk`)}function $x(e,t,n){if(!Gi(e))return[];let r=mr(e),i={};for(let[o,a]of Object.entries(r)){if(o in t)continue;let l=Tn(o);(e.style.getPropertyValue(l)||(n?n.getComputedStyle(e).getPropertyValue(l):"")).trim()===""&&(i[o]=a)}for(let[o,a]of Object.entries(t))o in r&&(i[o]=a);return Ga(e,i),Object.keys(r)}function sd(e){let t=e.getAttribute("data-variable-values");if(!t)return{};let n;try{n=JSON.parse(t)}catch{return{}}return!n||typeof n!="object"||Array.isArray(n)?{}:n}function Bi(){if(typeof window>"u")return{};let e=window.__hfVariables;return!e||typeof e!="object"||Array.isArray(e)?{}:e}var ld="http://www.w3.org/1999/xhtml";function Ne(e){return e!=null&&e.nodeType===1}function ye(e){return Ne(e)&&e.namespaceURI===ld}function Rn(e,t){return ye(e)&&e.localName===t}function Ee(e){return Rn(e,"video")}function Ba(e){return Rn(e,"audio")}function be(e){return Ee(e)||Ba(e)}function Oe(e){return Rn(e,"img")}function pr(e){return Rn(e,"canvas")}function ud(e){return Rn(e,"style")}function cd(e){return Rn(e,"link")}function Ua(e){return Ne(e)&&(e.namespaceURI===ld||e.namespaceURI==="http://www.w3.org/2000/svg")}function dd(e){let t=[],n=(f,b=()=>f.getAnimations())=>{if(typeof f.getAnimations!="function")return[];try{return b()}catch{return[]}},r=f=>{let b=new Map;if(t.length===0)return b;let p=typeof CSSAnimation<"u";for(let y of n(document,f)){if(p&&!(y instanceof CSSAnimation))continue;let x=y.effect;if(!x?.target||x.pseudoElement)continue;let v=b.get(x.target);v?v.push(y):b.set(x.target,[y])}return b},i=(f=[],b=[])=>[...b,...f.filter(p=>!b.includes(p)&&p.playState!=="idle")],o=f=>{let b=f.closest("[data-start]")??f;return e?.resolveStartSeconds?e.resolveStartSeconds(b):Number.parseFloat(b.getAttribute("data-start")??"0")||0},a=f=>{let b=_=>(_||"").split(",").map(w=>Number.parseFloat(w)/(w.trim().endsWith("ms")?1e3:1)),p=b(f.animationDuration),y=b(f.animationDelay),x=f.animationName.split(","),v=0;return x.forEach((_,w)=>{if(_.trim()==="none")return;let I=y[w%y.length]+p[w%p.length];I>v&&(v=I)}),{cycleSeconds:v,delays:x.map((_,w)=>y[w%y.length]||0)}},l=(f,b)=>{let p=null;try{p=f.effect?.getComputedTiming?.()??null}catch(x){P("runtime.adapters.css.site5",x)}if(!p)return{};let y=Number(p.endTime);return Number.isFinite(y)?{endSeconds:b+y/1e3}:{unbounded:!0}},s=(f,b)=>{for(let p of f){try{p.currentTime=b}catch(y){P("runtime.adapters.css.site1",y)}try{p.pause()}catch(y){P("runtime.adapters.css.site2",y)}}},u=f=>{for(let b of f)try{b.play()}catch(p){P("runtime.adapters.css.site3",p)}},d=f=>{for(let b of f)try{b.pause()}catch(p){P("runtime.adapters.css.site4",p)}},m=f=>{f.baseDelay?f.el.style.animationDelay=f.baseDelay:f.el.style.removeProperty("animation-delay"),f.basePlayState?f.el.style.animationPlayState=f.basePlayState:f.el.style.removeProperty("animation-play-state")};return{name:"css",discover:()=>{for(let p of t)m(p);let f=new Map(t.map(p=>[p.el,p.handles]));t=[];let b=document.querySelectorAll("*");for(let p of b){if(!ye(p))continue;let y=window.getComputedStyle(p);!y.animationName||y.animationName==="none"||t.push({el:p,baseDelay:p.style.animationDelay||"",basePlayState:p.style.animationPlayState||"",...a(y),handles:f.get(p)})}},getAnimationCycleEndSeconds:()=>{let f=0;for(let b of t)!b.el.isConnected||b.cycleSeconds<=0||(f=Math.max(f,o(b.el)+b.cycleSeconds));return f>0?f:null},getInferredDurationSeconds:()=>{let f=0;for(let b of t){if(!b.el.isConnected)continue;let p=o(b.el);for(let y of n(b.el)){let x=l(y,p);x.endSeconds!=null&&(f=Math.max(f,x.endSeconds))}}return f>0?f:null},seek:f=>{let b=Number(f.time)||0,p=r(f.pageAnimations);for(let y of t)y.handles=i(y.handles,p.get(y.el));for(let y of t){if(!y.el.isConnected)continue;let x=o(y.el),v=Math.max(0,b-x)*1e3;if(y.handles?.length){y.el.style.animationDelay!==y.baseDelay&&m(y),s(y.handles,v);continue}y.el.style.animationPlayState="paused",y.el.style.animationDelay=y.delays.map(_=>`${Number((_-v/1e3).toFixed(3))}s`).join(", ")}},pause:f=>{let b=r(f?.pageAnimations);for(let p of t){if(!p.el.isConnected)continue;let y=b.get(p.el);y&&(d(y),m(p))}},play:()=>{let f=r();for(let b of t)b.el.isConnected&&(m(b),u(f.get(b.el)??[]))},revert:()=>{t=[]}}}function fd(e){return{name:"gsap",discover:()=>{},seek:t=>{let n=e.getTimeline();if(!n)return;n.pause();let r=Math.max(0,Number(t.time)||0),i=t.suppressEvents===!0;typeof n.totalTime=="function"?(n.totalTime(r+.001,!0),n.totalTime(r,i)):n.seek(r,i)},pause:()=>{let t=e.getTimeline();t&&t.pause()}}}function md(){return{name:"animejs",discover:()=>{try{let e=window.anime;if(!e||typeof e.running>"u")return;let t=e.running;if(!Array.isArray(t)||t.length===0)return;let n=window.__hfAnime??[],r=new Set(n);for(let i of t)r.has(i)||n.push(i);window.__hfAnime=n}catch(e){P("runtime.adapters.animejs.site1",e)}},seek:e=>{let t=Math.max(0,(Number(e.time)||0)*1e3),n=window.__hfAnime;if(!(!n||n.length===0))for(let r of n)try{typeof r.seek=="function"&&r.seek(t)}catch(i){P("runtime.adapters.animejs.site2",i)}},pause:()=>{let e=window.__hfAnime;if(!(!e||e.length===0))for(let t of e)try{typeof t.pause=="function"&&t.pause()}catch(n){P("runtime.adapters.animejs.site3",n)}},play:()=>{let e=window.__hfAnime;if(!(!e||e.length===0))for(let t of e)try{typeof t.play=="function"&&t.play()}catch(n){P("runtime.adapters.animejs.site4",n)}},revert:()=>{}}}function xd(e){let t=r=>{let i=hd(r),o=i&&typeof i.closest=="function"?i.closest("[data-composition-id]"):null;return o&&e?.resolveStartSeconds?e.resolveStartSeconds(o):0},n=(r,i)=>Math.max(0,i-t(r));return{name:"lottie",discover:()=>{try{let r=window.lottie;if(r&&typeof r.getRegisteredAnimations=="function"){let i=r.getRegisteredAnimations();if(Array.isArray(i)&&i.length>0){let o=window.__hfLottie??[],a=new Set(o);for(let l of i)a.has(l)||o.push(l);window.__hfLottie=o}}}catch(r){P("runtime.adapters.lottie.site1",r)}},seek:r=>{let i=Math.max(0,Number(r.time)||0),o=window.__hfLottie;if(!(!o||o.length===0))for(let a of o)try{let l=n(a,i),s=a.loop===!0;if(Ui(a)){let u=l*a.frameRate;a.totalFrames>0&&s?a.goToAndStop(gd(u,a.totalFrames),!0):a.totalFrames>0&&u>=a.totalFrames?a.goToAndStop(a.totalFrames-1,!0):a.goToAndStop(l*1e3,!1)}else if(Wa(a)){if(typeof a.setCurrentRawFrameValue=="function"){let u=a.totalFrames??0,d=a.frameRate??30,m=s&&u>0?gd(l*d,u):l*d;u>0&&a.setCurrentRawFrameValue(Math.min(m,u-1))}else if(typeof a.seek=="function"){let u=a.duration??0;if(Number.isFinite(u)&&u>0){let d=Math.min(100,(s?l%u:l)/u*100);a.seek(d)}}}}catch(l){P("runtime.adapters.lottie.site2",l)}},pause:()=>{let r=window.__hfLottie;if(!(!r||r.length===0))for(let i of r)try{(Ui(i)||Wa(i))&&i.pause()}catch(o){P("runtime.adapters.lottie.site3",o)}},revert:()=>{},getInferredDurationSeconds:()=>pd((r,i)=>i),getAnimationCycleEndSeconds:()=>pd((r,i)=>hd(r)?.isConnected===!1?null:t(r)+i)}}function pd(e){let t=window.__hfLottie;if(!t||t.length===0)return null;let n=0,r=!1;for(let i of t){let o=null;try{let a=zx(i);o=a==null?null:e(i,a)}catch(a){P("runtime.adapters.lottie.site4",a)}o!=null&&(r=!0,n=Math.max(n,o))}return r?n:null}function hd(e){return Ui(e)?e.wrapper:e.canvas}function gd(e,t){let n=e%t;return t-n<1e-6?0:n}function bd(e,t){return!Number.isFinite(e)||!e||e<=0||!Number.isFinite(t)||!t||t<=0?null:e/t}function zx(e){return Ui(e)?bd(e.totalFrames,e.frameRate):Wa(e)?Number.isFinite(e.duration)&&(e.duration??0)>0?e.duration??null:bd(e.totalFrames,e.frameRate):null}function Ui(e){return typeof e=="object"&&e!==null&&typeof e.goToAndStop=="function"}function Wa(e){return typeof e=="object"&&e!==null&&typeof e.pause=="function"&&("totalFrames"in e||"duration"in e)}var Va=-1,Wi=new Set,kn,$a=0;function yd(e){let t=[],n=!0,r={time:e,waitUntil:i=>{if(!n)throw new Error("hf-seek waitUntil() must be called synchronously from the event listener");t.push(i)}};try{window.dispatchEvent(new CustomEvent("hf-seek",{detail:r}))}catch(i){P("runtime.adapters.seek-dispatch.site1",i)}finally{n=!1}t.length!==0&&_t(Promise.all(t))}function _t(e){let t=e.then(()=>({status:"fulfilled"})).catch(n=>({status:"rejected",reason:n}));Wi.add(t),t.then(n=>{Wi.delete(t)&&n.status==="rejected"&&kn===void 0&&(kn={reason:n.reason})})}function Vi(e){e!==Va&&(Va=e,yd(e))}function $i(e){Va=e,yd(e)}function Sd(){return $a>0}async function za(){$a+=1;let e=kn;try{for(await Promise.resolve();Wi.size>0;){let r=(await Promise.all([...Wi])).find(i=>i.status==="rejected");e===void 0&&r?.status==="rejected"&&(e={reason:r.reason})}let t=kn;if(e===void 0&&(e=t),kn===t&&(kn=void 0),e)throw e.reason}finally{$a-=1}}function vd(){let e=null,t=0,n=null,r=null,i=null,o=null,a=()=>{if(typeof window>"u")return null;let d=window.THREE?.DefaultLoadingManager;return!d||typeof d!="object"||typeof d.itemsLoaded!="number"||typeof d.itemsTotal!="number"?null:d},l=u=>{o||u.itemsTotal<=u.itemsLoaded||(o=new Promise(d=>{u.onLoad=function(){try{i?.call(this)}finally{o=null,u.onLoad=i??null,d()}}}))},s=u=>{n!==u&&(n=u,r=u.onStart??null,i=u.onLoad??null,u.onStart=function(d,m,f){try{r?.call(this,d,m,f)}finally{l(u)}})};return{name:"three",discover:()=>{let u=a();u&&(s(u),l(u))},seek:u=>{e=Math.max(0,Number(u.time)||0),t=e,window.__hfThreeTime=e,Vi(e)},pause:()=>{e==null&&(e=Math.max(0,t))},play:()=>{e=null},revert:()=>{e=null,t=0},getReadyPromise:()=>{let u=a();return!u||u.itemsTotal<=u.itemsLoaded?null:(o||l(u),o)}}}function mt(e){let t=null,n=new WeakSet;return{name:e.name,discover:()=>{},seek:()=>{},pause:()=>{},play:()=>{},revert:()=>{},getReadyPromise:()=>{let r=e.getInstances();if(r.length===0)return null;let i=r.filter(o=>!n.has(o));return i.length===0?null:t||(t=Promise.allSettled(i.map(o=>e.waitFor(o).then(()=>{n.add(o)}))).then(()=>{t=null}),t)}}}function Ed(){return mt({name:"mapbox",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfMapbox;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>{if(e.loaded()){t();return}e.on("load",t)})})}function Ad(){return mt({name:"leaflet",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfLeaflet;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>e.whenReady(t))})}function _d(){return mt({name:"google-maps",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfGoogleMaps;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>{let n=e.addListener("tilesloaded",()=>{n.remove(),t()})})})}function wd(){return mt({name:"maplibre",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfMaplibre;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>{if(e.loaded()){t();return}e.on("load",t)})})}function Cd(){return mt({name:"d3",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfD3;return Array.isArray(e)?e:[]},waitFor:e=>e.end()})}var qx=250;function Td(){let e=null,t=0,n=null,r=()=>{n!==null&&(window.clearInterval(n),n=null)},i=()=>{n===null&&document.querySelector("[data-composition-id][data-requires-webgpu]")&&(n=window.setInterval(()=>{e!==null&&(Sd()||(window.__hfTypegpuTime=e,$i(e)))},qx))};return{name:"typegpu",discover:()=>{},seek:o=>{e=Math.max(0,Number(o.time)||0),t=e,window.__hfTypegpuTime=e,Vi(e)},pause:()=>{e==null&&(e=Math.max(0,t)),i()},play:()=>{r(),e=null},revert:()=>{r(),e=null,t=0}}}var hr="data-hf-render-id",Rd="data-hf-group-render-id";function jx(e){return e.getAttribute(hr)||e.id||null}var Kx="__render_frame_",Xx="__";function Yx(e){return`${Kx}${e}${Xx}`}function Jx(e){let t=jx(e);return t?Yx(t):null}function wt(e){let t=Jx(e);if(!t)return null;let n=document.getElementById(t);return Oe(n)?n:null}function kd(e){let t=e.nextElementSibling;if(Oe(t)&&t.classList.contains("__render_frame__")&&t.complete&&t.naturalWidth>0)return t;let n=wt(e);return n&&n.complete&&n.naturalWidth>0?n:null}function Md(){let e=globalThis.GPUQueue;if(!e?.prototype?.copyExternalImageToTexture)return;let t=e.prototype.copyExternalImageToTexture;e.prototype.copyExternalImageToTexture=function(n,r,i){if(Ee(n?.source)){let o=kd(n.source);if(o)return t.call(this,{...n,source:o},r,i)}return t.call(this,n,r,i)}}function Nd(){let e=[globalThis.WebGL2RenderingContext,globalThis.WebGLRenderingContext],t=["texImage2D","texSubImage2D"];for(let n of e){let r=n?.prototype;if(r)for(let i of t){let o=r[i];if(typeof o!="function"||o.__hfVideoPatched)continue;let a=function(...l){let s=l.length-1,u=l[s];if(Ee(u)){let d=kd(u);d&&(l[s]=d)}return o.apply(this,l)};a.__hfVideoPatched=!0,r[i]=a}}}var cn="data-fx-chain",HR=cn.slice(5),Ld=1,gr=(e="frequency",t="Frequency",n=1e3,r=20,i=2e4)=>({kind:"number",key:e,label:t,unit:"Hz",min:r,max:i,step:1,default:n,scale:"log",automatable:!0}),qa=(e=.707,t="Bandwidth \\u2014 higher is narrower.")=>({kind:"number",key:"q",label:"Q",unit:"",min:.1,max:20,step:.01,default:e,scale:"log",automatable:!0,hint:t}),zi=(e=-40,t=40,n=0)=>({kind:"number",key:"gain",label:"Gain",unit:"dB",min:e,max:t,step:.1,default:n,automatable:!0}),Fd={kind:"enum",key:"poles",label:"Slope",options:[{value:"1",label:"6 dB/oct"},{value:"2",label:"12 dB/oct"}],default:"2",hint:"Two poles is the usual biquad; one pole is gentler."},Id=[{id:"gain",label:"Gain",group:"dynamics",description:"Raise or lower the whole signal. Automate it to duck under something else.",params:[zi(-60,12,0)],web:"gain-node"},{id:"peaking",label:"Peaking EQ",group:"filter",description:"Boost or cut a band, leaving everything either side alone.",params:[gr("frequency","Frequency",1e3),zi(-40,40,0),qa(1)],web:"biquad-peaking"},{id:"lowshelf",label:"Low Shelf",group:"filter",description:"Lift or drop everything below the corner frequency.",params:[gr("frequency","Frequency",200,20,2e3),zi(-40,40,0)],web:"biquad-lowshelf"},{id:"highshelf",label:"High Shelf",group:"filter",description:"Lift or drop everything above the corner frequency.",params:[gr("frequency","Frequency",4e3,500,2e4),zi(-40,40,0)],web:"biquad-highshelf"},{id:"highpass",label:"High-pass",group:"filter",description:"Remove low frequencies \\u2014 the usual fix for rumble on a voice.",params:[gr("frequency","Cutoff",300,20,2e4),qa(.707),Fd],web:"biquad-highpass"},{id:"lowpass",label:"Low-pass",group:"filter",description:"Remove high frequencies \\u2014 darkens or muffles a track.",params:[gr("frequency","Cutoff",8e3,100,2e4),qa(.707),Fd],web:"biquad-lowpass"},{id:"compressor",label:"Compressor",group:"dynamics",description:"Pull loud parts down so the quiet ones can come up.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-60,max:0,step:.5,default:-24,hint:"Level above which the compressor starts working."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:4},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:2e3,step:.1,default:20,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:250,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83,hint:"1 is a hard corner; higher eases into it."},{kind:"number",key:"makeup",label:"Makeup",unit:"dB",min:0,max:36,step:.1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1,hint:"Below 1 blends the dry signal back in."}],web:"worklet-compressor"},{id:"limiter",label:"Limiter",group:"dynamics",description:"Hard ceiling \\u2014 nothing gets past the limit.",params:[{kind:"number",key:"limit",label:"Ceiling",unit:"dB",min:-24,max:0,step:.1,default:-1},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.1,max:80,step:.1,default:5},{kind:"number",key:"release",label:"Release",unit:"ms",min:1,max:8e3,step:1,default:50,scale:"log"},{kind:"number",key:"level_out",label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0}],web:"worklet-limiter"},{id:"gate",label:"Noise Gate",group:"dynamics",description:"Silence the track when it drops below the threshold.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-80,max:0,step:.5,default:-35},{kind:"number",key:"range",label:"Range",unit:"dB",min:-80,max:0,step:.5,default:-24,hint:"How far down the gate pulls when closed."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:10},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:9e3,step:.1,default:1,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:100,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83}],web:"worklet-gate"},{id:"saturate",label:"Saturation",group:"nonlinear",description:"Soft-clip the waveform for warmth or outright distortion.",params:[{kind:"enum",key:"type",label:"Curve",options:[{value:"tanh",label:"Tanh"},{value:"atan",label:"Arctan"},{value:"cubic",label:"Cubic"},{value:"exp",label:"Exponential"},{value:"alg",label:"Algebraic"},{value:"quintic",label:"Quintic"},{value:"sin",label:"Sine"},{value:"erf",label:"Error function"},{value:"hard",label:"Hard clip"}],default:"tanh"},{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-40,max:0,step:.1,default:-6},{kind:"number",key:"output",automatable:!0,label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0},{kind:"number",key:"oversample",label:"Oversample",unit:"x",min:1,max:8,step:1,default:4,hint:"Higher costs more but keeps aliasing down."}],web:"waveshaper"},{id:"bitcrush",label:"Bitcrush",group:"nonlinear",description:"Drop bit depth and sample rate for a lo-fi, digital sound.",params:[{kind:"number",key:"bits",label:"Bit depth",unit:"bit",min:1,max:32,step:.1,default:8},{kind:"number",key:"samples",label:"Sample hold",unit:"x",min:1,max:250,step:1,default:1,hint:"Repeats each sample N times \\u2014 a crude downsample."},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-bitcrush"},{id:"pitchshift",label:"Pitch shift",group:"time",description:"Shifts pitch up or down without changing playback speed. Adds ~50 ms of latency.",params:[{kind:"number",key:"semitones",label:"Semitones",unit:"st",min:-12,max:12,step:1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-pitchshift"},{id:"delay",label:"Delay",group:"time",description:"Repeating echoes behind the dry signal.",params:[{kind:"number",key:"time",automatable:!0,label:"Time",unit:"ms",min:1,max:5e3,step:1,default:250,scale:"log"},{kind:"number",key:"feedback",automatable:!0,label:"Feedback",unit:"",min:.01,max:.95,step:.01,default:.35},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.4}],web:"delay-feedback"},{id:"chorus",label:"Chorus",group:"time",description:"Detuned copies of the signal for width and thickness.",params:[{kind:"number",key:"delay",automatable:!0,label:"Delay",unit:"ms",min:1,max:100,step:.1,default:7},{kind:"number",key:"depth",automatable:!0,label:"Depth",unit:"ms",min:0,max:10,step:.01,default:2},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.01,max:10,step:.01,default:1},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.5}],web:"chorus-lfo"},{id:"phaser",label:"Phaser",group:"time",description:"Sweeping notches moving through the spectrum.",params:[{kind:"number",key:"in_gain",automatable:!0,label:"Input",unit:"",min:0,max:1,step:.01,default:.4},{kind:"number",key:"out_gain",automatable:!0,label:"Output",unit:"",min:0,max:2,step:.01,default:.74},{kind:"number",key:"delay",label:"Delay",unit:"ms",min:.1,max:5,step:.1,default:3},{kind:"number",key:"decay",label:"Decay",unit:"",min:0,max:.99,step:.01,default:.4},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.1,max:2,step:.01,default:.5},{kind:"enum",key:"type",label:"Waveform",options:[{value:"0",label:"Triangular"},{value:"1",label:"Sinusoidal"}],default:"0"}],web:"allpass-phaser"},{id:"reverb",label:"Reverb",group:"time",description:"Room tail. Both ends convolve the same generated impulse, so preview matches render.",params:[{kind:"number",key:"size",label:"Room size",unit:"",min:.05,max:1,step:.01,default:.7},{kind:"number",key:"damping",label:"Damping",unit:"",min:0,max:1,step:.01,default:.5,hint:"Higher rolls the top off the tail faster."},{kind:"number",key:"wet",automatable:!0,label:"Wet",unit:"",min:0,max:1,step:.01,default:.35},{kind:"number",key:"dry",automatable:!0,label:"Dry",unit:"",min:0,max:1,step:.01,default:.7}],web:"convolver"}],ja=new Map(Id.map(e=>[e.id,e]));function br(e){return ja.get(e)}var GR=Id.map(e=>e.id);function xr(e,t){let n=ja.get(e);if(!n)return{};let r={};for(let i of n.params){let o=t?.[i.key];if(i.kind==="enum"){let l=i.options.some(s=>s.value===o);r[i.key]=l?o:i.default;continue}let a=typeof o=="number"?o:typeof o=="string"&&o.trim()!==""?Number(o):Number.NaN;r[i.key]=Number.isFinite(a)?Math.min(i.max,Math.max(i.min,a)):i.default}return r}var Ht=class extends Error{constructor(t){super(t),this.name="AudioFxChainError"}};function Pd(e){let t;try{t=JSON.parse(e)}catch(i){throw new Ht(`Chain file is not valid JSON: ${i.message}`)}if(typeof t!="object"||t===null)throw new Ht("Chain file must be a JSON object.");let n=t;if(n.version!==Ld)throw new Ht(`Unsupported chain version: ${String(n.version)}`);if(!Array.isArray(n.nodes))throw new Ht("Chain file is missing a `nodes` array.");let r=n.nodes.map(Qx);return{version:Ld,nodes:r}}function yr(e){return e.nodes.filter(t=>t.enabled!==!1)}function Qx(e,t){if(typeof e!="object"||e===null)throw new Ht(`Node ${t} is not an object.`);let n=e;if(typeof n.type!="string"||!ja.has(n.type))throw new Ht(`Node ${t} has unknown effect type: ${String(n.type)}`);return ey({type:n.type,id:qi(n.id),fromCarve:Dd(n.fromCarve),fromPreset:qi(n.fromPreset),label:qi(n.label),fromEq:qi(n.fromEq),fromLeveller:Dd(n.fromLeveller),presetAmount:Zx(n.presetAmount),enabled:n.enabled!==!1,params:xr(n.type,n.params??void 0)})}function qi(e){return typeof e=="string"&&e?e:void 0}function Dd(e){return e===!0?!0:void 0}function Zx(e){if(!(typeof e!="number"||!Number.isFinite(e)))return Math.min(1,Math.max(0,e))}function ey(e){for(let t of Object.keys(e))e[t]===void 0&&delete e[t];return e}function ty(e){return 10**(e/20)}var Ka=ty(12);function Je(e){return Number.isFinite(e)?Math.max(0,Math.min(Ka,e)):1}function ji(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):1}function Od(e,t){let n=typeof HTMLMediaElement>"u"?void 0:Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype,"volume"),r=n?.get,i=n?.set;if(!r||!i)return t();let o=Number(r.call(e));Object.defineProperty(e,"volume",{configurable:!0,get:()=>o,set:a=>{o=Number(a),i.call(e,ji(o))}});try{return t()}finally{delete e.volume,i.call(e,ji(o))}}var Mn=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),WR=Object.freeze([Mn.start,Mn.duration,Mn.trackIndex]),VR=Object.freeze([Mn.derivedEnd]),$R=Object.freeze([Mn.derivedEnd,Mn.legacyTrack]);function Gt(e){if(e==null||e.trim()==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}var Gd=/^[A-Za-z0-9_.:-]+$/;function Bd(e,t){let n=e.charCodeAt(t);return n>=48&&n<=57}function Hd(e,t){let n=t;for(;n>=0&&Bd(e,n);)n--;return n}function ny(e,t){let n=t;for(;n>=0&&(e[n]??"").trim()==="";)n--;return n}function ry(e){let t=e.length-1;if(!Bd(e,t))return null;let n=Hd(e,t);return e[n]==="."&&(n=Hd(e,n-1)),n+1}function iy(e){let t=ry(e);if(t==null)return null;let n=ny(e,t-1),r=e[n];if(r!=="+"&&r!=="-")return null;let i=e.slice(0,n).trim();if(!Gd.test(i))return null;let o=Number(e.slice(t));return Number.isFinite(o)?{refId:i,operator:r,magnitude:o}:null}function Xa(e){let t=(e??"").trim();if(!t)return null;let n=Gt(t);if(n!=null)return{kind:"absolute",value:n};if(Gd.test(t))return{kind:"reference",refId:t,offset:0};let r=iy(t);return r?{kind:"reference",refId:r.refId,offset:r.operator==="-"?-r.magnitude:r.magnitude}:null}var Ud=e=>{let t=Gt(e);return t!==null&&t>=0?t:null};function Wd(e){return Ud(e("data-playback-start"))??Ud(e("data-media-start"))??0}var Sr=.1,vr=10;function Ya(e){return Number.isFinite(e)&&e>0?Math.max(Sr,Math.min(vr,e)):1}function Vd(e,t=1){let n=Number.parseFloat(e("data-playback-rate")??"");return Ya(Number.isFinite(n)&&n>0?n:t)}function Ja(e){let t=Gt(e("data-duration"));return t!==null&&t>0?t:null}function $d(e,t){let n=Ja(e);if(n!==null)return n;let r=Gt(e("data-end"));return r!==null?r-t:null}var oy=3;function Qa(e,t,n){return Number.isFinite(e)?Math.max(0,e-t)/Ya(n):null}function Za(e){let{tag:t,authoredDurationSeconds:n,sourceDurationSeconds:r,mediaStartSeconds:i,playbackRate:o}=e;if(n!==null&&n>0)return{seconds:n,source:"authored"};if(t==="img")return{seconds:oy,source:"default"};if(r===null)return{seconds:null,source:"pending",reason:"source duration not yet probed"};let a=Qa(r,i,o);return a===null?{seconds:null,source:"pending",reason:"source reported a non-finite duration"}:{seconds:a,source:"media"}}var Tt="data-automation",ek=Tt.slice(5),Ki=1,ay=512,Ct=class extends Error{constructor(t){super(t),this.name="AudioAutomationError"}},Nn="volume",Xi="rate";function Ar(e){if(e===Nn)return{kind:"volume"};if(e===Xi)return{kind:"rate"};let t=e.split(".");if(t.length===3&&t[0]==="fx"&&t[1]===sy){let i=t[2];return i?{kind:"preset",presetId:i}:null}if(t.length!==3||t[0]!=="fx")return null;let[,n,r]=t;return!n||!r?null:{kind:"fx",nodeId:n,param:r}}var sy="preset";var ly={min:0,max:1,step:.01,unit:"",label:"Amount",scale:"linear",default:1},Yi={min:0,max:Ka,step:.01,unit:"",label:"Volume",scale:"linear",default:1},zd={min:Sr,max:vr,step:.05,unit:"x",label:"Speed",scale:"log",default:1};function es(e,t){let n=Ar(e);if(!n)return null;if(n.kind==="volume")return Yi;if(n.kind==="rate")return zd;if(n.kind==="preset")return t?.nodes.some(l=>l.fromPreset===n.presetId)?{...ly,label:`${n.presetId} \\xB7 Amount`}:null;let r=t?.nodes.find(a=>a.id===n.nodeId);if(!r)return null;let i=br(r.type),o=i?.params.find(a=>a.key===n.param);return!o||o.kind!=="number"?null:{min:o.min,max:o.max,step:o.step,unit:o.unit,label:`${i?.label??r.type} \\xB7 ${o.label}`,scale:o.scale==="log"&&o.min>0?"log":"linear",default:o.default}}function Er(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let t=Number(e);return Number.isFinite(t)?t:null}return null}function uy(e){let t=Er(e);return t===null||t===0?0:Math.min(1,Math.max(-1,t))}function qd(e,t){let n=Er(e),r=Er(t);if(n===null||r===null)return null;let i=l=>Math.min(.999,Math.max(.001,l)),o=i(n),a=i(r);return Math.abs(o-a)<1e-6?null:{x:o,y:a}}function cy(e){let t=uy(e?.curve),n=qd(e?.viaX,e?.viaY);return{...t?{curve:t}:{},...n?{viaX:n.x,viaY:n.y}:{}}}function dy(e,t){let n=Er(e?.t),r=Er(e?.v);if(n===null||r===null)return null;let i=t?Math.min(t.max,Math.max(t.min,r)):r;return{t:Math.max(0,n),v:i,...cy(e)}}function jd(e,t){let n=e.map(i=>dy(i,t)).filter(i=>i!==null).sort((i,o)=>i.t-o.t),r=[];for(let i of n)r.length>0&&r[r.length-1].t===i.t?r[r.length-1]=i:r.push(i);return r.slice(0,ay)}function fy(e){let t=[];for(let n of e.lanes){if(!Ar(n.target))continue;let r=n.target===Nn?Yi:n.target===Xi?zd:null,i=jd(n.points??[],r);i.length>0&&t.push({target:n.target,points:i})}return{version:Ki,lanes:t}}function Kd(e,t){let n=[];for(let r of e.lanes){let i=es(r.target,t);if(!i)continue;let o=jd(r.points,i);o.length>0&&n.push({target:r.target,points:o})}return{version:Ki,lanes:n}}function Ji(e){let t;try{t=JSON.parse(e)}catch(i){throw new Ct(`Automation is not valid JSON: ${i.message}`)}if(typeof t!="object"||t===null)throw new Ct("Automation must be a JSON object.");let n=t;if(n.version!==Ki)throw new Ct(`Unsupported automation version: ${String(n.version)}`);if(!Array.isArray(n.lanes))throw new Ct("Automation is missing a `lanes` array.");let r=n.lanes.map((i,o)=>{if(typeof i!="object"||i===null)throw new Ct(`Lane ${o} is not an object.`);let a=i;if(typeof a.target!="string"||!Ar(a.target))throw new Ct(`Lane ${o} has an unreadable target: ${String(a.target)}`);if(!Array.isArray(a.points))throw new Ct(`Lane ${o} is missing a \\`points\\` array.`);return{target:a.target,points:a.points}});return fy({version:Ki,lanes:r})}function my(e,t){return t?Math.pow(e,Math.pow(2,2*t)):e}function py(e,t){let n=e-.5,r=t-.5,i=.999,o=1e6,a=n>0?n/(i-e):n<0?-n/(e-(1-i)):0,l=r>0?r/(i-t):r<0?-r/(t-(1-i)):0,s=Math.min(o,Math.max(1,a,l));return{cx:e+n/s,cy:t+r/s,w:s}}function hy(e,t,n){let{cx:r,cy:i,w:o}=py(t,n),a=2-2*o,l=e*a-1+2*o*r,s=-e*a-2*o*r,u=gy(l,s,e),d=1-u,m=d*d+2*o*u*d+u*u;return m>0?(2*o*i*u*d+u*u)/m:e}function gy(e,t,n){if(Math.abs(e)<1e-12)return Math.abs(t)<1e-12?n:-n/t;let r=Math.sqrt(Math.max(0,t*t-4*e*n)),i=(-t+r)/(2*e),o=(-t-r)/(2*e),a=l=>l>=-1e-9&&l<=1+1e-9;return a(i)?Math.min(1,Math.max(0,i)):a(o)?Math.min(1,Math.max(0,o)):n}function by(e,t){let n=qd(t.viaX,t.viaY);return n?hy(Math.min(1,Math.max(0,e)),n.x,n.y):my(e,t.curve)}function xy(e,t,n,r){return r==="log"&&e>0&&t>0?Math.exp(Math.log(e)+(Math.log(t)-Math.log(e))*n):e+(t-e)*n}function Rt(e,t,n="linear"){let r=e.points;if(r.length===0)return 0;let i=r[0];if(t<=i.t)return i.v;let o=r[r.length-1];if(t>=o.t)return o.v;let a=0,l=r.length-1;for(;l-a>1;){let m=a+l>>1;r[m].t<=t?a=m:l=m}let s=r[a],u=r[l],d=u.t-s.t;return d<=0?u.v:xy(s.v,u.v,by((t-s.t)/d,s),n)}function Xd(e){return e.points.length<=1||e.points.every(t=>t.v===e.points[0].v)}function Yd(e,t,n,r,i="linear"){let o=Math.max(2,Math.floor(r)),a=new Float32Array(o),l=n-t;for(let s=0;s<o;s+=1)a[s]=Rt(e,t+l*s/(o-1),i);return a}var Qi=new Map,yy=64;function ts(e,t=Nn){let n=`${t}\\0${e}`,r=Qi.get(n);if(r!==void 0)return r;let i=null;try{i=Ji(e).lanes.find(o=>o.target===t)??null}catch{i=null}return Qi.size>yy&&Qi.clear(),Qi.set(n,i),i}function Jd(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(Tt):null)??"";if(!n)return null;let r=ts(n);return!r||r.points.length===0?null:Rt(r,t)}var Qd=48,Zd=new WeakMap;function Sy(e){let t=e.points,n=t[0].v,r=t[t.length-1].v,i=[0],o=[0],a=s=>{let u=i[i.length-1];if(s<=u)return;let d=Rt(e,u,"log");i.push(s),o.push(o[o.length-1]+(d+Rt(e,s,"log"))/2*(s-u))},l=Math.max(0,t[0].t);a(l);for(let s=1;s<t.length;s+=1){let u=t[s-1].t,d=t[s].t;if(!(d<=0))for(let m=1;m<=Qd;m+=1)a(Math.max(u,0)+(d-u)*m/Qd)}return{ts:Float64Array.from(i),ss:Float64Array.from(o),firstRate:n,lastRate:r}}function ef(e){let t=Zd.get(e);return t||(t=Sy(e),Zd.set(e,t)),t}function ns(e){return typeof e!="number"&&e.points.length>0}function rs(e,t){return typeof e=="number"?e:ns(e)?Rt(e,t,"log"):1}function tf(e,t,n){let r=0,i=e.length-1;for(;i-r>1;){let o=r+i>>1;e[o]<=n?r=o:i=o}return t[r]+(t[i]-t[r])*(n-e[r])/(e[i]-e[r])}function Zi(e,t){if(typeof e=="number")return t*e;if(!ns(e))return t;let{ts:n,ss:r,firstRate:i,lastRate:o}=ef(e),a=n.length-1;return t<=0?t*i:t>=n[a]?r[a]+(t-n[a])*o:tf(n,r,t)}function dn(e,t){if(typeof e=="number")return t/e;if(!ns(e))return t;let{ts:n,ss:r,firstRate:i,lastRate:o}=ef(e),a=n.length-1;return t<=0?t/i:t>=r[a]?n[a]+(t-r[a])/o:tf(r,n,t)}function vy(e){return e?ts(e,Xi):null}function nf(e,t){return vy(e)??t}function rf(){let e=!1,t=0,n=!1,r,i,o,a=new Set,l=new WeakMap,s=(x=()=>document.getAnimations())=>{if(!document.getAnimations)return[];try{return x()}catch{return[]}},u=x=>{let v=Number(x.currentTime);return Number.isFinite(v)&&v>0?v:0},d=(x,v)=>v<=0?x:x>=v?Math.max(0,x-v):x,m=(x,v)=>{let _=l.get(x);if(_)return _;let w={compositionTimeMs:v,animationTimeMs:e?d(u(x),v):u(x)};return l.set(x,w),w},f=(x,v)=>{if(!a.has(x)){a.add(x);let _=()=>{a.delete(x)};try{x.addEventListener("finish",_,{once:!0}),x.addEventListener("cancel",_,{once:!0})}catch(w){P("runtime.adapters.waapi.site4",w)}}m(x,v)},b=(x,v)=>{for(let _ of x)f(_,v)},p=()=>{if(n||typeof Element>"u")return;let x=Element.prototype;if(typeof x.animate!="function"||x.__hfOriginalAnimate)return;let v=x.animate;try{Object.defineProperty(x,"__hfOriginalAnimate",{value:v,configurable:!0});let _=function(...w){let I=v.apply(this,w);return f(I,t),I};x.animate=_,r=x,i=v,o=_,n=!0}catch{}},y=x=>{let v=null;try{v=x.effect?.getComputedTiming?.()??null}catch(I){P("runtime.adapters.waapi.site4",I)}if(!v)return{};let _=Number(v.endTime);return Number.isFinite(_)?{endSeconds:(l.get(x)?.compositionTimeMs??0)/1e3+_/1e3}:{unbounded:!0}};return{name:"waapi",discover:()=>{e=!0,p(),b(s(),t)},seek:x=>{let v=Math.max(0,(Number(x.time)||0)*1e3);t=v,(!e||a.size>0)&&b(s(x.pageAnimations),e?v:0);for(let _ of a){let w=e?m(_,v):m(_,0),I=w.animationTimeMs+Math.max(0,v-w.compositionTimeMs);try{_.currentTime=I}catch(D){P("runtime.adapters.waapi.site1",D)}try{_.pause()}catch(D){P("runtime.adapters.waapi.site2",D)}}},pause:x=>{e||b(s(x?.pageAnimations),t);for(let v of a)try{v.pause()}catch(_){P("runtime.adapters.waapi.site3",_)}},revert:()=>{if(a.clear(),l=new WeakMap,e=!1,t=0,r&&i&&o&&r.animate===o)try{r.animate=i,r.__hfOriginalAnimate===i&&delete r.__hfOriginalAnimate}catch(x){P("runtime.adapters.waapi.site5",x)}r=void 0,i=void 0,o=void 0,n=!1},getInferredDurationSeconds:()=>{let x=0;for(let v of s()){let _=y(v);_.endSeconds!=null&&(x=Math.max(x,_.endSeconds))}return x>0?x:null}}}function Fe(e){return Gt(e)}function Ve(e){return Vd(t=>e.getAttribute(t),be(e)?e.defaultPlaybackRate:1)}function Bt(e){return nf(e.getAttribute("data-automation"),Ve(e))}function eo(e){return Wd(t=>e.getAttribute(t))}function pt(e,t){return Ey(t,eo(e),Bt(e))}function to(e){let t=Za({tag:"video",authoredDurationSeconds:Ja(n=>e.getAttribute(n)),sourceDurationSeconds:Number.isFinite(e.duration)?e.duration:null,mediaStartSeconds:eo(e),playbackRate:Ve(e)});return t.source==="media"?pt(e,e.duration):t.seconds}function Ln(e,t=0){return!Oe(e)||!e.hasAttribute("data-start")&&!e.hasAttribute("data-track-index")?null:Za({tag:"img",authoredDurationSeconds:$d(n=>e.getAttribute(n),t),sourceDurationSeconds:null,mediaStartSeconds:0,playbackRate:1}).seconds}function Ey(e,t,n){return typeof n=="number"?Qa(e,t,n):Number.isFinite(e)?dn(n,Math.max(0,e-t)):null}var Fn="data-hf-authored-duration",Dn="data-hf-authored-end";function _r(e){if(e==null||typeof e=="string"&&e.trim()==="")return null;let t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:null}function In(e){let t=_r(e.start);if(t==null)return null;let n=Math.max(0,t),r=_r(e.duration),i=_r(e.authoredDuration),o=r!=null&&r>0?r:i!=null&&i>0?i:null;if(o!=null)return{start:n,duration:o,end:n+o};let a=_r(e.end),l=_r(e.authoredEnd),s=a!=null&&a>n?a:l!=null&&l>n?l:null;return{start:n,duration:s==null?null:s-n,end:s}}var no="data-hf-media-start-basis";function of(e){return e?.trim().toLowerCase()==="global"?"global":"local"}function Ay(e){return of(e.basis)==="global"?e.authoredStart:e.hostStart+e.authoredStart}function af(e){return lf(e)?Ay({authoredStart:e.authoredStart,hostStart:e.hostStart,basis:e.basis}):e.ordinaryStart()}function sf(e){return lf(e)&&of(e.basis)==="global"}function lf(e){return!e.hasAutoStart&&e.authoredStart!=null&&e.hostStart>0}function Qe(e){let t=e.timelineRegistry??{},n=e.includeAuthoredTimingAttrs??!1,r=e.documentRef??document,i=new WeakMap,o=new WeakMap,a=new Set,l=p=>{let y=r.getElementById(p);return y||(r.querySelector(`[data-composition-id="${CSS.escape(p)}"]`)??null)},s=p=>{let y=o.get(p);if(y!==void 0)return y;let x=null,v=In({start:0,duration:p.getAttribute("data-duration"),authoredDuration:n?p.getAttribute("data-hf-authored-duration"):null});if(v?.duration!=null&&v.duration>0&&(x=v.duration),x==null||x<=0){let _=d(p,0),w=In({start:_,end:p.getAttribute("data-end"),authoredEnd:n?p.getAttribute("data-hf-authored-end"):null});w?.duration!=null&&w.duration>0&&(x=w.duration)}if((x==null||x<=0)&&be(p)&&(x=pt(p,p.duration)),(x==null||x<=0)&&(x=Ln(p)),x==null||x<=0){let _=p.getAttribute("data-composition-id");if(_){let w=t[_]??null;if(w&&typeof w.duration=="function")try{let I=Number(w.duration());Number.isFinite(I)&&I>0&&(x=I)}catch(I){P("runtime.startResolver.site1",I)}}}return x!=null&&Number.isFinite(x)&&x>0?(o.set(p,x),x):(o.set(p,null),null)},u=(p,y)=>{if(p.hasAttribute("data-composition-id")){let v=p.parentElement?.closest("[data-composition-id]");return v?d(v,y):0}let x=p.closest("[data-composition-id]");return x?d(x,y):0},d=(p,y)=>{let x=i.get(p);if(x!==void 0)return x??y;if(a.has(p))return y;a.add(p);try{let v=Xa(p.getAttribute("data-start"));if(!v){if(p.hasAttribute("data-composition-id")){let F=p.parentElement;if(F&&(F.hasAttribute("data-composition-src")||F.hasAttribute("data-composition-id")||F.hasAttribute("data-composition-file"))){let O=d(F,y);return i.set(p,O),O}}return i.set(p,y),y}if(v.kind==="absolute"){let F=Math.max(0,v.value),O=Math.max(0,u(p,y)+F);return i.set(p,O),O}let _=l(v.refId);if(!_)return i.set(p,y),y;let w=d(_,0),I=s(_);if(I==null||I<=0){let F=Math.max(0,w+v.offset);return i.set(p,F),F}let D=Math.max(0,w+I+v.offset);return i.set(p,D),D}finally{a.delete(p)}},m=p=>{let y=p.closest("[data-composition-id]");return{authoredStart:Fe(p.getAttribute("data-start")),hostStart:y?d(y,0):0,hasAutoStart:p.hasAttribute("data-hf-auto-start"),basis:p.getAttribute(no)}};return{resolveStartForElement:(p,y=0)=>d(p,Math.max(0,y)),resolveDurationForElement:p=>s(p),resolveMediaStartForElement:p=>{let y=m(p);return af({...y,ordinaryStart:()=>d(p,y.hostStart)})},resolveHostStartForElement:p=>u(p,0),isRootGlobalMediaStartForElement:p=>be(p)&&sf(m(p))}}function _y(e,t,n){let r=e.filter(o=>Number.isFinite(o.time)&&Number.isFinite(o.volume)).map(o=>({time:Math.max(0,o.time-t),volume:Je(o.volume)})).sort((o,a)=>o.time-a.time),i=[];for(let o of r){let a=i.at(-1);a&&Math.abs(a.time-o.time)<1e-9?a.volume=o.volume:i.push(o)}return i.length===0||i[0].time>0&&i.unshift({time:0,volume:Je(n)}),i}function uf(e,t){if(e.length===0)return 1;let n=0;for(;n<e.length-2&&t>=e[n+1].time;)n+=1;let r=e[n],i=e[n+1]??r,o=i.time-r.time,a=o<=0?0:Math.min(1,Math.max(0,(t-r.time)/o));return r.volume+(i.volume-r.volume)*a}function wy(e,t,n,r){let i=e.at(-1);!i||Math.abs(i.volume-n.volume)>1e-4?(i&&t&&t.time>i.time&&e.push(t),e.push(n)):r&&n.time>i.time&&e.push(n)}function Cy(e){let t=Number.parseFloat(e??"");return Number.isFinite(t)?t:void 0}function Ty(e,t){let n=Qe({timelineRegistry:window.__timelines,includeAuthoredTimingAttrs:!0}).resolveMediaStartForElement(e),r=Fe(e.dataset.end)??void 0,i=Fe(e.dataset.duration)??void 0,o=t;i!==void 0&&i>0?o=n+i:r!==void 0&&r>n&&(o=r);let a=Cy(e.dataset.volume)??1;return{start:n,end:o,staticVolume:Je(a)}}function Ry(e,t,n,r,{start:i,end:o,staticVolume:a}){let l=1/Math.min(60,Math.max(1,r)),s=Math.max(0,i),u=Math.min(n,o),d=Od(e,()=>{e.volume=a;let f=[],b;for(let p=s;p<=u+1e-6;p=Math.min(u,p+l)){t(p);let y=Number(e.volume);if(Number.isFinite(y)){let x={time:Number(p.toFixed(6)),volume:Number(Je(y).toFixed(6))};wy(f,b,x,p===u),b=x}if(p===u)break}return f});return d.some(f=>Math.abs(f.volume-a)>1e-4)?d:null}function ro(e,t,n=0){return n>3||e===null||typeof e!="object"?!1:Array.isArray(e)?e.some(r=>ro(r,t,n+1)):Object.getPrototypeOf(e)!==Object.prototype?!1:Object.entries(e).some(([r,i])=>t(r)||ro(i,t,n+1))}var ky=e=>typeof e?.nodeType=="number";function My(e,t){for(let n=Object(e);n;n=Object.getPrototypeOf(n)){let r=Object.getOwnPropertyDescriptor(n,t);if(r)return typeof r.set=="function"}return!1}function Ny(e,t){if(typeof e.getChildren!="function")return!0;try{return e.getChildren(!0,!0,!1).some(n=>(n.targets?.()??[]).some(i=>ky(i)?i===t&&ro(n.vars,o=>o==="volume"):ro(n.vars,o=>My(i,o))))}catch{return!0}}function cf(e,t,n,r,i={}){if(i.allowLiveTimelineSeek===!1||!t||!be(e)||n<=0||!Ny(t,e))return;let o=u=>{try{typeof t.totalTime=="function"?t.totalTime(u,!0):typeof t.seek=="function"&&t.seek(u,!0)}catch{}},a=typeof t.totalTime=="function"?Number(t.totalTime()):typeof t.seek=="function"?Number(t.seek()):0,l=Ty(e,n),s=Ry(e,o,n,60,l);if(Number.isFinite(a)&&o(a),s){let u=_y(s,l.start,l.staticVolume);u.length>0&&r.set(e,u)}}var mf="data-fade-in",pf="data-fade-out",Nk=mf.slice(5),Lk=pf.slice(5),hf=Object.freeze({fadeIn:0,fadeOut:0});function is(e){return Number.isFinite(e)&&e>0?e:0}function df(e){return e==null||e===""?0:is(Number.parseFloat(e))}function gf(e){return{fadeIn:df(e.getAttribute(mf)),fadeOut:df(e.getAttribute(pf))}}function Ly(e,t){let n=is(e.fadeIn),r=is(e.fadeOut);if(!Number.isFinite(t)||t<=0)return{fadeIn:n,fadeOut:r};let i=n+r;if(i<=t)return{fadeIn:n,fadeOut:r};let o=t/i;return{fadeIn:n*o,fadeOut:r*o}}function bf(e,t,n){if(!Number.isFinite(e))return 1;let{fadeIn:r,fadeOut:i}=Ly(n,t),o=1;return r>0&&(o*=ff(e/r)),i>0&&Number.isFinite(t)&&(o*=ff((t-e)/i)),o}function ff(e){return!Number.isFinite(e)||e<0?0:e>1?1:e}var Pn="hf-audio-group",io="data-audio-group";function os(e){let t=e?.getAttribute("data-volume"),n=t?parseFloat(t):1;return Number.isFinite(n)?n:1}function as(e,t){let n=Array.from(e?.querySelectorAll?.(`${Pn}[${hr}]`)??[]).find(i=>i.getAttribute(hr)===t);if(n)return n;let r=e?.getElementById(t)??null;return r&&r.tagName?.toLowerCase()===Pn?r:null}function oo(e,t){let n=t?.getAttribute?.(Rd)??t?.getAttribute?.(io);return n?as(e,n)?.hasAttribute("data-hidden")??!1:!1}function ao(e){return typeof e.tagName!="string"||e.tagName.toLowerCase()!=="audio"||typeof e.getAttribute!="function"?null:e.getAttribute(io)||null}function xf(e){let t="__hf-audio-group-inert";if(!e?.head||e.getElementById(t))return;let n=e.createElement("style");n.id=t,n.textContent=`${Pn}{display:none!important}`,e.head.appendChild(n)}function ht(e){return eo(e)}var yf=["seeked","loadeddata","error","emptied","abort"],fs=5e3,so=new WeakMap;function Sf(e){let t=e.readyState<e.HAVE_CURRENT_DATA&&e.networkState===e.NETWORK_LOADING&&!window.__HF_EXPORT_RENDER_SEEK_CONFIG;e.tagName!=="VIDEO"||!(e.seeking||t)||wt(e)||(so.get(e)?.(),_t(new Promise(n=>{let r=o=>{if(!(o?.type==="loadeddata"&&e.seeking)){clearTimeout(i);for(let a of yf)e.removeEventListener(a,r,!0);so.get(e)===r&&so.delete(e),n()}},i=setTimeout(r,fs);for(let o of yf)e.addEventListener(o,r,!0);so.set(e,r)})))}function vf(e){let t=e.isVideo?e.explicitDuration??e.sourceDuration:e.sourceDuration,n=(e.isVideo?[t,e.hostRemaining]:[t,e.hostRemaining,e.explicitDuration]).filter(r=>r!=null&&Number.isFinite(r)&&r>=0);return n.length>0?Math.min(...n):null}function Ef(e){let t=e?.elements??Array.from(document.querySelectorAll("video, audio")),n=e?.shouldIncludeElement?t.filter(a=>e.shouldIncludeElement?.(a)):t.filter(a=>a.hasAttribute("data-start")),r=[],i=[],o=0;for(let a of n){let l=e?.resolveStartSeconds?e.resolveStartSeconds(a):Number.parseFloat(a.dataset.start??"0");if(!Number.isFinite(l))continue;let s=ht(a),u=Ve(a),d=Bt(a),m=a.loop,f=Number.isFinite(a.duration)&&a.duration>0?a.duration:null,b=e?.resolveDurationSeconds?.(a)??Number.parseFloat(a.dataset.duration??"");(!Number.isFinite(b)||b<0)&&f!=null&&(b=Math.max(0,dn(d,f-s)));let p=Number.isFinite(b)&&b>=0,y=p?l+b:Number.POSITIVE_INFINITY,x=Number.parseFloat(a.dataset.volume??""),v={el:a,start:l,mediaStart:s,duration:p?b:Number.POSITIVE_INFINITY,end:y,volume:Number.isFinite(x)?x:null,playbackRate:u,rate:d,loop:m,sourceDuration:f,fades:gf(a)};r.push(v),a.tagName==="VIDEO"&&i.push(v),Number.isFinite(y)&&(o=Math.max(o,y))}return{timedMediaEls:n,mediaClips:r,videoClips:i,maxMediaEnd:o}}var us=new WeakMap,lo=new WeakMap,wr=new WeakMap,cs=new WeakSet,On=new WeakSet,ss=new WeakSet;function Fy(e){if(On.has(e))return;On.add(e);let t=()=>On.delete(e);e.addEventListener("playing",t,{once:!0}),e.addEventListener("pause",t,{once:!0}),e.addEventListener("error",t,{once:!0})}var Dy=3;function ms(e){return e.error!=null||e.networkState===Dy}var ds=new WeakMap;function ls(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):1}function ps(e){us.delete(e),lo.delete(e),wr.delete(e),cs.delete(e),ds.delete(e),Cr.delete(e)}var hs=.5,Ut=.04,Iy=.03,Py=.01,Cr=new WeakMap;function Oy(e,t,n){let r=Math.sign(t),i=Cr.get(e);if(Math.abs(t)>Ut)Cr.set(e,r);else if(i!==r||Math.abs(t)<=Py)return Cr.delete(e),n;return n*(1+r*Iy)}function Af(e){let t=!!(e.outputMuted||e.userMuted);for(let n of e.clips){let{el:r}=n;if(!r.isConnected)continue;let i=n.rate??n.playbackRate,o=r.tagName==="VIDEO"&&!n.loop,a=Ot(e.timeSeconds,n.start,n.end),l=n.start-e.timeSeconds,s=r.tagName==="AUDIO"&&!a&&l>0&&l*Math.max(1,rs(i,0))<=Math.max(e.cueAheadSeconds??0,ss.has(r)?Ut:0);s?ss.add(r):ss.delete(r);let u=o&&!a&&(e.timeSeconds>=n.end||cr(e.timeSeconds,n.end))&&Hi(e.timeSeconds,n.start,n.end,e.getCompositionDuration()),d=Zi(i,Math.max(0,Math.min(e.timeSeconds,n.end)-n.start))+n.mediaStart,m=u||o&&n.sourceDuration!=null&&d>=n.sourceDuration&&a;m&&n.sourceDuration!=null&&(d=Math.min(d,n.sourceDuration));let f=lo.get(r),b=r.tagName==="AUDIO"&&(f===void 0||d<f-.04),p=!n.loop&&n.sourceDuration!=null&&d>=n.mediaStart&&d<n.sourceDuration&&(o||b);if((a||u||s)&&d>=0&&(!r.ended||n.loop||m||p)){if(lo.set(r,d),n.loop&&n.sourceDuration!=null&&n.sourceDuration>0){let Z=n.sourceDuration-n.mediaStart;Z>0&&d>=n.sourceDuration&&(d=n.mediaStart+(d-n.mediaStart)%Z)}let v=ls(e.userVolume??1),_=Je(n.volume??1),w=ds.get(r),I=ls(r.volume),D,F=Jd(r,e.timeSeconds-n.start);if(F!==null)D=Je(F);else if(n.volumeKeyframes&&n.volumeKeyframes.length>0){let Z=e.timeSeconds-n.start;D=Je(uf(n.volumeKeyframes,Z))}else e.isWebAudioRouted?.(r)?D=_:w===void 0?D=_>1?_:I:Math.abs(I-w)>1e-4?D=I:D=_;let O=n.fades??hf;(O.fadeIn>0||O.fadeOut>0)&&(D*=bf(e.timeSeconds-n.start,n.duration,O));let M=r.closest("[data-hidden]")!==null||oo(r.ownerDocument,r)?0:ls(D*v);r.volume=M,ds.set(r,M),e.onElementVolume?.(r,M,D),(t||e.isWebAudioOwned?.(r))&&(r.muted=!0),r.preload!=="auto"&&(r.preload="auto");let R=rs(i,e.timeSeconds-n.start)*e.playbackRate,U=2,j=r.currentTime||0,Y=Math.abs(j-d),N=d-j,A=us.get(r);us.set(r,N);let H=A===void 0,J=!H&&Math.abs(N-A)>.5,B=Y>3,q=r.tagName==="AUDIO"&&H&&j-d>Ut,$=m&&Y>.001||r.ended&&p&&Y>.001||q||Y>hs&&(H||J||B),K=r.tagName==="VIDEO"&&!r.paused&&e.playing,X=A!==void 0&&Math.abs(N-A)<.004,G=!1;if(!K&&!$&&!H&&X&&Y>Ut){let Z=(wr.get(r)??0)+1;wr.set(r,Z),Z>=U&&(G=!0,wr.set(r,0))}else Y<=Ut&&wr.set(r,0);let V=!K&&e.forceSync&&Y>.02;try{(!K||$)&&Cr.delete(r);let Z=K&&!$?Oy(r,N,R):R;Math.abs(r.playbackRate-Z)>1e-6&&(r.playbackRate=Z)}catch(Z){P("runtime.media.site1",Z)}if($||G||V){if(!(r.tagName==="VIDEO"&&!!wt(r))){try{r.currentTime=d}catch(ce){P("runtime.media.site2",ce)}if(Math.abs(r.currentTime-d)>.5&&!cs.has(r)){cs.add(r),r.load();try{r.currentTime=d}catch(ce){P("runtime.media.site3",ce)}}Sf(r)}On.delete(r)}else e.playing||Sf(r);m?r.paused||r.pause():e.playing&&r.paused&&!On.has(r)&&!ms(r)?(Fy(r),r.play().catch(Z=>{On.delete(r),(Z&&typeof Z=="object"&&"name"in Z?String(Z.name??""):"")==="NotAllowedError"&&e.onAutoplayBlocked?.()})):!e.playing&&!r.paused&&r.pause();continue}let x=Ot(e.timeSeconds,n.start,n.end);ps(r),x&&lo.set(r,d),r.paused||r.pause()}}var Wt=new WeakMap;function Tr(e){return Wt.has(e)?Wt.get(e)??null:e.getAttribute("src")}async function _f(e,t){let n=0;for(;t();){let r=await fetch(e,{headers:{Range:"bytes=0-0"},cache:"no-store"}).catch(()=>null);r?.body?.cancel().catch(()=>{});let i=r?.status===202||r?.status===503;if(!i&&r?.ok)return!0;if(!i&&++n>3)return!1;let o=Math.min(Number(r?.headers.get("Retry-After"))||2,30);await new Promise(a=>setTimeout(a,o*1e3))}return!1}var Hy="hf-proxy",wf="runtime_media_proxy_fallback",Cf="runtime_media_proxy_unavailable",Tf=new WeakSet,Rr=new WeakMap;function uo(e){return e.currentSrc||e.src}function gs(e){return window.__HF_EXPORT_RENDER_SEEK_CONFIG?!0:Ee(e)&&!!wt(e)}function bs(e){let t=uo(e);if(!t)return null;let n;try{n=new URL(t,document.baseURI)}catch{return null}if(n.origin!==window.location.origin)return null;try{return decodeURIComponent(n.pathname)}catch{return n.pathname}}function Gy(e,t){let n=null;for(let r of Object.keys(t))e.endsWith(r)&&(n===null||r.length>n.length)&&(n=r);return n?t[n]??null:null}function By(e,t){let n=e.normalize("NFC").toLowerCase(),r=-1,i=null,o=!1;for(let[a,l]of Object.entries(t)){let s=a.normalize("NFC").toLowerCase();n.endsWith(s)&&(s.length>r?(r=s.length,i=l,o=!1):s.length===r&&(o=!0))}return o?null:i}function xs(e,t){return t[e]??Gy(e,t)??By(e,t)}function Uy(e,t){let n=new URL(e,document.baseURI);return n.searchParams.set(Hy,t?t.hasAlpha?"vp8":"h264":"auto"),n.href}var Wy={cross_origin:"video reports zero decodable width but its source is cross-origin; no local proxy can be served for it",proxy_playback_failed:"the authoring proxy itself failed to decode; render output is unaffected",browser_safe_codec:"the file errored but its codec is browser-decodable; a proxy cannot help (the file itself is likely corrupt)",invalid_source_url:"the media source URL is malformed and cannot be proxied"};function Vt(e,t,n){if(Tf.has(e))return;Tf.add(e);let r=Wy[t];we({source:"hf-preview",type:"diagnostic",code:Cf,details:{asset:n,codecName:null,reason:t,note:r}}),console.info(`[hyperframes] ${Cf}: "${n}" (${t}): ${r}`)}function ys(e,t=null,n="reactive"){if(Wt.has(e)||Rr.has(e)&&Rr.get(e)===e.getAttribute("src"))return;let r=uo(e),i;try{i=Uy(r,t)}catch(d){P("runtime.mediaProxy.swap",d),Vt(e,"invalid_source_url",r);return}let o=e.getAttribute("src");Rr.set(e,o);let a=()=>e.isConnected&&e.getAttribute("src")===o,l=_f(i,a).then(d=>{if(!a()){Rr.get(e)===o&&Rr.delete(e);return}if(!d){Vt(e,"proxy_playback_failed",r);return}return Wt.set(e,o),ps(e),e.src=i,e.load(),new Promise(m=>{e.addEventListener("loadeddata",m,{once:!0}),e.addEventListener("error",m,{once:!0})})});_t(Promise.race([l,new Promise(d=>setTimeout(d,fs))]));let s=t?.codecName??null;we({source:"hf-preview",type:"diagnostic",code:wf,details:{asset:r,codecName:s,trigger:n,note:"render output is unaffected; only this preview element was swapped to an authoring proxy"}}),console.info(`[hyperframes] ${wf}: "${r}" uses a codec (${s??"unknown"}) this browser can\'t decode; auto-swapped to an authoring proxy for this preview only. Render output is unaffected.`)}function Rf(e){if(gs(e)||!Ee(e)||Wt.has(e))return;let t=window.__HF_MEDIA_CODEC_MAP__;if(!t)return;let n=bs(e);if(n===null)return;let r=xs(n,t);if(!r||!r.browserHostile)return;let i=r.representativeMime?e.canPlayType(r.representativeMime):"";i==="probably"||i==="maybe"||ys(e,r,"proactive")}function kf(e){if(gs(e)||!Ee(e)||e.videoWidth!==0)return;let t=uo(e);if(Wt.has(e)){Vt(e,"proxy_playback_failed",t);return}let n=window.__HF_MEDIA_CODEC_MAP__;if(!n)return;let r=bs(e);if(r===null){Vt(e,"cross_origin",t);return}let i=xs(r,n);if(i&&!i.browserHostile){Vt(e,"browser_safe_codec",t);return}ys(e,i,"reactive")}function Mf(e){if(gs(e)||!Ee(e))return;let t=uo(e);if(Wt.has(e)){Vt(e,"proxy_playback_failed",t);return}let n=window.__HF_MEDIA_CODEC_MAP__;if(!n)return;let r=bs(e);if(r===null){Vt(e,"cross_origin",t);return}let i=xs(r,n);if(i&&!i.browserHostile){Vt(e,"browser_safe_codec",t);return}ys(e,i,"tertiary")}var De=class extends Error{constructor(n,r=null){super(r==null?n:`${n} at line ${r}`);ue(this,"lineNumber");this.name="CubeLutParseError",this.lineNumber=r}},Vy=[0,0,0],$y=[1,1,1],co=64;function zy(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];if(r===\'"\'&&(t=!t),r==="#"&&!t)return e.slice(0,n)}return e}function $t(e,t){let n=Number(e);if(!Number.isFinite(n))throw new De(`Invalid number "${e}"`,t);return n}function Nf(e,t,n){if(e.length!==3)throw new De(`${t} expects three numbers`,n);return[$t(e[0],n),$t(e[1],n),$t(e[2],n)]}function Lf(e,t,n){if(!e)throw new De(`${t} expects a size`,n);let r=Number(e);if(!Number.isInteger(r)||r<2)throw new De(`${t} must be an integer greater than 1`,n);return r}function qy(e,t){if(t[0]<=e[0]||t[1]<=e[1]||t[2]<=e[2])throw new De("DOMAIN_MAX values must be greater than DOMAIN_MIN values")}function jy(e){let t=/^TITLE\\s+"([^"]*)"\\s*$/i.exec(e);if(t)return t[1]??null;let n=/^TITLE\\s+(.+)\\s*$/i.exec(e);return n&&(n[1]??"").trim()||null}function Ky(e){return/^[+-]?(?:\\d|\\.\\d)/.test(e)}function Ff(e,t={}){let n=t.maxSize??co,r=null,i=Vy,o=$y,a=null,l=null,s=[],u=e.replace(/^\\uFEFF/,"").split(/\\r?\\n/);for(let m=0;m<u.length;m++){let f=m+1,b=zy(u[m]??"").trim();if(!b)continue;let p=b.split(/\\s+/),y=(p[0]??"").toUpperCase(),x=p.slice(1);if(y==="TITLE"){r=jy(b);continue}if(y==="DOMAIN_MIN"){i=Nf(x,y,f);continue}if(y==="DOMAIN_MAX"){o=Nf(x,y,f);continue}if(y==="LUT_3D_INPUT_RANGE"){if(x.length!==2)throw new De(`${y} expects two numbers`,f);let v=$t(x[0],f),_=$t(x[1],f);if(_<=v)throw new De("LUT_3D_INPUT_RANGE max must exceed min",f);i=[v,v,v],o=[_,_,_];continue}if(y==="LUT_1D_SIZE"){a=Lf(x[0],y,f);continue}if(y==="LUT_3D_SIZE"){if(l=Lf(x[0],y,f),l>n)throw new De(`LUT_3D_SIZE ${l} exceeds max ${n}`,f);continue}if(!Ky(y)){if(y.startsWith("LUT_"))throw new De(`Unsupported cube keyword ${y}`,f);continue}if(!l)throw a?new De("1D cube LUTs are not supported yet",f):new De("LUT data appears before LUT_3D_SIZE",f);if(p.length!==3)throw new De("LUT data rows must contain three numbers",f);s.push($t(p[0],f),$t(p[1],f),$t(p[2],f))}if(a&&l)throw new De("Mixed 1D and 3D cube LUTs are not supported yet");if(!l)throw a?new De("1D cube LUTs are not supported yet"):new De("Missing LUT_3D_SIZE");qy(i,o);let d=l*l*l;if(s.length!==d*3)throw new De(`Expected ${d} LUT rows for size ${l}, found ${s.length/3}`);return{title:r,size:l,domainMin:i,domainMax:o,data:new Float32Array(s)}}function Xy(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):0}function kr(e){return Math.round(Xy(e)*255)}function Ss(e){let t=e.size,n=t*t,r=t,i=new Uint8Array(n*r*4);for(let o=0;o<t;o++)for(let a=0;a<t;a++)for(let l=0;l<t;l++){let s=((o*t+a)*t+l)*3,u=(a*n+o*t+l)*4;i[u]=kr(e.data[s]??0),i[u+1]=kr(e.data[s+1]??0),i[u+2]=kr(e.data[s+2]??0),i[u+3]=255}return{width:n,height:r,data:i}}var Df="rec709";var Ae={hueDegrees:{min:0,max:360,inclusiveMax:!1},unit:{min:0,max:1},signedUnit:{min:-1,max:1},secondaryHueRange:{min:0,max:180},secondaryHueSoftness:{min:0,max:180},secondaryHueCombinedMax:180,secondarySoftRangeSoftness:{min:0,max:.5},secondaryHueShift:{min:-180,max:180},effects:{asciiStyle:{min:0,max:7},bloom:{min:0,max:3},bloomRadius:{min:1,max:100},monoScreenShape:{min:0,max:4}}};var If=["exposure","contrast","highlights","shadows","whites","blacks","temperature","tint","vibrance","saturation"],Pf=["shadows","midtones","highlights"],Of=["master","red","green","blue"],Hf=["hueVsHue","hueVsSaturation","hueVsLuma"];var Gf=["vignette","vignetteMidpoint","vignetteRoundness","vignetteFeather","grain","grainSize","grainRoughness"],Bf=["blur","pixelate","chromaBleed","tapeDamage","tapeTracking","tapeNoise","tapeSpeed","filmArtifacts","halftone","halftoneSize","twoInkPrint","twoInkPrintSize","ascii","asciiSize","asciiInvert","asciiStyle","asciiColor","asciiRotation","dither","ditherSize","bloom","bloomRadius","monoScreen","monoScreenSize","monoScreenAngle","monoScreenSpread","monoScreenShape","monoScreenInvert","scanlines","scanlineCount","scanlineSoftness","chromaticAberration","chromaticAngle","crtCurvature","digitalGlitch","digitalGlitchColorSplit","digitalGlitchLineTear","digitalGlitchPixelate","digitalGlitchBlockAmount","digitalGlitchBlockDisplacement","digitalGlitchBlockOpacity","digitalGlitchSpeed","engraving","engravingSpacing","engravingMinThickness","engravingMaxThickness","engravingAngle","engravingContrast","engravingSharpness","engravingWave","engravingWaveFrequency","crosshatch","crosshatchSpacing","crosshatchThickness","crosshatchAngle","crosshatchContrast","crosshatchEdges","crosshatchLineWeight","crosshatchWave","crosshatchWaveFrequency","kuwahara","kuwaharaRadius","kuwaharaSharpness","kuwaharaSaturation"];var dM=Ae.unit,fM=Ae.signedUnit,mM=Ae.effects;var gt=1024,Mr=16;function Uf(e,t,n,r){let i=((2*e+t)*n-e*r)/(e+t);return Math.sign(i)!==Math.sign(n)?0:Math.sign(n)!==Math.sign(r)&&Math.abs(i)>3*Math.abs(n)?3*n:i}function Ie(e,t){let n=e[t];if(n===void 0)throw new RangeError("Color curve points must be contiguous");return n}function Yy(e){let t=[],n=[],r=Ie(e,0);for(let a of e.slice(1)){let l=a[0]-r[0];t.push(l),n.push((a[1]-r[1])/l),r=a}let i=Ie(n,0);if(e.length===2)return[i,i];let o=new Array(e.length);o[0]=Uf(Ie(t,0),Ie(t,1),i,Ie(n,1)),o[o.length-1]=Uf(Ie(t,t.length-1),Ie(t,t.length-2),Ie(n,n.length-1),Ie(n,n.length-2));for(let a=1;a<e.length-1;a+=1){let l=Ie(n,a-1),s=Ie(n,a);if(l===0||s===0||Math.sign(l)!==Math.sign(s)){o[a]=0;continue}let u=Ie(t,a-1),d=Ie(t,a),m=2*d+u,f=d+2*u;o[a]=(m+f)/(m/l+f/s)}return o}function Wf(e,t){if(e.length<2)throw new RangeError("A color curve requires at least two points");if(!Number.isInteger(t)||t<2)throw new RangeError("Curve LUT size must be at least 2");let n=Number.NEGATIVE_INFINITY;for(let[r,i]of e){if(!Number.isFinite(r)||!Number.isFinite(i))throw new TypeError("Color curve points must be finite");if(r<=n)throw new RangeError("Color curve inputs must be strictly increasing");n=r}}function Jy(e,t,n){if(!Number.isFinite(t)||!Number.isFinite(n)||t>=n)throw new RangeError("Curve output bounds must be finite and increasing");if(e.some(([,r])=>r<t||r>n))throw new RangeError(`Curve outputs must be between ${t} and ${n}`)}function Qy(e,t,n,r,i){let o=n[0]-t[0],a=Math.min(1,Math.max(0,(e-t[0])/o)),l=a*a,s=l*a;return(2*s-3*l+1)*t[1]+(s-2*l+a)*o*r+(-2*s+3*l)*n[1]+(s-l)*o*i}function Vf(e,t,n,r,i){Jy(e,r,i);let o=Yy(e),a=new Float32Array(t),l=0;for(let s=0;s<t;s+=1){let u=n(s);for(;l<e.length-2&&u>Ie(e,l+1)[0];)l+=1;let d=Ie(e,l),m=Ie(e,l+1),f=Qy(u,d,m,Ie(o,l),Ie(o,l+1));a[s]=Math.min(i,Math.max(r,f))}return a}function Hn(e,t=gt){if(Wf(e,t),e.length>Mr)throw new RangeError(`A color curve supports at most ${Mr} points`);if(e.some(([n])=>n<0||n>1))throw new RangeError("Color curve inputs must be between 0 and 1");if(e[0]?.[0]!==0||e[e.length-1]?.[0]!==1)throw new RangeError("Color curves must include input endpoints 0 and 1");return Vf(e,t,n=>n/(t-1),0,1)}function Es(e,t,n,r=gt){if(e.length<3)throw new RangeError("A hue curve requires at least three points");if(e.length>Mr)throw new RangeError(`A hue curve supports at most ${Mr} points`);let i=[...e].sort((s,u)=>s[0]-u[0]);for(let s=0;s<i.length;s+=1){let u=i[s];if(!u||u[0]<0||u[0]>=360)throw new RangeError("Hue curve inputs must be from 0 up to 360 degrees");if(s>0&&u[0]===i[s-1]?.[0])throw new RangeError("Hue curve inputs must be unique")}let o=i.slice(-2).map(([s,u])=>[s-360,u]),a=i.slice(0,2).map(([s,u])=>[s+360,u]),l=[...o,...i,...a];return Wf(l,r),Vf(l,r,s=>s/r*360,t,n)}var Nr="data-color-grading",fn="data-hf-color-grading-source-hidden",mn="data-hf-authored-opacity",Kf="__hf_color_grading_",eS=Df,ws={exposure:0,contrast:0,highlights:0,shadows:0,whites:0,blacks:0,temperature:0,tint:0,vibrance:0,saturation:0},Cs={vignette:0,vignetteMidpoint:.5,vignetteRoundness:0,vignetteFeather:.65,grain:0,grainSize:.25,grainRoughness:.5},Ts={blur:0,pixelate:0,chromaBleed:0,tapeDamage:0,tapeTracking:0,tapeNoise:1,tapeSpeed:.5,filmArtifacts:0,halftone:0,halftoneSize:0,twoInkPrint:0,twoInkPrintSize:0,ascii:0,asciiSize:5/76,asciiInvert:0,asciiStyle:0,asciiColor:1,asciiRotation:0,dither:0,ditherSize:0,bloom:0,bloomRadius:8,monoScreen:0,monoScreenSize:0,monoScreenAngle:0,monoScreenSpread:0,monoScreenShape:0,monoScreenInvert:0,scanlines:0,scanlineCount:0,scanlineSoftness:0,chromaticAberration:0,chromaticAngle:0,crtCurvature:0,digitalGlitch:0,digitalGlitchColorSplit:0,digitalGlitchLineTear:0,digitalGlitchPixelate:0,digitalGlitchBlockAmount:0,digitalGlitchBlockDisplacement:0,digitalGlitchBlockOpacity:0,digitalGlitchSpeed:0,engraving:0,engravingSpacing:7/17,engravingMinThickness:.2,engravingMaxThickness:3.2/7,engravingAngle:.25,engravingContrast:7/15,engravingSharpness:.59,engravingWave:.2,engravingWaveFrequency:2/9,crosshatch:0,crosshatchSpacing:7/25,crosshatchThickness:.25,crosshatchAngle:.25,crosshatchContrast:1/3,crosshatchEdges:.5,crosshatchLineWeight:0,crosshatchWave:.33,crosshatchWaveFrequency:2/9,kuwahara:0,kuwaharaRadius:1/7,kuwaharaSharpness:5/16,kuwaharaSaturation:.5};var po=If,Xf=Pf,Yf=Of,Jf=Hf,ks=Gf,Ms=Bf,$f={exposure:.03,contrast:-.12,highlights:-.1,shadows:.16,whites:-.04,blacks:.08,temperature:.13,vibrance:-.08,saturation:-.08},zf={vignette:.18};function Pe(e,t,n={},r={},i={},o=1){return{id:e,label:t,intensity:o,adjust:{...ws,...n},details:{...Cs,...r},effects:{...Ts,...i}}}var Ns=[Pe("neutral","Neutral"),Pe("warm-daylight","Warm Daylight",{exposure:.06,contrast:.07,highlights:-.06,shadows:.08,temperature:.18,saturation:.08}),Pe("clean-studio","Clean Studio",{contrast:.08,highlights:-.08,shadows:.06,temperature:-.08,tint:.03,saturation:.04}),Pe("skin-soft","Skin Soft",{exposure:.04,contrast:-.03,highlights:-.12,shadows:.12,temperature:.08,tint:.02,saturation:.04}),Pe("food-pop","Food Pop",{exposure:.06,contrast:.1,shadows:.06,temperature:.14,vibrance:.1,saturation:.18}),Pe("night-lift","Night Lift",{exposure:.08,contrast:.08,highlights:-.18,shadows:.2,blacks:-.08,saturation:.04},{vignette:.12}),Pe("muted-editorial","Muted Editorial",{exposure:-.02,contrast:.08,highlights:-.08,shadows:.06,blacks:-.05,temperature:-.03,saturation:-.12},{vignette:.1}),Pe("vintage-wash","Vintage Wash",$f,zf),Pe("mono-clean","Mono Clean",{contrast:.12,highlights:-.04,shadows:.04,blacks:-.08,saturation:-1}),Pe("mono-fade","Mono Fade",{contrast:-.04,highlights:-.06,shadows:.1,blacks:.12,saturation:-1},{vignette:.08}),Pe("soft-boost","Soft Boost",{exposure:.06,contrast:-.04,highlights:-.14,shadows:.16,vibrance:.08,saturation:.1}),Pe("bright-pop","Bright Pop",{exposure:.12,contrast:.12,whites:.08,blacks:-.04,vibrance:.08,saturation:.14}),Pe("deep-contrast","Deep Contrast",{exposure:-.03,contrast:.2,highlights:-.08,shadows:-.08,blacks:-.12,saturation:.06}),Pe("creator-camcorder","Creator Camcorder",{contrast:.08,highlights:-.05,shadows:.02,whites:.03,blacks:-.04,temperature:-.03,tint:-.015,vibrance:-.03,saturation:-.06},{vignette:.06,grain:.08,grainSize:.18,grainRoughness:.58},{chromaBleed:.55},.72),Pe("vhs-playback","VHS Playback",{contrast:-.04,saturation:-.08},{grain:.16,grainSize:.12,grainRoughness:.72},{tapeDamage:.82,tapeTracking:.85,tapeNoise:.3,tapeSpeed:.5,chromaBleed:.5,chromaticAberration:.18,scanlines:.35,scanlineCount:.17,scanlineSoftness:1,digitalGlitch:.32,digitalGlitchLineTear:.08,digitalGlitchSpeed:.5}),Pe("home-movie-8mm","8mm Home Movie",$f,{...zf,vignette:.28,vignetteMidpoint:.54,vignetteFeather:.72,grain:.34,grainSize:.18,grainRoughness:.72},{filmArtifacts:.62},.72),Pe("editorial-halftone","Editorial Halftone",{contrast:.04,saturation:.04},{},{halftone:.94,halftoneSize:.36}),Pe("two-ink-print","Two-Ink Print",{contrast:.08,highlights:-.06,shadows:.04},{},{twoInkPrint:1,twoInkPrintSize:.42})],tS=new Map(Ns.map(e=>[e.id,e])),nS=/^\\$(?:\\{([A-Za-z0-9_.:-]+)\\}|([A-Za-z0-9_.:-]+))$/,rS={exposure:{min:-2,max:2},contrast:{min:-1,max:1},highlights:{min:-1,max:1},shadows:{min:-1,max:1},whites:{min:-1,max:1},blacks:{min:-1,max:1},temperature:{min:-1,max:1},tint:{min:-1,max:1},vibrance:{min:-1,max:1},saturation:{min:-1,max:1}},Gn={hue:0,amount:0,level:0},qf={amount:Ae.unit,level:Ae.signedUnit},zt=[[0,0],[1,1]],Bn=[],iS={hueVsHue:Ae.secondaryHueShift,hueVsSaturation:Ae.signedUnit,hueVsLuma:Ae.signedUnit},As={center:0,range:180,softness:0},_s={min:0,max:1,softness:.05},oS={vignette:Ae.unit,vignetteMidpoint:Ae.unit,vignetteRoundness:Ae.signedUnit,vignetteFeather:Ae.unit,grain:Ae.unit,grainSize:Ae.unit,grainRoughness:Ae.unit},Rs=Ae.unit,aS=Ae.effects,Qf=["blur","pixelate","chromaBleed","tapeDamage","filmArtifacts","halftone","twoInkPrint","ascii","dither","bloom","monoScreen","scanlines","chromaticAberration","crtCurvature","digitalGlitch","engraving","crosshatch","kuwahara"];var sS=Ns.filter(e=>Qf.some(t=>e.effects[t]>1e-4)),vM=Ns.filter(e=>!sS.includes(e)),EM={blur:{blur:.45},pixelate:{pixelate:.55},bloom:{bloom:.55,bloomRadius:8},chromaBleed:{chromaBleed:.55},tapeDamage:{tapeDamage:.65,tapeTracking:.55,tapeNoise:.25,tapeSpeed:.5},filmArtifacts:{filmArtifacts:.55},scanlines:{scanlines:.35,scanlineCount:.17,scanlineSoftness:1},chromaticAberration:{chromaticAberration:.15,chromaticAngle:0},crtCurvature:{crtCurvature:.2},digitalGlitch:{digitalGlitch:.55,digitalGlitchColorSplit:.25,digitalGlitchLineTear:.25,digitalGlitchPixelate:.15,digitalGlitchBlockAmount:.5,digitalGlitchBlockDisplacement:.25,digitalGlitchBlockOpacity:0,digitalGlitchSpeed:.5},halftone:{halftone:.94,halftoneSize:.36},twoInkPrint:{twoInkPrint:1,twoInkPrintSize:.42},ascii:{ascii:1,asciiSize:5/76,asciiInvert:0,asciiStyle:0,asciiColor:1,asciiRotation:0},dither:{dither:1,ditherSize:.5},monoScreen:{monoScreen:1,monoScreenSize:.35,monoScreenAngle:.25,monoScreenSpread:.3,monoScreenShape:0,monoScreenInvert:0},engraving:{engraving:1,engravingSpacing:7/17,engravingMinThickness:.2,engravingMaxThickness:3.2/7,engravingAngle:.25,engravingContrast:7/15,engravingSharpness:.59,engravingWave:.2,engravingWaveFrequency:2/9},crosshatch:{crosshatch:1,crosshatchSpacing:7/25,crosshatchThickness:.25,crosshatchAngle:.25,crosshatchContrast:1/3,crosshatchEdges:.5,crosshatchLineWeight:0,crosshatchWave:.33,crosshatchWaveFrequency:2/9},kuwahara:{kuwahara:1,kuwaharaRadius:1/7,kuwaharaSharpness:5/16,kuwaharaSaturation:.5}},Zf=[{path:"intensity",name:"--hf-color-grading-intensity",min:0,max:1},{path:"lut.intensity",name:"--hf-color-grading-lut-intensity",min:0,max:1},{path:"adjust.exposure",name:"--hf-color-grading-exposure",min:-2,max:2},{path:"effects.blur",name:"--hf-color-grading-blur",min:0,max:1},{path:"effects.bloom",name:"--hf-color-grading-bloom",min:0,max:3},{path:"effects.kuwahara",name:"--hf-color-grading-kuwahara",min:0,max:1},{path:"effects.pixelate",name:"--hf-color-grading-pixelate",min:0,max:1},{path:"effects.ascii",name:"--hf-color-grading-ascii",min:0,max:1},{path:"effects.dither",name:"--hf-color-grading-dither",min:0,max:1}];var lS=/^#[0-9a-f]{6}$/i;function uS(e){return!Array.isArray(e)||e.length<2||e.length>6||!e.every(t=>typeof t=="string"&&lS.test(t))?null:e.map(t=>t.toLowerCase())}function He(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function mo(e,t,n){return Number.isFinite(e)?Math.min(n,Math.max(t,e)):0}function em(e,t){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?Math.min(1,Math.max(0,n)):t}function Ue(e,t){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?mo(n,t.min,t.max):0}function Ls(e,t=0){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?(n%360+360)%360:t}function cS(e){let t=He(e)?e:{};return Xf.reduce((n,r)=>{let i=He(t[r])?t[r]:{};return n[r]={hue:Ls(i.hue,Gn.hue),amount:Ue(i.amount??Gn.amount,qf.amount),level:Ue(i.level??Gn.level,qf.level)},n},{shadows:{...Gn},midtones:{...Gn},highlights:{...Gn}})}function dS(e){if(!Array.isArray(e)||e.length!==2)return null;let t=Number(e[0]),n=Number(e[1]);return Number.isFinite(t)&&Number.isFinite(n)?[mo(t,0,1),mo(n,0,1)]:null}function tm(e){return e.some((t,n)=>n>0&&t[0]===e[n-1]?.[0])}function fS(e){(e[0]?.[0]??0)>0&&e.unshift([0,0]),(e.at(-1)?.[0]??1)<1&&e.push([1,1])}function mS(e){if(!Array.isArray(e)||e.length<2)return zt;let t=[];for(let n of e){let r=dS(n);if(!r)return zt;t.push(r)}return t.sort((n,r)=>n[0]-r[0]),tm(t)||(fS(t),t.length>16)?zt:t}function pS(e){let t=He(e)?e:{};return Yf.reduce((n,r)=>(n[r]=mS(t[r]),n),{master:zt,red:zt,green:zt,blue:zt})}function hS(e,t){if(!Array.isArray(e)||e.length!==2)return null;let n=Number(e[0]),r=Number(e[1]);return Number.isFinite(n)&&Number.isFinite(r)?[Ls(n),mo(r,t.min,t.max)]:null}function gS(e,t){if(!Array.isArray(e)||e.length<3||e.length>16)return Bn;let n=[];for(let r of e){let i=hS(r,t);if(!i)return Bn;n.push(i)}return n.sort((r,i)=>r[0]-i[0]),tm(n)?Bn:n}function bS(e){let t=He(e)?e:{};return Jf.reduce((n,r)=>(n[r]=gS(t[r],iS[r]),n),{hueVsHue:Bn,hueVsSaturation:Bn,hueVsLuma:Bn})}function jf(e){let t=He(e)?e:{},n=Ue(t.min??_s.min,Rs),r=Ue(t.max??_s.max,Rs);return{min:Math.min(n,r),max:Math.max(n,r),softness:Ue(t.softness??_s.softness,Ae.secondarySoftRangeSoftness)}}function xS(e){let t=He(e)?e:{},n=Ue(t.range??As.range,Ae.secondaryHueRange);return{center:Ls(t.center,As.center),range:n,softness:Ue(t.softness??As.softness,{min:Ae.secondaryHueSoftness.min,max:Ae.secondaryHueCombinedMax-n})}}function yS(e){return{hueShift:Ue(e.hueShift??0,Ae.secondaryHueShift),saturation:Ue(e.saturation??0,Ae.signedUnit),luma:Ue(e.luma??0,Ae.signedUnit),temperature:Ue(e.temperature??0,Ae.signedUnit),tint:Ue(e.tint??0,Ae.signedUnit)}}function SS(e){return!He(e)||!He(e.key)||!He(e.correction)?null:{enabled:e.enabled!==!1,key:{hue:xS(e.key.hue),saturation:jf(e.key.saturation),luma:jf(e.key.luma)},correction:yS(e.correction)}}function vS(e){if(!Array.isArray(e))return[];let t=[];for(let n of e.slice(0,4)){let r=SS(n);r&&t.push(r)}return t}function ES(e){if(e==null)return null;let t=String(e).trim();return t||null}function AS(e){if(e==null)return null;if(typeof e=="string"){let n=e.trim();return n?{src:n,intensity:1}:null}if(!He(e))return null;let t=e.src;return typeof t!="string"||t.trim()===""?null:{src:t.trim(),intensity:em(e.intensity,1)}}function _S(e){if(typeof e=="string"){let t=e.trim();if(!t)return null;if(t.startsWith("{"))try{let n=JSON.parse(t);return He(n)?n:null}catch{return null}return{preset:t}}return He(e)?e:null}function wS(e,t){let n=e.trim().match(nS);if(!n)return e;let r=n[1]??n[2]??"";return r&&Object.hasOwn(t,r)?t[r]:e}function fo(e,t){if(typeof e=="string"){let r=wS(e,t);if(r!==e)return r;let i=e.trim();if(!i.startsWith("{"))return e;try{return fo(JSON.parse(i),t)}catch{return e}}if(Array.isArray(e))return e.map(r=>fo(r,t));if(!He(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=fo(i,t);return n}function CS(e){return e?tS.get(e)??null:null}function ho(e){let t=_S(e);if(!t||t.enabled===!1)return null;let n=ES(t.preset),r=CS(n),i=r?.adjust??ws,o=r?.details??Cs,a=r?.effects??Ts,l=He(t.adjust)?t.adjust:{},s=He(t.details)?t.details:{},u=He(t.effects)?t.effects:{},d=po.reduce((b,p)=>(b[p]=Ue(l[p]??i[p],rS[p]),b),{...ws}),m=ks.reduce((b,p)=>(b[p]=Ue(s[p]??o[p],oS[p]),b),{...Cs}),f=Ms.reduce((b,p)=>(b[p]=Ue(u[p]??a[p],aS[p]??Rs),b),{...Ts});return{enabled:!0,preset:n,intensity:em(t.intensity,r?.intensity??1),adjust:d,wheels:cS(t.wheels),curves:pS(t.curves),hueCurves:bS(t.hueCurves),secondaries:vS(t.secondaries),details:m,effects:f,palette:uS(t.palette),lut:AS(t.lut),colorSpace:typeof t.colorSpace=="string"&&t.colorSpace.trim()?t.colorSpace.trim():eS}}function nm(e,t){return ho(fo(e,t))}function TS(e){return Xf.some(t=>Math.abs(e[t].amount)>1e-4||Math.abs(e[t].level)>1e-4)}function Fs(e){return Yf.some(t=>e[t].some(([n,r])=>Math.abs(n-r)>1e-4))}function Ds(e){return Jf.some(t=>e[t].some(([,n])=>Math.abs(n)>1e-4))}function Is(e){return e.some(t=>t.enabled&&Object.values(t.correction).some(n=>Math.abs(n)>1e-4))}function rm(e){return e?.enabled?Math.abs(e.details.vignette)>1e-4||Math.abs(e.details.grain)>1e-4||Qf.some(n=>Math.abs(e.effects[n])>1e-4)?!0:e.intensity===0?!1:e.lut&&e.lut.intensity!==0?!0:po.some(n=>Math.abs(e.adjust[n])>1e-4)||(e.wheels?TS(e.wheels):!1)||(e.curves?Fs(e.curves):!1)||(e.hueCurves?Ds(e.hueCurves):!1)||(e.secondaries?Is(e.secondaries):!1):!1}var go=/^(|transparent|rgba\\(.*,\\s*0\\)|.*\\/\\s*0%?\\s*\\))$/,RS=new Set(["IMG","VIDEO","IFRAME","EMBED","OBJECT","CANVAS"]),im="http://www.w3.org/2000/svg",kS=new Set(["svg","g","foreignObject"]),MS=["Top","Right","Bottom","Left"],NS={left:-1/0,right:1/0,top:-1/0,bottom:1/0},om=e=>!!e.backgroundImage&&e.backgroundImage!=="none"||!go.test(e.backgroundColor),LS=e=>{let t=e.getPropertyValue("-webkit-text-fill-color")||e.color,n=Number.parseFloat(e.getPropertyValue("-webkit-text-stroke-width"))||0,r=e.getPropertyValue("-webkit-text-stroke-color")||e.color;return!go.test(t)||n>0&&!go.test(r)},am=e=>MS.map(t=>e[`border${t}Style`]!=="none"&&!go.test(e[`border${t}Color`])&&Number.parseFloat(e[`border${t}Width`])||0),bo=e=>e.bottom-e.top,Ps=(e,t,n)=>t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom,sm=(e,t)=>({left:Math.min(e.left,t.left),right:Math.max(e.right,t.right),top:Math.min(e.top,t.top),bottom:Math.max(e.bottom,t.bottom)}),FS=(e,t)=>t.display==="none"||t.position==="absolute"||t.position==="fixed"||Number.parseFloat(t.opacity)<=.01&&!e.hasAttribute(fn);function DS(e,t,n){if(e.width<=0&&e.height<=0)return!1;let r=3*(Number.parseFloat(t.fontSize)||16),i=Math.max(r,Math.min(2*e.height,20*r/3));return n<e.top-i||n>e.bottom+i}function IS(e,t,n,r){let[i,o,a,l]=am(t);if(!(i||o||a||l))return!1;let s=e.getBoundingClientRect(),{offsetWidth:u,offsetHeight:d}=e,m=u>0?s.width/u:1,f=d>0?s.height/d:1,b={left:s.left+l*m,right:s.right-o*m,top:s.top+i*f,bottom:s.bottom-a*f};return!Ps(b,n,r)}function PS(e){let t=[];for(let n of[...e].sort((r,i)=>r.left-i.left)){let r=t.findIndex(i=>n.top<i.bottom&&n.bottom>i.top&&n.left-i.right<=2*Math.max(bo(i),bo(n)));r<0?t.push(n):t[r]=sm(t[r],n)}return t}function OS(e){let t=[...e].sort((n,r)=>n.top-r.top);return t.flatMap((n,r)=>t.slice(r+1).flatMap(i=>{let o=i.left<n.right&&i.right>n.left,a=i.top-n.bottom<=2*Math.min(bo(n),bo(i));return o&&a&&i.top>n.bottom?[sm(n,i)]:[]}))}function lm(e,t,n){let r=e.defaultView,i=typeof e.createRange().getClientRects=="function",o=e.createRange(),a=new Map,l=new Map,s=new Map,u=x=>{let v=l.get(x);if(v===void 0){let _=r.getComputedStyle(x);v=FS(x,_)||i&&DS(x.getBoundingClientRect(),_,n),l.set(x,v)}return v},d=x=>{let v=s.get(x);if(v===void 0){let _=x.parentElement,w=_&&x.nodeValue?.trim()?r.getComputedStyle(_):null;v=!!w&&w.visibility!=="hidden"&&LS(w),s.set(x,v)}return v},m=x=>{if(!i)return[NS];let v=[];o.selectNodeContents(x);for(let _ of o.getClientRects()){let w=_.bottom-_.top;_.width>0&&w>0&&n>=_.top-2*w&&n<=_.bottom+2*w&&v.push(_)}return v},f=x=>{let v=a.get(x);if(v)return v;v=[];for(let _ of x.childNodes)_.nodeType===3?d(_)&&v.push(...m(_)):_.nodeType===1&&_.hasChildNodes()&&!u(_)&&v.push(...f(_));return a.set(x,v),v};function b(x){let v=PS(f(x));return v.some(_=>Ps(_,t,n))||OS(v).some(_=>Ps(_,t,n))}function p(x,v){let _=r.getComputedStyle(x,v);return!_.content||_.content==="none"||_.content==="normal"||_.display==="none"?!1:_.content!==\'""\'||om(_)||am(_).some(w=>w>0)}let y=(x,v)=>/inset/.test(v.boxShadow)||IS(x,v,t,n)||p(x,"::before")||p(x,"::after");return x=>{if(RS.has(x.tagName)||!(x.namespaceURI!==im||kS.has(x.localName))||!r)return!0;let _=r.getComputedStyle(x);return om(_)||y(x,_)||x.namespaceURI!==im&&b(x)}}var HS=["[data-hyperframes-ignore]","[data-hyperframes-picker-ignore]","[data-hf-ignore]","[data-no-inspect]","[data-no-pick]","[data-hyper-shader-loading]"].join(","),GS=["[data-hyperframes-picker-block]","[data-hyper-shader-loading]"].join(","),um="[data-hf-inner-root],[data-composition-id]:not([data-composition-id] *)",cm=`${um}{pointer-events:auto!important}`,BS=`@layer hf-picker{${cm}}`;function dm(e){let t=!1,n=null,r=null,i=null,o=null,a,l=new Set;function s(N,A){try{window.dispatchEvent(new CustomEvent(N,{detail:A}))}catch(H){P("runtime.picker.site1",H)}}function u(N){i=N,s("hyperframe:picker:hovered",{elementInfo:i,isPickMode:t,timestamp:Date.now()})}function d(N){o=N,s("hyperframe:picker:selected",{elementInfo:o,isPickMode:t,timestamp:Date.now()})}function m(N){if(l=new Set(Array.from(document.querySelectorAll(um)).filter(J=>getComputedStyle(J).pointerEvents==="none")),l.size===0)return N();let A=f(),H=A?b(A):p();try{return N()}finally{H(),l=new Set}}function f(){if(a!==void 0)return a;if(a=null,!Array.isArray(document.adoptedStyleSheets)||typeof CSSStyleSheet>"u")return null;try{let N=new CSSStyleSheet;N.replaceSync(BS),a=N}catch(N){P("runtime.picker.site2",N)}return a}function b(N){return document.adoptedStyleSheets=[...document.adoptedStyleSheets,N],()=>{document.adoptedStyleSheets=document.adoptedStyleSheets.filter(A=>A!==N)}}function p(){let N=document.createElement("style");return N.textContent=cm,(document.head??document.documentElement).appendChild(N),()=>N.remove()}function y(N){let A=N.ownerDocument.defaultView;if(!A)return!1;let H=N;if(A.getComputedStyle(N).visibility==="hidden")return!0;for(;H&&H!==document.body&&H!==document.documentElement;){let J=A.getComputedStyle(H);if(J.display==="none"||J.pointerEvents==="none")return!0;let B=Number.parseFloat(J.opacity);if(Number.isFinite(B)&&B<=.01&&!H.hasAttribute(fn))return!0;H=H.parentElement}return!1}function x(N){if(!N||N===document.body||N===document.documentElement)return!1;let A=N.tagName.toLowerCase();return!(A==="script"||A==="style"||A==="link"||A==="meta"||l.has(N)||N.closest(HS)||y(N))}function v(N){return!!N?.closest(GS)}function _(N){let A=N.parentElement?.getAttribute("data-composition-id");return!N.hasAttribute("data-hf-inner-root")||!A?null:`[data-composition-id="${CSS.escape(A)}"] > [data-hf-inner-root]`}function w(N){let A=_(N);if(A)return A;let H=N;if(H.id)return`#${CSS.escape(H.id)}`;let J=N.getAttribute("data-composition-id");if(J)return`[data-composition-id="${CSS.escape(J)}"]`;let B=N.getAttribute("data-composition-src");if(B)return`[data-composition-src="${CSS.escape(B)}"]`;let q=N.getAttribute("data-track-index");if(q)return`[data-track-index="${CSS.escape(q)}"]`;let $=N.tagName.toLowerCase(),K=N.parentElement;if(!K)return $;let X=K.querySelectorAll(`:scope > ${$}`);if(X.length===1)return $;for(let G=0;G<X.length;G+=1)if(X[G]===N)return`${$}:nth-of-type(${G+1})`;return $}function I(N){let A=N.tagName.toLowerCase(),H=(N.textContent??"").trim().replace(/\\s+/g," "),J=(q,$)=>{let K=Array.from(q);return K.length>$?`${K.slice(0,$-1).join("")}\\u2026`:q},B=/^h[1-6]$/.test(A);return B||A==="p"||A==="span"||A==="div"?H.length>0?J(H,56):B?"Heading":"Text":A==="img"?"Image":A==="video"?"Video":A==="audio"?"Audio":A==="svg"?"Shape":N.getAttribute("data-composition-src")?"Composition":A==="section"?"Section":`${A.charAt(0).toUpperCase()}${A.slice(1)}`}function D(N,A,H){let J=typeof H=="number"&&H>0?H:8,B=[];if(document.elementsFromPoint)B=document.elementsFromPoint(N,A);else if(document.elementFromPoint){let G=document.elementFromPoint(N,A);B=G?[G]:[]}if(v(B[0]??null))return[];let q={},$=[],K=[],X=lm(document,N,A);for(let[G,V]of B.entries()){if(!x(V))continue;let Z=`${V.tagName}::${V.id||""}::${G}`;if(!q[Z]&&(q[Z]=!0,$.push(V),(K.some(ce=>V.contains(ce))||X(V))&&(K.push(V),K.length>=J)))break}return K.length>0?K:$.slice(0,J)}function F(N){let A=N.getBoundingClientRect(),H={};for(let B of Array.from(N.attributes))B.name.startsWith("data-")&&(H[B.name]=B.value);return{id:N.id||null,tagName:N.tagName.toLowerCase(),selector:w(N),label:I(N),boundingBox:{x:A.left,y:A.top,width:A.width,height:A.height},textContent:N.textContent?N.textContent.trim().slice(0,200):null,src:N.getAttribute("src")||N.getAttribute("data-composition-src")||null,dataAttributes:H}}function O(N,A,H){return m(()=>D(N,A,H)).map(F)}function T(N){if(!t)return;let A=m(()=>{let J=D(N.clientX,N.clientY,1)[0]??(Ne(N.target)?N.target:null);return x(J)?J:null});if(!A||n===A)return;n&&n.classList.remove("__hf-pick-highlight"),n=A,A.classList.add("__hf-pick-highlight");let H=F(A);u(H),e.postMessage({source:"hf-preview",type:"element-hovered",elementInfo:H})}function M(N){if(!t)return;N.preventDefault(),N.stopPropagation(),N.stopImmediatePropagation();let A=O(N.clientX,N.clientY,8);A.length!==0&&(u(A[0]??null),e.postMessage({source:"hf-preview",type:"element-pick-candidates",candidates:A,selectedIndex:0,point:{x:N.clientX,y:N.clientY}}))}function R(N){N.key==="Escape"&&(j(),e.postMessage({source:"hf-preview",type:"pick-mode-cancelled"}))}function U(){t||(t=!0,r=document.createElement("style"),r.textContent=[".__hf-pick-highlight { outline: 2px solid #4f8cf7 !important; outline-offset: 2px; cursor: crosshair !important; }",".__hf-pick-active * { cursor: crosshair !important; }"].join(`\n`),document.head.appendChild(r),document.body.classList.add("__hf-pick-active"),document.addEventListener("mousemove",T,!0),document.addEventListener("click",M,!0),document.addEventListener("keydown",R,!0),s("hyperframe:picker:mode",{isPickMode:!0,timestamp:Date.now()}))}function j(){t&&(t=!1,n&&(n.classList.remove("__hf-pick-highlight"),n=null),r&&(r.remove(),r=null),document.body.classList.remove("__hf-pick-active"),document.removeEventListener("mousemove",T,!0),document.removeEventListener("click",M,!0),document.removeEventListener("keydown",R,!0),s("hyperframe:picker:mode",{isPickMode:!1,timestamp:Date.now()}))}function Y(){window.__HF_PICKER_API={enable:U,disable:j,isActive:()=>t,getHovered:()=>i,getSelected:()=>o,getCandidatesAtPoint:(N,A,H)=>Number.isFinite(N)&&Number.isFinite(A)?O(N,A,H):[],pickAtPoint:(N,A,H)=>{if(!Number.isFinite(N)||!Number.isFinite(A))return null;let J=O(N,A,8);if(!J.length)return null;let B=Math.max(0,Math.min(J.length-1,Number(H??0))),q=J[B]??null;return q?(d(q),e.postMessage({source:"hf-preview",type:"element-picked",elementInfo:q}),j(),q):null},describe:N=>Ne(N)?F(N):null,pickManyAtPoint:(N,A,H)=>{if(!Number.isFinite(N)||!Number.isFinite(A))return[];let J=O(N,A,8);if(!J.length)return[];let B=[],q=Array.isArray(H)?H:[0];for(let $ of q){let K=Math.max(0,Math.min(J.length-1,Math.floor(Number($)))),X=J[K];if(!X)continue;B.some(V=>V.selector===X.selector&&V.tagName===X.tagName)||B.push(X)}return B.length?(d(B[0]??null),e.postMessage({source:"hf-preview",type:"element-picked-many",elementInfos:B}),j(),B):[]}},s("hyperframe:picker:api-ready",{hasApi:!0,timestamp:Date.now()})}return{enablePickMode:U,disablePickMode:j,installPickerApi:Y}}var US=["width","height","top","left","right","bottom","inset","object-fit","object-position","z-index","opacity","visibility","filter","mix-blend-mode","backdrop-filter","border-radius","overflow","clip-path","mask","mask-image","mask-size","mask-position","mask-repeat","transform","transform-origin","translate","rotate","scale","box-sizing"];function Os(e){return Number.isFinite(e)&&e>0?e:30}function Hs(e){return Number.isFinite(e)&&e>0?e:0}function Gs(e,t){let n=Os(t);return Math.floor(Hs(e)*n+1e-9)/n}function Lr(e,t,n){let r=Number.isInteger(n)?n:1;if(r<=1)return Gs(e,t);let i=Os(t)*r;return Math.round(Hs(e)*i)/i}function fm(e,t){let n=Os(t),r=Hs(e),i=r*n,o=Math.round(i);return Math.abs(i-o)<=.001?o/n:r}function mm(e,t,n){return{start:fm(e,n),end:Number.isFinite(t)?fm(t,n):t}}function pm(e,t,n=US){for(let r of n){let i=t.getPropertyValue(r);i&&e.setProperty(r,i)}}function Fr(e,t,n){let r=e?.[t];return typeof r=="function"?Number(r.call(e))||n:typeof r=="number"&&Number.isFinite(r)?r:(r!=null&&P("runtime.player.nonConformantNum",{prop:t,actual:typeof r}),n)}function rt(e,t){let n=e?.[t];if(typeof n=="function"){n.call(e);return}n!==void 0&&P("runtime.player.nonConformantVoid",{method:t,actual:typeof n})}function Dr(e,t,n){if(e){for(let r of Object.values(e))if(!(!r||r===t))try{n(r)}catch(i){P("runtime.player.site1",i)}}}function hm(e,t,n,r){let i=Lr(t,n,r?.subFrameDivisions),o=r?.suppressEvents===!0;return rt(e,"pause"),typeof e.totalTime=="function"?e.totalTime(i,o):typeof e.seek=="function"&&e.seek(i,o),i}function WS(e,t,n,r,i){let o=[];Dr(e,t,a=>{rt(a,"play"),o.push(a)});try{return hm(t,n,r,i)}finally{for(let a of o)try{rt(a,"pause")}catch(l){P("runtime.player.site2",l)}}}function VS(e,t){Dr(e,t,n=>{rt(n,"play")})}function gm(e){let t=e.transport;return t?{_timeline:null,play:()=>t.play(),pause:()=>t.pause(),seek:(n,r)=>t.seek(n,r),renderSeek:(n,r)=>t.renderSeek(n,r),getTime:()=>t.getTime(),getDuration:()=>t.getDuration(),isPlaying:()=>t.isPlaying(),setPlaybackRate:n=>t.setPlaybackRate(n),getPlaybackRate:()=>t.getPlaybackRate()}:{_timeline:null,play:()=>{let n=e.getTimeline();if(!n||e.getIsPlaying())return;let r=Math.max(0,Number(e.getSafeDuration?.()??Fr(n,"duration",0))||0);r>0&&Math.max(0,Fr(n,"time",0))>=r&&(rt(n,"pause"),typeof n.seek=="function"&&n.seek(0,!1),e.onDeterministicSeek(0),e.setIsPlaying(!1),e.onSyncMedia(0,!1),e.onRenderFrameSeek(0)),typeof n.timeScale=="function"&&n.timeScale(e.getPlaybackRate()),rt(n,"play"),Dr(e.getTimelineRegistry?.(),n,i=>{typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),rt(i,"play")}),e.onDeterministicPlay(),e.setIsPlaying(!0),e.onShowNativeVideos(),e.onStatePost(!0)},pause:()=>{let n=e.getTimeline();if(!n)return;rt(n,"pause"),Dr(e.getTimelineRegistry?.(),n,i=>{rt(i,"pause")});let r=Math.max(0,Fr(n,"time",0));e.onDeterministicSeek(r),e.onDeterministicPause(),e.setIsPlaying(!1),e.onSyncMedia(r,!1),e.onRenderFrameSeek(r),e.onStatePost(!0)},seek:(n,r)=>{let i=e.getTimeline();if(!i)return;let o=Math.max(0,Number(n)||0),a=e.getIsPlaying(),l=WS(e.getTimelineRegistry?.(),i,o,e.getCanonicalFps());e.onDeterministicSeek(l),r?.keepPlaying&&a?(typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),rt(i,"play"),Dr(e.getTimelineRegistry?.(),i,s=>{typeof s.timeScale=="function"&&s.timeScale(e.getPlaybackRate()),rt(s,"play")}),e.onDeterministicPlay(),e.onShowNativeVideos(),e.onSyncMedia(l,!0)):(e.setIsPlaying(!1),e.onSyncMedia(l,!1)),e.onRenderFrameSeek(l),e.onStatePost(!0)},renderSeek:(n,r)=>{let i=e.getTimeline(),o=e.getCanonicalFps(),a=i?(VS(e.getTimelineRegistry?.(),i),hm(i,n,o,r)):Lr(Math.max(0,Number(n)||0),o,r?.subFrameDivisions);e.onDeterministicSeek(a,r),e.setIsPlaying(!1),e.onSyncMedia(a,!1),e.onRenderFrameSeek(a),e.onStatePost(!0)},getTime:()=>Fr(e.getTimeline(),"time",0),getDuration:()=>Fr(e.getTimeline(),"duration",0),isPlaying:()=>e.getIsPlaying(),setPlaybackRate:n=>e.setPlaybackRate(n),getPlaybackRate:()=>e.getPlaybackRate()}}function bm(){return{capturedTimeline:null,isPlaying:!1,currentTime:0,deterministicAdapters:[],canonicalFps:30,bridgeMuted:!1,bridgeVolume:1,mediaOutputMuted:!1,nativeMediaSyncDisabled:!1,webAudioMediaDisabled:!1,mediaAutoplayBlockedPosted:!1,mediaForceSyncNextTick:!1,playbackRate:1,bridgeLastPostedFrame:-1,bridgeLastPostedAt:0,bridgeLastPostedPlaying:!1,bridgeLastPostedMuted:!1,bridgeMaxPostIntervalMs:80,controlBridgeHandler:null,beforeUnloadHandler:null,injectedCompStyles:[],injectedCompScripts:[],injectedCompLinks:[],cachedTimedMediaEls:[],cachedMediaClips:[],cachedVideoClips:[],cachedMediaTimelineDurationSeconds:0,tornDown:!1,transportClock:null,transportRafId:null}}function pn(e){if(e==null||e.trim()==="")return null;let t=Number.parseFloat(e);return Number.isFinite(t)&&t>0?t:null}function Un(e){if(e==null||e.trim()==="")return null;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:null}function kt(){let e=document.querySelector(\'[data-composition-id][data-root="true"]\');return ye(e)?e:document.querySelector("[data-composition-id]")}var $S=new Set(["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"]);function Bs(e){return e.id||e.getAttribute("data-hf-id")||null}function zS(e){return Fe(e)}function qS(e,t){let n=e.getAttribute("data-composition-id");if(!n)return null;let r=Number(t[n]?.duration?.());return Number.isFinite(r)&&r>0?r:null}function jS(e){return be(e)?Number.isFinite(e.duration)?pt(e,e.duration):null:Ln(e)}function KS(e,t,n,r){let i=zS(e.getAttribute("data-duration"));return i!=null&&i>0?i:qS(e,t)??jS(e)??Math.max(0,n-r)}function XS(e){for(let[t,n]of e){let r=t.parentElement;for(;r;){let i=e.get(r);if(i){n.parentId=i.id,i.children.push(n);break}r=r.parentElement}}}function xm(e){let{startResolver:t,timelineRegistry:n,rootDuration:r}=e,i=new Map,o=kt(),a=0;for(let l of document.querySelectorAll("[data-start]")){if(l===o||$S.has(l.tagName))continue;let s=t.resolveStartForElement(l,0);if(KS(l,n,r,s)<=0)continue;let u={id:Bs(l)??`__clip-${a++}`,element:l,parentId:null,children:[]};i.set(l,u)}return XS(i),{roots:Array.from(i.values()).filter(l=>l.parentId===null)}}var Us="css:root",ym=["backdrop-filter","clip-path","filter","mask","mask-border-source","mask-image","perspective","rotate","scale","transform","translate","-webkit-mask-image"],YS=new Set([...ym,"contain","isolation","mask-border","mix-blend-mode","opacity"]),JS=new Set(["absolute","relative"]),QS=new Set(["flex","inline-flex","grid","inline-grid"]),ZS=new Set(["layout","paint","strict","content"]),ev=new Set(["size","inline-size"]);function tv(e){return e.position==="fixed"||e.position==="sticky"}function nv(e,t){if(t.zIndex==="auto"||t.zIndex==="")return!1;if(JS.has(t.position))return!0;let n=e.parentElement?e.ownerDocument.defaultView?.getComputedStyle(e.parentElement).display:null;return n!=null&&QS.has(n)}function rv(e){let t=Number.parseFloat(e.opacity);if(Number.isFinite(t)&&t<1||e.getPropertyValue("isolation")==="isolate")return!0;let n=e.getPropertyValue("mix-blend-mode");return n&&n!=="normal"?!0:ym.some(r=>{let i=e.getPropertyValue(r);return i!==""&&i!=="none"})}function iv(e){return e.getPropertyValue("contain").split(/\\s+/).some(n=>ZS.has(n))?!0:ev.has(e.getPropertyValue("container-type"))}function ov(e){return e.getPropertyValue("will-change").split(",").map(t=>t.trim()).some(t=>YS.has(t))}function av(e,t){return tv(t)||nv(e,t)||rv(t)||iv(t)?!0:ov(t)}function sv(e){let t=[],n=e;for(;n?.parentElement;)t.push(Array.prototype.indexOf.call(n.parentElement.children,n)),n=n.parentElement;return`css:${t.reverse().join(".")}`}function xo(e){let t=e.ownerDocument.defaultView;if(!t)return Us;let n=e.parentElement;for(;n&&n!==e.ownerDocument.documentElement;){try{if(av(n,t.getComputedStyle(n)))return sv(n)}catch{return Us}n=n.parentElement}return Us}function Ws(e){let t=e.trim().toLowerCase();return!(!t||t==="main"||t.includes("caption")||t.includes("ambient"))}var yo=7200;function So(e,t){let n=e.tagName.toLowerCase();if(n==="script"||n==="style"||n==="link"||n==="meta")return!1;let i=n==="video"||n==="audio"?t.resolver.resolveMediaStartForElement(e):t.resolver.resolveStartForElement(e,0),o=t.resolver.resolveDurationForElement(e),a=e.getAttribute("data-composition-id");if(a){let u=t.timelineRegistry[a],d=u&&typeof u.duration=="function"?Number(u.duration()):null;!(e.hasAttribute("data-duration")||e.hasAttribute("data-end")||e.hasAttribute(Fn)||e.hasAttribute(Dn))&&(o==null||o<=0)&&d!=null&&Number.isFinite(d)&&d>0&&(o=d)}let l=o!=null&&o>0?i+o:Number.POSITIVE_INFINITY,s=t.exportRenderSeek?mm(i,l,t.canonicalFps):{start:i,end:l};return Hi(t.currentTime,s.start,s.end,t.compositionDuration)}function Pr(e){return Fe(e)}function Vs(e){let t=e.getAttribute("data-duration"),n=e.getAttribute(Fn),r=In({start:0,duration:t,authoredDuration:n})?.duration;return r??([t,n].map(Pr).some(o=>o!=null&&o<=0)?0:null)}function Sm(e){return In({start:0,end:e.getAttribute("data-end"),authoredEnd:e.getAttribute(Dn)})?.end??null}function $s(e){try{let t=e.style?.zIndex;if(t&&t!=="auto"){let n=parseInt(t,10);if(Number.isFinite(n))return n}return 0}catch{return 0}}function zs(...e){let t=e.filter(n=>Number.isFinite(n??null));return t.length===0?null:Math.max(...t)}function qs(e,t){let n=e.getAttribute("data-track-index")??e.getAttribute("data-track");if(n==null)return t;let r=Number.parseInt(n,10);return Number.isFinite(r)?r:t}function Or(e){let t=String(e??"").trim();if(!t)return null;let n=t.toLowerCase();if(n.startsWith("data:")||n.startsWith("javascript:"))return null;try{return new URL(t,document.baseURI).toString()}catch{return t}}function vm(e){let t=e.getAttribute("src")??e.getAttribute("data-src");if(t)return Or(t);let n=e.getAttribute("data-composition-src");if(n)return Or(n);let r=e.querySelector("img[src], video[src], audio[src], source[src]");return r?Or(r.getAttribute("src")):null}function uv(e){let t=e.className;return typeof t!="string"?null:t.split(/\\s+/).map(n=>n.trim()).find(n=>n&&n!=="clip"&&!n.startsWith("__hf-"))??null}function cv(e){if(!e)return null;try{return new URL(e,document.baseURI).pathname.split("/").filter(Boolean).at(-1)??null}catch{return e.split(/[\\\\/]/).filter(Boolean).at(-1)??null}}function dv(e){let t=e.textContent?.replace(/\\s+/g," ").trim();return t?t.length>32?`${t.slice(0,31)}...`:t:null}function Ir(e){let t=e.replace(/\\.[^.]+$/i,"").replace(/[-_]+/g," ").replace(/\\s+/g," ").trim();return t?t.replace(/\\b\\w/g,n=>n.toUpperCase()):e}function fv(e,t,n){let r=e.getAttribute("data-timeline-label")??e.getAttribute("data-label")??e.getAttribute("aria-label")??null;if(r?.trim())return r.trim();let i=e.getAttribute("data-composition-id");if(i)return Ir(i);let o=e.id;if(o)return Ir(o);let a=uv(e);if(a)return Ir(a);let l=cv(vm(e));if(l)return Ir(l);let s=dv(e);return s||`${Ir(t)} ${n+1}`}function js(e){let n=window.__timelines??{},r=Qe({timelineRegistry:n,includeAuthoredTimingAttrs:!0}),i=X=>{if(!X)return null;let G=n[X]??null;if(!G||typeof G.duration!="function")return null;try{let V=Number(G.duration());return Number.isFinite(V)&&V>0?V:null}catch{return null}},o=()=>{let X=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(X.length===0)return null;let G=0;for(let V of X){let Z=r.resolveMediaStartForElement(V);if(!Number.isFinite(Z))continue;let ce=to(V);ce==null||ce<=0||(G=Math.max(G,Math.max(0,Z)+ce))}return G>0?G:null},a=(X,G)=>{let V=[],Z=null,ce=null,ae=null,z=X.parentElement;for(;z;){let Q=z.getAttribute("data-composition-id");Q&&(V.push(Q),!ae&&z!==G&&(ae=Q),Z==null&&(Z=r.resolveStartForElement(z,0)),ce==null&&(ce=Pr(z.getAttribute("data-duration"))??i(Q)??null)),z=z.parentElement}return{parentCompositionId:ae,compositionAncestors:V.reverse(),inheritedStart:Z,inheritedDuration:ce}},l=kt(),s=Array.from(document.querySelectorAll("[data-composition-id]")),u=l?.getAttribute("data-composition-id")??null,d=l?r.resolveStartForElement(l,0):0,m=o(),f=m!=null?Math.max(0,m-Math.max(0,d)):null,b=i(u),p=Vs(l??document.body),y=zs(...s.filter(X=>X!==l).map(X=>{let G=r.resolveStartForElement(X,0),V=r.resolveDurationForElement(X)??i(X.getAttribute("data-composition-id"))??null;return!Number.isFinite(G)||V==null||V<=0?null:Math.max(0,G)+V})),x=y!=null?Math.max(0,y-Math.max(0,d)):null,v=typeof b=="number"&&Number.isFinite(b)&&b>0?b:null,_=typeof p=="number"&&Number.isFinite(p)&&p>0?p:null,w=typeof f=="number"&&Number.isFinite(f)&&f>0?f:null,I=typeof x=="number"&&Number.isFinite(x)&&x>0?x:null,D=zs(w,I),F=v!=null&&D!=null&&v>=yo,T=_??(F?D:zs(v,w,I))??null,R=(T!=null?d+T:null)??(typeof m=="number"&&Number.isFinite(m)&&m>0?m:null),U=(X,G)=>!Number.isFinite(G)||G<=0?0:R==null||!Number.isFinite(R)?G:!Number.isFinite(X)||X>=R?0:Math.max(0,Math.min(G,R-X)),j=[],Y=[],N=Array.from(document.querySelectorAll("[data-start], [data-track-index], [data-composition-id], video, audio, img")),A=0;for(let[X,G]of N.entries()){if(G===l||["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"].includes(G.tagName))continue;let V=a(G,l),Z=G.tagName.toLowerCase(),ce=Z==="video"||Z==="audio"?r.resolveMediaStartForElement(G):r.resolveStartForElement(G,V.inheritedStart??0),ae=G.getAttribute("data-composition-id"),z=Vs(G);if(z==null&&ae&&ae!==u&&(z=i(ae)),z==null&&be(G)&&Number.isFinite(G.duration)&&(z=pt(G,G.duration)),z==null&&(z=Ln(G,ce)),z==null){let qe=V.inheritedDuration;if(qe!=null&&qe>0){let At=(V.inheritedStart??0)+qe;z=Math.max(0,At-ce)}}if(z==null||z<=0||(z=U(ce,z),z<=0))continue;let Q=ce+z;A=Math.max(A,Q);let lt=ae&&ae!==u?"composition":Z==="video"?"video":Z==="audio"?"audio":Z==="img"?"image":"element";j.push({id:Bs(G)??ae??null,label:fv(G,lt,j.length),start:ce,duration:z,track:qs(G,X),zIndex:$s(G),stackingContextId:xo(G),kind:lt,tagName:Z,compositionId:G.getAttribute("data-composition-id"),compositionAncestors:V.compositionAncestors,parentCompositionId:V.parentCompositionId,nodePath:null,compositionSrc:Or(G.getAttribute("data-composition-src")),playbackStart:ht(G),playbackRate:Ve(G),assetUrl:vm(G),timelineRole:G.getAttribute("data-timeline-role"),timelineLabel:G.getAttribute("data-timeline-label"),timelineGroup:G.getAttribute("data-timeline-group"),timelinePriority:Pr(G.getAttribute("data-timeline-priority"))})}let H=new Set(j.map(X=>X.id)),J=l?.getAttribute("data-composition-id")??null,B=J?n[J]??null:null;if(B&&l){let X=B;if(typeof X.getChildren=="function")try{let G=X.getChildren(!0,!0,!1)??[],V=new Map;for(let ae of l.children){let z=ae;if(!z.id)continue;let Q=z.tagName.toLowerCase();Q==="script"||Q==="style"||Q==="link"||V.set(z,{id:z.id,start:1/0,end:-1/0})}let Z=ae=>{let z=ae;for(;z;){if(V.has(z))return z;if(z===l)return null;z=z.parentElement}return null};for(let ae of G){if(typeof ae.targets!="function"||typeof ae.startTime!="function"||typeof ae.duration!="function")continue;let z=ae.startTime(),Q=ae.parent;for(;Q&&Q!==B&&typeof Q.startTime=="function";)z+=Q.startTime(),Q=Q.parent;let lt=z+ae.duration();if(!(!Number.isFinite(z)||!Number.isFinite(lt)))for(let qe of ae.targets()){if(!Ne(qe))continue;let rr=Z(qe);if(!rr)continue;let At=V.get(rr);At&&(At.start=Math.min(At.start,z),At.end=Math.max(At.end,lt))}}let ce=j.length>0?Math.max(...j.map(ae=>ae.track))+1:0;for(let[ae,z]of V){if(z.start===1/0||z.end===-1/0)continue;let Q=ae;if(H.has(Q.id))continue;let lt=Math.max(0,z.end-z.start);if(lt<=0)continue;let qe=U(z.start,lt);qe<=0||(A=Math.max(A,z.start+qe),j.push({id:Q.id,label:Q.getAttribute("data-timeline-label")??Q.getAttribute("data-label")??Q.getAttribute("aria-label")??Q.id,start:z.start,duration:qe,track:qs(Q,ce),zIndex:$s(Q),stackingContextId:xo(Q),kind:"element",tagName:Q.tagName.toLowerCase(),compositionId:Q.getAttribute("data-composition-id"),compositionAncestors:J?[J]:[],parentCompositionId:J,nodePath:null,compositionSrc:null,playbackStart:ht(Q),playbackRate:Ve(Q),assetUrl:null,timelineRole:Q.getAttribute("data-timeline-role"),timelineLabel:Q.getAttribute("data-timeline-label"),timelineGroup:Q.getAttribute("data-timeline-group"),timelinePriority:Pr(Q.getAttribute("data-timeline-priority"))}),H.add(Q.id))}}catch(G){P("runtime.timeline.site1",G)}}if(l&&T!=null&&T>0){let X=j.length>0?Math.max(...j.map(G=>G.track))+1:0;for(let G of l.children){let V=G;if(!V.id||H.has(V.id))continue;let Z=V.getAttribute("data-timeline-role");if(Z!=="overlay"&&Z!=="persistent-overlay")continue;let ce=V.tagName.toLowerCase();if(ce==="script"||ce==="style"||ce==="link"||ce==="meta"||window.getComputedStyle(V).display==="none")continue;let z=U(0,T);z<=0||(A=Math.max(A,z),j.push({id:V.id,label:V.getAttribute("data-timeline-label")??V.getAttribute("data-label")??V.getAttribute("aria-label")??V.id,start:0,duration:z,track:qs(V,X),zIndex:$s(V),stackingContextId:xo(V),kind:"element",tagName:ce,compositionId:V.getAttribute("data-composition-id"),compositionAncestors:J?[J]:[],parentCompositionId:J,nodePath:null,compositionSrc:null,playbackStart:ht(V),playbackRate:Ve(V),assetUrl:null,timelineRole:Z,timelineLabel:V.getAttribute("data-timeline-label"),timelineGroup:V.getAttribute("data-timeline-group"),timelinePriority:Pr(V.getAttribute("data-timeline-priority"))}),H.add(V.id))}}for(let X of s){if(X===l)continue;let G=X.getAttribute("data-composition-id");if(!G||!Ws(G))continue;let V=r.resolveStartForElement(X,0),Z=Vs(X);if((Z==null||Z<=0)&&Sm(X)!=null){let Q=Sm(X);Z=Math.max(0,Q-V)}let ce=i(G),ae=Z&&Z>0?Z:ce;if(ae==null||ae<=0)continue;let z=U(V,ae);z<=0||Y.push({id:G,label:X.getAttribute("data-label")??G,start:V,duration:z,thumbnailUrl:Or(X.getAttribute("data-thumbnail-url")),avatarName:null})}let q=Math.max(A||0,T??0),$=q>0?q:1,K=Math.max(1,Math.ceil($*Math.max(1,e.canonicalFps)));return{...Oi(e.canonicalFps),source:"hf-preview",type:"timeline",compositionContractVersion:1,durationSeconds:$,durationInFrames:K,clips:j,scenes:Y,compositionWidth:Un(l?.getAttribute("data-width"))??1920,compositionHeight:Un(l?.getAttribute("data-height"))??1080}}var Em=e=>e!==null&&Number.isFinite(e)&&e>0;function Hr(e){let t=e.clipEndsSeconds.filter(r=>r===null).length;if(Em(e.authoredDurationSeconds))return{seconds:e.authoredDurationSeconds,source:"authored",pendingClips:t};let n=e.clipEndsSeconds.filter(Em);return n.length>0?{seconds:Math.max(...n),source:"derived",pendingClips:t}:{seconds:null,source:"unresolved",pendingClips:t,reason:t>0?"every clip\'s length is still pending":"no authored duration and no clip with a length"}}var Ks="data-composition-id",mv="data-composition-src",pv=`[${Ks}]`,hN=`[${mv}]`,Xs="style",Ys="script",Js=\'link[rel="stylesheet"], link[rel="preconnect"]\',Am=`${Xs}, ${Ys}, ${Js}`;function hn(e){return e?Array.from(e):[]}function _m(e){let{contentNode:t,head:n,documentElement:r,hasTemplate:i,compositionId:o}=e,a=hn(t.querySelectorAll(pv)),l=o?a.find(d=>d.getAttribute(Ks)===o)??null:a[0]??null,s=(l??a[0])?.getAttribute(Ks)?.trim()||"",u=i?null:n??null;return{innerRoot:l,authoredCompositionId:o||s||null,scriptCompositionId:s||o||null,authoredRootId:l?.getAttribute("id")?.trim()||null,styleSources:[...hn(u?.querySelectorAll(Xs)),...hn(t.querySelectorAll(Xs))],scriptSources:[...hn(u?.querySelectorAll(Ys)),...hn(t.querySelectorAll(Ys))],linkSources:[...hn(n?.querySelectorAll(Js)),...hn(t.querySelectorAll(Js))],variableDefaultCarriers:[r,l].filter(d=>d!=null)}}var Ce=Cx(Zp(),1),eh=Ce.default,iL=Ce.default.stringify,oL=Ce.default.fromJSON,aL=Ce.default.plugin,sL=Ce.default.parse,lL=Ce.default.list,uL=Ce.default.document,cL=Ce.default.comment,dL=Ce.default.atRule,fL=Ce.default.rule,mL=Ce.default.decl,pL=Ce.default.root,hL=Ce.default.CssSyntaxError,gL=Ce.default.Declaration,bL=Ce.default.Container,xL=Ce.default.Processor,yL=Ce.default.Document,SL=Ce.default.Comment,vL=Ce.default.Warning,EL=Ce.default.AtRule,AL=Ce.default.Result,_L=Ce.default.Input,wL=Ce.default.Rule,CL=Ce.default.Root,TL=Ce.default.Node;var El="data-hf-scene",ri="hf-scene-parts",Al="data-hf-scene-no-swap";var _l="data-hf-authored-id",th="data-hf-inner-root";function wl(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function Cl(e){return e.replace(/\\\\/g,"\\\\\\\\").replace(/"/g,\'\\\\"\')}function jE(e){return e&&e.replace(/[^a-zA-Z0-9_-]/g,n=>`\\\\${n}`).replace(/^-?\\d/,n=>`\\\\${n}`)}function rh(e){let t=e.trim();return t?Array.from(new Set([t,jE(t)])).filter(Boolean):[]}function KE(e){return!!e&&/[\\w-]/.test(e)}function XE(e,t,n){let r=rh(t).sort((l,s)=>s.length-l.length);if(r.length===0)return e;let i="",o=0,a=null;for(let l=0;l<e.length;l+=1){let s=e[l],u=l>0?e[l-1]:"";if(a){i+=s,s===a&&u!=="\\\\"&&(a=null);continue}if(s===\'"\'||s==="\'"){a=s,i+=s;continue}if(s==="["){o+=1,i+=s;continue}if(s==="]"){o=Math.max(0,o-1),i+=s;continue}if(s==="#"&&o===0){let d=r.find(m=>e.startsWith(m,l+1));if(d){let m=e[l+1+d.length];if(!KE(m)){i+=n,l+=d.length;continue}}}i+=s}return i}function YE(e,t){let n=t?.trim();return n?XE(e,n,`[${_l}="${Cl(n)}"]`):e}function nh(e){return`${e}:not(:has([${th}])), ${e} > [${th}]`}function JE(e,t,n,r,i,o){let a=YE(e,r),l=QE(a,t,n),s=l.trim();if(!s||s==="*")return e;if(/^(html|body|:root)$/i.test(s))return o?nh(t):e;let u=new RegExp(`\\\\[\\\\s*data-composition-id\\\\s*[\\\\^\\\\*\\\\$]?=\\\\s*(["\'])${wl(n)}\\\\1\\\\s*\\\\]`,"g");if(u.test(s))return s.replace(u,"").trim()===""?nh(t):l.replace(u,t);let d=l.match(/^\\s*/)?.[0]??"",m=l.match(/\\s*$/)?.[0]??"";if(i){let f=r?`[${_l}="${Cl(r)}"]`:null;if(f&&s.startsWith(f)){let b=s.slice(f.length);return`${d}${t}${f}${b}${m}`}}return`${d}${t} ${s}${m}`}function QE(e,t,n){let r=wl(n),i=String.raw`\\[\\s*data-composition-id\\s*=\\s*(?:"${r}"|\'${r}\')\\s*\\]`,o=String.raw`\\s*\\[\\s*data-(?:start|duration)\\s*=\\s*(?:"[^"]*"|\'[^\']*\')\\s*\\]`;return e.replace(new RegExp(`${i}(?:${o})+`,"g"),t).replace(new RegExp(`(?:${o})+${i}`,"g"),t)}var ZE=new Set(["keyframes","-webkit-keyframes","font-face"]);function eA(e){return e?.type==="atrule"}function tA(e){let t=e.parent;for(;t;){if(eA(t)&&ZE.has(t.name.toLowerCase()))return!0;t=t.parent}return!1}function nA(e){let t=e.parent;for(;t;){if(t.type==="rule")return!0;t=t.parent}return!1}function ih(e,t,n,r,i){let o=t.trim();if(!e||!o)return e;let a=n||`[data-composition-id="${Cl(o)}"]`,l;try{l=eh.parse(e)}catch{return""}return l.walkRules(s=>{tA(s)||nA(s)||(s.selectors=s.selectors.map(u=>JE(u,a,o,r,i?.compoundAuthoredRoot,i?.scopeRootSelectors)))}),l.toResult({map:!1}).css}function ze(e){return JSON.stringify(e).replace(/</g,"\\\\u003c")}var oh=`!__hfBaseHyperframes\n ? __hfBaseHyperframes\n : Object.assign({}, __hfBaseHyperframes, {\n assetUrl: function(path) {\n var page = window.document.baseURI;\n return new URL(path, __hfCompositionSrc ? new URL(__hfCompositionSrc, page) : page).href;\n },\n getVariables: function() {\n var byComp = window.__hfVariablesByComp;\n var scoped = byComp && __hfTimelineCompId ? byComp[__hfTimelineCompId] : null;\n return scoped ? Object.assign({}, scoped) : {};\n },\n })`;function ah(e,t){return`const __hyperframes = (function(__hfBaseHyperframes, __hfTimelineCompId, __hfCompositionSrc) {\n return ${oh};\n})(window.__hyperframes, ${ze(e)}, ${ze(t?.trim()||null)});\n`}function sh(e,t,n="[HyperFrames] composition script error:",r,i=t,o,a){let l=ze(t),s=ze(i),u=ze(n),d=wl(t),m=ze(o?.trim()||null),f=ze(r??null),b=ze(String.raw`\\[\\s*data-composition-id\\s*=\\s*(?:"${d}"|\'${d}\')\\s*\\]`),p=ze(String.raw`\\s*\\[\\s*data-(?:start|duration)\\s*=\\s*(?:"[^"]*"|\'[^\']*\')\\s*\\]`),y=ze(rh(o?.trim()||""));return`(function(){\n var __hfCompId = ${l};\n var __hfTimelineCompId = ${s};\n var __hfErrorLabel = ${u};\n var __hfAuthoredRootId = ${m};\n var __hfCompositionSrc = ${ze(a?.trim()||null)};\n var __hfAuthoredRootAttr = ${ze(_l)};\n var __hfEscapeAttr = function(value) {\n return (value + "").replace(/\\\\\\\\/g, "\\\\\\\\\\\\\\\\").replace(/"/g, "\\\\\\\\\\\\"");\n };\n var __hfRootSelector = ${f} || (__hfCompId\n ? \'[data-composition-id="\' + __hfEscapeAttr(__hfCompId) + \'"]\'\n : "");\n var __hfRoot = null;\n var __hfRootSelectorPattern = ${b};\n var __hfTimingSelectorPattern = ${p};\n var __hfAuthoredRootIdForms = ${y};\n var __hfAuthoredRootSelector = __hfAuthoredRootId\n ? "[" + __hfAuthoredRootAttr + \'="\' + __hfEscapeAttr(__hfAuthoredRootId) + \'"]\'\n : "";\n var __hfIsSelectorNameChar = function(char) {\n return !!char && /[\\\\w-]/.test(char);\n };\n var __hfReplaceAuthoredRootIdSelectors = function(selector) {\n if (!__hfAuthoredRootSelector || !__hfAuthoredRootIdForms.length || typeof selector !== "string") {\n return selector;\n }\n var result = "";\n var bracketDepth = 0;\n var quote = null;\n for (var index = 0; index < selector.length; index += 1) {\n var char = selector[index];\n var previousChar = index > 0 ? selector[index - 1] : "";\n if (quote) {\n result += char;\n if (char === quote && previousChar !== "\\\\\\\\") {\n quote = null;\n }\n continue;\n }\n if (char === \'"\' || char === "\'") {\n quote = char;\n result += char;\n continue;\n }\n if (char === "[") {\n bracketDepth += 1;\n result += char;\n continue;\n }\n if (char === "]") {\n bracketDepth = Math.max(0, bracketDepth - 1);\n result += char;\n continue;\n }\n if (char === "#" && bracketDepth === 0) {\n var matchedForm = null;\n for (var formIndex = 0; formIndex < __hfAuthoredRootIdForms.length; formIndex += 1) {\n var form = __hfAuthoredRootIdForms[formIndex];\n if (selector.slice(index + 1, index + 1 + form.length) === form) {\n matchedForm = form;\n break;\n }\n }\n if (matchedForm) {\n var nextChar = selector[index + 1 + matchedForm.length];\n if (!__hfIsSelectorNameChar(nextChar)) {\n result += __hfAuthoredRootSelector;\n index += matchedForm.length;\n continue;\n }\n }\n }\n result += char;\n }\n return result;\n };\n var __hfNormalizeSelector = function(selector) {\n if (!__hfCompId || typeof selector !== "string") return selector;\n var normalized = selector\n .replace(new RegExp(__hfRootSelectorPattern + \'(?:\' + __hfTimingSelectorPattern + \')+\', \'g\'), __hfRootSelector)\n .replace(new RegExp(\'(?:\' + __hfTimingSelectorPattern + \')+\' + __hfRootSelectorPattern, \'g\'), __hfRootSelector);\n if (__hfAuthoredRootSelector) {\n normalized = __hfReplaceAuthoredRootIdSelectors(normalized);\n }\n return normalized;\n };\n var __hfFindRoot = function() {\n if (!__hfRoot && __hfRootSelector) {\n __hfRoot = window.document.querySelector(__hfRootSelector);\n }\n return __hfRoot;\n };\n var __hfContains = function(node) {\n var root = __hfFindRoot();\n return !root || node === root || root.contains(node);\n };\n var __hfQueryAll = function(selector) {\n var root = __hfFindRoot();\n if (!root || typeof selector !== "string") {\n return window.document.querySelectorAll(selector);\n }\n return Array.prototype.filter.call(window.document.querySelectorAll(__hfNormalizeSelector(selector)), function(node) {\n return __hfContains(node);\n });\n };\n var __hfQueryOne = function(selector) {\n var matches = __hfQueryAll(selector);\n return matches[0] || null;\n };\n var __hfGetElementById = function(id) {\n var found = window.document.getElementById(id);\n if (found && __hfContains(found)) return found;\n var root = __hfFindRoot();\n if (!root) return found || null;\n var idValue = id + "";\n if (__hfAuthoredRootId && __hfAuthoredRootId === idValue && root.getAttribute && root.getAttribute(__hfAuthoredRootAttr) === idValue) {\n return root;\n }\n if (root.id === idValue) return root;\n if (typeof root.querySelector !== "function") return null;\n try {\n var authoredRootMatch = root.querySelector(\'[\' + __hfAuthoredRootAttr + \'="\' + __hfEscapeAttr(idValue) + \'"]\');\n if (authoredRootMatch) return authoredRootMatch;\n } catch {}\n if (typeof CSS !== "undefined" && CSS && typeof CSS.escape === "function") {\n try {\n return root.querySelector("#" + CSS.escape(idValue)) || null;\n } catch {}\n }\n try {\n return root.querySelector(\'[id="\' + __hfEscapeAttr(idValue) + \'"]\') || null;\n } catch {}\n return null;\n };\n var __hfScopedDocument = typeof Proxy === "function"\n ? new Proxy(window.document, {\n get: function(target, prop, receiver) {\n if (prop === "querySelector") return __hfQueryOne;\n if (prop === "querySelectorAll") return __hfQueryAll;\n if (prop === "getElementById") return __hfGetElementById;\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" ? value.bind(target) : value;\n },\n })\n : window.document;\n var __hfTimelineRegistryProxy = null;\n var __hfGetTimelineRegistry = function() {\n window.__timelines = window.__timelines || {};\n if (!__hfCompId || __hfCompId === __hfTimelineCompId || typeof Proxy !== "function") {\n return window.__timelines;\n }\n if (!__hfTimelineRegistryProxy) {\n __hfTimelineRegistryProxy = new Proxy(window.__timelines, {\n get: function(target, prop, receiver) {\n if (prop !== __hfCompId) {\n return Reflect.get(target, prop, target);\n }\n var authoredValue = Reflect.get(target, prop, target);\n return authoredValue === undefined\n ? Reflect.get(target, __hfTimelineCompId, target)\n : authoredValue;\n },\n set: function(target, prop, value, receiver) {\n if (prop !== __hfCompId) {\n return Reflect.set(target, prop, value, target);\n }\n // The authored node remains in the compiled DOM when its local id\n // differs from the runtime mount id, so readiness legitimately sees\n // both compositions. Publish the same timeline under both identities\n // instead of replacing one with the other.\n var authoredSet = Reflect.set(target, __hfCompId, value, target);\n var runtimeSet = Reflect.set(target, __hfTimelineCompId, value, target);\n return authoredSet && runtimeSet;\n },\n });\n }\n return __hfTimelineRegistryProxy;\n };\n var __hfScopedWindow = typeof Proxy === "function"\n ? new Proxy(window, {\n get: function(target, prop, receiver) {\n if (prop === "__timelines") return __hfGetTimelineRegistry();\n // Inside a sub-composition, __hyperframes is passed as a bare script\n // param bound to the SCOPED variant (per-comp getVariables). But\n // authors routinely write the documented window.__hyperframes.\n // getVariables() form, which would otherwise fall through to the host\n // page\'s base __hyperframes and return the WRONG (or empty) variables\n // for this instance. Route it to the scoped variant too so both\n // spellings resolve to this composition\'s own variables.\n // (__hfScopedHyperframes is a hoisted var assigned below, before any\n // sub-comp script -- the only code that reads this -- runs.)\n if (prop === "__hyperframes") return __hfScopedHyperframes;\n // Native window methods must stay bound to the real window. Handed\n // back unbound, "this" at call time is this Proxy and Chrome rejects\n // it with "Illegal invocation", which broke window.addEventListener,\n // setTimeout, matchMedia and getComputedStyle inside every\n // sub-composition -- including the window.addEventListener("hf-seek",\n // ...) form the Three.js and TypeGPU adapters document. The sibling\n // document and gsap proxies here already bind.\n //\n // Only bind non-constructors. Function.prototype.bind drops static\n // members, so binding a class exposed on window (window.Texts and\n // friends) would silently strip its statics. Built-in methods have\n // no .prototype; classes and constructor functions do.\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" && value.prototype === undefined\n ? value.bind(target)\n : value;\n },\n set: function(target, prop, value, receiver) {\n if (prop === "__timelines") {\n // Common authoring boilerplate assigns the registry back to\n // itself (window.__timelines = window.__timelines || {}). The\n // getter above returns our proxy; do not replace the canonical\n // registry with that proxy or later wrappers will stack proxies.\n if (value === __hfTimelineRegistryProxy) return true;\n target.__timelines = value || {};\n __hfTimelineRegistryProxy = null;\n return true;\n }\n return Reflect.set(target, prop, value, target);\n },\n })\n : window;\n var __hfResolveGsapTarget = function(target) {\n if (typeof target === "string") return __hfQueryAll(target);\n if (!Array.isArray(target)) return target;\n return target.reduce(function(resolved, item) {\n if (typeof item === "string") {\n return resolved.concat(Array.prototype.slice.call(__hfQueryAll(item)));\n }\n resolved.push(item);\n return resolved;\n }, []);\n };\n var __hfScopeTimeline = function(timeline) {\n if (!timeline || timeline.__hfScopedCompositionRoot === __hfFindRoot()) return timeline;\n ["to", "from", "fromTo", "set"].forEach(function(method) {\n var original = timeline[method];\n if (typeof original !== "function") return;\n timeline[method] = function(target) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(target);\n return original.apply(timeline, args);\n };\n });\n try {\n Object.defineProperty(timeline, "__hfScopedCompositionRoot", {\n value: __hfFindRoot(),\n configurable: true,\n });\n } catch {\n // Best-effort: timelines coming from user code may have a frozen target\n // or a non-extensible defineProperty path. Swallow \\u2014 the scoped root\n // is an enrichment, not a correctness invariant for playback.\n }\n return timeline;\n };\n var __hfBaseGsap = typeof gsap === "undefined" ? window.gsap : gsap;\n var __hfScopedGsap = !__hfBaseGsap || typeof Proxy !== "function"\n ? __hfBaseGsap\n : new Proxy(__hfBaseGsap, {\n get: function(target, prop, receiver) {\n if (prop === "timeline") {\n return function() {\n return __hfScopeTimeline(target.timeline.apply(target, arguments));\n };\n }\n if (prop === "to" || prop === "from" || prop === "fromTo" || prop === "set") {\n return function(firstArg) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(firstArg);\n return target[prop].apply(target, args);\n };\n }\n if (prop === "utils" && target.utils && typeof Proxy === "function") {\n return new Proxy(target.utils, {\n get: function(utilsTarget, utilsProp, utilsReceiver) {\n if (utilsProp === "toArray") {\n return function(firstArg) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(firstArg);\n return utilsTarget.toArray.apply(utilsTarget, args);\n };\n }\n if (utilsProp === "selector") {\n return function(base) {\n var baseEl = typeof base === "string" ? __hfQueryOne(base) : base;\n var root = baseEl || __hfFindRoot();\n return function(selector) {\n if (!root || typeof selector !== "string") return [];\n return Array.prototype.filter.call(\n window.document.querySelectorAll(__hfNormalizeSelector(selector)),\n function(node) {\n return node === root || (typeof root.contains === "function" && root.contains(node));\n },\n );\n };\n };\n }\n var value = Reflect.get(utilsTarget, utilsProp, utilsTarget);\n return typeof value === "function" ? value.bind(utilsTarget) : value;\n },\n });\n }\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" ? value.bind(target) : value;\n },\n });\n var __hfBaseHyperframes = window.__hyperframes;\n var __hfScopedHyperframes = ${oh};\n var __hfRun = function() {\n try {\n (function(document, gsap, window, __hyperframes) {\n${e.replace(/<\\/(script)/gi,"<\\\\/$1")}\n }).call(window, __hfScopedDocument, __hfScopedGsap, __hfScopedWindow, __hfScopedHyperframes);\n } catch (_err) {\n console.error(__hfErrorLabel, __hfCompId, _err);\n }\n };\n // What the script started on the global gsap timeline, by any route, for a scene swap to revert.\n // Only a page with a scene manifest can swap; elsewhere the first script stores null and none records.\n var __hfRecordAnimations = function(run) {\n if (window.__hfSceneAnimations === undefined) {\n window.__hfSceneAnimations = window.document.querySelector(${ze(`meta[name="${ri}"]`)})\n ? {}\n : null;\n }\n var byComp = window.__hfSceneAnimations;\n var globalTimeline = __hfBaseGsap && __hfBaseGsap.globalTimeline;\n if (!byComp || !globalTimeline || !__hfTimelineCompId) return run();\n var before = globalTimeline.getChildren(false);\n // A set completes as it is made and would leave the timeline before the diff below.\n var autoRemove = globalTimeline.autoRemoveChildren;\n globalTimeline.autoRemoveChildren = false;\n run();\n globalTimeline.autoRemoveChildren = autoRemove;\n var recorded = (byComp[__hfTimelineCompId] = byComp[__hfTimelineCompId] || []);\n globalTimeline.getChildren(false).forEach(function(animation) {\n if (before.indexOf(animation) >= 0) return;\n recorded.push(animation);\n // Dropped as the timeline drops a finished tween (it keeps a paused one); moved back, a tween re-adds itself.\n if (autoRemove && !animation.getChildren && animation.totalProgress() === 1) globalTimeline.remove(animation);\n });\n };\n __hfFindRoot();\n __hfRecordAnimations(__hfRun);\n})();`}var lh=(e,t)=>e&&Object.fromEntries(Object.entries(e).map(([n,r])=>[n,t(r)]));function uh(e,t){let n;try{n=JSON.parse(e)}catch{return null}if(!n||typeof n!="object")return null;let{imports:r,scopes:i}=n;return{imports:lh(r,t),scopes:i&&Object.fromEntries(Object.entries(i).map(([o,a])=>[t(o),lh(a,t)??{}]))}}function rA(e){let t=e.getAttribute("type")??"",n=e.tagName.toLowerCase()==="link"?t.split(";")[0].trim():t;if(n!==""&&n.toLowerCase()!=="text/css")return;let r=(e.getAttribute("media")??"").trim().toLowerCase();return JSON.stringify([r==="all"?"":r,e.getAttribute("title")??""])}var DL=JSON.stringify(["",""]);function ch(e){return JSON.stringify([e.getAttribute("href"),(e.getAttribute("rel")??"").trim().toLowerCase(),rA(e)??e.getAttribute("type"),e.hasAttribute("disabled")])}function dh(e,t){let n=ch(t);return[...e.querySelectorAll("link[href]")].some(r=>!r.closest("noscript")&&ch(r)===n)}var iA=["data-composition-id","data-composition-file","data-start","data-duration","data-end","data-track-index","data-track","data-composition-src","data-hf-authored-duration","data-hf-authored-end"];function fh(e){let t=e.getAttribute("id")?.trim();for(let n of iA)e.removeAttribute(n);t&&(e.removeAttribute("id"),e.setAttribute("data-hf-authored-id",t)),e.setAttribute("data-hf-inner-root","true")}var oA=8e3,aA=/^(?![a-zA-Z][a-zA-Z\\d+\\-.]*:)(?!\\/\\/)(?!\\/)(?!\\.\\.?\\/).+/,sA=/\\burl\\(\\s*(["\']?)([^)"\']+)\\1\\s*\\)/g,lA=["src","href"];function uA(e){return!e||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//")||e.startsWith("data:")||e.startsWith("#")||e.startsWith("/")}function hh(e,t){if(!t)return e;let n=e.trim();if(uA(n)||!n.startsWith("../")&&n!=="..")return e;try{return new URL(n,t).href}catch{return e}}function gh(e,t){return!t||!e?e:e.replace(sA,(n,r,i)=>{let o=hh(i||"",t);return o===i?n:`url(${r||""}${o}${r||""})`})}function cA(e,t){for(let n of Array.from(e.querySelectorAll("[src], [href]")))for(let r of lA){let i=n.getAttribute(r);if(i==null)continue;let o=hh(i,t);o!==i&&n.setAttribute(r,o)}}function dA(e,t){for(let n of Array.from(e.querySelectorAll("[style]"))){let r=n.getAttribute("style");if(r==null)continue;let i=gh(r,t);i!==r&&n.setAttribute("style",i)}}function fA(e,t){for(let n of Array.from(e.querySelectorAll("style"))){let r=n.textContent||"",i=gh(r,t);i!==r&&(n.textContent=i)}}function bh(e,t){if(t){cA(e,t),dA(e,t),fA(e,t);for(let n of Array.from(e.querySelectorAll("template")))bh(n.content,t)}}function mA(e,t){return`${e}__hf${t}`}var pA=e=>new Promise(t=>{let n=!1,r=Date.now(),i=null,o=a=>{n||(n=!0,i!=null&&window.clearTimeout(i),t({status:a,elapsedMs:Math.max(0,Date.now()-r)}))};e.addEventListener("load",()=>o("load"),{once:!0}),e.addEventListener("error",()=>o("error"),{once:!0}),i=window.setTimeout(()=>o("timeout"),oA)});function Rl(e){for(;e.firstChild;)e.removeChild(e.firstChild);e.textContent=""}function Tl(e){for(let t of Array.from(e.querySelectorAll(Am)))t.remove()}function hA(e){let t=document.importNode(e,!0);fh(t);let n=pn(t.getAttribute("data-width")),r=pn(t.getAttribute("data-height"));return t.style.width=n===null?"100%":`${n}px`,t.style.height=r===null?"100%":`${r}px`,t}function mh(e,t){let n=e.trim();if(!n)return e;try{return aA.test(n)&&!n.startsWith("#")&&!n.startsWith("?")?new URL(n,document.baseURI).toString():t?new URL(n,t).toString():new URL(n,document.baseURI).toString()}catch{return e}}function ph(e,t){try{let n=new URL(e),r=new URL(t);return n.search="",n.hash="",r.search="",r.hash="",n.href===r.href}catch{return!1}}function Oo(e){let t=(e.getAttribute("data-composition-id")||"").trim()||null;return{authoredCompositionId:(e.getAttribute("data-hf-original-composition-id")||t||"").trim()||null,runtimeCompositionId:t}}function gA(e){let t=new Map;for(let n of e){let r=Oo(n).authoredCompositionId||"";r&&t.set(r,(t.get(r)||0)+1)}return t}function xh(e){let t=Oo(e).authoredCompositionId;return t?!!document.querySelector(`template#${CSS.escape(t)}-template`):!1}function bA(e){return!!e.querySelector(\'[data-hf-inner-root="true"]\')}function xA(e){return e.hasAttribute("data-composition-src")?!0:xh(e)?e.children.length===0||e.hasAttribute("data-hf-original-composition-id")?!0:bA(e):!1}function Ml(){return Array.from(document.querySelectorAll("[data-composition-src], [data-composition-id]")).filter(t=>t.hasAttribute("data-composition-src")?!0:xh(t))}function yh(){let e=window.__hfVariablesByComp;if(!e)return;let t=new Set(Ml().map(n=>Oo(n).runtimeCompositionId).filter(n=>!!n));for(let n of Object.keys(e))t.has(n)||delete e[n]}function Sh(e,t=gA(e)){let n=new Map,r=new Map;for(let i of e){let{authoredCompositionId:o,runtimeCompositionId:a}=Oo(i),l=xA(i);if(!o){r.set(i,{authoredCompositionId:null,runtimeCompositionId:a});continue}let s=(t.get(o)||0)>1,u=a||o;if(l){let d=s?(n.get(o)||0)+1:0;s&&n.set(o,d),u=s?mA(o,d):o,s?i.setAttribute("data-hf-original-composition-id",o):i.removeAttribute("data-hf-original-composition-id"),i.setAttribute("data-composition-id",u),a&&a!==u&&window.__hfVariablesByComp&&delete window.__hfVariablesByComp[a]}r.set(i,{authoredCompositionId:o,runtimeCompositionId:u})}return r}async function kl(e){let t=_m({contentNode:e.sourceNode,head:e.head,hasTemplate:e.hasTemplate,compositionId:e.authoredCompositionId}),n=ye(t.innerRoot)?t.innerRoot:null,r=n??e.sourceNode,i=t.authoredCompositionId,o=t.scriptCompositionId,a=e.runtimeCompositionId||null,l=t.authoredRootId,s=a?`[data-composition-id="${CSS.escape(a)}"]`:void 0;for(let f of t.linkSources){let b=(f.getAttribute("href")||"").trim();if(!b)continue;let p=e.compositionUrl?new URL(b,e.compositionUrl).href:b;if(e.compositionUrl&&ph(p,e.compositionUrl))continue;let y=f.cloneNode(!0);cd(y)&&(y.href=p,!dh(document.head,y)&&(document.head.appendChild(y),e.injectedLinks.push(y)))}(f=>{for(let b of f){let p=b.cloneNode(!0);ud(p)&&(i&&(p.textContent=ih(p.textContent||"",i,s,l,{scopeRootSelectors:!0})),document.head.appendChild(p),e.injectedStyles.push(p))}})(t.styleSources);let d=f=>{let b=f.getAttribute("type")?.trim()??"",p=f.getAttribute("src")?.trim()??"";if(p){let x=mh(p,e.compositionUrl);return e.compositionUrl&&ph(x,e.compositionUrl)?null:{kind:"external",src:x,type:b}}let y=f.textContent?.trim()??"";return y?{kind:"inline",content:y,type:b,scopeCompositionId:o}:null},m=t.scriptSources.map(d).filter(f=>f!==null);if(n){let f=n.getAttribute("data-width"),b=n.getAttribute("data-height"),p=e.parseDimensionPx(f),y=e.parseDimensionPx(b);f&&e.host.setAttribute("data-width",f),b&&e.host.setAttribute("data-height",b),p&&ye(e.host)&&(e.host.style.width=p),y&&ye(e.host)&&(e.host.style.height=y),n.hasAttribute("data-timeline-locked")&&e.host.setAttribute("data-timeline-locked","");let x=hA(n);!e.authoredCompositionId&&i&&x.setAttribute("data-composition-id",i),Tl(x),e.host.appendChild(x)}else if(e.hasTemplate){let f=document.importNode(r,!0);Tl(f),e.host.appendChild(f)}else e.host.innerHTML=e.fallbackBodyInnerHtml,Tl(e.host);a&&yA(e,r,a);for(let f of m){let b=document.createElement("script");if(f.type&&(b.type=f.type),b.async=!1,f.kind==="external")b.src=f.src;else if(f.type.toLowerCase()==="importmap"){let p=uh(f.content,y=>mh(y,e.compositionUrl));b.textContent=p?JSON.stringify(p):f.content}else if(f.type.toLowerCase()==="module"){let p=f.scopeCompositionId?ah(a||f.scopeCompositionId,e.compositionUrl?.href):"";b.textContent=p+f.content}else f.scopeCompositionId?b.textContent=sh(f.content,f.scopeCompositionId,"[HyperFrames] composition script error:",s,a||f.scopeCompositionId,l,e.compositionUrl?.href):b.textContent=`(function(){${f.content}})();`;if(document.body.appendChild(b),e.injectedScripts.push(b),f.kind==="external"){let p=await pA(b);p.status!=="load"&&e.onDiagnostic?.({code:"external_composition_script_load_issue",details:{hostCompositionId:e.authoredCompositionId,runtimeCompositionId:e.runtimeCompositionId,hostCompositionSrc:e.hostCompositionSrc,resolvedScriptSrc:f.src,loadStatus:p.status,elapsedMs:p.elapsedMs}})}}}async function vh(e){let t=Ml();if(yh(),t.length===0)return;let n=Sh(t),r=t.filter(i=>{if(i.hasAttribute("data-composition-src")||i.children.length>0)return!1;let o=n.get(i)?.authoredCompositionId;return o?!!document.querySelector(`template#${CSS.escape(o)}-template`):!1});if(r.length!==0)for(let i of r){let o=n.get(i),a=o?.authoredCompositionId;if(!a)continue;let l=document.querySelector(`template#${CSS.escape(a)}-template`);Rl(i),await kl({host:i,authoredCompositionId:a,runtimeCompositionId:o?.runtimeCompositionId||a,hostCompositionSrc:`template#${a}-template`,sourceNode:l.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:null,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,injectedLinks:e.injectedLinks,parseDimensionPx:e.parseDimensionPx,onDiagnostic:e.onDiagnostic})}}async function Eh(e){let t=Ml();if(yh(),t.length===0)return;let n=Sh(t),r=t.filter(i=>i.hasAttribute("data-composition-src"));r.length!==0&&await Promise.all(r.map(async i=>{let o=i.getAttribute("data-composition-src");if(!o)return;let a=n.get(i),l=a?.authoredCompositionId||null,s=a?.runtimeCompositionId||l||null,u=null;try{u=new URL(o,document.baseURI)}catch{u=null}Rl(i);try{let d=l!=null?document.querySelector(`template#${CSS.escape(l)}-template`):null;if(d){await kl({host:i,authoredCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,sourceNode:d.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:u,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,injectedLinks:e.injectedLinks,parseDimensionPx:e.parseDimensionPx,onDiagnostic:e.onDiagnostic});return}let m=await fetch(o);if(!m.ok)throw new Error(`HTTP ${m.status}`);let f=await m.text(),p=new DOMParser().parseFromString(f,"text/html");bh(p,u);let y=(l?p.querySelector(`template#${CSS.escape(l)}-template`):null)??p.querySelector("template"),x=y?y.content:p.body;await kl({host:i,authoredCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,sourceNode:x,hasTemplate:!!y,fallbackBodyInnerHtml:p.body.innerHTML,compositionUrl:u,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,injectedLinks:e.injectedLinks,parseDimensionPx:e.parseDimensionPx,head:p.head,declaredVariableDefaults:mr(p.documentElement),variableDeclarer:p.documentElement,onDiagnostic:e.onDiagnostic})}catch(d){e.onDiagnostic?.({code:"external_composition_load_failed",details:{hostCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,errorMessage:d instanceof Error?d.message:"unknown_error"}}),Rl(i)}}))}function yA(e,t,n){let i={...e.declaredVariableDefaults??(Ne(t)?mr(t):{}),...sd(e.host)};Ha(e.variableDeclarer??(Ne(t)?t:null),i,n),od(e.host),Object.keys(i).length>0?(window.__hfVariablesByComp||(window.__hfVariablesByComp={}),window.__hfVariablesByComp[n]=i,Ga(e.host,{...id(e.host,i,window),...Bi()})):window.__hfVariablesByComp&&delete window.__hfVariablesByComp[n]}function SA(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function vA(e){if(!Array.isArray(e))throw new Error("expected a JSON array");if(!e.every(SA))throw new Error("every array entry must be an object");return e}function EA(e){let n=e.vars.data?.captionState;return n==="dim"||n==="active"?n:void 0}function AA(e){return ye(e)?e.dataset.captionWrapper!=="true"?e:e.querySelector(":scope > span")??null:null}function _A(){let e=[],t=document.querySelectorAll(".caption-group");for(let n of t)for(let r of n.children){if(!ye(r))continue;let i=r.dataset.captionWrapper==="true"?r.querySelector(":scope > span"):r.tagName==="SPAN"?r:null;i&&e.push(i)}return e}function wA(e){let t=e.parentElement;if(t?.dataset.captionWrapper==="true")return t;let n=document.createElement("span");return n.style.display="inline-block",n.dataset.captionWrapper="true",e.parentNode?.insertBefore(n,e),n.appendChild(e),n}var Ll=()=>window.gsap,_h=()=>fetch("caption-overrides.json").then(e=>e.ok?e.json():null),wh=e=>e===null?[]:vA(e);function Ch(e){let t=e instanceof Error?e.message:String(e);console.error(`[HyperFrames] Invalid caption-overrides.json: ${t}`)}function Th(){return Ll()?_h().then(wh).catch(e=>(Ch(e),[])):Promise.resolve([])}function Fl(e,t){return!Ll()||document.querySelectorAll(".caption-group").length===0?Promise.resolve():_h().then(n=>Dl(wh(n),e,t)).catch(Ch)}function CA(e,t){return(e.wordId?AA(document.getElementById(e.wordId)):null)??(e.wordIndex!==void 0?t[e.wordIndex]??null:null)}function Ah(e,t){return Object.fromEntries(t.filter(n=>e[n]!==void 0).map(n=>[n,e[n]]))}function Nl(e,t){let n=e.style.color;e.style.color=t;let r=getComputedStyle(e).color;return e.style.color=n,r}function TA(e,t){let n=t[0]?.vars.startAt;return Nl(e,n?.color===void 0?"":String(n.color))}function RA(e,t,n,r){let i=EA(e);if(i)return i;let o=String(e.vars.color);return/var\\(|currentcolor/i.test(o)?Nl(t,o)===n?"dim":"active":(r.has(o)||r.set(o,Nl(t,o)),r.get(o)===n?"dim":"active")}function kA(e,t,n){if(e.dimColor)return e.dimColor;if(!(t.length===0||t.some(r=>r.vars.runBackwards)))return n}function MA(e,t,n,r){let i=e.getTweensOf(t).filter(l=>l.vars.color!==void 0).sort((l,s)=>l.startTime()-s.startTime()),o=TA(t,i);for(let l of i){let u=RA(l,t,o,r)==="dim"?n.dimColor:n.activeColor;u&&(l.vars.color=u),l.vars.runBackwards||l.invalidate?.()}let a=kA(n,i,o);a&&e.set(t,{color:a})}function NA(e,t,n,r){let i=Ah(n,["x","y","scale","rotation"]),o=Ah(n,["opacity","fontWeight","fontFamily"]);if(n.fontSize!==void 0&&(o.fontSize=`${n.fontSize}px`),(n.activeColor||n.dimColor)&&MA(e,t,n,r),Object.keys(o).length>0&&e.set(t,o),Object.keys(i).length>0){let a=wA(t);e.set(a,i)}}function Dl(e,t,n=()=>{}){let r=Ll();if(!r||e.length===0)return;n();let i=_A(),o=new Map;for(let a of e){let l=CA(a,i);!l||t&&!t.some(s=>s.contains(l))||NA(r,l,a,o)}}var Pl="data-hf-edit-base-x",Ol="data-hf-edit-base-y",Kt="data-hf-edit-original-translate",Ho=e=>{let t=parseFloat(e??"");return Number.isFinite(t)?t:0},LA=e=>{let t=[],n=0,r="";for(let i of e.trim())i==="("&&(n+=1),i===")"&&(n=Math.max(0,n-1)),/\\s/.test(i)&&n===0?(r&&t.push(r),r=""):r+=i;return r&&t.push(r),t},Rh=/^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)px$/,Il=(e,t)=>Rh.test(e)&&Rh.test(t)?`${parseFloat(e)+parseFloat(t)}px`:`calc(${e} + ${t})`,FA=(e,t,n)=>{if(!e||e==="none")return`${t} ${n}`;let[r,i,o]=LA(e);if(r===void 0)return`${t} ${n}`;if(i===void 0)return`${Il(r,t)} ${n}`;let a=o===void 0?"":` ${o}`;return`${Il(r,t)} ${Il(i,n)}${a}`},DA=e=>{try{e.ownerDocument.defaultView?.gsap?.getProperty?.(e,"x")}catch{}},IA=e=>{let t=e.style.getPropertyValue("translate").trim();if(t)return t==="none"?"":t;try{let n=e.ownerDocument.defaultView,r=n?n.getComputedStyle(e).getPropertyValue("translate").trim():"";return r==="none"?"":r}catch{return""}},Go=new WeakMap;function Fh(e){Go.delete(e)}function PA(e,t){let n=Go.get(e);if(!t?.force&&n!==void 0&&e.style.getPropertyValue("translate")!==n){Ye("position_edit_fold_skipped",{hfId:e.getAttribute("data-hf-id")});return}let r=Ho(e.getAttribute("data-x"))-Ho(e.getAttribute(Pl)),i=Ho(e.getAttribute("data-y"))-Ho(e.getAttribute(Ol));e.hasAttribute(Kt)||e.setAttribute(Kt,IA(e)),n===void 0&&DA(e);let o=e.getAttribute(Kt)??"",a=FA(o,`${r}px`,`${i}px`);e.style.setProperty("translate",a),Go.set(e,e.style.getPropertyValue("translate"))}function ii(e,t){let n=e.querySelectorAll(`[${Kt}]:not([${Pl}]):not([${Ol}])`);for(let o=0;o<n.length;o++){let a=n[o];if(a===void 0||!Ua(a))continue;let l=a.getAttribute(Kt)??"";l===""?a.style.removeProperty("translate"):a.style.setProperty("translate",l),a.removeAttribute(Kt),Go.delete(a)}let r=e.querySelectorAll(`[${Pl}], [${Ol}]`),i=0;for(let o=0;o<r.length;o++){let a=r[o];a===void 0||!Ua(a)||(PA(a,t),i+=1)}return i}var kh="__hfPositionEditsSeekReapplyWrapped",Mh=new WeakSet,Nh=new WeakMap,Lh=new WeakMap;function Dh(e){let t=e,n=()=>{try{ii(t.document)}catch{}},r=m=>typeof m=="function"&&(Mh.has(m)||!!m[kh]),i=m=>{Mh.add(m);try{Object.defineProperty(m,kh,{value:!0})}catch{}},o=m=>{if(typeof m!="function"||r(m))return m;let f=function(...b){let p=m.apply(this,b);return n(),p};return i(f),f},a=(m,f)=>{let b=Nh.get(m);if(b?.has(f))return!0;let p=Object.getOwnPropertyDescriptor(m,f);if(p?.configurable===!1){let v=m[f];return typeof v=="function"&&(m[f]=o(v),n()),!1}let y=m[f],x=p?.set;return Object.defineProperty(m,f,{configurable:!0,enumerable:p?.enumerable??!0,get:()=>y,set:v=>{y=o(v),x?.call(m,v)}}),y=o(y),b??(b=new Set),b.add(f),Nh.set(m,b),n(),!0},l=(m,f)=>{let b=Lh.get(t),p=Object.getOwnPropertyDescriptor(t,m);if(!b?.has(m)){if(p?.configurable===!1){let v=t[m];return v?a(v,f):!1}let x=t[m];Object.defineProperty(t,m,{configurable:!0,enumerable:p?.enumerable??!0,get:()=>x,set:v=>{x=v,x&&a(x,f)}}),b??(b=new Set),b.add(m),Lh.set(t,b)}let y=t[m];return y?a(y,f):!1},s=()=>{let m=l("__hf","seek"),f=l("__player","renderSeek");return m&&f};if(s())return;let u=120,d=t.setInterval(()=>{if(s()){t.clearInterval(d);return}u-=1,u<=0&&t.clearInterval(d)},50)}function Bo(e){let t=window,r=e.closest("[data-composition-id]")?.getAttribute("data-composition-id")?.trim()??"",i=r?t.__hfVariablesByComp?.[r]:void 0;if(i)return i;let o=t.__hyperframes?.getVariables?.();return o&&typeof o=="object"?o:t.__hfVariables??{}}function Uo(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Hl(e){let t=e.replace(/[\\u0000-\\u0020]/g,""),n=/^([a-z][a-z0-9+.-]*):/i.exec(t);if(!n)return!0;let r=n[1]?.toLowerCase();return r?r==="https"||r==="http"||r==="blob"?!0:r==="data"?/^data:image\\//i.test(t):!1:!1}var Ih=new Set(["img","video","audio","source"]);function OA(e){if(typeof e=="string"&&e.length>0)return e;if(e!==null&&typeof e=="object"){let t=e.url;if(typeof t=="string"&&t.length>0)return t}return null}function HA(e){return e.replace(/[;{}<>\\r\\n]/g,"")}function GA(e){if(Uo(e))return String(e);if(e!==null&&typeof e=="object"){let t=e.name;if(typeof t=="string"&&t.length>0)return t}return null}function Gl(e,t){let n=e.closest("[data-composition-id]"),r=t.get(n);if(r)return r;let i=Bo(e);return t.set(n,i),i}function BA(e,t){if(e.childElementCount===0){e.textContent=t;return}let n=!1;for(let r of Array.from(e.childNodes))r.nodeType===Node.TEXT_NODE&&(r.nodeValue=n?"":t,n=!0);n||e.insertBefore(e.ownerDocument.createTextNode(t),e.firstChild)}function UA(e){return e.querySelector("[data-hf-root]")??e.getElementById("stage")??e.body?.firstElementChild??e.body}function WA(e,t){for(let n of new Set(e)){let r=Gl(n,t);for(let[i,o]of Object.entries(r)){let a=GA(o);a!==null&&ye(n)&&n.style.setProperty(`--${i}`,HA(a))}}}function Ph(e,t,n=!0){let r=e.getAttribute("data-var-src")?.trim();if(!r)return null;if(!Ih.has(e.tagName.toLowerCase()))return n&&console.warn(`[hyperframes] Ignoring data-var-src on <${e.tagName.toLowerCase()}>: variable-bound src is only allowed on ${Array.from(Ih).join("/")}.`),null;let i=OA(Gl(e,t)[r]);return i===null?null:Hl(i)?i:(n&&console.warn(`[hyperframes] Ignoring data-var-src="${r}": unsafe URL protocol.`),null)}function Oh(e){return Ph(e,new Map,!1)??Tr(e)}function Wo(e,t){let n=new Map,r=o=>t?[...t.matches(o)?[t]:[],...t.querySelectorAll(o)]:Array.from(e.querySelectorAll(o)),i=t?null:UA(e);WA([...i?[i]:[],...r("[data-composition-id]")],n);for(let o of r("[data-var-src]")){let a=Ph(o,n);a!==null&&Tr(o)!==a&&o.setAttribute("src",a)}for(let o of r("[data-var-text]")){let a=o.getAttribute("data-var-text")?.trim();if(!a)continue;let l=Gl(o,n)[a];Uo(l)&&BA(o,String(l))}}var Nt=new Map,VA="data-hf-color-grading-canvas",$A="__hf_color_grading_canvas__";function Kh(){if(typeof MutationObserver>"u"||typeof document>"u")return;let e=document.documentElement;if(!e)return;let t=r=>{ye(r)&&(r.hasAttribute(mn)||r.setAttribute(mn,r.style.opacity))},n=r=>{if(Ne(r)){r.matches("video, img")&&t(r);for(let i of r.querySelectorAll("video, img"))t(i)}};n(e),new MutationObserver(r=>{for(let i of r)for(let o of i.addedNodes)n(o)}).observe(e,{childList:!0,subtree:!0})}var zA=16,qA=4,Kn={enabled:!1,position:.5,softness:0,lineWidth:2},Bl=["#000000","#ffffff"],jA=["#1a1a1a","#f5f5dc"],ci=3,KA=ci-1,XA=5,Ul=`${gt}.0`,Hh=`${gt-1}.0`,YA=`${ci}.0`,JA=`${(KA+.5)/ci}`;function Vo(e){let t=e.getAttribute(Nr);return t==null?null:nm(t,Bo(e))}var QA=["attribute vec2 a_pos;","varying vec2 v_uv;","void main(){"," v_uv = a_pos * 0.5 + 0.5;"," gl_Position = vec4(a_pos, 0.0, 1.0);","}"].join(`\n`),ZA=["#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","varying vec2 v_uv;","uniform sampler2D u_source;","uniform sampler2D u_blurSource;","uniform sampler2D u_bloomSource;","uniform sampler2D u_kuwaharaSource;","uniform sampler2D u_lut;","uniform sampler2D u_advanced;","uniform vec2 u_resolution;","uniform vec2 u_uvScale;","uniform vec2 u_uvOffset;","uniform float u_blurReady;","uniform float u_bloomReady;","uniform float u_kuwaharaReady;","uniform float u_lutEnabled;","uniform float u_lutSize;","uniform vec2 u_lutTextureSize;","uniform vec3 u_lutDomainMin;","uniform vec3 u_lutDomainMax;","uniform float u_lutIntensity;","uniform vec3 u_shadowWheel;","uniform vec3 u_midtoneWheel;","uniform vec3 u_highlightWheel;","uniform float u_rgbCurvesEnabled;","uniform float u_hueCurvesEnabled;","uniform float u_secondaryCount;","uniform float u_exposure;","uniform float u_contrast;","uniform float u_highlights;","uniform float u_shadows;","uniform float u_whites;","uniform float u_blacks;","uniform float u_temperature;","uniform float u_tint;","uniform float u_vibrance;","uniform float u_saturation;","uniform float u_vignette;","uniform float u_vignetteMidpoint;","uniform float u_vignetteRoundness;","uniform float u_vignetteFeather;","uniform float u_grain;","uniform float u_grainSize;","uniform float u_grainRoughness;","uniform float u_grainSeed;","uniform float u_effectTime;","uniform float u_blur;","uniform float u_bloom;","uniform float u_kuwahara;","uniform float u_pixelate;","uniform float u_chromaBleed;","uniform float u_tapeDamage;","uniform float u_tapeTracking;","uniform float u_tapeNoise;","uniform float u_tapeSpeed;","uniform float u_filmArtifacts;","uniform float u_halftone;","uniform float u_halftoneSize;","uniform float u_twoInkPrint;","uniform float u_twoInkPrintSize;","uniform float u_ascii;","uniform float u_asciiSize;","uniform float u_asciiInvert;","uniform float u_asciiStyle;","uniform float u_asciiColor;","uniform float u_asciiRotation;","uniform float u_dither;","uniform float u_ditherSize;","uniform float u_monoScreen;","uniform float u_monoScreenSize;","uniform float u_monoScreenAngle;","uniform float u_monoScreenSpread;","uniform float u_monoScreenShape;","uniform float u_monoScreenInvert;","uniform float u_scanlines;","uniform float u_scanlineCount;","uniform float u_scanlineSoftness;","uniform float u_chromaticAberration;","uniform float u_chromaticAngle;","uniform float u_crtCurvature;","uniform float u_digitalGlitch;","uniform float u_digitalGlitchColorSplit;","uniform float u_digitalGlitchLineTear;","uniform float u_digitalGlitchPixelate;","uniform float u_digitalGlitchBlockAmount;","uniform float u_digitalGlitchBlockDisplacement;","uniform float u_digitalGlitchBlockOpacity;","uniform float u_digitalGlitchSpeed;","uniform float u_engraving;","uniform float u_engravingSpacing;","uniform float u_engravingMinThickness;","uniform float u_engravingMaxThickness;","uniform float u_engravingAngle;","uniform float u_engravingContrast;","uniform float u_engravingSharpness;","uniform float u_engravingWave;","uniform float u_engravingWaveFrequency;","uniform float u_crosshatch;","uniform float u_crosshatchSpacing;","uniform float u_crosshatchThickness;","uniform float u_crosshatchAngle;","uniform float u_crosshatchContrast;","uniform float u_crosshatchEdges;","uniform float u_crosshatchLineWeight;","uniform float u_crosshatchWave;","uniform float u_crosshatchWaveFrequency;","uniform float u_paletteSize;","uniform vec3 u_palette0;","uniform vec3 u_palette1;","uniform vec3 u_palette2;","uniform vec3 u_palette3;","uniform vec3 u_palette4;","uniform vec3 u_palette5;","uniform float u_intensity;","uniform float u_compareEnabled;","uniform float u_comparePosition;","uniform float u_compareSoftness;","uniform float u_compareLineWidth;","const float PI = 3.14159265359;","float lumaOf(vec3 c){ return dot(c, vec3(0.2126, 0.7152, 0.0722)); }","float bt601Luma(vec3 c){ return dot(c, vec3(0.299, 0.587, 0.114)); }","float grainHash(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123); }","float digitalHash(vec2 p){"," vec2 q = mod(floor(p), 251.0);"," float x = mod(q.x * q.x * 157.0 + q.x * 89.0, 251.0);"," float y = mod(q.y * q.y * 113.0 + q.y * 47.0, 251.0);"," float xy = mod(q.x * q.y * 71.0, 251.0);"," return mod(x + y + xy + 19.0, 251.0) / 251.0;","}","float colorSaturation(vec3 c){ return max(max(c.r, c.g), c.b) - min(min(c.r, c.g), c.b); }","vec2 clampUv(vec2 uv){ return clamp(uv, vec2(0.0), vec2(1.0)); }","vec2 applyCrtWarp(vec2 uv){"," vec2 centered = uv * 2.0 - 1.0;"," float curvature = clamp(u_crtCurvature, 0.0, 1.0) * 0.5;"," float dist = dot(centered, centered);"," centered *= 1.0 + curvature * dist;"," return centered * 0.5 + 0.5;","}","vec4 sampleSource(vec2 uv){ return texture2D(u_source, clampUv(uv)); }","vec4 sampleBlur(vec2 uv){ return texture2D(u_blurSource, clampUv(uv)); }","vec3 sampleBloom(vec2 uv){ return texture2D(u_bloomSource, clampUv(uv)).rgb; }","vec3 sampleKuwahara(vec2 uv){"," vec2 displayUv = uv * u_uvScale + u_uvOffset;"," return texture2D(u_kuwaharaSource, clampUv(displayUv)).rgb;","}","vec4 samplePrepared(vec2 uv){"," vec4 base = sampleSource(uv);"," float blur = clamp(u_blur, 0.0, 1.0);"," if (blur > 0.0 && u_blurReady > 0.5) base = mix(base, sampleBlur(uv), blur);"," float kuwahara = clamp(u_kuwahara, 0.0, 1.0);"," if (kuwahara > 0.0 && u_kuwaharaReady > 0.5) {"," base.rgb = mix(base.rgb, sampleKuwahara(uv), kuwahara);"," }"," return base;","}","float tapeTrackingBand(float y, float center, float width){"," float offset = fract(y - center + 0.5) - 0.5;"," float triangle = max(0.0, 1.0 - abs(offset) / max(width, 0.0001));"," return triangle * triangle * (3.0 - 2.0 * triangle);","}","vec4 sampleMedia(vec2 uv){"," float pixel = clamp(u_pixelate, 0.0, 1.0);"," vec2 sampleUv = uv;"," if (pixel > 0.0) {"," float blockSize = mix(1.0, 48.0, pixel);"," vec2 cells = max(u_resolution / blockSize, vec2(1.0));"," sampleUv = (floor(clamp(uv, vec2(0.0), vec2(0.999999)) * cells) + 0.5) / cells;"," }"," float tapeDamage = clamp(u_tapeDamage, 0.0, 1.0);"," float tapeTracking = clamp(u_tapeTracking, 0.0, 1.0);"," float tapeNoise = clamp(u_tapeNoise, 0.0, 1.0);"," float tapeTime = u_effectTime * mix(0.0, 2.0, clamp(u_tapeSpeed, 0.0, 1.0));"," float tapeFrame = floor(tapeTime * 60.0);"," float tapeLine = floor(sampleUv.y * u_resolution.y * 0.5);"," float lineJitter = (digitalHash(vec2(tapeLine, floor(tapeFrame * 0.5))) - 0.5) * 1.8 * tapeNoise;"," float slowWobble = sin(sampleUv.y * 32.0 + tapeTime * 2.6) * 0.55;"," float headSwitch = smoothstep(0.88, 1.0, sampleUv.y) * sin(sampleUv.y * 240.0 + tapeTime * 8.0) * 4.0;"," float trackingShift = tapeTrackingBand(sampleUv.y, fract(0.08 + tapeTime * 0.083), 0.035);"," trackingShift -= tapeTrackingBand(sampleUv.y, fract(0.28 + tapeTime * 0.061), 0.03) * 0.8;"," trackingShift += tapeTrackingBand(sampleUv.y, fract(0.5 + tapeTime * 0.047), 0.04) * 0.75;"," trackingShift -= tapeTrackingBand(sampleUv.y, fract(0.72 + tapeTime * 0.037), 0.028) * 0.65;"," trackingShift += tapeTrackingBand(sampleUv.y, fract(0.89 + tapeTime * 0.029), 0.032) * 0.55;"," trackingShift *= tapeTracking * 48.0;"," float tapeShift = (lineJitter + slowWobble + headSwitch + trackingShift) * tapeDamage;"," float texelX = 1.0 / max(u_resolution.x * max(u_uvScale.x, 0.00001), 1.0);"," vec2 tapeUv = sampleUv + vec2(tapeShift * texelX, 0.0);"," vec4 base = samplePrepared(tapeUv);"," if (tapeDamage > 0.0) {"," vec2 lumaStep = vec2(texelX * mix(1.0, 3.5, tapeDamage), 0.0);"," vec3 leftTape = samplePrepared(tapeUv - lumaStep).rgb;"," vec3 rightTape = samplePrepared(tapeUv + lumaStep).rgb;"," float tapeLuma = (bt601Luma(leftTape) + bt601Luma(base.rgb) * 2.0 + bt601Luma(rightTape)) * 0.25;"," vec3 centerChroma = base.rgb - vec3(bt601Luma(base.rgb));"," vec3 tapeColor = vec3(tapeLuma) + centerChroma;"," vec3 ghost = samplePrepared(tapeUv - vec2(texelX * 12.0, 0.0)).rgb;"," tapeColor = mix(tapeColor, ghost, 0.045 * tapeDamage);"," float fineNoise = digitalHash(floor(gl_FragCoord.xy) + vec2(tapeFrame * 17.0, tapeFrame * 3.0)) - 0.5;"," float band = digitalHash(vec2(floor(sampleUv.y * 92.0), floor(tapeFrame / 3.0)));"," float dropout = smoothstep(0.985, 1.0, band) * (digitalHash(vec2(floor(sampleUv.x * 18.0), tapeLine)) - 0.5);"," tapeColor += (fineNoise * 0.035 + dropout * 0.12) * tapeDamage * tapeNoise;"," base.rgb = mix(base.rgb, clamp(tapeColor, 0.0, 1.0), tapeDamage);"," }"," float chromaBleed = clamp(u_chromaBleed, 0.0, 1.0);"," if (chromaBleed > 0.0) {"," float radius = mix(1.0, 4.0, chromaBleed);"," vec2 stepUv = vec2(texelX * radius, 0.0);"," vec3 c0 = base.rgb;"," vec3 c1 = samplePrepared(tapeUv - stepUv).rgb;"," vec3 c2 = samplePrepared(tapeUv + stepUv).rgb;"," vec3 c3 = samplePrepared(tapeUv - stepUv * 2.0).rgb;"," vec3 c4 = samplePrepared(tapeUv + stepUv * 2.0).rgb;"," float centerLuma = lumaOf(base.rgb);"," vec3 blurredChroma = ((c0 - vec3(lumaOf(c0))) * 6.0 + (c1 - vec3(lumaOf(c1))) * 4.0 + (c2 - vec3(lumaOf(c2))) * 4.0 + (c3 - vec3(lumaOf(c3))) + (c4 - vec3(lumaOf(c4)))) / 16.0;"," base.rgb = mix(base.rgb, clamp(vec3(centerLuma) + blurredChroma, 0.0, 1.0), chromaBleed);"," }"," return base;","}","vec4 sampleChromaticMedia(vec2 uv, vec4 center){"," float amount = clamp(u_chromaticAberration, 0.0, 1.0);"," if (amount <= 0.0) return center;"," float angle = clamp(u_chromaticAngle, 0.0, 1.0) * PI * 2.0;"," vec2 offset = vec2(cos(angle), sin(angle)) * amount * 0.02;"," vec4 positive = sampleMedia(uv + offset);"," vec4 negative = sampleMedia(uv - offset);"," vec3 split = vec3(positive.r, center.g, negative.b);"," return vec4(split, center.a);","}","vec3 sampleDigitalSplit(vec2 uv, vec2 block, float time, float amount){"," float split = amount * 0.06;"," float direction = digitalHash(block * 0.4 + vec2(floor(time * 3.7), floor(time * 5.3)));"," vec2 axis = direction > 0.66 ? vec2(1.0, 0.0) : direction > 0.33 ? vec2(0.0, 1.0) : vec2(0.7071);"," vec4 center = sampleMedia(uv);"," return vec3(sampleMedia(uv + axis * split).r, center.g, sampleMedia(uv - axis * split).b);","}","vec3 applyDigitalGlitch(vec2 uv, vec3 source){"," float amount = clamp(u_digitalGlitch, 0.0, 1.0);"," if (amount <= 0.0) return source;"," float colorSplit = clamp(u_digitalGlitchColorSplit, 0.0, 1.0) * 2.0;"," float lineTear = clamp(u_digitalGlitchLineTear, 0.0, 1.0) * 2.0;"," float pixelate = clamp(u_digitalGlitchPixelate, 0.0, 1.0) * 2.0;"," float blockAmount = clamp(u_digitalGlitchBlockAmount, 0.0, 1.0);"," float blockDisplacement = clamp(u_digitalGlitchBlockDisplacement, 0.0, 1.0) * 2.0;"," float blockOpacity = clamp(u_digitalGlitchBlockOpacity, 0.0, 1.0);"," float speed = clamp(u_digitalGlitchSpeed, 0.0, 1.0) * 2.0;"," float time = u_effectTime * speed;"," float blockCount = 8.0 + blockAmount * 60.0;"," vec2 block = floor(uv * blockCount);"," float randomA = digitalHash(block + vec2(floor(time * 7.3), floor(time * 11.1)));"," float randomB = digitalHash(block * 0.7 + vec2(17.3 + floor(time * 6.6), 29.1));"," float randomC = digitalHash(block + vec2(floor(time * 5.7) * 13.0, 41.0));"," float randomD = digitalHash(block * 1.3 + vec2(7.0, floor(time * 3.2) * 7.0));"," vec2 displaced = uv;"," if (blockDisplacement > 0.0 && blockOpacity > 0.0) {"," float threshold = 1.0 - blockDisplacement * 0.4;"," if (randomA > threshold) {"," displaced += vec2((randomB - 0.5) * blockDisplacement * 0.5, (randomC - 0.5) * blockDisplacement * 0.3);"," }"," if (randomD > 0.92 && blockDisplacement > 0.5) {"," displaced.x += (digitalHash(vec2(block.y, floor(time * 8.0))) - 0.5) * blockDisplacement;"," }"," displaced = mix(uv, displaced, blockOpacity);"," }"," if (lineTear > 0.0) {"," float row = floor(uv.y * (50.0 + lineTear * 150.0));"," float tearA = digitalHash(vec2(row * 7.3 + floor(time * 12.0 + row * 0.1) * 3.7, 13.0));"," float tearB = digitalHash(vec2(row * 13.7 + floor(time * 8.3) * 5.1, 31.0));"," if (tearA > 1.0 - lineTear * 0.5) displaced.x += (tearB - 0.5) * lineTear * 0.4;"," if (tearB > 0.95 && lineTear > 0.3) displaced.x += (tearA - 0.5) * lineTear * 0.8;"," }"," if (pixelate > 0.0) {"," float pixelRandom = digitalHash(block * 0.5 + vec2(floor(time * 4.9), 53.0));"," if (pixelRandom > 1.0 - pixelate * 0.35) {"," float cells = 4.0 + (1.0 - pixelRandom) * pixelate * 40.0;"," displaced = (floor(clampUv(displaced) * cells) + 0.5) / cells;"," }"," }"," displaced = clampUv(displaced);"," vec3 glitch = sampleDigitalSplit(displaced, block, time, colorSplit);"," if (blockDisplacement > 0.2 && blockOpacity > 0.0) {"," float corruption = digitalHash(block * 1.1 + vec2(floor(time * 11.9), 67.0));"," vec3 changed = glitch;"," if (corruption > 0.9) changed = 1.0 - glitch;"," else if (corruption > 0.85) changed = corruption > 0.875 ? glitch.gbr : glitch.brg;"," else if (corruption > 0.8) {"," float channel = digitalHash(block + vec2(73.0));"," if (channel > 0.66) changed.r = min(changed.r * 2.0, 1.0);"," else if (channel > 0.33) changed.g = min(changed.g * 2.0, 1.0);"," else changed.b = min(changed.b * 2.0, 1.0);"," }"," glitch = mix(glitch, changed, blockOpacity);"," }"," if (blockOpacity > 0.0) {"," float flash = digitalHash(block * 0.8 + vec2(floor(time * 14.7), 83.0));"," vec3 flashed = flash > 0.97 ? min(glitch * 1.8, vec3(1.0)) : flash > 0.94 ? glitch * 0.3 : glitch;"," glitch = mix(glitch, flashed, blockOpacity * 0.6);"," }"," if (lineTear > 0.1) {"," float interference = pow(sin(uv.y * (300.0 + randomA * 200.0) + time * 30.0) * 0.5 + 0.5, 6.0);"," glitch -= interference * 0.08 * lineTear;"," }"," return mix(source, clamp(glitch, 0.0, 1.0), amount);","}","float dustMask(vec2 uv, float frameBucket){"," vec2 grid = vec2(128.0, 72.0);"," vec2 cell = floor(uv * grid);"," vec2 local = fract(uv * grid) - 0.5;"," float chance = grainHash(cell + frameBucket * 19.13);"," float radius = mix(0.05, 0.34, grainHash(cell + 7.1));"," return step(0.9975, chance) * (1.0 - smoothstep(radius, radius + 0.08, length(local)));","}","float screenDot(vec2 p, float ink, float angle, float sharpness){"," float c = cos(angle);"," float s = sin(angle);"," vec2 q = mat2(c, -s, s, c) * p;"," vec2 d = fract(q) - 0.5;"," float radius = sqrt(clamp(ink, 0.0, 1.0)) * 0.68;"," float edge = mix(0.16, 0.025, sharpness);"," return 1.0 - smoothstep(radius - edge, radius + edge, length(d));","}","vec3 paletteColor(float index);","float monoScreenMask(vec2 local, float radius, float shape, float softness){"," vec2 centered = local - 0.5;"," float distanceToInk = length(centered);"," if (shape > 0.5 && shape < 1.5) distanceToInk = max(abs(centered.x), abs(centered.y));"," if (shape > 1.5 && shape < 2.5) distanceToInk = abs(centered.x) + abs(centered.y);"," if (shape > 2.5 && shape < 3.5) distanceToInk = max(abs(centered.x) * 0.86 + centered.y * 0.5, -centered.y);"," if (shape > 3.5) distanceToInk = abs(centered.y);"," float shapeRadius = shape > 3.5 ? radius * 0.45 : radius;"," return 1.0 - smoothstep(shapeRadius, shapeRadius + softness, distanceToInk);","}","vec3 applyMonoScreen(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float invert = step(0.5, u_monoScreenInvert);"," float coverage = mix(1.0 - lumaOf(source), lumaOf(source), invert);"," coverage = pow(clamp(coverage, 0.0, 1.0), mix(1.7, 0.58, clamp(u_monoScreenSpread, 0.0, 1.0)));"," float scale = max(min(u_resolution.x, u_resolution.y) / 540.0, 0.25);"," float cellPx = mix(4.0, 18.0, clamp(u_monoScreenSize, 0.0, 1.0)) * scale;"," float angle = clamp(u_monoScreenAngle, 0.0, 1.0) * PI * 0.5;"," float cosine = cos(angle);"," float sine = sin(angle);"," vec2 point = mat2(cosine, -sine, sine, cosine) * gl_FragCoord.xy / max(cellPx, 1.0);"," float radius = sqrt(coverage) * 0.68;"," float inkMask = monoScreenMask(fract(point), radius, floor(u_monoScreenShape + 0.5), 0.035);"," vec3 ink = paletteColor(0.0);"," vec3 paper = paletteColor(max(u_paletteSize - 1.0, 1.0));"," return mix(source, mix(paper, ink, inkMask), amount);","}","vec3 applyEngraving(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float spacing = mix(3.0, 20.0, clamp(u_engravingSpacing, 0.0, 1.0));"," float minThickness = mix(0.0, 2.0, clamp(u_engravingMinThickness, 0.0, 1.0));"," float maxThickness = mix(1.0, 8.0, clamp(u_engravingMaxThickness, 0.0, 1.0));"," float angle = clamp(u_engravingAngle, 0.0, 1.0) * PI;"," vec2 alongAxis = vec2(cos(angle), sin(angle));"," vec2 acrossAxis = vec2(-alongAxis.y, alongAxis.x);"," float along = dot(gl_FragCoord.xy, alongAxis);"," float across = dot(gl_FragCoord.xy, acrossAxis);"," float frequency = mix(1.0, 10.0, clamp(u_engravingWaveFrequency, 0.0, 1.0));"," float wave = sin(along * frequency * 0.01);"," across += wave * clamp(u_engravingWave, 0.0, 1.0) * 3.0;"," float lineIndex = floor(across / max(spacing, 1.0));"," float lineDistance = abs(fract(across / max(spacing, 1.0)) - 0.5) * spacing;"," float contrast = mix(0.5, 2.0, clamp(u_engravingContrast, 0.0, 1.0));"," float darkness = 1.0 - pow(clamp(lumaOf(source), 0.0, 1.0), contrast);"," float variation = mix(0.88, 1.12, digitalHash(vec2(lineIndex, 73.0)));"," float thickness = mix(minThickness, maxThickness, darkness) * variation;"," float edge = mix(1.0, 0.3, clamp(u_engravingSharpness, 0.0, 1.0));"," float inkMask = 1.0 - smoothstep(max(thickness * 0.5 - edge, 0.0), thickness * 0.5 + edge, lineDistance);"," inkMask *= smoothstep(0.015, 0.12, darkness);"," vec3 ink = paletteColor(0.0);"," vec3 paper = paletteColor(max(u_paletteSize - 1.0, 1.0));"," return mix(source, mix(paper, ink, inkMask), amount);","}","float crosshatchLine(vec2 pixel, float angle, float spacing, float thickness, float seed){"," vec2 alongAxis = vec2(cos(angle), sin(angle));"," vec2 acrossAxis = vec2(-alongAxis.y, alongAxis.x);"," float along = dot(pixel, alongAxis);"," float across = dot(pixel, acrossAxis);"," float frequency = mix(1.0, 10.0, clamp(u_crosshatchWaveFrequency, 0.0, 1.0));"," across += sin(along * frequency * 0.02 + u_effectTime + seed) * clamp(u_crosshatchWave, 0.0, 1.0) * 5.0;"," float lineIndex = floor(across / max(spacing, 1.0));"," float distanceToLine = abs(fract(across / max(spacing, 1.0)) - 0.5) * spacing;"," float variation = mix(1.0, 0.5 + digitalHash(vec2(lineIndex, seed)), clamp(u_crosshatchLineWeight, 0.0, 1.0));"," float halfWidth = thickness * variation * 0.5;"," return 1.0 - smoothstep(max(halfWidth - 0.5, 0.0), halfWidth + 0.5, distanceToLine);","}","float crosshatchEdge(vec2 uv){"," vec2 texel = 1.0 / max(u_resolution * u_uvScale, vec2(1.0));"," float tl = lumaOf(sampleMedia(uv + texel * vec2(-1.0, -1.0)).rgb);"," float tc = lumaOf(sampleMedia(uv + texel * vec2( 0.0, -1.0)).rgb);"," float tr = lumaOf(sampleMedia(uv + texel * vec2( 1.0, -1.0)).rgb);"," float ml = lumaOf(sampleMedia(uv + texel * vec2(-1.0, 0.0)).rgb);"," float mr = lumaOf(sampleMedia(uv + texel * vec2( 1.0, 0.0)).rgb);"," float bl = lumaOf(sampleMedia(uv + texel * vec2(-1.0, 1.0)).rgb);"," float bc = lumaOf(sampleMedia(uv + texel * vec2( 0.0, 1.0)).rgb);"," float br = lumaOf(sampleMedia(uv + texel * vec2( 1.0, 1.0)).rgb);"," float gx = -tl - 2.0 * ml - bl + tr + 2.0 * mr + br;"," float gy = -tl - 2.0 * tc - tr + bl + 2.0 * bc + br;"," return length(vec2(gx, gy));","}","vec3 applyCrosshatch(vec2 uv, vec3 source, float amount){"," if (amount <= 0.0) return source;"," float spacing = mix(5.0, 30.0, clamp(u_crosshatchSpacing, 0.0, 1.0));"," float thickness = mix(1.0, 5.0, clamp(u_crosshatchThickness, 0.0, 1.0));"," float baseAngle = -clamp(u_crosshatchAngle, 0.0, 1.0) * PI;"," float contrast = mix(0.5, 2.0, clamp(u_crosshatchContrast, 0.0, 1.0));"," float darkness = 1.0 - pow(clamp(lumaOf(source), 0.0, 1.0), contrast);"," vec3 ink = paletteColor(0.0);"," vec3 paper = paletteColor(max(u_paletteSize - 1.0, 1.0));"," vec3 result = paper;"," float layer = crosshatchLine(gl_FragCoord.xy, baseAngle, spacing, thickness, 1.0) * smoothstep(0.2, 0.4, darkness);"," result = mix(result, ink, layer);"," layer = crosshatchLine(gl_FragCoord.xy, baseAngle + PI * 0.5, spacing * 0.95, thickness * 0.9, 2.0) * smoothstep(0.4, 0.6, darkness);"," result = mix(result, ink, layer);"," layer = crosshatchLine(gl_FragCoord.xy, baseAngle + PI * 0.25, spacing * 0.9, thickness * 0.8, 3.0) * smoothstep(0.6, 0.8, darkness);"," result = mix(result, ink, layer);"," layer = crosshatchLine(gl_FragCoord.xy, baseAngle - PI * 0.25, spacing * 0.85, thickness * 0.7, 4.0) * smoothstep(0.75, 0.9, darkness);"," result = mix(result, ink, layer);"," result = mix(result, ink, smoothstep(0.9, 1.0, darkness) * 0.8);"," float edgeStrength = mix(0.0, 2.0, clamp(u_crosshatchEdges, 0.0, 1.0));"," float edge = smoothstep(0.1, 0.3, crosshatchEdge(uv)) * edgeStrength;"," result = mix(result, ink, clamp(edge, 0.0, 1.0));"," return mix(source, result, amount);","}","vec3 applyHalftone(vec3 source, float amount){"," if (amount <= 0.0) return source;"," vec3 cmy = 1.0 - source;"," float k = min(cmy.r, min(cmy.g, cmy.b));"," vec3 inks = max(cmy - vec3(k * 0.72), 0.0);"," float scale = min(u_resolution.x, u_resolution.y) / 540.0;"," float cellPx = mix(5.0, 14.0, clamp(u_halftoneSize, 0.0, 1.0)) * max(scale, 0.25);"," vec2 p = gl_FragCoord.xy / max(cellPx, 1.0);"," float cyan = screenDot(p, inks.r, 0.261799, 0.78);"," float magenta = screenDot(p, inks.g, 1.308997, 0.78);"," float yellow = screenDot(p, inks.b, 0.0, 0.78);"," float blackInk = screenDot(p, k, 0.785398, 0.82);"," vec3 printColor = vec3(0.975, 0.962, 0.925);"," printColor *= mix(vec3(1.0), vec3(0.05, 0.79, 0.86), cyan);"," printColor *= mix(vec3(1.0), vec3(0.91, 0.08, 0.48), magenta);"," printColor *= mix(vec3(1.0), vec3(0.98, 0.83, 0.08), yellow);"," printColor *= mix(vec3(1.0), vec3(0.035), blackInk * 0.92);"," return mix(source, printColor, amount);","}","vec3 applyTwoInkPrint(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float sourceLuma = lumaOf(source);"," float darkness = 1.0 - sourceLuma;"," float warmBias = clamp(source.r - (source.g + source.b) * 0.5, -0.35, 0.35);"," float coolBias = clamp((source.g + source.b) * 0.5 - source.r, -0.35, 0.35);"," float redTone = smoothstep(0.08, 0.72, darkness) * (1.0 - 0.68 * smoothstep(0.66, 1.0, darkness));"," float tealTone = smoothstep(0.30, 0.92, darkness);"," float redCoverage = clamp(redTone + warmBias * 1.35 - coolBias * 0.35, 0.0, 1.0);"," float tealCoverage = clamp(tealTone + coolBias * 1.1 - warmBias * 0.45, 0.0, 1.0);"," float scale = min(u_resolution.x, u_resolution.y) / 540.0;"," float cellPx = mix(4.5, 12.0, clamp(u_twoInkPrintSize, 0.0, 1.0)) * max(scale, 0.25);"," vec2 p = gl_FragCoord.xy / max(cellPx, 1.0);"," float redDot = screenDot(p, redCoverage, 0.261799, 0.84);"," float tealDot = screenDot(p + vec2(0.12, -0.08), tealCoverage, 1.308997, 0.84);"," float paperNoise = grainHash(floor(gl_FragCoord.xy * 0.5)) - 0.5;"," vec3 paper = vec3(0.955, 0.910, 0.795) + paperNoise * 0.018;"," vec3 vermilion = vec3(0.88, 0.13, 0.075);"," vec3 teal = vec3(0.035, 0.285, 0.355);"," vec3 overprint = vec3(0.045, 0.055, 0.052);"," vec3 printColor = paper * (1.0 - redDot) * (1.0 - tealDot);"," printColor += vermilion * redDot * (1.0 - tealDot);"," printColor += teal * (1.0 - redDot) * tealDot;"," printColor += overprint * redDot * tealDot;"," return mix(source, clamp(printColor, 0.0, 1.0), amount);","}","vec3 paletteColor(float index){"," if (index < 0.5) return u_palette0;"," if (index < 1.5) return u_palette1;"," if (index < 2.5) return u_palette2;"," if (index < 3.5) return u_palette3;"," if (index < 4.5) return u_palette4;"," return u_palette5;","}","float bayer4(vec2 point){"," vec2 cell = mod(floor(point), 4.0);"," if (cell.y < 0.5) {"," if (cell.x < 0.5) return 0.5 / 16.0;"," if (cell.x < 1.5) return 8.5 / 16.0;"," if (cell.x < 2.5) return 2.5 / 16.0;"," return 10.5 / 16.0;"," }"," if (cell.y < 1.5) {"," if (cell.x < 0.5) return 12.5 / 16.0;"," if (cell.x < 1.5) return 4.5 / 16.0;"," if (cell.x < 2.5) return 14.5 / 16.0;"," return 6.5 / 16.0;"," }"," if (cell.y < 2.5) {"," if (cell.x < 0.5) return 3.5 / 16.0;"," if (cell.x < 1.5) return 11.5 / 16.0;"," if (cell.x < 2.5) return 1.5 / 16.0;"," return 9.5 / 16.0;"," }"," if (cell.x < 0.5) return 15.5 / 16.0;"," if (cell.x < 1.5) return 7.5 / 16.0;"," if (cell.x < 2.5) return 13.5 / 16.0;"," return 5.5 / 16.0;","}","float standardAsciiSample(float brightness, vec2 grid){"," if (brightness < 0.1) return 0.0;"," if (brightness < 0.2) return grid.x == 2.0 && grid.y == 5.0 ? 1.0 : 0.0;"," if (brightness < 0.3) return grid.x == 2.0 && (grid.y == 2.0 || grid.y == 4.0) ? 1.0 : 0.0;"," if (brightness < 0.4) return (grid.y == 2.0 || grid.y == 4.0) && grid.x >= 1.0 && grid.x <= 3.0 ? 1.0 : 0.0;"," if (brightness < 0.5) {"," bool cross = (grid.x == 2.0 && grid.y >= 2.0 && grid.y <= 4.0) || (grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0);"," bool diagonals = (grid.x == 1.0 || grid.x == 3.0) && (grid.y == 2.0 || grid.y == 4.0);"," return cross || diagonals ? 1.0 : 0.0;"," }"," if (brightness < 0.6) {"," bool ring = ((grid.y == 2.0 || grid.y == 4.0) && grid.x >= 1.0 && grid.x <= 3.0) || ((grid.x == 1.0 || grid.x == 3.0) && grid.y == 3.0);"," return ring ? 1.0 : 0.0;"," }"," bool outline = ((grid.y == 1.0 || grid.y == 5.0) && grid.x >= 1.0 && grid.x <= 3.0) || ((grid.x == 0.0 || grid.x == 4.0) && grid.y >= 2.0 && grid.y <= 4.0) || ((grid.x == 1.0 || grid.x == 3.0) && grid.y >= 1.0 && grid.y <= 5.0);"," if (brightness < 0.7) return outline ? 1.0 : 0.0;"," if (brightness < 0.8) {"," bool slash = abs(grid.x - 2.0) == abs(grid.y - 3.0) && grid.x >= 1.0 && grid.x <= 3.0;"," return outline || slash ? 1.0 : 0.0;"," }"," if (brightness < 0.9) {"," bool loops = ((grid.y == 1.0 || grid.y == 3.0 || grid.y == 5.0) && grid.x >= 1.0 && grid.x <= 3.0) || ((grid.x == 1.0 || grid.x == 3.0) && (grid.y == 2.0 || grid.y == 4.0));"," return loops ? 1.0 : 0.0;"," }"," return 1.0;","}","float asciiStyleSample(float style, float brightness, vec2 uv){"," vec2 grid = floor(uv * vec2(5.0, 7.0));"," if (style < 0.5) return standardAsciiSample(brightness, grid);"," if (style < 1.5) {"," float checker = mod(grid.x + grid.y, 2.0);"," float ruled = mod(grid.x, 2.0) == 0.0 || mod(grid.y, 2.0) == 0.0 ? 1.0 : 0.0;"," if (brightness < 0.125) return 0.0;"," if (brightness < 0.25) return checker == 0.0 ? 0.5 : 0.0;"," if (brightness < 0.375) return ruled * 0.6;"," if (brightness < 0.5) return checker == 0.0 ? 1.0 : 0.0;"," if (brightness < 0.625) return ruled > 0.5 ? 1.0 : 0.3;"," if (brightness < 0.75) return checker == 0.0 ? 1.0 : 0.7;"," if (brightness < 0.875) return ruled > 0.5 ? 1.0 : 0.85;"," return 1.0;"," }"," if (style < 2.5) {"," if (brightness < 0.14) return 0.0;"," if (brightness < 0.28) return grid.x == 2.0 && grid.y == 1.0 ? 1.0 : 0.0;"," if (brightness < 0.42) return grid.x == 2.0 && grid.y == 5.0 ? 1.0 : 0.0;"," if (brightness < 0.56) return grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0 ? 1.0 : 0.0;"," if (brightness < 0.7) return (grid.x == 2.0 && grid.y >= 2.0 && grid.y <= 4.0) || (grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0) ? 1.0 : 0.0;"," if (brightness < 0.84) return abs(grid.x - 2.0) == abs(grid.y - 3.0) && grid.y >= 2.0 && grid.y <= 4.0 ? 1.0 : 0.0;"," return grid.x == 1.0 || grid.x == 3.0 || grid.y == 2.0 || grid.y == 4.0 ? 1.0 : 0.0;"," }"," if (style < 3.5) return grid.y >= 6.0 - brightness * 7.0 ? 1.0 : 0.0;"," if (style < 4.5) {"," vec2 dots = floor(uv * vec2(2.0, 4.0));"," if (brightness < 0.125) return 0.0;"," if (brightness < 0.25) return dots.y == 3.0 ? 1.0 : 0.0;"," if (brightness < 0.375) return dots.y >= 2.0 ? 1.0 : 0.0;"," if (brightness < 0.5) return dots.y >= 1.0 ? 1.0 : 0.0;"," if (brightness < 0.625) return dots.y >= 1.0 || dots.x == 1.0 ? 1.0 : 0.0;"," if (brightness < 0.75) return 1.0;"," if (brightness < 0.875) return mod(grid.x + grid.y, 2.0) < 1.5 ? 1.0 : 0.7;"," return 1.0;"," }"," if (style < 5.5) {"," if (brightness < 0.125) return 0.0;"," if (brightness < 0.25) return grid.x == 2.0 && grid.y == 3.0 ? 1.0 : 0.0;"," if (brightness < 0.375) return grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0 ? 1.0 : 0.0;"," if (brightness < 0.5) return grid.x + grid.y == 5.0 || grid.x + grid.y == 6.0 ? 1.0 : 0.0;"," if (brightness < 0.625) return grid.x == 2.0 ? 1.0 : 0.0;"," if (brightness < 0.75) return abs(grid.x - grid.y / 1.4) < 0.7 && grid.x >= 1.0 && grid.x <= 3.0 ? 1.0 : 0.0;"," if (brightness < 0.875) return grid.x == 2.0 || grid.y == 3.0 ? 1.0 : 0.0;"," return grid.x == 1.0 || grid.x == 3.0 || grid.y == 2.0 || grid.y == 4.0 ? 1.0 : 0.0;"," }"," if (style < 6.5) {"," bool top = grid.y == 0.0 && grid.x >= 1.0 && grid.x <= 3.0;"," bool topLeft = grid.x == 1.0 && grid.y <= 3.0;"," bool topRight = grid.x == 3.0 && grid.y <= 3.0;"," bool middle = grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0;"," bool bottomLeft = grid.x == 1.0 && grid.y >= 3.0;"," bool bottomRight = grid.x == 3.0 && grid.y >= 3.0;"," bool bottom = grid.y == 6.0 && grid.x >= 1.0 && grid.x <= 3.0;"," if (brightness < 0.1) return 0.0;"," if (brightness < 0.2) return topRight || bottomRight ? 1.0 : 0.0;"," if (brightness < 0.3) return top || topRight || middle || bottomLeft || bottom ? 1.0 : 0.0;"," if (brightness < 0.4) return top || topRight || middle || bottomRight || bottom ? 1.0 : 0.0;"," if (brightness < 0.5) return topLeft || middle || topRight || bottomRight ? 1.0 : 0.0;"," if (brightness < 0.6) return top || topLeft || middle || bottomRight || bottom ? 1.0 : 0.0;"," if (brightness < 0.7) return top || topLeft || middle || bottomLeft || bottomRight || bottom ? 1.0 : 0.0;"," if (brightness < 0.8) return top || topRight || bottomRight ? 1.0 : 0.0;"," if (brightness < 0.9) return top || topLeft || topRight || middle || bottomLeft || bottomRight || bottom ? 1.0 : 0.0;"," return top || topLeft || topRight || middle || bottomRight || bottom ? 1.0 : 0.0;"," }"," float slash = grid.x - grid.y;"," float backslash = grid.x + grid.y;"," if (brightness < 0.16) return 0.0;"," if (brightness < 0.33) return mod(slash, 3.0) < 0.5 ? 1.0 : 0.0;"," if (brightness < 0.5) return mod(slash, 2.0) < 0.5 ? 1.0 : 0.0;"," bool diagonalA = mod(slash, 2.0) < 0.5;"," bool diagonalB = mod(backslash, 2.0) < 0.5;"," if (brightness < 0.66) return diagonalA || diagonalB ? 1.0 : 0.0;"," if (brightness < 0.83) return mod(slash, 1.5) < 0.5 || mod(backslash, 1.5) < 0.5 ? 1.0 : 0.2;"," return mod(slash, 1.0) < 0.6 || mod(backslash, 1.0) < 0.6 ? 1.0 : 0.5;","}","vec3 rgbToHsv(vec3 color){"," float maximum = max(max(color.r, color.g), color.b);"," float minimum = min(min(color.r, color.g), color.b);"," float delta = maximum - minimum;"," float hue = 0.0;"," if (delta > 0.00001) {"," if (maximum == color.r) hue = mod((color.g - color.b) / delta, 6.0);"," else if (maximum == color.g) hue = (color.b - color.r) / delta + 2.0;"," else hue = (color.r - color.g) / delta + 4.0;"," hue = fract(hue / 6.0);"," }"," return vec3(hue, maximum > 0.00001 ? delta / maximum : 0.0, maximum);","}","vec3 hsvToRgb(vec3 color){"," vec3 bands = abs(fract(color.xxx + vec3(0.0, 0.6666667, 0.3333333)) * 6.0 - 3.0);"," return color.z * mix(vec3(1.0), clamp(bands - 1.0, 0.0, 1.0), color.y);","}","vec4 sampleAdvancedCurve(float coordinate, float row){",` float position = clamp(coordinate, 0.0, 1.0) * ${Hh};`," float lower = floor(position);",` float upper = min(lower + 1.0, ${Hh});`,` float y = (row + 0.5) / ${YA};`,` vec4 before = texture2D(u_advanced, vec2((lower + 0.5) / ${Ul}, y));`,` vec4 after = texture2D(u_advanced, vec2((upper + 0.5) / ${Ul}, y));`," return mix(before, after, position - lower);","}","vec4 advancedConfig(float index){",` return texture2D(u_advanced, vec2((index + 0.5) / ${Ul}, ${JA}));`,"}","vec3 wheelDirection(float hue){"," vec3 direction = hsvToRgb(vec3(fract(hue), 1.0, 1.0));"," direction -= vec3(lumaOf(direction));"," return direction / max(max(max(abs(direction.r), abs(direction.g)), abs(direction.b)), 0.0001);","}","vec3 applyTonalWheels(vec3 color){"," float luma = lumaOf(color);"," float shadows = 1.0 - smoothstep(0.0, 0.6, luma);"," float highlights = smoothstep(0.4, 1.0, luma);"," float midtones = max(0.0, 1.0 - shadows - highlights);"," float total = max(shadows + midtones + highlights, 0.0001);"," vec3 weights = vec3(shadows, midtones, highlights) / total;"," color += wheelDirection(u_shadowWheel.x) * u_shadowWheel.y * weights.x * 0.18;"," color += wheelDirection(u_midtoneWheel.x) * u_midtoneWheel.y * weights.y * 0.18;"," color += wheelDirection(u_highlightWheel.x) * u_highlightWheel.y * weights.z * 0.18;"," color += u_shadowWheel.z * weights.x * 0.25;"," color += u_midtoneWheel.z * weights.y * 0.25;"," color += u_highlightWheel.z * weights.z * 0.25;"," return color;","}","vec3 applyRgbCurves(vec3 color){"," if (u_rgbCurvesEnabled < 0.5) return color;"," vec3 master = vec3("," sampleAdvancedCurve(color.r, 0.0).a,"," sampleAdvancedCurve(color.g, 0.0).a,"," sampleAdvancedCurve(color.b, 0.0).a"," );"," return vec3("," sampleAdvancedCurve(master.r, 0.0).r,"," sampleAdvancedCurve(master.g, 0.0).g,"," sampleAdvancedCurve(master.b, 0.0).b"," );","}","float decodeSigned(float value){ return (value * 255.0 - 128.0) / 127.0; }","vec3 applyHueCurves(vec3 color){"," if (u_hueCurvesEnabled < 0.5) return color;"," vec3 hsv = rgbToHsv(clamp(color, 0.0, 1.0));"," vec3 curves = sampleAdvancedCurve(hsv.x, 1.0).rgb;"," float originalLuma = lumaOf(color);"," hsv.x = fract(hsv.x + decodeSigned(curves.r) * 0.5);"," hsv.y = clamp(hsv.y * max(0.0, 1.0 + decodeSigned(curves.g)), 0.0, 1.0);"," vec3 shifted = hsvToRgb(hsv);"," shifted += vec3(originalLuma - lumaOf(shifted) + decodeSigned(curves.b));"," return shifted;","}","float softRangeMask(float value, float minimum, float maximum, float softness){"," if (value < minimum) {"," if (softness <= 0.0) return 0.0;"," return smoothstep(minimum - softness, minimum, value);"," }"," if (value > maximum) {"," if (softness <= 0.0) return 0.0;"," return 1.0 - smoothstep(maximum, maximum + softness, value);"," }"," return 1.0;","}","float hueRangeMask(float hue, float saturation, vec3 key){"," float distance = abs(fract(hue - key.x + 0.5) - 0.5) * 360.0;"," float range = key.y * 180.0;"," float softness = key.z * 180.0;"," if (range < 179.999 && saturation < 0.001) return 0.0;"," if (distance <= range) return 1.0;"," if (softness <= 0.0) return 0.0;"," return 1.0 - smoothstep(range, range + softness, distance);","}","vec3 applySecondary(vec3 color, float index){"," float base = index * 5.0;"," vec4 hueKey = advancedConfig(base);"," vec4 saturationKey = advancedConfig(base + 1.0);"," vec4 lumaKey = advancedConfig(base + 2.0);"," vec4 correction = advancedConfig(base + 3.0);"," vec4 tintCorrection = advancedConfig(base + 4.0);"," vec3 hsv = rgbToHsv(clamp(color, 0.0, 1.0));"," float luma = lumaOf(color);"," float mask = hueRangeMask(hsv.x, hsv.y, hueKey.rgb);"," mask *= softRangeMask(hsv.y, saturationKey.x, saturationKey.y, saturationKey.z * 0.5);"," mask *= softRangeMask(luma, lumaKey.x, lumaKey.y, lumaKey.z * 0.5);"," if (mask <= 0.0) return color;"," hsv.x = fract(hsv.x + decodeSigned(correction.x) * 0.5);"," vec3 corrected = hsvToRgb(hsv);"," float correctedLuma = lumaOf(corrected);"," corrected = mix(vec3(correctedLuma), corrected, max(0.0, 1.0 + decodeSigned(correction.y)));"," corrected += vec3(decodeSigned(correction.z));"," float temperature = decodeSigned(correction.w);"," float tint = decodeSigned(tintCorrection.x);"," corrected.r += temperature * 0.08 + tint * 0.04;"," corrected.b -= temperature * 0.08 - tint * 0.04;"," corrected.g -= tint * 0.08;"," return mix(color, corrected, mask);","}","vec3 applyAdvancedGrade(vec3 color){"," color = applyTonalWheels(color);"," color = applyRgbCurves(color);"," color = applyHueCurves(color);"," if (u_secondaryCount > 0.5) color = applySecondary(color, 0.0);"," if (u_secondaryCount > 1.5) color = applySecondary(color, 1.0);"," if (u_secondaryCount > 2.5) color = applySecondary(color, 2.0);"," if (u_secondaryCount > 3.5) color = applySecondary(color, 3.0);"," return color;","}","vec3 sampleLut(float r, float g, float b){"," float size = max(u_lutSize, 2.0);"," float x = (r + b * size + 0.5) / max(u_lutTextureSize.x, 1.0);"," float y = (g + 0.5) / max(u_lutTextureSize.y, 1.0);"," return texture2D(u_lut, vec2(x, y)).rgb;","}","vec3 applyLut(vec3 color){"," if (u_lutEnabled < 0.5) return color;"," float size = max(u_lutSize, 2.0);"," vec3 span = max(u_lutDomainMax - u_lutDomainMin, vec3(0.00001));"," vec3 scaled = clamp((color - u_lutDomainMin) / span, 0.0, 1.0) * (size - 1.0);"," vec3 lo = floor(scaled);"," vec3 hi = min(lo + 1.0, vec3(size - 1.0));"," vec3 f = scaled - lo;"," vec3 c000 = sampleLut(lo.r, lo.g, lo.b);"," vec3 c100 = sampleLut(hi.r, lo.g, lo.b);"," vec3 c010 = sampleLut(lo.r, hi.g, lo.b);"," vec3 c110 = sampleLut(hi.r, hi.g, lo.b);"," vec3 c001 = sampleLut(lo.r, lo.g, hi.b);"," vec3 c101 = sampleLut(hi.r, lo.g, hi.b);"," vec3 c011 = sampleLut(lo.r, hi.g, hi.b);"," vec3 c111 = sampleLut(hi.r, hi.g, hi.b);"," vec3 c00 = mix(c000, c100, f.r);"," vec3 c10 = mix(c010, c110, f.r);"," vec3 c01 = mix(c001, c101, f.r);"," vec3 c11 = mix(c011, c111, f.r);"," vec3 c0 = mix(c00, c10, f.g);"," vec3 c1 = mix(c01, c11, f.g);"," vec3 lutColor = mix(c0, c1, f.b);"," return mix(color, lutColor, clamp(u_lutIntensity, 0.0, 1.0));","}","vec3 applyPrimaryGrade(vec3 color){"," color *= pow(2.0, u_exposure);"," float y = lumaOf(color);"," float shadowMask = 1.0 - smoothstep(0.0, 0.65, y);"," float highlightMask = smoothstep(0.35, 1.0, y);"," color += u_shadows * 0.35 * shadowMask;"," color += u_highlights * 0.35 * highlightMask;"," float blackPoint = clamp(u_blacks * 0.18, -0.18, 0.18);"," float whitePoint = clamp(1.0 - u_whites * 0.18, 0.82, 1.18);"," color = (color - blackPoint) / max(whitePoint - blackPoint, 0.2);"," color.r += u_temperature * 0.08 + u_tint * 0.04;"," color.b -= u_temperature * 0.08 - u_tint * 0.04;"," color.g -= u_tint * 0.08;"," color = (color - 0.5) * max(0.0, 1.0 + u_contrast) + 0.5;"," float satLuma = lumaOf(color);"," float currentSat = clamp(colorSaturation(color), 0.0, 1.0);"," float skinLike = smoothstep(0.02, 0.18, color.r - color.g) * smoothstep(0.0, 0.16, color.g - color.b) * smoothstep(0.18, 0.82, satLuma);"," float vibranceWeight = (1.0 - currentSat * 0.72) * mix(1.0, 0.55, skinLike);"," color = mix(vec3(satLuma), color, max(0.0, 1.0 + u_vibrance * vibranceWeight));"," color = mix(vec3(satLuma), color, max(0.0, 1.0 + u_saturation));"," return color;","}","vec3 applyColorGrade(vec3 color){"," color = applyPrimaryGrade(color);"," color = applyAdvancedGrade(color);"," return clamp(applyLut(clamp(color, 0.0, 1.0)), 0.0, 1.0);","}","vec3 applyDither(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float scale = max(min(u_resolution.x, u_resolution.y) / 540.0, 0.25);"," float pixelSize = mix(1.0, 5.0, clamp(u_ditherSize, 0.0, 1.0)) * scale;"," vec2 block = floor(gl_FragCoord.xy / max(pixelSize, 1.0));"," float levels = clamp(u_paletteSize, 2.0, 6.0);"," float index = floor(clamp(lumaOf(source) * (levels - 1.0) + bayer4(block), 0.0, levels - 1.0));"," return mix(source, paletteColor(index), amount);","}","vec2 asciiEdgeDirection(vec2 uv, vec2 stepUv){"," float topLeft = bt601Luma(sampleMedia(uv + vec2(-stepUv.x, -stepUv.y)).rgb);"," float top = bt601Luma(sampleMedia(uv + vec2(0.0, -stepUv.y)).rgb);"," float topRight = bt601Luma(sampleMedia(uv + vec2(stepUv.x, -stepUv.y)).rgb);"," float left = bt601Luma(sampleMedia(uv + vec2(-stepUv.x, 0.0)).rgb);"," float right = bt601Luma(sampleMedia(uv + vec2(stepUv.x, 0.0)).rgb);"," float bottomLeft = bt601Luma(sampleMedia(uv + vec2(-stepUv.x, stepUv.y)).rgb);"," float bottom = bt601Luma(sampleMedia(uv + vec2(0.0, stepUv.y)).rgb);"," float bottomRight = bt601Luma(sampleMedia(uv + stepUv).rgb);"," float x = -topLeft - 2.0 * left - bottomLeft + topRight + 2.0 * right + bottomRight;"," float y = -topLeft - 2.0 * top - topRight + bottomLeft + 2.0 * bottom + bottomRight;"," return vec2(x, y);","}","vec2 rotateAsciiUv(vec2 uv, float angle){"," float cosine = cos(angle);"," float sine = sin(angle);"," vec2 centered = uv - 0.5;"," return vec2(centered.x * cosine - centered.y * sine, centered.x * sine + centered.y * cosine) + 0.5;","}","vec3 applyAscii(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float scale = max(min(u_resolution.x, u_resolution.y) / 540.0, 0.25);"," float cellHeight = mix(4.0, 80.0, clamp(u_asciiSize, 0.0, 1.0)) * scale;"," vec2 cellSize = vec2(cellHeight);"," vec2 cell = floor(gl_FragCoord.xy / cellSize);"," vec2 cellVuv = (cell + 0.5) * cellSize / max(u_resolution, vec2(1.0));"," vec2 cellUv = (cellVuv - u_uvOffset) / u_uvScale;"," cellUv = applyCrtWarp(cellUv);"," vec3 cellColor = applyColorGrade(sampleMedia(cellUv).rgb);"," float brightness = bt601Luma(cellColor);"," float invert = step(0.5, u_asciiInvert);"," brightness = mix(brightness, 1.0 - brightness, invert);"," vec2 glyphUv = fract(gl_FragCoord.xy / cellSize);"," float rotation = clamp(u_asciiRotation, 0.0, 1.0);"," if (rotation > 0.0) {"," vec2 cellStepUv = cellSize / max(u_resolution * u_uvScale, vec2(1.0));"," vec2 edge = asciiEdgeDirection(cellUv, cellStepUv);"," if (length(edge) > 0.1) glyphUv = mix(glyphUv, rotateAsciiUv(glyphUv, atan(edge.y, edge.x)), rotation);"," }"," float ink = asciiStyleSample(floor(u_asciiStyle + 0.5), brightness, glyphUv);"," vec3 background = paletteColor(0.0);"," vec3 inkColor = mix(paletteColor(max(u_paletteSize - 1.0, 1.0)), cellColor, clamp(u_asciiColor, 0.0, 1.0));"," vec3 asciiColor = mix(background, inkColor, ink);"," return mix(source, asciiColor, amount);","}","vec3 applyScanlines(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float count = mix(50.0, 500.0, clamp(u_scanlineCount, 0.0, 1.0));"," float softness = clamp(u_scanlineSoftness, 0.0, 1.0);"," float wave = 0.5 + 0.5 * sin(v_uv.y * count * PI);"," float line = mix(1.0 - wave, pow(1.0 - wave, 2.2), softness);"," return source * (1.0 - line * amount);","}","void main(){"," vec2 uv = (v_uv - u_uvOffset) / u_uvScale;"," if (uv.x < 0.0 || uv.y < 0.0 || uv.x > 1.0 || uv.y > 1.0) {"," gl_FragColor = vec4(0.0);"," return;"," }"," vec4 originalSample = sampleSource(uv);"," uv = applyCrtWarp(uv);"," vec2 displayEdge = smoothstep(vec2(0.0), vec2(0.006), uv) * (1.0 - smoothstep(vec2(0.994), vec2(1.0), uv));"," float displayMask = displayEdge.x * displayEdge.y;"," vec4 sampleColor = sampleMedia(uv);"," sampleColor = sampleChromaticMedia(uv, sampleColor);"," sampleColor.rgb = applyDigitalGlitch(uv, sampleColor.rgb);"," vec3 original = originalSample.rgb;"," vec3 color = mix(sampleColor.rgb, applyColorGrade(sampleColor.rgb), u_intensity);"," float grainAmount = clamp(u_grain, 0.0, 1.0);"," if (grainAmount > 0.0) {"," float grainPixelSize = mix(1.0, 6.0, clamp(u_grainSize, 0.0, 1.0));"," vec2 grainCoord = floor(gl_FragCoord.xy / grainPixelSize) + vec2(u_grainSeed, u_grainSeed * 1.37);"," float grainBase = grainHash(grainCoord) - grainHash(grainCoord + vec2(19.19, 73.31));"," float grainFine = grainHash(gl_FragCoord.xy + vec2(u_grainSeed * 2.11, u_grainSeed * 0.71)) - 0.5;"," float grain = mix(grainBase * 0.7, grainBase + grainFine * 0.35, clamp(u_grainRoughness, 0.0, 1.0));"," float grainLuma = lumaOf(color);"," float grainMask = smoothstep(0.02, 0.55, grainLuma) * (1.0 - smoothstep(0.88, 1.0, grainLuma));"," color += grain * grainAmount * mix(0.025, 0.08, grainMask);"," }"," float filmArtifacts = clamp(u_filmArtifacts, 0.0, 1.0);"," if (filmArtifacts > 0.0) {"," float filmFrame = floor(u_grainSeed);"," float dust = dustMask(v_uv, floor(filmFrame / 3.0));"," float dustTone = grainHash(vec2(floor(filmFrame / 3.0), 8.0));"," color = mix(color, vec3(dustTone > 0.5 ? 0.95 : 0.02), dust * 0.72 * filmArtifacts);"," float scratchBucket = floor(filmFrame / 12.0);"," float scratchX = grainHash(vec2(scratchBucket, 4.2));"," float scratchLife = step(0.78, grainHash(vec2(scratchBucket, 8.4)));"," float scratch = (1.0 - smoothstep(0.0, 1.4 / max(u_resolution.x, 1.0), abs(v_uv.x - scratchX))) * scratchLife;"," color = mix(color, vec3(0.94, 0.88, 0.76), scratch * 0.28 * filmArtifacts);"," }"," color = applyMonoScreen(clamp(color, 0.0, 1.0), clamp(u_monoScreen, 0.0, 1.0));"," color = applyEngraving(clamp(color, 0.0, 1.0), clamp(u_engraving, 0.0, 1.0));"," color = applyCrosshatch(uv, clamp(color, 0.0, 1.0), clamp(u_crosshatch, 0.0, 1.0));"," color = applyHalftone(clamp(color, 0.0, 1.0), clamp(u_halftone, 0.0, 1.0));"," color = applyTwoInkPrint(clamp(color, 0.0, 1.0), clamp(u_twoInkPrint, 0.0, 1.0));"," color = applyDither(clamp(color, 0.0, 1.0), clamp(u_dither, 0.0, 1.0));"," color = applyAscii(clamp(color, 0.0, 1.0), clamp(u_ascii, 0.0, 1.0));"," if (u_bloomReady > 0.5 && u_bloom > 0.0) color += sampleBloom(uv) * u_bloom;"," color = applyScanlines(clamp(color, 0.0, 1.0), clamp(u_scanlines, 0.0, 1.0));"," vec2 vignetteAspect = u_resolution.x > u_resolution.y"," ? vec2(u_resolution.x / max(u_resolution.y, 1.0), 1.0)"," : vec2(1.0, u_resolution.y / max(u_resolution.x, 1.0));"," vec2 vignetteUv = abs((v_uv - vec2(0.5)) * 2.0) * vignetteAspect;"," float vignettePower = mix(8.0, 1.8, clamp(u_vignetteRoundness * 0.5 + 0.5, 0.0, 1.0));"," float vignetteDistance = pow(pow(vignetteUv.x, vignettePower) + pow(vignetteUv.y, vignettePower), 1.0 / vignettePower);"," float vignetteMidpoint = mix(0.22, 1.08, clamp(u_vignetteMidpoint, 0.0, 1.0));"," float vignetteFeather = mix(0.08, 0.72, clamp(u_vignetteFeather, 0.0, 1.0));"," float vignetteMask = smoothstep(vignetteMidpoint, vignetteMidpoint + vignetteFeather, vignetteDistance);"," color *= 1.0 - vignetteMask * clamp(u_vignette, 0.0, 1.0) * 0.75;"," float warpActive = step(0.0001, u_crtCurvature);"," color *= mix(1.0, displayMask, warpActive);"," vec3 graded = clamp(color, 0.0, 1.0);"," if (u_compareEnabled > 0.5) {"," float pos = clamp(u_comparePosition, 0.0, 1.0);"," float softness = max(u_compareSoftness, 0.00001);"," float afterMask = smoothstep(pos - softness, pos + softness, v_uv.x);"," vec3 splitColor = mix(original, graded, afterMask);"," float lineMask = 0.0;"," if (u_compareLineWidth > 0.0) {"," float lineWidth = max(u_compareLineWidth / max(u_resolution.x, 1.0), 0.00001);"," lineMask = 1.0 - smoothstep(lineWidth, lineWidth * 1.8, abs(v_uv.x - pos));"," }"," gl_FragColor = vec4(mix(splitColor, vec3(1.0), lineMask * 0.82), sampleColor.a);"," return;"," }"," gl_FragColor = vec4(graded, sampleColor.a);","}"].join(`\n`),e_=["#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","varying vec2 v_uv;","uniform sampler2D u_source;","uniform vec2 u_resolution;","uniform vec2 u_direction;","uniform float u_radius;","uniform float u_bloomPass;","uniform float u_threshold;","vec4 readSource(vec2 uv){"," vec4 color = texture2D(u_source, clamp(uv, vec2(0.0), vec2(1.0)));"," if (u_bloomPass > 0.5) {"," float luminance = dot(color.rgb, vec3(0.299, 0.587, 0.114));"," if (u_threshold >= 0.0 && luminance <= u_threshold) color.rgb = vec3(0.0);"," return vec4(color.rgb, 1.0);"," }"," color.rgb *= color.a;"," return color;","}","void main(){"," if (u_bloomPass > 0.5) {"," vec2 stepUv = u_direction * max(u_radius, 0.0) / max(u_resolution, vec2(1.0)) * 0.5;"," vec4 bloom = readSource(v_uv) * 0.227027;"," bloom += readSource(v_uv + stepUv) * 0.1945946;"," bloom += readSource(v_uv - stepUv) * 0.1945946;"," bloom += readSource(v_uv + stepUv * 2.0) * 0.1216216;"," bloom += readSource(v_uv - stepUv * 2.0) * 0.1216216;"," bloom += readSource(v_uv + stepUv * 3.0) * 0.054054;"," bloom += readSource(v_uv - stepUv * 3.0) * 0.054054;"," bloom += readSource(v_uv + stepUv * 4.0) * 0.016216;"," bloom += readSource(v_uv - stepUv * 4.0) * 0.016216;"," gl_FragColor = bloom;"," return;"," }"," vec2 stepUv = u_direction * max(u_radius, 0.0) / max(u_resolution, vec2(1.0)) / 12.0;"," vec4 color = readSource(v_uv) * 0.08077993;"," color += readSource(v_uv + stepUv * 1.0) * 0.07918038;"," color += readSource(v_uv - stepUv * 1.0) * 0.07918038;"," color += readSource(v_uv + stepUv * 2.0) * 0.07456928;"," color += readSource(v_uv - stepUv * 2.0) * 0.07456928;"," color += readSource(v_uv + stepUv * 3.0) * 0.06747307;"," color += readSource(v_uv - stepUv * 3.0) * 0.06747307;"," color += readSource(v_uv + stepUv * 4.0) * 0.05865827;"," color += readSource(v_uv - stepUv * 4.0) * 0.05865827;"," color += readSource(v_uv + stepUv * 5.0) * 0.04899551;"," color += readSource(v_uv - stepUv * 5.0) * 0.04899551;"," color += readSource(v_uv + stepUv * 6.0) * 0.03931982;"," color += readSource(v_uv - stepUv * 6.0) * 0.03931982;"," color += readSource(v_uv + stepUv * 7.0) * 0.03031761;"," color += readSource(v_uv - stepUv * 7.0) * 0.03031761;"," color += readSource(v_uv + stepUv * 8.0) * 0.02245983;"," color += readSource(v_uv - stepUv * 8.0) * 0.02245983;"," color += readSource(v_uv + stepUv * 9.0) * 0.01598624;"," color += readSource(v_uv - stepUv * 9.0) * 0.01598624;"," color += readSource(v_uv + stepUv * 10.0) * 0.01093238;"," color += readSource(v_uv - stepUv * 10.0) * 0.01093238;"," color += readSource(v_uv + stepUv * 11.0) * 0.00718308;"," color += readSource(v_uv - stepUv * 11.0) * 0.00718308;"," color += readSource(v_uv + stepUv * 12.0) * 0.00453456;"," color += readSource(v_uv - stepUv * 12.0) * 0.00453456;"," if (color.a > 0.0001) color.rgb /= color.a;"," gl_FragColor = color;","}"].join(`\n`),t_=["#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","varying vec2 v_uv;","uniform sampler2D u_source;","uniform sampler2D u_blurSource;","uniform vec2 u_texel;","uniform vec2 u_uvScale;","uniform vec2 u_uvOffset;","uniform float u_blurReady;","uniform float u_blur;","uniform float u_kuwaharaRadius;","vec3 readPrepared(vec2 displayUv){"," vec2 uv = (displayUv - u_uvOffset) / u_uvScale;"," vec3 color = texture2D(u_source, clamp(uv, vec2(0.0), vec2(1.0))).rgb;"," if (u_blurReady > 0.5 && u_blur > 0.0) {"," vec3 blurred = texture2D(u_blurSource, clamp(uv, vec2(0.0), vec2(1.0))).rgb;"," color = mix(color, blurred, clamp(u_blur, 0.0, 1.0));"," }"," return color;","}","void main(){"," float radius = floor(mix(2.0, 16.0, clamp(u_kuwaharaRadius, 0.0, 1.0)) + 0.5);"," vec3 sum = vec3(0.0);"," float sumSquares = 0.0;"," float count = 0.0;"," for (int offset = 0; offset <= 16; offset++) {"," if (float(offset) > radius) continue;"," vec3 color = readPrepared(v_uv + vec2(float(offset), 0.0) * u_texel);"," sum += color;"," sumSquares += dot(color, color) / 3.0;"," count += 1.0;"," }"," gl_FragColor = vec4(sum / count, sumSquares / count);","}"].join(`\n`),n_=["#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","varying vec2 v_uv;","uniform sampler2D u_kuwaharaMoments;","uniform vec2 u_texel;","uniform float u_kuwaharaRadius;","uniform float u_kuwaharaSharpness;","uniform float u_kuwaharaSaturation;","void main(){"," float radius = floor(mix(2.0, 16.0, clamp(u_kuwaharaRadius, 0.0, 1.0)) + 0.5);"," vec2 origins[4];"," origins[0] = vec2(-radius, -radius);"," origins[1] = vec2(0.0, -radius);"," origins[2] = vec2(-radius, 0.0);"," origins[3] = vec2(0.0, 0.0);"," vec3 means[4];"," float variances[4];"," float minVariance = 1.0;"," for (int quadrant = 0; quadrant < 4; quadrant++) {"," vec4 moment = vec4(0.0);"," float count = 0.0;"," for (int offset = 0; offset <= 16; offset++) {"," if (float(offset) > radius) continue;"," vec2 sampleOffset = origins[quadrant] + vec2(0.0, float(offset));"," moment += texture2D(u_kuwaharaMoments, clamp(v_uv + sampleOffset * u_texel, vec2(0.0), vec2(1.0)));"," count += 1.0;"," }"," moment /= count;"," vec3 mean = moment.rgb;"," float meanSquare = moment.a * 3.0;"," float variance = max(meanSquare - dot(mean, mean), 0.0);"," means[quadrant] = mean;"," variances[quadrant] = variance;"," minVariance = min(minVariance, variance);"," }"," float exponent = 1.0 + clamp(u_kuwaharaSharpness, 0.0, 1.0) * 8.0;"," vec3 result = vec3(0.0);"," float totalWeight = 0.0;"," for (int quadrant = 0; quadrant < 4; quadrant++) {"," float weight = pow((minVariance + 0.0001) / (variances[quadrant] + 0.0001), exponent);"," result += means[quadrant] * weight;"," totalWeight += weight;"," }"," result /= max(totalWeight, 0.0001);"," float luma = dot(result, vec3(0.2126, 0.7152, 0.0722));"," float saturation = clamp(u_kuwaharaSaturation, 0.0, 1.0) * 2.0;"," gl_FragColor = vec4(clamp(mix(vec3(luma), result, saturation), 0.0, 1.0), 1.0);","}"].join(`\n`);function Xt(e){return Ee(e)||Oe(e)}function Gh(e){let t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function Bh(e,t,n){let r=e.createShader(n);return r?(e.shaderSource(r,t),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(P("runtime.colorGrading.compileShader",e.getShaderInfoLog(r)),e.deleteShader(r),null)):null}function Ko(e,t=ZA){let n=Bh(e,QA,e.VERTEX_SHADER),r=Bh(e,t,e.FRAGMENT_SHADER);if(!n||!r)return n&&e.deleteShader(n),r&&e.deleteShader(r),null;let i=e.createProgram();return i?(e.attachShader(i,n),e.attachShader(i,r),e.linkProgram(i),e.deleteShader(n),e.deleteShader(r),e.getProgramParameter(i,e.LINK_STATUS)?i:(P("runtime.colorGrading.linkProgram",e.getProgramInfoLog(i)),e.deleteProgram(i),null)):null}function $o(e,t=e.LINEAR,n=e.UNSIGNED_BYTE){let r=e.createTexture();return r?(e.bindTexture(e.TEXTURE_2D,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,n,null),r):null}function r_(e,t){let n=Ko(e,e_);return n?{program:n,quad:t,position:e.getAttribLocation(n,"a_pos"),source:e.getUniformLocation(n,"u_source"),resolution:e.getUniformLocation(n,"u_resolution"),direction:e.getUniformLocation(n,"u_direction"),radius:e.getUniformLocation(n,"u_radius"),bloomPass:e.getUniformLocation(n,"u_bloomPass"),threshold:e.getUniformLocation(n,"u_threshold")}:null}function i_(e,t){let n=Ko(e,t_);return n?{program:n,quad:t,position:e.getAttribLocation(n,"a_pos"),source:e.getUniformLocation(n,"u_source"),blurSource:e.getUniformLocation(n,"u_blurSource"),texel:e.getUniformLocation(n,"u_texel"),uvScale:e.getUniformLocation(n,"u_uvScale"),uvOffset:e.getUniformLocation(n,"u_uvOffset"),blurReady:e.getUniformLocation(n,"u_blurReady"),blur:e.getUniformLocation(n,"u_blur"),radius:e.getUniformLocation(n,"u_kuwaharaRadius")}:null}function o_(e,t){let n=Ko(e,n_);return n?{program:n,quad:t,position:e.getAttribLocation(n,"a_pos"),moments:e.getUniformLocation(n,"u_kuwaharaMoments"),texel:e.getUniformLocation(n,"u_texel"),radius:e.getUniformLocation(n,"u_kuwaharaRadius"),sharpness:e.getUniformLocation(n,"u_kuwaharaSharpness"),saturation:e.getUniformLocation(n,"u_kuwaharaSaturation")}:null}function si(e,t=e.UNSIGNED_BYTE,n=e.LINEAR){let r=$o(e,n,t),i=e.createFramebuffer();if(!r||!i)return r&&e.deleteTexture(r),i&&e.deleteFramebuffer(i),null;e.bindFramebuffer(e.FRAMEBUFFER,i),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0);let o=e.checkFramebufferStatus(e.FRAMEBUFFER);return e.bindFramebuffer(e.FRAMEBUFFER,null),o!==e.FRAMEBUFFER_COMPLETE?(e.deleteTexture(r),e.deleteFramebuffer(i),null):{texture:r,framebuffer:i,type:t,width:1,height:1}}function qo(e,t,n,r){t.width===n&&t.height===r||(t.width=n,t.height=r,e.bindTexture(e.TEXTURE_2D,t.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n,r,0,e.RGBA,t.type,null))}function Wl(e,t,n){let r=[];for(let i of n){let o=e.getUniformLocation(t,`u_${i}`);o!==null&&r.push([i,o])}return r}function Uh(e,t,n){t&&e.deleteProgram(t);for(let r of n)r&&e.deleteTexture(r)}function ql(e){let t=e.getContext("webgl",{alpha:!0,premultipliedAlpha:!1});if(!t)return null;let n=Ko(t),r=$o(t),i=$o(t,t.NEAREST),o=$o(t,t.NEAREST);if(!n||!r||!i||!o)return Uh(t,n,[r,i,o]),null;let a=t.createBuffer();return a?(t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),t.STATIC_DRAW),{gl:t,program:{program:n,texture:r,lutTexture:i,advancedTexture:o,advancedSignature:null,quad:a,position:t.getAttribLocation(n,"a_pos"),source:t.getUniformLocation(n,"u_source"),blurSource:t.getUniformLocation(n,"u_blurSource"),bloomSource:t.getUniformLocation(n,"u_bloomSource"),kuwaharaSource:t.getUniformLocation(n,"u_kuwaharaSource"),lut:t.getUniformLocation(n,"u_lut"),advanced:t.getUniformLocation(n,"u_advanced"),resolution:t.getUniformLocation(n,"u_resolution"),uvScale:t.getUniformLocation(n,"u_uvScale"),uvOffset:t.getUniformLocation(n,"u_uvOffset"),blurReady:t.getUniformLocation(n,"u_blurReady"),bloomReady:t.getUniformLocation(n,"u_bloomReady"),kuwaharaReady:t.getUniformLocation(n,"u_kuwaharaReady"),lutEnabled:t.getUniformLocation(n,"u_lutEnabled"),lutSize:t.getUniformLocation(n,"u_lutSize"),lutTextureSize:t.getUniformLocation(n,"u_lutTextureSize"),lutDomainMin:t.getUniformLocation(n,"u_lutDomainMin"),lutDomainMax:t.getUniformLocation(n,"u_lutDomainMax"),lutIntensity:t.getUniformLocation(n,"u_lutIntensity"),shadowWheel:t.getUniformLocation(n,"u_shadowWheel"),midtoneWheel:t.getUniformLocation(n,"u_midtoneWheel"),highlightWheel:t.getUniformLocation(n,"u_highlightWheel"),rgbCurvesEnabled:t.getUniformLocation(n,"u_rgbCurvesEnabled"),hueCurvesEnabled:t.getUniformLocation(n,"u_hueCurvesEnabled"),secondaryCount:t.getUniformLocation(n,"u_secondaryCount"),adjustUniforms:Wl(t,n,po),detailUniforms:Wl(t,n,ks),effectUniforms:Wl(t,n,Ms),grainSeed:t.getUniformLocation(n,"u_grainSeed"),effectTime:t.getUniformLocation(n,"u_effectTime"),paletteSize:t.getUniformLocation(n,"u_paletteSize"),palette0:t.getUniformLocation(n,"u_palette0"),palette1:t.getUniformLocation(n,"u_palette1"),palette2:t.getUniformLocation(n,"u_palette2"),palette3:t.getUniformLocation(n,"u_palette3"),palette4:t.getUniformLocation(n,"u_palette4"),palette5:t.getUniformLocation(n,"u_palette5"),intensity:t.getUniformLocation(n,"u_intensity"),compareEnabled:t.getUniformLocation(n,"u_compareEnabled"),comparePosition:t.getUniformLocation(n,"u_comparePosition"),compareSoftness:t.getUniformLocation(n,"u_compareSoftness"),compareLineWidth:t.getUniformLocation(n,"u_compareLineWidth")}}):(Uh(t,n,[r,i,o]),null)}function a_(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function s_(e){if(!a_(e))return{...Kn};let t=(n,r,i,o)=>{let a=typeof n=="number"?n:Number(n);return Math.min(o,Math.max(i,Number.isFinite(a)?a:r))};return{enabled:e.enabled===!0,position:t(e.position,Kn.position,0,1),softness:t(e.softness,Kn.softness,0,.25),lineWidth:t(e.lineWidth,Kn.lineWidth,0,12)}}function Xh(e){try{let t=new URL(e,document.baseURI);return t.protocol==="data:"?{href:t.href}:t.protocol!=="http:"&&t.protocol!=="https:"?{error:"LUT must be project-local or a data URL"}:t.origin!==window.location.origin?{error:"Remote LUT URLs are not supported"}:{href:t.href}}catch{return{error:"Invalid LUT URL"}}}function Xo(e){return e instanceof Error?e.message:"LUT failed to load"}function l_(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0)%1e4}function Yh(e){let t=e.id||e.currentSrc||e.getAttribute("src")||`${e.tagName}:${Array.prototype.indexOf.call(e.parentNode?.children??[],e)}`;return l_(t)}function jl(e){let t=Xh(e);if("error"in t)return{state:"error",message:t.error};let n=Nt.get(t.href);if(n)return n;let r=fetch(t.href,{credentials:"same-origin"}).then(o=>{if(!o.ok)throw new Error(`Failed to load LUT (${o.status})`);return o.text()}).then(o=>Ff(o,{maxSize:co})),i={state:"pending",promise:r};for(;Nt.size>=zA;){let o=Nt.keys().next().value;if(!o)break;Nt.delete(o)}return Nt.set(t.href,i),r.then(o=>{Nt.get(t.href)===i&&Nt.set(t.href,{state:"ready",lut:o})},o=>{Nt.get(t.href)===i&&Nt.set(t.href,{state:"error",message:Xo(o)})}),i}function Wh(e,t,n){if(e.lut?.src===t)return e.lut;let r=Ss(n),{gl:i,program:o}=e;try{return Jh(i,o.lutTexture,r),e.lut={src:t,size:n.size,domainMin:n.domainMin,domainMax:n.domainMax,textureWidth:r.width,textureHeight:r.height},e.lutError=null,e.lutLoadingSrc=null,e.lut}catch(a){return e.lut=null,e.lutError=Xo(a),e.lutLoadingSrc=null,P("runtime.colorGrading.uploadLut",a),null}}async function u_(e){let t=jl(e);if(t.state==="ready")return t.lut;if(t.state==="pending")return t.promise;throw new Error(t.message)}function Jh(e,t,n){e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n.width,n.height,0,e.RGBA,e.UNSIGNED_BYTE,n.data)}function c_(e,t,n){let r=Ss(n),{gl:i,program:o}=e;return Jh(i,o.lutTexture,r),{src:t,size:n.size,domainMin:n.domainMin,domainMax:n.domainMax,textureWidth:r.width,textureHeight:r.height}}function St(e,t){e.deleteTexture(t.texture),e.deleteFramebuffer(t.framebuffer)}function Kl(e){let t=e.effectTargets;t&&(e.gl.deleteProgram(t.blurProgram.program),St(e.gl,t.scratch),St(e.gl,t.blur),t.bloom&&St(e.gl,t.bloom),e.effectTargets=null)}function Xl(e){let t=e.kuwaharaTargets;t&&(e.gl.deleteProgram(t.horizontalProgram.program),e.gl.deleteProgram(t.resolveProgram.program),St(e.gl,t.moments),St(e.gl,t.output),e.kuwaharaTargets=null)}function zo(e,t=!1){Kl(e),Xl(e),d_(e.gl,e.program),t&&e.gl.getExtension("WEBGL_lose_context")?.loseContext()}function d_(e,t){e.deleteTexture(t.texture),e.deleteTexture(t.lutTexture),e.deleteTexture(t.advancedTexture),e.deleteBuffer(t.quad),e.deleteProgram(t.program)}function f_(e){let t=ql(e.canvas);return t?(zo(e),e.gl=t.gl,e.program=t.program,e.lut=null,e.lutLoadingSrc=null,e.lutError=null,e.effectError=null,!0):!1}function zl(e){if(!e.sourceHidden)return;e.element.removeAttribute(fn);let t=e.element.style.getPropertyValue("opacity"),n=e.element.style.getPropertyPriority("opacity");t==="0"&&n==="important"&&(e.sourceInlineOpacity===null?e.element.style.removeProperty("opacity"):e.element.style.setProperty("opacity",e.sourceInlineOpacity,e.sourceInlineOpacityPriority)),e.sourceHidden=!1}function m_(e){if(e.effectTargets)return e.effectTargets;let{gl:t}=e,n=r_(t,e.program.quad),r=si(t),i=si(t);return!n||!r||!i?(n&&t.deleteProgram(n.program),r&&St(t,r),i&&St(t,i),e.effectError="Framebuffer effects unavailable",null):(e.effectError=null,e.effectTargets={blurProgram:n,scratch:r,blur:i,bloom:null},e.effectTargets)}function p_(e,t){return t.bloom||(t.bloom=si(e.gl),e.effectError=t.bloom?null:"Framebuffer effects unavailable"),t.bloom}function Vh(e){let t=e.effectTargets;t?.bloom&&(St(e.gl,t.bloom),t.bloom=null)}function h_(e){if(e.kuwaharaTargets)return e.kuwaharaTargets;let{gl:t}=e,n=t.getExtension("OES_texture_half_float"),r=t.getExtension("EXT_color_buffer_half_float");if(!n||!r)return e.effectError="Kuwahara requires half-float framebuffer support",null;let i=i_(t,e.program.quad),o=o_(t,e.program.quad),a=si(t,n.HALF_FLOAT_OES,t.NEAREST),l=si(t);return!i||!o||!a||!l?(g_(t,i,o,a,l),e.effectError="Kuwahara framebuffer effects unavailable",null):(e.kuwaharaTargets={horizontalProgram:i,resolveProgram:o,moments:a,output:l},e.kuwaharaTargets)}function g_(e,t,n,r,i){t&&e.deleteProgram(t.program),n&&e.deleteProgram(n.program),r&&St(e,r),i&&St(e,i)}function Qh(e,t,n,r,i){let o=Math.max(1,Math.ceil(r)),a=Math.max(1,Math.ceil(i));return qo(e,t,o,a),qo(e,n,o,a),{width:o,height:a}}function jo(e,t,n,r,i,o,a,l=!1,s=-1){e.bindFramebuffer(e.FRAMEBUFFER,r.framebuffer),e.viewport(0,0,i.width,i.height),e.useProgram(t.program),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,n),e.uniform1i(t.source,0),e.uniform2f(t.resolution,i.width,i.height),e.uniform2f(t.direction,o.x,o.y),e.uniform1f(t.radius,a),e.uniform1f(t.bloomPass,l?1:0),e.uniform1f(t.threshold,s),li(e,t)}function b_(e,t,n,r,i,o,a){let l=Qh(e,t.scratch,r,i/2,o/2),s=a/2;jo(e,t.blurProgram,n,t.scratch,l,{x:1,y:0},s,!0,.5),jo(e,t.blurProgram,t.scratch.texture,r,l,{x:0,y:1},s,!0)}function x_(e,t,n,r,i,o,a){let l=n;for(let s=0;s<Math.max(1,Math.floor(a));s++)jo(e,t.blurProgram,l,t.scratch,i,{x:1,y:0},o),jo(e,t.blurProgram,t.scratch.texture,r,i,{x:0,y:1},o),l=r.texture}function li(e,t){e.bindBuffer(e.ARRAY_BUFFER,t.quad),e.enableVertexAttribArray(t.position),e.vertexAttribPointer(t.position,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_STRIP,0,4)}function y_(e,t,n,r,i,o,a,l){qo(e,t.moments,i.width,i.height),qo(e,t.output,i.width,i.height);let s=t.horizontalProgram;e.bindFramebuffer(e.FRAMEBUFFER,t.moments.framebuffer),e.viewport(0,0,i.width,i.height),e.useProgram(s.program),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,n),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,r),e.uniform1i(s.source,0),e.uniform1i(s.blurSource,1),e.uniform2f(s.texel,1/i.width,1/i.height),e.uniform2f(s.uvScale,o.scaleX,o.scaleY),e.uniform2f(s.uvOffset,o.offsetX,o.offsetY),e.uniform1f(s.blurReady,a?1:0),e.uniform1f(s.blur,l.blur),e.uniform1f(s.radius,l.kuwaharaRadius),li(e,s);let u=t.resolveProgram;e.bindFramebuffer(e.FRAMEBUFFER,t.output.framebuffer),e.useProgram(u.program),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t.moments.texture),e.uniform1i(u.moments,0),e.uniform2f(u.texel,1/i.width,1/i.height),e.uniform1f(u.radius,l.kuwaharaRadius),e.uniform1f(u.sharpness,l.kuwaharaSharpness),e.uniform1f(u.saturation,l.kuwaharaSaturation),li(e,u)}function S_(e,t,n,r){if(n<=0)return!1;let i=Qh(e.gl,t.scratch,t.blur,r.width,r.height);return x_(e.gl,t,e.program.texture,t.blur,i,.75+Math.pow(n,1.35)*32,n>.55?3:2),!0}function v_(e,t,n,r,i,o){if(n<=0)return Vh(e),null;o||Vh(e);let a=o?p_(e,t):t.blur;return a?(b_(e.gl,t,e.program.texture,a,i.width,i.height,r),a.texture):null}function E_(e,t,n,r){let{program:i}=e,o=t.effects.blur,a=t.effects.bloom;if(o<=0&&a<=0)return e.effectTargets&&r&&Kl(e),{blurReady:!1,bloomReady:!1,blurTexture:i.texture,bloomTexture:i.texture};let l=m_(e);if(!l)return{blurReady:!1,bloomReady:!1,blurTexture:i.texture,bloomTexture:i.texture};let s=S_(e,l,o,n),u=v_(e,l,a,t.effects.bloomRadius,n,s);return{blurReady:s,bloomReady:u!==null,blurTexture:l.blur.texture,bloomTexture:u??i.texture}}function A_(e,t,n,r,i,o,a){let l=t.effects.kuwahara;if(l<=0&&!o)return e.kuwaharaTargets&&a&&Xl(e),{kuwaharaReady:!1,kuwaharaTexture:e.program.texture};let s=h_(e);return!s||l<=0?{kuwaharaReady:!1,kuwaharaTexture:s?.output.texture??e.program.texture}:(y_(e.gl,s,e.program.texture,e.effectTargets?.blur.texture??e.program.texture,n,r,i,t.effects),{kuwaharaReady:!0,kuwaharaTexture:s.output.texture})}function Zh(e,t,n,r,i={}){let o=i.releaseIdleTargets??!0;e.effectError=null;let a=E_(e,t,n,o),l=A_(e,t,n,r,a.blurReady,i.preserveKuwahara??!1,o);return{...a,...l}}function __(e){let t=e.grading.lut?.src.trim()??"",n=e.grading.lut?.intensity??1;if(!t||n<=0)return e.lut=null,e.lutLoadingSrc=null,e.lutError=null,null;let r=Xh(t);if("error"in r)return e.lut=null,e.lutLoadingSrc=null,e.lutError=r.error,null;if(e.lut?.src===r.href)return e.lut;e.lut=null;let i=jl(t);return i.state==="ready"?Wh(e,r.href,i.lut):i.state==="error"?(e.lutError=i.message,e.lutLoadingSrc=null,null):(e.lutLoadingSrc!==r.href&&(e.lutLoadingSrc=r.href,e.lutError=null,i.promise.then(o=>{e.destroyed||e.grading.lut?.src.trim()!==t||(Wh(e,r.href,o),Ze(e))},o=>{e.destroyed||e.grading.lut?.src.trim()!==t||(e.lut=null,e.lutError=Xo(o),e.lutLoadingSrc=null,Ze(e))})),null)}function oi(e){if(!e)return null;if(typeof e=="string"){let t=e.trim();if(!t)return null;let n=document.getElementById(t.replace(/^#/,""));if(n&&Xt(n))return n;try{let r=document.querySelector(t);return r&&Xt(r)?r:null}catch{return null}}if(e.hfId){let t=document.querySelector(`[data-hf-id="${CSS.escape(e.hfId)}"]`);if(t&&Xt(t))return t}if(e.id){let t=document.getElementById(e.id);if(t&&Xt(t))return t}if(!e.selector)return null;try{let t=Array.from(document.querySelectorAll(e.selector)),n=Math.max(0,Math.floor(Number(e.selectorIndex??0)||0)),r=t[n]??null;return r&&Xt(r)?r:null}catch{return null}}function e0(e){return Ee(e)?e.videoWidth>0&&e.videoHeight>0?{width:e.videoWidth,height:e.videoHeight}:null:Oe(e)&&e.naturalWidth>0&&e.naturalHeight>0?{width:e.naturalWidth,height:e.naturalHeight}:null}function t0(e){return Ee(e)?e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&e.videoWidth>0&&e.videoHeight>0:Oe(e)?e.complete&&e.naturalWidth>0&&e.naturalHeight>0:!1}function n0(e){let t=wt(e);return t&&t0(t)?t:null}function $h(e){if(!Ee(e))return!1;let t=n0(e);if(!t)return!1;let n=window.getComputedStyle(t);return n.display!=="none"&&n.visibility!=="hidden"}function w_(e){return Oe(e)&&e.classList.contains("__render_frame__")}function C_(e,t){t.parentNode&&t.nextSibling!==e.canvas&&t.parentNode.insertBefore(e.canvas,t.nextSibling)}function r0(e){if(Ee(e)){let t=n0(e);if(t)return t}return t0(e)?e:null}function zh(e,t){let n=e.toLowerCase();if(n==="center")return .5;if(t==="x"){if(n==="left")return 0;if(n==="right")return 1}else{if(n==="top")return 0;if(n==="bottom")return 1}if(n.endsWith("%")){let r=Number.parseFloat(n);return Number.isFinite(r)?r/100:null}return null}function T_(e){let t=e.trim().split(/\\s+/).filter(Boolean),n=.5,r=.5;for(let i=0;i<t.length;i++){let o=t[i]??"",a=zh(o,"x"),l=zh(o,"y");if(a!==null&&(o==="left"||o==="right"||o.endsWith("%")&&i===0)){n=a;continue}if(l!==null&&(o==="top"||o==="bottom"||o.endsWith("%")&&i>0)){r=l;continue}}return{x:n,y:r}}function i0(e,t,n,r,i,o){if(e<=0||t<=0||n<=0||r<=0)return{scaleX:1,scaleY:1,offsetX:0,offsetY:0};let a=i||"fill",l=e,s=t;if(a==="contain"||a==="cover"||a==="scale-down"){let f=a==="cover"?Math.max(e/n,t/r):Math.min(e/n,t/r);l=n*f,s=r*f,a==="scale-down"&&l>n&&s>r&&(l=n,s=r)}else a==="none"&&(l=n,s=r);let u=T_(o||"center"),d=(e-l)*u.x/e,m=(t-s)*u.y/t;return{scaleX:l/e,scaleY:s/t,offsetX:d,offsetY:m}}function R_(e,t){window.getComputedStyle(t).position==="static"&&(e.touchedParent||(e.touchedParent=t,e.parentInlinePosition=t.style.position||null),t.style.position="relative")}function qh(e,t){return Math.max(0,Math.round(e>0?e:t))}function k_(e,t){let{element:n,canvas:r}=e,i=n.parentElement;i&&R_(e,i);let o=window.getComputedStyle(t);pm(r.style,o),r.style.pointerEvents="none",r.style.position="absolute",r.style.inset="auto",r.style.left=`${n.offsetLeft}px`,r.style.top=`${n.offsetTop}px`,r.style.right="auto",r.style.bottom="auto",r.style.width=`${n.offsetWidth}px`,r.style.height=`${n.offsetHeight}px`,r.style.display="block",r.style.opacity=e.sourceOpacityForCanvas,r.style.visibility=e.sourceVisibleForCanvas?"visible":"hidden";let a=n.getBoundingClientRect(),l=qh(n.offsetWidth,a.width),s=qh(n.offsetHeight,a.height);if(l<=0||s<=0)return r.style.display="none",null;let u=Math.max(1,window.devicePixelRatio||1),d=Math.round(l*u),m=Math.round(s*u);return r.width!==d&&(r.width=d),r.height!==m&&(r.height=m),{width:d,height:m}}function jn(e,t,n){e.uniform3f(t,Number.parseInt(n.slice(1,3),16)/255,Number.parseInt(n.slice(3,5),16)/255,Number.parseInt(n.slice(5,7),16)/255)}function yn(e,t,n,r){e.set(r,(t*gt+n)*4)}function Yt(e,t){return Math.min(1,Math.max(1/255,(e*(127/t)+128)/255))}function Vl(e,t,n){return e.length>=3?Es(e,t,n):new Float32Array(gt)}function xn(e,t){return e[t]??0}function M_(e,t,n){let r=Hn(t.red),i=Hn(t.green),o=Hn(t.blue),a=Hn(t.master),l=Vl(n.hueVsHue,-180,180),s=Vl(n.hueVsSaturation,-1,1),u=Vl(n.hueVsLuma,-1,1);for(let d=0;d<gt;d+=1)yn(e,0,d,[xn(r,d),xn(i,d),xn(o,d),xn(a,d)]),yn(e,1,d,[Yt(xn(l,d),180),Yt(xn(s,d),1),Yt(xn(u,d),1),1])}function N_(e,t,n){let r=n*XA;yn(e,2,r,[t.key.hue.center/360,t.key.hue.range/180,t.key.hue.softness/180,1]),yn(e,2,r+1,[t.key.saturation.min,t.key.saturation.max,t.key.saturation.softness/.5,0]),yn(e,2,r+2,[t.key.luma.min,t.key.luma.max,t.key.luma.softness/.5,0]),yn(e,2,r+3,[Yt(t.correction.hueShift,180),Yt(t.correction.saturation,1),Yt(t.correction.luma,1),Yt(t.correction.temperature,1)]),yn(e,2,r+4,[Yt(t.correction.tint,1),.5,.5,1])}function L_(e,t,n){let r=new Float32Array(gt*ci*4);M_(r,e,t);let i=0;for(let o of n)o.enabled&&(N_(r,o,i),i+=1);return r}var jh=new WeakMap;function F_(e,t,n){let r=jh.get(e);if(r?.hueCurves===t&&r.secondaries===n)return r.signature;let i=JSON.stringify([e,t,n]);return jh.set(e,{hueCurves:t,secondaries:n,signature:i}),i}function D_(e,t,n,r){let{curves:i,hueCurves:o}=n,a=F_(i,o,r);if(t.advancedSignature===a)return;let l=Uint8Array.from(L_(i,o,r),kr);e.activeTexture(e.TEXTURE5),e.bindTexture(e.TEXTURE_2D,t.advancedTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,gt,ci,0,e.RGBA,e.UNSIGNED_BYTE,l),t.advancedSignature=a}function $l(e,t,n){e.uniform3f(t,n.hue/360,n.amount,n.level)}function o0(e,t,n,r,i,o,a,l,s,u,d,m){e.uniform1i(t.source,0),e.uniform1i(t.blurSource,1),e.uniform1i(t.lut,2),e.uniform1i(t.kuwaharaSource,3),e.uniform1i(t.bloomSource,4),e.uniform1i(t.advanced,5),e.uniform2f(t.resolution,s.width,s.height),e.uniform2f(t.uvScale,u.scaleX,u.scaleY),e.uniform2f(t.uvOffset,u.offsetX,u.offsetY),e.uniform1f(t.blurReady,i?1:0),e.uniform1f(t.bloomReady,o?1:0),e.uniform1f(t.kuwaharaReady,a?1:0),e.uniform1f(t.lutEnabled,r?1:0),e.uniform1f(t.lutSize,r?.size??2),e.uniform2f(t.lutTextureSize,r?.textureWidth??1,r?.textureHeight??1),e.uniform3f(t.lutDomainMin,r?.domainMin[0]??0,r?.domainMin[1]??0,r?.domainMin[2]??0),e.uniform3f(t.lutDomainMax,r?.domainMax[0]??1,r?.domainMax[1]??1,r?.domainMax[2]??1),e.uniform1f(t.lutIntensity,n.lut?.intensity??0);let{curves:f,hueCurves:b,secondaries:p}=n,y=Fs(f),x=Ds(b),v=Is(p)?p.reduce((I,D)=>I+Number(D.enabled),0):0;(y||x||v>0)&&D_(e,t,n,p),$l(e,t.shadowWheel,n.wheels.shadows),$l(e,t.midtoneWheel,n.wheels.midtones),$l(e,t.highlightWheel,n.wheels.highlights),e.uniform1f(t.rgbCurvesEnabled,y?1:0),e.uniform1f(t.hueCurvesEnabled,x?1:0),e.uniform1f(t.secondaryCount,v);for(let[I,D]of t.adjustUniforms)e.uniform1f(D,n.adjust[I]);for(let[I,D]of t.detailUniforms)e.uniform1f(D,n.details[I]);e.uniform1f(t.grainSeed,d),e.uniform1f(t.effectTime,m);for(let[I,D]of t.effectUniforms)e.uniform1f(D,n.effects[I]);let _=n.palette??(n.effects.engraving>0||n.effects.crosshatch>0?jA:Bl),w=_[_.length-1]??Bl[1];e.uniform1f(t.paletteSize,_.length),jn(e,t.palette0,_[0]??Bl[0]),jn(e,t.palette1,_[1]??w),jn(e,t.palette2,_[2]??w),jn(e,t.palette3,_[3]??w),jn(e,t.palette4,_[4]??w),jn(e,t.palette5,_[5]??w),e.uniform1f(t.intensity,n.intensity),e.uniform1f(t.compareEnabled,l.enabled?1:0),e.uniform1f(t.comparePosition,l.position),e.uniform1f(t.compareSoftness,l.softness),e.uniform1f(t.compareLineWidth,l.lineWidth)}function I_(e){if(!e.sourceHidden){let t=e.element.getAttribute(mn);t!==null?(e.sourceInlineOpacity=t===""?null:t,e.sourceInlineOpacityPriority=""):(e.sourceInlineOpacity=e.element.style.getPropertyValue("opacity")||null,e.sourceInlineOpacityPriority=e.element.style.getPropertyPriority("opacity"))}e.element.setAttribute(fn,"true"),e.element.style.setProperty("opacity","0","important"),e.sourceHidden=!0}function Lt(e){let t=Zf.find(n=>n.path===e);if(!t)throw new Error(`Missing color-grading animation property: ${e}`);return t}var a0=Lt("intensity"),s0=Lt("lut.intensity"),l0=Lt("adjust.exposure"),u0=Lt("effects.kuwahara"),c0=[["blur",Lt("effects.blur")],["bloom",Lt("effects.bloom")],["kuwahara",u0],["pixelate",Lt("effects.pixelate")],["ascii",Lt("effects.ascii")],["dither",Lt("effects.dither")]],d0=[a0,s0,l0,...c0.map(([,e])=>e)];function Sn(e,t){let n=e.style.getPropertyValue(t.name);if(!n)return null;let r=Number(n);return Number.isFinite(r)?Math.min(t.max,Math.max(t.min,r)):null}function ai(e,t){return t!==null&&(rm(t)||d0.some(n=>Sn(e,n)!==null))}function P_(e,t){let n=null;for(let[r,i]of c0){let o=Sn(e,i);o!==null&&(n??(n={...t.effects}),n[r]=o)}return n}function O_(e){let{element:t,grading:n}=e,r=Sn(t,a0),i=Sn(t,s0),o=Sn(t,l0),a=P_(t,n);if(![r,i,o].some(u=>u!==null)&&a===null)return n;let s={...n,adjust:o===null?n.adjust:{...n.adjust,exposure:o},effects:a??n.effects};return r!==null&&(s.intensity=r),n.lut&&i!==null&&(s.lut={...n.lut,intensity:i}),s}function f0(e,t,n){e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n)}function m0(e,t,n){let r=[t.texture,n.blurTexture,t.lutTexture,n.kuwaharaTexture,n.bloomTexture,t.advancedTexture];for(let[i,o]of r.entries())e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,o)}function Ze(e){if(e.destroyed||e.contextLost)return!1;let t=r0(e.element);if(!t)return e.hasDrawn||(e.canvas.style.display="none"),!1;let n=e0(t);if(!n)return!1;let r=ye(t)?t:e.element,i=e.element.style.getPropertyValue("opacity"),o=e.element.style.getPropertyPriority("opacity"),a=e.sourceHidden&&i==="0"&&o==="important",l=e.element.style.getPropertyValue("visibility"),s=w_(t);s&&C_(e,t),a&&!s&&(e.sourceInlineOpacity!==null?e.element.style.setProperty("opacity",e.sourceInlineOpacity,e.sourceInlineOpacityPriority||""):e.element.style.removeProperty("opacity"));let u=window.getComputedStyle(s?t:e.element);e.sourceOpacityForCanvas=u.opacity||"1",a&&!s&&e.element.style.setProperty("opacity","0","important"),e.sourceVisibleForCanvas=(s||l!=="hidden")&&u.visibility!=="hidden";let d=k_(e,r);if(!d)return!1;let m=window.getComputedStyle(r),f=i0(d.width,d.height,n.width,n.height,m.objectFit,m.objectPosition),{gl:b,program:p}=e;try{let y=O_(e),x=__(e);f0(b,p.texture,t);let v=Sn(e.element,u0)!==null,_=Zh(e,y,d,f,{preserveKuwahara:v});b.bindFramebuffer(b.FRAMEBUFFER,null),b.viewport(0,0,d.width,d.height),b.useProgram(p.program),m0(b,p,_);let w=window.__player?.getTime?.(),I=typeof w=="number"&&Number.isFinite(w)?Math.max(0,w):Ee(e.element)?Math.max(0,e.element.currentTime):0,D=e.grainSeed+Math.floor(I*60);return o0(b,p,y,x,_.blurReady,_.bloomReady,_.kuwaharaReady,e.compare,d,f,D,I),li(b,p),I_(e),e.hasDrawn=!0,e.drawError=null,!0}catch(y){return e.drawError=y instanceof Error?y.message:"Shader draw failed",P("runtime.colorGrading.drawEntry",y),!1}}function H_(e,t,n){let r=e.getBoundingClientRect(),i=e.offsetWidth||r.width||t.width,o=e.offsetHeight||r.height||t.height,a=Math.min(320,Math.max(64,Math.round(n??160))),l=i>0&&o>0?i/o:t.width/t.height;return l>=1?{width:a,height:Math.max(1,Math.round(a/l))}:{width:Math.max(1,Math.round(a*l)),height:a}}function G_(){let e=document.createElement("canvas"),t=ql(e);return t?{canvas:e,...t,lut:null,effectTargets:null,kuwaharaTargets:null,effectError:null}:null}function B_(e,t){let n=t?void 0:window.__player?.getTime?.();return typeof n=="number"&&Number.isFinite(n)?Math.max(0,n):Ee(e)?Math.max(0,e.currentTime):0}function U_(e,t,n,r){let i=r0(t);if(!i)return null;let o=e0(i);if(!o)return null;let a=H_(t,o,n);e.canvas.width=a.width,e.canvas.height=a.height;let l=ye(i)?i:t,s=window.getComputedStyle(l),u=i0(a.width,a.height,o.width,o.height,s.objectFit,s.objectPosition);return f0(e.gl,e.program.texture,i),{dimensions:a,uv:u,effectTime:B_(t,r),grainSeed:Yh(t)+(Ee(t)?Math.floor(t.currentTime*60):0)}}async function W_(e,t,n,r,i=!1){let o=U_(e,t,r,i);if(!o)return null;let{dimensions:a,uv:l,grainSeed:s,effectTime:u}=o,d=[];for(let m of n.slice(0,32)){let f=ho(m.grading);if(!f){d.push({id:m.id,dataUrl:null,error:"Invalid grading"});continue}let b=null;try{f.lut&&(e.lut?.src!==f.lut.src&&(e.lut=c_(e,f.lut.src,await u_(f.lut.src))),b=e.lut),d.push({id:m.id,dataUrl:V_(e,f,b,a,l,s,u)})}catch(p){d.push({id:m.id,dataUrl:null,error:Xo(p)})}}return{...a,images:d}}function V_(e,t,n,r,i,o,a){let{canvas:l,gl:s,program:u}=e,d=Zh(e,t,r,i,{releaseIdleTargets:!1});return s.bindFramebuffer(s.FRAMEBUFFER,null),s.viewport(0,0,r.width,r.height),s.useProgram(u.program),m0(s,u,d),n||(e.lut=null),o0(s,u,t,n,d.blurReady,d.bloomReady,d.kuwaharaReady,Kn,r,i,o,a),li(s,u),l.toDataURL("image/png")}function yt(e,t,n,r){t.addEventListener(n,r),e.cleanup.push(()=>t.removeEventListener(n,r))}function $_(e){e.animationFrame!==null&&(window.cancelAnimationFrame(e.animationFrame),e.animationFrame=null),e.videoFrameHandle!==null&&Ee(e.element)&&(e.element.cancelVideoFrameCallback?.(e.videoFrameHandle),e.videoFrameHandle=null)}function ui(e){if(e.destroyed||!Ee(e.element)||e.videoFrameHandle!==null||e.animationFrame!==null)return;let t=e.element,n=t;if(typeof n.requestVideoFrameCallback=="function"){e.videoFrameHandle=n.requestVideoFrameCallback(()=>{e.videoFrameHandle=null,Ze(e),!e.destroyed&&!t.paused&&!t.ended&&ui(e)});return}e.animationFrame=window.requestAnimationFrame(()=>{e.animationFrame=null,Ze(e),!e.destroyed&&!t.paused&&!t.ended&&ui(e)})}function z_(e){let t=()=>{Ze(e)};if(yt(e,e.element,"load",t),yt(e,e.element,"loadedmetadata",t),yt(e,e.element,"loadeddata",t),yt(e,e.element,"seeked",t),yt(e,e.element,"timeupdate",t),yt(e,window,"resize",t),Ee(e.element)&&(yt(e,e.element,"play",()=>ui(e)),yt(e,e.element,"pause",t)),yt(e,e.canvas,"webglcontextlost",n=>{n.preventDefault(),e.contextLost=!0,e.drawError="WebGL context lost",e.canvas.style.display="none",zl(e)}),yt(e,e.canvas,"webglcontextrestored",()=>{if(e.contextLost=!1,!f_(e)){e.contextLost=!0,e.drawError="WebGL context restore failed",zl(e);return}e.drawError=null,Ze(e)}),typeof ResizeObserver<"u"&&(e.resizeObserver=new ResizeObserver(t),e.resizeObserver.observe(e.element)),typeof MutationObserver<"u"){let n=()=>{let a=e.element.style;return`${a.transform}|${a.translate}|${a.rotate}|${a.scale}|${a.left}|${a.top}|${a.width}|${a.height}`},r=n(),i=!1,o=new MutationObserver(()=>{i||n()!==r&&(i=!0,requestAnimationFrame(()=>{i=!1,r=n(),Ze(e)}))});o.observe(e.element,{attributes:!0,attributeFilter:["style"]}),e.cleanup.push(()=>o.disconnect())}}function q_(e){if(e.destroyed)return null;e.destroyed=!0,$_(e),e.resizeObserver?.disconnect();for(let t of e.cleanup)t();return e.cleanup.length=0,e.canvas.remove(),Kl(e),Xl(e),zl(e),e.touchedParent&&(e.parentInlinePosition===null?e.touchedParent.style.removeProperty("position"):e.touchedParent.style.position=e.parentInlinePosition),{canvas:e.canvas,gl:e.gl,program:e.program,effectTargets:null,kuwaharaTargets:null,effectError:null}}function p0(e,t){return e.removeAttribute("style"),t.id?e.id=`${Kf}${t.id}`:e.removeAttribute("id"),e.className=$A,e.setAttribute(VA,"true"),e.setAttribute("data-hyperframes-ignore",""),e.setAttribute("data-hyperframes-picker-ignore",""),e.setAttribute("data-hf-ignore",""),e.setAttribute("aria-hidden","true"),e.style.pointerEvents="none",e.style.display="none",t.parentNode?.insertBefore(e,t.nextSibling),e}function j_(e){return p0(document.createElement("canvas"),e)}function h0(e){let t=new WeakMap,n=new Set,r=[],i=null,o=null,a=Promise.resolve(),l=!1,s=(T,M,R)=>{let U=t.get(T);if(U)return U.grading=M,U.source=R,Ze(U),Ee(T)&&!T.paused&&ui(U),!0;let j=r.pop();if(j)p0(j.canvas,T);else{let N=j_(T),A=ql(N);if(!A)return N.remove(),!1;j={canvas:N,gl:A.gl,program:A.program,effectTargets:null,kuwaharaTargets:null,effectError:null}}let Y={element:T,...j,grading:M,compare:{...Kn},lut:null,lutLoadingSrc:null,lutError:null,drawError:null,effectTargets:null,kuwaharaTargets:null,effectError:null,source:R,animationFrame:null,videoFrameHandle:null,resizeObserver:null,cleanup:[],touchedParent:null,parentInlinePosition:null,sourceHidden:!1,sourceInlineOpacity:null,sourceInlineOpacityPriority:"",sourceOpacityForCanvas:window.getComputedStyle(T).opacity||"1",sourceVisibleForCanvas:window.getComputedStyle(T).visibility!=="hidden",hasDrawn:!1,contextLost:!1,grainSeed:Yh(T),destroyed:!1};return t.set(T,Y),n.add(T),z_(Y),Ze(Y),Ee(T)&&!T.paused&&ui(Y),!0},u=(T,M)=>{if(l)return!1;let R=oi(T);if(!R)return!1;let U=t.get(R);if(!U){let j=Vo(R);if(!ai(R,j)||!s(R,j,"attribute"))return!1;U=t.get(R)}return U?(U.compare=s_(M),Ze(U),!0):!1},d=T=>{let M=t.get(T);if(!M)return;let R=q_(M);R&&(M.contextLost||r.length>=qA?zo(R,!0):r.push(R)),t.delete(T),n.delete(T)},m=()=>{if(l)return 0;let T=new Set;document.querySelectorAll(`video[${Nr}], img[${Nr}]`).forEach(R=>{if(!Xt(R))return;T.add(R);let U=Vo(R);ai(R,U)&&(Gh(R)||$h(R))?s(R,U,"attribute"):d(R)});for(let R of n){let U=t.get(R);U&&(!R.isConnected||U.source==="attribute"&&!T.has(R))&&d(R)}return n.size},f=()=>{if(l)return 0;let T=0;for(let M of n){let R=t.get(M);R&&Ze(R)&&(T+=1)}return T},b=async()=>{let T=new Set;for(let M of n){let R=t.get(M)?.grading.lut;if(!R?.src.trim()||(R.intensity??1)<=0)continue;let U=jl(R.src);U.state==="pending"&&T.add(U.promise)}return T.size>0&&await Promise.allSettled(T),f(),T.size},p=()=>{if(l)return 0;let T=0;for(let M of n){let R=t.get(M);!R||!d0.some(j=>Sn(M,j)!==null)||Ee(M)&&!M.paused&&!M.ended||Ze(R)&&(T+=1)}return T},y=(T,M)=>{if(l)return!1;let R=oi(T);if(!R)return!1;let U=ho(M);return ai(R,U)?s(R,U,"live"):(d(R),!0)},x=(T,M)=>{if(!Xt(T))return!1;let R=t.get(T);if(!R){if(!M)return!1;let U=Vo(T);return ai(T,U)&&s(T,U,"attribute")}return R.sourceVisibleForCanvas=M,!M&&R.source==="attribute"&&d(T),!0},v=T=>Xt(T)&&t.has(T),_=T=>{let M=oi(T);if(!M)return{state:"missing",message:"Media not found"};let R=t.get(M);if(R)return R.effectError?{state:"unavailable",message:R.effectError}:R.drawError?{state:"unavailable",message:R.drawError}:R.lutError?{state:"unavailable",message:`LUT error: ${R.lutError}`}:R.grading.lut&&R.lutLoadingSrc?{state:"pending",message:"Loading LUT"}:R.canvas.style.display==="none"?{state:"pending",message:"Waiting for media frame"}:{state:"active",message:R.lut?"Shader + LUT active":"Shader active"};let U=Vo(M);return ai(M,U)?!Gh(M)&&!$h(M)?{state:"pending",message:"Waiting for visible media"}:{state:"unavailable",message:"WebGL unavailable"}:{state:"inactive",message:"No grading applied"}},w=async(T,M,R)=>{let U=async()=>{if(l||M.length===0)return null;let Y=oi(T);return!Y||(o??(o=G_()),!o)?null:W_(o,Y,M,R?.maxDimension,R?.useMediaTime)},j=a.then(U,U);return a=j.then(()=>{},()=>{}),j},I=T=>{let M=oi(T);if(!Ee(M))return null;if(!M.paused)return()=>{};let R=M.currentTime,U=M.loop,j=M.muted;return M.loop=!0,M.muted=!0,(M.ended||Number.isFinite(M.duration)&&R>=M.duration)&&(M.currentTime=0),e?.lease(M),M.play().catch(()=>{}),()=>{e?.release(M),M.pause(),M.loop=U,M.muted=j,M.currentTime=R}},D=()=>{if(!l){l=!0,i?.disconnect(),i=null;for(let T of n)d(T);for(let T of r)zo(T,!0);r.length=0,o&&(zo(o,!0),o=null)}};document.body&&(i=new MutationObserver(()=>m()),i.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[Nr]}));let F={refresh:m,redraw:f,redrawAnimated:p,waitForActiveLuts:b,setGrading:y,setCompare:u,setSourceVisibility:x,isGraded:v,getStatus:_,renderPreviews:w,startPreviewPlayback:I,destroy:D},O=window;return O.__hf=O.__hf||{},O.__hf.colorGrading=F,m(),F}var K_={mulX:374761393,mulY:668265263,mulMix:1274126177,offset:2654435769,shift1:13,shift2:16,divisor:4294967296},{mulX:X_,mulY:Y_,mulMix:g0,offset:J_,shift1:Q_,shift2:Z_,divisor:e1}=K_,t1=20,b0=`#version 300 es\nprecision highp float;\nprecision highp int;\n\nin vec2 v_uv;\nout vec4 fragColor;\n\nuniform vec2 u_size;\nuniform float u_t;\nuniform float u_fps;\nuniform float u_fractalType;\nuniform float u_noiseType;\nuniform float u_invert;\nuniform float u_contrast;\nuniform float u_brightness;\nuniform float u_scale;\nuniform float u_complexity;\nuniform float u_subInfluence;\nuniform float u_subScaling;\nuniform float u_evolution;\nuniform float u_randomSeed;\nuniform float u_opacity;\n\nfloat hfHashUnit(int ix, int iy, int seed) {\n uint h = ((uint(ix) * ${X_}u) ^ (uint(iy) * ${Y_}u) ^ (uint(seed) * ${g0}u)) + ${J_}u;\n h = h ^ (h >> ${Q_}u);\n h = h * ${g0}u;\n h = h ^ (h >> ${Z_}u);\n return float(h) / ${e1}.0;\n}\n\nfloat hfFade(float f, float noiseType) {\n if (noiseType < 1.5) return 0.0;\n if (noiseType < 2.5) return f;\n if (noiseType < 3.5) return f * f * (3.0 - 2.0 * f);\n return f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n}\n\nfloat hfValueNoise(vec2 p, int seed) {\n vec2 cell = floor(p);\n vec2 f = p - cell;\n int ix = int(cell.x);\n int iy = int(cell.y);\n float sx = hfFade(f.x, u_noiseType);\n float sy = hfFade(f.y, u_noiseType);\n float bottom = mix(hfHashUnit(ix, iy, seed), hfHashUnit(ix + 1, iy, seed), sx);\n float top = mix(hfHashUnit(ix, iy + 1, seed), hfHashUnit(ix + 1, iy + 1, seed), sx);\n return mix(bottom, top, sy);\n}\n\nfloat hfFbm(vec2 p) {\n float lacunarity = 100.0 / max(u_subScaling, 1.0);\n float gain = u_subInfluence / 100.0;\n int seed = int(u_randomSeed);\n float amp = 1.0;\n float freq = 1.0;\n float sum = 0.0;\n float norm = 0.0;\n for (int i = 0; i < ${t1}; i++) {\n if (float(i) >= u_complexity) break;\n sum += amp * hfValueNoise(p * freq, seed + i);\n norm += amp;\n amp *= gain;\n freq *= lacunarity;\n }\n return norm > 0.0 ? sum / norm : 0.0;\n}\n\nvoid main() {\n vec2 px = v_uv * u_size;\n vec2 p = px / max(u_scale, 1.0) + vec2(u_evolution, u_evolution * 0.5);\n float v = hfFbm(p);\n v = (v - 0.5) * (u_contrast / 100.0) + 0.5 + u_brightness / 100.0;\n if (u_invert > 0.5) v = 1.0 - v;\n v = clamp(v, 0.0, 1.0);\n float a = clamp(u_opacity / 100.0, 0.0, 1.0);\n fragColor = vec4(v * a, v * a, v * a, a);\n}\n`;var Yl={lumaR:.299,lumaG:.587,lumaB:.114},{lumaR:n1,lumaG:r1,lumaB:i1}=Yl,x0=`#version 300 es\nprecision highp float;\n\nin vec2 v_uv;\nout vec4 fragColor;\n\nuniform vec2 u_size;\nuniform float u_t;\nuniform float u_fps;\nuniform sampler2D u_src;\nuniform sampler2D u_src2;\n// 1 when the map ref named another element, 0 when the map is the layer\n// itself. Set by the runtime for every pass, from whether a ref resolved.\nuniform float u_hasSrc2;\nuniform float u_useH;\nuniform float u_maxH;\nuniform float u_useV;\nuniform float u_maxV;\nuniform float u_behavior;\nuniform float u_edge;\nuniform float u_expand;\n\nvec4 hfSampleSrc(vec2 uv) {\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) return vec4(0.0);\n return texture(u_src, uv);\n}\n\n// The selector\'s value, in [0, 1]. Half and Off both land on 0.5, which is the\n// "no displacement" midpoint the caller subtracts.\nfloat hfMapChannel(vec4 premultiplied, float selector) {\n vec3 rgb = premultiplied.a > 0.0 ? premultiplied.rgb / premultiplied.a : vec3(0.0);\n if (selector < 1.5) return rgb.r;\n if (selector < 2.5) return rgb.g;\n if (selector < 3.5) return rgb.b;\n if (selector < 4.5) return premultiplied.a;\n if (selector < 8.5) return dot(rgb, vec3(${n1}, ${r1}, ${i1}));\n if (selector < 9.5) return 1.0;\n return 0.5;\n}\n\nvoid main() {\n vec4 mapTexel = u_hasSrc2 > 0.5 ? texture(u_src2, v_uv) : texture(u_src, v_uv);\n float h = hfMapChannel(mapTexel, u_useH);\n float v = hfMapChannel(mapTexel, u_useV);\n vec2 d = vec2((h - 0.5) * 2.0 * u_maxH, (v - 0.5) * 2.0 * u_maxV);\n fragColor = hfSampleSrc(v_uv + d / u_size);\n}\n`;var{lumaR:o1,lumaG:a1,lumaB:s1}=Yl;var y0=`#version 300 es\nprecision highp float;\n\nin vec2 v_uv;\nout vec4 fragColor;\n\nuniform vec2 u_size;\nuniform float u_t;\nuniform float u_fps;\nuniform sampler2D u_src;\nuniform sampler2D u_src2;\nuniform float u_mode;\n\n// The matte texel is premultiplied, so its rgb is already "over black" \\u2014 the\n// composite After Effects reads a luma matte through.\nfloat hfCoverage(vec4 matte, float mode) {\n if (mode < 1.5) return matte.a;\n if (mode < 2.5) return 1.0 - matte.a;\n float luma = dot(matte.rgb, vec3(${o1}, ${a1}, ${s1}));\n if (mode < 3.5) return luma;\n return 1.0 - luma;\n}\n\nvoid main() {\n vec4 src = texture(u_src, v_uv);\n vec4 matte = texture(u_src2, v_uv);\n fragColor = src * clamp(hfCoverage(matte, u_mode), 0.0, 1.0);\n}\n`;var l1={lcgMulA:1103515245,lcgMulB:12996205,lcgAdd:12345,highMask:32640,lowMask:255,byteScale:32704},{lcgMulA:u1,lcgMulB:c1,lcgAdd:S0,highMask:d1,lowMask:f1,byteScale:m1}=l1,v0=`#version 300 es\nprecision highp float;\n// NOT decoration: a fragment shader\'s default integer precision is mediump,\n// and a mediump uint is only guaranteed 16 bits (ESSL 3.00 \\xA74.5.2). Every step\n// below \\u2014 the Jenkins mix, both LCG rounds \\u2014 is defined by 32-bit wraparound,\n// so without this the hash is a different function on any implementation that\n// honours the minimum. ANGLE and SwiftShader both use 32-bit ints, which is\n// exactly why no test on this machine would catch it.\nprecision highp int;\n\nin vec2 v_uv;\nout vec4 fragColor;\n\nuniform vec2 u_size;\nuniform float u_t;\nuniform float u_fps;\nuniform sampler2D u_src;\nuniform float u_amount;\nuniform float u_useColorNoise;\nuniform float u_clipping;\n\n// Bob Jenkins\' 1997 integer mix, the six-round shift/xor/subtract sequence the\n// metallib runs verbatim. uint arithmetic wraps in GLSL ES 3.00, which is what\n// makes this bit-identical to the C original.\nuint hfJenkinsMix(uint a, uint b, uint c) {\n a -= b; a -= c; a ^= (c >> 13u);\n b -= c; b -= a; b ^= (a << 8u);\n c -= a; c -= b; c ^= (b >> 13u);\n a -= b; a -= c; a ^= (c >> 12u);\n b -= c; b -= a; b ^= (a << 16u);\n c -= a; c -= b; c ^= (b >> 5u);\n a -= b; a -= c; a ^= (c >> 3u);\n b -= c; b -= a; b ^= (a << 10u);\n c -= a; c -= b; c ^= (b >> 15u);\n return c;\n}\n\n// The hash\'s 15-bit output byte for one channel.\nfloat hfNoiseByte(uint a, uint y, uint seed) {\n uint h = hfJenkinsMix(a, y, seed);\n uint t2 = h * ${u1}u + ${S0}u;\n uint t4 = t2 * ${c1}u + ${S0}u;\n return float(((t4 >> 16u) & ${f1}u) ^ ((t2 >> 9u) & ${d1}u));\n}\n\nvoid main() {\n vec4 src = texture(u_src, v_uv);\n vec2 px = floor(v_uv * u_size);\n uint x = uint(max(px.x, 0.0));\n // After Effects indexes rows from the top; v_uv is y-up.\n uint y = uint(max(u_size.y - 1.0 - px.y, 0.0));\n float frame = floor(u_t * u_fps + 0.5);\n uint seed = uint(max(frame, 0.0)) & 0xFFFFu;\n\n float amount = u_amount * 0.01;\n vec3 nz;\n if (u_useColorNoise > 0.5) {\n uint a = x * 3u;\n nz = vec3(hfNoiseByte(a, y, seed), hfNoiseByte(a + 1u, y, seed), hfNoiseByte(a + 2u, y, seed));\n } else {\n nz = vec3(hfNoiseByte(x, y, seed));\n }\n nz = amount * (nz / ${m1}.0 - 0.5);\n\n vec4 out4 = vec4(src.rgb + nz, src.a);\n // A valid premultiplied colour needs rgb <= a component-wise; noise on a\n // near-transparent texel can push rgb above it, which our fixed 8-bit RGBA\n // storage cannot carry safely the way AE\'s float pipeline can (see the doc\n // comment above). This runs before, and independently of, u_clipping.\n out4.rgb = min(out4.rgb, out4.a);\n fragColor = u_clipping > 0.5 ? clamp(out4, 0.0, 1.0) : out4;\n}\n`;var p1={tau:6.283185307179586,degreesPerTurn:360},{tau:h1,degreesPerTurn:g1}=p1,E0=`#version 300 es\nprecision highp float;\n\nin vec2 v_uv;\nout vec4 fragColor;\n\nuniform vec2 u_size;\nuniform float u_t;\nuniform float u_fps;\nuniform sampler2D u_src;\nuniform float u_waveType;\nuniform float u_height;\nuniform float u_width;\nuniform float u_direction;\nuniform float u_speed;\nuniform float u_pinning;\nuniform float u_phase;\n\n// Outside the layer\'s own box there is nothing to warp in from, so the wave\n// carries transparency rather than a smeared edge pixel.\nvec4 hfSampleSrc(vec2 uv) {\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) return vec4(0.0);\n return texture(u_src, uv);\n}\n\nvoid main() {\n vec2 px = v_uv * u_size;\n float dir = radians(u_direction);\n vec2 travel = vec2(sin(dir), -cos(dir));\n vec2 swing = vec2(-travel.y, travel.x);\n float proj = (px.x + 1.0) * travel.x + px.y * travel.y;\n float turns = proj / max(u_width, 1.0) + u_phase / ${g1}.0 + u_speed * u_t;\n float disp = u_height * sin(${h1} * turns);\n fragColor = hfSampleSrc((px + swing * disp) / u_size);\n}\n`;var Jl="data-vfx-chain",A0=1,_0=[{value:1,label:"Red"},{value:2,label:"Green"},{value:3,label:"Blue"},{value:4,label:"Alpha"},{value:5,label:"Luminance"},{value:6,label:"Hue"},{value:7,label:"Lightness"},{value:8,label:"Saturation"},{value:9,label:"Full"},{value:10,label:"Half"},{value:11,label:"Off"}],b1=[{id:"fractal-noise",label:"Fractal Noise",ae:"ADBE Fractal Noise",capture:"none",frag:b0,params:[{kind:"enum",key:"fractalType",label:"Fractal Type",options:[{value:1,label:"Basic"}],default:1,hint:"Only Basic is implemented in v1."},{kind:"enum",key:"noiseType",label:"Noise Type",options:[{value:1,label:"Block"},{value:2,label:"Linear"},{value:3,label:"Soft Linear"},{value:4,label:"Spline"}],default:3},{kind:"bool",key:"invert",label:"Invert",default:!1},{kind:"number",key:"contrast",label:"Contrast",unit:"%",min:0,max:1e3,step:1,default:100},{kind:"number",key:"brightness",label:"Brightness",unit:"",min:-1e3,max:1e3,step:1,default:0},{kind:"number",key:"scale",label:"Scale",unit:"%",min:6,max:1e4,step:1,default:100},{kind:"number",key:"complexity",label:"Complexity",unit:"",min:1,max:20,step:1,default:6},{kind:"number",key:"subInfluence",label:"Sub Influence",unit:"%",min:0,max:100,step:1,default:70},{kind:"number",key:"subScaling",label:"Sub Scaling",unit:"%",min:0,max:100,step:1,default:56},{kind:"number",key:"evolution",label:"Evolution",unit:"revolutions",min:-1e4,max:1e4,step:.01,default:0,animatable:!0},{kind:"number",key:"randomSeed",label:"Random Seed",unit:"",min:0,max:99999,step:1,default:0},{kind:"number",key:"opacity",label:"Opacity",unit:"%",min:0,max:100,step:1,default:100,animatable:!0}]},{id:"wave-warp",label:"Wave Warp",ae:"ADBE Wave Warp",capture:"self",frag:E0,params:[{kind:"enum",key:"waveType",label:"Wave Type",options:[{value:1,label:"Sine"}],default:1,hint:"Only Sine is implemented in v1; the exporter marks the others cosmetic."},{kind:"number",key:"height",label:"Wave Height",unit:"px",min:-1e3,max:1e3,step:1,default:10,animatable:!0},{kind:"number",key:"width",label:"Wave Width",unit:"px",min:1,max:1e4,step:1,default:40,animatable:!0},{kind:"number",key:"direction",label:"Direction",unit:"deg",min:-360,max:360,step:1,default:90},{kind:"number",key:"speed",label:"Wave Speed",unit:"waves/s",min:-100,max:100,step:.1,default:1},{kind:"enum",key:"pinning",label:"Pinning",options:[{value:1,label:"None"}],default:1,hint:"Only None is implemented in v1; the exporter marks the others cosmetic."},{kind:"number",key:"phase",label:"Phase",unit:"deg",min:-360,max:360,step:1,default:0,animatable:!0}]},{id:"displacement-map",label:"Displacement Map",ae:"ADBE Displacement Map",capture:"self",frag:x0,params:[{kind:"ref",key:"map",label:"Displacement Map Layer",optional:!0},{kind:"enum",key:"useH",label:"Use For Horizontal Displacement",options:_0,default:1,hint:"Hue, Lightness and Saturation are read as Luminance in v1."},{kind:"number",key:"maxH",label:"Max Horizontal Displacement",unit:"px",min:-32e3,max:32e3,step:1,default:5,animatable:!0},{kind:"enum",key:"useV",label:"Use For Vertical Displacement",options:_0,default:2,hint:"Hue, Lightness and Saturation are read as Luminance in v1."},{kind:"number",key:"maxV",label:"Max Vertical Displacement",unit:"px",min:-32e3,max:32e3,step:1,default:5,animatable:!0},{kind:"enum",key:"behavior",label:"Displacement Map Behavior",options:[{value:1,label:"Center Map"}],default:1,hint:"Only Center Map is implemented in v1."},{kind:"enum",key:"edge",label:"Edge Behavior",options:[{value:0,label:"Off"}],default:0,hint:"Only Off (transparent outside the layer) is implemented in v1."},{kind:"bool",key:"expand",label:"Expand Output",default:!0}]},{id:"luma-matte",label:"Matte",capture:"self",frag:y0,params:[{kind:"ref",key:"matte",label:"Matte Layer"},{kind:"enum",key:"mode",label:"Matte Mode",options:[{value:1,label:"Alpha"},{value:2,label:"Alpha Inverted"},{value:3,label:"Luma"},{value:4,label:"Luma Inverted"}],default:1}]},{id:"noise",label:"Noise",ae:"ADBE Noise",capture:"self",frag:v0,params:[{kind:"number",key:"amount",label:"Amount of Noise",unit:"%",min:0,max:400,step:.1,default:0,animatable:!0},{kind:"bool",key:"useColorNoise",label:"Use Color Noise",default:!1},{kind:"bool",key:"clipping",label:"Clip Result Values",default:!0}]}],Yo=new Map(b1.map(e=>[e.id,e]));function T0(e){return Yo.get(e)}function R0(e,t){let n=Yo.get(e);if(!n)return{};let r={};for(let i of n.params){let o=t?.[i.key];r[i.key]=i.kind==="enum"?x1(i,o):i.kind==="bool"?y1(i,o):i.kind==="ref"?S1(o):v1(i,o)}return r}function k0(e){let t=typeof e=="number"?e:typeof e=="string"&&e.trim()!==""?Number(e):Number.NaN;return Number.isFinite(t)?t:void 0}function x1(e,t){let n=k0(t);return n!==void 0&&e.options.some(r=>r.value===n)?n:e.default}function y1(e,t){return typeof t=="boolean"?t:e.default}function S1(e){return typeof e=="string"?e:""}function v1(e,t){let n=k0(t);return n!==void 0?Math.min(e.max,Math.max(e.min,n)):e.default}var at=class extends Error{constructor(t){super(t),this.name="VfxChainError"}};function Ql(e){return e.nodes.filter(t=>t.enabled!==!1)}var w0={none:0,self:1,backdrop:2};function M0(e){let t="none";for(let n of Ql(e)){let r=Yo.get(n.type);r&&w0[r.capture]>w0[t]&&(t=r.capture)}return t}function N0(e){let t;try{t=JSON.parse(e)}catch(i){throw new at(`Chain file is not valid JSON: ${i.message}`)}if(typeof t!="object"||t===null)throw new at("Chain file must be a JSON object.");let n=t;if(n.version!==A0)throw new at(`Unsupported chain version: ${String(n.version)}`);if(!Array.isArray(n.nodes))throw new at("Chain file is missing a `nodes` array.");let r=n.nodes.map(_1);return{version:A0,nodes:r}}function C0(e){return typeof e=="object"&&e!==null}function E1(e,t){if(typeof e.type!="string"||!Yo.has(e.type))throw new at(`Node ${t} has unknown effect type: ${String(e.type)}`);return e.type}function A1(e,t){if(typeof e.id!="string"||e.id==="")throw new at(`Node ${t} is missing an id.`);return e.id}function _1(e,t){if(!C0(e))throw new at(`Node ${t} is not an object.`);let n=e,r=E1(n,t),i=A1(n,t),o=C0(n.params)?n.params:{};return w1({type:r,id:i,enabled:n.enabled===!1?!1:void 0,params:o})}function w1(e){for(let t of Object.keys(e))e[t]===void 0&&delete e[t];return e}var C1="data-vfx-ref-visible",T1="[HyperFrames] composition script error:",R1={preserveDrawingBuffer:!0,antialias:!1,premultipliedAlpha:!0,alpha:!0},k1=`#version 300 es\nout vec2 v_uv;\nvoid main() {\n vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));\n v_uv = p;\n gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);\n}\n`,Jt=[],H0=30,G0=0,nu=0,B0=-1,Zl=null,eu=null;function $e(e){console.error(T1,`vfx: ${e}`)}function L0(e,t,n){let r=e.createShader(t);return r?(e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:($e(`shader failed to compile: ${e.getShaderInfoLog(r)??"(no log)"}`),e.deleteShader(r),null)):null}function M1(e,t){let n=L0(e,e.VERTEX_SHADER,k1),r=n?L0(e,e.FRAGMENT_SHADER,t):null;if(!n||!r)return null;let i=e.createProgram();return i?(e.attachShader(i,n),e.attachShader(i,r),e.linkProgram(i),e.deleteShader(n),e.deleteShader(r),e.getProgramParameter(i,e.LINK_STATUS)?i:($e(`program failed to link: ${e.getProgramInfoLog(i)??"(no log)"}`),e.deleteProgram(i),null)):null}var F0="position:absolute;inset:0;width:100%;height:100%;pointer-events:none;";function N1(e){let t=e.querySelector("canvas.hf-vfx-out");if(pr(t))return t.style.cssText=F0+t.style.cssText,t;let n=document.createElement("canvas");return n.className="hf-vfx-out",n.style.cssText=F0,e.appendChild(n),n}function L1(e,t,n){let r={};for(let i of n.params)i.kind!=="ref"&&(r[i.key]=e.getUniformLocation(t,`u_${i.key}`));return{size:e.getUniformLocation(t,"u_size"),t:e.getUniformLocation(t,"u_t"),fps:e.getUniformLocation(t,"u_fps"),src:e.getUniformLocation(t,"u_src"),src2:e.getUniformLocation(t,"u_src2"),hasSrc2:e.getUniformLocation(t,"u_hasSrc2"),params:r}}function F1(e,t,n,r){return r.optional?{kind:"none"}:($e(`${vt(e)}: node "${t.id}" (${n.id}) needs a "${r.key}" param naming the id of the element to read as its second source.`),{kind:"error"})}function D1(e,t,n,r,i,o){let a=n.params.find(m=>m.kind==="ref");if(!a)return{kind:"none"};let l=r[a.key];if(typeof l!="string"||l==="")return F1(e,t,n,a);let s=e.ownerDocument.getElementById(l);if(!ye(s))return $e(`${vt(e)}: node "${t.id}" (${n.id}) names "${a.key}" element #${l}, which is not in the composition.`),{kind:"error"};if(s===e)return a.optional?{kind:"none"}:{kind:"self"};let u=o.get(s);if(u)return{kind:"source",source:u};let d=U0(s,i,`${vt(e)}: "${a.key}" source`);return d?(d.visible=d.canvas.hasAttribute(C1),o.set(s,d),{kind:"source",source:d}):{kind:"error"}}function I1(e,t,n){let r=[],i=new Map;for(let o of Ql(t)){let a=T0(o.type);if(!a)return $e(`node "${o.id}" has unknown effect type "${o.type}"`),null;let l=M1(e,a.frag);if(!l)return $e(`node "${o.id}" (${a.id}) has no usable program`),null;let s=R0(a.id,o.params),u=D1(n,o,a,s,e,i);if(u.kind==="error")return null;r.push({node:o,def:a,program:l,params:s,locations:L1(e,l,a),...u.kind==="source"?{ref:u.source}:{},selfRef:u.kind==="self"})}return r}function P1(e){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function O1(e){let t=e.parentElement;if(!t||e.id==="")return null;let n=t.children;for(let r=0;r<n.length;r++){let i=n.item(r);if(pr(i)&&i.classList.contains("hf-vfx-src")&&i.getAttribute("data-vfx-for")===e.id)return i}return null}function U0(e,t,n){let r=O1(e),i=r??e.querySelector("canvas.hf-vfx-src"),o=pr(i)?i.querySelector(":scope > .hf-vfx-in"):null;if(!pr(i)||!ye(o)){$e(`${n}: a capturing chain needs <canvas layoutsubtree class="hf-vfx-src"><div class="hf-vfx-in">\\u2026</div></canvas> in source \\u2014 inside the element for its own pixels, or beside it with data-vfx-for="${e.id}" for the layers below it.`);return}let a=i.getContext("2d");if(!a||typeof a.drawElementImage!="function"){$e(`${n}: drawElementImage is unavailable, so the layer cannot be captured. In Studio, enable chrome://flags/#canvas-draw-element.`);return}return{canvas:i,inner:o,ctx:a,texture:P1(t),backdrop:r!==null,visible:!1,emptyBoxReported:!1}}function H1(e){e.out.addEventListener("webglcontextlost",t=>{t.preventDefault(),!(!Jt.includes(e)||e.contextLost)&&(e.contextLost=!0,$e(`${vt(e.host)}: WebGL context lost.`))})}function G1(e){try{return N0(e.getAttribute(Jl)??"")}catch(t){let n=t instanceof at?t.message:String(t);return $e(`${vt(e)}: ${n}`),null}}function B1(e){let t=G1(e);if(!t)return null;let n=N1(e),r=n.getContext("webgl2",R1);if(!r)return $e(`${vt(e)}: WebGL2 is unavailable, so the chain cannot paint.`),n.remove(),null;let i=I1(r,t,e);if(!i)return n.remove(),null;let o=M0(t),a=o==="none"?void 0:U0(e,r,vt(e));if(o!=="none"&&!a)return n.remove(),null;let l=a?.backdrop?"backdrop":o,s={host:e,chain:t,capture:l,out:n,gl:r,passes:i,src:a,contextLost:!1};return H1(s),s}function ru(e){let t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function W0(e){if(getComputedStyle(e.inner).visibility==="hidden")return!1;for(let t=e.inner;t;t=t.parentElement)if(getComputedStyle(t).display==="none")return!1;return!0}function vt(e){return e.id?`#${e.id}`:`<${e.tagName.toLowerCase()}>`}function fi(e){let t=e.src?[e.src]:[];for(let n of e.passes)n.ref&&!t.includes(n.ref)&&t.push(n.ref);return t}function iu(e){return e.src?.backdrop===!0}function di(e){let t=[];for(let n of e.passes)n.ref?.visible&&!t.includes(n.ref)&&t.push(n.ref);return t}function U1(){for(let e of Jt){let{gl:t}=e;for(let n of e.passes)t.deleteProgram(n.program);for(let n of fi(e))t.deleteTexture(n.texture);if(e.ping){for(let n of e.ping.textures)t.deleteTexture(n);for(let n of e.ping.framebuffers)t.deleteFramebuffer(n)}}}function Jo(e,t){U1(),Jt=[],H0=Number.isFinite(t)&&t>0?t:30;let n=e.querySelectorAll(`[${Jl}]`);for(let r of n){if(!ye(r))continue;let i=B1(r);i&&Jt.push(i)}return Jt}function Xn(e){let t=typeof window>"u"?1:window.devicePixelRatio||1,n=Math.round(e.offsetWidth*t),r=Math.round(e.offsetHeight*t);return n>0&&r>0?{width:n,height:r}:null}function D0(e,t,n){let r=e.createTexture();e.bindTexture(e.TEXTURE_2D,r),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,n,0,e.RGBA,e.UNSIGNED_BYTE,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);let i=e.createFramebuffer();return e.bindFramebuffer(e.FRAMEBUFFER,i),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0),[r,i]}function W1(e,t,n){let r=e.ping;if(r&&r.width===t&&r.height===n)return r;let{gl:i}=e;if(r){for(let s of r.textures)i.deleteTexture(s);for(let s of r.framebuffers)i.deleteFramebuffer(s)}let o=D0(i,t,n),a=D0(i,t,n),l={textures:[o[0],a[0]],framebuffers:[o[1],a[1]],width:t,height:n};return e.ping=l,l}function V1(e,t,n){if(e.kind==="ref")return null;if(e.kind==="number"&&e.animatable){let i=n.getPropertyValue(`--vfx-${t.node.id}-${e.key}`).trim(),o=i===""?Number.NaN:Number.parseFloat(i);if(Number.isFinite(o))return Math.min(e.max,Math.max(e.min,o))}let r=t.params[e.key];return typeof r=="boolean"?r?1:0:typeof r=="number"?r:0}function $1(e,t,n,r,i,o){let{gl:a}=e,{locations:l}=t;a.uniform2f(l.size,i,o),a.uniform1f(l.t,r),a.uniform1f(l.fps,H0),a.uniform1f(l.hasSrc2,t.ref||t.selfRef?1:0);for(let s of t.def.params){let u=V1(s,t,n);u!==null&&a.uniform1f(l.params[s.key]??null,u)}}function z1(e,t,n){return e===t||!n?null:n.framebuffers[e%2]??null}function q1(e,t,n){return t===0?e.src?.texture??null:n?.textures[(t-1)%2]??null}function j1(e,t,n,r){let{gl:i}=e,o=e.passes[t];i.bindFramebuffer(i.FRAMEBUFFER,z1(t,n,r));let a=q1(e,t,r);a&&I0(i,o.locations.src,a,0),o.ref?(I0(i,o.locations.src2,o.ref.texture,1),i.activeTexture(i.TEXTURE0)):o.selfRef&&a&&i.uniform1i(o.locations.src2,0)}function I0(e,t,n,r){e.activeTexture(r===0?e.TEXTURE0:e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,n),e.uniform1i(t,r)}function ou(e,t){let n=Xn(e.host);if(!n)return;let{gl:r,out:i,passes:o}=e;i.width!==n.width&&(i.width=n.width),i.height!==n.height&&(i.height=n.height);let a=o.length>1?W1(e,n.width,n.height):null,l=getComputedStyle(e.host),s=o.length-1;for(let u=0;u<=s;u++){let d=o[u];r.useProgram(d.program),j1(e,u,s,a),r.viewport(0,0,n.width,n.height),$1(e,d,l,t,n.width,n.height),r.drawArrays(r.TRIANGLES,0,3)}}function P0(e,t){e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t.texture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.canvas),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0)}var K1={upload:!0,keepBitmap:!1},X1={upload:!1,keepBitmap:!0},Y1={upload:!0,keepBitmap:!0},J1={upload:!1,keepBitmap:!0};function O0(e,t){e.canvas.width!==t.width&&(e.canvas.width=t.width),e.canvas.height!==t.height&&(e.canvas.height=t.height)}function au(e,t,n,r,i){if(!W0(t))return O0(t,n),t.ctx.clearRect(0,0,n.width,n.height),i.upload&&P0(e.gl,t),!0;if(Xn(t.inner)===null)return t.emptyBoxReported||(t.emptyBoxReported=!0,$e(`${vt(e.host)}: the .hf-vfx-in wrapper measures 0\\xD70, so its capture would be empty. Inside a layoutsubtree canvas an inset or percentage box has no size \\u2014 the wrapper must state an explicit width and height in px.`)),!1;O0(t,n),t.ctx.clearRect(0,0,n.width,n.height);try{t.ctx.drawElementImage(t.inner,0,0,n.width,n.height)}catch(o){return r||$e(`${vt(e.host)}: drawElementImage failed: ${o.message} In Studio, enable chrome://flags/#canvas-draw-element.`),!1}return i.upload&&P0(e.gl,t),i.keepBitmap||t.ctx.clearRect(0,0,n.width,n.height),!0}function V0(e,t){return e.visible?Xn(e.inner)??t:t}function $0(e,t=!1){let n=Xn(e.host),r=fi(e);if(!n||r.length===0)return!1;let i=!0;for(let o of r){let a=o.visible?Y1:K1;au(e,o,V0(o,n),t,a)||(i=!1)}return i}function z0(e,t=!1){let n=e.src;if(!n)return!1;let r=Xn(e.host)??Xn(n.inner);return r?au(e,n,r,t,X1):!1}function tu(e,t=!1){let n=!0;for(let r of di(e)){let i=V0(r,{width:0,height:0});au(e,r,i,t,J1)||(n=!1)}return n}function Q1(e){let t=!1;return iu(e)&&z0(e)&&(t=!0),di(e).length>0&&tu(e)&&(t=!0),t}function Z1(){let e=!1;for(let t of Jt)if(!t.contextLost&&fi(t).length!==0){if(!ru(t.host)){Q1(t)&&(e=!0);continue}$0(t)&&(ou(t,G0),e=!0)}return B0=nu,window.__hf_page_composite_pending=!1,e}function ew(){let e=window,t=e.__hf_page_composite_resolve;t!==Zl&&(eu=typeof t=="function"?t:null,Zl=()=>{let n=eu?eu():!1;return Z1()||n},e.__hf_page_composite_resolve=Zl),e.__hf_page_composite_pending=!0}var q0=2e3;function tw(e){return new Promise(t=>{let n=!1,r=a=>{n||(n=!0,clearTimeout(o),e.removeEventListener("paint",i),t(a))},i=()=>r("painted"),o=setTimeout(()=>r("timeout"),q0);e.addEventListener("paint",i,{once:!0});try{e.requestPaint?.()}catch{}if(typeof requestAnimationFrame!="function"){r("painted");return}requestAnimationFrame(()=>requestAnimationFrame(()=>r("painted")))})}async function nw(e,t){return(await Promise.all(t.map(r=>tw(r.canvas)))).includes("timeout")?($e(`${vt(e.host)}: no paint arrived within ${q0}ms, so this frame\'s capture was skipped (a BeginFrame-controlled compositor without a tick for this frame is a known cause).`),!1):!0}function rw(e){return ru(e.host)?"paint":iu(e)?"passThrough":"refOnly"}function iw(e,t){return(t==="passThrough"?[...e.src?[e.src]:[],...di(e)]:t==="refOnly"?di(e):fi(e)).filter(W0)}function ow(e,t){return t!==nu||B0===t?!1:Jt.includes(e)&&!e.contextLost}async function aw(e,t,n,r){let i=rw(e);if(await nw(e,iw(e,i))&&ow(e,n)){if(i==="passThrough"){z0(e,r),tu(e,r);return}if(i==="refOnly"){tu(e,r);return}$0(e,r)&&ou(e,t)}}async function sw(e,t,n,r){await Promise.all(e.map(i=>aw(i,t,n,r)))}function su(e,t){G0=e;let n=++nu,r=[];for(let i of Jt)if(!i.contextLost){if(!ru(i.host)){(iu(i)||di(i).length>0)&&r.push(i);continue}fi(i).length>0?r.push(i):ou(i,e)}r.length!==0&&(t?.engineMode&&ew(),_t(sw(r,e,n,t?.engineMode===!0)))}var lw=500,uw=33,cw=3,Qo=class{constructor(t){ue(this,"_baseTime",0);ue(this,"_playStartMs",null);ue(this,"_rate",1);ue(this,"_duration",1/0);ue(this,"_playStart",0);ue(this,"_playEnd",1/0);ue(this,"_playHold",1/0);ue(this,"_nowMs");ue(this,"_audioSource",null);ue(this,"_lastReadMs",null);ue(this,"_lastNow",0);this._baseTime=t?.initialTime??0,this._rate=t?.rate??1,this._duration=t?.duration??1/0,this._nowMs=t?.nowMs??(()=>performance.now())}now(){if(this._playStartMs===null)return this._baseTime;if(this._audioSource){let r=null;if("currentTimeSeconds"in this._audioSource?r=this._audioSource.currentTimeSeconds:r=this._elementTimeNeverBehind(this._audioSource),r!==null){let i=Math.min(r,this.getEnd());return this._baseTime=Math.max(0,i),this._playStartMs=this._nowMs(),this._lastReadMs=null,this._lastNow=this._baseTime,this._baseTime}}this._applyStallCorrection();let t=(this._nowMs()-this._playStartMs)/1e3,n=this._baseTime+t*this._rate;return this._lastNow=Math.max(0,Math.min(n,this.getEnd())),this._lastNow}_elementTimeNeverBehind(t){let{el:n,compositionStart:r,mediaStart:i,rate:o}=t;if(n.paused||!Number.isFinite(n.currentTime))return null;if(n.seeking)return this._lastNow;let a=o??1,l=dn(a,n.currentTime-i)+r;return l>=this._lastNow?l:this._heldTimeWhenBehind(n,this._lastNow-l,a)}_heldTimeWhenBehind(t,n,r){return t.loop&&n>dn(r,t.duration)/2?null:t.readyState<cw||n<=hs?this._lastNow:null}_applyStallCorrection(){if(this._playStartMs===null)return;let t=this._nowMs();if(this._lastReadMs!==null){let n=t-this._lastReadMs;n>lw&&(this._playStartMs+=n-uw)}this._lastReadMs=t}play(){return this._playStartMs!==null||this._baseTime>=this.getEnd()?!1:(this._playStartMs=this._nowMs(),this._lastNow=this._baseTime,this._lastReadMs=null,!0)}pause(){return this._playStartMs===null?!1:(this._baseTime=this.now(),this._playStartMs=null,!0)}seek(t){let n=Number.isFinite(this._duration)?Math.max(0,Math.min(t,this._duration)):Math.max(0,t);this._baseTime=n,this._lastNow=n,this._playStartMs!==null&&(this._playStartMs=this._nowMs(),this._lastReadMs=null)}isPlaying(){return this._playStartMs!==null}setRate(t){let n=Number.isFinite(t)&&t>0?Math.max(.1,Math.min(5,t)):1;this._playStartMs!==null&&(this._baseTime=this.now(),this._playStartMs=this._nowMs(),this._lastReadMs=null),this._rate=n}getRate(){return this._rate}setDuration(t){this._duration=Number.isFinite(t)&&t>0?t:1/0,this._baseTime>this._duration&&(this._baseTime=this._duration)}getDuration(){return this._duration}setPlayRange(t,n,r){this._playStart=Number.isFinite(t)&&t>0?t:0,this._playEnd=n!==null&&Number.isFinite(n)&&n>this._playStart?n:1/0,this._playHold=Gc(this._playStart,this._playEnd,r)}getPlayStart(){return this._playStart}getEnd(){return Math.min(this._duration,this._playEnd)}getStopTime(){return this._playEnd<this._duration?this._playHold:this.getEnd()}attachAudioSource(t){this._audioSource=t}detachAudioSource(){this._audioSource&&this._playStartMs!==null&&(this._baseTime=this.now(),this._playStartMs=this._nowMs(),this._lastReadMs=null),this._audioSource=null}audioElement(){return this._audioSource&&"el"in this._audioSource?this._audioSource.el:null}hasAudioSource(){return this._audioSource!==null}getSource(){if(this._audioSource&&this._playStartMs!==null){if("currentTimeSeconds"in this._audioSource)return"audio";let{el:t}=this._audioSource;if(!t.paused&&Number.isFinite(t.currentTime))return"audio"}return"monotonic"}snapshot(){return{time:this.now(),playing:this.isPlaying(),rate:this._rate,duration:this._duration,source:this.getSource()}}reachedEnd(){let t=this.now();return t>=this.getEnd()||this._playStartMs===null&&t>=this.getStopTime()}};var dw=100,fw=8,mw=4096,lu=e=>e;function pw(e,t,n){return!(!!e.curve||e.viaX!==void 0&&e.viaY!==void 0)&&t==="linear"&&!n}function hw(e){let t=Math.ceil(e*dw);return Math.min(mw,Math.max(fw,t))}function gw(e,t,n,r,i){let{scheduledAt:o,elapsed:a,rate:l}=r,s=i??lu,u=_=>o+(_-a)/l,d=e.points[t],m=e.points[t+1],f=u(m.t);if(f<=o)return null;let b=Math.max(o,u(d.t)),p=f-b;if(p<=0)return null;if(pw(d,n,i))return{kind:"ramp",time:f,value:s(m.v)};let y=hw(p),x=Yd(e,Math.max(d.t,a),m.t,y,n),v=new Float32Array(y);for(let _=0;_<y;_+=1)v[_]=s(x[_]??0);return{kind:"curve",time:b,duration:p,values:v}}function bw(e,t,n,r){let i=[];for(let a=0;a+1<e.points.length;a+=1){let l=gw(e,a,t,n,r);l&&i.push(l)}let o=i[0];return o?.kind==="curve"&&o.time<=n.scheduledAt||i.unshift({kind:"set",time:n.scheduledAt,value:(r??lu)(Rt(e,n.elapsed,t))}),i}function xw(e,t){for(let n of t)if(n.kind==="set")e.setValueAtTime(n.value,n.time);else if(n.kind==="ramp")e.linearRampToValueAtTime(n.value,n.time);else try{e.setValueCurveAtTime(n.values,n.time,n.duration)}catch{let r=n.values[n.values.length-1]??0;e.linearRampToValueAtTime(r,n.time+n.duration)}}function mi(e){for(let t of e)t.param.cancelScheduledValues(0)}function Yn(e,t){for(let n of e)typeof n.param.cancelAndHoldAtTime=="function"?n.param.cancelAndHoldAtTime(t):n.param.cancelScheduledValues(t)}function uu(e,t,n,r){if(t.points.length!==0)for(let i of e){if(mi([i]),Xd(t)){let o=(i.map??lu)(t.points[0].v);i.param.setValueAtTime(o,r.scheduledAt);continue}xw(i.param,bw(t,n,r,i.map))}}function j0(e,t,n,r,i){let o=new Map(n.filter(l=>l.id).map(l=>[l.id,l.handle])),a=[];for(let l of e.lanes){let s=Ar(l.target);if(!s)continue;let u=s.kind==="preset"?i?.[s.presetId]:s.kind==="fx"?o.get(s.nodeId)?.automation?.[s.param]:void 0;if(!u||u.length===0)continue;let d=es(l.target,t);d&&(uu(u,l,d.scale,r),a.push(...u))}return a}function K0(e){return e.lanes.find(t=>t.target===Nn)??null}var yw=`\nconst dbToLin = (db) => Math.pow(10, db / 20);\n\n/**\n * One-pole envelope followers, one per channel.\n *\n * Per channel matters: the followers advance once per sample, so a single shared\n * follower stepped once per channel per sample. On stereo that ran a 20 ms attack\n * as 10 ms, and gave the right channel a gain computed from an envelope that had\n * already traversed the left \\u2014 so the two channels ducked by different amounts\n * from the same input and the image pumped.\n */\nclass EnvBank {\n constructor(attackMs, releaseMs) { this.set(attackMs, releaseMs); this.values = []; }\n set(attackMs, releaseMs) {\n this.a = Math.exp(-1 / (sampleRate * Math.max(1e-5, attackMs / 1000)));\n this.r = Math.exp(-1 / (sampleRate * Math.max(1e-5, releaseMs / 1000)));\n }\n push(ch, x) {\n const prev = this.values[ch] ?? 0;\n const m = Math.abs(x);\n const c = m > prev ? this.a : this.r;\n const next = m + c * (prev - m);\n this.values[ch] = next;\n return next;\n }\n}\n\n/** Soft-knee gain computer in dB, matching acompressor\'s shape. */\nfunction kneeGain(envDb, thresholdDb, ratio, kneeDb) {\n const over = envDb - thresholdDb;\n if (kneeDb > 0 && over > -kneeDb && over < kneeDb) {\n const t = (over + kneeDb) / (2 * kneeDb);\n return -((1 - 1 / ratio) * kneeDb * t * t);\n }\n return over > 0 ? -(over * (1 - 1 / ratio)) : 0;\n}\n\n// log10/exp per sample is the single most expensive thing a dynamics processor\n// can do on the audio thread, and every sample below the knee needs neither:\n// its gain is exactly unity. Comparing envelopes in the linear domain lets the\n// quiet majority of samples skip the transcendentals entirely.\nconst LN10_OVER_20 = Math.LN10 / 20;\nconst dbToLinFast = (db) => Math.exp(db * LN10_OVER_20);\n\nclass HfCompressor extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 20, this.p.release ?? 250);\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 20, this.p.release ?? 250);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const makeup = dbToLin(p.makeup ?? 0);\n const mix = p.mix ?? 1;\n // Knee is expressed as a ratio in FFmpeg; convert to dB width.\n const kneeDb = 20 * Math.log10(Math.max(1.0001, p.knee ?? 2.83));\n const thresholdDb = p.threshold ?? -24;\n const ratio = p.ratio ?? 4;\n // Below this the gain computer returns unity, so the sample needs no\n // logarithm at all.\n const kneeStartLin = dbToLin(thresholdDb - kneeDb);\n const dry = 1 - mix;\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n // Per-channel follower, and the sub-knee shortcut: below the knee the\n // gain is exactly unity, so the sample needs no logarithm at all.\n const env = this.env.push(ch, x);\n if (env <= kneeStartLin) {\n out[n] = x * makeup * mix + x * dry;\n continue;\n }\n const envDb = 20 * Math.log10(env);\n const g = dbToLinFast(kneeGain(envDb, thresholdDb, ratio, kneeDb));\n out[n] = x * g * makeup * mix + x * dry;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-compressor", HfCompressor);\n\nclass HfLimiter extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 5, this.p.release ?? 50);\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 5, this.p.release ?? 50);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const ceiling = dbToLin(this.p.limit ?? -1);\n const outGain = dbToLin(this.p.level_out ?? 0);\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n const env = this.env.push(ch, x);\n // Only ever attenuate: a limiter that can raise level is a compressor.\n const g = env > ceiling ? ceiling / env : 1;\n out[n] = x * g * outGain;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-limiter", HfLimiter);\n\nclass HfGate extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 1, this.p.release ?? 100);\n this.gains = [];\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 1, this.p.release ?? 100);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const threshold = dbToLin(p.threshold ?? -35);\n const floor = dbToLin(p.range ?? -24);\n const ratio = p.ratio ?? 10;\n // Knee is declared in the registry as a ratio, like the compressor\'s; a\n // hard threshold ignored it and chattered on material sitting right at the\n // gate point.\n const kneeDb = 20 * Math.log10(Math.max(1.0001, p.knee ?? 2.83));\n const kneeLin = dbToLin((p.threshold ?? -35) + kneeDb);\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n const env = this.env.push(ch, x);\n let target = 1;\n // Above the threshold the gate is fully open; skip the pow entirely.\n if (env < threshold) {\n const under = env > 1e-9 ? threshold / env : 1e9;\n target = Math.max(floor, 1 / Math.pow(under, ratio - 1));\n if (!isFinite(target)) target = floor;\n }\n // Smooth toward the target so the gate does not click on every sample.\n const held = this.gains[ch] ?? 1;\n const c = target < held ? this.env.r : this.env.a;\n const smoothed = target + c * (held - target);\n this.gains[ch] = smoothed;\n out[n] = x * smoothed;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-gate", HfGate);\n\nclass HfBitcrush extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.holds = [];\n this.held = [];\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const levels = Math.pow(2, (p.bits ?? 8) - 1);\n const step = Math.max(1, Math.round(p.samples ?? 1));\n const mix = p.mix ?? 1;\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n if (this.held[ch] === undefined) this.held[ch] = 0;\n if (this.holds[ch] === undefined) this.holds[ch] = 0;\n for (let n = 0; n < inp.length; n++) {\n // Per channel: advancing one shared counter only on the last channel\n // left every earlier channel either unheld or frozen for a whole\n // 128-sample quantum, clicking once a block.\n if (this.holds[ch] === 0) this.held[ch] = Math.round(inp[n] * levels) / levels;\n out[n] = this.held[ch] * mix + inp[n] * (1 - mix);\n this.holds[ch] = (this.holds[ch] + 1) % step;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-bitcrush", HfBitcrush);\n\n/** Linear-interpolated read, \\`delaySamples\\` behind the write head. */\nfunction readTap(ring, write, delaySamples) {\n const len = ring.length;\n const pos = (write - 1 - delaySamples + len) % len;\n const i0 = Math.floor(pos);\n const frac = pos - i0;\n const i1 = (i0 + 1) % len;\n return ring[i0] * (1 - frac) + ring[i1] * frac;\n}\n\n/** Equal-power-ish crossfade, zero at a tap\'s reset point \\u2014 hides the splice. */\nfunction xfade(phase) {\n return Math.sin(Math.PI * phase);\n}\n\n/**\n * Dual-tap granular delay line: two read taps 180\\xB0 apart in a 100 ms grain,\n * each sweeping at a speed relative to the write head that shifts pitch\n * without changing duration. One tap is always fading in as the other fades\n * out, which hides the splice each tap makes when it wraps.\n *\n * write/phase are block-level state, advanced once per SAMPLE across all\n * channels together (not once per channel) \\u2014 advancing them inside the\n * per-channel loop would move the tap 2x/4x too fast on a stereo/quad input.\n */\nclass HfPitchshift extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.grain = Math.round(sampleRate * 0.1);\n this.buf = [];\n this.write = 0;\n this.phase = 0;\n // Samples written so far, capped at one grain. The taps read up to a grain\n // behind the write head, so until this fills they would read the ring\'s\n // zeros \\u2014 the head of every clip came out attenuated or silent.\n this.filled = 0;\n // How much of the wet (pitch-shifted) path is currently in the output, and\n // where it is heading. Crossing between dry and wet is a ~50 ms jump in the\n // signal, so it is RAMPED rather than switched: a hard swap either way is a\n // click. Ramping in both directions is also what lets a node return to true\n // bypass at semitones 0 \\u2014 a one-way latch left preview stuck with the delay\n // that the render, building a fresh node from the attribute, does not have.\n this.wet = 0;\n this.wetTarget = 0;\n // ~15 ms one-pole, short enough to feel immediate on a slider drag and long\n // enough that the splice is inaudible.\n this.wetCoef = Math.exp(-1 / (sampleRate * 0.015));\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const semitones = Math.max(-12, Math.min(12, p.semitones ?? 0));\n const mix = Math.max(0, Math.min(1, p.mix ?? 1));\n const grain = this.grain;\n const ringLen = grain * 2;\n const n = i[0] ? i[0].length : 0;\n for (let ch = 0; ch < i.length; ch++) {\n if (!this.buf[ch]) this.buf[ch] = new Float32Array(ringLen);\n }\n\n // Nothing to shift, or mixed fully out. The grain delay is ~grain/2\n // whatever the ratio, so at semitones=0 this degenerated into a pure 50 ms\n // delay of the signal \\u2014 while the copy for that exact setting reads\n // "Unchanged pitch".\n this.wetTarget = semitones === 0 ? 0 : mix;\n\n // Fully dry AND settled: take the cheap transparent path. The ring keeps\n // filling, so a later shift does not start cold.\n if (this.wetTarget === 0 && this.wet < 1e-4) {\n this.wet = 0;\n let w = this.write;\n for (let s = 0; s < n; s++) {\n for (let ch = 0; ch < i.length; ch++) {\n const x = i[ch][s];\n this.buf[ch][w] = x;\n o[ch][s] = x;\n }\n w = (w + 1) % ringLen;\n }\n this.write = w;\n this.filled = Math.min(grain, this.filled + n);\n return true;\n }\n\n const ratio = Math.pow(2, semitones / 12);\n const inc = (1 - ratio) / grain;\n let write = this.write, phase = this.phase, filled = this.filled, wetNow = this.wet;\n const target = this.wetTarget, coef = this.wetCoef;\n for (let s = 0; s < n; s++) {\n phase += inc;\n phase -= Math.floor(phase);\n const phaseB = (phase + 0.5) % 1;\n const gA = xfade(phase), gB = xfade(phaseB);\n // Ramp the wet path in as the ring fills rather than reading zeros:\n // 100 ms of unshifted audio at the head of a clip beats 50 ms of silence.\n const warm = filled >= grain ? 1 : filled / grain;\n wetNow = target + coef * (wetNow - target);\n const wetMix = wetNow * warm;\n for (let ch = 0; ch < i.length; ch++) {\n const ring = this.buf[ch];\n const inp = i[ch], out = o[ch];\n const x = inp[s];\n ring[write] = x;\n const wet =\n readTap(ring, write, phase * grain) * gA + readTap(ring, write, phaseB * grain) * gB;\n out[s] = x * (1 - wetMix) + wet * wetMix;\n }\n write = (write + 1) % ringLen;\n if (filled < grain) filled++;\n }\n this.write = write;\n this.phase = phase;\n this.filled = filled;\n this.wet = wetNow;\n return true;\n }\n}\nregisterProcessor("hf-pitchshift", HfPitchshift);\n`,cu=new WeakMap;function du(e){return X0.has(e)}var X0=new WeakSet;function fu(e){let t=cu.get(e);return t||(t=(async()=>{if(!e.audioWorklet)throw new Error("AudioWorklet is unavailable \\u2014 the page needs a secure context (https, localhost or file://)");let n=`data:text/javascript;base64,${btoa(String.fromCharCode(...new TextEncoder().encode(yw)))}`;await e.audioWorklet.addModule(n),X0.add(e)})().catch(n=>{throw cu.delete(e),n}),cu.set(e,t)),t}function Sw(e,t,n){let r=.6+Math.max(0,Math.min(1,t))*2.6,i=Math.max(1,Math.floor(e*r)),o=new Float32Array(i),a=Math.round(t*1e3)*2654435761+Math.round(n*1e3)*40503>>>0,l=()=>(a=a*1664525+1013904223>>>0,a/4294967295*2-1),s=Math.max(.001,1-Math.max(0,Math.min(1,n))),u=0,d=0;for(let f=0;f<i;f++){u+=s*(l()-u);let b=u*Math.pow(1-f/i,2.5);o[f]=b,d+=b*b}let m=Math.sqrt(d);if(m>0)for(let f=0;f<i;f++)o[f]=(o[f]??0)/m;return o}var ve=e=>typeof e=="number"?e:Number(e??0),mu=e=>e/1e3;function Z0(e,t,n,r){let i=Math.max(1,Math.round(e.sampleRate)),o=e.createBuffer(1,i,e.sampleRate),a=o.getChannelData(0);for(let u=0;u<i;u++){let d=u/i;a[u]=t==="sine"?Math.sin(2*Math.PI*d):4*Math.abs((d+.75)%1-.5)-1}let l=e.createBufferSource();l.buffer=o,l.loop=!0,l.playbackRate.value=n;let s=(r*n%1+1)%1*(i/e.sampleRate);return l.start(typeof e.currentTime=="number"?e.currentTime:0,s),l}function eg(e){try{e.stop()}catch{}e.disconnect()}function pu(e,t){return[{param:e},{param:t,map:n=>1-n}]}function tg(e,t,n){e.gain.value=n,t.gain.value=1-n}function hu(e,t,n){return{input:e,output:e,update:t,automation:n,dispose:()=>e.disconnect()}}var vw=new Set(["peaking","highpass","lowpass"]),Y0=e=>Math.pow(10,e/20),Ew=(e,t)=>{let n=e.createGain(),r=i=>{n.gain.value=Y0(ve(i.gain))};return r(t),hu(n,r,{gain:[{param:n.gain,map:Y0}]})};function pi(e,t){return(n,r)=>{let i=n.createBiquadFilter();i.type=e;let o=a=>{i.frequency.value=ve(a.frequency),a.q!==void 0&&(i.Q.value=ve(a.q)),t&&(i.gain.value=ve(a.gain))};return o(r),hu(i,o,{frequency:[{param:i.frequency}],...vw.has(e)?{q:[{param:i.Q}]}:{},...t?{gain:[{param:i.gain}]}:{}})}}function Aw(e){return(t,n)=>{let r=Math.tan(Math.PI*ve(n.frequency)/t.sampleRate),i=e==="highpass"?t.createIIRFilter([1/(1+r),-1/(1+r)],[1,(r-1)/(r+1)]):t.createIIRFilter([r/(1+r),r/(1+r)],[1,(r-1)/(r+1)]);return hu(i,()=>{})}}function hi(e){return(t,n)=>{let r=new AudioWorkletNode(t,e,{processorOptions:{...n}});return{input:r,output:r,update:i=>r.port.postMessage({...i}),dispose:()=>{r.port.postMessage({__hfDispose:!0}),r.disconnect()}}}}var _w={tanh:Math.tanh,atan:e=>2/Math.PI*Math.atan(Math.PI/2*e),cubic:e=>Math.abs(e)>=1?Math.sign(e):e-e**3/3,exp:e=>Math.sign(e)*(1-Math.exp(-Math.abs(e))),alg:e=>e/Math.sqrt(1+e*e),quintic:e=>Math.abs(e)>=1?Math.sign(e):e-e**5/5,sin:e=>Math.abs(e)>=1?Math.sign(e):Math.sin(Math.PI/2*e),erf:e=>Math.tanh(1.20211*e),hard:e=>Math.max(-1,Math.min(1,e))},ww=(e,t)=>{let n=e.createWaveShaper(),r=e.createGain(),i=e.createGain();r.connect(n).connect(i);let o=a=>{let l=_w[String(a.type)]??Math.tanh,s=Math.pow(10,ve(a.threshold)/20),u=8192,d=new Float32Array(u);for(let m=0;m<u;m++){let f=m/(u-1)*2-1;d[m]=l(f/Math.max(1e-6,s))*s}n.curve=d,n.oversample=ve(a.oversample)>=4?"4x":ve(a.oversample)>=2?"2x":"none",i.gain.value=Math.pow(10,ve(a.output)/20)};return o(t),{input:r,output:i,update:o,automation:{output:[{param:i.gain,map:a=>Math.pow(10,a/20)}]},dispose:()=>{r.disconnect(),n.disconnect(),i.disconnect()}}},Cw=(e,t)=>{let n=e.createGain(),r=e.createGain(),i=e.createDelay(5),o=e.createGain(),a=e.createGain(),l=e.createGain();n.connect(i),i.connect(o),o.connect(i),i.connect(a).connect(r),n.connect(l).connect(r);let s=u=>{i.delayTime.value=Math.min(5,ve(u.time)/1e3),o.gain.value=ve(u.feedback),tg(a,l,ve(u.mix))};return s(t),{input:n,output:r,update:s,automation:{time:[{param:i.delayTime,map:u=>Math.min(5,mu(u))}],feedback:[{param:o.gain}],mix:pu(a.gain,l.gain)},dispose:()=>[n,r,i,o,a,l].forEach(u=>u.disconnect())}},Tw=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createDelay(.5),a=Z0(e,"sine",ve(t.speed),n),l=e.createGain(),s=e.createGain(),u=e.createGain();a.connect(l).connect(o.delayTime),r.connect(o).connect(s).connect(i),r.connect(u).connect(i);let d=m=>{o.delayTime.value=ve(m.delay)/1e3,l.gain.value=ve(m.depth)/1e3,a.playbackRate.value=ve(m.speed),tg(s,u,ve(m.mix))};return d(t),{input:r,output:i,update:d,automation:{delay:[{param:o.delayTime,map:mu}],depth:[{param:l.gain,map:mu}],speed:[{param:a.playbackRate}],mix:pu(s.gain,u.gain)},dispose:()=>{eg(a),[r,i,o,l,s,u].forEach(m=>m.disconnect())}}},Rw=6,kw=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createGain(),a=e.createGain(),l=Z0(e,String(t.type)==="1"?"sine":"triangle",ve(t.speed),n),s=e.createGain(),u=e.createGain(),d=e.createGain(),m=[];r.connect(o);let f=o;for(let p=0;p<Rw;p++){let y=e.createBiquadFilter();y.type="allpass",y.Q.value=.7071,s.connect(y.frequency),f.connect(y),f=y,m.push(y)}l.connect(s),f.connect(u).connect(a),o.connect(d).connect(a),a.connect(i);let b=p=>{let y=1e3/Math.max(.1,ve(p.delay));for(let x of m)x.frequency.value=y;s.gain.value=y*ve(p.decay),l.playbackRate.value=ve(p.speed),o.gain.value=ve(p.in_gain),a.gain.value=ve(p.out_gain),u.gain.value=1,d.gain.value=1};return b(t),{input:r,output:i,update:b,automation:{speed:[{param:l.playbackRate}],in_gain:[{param:o.gain}],out_gain:[{param:a.gain}]},dispose:()=>{eg(l),[r,i,o,a,s,u,d,...m].forEach(p=>p.disconnect())}}},Mw=(e,t)=>{let n=e.createGain(),r=e.createGain(),i=e.createConvolver(),o=e.createGain(),a=e.createGain();i.normalize=!1,n.connect(i).connect(o).connect(r),n.connect(a).connect(r);let l="",s=u=>{let d=`${ve(u.size)}:${ve(u.damping)}`;if(d!==l){let m=Sw(e.sampleRate,ve(u.size),ve(u.damping)),f=e.createBuffer(1,m.length,e.sampleRate);f.getChannelData(0).set(m),i.buffer=f,l=d}o.gain.value=ve(u.wet),a.gain.value=ve(u.dry)};return s(t),{input:n,output:r,update:s,automation:{wet:[{param:o.gain}],dry:[{param:a.gain}]},dispose:()=>[n,r,i,o,a].forEach(u=>u.disconnect())}},Nw={"gain-node":Ew,"biquad-peaking":pi("peaking",!0),"biquad-lowshelf":pi("lowshelf",!0),"biquad-highshelf":pi("highshelf",!0),"biquad-highpass":pi("highpass",!1),"biquad-lowpass":pi("lowpass",!1),"worklet-compressor":hi("hf-compressor"),"worklet-limiter":hi("hf-limiter"),"worklet-gate":hi("hf-gate"),"worklet-bitcrush":hi("hf-bitcrush"),"worklet-pitchshift":hi("hf-pitchshift"),waveshaper:ww,"delay-feedback":Cw,"chorus-lfo":Tw,"allpass-phaser":kw,convolver:Mw};function ng(e){return e.nodes.some(t=>br(t.type)?.web.startsWith("worklet-")??!1)}function Lw(e,t,n,r=0){let i=br(t);if(!i)throw new Error(`Unknown effect type: ${t}`);let o=xr(t,n);if((t==="highpass"||t==="lowpass")&&String(o.poles)==="1")return Aw(t)(e,o,r);let a=Nw[i.web];if(!a)throw new Error(`No Web Audio builder for ${i.web}`);return a(e,o,r)}function J0(e){let t=[];for(let n of e){let r=n.fromPreset,i=t.at(-1);if(i&&i.preset===r)i.nodes.push(n);else{let o=typeof n.presetAmount=="number"?n.presetAmount:1;t.push({...r?{preset:r}:{},amount:Math.min(1,Math.max(0,o)),nodes:[n]})}}return t}function Q0(e){return yr(e).map(t=>{let n=xr(t.type,t.params),r=n.poles!==void 0?`:${n.poles}`:"",i=String(n.poles)==="1"?`@${n.frequency}`:"",o=t.type==="phaser"?`~${n.type}`:"",a=t.fromPreset?`%${t.fromPreset}`:"";return`${t.type}${r}${i}${o}${a}`}).join("|")}function rg(e,t,n=0){var m;let r=e.createGain(),i=e.createGain(),o=[],a=[],l=J0(yr(t)),s=r;for(let f of l){let b=null;if(f.preset){let p=e.createGain(),y=e.createGain(),x=e.createGain(),v=e.createGain();x.gain.value=f.amount,y.gain.value=1-f.amount,s.connect(p),p.connect(y).connect(v),b={entry:p,wet:x,dry:y,join:v},s=p}for(let p of f.nodes){let y=Lw(e,p.type,p.params??{},n);s.connect(y.input),s=y.output,o.push({...p.id?{id:p.id}:{},type:p.type,handle:y})}b&&f.preset&&(s.connect(b.wet).connect(b.join),a.push({id:f.preset,...b}),s=b.join)}s.connect(i);let u=Q0(t),d={};for(let f of a)(d[m=f.id]??(d[m]=[])).push(...pu(f.wet.gain,f.dry.gain));return{input:r,output:i,presets:d,nodes:o,update(f){if(Q0(f)!==u)return!1;yr(f).forEach((p,y)=>{let x=o[y];x&&(x.handle.update(xr(p.type,p.params)),p.id===void 0?delete x.id:x.id=p.id)});let b=0;for(let p of J0(yr(f))){if(!p.preset)continue;let y=a[b++];!y||y.id!==p.preset||(y.wet.gain.value=p.amount,y.dry.gain.value=1-p.amount)}return!0},dispose(){for(let{handle:f}of o)f.dispose();for(let{entry:f,wet:b,dry:p,join:y}of a)f.disconnect(),b.disconnect(),p.disconnect(),y.disconnect();r.disconnect(),i.disconnect()}}}var ig={version:1,nodes:[]},og={version:1,lanes:[]};function ag(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(Tt):null)??"";if(!n)return og;try{return Kd(Ji(n),t)}catch{return og}}function Jn(e){let t=(typeof e.getAttribute=="function"?e.getAttribute(cn):null)??"";if(!t)return{chain:ig,raw:""};try{return{chain:Pd(t),raw:t}}catch{return{chain:ig,raw:""}}}function sg(e){return ag(e,Jn(e).chain)}function Zo(e,t,n,r,i){let{chain:o}=Jn(t),a=null,l=[],s=!1,u=0,d=()=>{try{a?(n.disconnect(a.input),a.output.disconnect(r),a.dispose()):n.disconnect(r)}catch{}a=null},m=(w,I)=>{if(w.nodes.length===0){n.connect(r);return}if(ng(w)&&!du(e)){n.connect(r);let D=++u;fu(e).then(()=>{s||D!==u||x(Jn(t).chain)}).catch(()=>{});return}try{let D=rg(e,w,I);n.connect(D.input),D.output.connect(r),a=D}catch{n.connect(r)}},f=(w,I)=>{l=I&&a?j0(ag(t,w),w,a.nodes,I,a.presets):[]},b=i?{...i}:null;m(o,b?.elapsed??0),f(o,b);let p=()=>{if(!b)return null;let w=typeof e.currentTime=="number"?e.currentTime:b.scheduledAt;return{scheduledAt:w,elapsed:b.elapsed+(w-b.scheduledAt)*b.rate,rate:b.rate}},y=w=>{let I=p();I&&(Yn(l,I.scheduledAt),f(w,I))},x=w=>{let I=p();Yn(l,I?.scheduledAt??0),d(),m(w,I?.elapsed??0),f(w,I)},v=null,_=t;return typeof MutationObserver<"u"&&typeof _?.nodeType=="number"&&(v=new MutationObserver(()=>{let w=Jn(t);l.length>0&&mi(l),!a||!a.update(w.chain)?x(w.chain):y(w.chain)}),v.observe(_,{attributes:!0,attributeFilter:[cn,Tt]})),{reanchor:w=>{if(s)return;let I=p();I&&Yn(l,I.scheduledAt),b={...w},f(Jn(t).chain,b)},setRate:w=>{let I=p();s||!I||!Number.isFinite(w)||w<=0||w===I.rate||(b={...I,rate:w},Yn(l,I.scheduledAt),f(Jn(t).chain,b))},dispose:()=>{s=!0,v?.disconnect(),l.length>0&&Yn(l,typeof e.currentTime=="number"?e.currentTime:0),a?.dispose()}}}function lg(e,t){e.getFloatTimeDomainData(t);let n=0;for(let r=0;r<t.length;r++)n=Math.max(n,Math.abs(t[r]??0));return n}function gu(e,t){let n=e.createGain();n.channelCount=2,n.channelCountMode="explicit";let r=e.createChannelSplitter(2),i=e.createAnalyser(),o=e.createAnalyser();i.fftSize=o.fftSize=2048,t.connect(n),n.connect(r),r.connect(i,0),r.connect(o,1);let a=new Float32Array(new ArrayBuffer(2048*4)),l=new Float32Array(new ArrayBuffer(2048*4));return{read:()=>({l:lg(i,a),r:lg(o,l)}),dispose:()=>{try{t.disconnect(n),n.disconnect(),r.disconnect()}catch{}}}}var ug="runtime_web_audio_bypass";function bu(e,t){return typeof e.getAttribute=="function"?e.getAttribute(t):null}function gi(e,t){return bu(e,t)!==null}function Fw(e){return gi(e,"crossorigin")?!0:e.crossOrigin!=null}function Dw(e){return typeof e.baseURI=="string"&&e.baseURI?e.baseURI:typeof document<"u"?document.baseURI:""}function Iw(e){let t=typeof e.currentSrc=="string"?e.currentSrc:"";if(t)return[t];let n=bu(e,"src");if(n)return[n];if(typeof e.querySelectorAll!="function")return[];let r=[];for(let i of Array.from(e.querySelectorAll("source"))){let o=i.getAttribute("src");o&&r.push(o)}return r}function Pw(e,t){let n;try{n=new URL(e,Dw(t))}catch{return null}return n.protocol!=="http:"&&n.protocol!=="https:"?null:n}function Ow(){return typeof window.origin=="string"?window.origin:window.location.origin}function Hw(e,t){if(typeof window>"u")return null;let n=Pw(e,t);if(!n)return null;let r=Ow(),i=r==="null";return!i&&n.origin===r||Fw(t)?null:i?"opaque_document_origin":"cross_origin_no_cors"}function dg(e){return(typeof e.currentSrc=="string"?e.currentSrc:"")?!0:gi(e,"src")}function Qn(e){for(let t of Iw(e)){let n=Hw(t,e);if(n)return{kind:"decode-only",reason:n,asset:t}}return{kind:"web-audio"}}function Gw(e){let t=[];gi(e,cn)&&t.push("fx-chain"),gi(e,Tt)&&t.push("automation"),gi(e,io)&&t.push("audio-group");let n=Number.parseFloat(bu(e,"data-volume")??"");return Number.isFinite(n)&&n>1&&t.push("above-unity-gain"),t}function Bw(){return typeof window<"u"&&!!window.__HF_EXPORT_RENDER_SEEK_CONFIG}var cg=new WeakSet,Uw={cross_origin_no_cors:"cross-origin media without a `crossorigin` opt-in is silent through createMediaElementSource (Web Audio spec); using native playback instead",opaque_document_origin:"this document\'s security origin is opaque (a sandbox without `allow-same-origin`), so no media is same-origin with it and createMediaElementSource would be silent (Web Audio spec); using native playback instead"},Ww={cross_origin_no_cors:"proxy or download the asset to a same-origin URL to keep it.",opaque_document_origin:"add `allow-same-origin` to the sandbox, or serve the asset with a `crossorigin` attribute and an `Access-Control-Allow-Origin` of `null` or `*`, to keep it."};function Zn(e,t){if(t.kind==="web-audio"||Bw()||cg.has(e))return;let n=Gw(e);cg.add(e);let r={asset:t.asset,reason:t.reason,lostProcessing:n,note:Uw[t.reason]};we({source:"hf-preview",type:"diagnostic",code:ug,details:r});let i=n.length>0?` Native playback cannot reproduce: ${n.join(", ")} \\u2014 ${Ww[t.reason]}`:"";console.info(`[hyperframes] ${ug}: "${t.asset}" (${t.reason}): Web Audio capture withheld; the track plays through native HTMLMediaElement output.${i}`)}function xu(e){return!Number.isFinite(e)||e<=0?1:e}function fg(e){return Je(e)}function Vw(e,t){t||e.paused||!Pi().__hfDebug||console.debug("[hyperframes] webAudioTransport claimed fallback-playing element:",e.currentSrc||e.getAttribute("src")||"")}function $w(e,t){let{elapsed:n,mediaStart:r,scheduledAt:i,globalRate:o,mediaRate:a,clipDuration:l}=t,s=Number.isFinite(l)&&l>0,u=l*a;if(n>=0){let m=n*a,f=u-m;return s&&f<=0?!1:(s?e.start(0,m+r,f):e.start(0,m+r),!0)}let d=-n/o;return s?e.start(i+d,r,u):e.start(i+d,r),!0}function ea(e,t,n){let r=K0(sg(e));r&&uu([{param:t.gain}],r,Yi.scale,n)}function er(e){return e.sourceKind==="buffer"}var zw=1e4,ta=class{constructor(){ue(this,"_ctx",null);ue(this,"_bufferCache",new Map);ue(this,"_failedSrcs",new Set);ue(this,"_mediaElementSources",new WeakMap);ue(this,"_activeSources",[]);ue(this,"_masterGain",null);ue(this,"_monitorGain",null);ue(this,"_masterVolume",1);ue(this,"_masterMuted",!1);ue(this,"_groups",new Map);ue(this,"_metering",!1);ue(this,"_masterTap",null);ue(this,"_groupTaps",new Map);ue(this,"_rateAnchorCtx",0);ue(this,"_rateAnchorComp",0);ue(this,"_rate",1);ue(this,"_paused",!0);ue(this,"_playGeneration",0);ue(this,"_playingCaptured",new Set);ue(this,"_suspendPending",!1);ue(this,"_restTimer",null)}async init(){try{return this._ctx=new AudioContext,this._ctx.onstatechange=()=>this.rest(),this._masterGain=this._ctx.createGain(),this._monitorGain=this._ctx.createGain(),this._masterGain.connect(this._monitorGain),this._monitorGain.connect(this._ctx.destination),this.applyMasterGain(),this._metering&&this.attachMasterTap(),!0}catch{return!1}}async wake(){!this._ctx||this._ctx.state==="running"&&!this._suspendPending||(this._suspendPending=!1,await this._ctx.resume())}rest(){this._restTimer!==null&&clearTimeout(this._restTimer),this._restTimer=null,!(!this._ctx||this._ctx.state!=="running"||this._suspendPending)&&(this._restTimer=setTimeout(()=>{this._restTimer=null,this.suspendIfIdle()},zw))}suspendIfIdle(){for(let t of this._playingCaptured)t.paused&&this._playingCaptured.delete(t);!this._ctx||!this._paused||this._suspendPending||this._playingCaptured.size>0||(this._suspendPending=!0,this._ctx.suspend().catch(t=>{this._suspendPending=!1,P("webAudioTransport.suspend",t)}))}get context(){return this._ctx}getTime(){return!this._ctx||this._paused?-1:this._rateAnchorComp+(this._ctx.currentTime-this._rateAnchorCtx)*this._rate}async decodeAudioElement(t){let n=t.currentSrc||t.getAttribute("src");if(!n)return null;if(this._bufferCache.has(n))return this._bufferCache.get(n);if(this._failedSrcs.has(n)||!this._ctx)return null;let r;try{let i=await fetch(n,{cache:"no-store"});if(!i.ok)return P("webAudioTransport.fetch",new Error(`${i.status} ${n}`)),null;r=await i.arrayBuffer()}catch(i){return P("webAudioTransport.fetch",i),null}try{let i=await this._ctx.decodeAudioData(r);return this._bufferCache.set(n,i),i}catch(i){return this._failedSrcs.add(n),P("webAudioTransport.decode",i),null}}startGeneration(){return this._playGeneration+=1,this._playGeneration}currentGeneration(){return this._playGeneration}acquireMediaElementSource(t){let n=this._mediaElementSources.get(t);if(n){let a=Qn(t);if(a.kind!=="web-audio"){try{n.disconnect()}catch{}return this._mediaElementSources.delete(t),Zn(t,a),null}return n}if(!this._ctx)return null;let r=Qn(t);if(r.kind!=="web-audio")return Zn(t,r),null;let i=this._ctx.createMediaElementSource(t);this._mediaElementSources.set(t,i),t.paused||this._playingCaptured.add(t),t.addEventListener("play",()=>{this._playingCaptured.add(t),this.wake()});let o=()=>{this._playingCaptured.delete(t),this.rest()};return t.addEventListener("pause",o),t.addEventListener("emptied",o),i}async scheduleMediaElementPlayback(t,n,r,i,o,a,l=1){if(!this._ctx||!this._masterGain||a!==this._playGeneration)return null;try{if(await this.wake(),a!==this._playGeneration)return null;let s=this.acquireMediaElementSource(t);if(!s)return null;s.disconnect();let u=xu(l),d=this._ctx.createGain();d.gain.value=o;let m=this._ctx.currentTime,f=i-n,b={scheduledAt:m,elapsed:f,rate:u},p=Zo(this._ctx,t,s,d,b);d.connect(this.resolveDestination(t,m,i,u)??this._masterGain),ea(t,d,b),this._rate=u,this._rateAnchorCtx=m,this._rateAnchorComp=i;let y={fx:p,el:t,sourceNode:s,sourceKind:"media-element",gainNode:d,compositionStart:n,mediaStart:r,scheduledAt:m,priorMuted:t.muted,priorVolume:t.volume,mediaPlaybackRate:Ve(t),bounded:!1};return t.volume=1,this._activeSources.push(y),this._paused=!1,y}catch(s){return P("webAudioTransport.mediaElementSource",s),null}}groupInput(t,n,r){let i=this._groups.get(t);if(i){if(i.generation!==this._playGeneration)try{i.reanchor(r),i.generation=this._playGeneration}catch(f){P("webAudioTransport.groupReanchor",f)}return i.input}if(!this._ctx||!this._masterGain)return null;let o=this._ctx.createGain(),a=this._ctx.createGain();a.connect(this._masterGain);let l=()=>as(n,t),s=l(),u=this._ctx.createGain();u.gain.value=s?.hasAttribute("data-hidden")?0:1,u.connect(a);let d=this._ctx.createGain();d.gain.value=fg(os(s)),d.connect(u);let m=Zo(this._ctx,s??{getAttribute:()=>null},o,d,r);return s&&ea(s,d,r),this._groups.set(t,{input:o,output:a,isPresent:()=>l()!==null,fader:d,muteGain:u,fx:m,generation:this._playGeneration,reanchor:f=>{mi([{param:d.gain}]);let b=l();d.gain.value=fg(os(b)),u.gain.value=b?.hasAttribute("data-hidden")?0:1,m?.reanchor(f),b&&ea(b,d,f)},dispose:()=>{try{m?.dispose(),o.disconnect(),d.disconnect(),u.disconnect(),a.disconnect()}catch{}}}),this.attachGroupTap(t,a),o}startMetering(){this._metering=!0,this.attachMasterTap();for(let[t,n]of this._groups)this.attachGroupTap(t,n.output)}stopMetering(){this._metering=!1,this._masterTap?.dispose(),this._masterTap=null;for(let t of this._groupTaps.values())t.dispose();this._groupTaps.clear()}readLevels(){let t={};for(let[n,r]of this._groupTaps)this._groups.get(n)?.isPresent()&&(t[n]=r.read());return{master:this._masterTap?.read()??{l:0,r:0},groups:t}}attachMasterTap(){this._ctx&&this._masterGain&&!this._masterTap&&(this._masterTap=gu(this._ctx,this._masterGain))}attachGroupTap(t,n){this._metering&&this._ctx&&!this._groupTaps.has(t)&&this._groupTaps.set(t,gu(this._ctx,n))}setGroupMuted(t,n){let r=this._groups.get(t);if(r)try{r.muteGain.gain.value=n?0:1}catch(i){P("webAudioTransport.setGroupMuted",i)}}resolveDestination(t,n,r,i){if(!this._masterGain)return null;let o=ao(t);if(!o)return this._masterGain;let a={scheduledAt:n,elapsed:r,rate:i};return this.groupInput(o,t.ownerDocument,a)??this._masterGain}handleSourceEnded(t,n,r,i){let o=this._activeSources.indexOf(n);if(o!==-1){this._activeSources.splice(o,1),r.muted=i;try{t.disconnect(),n.fx?.dispose(),n.gainNode.disconnect()}catch{}this._activeSources.length===0&&(this._paused=!0)}}async schedulePlayback(t,n,r,i,o,a,l,s=1,u=Number.POSITIVE_INFINITY){if(!this._ctx||!this._masterGain||l!==this._playGeneration)return null;try{if(await this.wake(),l!==this._playGeneration)return null;let d=o(),m=xu(s),f=Ve(t),b=m*f,p=this._ctx.createBufferSource();p.buffer=n,p.playbackRate.value=b;let y=this._ctx.createGain();y.gain.value=a;let x=d-r,v=this._ctx.currentTime,_={scheduledAt:v,elapsed:x,rate:m},w=Zo(this._ctx,t,p,y,_);if(y.connect(this.resolveDestination(t,v,d,m)??this._masterGain),ea(t,y,_),this._rate=m,this._rateAnchorCtx=v,this._rateAnchorComp=d,!$w(p,{elapsed:x,mediaStart:i,scheduledAt:v,globalRate:m,mediaRate:f,clipDuration:u}))return p.disconnect(),w?.dispose(),y.disconnect(),null;let I=t.muted;t.muted=!0,Vw(t,I);let D={fx:w,el:t,sourceNode:p,sourceKind:"buffer",gainNode:y,compositionStart:r,mediaStart:i,scheduledAt:v,priorMuted:I,priorVolume:t.volume,mediaPlaybackRate:f,bounded:Number.isFinite(u)&&u>0};return this._activeSources.push(D),this._paused=!1,p.addEventListener("ended",()=>this.handleSourceEnded(p,D,t,I)),D}catch(d){return P("webAudioTransport.schedule",d),null}}setRate(t){let n=xu(t);if(n===this._rate)return!1;this._ctx&&!this._paused&&(this._rateAnchorComp=this.getTime(),this._rateAnchorCtx=this._ctx.currentTime),this._rate=n;for(let r of this._activeSources)try{er(r)&&(r.sourceNode.playbackRate.value=n*r.mediaPlaybackRate),r.fx?.setRate(n)}catch(i){P("webAudioTransport.setRate",i)}for(let r of this._groups.values())try{r.fx?.setRate(n)}catch(i){P("webAudioTransport.setRate.group",i)}return!0}hasBoundedActiveSources(){return this._activeSources.some(t=>er(t)&&t.bounded)}stopAll(){for(let t of this._activeSources){try{er(t)&&t.sourceNode.stop(),t.sourceNode.disconnect(),t.fx?.dispose(),t.gainNode.disconnect()}catch{}er(t)?t.el.muted=t.priorMuted:(t.el.volume=t.priorVolume,this._ctx&&t.sourceNode.connect(this._ctx.destination))}this._activeSources=[],this._paused=!0,this._playGeneration+=1,this.rest()}setVolume(t){this._masterVolume=Math.max(0,Math.min(1,t)),this.applyMasterGain()}setElementVolume(t,n){let r=Je(n);for(let i of this._activeSources)if(i.el===t)try{i.sourceKind==="media-element"&&(i.el.volume=1),i.gainNode.gain.value=r}catch(o){P("webAudioTransport.setElementVolume",o)}}setMuted(t){this._masterMuted=t,this.applyMasterGain()}applyMasterGain(){this._monitorGain&&(this._monitorGain.gain.value=this._masterMuted?0:this._masterVolume)}ownsClock(){return!this._paused&&this._activeSources.some(er)}ownsElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t&&er(n))}routesElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t)}destroy(){this.stopAll(),this.stopMetering();for(let t of this._groups.values())t.dispose();if(this._groups.clear(),this._bufferCache.clear(),this._failedSrcs.clear(),this._mediaElementSources=new WeakMap,this._playingCaptured.clear(),this._suspendPending=!1,this._restTimer!==null&&clearTimeout(this._restTimer),this._restTimer=null,this._ctx)try{this._ctx.close()}catch{}this._ctx=null,this._masterGain=null,this._monitorGain=null,this._masterVolume=1,this._masterMuted=!1}};var bi="data-hf-studio-manual-edit-gesture";var mg=`[${bi}]`;function pg(e,t){let n=e.defaultView?.MutationObserver??globalThis.MutationObserver;if(!n||!e.documentElement)return{isActive:()=>e.querySelector(mg)!=null,observing:!1,disconnect:()=>{}};let r=new Set(e.querySelectorAll(mg)),i=l=>{for(let s of l){let u=s.target;Ne(u)&&(u.hasAttribute(bi)?r.add(u):r.delete(u))}},o=l=>{l.length!==0&&(i(l),t())},a=new n(o);return a.observe(e.documentElement,{subtree:!0,attributes:!0,attributeFilter:[bi]}),{observing:!0,isActive:()=>{o(a.takeRecords());for(let l of r){if(l.isConnected&&l.hasAttribute(bi))return!0;r.delete(l)}return!1},disconnect:()=>{a.disconnect(),r.clear()}}}var hg=333.3333333333333,gg=1e3*60/60;function bg(e){return e.isPlaying&&e.hasCapturedTimeline&&e.currentTimeSeconds<2?!1:e.compositionChanged===!0?!0:e.isPlaying?e.playingPollDue===!0:Number.isInteger(e.tick)&&e.tick>0&&e.tick%60===0}var qw=/^\\s*spring\\(\\s*([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+))\\s*\\)\\s*$/;function xg(e){return Math.max(0,Math.min(1,e))}function yg(e){let t=qw.exec(e);if(!t)return null;let n=Number(t[1]);return Number.isFinite(n)?xg(n):null}function Sg(e,t){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let n=xg(t),r=12-n*6,i=Math.PI*2*(1+n*1.5),o=1-Math.exp(-r)*Math.cos(i);return(1-Math.exp(-r*e)*Math.cos(i*e))/o}var jw=/^\\s*wiggle\\(\\s*(\\d+)\\s*,\\s*(easeOut|easeInOut|anticipate|uniform)\\s*(?:,\\s*([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?)\\s*)?\\)\\s*$/,Kw=Math.PI*2;function Xw(e){let t=jw.exec(e);if(!t)return null;let n=Number(t[1]);if(!Number.isSafeInteger(n)||n<1)return null;let r=t[2];if(r!=="easeOut"&&r!=="easeInOut"&&r!=="anticipate"&&r!=="uniform")return null;if(t[3]===void 0)return{wiggles:n,type:r};let i=Number(t[3]);return!Number.isFinite(i)||i<0||i>1?null:{wiggles:n,type:r,amplitude:i}}function Yw(e,t,n,r){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let i=r??(n==="easeInOut"?.08:n==="uniform"?.14:n==="anticipate"?.12:.16),o=n==="easeInOut"?i*Math.sin(Math.PI*e):n==="uniform"?i:i*(1-e);return e+(n==="anticipate"?-1:1)*o*Math.sin(Kw*t*e)}function vg(e,t){let n=Xw(e);if(!n)return null;let r=`${n.wiggles}:${n.type}:${n.amplitude??"default"}`,i=t?.get(r);if(i)return i;let o=a=>Yw(a,n.wiggles,n.type,n.amplitude);return t?.set(r,o),o}var Jw=24,Eg=e=>e>=1?1:0,Qw=e=>e,na=String.raw`([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?)`,Zw=new RegExp(String.raw`^\\s*M\\s*0\\s*,\\s*0\\s+C\\s*${na}\\s*,\\s*${na}\\s+${na}\\s*,\\s*${na}\\s+1\\s*,\\s*1\\s*$`,"i");function Ag(e,t,n){let r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function eC(e,t,n,r,i){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let o=0,a=1;for(let l=0;l<Jw;l+=1){let s=(o+a)/2;Ag(s,t,r)<e?o=s:a=s}return Ag((o+a)/2,n,i)}function tC(e){let t=Zw.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]),o=Number(t[4]);return Math.min(n,i)<0||Math.max(n,i)>1?null:a=>eC(a,n,r,i,o)}function nC(e,t){if(!e.startsWith("spring("))return null;let n=yg(e);if(n===null)return null;let r=t.get(n);if(r)return r;let i=o=>Sg(o,n);return t.set(n,i),i}function rC(e,t){if(!e.startsWith("custom(")||!e.endsWith(")"))return null;let n=e.slice(7,-1),r=t.get(n);if(r)return r;let i=tC(n);return i&&t.set(n,i),i}function _g(e){if(e.__hfCustomEaseInstalled)return!0;let t=e.parseEase;if(!t)return!1;let n=new Map,r=new Map,i=new Map,o=s=>typeof s!="string"?null:s==="hold"?Eg:vg(s,i)??nC(s,r)??rC(s,n),a=(s,u,d=[])=>{let m=o(s);return m||(typeof s=="string"&&/^(?:hold|spring|wiggle|custom)(?:\\(|$)/.test(s.trim())&&Ye("custom_ease_parse_failed",{ease:s}),t.call(u,s,...d)??Qw)};e.parseEase=function(u,...d){return a(u,this,d)};let l=e.registerEase;if(typeof l=="function"){l("hold",Eg);let s=u=>{let d=m=>m;d.config=(...m)=>a(`${u}(${m.join(",")})`,e),l(u,d)};s("spring"),s("wiggle"),s("custom")}return e.__hfCustomEaseInstalled=!0,!0}var Cg="first-frame",iC=3;function oC(e){let t=e.ownerDocument?.defaultView;return t&&e instanceof t.Element?!0:e instanceof Element}function aC(e){if(!oC(e)||e.tagName!=="AUDIO"&&e.tagName!=="VIDEO")return!1;let t=e.ownerDocument?.defaultView;return t&&e instanceof t.HTMLMediaElement?!0:e instanceof HTMLMediaElement}function sC(e){return e.hasAttribute("data-start")||e.hasAttribute("data-track-index")}function lC(e,t,n){let r=e;for(;r;){if(sC(r)&&!So(r,{currentTime:0,compositionDuration:Number.POSITIVE_INFINITY,canonicalFps:30,exportRenderSeek:!1,timelineRegistry:n,resolver:t}))return!1;r=r.parentElement}return!0}function wg(e,t,n,r){return t==="all"?!0:lC(e,n,r)}function uC(e,{scope:t="all"}={}){let n=e.defaultView,r=Qe({documentRef:e,timelineRegistry:n?.__timelines,includeAuthoredTimingAttrs:!0}),i=Array.from(e.querySelectorAll("video, audio")).filter(aC).filter(l=>wg(l,t,r,n?.__timelines??{})).filter(l=>l.readyState<iC),o=Array.from(e.querySelectorAll("img")).filter(l=>wg(l,l.getAttribute("loading")?.toLowerCase()==="lazy"?Cg:t,r,n?.__timelines??{})).filter(l=>!l.complete),a=e.fonts?.status==="loading";return{pendingMedia:i,pendingImages:o,fontsLoading:a}}function cC(e,{pendingMedia:t,pendingImages:n,fontsLoading:r},i){let o=t.map(s=>new Promise(u=>{if(s.error){u();return}let d=()=>{s.removeEventListener("canplay",d),s.removeEventListener("error",d),i.removeEventListener("abort",d),u()};s.addEventListener("canplay",d),s.addEventListener("error",d),i.addEventListener("abort",d,{once:!0})})),a=n.map(s=>s.decode?s.decode().catch(()=>{}):Promise.resolve()),l=r&&e.fonts?e.fonts.ready.then(()=>{}):Promise.resolve();return Promise.all([...o,...a,l]).then(()=>{})}function dC(e,t,{scope:n="all"}={}){let r=uC(e,{scope:n});return r.pendingMedia.length===0&&r.pendingImages.length===0&&!r.fontsLoading?null:cC(e,r,t)}var fC=50;function mC(e,t){let n=e.defaultView;return!n||n.__renderReady||!n.__hf?null:new Promise(r=>{let i,o=()=>{i!==void 0&&clearTimeout(i),t.removeEventListener("abort",o),r()};if(t.aborted){o();return}t.addEventListener("abort",o,{once:!0});let a=()=>{if(n.__renderReady){o();return}i=setTimeout(a,fC)};a()})}var pC=50,hC=2,gC=1500;function yu(e,t){return new Promise(n=>{if(t.aborted){n(-1);return}let r=0,i=()=>{e.cancelAnimationFrame?.(r),n(-1)};t.addEventListener("abort",i,{once:!0}),r=e.requestAnimationFrame(o=>{t.removeEventListener("abort",i),n(o)})})}function bC(e,t){let n=e.defaultView;return n?(async()=>{let r=await yu(n,t);if(t.aborted)return;let i=await yu(n,t),o=0;for(;!t.aborted&&o<hC;){if(i-r>=gC)return;let a=await yu(n,t);if(t.aborted)return;o=a-i<pC?o+1:0,i=a}})():null}var xC=8e3;function yC(e,t,n={}){let r=n.inputs??[(u,d)=>dC(u,d,{scope:n.scope}),mC,bC],i=new AbortController,o=r.map(u=>u(e,i.signal)).filter(u=>u!==null);if(o.length===0){t({timedOut:!1});return}let a=n.timeoutMs??xC,l,s=new Promise(u=>{l=setTimeout(()=>u("timed-out"),a)});Promise.race([Promise.all(o).then(()=>"done"),s]).then(u=>{clearTimeout(l),i.abort(),t({timedOut:u==="timed-out"})})}function Tg(e,t,n={}){yC(e,t,{...n,scope:Cg})}var Eu=new Map,xi=new Map,Su=new Map,vu=()=>{},kg=()=>{},Rg=0;function Au(e){return/^[a-z][a-z0-9-]{0,63}$/.test(e)}function Mg(e){let t=(Su.get(e)??0)+1;return Su.set(e,t),t}function Ng(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:(Rg-=1,Rg)}function _u(e,t){let n=xi.get(e);if(!n)return;let r=()=>Su.get(e)===t.generation&&xi.get(e)===n;try{Promise.resolve(n(t.payload)).then(()=>{r()&&kg(e,t.requestId)},i=>{r()&&vu(e,t.requestId,i)})}catch(i){r()&&vu(e,t.requestId,i)}}function Lg(e){vu=e}function Fg(e){kg=e}function ra(e,t,n){if(!Au(e))return;let r={payload:t,requestId:Ng(n),generation:Mg(e)};Eu.set(e,r),_u(e,r)}function ia(e,t){Au(e)&&(Eu.delete(e),_u(e,{payload:void 0,requestId:Ng(t),generation:Mg(e)}))}function Dg(e,t){if(!Au(e))throw new Error(`Invalid HyperFrames runtime-data channel: ${e}`);xi.set(e,t);let n=Eu.get(e);return n&&_u(e,n),()=>{xi.get(e)===t&&xi.delete(e)}}var Ig=!1;function Et(e){if(e){if(typeof e.pause!="function"){Ig||(Ig=!0,Ye("timeline_missing_pause",{}));return}try{e.pause()}catch(t){P("runtime.timeline.pause",t)}}}function EC(){let e=window.__HF_EXPORT_RENDER_SEEK_CONFIG,t=e?.fps,n=e?.fpsSource,r=Number(t);return!e||t==null?{fps:null,source:"default",rawFpsSource:n,rawFps:t,fallbackReason:"missing"}:!Number.isFinite(r)||r<=0?{fps:null,source:"default",rawFpsSource:n,rawFps:t,fallbackReason:"invalid"}:{fps:r,source:n==="render-options"||n==="default"?n:"unknown",rawFpsSource:n,rawFps:t,fallbackReason:e.fpsFallbackReason}}function AC(e,t){return t!==null&&e.length===t.length&&e.every((n,r)=>n===t[r])}function Pg(e,t,n){let r=null,i=!0;return()=>{let o=e();if(o.length===0)return r=null,i=!0,!0;if(AC(o,r))return i;r=o,i=!1;let a=o.length===1?o[0]:Promise.all(o);return Promise.resolve(a).then(()=>{r===o&&(i=!0,t())},l=>{r===o&&(i=!0,n(l),t())}),i}}function yi(e){let t=e.querySelector(`meta[name="${ri}"]`)?.getAttribute("content");if(!t)return null;try{return JSON.parse(t)}catch{return null}}var Tu=e=>JSON.stringify([Array.from(e.attributes,t=>[t.name,t.value]).filter(([t])=>t!==mn),e.innerHTML]),_C=new Set(["style","preload","src",mn,Kt]),wC=e=>e.split(/\\s+/).filter(t=>t&&!t.startsWith("__hf-")).join(" "),Og=e=>JSON.stringify([Array.from(e.attributes,({name:t,value:n})=>[t,t==="class"?wC(n):n]).filter(([t,n])=>!_C.has(t)&&!(t==="class"&&!n)).sort(([t],[n])=>t<n?-1:1),e.hasAttribute("data-var-src")?null:Tr(e),e.innerHTML]),Si=new WeakMap,Hg=e=>e.localName==="video"||e.localName==="audio",Cu=e=>{if(!Ne(e))return;let t=Hg(e)?[e]:e.firstElementChild?e.querySelectorAll("video, audio"):[];for(let n of t)Si.has(n)||Si.set(n,Tu(n))},oa=null;function Gg(){typeof MutationObserver>"u"||!yi(document)||(Cu(document.documentElement),oa=new MutationObserver(e=>{for(let t of e){t.addedNodes.forEach(Cu);let{target:n}=t;Ne(n)&&Hg(n)&&Si.set(n,Tu(n))}}),oa.observe(document.documentElement,{childList:!0,subtree:!0}))}var CC=new Map([["image",["href","xlink:href"]],["object",["data"]]]),TC=1e3,wu="hf-runtime-filler";function RC(){let e;return()=>e??(e=document.getAnimations())}function Bg(){let e=bm();oa?.disconnect(),oa=null,yi(document)&&Cu(document.documentElement);let t=()=>{};Zc(we),Lg((c,h,g)=>{we({source:"hf-preview",type:"runtime-data-error",channel:c,requestId:h,message:g instanceof Error?g.message:String(g)})}),Fg((c,h)=>{try{t()}catch(g){we({source:"hf-preview",type:"runtime-data-error",channel:c,requestId:h,message:g instanceof Error?g.message:String(g)});return}we({source:"hf-preview",type:"runtime-data-applied",channel:c,requestId:h})}),ii(document),Wo(document),xf(document);let n=EC();if(e.canonicalFps=n.fps??e.canonicalFps,Wc(e.canonicalFps),window.__HF_EXPORT_RENDER_SEEK_CONFIG){let c=JSON.stringify({canonicalFps:e.canonicalFps,source:n.source,rawFpsSource:n.rawFpsSource,rawFps:n.rawFps,fallbackReason:n.fallbackReason});console.info(`[hyperframes] render runtime fps ${c}`)}let r=null,i=null,o=null,a=[],l=new Set,s=null,u=new Set,d=(c,h,g)=>{u.has(c)||(u.add(c),Ye(h,g))};if(typeof window.__hfRuntimeTeardown=="function")try{window.__hfRuntimeTeardown()}catch(c){P("runtime.init.site1",c)}let m=new Qo;e.transportClock=m;let f=new ta,b=!1;f.init().then(c=>{b=c}),window.__hf=window.__hf||{};let p=c=>c.closest("[data-hidden]")!==null||oo(c.ownerDocument,c),y=()=>{let c=window.gsap,h=window;if(!(!c?.registerPlugin||h.__hfAutoNoopRegistered))try{c.registerPlugin({name:"_auto",init:()=>!1}),h.__hfAutoNoopRegistered=!0}catch(g){d("auto_marker_install_failed","auto_marker_install_failed",{reason:"threw"}),P("runtime.autoMarker.install",g)}},x=()=>{let c=window.gsap;if(!c){d("custom_ease_missing_gsap","custom_ease_install_failed",{reason:"missing_gsap"});return}try{_g(c)||d("custom_ease_no_parse_ease","custom_ease_install_failed",{reason:"no_parseEase"})}catch(h){d("custom_ease_install_threw","custom_ease_install_failed",{reason:"threw"}),P("runtime.customEase.install",h)}};y(),x(),document.documentElement&&(document.documentElement.style.margin="0",document.documentElement.style.padding="0",document.documentElement.style.overflow="hidden"),document.body&&(document.body.style.margin="0",document.body.style.padding="0",document.body.style.overflow="hidden");try{ad(document)}catch(c){P("runtime.init.cssVariables",c)}if(window.__timelines=window.__timelines||{},Array.isArray(window.__timelines)){let c=window.__timelines,h=kt()?.getAttribute("data-composition-id")??"root",g={};if(c.length===1)g[h]=c[0];else for(let S=0;S<c.length;S++)g[`tl-${S}`]=c[S];window.__timelines=g}let v=kt();v&&!v.hasAttribute("data-start")&&v.setAttribute("data-start","0");let _=c=>{a.push(c)},w=(c,h,g)=>{let S=g??`${c}:${JSON.stringify(h)}`;l.has(S)||(l.add(S),we({source:"hf-preview",type:"diagnostic",code:c,details:h}))},I=c=>{let h={scale:1,focusX:960,focusY:540},g=[],S=[],E={time:c.getTime(),duration:c.getDuration(),isPlaying:c.isPlaying(),renderMode:!1,timelineDirty:!1};return{play:c.play,pause:c.pause,seek:c.seek,getTime:c.getTime,getDuration:c.getDuration,isPlaying:c.isPlaying,getMainTimeline:()=>null,getElementBounds:()=>{},getElementsAtPoint:()=>{},setElementPosition:()=>{},previewElementPosition:()=>{},setElementKeyframes:()=>{},setElementScale:()=>{},setElementFontSize:()=>{},setElementTextContent:()=>{},setElementTextColor:()=>{},setElementTextShadow:()=>{},setElementTextFontWeight:()=>{},setElementTextFontFamily:()=>{},setElementTextOutline:()=>{},setElementTextHighlight:()=>{},setElementVolume:()=>{},setStageZoom:()=>{},getStageZoom:()=>h,setStageZoomKeyframes:()=>{},getStageZoomKeyframes:()=>g,addElement:()=>!1,removeElement:()=>!1,updateElementTiming:()=>!1,setElementTiming:()=>{},updateElementSrc:()=>!1,updateElementLayer:()=>!1,updateElementBasePosition:()=>!1,markTimelineDirty:()=>{},isTimelineDirty:()=>!1,rebuildTimeline:()=>{},ensureTimeline:()=>{},enableRenderMode:()=>{},disableRenderMode:()=>{},renderSeek:c.renderSeek,getElementVisibility:()=>({visible:!1}),getVisibleElements:()=>S,getRenderState:()=>({...E,time:c.getTime(),duration:c.getDuration(),isPlaying:c.isPlaying()})}},D=1/60,F=.75,O=.05,T=100,M=240,R=c=>{if(c instanceof Error)return c.message||String(c);if(typeof c=="string")return c;try{return JSON.stringify(c)}catch{return String(c??"")}},U=c=>{let h=c.toLowerCase();return h.includes("cannot read properties of null")||h.includes("cannot set properties of null")?{code:"runtime_null_dom_access",category:"dom-null-access"}:h.includes("failed to execute \'queryselector\'")?{code:"runtime_invalid_selector",category:"selector-invalid"}:h.includes("is not defined")?{code:"runtime_reference_missing",category:"reference-missing"}:{code:"runtime_script_error",category:"script-error"}},j=c=>{let h=pn(c);return h===null?null:`${h}px`},Y=()=>kt(),N=()=>{let c=Y();if(!c)return;let h=j(c.getAttribute("data-width")),g=j(c.getAttribute("data-height"));h&&(c.style.width=h),g&&(c.style.height=g),h&&c.style.setProperty("--comp-width",h),g&&c.style.setProperty("--comp-height",g),h&&(document.documentElement.style.width=h),g&&(document.documentElement.style.height=g),h&&(document.body.style.width=h),g&&(document.body.style.height=g)},A=()=>{let c=Y(),h=Array.from(document.querySelectorAll("[data-composition-id]")).filter(g=>g.hasAttribute("data-duration")||g.hasAttribute("data-end"));for(let g of h){if(c&&g===c)continue;let S=g.getAttribute("data-duration"),E=g.getAttribute("data-end");S!=null&&!g.hasAttribute(Fn)&&g.setAttribute(Fn,S),E!=null&&!g.hasAttribute(Dn)&&g.setAttribute(Dn,E),g.removeAttribute("data-duration"),g.removeAttribute("data-end")}},H=()=>{let c=Y();if(!c)return;c.style.position||(c.style.position="relative"),c.style.overflow="hidden";let h=j(c.getAttribute("data-width")),g=j(c.getAttribute("data-height"));h&&(c.style.width=h),g&&(c.style.height=g);let S=Array.from(c.children).filter(C=>{let L=C.tagName.toLowerCase();return L==="script"||L==="style"||L==="link"||L==="meta"||!C.hasAttribute("data-start")?!1:!C.hasAttribute("data-hf-autostamped")}),E=S.filter(C=>C.style.getPropertyValue("display")==="none").map(C=>({el:C,priority:C.style.getPropertyPriority("display")}));for(let{el:C}of E)C.style.removeProperty("display");for(let C of S){let L=C.tagName.toLowerCase(),k=(C.style.top==="0px"||C.style.top==="0")&&(C.style.left==="0px"||C.style.left==="0")&&C.style.width==="100%"&&C.style.height==="100%",W=/translate\\(\\s*-50%\\s*,\\s*-50%\\s*\\)/.test(C.style.transform);if(k&&W&&!C.hasAttribute("data-width")&&!C.hasAttribute("data-height")){let se=C.style.top,ne=C.style.left,he=C.style.width,Te=C.style.height;C.style.top="",C.style.left="",C.style.width="",C.style.height="";let We=window.getComputedStyle(C);We.top!=="auto"||We.bottom!=="auto"||We.left!=="auto"||We.right!=="auto"||We.width!=="0px"||We.height!=="0px"||(C.style.top=se,C.style.left=ne,C.style.width=he,C.style.height=Te)}let ee=window.getComputedStyle(C),te=ee.position;if(te!=="absolute"&&te!=="fixed"&&(C.style.position="absolute"),L!=="audio"){let se=j(C.getAttribute("data-width")),ne=j(C.getAttribute("data-height")),he=ee.width!=="0px"&&ee.width!=="auto",Te=ee.height!=="0px"&&ee.height!=="auto";se?!C.style.width&&!he&&(C.style.width=se):!C.style.width&&ee.width==="0px"&&(C.style.width="100%"),ne?!C.style.height&&!Te&&(C.style.height=ne):!C.style.height&&ee.height==="0px"&&(C.style.height="100%")}}for(let{el:C,priority:L}of E)C.style.setProperty("display","none",L)},J=c=>Qe({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:c}),B=null,q=c=>{let h=B;B=J(!0);try{return c()}finally{B=h}},$=c=>c&&B?B:J(c),K=(c,h=0,g)=>$(g?.includeAuthoredTimingAttrs??!0).resolveStartForElement(c,h),X=(c,h)=>$(h?.includeAuthoredTimingAttrs??!0).resolveDurationForElement(c),G=c=>{let h=c.closest("[data-composition-id]"),g=h?K(h,0):null,S=h?X(h,{includeAuthoredTimingAttrs:!0}):null;return{compositionRoot:h,inheritedStart:g,inheritedDuration:S}},V=c=>$(!0).resolveMediaStartForElement(c);window.__hfResolveMediaStartSeconds=V,a.push(()=>{window.__hfResolveMediaStartSeconds===V&&delete window.__hfResolveMediaStartSeconds});let Z=!!document.querySelector("[data-composition-src]"),ce=!1;{let c=document.querySelectorAll("[data-composition-id]:not([data-composition-src])");for(let h of c){let g=h.getAttribute("data-composition-id");if(g&&h.children.length===0&&document.querySelector(`template#${CSS.escape(g)}-template`)){ce=!0;break}}}let ae=!Z&&!ce,z=c=>{if(!c||typeof c.duration!="function")return null;try{let h=Number(c.duration());return Number.isFinite(h)?Math.max(0,h):null}catch{return null}},Q=c=>typeof c=="number"&&Number.isFinite(c)&&c>D,lt=()=>{let c=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));return c.length===0?null:q(()=>{let h=[];for(let S of c){let E=V(S);if(!Number.isFinite(E))continue;let C=to(S);C==null||C<=D||h.push(Math.max(0,E)+C)}let{seconds:g}=Hr({authoredDurationSeconds:null,clipEndsSeconds:h});return g!==null&&g>D?g:null})},qe=()=>{let c=Y();if(!c)return null;let h=window.__timelines??{},g=Qe({timelineRegistry:h,includeAuthoredTimingAttrs:!0}),S=Fe(c.getAttribute("data-duration")),E=[],C=Array.from(c.querySelectorAll("[data-composition-id][data-start]"));for(let k of C){if(!Ne(k)||k.parentElement?.closest("[data-composition-id]")!==c)continue;let ee=g.resolveStartForElement(k,0),te=g.resolveDurationForElement(k);!Number.isFinite(ee)||te==null||te<=0||E.push(Math.max(0,ee)+te)}let{seconds:L}=Hr({authoredDurationSeconds:null,clipEndsSeconds:[S,...E]});return L!==null&&L>D?L:null},rr=c=>c.hasAttribute("data-composition-id")||c.hasAttribute("data-composition-src"),At=c=>{let h=window;return!!(h.lottie||h.DotLottie||c.querySelector("[data-lottie-src]"))},Ou=()=>{let c=Y();if(!c)return Hr({authoredDurationSeconds:null,clipEndsSeconds:[]});let h=Qe({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:!0}),g=[];for(let E of Array.from(c.querySelectorAll("[data-start]"))){if(!Ne(E))continue;let C=h.resolveStartForElement(E,0);if(!Number.isFinite(C))continue;let L=h.resolveDurationForElement(E);L!=null?g.push(Math.max(0,C)+L):(be(E)||rr(E))&&g.push(null)}At(c)&&g.push(null);let S=Hr({authoredDurationSeconds:null,clipEndsSeconds:g});return S.pendingClips>0?{...S,seconds:null,source:"unresolved",reason:"a clip\'s length is pending"}:S},ma=null,Eb=()=>{if(ir)return Ou();let c=or();return ma?.revision!==c&&(ma={revision:c,result:Ou()}),ma.result},Ab=c=>{window.__hf=window.__hf||{},window.__hf.durationSource={source:c.source,seconds:c.seconds,pendingClips:c.pendingClips},c.source==="derived"&&w("composition_duration_derived",{source:c.source,seconds:c.seconds,pendingClips:c.pendingClips},`composition_duration_derived:${c.seconds}`)},_b=()=>{let c=lt();return typeof c!="number"||!Number.isFinite(c)||c<=D?null:c},wb=c=>Q(c)?Math.max(D,c*F):D,pa=(c=!1)=>{let h=0;for(let g of e.deterministicAdapters){let S=c?g.getAnimationCycleEndSeconds:g.getInferredDurationSeconds;if(typeof S!="function")continue;let E=null;try{E=S()}catch(C){P("runtime.init.adapterDuration",C)}typeof E=="number"&&Number.isFinite(E)&&E>0&&(h=Math.max(h,E))}return h>D?h:null},ir=!1,Hu=()=>ir&&window.__HF_EXPORT_RENDER_SEEK_CONFIG!=null,Cb=["data-start","data-duration","data-end","data-composition-id","data-composition-src","data-composition-file","data-root","data-hf-authored-duration","data-hf-authored-end","data-hf-auto-start",no,"data-playback-rate","data-automation","data-playback-start","data-media-start","id","src"],Gu=["loadedmetadata","durationchange","emptied"],Ai=null,Bu=-1,Uu=null,tn=null,Wu=0,nn=()=>{},vn=()=>{Wu+=1,nn()},Vu=()=>({media:_b(),authoredComposition:qe()}),Tb=()=>{let c=window.__timelines??{},h="";for(let g of Object.keys(c)){let S=c[g];S&&(h+=`${g}=${z(S)??"?"};`)}return h},Rb=()=>{if(!(tn||typeof MutationObserver>"u")){tn=new MutationObserver(vn),tn.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...Cb,"data-width","data-height"]});for(let c of Gu)document.addEventListener(c,vn,!0);a.push(()=>{tn?.disconnect(),tn=null,vn();for(let c of Gu)document.removeEventListener(c,vn,!0)})}},or=()=>{Rb(),tn&&tn.takeRecords().length>0&&vn();let c=Tb();return c!==Uu&&(Uu=c,vn()),Wu},$u=c=>ir?Vu():(c??(c=or()),Ai&&Bu===c||(Bu=c,Ai=Vu()),Ai),je=(c,h=0,g)=>{let S=Fe(Y()?.getAttribute("data-duration"));if(S!==null&&S>0)return window.__hf?.durationSource&&delete window.__hf.durationSource,S;let E=z(c),{media:C,authoredComposition:L}=$u(g),k=pa(),W=Math.max(C??0,L??0,k??0),ee=Number.isFinite(h)&&h>D?h:0,te=0,ke=null;return Q(E)?te=Math.max(E,W,ee):Q(W)?te=Math.max(W,ee):ee>0?te=ee:(ke=Eb(),te=ke.seconds??0),ke?Ab(ke):window.__hf?.durationSource&&delete window.__hf.durationSource,te>0?Math.max(0,te):0},zu=new WeakMap,ha=()=>{let c=window.__timelines??{},h=pe=>{let ie=Object.entries(c).filter(de=>!!de[1]&&typeof de[1].play=="function"&&typeof de[1].pause=="function");if(ie.length!==1)return{timeline:null};let le=ie[0];if(!le)return{timeline:null};let[_e,Re]=le;return{timeline:Re,selectedTimelineIds:[_e],selectedDurationSeconds:z(Re),diagnostics:{code:"root_timeline_sole_registered_fallback",details:{reason:pe,soleTimelineId:_e}}}},g=Qe({timelineRegistry:c,includeAuthoredTimingAttrs:!0}),{media:S,authoredComposition:E}=$u(),C=Math.max(S??0,E??0)||null,L=wb(C),k=pe=>{let ie=document.querySelector(`[data-composition-id="${CSS.escape(pe)}"]`);return ie?g.resolveStartForElement(ie,0):0},W=(pe,ie)=>{pe.add(ie.timeline,k(ie.compositionId)),zu.set(ie.timeline,ie.compositionId)},ee=pe=>{let ie=window.gsap;if(!ie||typeof ie.timeline!="function")return null;let le=ie.timeline({paused:!0});for(let _e of pe)W(le,_e);return le},te=(pe,ie)=>{if(!Q(pe))return null;let le=window.gsap;if(!le||typeof le.timeline!="function")return null;let _e=le.timeline({paused:!0});if(ie)try{_e.add(ie,0)}catch(de){P("runtime.init.site2",de)}let Re=_e;if(typeof Re.to=="function")try{Re.to({},{duration:pe,data:wu})}catch(de){P("runtime.init.site3",de)}return _e},ke=(pe,ie)=>{if(!pe||typeof pe.getChildren!="function")return[];try{let le=pe.getChildren(!0,!0,!0);return Array.isArray(le)?ie.filter(_e=>le.includes(_e.timeline)):[]}catch{return[]}},se=(pe,ie)=>{let le=pe,_e={addedIds:[],nested:[]};if(typeof le.getChildren!="function")return _e;try{let Re=le.getChildren(!0,!0,!0)??[];if(!Array.isArray(Re))return _e;let de=[];for(let Me of ie)if(!Re.some(me=>me===Me.timeline))try{W(pe,Me),de.push(Me.compositionId)}catch(me){P("runtime.init.site4",me)}return{addedIds:de,nested:ke(pe,ie)}}catch{return _e}},ne=Y(),he=ne?.getAttribute("data-composition-id")??null;if(!he)return h("root_missing_composition_id");let Te=c[he]??null,Le=(()=>{if(!ne)return[];let pe=new Set,ie=Array.from(ne.querySelectorAll("[data-composition-id]")),le=[];for(let _e of ie){let Re=_e.getAttribute("data-composition-id");if(!Re||Re===he||pe.has(Re))continue;pe.add(Re);let de=c[Re]??null;if(!de||typeof de.play!="function"||typeof de.pause!="function")continue;let Me=z(de);le.push({compositionId:Re,timeline:de,durationSeconds:Me??0})}return le})(),ln=pe=>{for(let ie of pe){let le=ie.timeline;if(typeof le.paused=="function")try{le.paused(!1)}catch(_e){P("runtime.init.site5",_e)}}};if(Te){let pe=Le.length>0?se(Te,Le):{addedIds:[],nested:[]},ie=pe.addedIds;if(ln(pe.nested),(Le.length>0||!document.querySelector("[data-composition-id]:not([data-composition-id=\'"+he+"\'])"))&&(En=!0),ie.length>0)try{let de=Te.time();Te.seek(de,!1)}catch{}let le=z(Te);if(!Q(le)&&Le.length>0){let de=Le.map(xe=>xe.compositionId),Me=ee(Le),re=z(Me);if(Me&&Q(re))return ln(ke(Me,Le)),{timeline:Me,selectedTimelineIds:de,selectedDurationSeconds:re,mediaDurationFloorSeconds:S,diagnostics:{code:"root_timeline_unusable_fallback",details:{rootCompositionId:he,rootDurationSeconds:le,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:L,selectedDurationSeconds:re,mediaDurationFloorSeconds:S,authoredCompositionDurationFloorSeconds:E,selectedTimelineIds:de,autoNestedChildren:ie}}};let me=te(C??0,Te),ge=z(me);if(me&&Q(ge))return{timeline:me,selectedTimelineIds:[he],selectedDurationSeconds:ge,mediaDurationFloorSeconds:S,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:he,rootDurationSeconds:le,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:S,authoredCompositionDurationFloorSeconds:E,selectedDurationSeconds:ge,selectedTimelineIds:[he],autoNestedChildren:ie}}}}if(!Q(le)&&Le.length===0){let de=te(C??0,Te),Me=z(de);if(de&&Q(Me))return{timeline:de,selectedTimelineIds:[he],selectedDurationSeconds:Me,mediaDurationFloorSeconds:S,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:he,rootDurationSeconds:le,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:S,authoredCompositionDurationFloorSeconds:E,selectedDurationSeconds:Me,selectedTimelineIds:[he]}}}}let _e=Fe(ne?.getAttribute("data-duration")),Re=Math.max(Q(_e)?_e:0,E??0);if(Re>0&&Q(Re)&&Q(le)&&Re>=le+.5){let de=Te;if(typeof de.to=="function")try{de.to({},{duration:0,data:wu},Re)}catch(re){P("runtime.init.site6",re)}let Me=z(Te);if(Q(Me))return{timeline:Te,selectedTimelineIds:[he],selectedDurationSeconds:Me,mediaDurationFloorSeconds:S,diagnostics:{code:"root_timeline_padded_to_declared_duration",details:{rootCompositionId:he,rootDurationSeconds:le,rootDeclaredDur:_e,authoredCompositionDurationFloorSeconds:E,newDur:Me}}}}return{timeline:Te,selectedTimelineIds:[he],selectedDurationSeconds:le,mediaDurationFloorSeconds:S,diagnostics:ie.length>0?{code:"root_timeline_auto_nested_children",details:{rootCompositionId:he,selectedDurationSeconds:le,autoNestedChildren:ie}}:void 0}}if(Le.length>0){let pe=Le.map(_e=>_e.compositionId),ie=ee(Le),le=z(ie);if(ie)return ln(ke(ie,Le)),{timeline:ie,selectedTimelineIds:pe,selectedDurationSeconds:le,mediaDurationFloorSeconds:S,diagnostics:{code:"root_timeline_missing_fallback",details:{rootCompositionId:he,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:L,selectedDurationSeconds:le,mediaDurationFloorSeconds:S,selectedTimelineIds:pe}}}}return h("root_composition_id_unmatched_in_registry")},En=!1,kb=c=>{let h=window.gsap,g=c;if(!(!g||typeof g.getChildren!="function"||!h||typeof h.parseEase!="function"))for(let S of g.getChildren(!0,!0,!0)){let E=S,C=E.timeline;if(!C||!("_ease"in C)||typeof C._ease=="function")continue;let L=E.vars?.keyframes,W=(L&&!Array.isArray(L)?L.ease:void 0)??E.vars?.ease??"none";try{let ee=h.parseEase(W);typeof ee=="function"&&(C._ease=ee)}catch(ee){Ye("keyframe_ease_repair_failed",{ease:typeof W=="string"?W:String(W)}),P("runtime.keyframeEase.repair",ee)}}},An=()=>{if(x(),!ae)return!1;let c=e.capturedTimeline,h=z(c),g=Q(h);if(c&&g&&En)return!1;let S=ha();if(!S.timeline)return!1;if(c&&c===S.timeline)return typeof c.timeScale=="function"&&c.timeScale(e.playbackRate),!1;e.capturedTimeline=S.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate),kb(e.capturedTimeline);let E=je(e.capturedTimeline,0);if(E<=0&&typeof e.capturedTimeline.progress=="function"&&(e.capturedTimeline.progress(1,!0),e.capturedTimeline.progress(0,!1),Et(e.capturedTimeline)),E>0){try{m.setDuration(E)}catch{}if(typeof e.capturedTimeline.totalTime=="function"){typeof e.capturedTimeline.progress=="function"&&e.capturedTimeline.progress(1e-4,!0);let L=Math.max(0,e.currentTime||0);e.capturedTimeline.totalTime(L,!1),Et(e.capturedTimeline)}let C=window.__hfStudioManualEditsApply;typeof C=="function"&&C(),ii(document)}if(S.diagnostics&&we({source:"hf-preview",type:"diagnostic",code:S.diagnostics.code,details:S.diagnostics.details}),we({source:"hf-preview",type:"diagnostic",code:"timeline_bound",details:{selectedTimelineIds:S.selectedTimelineIds??[],selectedDurationSeconds:S.selectedDurationSeconds??null,mediaDurationFloorSeconds:S.mediaDurationFloorSeconds??null}}),window.parent!==window){let C=Y(),L=E>0?E:0,k=String(L>0?L:1),W=new Set,ee=se=>se.tagName.toLowerCase()===Pn,te=new Set(document.querySelectorAll("[data-start]")),ke=se=>{let ne=se.parentElement;for(;ne&&ne!==C;){if(te.has(ne))return!0;ne=ne.parentElement}return!1};if(e.capturedTimeline.getChildren)try{for(let se of e.capturedTimeline.getChildren(!0))if(typeof se.targets=="function")for(let ne of se.targets())ye(ne)&&ne!==C&&(ee(ne)||ne.hasAttribute("data-start")||ke(ne)||W.has(ne)||(W.add(ne),ne.setAttribute("data-start","0"),ne.setAttribute("data-duration",k),ne.setAttribute("data-hf-autostamped","1")))}catch{}if(ye(C))for(let se of C.querySelectorAll("[id]"))ye(se)&&se!==C&&(se.hasAttribute("data-start")||ke(se)||W.has(se)||se.tagName==="SCRIPT"||se.tagName==="STYLE"||se.tagName==="LINK"||ee(se)||(W.add(se),se.setAttribute("data-start","0"),se.setAttribute("data-duration",k),se.setAttribute("data-hf-autostamped","1")))}for(let C of _n)ar.delete(C),ga(C);return!0},qu=()=>{if(e.tornDown)return;let c=ha();if(!c.timeline){e.capturedTimeline=null,En=!1,m.setDuration(0),wn(e.currentTime);return}e.capturedTimeline!==c.timeline&&(En=!1,An()),wn(e.currentTime)};t=()=>{qu(),ut()},window.__hfForceTimelineRebind=qu;let Mb=()=>{let c=Y();if(!ye(c))return;let h=c.getBoundingClientRect(),g=pn(c.getAttribute("data-width")),S=pn(c.getAttribute("data-height")),E=window.getComputedStyle(c),C=g!==null&&S!==null,L=h.width<=0||h.height<=0||c.clientWidth<=0||c.clientHeight<=0;!C||!L||w("root_stage_layout_zero",{compositionId:c.getAttribute("data-composition-id")??null,declaredWidth:g,declaredHeight:S,rectWidth:Math.round(h.width),rectHeight:Math.round(h.height),clientWidth:c.clientWidth,clientHeight:c.clientHeight,display:E.display,visibility:E.visibility,overflow:E.overflow},`root-stage-layout-zero:${c.getAttribute("data-composition-id")??"unknown"}`)},Nb=()=>{e.tornDown||(s!=null&&window.cancelAnimationFrame(s),s=window.requestAnimationFrame(()=>{s=null,Mb()}))},Lb=()=>{i=c=>{let h=R(c.error??c.message).slice(0,M);if(!h)return;let g=U(h);we({source:"hf-preview",type:"diagnostic",code:g.code,details:{category:g.category,message:h,filename:c.filename||null,line:Number.isFinite(c.lineno)?c.lineno:null,column:Number.isFinite(c.colno)?c.colno:null}})},o=c=>{let h=R(c.reason).slice(0,M);if(!h)return;let g=U(h);we({source:"hf-preview",type:"diagnostic",code:`${g.code}_unhandled_rejection`,details:{category:`${g.category}-unhandled-rejection`,message:h}})},window.addEventListener("error",i),window.addEventListener("unhandledrejection",o)},ju=new WeakSet,Fb=()=>{let c=Array.from(document.querySelectorAll("img, video, audio, source, link[rel=\'stylesheet\']"));for(let g of c){if(ju.has(g))continue;ju.add(g);let S=()=>{if(!Ne(g))return;let E=g.tagName.toLowerCase(),C=g.getAttribute("src")??g.getAttribute("href")??g.getAttribute("poster")??null,L=E==="link"?"runtime_stylesheet_load_failed":"runtime_asset_load_failed";w(L,{tagName:E,assetUrl:C,currentSrc:(Oe(g)||be(g))&&g.currentSrc||null,readyState:be(g)?g.readyState:null,networkState:be(g)?g.networkState:null},`${L}:${E}:${C??"unknown"}`)};g.addEventListener("error",S),_(()=>{g.removeEventListener("error",S)})}let h=document.fonts;h&&h.ready.then(()=>{if(e.tornDown)return;let g=Array.from(h).filter(S=>S.status==="error").map(S=>S.family).filter(S=>!!S).slice(0,10);g.length!==0&&w("runtime_font_load_issue",{failedFamilies:g,totalFaces:Array.from(h).length},`runtime-font-load-issue:${g.join("|")}`)}).catch(()=>{})},Db=(c,h)=>{if(!c.timeline)return!1;let g=e.capturedTimeline;if(g&&g===c.timeline)return!1;let S=Math.max(0,e.currentTime||0),E=e.isPlaying;e.capturedTimeline=c.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);try{Et(e.capturedTimeline),typeof e.capturedTimeline.seek=="function"&&e.capturedTimeline.seek(S,!1),E&&typeof e.capturedTimeline.play=="function"&&e.capturedTimeline.play()}catch(C){P("runtime.init.site7",C)}return we({source:"hf-preview",type:"diagnostic",code:"timeline_loop_guard_rebind",details:{reason:h,previousTime:S,selectedTimelineIds:c.selectedTimelineIds??[],selectedDurationSeconds:c.selectedDurationSeconds??null,mediaDurationFloorSeconds:c.mediaDurationFloorSeconds??null}}),!0},rn=null,Ku=!1,_n=new Set,ar=new WeakMap,_i=()=>{e.tornDown||(rn!=null&&window.clearTimeout(rn),rn=window.setTimeout(()=>{if(e.tornDown||(rn=null,Hu()))return;let c=ha();if(!c.timeline||!Q(c.mediaDurationFloorSeconds??null))return;if(!e.capturedTimeline){An()&&(ut(),Ge(!0));return}if(Ku)return;let g=z(e.capturedTimeline),S=c.selectedDurationSeconds??z(c.timeline);Q(S)&&(!Q(g)||S>=g+O)&&Db(c,"manual")&&(Ku=!0,we({source:"hf-preview",type:"diagnostic",code:"timeline_rebind_after_media_metadata",details:{previousDurationSeconds:g??null,selectedDurationSeconds:S??null,selectedTimelineIds:c.selectedTimelineIds??[],mediaDurationFloorSeconds:c.mediaDurationFloorSeconds??null}}),ut(),Ge(!0))},T))},Xu=c=>{be(c.currentTarget)&&kf(c.currentTarget)},Yu=c=>{be(c.currentTarget)&&Mf(c.currentTarget)},Ju=c=>{Ba(c)&&dg(c)&&Zn(c,Qn(c))},Qu=c=>{let h=c.currentTarget;be(h)&&Ju(h)},Zu=c=>{c.removeEventListener("loadedmetadata",_i),c.removeEventListener("durationchange",_i),c.removeEventListener("loadedmetadata",Xu),c.removeEventListener("loadedmetadata",Qu),c.removeEventListener("error",Yu),_n.delete(c)},Ib=()=>{for(let c of _n)Zu(c)},Pb=()=>{for(let c of _n)if(!c.isConnected){Zu(c),c.pause();for(let h of c.querySelectorAll("source"))h.remove();c.removeAttribute("src"),c.load()}},ec=c=>{let h=Number.parseFloat(c.dataset.volume??"");return Number.isFinite(h)?Math.max(0,Math.min(1,h)):null},wi=()=>{if(e.tornDown)return;let c=Array.from(document.querySelectorAll("video, audio"));for(let h of c){if(_n.has(h))continue;_n.add(h);let g=ec(h);g!==null&&(h.volume=g),h.addEventListener("loadedmetadata",_i),h.addEventListener("durationchange",_i),h.addEventListener("loadedmetadata",Qu),Ju(h),h.addEventListener("loadedmetadata",Xu),h.addEventListener("error",Yu),Rf(h),Hc(h),ga(h)}},ga=c=>{ar.has(c)||cf(c,e.capturedTimeline,je(e.capturedTimeline,0),ar,{allowLiveTimelineSeek:!window.__HF_RENDER_CAPTURE_MODE})},ba=new WeakMap,Ob=c=>{let h=ba.get(c);if(h!==void 0)return h;let g=window.getComputedStyle(c).position,S=g==="static"||g==="relative"||g==="sticky";return ba.set(c,S),S},xa=new WeakMap,Hb=c=>{let h=xa.get(c);if(h!==void 0)return h;let g=c.querySelector("[data-start]")===null;return xa.set(c,g),g},Gb=()=>{ba=new WeakMap,xa=new WeakMap},Ci=new WeakMap,tc=(c,h)=>{if(!Ci.has(c)){let g=c.style.getPropertyValue("display"),S=c.style.getPropertyPriority("display"),E=h&&g==="none"&&!S;Ci.set(c,E?{value:"",priority:""}:{value:g,priority:S})}c.style.display="none"},nc=c=>{let h=Ci.get(c);h&&(Ci.delete(c),h.value?c.style.setProperty("display",h.value,h.priority):c.style.removeProperty("display"))},Ti=new WeakSet,Ri=!1,rc=c=>c.matches("audio[data-start]")||c.querySelector("audio[data-start]")!==null,ic=new WeakMap,Bb=(c,h)=>{for(let g of document.querySelectorAll("audio[data-start]")){if(!be(g)||ao(g)!==c||f.routesElement(g)||p(g))continue;let S=V(g),E=Fe(g.dataset.duration),C=E!=null&&E>0?S+E:1/0;if(Number.isFinite(S)&&h<C)return!0}return!1},Ub=c=>{let h=!1;for(let g of document.querySelectorAll(Pn)){let S=g.hasAttribute("data-hidden"),E=ic.get(g);E!==S&&(ic.set(g,S),g.id&&(f.setGroupMuted(g.id,S),E&&!S&&Bb(g.id,c)&&(h=!0)))}return h},oc=c=>{let h=je(e.capturedTimeline,0,c);return(g,S)=>So(g,{currentTime:S,compositionDuration:h,canonicalFps:e.canonicalFps,exportRenderSeek:!!window.__HF_EXPORT_RENDER_SEEK_CONFIG,timelineRegistry:window.__timelines??{},resolver:$(!0)})},ac=(c,h,g,S)=>{for(let E=c;E&&E!==S;E=E.parentElement)if(ye(E)&&E.hasAttribute("data-start")&&!g(E,h))return!1;return!0},sc=Ia(),lc=2,Wb=(c,h,g)=>{let S=K(c,Number.NaN);return S>g&&S<=g+lc||h(c,g+lc)},Vb=(c,h,g)=>{let S=Y(),E=!1,C=oc(g);for(let k of h){if(!ye(k))continue;if(k.hasAttribute("data-hidden")){Ti.has(k)||(Ti.add(k),rc(k)&&(Ri=!0)),tc(k,!1),(Ee(k)||Oe(k))&&r?.setSourceVisibility(k,!1);continue}Ti.has(k)&&(nc(k),Ti.delete(k),rc(k)&&(Ri=!0));let W=C(k,c)&&ac(k.parentElement,c,C,S);k.style.visibility=W?"visible":"hidden",k.toggleAttribute(dr,sc&&!W&&Wb(k,C,c)),!be(k)&&!Oe(k)&&(E=!0),(Ee(k)||Oe(k))&&r?.setSourceVisibility(k,W),W?nc(k):Ob(k)&&Hb(k)&&tc(k,!0)}E&&Qc()&&r?.refresh();let L=Ub(c);if((Ri||L)&&m.isPlaying()){f.stopAll();for(let k of document.querySelectorAll("audio[data-start]"))be(k)&&p(k)&&(k.volume=0);Ma()}Ri=!1},wn=(c,h=Array.from(document.querySelectorAll("[data-start]")),g)=>q(()=>Vb(c,h,g)),$b=c=>q(()=>{if(!sc)return[];let h=Y(),g=oc();return Array.from(document.images).filter(S=>S.closest(\'[data-start][style*="visibility: hidden"]\')!==null&&(S.closest(fr)!==null||!S.complete)&&ac(S,c,g,h))}),sr=null,on=null,ki=[],uc=c=>c.hasAttribute("data-start")||!!G(c).compositionRoot,ya=c=>Ef({elements:c,shouldIncludeElement:uc,resolveStartSeconds:h=>V(h),resolveDurationSeconds:h=>{let g=G(h),S=V(h),E=g.inheritedStart!=null&&g.inheritedDuration!=null&&g.inheritedDuration>0?Math.max(0,g.inheritedStart+g.inheritedDuration-S):null,C=Number.isFinite(h.duration)?pt(h,h.duration):null,L=Fe(h.dataset.duration),k=L!=null&&L>0?L:null;return vf({isVideo:h.tagName==="VIDEO",sourceDuration:C,hostRemaining:E,explicitDuration:k})}}),zb=()=>{let c=or();if(sr&&sr.revision===c)return sr;let h=ya().mediaClips;return sr={revision:c,clips:h,byStart:[...h].sort((g,S)=>g.start-S.start),byEnd:[...h].sort((g,S)=>g.end-S.end)},on=null,ki=[],sr},cc=(c,h,g,S)=>{let E=0,C=c.length;for(;E<C;){let k=E+C>>1;h(c[k])<g?E=k+1:C=k}let L=[];for(let k=E;k<c.length&&h(c[k])<=S;k+=1)L.push(c[k]);return L},qb=(c,h,g)=>{let S=on;if(S===null)return c.clips.map(W=>W.el);let E=2*Da(Math.max(Math.abs(S),Math.abs(h))),C=Math.min(S,h)-E,L=Math.max(S,h)+E,k=new Set;for(let W of ki)k.add(W.el);for(let W of cc(c.byStart,ee=>ee.start,C,L+g))k.add(W.el);for(let W of cc(c.byEnd,ee=>ee.end,C,L))k.add(W.el);return[...k]},Mi=new WeakSet,dc=c=>{Mi.add(c)},fc=c=>{Mi.delete(c)};window.__hf.leasePausedMedia=dc,window.__hf.releasePausedMedia=fc;let jb=c=>{let h=zu.get(c),g=h?document.querySelector(`[data-composition-id="${CSS.escape(h)}"]`):null,S=g?X(g):null;return g&&S?K(g,0)+S:1/0},mc=c=>{let h=0;for(let g of c){if(g.data===wu)continue;let S=g.getChildren?g:g.timeline,E=Number(g.duration?.())/Number(S?.duration?.()),C=S?.getChildren?mc(S.getChildren(!1,!0,!0))*(Number.isFinite(E)&&E>0?E:1):Number(g.duration?.())||0,L=Math.abs(Number(g.timeScale?.())||1),k=(Number(g.startTime?.())||0)+C/L;k>=yo||(h=Math.max(h,Math.min(k,jb(g))))}return h};window.__hf.animationEnd=()=>{let c=e.capturedTimeline,h=c?.getChildren?mc(c.getChildren(!1,!0,!0)):z(c)??0,g=Math.max(h,pa(!0)??0);return g>0&&g<yo?g:null},window.__hf.audioMeter={start:()=>f.startMetering(),stop:()=>f.stopMetering(),read:()=>f.readLevels()};let Kb=()=>{for(let c of document.querySelectorAll("video, audio"))if(be(c)&&!c.paused&&uc(c)&&!Mi.has(c))return!0;return!1},pc=()=>nn();document.addEventListener("play",pc,!0),a.push(()=>{document.removeEventListener("play",pc,!0)});let Ke=c=>{let h=!ir,g=e.isPlaying&&!e.mediaForceSyncNextTick&&on!==null?Math.min(Math.max(0,e.currentTime-on),Ut*Math.min(1,e.playbackRate)):0,S=q(()=>{if(!h)return ya().mediaClips;let L=zb();return ya(qb(L,e.currentTime,g)).mediaClips});for(let L of S){let k=ar.get(L.el);k&&(L.volumeKeyframes=k)}let E=e.isPlaying?S:S.filter(L=>!Mi.has(L.el)),C=e.mediaForceSyncNextTick;C&&(e.mediaForceSyncNextTick=!1),e.nativeMediaSyncDisabled||(Af({clips:E,timeSeconds:e.currentTime,playing:e.isPlaying,playbackRate:e.playbackRate,outputMuted:e.mediaOutputMuted,userMuted:e.bridgeMuted,userVolume:e.bridgeVolume,forceSync:C,cueAheadSeconds:g,getCompositionDuration:()=>je(e.capturedTimeline,0,c),onElementVolume:(L,k,W)=>f.setElementVolume(L,W),isWebAudioOwned:L=>f.ownsElement(L),isWebAudioRouted:L=>f.routesElement(L),onAutoplayBlocked:()=>{e.mediaAutoplayBlockedPosted||(e.mediaAutoplayBlockedPosted=!0,we({source:"hf-preview",type:"media-autoplay-blocked"}))}}),h?(on=e.currentTime,ki=S.filter(L=>Ot(e.currentTime,L.start-Ut,L.end))):(on=null,ki=[])),wn(e.currentTime,void 0,c)},Ge=c=>{c&&nn();let h=Math.max(0,Math.round((e.currentTime||0)*e.canonicalFps)),g=Date.now();(c||h!==e.bridgeLastPostedFrame||e.isPlaying!==e.bridgeLastPostedPlaying||e.bridgeMuted!==e.bridgeLastPostedMuted||g-e.bridgeLastPostedAt>=e.bridgeMaxPostIntervalMs)&&(e.bridgeLastPostedFrame=h,e.bridgeLastPostedPlaying=e.isPlaying,e.bridgeLastPostedMuted=e.bridgeMuted,e.bridgeLastPostedAt=g,we({source:"hf-preview",type:"state",frame:h,currentTime:e.currentTime||0,ended:m.reachedEnd(),isPlaying:e.isPlaying,muted:e.bridgeMuted,playbackRate:e.playbackRate}))},Sa="",hc=!1,gc=!1,bc=0,xc="",Xb=()=>{let c="";for(let h of document.querySelectorAll("[data-start]"))c+=`${h.id}:${h.tagName}|`;return c},ut=()=>{A(),N(),H();let c=Y();if(c){let S=Un(c.getAttribute("data-width")),E=Un(c.getAttribute("data-height"));S!==null&&E!==null&&we({source:"hf-preview",type:"stage-size",width:S,height:E})}An();let h=js({canonicalFps:e.canonicalFps});window.__clipManifest=h,xc=JSON.stringify(h);let g=Xb();if(Sa!==g&&Gb(),!window.__clipTree||Sa!==g){let S=window;window.__clipTree=xm({startResolver:Qe({timelineRegistry:S.__timelines??{},includeAuthoredTimingAttrs:!0}),timelineRegistry:S.__timelines??{},rootDuration:h.durationInFrames/e.canonicalFps}),Sa=g}we({...h,assetsReady:gc}),hc||(hc=!0,Tg(document,({timedOut:S})=>{e.tornDown||(gc=!0,we({source:"hf-preview",type:"assets-ready",timedOut:S}))})),Nb()},Yb=()=>{JSON.stringify(js({canonicalFps:e.canonicalFps}))!==xc&&ut()},va=c=>typeof c=="number"&&Number.isFinite(c)&&c>0?c:0,Jb=c=>{let h=va(Number(c));if(h<=0)return;let g=Y(),S=va(Fe(g?.getAttribute("data-duration"))),E=Math.max(bc,va(m.getDuration()),S);h<=E||(bc=h,g?.setAttribute("data-duration",String(h)),m.setDuration(h),ut(),Ge(!0))},Xe=(c,h=0,g)=>{for(let S of e.deterministicAdapters){try{c==="discover"&&S.discover(),c==="pause"&&S.pause({pageAnimations:g}),c==="play"&&S.play&&S.play()}catch(E){P("runtime.init.site8",E)}if(c==="discover")try{S.seek({time:h,suppressEvents:!0})}catch(E){P("runtime.init.site9",E)}}},an=()=>{window.__renderReady=!1},Qb=Pg(()=>{let c=[];for(let h of e.deterministicAdapters){let g=h.getReadyPromise;if(typeof g=="function")try{let S=g();S&&c.push(S)}catch(S){P("runtime.init.adapterReady",S)}}return c},()=>an(),c=>P("runtime.init.adapterReady",c)),Zb=Pg(()=>{let c=window.__hf?.buildReady;return c?Object.values(c).filter(h=>h!=null&&typeof h.then=="function"):[]},()=>an(),c=>P("runtime.init.buildReady",c)),ex=()=>{wi(),Fb();let c=Fl();return Wo(document),Jo(document.body,e.canonicalFps),c};if(ae)Fl();else{let c={injectedStyles:e.injectedCompStyles,injectedScripts:e.injectedCompScripts,injectedLinks:e.injectedCompLinks,parseDimensionPx:j,onDiagnostic:({code:h,details:g})=>{we({source:"hf-preview",type:"diagnostic",code:h,details:g})}};Eh(c).then(()=>vh(c)).finally(()=>{ae=!0,ex(),an()})}let yc=c=>{let h=new Set,g=S=>{for(let E of(S??"").matchAll(/url\\(\\s*([\'"]?)(.*?)\\1\\s*\\)|@import\\s+([\'"])(.*?)\\3/gi))h.add(E[2]??E[4]);for(let E of(S??"").matchAll(/image-set\\((?:[^()]|\\([^()]*\\))*\\)/gi))for(let C of E[0].matchAll(/([\'"])(.*?)\\1/g))h.add(C[2])};for(let S of c)if(S.tagName==="STYLE"&&g(S.textContent),!(S.tagName==="STYLE"||S.tagName==="SCRIPT"))for(let E of[S,...S.querySelectorAll("*")]){let C=CC.get(E.localName)??[],L=[Oh(E),...[...C,"poster","srcset"].map(k=>E.getAttribute(k))];for(let k of L)k&&h.add(k);g(E.getAttribute("style"))}return h},Ea=0,tx=(c,h,g)=>{let S=new Map;for(let E of g?c.querySelectorAll("video, audio"):[]){let C=Si.get(E);if(!C||r?.isGraded(E))continue;let{srcObject:L,sinkId:k,mediaKeys:W}=E;L||k||W||S.set(C,[...S.get(C)??[],E])}for(let E of h.querySelectorAll("video, audio")){let C=Tu(E),L=S.get(C)?.shift();if(!L||Og(L)!==Og(E)){Si.set(E,C);continue}E.replaceWith(L),window.gsap?.set?.(L,{clearProps:"all"});let k=E.getAttribute("style");k===null?L.removeAttribute("style"):L.setAttribute("style",k),Fh(L);let W=L;W.volume=ec(W)??1,W.muted=e.bridgeMuted||e.mediaOutputMuted||W.defaultMuted,W.defaultPlaybackRate=1,W.playbackRate=e.playbackRate,W.preservesPitch=!0}},Sc=c=>[c,...c.querySelectorAll("[data-composition-id]")].flatMap(h=>h.getAttribute("data-composition-id")||[]),nx=(c,h,g,S)=>{let E=new Set(Sc(h).flatMap(k=>[g[k],...S[k]??[]])),C=new Set([h,...h.querySelectorAll("*")]);for(let k of window.gsap?.globalTimeline?.getChildren?.(!0,!0,!1)??[]){if(!k.targets?.().some(ee=>C.has(ee)))continue;let W=k;for(;W&&!E.has(W);)W=W.parent;if(!W)throw new Error(`scene ${c} cannot be swapped: an animation outside it moves its elements`)}let L=k=>typeof k?.nodeType=="number"&&!C.has(k);for(let k of E)for(let W of k?[k,...k.getChildren?.(!0,!0,!1)??[]]:[])if(W.targets?.().some(L))throw new Error(`scene ${c} cannot be swapped: its animations write outside the scene`)},rx=async(c,h)=>{let g=Ea,S=new DOMParser().parseFromString(c,"text/html"),E=yi(document),C=yi(S);if(!E||!C)throw new Error("no scene manifest");if(E.shared!==C.shared)throw new Error("the film changed outside its scenes");let L=Object.keys(C.scenes);if(L.length!==Object.keys(E.scenes).length||L.some(re=>!(re in E.scenes)))throw new Error("scenes were added or removed");let k=L.filter(re=>C.scenes[re]!==E.scenes[re]);if(k.length===0)throw new Error("no scene changed");let W=k.map(re=>{let me=ft=>Array.from(ft.querySelectorAll(`[${El}="${CSS.escape(re)}"]`)),ge=ft=>ft.tagName!=="STYLE"&&ft.tagName!=="SCRIPT",xe=me(document),dt=me(S),nt=xe.filter(ge),un=dt.filter(ge),Be=nt[0],Pt=un[0];if(!Be||!Pt||nt.length>1||un.length>1)throw new Error(`scene ${re} cannot be swapped: it has no single host`);if(Be.hasAttribute("data-hf-original-composition-id"))throw new Error(`scene ${re} cannot be swapped: it is a duplicated instance`);let Pc=Be.getAttribute(Al)??Pt.getAttribute(Al);if(Pc!==null)throw new Error(`scene ${re} cannot be swapped: ${Pc}`);let bx=yc(xe);if([...yc(dt)].some(ft=>!bx.has(ft)))throw new Error(`scene ${re} cannot be swapped: it loads media this scene has not loaded`);let Oc=ft=>ft.filter(xx=>xx.tagName==="STYLE").length;if(Oc(xe)!==Oc(dt))throw new Error(`scene ${re} cannot be swapped: its styles moved`);return{name:re,oldParts:xe,homes:xe.map(ft=>ft.parentNode),newParts:dt,oldHost:Be,newHost:Pt}}),ee=()=>{let re=Y(),me=new Set;for(let ge of document.querySelectorAll(`[${El}]`)){if(ge.tagName==="STYLE"||ge.tagName==="SCRIPT")continue;let xe=ge.parentElement;for(;xe;xe=xe===re?null:xe.parentElement)me.add(xe)}return[...me].flatMap(ge=>[ge,...Array.from(ge.children).filter(xe=>!xe.hasAttribute("data-hf-ignore")),null])},te=ee(),ke=W.some(({newHost:re})=>re.querySelector(".caption-group"))?await Th():[];if(e.tornDown)throw new Error("the preview was torn down during the swap");if(h?.aborted)throw new Error("the swap was cancelled");if(g!==Ea)throw new Error("the preview changed while this swap waited");let se=()=>{let re=({oldParts:xe,homes:dt})=>xe.some((nt,un)=>!nt.isConnected||nt.parentNode!==dt[un]),me=ee();if(me.length!==te.length||me.some((xe,dt)=>xe!==te[dt])||W.some(re))throw new Error("a scene changed while this swap waited")};se();let ne=()=>window.__timelines??(window.__timelines={}),he=()=>window.__hfSceneAnimations??(window.__hfSceneAnimations={}),Te=()=>{for(let{name:re,oldHost:me}of W)nx(re,me,ne(),he())};Te(),Ea+=1;let We=e.capturedTimeline,Le=[],ln=[],pe=W.flatMap(({oldHost:re})=>Sc(re)),ie=new Set,le=()=>{let re=ie.size;for(let me of pe)for(let ge of[...(he()[me]??[]).slice().reverse(),ne()[me]]){if(!ge||ie.has(ge))continue;ie.add(ge);let xe=ge;xe.revert?xe.revert():xe.totalTime?.(0,!0),We?.remove?.(ge),xe.revert||xe.kill?.()}return ie.size>re},_e=0;for(;le();)if(++_e>8)throw new Error("the old scene keeps starting animations as they stop");se(),Te();for(let re of pe)delete ne()[re],delete he()[re];f.stopAll(),m.detachAudioSource();for(let{oldParts:re,newParts:me,oldHost:ge,newHost:xe}of W){let dt=me.filter(Be=>Be.tagName==="STYLE");re.filter(Be=>Be.tagName==="STYLE").forEach((Be,Pt)=>Be.replaceWith(document.importNode(dt[Pt],!0)));for(let Be of re)Be!==ge&&Be.remove();let nt=document.importNode(xe,!0),un=Be=>Be.flatMap(Pt=>Pt.tagName==="SCRIPT"?Pt.outerHTML:[]).join("");tx(ge,nt,un(re)===un(me)),ge.replaceWith(nt),ln.push(nt),nt.querySelector(".caption-group")&&Le.push(nt)}for(let{newParts:re}of W)for(let me of re){if(me.tagName!=="SCRIPT")continue;let ge=document.createElement("script");for(let xe of Array.from(me.attributes))ge.setAttribute(xe.name,xe.value);ge.textContent=me.textContent,document.body.appendChild(ge)}document.querySelector(`meta[name="${ri}"]`)?.setAttribute("content",JSON.stringify(C));for(let re of ln)Wo(document,re);wi();let Re=()=>{for(let re of Le)for(let me of[re,...re.querySelectorAll("[data-composition-id]")]){let ge=me.getAttribute("data-composition-id");ge&&window.__timelines?.[ge]?.totalTime?.(0,!0)}};Jo(document.body,e.canonicalFps),Dl(ke,Le,Re),Pb(),En=!1,An();for(let re of ln)for(let me of re.querySelectorAll("video, audio"))ar.delete(me),ga(me);let de=je(e.capturedTimeline,0);de>0&&m.setDuration(de),Xe("discover",e.currentTime),ii(document);let Me=m.isPlaying()&&de>0&&e.currentTime>=de;Li.seek(Me?de:e.currentTime,{keepPlaying:!Me}),wn(e.currentTime),ut()};yi(document)&&(window.__hfSwapScenes=rx,_(()=>{delete window.__hfSwapScenes}));let Ni=dm({postMessage:c=>we(c)});Ni.installPickerApi(),wn(e.currentTime,Array.from(document.querySelectorAll("video[data-start], img[data-start]")));let ct=h0({lease:dc,release:fc});r=ct,_(()=>{ct.destroy(),r=null}),Jo(document.body,e.canonicalFps);let Aa=c=>{let h=Number(c);!Number.isFinite(h)||h<=0?e.playbackRate=1:e.playbackRate=Math.max(.1,Math.min(5,h)),e.mediaForceSyncNextTick=!0,e.capturedTimeline&&typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);let g=document.querySelectorAll("video, audio");for(let S of g)if(be(S))try{S.playbackRate=e.playbackRate}catch(E){P("runtime.init.site10",E)}},ix=1e3,Dt=null,vc=()=>{let c=Dt;Dt=null,c?.apply()},Ec=(c,h)=>{f.stopAll(),m.detachAudioSource();let g=m.isPlaying();g&&m.pause(),m.seek(c),e.currentTime=m.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0;let S=e.capturedTimeline;Et(S);let E=sn(e.currentTime);if(Xe("pause",0,E),h?.keepPlaying&&g){Li.play();return}Ke(),ct.redraw(),su(e.currentTime),Ge(!0)},Li={play:()=>{vc();let c=e.capturedTimeline;if(m.isPlaying())return;let h=je(c,0);if(h>0){if(m.setDuration(h),m.reachedEnd()){let g=m.getPlayStart();m.seek(g),e.currentTime=g,sn(g)}}else{let g=Y(),S=Number(g?.getAttribute("data-duration")??0);S>0&&m.setDuration(S)}Et(c),m.play()&&(e.isPlaying=!0,e.mediaForceSyncNextTick=!0,Dc(m.now()),b&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&Ma(),Xe("play"),Ke(),ct.redraw(),Ge(!0))},pause:()=>{if(!m.isPlaying())return;f.stopAll(),m.detachAudioSource(),m.pause(),e.isPlaying=!1,e.currentTime=m.now(),e.mediaForceSyncNextTick=!0,Dc(e.currentTime);let c=e.capturedTimeline;Et(c),Xe("pause"),Ke(),ct.redraw(),Ge(!0)},seek:(c,h)=>{let g=Gs(Math.max(0,Number(c)||0),e.canonicalFps);Dt=null;let S=m.isPlaying()?[]:$b(g);if(S.length===0){Ec(g,h);return}let E={time:g,apply:()=>Ec(g,h)};Dt=E;for(let ee of S){ee.hasAttribute(qc)&&ee.setAttribute("loading","eager");for(let te=ee.closest(fr);te;te=ee.closest(fr))te.setAttribute(dr,"")}let C=0,L=new Promise(ee=>{C=window.setTimeout(()=>{Dt===E&&P("runtime.init.seekHoldCap",S),ee()},ix)}),k=Promise.all(S.map(ee=>ee.decode?ee.decode().catch(()=>{}):void 0)),W=Promise.race([k,L]).then(()=>{window.clearTimeout(C),Dt===E&&vc()});return _t(W),W},renderSeek:(c,h)=>{Dt=null,ir=!0;let g=Lr(Math.max(0,Number(c)||0),e.canonicalFps,h?.subFrameDivisions);f.stopAll(),m.detachAudioSource(),m.isPlaying()&&m.pause(),m.seek(g),e.currentTime=m.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0;let S=sn(e.currentTime,{activateChildren:!0,suppressEvents:h?.suppressEvents});Xe("pause",0,S),Ke(),ct.redraw(),su(e.currentTime,{engineMode:!0}),Ge(!0)},getTime:()=>Dt?.time??m.now(),getDuration:()=>{let c=m.getDuration();return Number.isFinite(c)?c:0},isPlaying:()=>m.isPlaying(),setPlaybackRate:c=>{Aa(c),m.setRate(e.playbackRate),Ic()},getPlaybackRate:()=>e.playbackRate},Ac=je(e.capturedTimeline,0);Ac>0&&m.setDuration(Ac);let tt=gm({getTimeline:()=>e.capturedTimeline,setTimeline:c=>{e.capturedTimeline=c},getTimelineRegistry:()=>window.__timelines??{},getIsPlaying:()=>e.isPlaying,setIsPlaying:c=>{e.isPlaying!==c&&(e.mediaForceSyncNextTick=!0),e.isPlaying=c},getPlaybackRate:()=>e.playbackRate,setPlaybackRate:Aa,getCanonicalFps:()=>e.canonicalFps,onSyncMedia:(c,h)=>{e.currentTime=Math.max(0,Number(c)||0),e.isPlaying!==h&&(e.mediaForceSyncNextTick=!0),e.isPlaying=h,Ke()},onStatePost:Ge,onDeterministicSeek:(c,h)=>{for(let g of e.deterministicAdapters)if(!(g.name==="gsap"&&e.capturedTimeline))try{g.seek({time:Number(c)||0,suppressEvents:h?.suppressEvents})}catch(S){P("runtime.init.site11",S)}},onDeterministicPause:()=>Xe("pause"),onDeterministicPlay:()=>Xe("play"),onRenderFrameSeek:()=>{ct.redraw()},onShowNativeVideos:()=>{},getSafeDuration:()=>je(e.capturedTimeline,0),transport:Li});window.__player=I(tt),window.__playerReady=!0,Ye("composition_loaded",{duration:tt.getDuration(),compositionId:kt()?.getAttribute("data-composition-id")??null}),e.deterministicAdapters=[rf(),dd({resolveStartSeconds:c=>K(c,0)}),md(),xd({resolveStartSeconds:c=>K(c,0)}),vd(),Ed(),Ad(),_d(),wd(),Cd(),Td(),fd({getTimeline:()=>e.capturedTimeline})],Md(),Nd(),window.__hfReseekGpu=c=>{let h=Math.max(0,Number(c)||0);window.__hfThreeTime=h,window.__hfTypegpuTime=h,$i(h)},window.__hfWaitForSeekCompletion=za,a.push(()=>{window.__hfWaitForSeekCompletion===za&&delete window.__hfWaitForSeekCompletion}),Lb(),wi(),Xe("discover");let ox=()=>{let c=e.capturedTimeline,h=An();e.capturedTimeline&&(h||e.capturedTimeline!==c||!tt._timeline)&&(tt._timeline=e.capturedTimeline);let g=je(e.capturedTimeline,0);if(g>0&&m.setDuration(g),Xe("discover",e.currentTime),!e.capturedTimeline){let S=window.__timelines??{},E=Object.keys(S).filter(C=>S[C]);if(E.length>0){let L=Y()?.getAttribute("data-composition-id")??null;w("root_timeline_unbound_registry_present",{reason:L?"root data-composition-id has no matching key in window.__timelines":"root composition element has no data-composition-id attribute",rootCompositionId:L,registeredTimelineKeys:E},"root_timeline_unbound_registry_present"),console.warn("[hyperframes] Root timeline not bound \\u2014 render will freeze at t=0. "+(L?`Root data-composition-id is "${L}" but window.__timelines has no such key. `:"Root composition element has no data-composition-id. ")+`Registered timeline keys: [${E.join(", ")}]. Register the root timeline under its data-composition-id (window.__timelines["${L??"<root-id>"}"] = tl).`)}}wn(e.currentTime,Array.from(document.querySelectorAll("[data-start]:not(video, audio, img)"))),window.__renderReady=!0,ut(),Ge(!0)},Cn=null,ax=()=>{if(Cn)return;let c=()=>{window.removeEventListener("hf-timelines-built",c),Cn=null,an()};Cn=c,window.addEventListener("hf-timelines-built",c)};_(()=>{Cn&&(window.removeEventListener("hf-timelines-built",Cn),Cn=null)}),an=()=>{if(!ae){window.__renderReady=!1;return}if(window.__hfTimelinesBuilding){window.__renderReady=!1,ax();return}if(Xe("discover",e.currentTime),!Qb()){window.__renderReady=!1;return}if(!Zb()){window.__renderReady=!1;return}ox()},an(),ae&&setTimeout(()=>{an()},0);let _a=0,Fi=!1,wa=Number.NaN,Ca=null,Di=!1,It=null,_c=!1,Ii=!1,wc="",Cc=-1,lr=!1,Tc=Number.NEGATIVE_INFINITY,Rc=Number.NEGATIVE_INFINITY,kc="",Mc=!1,sx=(c,h,g,S)=>{try{let E=S?.suppressEvents===!0;Et(c),typeof c.totalTime=="function"?c.totalTime(h,E):c.seek(h,E)}catch(E){P(g,E)}},lx=(c,h)=>{let g=window.__timelines??{},S=Y()?.getAttribute("data-composition-id")??null;for(let[E,C]of Object.entries(g)){if(!C||E===S)continue;let L=document.querySelector(`[data-composition-id="${CSS.escape(E)}"]`);if(!L)continue;let k=K(L,0);if(!Number.isFinite(k))continue;let W=z(C),ee=ht(L)+Zi(Bt(L),Math.max(0,c-k)),te=Math.max(0,W!=null&&W>0?Math.min(W,ee):ee);sx(C,te,"runtime.init.transport.childTimeline",h)}},ux=c=>{let h=window.__timelines??{},g=[];for(let S of Object.values(h))if(!(!S||S===c)){g.push(S);try{S.play()}catch(E){P("runtime.init.activateSiblings",E)}}return g},Nc=c=>typeof c=="object"&&c!==null,ur=new WeakMap,cx=["onStart","onUpdate","onComplete","onReverseComplete","onRepeat"],Lc=(c,h)=>{let g=c[h];if(typeof g!="function")return null;try{let S=Number(g.call(c));return Number.isFinite(S)?S:null}catch(S){return P("runtime.init.gsapCallbackDuration",S),null}},dx=c=>{let h=ur.get(c);if(h!=null)return h;if(!("getChildren"in c)||typeof c.getChildren!="function")return!1;let g;try{g=c.getChildren(!0,!0,!0)}catch(S){return P("runtime.init.gsapCallbackChildren",S),ur.set(c,!1),!1}if(!Array.isArray(g))return ur.set(c,!1),!1;for(let S of g){if(!Nc(S))continue;let E=S.vars;if(!Nc(E)||!cx.some(W=>typeof E[W]=="function"))continue;let k=Lc(S,"totalDuration")??Lc(S,"duration");if(k!=null&&k<=1e-6)return ur.set(c,!0),!0}return ur.set(c,!1),!1};function sn(c,h){let g=e.capturedTimeline,S=g&&h?.activateChildren?ux(g):[];try{return fx(g,c,h)}finally{for(let E of S)Et(E)}}function fx(c,h,g){let S=g?.suppressEvents===!0;if(c){let C=c,L=h;if(typeof C.totalDuration=="function")try{let k=Number(C.totalDuration());Number.isFinite(k)&&k>0&&h>k&&(L=k)}catch(k){P("runtime.init.transport.clampDuration",k)}try{typeof c.totalTime=="function"?(c.totalTime(L,S),!S&&!dx(c)&&(c.totalTime(L+.001,!0),c.totalTime(L,!0))):c.seek(L,S)}catch(k){P("runtime.init.transport.seek",k)}}lx(h,g);let E=RC();for(let C of e.deterministicAdapters)if(!(C.name==="gsap"&&c))try{C.seek({time:h,suppressEvents:S,pageAnimations:E})}catch(L){P("runtime.init.transport.adapter",L)}return E}let Ta=pg(document,()=>{nn()});a.push(()=>Ta.disconnect());let mx=()=>{try{return Ta.isActive()}catch{return!1}},px=()=>!m.isPlaying()&&!Hu()&&Ta.observing&&!Di&&!lr&&e.currentTime===wa&&e.capturedTimeline===Ca,Ra=()=>`${or()}|${pa()??""}`,Fc=()=>{It=window.setTimeout(hx,_c&&e.capturedTimeline&&En?TC:e.bridgeMaxPostIntervalMs)},hx=()=>{if(It=null,!e.tornDown&&!(typeof window>"u"||typeof document>"u")){if(Ra()!==wc){nn();return}Ge(!1),Fc()}},gx=()=>{if(e.transportRafId=null,e.tornDown)return;let c=Ii;if(Ii=!1,c||!px()){e.transportRafId=window.requestAnimationFrame(ka);return}wc=Ra(),Fc()};nn=()=>{e.tornDown||(Ii=!0,!(Fi||e.transportRafId!=null)&&(It!=null&&(window.clearTimeout(It),It=null),Ii=!1,e.transportRafId=window.requestAnimationFrame(ka)))};let ka=()=>{if(!(e.tornDown||Fi)){Fi=!0;try{_a+=1;let c=or();c!==Cc&&(Cc=c,lr=!0);let h=Date.now(),g=m.isPlaying(),S=g&&h-Rc>=gg,E=Mc&&!g;if(Mc=g,S){Rc=h;let te=Ra();te!==kc&&(kc=te,lr=!0)}let C=lr&&h-Tc>=hg;C&&(Tc=h);let L=te=>!g&&_a%te===0;if(bg({tick:_a,isPlaying:g,hasCapturedTimeline:e.capturedTimeline!=null,currentTimeSeconds:m.now(),compositionChanged:C,playingPollDue:S})){let te=e.capturedTimeline;if(An()){e.capturedTimeline&&!tt._timeline&&(tt._timeline=e.capturedTimeline),e.capturedTimeline&&e.capturedTimeline!==te&&Et(e.capturedTimeline);let ke=je(e.capturedTimeline,0,c);ke>0&&m.setDuration(ke),ut()}}if(C||L(20)?(ut(),lr=!1):(S||E)&&Yb(),(C||L(30))&&wi(),e.capturedTimeline){let te=je(e.capturedTimeline,0,c);te>0&&(!m.isPlaying()||te>=m.getDuration())&&m.setDuration(te)}if(m.isPlaying()&&!e.mediaOutputMuted)if(!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&f.ownsClock()&&f.context){let te=f.getTime();te>=0&&m.attachAudioSource({currentTimeSeconds:te})}else{let te=document.querySelectorAll("audio[data-start]"),ke=m.audioElement(),se=!1;for(let ne of ke?[ke,...te]:te){if(!be(ne)||!ne.isConnected||p(ne)||ms(ne)||!ne.hasAttribute("src")&&!ne.querySelector("source[src]"))continue;let he=V(ne),Te=Fe(ne.dataset.duration),We=Te!=null&&Te>0?he+Te:1/0,Le=ht(ne);if(Number.isFinite(he)&&Ot(e.currentTime,he,We)){ne.paused?ne.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&(m.attachAudioSource({currentTimeSeconds:e.currentTime}),se=!0):(m.attachAudioSource({el:ne,compositionStart:he,mediaStart:Le,rate:Bt(ne)}),se=!0);break}}!se&&m.hasAudioSource()&&m.detachAudioSource()}else m.hasAudioSource()&&m.detachAudioSource();let k=m.now();e.currentTime=k;let W=m.isPlaying();if(!W&&mx()?Di=!0:(W||Di||k!==wa||e.capturedTimeline!==Ca)&&(sn(k),wa=k,Ca=e.capturedTimeline,W||(Di=!1)),W&&ct.redrawAnimated(),m.isPlaying()&&m.reachedEnd()){f.stopAll(),m.detachAudioSource(),m.pause(),e.isPlaying=!1;let te=m.getStopTime();Number.isFinite(te)&&(m.seek(te),e.currentTime=te,sn(te)),Xe("pause"),Ke(c),Ge(!0);return}m.isPlaying()?Ke(c):Kb()&&(on=null,Ke(c)),Ge(!1)}finally{Fi=!1,gx()}}},Dc=c=>{let h=document.querySelectorAll("video, audio");for(let g of h){if(!be(g)||!g.isConnected||!g.hasAttribute("data-start"))continue;let S=V(g);if(!Number.isFinite(S))continue;let E=Fe(g.dataset.duration),C=E!=null&&E>0?S+E:1/0;if(!Ot(c,S,C))continue;let L=ht(g),k=c-S+L;if(k>=0)try{g.currentTime=k}catch{}}},Ma=()=>{if(e.nativeMediaSyncDisabled||e.webAudioMediaDisabled)return;let c=f.startGeneration(),h=document.querySelectorAll("audio[data-start]");for(let g of h){if(!be(g)||!g.isConnected||p(g))continue;let S=V(g);if(!Number.isFinite(S))continue;let E=ht(g),C=Number.parseFloat(g.dataset.volume??""),L=Number.isFinite(C)?C:1,k=Fe(g.dataset.duration),W=k!=null&&k>0?k:Number.POSITIVE_INFINITY,ee=g.closest("[data-composition-id]");if(ee){let se=K(ee,0),ne=X(ee,{includeAuthoredTimingAttrs:!0});ne!=null&&ne>0&&(W=Math.min(W,Math.max(0,se+ne-S)))}let te=Qn(g);if(Zn(g,te),typeof Bt(g)!="number")continue;(te.kind==="web-audio"?f.scheduleMediaElementPlayback(g,S,E,m.now(),L,c,e.playbackRate):Promise.resolve(null)).then(se=>{let ne=c!==f.currentGeneration();if(se||!m.isPlaying()||ne)return;let he=e.playbackRate*Ve(g),Te=g.hasAttribute("data-fx-chain")||g.hasAttribute("data-automation");if(Math.abs(he-1)>1e-9){te.kind==="web-audio"&&Te&&(g.muted=!0);return}f.decodeAudioElement(g).then(We=>{!We||!m.isPlaying()||f.schedulePlayback(g,We,S,E,()=>m.now(),L,c,e.playbackRate,W)})})}};function Ic(){f.setRate(e.playbackRate)&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&b&&m.isPlaying()&&f.hasBoundedActiveSources()&&(f.stopAll(),Ma())}if(e.capturedTimeline){let c=je(e.capturedTimeline,0);c>0&&m.setDuration(c),Et(e.capturedTimeline)}Dh(window),e.transportRafId=window.requestAnimationFrame(ka),ut(),Ge(!0),e.controlBridgeHandler=Vc({onPlay:()=>{tt.play(),Ye("composition_played",{time:tt.getTime()})},onPause:()=>{tt.pause(),Ye("composition_paused",{time:tt.getTime()})},onStopMedia:()=>{f.stopAll();let c=document.querySelectorAll("video, audio");for(let h of c)be(h)&&!h.paused&&h.pause()},onSeek:(c,h)=>{tt.seek(c),Ye("composition_seeked",{time:c})},onSetMuted:c=>{e.bridgeMuted=c;let h=c||e.mediaOutputMuted;f.setMuted(h);let g=document.querySelectorAll("video, audio");for(let S of g)be(S)&&(S.muted=h||S.defaultMuted)},onSetVolume:c=>{e.bridgeVolume=c,f.setVolume(c);let h=document.querySelectorAll("video, audio");for(let g of h){if(!be(g))continue;let S=parseFloat(g.dataset.volume??""),E=Number.isFinite(S)?S:1;g.volume=ji(E*c)}},onSetMediaOutputMuted:c=>{e.mediaOutputMuted=c;let h=c||e.bridgeMuted;f.setMuted(h);let g=document.querySelectorAll("video, audio");for(let S of g)be(S)&&(S.muted=h||S.defaultMuted)},onSetNativeMediaSyncDisabled:c=>{e.nativeMediaSyncDisabled!==c&&(e.nativeMediaSyncDisabled=c,e.mediaForceSyncNextTick=!0,c?(f.stopAll(),m.detachAudioSource()):Ke())},onSetWebAudioMediaDisabled:c=>{e.webAudioMediaDisabled!==c&&(e.webAudioMediaDisabled=c,e.mediaForceSyncNextTick=!0,c&&(f.stopAll(),m.detachAudioSource()),Ke())},onSetPlaybackRate:c=>{Aa(c),e.transportClock&&e.transportClock.setRate(e.playbackRate),Ic()},onSetIdleHeartbeat:c=>{_c=c,nn()},onSetRootDuration:Jb,onSetPlayRange:(c,h)=>{m.setPlayRange(c,h,e.canonicalFps);let g=m.getPlayStart();if(m.isPlaying()&&(m.now()<g||m.reachedEnd())){Li.seek(g,{keepPlaying:!0});return}Ge(!0)},onSetColorGrading:(c,h)=>{ct.setGrading(c,h)},onSetColorGradingCompare:(c,h)=>{ct.setCompare(c,h)},onTick:()=>{if(e.tornDown||!m.isPlaying())return;let c=m.now();if(e.currentTime=c,sn(c),m.reachedEnd()){f.stopAll(),m.detachAudioSource(),m.pause(),e.isPlaying=!1;let h=m.getStopTime();Number.isFinite(h)&&(m.seek(h),e.currentTime=h,sn(h)),Xe("pause"),Ke(),Ge(!0)}},onEnablePickMode:()=>Ni.enablePickMode(),onDisablePickMode:()=>Ni.disablePickMode(),onSetRuntimeData:ra,onClearRuntimeData:ia,getCanonicalFps:()=>e.canonicalFps});let Na=()=>{if(!e.tornDown){e.tornDown=!0,e.transportRafId!=null&&(window.cancelAnimationFrame(e.transportRafId),e.transportRafId=null),It!=null&&(window.clearTimeout(It),It=null),e.transportClock=null,f.destroy(),rn!=null&&(window.clearTimeout(rn),rn=null),s!=null&&(window.cancelAnimationFrame(s),s=null),Ib(),e.controlBridgeHandler&&(window.removeEventListener("message",e.controlBridgeHandler),e.controlBridgeHandler=null),i&&(window.removeEventListener("error",i),i=null),o&&(window.removeEventListener("unhandledrejection",o),o=null),e.beforeUnloadHandler&&(window.removeEventListener("beforeunload",e.beforeUnloadHandler),e.beforeUnloadHandler=null),Ni.disablePickMode();for(let c of e.deterministicAdapters)if(!(!c||typeof c.revert!="function"))try{c.revert()}catch(h){P("runtime.init.site12",h)}e.deterministicAdapters=[],window.__hf?.buildReady&&(window.__hf.buildReady={});for(let c of a.splice(0))try{c()}catch(h){P("runtime.init.site13",h)}for(let c of e.injectedCompStyles)try{c.remove()}catch(h){P("runtime.init.site14",h)}e.injectedCompStyles=[];for(let c of e.injectedCompLinks)try{c.remove()}catch(h){P("runtime.init.site15",h)}e.injectedCompLinks=[];for(let c of e.injectedCompScripts)try{c.remove()}catch(h){P("runtime.init.site16",h)}e.injectedCompScripts=[],e.capturedTimeline=null,t=()=>{},window.__hfRuntimeTeardown===Na&&(window.__hfRuntimeTeardown=null)}};window.__hfRuntimeTeardown=Na,e.beforeUnloadHandler=Na,window.addEventListener("beforeunload",e.beforeUnloadHandler)}var Ug=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],Ru=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function kC(e){if(e<=255)return Ug[e];let t=0,n=Ru.length-1;for(;t<=n;){let r=t+n>>1,i=Ru[r];if(e<i[0]){n=r-1;continue}if(e>i[1]){t=r+1;continue}return i[2]}return"L"}function MC(e){let t=e.length;if(t===0)return null;let n=new Array(t),r=!1;for(let u=0;u<t;){let d=e.charCodeAt(u),m=d,f=1;if(d>=55296&&d<=56319&&u+1<t){let p=e.charCodeAt(u+1);p>=56320&&p<=57343&&(m=(d-55296<<10)+(p-56320)+65536,f=2)}let b=kC(m);(b==="R"||b==="AL"||b==="AN")&&(r=!0);for(let p=0;p<f;p++)n[u+p]=b;u+=f}if(!r)return null;let i=0;for(let u=0;u<t;u++){let d=n[u];if(d==="L"){i=0;break}if(d==="R"||d==="AL"){i=1;break}}let o=new Int8Array(t);for(let u=0;u<t;u++)o[u]=i;let a=i&1?"R":"L",l=a,s=l;for(let u=0;u<t;u++)n[u]==="NSM"?n[u]=s:s=n[u];s=l;for(let u=0;u<t;u++){let d=n[u];d==="EN"?n[u]=s==="AL"?"AN":"EN":(d==="R"||d==="L"||d==="AL")&&(s=d)}for(let u=0;u<t;u++)n[u]==="AL"&&(n[u]="R");for(let u=1;u<t-1;u++)n[u]==="ES"&&n[u-1]==="EN"&&n[u+1]==="EN"&&(n[u]="EN"),n[u]==="CS"&&(n[u-1]==="EN"||n[u-1]==="AN")&&n[u+1]===n[u-1]&&(n[u]=n[u-1]);for(let u=0;u<t;u++){if(n[u]!=="EN")continue;let d;for(d=u-1;d>=0&&n[d]==="ET";d--)n[d]="EN";for(d=u+1;d<t&&n[d]==="ET";d++)n[d]="EN"}for(let u=0;u<t;u++){let d=n[u];(d==="WS"||d==="ES"||d==="ET"||d==="CS")&&(n[u]="ON")}s=l;for(let u=0;u<t;u++){let d=n[u];d==="EN"?n[u]=s==="L"?"L":"EN":(d==="R"||d==="L")&&(s=d)}for(let u=0;u<t;u++){if(n[u]!=="ON")continue;let d=u+1;for(;d<t&&n[d]==="ON";)d++;let m=u>0?n[u-1]:l,f=d<t?n[d]:l,b=m!=="L"?"R":"L";if(b===(f!=="L"?"R":"L"))for(let y=u;y<d;y++)n[y]=b;u=d-1}for(let u=0;u<t;u++)n[u]==="ON"&&(n[u]=a);for(let u=0;u<t;u++){let d=n[u];(o[u]&1)===0?d==="R"?o[u]++:(d==="AN"||d==="EN")&&(o[u]+=2):(d==="L"||d==="AN"||d==="EN")&&o[u]++}return o}function Wg(e,t){let n=MC(e);if(n===null)return null;let r=new Int8Array(t.length);for(let i=0;i<t.length;i++)r[i]=n[t[i]];return r}var NC=/[ \\t\\n\\r\\f]+/g,LC=/[\\t\\n\\r\\f]| {2,}|^ | $/;function FC(e){let t=e??"normal";return t==="pre-wrap"?{mode:t,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:t,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}function DC(e){if(!LC.test(e))return e;let t=e.replace(NC," ");return t.charCodeAt(0)===32&&(t=t.slice(1)),t.length>0&&t.charCodeAt(t.length-1)===32&&(t=t.slice(0,-1)),t}function IC(e){return/[\\r\\f]/.test(e)?e.replace(/\\r\\n/g,`\n`).replace(/[\\r\\f]/g,`\n`):e.replace(/\\r\\n/g,`\n`)}var ku=null,PC;function OC(){return ku===null&&(ku=new Intl.Segmenter(PC,{granularity:"word"})),ku}var HC=/\\p{Script=Arabic}/u,aa=/\\p{M}/u,Yg=/\\p{Nd}/u;function Vg(e){return HC.test(e)}function $g(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519}function st(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(!(n<12288)){if(n>=55296&&n<=56319&&t+1<e.length){let r=e.charCodeAt(t+1);if(r>=56320&&r<=57343){let i=(n-55296<<10)+(r-56320)+65536;if($g(i))return!0;t++;continue}}if($g(n))return!0}}return!1}function GC(e){let t=ua(e);return t!==null&&(la.has(t)||Qt.has(t))}var BC=new Set(["\\xA0","\\u202F","\\u2060","\\uFEFF"]);function UC(e){return st(e)}function WC(e){let t=ua(e);return t!==null&&BC.has(t)}function sa(e){return!GC(e)&&!WC(e)}var la=new Set(["\\uFF0C","\\uFF0E","\\uFF01","\\uFF1A","\\uFF1B","\\uFF1F","\\u3001","\\u3002","\\u30FB","\\uFF09","\\u3015","\\u3009","\\u300B","\\u300D","\\u300F","\\u3011","\\u3017","\\u3019","\\u301B","\\u30FC","\\u3005","\\u303B","\\u309D","\\u309E","\\u30FD","\\u30FE"]),Ei=new Set([\'"\',"(","[","{","\\u201C","\\u2018","\\xAB","\\u2039","\\uFF08","\\u3014","\\u3008","\\u300A","\\u300C","\\u300E","\\u3010","\\u3016","\\u3018","\\u301A"]),Nu=new Set(["\'","\\u2019"]),Qt=new Set([".",",","!","?",":",";","\\u060C","\\u061B","\\u061F","\\u0964","\\u0965","\\u104A","\\u104B","\\u104C","\\u104D","\\u104F",")","]","}","%",\'"\',"\\u201D","\\u2019","\\xBB","\\u203A","\\u2026"]),VC=new Set([":",".","\\u060C","\\u061B"]),$C=new Set(["\\u104F"]),zC=new Set(["\\u201D","\\u2019","\\xBB","\\u203A","\\u300D","\\u300F","\\u3011","\\u300B","\\u3009","\\u3015","\\uFF09"]);function qC(e){if(Lu(e))return!0;let t=!1;for(let n of e){if(Qt.has(n)){t=!0;continue}if(!(t&&aa.test(n)))return!1}return t}function jC(e){for(let t of e)if(!la.has(t)&&!Qt.has(t))return!1;return e.length>0}function KC(e){if(Lu(e))return!0;for(let t of e)if(!Ei.has(t)&&!Nu.has(t)&&!aa.test(t))return!1;return e.length>0}function Lu(e){let t=!1;for(let n of e)if(!(n==="\\\\"||aa.test(n))){if(Ei.has(n)||Qt.has(n)||Nu.has(n)){t=!0;continue}return!1}return t}function Jg(e,t){let n=t-1;if(n<=0)return Math.max(n,0);let r=e.charCodeAt(n);if(r<56320||r>57343)return n;let i=n-1;if(i<0)return n;let o=e.charCodeAt(i);return o>=55296&&o<=56319?i:n}function ua(e){if(e.length===0)return null;let t=Jg(e,e.length);return e.slice(t)}function XC(e){let t=Array.from(e),n=t.length;for(;n>0;){let r=t[n-1];if(aa.test(r)){n--;continue}if(Ei.has(r)||Nu.has(r)){n--;continue}break}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function YC(e,t,n){return n==="text"&&!t&&e.length===1&&e!=="-"&&e!=="\\u2014"?e:null}function zg(e,t,n,r){let i=t[r],o=e[r];if(i==null)return o;let a=n[r];if(o.length===a)return o;let l=i.repeat(a);return e[r]=l,l}function qg(e,t){return e&&t!==null&&VC.has(t)}function JC(e){let t=ua(e);return t!==null&&$C.has(t)}function QC(e){if(e.length<2||e[0]!==" ")return null;let t=e.slice(1);return/^\\p{M}+$/u.test(t)?{space:" ",marks:t}:null}function ca(e){let t=e.length;for(;t>0;){let n=Jg(e,t),r=e.slice(n,t);if(zC.has(r))return!0;if(!Qt.has(r))return!1;t=n}return!1}function ZC(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===" ")return"preserved-space";if(e===" ")return"tab";if(t.preserveHardBreaks&&e===`\n`)return"hard-break"}return e===" "?"space":e==="\\xA0"||e==="\\u202F"||e==="\\u2060"||e==="\\uFEFF"?"glue":e==="\\u200B"?"zero-width-break":e==="\\xAD"?"soft-hyphen":"text"}var eT=/[\\x20\\t\\n\\xA0\\xAD\\u200B\\u202F\\u2060\\uFEFF]/;function et(e){return e.length===1?e[0]:e.join("")}function tT(e,t){let n=[];for(let r=e.length-1;r>=0;r--)n.push(e[r]);return n.push(t),et(n)}function nT(e,t,n,r){if(!eT.test(e))return[{text:e,isWordLike:t,kind:"text",start:n}];let i=[],o=null,a=[],l=n,s=!1,u=0;for(let d of e){let m=ZC(d,r),f=m==="text"&&t;if(o!==null&&m===o&&f===s){a.push(d),u+=d.length;continue}o!==null&&i.push({text:et(a),isWordLike:s,kind:o,start:l}),o=m,a=[d],l=n+u,s=f,u+=d.length}return o!==null&&i.push({text:et(a),isWordLike:s,kind:o,start:l}),i}function Mu(e){return e==="space"||e==="preserved-space"||e==="zero-width-break"||e==="hard-break"}var rT=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function iT(e,t){let n=e.texts[t];return n.startsWith("www.")?!0:rT.test(n)&&t+1<e.len&&e.kinds[t+1]==="text"&&e.texts[t+1]==="//"}function oT(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}function aT(e){let t=e.texts.slice(),n=e.isWordLike.slice(),r=e.kinds.slice(),i=e.starts.slice();for(let a=0;a<e.len;a++){if(r[a]!=="text"||!iT(e,a))continue;let l=[t[a]],s=a+1;for(;s<e.len&&!Mu(r[s]);){l.push(t[s]),n[a]=!0;let u=t[s].includes("?");if(r[s]="text",t[s]="",s++,u)break}t[a]=et(l)}let o=0;for(let a=0;a<t.length;a++){let l=t[a];l.length!==0&&(o!==a&&(t[o]=l,n[o]=n[a],r[o]=r[a],i[o]=i[a]),o++)}return t.length=o,n.length=o,r.length=o,i.length=o,{len:o,texts:t,isWordLike:n,kinds:r,starts:i}}function sT(e){let t=[],n=[],r=[],i=[];for(let o=0;o<e.len;o++){let a=e.texts[o];if(t.push(a),n.push(e.isWordLike[o]),r.push(e.kinds[o]),i.push(e.starts[o]),!oT(a))continue;let l=o+1;if(l>=e.len||Mu(e.kinds[l]))continue;let s=[],u=e.starts[l],d=l;for(;d<e.len&&!Mu(e.kinds[d]);)s.push(e.texts[d]),d++;s.length>0&&(t.push(et(s)),n.push(!0),r.push("text"),i.push(u),o=d-1)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}var lT=new Set([":","-","/","\\xD7",",",".","+","\\u2013","\\u2014"]),jg=/^[A-Za-z0-9_]+[,:;]*$/,Kg=/[,:;]+$/;function Qg(e){for(let t of e)if(Yg.test(t))return!0;return!1}function vi(e){if(e.length===0)return!1;for(let t of e)if(!(Yg.test(t)||lT.has(t)))return!1;return!0}function uT(e){let t=[],n=[],r=[],i=[];for(let o=0;o<e.len;o++){let a=e.texts[o],l=e.kinds[o];if(l==="text"&&vi(a)&&Qg(a)){let s=[a],u=o+1;for(;u<e.len&&e.kinds[u]==="text"&&vi(e.texts[u]);)s.push(e.texts[u]),u++;t.push(et(s)),n.push(!0),r.push("text"),i.push(e.starts[o]),o=u-1;continue}t.push(a),n.push(e.isWordLike[o]),r.push(l),i.push(e.starts[o])}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function cT(e){let t=[],n=[],r=[],i=[];for(let o=0;o<e.len;o++){let a=e.texts[o],l=e.kinds[o],s=e.isWordLike[o];if(l==="text"&&s&&jg.test(a)){let u=[a],d=Kg.test(a),m=o+1;for(;d&&m<e.len&&e.kinds[m]==="text"&&e.isWordLike[m]&&jg.test(e.texts[m]);){let f=e.texts[m];u.push(f),d=Kg.test(f),m++}t.push(et(u)),n.push(!0),r.push("text"),i.push(e.starts[o]),o=m-1;continue}t.push(a),n.push(s),r.push(l),i.push(e.starts[o])}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function dT(e){let t=[],n=[],r=[],i=[];for(let o=0;o<e.len;o++){let a=e.texts[o];if(e.kinds[o]==="text"&&a.includes("-")){let l=a.split("-"),s=l.length>1;for(let u=0;u<l.length;u++){let d=l[u];if(!s)break;(d.length===0||!Qg(d)||!vi(d))&&(s=!1)}if(s){let u=0;for(let d=0;d<l.length;d++){let m=l[d],f=d<l.length-1?`${m}-`:m;t.push(f),n.push(!0),r.push("text"),i.push(e.starts[o]+u),u+=f.length}continue}}t.push(a),n.push(e.isWordLike[o]),r.push(e.kinds[o]),i.push(e.starts[o])}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function fT(e){let t=[],n=[],r=[],i=[],o=0;for(;o<e.len;){let a=[e.texts[o]],l=e.isWordLike[o],s=e.kinds[o],u=e.starts[o];if(s==="glue"){let d=[a[0]],m=u;for(o++;o<e.len&&e.kinds[o]==="glue";)d.push(e.texts[o]),o++;let f=et(d);if(o<e.len&&e.kinds[o]==="text")a[0]=f,a.push(e.texts[o]),l=e.isWordLike[o],s="text",u=m,o++;else{t.push(f),n.push(!1),r.push("glue"),i.push(m);continue}}else o++;if(s==="text")for(;o<e.len&&e.kinds[o]==="glue";){let d=[];for(;o<e.len&&e.kinds[o]==="glue";)d.push(e.texts[o]),o++;let m=et(d);if(o<e.len&&e.kinds[o]==="text"){a.push(m,e.texts[o]),l=l||e.isWordLike[o],o++;continue}a.push(m)}t.push(et(a)),n.push(l),r.push(s),i.push(u)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function mT(e){let t=e.texts.slice(),n=e.isWordLike.slice(),r=e.kinds.slice(),i=e.starts.slice();for(let o=0;o<t.length-1;o++){if(r[o]!=="text"||r[o+1]!=="text"||!st(t[o])||!st(t[o+1]))continue;let a=XC(t[o]);a!==null&&(t[o]=a.head,t[o+1]=a.tail+t[o+1],i[o+1]=i[o]+a.head.length)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function Xg(e,t,n){let r=OC(),i=0,o=[],a=[],l=[],s=[],u=[],d=[],m=[],f=[],b=[],p=[],y=[],x=[];for(let F of r.segment(e))for(let O of nT(F.segment,F.isWordLike??!1,F.index,n)){let H=function(){d[A]!==null&&(a[A]=[zg(o,d,m,A)],d[A]=null),a[A].push(O.text),l[A]=l[A]||O.isWordLike,f[A]=f[A]||R,b[A]=b[A]||U,p[A]=Y,y[A]=N,x[A]=qg(b[A],j)},T=O.kind==="text",M=YC(O.text,O.isWordLike,O.kind),R=st(O.text),U=Vg(O.text),j=ua(O.text),Y=ca(O.text),N=JC(O.text),A=i-1;t.carryCJKAfterClosingQuote&&T&&i>0&&s[A]==="text"&&R&&f[A]&&p[A]||T&&i>0&&s[A]==="text"&&jC(O.text)&&f[A]||T&&i>0&&s[A]==="text"&&y[A]?H():T&&i>0&&s[A]==="text"&&O.isWordLike&&U&&x[A]?(H(),l[A]=!0):M!==null&&i>0&&s[A]==="text"&&d[A]===M?m[A]=(m[A]??1)+1:T&&!O.isWordLike&&i>0&&s[A]==="text"&&(qC(O.text)||O.text==="-"&&l[A])?H():(o[i]=O.text,a[i]=[O.text],l[i]=O.isWordLike,s[i]=O.kind,u[i]=O.start,d[i]=M,m[i]=M===null?0:1,f[i]=R,b[i]=U,p[i]=Y,y[i]=N,x[i]=qg(U,j),i++)}for(let F=0;F<i;F++){if(d[F]!==null){o[F]=zg(o,d,m,F);continue}o[F]=et(a[F])}for(let F=1;F<i;F++)s[F]==="text"&&!l[F]&&Lu(o[F])&&s[F-1]==="text"&&(o[F-1]+=o[F],l[F-1]=l[F-1]||l[F],o[F]="");let v=Array.from({length:i},()=>null),_=-1;for(let F=i-1;F>=0;F--){let O=o[F];if(O.length!==0){if(s[F]==="text"&&!l[F]&&KC(O)&&_>=0&&s[_]==="text"){let T=v[_]??[];T.push(O),v[_]=T,u[_]=u[F],o[F]="";continue}_=F}}for(let F=0;F<i;F++){let O=v[F];O!=null&&(o[F]=tT(O,o[F]))}let w=0;for(let F=0;F<i;F++){let O=o[F];O.length!==0&&(w!==F&&(o[w]=O,l[w]=l[F],s[w]=s[F],u[w]=u[F]),w++)}o.length=w,l.length=w,s.length=w,u.length=w;let I=fT({len:w,texts:o,isWordLike:l,kinds:s,starts:u}),D=mT(cT(dT(uT(sT(aT(I))))));for(let F=0;F<D.len-1;F++){let O=QC(D.texts[F]);O!==null&&(D.kinds[F]!=="space"&&D.kinds[F]!=="preserved-space"||D.kinds[F+1]!=="text"||!Vg(D.texts[F+1])||(D.texts[F]=O.space,D.isWordLike[F]=!1,D.kinds[F]=D.kinds[F]==="preserved-space"?"preserved-space":"space",D.texts[F+1]=O.marks+D.texts[F+1],D.starts[F+1]=D.starts[F]+O.space.length))}return D}function pT(e,t){if(e.len===0)return[];if(!t.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];let n=[],r=0;for(let i=0;i<e.len;i++)e.kinds[i]==="hard-break"&&(n.push({startSegmentIndex:r,endSegmentIndex:i,consumedEndSegmentIndex:i+1}),r=i+1);return r<e.len&&n.push({startSegmentIndex:r,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),n}function hT(e){if(e.len<=1)return e;let t=[],n=[],r=[],i=[],o=null,a=!1,l=0,s=!1,u=!1;function d(){o!==null&&(t.push(et(o)),n.push(a),r.push("text"),i.push(l),o=null)}for(let m=0;m<e.len;m++){let f=e.texts[m],b=e.kinds[m],p=e.isWordLike[m],y=e.starts[m];if(b==="text"){let x=UC(f),v=sa(f);if(o!==null&&s&&u){o.push(f),a=a||p,s=s||x,u=v;continue}d(),o=[f],a=p,l=y,s=x,u=v;continue}d(),t.push(f),n.push(p),r.push(b),i.push(y)}return d(),{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function Zg(e,t,n="normal",r="normal"){let i=FC(n),o=i.mode==="pre-wrap"?IC(e):DC(e);if(o.length===0)return{normalized:o,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};let a=r==="keep-all"?hT(Xg(o,t,i)):Xg(o,t,i);return{normalized:o,chunks:pT(a,i),...a}}var tr=null,eb=new Map,nr=null,gT=96,bT=/\\p{Emoji_Presentation}/u,xT=/[\\p{Emoji_Presentation}\\p{Extended_Pictographic}\\p{Regional_Indicator}\\uFE0F\\u20E3]/u,Fu=null,tb=new Map;function Du(){if(tr!==null)return tr;if(typeof OffscreenCanvas<"u")return tr=new OffscreenCanvas(1,1).getContext("2d"),tr;if(typeof document<"u")return tr=document.createElement("canvas").getContext("2d"),tr;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function yT(e){let t=eb.get(e);return t||(t=new Map,eb.set(e,t)),t}function Ft(e,t){let n=t.get(e);return n===void 0&&(n={width:Du().measureText(e).width,containsCJK:st(e)},t.set(e,n)),n}function en(){if(nr!==null)return nr;if(typeof navigator>"u")return nr={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},nr;let e=navigator.userAgent,n=navigator.vendor==="Apple Computer, Inc."&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/"),r=e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/");return nr={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:r,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},nr}function ST(e){let t=e.match(/(\\d+(?:\\.\\d+)?)\\s*px/);return t?parseFloat(t[1]):16}function nb(){return Fu===null&&(Fu=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Fu}function vT(e){return bT.test(e)||e.includes("\\uFE0F")}function rb(e){return xT.test(e)}function ET(e,t){let n=tb.get(e);if(n!==void 0)return n;let r=Du();r.font=e;let i=r.measureText("\\u{1F600}").width;if(n=0,i>t+.5&&typeof document<"u"&&document.body!==null){let o=document.createElement("span");o.style.font=e,o.style.display="inline-block",o.style.visibility="hidden",o.style.position="absolute",o.textContent="\\u{1F600}",document.body.appendChild(o);let a=o.getBoundingClientRect().width;document.body.removeChild(o),i-a>.5&&(n=i-a)}return tb.set(e,n),n}function AT(e){let t=0,n=nb();for(let r of n.segment(e))vT(r.segment)&&t++;return t}function _T(e,t){return t.emojiCount===void 0&&(t.emojiCount=AT(e)),t.emojiCount}function Zt(e,t,n){return n===0?t.width:t.width-_T(e,t)*n}function ib(e,t,n,r,i){if(t.breakableFitAdvances!==void 0)return t.breakableFitAdvances;let o=nb(),a=[];for(let d of o.segment(e))a.push(d.segment);if(a.length<=1)return t.breakableFitAdvances=null,t.breakableFitAdvances;if(i==="sum-graphemes"){let d=[];for(let m of a){let f=Ft(m,n);d.push(Zt(m,f,r))}return t.breakableFitAdvances=d,t.breakableFitAdvances}if(i==="pair-context"||a.length>gT){let d=[],m=null,f=0;for(let b of a){let p=Ft(b,n),y=Zt(b,p,r);if(m===null)d.push(y);else{let x=m+b,v=Ft(x,n);d.push(Zt(x,v,r)-f)}m=b,f=y}return t.breakableFitAdvances=d,t.breakableFitAdvances}let l=[],s="",u=0;for(let d of a){s+=d;let m=Ft(s,n),f=Zt(s,m,r);l.push(f-u),u=f}return t.breakableFitAdvances=l,t.breakableFitAdvances}function ob(e,t){let n=Du();n.font=e;let r=yT(e),i=ST(e),o=t?ET(e,i):0;return{cache:r,fontSize:i,emojiCorrection:o}}function wT(e,t){for(;t<e.widths.length;){let n=e.kinds[t];if(n!=="space"&&n!=="zero-width-break"&&n!=="soft-hyphen")break;t++}return t}function ab(e,t){if(t<=0)return 0;let n=e%t;return Math.abs(n)<=1e-6?t:t-n}function sb(e,t,n,r,i){let o=0,a=t;for(;o<e.length;){let l=a+e[o];if((o+1<e.length?l+i:l)>n+r)break;a=l,o++}return{fitCount:o,fittedWidth:a}}function CT(e,t){let n=0,r=e.chunks.length;for(;n<r;){let i=Math.floor((n+r)/2);t<e.chunks[i].consumedEndSegmentIndex?r=i:n=i+1}return n<e.chunks.length?n:-1}function lb(e,t,n){let r=n.segmentIndex;if(n.graphemeIndex>0)return t;let i=e.chunks[t];if(i.startSegmentIndex===i.endSegmentIndex&&r===i.startSegmentIndex)return n.segmentIndex=r,n.graphemeIndex=0,t;for(r<i.startSegmentIndex&&(r=i.startSegmentIndex);r<i.endSegmentIndex;){let o=e.kinds[r];if(o!=="space"&&o!=="zero-width-break"&&o!=="soft-hyphen")return n.segmentIndex=r,n.graphemeIndex=0,t;r++}return i.consumedEndSegmentIndex>=e.widths.length?-1:(n.segmentIndex=i.consumedEndSegmentIndex,n.graphemeIndex=0,t+1)}function ub(e,t){if(t.segmentIndex>=e.widths.length)return-1;let n=CT(e,t.segmentIndex);return n<0?-1:lb(e,n,t)}function TT(e,t,n){if(n.segmentIndex>=e.widths.length)return-1;let r=t;for(;r<e.chunks.length&&n.segmentIndex>=e.chunks[r].consumedEndSegmentIndex;)r++;return r>=e.chunks.length?-1:lb(e,r,n)}function cb(e,t){return e.simpleLineWalkFastPath?db(e,t):Iu(e,t)}function db(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:o}=e;if(r.length===0)return 0;let l=en().lineFitEpsilon,s=t+l,u=0,d=0,m=!1,f=0,b=0,p=0,y=0,x=-1,v=0;function _(){x=-1,v=0}function w(M=p,R=y,U=d){u++,n?.({startSegmentIndex:f,startGraphemeIndex:b,endSegmentIndex:M,endGraphemeIndex:R,width:U}),d=0,m=!1,_()}function I(M,R){m=!0,f=M,b=0,p=M+1,y=0,d=R}function D(M,R,U){m=!0,f=M,b=R,p=M,y=R+1,d=U}function F(M,R){if(!m){I(M,R);return}d+=R,p=M+1,y=0}function O(M,R){let U=o[M];for(let j=R;j<U.length;j++){let Y=U[j];m?d+Y>s?(w(),D(M,j,Y)):(d+=Y,p=M,y=j+1):D(M,j,Y)}m&&p===M&&y===U.length&&(p=M+1,y=0)}let T=0;for(;T<r.length&&!(!m&&(T=wT(e,T),T>=r.length));){let M=r[T],R=i[T],U=R==="space"||R==="preserved-space"||R==="tab"||R==="zero-width-break"||R==="soft-hyphen";if(!m){M>t&&o[T]!==null?O(T,0):I(T,M),U&&(x=T+1,v=d-M),T++;continue}if(d+M>s){if(U){F(T,M),w(T+1,0,d-M),T++;continue}if(x>=0){if(p>x||p===x&&y>0){w();continue}w(x,0,v);continue}if(M>t&&o[T]!==null){w(),O(T,0),T++;continue}w();continue}F(T,M),U&&(x=T+1,v=d-M),T++}return m&&w(),u}function Iu(e,t,n){if(e.simpleLineWalkFastPath)return db(e,t,n);let{widths:r,lineEndFitAdvances:i,lineEndPaintAdvances:o,kinds:a,breakableFitAdvances:l,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:d}=e;if(r.length===0||d.length===0)return 0;let m=en(),f=m.lineFitEpsilon,b=t+f,p=0,y=0,x=!1,v=0,_=0,w=0,I=0,D=-1,F=0,O=0,T=null;function M(){D=-1,F=0,O=0,T=null}function R(B=w,q=I,$=y){p++,n?.({startSegmentIndex:v,startGraphemeIndex:_,endSegmentIndex:B,endGraphemeIndex:q,width:$}),y=0,x=!1,M()}function U(B,q){x=!0,v=B,_=0,w=B+1,I=0,y=q}function j(B,q,$){x=!0,v=B,_=q,w=B,I=q+1,y=$}function Y(B,q){if(!x){U(B,q);return}y+=q,w=B+1,I=0}function N(B,q,$,K){if(!q)return;let X=B==="tab"?0:i[$],G=B==="tab"?K:o[$];D=$+1,F=y-K+X,O=y-K+G,T=B}function A(B,q){let $=l[B];for(let K=q;K<$.length;K++){let X=$[K];x?y+X>b?(R(),j(B,K,X)):(y+=X,w=B,I=K+1):j(B,K,X)}x&&w===B&&I===$.length&&(w=B+1,I=0)}function H(B){if(T!=="soft-hyphen")return!1;let q=l[B];if(q==null)return!1;let{fitCount:$,fittedWidth:K}=sb(q,y,t,f,s);return $===0?!1:(y=K,w=B,I=$,M(),$===q.length?(w=B+1,I=0,!0):(R(B,$,K+s),A(B,$),!0))}function J(B){p++,n?.({startSegmentIndex:B.startSegmentIndex,startGraphemeIndex:0,endSegmentIndex:B.consumedEndSegmentIndex,endGraphemeIndex:0,width:0}),M()}for(let B=0;B<d.length;B++){let q=d[B];if(q.startSegmentIndex===q.endSegmentIndex){J(q);continue}x=!1,y=0,v=q.startSegmentIndex,_=0,w=q.startSegmentIndex,I=0,M();let $=q.startSegmentIndex;for(;$<q.endSegmentIndex;){let K=a[$],X=K==="space"||K==="preserved-space"||K==="tab"||K==="zero-width-break"||K==="soft-hyphen",G=K==="tab"?ab(y,u):r[$];if(K==="soft-hyphen"){x&&(w=$+1,I=0,D=$+1,F=y+s,O=y+s,T=K),$++;continue}if(!x){G>t&&l[$]!==null?A($,0):U($,G),N(K,X,$,G),$++;continue}if(y+G>b){let Z=y+(K==="tab"?0:i[$]),ce=y+(K==="tab"?G:o[$]);if(T==="soft-hyphen"&&m.preferEarlySoftHyphenBreak&&F<=b){R(D,0,O);continue}if(T==="soft-hyphen"&&H($)){$++;continue}if(X&&Z<=b){Y($,G),R($+1,0,ce),$++;continue}if(D>=0&&F<=b){if(w>D||w===D&&I>0){R();continue}let ae=D;R(ae,0,O),$=ae;continue}if(G>t&&l[$]!==null){R(),A($,0),$++;continue}R();continue}Y($,G),N(K,X,$,G),$++}if(x){let K=D===q.consumedEndSegmentIndex?O:y;R(q.consumedEndSegmentIndex,0,K)}}return p}function fb(e,t,n,r){let i=e.chunks[n];if(i.startSegmentIndex===i.endSegmentIndex)return t.segmentIndex=i.consumedEndSegmentIndex,t.graphemeIndex=0,0;let{widths:o,lineEndFitAdvances:a,lineEndPaintAdvances:l,kinds:s,breakableFitAdvances:u,discretionaryHyphenWidth:d,tabStopAdvance:m}=e,f=en(),b=f.lineFitEpsilon,p=r+b,y=0,x=!1,v=t.segmentIndex,_=t.graphemeIndex,w=-1,I=0,D=0,F=null;function O(){w=-1,I=0,D=0,F=null}function T(A=v,H=_,J=y){return x?(t.segmentIndex=A,t.graphemeIndex=H,J):null}function M(A,H){x=!0,v=A+1,_=0,y=H}function R(A,H,J){x=!0,v=A,_=H+1,y=J}function U(A,H){if(!x){M(A,H);return}y+=H,v=A+1,_=0}function j(A,H,J,B){if(!H)return;let q=A==="tab"?0:a[J],$=A==="tab"?B:l[J];w=J+1,I=y-B+q,D=y-B+$,F=A}function Y(A,H){let J=u[A];for(let B=H;B<J.length;B++){let q=J[B];if(!x)R(A,B,q);else{if(y+q>p)return T();y+=q,v=A,_=B+1}}return x&&v===A&&_===J.length&&(v=A+1,_=0),null}function N(A){if(F!=="soft-hyphen"||w<0)return null;let H=u[A]??null;if(H!==null){let{fitCount:J,fittedWidth:B}=sb(H,y,r,b,d);if(J===H.length)return y=B,v=A+1,_=0,O(),null;if(J>0)return T(A,J,B+d)}return I<=p?T(w,0,D):null}for(let A=t.segmentIndex;A<i.endSegmentIndex;A++){let H=s[A],J=H==="space"||H==="preserved-space"||H==="tab"||H==="zero-width-break"||H==="soft-hyphen",B=A===t.segmentIndex?t.graphemeIndex:0,q=H==="tab"?ab(y,m):o[A];if(H==="soft-hyphen"&&B===0){x&&(v=A+1,_=0,w=A+1,I=y+d,D=y+d,F=H);continue}if(!x){if(B>0){let K=Y(A,B);if(K!==null)return K}else if(q>r&&u[A]!==null){let K=Y(A,0);if(K!==null)return K}else M(A,q);j(H,J,A,q);continue}if(y+q>p){let K=y+(H==="tab"?0:a[A]),X=y+(H==="tab"?q:l[A]);if(F==="soft-hyphen"&&f.preferEarlySoftHyphenBreak&&I<=p)return T(w,0,D);let G=N(A);if(G!==null)return G;if(J&&K<=p)return U(A,q),T(A+1,0,X);if(w>=0&&I<=p)return v>w||v===w&&_>0?T():T(w,0,D);if(q>r&&u[A]!==null){let V=T();if(V!==null)return V;let Z=Y(A,0);if(Z!==null)return Z}return T()}U(A,q),j(H,J,A,q)}return w===i.consumedEndSegmentIndex&&_===0?T(i.consumedEndSegmentIndex,0,D):T(i.consumedEndSegmentIndex,0,y)}function RT(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:o}=e,l=en().lineFitEpsilon,s=n+l,u=0,d=!1,m=t.segmentIndex,f=t.graphemeIndex,b=-1,p=0;for(let y=t.segmentIndex;y<r.length;y++){let x=r[y],v=i[y],_=v==="space"||v==="preserved-space"||v==="tab"||v==="zero-width-break"||v==="soft-hyphen",w=y===t.segmentIndex?t.graphemeIndex:0,I=o[y];if(!d){if(w>0||x>n&&I!==null){let D=I,F=D[w];d=!0,u=F,m=y,f=w+1;for(let O=w+1;O<D.length;O++){let T=D[O];if(u+T>s)return t.segmentIndex=m,t.graphemeIndex=f,u;u+=T,m=y,f=O+1}m===y&&f===D.length&&(m=y+1,f=0)}else d=!0,u=x,m=y+1,f=0;_&&(b=y+1,p=u-x);continue}if(u+x>s)return _?(t.segmentIndex=y+1,t.graphemeIndex=0,u):b>=0?m>b||m===b&&f>0?(t.segmentIndex=m,t.graphemeIndex=f,u):(t.segmentIndex=b,t.graphemeIndex=0,p):(t.segmentIndex=m,t.graphemeIndex=f,u);u+=x,m=y+1,f=0,_&&(b=y+1,p=u-x)}return d?(t.segmentIndex=m,t.graphemeIndex=f,u):null}function kT(e,t,n){let r=ub(e,t);return r<0?null:e.simpleLineWalkFastPath?RT(e,t,n):fb(e,t,r,n)}function mb(e,t){if(e.widths.length===0)return{lineCount:0,maxLineWidth:0};let n={segmentIndex:0,graphemeIndex:0},r=0,i=0;if(!e.simpleLineWalkFastPath){let o=ub(e,n);for(;o>=0;){let a=fb(e,n,o,t);if(a===null)return{lineCount:r,maxLineWidth:i};r++,a>i&&(i=a),o=TT(e,o,n)}return{lineCount:r,maxLineWidth:i}}for(;;){let o=kT(e,n,t);if(o===null)return{lineCount:r,maxLineWidth:i};r++,o>i&&(i=o)}}var Pu=null;function MT(){return Pu===null&&(Pu=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Pu}function NT(e){return e?{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[],segments:[]}:{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]}}function LT(e,t){let n=[],r=[],i=0,o=!1,a=!1,l=!1;function s(){r.length!==0&&(n.push({text:r.length===1?r[0]:r.join(""),start:i}),r=[],o=!1,a=!1,l=!1)}function u(m,f,b){r=[m],i=f,o=b,a=ca(m),l=Ei.has(m)}function d(m,f){r.push(m),o=o||f;let b=ca(m);m.length===1&&Qt.has(m)?a=a||b:a=b,l=!1}for(let m of MT().segment(e)){let f=m.segment,b=st(f);if(r.length===0){u(f,m.index,b);continue}if(l||la.has(f)||Qt.has(f)||t.carryCJKAfterClosingQuote&&b&&a){d(f,b);continue}if(!o&&!b){d(f,b);continue}s(),u(f,m.index,b)}return s(),n}function FT(e){if(e.length<=1)return e;let t=[],n=[e[0].text],r=e[0].start,i=st(e[0].text),o=sa(e[0].text);function a(){t.push({text:n.length===1?n[0]:n.join(""),start:r})}for(let l=1;l<e.length;l++){let s=e[l],u=st(s.text),d=sa(s.text);if(i&&o){n.push(s.text),i=i||u,o=d;continue}a(),n=[s.text],r=s.start,i=u,o=d}return a(),t}function DT(e,t,n,r){let i=en(),{cache:o,emojiCorrection:a}=ob(t,rb(e.normalized)),l=Zt("-",Ft("-",o),a),u=Zt(" ",Ft(" ",o),a)*8;if(e.len===0)return NT(n);let d=[],m=[],f=[],b=[],p=e.chunks.length<=1,y=n?[]:null,x=[],v=n?[]:null,_=Array.from({length:e.len});function w(O,T,M,R,U,j,Y){U!=="text"&&U!=="space"&&U!=="zero-width-break"&&(p=!1),d.push(T),m.push(M),f.push(R),b.push(U),y?.push(j),x.push(Y),v!==null&&v.push(O)}function I(O,T,M,R,U){let j=Ft(O,o),Y=Zt(O,j,a),N=T==="space"||T==="preserved-space"||T==="zero-width-break"?0:Y,A=T==="space"||T==="zero-width-break"?0:Y;if(U&&R&&O.length>1){let H="sum-graphemes";vi(O)?H="pair-context":i.preferPrefixWidthsForBreakableRuns&&(H="segment-prefixes");let J=ib(O,j,o,a,H);w(O,Y,N,A,T,M,J);return}w(O,Y,N,A,T,M,null)}for(let O=0;O<e.len;O++){_[O]=d.length;let T=e.texts[O],M=e.isWordLike[O],R=e.kinds[O],U=e.starts[O];if(R==="soft-hyphen"){w(T,0,l,l,R,U,null);continue}if(R==="hard-break"){w(T,0,0,0,R,U,null);continue}if(R==="tab"){w(T,0,0,0,R,U,null);continue}let j=Ft(T,o);if(R==="text"&&j.containsCJK){let Y=LT(T,i),N=r==="keep-all"?FT(Y):Y;for(let A=0;A<N.length;A++){let H=N[A];I(H.text,"text",U+H.start,M,r==="keep-all"||!st(H.text))}continue}I(T,R,U,M,!0)}let D=IT(e.chunks,_,d.length),F=y===null?null:Wg(e.normalized,y);return v!==null?{widths:d,lineEndFitAdvances:m,lineEndPaintAdvances:f,kinds:b,simpleLineWalkFastPath:p,segLevels:F,breakableFitAdvances:x,discretionaryHyphenWidth:l,tabStopAdvance:u,chunks:D,segments:v}:{widths:d,lineEndFitAdvances:m,lineEndPaintAdvances:f,kinds:b,simpleLineWalkFastPath:p,segLevels:F,breakableFitAdvances:x,discretionaryHyphenWidth:l,tabStopAdvance:u,chunks:D}}function IT(e,t,n){let r=[];for(let i=0;i<e.length;i++){let o=e[i],a=o.startSegmentIndex<t.length?t[o.startSegmentIndex]:n,l=o.endSegmentIndex<t.length?t[o.endSegmentIndex]:n,s=o.consumedEndSegmentIndex<t.length?t[o.consumedEndSegmentIndex]:n;r.push({startSegmentIndex:a,endSegmentIndex:l,consumedEndSegmentIndex:s})}return r}function pb(e,t,n,r){let i=r?.wordBreak??"normal",o=Zg(e,en(),r?.whiteSpace,i);return DT(o,t,n,i)}function da(e,t,n){return pb(e,t,!1,n)}function hb(e,t,n){return pb(e,t,!0,n)}function fa(e,t,n){let r=cb(e,t);return{lineCount:r,height:r*n}}function PT(e){return{width:e.width,start:{segmentIndex:e.startSegmentIndex,graphemeIndex:e.startGraphemeIndex},end:{segmentIndex:e.endSegmentIndex,graphemeIndex:e.endGraphemeIndex}}}function OT(e,t,n){return e.widths.length===0?0:Iu(e,t,r=>{n(PT(r))})}function gb(e,t){return mb(e,t)}function bb(e){let t=0;return OT(e,Number.POSITIVE_INFINITY,n=>{n.width>t&&(t=n.width)}),t}var HT={maxWidth:1600,baseFontSize:78,minFontSize:42,fontWeight:900,fontFamily:"Outfit",step:2};function xb(e,t){let n={...HT,...t},r=1.2;for(let i=n.baseFontSize;i>=n.minFontSize;i-=n.step){let o=`${n.fontWeight} ${i}px ${n.fontFamily}`,a=da(e,o),{lineCount:l}=fa(a,n.maxWidth,i*r);if(l<=1)return{fontSize:i,fits:!0}}return{fontSize:n.minFontSize,fits:!1}}var yb={prepare:da,layout:fa,prepareWithSegments:hb,measureLineStats:gb,measureNaturalWidth:bb};function Sb(e){return new URL(e,document.baseURI).href}window.__timelines=window.__timelines||{};Kh();Gg();Jc();window.__hyperframes={assetUrl:Sb,fitTextFontSize:xb,getVariables:nd,pretext:yb,registerRuntimeDataHandler:Dg,setRuntimeData:ra,clearRuntimeData:ia};function vb(){let e=window;e.__hyperframeRuntimeBootstrapped||(e.__hyperframeRuntimeBootstrapped=!0,Bg())}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",vb,{once:!0}):vb();})();\n';
3225
+ function getHyperframeRuntimeScript() {
3226
+ return RUNTIME_IIFE;
3227
+ }
3228
+
3229
+ // ../core/dist/safePath.js
3230
+ import { resolve, sep, join, dirname, basename, relative, isAbsolute } from "path";
3231
+ import { lstatSync, mkdirSync, realpathSync, statSync } from "fs";
3232
+ function realpath(path) {
3233
+ try {
3234
+ return realpathSync.native(path);
3235
+ } catch (error) {
3236
+ if (error.code === "EISDIR")
3237
+ return realpathSync(path);
3238
+ throw error;
3239
+ }
3240
+ }
3241
+ function isMissingPath(path) {
3242
+ try {
3243
+ lstatSync(path);
3244
+ return false;
3245
+ } catch (error) {
3246
+ return Boolean(error && typeof error === "object" && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"));
3247
+ }
3248
+ }
3249
+ function isSafePath(base, resolved) {
3250
+ let baseReal;
3251
+ try {
3252
+ baseReal = realpath(resolve(base));
3253
+ } catch {
3254
+ return false;
3255
+ }
3256
+ const target = resolve(resolved);
3257
+ const trailing = [];
3258
+ let probe = target;
3259
+ for (; ; ) {
3260
+ let ancestorReal;
3261
+ try {
3262
+ ancestorReal = realpath(probe);
3263
+ } catch {
3264
+ if (!isMissingPath(probe))
3265
+ return false;
3266
+ const parent = dirname(probe);
3267
+ if (parent === probe)
3268
+ return false;
3269
+ trailing.push(basename(probe));
3270
+ probe = parent;
3271
+ continue;
3272
+ }
3273
+ const targetReal = trailing.length ? join(ancestorReal, ...[...trailing].reverse()) : ancestorReal;
3274
+ return targetReal === baseReal || targetReal.startsWith(baseReal + sep);
3275
+ }
3276
+ }
3277
+ function resolveWithinProject(base, relativePath) {
3278
+ const resolved = resolve(base, relativePath);
3279
+ return isSafePath(base, resolved) ? resolved : null;
3280
+ }
3281
+ var ProjectRootMissingError = class extends Error {
3282
+ root;
3283
+ constructor(root) {
3284
+ super(`Project folder not found: ${root}`);
3285
+ this.root = root;
3286
+ this.name = "ProjectRootMissingError";
3287
+ }
3288
+ };
3289
+ var isProjectRootMissing = (error) => error instanceof Error && error.name === "ProjectRootMissingError";
3290
+ function folderGone(dir) {
3291
+ try {
3292
+ return !statSync(dir, { throwIfNoEntry: false });
3293
+ } catch {
3294
+ return false;
3295
+ }
3296
+ }
3297
+ function realProjectRoot(root) {
3298
+ try {
3299
+ return realpath(root);
3300
+ } catch (error) {
3301
+ if (folderGone(root))
3302
+ throw new ProjectRootMissingError(root);
3303
+ throw error;
3304
+ }
3305
+ }
3306
+ function mkdirWithinProject(root, dir) {
3307
+ if (folderGone(root))
3308
+ throw new ProjectRootMissingError(root);
3309
+ const inside = relative(resolve(root), resolve(dir));
3310
+ if (inside === ".." || inside.startsWith(`..${sep}`) || isAbsolute(inside)) {
3311
+ mkdirSync(dir, { recursive: true });
3312
+ return;
3313
+ }
3314
+ let path = resolve(root);
3315
+ for (const part of inside.split(sep).filter(Boolean)) {
3316
+ path = join(path, part);
3317
+ try {
3318
+ mkdirSync(path);
3319
+ } catch (error) {
3320
+ const code = error.code;
3321
+ if (code === "ENOENT" && folderGone(root))
3322
+ throw new ProjectRootMissingError(root);
3323
+ if (code !== "EEXIST")
3324
+ throw error;
3325
+ }
3326
+ }
3327
+ }
3328
+
3329
+ // ../core/dist/runtime/getVariables.js
3330
+ function getVariables() {
3331
+ if (typeof document === "undefined")
3332
+ return {};
3333
+ const declarers = /* @__PURE__ */ new Set();
3334
+ if (document.documentElement?.hasAttribute("data-composition-variables")) {
3335
+ declarers.add(document.documentElement);
3336
+ }
3337
+ for (const el of Array.from(document.querySelectorAll("[data-composition-variables]"))) {
3338
+ declarers.add(el);
3339
+ }
3340
+ const declaredDefaults = {};
3341
+ for (const el of declarers) {
3342
+ Object.assign(declaredDefaults, readDeclaredDefaults(el));
3343
+ }
3344
+ const overrides = readRenderOverrides();
3345
+ const merged = { ...declaredDefaults, ...overrides };
3346
+ for (const el of declarers)
3347
+ warnUnknownEnumValues(el, merged);
3348
+ return merged;
3349
+ }
3350
+ var warnedUnknownEnumValues = /* @__PURE__ */ new Set();
3351
+ function readDeclarations(el) {
3352
+ const raw = el?.getAttribute("data-composition-variables");
3353
+ if (!raw)
3354
+ return [];
3355
+ let parsed;
3356
+ try {
3357
+ parsed = JSON.parse(raw);
3358
+ } catch {
3359
+ return [];
3360
+ }
3361
+ if (!Array.isArray(parsed))
3362
+ return [];
3363
+ return parsed.filter((entry) => !!entry && typeof entry === "object");
3364
+ }
3365
+ function compositionLabel(declarer, compositionId) {
3366
+ return compositionId?.trim() || declarer.getAttribute("data-composition-id")?.trim() || declarer.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")?.trim() || "composition";
3367
+ }
3368
+ function declaredOptions(entry) {
3369
+ if (!Array.isArray(entry.options))
3370
+ return [];
3371
+ return entry.options.map((option) => option && typeof option === "object" ? option.value : option).filter((v) => typeof v === "string" || typeof v === "number");
3372
+ }
3373
+ function unknownEnumValue(entry, resolved) {
3374
+ if (typeof entry.id !== "string")
3375
+ return null;
3376
+ const value = resolved[entry.id];
3377
+ if (value === void 0 || value === null)
3378
+ return null;
3379
+ if ("default" in entry && String(value) === String(entry.default))
3380
+ return null;
3381
+ const allowed = declaredOptions(entry);
3382
+ if (allowed.length === 0 || allowed.some((v) => String(v) === String(value)))
3383
+ return null;
3384
+ return { id: entry.id, value, allowed };
3385
+ }
3386
+ function warnUnknownEnumValues(declarer, resolved, compositionId) {
3387
+ if (!declarer)
3388
+ return;
3389
+ const entries = readDeclarations(declarer);
3390
+ if (entries.length === 0)
3391
+ return;
3392
+ const move = compositionLabel(declarer, compositionId);
3393
+ for (const entry of entries) {
3394
+ const found = unknownEnumValue(entry, resolved);
3395
+ if (!found)
3396
+ continue;
3397
+ const key = `${move}|${found.id}|${String(found.value)}`;
3398
+ if (warnedUnknownEnumValues.has(key))
3399
+ continue;
3400
+ warnedUnknownEnumValues.add(key);
3401
+ const fallback = "default" in entry ? JSON.stringify(entry.default) : "the composition default";
3402
+ console.warn(`[hyperframes] runtime_unknown_enum_value: ${move} variable "${found.id}" got ${JSON.stringify(found.value)}, which is not a declared option (${found.allowed.join(", ")}). Rendering ${fallback} instead.`);
3403
+ }
3404
+ }
3405
+ function readDeclaredDefaults(root) {
3406
+ const out = {};
3407
+ for (const entry of readDeclarations(root)) {
3408
+ if (typeof entry.id !== "string" || !("default" in entry))
3409
+ continue;
3410
+ out[entry.id] = entry.default;
3411
+ }
3412
+ return out;
3413
+ }
3414
+ function parseHostVariableValues(host) {
3415
+ const raw = host.getAttribute("data-variable-values");
3416
+ if (!raw)
3417
+ return {};
3418
+ let parsed;
3419
+ try {
3420
+ parsed = JSON.parse(raw);
3421
+ } catch {
3422
+ return {};
3423
+ }
3424
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
3425
+ return {};
3426
+ return parsed;
3427
+ }
3428
+ function readRenderOverrides() {
3429
+ if (typeof window === "undefined")
3430
+ return {};
3431
+ const raw = window.__hfVariables;
3432
+ if (!raw || typeof raw !== "object" || Array.isArray(raw))
3433
+ return {};
3434
+ return raw;
3435
+ }
3436
+
3437
+ export {
3438
+ resolveTimings,
3439
+ HF_AUDIO_FX_ATTR,
3440
+ normalizeAudioFxParams,
3441
+ parseAudioFxChain,
3442
+ enabledAudioFxNodes,
3443
+ MAX_AUDIO_GAIN_DB,
3444
+ MAX_AUDIO_GAIN,
3445
+ clampAudioGain,
3446
+ formatAudioGain,
3447
+ HF_AUDIO_AUTOMATION_ATTR,
3448
+ VOLUME_TARGET,
3449
+ fxAutomationTarget,
3450
+ resolveAutomation,
3451
+ parseAutomation,
3452
+ serializeAutomation,
3453
+ sampleAutomationLane,
3454
+ shiftRateLane,
3455
+ sourceTimeAt,
3456
+ timeAtSourceTime,
3457
+ isMediaElement,
3458
+ normalizePlaybackRate,
3459
+ parseStrictFiniteTimingNumber,
3460
+ readElementPlaybackRate,
3461
+ normalizeRateSpec,
3462
+ readElementRateSpec,
3463
+ readMediaStart,
3464
+ resolveNaturalMediaTimelineDuration,
3465
+ resolveTimedImageDurationSeconds,
3466
+ resolveNaturalMediaTimelineDurationFromValues,
3467
+ MEDIA_DURATION_CLAMP_EPSILON_SECONDS,
3468
+ shouldClampMediaDuration,
3469
+ shouldClampResolvedMediaDuration,
3470
+ compileTimingAttrs,
3471
+ injectDurations,
3472
+ extractResolvedMedia,
3473
+ clampDurations,
3474
+ MEDIA_RENDER_ID_ATTR,
3475
+ AUDIO_GROUP_RENDER_ID_ATTR,
3476
+ assignMediaRenderIds,
3477
+ RUNTIME_BOOTSTRAP_ATTR,
3478
+ isFullHtmlDocument,
3479
+ parseHTMLContent,
3480
+ stripEmbeddedRuntimeScripts,
3481
+ findStartTags,
3482
+ insertBeforeCloseTag,
3483
+ injectTagsAtHeadStart,
3484
+ injectScriptsAtHeadStart,
3485
+ injectScriptsIntoHtml,
3486
+ queryByAttr,
3487
+ CubeLutParseError,
3488
+ parseCubeLut,
3489
+ HF_COLOR_GRADING_ATTR,
3490
+ COLOR_GRADING_SOURCE_HIDDEN_ATTR,
3491
+ HF_COLOR_GRADING_CANVAS_ID_PREFIX,
3492
+ HF_COLOR_GRADING_COLOR_SPACE,
3493
+ HF_COLOR_GRADING_TOP_LEVEL_KEYS,
3494
+ HF_COLOR_GRADING_LUT_KEYS,
3495
+ HF_COLOR_GRADING_PALETTES,
3496
+ HF_COLOR_GRADING_ADJUST_KEYS,
3497
+ HF_COLOR_GRADING_WHEEL_KEYS,
3498
+ HF_COLOR_GRADING_CURVE_KEYS,
3499
+ HF_COLOR_GRADING_HUE_CURVE_KEYS,
3500
+ HF_COLOR_GRADING_DETAIL_KEYS,
3501
+ HF_COLOR_GRADING_EFFECT_KEYS,
3502
+ HF_COLOR_GRADING_PRESETS,
3503
+ HF_COLOR_GRADING_ACTIVE_EFFECT_KEYS,
3504
+ HF_COLOR_GRADING_EFFECT_PRESETS,
3505
+ HF_COLOR_GRADING_GRADE_PRESETS,
3506
+ HF_COLOR_GRADING_EFFECT_APPLY_DEFAULTS,
3507
+ HF_COLOR_GRADING_ANIMATABLE_PROPERTIES,
3508
+ getHfColorGradingCapabilities,
3509
+ resolveHfColorGradingVariables,
3510
+ normalizeHfColorGrading,
3511
+ normalizeHfColorGradingWithVariables,
3512
+ serializeHfColorGrading,
3513
+ isHfColorGradingActive,
3514
+ hasHfColorGradingAuthoredValues,
3515
+ getHyperframeRuntimeScript,
3516
+ realpath,
3517
+ isSafePath,
3518
+ resolveWithinProject,
3519
+ ProjectRootMissingError,
3520
+ isProjectRootMissing,
3521
+ folderGone,
3522
+ realProjectRoot,
3523
+ mkdirWithinProject,
3524
+ getVariables,
3525
+ warnUnknownEnumValues,
3526
+ readDeclaredDefaults,
3527
+ parseHostVariableValues
3528
+ };